ranui 0.2.1-alpha.1 → 0.2.1-alpha.3

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 (310) hide show
  1. package/dist/abnfDiagram-VRR7QNED-CH_pIv_l.cjs +1 -0
  2. package/dist/abnfDiagram-VRR7QNED-CTsqwzwi.js +95 -0
  3. package/dist/arc-D25LhgTs.cjs +1 -0
  4. package/dist/arc-DRPGof21.js +82 -0
  5. package/dist/architecture-TIHT7OUA-BbBd15_y.cjs +1 -0
  6. package/dist/architecture-TIHT7OUA-pbFO1xSx.js +5 -0
  7. package/dist/architectureDiagram-ZJ3FMSHR-8mjyXr-w.js +4279 -0
  8. package/dist/architectureDiagram-ZJ3FMSHR-D_jWFFZx.cjs +36 -0
  9. package/dist/array-By5736M5.js +7 -0
  10. package/dist/array-C3cbN3GY.cjs +1 -0
  11. package/dist/blockDiagram-677ZJIJ3-3F79MOSt.js +3321 -0
  12. package/dist/blockDiagram-677ZJIJ3-Cx35khWe.cjs +132 -0
  13. package/dist/builder.d.ts +2 -2
  14. package/dist/builder.js +39 -34
  15. package/dist/{builtin-D9djWkCE.js → builtin-BkM0LLof.js} +83 -76
  16. package/dist/button-D0zcnKnG.js +117 -0
  17. package/dist/button.js +1 -1
  18. package/dist/c4Diagram-LMCZKHZV-Cxn_gqu_.js +3064 -0
  19. package/dist/c4Diagram-LMCZKHZV-TRNb3Gvl.cjs +10 -0
  20. package/dist/{card-CqJa4Q_v.js → card-CygMndQS.js} +2 -2
  21. package/dist/card.js +1 -1
  22. package/dist/channel-C9WSNwcS.cjs +1 -0
  23. package/dist/channel-k5-UxdcV.js +5 -0
  24. package/dist/{checkbox-CThC9-vy.js → checkbox-D5om9aJO.js} +10 -10
  25. package/dist/checkbox.js +1 -1
  26. package/dist/chunk-2Q5K7J3B-CTMy5FII.cjs +1 -0
  27. package/dist/chunk-2Q5K7J3B-DlFVJRAn.js +15 -0
  28. package/dist/chunk-32BRIVSS-BXVdG_nV.cjs +1 -0
  29. package/dist/chunk-32BRIVSS-jAuAwMVV.js +68 -0
  30. package/dist/chunk-52WLFC77-BChUrU24.cjs +10 -0
  31. package/dist/chunk-52WLFC77-wpL7en7e.js +630 -0
  32. package/dist/chunk-5VM5RSS4-Cni2Ogq2.js +19 -0
  33. package/dist/chunk-5VM5RSS4-DudUFQ_Z.cjs +15 -0
  34. package/dist/chunk-7BUUIJ7U-9hiBbc7O.js +87 -0
  35. package/dist/chunk-7BUUIJ7U-DMv_UkjI.cjs +1 -0
  36. package/dist/chunk-C7G6YPKG-CA-DNpvI.js +71 -0
  37. package/dist/chunk-C7G6YPKG-CKEeW9TM.cjs +1 -0
  38. package/dist/chunk-EX3LRPZG-BCmf0iDq.js +2137 -0
  39. package/dist/chunk-EX3LRPZG-DbfbNdXo.cjs +231 -0
  40. package/dist/chunk-FWX5IMBZ-D11-gbhc.cjs +1 -0
  41. package/dist/chunk-FWX5IMBZ-DZ5VYvm5.js +60 -0
  42. package/dist/chunk-HOUHSVGY-BGB3dOvI.cjs +1 -0
  43. package/dist/chunk-HOUHSVGY-DRQcQeMT.js +268 -0
  44. package/dist/chunk-ICXQ74PX-BbT9JaEW.cjs +2 -0
  45. package/dist/chunk-ICXQ74PX-DR8rL-xF.js +1377 -0
  46. package/dist/chunk-JWPE2WC7-CGEmUMMZ.js +8 -0
  47. package/dist/chunk-JWPE2WC7-D8EnWK1B.cjs +1 -0
  48. package/dist/chunk-KEIR6QF5-B2Op7cFH.js +22155 -0
  49. package/dist/chunk-KEIR6QF5-C4fcHpY0.cjs +161 -0
  50. package/dist/chunk-MOJQB5TN-BC46HDyu.js +516 -0
  51. package/dist/chunk-MOJQB5TN-oOeq982_.cjs +88 -0
  52. package/dist/chunk-OGEWGWER-BV51ll2w.js +33 -0
  53. package/dist/chunk-OGEWGWER-DX8sW1dT.cjs +1 -0
  54. package/dist/chunk-PUDLZKDR-48YaqVoF.cjs +156 -0
  55. package/dist/chunk-PUDLZKDR-NdMR0Ft5.js +4282 -0
  56. package/dist/chunk-Q4XR5HBZ-3BHjjc9u.js +1709 -0
  57. package/dist/chunk-Q4XR5HBZ-aBnPq509.cjs +70 -0
  58. package/dist/chunk-RYQCIY6F-BER2T9t0.js +246 -0
  59. package/dist/chunk-RYQCIY6F-DVRzSnsI.cjs +1 -0
  60. package/dist/chunk-V7JOEXUC-Cr_hr02u.js +3467 -0
  61. package/dist/chunk-V7JOEXUC-DHizzTla.cjs +206 -0
  62. package/dist/chunk-VAUOI2AC-DfQf5L2_.cjs +1 -0
  63. package/dist/chunk-VAUOI2AC-izt0o4id.js +11 -0
  64. package/dist/chunk-VR4S4FIN-CJi5okl4.js +26 -0
  65. package/dist/chunk-VR4S4FIN-KiwnPF31.cjs +1 -0
  66. package/dist/chunk-WYO6CB5R-DDHkKowO.js +4535 -0
  67. package/dist/chunk-WYO6CB5R-u4mJNOcO.cjs +127 -0
  68. package/dist/chunk-XXDRQBXY-BB1i_53q.js +9 -0
  69. package/dist/chunk-XXDRQBXY-C8VGLZmt.cjs +1 -0
  70. package/dist/chunk-Y2CYZVJY-0JxdZxki.js +13 -0
  71. package/dist/chunk-Y2CYZVJY-DPaYLFFP.cjs +1 -0
  72. package/dist/chunk-ZGVPDNZ5-6uMbTJXy.js +3841 -0
  73. package/dist/chunk-ZGVPDNZ5-Cw5_HJba.cjs +62 -0
  74. package/dist/chunk-ZIRB5QZD-C7OH2FI2.js +1280 -0
  75. package/dist/chunk-ZIRB5QZD-aLu-4ITN.cjs +32 -0
  76. package/dist/classDiagram-OUVF2IWQ-D6rqYIh0.cjs +1 -0
  77. package/dist/classDiagram-OUVF2IWQ-Df0ghim9.js +30 -0
  78. package/dist/classDiagram-v2-EOCWNBFH-D6rqYIh0.cjs +1 -0
  79. package/dist/classDiagram-v2-EOCWNBFH-Df0ghim9.js +30 -0
  80. package/dist/{colorpicker-XNxDRcQ-.js → colorpicker-qWnaTlYX.js} +8 -8
  81. package/dist/colorpicker.js +1 -1
  82. package/dist/components/glass/index.d.ts +52 -0
  83. package/dist/components/icon/core-icons.d.ts +13 -0
  84. package/dist/components/icon/index.d.ts +1 -1
  85. package/dist/components/mermaid/index.d.ts +52 -0
  86. package/dist/components/modal/index.d.ts +9 -0
  87. package/dist/content-Rry-U6ir.js +39 -0
  88. package/dist/content.js +5 -0
  89. package/dist/cose-bilkent-JH36ORCC-BUxFTdey.cjs +1 -0
  90. package/dist/cose-bilkent-JH36ORCC-DTwvJlGw.js +2353 -0
  91. package/dist/cynefin-VYW2F7L2-6c1GOGXW.cjs +1 -0
  92. package/dist/cynefin-VYW2F7L2-ALQKF7N6.js +5 -0
  93. package/dist/cynefinDiagram-TSTJHNR4-Bjt4QTVh.js +355 -0
  94. package/dist/cynefinDiagram-TSTJHNR4-ISDORSxO.cjs +62 -0
  95. package/dist/cytoscape.esm-CFq1_DTa.js +18906 -0
  96. package/dist/cytoscape.esm-pygMw4dR.cjs +321 -0
  97. package/dist/dagre-D1-W1tt6.cjs +1 -0
  98. package/dist/dagre-D8GLTwuf.js +1578 -0
  99. package/dist/dagre-VKFMJZFB-DXI69qAN.cjs +4 -0
  100. package/dist/dagre-VKFMJZFB-Dfku86Az.js +341 -0
  101. package/dist/defaultLocale-0M_kMcEH.js +184 -0
  102. package/dist/defaultLocale-DSqtvhxg.cjs +1 -0
  103. package/dist/diagram-FQU43EPY-BAiRt5eL.cjs +3 -0
  104. package/dist/diagram-FQU43EPY-BvQ5jmVn.js +452 -0
  105. package/dist/diagram-G47NLZAW-DGnmEa8u.cjs +24 -0
  106. package/dist/diagram-G47NLZAW-DT2BBA0T.js +498 -0
  107. package/dist/diagram-NH7WQ7WH-DxgkStA3.cjs +24 -0
  108. package/dist/diagram-NH7WQ7WH-W7jg4Vh8.js +135 -0
  109. package/dist/diagram-OA4YK3LP-DkvFII73.cjs +30 -0
  110. package/dist/diagram-OA4YK3LP-jU--aqQl.js +317 -0
  111. package/dist/diagram-WEI45ONY-C_Qhf4ny.js +215 -0
  112. package/dist/diagram-WEI45ONY-XvzRFmmY.cjs +41 -0
  113. package/dist/dist-C0Fwsvsq.js +70 -0
  114. package/dist/dist-C20XxSsP.cjs +1 -0
  115. package/dist/{dropdown-CCvsambb.js → dropdown-DzdAR1nI.js} +4 -4
  116. package/dist/dropdown.js +1 -1
  117. package/dist/ebnfDiagram-CCIWWBDH-Cu8bAlhC.cjs +1 -0
  118. package/dist/ebnfDiagram-CCIWWBDH-Gnr20Oc1.js +112 -0
  119. package/dist/erDiagram-Q63AITRT-CxLSa9Yv.cjs +85 -0
  120. package/dist/erDiagram-Q63AITRT-D0Hh9b-W.js +1822 -0
  121. package/dist/eventmodeling-45OFAUF4-C6VXxUn1.cjs +1 -0
  122. package/dist/eventmodeling-45OFAUF4-DMpGs2yI.js +5 -0
  123. package/dist/factory-BkvRcCOx.js +482 -0
  124. package/dist/flowDiagram-23GEKE2U-B6gASEYG.cjs +1 -0
  125. package/dist/flowDiagram-23GEKE2U-BY4wE2vw.js +19 -0
  126. package/dist/{form-Ceq3uJzz.js → form-CUJpeQ7Q.js} +5 -5
  127. package/dist/form.js +1 -1
  128. package/dist/ganttDiagram-NO4QXBWP-B40Eabk0.js +3125 -0
  129. package/dist/ganttDiagram-NO4QXBWP-DZT79qJr.cjs +292 -0
  130. package/dist/gitGraph-TEB2WS4Q-BbtF3MDr.cjs +1 -0
  131. package/dist/gitGraph-TEB2WS4Q-D6Ru11Cs.js +5 -0
  132. package/dist/gitGraphDiagram-IHSO6WYX-BUJNSssA.js +754 -0
  133. package/dist/gitGraphDiagram-IHSO6WYX-DW06165m.cjs +106 -0
  134. package/dist/glass-Bj1Zf8Hy.js +115 -0
  135. package/dist/glass.js +5 -0
  136. package/dist/graphlib-CCKThIKP.js +1104 -0
  137. package/dist/graphlib-Du-578Js.cjs +1 -0
  138. package/dist/{icon-C_ENrJ3F.js → icon-CtlZJISZ.js} +77 -25
  139. package/dist/icon.js +1 -1
  140. package/dist/icons.js +1 -1
  141. package/dist/iife/button.iife.js +1 -1
  142. package/dist/iife/card.iife.js +1 -1
  143. package/dist/iife/checkbox.iife.js +1 -1
  144. package/dist/iife/colorpicker.iife.js +2 -2
  145. package/dist/iife/content.iife.js +1 -0
  146. package/dist/iife/dropdown.iife.js +1 -1
  147. package/dist/iife/form.iife.js +1 -1
  148. package/dist/iife/glass.iife.js +1 -0
  149. package/dist/iife/icon.iife.js +1 -1
  150. package/dist/iife/image.iife.js +1 -1
  151. package/dist/iife/input.iife.js +1 -1
  152. package/dist/iife/loading.iife.js +1 -1
  153. package/dist/iife/math.iife.js +14 -14
  154. package/dist/iife/mermaid.iife.js +3535 -0
  155. package/dist/iife/message.iife.js +1 -1
  156. package/dist/iife/modal.iife.js +1 -1
  157. package/dist/iife/player.iife.js +8 -8
  158. package/dist/iife/popover.iife.js +1 -1
  159. package/dist/iife/progress.iife.js +1 -1
  160. package/dist/iife/radar.iife.js +1 -1
  161. package/dist/iife/route.iife.js +1 -1
  162. package/dist/iife/router.iife.js +1 -1
  163. package/dist/iife/scratch.iife.js +1 -1
  164. package/dist/iife/section.iife.js +1 -1
  165. package/dist/iife/select.iife.js +1 -1
  166. package/dist/iife/skeleton.iife.js +1 -1
  167. package/dist/iife/tab.iife.js +1 -1
  168. package/dist/iife/tabpane.iife.js +1 -1
  169. package/dist/{image-B7MBI5n_.js → image-ILZNlaGc.js} +4 -4
  170. package/dist/image.js +1 -1
  171. package/dist/index.cjs +38 -37
  172. package/dist/index.d.ts +8 -0
  173. package/dist/index.iife.js +3623 -88
  174. package/dist/index.js +88 -84
  175. package/dist/info-DKCQHKI2-DNOtUIin.cjs +1 -0
  176. package/dist/info-DKCQHKI2-Df7h9MSE.js +5 -0
  177. package/dist/infoDiagram-FWYZ7A6U-C8dZc-Ki.cjs +2 -0
  178. package/dist/infoDiagram-FWYZ7A6U-Dc0m9qAx.js +21 -0
  179. package/dist/init-1VpIn1S3.js +16 -0
  180. package/dist/init-CbDwVtpO.cjs +1 -0
  181. package/dist/{input-RNqdEHPf.js → input-CDH6zY9I.js} +6 -6
  182. package/dist/input.js +1 -1
  183. package/dist/ishikawaDiagram-FXEZZL3T-BugNyysB.cjs +70 -0
  184. package/dist/ishikawaDiagram-FXEZZL3T-DuFtHOmf.js +742 -0
  185. package/dist/journeyDiagram-5HDEW3XC-Bshelnhq.js +928 -0
  186. package/dist/journeyDiagram-5HDEW3XC-ItmURvA2.cjs +139 -0
  187. package/dist/kanban-definition-HUTT4EX6-BL512R2A.cjs +89 -0
  188. package/dist/kanban-definition-HUTT4EX6-Dogv2paU.js +1050 -0
  189. package/dist/katex-Cq3Y8cmK.cjs +257 -0
  190. package/dist/katex-Pg2EqTH0.js +23485 -0
  191. package/dist/line-BIPmUVxO.js +33 -0
  192. package/dist/line-CAB5QHC6.cjs +1 -0
  193. package/dist/linear-B2AM4ZBe.js +259 -0
  194. package/dist/linear-CSAfNEpl.cjs +1 -0
  195. package/dist/{link-DURZzd7u.js → link-BCrmHvXP.js} +3 -3
  196. package/dist/link.js +1 -1
  197. package/dist/{loading-B9MFI03l.js → loading-DJWGih1g.js} +4 -4
  198. package/dist/loading.js +1 -1
  199. package/dist/map-BC2bk_rV.cjs +1 -0
  200. package/dist/map-DMSWkcq6.js +208 -0
  201. package/dist/{math-CudIwEXZ.js → math-DRmkEDSQ.js} +4 -4
  202. package/dist/math.js +1 -1
  203. package/dist/mermaid-CMhm7npE.js +261 -0
  204. package/dist/mermaid-parser.core-DYumW1vq.cjs +6 -0
  205. package/dist/mermaid-parser.core-uIDZYuBu.js +654 -0
  206. package/dist/mermaid.core-B2d5lQW2.js +1085 -0
  207. package/dist/mermaid.core-a1hgpWfs.cjs +10 -0
  208. package/dist/mermaid.js +5 -0
  209. package/dist/{message-DW7qWpEm.js → message-BpYJBvYn.js} +6 -6
  210. package/dist/message.js +1 -1
  211. package/dist/mindmap-definition-LN4V7U3C-DYZgIZym.cjs +96 -0
  212. package/dist/mindmap-definition-LN4V7U3C-f7s5ZePP.js +1070 -0
  213. package/dist/{modal-CrvGKL2B.js → modal-BeQlDYDP.js} +40 -24
  214. package/dist/modal.js +1 -1
  215. package/dist/ordinal-BMN81JG2.js +64 -0
  216. package/dist/ordinal-BplLHIij.cjs +1 -0
  217. package/dist/packet-7NZHBO7P-4PLslLZJ.js +5 -0
  218. package/dist/packet-7NZHBO7P-DeyLCrSn.cjs +1 -0
  219. package/dist/path-Bja5PoYn.js +82 -0
  220. package/dist/path-DmfWsuKi.cjs +1 -0
  221. package/dist/pegDiagram-2B236MQR-B-Xeh55J.js +107 -0
  222. package/dist/pegDiagram-2B236MQR-Bo5Nj40u.cjs +1 -0
  223. package/dist/pie-RZYD4A2V-DBE9a8Kz.js +5 -0
  224. package/dist/pie-RZYD4A2V-pDNZ2ZyB.cjs +1 -0
  225. package/dist/pieDiagram-ENE6RG2P-BkSiP4iu.cjs +39 -0
  226. package/dist/pieDiagram-ENE6RG2P-CVSE95zc.js +207 -0
  227. package/dist/{player-BKQaaT7o.js → player-CQ4e3Yeo.js} +196 -195
  228. package/dist/player.js +1 -1
  229. package/dist/{popover-CvYIVgUS.js → popover-eZMnL1F3.js} +22 -54
  230. package/dist/popover.js +1 -1
  231. package/dist/{progress-C6jctsFH.js → progress-DyHgW4Ep.js} +5 -5
  232. package/dist/progress.js +1 -1
  233. package/dist/quadrantDiagram-ABIIQ3AL-BDmdDGsh.cjs +7 -0
  234. package/dist/quadrantDiagram-ABIIQ3AL-TJ8FmqES.js +2058 -0
  235. package/dist/{radar-BUb4EzmG.js → radar-D21Rccap.js} +5 -5
  236. package/dist/radar-I7S5WNFK-CY5ycn2a.cjs +1 -0
  237. package/dist/radar-I7S5WNFK-DFTxtd_t.js +5 -0
  238. package/dist/radar.js +1 -1
  239. package/dist/railroad-3IZDKUUU-DALJwv16.js +5 -0
  240. package/dist/railroad-3IZDKUUU-DGzXHqt7.cjs +1 -0
  241. package/dist/railroad-abnf-AHOZXSZD-BCIHdSw6.cjs +1 -0
  242. package/dist/railroad-abnf-AHOZXSZD-CntW2udQ.js +5 -0
  243. package/dist/railroad-ebnf-EBAXGLYW-4vFZrfHF.cjs +1 -0
  244. package/dist/railroad-ebnf-EBAXGLYW-s_1ZOb_9.js +5 -0
  245. package/dist/railroad-peg-LSFZ7HO6-CaM5A0Ml.js +5 -0
  246. package/dist/railroad-peg-LSFZ7HO6-D_oFW1Bo.cjs +1 -0
  247. package/dist/railroadDiagram-RFXS5EU6-0lS5wYI7.js +83 -0
  248. package/dist/railroadDiagram-RFXS5EU6-DJKAtnQk.cjs +1 -0
  249. package/dist/ranui.css +1 -1
  250. package/dist/requirementDiagram-TGXJPOKE-Bg701bNl.cjs +84 -0
  251. package/dist/requirementDiagram-TGXJPOKE-viCQLyJd.js +2301 -0
  252. package/dist/rolldown-runtime-9ZSF5uba.js +16 -0
  253. package/dist/rolldown-runtime-CAnuVJ4g.cjs +1 -0
  254. package/dist/rough.esm-BWe9E0Nz.js +1387 -0
  255. package/dist/rough.esm-BfSi6CZE.cjs +1 -0
  256. package/dist/{route-Djrf9UR_.js → route-pR5P4ann.js} +10 -10
  257. package/dist/route.js +1 -1
  258. package/dist/{router-BU2KhtxV.js → router-CewzSH7O.js} +5 -5
  259. package/dist/router.js +1 -1
  260. package/dist/sankeyDiagram-HTMAVEWB-CV6_AuMF.js +974 -0
  261. package/dist/sankeyDiagram-HTMAVEWB-K-nGMsuS.cjs +40 -0
  262. package/dist/{scratch-CO4I2dIa.js → scratch-BFVsgl-7.js} +2 -2
  263. package/dist/scratch.js +1 -1
  264. package/dist/{section-CsUkp8bv.js → section-DSPCsIxv.js} +2 -2
  265. package/dist/section.js +1 -1
  266. package/dist/{select-Dn26ajJZ.js → select-B58nMfB1.js} +13 -13
  267. package/dist/select.js +1 -1
  268. package/dist/sequenceDiagram-DBY2YBRQ-4GdkLnUr.cjs +162 -0
  269. package/dist/sequenceDiagram-DBY2YBRQ-B9WNesh2.js +4326 -0
  270. package/dist/sizeCapture-X5ZJPWSS-BUY3-n09.cjs +1 -0
  271. package/dist/sizeCapture-X5ZJPWSS-D7rGsqTl.js +48 -0
  272. package/dist/{skeleton-BuMLhvzQ.js → skeleton-DoHYMsTn.js} +5 -5
  273. package/dist/skeleton.js +1 -1
  274. package/dist/src-C9EhKhbk.cjs +1 -0
  275. package/dist/src-DtRLxcYO.js +2104 -0
  276. package/dist/stateDiagram-2N3HPSRC-B7VpgjJu.cjs +1 -0
  277. package/dist/stateDiagram-2N3HPSRC-DxH4BMSh.js +237 -0
  278. package/dist/stateDiagram-v2-6OUMAXLB-CQv7GIaO.cjs +1 -0
  279. package/dist/stateDiagram-v2-6OUMAXLB-CWfn6e7n.js +30 -0
  280. package/dist/swimlanes-5IMT3BWC-DcADNGpg.js +5258 -0
  281. package/dist/swimlanes-5IMT3BWC-o-MjdPlw.cjs +1 -0
  282. package/dist/swimlanesDiagram-G3AALYLV-D-rmAGky.cjs +8 -0
  283. package/dist/swimlanesDiagram-G3AALYLV-DDtDtl1L.js +31 -0
  284. package/dist/{tab-40fDkuox.js → tab-BRPdZ9Ws.js} +5 -5
  285. package/dist/tab.js +1 -1
  286. package/dist/{tabpane-F4Pd7JtC.js → tabpane-Owf72hw_.js} +5 -5
  287. package/dist/tabpane.js +1 -1
  288. package/dist/{theme-switch-B09egc6h.js → theme-switch-CZDIIonc.js} +4 -4
  289. package/dist/theme-switch.js +1 -1
  290. package/dist/timeline-definition-FHXFAJF6-C80VjPLh.js +1119 -0
  291. package/dist/timeline-definition-FHXFAJF6-DOwvOb3S.cjs +120 -0
  292. package/dist/treeView-QDETBFTQ-B1Ejxfpg.cjs +1 -0
  293. package/dist/treeView-QDETBFTQ-vTKOZls1.js +5 -0
  294. package/dist/treemap-6X3UGDF4-D0FeO_NX.cjs +1 -0
  295. package/dist/treemap-6X3UGDF4-Ddzv6Gqd.js +5 -0
  296. package/dist/utils/builder/core.d.ts +133 -3
  297. package/dist/utils/builder/index.d.ts +1 -1
  298. package/dist/{utils-DBfrRFoE.js → utils-D1iZnChu.js} +38 -31
  299. package/dist/vennDiagram-L72KCM5P-BYHB7OW8.js +1955 -0
  300. package/dist/vennDiagram-L72KCM5P-CidVJK6y.cjs +34 -0
  301. package/dist/wardley-OPB4EBWU-C1hXbbD4.cjs +1 -0
  302. package/dist/wardley-OPB4EBWU-DBgFLc64.js +5 -0
  303. package/dist/wardleyDiagram-EHGQE667--ubmCaWM.js +652 -0
  304. package/dist/wardleyDiagram-EHGQE667-K6ckkRZS.cjs +78 -0
  305. package/dist/xychartDiagram-FW5EYKEG-CzdokxrM.cjs +7 -0
  306. package/dist/xychartDiagram-FW5EYKEG-DLqWcTPt.js +2154 -0
  307. package/docs/BUILDER.md +155 -2
  308. package/package.json +7 -1
  309. package/dist/button-BfYw0fes.js +0 -117
  310. package/dist/factory-DCrO37si.js +0 -334
@@ -0,0 +1,321 @@
1
+ function Do(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r<e;r++)a[r]=t[r];return a}function Qf(t){if(Array.isArray(t))return t}function Jf(t){if(Array.isArray(t))return Do(t)}function lr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jf(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,Zl(a.key),a)}}function vr(t,e,r){return e&&jf(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ct(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Uo(t))||e){r&&(t=r);var a=0,n=function(){};return{s:n,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(u){throw u},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,i=u},f:function(){try{o||r.return==null||r.return()}finally{if(s)throw i}}}}function Xl(t,e,r){return(e=Zl(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ec(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function tc(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,n,i,o,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(a=i.call(r)).done)&&(s.push(a.value),s.length!==e);u=!0);}catch(v){l=!0,n=v}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw n}}return s}}function rc(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ac(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xe(t,e){return Qf(t)||tc(t,e)||Uo(t,e)||rc()}function dn(t){return Jf(t)||ec(t)||Uo(t)||ac()}function nc(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Zl(t){var e=nc(t,"string");return typeof e=="symbol"?e:e+""}function je(t){"@babel/helpers - typeof";return je=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},je(t)}function Uo(t,e){if(t){if(typeof t=="string")return Do(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Do(t,e):void 0}}var Qe=typeof window>"u"?null:window,xs=Qe?Qe.navigator:null;Qe&&Qe.document;var ic=je(""),Ql=je({}),oc=je(function(){}),sc=typeof HTMLElement>"u"?"undefined":je(HTMLElement),Ba=function(e){return e&&e.instanceString&&We(e.instanceString)?e.instanceString():null},he=function(e){return e!=null&&je(e)==ic},We=function(e){return e!=null&&je(e)===oc},ze=function(e){return!Tt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Re=function(e){return e!=null&&je(e)===Ql&&!ze(e)&&e.constructor===Object},uc=function(e){return e!=null&&je(e)===Ql},re=function(e){return e!=null&&je(e)===je(1)&&!isNaN(e)},lc=function(e){return re(e)&&Math.floor(e)===e},gn=function(e){if(sc!=="undefined")return e!=null&&e instanceof HTMLElement},Tt=function(e){return Pa(e)||Jl(e)},Pa=function(e){return Ba(e)==="collection"&&e._private.single},Jl=function(e){return Ba(e)==="collection"&&!e._private.single},Ko=function(e){return Ba(e)==="core"},jl=function(e){return Ba(e)==="stylesheet"},vc=function(e){return Ba(e)==="event"},ar=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},fc=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},cc=function(e){return Re(e)&&re(e.x1)&&re(e.x2)&&re(e.y1)&&re(e.y2)},hc=function(e){return uc(e)&&We(e.then)},dc=function(){return xs&&xs.userAgent.match(/msie|trident|edge/i)},Kr=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);return i.join("$")});var a=function(){var i=this,o=arguments,s,u=r.apply(i,o),l=a.cache;return(s=l[u])||(s=l[u]=e.apply(i,o)),s};return a.cache={},a},Yo=Kr(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),An=Kr(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),ev=Kr(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),Es=function(e){return ar(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Jt=function(e,r){return e.slice(-1*r.length)===r},Je="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",gc="rgb[a]?\\(("+Je+"[%]?)\\s*,\\s*("+Je+"[%]?)\\s*,\\s*("+Je+"[%]?)(?:\\s*,\\s*("+Je+"))?\\)",pc="rgb[a]?\\((?:"+Je+"[%]?)\\s*,\\s*(?:"+Je+"[%]?)\\s*,\\s*(?:"+Je+"[%]?)(?:\\s*,\\s*(?:"+Je+"))?\\)",yc="hsl[a]?\\(("+Je+")\\s*,\\s*("+Je+"[%])\\s*,\\s*("+Je+"[%])(?:\\s*,\\s*("+Je+"))?\\)",mc="hsl[a]?\\((?:"+Je+")\\s*,\\s*(?:"+Je+"[%])\\s*,\\s*(?:"+Je+"[%])(?:\\s*,\\s*(?:"+Je+"))?\\)",bc="\\#[0-9a-fA-F]{3}",wc="\\#[0-9a-fA-F]{6}",tv=function(e,r){return e<r?-1:e>r?1:0},xc=function(e,r){return-1*tv(e,r)},ge=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var o=n[i];t[o]=a[o]}}return t},Ec=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,o=16;return r?(a=parseInt(e[1]+e[1],o),n=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),n=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[a,n,i]}},Cc=function(e){var r,a,n,i,o,s,u,l;function v(h,g,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?h+(g-h)*6*p:p<1/2?g:p<2/3?h+(g-h)*(2/3-p)*6:h}var f=new RegExp("^"+yc+"$").exec(e);if(f){if(a=parseInt(f[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(f[2]),n<0||n>100||(n=n/100,i=parseFloat(f[3]),i<0||i>100)||(i=i/100,o=f[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=u=l=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,d=2*i-c;s=Math.round(255*v(d,c,a+1/3)),u=Math.round(255*v(d,c,a)),l=Math.round(255*v(d,c,a-1/3))}r=[s,u,l,o]}return r},Tc=function(e){var r,a=new RegExp("^"+gc+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var o=a[i];if(o[o.length-1]==="%"&&(n[i]=!0),o=parseFloat(o),n[i]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var s=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(s&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;r.push(l)}}return r},Sc=function(e){return Dc[e.toLowerCase()]},rv=function(e){return(ze(e)?e:null)||Sc(e)||Ec(e)||Tc(e)||Cc(e)},Dc={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},av=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(Re(o))throw Error("Tried to set map with object key");i<a.length-1?(r[o]==null&&(r[o]={}),r=r[o]):r[o]=e.value}},nv=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(Re(o))throw Error("Tried to get map with object key");if(r=r[o],r==null)return r}return r},Ga=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Aa(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Xn,Cs;function Ra(){if(Cs)return Xn;Cs=1;function t(e){var r=typeof e;return e!=null&&(r=="object"||r=="function")}return Xn=t,Xn}var Zn,Ts;function kc(){return Ts||(Ts=1,Zn=typeof Ga=="object"&&Ga&&Ga.Object===Object&&Ga),Zn}var Qn,Ss;function Rn(){if(Ss)return Qn;Ss=1;var t=kc(),e=typeof self=="object"&&self&&self.Object===Object&&self;return Qn=t||e||Function("return this")(),Qn}var Jn,Ds;function Bc(){if(Ds)return Jn;Ds=1;var t=Rn(),e=function(){return t.Date.now()};return Jn=e,Jn}var jn,ks;function Pc(){if(ks)return jn;ks=1;var t=/\s/;function e(r){for(var a=r.length;a--&&t.test(r.charAt(a)););return a}return jn=e,jn}var ei,Bs;function Ac(){if(Bs)return ei;Bs=1;var t=Pc(),e=/^\s+/;function r(a){return a&&a.slice(0,t(a)+1).replace(e,"")}return ei=r,ei}var ti,Ps;function Xo(){return Ps||(Ps=1,ti=Rn().Symbol),ti}var ri,As;function Rc(){if(As)return ri;As=1;var t=Xo(),e=Object.prototype,r=e.hasOwnProperty,a=e.toString,n=t?t.toStringTag:void 0;function i(o){var s=r.call(o,n),u=o[n];try{o[n]=void 0;var l=!0}catch{}var v=a.call(o);return l&&(s?o[n]=u:delete o[n]),v}return ri=i,ri}var ai,Rs;function Mc(){if(Rs)return ai;Rs=1;var t=Object.prototype.toString;function e(r){return t.call(r)}return ai=e,ai}var ni,Ms;function iv(){if(Ms)return ni;Ms=1;var t=Xo(),e=Rc(),r=Mc(),a="[object Null]",n="[object Undefined]",i=t?t.toStringTag:void 0;function o(s){return s==null?s===void 0?n:a:i&&i in Object(s)?e(s):r(s)}return ni=o,ni}var ii,Ls;function Lc(){if(Ls)return ii;Ls=1;function t(e){return e!=null&&typeof e=="object"}return ii=t,ii}var oi,Is;function Ma(){if(Is)return oi;Is=1;var t=iv(),e=Lc(),r="[object Symbol]";function a(n){return typeof n=="symbol"||e(n)&&t(n)==r}return oi=a,oi}var si,Os;function Ic(){if(Os)return si;Os=1;var t=Ac(),e=Ra(),r=Ma(),a=NaN,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(l){if(typeof l=="number")return l;if(r(l))return a;if(e(l)){var v=typeof l.valueOf=="function"?l.valueOf():l;l=e(v)?v+"":v}if(typeof l!="string")return l===0?l:+l;l=t(l);var f=i.test(l);return f||o.test(l)?s(l.slice(2),f?2:8):n.test(l)?a:+l}return si=u,si}var ui,Ns;function Oc(){if(Ns)return ui;Ns=1;var t=Ra(),e=Bc(),r=Ic(),a="Expected a function",n=Math.max,i=Math.min;function o(s,u,l){var v,f,c,d,h,g,p=0,y=!1,b=!1,m=!0;if(typeof s!="function")throw new TypeError(a);u=r(u)||0,t(l)&&(y=!!l.leading,b="maxWait"in l,c=b?n(r(l.maxWait)||0,u):c,m="trailing"in l?!!l.trailing:m);function w(P){var M=v,R=f;return v=f=void 0,p=P,d=s.apply(R,M),d}function T(P){return p=P,h=setTimeout(S,u),y?w(P):d}function C(P){var M=P-g,R=P-p,L=u-M;return b?i(L,c-R):L}function x(P){var M=P-g,R=P-p;return g===void 0||M>=u||M<0||b&&R>=c}function S(){var P=e();if(x(P))return D(P);h=setTimeout(S,C(P))}function D(P){return h=void 0,m&&v?w(P):(v=f=void 0,d)}function E(){h!==void 0&&clearTimeout(h),p=0,v=g=f=h=void 0}function B(){return h===void 0?d:D(e())}function A(){var P=e(),M=x(P);if(v=arguments,f=this,g=P,M){if(h===void 0)return T(g);if(b)return clearTimeout(h),h=setTimeout(S,u),w(g)}return h===void 0&&(h=setTimeout(S,u)),d}return A.cancel=E,A.flush=B,A}return ui=o,ui}var La=Aa(Oc()),li=Qe?Qe.performance:null,ov=li&&li.now?function(){return li.now()}:function(){return Date.now()},Nc=(function(){if(Qe){if(Qe.requestAnimationFrame)return function(t){Qe.requestAnimationFrame(t)};if(Qe.mozRequestAnimationFrame)return function(t){Qe.mozRequestAnimationFrame(t)};if(Qe.webkitRequestAnimationFrame)return function(t){Qe.webkitRequestAnimationFrame(t)};if(Qe.msRequestAnimationFrame)return function(t){Qe.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(ov())},1e3/60)}})(),pn=function(e){return Nc(e)},$t=ov,br=9261,sv=65599,Vr=5381,uv=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:br,a;a=e.next(),!a.done;)r=r*sv+a.value|0;return r},ba=function(e){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:br)*sv+e|0},wa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Vr;return(r<<5)+r+e|0},zc=function(e,r){return e*2097152+r},Xt=function(e){return e[0]*2097152+e[1]},Ha=function(e,r){return[ba(e[0],r[0]),wa(e[1],r[1])]},zs=function(e,r){var a={value:0,done:!1},n=0,i=e.length;return uv({next:function(){return n<i?a.value=e[n++]:a.done=!0,a}},r)},Er=function(e,r){var a={value:0,done:!1},n=0,i=e.length;return uv({next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}},r)},lv=function(){return Fc(arguments)},Fc=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=Er(n):r=Er(n,r)}return r};function Vc(t,e,r,a,n){var i=n*Math.PI/180;return{x:Math.cos(i)*(t-r)-Math.sin(i)*(e-a)+r,y:Math.sin(i)*(t-r)+Math.cos(i)*(e-a)+a}}var qc=function(e,r,a,n,i,o){return{x:(e-a)*i+a,y:(r-n)*o+n}};function _c(t,e,r){if(r===0)return t;var a=(e.x1+e.x2)/2,n=(e.y1+e.y2)/2,i=e.w/e.h,o=1/i,s=Vc(t.x,t.y,a,n,r),u=qc(s.x,s.y,a,n,i,o);return{x:u.x,y:u.y}}var Fs=!0,Gc=console.warn!=null,Hc=console.trace!=null,Zo=Number.MAX_SAFE_INTEGER||9007199254740991,vv=function(){return!0},yn=function(){return!1},Vs=function(){return 0},Qo=function(){},He=function(e){throw new Error(e)},fv=function(e){if(e!==void 0)Fs=!!e;else return Fs},Ie=function(e){fv()&&(Gc?console.warn(e):Hc&&console.trace())},$c=function(e){return ge({},e)},Ft=function(e){return e==null?e:ze(e)?e.slice():Re(e)?$c(e):e},Wc=function(e){return e.slice()},cv=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},Uc={},hv=function(){return Uc},vt=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var o=r[i],s=a?.[o];n[o]=s===void 0?e[o]:s}return n}},nr=function(e,r,a){for(var n=e.length-1;n>=0;n--)e[n]===r&&e.splice(n,1)},Jo=function(e){e.splice(0,e.length)},Kc=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},yt=function(e,r,a){return a&&(r=ev(a,r)),e[r]},zt=function(e,r,a,n){a&&(r=ev(a,r)),e[r]=n},Ht=typeof Map<"u"?Map:(function(){function t(){lr(this,t),this._obj={}}return vr(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}])})(),Yc="undefined",Xc=(function(){function t(e){if(lr(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return vr(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}])})(),Jr=(typeof Set>"u"?"undefined":je(Set))!==Yc?Set:Xc,Mn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!Ko(e)){He("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){He("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new Jr,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),r.renderedPosition){var o=r.renderedPosition,s=e.pan(),u=e.zoom();i.position={x:(o.x-s.x)/u,y:(o.y-s.y)/u}}var l=[];ze(r.classes)?l=r.classes:he(r.classes)&&(l=r.classes.split(/\s+/));for(var v=0,f=l.length;v<f;v++){var c=l[v];!c||c===""||i.classes.add(c)}this.createEmitter(),(a===void 0||a)&&this.restore();var d=r.style||r.css;d&&(Ie("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d))},qs=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var o;Re(a)&&!Tt(a)&&(o=a,a=o.roots||o.root,n=o.visit,i=o.directed),i=arguments.length===2&&!We(n)?n:i,n=We(n)?n:function(){};for(var s=this._private.cy,u=a=he(a)?this.filter(a):a,l=[],v=[],f={},c={},d={},h=0,g,p=this.byGroup(),y=p.nodes,b=p.edges,m=0;m<u.length;m++){var w=u[m],T=w.id();w.isNode()&&(l.unshift(w),e.bfs&&(d[T]=!0,v.push(w)),c[T]=0)}for(var C=function(){var P=e.bfs?l.shift():l.pop(),M=P.id();if(e.dfs){if(d[M])return 0;d[M]=!0,v.push(P)}var R=c[M],L=f[M],I=L!=null?L.source():null,F=L!=null?L.target():null,_=L==null?void 0:P.same(I)?F[0]:I[0],N=n(P,L,_,h++,R);if(N===!0)return g=P,1;if(N===!1)return 1;for(var G=P.connectedEdges().filter(function(te){return(!i||te.source().same(P))&&b.has(te)}),Z=0;Z<G.length;Z++){var W=G[Z],$=W.connectedNodes().filter(function(te){return!te.same(P)&&y.has(te)}),Y=$.id();$.length!==0&&!d[Y]&&($=$[0],l.push($),e.bfs&&(d[Y]=!0,v.push($)),f[Y]=W,c[Y]=c[M]+1)}},x;l.length!==0&&(x=C(),!(x!==0&&x===1)););for(var S=s.collection(),D=0;D<v.length;D++){var E=v[D],B=f[E.id()];B!=null&&S.push(B),S.push(E)}return{path:s.collection(S),found:s.collection(g)}}},xa={breadthFirstSearch:qs({bfs:!0}),depthFirstSearch:qs({dfs:!0})};xa.bfs=xa.breadthFirstSearch;xa.dfs=xa.depthFirstSearch;var rn={exports:{}},Zc=rn.exports,_s;function Qc(){return _s||(_s=1,(function(t,e){(function(){var r,a,n=Math.floor,i,o,s,u,l,v,f=Math.min,c,d,h,g,p;a=function(y,b){return y<b?-1:y>b?1:0},v=function(y,b,m,w,T){var C;if(m==null&&(m=0),T==null&&(T=a),m<0)throw new Error("lo must be non-negative");for(w==null&&(w=y.length);m<w;)C=n((m+w)/2),T(b,y[C])<0?w=C:m=C+1;return[].splice.apply(y,[m,m-m].concat(b)),b},s=function(y,b,m){return m==null&&(m=a),y.push(b),g(y,0,y.length-1,m)},o=function(y,b){var m,w;return b==null&&(b=a),m=y.pop(),y.length?(w=y[0],y[0]=m,p(y,0,b)):w=m,w},l=function(y,b,m){var w;return m==null&&(m=a),w=y[0],y[0]=b,p(y,0,m),w},u=function(y,b,m){var w;return m==null&&(m=a),y.length&&m(y[0],b)<0&&(w=[y[0],b],b=w[0],y[0]=w[1],p(y,0,m)),b},i=function(y,b){var m,w,T,C,x,S;for(b==null&&(b=a),C=(function(){S=[];for(var D=0,E=n(y.length/2);0<=E?D<E:D>E;0<=E?D++:D--)S.push(D);return S}).apply(this).reverse(),x=[],w=0,T=C.length;w<T;w++)m=C[w],x.push(p(y,m,b));return x},h=function(y,b,m){var w;if(m==null&&(m=a),w=y.indexOf(b),w!==-1)return g(y,0,w,m),p(y,w,m)},c=function(y,b,m){var w,T,C,x,S;if(m==null&&(m=a),T=y.slice(0,b),!T.length)return T;for(i(T,m),S=y.slice(b),C=0,x=S.length;C<x;C++)w=S[C],u(T,w,m);return T.sort(m).reverse()},d=function(y,b,m){var w,T,C,x,S,D,E,B,A;if(m==null&&(m=a),b*10<=y.length){if(C=y.slice(0,b).sort(m),!C.length)return C;for(T=C[C.length-1],E=y.slice(b),x=0,D=E.length;x<D;x++)w=E[x],m(w,T)<0&&(v(C,w,0,null,m),C.pop(),T=C[C.length-1]);return C}for(i(y,m),A=[],S=0,B=f(b,y.length);0<=B?S<B:S>B;0<=B?++S:--S)A.push(o(y,m));return A},g=function(y,b,m,w){var T,C,x;for(w==null&&(w=a),T=y[m];m>b;){if(x=m-1>>1,C=y[x],w(T,C)<0){y[m]=C,m=x;continue}break}return y[m]=T},p=function(y,b,m){var w,T,C,x,S;for(m==null&&(m=a),T=y.length,S=b,C=y[b],w=2*b+1;w<T;)x=w+1,x<T&&!(m(y[w],y[x])<0)&&(w=x),y[b]=y[w],b=w,w=2*b+1;return y[b]=C,g(y,S,b,m)},r=(function(){y.push=s,y.pop=o,y.replace=l,y.pushpop=u,y.heapify=i,y.updateItem=h,y.nlargest=c,y.nsmallest=d;function y(b){this.cmp=b??a,this.nodes=[]}return y.prototype.push=function(b){return s(this.nodes,b,this.cmp)},y.prototype.pop=function(){return o(this.nodes,this.cmp)},y.prototype.peek=function(){return this.nodes[0]},y.prototype.contains=function(b){return this.nodes.indexOf(b)!==-1},y.prototype.replace=function(b){return l(this.nodes,b,this.cmp)},y.prototype.pushpop=function(b){return u(this.nodes,b,this.cmp)},y.prototype.heapify=function(){return i(this.nodes,this.cmp)},y.prototype.updateItem=function(b){return h(this.nodes,b,this.cmp)},y.prototype.clear=function(){return this.nodes=[]},y.prototype.empty=function(){return this.nodes.length===0},y.prototype.size=function(){return this.nodes.length},y.prototype.clone=function(){var b=new y;return b.nodes=this.nodes.slice(0),b},y.prototype.toArray=function(){return this.nodes.slice(0)},y.prototype.insert=y.prototype.push,y.prototype.top=y.prototype.peek,y.prototype.front=y.prototype.peek,y.prototype.has=y.prototype.contains,y.prototype.copy=y.prototype.clone,y})(),(function(y,b){return t.exports=b()})(this,function(){return r})}).call(Zc)})(rn)),rn.exports}var vi,Gs;function Jc(){return Gs||(Gs=1,vi=Qc()),vi}var Ia=Aa(Jc()),jc=vt({root:null,weight:function(e){return 1},directed:!1}),eh={dijkstra:function(e){if(!Re(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=jc(e),n=a.root,i=a.weight,o=a.directed,s=this,u=i,l=he(n)?this.filter(n)[0]:n[0],v={},f={},c={},d=this.byGroup(),h=d.nodes,g=d.edges;g.unmergeBy(function(R){return R.isLoop()});for(var p=function(L){return v[L.id()]},y=function(L,I){v[L.id()]=I,b.updateItem(L)},b=new Ia(function(R,L){return p(R)-p(L)}),m=0;m<h.length;m++){var w=h[m];v[w.id()]=w.same(l)?0:1/0,b.push(w)}for(var T=function(L,I){for(var F=(o?L.edgesTo(I):L.edgesWith(I)).intersect(g),_=1/0,N,G=0;G<F.length;G++){var Z=F[G],W=u(Z);(W<_||!N)&&(_=W,N=Z)}return{edge:N,dist:_}};b.size()>0;){var C=b.pop(),x=p(C),S=C.id();if(c[S]=x,x!==1/0)for(var D=C.neighborhood().intersect(h),E=0;E<D.length;E++){var B=D[E],A=B.id(),P=T(C,B),M=x+P.dist;M<p(B)&&(y(B,M),f[A]={node:C,edge:P.edge})}}return{distanceTo:function(L){return c[(he(L)?h.filter(L)[0]:L[0]).id()]},pathTo:function(L){var I=he(L)?h.filter(L)[0]:L[0],F=[],_=I,N=_.id();if(I.length>0)for(F.unshift(I);f[N];){var G=f[N];F.unshift(G.edge),F.unshift(G.node),_=G.node,N=_.id()}return s.spawn(F)}}}},th={kruskal:function(e){e=e||function(m){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,o=new Array(i),s=a,u=function(w){for(var T=0;T<o.length;T++)if(o[T].has(w))return T},l=0;l<i;l++)o[l]=this.spawn(a[l]);for(var v=n.sort(function(m,w){return e(m)-e(w)}),f=0;f<v.length;f++){var c=v[f],d=c.source()[0],h=c.target()[0],g=u(d),p=u(h),y=o[g],b=o[p];g!==p&&(s.merge(c),y.merge(b),o.splice(p,1))}return s}},rh=vt({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),ah={aStar:function(e){var r=this.cy(),a=rh(e),n=a.root,i=a.goal,o=a.heuristic,s=a.directed,u=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var l=n.id(),v=i.id(),f={},c={},d={},h=new Ia(function(N,G){return c[N.id()]-c[G.id()]}),g=new Jr,p={},y={},b=function(G,Z){h.push(G),g.add(Z)},m,w,T=function(){m=h.pop(),w=m.id(),g.delete(w)},C=function(G){return g.has(G)};b(n,l),f[l]=0,c[l]=o(n);for(var x=0;h.size()>0;){if(T(),x++,w===v){for(var S=[],D=i,E=v,B=y[E];S.unshift(D),B!=null&&S.unshift(B),D=p[E],D!=null;)E=D.id(),B=y[E];return{found:!0,distance:f[w],path:this.spawn(S),steps:x}}d[w]=!0;for(var A=m._private.edges,P=0;P<A.length;P++){var M=A[P];if(this.hasElementWithId(M.id())&&!(s&&M.data("source")!==w)){var R=M.source(),L=M.target(),I=R.id()!==w?R:L,F=I.id();if(this.hasElementWithId(F)&&!d[F]){var _=f[w]+u(M);if(!C(F)){f[F]=_,c[F]=_+o(I),b(I,F),p[F]=m,y[F]=M;continue}_<f[F]&&(f[F]=_,c[F]=_+o(I),p[F]=m,y[F]=M)}}}}return{found:!1,distance:void 0,path:void 0,steps:x}}},nh=vt({weight:function(e){return 1},directed:!1}),ih={floydWarshall:function(e){for(var r=this.cy(),a=nh(e),n=a.weight,i=a.directed,o=n,s=this.byGroup(),u=s.nodes,l=s.edges,v=u.length,f=v*v,c=function(G){return u.indexOf(G)},d=function(G){return u[G]},h=new Array(f),g=0;g<f;g++){var p=g%v;(g-p)/v===p?h[g]=0:h[g]=1/0}for(var y=new Array(f),b=new Array(f),m=0;m<l.length;m++){var w=l[m],T=w.source()[0],C=w.target()[0];if(T!==C){var x=c(T),S=c(C),D=x*v+S,E=o(w);if(h[D]>E&&(h[D]=E,y[D]=S,b[D]=w),!i){var B=S*v+x;!i&&h[B]>E&&(h[B]=E,y[B]=x,b[B]=w)}}}for(var A=0;A<v;A++)for(var P=0;P<v;P++)for(var M=P*v+A,R=0;R<v;R++){var L=P*v+R,I=A*v+R;h[M]+h[I]<h[L]&&(h[L]=h[M]+h[I],y[L]=y[M])}var F=function(G){return(he(G)?r.filter(G):G)[0]},_=function(G){return c(F(G))};return{distance:function(G,Z){var W=_(G),$=_(Z);return h[W*v+$]},path:function(G,Z){var W=_(G),$=_(Z),Y=d(W);if(W===$)return Y.collection();if(y[W*v+$]==null)return r.collection();var te=r.collection(),J=W,X;for(te.merge(Y);W!==$;)J=W,W=y[W*v+$],X=b[J*v+W],te.merge(X),te.merge(d(W));return te}}}},oh=vt({weight:function(e){return 1},directed:!1,root:null}),sh={bellmanFord:function(e){var r=this,a=oh(e),n=a.weight,i=a.directed,o=a.root,s=n,u=this,l=this.cy(),v=this.byGroup(),f=v.edges,c=v.nodes,d=c.length,h=new Ht,g=!1,p=[];o=l.collection(o)[0],f.unmergeBy(function(le){return le.isLoop()});for(var y=f.length,b=function(ae){var fe=h.get(ae.id());return fe||(fe={},h.set(ae.id(),fe)),fe},m=function(ae){return(he(ae)?l.$(ae):ae)[0]},w=function(ae){return b(m(ae)).dist},T=function(ae){for(var fe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,pe=m(ae),me=[],ce=pe;;){if(ce==null)return r.spawn();var Ce=b(ce),Be=Ce.edge,Pe=Ce.pred;if(me.unshift(ce[0]),ce.same(fe)&&me.length>0)break;Be!=null&&me.unshift(Be),ce=Pe}return u.spawn(me)},C=0;C<d;C++){var x=c[C],S=b(x);x.same(o)?S.dist=0:S.dist=1/0,S.pred=null,S.edge=null}for(var D=!1,E=function(ae,fe,pe,me,ce,Ce){var Be=me.dist+Ce;Be<ce.dist&&!pe.same(me.edge)&&(ce.dist=Be,ce.pred=ae,ce.edge=pe,D=!0)},B=1;B<d;B++){D=!1;for(var A=0;A<y;A++){var P=f[A],M=P.source(),R=P.target(),L=s(P),I=b(M),F=b(R);E(M,R,P,I,F,L),i||E(R,M,P,F,I,L)}if(!D)break}if(D)for(var _=[],N=0;N<y;N++){var G=f[N],Z=G.source(),W=G.target(),$=s(G),Y=b(Z).dist,te=b(W).dist;if(Y+$<te||!i&&te+$<Y)if(g||(Ie("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),e.findNegativeWeightCycles!==!1){var J=[];Y+$<te&&J.push(Z),!i&&te+$<Y&&J.push(W);for(var X=J.length,O=0;O<X;O++){var V=J[O],q=[V];q.push(b(V).edge);for(var j=b(V).pred;q.indexOf(j)===-1;)q.push(j),q.push(b(j).edge),j=b(j).pred;q=q.slice(q.indexOf(j));for(var ue=q[0].id(),we=0,be=2;be<q.length;be+=2)q[be].id()<ue&&(ue=q[be].id(),we=be);q=q.slice(we).concat(q.slice(0,we)),q.push(q[0]);var ke=q.map(function(le){return le.id()}).join(",");_.indexOf(ke)===-1&&(p.push(u.spawn(q)),_.push(ke))}}else break}return{distanceTo:w,pathTo:T,hasNegativeWeightCycle:g,negativeWeightCycles:p}}},uh=Math.sqrt(2),lh=function(e,r,a){a.length===0&&He("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],o=n[2],s=r[i],u=r[o],l=a,v=l.length-1;v>=0;v--){var f=l[v],c=f[1],d=f[2];(r[c]===s&&r[d]===u||r[c]===u&&r[d]===s)&&l.splice(v,1)}for(var h=0;h<l.length;h++){var g=l[h];g[1]===u?(l[h]=g.slice(),l[h][1]=s):g[2]===u&&(l[h]=g.slice(),l[h][2]=s)}for(var p=0;p<r.length;p++)r[p]===u&&(r[p]=s);return l},fi=function(e,r,a,n){for(;a>n;)r=lh(Math.floor(Math.random()*r.length),e,r),a--;return r},vh={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(L){return L.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/uh);if(i<2){He("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],v=0;v<o;v++){var f=n[v];l.push([v,a.indexOf(f.source()),a.indexOf(f.target())])}for(var c=1/0,d=[],h=new Array(i),g=new Array(i),p=new Array(i),y=function(I,F){for(var _=0;_<i;_++)F[_]=I[_]},b=0;b<=s;b++){for(var m=0;m<i;m++)g[m]=m;var w=fi(g,l.slice(),i,u),T=w.slice();y(g,p);var C=fi(g,w,u,2),x=fi(p,T,u,2);C.length<=x.length&&C.length<c?(c=C.length,d=C,y(g,h)):x.length<=C.length&&x.length<c&&(c=x.length,d=x,y(p,h))}for(var S=this.spawn(d.map(function(L){return n[L[0]]})),D=this.spawn(),E=this.spawn(),B=h[0],A=0;A<h.length;A++){var P=h[A],M=a[A];P===B?D.merge(M):E.merge(M)}var R=function(I){var F=e.spawn();return I.forEach(function(_){F.merge(_),_.connectedEdges().forEach(function(N){e.contains(N)&&!S.contains(N)&&F.merge(N)})}),F};return{cut:S,components:[R(D),R(E)],partition1:D,partition2:E}}},ci,fh=function(e){return{x:e.x,y:e.y}},Ln=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},dv=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},qr=function(e){return{x:e[0],y:e[1]}},ch=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.min(o,n))}return n},hh=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.max(o,n))}return n},dh=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,o=r;o<a;o++){var s=e[o];isFinite(s)&&(n+=s,i++)}return n/i},gh=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var s=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,s++):e.splice(u,1)}i&&e.sort(function(c,d){return c-d});var v=e.length,f=Math.floor(v/2);return v%2!==0?e[f+1+s]:(e[f-1+s]+e[f+s])/2},ph=function(e){return Math.PI*e/180},$a=function(e,r){return Math.atan2(r,e)-Math.PI/2},jo=Math.log2||function(t){return Math.log(t)/Math.log(2)},es=function(e){return e>0?1:e<0?-1:0},Cr=function(e,r){return Math.sqrt(yr(e,r))},yr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},yh=function(e){for(var r=e.length,a=0,n=0;n<r;n++)a+=e[n];for(var i=0;i<r;i++)e[i]=e[i]/a;return e},rt=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},Hr=function(e,r,a,n){return{x:rt(e.x,r.x,a.x,n),y:rt(e.y,r.y,a.y,n)}},mh=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},o=Cr(e,r),s={x:i.x/o,y:i.y/o};return a=a??0,n=n??a*o,{x:e.x+s.x*n,y:e.y+s.y*n}},Ea=function(e,r,a){return Math.max(e,Math.min(a,r))},mt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},bh=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},wh=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},xh=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},gv=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},an=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},nn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(r.length===1)a=n=i=o=r[0];else if(r.length===2)a=i=r[0],o=n=r[1];else if(r.length===4){var s=Xe(r,4);a=s[0],n=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Hs=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},ts=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},jt=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},$s=function(e,r){return jt(e,r.x,r.y)},pv=function(e,r){return jt(e,r.x1,r.y1)&&jt(e,r.x2,r.y2)},Eh=(ci=Math.hypot)!==null&&ci!==void 0?ci:function(t,e){return Math.sqrt(t*t+e*e)};function Ch(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(S,D){return{x:S.x+D.x,y:S.y+D.y}},a=function(S,D){return{x:S.x-D.x,y:S.y-D.y}},n=function(S,D){return{x:S.x*D,y:S.y*D}},i=function(S,D){return S.x*D.y-S.y*D.x},o=function(S){var D=Eh(S.x,S.y);return D===0?{x:0,y:0}:{x:S.x/D,y:S.y/D}},s=function(S){for(var D=0,E=0;E<S.length;E++){var B=S[E],A=S[(E+1)%S.length];D+=B.x*A.y-A.x*B.y}return D/2},u=function(S,D,E,B){var A=a(D,S),P=a(B,E),M=i(A,P);return Math.abs(M)<1e-9?r(S,n(A,.5)):r(S,n(A,i(a(E,S),P)/M))},l=t.map(function(x){return{x:x.x,y:x.y}});s(l)<0&&l.reverse();for(var v=l.length,f=[],c=0;c<v;c++){var d=l[c],h=l[(c+1)%v],g=a(h,d),p=o({x:g.y,y:-g.x});f.push(p)}for(var y=f.map(function(x,S){return{p1:r(l[S],n(x,e)),p2:r(l[(S+1)%v],n(x,e))}}),b=[],m=0;m<v;m++){var w=y[(m-1+v)%v],T=y[m],C=u(w.p1,w.p2,T.p1,T.p2);b.push(C)}return b}function Th(t,e,r,a,n,i){var o=Ch(Lh(t,e,r,a,n),i),s=mt();return o.forEach(function(u){return gv(s,u.x,u.y)}),s}var yv=function(e,r,a,n,i,o,s){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?ir(i,o):u,v=i/2,f=o/2;l=Math.min(l,v,f);var c=l!==v,d=l!==f,h;if(c){var g=a-v+l-s,p=n-f-s;if(h=er(e,r,a,n,g,p,a+v-l+s,p,!1),h.length>0)return h}if(d){var y=a+v+s;if(h=er(e,r,a,n,y,n-f+l-s,y,n+f-l+s,!1),h.length>0)return h}if(c){var b=a-v+l-s,m=n+f+s;if(h=er(e,r,a,n,b,m,a+v-l+s,m,!1),h.length>0)return h}if(d){var w=a-v-s;if(h=er(e,r,a,n,w,n-f+l-s,w,n+f-l+s,!1),h.length>0)return h}var T,C=a-v+l,x=n-f+l;if(T=ha(e,r,a,n,C,x,l+s),T.length>0&&T[0]<=C&&T[1]<=x)return[T[0],T[1]];var S=a+v-l,D=n-f+l;if(T=ha(e,r,a,n,S,D,l+s),T.length>0&&T[0]>=S&&T[1]<=D)return[T[0],T[1]];var E=a+v-l,B=n+f-l;if(T=ha(e,r,a,n,E,B,l+s),T.length>0&&T[0]>=E&&T[1]>=B)return[T[0],T[1]];var A=a-v+l,P=n+f-l;return T=ha(e,r,a,n,A,P,l+s),T.length>0&&T[0]<=A&&T[1]>=P?[T[0],T[1]]:[]},Sh=function(e,r,a,n,i,o,s){var u=s,l=Math.min(a,i),v=Math.max(a,i),f=Math.min(n,o),c=Math.max(n,o);return l-u<=e&&e<=v+u&&f-u<=r&&r<=c+u},Dh=function(e,r,a,n,i,o,s,u,l){var v={x1:Math.min(a,s,i)-l,x2:Math.max(a,s,i)+l,y1:Math.min(n,u,o)-l,y2:Math.max(n,u,o)+l};return!(e<v.x1||e>v.x2||r<v.y1||r>v.y2)},kh=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e;return[(-r+o)/s,(-r-o)/s]},Bh=function(e,r,a,n,i){var o=1e-5;e===0&&(e=o),r/=e,a/=e,n/=e;var s,u=(3*a-r*r)/9,l=-(27*n)+r*(9*a-2*(r*r)),v,f,c,d,h;if(l/=54,s=u*u*u+l*l,i[1]=0,d=r/3,s>0){f=l+Math.sqrt(s),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),c=l-Math.sqrt(s),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+f+c,d+=(f+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+f)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,s===0){h=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-d+2*h,i[4]=i[2]=-(h+d);return}u=-u,v=u*u*u,v=Math.acos(l/Math.sqrt(v)),h=2*Math.sqrt(u),i[0]=-d+h*Math.cos(v/3),i[2]=-d+h*Math.cos((v+2*Math.PI)/3),i[4]=-d+h*Math.cos((v+4*Math.PI)/3)},Ph=function(e,r,a,n,i,o,s,u){var l=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*u+4*o*o-4*o*u+u*u,v=9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*u-6*o*o+3*o*u,f=3*a*a-6*a*i+a*s-a*e+2*i*i+2*i*e-s*e+3*n*n-6*n*o+n*u-n*r+2*o*o+2*o*r-u*r,c=1*a*i-a*a+a*e-i*e+n*o-n*n+n*r-o*r,d=[];Bh(l,v,f,c,d);for(var h=1e-7,g=[],p=0;p<6;p+=2)Math.abs(d[p+1])<h&&d[p]>=0&&d[p]<=1&&g.push(d[p]);g.push(1),g.push(0);for(var y=-1,b,m,w,T=0;T<g.length;T++)b=Math.pow(1-g[T],2)*a+2*(1-g[T])*g[T]*i+g[T]*g[T]*s,m=Math.pow(1-g[T],2)*n+2*(1-g[T])*g[T]*o+g[T]*g[T]*u,w=Math.pow(b-e,2)+Math.pow(m-r,2),y>=0?w<y&&(y=w):y=w;return y},Ah=function(e,r,a,n,i,o){var s=[e-a,r-n],u=[i-a,o-n],l=u[0]*u[0]+u[1]*u[1],v=s[0]*s[0]+s[1]*s[1],f=s[0]*u[0]+s[1]*u[1],c=f*f/l;return f<0?v:c>l?(e-i)*(e-i)+(r-o)*(r-o):v-c},Et=function(e,r,a){for(var n,i,o,s,u,l=0,v=0;v<a.length/2;v++)if(n=a[v*2],i=a[v*2+1],v+1<a.length/2?(o=a[(v+1)*2],s=a[(v+1)*2+1]):(o=a[(v+1-a.length/2)*2],s=a[(v+1-a.length/2)*2+1]),!(n==e&&o==e))if(n>=e&&e>=o||n<=e&&e<=o)u=(e-n)/(o-n)*(s-i)+i,u>r&&l++;else continue;return l%2!==0},Wt=function(e,r,a,n,i,o,s,u,l){var v=new Array(a.length),f;u[0]!=null?(f=Math.atan(u[1]/u[0]),u[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=u;for(var c=Math.cos(-f),d=Math.sin(-f),h=0;h<v.length/2;h++)v[h*2]=o/2*(a[h*2]*c-a[h*2+1]*d),v[h*2+1]=s/2*(a[h*2+1]*c+a[h*2]*d),v[h*2]+=n,v[h*2+1]+=i;var g;return l>0?g=mn(bn(v,-l)):g=v,Et(e,r,g)},Rh=function(e,r,a,n,i,o,s,u){for(var l=new Array(a.length*2),v=0;v<u.length;v++){var f=u[v];if(l[v*4+0]=f.startX,l[v*4+1]=f.startY,l[v*4+2]=f.stopX,l[v*4+3]=f.stopY,Math.pow(f.cx-e,2)+Math.pow(f.cy-r,2)<=Math.pow(f.radius,2))return!0}return Et(e,r,l)},mn=function(e){for(var r=new Array(e.length/2),a,n,i,o,s,u,l,v,f=0;f<e.length/4;f++){a=e[f*4],n=e[f*4+1],i=e[f*4+2],o=e[f*4+3],f<e.length/4-1?(s=e[(f+1)*4],u=e[(f+1)*4+1],l=e[(f+1)*4+2],v=e[(f+1)*4+3]):(s=e[0],u=e[1],l=e[2],v=e[3]);var c=er(a,n,i,o,s,u,l,v,!0);r[f*2]=c[0],r[f*2+1]=c[1]}return r},bn=function(e,r){for(var a=new Array(e.length*2),n,i,o,s,u=0;u<e.length/2;u++){n=e[u*2],i=e[u*2+1],u<e.length/2-1?(o=e[(u+1)*2],s=e[(u+1)*2+1]):(o=e[0],s=e[1]);var l=s-i,v=-(o-n),f=Math.sqrt(l*l+v*v),c=l/f,d=v/f;a[u*4]=n+c*r,a[u*4+1]=i+d*r,a[u*4+2]=o+c*r,a[u*4+3]=s+d*r}return a},Mh=function(e,r,a,n,i,o){var s=a-e,u=n-r;s/=i,u/=o;var l=Math.sqrt(s*s+u*u),v=l-1;if(v<0)return[];var f=v/l;return[(a-e)*f+e,(n-r)*f+r]},xr=function(e,r,a,n,i,o,s){return e-=i,r-=o,e/=a/2+s,r/=n/2+s,e*e+r*r<=1},ha=function(e,r,a,n,i,o,s){var u=[a-e,n-r],l=[e-i,r-o],v=u[0]*u[0]+u[1]*u[1],f=2*(l[0]*u[0]+l[1]*u[1]),c=l[0]*l[0]+l[1]*l[1]-s*s,d=f*f-4*v*c;if(d<0)return[];var h=(-f+Math.sqrt(d))/(2*v),g=(-f-Math.sqrt(d))/(2*v),p=Math.min(h,g),y=Math.max(h,g),b=[];if(p>=0&&p<=1&&b.push(p),y>=0&&y<=1&&b.push(y),b.length===0)return[];var m=b[0]*u[0]+e,w=b[0]*u[1]+r;return b.length>1?b[0]==b[1]?[m,w]:[m,w,b[1]*u[0]+e,b[1]*u[1]+r]:[m,w]},hi=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},er=function(e,r,a,n,i,o,s,u,l){var v=e-i,f=a-e,c=s-i,d=r-o,h=n-r,g=u-o,p=c*d-g*v,y=f*d-h*v,b=g*f-c*h;if(b!==0){var m=p/b,w=y/b,T=.001,C=0-T,x=1+T;return C<=m&&m<=x&&C<=w&&w<=x?[e+m*f,r+m*h]:l?[e+m*f,r+m*h]:[]}else return p===0||y===0?hi(e,a,s)===s?[s,u]:hi(e,a,i)===i?[i,o]:hi(i,s,a)===a?[a,n]:[]:[]},Lh=function(e,r,a,n,i){var o=[],s=n/2,u=i/2,l=r,v=a;o.push({x:l+s*e[0],y:v+u*e[1]});for(var f=1;f<e.length/2;f++)o.push({x:l+s*e[f*2],y:v+u*e[f*2+1]});return o},Ca=function(e,r,a,n,i,o,s,u){var l=[],v,f=new Array(a.length),c=!0;o==null&&(c=!1);var d;if(c){for(var h=0;h<f.length/2;h++)f[h*2]=a[h*2]*o+n,f[h*2+1]=a[h*2+1]*s+i;u>0?d=mn(bn(f,-u)):d=f}else d=a;for(var g,p,y,b,m=0;m<d.length/2;m++)g=d[m*2],p=d[m*2+1],m<d.length/2-1?(y=d[(m+1)*2],b=d[(m+1)*2+1]):(y=d[0],b=d[1]),v=er(e,r,n,i,g,p,y,b),v.length!==0&&l.push(v[0],v[1]);return l},Ih=function(e,r,a,n,i,o,s,u,l){var v=[],f,c=new Array(a.length*2);l.forEach(function(b,m){m===0?(c[c.length-2]=b.startX,c[c.length-1]=b.startY):(c[m*4-2]=b.startX,c[m*4-1]=b.startY),c[m*4]=b.stopX,c[m*4+1]=b.stopY,f=ha(e,r,n,i,b.cx,b.cy,b.radius),f.length!==0&&v.push(f[0],f[1])});for(var d=0;d<c.length/4;d++)f=er(e,r,n,i,c[d*4],c[d*4+1],c[d*4+2],c[d*4+3],!1),f.length!==0&&v.push(f[0],f[1]);if(v.length>2){for(var h=[v[0],v[1]],g=Math.pow(h[0]-e,2)+Math.pow(h[1]-r,2),p=1;p<v.length/2;p++){var y=Math.pow(v[p*2]-e,2)+Math.pow(v[p*2+1]-r,2);y<=g&&(h[0]=v[p*2],h[1]=v[p*2+1],g=y)}return h}return v},Wa=function(e,r,a){var n=[e[0]-r[0],e[1]-r[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),o=(i-a)/i;return o<0&&(o=1e-5),[r[0]+o*n[0],r[1]+o*n[1]]},pt=function(e,r){var a=ko(e,r);return a=mv(a),a},mv=function(e){for(var r,a,n=e.length/2,i=1/0,o=1/0,s=-1/0,u=-1/0,l=0;l<n;l++)r=e[2*l],a=e[2*l+1],i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);for(var v=2/(s-i),f=2/(u-o),c=0;c<n;c++)r=e[2*c]=e[2*c]*v,a=e[2*c+1]=e[2*c+1]*f,i=Math.min(i,r),s=Math.max(s,r),o=Math.min(o,a),u=Math.max(u,a);if(o<-1)for(var d=0;d<n;d++)a=e[2*d+1]=e[2*d+1]+(-1-o);return e},ko=function(e,r){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=r;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*a+n,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},ir=function(e,r){return Math.min(e/4,r/4,8)},bv=function(e,r){return Math.min(e/10,r/10,8)},rs=function(){return 8},Oh=function(e,r,a){return[e-2*r+a,2*(r-e),e]},Bo=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function di(t,e){function r(u){for(var l=[],v=0;v<u.length;v++){var f=u[v],c=u[(v+1)%u.length],d={x:c.x-f.x,y:c.y-f.y},h={x:-d.y,y:d.x},g=Math.sqrt(h.x*h.x+h.y*h.y);l.push({x:h.x/g,y:h.y/g})}return l}function a(u,l){var v=1/0,f=-1/0,c=Ct(u),d;try{for(c.s();!(d=c.n()).done;){var h=d.value,g=h.x*l.x+h.y*l.y;v=Math.min(v,g),f=Math.max(f,g)}}catch(p){c.e(p)}finally{c.f()}return{min:v,max:f}}function n(u,l){return!(u.max<l.min||l.max<u.min)}var i=Ct([].concat(dn(r(t)),dn(r(e)))),o;try{for(i.s();!(o=i.n()).done;){var s=o.value;if(!n(a(t,s),a(e,s)))return!1}}catch(u){i.e(u)}finally{i.f()}return!0}var Nh=vt({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),zh={pageRank:function(e){for(var r=Nh(e),a=r.dampingFactor,n=r.precision,i=r.iterations,o=r.weight,s=this._private.cy,u=this.byGroup(),l=u.nodes,v=u.edges,f=l.length,c=f*f,d=v.length,h=new Array(c),g=new Array(f),p=(1-a)/f,y=0;y<f;y++){for(var b=0;b<f;b++){var m=y*f+b;h[m]=0}g[y]=0}for(var w=0;w<d;w++){var T=v[w],C=T.data("source"),x=T.data("target");if(C!==x){var S=l.indexOfId(C),D=l.indexOfId(x),E=o(T),B=D*f+S;h[B]+=E,g[S]+=E}}for(var A=1/f+p,P=0;P<f;P++)if(g[P]===0)for(var M=0;M<f;M++){var R=M*f+P;h[R]=A}else for(var L=0;L<f;L++){var I=L*f+P;h[I]=h[I]/g[P]+p}for(var F=new Array(f),_=new Array(f),N,G=0;G<f;G++)F[G]=1;for(var Z=0;Z<i;Z++){for(var W=0;W<f;W++)_[W]=0;for(var $=0;$<f;$++)for(var Y=0;Y<f;Y++){var te=$*f+Y;_[$]+=h[te]*F[Y]}yh(_),N=F,F=_,_=N;for(var J=0,X=0;X<f;X++){var O=N[X]-F[X];J+=O*O}if(J<n)break}return{rank:function(q){return q=s.collection(q)[0],F[l.indexOf(q)]}}}},Ws=vt({root:null,weight:function(e){return 1},directed:!1,alpha:0}),$r={degreeCentralityNormalized:function(e){e=Ws(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var v={},f={},c=0,d=0,h=0;h<n;h++){var g=a[h],p=g.id();e.root=g;var y=this.degreeCentrality(e);c<y.indegree&&(c=y.indegree),d<y.outdegree&&(d=y.outdegree),v[p]=y.indegree,f[p]=y.outdegree}return{indegree:function(m){return c==0?0:(he(m)&&(m=r.filter(m)),v[m.id()]/c)},outdegree:function(m){return d===0?0:(he(m)&&(m=r.filter(m)),f[m.id()]/d)}}}else{for(var i={},o=0,s=0;s<n;s++){var u=a[s];e.root=u;var l=this.degreeCentrality(e);o<l.degree&&(o=l.degree),i[u.id()]=l.degree}return{degree:function(m){return o===0?0:(he(m)&&(m=r.filter(m)),i[m.id()]/o)}}}},degreeCentrality:function(e){e=Ws(e);var r=this.cy(),a=this,n=e,i=n.root,o=n.weight,s=n.directed,u=n.alpha;if(i=r.collection(i)[0],s){for(var d=i.connectedEdges(),h=d.filter(function(C){return C.target().same(i)&&a.has(C)}),g=d.filter(function(C){return C.source().same(i)&&a.has(C)}),p=h.length,y=g.length,b=0,m=0,w=0;w<h.length;w++)b+=o(h[w]);for(var T=0;T<g.length;T++)m+=o(g[T]);return{indegree:Math.pow(p,1-u)*Math.pow(b,u),outdegree:Math.pow(y,1-u)*Math.pow(m,u)}}else{for(var l=i.connectedEdges().intersection(a),v=l.length,f=0,c=0;c<l.length;c++)f+=o(l[c]);return{degree:Math.pow(v,1-u)*Math.pow(f,u)}}}};$r.dc=$r.degreeCentrality;$r.dcn=$r.degreeCentralityNormalised=$r.degreeCentralityNormalized;var Us=vt({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Wr={closenessCentralityNormalized:function(e){for(var r=Us(e),a=r.harmonic,n=r.weight,i=r.directed,o=this.cy(),s={},u=0,l=this.nodes(),v=this.floydWarshall({weight:n,directed:i}),f=0;f<l.length;f++){for(var c=0,d=l[f],h=0;h<l.length;h++)if(f!==h){var g=v.distance(d,l[h]);a?c+=1/g:c+=g}a||(c=1/c),u<c&&(u=c),s[d.id()]=c}return{closeness:function(y){return u==0?0:(he(y)?y=o.filter(y)[0].id():y=y.id(),s[y]/u)}}},closenessCentrality:function(e){var r=Us(e),a=r.root,n=r.weight,i=r.directed,o=r.harmonic;a=this.filter(a)[0];for(var s=this.dijkstra({root:a,weight:n,directed:i}),u=0,l=this.nodes(),v=0;v<l.length;v++){var f=l[v];if(!f.same(a)){var c=s.distanceTo(f);o?u+=1/c:u+=c}}return o?u:1/u}};Wr.cc=Wr.closenessCentrality;Wr.ccn=Wr.closenessCentralityNormalised=Wr.closenessCentralityNormalized;var Fh=vt({weight:null,directed:!1}),Po={betweennessCentrality:function(e){for(var r=Fh(e),a=r.directed,n=r.weight,i=n!=null,o=this.cy(),s=this.nodes(),u={},l={},v=0,f={set:function(m,w){l[m]=w,w>v&&(v=w)},get:function(m){return l[m]}},c=0;c<s.length;c++){var d=s[c],h=d.id();a?u[h]=d.outgoers().nodes():u[h]=d.openNeighborhood().nodes(),f.set(h,0)}for(var g=function(){for(var m=s[p].id(),w=[],T={},C={},x={},S=new Ia(function($,Y){return x[$]-x[Y]}),D=0;D<s.length;D++){var E=s[D].id();T[E]=[],C[E]=0,x[E]=1/0}for(C[m]=1,x[m]=0,S.push(m);!S.empty();){var B=S.pop();if(w.push(B),i)for(var A=0;A<u[B].length;A++){var P=u[B][A],M=o.getElementById(B),R=void 0;M.edgesTo(P).length>0?R=M.edgesTo(P)[0]:R=P.edgesTo(M)[0];var L=n(R);P=P.id(),x[P]>x[B]+L&&(x[P]=x[B]+L,S.nodes.indexOf(P)<0?S.push(P):S.updateItem(P),C[P]=0,T[P]=[]),x[P]==x[B]+L&&(C[P]=C[P]+C[B],T[P].push(B))}else for(var I=0;I<u[B].length;I++){var F=u[B][I].id();x[F]==1/0&&(S.push(F),x[F]=x[B]+1),x[F]==x[B]+1&&(C[F]=C[F]+C[B],T[F].push(B))}}for(var _={},N=0;N<s.length;N++)_[s[N].id()]=0;for(;w.length>0;){for(var G=w.pop(),Z=0;Z<T[G].length;Z++){var W=T[G][Z];_[W]=_[W]+C[W]/C[G]*(1+_[G])}G!=s[p].id()&&f.set(G,f.get(G)+_[G])}},p=0;p<s.length;p++)g();var y={betweenness:function(m){var w=o.collection(m).id();return f.get(w)},betweennessNormalized:function(m){if(v==0)return 0;var w=o.collection(m).id();return f.get(w)/v}};return y.betweennessNormalised=y.betweennessNormalized,y}};Po.bc=Po.betweennessCentrality;var Vh=vt({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),qh=function(e){return Vh(e)},_h=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},Gh=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},wv=function(e,r){for(var a,n=0;n<r;n++){a=0;for(var i=0;i<r;i++)a+=e[i*r+n];for(var o=0;o<r;o++)e[o*r+n]=e[o*r+n]/a}},Hh=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var o=0;o<a;o++)n[i*a+o]=0;for(var s=0;s<a;s++)for(var u=0;u<a;u++)n[i*a+u]+=e[i*a+s]*r[s*a+u]}return n},$h=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=Hh(e,n,r);return e},Wh=function(e,r,a){for(var n=new Array(r*r),i=0;i<r*r;i++)n[i]=Math.pow(e[i],a);return wv(n,r),n},Uh=function(e,r,a,n){for(var i=0;i<a;i++)if(Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n)!==Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n))return!1;return!0},Kh=function(e,r,a,n){for(var i=[],o=0;o<r;o++){for(var s=[],u=0;u<r;u++)Math.round(e[o*r+u]*1e3)/1e3>0&&s.push(a[u]);s.length!==0&&i.push(n.collection(s))}return i},Yh=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},Xh=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&Yh(e[r],e[a])&&e.splice(a,1);return e},Ks=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=qh(e),o={},s=0;s<r.length;s++)o[r[s].id()]=s;for(var u=r.length,l=u*u,v=new Array(l),f,c=0;c<l;c++)v[c]=0;for(var d=0;d<a.length;d++){var h=a[d],g=o[h.source().id()],p=o[h.target().id()],y=_h(h,i.attributes);v[g*u+p]+=y,v[p*u+g]+=y}Gh(v,u,i.multFactor),wv(v,u);for(var b=!0,m=0;b&&m<i.maxIterations;)b=!1,f=$h(v,u,i.expandFactor),v=Wh(f,u,i.inflateFactor),Uh(v,f,l,4)||(b=!0),m++;var w=Kh(v,u,r,n);return w=Xh(w),w},Zh={markovClustering:Ks,mcl:Ks},Qh=function(e){return e},xv=function(e,r){return Math.abs(r-e)},Ys=function(e,r,a){return e+xv(r,a)},Xs=function(e,r,a){return e+Math.pow(a-r,2)},Jh=function(e){return Math.sqrt(e)},jh=function(e,r,a){return Math.max(e,xv(r,a))},oa=function(e,r,a,n,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Qh,s=n,u,l,v=0;v<e;v++)u=r(v),l=a(v),s=i(s,u,l);return o(s)},Yr={euclidean:function(e,r,a){return e>=2?oa(e,r,a,0,Xs,Jh):oa(e,r,a,0,Ys)},squaredEuclidean:function(e,r,a){return oa(e,r,a,0,Xs)},manhattan:function(e,r,a){return oa(e,r,a,0,Ys)},max:function(e,r,a){return oa(e,r,a,-1/0,jh)}};Yr["squared-euclidean"]=Yr.squaredEuclidean;Yr.squaredeuclidean=Yr.squaredEuclidean;function In(t,e,r,a,n,i){var o;return We(t)?o=t:o=Yr[t]||Yr.euclidean,e===0&&We(t)?o(n,i):o(e,r,a,n,i)}var ed=vt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),as=function(e){return ed(e)},wn=function(e,r,a,n,i){var o=i!=="kMedoids"?function(v){return a[v]}:function(v){return n[v](a)},s=function(f){return n[f](r)},u=a,l=r;return In(e,n.length,o,s,u,l)},gi=function(e,r,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(r),u=null,l=0;l<n;l++)i[l]=e.min(a[l]).value,o[l]=e.max(a[l]).value;for(var v=0;v<r;v++){u=[];for(var f=0;f<n;f++)u[f]=Math.random()*(o[f]-i[f])+i[f];s[v]=u}return s},Ev=function(e,r,a,n,i){for(var o=1/0,s=0,u=0;u<r.length;u++){var l=wn(a,e,r[u],n,i);l<o&&(o=l,s=u)}return s},Cv=function(e,r,a){for(var n=[],i=null,o=0;o<r.length;o++)i=r[o],a[i.id()]===e&&n.push(i);return n},td=function(e,r,a){return Math.abs(r-e)<=a},rd=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)if(Math.abs(e[n][i]-r[n][i])>a)return!1;return!0},ad=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},Zs=function(e,r){var a=new Array(r);if(e.length<50)for(var n=0;n<r;n++){for(var i=e[Math.floor(Math.random()*e.length)];ad(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var o=0;o<r;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},Qs=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=wn("manhattan",r[i],e,a,"kMedoids");return n},nd=function(e){var r=this.cy(),a=this.nodes(),n=null,i=as(e),o=new Array(i.k),s={},u;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,u=gi(a,i.k,i.attributes)):je(i.testCentroids)==="object"?u=i.testCentroids:u=gi(a,i.k,i.attributes):u=gi(a,i.k,i.attributes);for(var l=!0,v=0;l&&v<i.maxIterations;){for(var f=0;f<a.length;f++)n=a[f],s[n.id()]=Ev(n,u,i.distance,i.attributes,"kMeans");l=!1;for(var c=0;c<i.k;c++){var d=Cv(c,a,s);if(d.length!==0){for(var h=i.attributes.length,g=u[c],p=new Array(h),y=new Array(h),b=0;b<h;b++){y[b]=0;for(var m=0;m<d.length;m++)n=d[m],y[b]+=i.attributes[b](n);p[b]=y[b]/d.length,td(p[b],g[b],i.sensitivityThreshold)||(l=!0)}u[c]=p,o[c]=r.collection(d)}}v++}return o},id=function(e){var r=this.cy(),a=this.nodes(),n=null,i=as(e),o=new Array(i.k),s,u={},l,v=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(je(i.testCentroids)==="object"?s=i.testCentroids:s=Zs(a,i.k)):s=Zs(a,i.k);for(var f=!0,c=0;f&&c<i.maxIterations;){for(var d=0;d<a.length;d++)n=a[d],u[n.id()]=Ev(n,s,i.distance,i.attributes,"kMedoids");f=!1;for(var h=0;h<s.length;h++){var g=Cv(h,a,u);if(g.length!==0){v[h]=Qs(s[h],g,i.attributes);for(var p=0;p<g.length;p++)l=Qs(g[p],g,i.attributes),l<v[h]&&(v[h]=l,s[h]=g[p],f=!0);o[h]=r.collection(g)}}c++}return o},od=function(e,r,a,n,i){for(var o,s,u=0;u<r.length;u++)for(var l=0;l<e.length;l++)n[u][l]=Math.pow(a[u][l],i.m);for(var v=0;v<e.length;v++)for(var f=0;f<i.attributes.length;f++){o=0,s=0;for(var c=0;c<r.length;c++)o+=n[c][v]*i.attributes[f](r[c]),s+=n[c][v];e[v][f]=o/s}},sd=function(e,r,a,n,i){for(var o=0;o<e.length;o++)r[o]=e[o].slice();for(var s,u,l,v=2/(i.m-1),f=0;f<a.length;f++)for(var c=0;c<n.length;c++){s=0;for(var d=0;d<a.length;d++)u=wn(i.distance,n[c],a[f],i.attributes,"cmeans"),l=wn(i.distance,n[c],a[d],i.attributes,"cmeans"),s+=Math.pow(u/l,v);e[c][f]=1/s}},ud=function(e,r,a,n){for(var i=new Array(a.k),o=0;o<i.length;o++)i[o]=[];for(var s,u,l=0;l<r.length;l++){s=-1/0,u=-1;for(var v=0;v<r[0].length;v++)r[l][v]>s&&(s=r[l][v],u=v);i[u].push(e[l])}for(var f=0;f<i.length;f++)i[f]=n.collection(i[f]);return i},Js=function(e){var r=this.cy(),a=this.nodes(),n=as(e),i,o,s,u,l;u=new Array(a.length);for(var v=0;v<a.length;v++)u[v]=new Array(n.k);s=new Array(a.length);for(var f=0;f<a.length;f++)s[f]=new Array(n.k);for(var c=0;c<a.length;c++){for(var d=0,h=0;h<n.k;h++)s[c][h]=Math.random(),d+=s[c][h];for(var g=0;g<n.k;g++)s[c][g]=s[c][g]/d}o=new Array(n.k);for(var p=0;p<n.k;p++)o[p]=new Array(n.attributes.length);l=new Array(a.length);for(var y=0;y<a.length;y++)l[y]=new Array(n.k);for(var b=!0,m=0;b&&m<n.maxIterations;)b=!1,od(o,a,s,l,n),sd(s,u,o,a,n),rd(s,u,n.sensitivityThreshold)||(b=!0),m++;return i=ud(a,s,n,r),{clusters:i,degreeOfMembership:s}},ld={kMeans:nd,kMedoids:id,fuzzyCMeans:Js,fcm:Js},vd=vt({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),fd={single:"min",complete:"max"},cd=function(e){var r=vd(e),a=fd[r.linkage];return a!=null&&(r.linkage=a),r},js=function(e,r,a,n,i){for(var o=0,s=1/0,u,l=i.attributes,v=function(D,E){return In(i.distance,l.length,function(B){return l[B](D)},function(B){return l[B](E)},D,E)},f=0;f<e.length;f++){var c=e[f].key,d=a[c][n[c]];d<s&&(o=c,s=d)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var h=r[o],g=r[n[o]],p;i.mode==="dendrogram"?p={left:h,right:g,key:h.key}:p={value:h.value.concat(g.value),key:h.key},e[h.index]=p,e.splice(g.index,1),r[h.key]=p;for(var y=0;y<e.length;y++){var b=e[y];h.key===b.key?u=1/0:i.linkage==="min"?(u=a[h.key][b.key],a[h.key][b.key]>a[g.key][b.key]&&(u=a[g.key][b.key])):i.linkage==="max"?(u=a[h.key][b.key],a[h.key][b.key]<a[g.key][b.key]&&(u=a[g.key][b.key])):i.linkage==="mean"?u=(a[h.key][b.key]*h.size+a[g.key][b.key]*g.size)/(h.size+g.size):i.mode==="dendrogram"?u=v(b.value,h.value):u=v(b.value[0],h.value[0]),a[h.key][b.key]=a[b.key][h.key]=u}for(var m=0;m<e.length;m++){var w=e[m].key;if(n[w]===h.key||n[w]===g.key){for(var T=w,C=0;C<e.length;C++){var x=e[C].key;a[w][x]<a[w][T]&&(T=x)}n[w]=T}e[m].index=m}return h.key=g.key=h.index=g.index=null,!0},_r=function(e,r,a){e&&(e.value?r.push(e.value):(e.left&&_r(e.left,r),e.right&&_r(e.right,r)))},Ao=function(e,r){if(!e)return"";if(e.left&&e.right){var a=Ao(e.left,r),n=Ao(e.right,r),i=r.add({group:"nodes",data:{id:a+","+n}});return r.add({group:"edges",data:{source:a,target:i.id()}}),r.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Ro=function(e,r,a){if(!e)return[];var n=[],i=[],o=[];return r===0?(e.left&&_r(e.left,n),e.right&&_r(e.right,i),o=n.concat(i),[a.collection(o)]):r===1?e.value?[a.collection(e.value)]:(e.left&&_r(e.left,n),e.right&&_r(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=Ro(e.left,r-1,a)),e.right&&(i=Ro(e.right,r-1,a)),n.concat(i))},eu=function(e){for(var r=this.cy(),a=this.nodes(),n=cd(e),i=n.attributes,o=function(m,w){return In(n.distance,i.length,function(T){return i[T](m)},function(T){return i[T](w)},m,w)},s=[],u=[],l=[],v=[],f=0;f<a.length;f++){var c={value:n.mode==="dendrogram"?a[f]:[a[f]],key:f,index:f};s[f]=c,v[f]=c,u[f]=[],l[f]=0}for(var d=0;d<s.length;d++)for(var h=0;h<=d;h++){var g=void 0;n.mode==="dendrogram"?g=d===h?1/0:o(s[d].value,s[h].value):g=d===h?1/0:o(s[d].value[0],s[h].value[0]),u[d][h]=g,u[h][d]=g,g<u[d][l[d]]&&(l[d]=h)}for(var p=js(s,v,u,l,n);p;)p=js(s,v,u,l,n);var y;return n.mode==="dendrogram"?(y=Ro(s[0],n.dendrogramDepth,r),n.addDendrogram&&Ao(s[0],r)):(y=new Array(s.length),s.forEach(function(b,m){b.key=b.index=null,y[m]=r.collection(b.value)})),y},hd={hierarchicalClustering:eu,hca:eu},dd=vt({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),gd=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||He("Damping must range on [0.5, 1). Got: ".concat(r));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||re(a)||He("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),dd(e)},pd=function(e,r,a,n){var i=function(s,u){return n[u](s)};return-In(e,n.length,function(o){return i(r,o)},function(o){return i(a,o)},r,a)},yd=function(e,r){var a=null;return r==="median"?a=gh(e):r==="mean"?a=dh(e):r==="min"?a=ch(e):r==="max"?a=hh(e):a=r,a},md=function(e,r,a){for(var n=[],i=0;i<e;i++)r[i*e+i]+a[i*e+i]>0&&n.push(i);return n},tu=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var o=-1,s=-1/0,u=0;u<a.length;u++){var l=a[u];r[i*e+l]>s&&(o=l,s=r[i*e+l])}o>0&&n.push(o)}for(var v=0;v<a.length;v++)n[a[v]]=a[v];return n},bd=function(e,r,a){for(var n=tu(e,r,a),i=0;i<a.length;i++){for(var o=[],s=0;s<n.length;s++)n[s]===a[i]&&o.push(s);for(var u=-1,l=-1/0,v=0;v<o.length;v++){for(var f=0,c=0;c<o.length;c++)f+=r[o[c]*e+o[v]];f>l&&(u=v,l=f)}a[i]=o[u]}return n=tu(e,r,a),n},ru=function(e){for(var r=this.cy(),a=this.nodes(),n=gd(e),i={},o=0;o<a.length;o++)i[a[o].id()]=o;var s,u,l,v,f,c;s=a.length,u=s*s,l=new Array(u);for(var d=0;d<u;d++)l[d]=-1/0;for(var h=0;h<s;h++)for(var g=0;g<s;g++)h!==g&&(l[h*s+g]=pd(n.distance,a[h],a[g],n.attributes));v=yd(l,n.preference);for(var p=0;p<s;p++)l[p*s+p]=v;f=new Array(u);for(var y=0;y<u;y++)f[y]=0;c=new Array(u);for(var b=0;b<u;b++)c[b]=0;for(var m=new Array(s),w=new Array(s),T=new Array(s),C=0;C<s;C++)m[C]=0,w[C]=0,T[C]=0;for(var x=new Array(s*n.minIterations),S=0;S<x.length;S++)x[S]=0;var D;for(D=0;D<n.maxIterations;D++){for(var E=0;E<s;E++){for(var B=-1/0,A=-1/0,P=-1,M=0,R=0;R<s;R++)m[R]=f[E*s+R],M=c[E*s+R]+l[E*s+R],M>=B?(A=B,B=M,P=R):M>A&&(A=M);for(var L=0;L<s;L++)f[E*s+L]=(1-n.damping)*(l[E*s+L]-B)+n.damping*m[L];f[E*s+P]=(1-n.damping)*(l[E*s+P]-A)+n.damping*m[P]}for(var I=0;I<s;I++){for(var F=0,_=0;_<s;_++)m[_]=c[_*s+I],w[_]=Math.max(0,f[_*s+I]),F+=w[_];F-=w[I],w[I]=f[I*s+I],F+=w[I];for(var N=0;N<s;N++)c[N*s+I]=(1-n.damping)*Math.min(0,F-w[N])+n.damping*m[N];c[I*s+I]=(1-n.damping)*(F-w[I])+n.damping*m[I]}for(var G=0,Z=0;Z<s;Z++){var W=c[Z*s+Z]+f[Z*s+Z]>0?1:0;x[D%n.minIterations*s+Z]=W,G+=W}if(G>0&&(D>=n.minIterations-1||D==n.maxIterations-1)){for(var $=0,Y=0;Y<s;Y++){T[Y]=0;for(var te=0;te<n.minIterations;te++)T[Y]+=x[te*s+Y];(T[Y]===0||T[Y]===n.minIterations)&&$++}if($===s)break}}for(var J=md(s,f,c),X=bd(s,l,J),O={},V=0;V<J.length;V++)O[J[V]]=[];for(var q=0;q<a.length;q++){var j=X[i[a[q].id()]];j!=null&&O[j].push(a[q])}for(var ue=new Array(J.length),we=0;we<J.length;we++)ue[we]=r.collection(O[J[we]]);return ue},wd={affinityPropagation:ru,ap:ru},xd=vt({root:void 0,directed:!1}),Ed={hierholzer:function(e){if(!Re(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=xd(e),n=a.root,i=a.directed,o=this,s=!1,u,l,v;n&&(v=he(n)?this.filter(n)[0].id():n[0].id());var f={},c={};i?o.forEach(function(b){var m=b.id();if(b.isNode()){var w=b.indegree(!0),T=b.outdegree(!0),C=w-T,x=T-w;C==1?u?s=!0:u=m:x==1?l?s=!0:l=m:(x>1||C>1)&&(s=!0),f[m]=[],b.outgoers().forEach(function(S){S.isEdge()&&f[m].push(S.id())})}else c[m]=[void 0,b.target().id()]}):o.forEach(function(b){var m=b.id();b.isNode()?(b.degree(!0)%2&&(u?l?s=!0:l=m:u=m),f[m]=[],b.connectedEdges().forEach(function(w){return f[m].push(w.id())})):c[m]=[b.source().id(),b.target().id()]});var d={found:!1,trail:void 0};if(s)return d;if(l&&u)if(i){if(v&&l!=v)return d;v=l}else{if(v&&l!=v&&u!=v)return d;v||(v=l)}else v||(v=o[0].id());var h=function(m){for(var w=m,T=[m],C,x,S;f[w].length;)C=f[w].shift(),x=c[C][0],S=c[C][1],w!=S?(f[S]=f[S].filter(function(D){return D!=C}),w=S):!i&&w!=x&&(f[x]=f[x].filter(function(D){return D!=C}),w=x),T.unshift(C),T.unshift(w);return T},g=[],p=[];for(p=h(v);p.length!=1;)f[p[0]].length==0?(g.unshift(o.getElementById(p.shift())),g.unshift(o.getElementById(p.shift()))):p=h(p.shift()).concat(p);g.unshift(o.getElementById(p.shift()));for(var y in f)if(f[y].length)return d;return d.found=!0,d.trail=this.spawn(g,!0),d}},Ua=function(){var e=this,r={},a=0,n=0,i=[],o=[],s={},u=function(c,d){for(var h=o.length-1,g=[],p=e.spawn();o[h].x!=c||o[h].y!=d;)g.push(o.pop().edge),h--;g.push(o.pop().edge),g.forEach(function(y){var b=y.connectedNodes().intersection(e);p.merge(y),b.forEach(function(m){var w=m.id(),T=m.connectedEdges().intersection(e);p.merge(m),r[w].cutVertex?p.merge(T.filter(function(C){return C.isLoop()})):p.merge(T)})}),i.push(p)},l=function(c,d,h){c===h&&(n+=1),r[d]={id:a,low:a++,cutVertex:!1};var g=e.getElementById(d).connectedEdges().intersection(e);if(g.size()===0)i.push(e.spawn(e.getElementById(d)));else{var p,y,b,m;g.forEach(function(w){p=w.source().id(),y=w.target().id(),b=p===d?y:p,b!==h&&(m=w.id(),s[m]||(s[m]=!0,o.push({x:d,y:b,edge:w})),b in r?r[d].low=Math.min(r[d].low,r[b].id):(l(c,b,d),r[d].low=Math.min(r[d].low,r[b].low),r[d].id<=r[b].low&&(r[d].cutVertex=!0,u(d,b))))})}};e.forEach(function(f){if(f.isNode()){var c=f.id();c in r||(n=0,l(c,c),r[c].cutVertex=n>1)}});var v=Object.keys(r).filter(function(f){return r[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(v),components:i}},Cd={hopcroftTarjanBiconnected:Ua,htbc:Ua,htb:Ua,hopcroftTarjanBiconnectedComponents:Ua},Ka=function(){var e=this,r={},a=0,n=[],i=[],o=e.spawn(e),s=function(l){if(i.push(l),r[l]={index:a,low:a++,explored:!1},e.getElementById(l).connectedEdges().intersection(e).forEach(function(h){var g=h.target().id();g!==l&&(g in r||s(g),r[g].explored||(r[l].low=Math.min(r[l].low,r[g].low)))}),r[l].index===r[l].low){for(var v=e.spawn();;){var f=i.pop();if(v.merge(e.getElementById(f)),r[f].low=r[l].index,r[f].explored=!0,f===l)break}var c=v.edgesWith(v),d=v.merge(c);n.push(d),o=o.difference(d)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in r||s(l)}}),{cut:o,components:n}},Td={tarjanStronglyConnected:Ka,tsc:Ka,tscc:Ka,tarjanStronglyConnectedComponents:Ka},Tv={};[xa,eh,th,ah,ih,sh,vh,zh,$r,Wr,Po,Zh,ld,hd,wd,Ed,Cd,Td].forEach(function(t){ge(Tv,t)});var Sv=0,Dv=1,kv=2,Lt=function(e){if(!(this instanceof Lt))return new Lt(e);this.id="Thenable/1.0.7",this.state=Sv,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Lt.prototype={fulfill:function(e){return au(this,Dv,"fulfillValue",e)},reject:function(e){return au(this,kv,"rejectReason",e)},then:function(e,r){var a=this,n=new Lt;return a.onFulfilled.push(iu(e,n,"fulfill")),a.onRejected.push(iu(r,n,"reject")),Bv(a),n.proxy}};var au=function(e,r,a,n){return e.state===Sv&&(e.state=r,e[a]=n,Bv(e)),e},Bv=function(e){e.state===Dv?nu(e,"onFulfilled",e.fulfillValue):e.state===kv&&nu(e,"onRejected",e.rejectReason)},nu=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var s=0;s<n.length;s++)n[s](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},iu=function(e,r,a){return function(n){if(typeof e!="function")r[a].call(r,n);else{var i;try{i=e(n)}catch(o){r.reject(o);return}Pv(r,i)}}},Pv=function(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(je(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(r,function(i){n||(n=!0,i===r?e.reject(new TypeError("circular thenable chain")):Pv(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(r)};Lt.all=function(t){return new Lt(function(e,r){for(var a=new Array(t.length),n=0,i=function(u,l){a[u]=l,n++,n===t.length&&e(a)},o=0;o<t.length;o++)(function(s){var u=t[s];u!=null&&u.then!=null?u.then(function(l){i(s,l)},function(l){r(l)}):i(s,u)})(o)})};Lt.resolve=function(t){return new Lt(function(e,r){e(t)})};Lt.reject=function(t){return new Lt(function(e,r){r(t)})};var jr=typeof Promise<"u"?Promise:Lt,Mo=function(e,r,a){var n=Ko(e),i=!n,o=this._private=ge({duration:1e3},r,a);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&We(o.complete)&&o.completes.push(o.complete),i){var s=e.position();o.startPosition=o.startPosition||{x:s.x,y:s.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(n){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},Tr=Mo.prototype;ge(Tr,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),Tt(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(l,v){var f=e[l];f!=null&&(e[l]=e[v],e[v]=f)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],o=i.name,s=e.startStyle[o];e.startStyle[o]=i,e.style[n]=s}return r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new jr(function(n,i){a.push(function(){n()})})}});Tr.complete=Tr.completed;Tr.run=Tr.play;Tr.running=Tr.playing;var Sd={animated:function(){return function(){var r=this,a=r.length!==void 0?r:[r];if(!(this._private.cy||this).styleEnabled())return!1;var n=a[0];if(n)return n._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0?r:[r];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n<a.length;n++){var i=a[n];i._private.animation.queue=[]}return this}},delay:function(){return function(r,a){return(this._private.cy||this).styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){return(this._private.cy||this).styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this,u=!i,l=!u;if(!s.styleEnabled())return this;var v=s.style();if(r=ge({},r,a),Object.keys(r).length===0)return new Mo(o[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(l&&(r.style=v.getPropsList(r.style||r.css),r.css=void 0),l&&r.renderedPosition!=null){var f=r.renderedPosition,c=s.pan(),d=s.zoom();r.position=dv(f,d,c)}if(u&&r.panBy!=null){var h=r.panBy,g=s.pan();r.pan={x:g.x+h.x,y:g.y+h.y}}var p=r.center||r.centre;if(u&&p!=null){var y=s.getCenterPan(p.eles,r.zoom);y!=null&&(r.pan=y)}if(u&&r.fit!=null){var b=r.fit,m=s.getFitViewport(b.eles||b.boundingBox,b.padding);m!=null&&(r.pan=m.pan,r.zoom=m.zoom)}if(u&&Re(r.zoom)){var w=s.getZoomedViewport(r.zoom);w!=null?(w.zoomed&&(r.zoom=w.zoom),w.panned&&(r.pan=w.pan)):r.zoom=null}return new Mo(o[0],r)}},animate:function(){return function(r,a){var n=this,i=n.length!==void 0?n:[n];if(!(this._private.cy||this).styleEnabled())return this;a&&(r=ge({},r,a));for(var o=0;o<i.length;o++){var s=i[o],u=s.animated()&&(r.queue===void 0||r.queue);s.animation(r,u?{queue:!0}:void 0).play()}return this}},stop:function(){return function(r,a){var n=this,i=n.length!==void 0?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var s=0;s<i.length;s++){for(var u=i[s]._private,l=u.animation.current,v=0;v<l.length;v++){var f=l[v]._private;a&&(f.duration=0)}r&&(u.animation.queue=[]),a||(u.animation.current=[])}return o.notify("draw"),this}}},pi,ou;function On(){return ou||(ou=1,pi=Array.isArray),pi}var yi,su;function Dd(){if(su)return yi;su=1;var t=On(),e=Ma(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function n(i,o){if(t(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:a.test(i)||!r.test(i)||o!=null&&i in Object(o)}return yi=n,yi}var mi,uu;function kd(){if(uu)return mi;uu=1;var t=iv(),e=Ra(),r="[object AsyncFunction]",a="[object Function]",n="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var u=t(s);return u==a||u==n||u==r||u==i}return mi=o,mi}var bi,lu;function Bd(){return lu||(lu=1,bi=Rn()["__core-js_shared__"]),bi}var wi,vu;function Pd(){if(vu)return wi;vu=1;var t=Bd(),e=(function(){var a=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function r(a){return!!e&&e in a}return wi=r,wi}var xi,fu;function Ad(){if(fu)return xi;fu=1;var t=Function.prototype.toString;function e(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return xi=e,xi}var Ei,cu;function Rd(){if(cu)return Ei;cu=1;var t=kd(),e=Pd(),r=Ra(),a=Ad(),n=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,v=RegExp("^"+u.call(l).replace(n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(c){return!r(c)||e(c)?!1:(t(c)?v:i).test(a(c))}return Ei=f,Ei}var Ci,hu;function Md(){if(hu)return Ci;hu=1;function t(e,r){return e?.[r]}return Ci=t,Ci}var Ti,du;function ns(){if(du)return Ti;du=1;var t=Rd(),e=Md();function r(a,n){var i=e(a,n);return t(i)?i:void 0}return Ti=r,Ti}var Si,gu;function Nn(){return gu||(gu=1,Si=ns()(Object,"create")),Si}var Di,pu;function Ld(){if(pu)return Di;pu=1;var t=Nn();function e(){this.__data__=t?t(null):{},this.size=0}return Di=e,Di}var ki,yu;function Id(){if(yu)return ki;yu=1;function t(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}return ki=t,ki}var Bi,mu;function Od(){if(mu)return Bi;mu=1;var t=Nn(),e="__lodash_hash_undefined__",r=Object.prototype.hasOwnProperty;function a(n){var i=this.__data__;if(t){var o=i[n];return o===e?void 0:o}return r.call(i,n)?i[n]:void 0}return Bi=a,Bi}var Pi,bu;function Nd(){if(bu)return Pi;bu=1;var t=Nn(),e=Object.prototype.hasOwnProperty;function r(a){var n=this.__data__;return t?n[a]!==void 0:e.call(n,a)}return Pi=r,Pi}var Ai,wu;function zd(){if(wu)return Ai;wu=1;var t=Nn(),e="__lodash_hash_undefined__";function r(a,n){var i=this.__data__;return this.size+=this.has(a)?0:1,i[a]=t&&n===void 0?e:n,this}return Ai=r,Ai}var Ri,xu;function Fd(){if(xu)return Ri;xu=1;var t=Ld(),e=Id(),r=Od(),a=Nd(),n=zd();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,Ri=i,Ri}var Mi,Eu;function Vd(){if(Eu)return Mi;Eu=1;function t(){this.__data__=[],this.size=0}return Mi=t,Mi}var Li,Cu;function Av(){if(Cu)return Li;Cu=1;function t(e,r){return e===r||e!==e&&r!==r}return Li=t,Li}var Ii,Tu;function zn(){if(Tu)return Ii;Tu=1;var t=Av();function e(r,a){for(var n=r.length;n--;)if(t(r[n][0],a))return n;return-1}return Ii=e,Ii}var Oi,Su;function qd(){if(Su)return Oi;Su=1;var t=zn(),e=Array.prototype.splice;function r(a){var n=this.__data__,i=t(n,a);return i<0?!1:(i==n.length-1?n.pop():e.call(n,i,1),--this.size,!0)}return Oi=r,Oi}var Ni,Du;function _d(){if(Du)return Ni;Du=1;var t=zn();function e(r){var a=this.__data__,n=t(a,r);return n<0?void 0:a[n][1]}return Ni=e,Ni}var zi,ku;function Gd(){if(ku)return zi;ku=1;var t=zn();function e(r){return t(this.__data__,r)>-1}return zi=e,zi}var Fi,Bu;function Hd(){if(Bu)return Fi;Bu=1;var t=zn();function e(r,a){var n=this.__data__,i=t(n,r);return i<0?(++this.size,n.push([r,a])):n[i][1]=a,this}return Fi=e,Fi}var Vi,Pu;function $d(){if(Pu)return Vi;Pu=1;var t=Vd(),e=qd(),r=_d(),a=Gd(),n=Hd();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,Vi=i,Vi}var qi,Au;function Wd(){return Au||(Au=1,qi=ns()(Rn(),"Map")),qi}var _i,Ru;function Ud(){if(Ru)return _i;Ru=1;var t=Fd(),e=$d(),r=Wd();function a(){this.size=0,this.__data__={hash:new t,map:new(r||e),string:new t}}return _i=a,_i}var Gi,Mu;function Kd(){if(Mu)return Gi;Mu=1;function t(e){var r=typeof e;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?e!=="__proto__":e===null}return Gi=t,Gi}var Hi,Lu;function Fn(){if(Lu)return Hi;Lu=1;var t=Kd();function e(r,a){var n=r.__data__;return t(a)?n[typeof a=="string"?"string":"hash"]:n.map}return Hi=e,Hi}var $i,Iu;function Yd(){if(Iu)return $i;Iu=1;var t=Fn();function e(r){var a=t(this,r).delete(r);return this.size-=a?1:0,a}return $i=e,$i}var Wi,Ou;function Xd(){if(Ou)return Wi;Ou=1;var t=Fn();function e(r){return t(this,r).get(r)}return Wi=e,Wi}var Ui,Nu;function Zd(){if(Nu)return Ui;Nu=1;var t=Fn();function e(r){return t(this,r).has(r)}return Ui=e,Ui}var Ki,zu;function Qd(){if(zu)return Ki;zu=1;var t=Fn();function e(r,a){var n=t(this,r),i=n.size;return n.set(r,a),this.size+=n.size==i?0:1,this}return Ki=e,Ki}var Yi,Fu;function Jd(){if(Fu)return Yi;Fu=1;var t=Ud(),e=Yd(),r=Xd(),a=Zd(),n=Qd();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return i.prototype.clear=t,i.prototype.delete=e,i.prototype.get=r,i.prototype.has=a,i.prototype.set=n,Yi=i,Yi}var Xi,Vu;function jd(){if(Vu)return Xi;Vu=1;var t=Jd(),e="Expected a function";function r(a,n){if(typeof a!="function"||n!=null&&typeof n!="function")throw new TypeError(e);var i=function(){var o=arguments,s=n?n.apply(this,o):o[0],u=i.cache;if(u.has(s))return u.get(s);var l=a.apply(this,o);return i.cache=u.set(s,l)||u,l};return i.cache=new(r.Cache||t),i}return r.Cache=t,Xi=r,Xi}var Zi,qu;function eg(){if(qu)return Zi;qu=1;var t=jd(),e=500;function r(a){var n=t(a,function(o){return i.size===e&&i.clear(),o}),i=n.cache;return n}return Zi=r,Zi}var Qi,_u;function Rv(){if(_u)return Qi;_u=1;var t=eg(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g;return Qi=t(function(a){var n=[];return a.charCodeAt(0)===46&&n.push(""),a.replace(e,function(i,o,s,u){n.push(s?u.replace(r,"$1"):o||i)}),n}),Qi}var Ji,Gu;function Mv(){if(Gu)return Ji;Gu=1;function t(e,r){for(var a=-1,n=e==null?0:e.length,i=Array(n);++a<n;)i[a]=r(e[a],a,e);return i}return Ji=t,Ji}var ji,Hu;function tg(){if(Hu)return ji;Hu=1;var t=Xo(),e=Mv(),r=On(),a=Ma(),n=t?t.prototype:void 0,i=n?n.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return e(s,o)+"";if(a(s))return i?i.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return ji=o,ji}var eo,$u;function Lv(){if($u)return eo;$u=1;var t=tg();function e(r){return r==null?"":t(r)}return eo=e,eo}var to,Wu;function Iv(){if(Wu)return to;Wu=1;var t=On(),e=Dd(),r=Rv(),a=Lv();function n(i,o){return t(i)?i:e(i,o)?[i]:r(a(i))}return to=n,to}var ro,Uu;function is(){if(Uu)return ro;Uu=1;var t=Ma();function e(r){if(typeof r=="string"||t(r))return r;var a=r+"";return a=="0"&&1/r==-1/0?"-0":a}return ro=e,ro}var ao,Ku;function rg(){if(Ku)return ao;Ku=1;var t=Iv(),e=is();function r(a,n){n=t(n,a);for(var i=0,o=n.length;a!=null&&i<o;)a=a[e(n[i++])];return i&&i==o?a:void 0}return ao=r,ao}var no,Yu;function ag(){if(Yu)return no;Yu=1;var t=rg();function e(r,a,n){var i=r==null?void 0:t(r,a);return i===void 0?n:i}return no=e,no}var ng=Aa(ag()),io,Xu;function ig(){if(Xu)return io;Xu=1;var t=ns();return io=(function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch{}})(),io}var oo,Zu;function og(){if(Zu)return oo;Zu=1;var t=ig();function e(r,a,n){a=="__proto__"&&t?t(r,a,{configurable:!0,enumerable:!0,value:n,writable:!0}):r[a]=n}return oo=e,oo}var so,Qu;function sg(){if(Qu)return so;Qu=1;var t=og(),e=Av(),r=Object.prototype.hasOwnProperty;function a(n,i,o){var s=n[i];(!(r.call(n,i)&&e(s,o))||o===void 0&&!(i in n))&&t(n,i,o)}return so=a,so}var uo,Ju;function ug(){if(Ju)return uo;Ju=1;var t=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function r(a,n){var i=typeof a;return n=n??t,!!n&&(i=="number"||i!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<n}return uo=r,uo}var lo,ju;function lg(){if(ju)return lo;ju=1;var t=sg(),e=Iv(),r=ug(),a=Ra(),n=is();function i(o,s,u,l){if(!a(o))return o;s=e(s,o);for(var v=-1,f=s.length,c=f-1,d=o;d!=null&&++v<f;){var h=n(s[v]),g=u;if(h==="__proto__"||h==="constructor"||h==="prototype")return o;if(v!=c){var p=d[h];g=l?l(p,h,d):void 0,g===void 0&&(g=a(p)?p:r(s[v+1])?[]:{})}t(d,h,g),d=d[h]}return o}return lo=i,lo}var vo,el;function vg(){if(el)return vo;el=1;var t=lg();function e(r,a,n){return r==null?r:t(r,a,n)}return vo=e,vo}var fg=Aa(vg()),fo,tl;function cg(){if(tl)return fo;tl=1;function t(e,r){var a=-1,n=e.length;for(r||(r=Array(n));++a<n;)r[a]=e[a];return r}return fo=t,fo}var co,rl;function hg(){if(rl)return co;rl=1;var t=Mv(),e=cg(),r=On(),a=Ma(),n=Rv(),i=is(),o=Lv();function s(u){return r(u)?t(u,i):a(u)?[u]:e(n(o(u)))}return co=s,co}var dg=Aa(hg()),gg={data:function(e){return e=ge({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(a){},beforeSet:function(a,n){},onSet:function(a){},canSet:function(a){return!0}},e),function(a,n){var i=e,o=this,s=o.length!==void 0,u=s?o:[o],l=s?o[0]:o;if(he(a)){var v=a.indexOf(".")!==-1&&dg(a);if(i.allowGetting&&n===void 0){var f;return l&&(i.beforeGet(l),v&&l._private[i.field][a]===void 0?f=ng(l._private[i.field],v):f=l._private[i.field][a]),f}else if(i.allowSetting&&n!==void 0&&!i.immutableKeys[a]){var c=Xl({},a,n);i.beforeSet(o,c);for(var d=0,h=u.length;d<h;d++){var g=u[d];i.canSet(g)&&(v&&l._private[i.field][a]===void 0?fg(g._private[i.field],v,n):g._private[i.field][a]=n)}i.updateStyle&&o.updateStyle(),i.onSet(o),i.settingTriggersEvent&&o[i.triggerFnName](i.settingEvent)}}else if(i.allowSetting&&Re(a)){var p=a,y,b,m=Object.keys(p);i.beforeSet(o,p);for(var w=0;w<m.length;w++)if(y=m[w],b=p[y],!i.immutableKeys[y])for(var T=0;T<u.length;T++){var C=u[T];i.canSet(C)&&(C._private[i.field][y]=b)}i.updateStyle&&o.updateStyle(),i.onSet(o),i.settingTriggersEvent&&o[i.triggerFnName](i.settingEvent)}else if(i.allowBinding&&We(a)){var x=a;o.on(i.bindingEvent,x)}else if(i.allowGetting&&a===void 0){var S;return l&&(i.beforeGet(l),S=l._private[i.field]),S}return o}},removeData:function(e){return e=ge({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(a){var n=e,i=this,o=i.length!==void 0?i:[i];if(he(a)){for(var s=a.split(/\s+/),u=s.length,l=0;l<u;l++){var v=s[l];if(!ar(v)&&!n.immutableKeys[v])for(var f=0,c=o.length;f<c;f++)o[f]._private[n.field][v]=void 0}n.triggerEvent&&i[n.triggerFnName](n.event)}else if(a===void 0){for(var d=0,h=o.length;d<h;d++)for(var g=o[d]._private[n.field],p=Object.keys(g),y=0;y<p.length;y++){var b=p[y];n.immutableKeys[b]||(g[b]=void 0)}n.triggerEvent&&i[n.triggerFnName](n.event)}return i}}},pg={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,n){var i=this,o=Array.prototype.slice.call(arguments,0);return new jr(function(s,u){var l=o.concat([function(c){i.off.apply(i,v),s(c)}]),v=l.concat([]);i.on.apply(i,l)})}}},Le={};[Sd,gg,pg].forEach(function(t){ge(Le,t)});var yg={animate:Le.animate(),animation:Le.animation(),animated:Le.animated(),clearQueue:Le.clearQueue(),delay:Le.delay(),delayAnimation:Le.delayAnimation(),stop:Le.stop()},on={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(d){return a.push(d)}),a}else ze(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new Jr(e),o=0;o<r.length;o++){for(var s=r[o],u=s._private,l=u.classes,v=!1,f=0;f<e.length;f++){var c=e[f];if(!l.has(c)){v=!0;break}}v||(v=l.size!==e.length),v&&(u.classes=i,n.push(s))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){ze(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],o=0,s=a.length;o<s;o++)for(var u=a[o],l=u._private.classes,v=!1,f=0;f<e.length;f++){var c=e[f],d=l.has(c),h=!1;r||n&&!d?(l.add(c),h=!0):(!r||n&&d)&&(l.delete(c),h=!0),!v&&h&&(i.push(u),v=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};on.className=on.classNames=on.classes;var Ae={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Je,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ae.variable="(?:[\\w-.]|(?:\\\\"+Ae.metaChar+"))+";Ae.className="(?:[\\w-]|(?:\\\\"+Ae.metaChar+"))+";Ae.value=Ae.string+"|"+Ae.number;Ae.id=Ae.variable;(function(){var t=Ae.comparatorOp.split("|"),e,r;for(r=0;r<t.length;r++)e=t[r],Ae.comparatorOp+="|@"+e;for(t=Ae.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Ae.comparatorOp+="|\\!"+e)})();var Oe=function(){return{checks:[]}},se={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Lo=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return xc(t.selector,e.selector)}),mg=(function(){for(var t={},e,r=0;r<Lo.length;r++)e=Lo[r],t[e.selector]=e.matches;return t})(),bg=function(e,r){return mg[e](r)},wg="("+Lo.map(function(t){return t.selector}).join("|")+")",Rr=function(e){return e.replace(new RegExp("\\\\("+Ae.metaChar+")","g"),function(r,a){return a})},Zt=function(e,r,a){e[e.length-1]=a},Io=[{name:"group",query:!0,regex:"("+Ae.group+")",populate:function(e,r,a){var n=Xe(a,1)[0];r.checks.push({type:se.GROUP,value:n==="*"?n:n+"s"})}},{name:"state",query:!0,regex:wg,populate:function(e,r,a){var n=Xe(a,1)[0];r.checks.push({type:se.STATE,value:n})}},{name:"id",query:!0,regex:"\\#("+Ae.id+")",populate:function(e,r,a){var n=Xe(a,1)[0];r.checks.push({type:se.ID,value:Rr(n)})}},{name:"className",query:!0,regex:"\\.("+Ae.className+")",populate:function(e,r,a){var n=Xe(a,1)[0];r.checks.push({type:se.CLASS,value:Rr(n)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Ae.variable+")\\s*\\]",populate:function(e,r,a){var n=Xe(a,1)[0];r.checks.push({type:se.DATA_EXIST,field:Rr(n)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Ae.variable+")\\s*("+Ae.comparatorOp+")\\s*("+Ae.value+")\\s*\\]",populate:function(e,r,a){var n=Xe(a,3),i=n[0],o=n[1],s=n[2];new RegExp("^"+Ae.string+"$").exec(s)!=null?s=s.substring(1,s.length-1):s=parseFloat(s),r.checks.push({type:se.DATA_COMPARE,field:Rr(i),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Ae.boolOp+")\\s*("+Ae.variable+")\\s*\\]",populate:function(e,r,a){var n=Xe(a,2),i=n[0],o=n[1];r.checks.push({type:se.DATA_BOOL,field:Rr(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Ae.meta+")\\s*("+Ae.comparatorOp+")\\s*("+Ae.number+")\\s*\\]\\]",populate:function(e,r,a){var n=Xe(a,3),i=n[0],o=n[1],s=n[2];r.checks.push({type:se.META_COMPARE,field:Rr(i),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:Ae.separator,populate:function(e,r){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,o=e[e.length-1];return a!=null&&(o.subject=a,e.currentSubject=null),o.edgeCount=n,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]=Oe()}},{name:"directedEdge",separator:!0,regex:Ae.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Oe(),n=r,i=Oe();return a.checks.push({type:se.DIRECTED_EDGE,source:n,target:i}),Zt(e,r,a),e.edgeCount++,i}else{var o=Oe(),s=r,u=Oe();return o.checks.push({type:se.NODE_SOURCE,source:s,target:u}),Zt(e,r,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:Ae.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Oe(),n=r,i=Oe();return a.checks.push({type:se.UNDIRECTED_EDGE,nodes:[n,i]}),Zt(e,r,a),e.edgeCount++,i}else{var o=Oe(),s=r,u=Oe();return o.checks.push({type:se.NODE_NEIGHBOR,node:s,neighbor:u}),Zt(e,r,o),u}}},{name:"child",separator:!0,regex:Ae.child,populate:function(e,r){if(e.currentSubject==null){var a=Oe(),n=Oe(),i=e[e.length-1];return a.checks.push({type:se.CHILD,parent:i,child:n}),Zt(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var o=Oe(),s=e[e.length-1],u=Oe(),l=Oe(),v=Oe(),f=Oe();return o.checks.push({type:se.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=r.checks,r.checks=[{type:se.TRUE}],f.checks.push({type:se.TRUE}),u.checks.push({type:se.PARENT,parent:f,child:v}),Zt(e,s,o),e.currentSubject=l,e.compoundCount++,v}else{var c=Oe(),d=Oe(),h=[{type:se.PARENT,parent:c,child:d}];return c.checks=r.checks,r.checks=h,e.compoundCount++,d}}},{name:"descendant",separator:!0,regex:Ae.descendant,populate:function(e,r){if(e.currentSubject==null){var a=Oe(),n=Oe(),i=e[e.length-1];return a.checks.push({type:se.DESCENDANT,ancestor:i,descendant:n}),Zt(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var o=Oe(),s=e[e.length-1],u=Oe(),l=Oe(),v=Oe(),f=Oe();return o.checks.push({type:se.COMPOUND_SPLIT,left:s,right:u,subject:l}),l.checks=r.checks,r.checks=[{type:se.TRUE}],f.checks.push({type:se.TRUE}),u.checks.push({type:se.ANCESTOR,ancestor:f,descendant:v}),Zt(e,s,o),e.currentSubject=l,e.compoundCount++,v}else{var c=Oe(),d=Oe(),h=[{type:se.ANCESTOR,ancestor:c,descendant:d}];return c.checks=r.checks,r.checks=h,e.compoundCount++,d}}},{name:"subject",modifier:!0,regex:Ae.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return Ie("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1].checks[0],n=a==null?null:a.type;n===se.DIRECTED_EDGE?a.type=se.NODE_TARGET:n===se.UNDIRECTED_EDGE&&(a.type=se.NODE_NEIGHBOR,a.node=a.nodes[1],a.neighbor=a.nodes[0],a.nodes=null)}}];Io.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var xg=function(e){for(var r,a,n,i=0;i<Io.length;i++){var o=Io[i],s=o.name,u=e.match(o.regexObj);if(u!=null){a=u,r=o,n=s;var l=u[0];e=e.substring(l.length);break}}return{expr:r,match:a,name:n,remaining:e}},Eg=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},Cg={parse:function(e){var r=this,a=r.inputText=e,n=r[0]=Oe();for(r.length=1,a=Eg(a);;){var i=xg(a);if(i.expr==null)return Ie("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),s=i.expr.populate(r,n,o);if(s===!1)return!1;if(s!=null&&(n=s),a=i.remaining,a.match(/^\s*$/))break}var u=r[r.length-1];r.currentSubject!=null&&(u.subject=r.currentSubject),u.edgeCount=r.edgeCount,u.compoundCount=r.compoundCount;for(var l=0;l<r.length;l++){var v=r[l];if(v.compoundCount>0&&v.edgeCount>0)return Ie("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(v.edgeCount>1)return Ie("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;v.edgeCount===1&&Ie("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(v){return v??""},r=function(v){return he(v)?'"'+v+'"':e(v)},a=function(v){return" "+v+" "},n=function(v,f){var c=v.type,d=v.value;switch(c){case se.GROUP:var h=e(d);return h.substring(0,h.length-1);case se.DATA_COMPARE:var g=v.field,p=v.operator;return"["+g+a(e(p))+r(d)+"]";case se.DATA_BOOL:var y=v.operator,b=v.field;return"["+e(y)+b+"]";case se.DATA_EXIST:return"["+v.field+"]";case se.META_COMPARE:var m=v.operator;return"[["+v.field+a(e(m))+r(d)+"]]";case se.STATE:return d;case se.ID:return"#"+d;case se.CLASS:return"."+d;case se.PARENT:case se.CHILD:return i(v.parent,f)+a(">")+i(v.child,f);case se.ANCESTOR:case se.DESCENDANT:return i(v.ancestor,f)+" "+i(v.descendant,f);case se.COMPOUND_SPLIT:var w=i(v.left,f),T=i(v.subject,f),C=i(v.right,f);return w+(w.length>0?" ":"")+T+C;case se.TRUE:return""}},i=function(v,f){return v.checks.reduce(function(c,d,h){return c+(f===v&&h===0?"$":"")+n(d,f)},"")},o="",s=0;s<this.length;s++){var u=this[s];o+=i(u,u.subject),this.length>1&&s<this.length-1&&(o+=", ")}return this.toStringCache=o,o}},Ov=function(e,r,a){var n,i=he(e),o=re(e),s=he(a),u,l,v=!1,f=!1,c=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),f=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),v=!0),(i||s||v)&&(u=!i&&!o?"":""+e,l=""+a),v&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),r){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e<a;break;case"<=":c=!0,n=e<=a;break;default:n=!1;break}return f&&(e!=null||!c)&&(n=!n),n},Tg=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},Sg=function(e){return e!==void 0},os=function(e,r){return e.data(r)},Dg=function(e,r){return e[r]()},Ke=[],Ge=function(e,r){return e.checks.every(function(a){return Ke[a.type](a,r)})};Ke[se.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};Ke[se.STATE]=function(t,e){var r=t.value;return bg(r,e)};Ke[se.ID]=function(t,e){var r=t.value;return e.id()===r};Ke[se.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};Ke[se.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return Ov(Dg(e,r),a,n)};Ke[se.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return Ov(os(e,r),a,n)};Ke[se.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return Tg(os(e,r),a)};Ke[se.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,Sg(os(e,r))};Ke[se.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],n=e.source(),i=e.target();return Ge(r,n)&&Ge(a,i)||Ge(a,n)&&Ge(r,i)};Ke[se.NODE_NEIGHBOR]=function(t,e){return Ge(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&Ge(t.neighbor,r)})};Ke[se.DIRECTED_EDGE]=function(t,e){return Ge(t.source,e.source())&&Ge(t.target,e.target())};Ke[se.NODE_SOURCE]=function(t,e){return Ge(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&Ge(t.target,r)})};Ke[se.NODE_TARGET]=function(t,e){return Ge(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&Ge(t.source,r)})};Ke[se.CHILD]=function(t,e){return Ge(t.child,e)&&Ge(t.parent,e.parent())};Ke[se.PARENT]=function(t,e){return Ge(t.parent,e)&&e.children().some(function(r){return Ge(t.child,r)})};Ke[se.DESCENDANT]=function(t,e){return Ge(t.descendant,e)&&e.ancestors().some(function(r){return Ge(t.ancestor,r)})};Ke[se.ANCESTOR]=function(t,e){return Ge(t.ancestor,e)&&e.descendants().some(function(r){return Ge(t.descendant,r)})};Ke[se.COMPOUND_SPLIT]=function(t,e){return Ge(t.subject,e)&&Ge(t.left,e)&&Ge(t.right,e)};Ke[se.TRUE]=function(){return!0};Ke[se.COLLECTION]=function(t,e){return t.value.has(e)};Ke[se.FILTER]=function(t,e){var r=t.value;return r(e)};var kg={matches:function(e){for(var r=this,a=0;a<r.length;a++){var n=r[a];if(Ge(n,e))return!0}return!1},filter:function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===se.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(i){for(var o=0;o<r.length;o++){var s=r[o];if(Ge(s,i))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)}},or=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||he(e)&&e.match(/^\s*$/)||(Tt(e)?this.addQuery({checks:[{type:se.COLLECTION,value:e.collection()}]}):We(e)?this.addQuery({checks:[{type:se.FILTER,value:e}]}):he(e)?this.parse(e)||(this.invalid=!0):He("A selector must be created from a string; found "))},sr=or.prototype;[Cg,kg].forEach(function(t){return ge(sr,t)});sr.text=function(){return this.inputText};sr.size=function(){return this.length};sr.eq=function(t){return this[t]};sr.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};sr.addQuery=function(t){this[this.length++]=t};sr.selector=sr.toString;var tr={allAre:function(e){var r=new or(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new or(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++)if(r?e.apply(r,[this[a],a,this]):e(this[a],a,this))return!0;return!1},every:function(e,r){for(var a=0;a<this.length;a++)if(!(r?e.apply(r,[this[a],a,this]):e(this[a],a,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length;return r!==e.length?!1:r===1?this[0]===e[0]:this.every(function(a){return e.hasElementWithId(a.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};tr.allAreNeighbours=tr.allAreNeighbors;tr.has=tr.contains;tr.equal=tr.equals=tr.same;var Bt=function(e,r){return function(n,i,o,s){var u=n,l=this,v;if(u==null?v="":Tt(u)&&u.length===1&&(v=u.id()),l.length===1&&v){var f=l[0]._private,c=f.traversalCache=f.traversalCache||{},d=c[r]=c[r]||[],h=Er(v),g=d[h];return g||(d[h]=e.call(l,n,i,o,s))}else return e.call(l,n,i,o,s)}},Xr={parent:function(e){var r=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n]._private.parent;i&&r.push(i)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];r.push(i)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var n=this[a].parents();r=r||n,r=r.intersect(n)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:Bt(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r]._private.children,n=0;n<a.length;n++)e.push(a[n]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function a(n){for(var i=0;i<n.length;i++){var o=n[i];r.push(o),o.children().nonempty()&&a(o.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function ss(t,e,r,a){for(var n=[],i=new Jr,o=t.cy().hasCompoundNodes(),s=0;s<t.length;s++){var u=t[s];r?n.push(u):o&&a(n,i,u)}for(;n.length>0;){var l=n.shift();e(l),i.add(l.id()),o&&a(n,i,l)}return t}function Nv(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||t.push(i)}}Xr.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ss(this,t,e,Nv)};function zv(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}Xr.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ss(this,t,e,zv)};function Bg(t,e,r){zv(t,e,r),Nv(t,e,r)}Xr.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ss(this,t,e,Bg)};Xr.ancestors=Xr.parents;var xn=Fv={data:Le.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Le.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Le.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Le.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Le.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Le.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Fv;xn.attr=xn.data;xn.removeAttr=xn.removeData;var Pg=Fv,Vn={};function ho(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],i=n._private.edges,o=0;o<i.length;o++){var s=i[o];!e&&s.isLoop()||(a+=t(n,s))}return a}else return}}ge(Vn,{degree:ho(function(t,e){return e.source().same(e.target())?2:1}),indegree:ho(function(t,e){return e.target().same(t)?1:0}),outdegree:ho(function(t,e){return e.source().same(t)?1:0})});function Mr(t,e){return function(r){for(var a,n=this.nodes(),i=0;i<n.length;i++){var o=n[i][t](r);o!==void 0&&(a===void 0||e(o,a))&&(a=o)}return a}}ge(Vn,{minDegree:Mr("degree",function(t,e){return t<e}),maxDegree:Mr("degree",function(t,e){return t>e}),minIndegree:Mr("indegree",function(t,e){return t<e}),maxIndegree:Mr("indegree",function(t,e){return t>e}),minOutdegree:Mr("outdegree",function(t,e){return t<e}),maxOutdegree:Mr("outdegree",function(t,e){return t>e})});ge(Vn,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n<a.length;n++)r+=a[n].degree(e);return r}});var Mt,Vv,qv=function(e,r,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var o=i._private.position,s={x:r.x!=null?r.x-o.x:0,y:r.y!=null?r.y-o.y:0};i.isParent()&&!(s.x===0&&s.y===0)&&i.children().shift(s,a),i.dirtyBoundingBoxCache()}}},al={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){qv(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Mt=Vv={position:Le.data(al),silentPosition:Le.data(ge({},al,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){qv(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Re(e))r?this.silentPosition(e):this.position(e);else if(We(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var o=this[i],s=void 0;(s=a(o,i))&&(r?o.silentPosition(s):o.position(s))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var n;if(Re(e)?(n={x:re(e.x)?e.x:0,y:re(e.y)?e.y:0},a=r):he(e)&&re(r)&&(n={x:0,y:0},n[e]=r),n!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var s=this[o];if(!(i.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this))){var u=s.position(),l={x:u.x+n.x,y:u.y+n.y};a?s.silentPosition(l):s.position(l)}}i.endBatch()}return this},silentShift:function(e,r){return Re(e)?this.shift(e,!0):he(e)&&re(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],n=this.cy(),i=n.zoom(),o=n.pan(),s=Re(e)?e:void 0,u=s!==void 0||r!==void 0&&he(e);if(a&&a.isNode())if(u)for(var l=0;l<this.length;l++){var v=this[l];r!==void 0?v.position(e,(r-o[e])/i):s!==void 0&&v.position(dv(s,i,o))}else return s=Ln(a.position(),i,o),e===void 0?s:s[e];else if(!u)return;return this},relativePosition:function(e,r){var a=this[0],n=this.cy(),i=Re(e)?e:void 0,o=i!==void 0||r!==void 0&&he(e),s=n.hasCompoundNodes();if(a&&a.isNode())if(o)for(var u=0;u<this.length;u++){var l=this[u],v=s?l.parent():null,f=v&&v.length>0,c=f;f&&(v=v[0]);var d=c?v.position():{x:0,y:0};r!==void 0?l.position(e,r+d[e]):i!==void 0&&l.position({x:i.x+d.x,y:i.y+d.y})}else{var h=a.position(),g=s?a.parent():null,p=g&&g.length>0,y=p;p&&(g=g[0]);var b=y?g.position():{x:0,y:0};return i={x:h.x-b.x,y:h.y-b.y},e===void 0?i:i[e]}else if(!o)return;return this}};Mt.modelPosition=Mt.point=Mt.position;Mt.modelPositions=Mt.points=Mt.positions;Mt.renderedPoint=Mt.renderedPosition;Mt.relativePoint=Mt.relativePosition;var Ag=Vv,Zr=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},Qr=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},Rg=function(e){switch(e){case"left":return"right";case"right":return"left";case"left-inside":return"left";case"right-inside":return"right";default:return"center"}},ga=fr={},fr;fr.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,o=e.x2*a+n.x,s=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}};fr.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};fr.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(o){if(!o.isParent())return;var s=o._private,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",v={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},f=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),c=s.position;(f.w===0||f.h===0)&&(f={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},f.x1=c.x-f.w/2,f.x2=c.x+f.w/2,f.y1=c.y-f.h/2,f.y2=c.y+f.h/2);function d(D,E,B){var A=0,P=0,M=E+B;return D>0&&M>0&&(A=E/M*D,P=B/M*D),{biasDiff:A,biasComplementDiff:P}}function h(D,E,B,A){if(B.units==="%")switch(A){case"width":return D>0?B.pfValue*D:0;case"height":return E>0?B.pfValue*E:0;case"average":return D>0&&E>0?B.pfValue*(D+E)/2:0;case"min":return D>0&&E>0?D>E?B.pfValue*E:B.pfValue*D:0;case"max":return D>0&&E>0?D>E?B.pfValue*D:B.pfValue*E:0;default:return 0}else return B.units==="px"?B.pfValue:0}var g=v.width.left.value;v.width.left.units==="px"&&v.width.val>0&&(g=g*100/v.width.val);var p=v.width.right.value;v.width.right.units==="px"&&v.width.val>0&&(p=p*100/v.width.val);var y=v.height.top.value;v.height.top.units==="px"&&v.height.val>0&&(y=y*100/v.height.val);var b=v.height.bottom.value;v.height.bottom.units==="px"&&v.height.val>0&&(b=b*100/v.height.val);var m=d(v.width.val-f.w,g,p),w=m.biasDiff,T=m.biasComplementDiff,C=d(v.height.val-f.h,y,b),x=C.biasDiff,S=C.biasComplementDiff;s.autoPadding=h(f.w,f.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(f.w,v.width.val),c.x=(-w+f.x1+f.x2+T)/2,s.autoHeight=Math.max(f.h,v.height.val),c.y=(-x+f.y1+f.y2+S)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||t)&&(r(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var kt=function(e){return e===1/0||e===-1/0?0:e},Rt=function(e,r,a,n,i){n-r===0||i-a===0||r==null||a==null||n==null||i==null||(e.x1=r<e.x1?r:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Qt=function(e,r){return r==null?e:Rt(e,r.x1,r.y1,r.x2,r.y2)},sa=function(e,r,a){return yt(e,r,a)},Ya=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,o=i.arrowWidth/2,s=r.pstyle(a+"-arrow-shape").value,u,l;if(s!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var v=n.arrowBounds=n.arrowBounds||{},f=v[a]=v[a]||{};f.x1=u-o,f.y1=l-o,f.x2=u+o,f.y2=l+o,f.w=f.x2-f.x1,f.h=f.y2-f.y1,an(f,1),Rt(e,f.x1,f.y1,f.x2,f.y2)}}},go=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,o=i.rstyle;if(r.pstyle(n+"label").strValue){var s=r.pstyle("text-halign"),u=r.pstyle("text-valign"),l=sa(o,"labelWidth",a),v=sa(o,"labelHeight",a),f=sa(o,"labelX",a),c=sa(o,"labelY",a),d=r.pstyle(n+"text-margin-x").pfValue,h=r.pstyle(n+"text-margin-y").pfValue,g=r.isEdge(),p=r.pstyle(n+"text-rotation"),y=r.pstyle("text-outline-width").pfValue,b=r.pstyle("text-border-width").pfValue/2,m=r.pstyle("text-background-padding").pfValue,w=2,T=v,C=l,x=C/2,S=T/2,D,E,B,A;if(g)D=f-x,E=f+x,B=c-S,A=c+S;else{switch(Zr(s.value)){case"left":D=f-C,E=f;break;case"center":D=f-x,E=f+x;break;case"right":D=f,E=f+C;break}switch(Qr(u.value)){case"top":B=c-T,A=c;break;case"center":B=c-S,A=c+S;break;case"bottom":B=c,A=c+T;break}}var P=d-Math.max(y,b)-m-w,M=d+Math.max(y,b)+m+w,R=h-Math.max(y,b)-m-w,L=h+Math.max(y,b)+m+w;D+=P,E+=M,B+=R,A+=L;var I=a||"main",F=i.labelBounds,_=F[I]=F[I]||{};_.x1=D,_.y1=B,_.x2=E,_.y2=A,_.w=E-D,_.h=A-B,_.leftPad=P,_.rightPad=M,_.topPad=R,_.botPad=L;var N=g&&p.strValue==="autorotate",G=p.pfValue!=null&&p.pfValue!==0;if(N||G){var Z=N?sa(i.rstyle,"labelAngle",a):p.pfValue,W=Math.cos(Z),$=Math.sin(Z),Y=(D+E)/2,te=(B+A)/2;if(!g){switch(Zr(s.value)){case"left":Y=E;break;case"right":Y=D;break}switch(Qr(u.value)){case"top":te=A;break;case"bottom":te=B;break}}var J=function(be,ke){return be=be-Y,ke=ke-te,{x:be*W-ke*$+Y,y:be*$+ke*W+te}},X=J(D,B),O=J(D,A),V=J(E,B),q=J(E,A);D=Math.min(X.x,O.x,V.x,q.x),E=Math.max(X.x,O.x,V.x,q.x),B=Math.min(X.y,O.y,V.y,q.y),A=Math.max(X.y,O.y,V.y,q.y)}var j=I+"Rot",ue=F[j]=F[j]||{};ue.x1=D,ue.y1=B,ue.x2=E,ue.y2=A,ue.w=E-D,ue.h=A-B,Rt(e,D,B,E,A),Rt(i.labelBounds.all,D,B,E,A)}return e}},nl=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value+r.pstyle("outline-offset").value;_v(e,r,a,n,"outside",n/2)}},_v=function(e,r,a,n,i,o){if(!(a===0||n<=0||i==="inside")){var s=r.cy().renderer(),u=s.nodeShapes[s.getNodeShape(r)];if(u){var l=r.position(),v=l.x,f=l.y,c=r.width(),d=r.height();u.hasMiterBounds?(i==="center"&&(n/=2),Qt(e,u.miterBounds(v,f,c,d,n))):o!=null&&o>0&&nn(e,[o,o,o,o])}}},Mg=function(e,r){if(!r.cy().headless()){var a=r.pstyle("border-opacity").value,n=r.pstyle("border-width").pfValue,i=r.pstyle("border-position").value;_v(e,r,a,n,i)}},Lg=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),o=mt(),s=e._private,u=e.isNode(),l=e.isEdge(),v,f,c,d,h,g,p=s.rstyle,y=u&&n?e.pstyle("bounds-expansion").pfValue:[0],b=function(q){return q.pstyle("display").value!=="none"},m=!n||b(e)&&(!l||b(e.source())&&b(e.target()));if(m){var w=0,T=0;n&&r.includeOverlays&&(w=e.pstyle("overlay-opacity").value,w!==0&&(T=e.pstyle("overlay-padding").value));var C=0,x=0;n&&r.includeUnderlays&&(C=e.pstyle("underlay-opacity").value,C!==0&&(x=e.pstyle("underlay-padding").value));var S=Math.max(T,x),D=0,E=0;if(n&&(D=e.pstyle("width").pfValue,E=D/2),u&&r.includeNodes){var B=e.position();h=B.x,g=B.y;var A=e.outerWidth()/2,P=e.outerHeight()/2;v=h-A,f=h+A,c=g-P,d=g+P,Rt(o,v,c,f,d),n&&nl(o,e),n&&r.includeOutlines&&!i&&nl(o,e),n&&Mg(o,e)}else if(l&&r.includeEdges)if(n&&!i){var M=e.pstyle("curve-style").strValue;if(v=Math.min(p.srcX,p.midX,p.tgtX),f=Math.max(p.srcX,p.midX,p.tgtX),c=Math.min(p.srcY,p.midY,p.tgtY),d=Math.max(p.srcY,p.midY,p.tgtY),v-=E,f+=E,c-=E,d+=E,Rt(o,v,c,f,d),M==="haystack"){var R=p.haystackPts;if(R&&R.length===2){if(v=R[0].x,c=R[0].y,f=R[1].x,d=R[1].y,v>f){var L=v;v=f,f=L}if(c>d){var I=c;c=d,d=I}Rt(o,v-E,c-E,f+E,d+E)}}else if(M==="bezier"||M==="unbundled-bezier"||Jt(M,"segments")||Jt(M,"taxi")){var F;switch(M){case"bezier":case"unbundled-bezier":F=p.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":F=p.linePts;break}if(F!=null)for(var _=0;_<F.length;_++){var N=F[_];v=N.x-E,f=N.x+E,c=N.y-E,d=N.y+E,Rt(o,v,c,f,d)}}}else{var G=e.source().position(),Z=e.target().position();if(v=G.x,f=Z.x,c=G.y,d=Z.y,v>f){var W=v;v=f,f=W}if(c>d){var $=c;c=d,d=$}v-=E,f+=E,c-=E,d+=E,Rt(o,v,c,f,d)}if(n&&r.includeEdges&&l&&(Ya(o,e,"mid-source"),Ya(o,e,"mid-target"),Ya(o,e,"source"),Ya(o,e,"target")),n&&e.pstyle("ghost").value==="yes"){var Y=e.pstyle("ghost-offset-x").pfValue,te=e.pstyle("ghost-offset-y").pfValue;Rt(o,o.x1+Y,o.y1+te,o.x2+Y,o.y2+te)}var J=s.bodyBounds=s.bodyBounds||{};Hs(J,o),nn(J,y),an(J,1),n&&(v=o.x1,f=o.x2,c=o.y1,d=o.y2,Rt(o,v-S,c-S,f+S,d+S));var X=s.overlayBounds=s.overlayBounds||{};Hs(X,o),nn(X,y),an(X,1);var O=s.labelBounds=s.labelBounds||{};O.all!=null?wh(O.all):O.all=mt(),n&&r.includeLabels&&(r.includeMainLabels&&go(o,e,null),l&&(r.includeSourceLabels&&go(o,e,"source"),r.includeTargetLabels&&go(o,e,"target")))}return o.x1=kt(o.x1),o.y1=kt(o.y1),o.x2=kt(o.x2),o.y2=kt(o.y2),o.w=kt(o.x2-o.x1),o.h=kt(o.y2-o.y1),o.w>0&&o.h>0&&m&&(nn(o,y),an(o,1)),o},Gv=function(e){var r=0,a=function(o){return(o?1:0)<<r++},n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},Hv=function(e){var r=function(s){return Math.round(s)};if(e.isEdge()){var a=e.source().position(),n=e.target().position();return zs([r(a.x),r(a.y),r(n.x),r(n.y)])}else{var i=e.position();return zs([r(i.x),r(i.y)])}},il=function(e,r){var a=e._private,n,i=e.isEdge(),o=(r==null?ol:Gv(r))===ol;if(a.bbCache==null?(n=Lg(e,Ta),a.bbCache=n,a.bbCachePosKey=Hv(e)):n=a.bbCache,!o){var s=e.isNode();n=mt(),(r.includeNodes&&s||r.includeEdges&&!s)&&(r.includeOverlays?Qt(n,a.overlayBounds):Qt(n,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?Qt(n,a.labelBounds.all):(r.includeMainLabels&&Qt(n,a.labelBounds.mainRot),r.includeSourceLabels&&Qt(n,a.labelBounds.sourceRot),r.includeTargetLabels&&Qt(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},Ta={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},ol=Gv(Ta),sl=vt(Ta);fr.boundingBox=function(t){var e,r=t===void 0||t.useCache===void 0||t.useCache===!0,a=Kr(function(l){var v=l._private;return v.bbCache==null||v.styleDirty||v.bbCachePosKey!==Hv(l)},function(l){return l.id()});if(r&&this.length===1&&!a(this[0]))t===void 0?t=Ta:t=sl(t),e=il(this[0],t);else{e=mt(),t=t||Ta;var n=sl(t),i=this,o=i.cy().styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),o&&this.recalculateRenderedStyle(r),this.updateCompoundBounds(!r);for(var s=0;s<i.length;s++){var u=i[s];a(u)&&u.dirtyBoundingBoxCache(),Qt(e,il(u,n))}}return e.x1=kt(e.x1),e.y1=kt(e.y1),e.x2=kt(e.x2),e.y2=kt(e.y2),e.w=kt(e.x2-e.x1),e.h=kt(e.y2-e.y1),e};fr.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};fr.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),n=r.collection();if(a&&(n=e.filter(function(l){return l.isParent()}),e=e.not(n)),Re(t)){var i=t;t=function(){return i}}var o=function(v,f){return v._private.bbAtOldPos=t(v,f)},s=function(v){return v._private.bbAtOldPos};r.startBatch(),e.forEach(o).silentPositions(t),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var u=bh(this.boundingBox({useCache:!1}));return e.silentPositions(s),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),r.endBatch(),u};ga.boundingbox=ga.bb=ga.boundingBox;ga.renderedBoundingbox=ga.renderedBoundingBox;var Ig=fr,Xa=Oa={},Oa,$v=function(e){e.uppercaseName=Es(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Es(e.outerName),Xa[e.name]=function(){var a=this[0],n=a._private,i=n.cy._private.styleEnabled;if(a)if(i){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var o=a.pstyle(e.name);return o.strValue==="label"?(a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):o.pfValue}else return 1},Xa["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private.cy._private.styleEnabled;if(a)if(n){var i=a[e.name](),o=a.pstyle("border-position").value,s;o==="center"?s=a.pstyle("border-width").pfValue:o==="outside"?s=2*a.pstyle("border-width").pfValue:s=0;var u=2*a.padding();return i+s+u}else return 1},Xa["rendered"+e.uppercaseName]=function(){var a=this[0];if(a)return a[e.name]()*this.cy().zoom()},Xa["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a)return a[e.outerName]()*this.cy().zoom()}};$v({name:"width"});$v({name:"height"});Oa.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue};Oa.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};Oa.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var Og=Oa,Ng=function(e,r){if(e.isEdge()&&e.takesUpSpace())return r(e)},zg=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return Ln(r(e),a.zoom(),a.pan())}},Fg=function(e,r){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),n=a.pan(),i=a.zoom();return r(e).map(function(o){return Ln(o,i,n)})}},ul={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},Vg=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},qg=ge({},Ag,Ig,Og,Object.keys(ul).reduce(function(t,e){var r=ul[e],a=Vg(e);return t[e]=function(){return Ng(this,r.get)},r.mult?t[a]=function(){return Fg(this,r.get)}:t[a]=function(){return zg(this,r.get)},t},{})),Wv=function(e,r){this.recycle(e,r)};function ua(){return!1}function Za(){return!0}Wv.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=ua,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Za:ua):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Za;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Za;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Za,this.stopPropagation()},isDefaultPrevented:ua,isPropagationStopped:ua,isImmediatePropagationStopped:ua};var Uv=/^([^.]+)(\.(?:[^.]+))?$/,_g=".*",Kv={qualifierCompare:function(e,r){return e===r},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},ll=Object.keys(Kv),Gg={};function qn(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Gg,e=arguments.length>1?arguments[1]:void 0,r=0;r<ll.length;r++){var a=ll[r];this[a]=t[a]||Kv[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var ur=qn.prototype,Yv=function(e,r,a,n,i,o,s){We(n)&&(i=n,n=null),s&&(o==null?o=s:o=ge({},o,s));for(var u=ze(a)?a:a.split(/\s+/),l=0;l<u.length;l++){var v=u[l];if(!ar(v)){var f=v.match(Uv);if(f){var c=f[1];if(r(e,v,c,f[2]?f[2]:null,n,i,o)===!1)break}}}},vl=function(e,r){return e.addEventFields(e.context,r),new Wv(r.type,r)},Hg=function(e,r,a){if(vc(a)){r(e,a);return}else if(Re(a)){r(e,vl(e,a));return}for(var n=ze(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var o=n[i];if(!ar(o)){var s=o.match(Uv);if(s){var u=s[1];r(e,vl(e,{type:u,namespace:s[2]?s[2]:null,target:e.context}))}}}};ur.on=ur.addListener=function(t,e,r,a,n){return Yv(this,function(i,o,s,u,l,v,f){We(v)&&i.listeners.push({event:o,callback:v,type:s,namespace:u,qualifier:l,conf:f})},t,e,r,a,n),this};ur.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})};ur.removeListener=ur.off=function(t,e,r,a){var n=this;this.emitting!==0&&(this.listeners=Wc(this.listeners));for(var i=this.listeners,o=function(l){var v=i[l];Yv(n,function(f,c,d,h,g,p){if((v.type===d||t==="*")&&(!h&&v.namespace!==".*"||v.namespace===h)&&(!g||f.qualifierCompare(v.qualifier,g))&&(!p||v.callback===p))return i.splice(l,1),!1},t,e,r,a)},s=i.length-1;s>=0;s--)o(s);return this};ur.removeAllListeners=function(){return this.removeListener("*")};ur.emit=ur.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,ze(e)||(e=[e]),Hg(this,function(i,o){r!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],n=a.length);for(var s=function(){var v=a[u];if(v.type===o.type&&(!v.namespace||v.namespace===o.namespace||v.namespace===_g)&&i.eventMatches(i.context,v,o)){var f=[o];e!=null&&Kc(f,e),i.beforeEmit(i.context,v,o),v.conf&&v.conf.one&&(i.listeners=i.listeners.filter(function(h){return h!==v}));var c=i.callbackContext(i.context,v,o),d=v.callback.apply(c,f);i.afterEmit(i.context,v,o),d===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u<n;u++)s();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},t),this.emitting--,this};var $g={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Pa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Qa=function(e){return he(e)?new or(e):e},Xv={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new qn($g,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var n=Qa(r),i=0;i<this.length;i++)this[i].emitter().on(e,n,a);return this},removeListener:function(e,r,a){for(var n=Qa(r),i=0;i<this.length;i++)this[i].emitter().removeListener(e,n,a);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,r,a){for(var n=Qa(r),i=0;i<this.length;i++)this[i].emitter().one(e,n,a);return this},once:function(e,r,a){for(var n=Qa(r),i=0;i<this.length;i++)this[i].emitter().on(e,n,a,{once:!0,onceCollection:this})},emit:function(e,r){for(var a=0;a<this.length;a++)this[a].emitter().emit(e,r);return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};Le.eventAliasesOn(Xv);var Zv={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):r.push(n)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(he(e)||Tt(e))return new or(e).filter(this);if(We(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var o=n[i];(r?e.apply(r,[o,i,n]):e(o,i,n))&&a.push(o)}return a}return this.spawn()},not:function(e){if(e){he(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var n=this[a];e.has(n)||r.push(n)}return r}else return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(he(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),n=this,i=e,o=this.length<e.length,s=o?n:i,u=o?i:n,l=0;l<s.length;l++){var v=s[l];u.has(v)&&a.push(v)}return a},xor:function(e){var r=this._private.cy;he(e)&&(e=r.$(e));var a=this.spawn(),n=this,i=e,o=function(u,l){for(var v=0;v<u.length;v++){var f=u[v],c=f._private.data.id;l.hasElementWithId(c)||a.push(f)}};return o(n,i),o(i,n),a},diff:function(e){var r=this._private.cy;he(e)&&(e=r.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),o=this,s=e,u=function(v,f,c){for(var d=0;d<v.length;d++){var h=v[d],g=h._private.data.id;f.hasElementWithId(g)?i.merge(h):c.push(h)}};return u(o,s,a),u(s,o,n),{left:a,right:n,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(he(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i];this.has(o)||n.push(o)}return n},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&he(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=r.map,o=0;o<e.length;o++){var s=e[o],u=s._private.data.id;if(!i.has(u)){var l=this.length++;this[l]=s,i.set(u,{ele:s,index:l})}}return this},unmergeAt:function(e){var r=this[e].id(),a=this._private.map;this[e]=void 0,a.delete(r);var n=e===this.length-1;if(this.length>1&&!n){var i=this.length-1,o=this[i],s=o._private.data.id;this[i]=void 0,this[e]=o,a.set(s,{ele:o,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map.get(a);if(!n)return this;var i=n.index;return this.unmergeAt(i),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&he(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],n=this,i=0;i<n.length;i++){var o=n[i],s=r?e.apply(r,[o,i,n]):e(o,i,n);a.push(s)}return a},reduce:function(e,r){for(var a=r,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,r){for(var a=-1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],u=r?e.apply(r,[s,o,i]):e(s,o,i);u>a&&(a=u,n=s)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],u=r?e.apply(r,[s,o,i]):e(s,o,i);u<a&&(a=u,n=s)}return{value:a,ele:n}}},Me=Zv;Me.u=Me["|"]=Me["+"]=Me.union=Me.or=Me.add;Me["\\"]=Me["!"]=Me["-"]=Me.difference=Me.relativeComplement=Me.subtract=Me.not;Me.n=Me["&"]=Me["."]=Me.and=Me.intersection=Me.intersect;Me["^"]=Me["(+)"]=Me["(-)"]=Me.symmetricDifference=Me.symdiff=Me.xor;Me.fnFilter=Me.filterFn=Me.stdFilter=Me.filter;Me.complement=Me.abscomp=Me.absoluteComplement;var Wg={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Qv=function(e,r){var a=e.cy().hasCompoundNodes();function n(l){var v=l.pstyle("z-compound-depth");return v.value==="auto"?a?l.zDepth():0:v.value==="bottom"?-1:v.value==="top"?Zo:0}var i=n(e)-n(r);if(i!==0)return i;function o(l){return l.pstyle("z-index-compare").value==="auto"&&l.isNode()?1:0}var s=o(e)-o(r);if(s!==0)return s;var u=e.pstyle("z-index").value-r.pstyle("z-index").value;return u!==0?u:e.poolIndex()-r.poolIndex()},En={forEach:function(e,r){if(We(e))for(var a=this.length,n=0;n<a;n++){var i=this[n];if((r?e.apply(r,[i,n,this]):e(i,n,this))===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],n=this.length;r==null&&(r=n),e==null&&(e=0),e<0&&(e=n+e),r<0&&(r=n+r);for(var i=e;i>=0&&i<r&&i<n;i++)a.push(this[i]);return this.spawn(a)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!We(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(Qv)},zDepth:function(){var e=this[0];if(e){var r=e._private;if(r.group==="nodes"){var a=r.data.parent?e.parents().size():0;return e.isParent()?a:Zo-1}else{var n=r.source,i=r.target,o=n.zDepth(),s=i.zDepth();return Math.max(o,s,0)}}}};En.each=En.forEach;(function(){var e="undefined";(typeof Symbol>"u"?"undefined":je(Symbol))!=e&&je(Symbol.iterator)!=e&&(En[Symbol.iterator]=function(){var r=this,a={value:void 0,done:!1},n=0,i=this.length;return Xl({next:function(){return n<i?a.value=r[n++]:(a.value=void 0,a.done=!0),a}},Symbol.iterator,function(){return this})})})();var Ug=vt({nodeDimensionsIncludeLabels:!1}),sn={layoutDimensions:function(e){e=Ug(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var n=this.nodes().filter(function(m){return!m.isParent()}),i=this.cy(),o=r.eles,s=function(w){return w.id()},u=Kr(a,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(w,T,C){var x={x:T.x1+T.w/2,y:T.y1+T.h/2},S={x:(C.x-x.x)*w,y:(C.y-x.y)*w};return{x:x.x+S.x,y:x.y+S.y}},v=r.spacingFactor&&r.spacingFactor!==1,f=(function(){if(!v)return null;for(var w=mt(),T=0;T<n.length;T++){var C=n[T],x=u(C,T);gv(w,x.x,x.y)}return w})(),c=Kr(function(m,w){var T=u(m,w);return v&&(T=l(Math.abs(r.spacingFactor),f,T)),r.transform!=null&&(T=r.transform(m,T)),T},s);if(r.animate){for(var d=0;d<n.length;d++){var h=n[d],g=c(h,d);if(r.animateFilter==null||r.animateFilter(h,d)){var p=h.animation({position:g,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(p)}else h.position(g)}if(r.fit){var y=i.animation({fit:{boundingBox:o.boundingBoxAt(c),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(y)}else if(r.zoom!==void 0&&r.pan!==void 0){var b=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}e.animations.forEach(function(m){return m.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),jr.all(e.animations.map(function(m){return m.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(c),r.fit&&i.fit(r.eles,r.padding),r.zoom!=null&&i.zoom(r.zoom),r.pan&&i.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(ge({},e,{eles:this}))}};sn.createLayout=sn.makeLayout=sn.layout;function Jv(t,e,r){var a=r._private,n=a.styleCache=a.styleCache||[],i;return(i=n[t])!=null||(i=n[t]=e(r)),i}function Cn(t,e){return t=Er(t),function(a){return Jv(t,e,a)}}function _n(t,e){t=Er(t);var r=function(n){return e.call(n)};return function(){var n=this[0];if(n)return Jv(t,r,n)}}var ut={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),n=r.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var a=this.spawnSelf().merge(this.descendants()).merge(this.parents());a.merge(a.connectedEdges()),a.forEach(r)}else this.forEach(function(n){r(n),n.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching())return r._private.batchStyleEles.merge(this),this;var a=r.hasCompoundNodes(),n=this;e=!!(e||e===void 0),a&&(n=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var i=n;return e?i.emitAndNotify("style"):i.emit("style"),n.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return i??(r?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Re(e)){var o=e;i.applyBypass(this,o,n),this.emitAndNotify("style")}else if(he(e))if(r===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var s=i[o];n.removeAllBypasses(s,a)}else{e=e.split(/\s+/);for(var u=0;u<i.length;u++){var l=i[u];n.removeBypasses(l,e,a)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!r)return i;var o=n.data.parent?a.parents():null;if(o)for(var s=0;s<o.length;s++)i=o[s].pstyle("opacity").value*i;return i}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],r=e.cy().hasCompoundNodes();if(e)return r?e.effectiveOpacity()===0:e.pstyle("opacity").value===0},backgrounding:function(){return this.cy().styleEnabled()?!!this[0]._private.backgrounding:!1}};function po(t,e){var r=t._private.data.parent?t.parents():null;if(r)for(var a=0;a<r.length;a++){var n=r[a];if(!e(n))return!1}return!0}function us(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=t.parentOk||t.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],o=n.hasCompoundNodes();if(i){var s=i._private;if(!e(i))return!1;if(i.isNode())return!o||po(i,a);var u=s.source,l=s.target;return r(u)&&(!o||po(u,r))&&(u===l||r(l)&&(!o||po(l,r)))}}}var Ur=Cn("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});ut.takesUpSpace=_n("takesUpSpace",us({ok:Ur}));ut.interactive=_n("interactive",us({ok:Cn("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Ur(t)}),parentOk:Cn("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Ur(t)}),edgeOkViaNode:Ur}));ut.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};ut.visible=_n("visible",us({ok:Cn("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Ur(t)}),edgeOkViaNode:Ur}));ut.hidden=function(){var t=this[0];if(t)return!t.visible()};ut.isBundledBezier=_n("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});ut.bypass=ut.css=ut.style;ut.renderedCss=ut.renderedStyle;ut.removeBypass=ut.removeCss=ut.removeStyle;ut.pstyle=ut.parsedStyle;var rr={};function fl(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],n=e[1];this.on(t.event,a,n)}else if(e.length===1&&We(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&ze(e[0])){for(var o=e.length===1?e[0]:null,s=0;s<this.length;s++){var u=this[s],l=!t.ableField||u._private[t.ableField],v=u._private[t.field]!=t.value;if(t.overrideAble){var f=t.overrideAble(u);if(f!==void 0&&(l=f,!f))return this}l&&(u._private[t.field]=t.value,v&&r.push(u))}var c=this.spawn(r);c.updateStyle(),c.emit(t.event),o&&c.emit(o)}return this}}function ea(t){rr[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},rr[t.on]=fl({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),rr[t.off]=fl({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}ea({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});ea({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});ea({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});ea({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});rr.deselect=rr.unselect;rr.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};ea({field:"active",on:"activate",off:"unactivate"});ea({field:"pannable",on:"panify",off:"unpanify"});rr.inactive=function(){var t=this[0];if(t)return!t._private.active};var ht={},cl=function(e){return function(a){for(var n=this,i=[],o=0;o<n.length;o++){var s=n[o];if(s.isNode()){for(var u=!1,l=s.connectedEdges(),v=0;v<l.length;v++){var f=l[v],c=f.source(),d=f.target();if(e.noIncomingEdges&&d===s&&c!==s||e.noOutgoingEdges&&c===s&&d!==s){u=!0;break}}u||i.push(s)}}return this.spawn(i,!0).filter(a)}},hl=function(e){return function(r){for(var a=this,n=[],i=0;i<a.length;i++){var o=a[i];if(o.isNode())for(var s=o.connectedEdges(),u=0;u<s.length;u++){var l=s[u],v=l.source(),f=l.target();e.outgoing&&v===o?(n.push(l),n.push(f)):e.incoming&&f===o&&(n.push(l),n.push(v))}}return this.spawn(n,!0).filter(r)}},dl=function(e){return function(r){for(var a=this,n=[],i={};;){var o=e.outgoing?a.outgoers():a.incomers();if(o.length===0)break;for(var s=!1,u=0;u<o.length;u++){var l=o[u],v=l.id();i[v]||(i[v]=!0,n.push(l),s=!0)}if(!s)break;a=o}return this.spawn(n,!0).filter(r)}};ht.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};ge(ht,{roots:cl({noIncomingEdges:!0}),leaves:cl({noOutgoingEdges:!0}),outgoers:Bt(hl({outgoing:!0}),"outgoers"),successors:dl({outgoing:!0}),incomers:Bt(hl({incoming:!0}),"incomers"),predecessors:dl({})});ge(ht,{neighborhood:Bt(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var n=r[a],i=n.connectedEdges(),o=0;o<i.length;o++){var s=i[o],u=s.source(),l=s.target(),v=n===u?l:u;v.length>0&&e.push(v[0]),e.push(s[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});ht.neighbourhood=ht.neighborhood;ht.closedNeighbourhood=ht.closedNeighborhood;ht.openNeighbourhood=ht.openNeighborhood;ge(ht,{source:Bt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:Bt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:gl({attr:"source"}),targets:gl({attr:"target"})});function gl(t){return function(r){for(var a=[],n=0;n<this.length;n++){var i=this[n]._private[t.attr];i&&a.push(i)}return this.spawn(a,!0).filter(r)}}ge(ht,{edgesWith:Bt(pl(),"edgesWith"),edgesTo:Bt(pl({thisIsSrc:!0}),"edgesTo")});function pl(t){return function(r){var a=[],n=this._private.cy,i=t||{};he(r)&&(r=n.$(r));for(var o=0;o<r.length;o++)for(var s=r[o]._private.edges,u=0;u<s.length;u++){var l=s[u],v=l._private.data,f=this.hasElementWithId(v.source)&&r.hasElementWithId(v.target),c=r.hasElementWithId(v.source)&&this.hasElementWithId(v.target);(f||c)&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!f||i.thisIsTgt&&!c)||a.push(l))}return this.spawn(a,!0)}}ge(ht,{connectedEdges:Bt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];if(n.isNode())for(var i=n._private.edges,o=0;o<i.length;o++){var s=i[o];e.push(s)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Bt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Bt(yl(),"parallelEdges"),codirectedEdges:Bt(yl({codirected:!0}),"codirectedEdges")});function yl(t){return t=ge({},{codirected:!1},t),function(r){for(var a=[],n=this.edges(),i=t,o=0;o<n.length;o++)for(var s=n[o]._private,u=s.source,l=u._private.data.id,v=s.data.target,f=u._private.edges,c=0;c<f.length;c++){var d=f[c],h=d._private.data,g=h.target,p=h.source,y=g===v&&p===l,b=l===g&&v===p;(i.codirected&&y||!i.codirected&&(y||b))&&a.push(d)}return this.spawn(a,!0).filter(r)}}ge(ht,{components:function(e){var r=this,a=r.cy(),n=a.collection(),i=e==null?r.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var s=function(v,f){n.merge(v),i.unmerge(v),f.merge(v)};if(i.empty())return r.spawn();var u=function(){var v=a.collection();o.push(v);var f=i[0];s(f,v),r.bfs({directed:!1,roots:f,visit:function(d){return s(d,v)}}),v.forEach(function(c){c.connectedEdges().forEach(function(d){r.has(d)&&v.has(d.source())&&v.has(d.target())&&v.merge(d)})})};do u();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});ht.componentsOf=ht.components;var lt=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){He("A collection must have a reference to the core");return}var i=new Ht,o=!1;if(!r)r=[];else if(r.length>0&&Re(r[0])&&!Pa(r[0])){o=!0;for(var s=[],u=new Jr,l=0,v=r.length;l<v;l++){var f=r[l];f.data==null&&(f.data={});var c=f.data;if(c.id==null)c.id=cv();else if(e.hasElementWithId(c.id)||u.has(c.id))continue;var d=new Mn(e,f,!1);s.push(d),u.add(c.id)}r=s}this.length=0;for(var h=0,g=r.length;h<g;h++){var p=r[h][0];if(p!=null){var y=p._private.data.id;(!a||!i.has(y))&&(a&&i.set(y,{index:this.length,ele:p}),this[this.length]=p,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(b){this.lazyMap=b},rebuildMap:function(){for(var m=this.lazyMap=new Ht,w=this.eles,T=0;T<w.length;T++){var C=w[T];m.set(C.id(),{index:T,ele:C})}}},a&&(this._private.map=i),o&&!n&&this.restore()},_e=Mn.prototype=lt.prototype=Object.create(Array.prototype);_e.instanceString=function(){return"collection"};_e.spawn=function(t,e){return new lt(this.cy(),t,e)};_e.spawnSelf=function(){return this.spawn(this)};_e.cy=function(){return this._private.cy};_e.renderer=function(){return this._private.cy.renderer()};_e.element=function(){return this[0]};_e.collection=function(){return Jl(this)?this:new lt(this._private.cy,[this])};_e.unique=function(){return new lt(this._private.cy,this,!0)};_e.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};_e.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new lt(e)};_e.$id=_e.getElementById;_e.poolIndex=function(){var t=this._private.cy._private.elements,e=this[0]._private.data.id;return t._private.map.get(e).index};_e.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};_e.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};_e.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(Re(t)){if(r.startBatch(),t.data){e.data(t.data);var n=a.data;if(e.isEdge()){var i=!1,o={},s=t.data.source,u=t.data.target;s!=null&&s!=n.source&&(o.source=""+s,i=!0),u!=null&&u!=n.target&&(o.target=""+u,i=!0),i&&(e=e.move(o))}else{var l="parent"in t.data,v=t.data.parent;l&&(v!=null||n.parent!=null)&&v!=n.parent&&(v===void 0&&(v=null),v!=null&&(v=""+v),e=e.move({parent:v}))}}t.position&&e.position(t.position);var f=function(g,p,y){var b=t[g];b!=null&&b!==a[g]&&(b?e[p]():e[y]())};return f("removed","remove","restore"),f("selected","select","unselect"),f("selectable","selectify","unselectify"),f("locked","lock","unlock"),f("grabbable","grabify","ungrabify"),f("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var c={data:Ft(a.data),position:Ft(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};c.classes="";var d=0;return a.classes.forEach(function(h){return c.classes+=d++===0?h:" "+h}),c}}};_e.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e].json();t.push(r)}return t};_e.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=new Mn(t,this[r].json(),!1);e.push(a)}return new lt(t,e)};_e.copy=_e.clone;_e.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,i=[],o=[],s,u=0,l=r.length;u<l;u++){var v=r[u];e&&!v.removed()||(v.isNode()?i.push(v):o.push(v))}s=i.concat(o);var f,c=function(){s.splice(f,1),f--};for(f=0;f<s.length;f++){var d=s[f],h=d._private,g=h.data;if(d.clearTraversalCache(),!(!e&&!h.removed)){if(g.id===void 0)g.id=cv();else if(re(g.id))g.id=""+g.id;else if(ar(g.id)||!he(g.id)){He("Can not create element with invalid string ID `"+g.id+"`"),c();continue}else if(a.hasElementWithId(g.id)){He("Can not create second element with ID `"+g.id+"`"),c();continue}}var p=g.id;if(d.isNode()){var y=h.position;y.x==null&&(y.x=0),y.y==null&&(y.y=0)}if(d.isEdge()){for(var b=d,m=["source","target"],w=m.length,T=!1,C=0;C<w;C++){var x=m[C],S=g[x];re(S)&&(S=g[x]=""+g[x]),S==null||S===""?(He("Can not create edge `"+p+"` with unspecified "+x),T=!0):a.hasElementWithId(S)||(He("Can not create edge `"+p+"` with nonexistent "+x+" `"+S+"`"),T=!0)}if(T){c();continue}var D=a.getElementById(g.source),E=a.getElementById(g.target);D.same(E)?D._private.edges.push(b):(D._private.edges.push(b),E._private.edges.push(b)),b._private.source=D,b._private.target=E}h.map=new Ht,h.map.set(p,{ele:d,index:0}),h.removed=!1,e&&a.addToPool(d)}for(var B=0;B<i.length;B++){var A=i[B],P=A._private.data;re(P.parent)&&(P.parent=""+P.parent);var M=P.parent;if(M!=null||A._private.parent){var R=A._private.parent?a.collection().merge(A._private.parent):a.getElementById(M);if(R.empty())P.parent=void 0;else if(R[0].removed())Ie("Node added with missing parent, reference to parent removed"),P.parent=void 0,A._private.parent=null;else{for(var L=!1,I=R;!I.empty();){if(A.same(I)){L=!0,P.parent=void 0;break}I=I.parent()}L||(R[0]._private.children.push(A),A._private.parent=R[0],n.hasCompoundNodes=!0)}}}if(s.length>0){for(var F=s.length===r.length?r:new lt(a,s),_=0;_<F.length;_++){var N=F[_];N.isNode()||(N.parallelEdges().clearTraversalCache(),N.source().clearTraversalCache(),N.target().clearTraversalCache())}var G;n.hasCompoundNodes?G=a.collection().merge(F).merge(F.connectedNodes()).merge(F.parent()):G=F,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?F.emitAndNotify("add"):e&&F.emit("add")}return r};_e.removed=function(){var t=this[0];return t&&t._private.removed};_e.inside=function(){var t=this[0];return t&&!t._private.removed};_e.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},i=r._private.cy;function o(P){for(var M=P._private.edges,R=0;R<M.length;R++)u(M[R])}function s(P){for(var M=P._private.children,R=0;R<M.length;R++)u(M[R])}function u(P){var M=n[P.id()];e&&P.removed()||M||(n[P.id()]=!0,P.isNode()?(a.push(P),o(P),s(P)):a.unshift(P))}for(var l=0,v=r.length;l<v;l++){var f=r[l];u(f)}function c(P,M){var R=P._private.edges;nr(R,M),P.clearTraversalCache()}function d(P){P.clearTraversalCache()}var h=[];h.ids={};function g(P,M){M=M[0],P=P[0];var R=P._private.children,L=P.id();nr(R,M),M._private.parent=null,h.ids[L]||(h.ids[L]=!0,h.push(P))}r.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var p=0;p<a.length;p++){var y=a[p];if(y.isEdge()){var b=y.source()[0],m=y.target()[0];c(b,y),c(m,y);for(var w=y.parallelEdges(),T=0;T<w.length;T++){var C=w[T];d(C),C.isBundledBezier()&&C.dirtyBoundingBoxCache()}}else{var x=y.parent();x.length!==0&&g(x,y)}e&&(y._private.removed=!0)}var S=i._private.elements;i._private.hasCompoundNodes=!1;for(var D=0;D<S.length;D++)if(S[D].isParent()){i._private.hasCompoundNodes=!0;break}var E=new lt(this.cy(),a);E.size()>0&&(t?E.emitAndNotify("remove"):e&&E.emit("remove"));for(var B=0;B<h.length;B++){var A=h[B];(!e||!A.removed())&&A.updateStyle()}return E};_e.move=function(t){var e=this._private.cy,r=this,a=!1,n=!1,i=function(d){return d==null?d:""+d};if(t.source!==void 0||t.target!==void 0){var o=i(t.source),s=i(t.target),u=o!=null&&e.hasElementWithId(o),l=s!=null&&e.hasElementWithId(s);(u||l)&&(e.batch(function(){r.remove(a,n),r.emitAndNotify("moveout");for(var c=0;c<r.length;c++){var d=r[c],h=d._private.data;d.isEdge()&&(u&&(h.source=o),l&&(h.target=s))}r.restore(a,n)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var v=i(t.parent);if(v===null||e.hasElementWithId(v)){var f=v===null?void 0:v;e.batch(function(){var c=r.remove(a,n);c.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var h=r[d],g=h._private.data;h.isNode()&&(g.parent=f)}c.restore(a,n)}),r.emitAndNotify("move")}}return this};[Tv,yg,on,tr,Xr,Pg,Vn,qg,Xv,Zv,Wg,En,sn,ut,rr,ht].forEach(function(t){ge(_e,t)});var Kg={add:function(e){var r,a=this;if(Tt(e)){var n=e;if(n._private.cy===a)r=n.restore();else{for(var i=[],o=0;o<n.length;o++){var s=n[o];i.push(s.json())}r=new lt(a,i)}}else if(ze(e))r=new lt(a,e);else if(Re(e)&&(ze(e.nodes)||ze(e.edges))){for(var u=e,l=[],v=["nodes","edges"],f=0,c=v.length;f<c;f++){var d=v[f],h=u[d];if(ze(h))for(var g=0,p=h.length;g<p;g++){var y=ge({group:d},h[g]);l.push(y)}}r=new lt(a,l)}else r=new Mn(a,e).collection();return r},remove:function(e){if(!Tt(e)){if(he(e)){var r=e;e=this.$(r)}}return e.remove()}};function Yg(t,e,r,a){var n=4,i=.001,o=1e-7,s=10,u=11,l=1/(u-1),v=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var f=0;f<4;++f)if(typeof arguments[f]!="number"||isNaN(arguments[f])||!isFinite(arguments[f]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var c=v?new Float32Array(u):new Array(u);function d(E,B){return 1-3*B+3*E}function h(E,B){return 3*B-6*E}function g(E){return 3*E}function p(E,B,A){return((d(B,A)*E+h(B,A))*E+g(B))*E}function y(E,B,A){return 3*d(B,A)*E*E+2*h(B,A)*E+g(B)}function b(E,B){for(var A=0;A<n;++A){var P=y(B,t,r);if(P===0)return B;var M=p(B,t,r)-E;B-=M/P}return B}function m(){for(var E=0;E<u;++E)c[E]=p(E*l,t,r)}function w(E,B,A){var P,M,R=0;do M=B+(A-B)/2,P=p(M,t,r)-E,P>0?A=M:B=M;while(Math.abs(P)>o&&++R<s);return M}function T(E){for(var B=0,A=1,P=u-1;A!==P&&c[A]<=E;++A)B+=l;--A;var M=(E-c[A])/(c[A+1]-c[A]),R=B+M*l,L=y(R,t,r);return L>=i?b(E,R):L===0?R:w(E,B,B+l)}var C=!1;function x(){C=!0,(t!==e||r!==a)&&m()}var S=function(B){return C||x(),t===e&&r===a?B:B===0?0:B===1?1:p(T(B),e,a)};S.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var D="generateBezier("+[t,e,r,a]+")";return S.toString=function(){return D},S}var Xg=(function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var o={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:o.v,dv:t(o)}}function r(a,n){var i={dx:a.v,dv:t(a)},o=e(a,n*.5,i),s=e(a,n*.5,o),u=e(a,n,s),l=1/6*(i.dx+2*(o.dx+s.dx)+u.dx),v=1/6*(i.dv+2*(o.dv+s.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+v*n,a}return function a(n,i,o){var s={x:-1,v:0,tension:null,friction:null},u=[0],l=0,v=1/1e4,f=16/1e3,c,d,h;for(n=parseFloat(n)||500,i=parseFloat(i)||20,o=o||null,s.tension=n,s.friction=i,c=o!==null,c?(l=a(n,i),d=l/o*f):d=f;h=r(h||s,d),u.push(1+h.x),l+=16,Math.abs(h.x)>v&&Math.abs(h.v)>v;);return c?function(g){return u[g*(u.length-1)|0]}:l}})(),qe=function(e,r,a,n){var i=Yg(e,r,a,n);return function(o,s,u){return o+(s-o)*i(u)}},un={linear:function(e,r,a){return e+(r-e)*a},ease:qe(.25,.1,.25,1),"ease-in":qe(.42,0,1,1),"ease-out":qe(0,0,.58,1),"ease-in-out":qe(.42,0,.58,1),"ease-in-sine":qe(.47,0,.745,.715),"ease-out-sine":qe(.39,.575,.565,1),"ease-in-out-sine":qe(.445,.05,.55,.95),"ease-in-quad":qe(.55,.085,.68,.53),"ease-out-quad":qe(.25,.46,.45,.94),"ease-in-out-quad":qe(.455,.03,.515,.955),"ease-in-cubic":qe(.55,.055,.675,.19),"ease-out-cubic":qe(.215,.61,.355,1),"ease-in-out-cubic":qe(.645,.045,.355,1),"ease-in-quart":qe(.895,.03,.685,.22),"ease-out-quart":qe(.165,.84,.44,1),"ease-in-out-quart":qe(.77,0,.175,1),"ease-in-quint":qe(.755,.05,.855,.06),"ease-out-quint":qe(.23,1,.32,1),"ease-in-out-quint":qe(.86,0,.07,1),"ease-in-expo":qe(.95,.05,.795,.035),"ease-out-expo":qe(.19,1,.22,1),"ease-in-out-expo":qe(1,0,0,1),"ease-in-circ":qe(.6,.04,.98,.335),"ease-out-circ":qe(.075,.82,.165,1),"ease-in-out-circ":qe(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return un.linear;var n=Xg(e,r,a);return function(i,o,s){return i+(o-i)*n(s)}},"cubic-bezier":qe};function ml(t,e,r,a,n){if(a===1||e===r)return r;var i=n(e,r,a);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function bl(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Lr(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var o=bl(t,n),s=bl(e,n);if(re(o)&&re(s))return ml(i,o,s,r,a);if(ze(o)&&ze(s)){for(var u=[],l=0;l<s.length;l++){var v=o[l],f=s[l];if(v!=null&&f!=null){var c=ml(i,v,f,r,a);u.push(c)}else u.push(f)}return u}}function Zg(t,e,r,a){var n=!a,i=t._private,o=e._private,s=o.easing,u=o.startTime,l=(a?t:t.cy()).style();if(!o.easingImpl)if(s==null)o.easingImpl=un.linear;else{var v;he(s)?v=l.parse("transition-timing-function",s).value:v=s;var f,c;he(v)?(f=v,c=[]):(f=v[1],c=v.slice(2).map(function(I){return+I})),c.length>0?(f==="spring"&&c.push(o.duration),o.easingImpl=un[f].apply(null,c)):o.easingImpl=un[f]}var d=o.easingImpl,h;if(o.duration===0?h=1:h=(r-u)/o.duration,o.applying&&(h=o.progress),h<0?h=0:h>1&&(h=1),o.delay==null){var g=o.startPosition,p=o.position;if(p&&n&&!t.locked()){var y={};la(g.x,p.x)&&(y.x=Lr(g.x,p.x,h,d)),la(g.y,p.y)&&(y.y=Lr(g.y,p.y,h,d)),t.position(y)}var b=o.startPan,m=o.pan,w=i.pan,T=m!=null&&a;T&&(la(b.x,m.x)&&(w.x=Lr(b.x,m.x,h,d)),la(b.y,m.y)&&(w.y=Lr(b.y,m.y,h,d)),t.emit("pan"));var C=o.startZoom,x=o.zoom,S=x!=null&&a;S&&(la(C,x)&&(i.zoom=Ea(i.minZoom,Lr(C,x,h,d),i.maxZoom)),t.emit("zoom")),(T||S)&&t.emit("viewport");var D=o.style;if(D&&D.length>0&&n){for(var E=0;E<D.length;E++){var B=D[E],A=B.name,P=B,M=o.startStyle[A],R=l.properties[M.name],L=Lr(M,P,h,d,R);l.overrideBypass(t,A,L)}t.emit("style")}}return o.progress=h,h}function la(t,e){return t==null||e==null?!1:re(t)&&re(e)?!0:!!(t&&e)}function Qg(t,e,r,a){var n=e._private;n.started=!0,n.startTime=r-n.progress*n.duration}function wl(t,e){var r=e._private.aniEles,a=[];function n(v,f){var c=v._private,d=c.animation.current,h=c.animation.queue,g=!1;if(d.length===0){var p=h.shift();p&&d.push(p)}for(var y=function(C){for(var x=C.length-1;x>=0;x--){var S=C[x];S()}C.splice(0,C.length)},b=d.length-1;b>=0;b--){var m=d[b],w=m._private;if(w.stopped){d.splice(b,1),w.hooked=!1,w.playing=!1,w.started=!1,y(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||Qg(v,m,t),Zg(v,m,t,f),w.applying&&(w.applying=!1),y(w.frames),w.step!=null&&w.step(t),m.completed()&&(d.splice(b,1),w.hooked=!1,w.playing=!1,w.started=!1,y(w.completes)),g=!0)}return!f&&d.length===0&&h.length===0&&a.push(v),g}for(var i=!1,o=0;o<r.length;o++){var s=r[o],u=n(s);i=i||u}var l=n(e,!0);(i||l)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var Jg={animate:Le.animate(),animation:Le.animation(),animated:Le.animated(),clearQueue:Le.clearQueue(),delay:Le.delay(),delayAnimation:Le.delayAnimation(),stop:Le.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&pn(function(i){wl(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,o){wl(o,e)},a.beforeRenderPriorities.animations):r()}},jg={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Pa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},Ja=function(e){return he(e)?new or(e):e},jv={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new qn(jg,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,Ja(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,Ja(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,Ja(r),a),this},once:function(e,r,a){return this.emitter().one(e,Ja(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Le.eventAliasesOn(jv);var Oo={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};Oo.jpeg=Oo.jpg;var ln={layout:function(e){var r=this;if(e==null){He("Layout options must be specified to make a layout");return}if(e.name==null){He("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){He("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;return he(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$(),new n(ge({},e,{cy:r,eles:i}))}};ln.createLayout=ln.makeLayout=ln.layout;var ep={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],o=e[i];r.getElementById(i).data(o)}})}},tp=vt({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),No={renderTo:function(e,r,a,n){return this._private.renderer.renderTo(e,r,a,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var r=this,a=r.extension("renderer",e.name);if(a==null){He("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Ie("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=tp(e);n.cy=r,r._private.renderer=new a(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};No.invalidateDimensions=No.resize;var vn={collection:function(e,r){return he(e)?this.$(e):Tt(e)?e.collection():ze(e)?(r||(r={}),new lt(this,e,r.unique,r.removed)):new lt(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};vn.elements=vn.filter=vn.$;var nt={},pa="t",rp="f";nt.apply=function(t){for(var e=this,r=e._private.cy.collection(),a=0;a<t.length;a++){var n=t[a],i=e.getContextMeta(n);if(!i.empty){var o=e.getContextStyle(i),s=e.applyContextStyle(i,o,n);n._private.appliedInitStyle?e.updateTransitions(n,s.diffProps):n._private.appliedInitStyle=!0,e.updateStyleHints(n)&&r.push(n)}}return r};nt.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},n=t+"-"+e,i=a[n];if(i)return i;for(var o=[],s={},u=0;u<r.length;u++){var l=r[u],v=t[u]===pa,f=e[u]===pa,c=v!==f,d=l.mappedProperties.length>0;if(c||f&&d){var h=void 0;c&&d||c?h=l.properties:d&&(h=l.mappedProperties);for(var g=0;g<h.length;g++){for(var p=h[g],y=p.name,b=!1,m=u+1;m<r.length;m++){var w=r[m];if(e[m]===pa&&(b=w.properties[p.name]!=null,b))break}!s[y]&&!b&&(s[y]=!0,o.push(y))}}}return a[n]=o,o};nt.getContextMeta=function(t){for(var e=this,r="",a,n=t._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i];o.selector&&o.selector.matches(t)?r+=pa:r+=rp}return a=e.getPropertiesDiff(n,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}};nt.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<r.length;i++){var o=r[i];if(e[i]===pa)for(var s=0;s<o.properties.length;s++){var u=o.properties[s];n[u.name]=u}}return a[e]=n,n};nt.applyContextStyle=function(t,e,r){for(var a=this,n=t.diffPropNames,i={},o=a.types,s=0;s<n.length;s++){var u=n[s],l=e[u],v=r.pstyle(u);if(!l)if(v)v.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(v!==l){if(l.mapped===o.fn&&v!=null&&v.mapping!=null&&v.mapping.value===l.value){var f=v.mapping;if((f.fnValue=l.value(r))===f.prevFnValue)continue}var c=i[u]={prev:v};a.applyParsedProperty(r,l),c.next=r.pstyle(u),c.next&&c.next.bypass&&(c.next=c.next.bypassed)}}return{diffProps:i}};nt.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,n=r.propertyGroupKeys,i=function(O,V,q){return r.getPropertiesHash(O,V,q)},o=e.styleKey;if(t.removed())return!1;var s=e.group==="nodes",u=t._private.style;a=Object.keys(u);for(var l=0;l<n.length;l++){var v=n[l];e.styleKeys[v]=[br,Vr]}for(var f=function(O,V){return e.styleKeys[V][0]=ba(O,e.styleKeys[V][0])},c=function(O,V){return e.styleKeys[V][1]=wa(O,e.styleKeys[V][1])},d=function(O,V){f(O,V),c(O,V)},h=function(O,V){for(var q=0;q<O.length;q++){var j=O.charCodeAt(q);f(j,V),c(j,V)}},g=2e9,p=function(O){return-128<O&&O<128&&Math.floor(O)!==O?g-(O*1024|0):O},y=0;y<a.length;y++){var b=a[y],m=u[b];if(m!=null){var w=this.properties[b],T=w.type,C=w.groupKey,x=void 0;w.hashOverride!=null?x=w.hashOverride(t,m):m.pfValue!=null&&(x=m.pfValue);var S=w.enums==null?m.value:null,D=x!=null,E=D||S!=null,B=m.units;T.number&&E&&!T.multiple?(d(p(D?x:S),C),!D&&B!=null&&h(B,C)):h(m.strValue,C)}}for(var A=[br,Vr],P=0;P<n.length;P++){var M=n[P],R=e.styleKeys[M];A[0]=ba(R[0],A[0]),A[1]=wa(R[1],A[1])}e.styleKey=zc(A[0],A[1]);var L=e.styleKeys;e.labelDimsKey=Xt(L.labelDimensions);var I=i(t,["label"],L.labelDimensions);if(e.labelKey=Xt(I),e.labelStyleKey=Xt(Ha(L.commonLabel,I)),!s){var F=i(t,["source-label"],L.labelDimensions);e.sourceLabelKey=Xt(F),e.sourceLabelStyleKey=Xt(Ha(L.commonLabel,F));var _=i(t,["target-label"],L.labelDimensions);e.targetLabelKey=Xt(_),e.targetLabelStyleKey=Xt(Ha(L.commonLabel,_))}if(s){var N=e.styleKeys,G=N.nodeBody,Z=N.nodeBorder,W=N.nodeOutline,$=N.backgroundImage,Y=N.compound,te=N.pie,J=N.stripe;e.nodeKey=Xt([G,Z,W,$,Y,te,J].filter(function(X){return X!=null}).reduce(Ha,[br,Vr])),e.hasPie=te!=null&&te[0]!==br&&te[1]!==Vr,e.hasStripe=J!=null&&J[0]!==br&&J[1]!==Vr}return o!==e.styleKey};nt.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null,e.hasStripe=null};nt.applyParsedProperty=function(t,e){var r=this,a=e,n=t._private.style,i,o=r.types,s=r.properties[a.name].type,u=a.bypass,l=n[a.name],v=l&&l.bypass,f=t._private,c="mapping",d=function(W){return W==null?null:W.pfValue!=null?W.pfValue:W.value},h=function(){var W=d(l),$=d(a);r.checkTriggers(t,a.name,W,$)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(a=e=this.parse(e.name,"bezier",u)),a.delete)return n[a.name]=void 0,h(),!0;if(a.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,h(),!0):!1:(h(),!0);if(a.deleteBypass)return l?l.bypass?(n[a.name]=l.bypassed,h(),!0):!1:(h(),!0);var g=function(){Ie("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:for(var p=a.field.split("."),y=f.data,b=0;b<p.length&&y;b++){var m=p[b];y=y[m]}if(y==null)return g(),!1;var w;if(re(y)){var T=a.fieldMax-a.fieldMin;T===0?w=0:w=(y-a.fieldMin)/T}else return Ie("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+y+"` for `"+t.id()+"` is non-numeric)"),!1;if(w<0?w=0:w>1&&(w=1),s.color){var C=a.valueMin[0],x=a.valueMax[0],S=a.valueMin[1],D=a.valueMax[1],E=a.valueMin[2],B=a.valueMax[2],A=a.valueMin[3]==null?1:a.valueMin[3],P=a.valueMax[3]==null?1:a.valueMax[3],M=[Math.round(C+(x-C)*w),Math.round(S+(D-S)*w),Math.round(E+(B-E)*w),Math.round(A+(P-A)*w)];i={bypass:a.bypass,name:a.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else if(s.number){var R=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,R,a.bypass,c)}else return!1;if(!i)return g(),!1;i.mapping=a,a=i;break;case o.data:for(var L=a.field.split("."),I=f.data,F=0;F<L.length&&I;F++){var _=L[F];I=I[_]}if(I!=null&&(i=this.parse(a.name,I,a.bypass,c)),!i)return g(),!1;i.mapping=a,a=i;break;case o.fn:var N=a.value,G=a.fnValue!=null?a.fnValue:N(t);if(a.prevFnValue=G,G==null)return Ie("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(a.name,G,a.bypass,c),!i)return Ie("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=Ft(a),a=i;break;case void 0:break;default:return!1}return u?(v?a.bypassed=l.bypassed:a.bypassed=l,n[a.name]=a):v?l.bypassed=a:n[a.name]=a,h(),!0};nt.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),o=0;o<i.length;o++){var s=i[o],u=n[s];u!=null&&(u.bypass?u.bypassed=null:n[s]=null)}}};nt.update=function(){this._private.cy.mutableElements().updateStyle()};nt.updateTransitions=function(t,e){var r=this,a=t._private,n=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,o=t.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var s={},u=!1,l=0;l<n.length;l++){var v=n[l],f=t.pstyle(v),c=e[v];if(c){var d=c.prev,h=c.next!=null?c.next:f,g=!1,p=void 0,y=1e-6;d&&(re(d.pfValue)&&re(h.pfValue)?(g=h.pfValue-d.pfValue,p=d.pfValue+y*g):re(d.value)&&re(h.value)?(g=h.value-d.value,p=d.value+y*g):ze(d.value)&&ze(h.value)&&(g=d.value[0]!==h.value[0]||d.value[1]!==h.value[1]||d.value[2]!==h.value[2],p=d.strValue),g&&(s[v]=h.strValue,this.applyBypass(t,v,p),u=!0))}}if(!u)return;a.transitioning=!0,new jr(function(b){o>0?t.delayAnimation(o).play().promise().then(b):b()}).then(function(){return t.animation({style:s,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)};nt.checkTrigger=function(t,e,r,a,n,i){var o=this.properties[e],s=n(o);t.removed()||s!=null&&s(r,a,t)&&i(o)};nt.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",t)})};nt.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})};nt.checkConnectedEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};nt.checkParallelEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){t.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};nt.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a),this.checkConnectedEdgesBoundsTrigger(t,e,r,a),this.checkParallelEdgesBoundsTrigger(t,e,r,a)};var Na={};Na.applyBypass=function(t,e,r,a){var n=this,i=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var s=0;s<n.properties.length;s++){var u=n.properties[s].name,l=this.parse(u,r,!0);l&&i.push(l)}}else if(he(e)){var v=this.parse(e,r,!0);v&&i.push(v)}else if(Re(e)){var f=e;a=r;for(var c=Object.keys(f),d=0;d<c.length;d++){var h=c[d],g=f[h];if(g===void 0&&(g=f[An(h)]),g!==void 0){var p=this.parse(h,g,!0);p&&i.push(p)}}}else return!1;if(i.length===0)return!1;for(var y=!1,b=0;b<t.length;b++){for(var m=t[b],w={},T=void 0,C=0;C<i.length;C++){var x=i[C];if(a){var S=m.pstyle(x.name);T=w[x.name]={prev:S}}y=this.applyParsedProperty(m,Ft(x))||y,a&&(T.next=m.pstyle(x.name))}y&&this.updateStyleHints(m),a&&this.updateTransitions(m,w,o)}return y};Na.overrideBypass=function(t,e,r){e=Yo(e);for(var a=0;a<t.length;a++){var n=t[a],i=n._private.style[e],o=this.properties[e].type,s=o.color,u=o.mutiple,l=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,r):(i.value=r,i.pfValue!=null&&(i.pfValue=r),s?i.strValue="rgb("+r.join(",")+")":u?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(n)),this.checkTriggers(n,e,l,r)}};Na.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Na.removeBypasses=function(t,e,r){for(var a=!0,n=0;n<t.length;n++){for(var i=t[n],o={},s=0;s<e.length;s++){var u=e[s],l=this.properties[u],v=i.pstyle(l.name);if(!(!v||!v.bypass)){var f=this.parse(u,"",!0),c=o[l.name]={prev:v};this.applyParsedProperty(i,f),c.next=i.pstyle(l.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,o,a)}};var ls={};ls.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};ls.containerCss=function(t){var e=this._private.cy,r=e.container(),a=e.window();if(a&&r&&a.getComputedStyle)return a.getComputedStyle(r).getPropertyValue(t)};var Vt={};Vt.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};Vt.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},n=0;n<r.properties.length;n++){var i=r.properties[n],o=r.getStylePropertyValue(t,i.name,e);o!=null&&(a[i.name]=o,a[An(i.name)]=o)}return a}};Vt.getIndexedStyle=function(t,e,r,a){var n=t.pstyle(e)[r][a];return n??t.cy().style().getDefaultProperty(e)[r][0]};Vt.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,o=t.pstyle(n.name);if(o){var s=o.value,u=o.units,l=o.strValue;if(r&&i.number&&s!=null&&re(s)){var v=t.cy().zoom(),f=function(g){return g*v},c=function(g,p){return f(g)+p},d=ze(s);return(d?u.every(function(h){return h!=null}):u!=null)?d?s.map(function(h,g){return c(h,u[g])}).join(" "):c(s,u):d?s.map(function(h){return he(h)?h:""+f(h)}).join(" "):""+f(s)}else if(l!=null)return l}return null}};Vt.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var n=e[a].name,i=t.pstyle(n);i!==void 0&&(Re(i)?i=this.parse(n,i.strValue):i=this.parse(n,i)),i&&(r[n]=i)}return r};Vt.getPropsList=function(t){var e=this,r=[],a=t,n=e.properties;if(a)for(var i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],u=a[s],l=n[s]||n[Yo(s)],v=this.parse(l.name,u);v&&r.push(v)}return r};Vt.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),n,i,o,s,u,l;for(u=0;u<e.length;u++)if(n=e[u],i=t.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=ba(s,a[0]),a[1]=wa(s,a[1]);else for(o=i.strValue,l=0;l<o.length;l++)s=o.charCodeAt(l),a[0]=ba(s,a[0]),a[1]=wa(s,a[1]);return a};Vt.getPropertiesHash=Vt.getNonDefaultPropertiesHash;var Gn={};Gn.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],n=a.selector,i=a.style||a.css,o=Object.keys(i);e.selector(n);for(var s=0;s<o.length;s++){var u=o[s],l=i[u];e.css(u,l)}}return e};Gn.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};Gn.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,n=r.properties,i={},o=0;o<n.length;o++){var s=n[o];i[s.name]=s.strValue}t.push({selector:a?a.toString():"core",style:i})}return t};var vs={};vs.appendFromString=function(t){var e=this,r=this,a=""+t,n,i,o;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){a.length>n.length?a=a.substr(n.length):a=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;!a.match(/^\s*$/);){var l=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){Ie("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=l[0];var v=l[1];if(v!=="core"&&new or(v).invalid){Ie("Skipping parsing of block: Invalid selector found in string stylesheet: "+v),s();continue}var f=l[2],c=!1;i=f;for(var d=[];!i.match(/^\s*$/);){var h=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){Ie("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+f),c=!0;break}o=h[0];var g=h[1],p=h[2];if(!e.properties[g]){Ie("Skipping property: Invalid property name in: "+o),u();continue}if(!r.parse(g,p)){Ie("Skipping property: Invalid property definition in: "+o),u();continue}d.push({name:g,val:p}),u()}if(c){s();break}r.selector(v);for(var y=0;y<d.length;y++){var b=d[y];r.css(b.name,b.val)}s()}return r};vs.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var Ye={};(function(){var t=Je,e=pc,r=mc,a=bc,n=wc,i=function(V){return"^"+V+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(V){var q=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+n;return"^"+V+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+q+")\\s*\\,\\s*("+q+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Ye.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},boxSelection:{enums:["contain","overlap","none"]},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle","circle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","top-inside","center","bottom","bottom-inside"]},halign:{enums:["left","left-inside","center","right","right-inside"]},justification:{enums:["left","center","right","auto"]},textMetrics:{enums:["font","glyph"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(V,q){switch(V.length){case 2:return q[0]!=="deg"&&q[0]!=="rad"&&q[1]!=="deg"&&q[1]!=="rad";case 1:return he(V[0])||q[0]==="deg"||q[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(V){var q=V.length;return q===1||q===2||q===4}}};var u={zeroNonZero:function(V,q){return(V==null||q==null)&&V!==q||V==0&&q!=0?!0:V!=0&&q==0},any:function(V,q){return V!=q},emptyNonEmpty:function(V,q){var j=ar(V),ue=ar(q);return j&&!ue||!j&&ue}},l=Ye.types,v=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],f=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],c=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],d=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],h=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification},{name:"text-metrics",type:l.textMetrics},{name:"box-select-labels",type:l.bool,triggersBounds:u.any}],g=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any},{name:"box-selection",type:l.boxSelection,triggersZOrder:u.any}],p=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(V,q,j){return V===q?!1:j.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],y=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],b=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],m=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],w=function(V,q){return q.value==="label"?-V.poolIndex():q.pfValue},T=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:w},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:w},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],C=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],x=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],S=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],D=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],E=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(V,q){return V===q?!1:V==="bezier"||q==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],B=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],A=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],P=[];Ye.pieBackgroundN=16,P.push({name:"pie-size",type:l.sizeMaybePercent}),P.push({name:"pie-hole",type:l.sizeMaybePercent}),P.push({name:"pie-start-angle",type:l.angle});for(var M=1;M<=Ye.pieBackgroundN;M++)P.push({name:"pie-"+M+"-background-color",type:l.color}),P.push({name:"pie-"+M+"-background-size",type:l.percent}),P.push({name:"pie-"+M+"-background-opacity",type:l.zeroOneNumber});var R=[];Ye.stripeBackgroundN=16,R.push({name:"stripe-size",type:l.sizeMaybePercent}),R.push({name:"stripe-direction",type:l.axisDirectionPrimary});for(var L=1;L<=Ye.stripeBackgroundN;L++)R.push({name:"stripe-"+L+"-background-color",type:l.color}),R.push({name:"stripe-"+L+"-background-size",type:l.percent}),R.push({name:"stripe-"+L+"-background-opacity",type:l.zeroOneNumber});var I=[],F=Ye.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(O){F.forEach(function(V){var q=V+"-"+O.name,j=O.type,ue=O.triggersBounds;I.push({name:q,type:j,triggersBounds:ue})})},{});var _=Ye.properties=[].concat(g,m,p,y,b,B,h,d,v,f,c,T,C,x,S,P,R,D,E,I,A),N=Ye.propertyGroups={behavior:g,transition:m,visibility:p,overlay:y,underlay:b,ghost:B,commonLabel:h,labelDimensions:d,mainLabel:v,sourceLabel:f,targetLabel:c,nodeBody:T,nodeBorder:C,nodeOutline:x,backgroundImage:S,pie:P,stripe:R,compound:D,edgeLine:E,edgeArrow:I,core:A},G=Ye.propertyGroupNames={};(Ye.propertyGroupKeys=Object.keys(N)).forEach(function(O){G[O]=N[O].map(function(V){return V.name}),N[O].forEach(function(V){return V.groupKey=O})});var Z=Ye.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Ye.propertyNames=_.map(function(O){return O.name});for(var W=0;W<_.length;W++){var $=_[W];_[$.name]=$}for(var Y=0;Y<Z.length;Y++){var te=Z[Y],J=_[te.pointsTo],X={name:te.name,alias:!0,pointsTo:J};_.push(X),_[te.name]=X}})();Ye.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};Ye.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=ge({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","text-metrics":"font","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%","pie-hole":0,"pie-start-angle":"0deg"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(s,u){for(var l=1;l<=Ye.pieBackgroundN;l++){var v=u.name.replace("{{i}}",l);s[v]=u.value}return s},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(s,u){for(var l=1;l<=Ye.stripeBackgroundN;l++){var v=u.name.replace("{{i}}",l);s[v]=u.value}return s},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(s,u){return Ye.arrowPrefixes.forEach(function(l){var v=l+"-"+u.name;s[v]=u.value}),s},{})),r={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,o=e[i];r[i]=this.parse(i,o)}}return t.defaultProperties=r,t.defaultProperties};Ye.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Hn={};Hn.parse=function(t,e,r,a){var n=this;if(We(e))return n.parseImplWarn(t,e,r,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,o=r?"t":"f",s=lv(t,""+e,o,i),u=n.propCache=n.propCache||[],l;return(l=u[s])||(l=u[s]=n.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(l=Ft(l),l&&(l.value=Ft(l.value))),l};Hn.parseImplWarn=function(t,e,r,a){var n=this.parseImpl(t,e,r,a);return!n&&e!=null&&Ie("The style property `".concat(t,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&Ie("The style value of `label` is deprecated for `"+n.name+"`"),n};Hn.parseImpl=function(t,e,r,a){var n=this;t=Yo(t);var i=n.properties[t],o=e,s=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var u=he(e);u&&(e=e.trim());var l=i.type;if(!l)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(We(e))return{name:t,value:e,strValue:"fn",mapped:s.fn,bypass:r};var v,f;if(!(!u||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(v=new RegExp(s.data.regex).exec(e))){if(r)return!1;var c=s.data;return{name:t,value:v,strValue:""+e,mapped:c,field:v[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(s.mapData.regex).exec(e))){if(r||l.multiple)return!1;var d=s.mapData;if(!(l.color||l.number))return!1;var h=this.parse(t,f[4]);if(!h||h.mapped)return!1;var g=this.parse(t,f[5]);if(!g||g.mapped)return!1;if(h.pfValue===g.pfValue||h.strValue===g.strValue)return Ie("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+h.strValue+"`"),this.parse(t,h.strValue);if(l.color){var p=h.value,y=g.value;if(p[0]===y[0]&&p[1]===y[1]&&p[2]===y[2]&&(p[3]===y[3]||(p[3]==null||p[3]===1)&&(y[3]==null||y[3]===1)))return!1}return{name:t,value:f,strValue:""+e,mapped:d,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:h.value,valueMax:g.value,bypass:r}}}if(l.multiple&&a!=="multiple"){var b;if(u?b=e.split(/\s+/):ze(e)?b=e:b=[e],l.evenMultiple&&b.length%2!==0)return null;for(var m=[],w=[],T=[],C="",x=!1,S=0;S<b.length;S++){var D=n.parse(t,b[S],r,"multiple");x=x||he(D.value),m.push(D.value),T.push(D.pfValue!=null?D.pfValue:D.value),w.push(D.units),C+=(S>0?" ":"")+D.strValue}return l.validate&&!l.validate(m,w)?null:l.singleEnum&&x?m.length===1&&he(m[0])?{name:t,value:m[0],strValue:m[0],bypass:r}:null:{name:t,value:m,pfValue:T,strValue:C,bypass:r,units:w}}var E=function(){for(var J=0;J<l.enums.length;J++)if(l.enums[J]===e)return{name:t,value:e,strValue:""+e,bypass:r};return null};if(l.number){var B,A="px";if(l.units&&(B=l.units),l.implicitUnits&&(A=l.implicitUnits),!l.unitless)if(u){var P="px|em"+(l.allowPercent?"|\\%":"");B&&(P=B);var M=e.match("^("+Je+")("+P+")?$");M&&(e=M[1],B=M[2]||A)}else(!B||l.implicitUnits)&&(B=A);if(e=parseFloat(e),isNaN(e)&&l.enums===void 0)return null;if(isNaN(e)&&l.enums!==void 0)return e=o,E();if(l.integer&&!lc(e)||l.min!==void 0&&(e<l.min||l.strictMin&&e===l.min)||l.max!==void 0&&(e>l.max||l.strictMax&&e===l.max))return null;var R={name:t,value:e,strValue:""+e+(B||""),units:B,bypass:r};return l.unitless||B!=="px"&&B!=="em"?R.pfValue=e:R.pfValue=B==="px"||!B?e:this.getEmSizeInPixels()*e,(B==="ms"||B==="s")&&(R.pfValue=B==="ms"?e:1e3*e),(B==="deg"||B==="rad")&&(R.pfValue=B==="rad"?e:ph(e)),B==="%"&&(R.pfValue=e/100),R}else if(l.propList){var L=[],I=""+e;if(I!=="none"){for(var F=I.split(/\s*,\s*|\s+/),_=0;_<F.length;_++){var N=F[_].trim();n.properties[N]?L.push(N):Ie("`"+N+"` is not a valid property name")}if(L.length===0)return null}return{name:t,value:L,strValue:L.length===0?"none":L.join(" "),bypass:r}}else if(l.color){var G=rv(e);return G?{name:t,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:r}:null}else if(l.regex||l.regexes){if(l.enums){var Z=E();if(Z)return Z}for(var W=l.regexes?l.regexes:[l.regex],$=0;$<W.length;$++){var Y=new RegExp(W[$]).exec(e);if(Y)return{name:t,value:l.singleRegexMatchValue?Y[1]:Y,strValue:""+e,bypass:r}}return null}else return l.string?{name:t,value:""+e,strValue:""+e,bypass:r}:l.enums?E():null};var at=function(e){if(!(this instanceof at))return new at(e);if(!Ko(e)){He("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},dt=at.prototype;dt.instanceString=function(){return"style"};dt.clear=function(){for(var t=this._private,e=t.cy.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(e,!0),e.forEach(function(a){var n=a[0]._private;n.styleDirty=!0,n.appliedInitStyle=!1}),this};dt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};dt.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};dt.selector=function(t){var e=t==="core"?null:new or(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};dt.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var n=t.properties[a],i=r[n.name];i===void 0&&(i=r[An(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};dt.style=dt.css;dt.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.name.match(/stripe-(\d+)-background-size/)&&r.value&&(this._private.hasStripe=!0),r.mapped&&this[a].mappedProperties.push(r),this[a].selector||(this._private.coreStyle[r.name]=r)}return this};dt.append=function(t){return jl(t)?t.appendToStyle(this):ze(t)?this.appendFromJson(t):he(t)&&this.appendFromString(t),this};at.fromJson=function(t,e){var r=new at(t);return r.fromJson(e),r};at.fromString=function(t,e){return new at(t).fromString(e)};[nt,Na,ls,Vt,Gn,vs,Ye,Hn].forEach(function(t){ge(dt,t)});at.types=dt.types;at.properties=dt.properties;at.propertyGroups=dt.propertyGroups;at.propertyGroupNames=dt.propertyGroupNames;at.propertyGroupKeys=dt.propertyGroupKeys;var ap={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var r=this._private;return jl(e)?r.style=e.generateStyle(this):ze(e)?r.style=at.fromJson(this,e):he(e)?r.style=at.fromString(this,e):r.style=at(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},np="single",Sr={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var r=this._private;if(r.selectionType==null&&(r.selectionType=np),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,r=this._private.pan,a,n,i,o,s;switch(e.length){case 0:return r;case 1:if(he(e[0]))return a=e[0],r[a];if(Re(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,s=i.y,re(o)&&(r.x=o),re(s)&&(r.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&re(n)&&(r[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,n=this._private.pan,i,o,s,u,l;if(!this._private.panningEnabled)return this;switch(a.length){case 1:Re(e)&&(s=a[0],u=s.x,l=s.y,re(u)&&(n.x+=u),re(l)&&(n.y+=l),this.emit("pan viewport"));break;case 2:i=e,o=r,(i==="x"||i==="y")&&re(o)&&(n[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,r){var a=this.getFitViewport(e,r);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(re(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(he(e)){var n=e;e=this.$(n)}else if(cc(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else Tt(e)||(e=this.mutableElements());if(!(Tt(e)&&e.empty())){a=a||e.boundingBox();var o=this.width(),s=this.height(),u;if(r=re(r)?r:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((o-2*r)/a.w,(s-2*r)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(o-u*(a.x1+a.x2))/2,y:(s-u*(a.y1+a.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var n=e;e=n.min,r=n.max}return re(e)&&re(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):re(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:re(r)&&e===void 0&&r>=a.minZoom&&(a.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,a=r.pan,n=r.zoom,i,o,s=!1;if(r.zoomingEnabled||(s=!0),re(e)?o=e:Re(e)&&(o=e.level,e.position!=null?i=Ln(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(s=!0)),o=o>r.maxZoom?r.maxZoom:o,o=o<r.minZoom?r.minZoom:o,s||!re(o)||o===n||i!=null&&(!re(i.x)||!re(i.y)))return null;if(i!=null){var u=a,l=n,v=o;return{zoomed:!0,panned:!0,zoom:v,pan:{x:-v/l*(i.x-u.x)+i.x,y:-v/l*(i.y-u.y)+i.y}}}else return{zoomed:!0,panned:!1,zoom:o,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,n=!0,i=[],o=!1,s=!1;if(!e)return this;if(re(e.zoom)||(a=!1),Re(e.pan)||(n=!1),!a&&!n)return this;if(a){var u=e.zoom;u<r.minZoom||u>r.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=u,i.push("zoom"))}if(n&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var l=e.pan;re(l.x)&&(r.pan.x=l.x,s=!1),re(l.y)&&(r.pan.y=l.y,s=!1),s||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(he(e)){var a=e;e=this.mutableElements().filter(a)}else Tt(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),o=this.height();return r=r===void 0?this._private.zoom:r,{x:(i-r*(n.x1+n.x2))/2,y:(o-r*(n.y1+n.y2))/2}}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?(function(){var n=a.window().getComputedStyle(r),i=function(s){return parseFloat(n.getPropertyValue(s))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.clientHeight-i("padding-top")-i("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Sr.centre=Sr.center;Sr.autolockNodes=Sr.autolock;Sr.autoungrabifyNodes=Sr.autoungrabify;var Sa={data:Le.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Le.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Le.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Le.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Sa.attr=Sa.data;Sa.removeAttr=Sa.removeData;var Da=function(e){var r=this;e=ge({},e);var a=e.container;a&&!gn(a)&&gn(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=r;var o=Qe!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=ge({name:o?"grid":"null"},s.layout),s.renderer=ge({name:o?"canvas":"null"},s.renderer);var u=function(h,g,p){return g!==void 0?g:p!==void 0?p:h},l=this._private={container:a,ready:!1,options:s,elements:new lt(this),listeners:[],aniEles:new lt(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,s.zoomingEnabled),userZoomingEnabled:u(!0,s.userZoomingEnabled),panningEnabled:u(!0,s.panningEnabled),userPanningEnabled:u(!0,s.userPanningEnabled),boxSelectionEnabled:u(!0,s.boxSelectionEnabled),autolock:u(!1,s.autolock,s.autolockNodes),autoungrabify:u(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:u(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:re(s.zoom)?s.zoom:1,pan:{x:Re(s.pan)&&re(s.pan.x)?s.pan.x:0,y:Re(s.pan)&&re(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var v=function(h,g){if(h.some(hc))return jr.all(h).then(g);g(h)};l.styleEnabled&&r.setStyle([]);var f=ge({},s,s.renderer);r.initRenderer(f);var c=function(h,g,p){r.notifications(!1);var y=r.mutableElements();y.length>0&&y.remove(),h!=null&&(Re(h)||ze(h))&&r.add(h),r.one("layoutready",function(m){r.notifications(!0),r.emit(m),r.one("load",g),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",p),r.emit("done")});var b=ge({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()};v([s.style,s.elements],function(d){var h=d[0],g=d[1];l.styleEnabled&&r.style().append(h),c(g,function(){r.startAnimationLoop(),l.ready=!0,We(s.ready)&&r.on("ready",s.ready);for(var p=0;p<i.length;p++){var y=i[p];r.on("ready",y)}n&&(n.readies=[]),r.emit("ready")},s.done)})},Tn=Da.prototype;ge(Tn,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(this._private.container==null)return Qe;var e=this._private.container.ownerDocument;return e===void 0||e==null?Qe:e.defaultView||Qe},mount:function(e){if(e!=null){var r=this,a=r._private,n=a.options;return!gn(e)&&gn(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer(ge({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),r.startAnimationLoop(),r.style(n.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Ft(this._private.options)},json:function(e){var r=this,a=r._private,n=r.mutableElements(),i=function(w){return r.getElementById(w.id())};if(Re(e)){if(r.startBatch(),e.elements){var o={},s=function(w,T){for(var C=[],x=[],S=0;S<w.length;S++){var D=w[S];if(!D.data.id){Ie("cy.json() cannot handle elements without an ID attribute");continue}var E=""+D.data.id,B=r.getElementById(E);o[E]=!0,B.length!==0?x.push({ele:B,json:D}):(T&&(D.group=T),C.push(D))}r.add(C);for(var A=0;A<x.length;A++){var P=x[A],M=P.ele,R=P.json;M.json(R)}};if(ze(e.elements))s(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var v=u[l],f=e.elements[v];ze(f)&&s(f,v)}var c=r.collection();n.filter(function(m){return!o[m.id()]}).forEach(function(m){m.isParent()?c.merge(m):m.remove()}),c.forEach(function(m){return m.children().move({parent:null})}),c.forEach(function(m){return i(m).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<d.length;h++){var g=d[h];e[g]!=null&&r[g](e[g])}return r.endBatch(),this}else{var p=!!e,y={};p?y.elements=this.elements().map(function(m){return m.json()}):(y.elements={},n.forEach(function(m){var w=m.group();y.elements[w]||(y.elements[w]=[]),y.elements[w].push(m.json())})),this._private.styleEnabled&&(y.style=r.style().json()),y.data=Ft(r.data());var b=a.options;return y.zoomingEnabled=a.zoomingEnabled,y.userZoomingEnabled=a.userZoomingEnabled,y.zoom=a.zoom,y.minZoom=a.minZoom,y.maxZoom=a.maxZoom,y.panningEnabled=a.panningEnabled,y.userPanningEnabled=a.userPanningEnabled,y.pan=Ft(a.pan),y.boxSelectionEnabled=a.boxSelectionEnabled,y.renderer=Ft(b.renderer),y.hideEdgesOnViewport=b.hideEdgesOnViewport,y.textureOnViewport=b.textureOnViewport,y.wheelSensitivity=b.wheelSensitivity,y.motionBlur=b.motionBlur,y.multiClickDebounceTime=b.multiClickDebounceTime,y}}});Tn.$id=Tn.getElementById;[Kg,Jg,jv,Oo,ln,ep,No,vn,ap,Sr,Sa].forEach(function(t){ge(Tn,t)});var ip={fit:!0,directed:!1,direction:"downward",padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},op={maximal:!1,acyclic:!1},Ir=function(e){return e.scratch("breadthfirst")},xl=function(e,r){return e.scratch("breadthfirst",r)};function ef(t){this.options=ge({},ip,op,t)}ef.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=r.nodes().filter(function(le){return le.isChildless()}),n=r,i=t.directed,o=t.acyclic||t.maximal||t.maximalAdjustments>0,s=!!t.boundingBox,u=mt(s?t.boundingBox:structuredClone(e.extent())),l;if(Tt(t.roots))l=t.roots;else if(ze(t.roots)){for(var v=[],f=0;f<t.roots.length;f++){var c=t.roots[f],d=e.getElementById(c);v.push(d)}l=e.collection(v)}else if(he(t.roots))l=e.$(t.roots);else if(i)l=a.roots();else{var h=r.components();l=e.collection();for(var g=function(){var ae=h[p],fe=ae.maxDegree(!1),pe=ae.filter(function(me){return me.degree(!1)===fe});l=l.add(pe)},p=0;p<h.length;p++)g()}var y=[],b={},m=function(ae,fe){y[fe]==null&&(y[fe]=[]);var pe=y[fe].length;y[fe].push(ae),xl(ae,{index:pe,depth:fe})},w=function(ae,fe){var pe=Ir(ae),me=pe.depth,ce=pe.index;y[me][ce]=null,ae.isChildless()&&m(ae,fe)};n.bfs({roots:l,directed:t.directed,visit:function(ae,fe,pe,me,ce){var Ce=ae[0],Be=Ce.id();Ce.isChildless()&&m(Ce,ce),b[Be]=!0}});for(var T=[],C=0;C<a.length;C++){var x=a[C];b[x.id()]||T.push(x)}var S=function(ae){for(var fe=y[ae],pe=0;pe<fe.length;pe++){var me=fe[pe];if(me==null){fe.splice(pe,1),pe--;continue}xl(me,{depth:ae,index:pe})}},D=function(ae,fe){for(var pe=Ir(ae),me=ae.incomers().filter(function(ie){return ie.isNode()&&r.has(ie)}),ce=-1,Ce=ae.id(),Be=0;Be<me.length;Be++){var Pe=me[Be],Ne=Ir(Pe);ce=Math.max(ce,Ne.depth)}if(pe.depth<=ce){if(!t.acyclic&&fe[Ce])return null;var Ee=ce+1;return w(ae,Ee),fe[Ce]=Ee,!0}return!1};if(i&&o){var E=[],B={},A=function(ae){return E.push(ae)},P=function(){return E.shift()};for(a.forEach(function(le){return E.push(le)});E.length>0;){var M=P(),R=D(M,B);if(R)M.outgoers().filter(function(le){return le.isNode()&&r.has(le)}).forEach(A);else if(R===null){Ie("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var L=0;if(t.avoidOverlap)for(var I=0;I<a.length;I++){var F=a[I].layoutDimensions(t),_=F.w,N=F.h;L=Math.max(L,_,N)}var G={},Z=function(ae){if(G[ae.id()])return G[ae.id()];for(var fe=Ir(ae).depth,pe=ae.neighborhood(),me=0,ce=0,Ce=0;Ce<pe.length;Ce++){var Be=pe[Ce];if(!(Be.isEdge()||Be.isParent()||!a.has(Be))){var Pe=Ir(Be);if(Pe!=null){var Ne=Pe.index,Ee=Pe.depth;if(!(Ne==null||Ee==null)){var ie=y[Ee].length;Ee<fe&&(me+=Ne/ie,ce++)}}}}return ce=Math.max(1,ce),me=me/ce,ce===0&&(me=0),G[ae.id()]=me,me},W=function(ae,fe){var pe=Z(ae)-Z(fe);return pe===0?tv(ae.id(),fe.id()):pe};t.depthSort!==void 0&&(W=t.depthSort);for(var $=y.length,Y=0;Y<$;Y++)y[Y].sort(W),S(Y);for(var te=[],J=0;J<T.length;J++)te.push(T[J]);var X=function(){for(var ae=0;ae<$;ae++)S(ae)};te.length&&(y.unshift(te),$=y.length,X());for(var O=0,V=0;V<$;V++)O=Math.max(y[V].length,O);var q={x:u.x1+u.w/2,y:u.y1+u.h/2},j=a.reduce(function(le,ae){return(function(fe){return{w:le.w===-1?fe.w:(le.w+fe.w)/2,h:le.h===-1?fe.h:(le.h+fe.h)/2}})(ae.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),ue=Math.max($===1?0:s?(u.h-t.padding*2-j.h)/($-1):(u.h-t.padding*2-j.h)/($+1),L),we=y.reduce(function(le,ae){return Math.max(le,ae.length)},0),be=function(ae){var fe=Ir(ae),pe=fe.depth,me=fe.index;if(t.circle){var ce=Math.min(u.w/2/$,u.h/2/$);ce=Math.max(ce,L);var Ce=ce*pe+ce-($>0&&y[0].length<=3?ce/2:0),Be=2*Math.PI/y[pe].length*me;return pe===0&&y[0].length===1&&(Ce=1),{x:q.x+Ce*Math.cos(Be),y:q.y+Ce*Math.sin(Be)}}else{var Pe=y[pe].length,Ne=Math.max(Pe===1?0:s?(u.w-t.padding*2-j.w)/((t.grid?we:Pe)-1):(u.w-t.padding*2-j.w)/((t.grid?we:Pe)+1),L);return{x:q.x+(me+1-(Pe+1)/2)*Ne,y:q.y+(pe+1-($+1)/2)*ue}}},ke={downward:0,leftward:90,upward:180,rightward:-90};return Object.keys(ke).indexOf(t.direction)===-1&&He("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(ke).join(", "))),r.nodes().layoutPositions(this,t,function(ae){return _c(be(ae),u,ke[t.direction])}),this};var sp={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function tf(t){this.options=ge({},sp,t)}tf.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=mt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=(e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep)/Math.max(1,i.length-1),l,v=0,f=0;f<i.length;f++){var c=i[f].layoutDimensions(e),d=c.w,h=c.h;v=Math.max(v,d,h)}if(re(e.radius)?l=e.radius:i.length<=1?l=0:l=Math.min(o.h,o.w)/2-v,i.length>1&&e.avoidOverlap){v*=1.75;var g=Math.cos(u)-Math.cos(0),p=Math.sin(u)-Math.sin(0),y=Math.sqrt(v*v/(g*g+p*p));l=Math.max(y,l)}return a.nodes().layoutPositions(this,e,function(m,w){var T=e.startAngle+w*u*(n?1:-1),C=l*Math.cos(T),x=l*Math.sin(T);return{x:s.x+C,y:s.y+x}}),this};var up={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function rf(t){this.options=ge({},up,t)}rf.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,i=n.nodes().not(":parent"),o=mt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],l=0,v=0;v<i.length;v++){var f=i[v],c=void 0;c=e.concentric(f),u.push({value:c,node:f}),f._private.scratch.concentric=c}i.updateStyle();for(var d=0;d<i.length;d++){var h=i[d].layoutDimensions(e);l=Math.max(l,h.w,h.h)}u.sort(function(O,V){return V.value-O.value});for(var g=e.levelWidth(i),p=[[]],y=p[0],b=0;b<u.length;b++){var m=u[b];y.length>0&&Math.abs(y[0].value-m.value)>=g&&(y=[],p.push(y)),y.push(m)}var w=l+e.minNodeSpacing;if(!e.avoidOverlap){var T=p.length>0&&p[0].length>1,C=(Math.min(o.w,o.h)/2-w)/(p.length+T?1:0);w=Math.min(w,C)}for(var x=0,S=0;S<p.length;S++){var D=p[S],E=D.dTheta=(e.sweep===void 0?2*Math.PI-2*Math.PI/D.length:e.sweep)/Math.max(1,D.length-1);if(D.length>1&&e.avoidOverlap){var B=Math.cos(E)-Math.cos(0),A=Math.sin(E)-Math.sin(0),P=Math.sqrt(w*w/(B*B+A*A));x=Math.max(P,x)}D.r=x,x+=w}if(e.equidistant){for(var M=0,R=0,L=0;L<p.length;L++){var I=p[L].r-R;M=Math.max(M,I)}R=0;for(var F=0;F<p.length;F++){var _=p[F];F===0&&(R=_.r),_.r=R,R+=M}}for(var N={},G=0;G<p.length;G++)for(var Z=p[G],W=Z.dTheta,$=Z.r,Y=0;Y<Z.length;Y++){var te=Z[Y],J=e.startAngle+(r?1:-1)*W*Y,X={x:s.x+$*Math.cos(J),y:s.y+$*Math.sin(J)};N[te.node.id()]=X}return n.nodes().layoutPositions(this,e,function(O){return N[O.id()]}),this};var yo,lp={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function $n(t){this.options=ge({},lp,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges().filter(function(a){var n=a.source().data("id"),i=a.target().data("id"),o=e.some(function(u){return u.data("id")===n}),s=e.some(function(u){return u.data("id")===i});return!o||!s});this.options.eles=this.options.eles.not(r)}$n.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?yo=!0:yo=!1;var a=vp(e,r,t);yo&&cp(a),t.randomize&&hp(a);var n=$t(),i=function(){dp(a,e,t),t.fit===!0&&e.fit(t.padding)},o=function(c){return!(r.stopped||c>=t.numIter||(gp(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},s=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var c=t.eles.nodes(),d=nf(a,t,c);c.layoutPositions(r,t,d)}},u=0,l=!0;if(t.animate===!0){var v=function(){for(var c=0;l&&c<t.refresh;)l=o(u),u++,c++;l?($t()-n>=t.animationThreshold&&i(),pn(v)):(Cl(a,t),s())};v()}else{for(;l;)l=o(u),u++;Cl(a,t),s()}return this};$n.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};$n.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var vp=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),o=mt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=a.eles.components(),l={},v=0;v<u.length;v++)for(var f=u[v],c=0;c<f.length;c++){var d=f[c];l[d.id()]=v}for(var v=0;v<s.nodeSize;v++){var h=i[v],g=h.layoutDimensions(a),p={};p.isLocked=h.locked(),p.id=h.data("id"),p.parentId=h.data("parent"),p.cmptId=l[h.id()],p.children=[],p.positionX=h.position("x"),p.positionY=h.position("y"),p.offsetX=0,p.offsetY=0,p.height=g.w,p.width=g.h,p.maxX=p.positionX+p.width/2,p.minX=p.positionX-p.width/2,p.maxY=p.positionY+p.height/2,p.minY=p.positionY-p.height/2,p.padLeft=parseFloat(h.style("padding")),p.padRight=parseFloat(h.style("padding")),p.padTop=parseFloat(h.style("padding")),p.padBottom=parseFloat(h.style("padding")),p.nodeRepulsion=We(a.nodeRepulsion)?a.nodeRepulsion(h):a.nodeRepulsion,s.layoutNodes.push(p),s.idToIndex[p.id]=v}for(var y=[],b=0,m=-1,w=[],v=0;v<s.nodeSize;v++){var h=s.layoutNodes[v],T=h.parentId;T!=null?s.layoutNodes[s.idToIndex[T]].children.push(h.id):(y[++m]=h.id,w.push(h.id))}for(s.graphSet.push(w);b<=m;){var C=y[b++],x=s.idToIndex[C],d=s.layoutNodes[x],S=d.children;if(S.length>0){s.graphSet.push(S);for(var v=0;v<S.length;v++)y[++m]=S[v]}}for(var v=0;v<s.graphSet.length;v++)for(var D=s.graphSet[v],c=0;c<D.length;c++){var E=s.idToIndex[D[c]];s.indexToGraph[E]=v}for(var v=0;v<s.edgeSize;v++){var B=n[v],A={};A.id=B.data("id"),A.sourceId=B.data("source"),A.targetId=B.data("target");var P=We(a.idealEdgeLength)?a.idealEdgeLength(B):a.idealEdgeLength,M=We(a.edgeElasticity)?a.edgeElasticity(B):a.edgeElasticity,R=s.idToIndex[A.sourceId],L=s.idToIndex[A.targetId];if(s.indexToGraph[R]!=s.indexToGraph[L]){for(var I=fp(A.sourceId,A.targetId,s),F=s.graphSet[I],_=0,p=s.layoutNodes[R];F.indexOf(p.id)===-1;)p=s.layoutNodes[s.idToIndex[p.parentId]],_++;for(p=s.layoutNodes[L];F.indexOf(p.id)===-1;)p=s.layoutNodes[s.idToIndex[p.parentId]],_++;P*=_*a.nestingFactor}A.idealLength=P,A.elasticity=M,s.layoutEdges.push(A)}return s},fp=function(e,r,a){var n=af(e,r,0,a);return 2>n.count?0:n.graph},af=function(e,r,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(r))return{count:2,graph:a};for(var o=0,s=0;s<i.length;s++){var u=i[s],l=n.idToIndex[u],v=n.layoutNodes[l].children;if(v.length!==0){var f=n.indexToGraph[n.idToIndex[v[0]]],c=af(e,r,f,n);if(c.count!==0)if(c.count===1){if(o++,o===2)break}else return c}}return{count:o,graph:a}},cp,hp=function(e,r){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*a,o.positionY=Math.random()*n)}},nf=function(e,r,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.forEach(function(o){var s=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,s.positionX),i.x2=Math.max(i.x2,s.positionX),i.y1=Math.min(i.y1,s.positionY),i.y2=Math.max(i.y2,s.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,s){var u=e.layoutNodes[e.idToIndex[o.data("id")]];if(r.boundingBox){var l=i.w===0?.5:(u.positionX-i.x1)/i.w,v=i.h===0?.5:(u.positionY-i.y1)/i.h;return{x:n.x1+l*n.w,y:n.y1+v*n.h}}else return{x:u.positionX,y:u.positionY}}},dp=function(e,r,a){var n=a.layout,i=a.eles.nodes(),o=nf(e,a,i);i.positions(o),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},gp=function(e,r,a){pp(e,r),bp(e),wp(e,r),xp(e),Ep(e)},pp=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,o=0;o<i;o++)for(var s=e.layoutNodes[e.idToIndex[n[o]]],u=o+1;u<i;u++){var l=e.layoutNodes[e.idToIndex[n[u]]];yp(s,l,e,r)}},El=function(e){return-e+2*e*Math.random()},yp=function(e,r,a,n){if(!(e.cmptId!==r.cmptId&&!a.isCompound)){var i=r.positionX-e.positionX,o=r.positionY-e.positionY,s=1;i===0&&o===0&&(i=El(s),o=El(s));var u=mp(e,r,i,o);if(u>0)var l=n.nodeOverlap*u,v=Math.sqrt(i*i+o*o),f=l*i/v,c=l*o/v;else var d=Sn(e,i,o),h=Sn(r,-1*i,-1*o),g=h.x-d.x,p=h.y-d.y,y=g*g+p*p,v=Math.sqrt(y),l=(e.nodeRepulsion+r.nodeRepulsion)/y,f=l*g/v,c=l*p/v;e.isLocked||(e.offsetX-=f,e.offsetY-=c),r.isLocked||(r.offsetX+=f,r.offsetY+=c)}},mp=function(e,r,a,n){if(a>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(n>0)var o=e.maxY-r.minY;else var o=r.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},Sn=function(e,r,a){var n=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,u=a/r,l=o/s,v={};return r===0&&0<a||r===0&&0>a?(v.x=n,v.y=i+o/2,v):0<r&&-1*l<=u&&u<=l?(v.x=n+s/2,v.y=i+s*a/2/r,v):0>r&&-1*l<=u&&u<=l?(v.x=n-s/2,v.y=i-s*a/2/r,v):0<a&&(u<=-1*l||u>=l)?(v.x=n+o*r/2/a,v.y=i+o/2,v):(0>a&&(u<=-1*l||u>=l)&&(v.x=n-o*r/2/a,v.y=i-o/2),v)},bp=function(e,r){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],o=e.layoutNodes[i],s=e.idToIndex[n.targetId],u=e.layoutNodes[s],l=u.positionX-o.positionX,v=u.positionY-o.positionY;if(!(l===0&&v===0)){var f=Sn(o,l,v),c=Sn(u,-1*l,-1*v),d=c.x-f.x,h=c.y-f.y,g=Math.sqrt(d*d+h*h),p=Math.pow(n.idealLength-g,2)/n.elasticity;if(g!==0)var y=p*d/g,b=p*h/g;else var y=0,b=0;o.isLocked||(o.offsetX+=y,o.offsetY+=b),u.isLocked||(u.offsetX-=y,u.offsetY-=b)}}},wp=function(e,r){if(r.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],o=i.length;if(n===0)var s=e.clientHeight/2,u=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],v=e.layoutNodes[e.idToIndex[l.parentId]],s=v.positionX,u=v.positionY;for(var f=0;f<o;f++){var c=e.layoutNodes[e.idToIndex[i[f]]];if(!c.isLocked){var d=s-c.positionX,h=u-c.positionY,g=Math.sqrt(d*d+h*h);if(g>a){var p=r.gravity*d/g,y=r.gravity*h/g;c.offsetX+=p,c.offsetY+=y}}}}},xp=function(e,r){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var o=a[n++],s=e.idToIndex[o],u=e.layoutNodes[s],l=u.children;if(0<l.length&&!u.isLocked){for(var v=u.offsetX,f=u.offsetY,c=0;c<l.length;c++){var d=e.layoutNodes[e.idToIndex[l[c]]];d.offsetX+=v,d.offsetY+=f,a[++i]=l[c]}u.offsetX=0,u.offsetY=0}}},Ep=function(e,r){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=Cp(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,of(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},Cp=function(e,r,a){var n=Math.sqrt(e*e+r*r);if(n>a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},of=function(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return of(n,r)}},Cl=function(e,r){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var o=a[i],s=o.cmptId;(n[s]=n[s]||[]).push(o)}for(var u=0,i=0;i<n.length;i++){var l=n[i];if(l){l.x1=1/0,l.x2=-1/0,l.y1=1/0,l.y2=-1/0;for(var v=0;v<l.length;v++){var f=l[v];l.x1=Math.min(l.x1,f.positionX-f.width/2),l.x2=Math.max(l.x2,f.positionX+f.width/2),l.y1=Math.min(l.y1,f.positionY-f.height/2),l.y2=Math.max(l.y2,f.positionY+f.height/2)}l.w=l.x2-l.x1,l.h=l.y2-l.y1,u+=l.w*l.h}}n.sort(function(y,b){return b.w*b.h-y.w*y.h});for(var c=0,d=0,h=0,g=0,p=Math.sqrt(u)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var l=n[i];if(l){for(var v=0;v<l.length;v++){var f=l[v];f.isLocked||(f.positionX+=c-l.x1,f.positionY+=d-l.y1)}c+=l.w+r.componentSpacing,h+=l.w+r.componentSpacing,g=Math.max(g,l.h),h>p&&(d+=g+r.componentSpacing,c=0,h=0,g=0)}}},Tp={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function sf(t){this.options=ge({},Tp,t)}sf.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=mt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(Z){return{x:i.x1,y:i.y1}});else{var o=n.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),v=function(W){if(W==null)return Math.min(u,l);Math.min(u,l)==u?u=W:l=W},f=function(W){if(W==null)return Math.max(u,l);Math.max(u,l)==u?u=W:l=W},c=e.rows,d=e.cols!=null?e.cols:e.columns;if(c!=null&&d!=null)u=c,l=d;else if(c!=null&&d==null)u=c,l=Math.ceil(o/u);else if(c==null&&d!=null)l=d,u=Math.ceil(o/l);else if(l*u>o){var h=v(),g=f();(h-1)*g>=o?v(h-1):(g-1)*h>=o&&f(g-1)}else for(;l*u<o;){var p=v(),y=f();(y+1)*p>=o?f(y+1):v(p+1)}var b=i.w/l,m=i.h/u;if(e.condense&&(b=0,m=0),e.avoidOverlap)for(var w=0;w<n.length;w++){var T=n[w],C=T._private.position;(C.x==null||C.y==null)&&(C.x=0,C.y=0);var x=T.layoutDimensions(e),S=e.avoidOverlapPadding,D=x.w+S,E=x.h+S;b=Math.max(b,D),m=Math.max(m,E)}for(var B={},A=function(W,$){return!!B["c-"+W+"-"+$]},P=function(W,$){B["c-"+W+"-"+$]=!0},M=0,R=0,L=function(){R++,R>=l&&(R=0,M++)},I={},F=0;F<n.length;F++){var _=n[F],N=e.position(_);if(N&&(N.row!==void 0||N.col!==void 0)){var G={row:N.row,col:N.col};if(G.col===void 0)for(G.col=0;A(G.row,G.col);)G.col++;else if(G.row===void 0)for(G.row=0;A(G.row,G.col);)G.row++;I[_.id()]=G,P(G.row,G.col)}}n.layoutPositions(this,e,function(W,$){var Y,te;if(W.locked()||W.isParent())return!1;var J=I[W.id()];if(J)Y=J.col*b+b/2+i.x1,te=J.row*m+m/2+i.y1;else{for(;A(M,R);)L();Y=R*b+b/2+i.x1,te=M*m+m/2+i.y1,P(M,R),L()}return{x:Y,y:te}})}return this};var Sp={ready:function(){},stop:function(){}};function fs(t){this.options=ge({},Sp,t)}fs.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this};fs.prototype.stop=function(){return this};var Dp={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function uf(t){this.options=ge({},Dp,t)}uf.prototype.run=function(){var t=this.options,e=t.eles.nodes(),r=We(t.positions);function a(n){if(t.positions==null)return fh(n.position());if(r)return t.positions(n);var i=t.positions[n._private.data.id];return i??null}return e.layoutPositions(this,t,function(n,i){var o=a(n);return n.locked()||o==null?!1:o}),this};var kp={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function lf(t){this.options=ge({},kp,t)}lf.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=mt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()});return r.nodes().layoutPositions(this,t,function(i,o){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}}),this};var Bp=[{name:"breadthfirst",impl:ef},{name:"circle",impl:tf},{name:"concentric",impl:rf},{name:"cose",impl:$n},{name:"grid",impl:sf},{name:"null",impl:fs},{name:"preset",impl:uf},{name:"random",impl:lf}];function vf(t){this.options=t,this.notifications=0}var Tl=function(){},Sl=function(){throw new Error("A headless instance can not render images")};vf.prototype={recalculateRenderedStyle:Tl,notify:function(){this.notifications++},init:Tl,isHeadless:function(){return!0},png:Sl,jpg:Sl};var cs={};cs.arrowShapeWidth=.3;cs.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(l,v,f,c,d,h,g){var p=d.x-f/2-g,y=d.x+f/2+g,b=d.y-f/2-g,m=d.y+f/2+g;return p<=l&&l<=y&&b<=v&&v<=m},a=function(l,v,f,c,d){var h=l*Math.cos(c)-v*Math.sin(c),g=l*Math.sin(c)+v*Math.cos(c),p=h*f,y=g*f;return{x:p+d.x,y:y+d.y}},n=function(l,v,f,c){for(var d=[],h=0;h<l.length;h+=2){var g=l[h],p=l[h+1];d.push(a(g,p,v,f,c))}return d},i=function(l){for(var v=[],f=0;f<l.length;f++){var c=l[f];v.push(c.x,c.y)}return v},o=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},s=function(l,v){he(v)&&(v=t[v]),t[l]=ge({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,d,h,g,p,y){return Et(c,d,i(n(this.points,h+2*y,g,p)))},roughCollide:r,draw:function(c,d,h,g){var p=n(this.points,d,h,g);e.arrowShapeImpl("polygon")(c,p)},spacing:function(c){return 0},gap:o},v)};s("none",{collide:yn,roughCollide:yn,draw:Qo,spacing:Vs,gap:Vs}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(l,v,f,c,d){var h=n(this.points,v,f,c),g=this.controlPoint,p=a(g[0],g[1],v,f,c);e.arrowShapeImpl(this.name)(l,h,p)},gap:function(l){return o(l)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,v,f,c,d,h,g){var p=i(n(this.points,f+2*g,c,d)),y=i(n(this.pointsTee,f+2*g,c,d));return Et(l,v,p)||Et(l,v,y)},draw:function(l,v,f,c,d){var h=n(this.points,v,f,c),g=n(this.pointsTee,v,f,c);e.arrowShapeImpl(this.name)(l,h,g)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,v,f,c,d,h,g){var p=d,y=Math.pow(p.x-l,2)+Math.pow(p.y-v,2)<=Math.pow((f+2*g)*this.radius,2);return Et(l,v,i(n(this.points,f+2*g,c,d)))||y},draw:function(l,v,f,c,d){var h=n(this.pointsTr,v,f,c);e.arrowShapeImpl(this.name)(l,h,c.x,c.y,this.radius*v)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,v){var f=this.baseCrossLinePts.slice(),c=v/l,d=3,h=5;return f[d]=f[d]-c,f[h]=f[h]-c,f},collide:function(l,v,f,c,d,h,g){var p=i(n(this.points,f+2*g,c,d)),y=i(n(this.crossLinePts(f,h),f+2*g,c,d));return Et(l,v,p)||Et(l,v,y)},draw:function(l,v,f,c,d){var h=n(this.points,v,f,c),g=n(this.crossLinePts(v,d),v,f,c);e.arrowShapeImpl(this.name)(l,h,g)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return o(l)*.525}}),s("circle",{radius:.15,collide:function(l,v,f,c,d,h,g){var p=d;return Math.pow(p.x-l,2)+Math.pow(p.y-v,2)<=Math.pow((f+2*g)*this.radius,2)},draw:function(l,v,f,c,d){e.arrowShapeImpl(this.name)(l,c.x,c.y,this.radius*v)},spacing:function(l){return e.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var Br={};Br.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],o=a[4],s=r.pan(),u=r.zoom();return[((t-n)/o-s.x)/u,((e-i)/o-s.y)/u]};Br.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),a=function(y){return parseFloat(r.getPropertyValue(y))},n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},o=t.clientWidth,s=t.clientHeight,u=n.left+n.right,l=n.top+n.bottom,v=i.left+i.right,f=e.width/(o+v),c=o-u,d=s-l,h=e.left+n.left+i.left,g=e.top+n.top+i.top;return this.containerBB=[h,g,c,d,f]};Br.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Br.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]};Br.findNearestElements=function(t,e,r,a){var n=this,i=this,o=i.getCachedZSortedEles(),s=[],u=i.cy.zoom(),l=i.cy.hasCompoundNodes(),v=(a?24:8)/u,f=(a?8:2)/u,c=(a?8:2)/u,d=1/0,h,g;r&&(o=o.interactive);function p(x,S){if(x.isNode()){if(g)return;g=x,s.push(x)}if(x.isEdge()&&(S==null||S<d))if(h){if(h.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value&&h.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value){for(var D=0;D<s.length;D++)if(s[D].isEdge()){s[D]=x,h=x,d=S??d;break}}}else s.push(x),h=x,d=S??d}function y(x){var S=x.outerWidth()+2*f,D=x.outerHeight()+2*f,E=S/2,B=D/2,A=x.position(),P=x.pstyle("corner-radius").value==="auto"?"auto":x.pstyle("corner-radius").pfValue,M=x._private.rscratch;if(A.x-E<=t&&t<=A.x+E&&A.y-B<=e&&e<=A.y+B&&i.nodeShapes[n.getNodeShape(x)].checkPoint(t,e,0,S,D,A.x,A.y,P,M))return p(x,0),!0}function b(x){var S=x._private,D=S.rscratch,E=x.pstyle("width").pfValue,B=x.pstyle("arrow-scale").value,A=E/2+v,P=A*A,M=A*2,F=S.source,_=S.target,R;if(D.edgeType==="segments"||D.edgeType==="straight"||D.edgeType==="haystack"){for(var L=D.allpts,I=0;I+3<L.length;I+=2)if(Sh(t,e,L[I],L[I+1],L[I+2],L[I+3],M)&&P>(R=Ah(t,e,L[I],L[I+1],L[I+2],L[I+3])))return p(x,R),!0}else if(D.edgeType==="bezier"||D.edgeType==="multibezier"||D.edgeType==="self"||D.edgeType==="compound"){for(var L=D.allpts,I=0;I+5<D.allpts.length;I+=4)if(Dh(t,e,L[I],L[I+1],L[I+2],L[I+3],L[I+4],L[I+5],M)&&P>(R=Ph(t,e,L[I],L[I+1],L[I+2],L[I+3],L[I+4],L[I+5])))return p(x,R),!0}for(var F=F||S.source,_=_||S.target,N=n.getArrowWidth(E,B),G=[{name:"source",x:D.arrowStartX,y:D.arrowStartY,angle:D.srcArrowAngle},{name:"target",x:D.arrowEndX,y:D.arrowEndY,angle:D.tgtArrowAngle},{name:"mid-source",x:D.midX,y:D.midY,angle:D.midsrcArrowAngle},{name:"mid-target",x:D.midX,y:D.midY,angle:D.midtgtArrowAngle}],I=0;I<G.length;I++){var Z=G[I],W=i.arrowShapes[x.pstyle(Z.name+"-arrow-shape").value],$=x.pstyle("width").pfValue;if(W.roughCollide(t,e,N,Z.angle,{x:Z.x,y:Z.y},$,v)&&W.collide(t,e,N,Z.angle,{x:Z.x,y:Z.y},$,v))return p(x),!0}l&&s.length>0&&(y(F),y(_))}function m(x,S,D){return yt(x,S,D)}function w(x,S){var D=x._private,E=c,B;S?B=S+"-":B="",x.boundingBox();var A=D.labelBounds[S||"main"],P=x.pstyle(B+"label").value;if(!(x.pstyle("text-events").strValue!=="yes"||!P)){var M=m(D.rscratch,"labelX",S),R=m(D.rscratch,"labelY",S),L=m(D.rscratch,"labelAngle",S),I=x.pstyle(B+"text-margin-x").pfValue,F=x.pstyle(B+"text-margin-y").pfValue,_=A.x1-E-I,N=A.x2+E-I,G=A.y1-E-F,Z=A.y2+E-F;if(L){var W=Math.cos(L),$=Math.sin(L),Y=function(q,j){return q=q-M,j=j-R,{x:q*W-j*$+M,y:q*$+j*W+R}},te=Y(_,G),J=Y(_,Z),X=Y(N,G),O=Y(N,Z);if(Et(t,e,[te.x+I,te.y+F,X.x+I,X.y+F,O.x+I,O.y+F,J.x+I,J.y+F]))return p(x),!0}else if(jt(A,t,e))return p(x),!0}}for(var T=o.length-1;T>=0;T--){var C=o[T];C.isNode()?y(C)||w(C):b(C)||w(C)||w(C,"source")||w(C,"target")}return s};Br.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=2/this.cy.zoom(),o=[],s=Math.min(t,r),u=Math.max(t,r),l=Math.min(e,a),v=Math.max(e,a);t=s,r=u,e=l,a=v;var f=mt({x1:t,y1:e,x2:r,y2:a}),c=[{x:f.x1,y:f.y1},{x:f.x2,y:f.y1},{x:f.x2,y:f.y2},{x:f.x1,y:f.y2}],d=[[c[0],c[1]],[c[1],c[2]],[c[2],c[3]],[c[3],c[0]]];function h(q,j,ue){return yt(q,j,ue)}function g(q,j){var ue=q._private,we=i,be="";q.boundingBox();var ke=ue.labelBounds.main;if(!ke)return null;var le=h(ue.rscratch,"labelX",j),ae=h(ue.rscratch,"labelY",j),fe=h(ue.rscratch,"labelAngle",j),pe=q.pstyle(be+"text-margin-x").pfValue,me=q.pstyle(be+"text-margin-y").pfValue,ce=ke.x1-we-pe,Ce=ke.x2+we-pe,Be=ke.y1-we-me,Pe=ke.y2+we-me;if(fe){var Ne=Math.cos(fe),Ee=Math.sin(fe),ie=function(U,k){return U=U-le,k=k-ae,{x:U*Ne-k*Ee+le,y:U*Ee+k*Ne+ae}};return[ie(ce,Be),ie(Ce,Be),ie(Ce,Pe),ie(ce,Pe)]}else return[{x:ce,y:Be},{x:Ce,y:Be},{x:Ce,y:Pe},{x:ce,y:Pe}]}function p(q,j,ue,we){function be(ke,le,ae){return(ae.y-ke.y)*(le.x-ke.x)>(le.y-ke.y)*(ae.x-ke.x)}return be(q,ue,we)!==be(j,ue,we)&&be(q,j,ue)!==be(q,j,we)}for(var y=0;y<n.length;y++){var b=n[y];if(b.isNode()){var m=b,w=m.pstyle("text-events").strValue==="yes",T=m.pstyle("box-selection").strValue,C=m.pstyle("box-select-labels").strValue==="yes";if(T==="none")continue;var x=(T==="overlap"||C)&&w,S=m.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:x});if(T==="contain"){var D=!1;if(C&&w){var E=g(m);E&&di(E,c)&&(o.push(m),D=!0)}!D&&pv(f,S)&&o.push(m)}else if(T==="overlap"&&ts(f,S)){var B=m.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if(di([{x:B.x1,y:B.y1},{x:B.x2,y:B.y1},{x:B.x2,y:B.y2},{x:B.x1,y:B.y2}],c))o.push(m);else{var A=g(m);A&&di(A,c)&&o.push(m)}}}else{var P=b,M=P._private,R=M.rscratch,L=P.pstyle("box-selection").strValue;if(L==="none")continue;if(L==="contain"){if(R.startX!=null&&R.startY!=null&&!jt(f,R.startX,R.startY)||R.endX!=null&&R.endY!=null&&!jt(f,R.endX,R.endY))continue;if(R.edgeType==="bezier"||R.edgeType==="multibezier"||R.edgeType==="self"||R.edgeType==="compound"||R.edgeType==="segments"||R.edgeType==="haystack"){for(var I=M.rstyle.bezierPts||M.rstyle.linePts||M.rstyle.haystackPts,F=!0,_=0;_<I.length;_++)if(!$s(f,I[_])){F=!1;break}F&&o.push(P)}else R.edgeType==="straight"&&o.push(P)}else if(L==="overlap"){var N=!1;if(R.startX!=null&&R.startY!=null&&R.endX!=null&&R.endY!=null&&(jt(f,R.startX,R.startY)||jt(f,R.endX,R.endY)))o.push(P),N=!0;else if(!N&&R.edgeType==="haystack"){for(var G=M.rstyle.haystackPts,Z=0;Z<G.length;Z++)if($s(f,G[Z])){o.push(P),N=!0;break}}if(!N){var W=M.rstyle.bezierPts||M.rstyle.linePts||M.rstyle.haystackPts;if((!W||W.length<2)&&R.edgeType==="straight"&&R.startX!=null&&R.startY!=null&&R.endX!=null&&R.endY!=null&&(W=[{x:R.startX,y:R.startY},{x:R.endX,y:R.endY}]),!W||W.length<2)continue;for(var $=0;$<W.length-1;$++){for(var Y=W[$],te=W[$+1],J=0;J<d.length;J++){var X=Xe(d[J],2),O=X[0],V=X[1];if(p(Y,te,O,V)){o.push(P),N=!0;break}}if(N)break}}}}}return o};var Dn={};Dn.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",s=e.edgeType==="self",u,l,v,f,c,d,y,b;if(r?(v=e.haystackPts[0],f=e.haystackPts[1],c=e.haystackPts[2],d=e.haystackPts[3]):(v=e.arrowStartX,f=e.arrowStartY,c=e.arrowEndX,d=e.arrowEndY),y=e.midX,b=e.midY,i)u=v-e.segpts[0],l=f-e.segpts[1];else if(n||o||s||a){var h=e.allpts,g=rt(h[0],h[2],h[4],.1),p=rt(h[1],h[3],h[5],.1);u=v-g,l=f-p}else u=v-y,l=f-b;e.srcArrowAngle=$a(u,l);var y=e.midX,b=e.midY;if(r&&(y=(v+c)/2,b=(f+d)/2),u=c-v,l=d-f,i){var h=e.allpts;if(h.length/2%2===0){var m=h.length/2,w=m-2;u=h[m]-h[w],l=h[m+1]-h[w+1]}else if(e.isRound)u=e.midVector[1],l=-e.midVector[0];else{var m=h.length/2-1,w=m-2;u=h[m]-h[w],l=h[m+1]-h[w+1]}}else if(n||o||s){var h=e.allpts,T=e.ctrlpts,C,x,S,D;if(T.length/2%2===0){var E=h.length/2-1,B=E+2,A=B+2;C=rt(h[E],h[B],h[A],0),x=rt(h[E+1],h[B+1],h[A+1],0),S=rt(h[E],h[B],h[A],1e-4),D=rt(h[E+1],h[B+1],h[A+1],1e-4)}else{var B=h.length/2-1,E=B-2,A=B+2;C=rt(h[E],h[B],h[A],.4999),x=rt(h[E+1],h[B+1],h[A+1],.4999),S=rt(h[E],h[B],h[A],.5),D=rt(h[E+1],h[B+1],h[A+1],.5)}u=S-C,l=D-x}if(e.midtgtArrowAngle=$a(u,l),e.midDispX=u,e.midDispY=l,u*=-1,l*=-1,i){var h=e.allpts;if(h.length/2%2!==0){if(!e.isRound){var m=h.length/2-1,P=m+2;u=-(h[P]-h[m]),l=-(h[P+1]-h[m+1])}}}if(e.midsrcArrowAngle=$a(u,l),i)u=c-e.segpts[e.segpts.length-2],l=d-e.segpts[e.segpts.length-1];else if(n||o||s||a){var h=e.allpts,M=h.length,g=rt(h[M-6],h[M-4],h[M-2],.9),p=rt(h[M-5],h[M-3],h[M-1],.9);u=c-g,l=d-p}else u=c-y,l=d-b;e.tgtArrowAngle=$a(u,l)};Dn.getArrowWidth=Dn.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var zo,Fo,Nt={},Dt={},Dl,kl,wr,fn,Gt,gr,mr,It,Or,ja,ff,cf,Vo,qo,Bl,Pl=function(e,r,a){a.x=r.x-e.x,a.y=r.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},Pp=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},Ap=function(e,r,a,n,i){if(e!==Bl?Pl(r,e,Nt):Pp(Dt,Nt),Pl(r,a,Dt),Dl=Nt.nx*Dt.ny-Nt.ny*Dt.nx,kl=Nt.nx*Dt.nx-Nt.ny*-Dt.ny,Gt=Math.asin(Math.max(-1,Math.min(1,Dl))),Math.abs(Gt)<1e-6){zo=r.x,Fo=r.y,mr=Or=0;return}wr=1,fn=!1,kl<0?Gt<0?Gt=Math.PI+Gt:(Gt=Math.PI-Gt,wr=-1,fn=!0):Gt>0&&(wr=-1,fn=!0),r.radius!==void 0?Or=r.radius:Or=n,gr=Gt/2,ja=Math.min(Nt.len/2,Dt.len/2),i?(It=Math.abs(Math.cos(gr)*Or/Math.sin(gr)),It>ja?(It=ja,mr=Math.abs(It*Math.sin(gr)/Math.cos(gr))):mr=Or):(It=Math.min(ja,Or),mr=Math.abs(It*Math.sin(gr)/Math.cos(gr))),Vo=r.x+Dt.nx*It,qo=r.y+Dt.ny*It,zo=Vo-Dt.ny*mr*wr,Fo=qo+Dt.nx*mr*wr,ff=r.x+Nt.nx*It,cf=r.y+Nt.ny*It,Bl=r};function hf(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function hs(t,e,r,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(Ap(t,e,r,a,n),{cx:zo,cy:Fo,radius:mr,startX:ff,startY:cf,stopX:Vo,stopY:qo,startAngle:Nt.ang+Math.PI/2*wr,endAngle:Dt.ang-Math.PI/2*wr,counterClockwise:fn})}var ka=.01,Rp=Math.sqrt(2*ka),gt={};gt.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,o=t.pstyle("source-endpoint"),s=t.pstyle("target-endpoint"),u=o.units!=null&&s.units!=null,l=function(b,m,w,T){var C=T-m,x=w-b,S=Math.sqrt(x*x+C*C);return{x:-C/S,y:x/S}};switch(t.pstyle("edge-distances").value){case"node-position":i=r;break;case"intersection":i=a;break;case"endpoints":if(u){var v=Xe(this.manualEndptToPx(t.source()[0],o),2),f=v[0],c=v[1],d=Xe(this.manualEndptToPx(t.target()[0],s),2),h=d[0],g=d[1],p={x1:f,y1:c,x2:h,y2:g};n=l(f,c,h,g),i=p}else Ie("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}return{midptPts:i,vectorNormInverse:n}};gt.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var o=a.source,s=a.target,u=o.position(),l=s.position(),v=o.width(),f=s.width(),c=o.height(),d=s.height(),h=r.pstyle("haystack-radius").value/2;n.haystackPts=n.allpts=[n.source.x*v*h+u.x,n.source.y*c*h+u.y,n.target.x*f*h+l.x,n.target.y*d*h+l.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}};gt.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),n=t.pstyle("segment-distances"),i=t.pstyle("segment-radii"),o=t.pstyle("radius-type"),s=Math.min(a.pfValue.length,n.pfValue.length),u=i.pfValue[i.pfValue.length-1],l=o.pfValue[o.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var v=0;v<s;v++){var f=a.pfValue[v],c=n.pfValue[v],d=1-f,h=f,g=this.findMidptPtsEtc(t,e),p=g.midptPts,y=g.vectorNormInverse,b={x:p.x1*d+p.x2*h,y:p.y1*d+p.y2*h};r.segpts.push(b.x+y.x*c,b.y+y.y*c),r.radii.push(i.pfValue[v]!==void 0?i.pfValue[v]:u),r.isArcRadius.push((o.pfValue[v]!==void 0?o.pfValue[v]:l)==="arc-radius")}};gt.findLoopPoints=function(t,e,r,a){var n=t._private.rscratch,i=e.dirCounts,o=e.srcPos,s=t.pstyle("control-point-distances"),u=s?s.pfValue[0]:void 0,l=t.pstyle("loop-direction").pfValue,v=t.pstyle("loop-sweep").pfValue,f=t.pstyle("control-point-step-size").pfValue;n.edgeType="self";var c=r,d=f;a&&(c=0,d=u);var h=l-Math.PI/2,g=h-v/2,p=h+v/2,y=l+"_"+v;c=i[y]===void 0?i[y]=0:++i[y],n.ctrlpts=[o.x+Math.cos(g)*1.4*d*(c/3+1),o.y+Math.sin(g)*1.4*d*(c/3+1),o.x+Math.cos(p)*1.4*d*(c/3+1),o.y+Math.sin(p)*1.4*d*(c/3+1)]};gt.findCompoundLoopPoints=function(t,e,r,a){var n=t._private.rscratch;n.edgeType="compound";var i=e.srcPos,o=e.tgtPos,s=e.srcW,u=e.srcH,l=e.tgtW,v=e.tgtH,f=t.pstyle("control-point-step-size").pfValue,c=t.pstyle("control-point-distances"),d=c?c.pfValue[0]:void 0,h=r,g=f;a&&(h=0,g=d);var p=50,y={x:i.x-s/2,y:i.y-u/2},b={x:o.x-l/2,y:o.y-v/2},m={x:Math.min(y.x,b.x),y:Math.min(y.y,b.y)},w=.5,T=Math.max(w,Math.log(s*ka)),C=Math.max(w,Math.log(l*ka));n.ctrlpts=[m.x,m.y-(1+Math.pow(p,1.12)/100)*g*(h/3+1)*T,m.x-(1+Math.pow(p,1.12)/100)*g*(h/3+1)*C,m.y]};gt.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};gt.findBezierPoints=function(t,e,r,a,n){var i=t._private.rscratch,o=t.pstyle("control-point-step-size").pfValue,s=t.pstyle("control-point-distances"),u=t.pstyle("control-point-weights"),l=s&&u?Math.min(s.value.length,u.value.length):1,v=s?s.pfValue[0]:void 0,f=u.value[0],c=a;i.edgeType=c?"multibezier":"bezier",i.ctrlpts=[];for(var d=0;d<l;d++){var h=(.5-e.eles.length/2+r)*o*(n?-1:1),g=void 0,p=es(h);c&&(v=s?s.pfValue[d]:o,f=u.value[d]),a?g=v:g=v!==void 0?p*v:void 0;var y=g!==void 0?g:h,b=1-f,m=f,w=this.findMidptPtsEtc(t,e),T=w.midptPts,C=w.vectorNormInverse,x={x:T.x1*b+T.x2*m,y:T.y1*b+T.y2*m};i.ctrlpts.push(x.x+C.x*y,x.y+C.y*y)}};gt.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",n="horizontal",i="leftward",o="rightward",s="downward",u="upward",l="auto",v=e.posPts,f=e.srcW,c=e.srcH,d=e.tgtW,h=e.tgtH,g=t.pstyle("edge-distances").value!=="node-position",p=t.pstyle("taxi-direction").value,y=p,b=t.pstyle("taxi-turn"),m=b.units==="%",w=b.pfValue,T=w<0,C=t.pstyle("taxi-turn-min-distance").pfValue,x=g?(f+d)/2:0,S=g?(c+h)/2:0,D=v.x2-v.x1,E=v.y2-v.y1,B=function(le,ae){return le>0?Math.max(le-ae,0):Math.min(le+ae,0)},A=B(D,x),P=B(E,S),M=!1;y===l?p=Math.abs(A)>Math.abs(P)?n:a:y===u||y===s?(p=a,M=!0):(y===i||y===o)&&(p=n,M=!0);var R=p===a,L=R?P:A,I=R?E:D,F=es(I),_=!1;!(M&&(m||T))&&(y===s&&I<0||y===u&&I>0||y===i&&I>0||y===o&&I<0)&&(F*=-1,L=F*Math.abs(L),_=!0);var N;m?N=(w<0?1+w:w)*L:N=(w<0?L:0)+w*F;var G=function(le){return Math.abs(le)<C||Math.abs(le)>=Math.abs(L)},Z=G(N),W=G(Math.abs(L)-Math.abs(N));if((Z||W)&&!_)if(R){var $=Math.abs(I)<=c/2,Y=Math.abs(D)<=d/2;if($){var te=(v.x1+v.x2)/2;r.segpts=[te,v.y1,te,v.y2]}else if(Y){var J=(v.y1+v.y2)/2;r.segpts=[v.x1,J,v.x2,J]}else r.segpts=[v.x1,v.y2]}else{var X=Math.abs(I)<=f/2,O=Math.abs(E)<=h/2;if(X){var V=(v.y1+v.y2)/2;r.segpts=[v.x1,V,v.x2,V]}else if(O){var q=(v.x1+v.x2)/2;r.segpts=[q,v.y1,q,v.y2]}else r.segpts=[v.x2,v.y1]}else if(R){var j=v.y1+N+(g?c/2*F:0);r.segpts=[v.x1,j,v.x2,j]}else{var ue=v.x1+N+(g?f/2*F:0);r.segpts=[ue,v.y1,ue,v.y2]}if(r.isRound){var we=t.pstyle("taxi-radius").value,be=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(we),r.isArcRadius=new Array(r.segpts.length/2).fill(be)}};gt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,u=e.tgtH,l=e.srcShape,v=e.tgtShape,f=e.srcCornerRadius,c=e.tgtCornerRadius,d=e.srcRs,h=e.tgtRs,g=!re(r.startX)||!re(r.startY),p=!re(r.arrowStartX)||!re(r.arrowStartY),y=!re(r.endX)||!re(r.endY),b=!re(r.arrowEndX)||!re(r.arrowEndY),m=3*(this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=Cr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),T=w<m,C=Cr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),x=C<m,S=!1;if(g||p||T){S=!0;var D={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},E=Math.sqrt(D.x*D.x+D.y*D.y),B={x:D.x/E,y:D.y/E},A=Math.max(i,o),P={x:r.ctrlpts[0]+B.x*2*A,y:r.ctrlpts[1]+B.y*2*A},M=l.intersectLine(a.x,a.y,i,o,P.x,P.y,0,f,d);T?(r.ctrlpts[0]=r.ctrlpts[0]+B.x*(m-w),r.ctrlpts[1]=r.ctrlpts[1]+B.y*(m-w)):(r.ctrlpts[0]=M[0]+B.x*m,r.ctrlpts[1]=M[1]+B.y*m)}if(y||b||x){S=!0;var R={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},L=Math.sqrt(R.x*R.x+R.y*R.y),I={x:R.x/L,y:R.y/L},F=Math.max(i,o),_={x:r.ctrlpts[0]+I.x*2*F,y:r.ctrlpts[1]+I.y*2*F},N=v.intersectLine(n.x,n.y,s,u,_.x,_.y,0,c,h);x?(r.ctrlpts[0]=r.ctrlpts[0]+I.x*(m-C),r.ctrlpts[1]=r.ctrlpts[1]+I.y*(m-C)):(r.ctrlpts[0]=N[0]+I.x*m,r.ctrlpts[1]=N[1]+I.y*m)}S&&this.findEndpoints(t)}};gt.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=rt(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=rt(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],s=e.isArcRadius[i/2-1];e.roundCorners.push(hs({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,s))}}if(e.segpts.length%4===0){var u=e.segpts.length/2,l=u-2;e.midX=(e.segpts[l]+e.segpts[u])/2,e.midY=(e.segpts[l+1]+e.segpts[u+1])/2}else{var v=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[v],e.midY=e.segpts[v+1];else{var f={x:e.segpts[v],y:e.segpts[v+1]},c=e.roundCorners[v/2];if(c.radius===0){var d={x:e.segpts[v+2],y:e.segpts[v+3]};e.midX=f.x,e.midY=f.y,e.midVector=[f.y-d.y,d.x-f.x]}else{var h=[f.x-c.cx,f.y-c.cy],g=c.radius/Math.sqrt(Math.pow(h[0],2)+Math.pow(h[1],2));h=h.map(function(p){return p*g}),e.midX=c.cx+h[0],e.midY=c.cy+h[1],e.midVector=h}}}}};gt.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||re(e.startX)&&re(e.startY)&&re(e.endX)&&re(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Ie("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};gt.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy.hasCompoundNodes(),n=new Ht,i=function(C,x){return[].concat(dn(C),[x?1:0]).join("-")},o=[],s=[],u=0;u<t.length;u++){var l=t[u],v=l._private,f=l.pstyle("curve-style").value;if(!(l.removed()||!l.takesUpSpace())){if(f==="haystack"){s.push(l);continue}var c=f==="unbundled-bezier"||Jt(f,"segments")||f==="straight"||f==="straight-triangle"||Jt(f,"taxi"),d=f==="unbundled-bezier"||f==="bezier",h=v.source,g=v.target,p=[h.poolIndex(),g.poolIndex()].sort(),y=i(p,c),b=n.get(y);b==null&&(b={eles:[]},o.push({pairId:p,edgeIsUnbundled:c}),n.set(y,b)),b.eles.push(l),c&&(b.hasUnbundled=!0),d&&(b.hasBezier=!0)}}for(var m=function(){var C=o[w],x=C.pairId,S=C.edgeIsUnbundled,D=i(x,S),E=n.get(D),B;if(!E.hasUnbundled){var A=E.eles[0].parallelEdges().filter(function(ie){return ie.isBundledBezier()});Jo(E.eles),A.forEach(function(ie){return E.eles.push(ie)}),E.eles.sort(function(ie,xe){return ie.poolIndex()-xe.poolIndex()})}var P=E.eles[0],M=P.source(),R=P.target();if(M.poolIndex()>R.poolIndex()){var L=M;M=R,R=L}var I=E.srcPos=M.position(),F=E.tgtPos=R.position(),_=E.srcW=M.outerWidth(),N=E.srcH=M.outerHeight(),G=E.tgtW=R.outerWidth(),Z=E.tgtH=R.outerHeight(),W=E.srcShape=r.nodeShapes[e.getNodeShape(M)],$=E.tgtShape=r.nodeShapes[e.getNodeShape(R)],Y=E.srcCornerRadius=M.pstyle("corner-radius").value==="auto"?"auto":M.pstyle("corner-radius").pfValue,te=E.tgtCornerRadius=R.pstyle("corner-radius").value==="auto"?"auto":R.pstyle("corner-radius").pfValue,J=E.tgtRs=R._private.rscratch,X=E.srcRs=M._private.rscratch;E.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var O=0;O<E.eles.length;O++){var V=E.eles[O],q=V[0]._private.rscratch,j=V.pstyle("curve-style").value,ue=j==="unbundled-bezier"||Jt(j,"segments")||Jt(j,"taxi"),we=!M.same(V.source());if(!E.calculatedIntersection&&M!==R&&(E.hasBezier||E.hasUnbundled)){E.calculatedIntersection=!0;var be=W.intersectLine(I.x,I.y,_,N,F.x,F.y,0,Y,X),ke=E.srcIntn=be,le=$.intersectLine(F.x,F.y,G,Z,I.x,I.y,0,te,J),ae=E.tgtIntn=le,fe=E.intersectionPts={x1:be[0],x2:le[0],y1:be[1],y2:le[1]},pe=E.posPts={x1:I.x,x2:F.x,y1:I.y,y2:F.y},me=le[1]-be[1],ce=le[0]-be[0],Ce=Math.sqrt(ce*ce+me*me);re(Ce)&&Ce>=Rp||(Ce=Math.sqrt(Math.max(ce*ce,ka)+Math.max(me*me,ka)));var Be=E.vector={x:ce,y:me},Pe=E.vectorNorm={x:Be.x/Ce,y:Be.y/Ce},Ne={x:-Pe.y,y:Pe.x};E.nodesOverlap=!re(Ce)||$.checkPoint(be[0],be[1],0,G,Z,F.x,F.y,te,J)||W.checkPoint(le[0],le[1],0,_,N,I.x,I.y,Y,X),E.vectorNormInverse=Ne,B={nodesOverlap:E.nodesOverlap,dirCounts:E.dirCounts,calculatedIntersection:!0,hasBezier:E.hasBezier,hasUnbundled:E.hasUnbundled,eles:E.eles,srcPos:F,srcRs:J,tgtPos:I,tgtRs:X,srcW:G,srcH:Z,tgtW:_,tgtH:N,srcIntn:ae,tgtIntn:ke,srcShape:$,tgtShape:W,posPts:{x1:pe.x2,y1:pe.y2,x2:pe.x1,y2:pe.y1},intersectionPts:{x1:fe.x2,y1:fe.y2,x2:fe.x1,y2:fe.y1},vector:{x:-Be.x,y:-Be.y},vectorNorm:{x:-Pe.x,y:-Pe.y},vectorNormInverse:{x:-Ne.x,y:-Ne.y}}}var Ee=we?B:E;q.nodesOverlap=Ee.nodesOverlap,q.srcIntn=Ee.srcIntn,q.tgtIntn=Ee.tgtIntn,q.isRound=j.startsWith("round"),a&&(M.isParent()||M.isChild()||R.isParent()||R.isChild())&&(M.parents().anySame(R)||R.parents().anySame(M)||M.same(R)&&M.isParent())?e.findCompoundLoopPoints(V,Ee,O,ue):M===R?e.findLoopPoints(V,Ee,O,ue):j.endsWith("segments")?e.findSegmentsPoints(V,Ee):j.endsWith("taxi")?e.findTaxiPoints(V,Ee):j==="straight"||!ue&&E.eles.length%2===1&&O===Math.floor(E.eles.length/2)?e.findStraightEdgePoints(V):e.findBezierPoints(V,Ee,O,ue,we),e.findEndpoints(V),e.tryToCorrectInvalidPoints(V,Ee),e.checkForInvalidEdgeWarning(V),e.storeAllpts(V),e.storeEdgeProjections(V),e.calculateArrowAngles(V),e.recalculateEdgeLabelProjections(V),e.calculateLabelAngles(V)}},w=0;w<o.length;w++)m();this.findHaystackPoints(s)}};function df(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],n=t[r+1];e.push({x:a,y:n})}return e}}gt.getSegmentPoints=function(t){var e=t[0]._private.rscratch;if(this.recalculateRenderedStyle(t),e.edgeType==="segments")return df(e.segpts)};gt.getControlPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return df(e.ctrlpts)};gt.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var za={};za.manualEndptToPx=function(t,e){var r=this,a=t.position(),n=t.outerWidth(),i=t.outerHeight(),o=t._private.rscratch;if(e.value.length===2){var s=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(s[0]=s[0]*n),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=a.x,s[1]+=a.y,s}else{var u=e.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(n,i),v=[a.x+Math.cos(u)*l,a.y+Math.sin(u)*l];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,n,i,v[0],v[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,o)}};za.findEndpoints=function(t){var e,r,a,n,i=this,o,s=t.source()[0],u=t.target()[0],l=s.position(),v=u.position(),f=t.pstyle("target-arrow-shape").value,c=t.pstyle("source-arrow-shape").value,d=t.pstyle("target-distance-from-node").pfValue,h=t.pstyle("source-distance-from-node").pfValue,g=s._private.rscratch,p=u._private.rscratch,y=t.pstyle("curve-style").value,b=t._private.rscratch,m=b.edgeType,w=Jt(y,"taxi"),T=m==="self"||m==="compound",C=m==="bezier"||m==="multibezier"||T,x=m!=="bezier",S=m==="straight"||m==="segments",D=m==="segments",E=C||x||S,B=T||w,A=t.pstyle("source-endpoint"),P=B?"outside-to-node":A.value,M=s.pstyle("corner-radius").value==="auto"?"auto":s.pstyle("corner-radius").pfValue,R=t.pstyle("target-endpoint"),L=B?"outside-to-node":R.value,I=u.pstyle("corner-radius").value==="auto"?"auto":u.pstyle("corner-radius").pfValue;b.srcManEndpt=A,b.tgtManEndpt=R;var F,_,N,G,Z=(e=(R==null||(r=R.pfValue)===null||r===void 0?void 0:r.length)===2?R.pfValue:null)!==null&&e!==void 0?e:[0,0],W=(a=(A==null||(n=A.pfValue)===null||n===void 0?void 0:n.length)===2?A.pfValue:null)!==null&&a!==void 0?a:[0,0];if(C){var $=[b.ctrlpts[0],b.ctrlpts[1]];F=x?[b.ctrlpts[b.ctrlpts.length-2],b.ctrlpts[b.ctrlpts.length-1]]:$,_=$}else if(S){var Y=D?b.segpts.slice(0,2):[v.x+Z[0],v.y+Z[1]];F=D?b.segpts.slice(b.segpts.length-2):[l.x+W[0],l.y+W[1]],_=Y}if(L==="inside-to-node")o=[v.x,v.y];else if(R.units)o=this.manualEndptToPx(u,R);else if(L==="outside-to-line")o=b.tgtIntn;else if(L==="outside-to-node"||L==="outside-to-node-or-label"?N=F:(L==="outside-to-line"||L==="outside-to-line-or-label")&&(N=[l.x,l.y]),o=i.nodeShapes[this.getNodeShape(u)].intersectLine(v.x,v.y,u.outerWidth(),u.outerHeight(),N[0],N[1],0,I,p),L==="outside-to-node-or-label"||L==="outside-to-line-or-label"){var te=u._private.rscratch,J=te.labelWidth,X=te.labelHeight,O=te.labelX,V=te.labelY,q=J/2,j=X/2,ue=u.pstyle("text-valign").value;ue=Qr(ue),ue==="top"?V-=j:ue==="bottom"&&(V+=j);var we=u.pstyle("text-halign").value;we=Zr(we),we==="left"?O-=q:we==="right"&&(O+=q);var be=Ca(N[0],N[1],[O-q,V-j,O+q,V-j,O+q,V+j,O-q,V+j],v.x,v.y);if(be.length>0){var ke=l,le=yr(ke,qr(o)),ae=yr(ke,qr(be)),fe=le;ae<le&&(o=be,fe=ae),be.length>2&&yr(ke,{x:be[2],y:be[3]})<fe&&(o=[be[2],be[3]])}}var pe=Wa(o,F,i.arrowShapes[f].spacing(t)+d),me=Wa(o,F,i.arrowShapes[f].gap(t)+d);if(b.endX=me[0],b.endY=me[1],b.arrowEndX=pe[0],b.arrowEndY=pe[1],P==="inside-to-node")o=[l.x,l.y];else if(A.units)o=this.manualEndptToPx(s,A);else if(P==="outside-to-line")o=b.srcIntn;else if(P==="outside-to-node"||P==="outside-to-node-or-label"?G=_:(P==="outside-to-line"||P==="outside-to-line-or-label")&&(G=[v.x,v.y]),o=i.nodeShapes[this.getNodeShape(s)].intersectLine(l.x,l.y,s.outerWidth(),s.outerHeight(),G[0],G[1],0,M,g),P==="outside-to-node-or-label"||P==="outside-to-line-or-label"){var ce=s._private.rscratch,Ce=ce.labelWidth,Be=ce.labelHeight,Pe=ce.labelX,Ne=ce.labelY,Ee=Ce/2,ie=Be/2,xe=s.pstyle("text-valign").value;xe=Qr(xe),xe==="top"?Ne-=ie:xe==="bottom"&&(Ne+=ie);var U=s.pstyle("text-halign").value;U=Zr(U),U==="left"?Pe-=Ee:U==="right"&&(Pe+=Ee);var k=Ca(G[0],G[1],[Pe-Ee,Ne-ie,Pe+Ee,Ne-ie,Pe+Ee,Ne+ie,Pe-Ee,Ne+ie],l.x,l.y);if(k.length>0){var z=v,H=yr(z,qr(o)),Q=yr(z,qr(k)),K=H;Q<H&&(o=[k[0],k[1]],K=Q),k.length>2&&yr(z,{x:k[2],y:k[3]})<K&&(o=[k[2],k[3]])}}var ee=Wa(o,_,i.arrowShapes[c].spacing(t)+h),ne=Wa(o,_,i.arrowShapes[c].gap(t)+h);b.startX=ne[0],b.startY=ne[1],b.arrowStartX=ee[0],b.arrowStartY=ee[1],E&&(!re(b.startX)||!re(b.startY)||!re(b.endX)||!re(b.endY)?b.badLine=!0:b.badLine=!1)};za.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),e.edgeType==="haystack"?{x:e.haystackPts[0],y:e.haystackPts[1]}:{x:e.arrowStartX,y:e.arrowStartY}};za.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),e.edgeType==="haystack"?{x:e.haystackPts[2],y:e.haystackPts[3]}:{x:e.arrowEndX,y:e.arrowEndY}};var ds={};function Mp(t,e,r){for(var a=function(u,l,v,f){return rt(u,l,v,f)},n=e._private.rstyle.bezierPts,i=0;i<t.bezierProjPcts.length;i++){var o=t.bezierProjPcts[i];n.push({x:a(r[0],r[2],r[4],o),y:a(r[1],r[3],r[5],o)})}}ds.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<r.allpts.length;n+=4)Mp(this,t,r.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<r.allpts.length;n+=2)i.push({x:r.allpts[n],y:r.allpts[n+1]});else if(a==="haystack"){var o=r.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};ds.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var qt={};qt.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!ar(e)){var r,a,n=t._private,i=t.width(),o=t.height(),s=t.padding(),u=t.position(),l=t.pstyle("text-halign").strValue,v=t.pstyle("text-valign").strValue,f=n.rscratch,c=n.rstyle;switch(l){case"left":r=u.x-i/2-s;break;case"left-inside":r=u.x-i/2+s;break;case"right":r=u.x+i/2+s;break;case"right-inside":r=u.x+i/2-s;break;default:r=u.x}switch(v){case"top":a=u.y-o/2-s;break;case"top-inside":a=u.y-o/2+s;break;case"bottom":a=u.y+o/2+s;break;case"bottom-inside":a=u.y+o/2-s;break;default:a=u.y}f.labelX=r,f.labelY=a,c.labelX=r,c.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var gf=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},pf=function(e,r){return gf(r.x-e.x,r.y-e.y)},Lp=function(e,r,a,n){var i=Ea(0,n-.001,1),o=Ea(0,n+.001,1);return pf(Hr(e,r,a,i),Hr(e,r,a,o))};qt.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.rscratch,n=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var o=function(v,f,c){zt(r.rscratch,v,f,c),zt(r.rstyle,v,f,c)};o("labelX",null,e.x),o("labelY",null,e.y),o("labelAutoAngle",null,gf(a.midDispX,a.midDispY));var s=function(){if(s.cache)return s.cache;for(var v=[],f=0;f+5<a.allpts.length;f+=4){var c={x:a.allpts[f],y:a.allpts[f+1]},d={x:a.allpts[f+2],y:a.allpts[f+3]},h={x:a.allpts[f+4],y:a.allpts[f+5]};v.push({p0:c,p1:d,p2:h,startDist:0,length:0,segments:[]})}var g=r.rstyle.bezierPts,p=n.bezierProjPcts.length;function y(C,x,S,D,E){var B=Cr(x,S),A=C.segments[C.segments.length-1],P={p0:x,p1:S,t0:D,t1:E,startDist:A?A.startDist+A.length:0,length:B};C.segments.push(P),C.length+=B}for(var b=0;b<v.length;b++){var m=v[b],w=v[b-1];w&&(m.startDist=w.startDist+w.length),y(m,m.p0,g[b*p],0,n.bezierProjPcts[0]);for(var T=0;T<p-1;T++)y(m,g[b*p+T],g[b*p+T+1],n.bezierProjPcts[T],n.bezierProjPcts[T+1]);y(m,g[b*p+p-1],m.p2,n.bezierProjPcts[p-1],1)}return s.cache=v},u=function(v){var f,c=v==="source";if(i[v]){var d=t.pstyle(v+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var h=s(),g,p=0,y=0,b=0;b<h.length;b++){for(var m=h[c?b:h.length-1-b],w=0;w<m.segments.length;w++){var T=m.segments[c?w:m.segments.length-1-w],C=b===h.length-1&&w===m.segments.length-1;if(p=y,y+=T.length,y>=d||C){g={cp:m,segment:T};break}}if(g)break}var x=g.cp,S=g.segment,D=(d-p)/S.length,E=S.t1-S.t0,B=c?S.t0+E*D:S.t1-E*D;B=Ea(0,B,1),e=Hr(x.p0,x.p1,x.p2,B),f=Lp(x.p0,x.p1,x.p2,B);break;case"straight":case"segments":case"haystack":for(var A=0,P,M,R,L,I=a.allpts.length,F=0;F+3<I&&(c?(R={x:a.allpts[F],y:a.allpts[F+1]},L={x:a.allpts[F+2],y:a.allpts[F+3]}):(R={x:a.allpts[I-2-F],y:a.allpts[I-1-F]},L={x:a.allpts[I-4-F],y:a.allpts[I-3-F]}),P=Cr(R,L),M=A,A+=P,!(A>=d));F+=2);var _=(d-M)/P;_=Ea(0,_,1),e=mh(R,L,_),f=pf(R,L);break}o("labelX",v,e.x),o("labelY",v,e.y),o("labelAutoAngle",v,f)}};u("source"),u("target"),this.applyLabelDimensions(t)}};qt.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};qt.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=Er(a,t._private.labelDimsKey);if(yt(r.rscratch,"prefixedLabelDimsKey",e)!==n){zt(r.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(t,a),o=t.pstyle("line-height").pfValue,s=t.pstyle("font-size").pfValue,u=t.pstyle("text-wrap").strValue,l=yt(r.rscratch,"labelWrapCachedLines",e)||[],v=u!=="wrap"?1:Math.max(l.length,1),f=s*o,c=i.width,d=i.height+(v-1)*(o-1)*s;zt(r.rstyle,"labelWidth",e,c),zt(r.rscratch,"labelWidth",e,c),zt(r.rstyle,"labelHeight",e,d),zt(r.rscratch,"labelHeight",e,d),zt(r.rscratch,"labelLineHeight",e,f),zt(r.rscratch,"labelActualDescent",e,i.labelActualDescent)}};qt.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,o=function(I,F){return F?(zt(r.rscratch,I,e,F),F):yt(r.rscratch,I,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var s=t.pstyle("text-wrap").value;if(s==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l="​",v=n.split(`
5
+ `),f=t.pstyle("text-max-width").pfValue,c=t.pstyle("text-overflow-wrap").value==="anywhere",d=[],h=/[\s\u200b]+|$/g,g=0;g<v.length;g++){var p=v[g],y=this.calculateLabelDimensions(t,p).width;if(c&&(p=p.split("").join(l)),y>f){var b=p.matchAll(h),m="",w=0,T=Ct(b),C;try{for(T.s();!(C=T.n()).done;){var x=C.value,S=x[0],D=p.substring(w,x.index);w=x.index+S.length;var E=m.length===0?D:m+D+S;this.calculateLabelDimensions(t,E).width<=f?m+=D+S:(m&&d.push(m),m=D+S)}}catch(L){T.e(L)}finally{T.f()}m.match(/^[\s\u200b]+$/)||d.push(m)}else d.push(p)}o("labelWrapCachedLines",d),n=o("labelWrapCachedText",d.join(`
6
+ `)),o("labelWrapKey",u)}else if(s==="ellipsis"){var B=t.pstyle("text-max-width").pfValue,A="",P="…",M=!1;if(this.calculateLabelDimensions(t,n).width<B)return n;for(var R=0;R<n.length&&!(this.calculateLabelDimensions(t,A+n[R]+P).width>B);R++)A+=n[R],R===n.length-1&&(M=!0);return M||(A+=P),A}return n};qt.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;return e==="auto"?t.isNode()?Rg(r):"center":e};qt.calculateLabelDimensions=function(t,e){var r=this.cy.window().document,a=0,n=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue,o=t.pstyle("font-family").strValue,s=t.pstyle("font-weight").strValue,u=t.pstyle("text-metrics").strValue||"font",l=this.labelCalcCanvas,v=this.labelCalcCanvasContext;if(!l){l=this.labelCalcCanvas=r.createElement("canvas"),v=this.labelCalcCanvasContext=l.getContext("2d");var f=l.style;f.position="absolute",f.left="-9999px",f.top="-9999px",f.zIndex="-1",f.visibility="hidden",f.pointerEvents="none"}v.font="".concat(n," ").concat(s," ").concat(i,"px ").concat(o);for(var c=0,d=0,h=e.split(`
7
+ `),g=h.length,p=0,y=0,b=0;b<g;b++){var m=h[b],w=v.measureText(m),T=Math.ceil(w.width),C=i;u==="glyph"&&(b===0&&(y=w.actualBoundingBoxAscent),b===g-1&&(p=w.actualBoundingBoxDescent)),c=Math.max(T,c),d+=C}return u==="glyph"&&(d-=i-y-p),c+=a,d+=a,{width:c,height:d,labelActualAscent:y,labelActualDescent:p}};qt.calculateLabelAngle=function(t,e){var r=t._private.rscratch,a=t.isEdge(),n=e?e+"-":"",i=t.pstyle(n+"text-rotation"),o=i.strValue;return o==="none"?0:a&&o==="autorotate"?r.labelAutoAngle:o==="autorotate"?0:i.pfValue};qt.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private.rscratch;a.labelAngle=e.calculateLabelAngle(t),r&&(a.sourceLabelAngle=e.calculateLabelAngle(t,"source"),a.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var yf={},Al=28,Rl=!1;yf.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<Al||t.height()<Al))return Rl||(Ie("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Rl=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var Wn={};Wn.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var u=0;u<o.length;u++){var l=o[u]._private.rstyle;l.clean=!1,l.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(o){var s=o.target;a(s)}).on("style.* background.*",function(o){var s=o.target;a(s,!1)});var n=function(o){if(o){var s=r.onUpdateEleCalcsFns;e.cleanStyle();for(var u=0;u<e.length;u++){var l=e[u],v=l._private.rstyle;l.isNode()&&!v.cleanConnected&&(a(l.connectedEdges()),v.cleanConnected=!0)}if(s)for(var f=0;f<s.length;f++){var c=s[f];c(o,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){n(!0)},r.beforeRender(n,r.beforeRenderPriorities.eleCalcs)};Wn.onUpdateEleCalcs=function(t){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(t)};Wn.recalculateRenderedStyle=function(t,e){var r=function(b){return b._private.rstyle.cleanConnected};if(t.length!==0){var a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var o=t[i],s=o._private,u=s.rstyle;o.isEdge()&&(!r(o.source())||!r(o.target()))&&(u.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(y){return!y._private.rstyle.clean&&y.isBundledBezier()})&&(u.clean=!1),!(e&&u.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?n.push(o):a.push(o),u.clean=!0)}for(var l=0;l<n.length;l++){var v=n[l],f=v._private.rstyle,c=v.position();this.recalculateNodeLabelProjection(v),f.nodeX=c.x,f.nodeY=c.y,f.nodeW=v.pstyle("width").pfValue,f.nodeH=v.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var h=a[d]._private,g=h.rstyle,p=h.rscratch;g.srcX=p.arrowStartX,g.srcY=p.arrowStartY,g.tgtX=p.arrowEndX,g.tgtY=p.arrowEndY,g.midX=p.midX,g.midY=p.midY,g.labelAngle=p.labelAngle,g.sourceLabelAngle=p.sourceLabelAngle,g.targetLabelAngle=p.targetLabelAngle}}}};var Un={};Un.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}};Un.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Un.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(Qv),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var mf={};[Br,Dn,gt,za,ds,qt,yf,Wn,Un].forEach(function(t){ge(mf,t)});var bf={};bf.getCachedImage=function(t,e,r){var a=this,n=a.imageCache=a.imageCache||{},i=n[t];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;i=n[t]=n[t]||{};var o=i.image=new Image;o.addEventListener("load",r),o.addEventListener("error",function(){o.error=!0});var s="data:";return t.substring(0,s.length).toLowerCase()!==s&&(e=e==="null"?null:e,o.crossOrigin=e),o.src=t,o};var wf=function(e,r){var a=e[0];!a||a._private.grabbed===r||(a._private.grabbed=r,e.updateStyle(!1))},Ip=function(e){wf(e,!0)},Op=function(e){wf(e,!1)},ta={};ta.registerBinding=function(t,e,r,a){var n=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var i=[],o=0;o<t.length;o++){var s=t[o];if(s!==void 0){var u=this.binder(s);i.push(u.on.apply(u,n))}}return i}var u=this.binder(t);return u.on.apply(u,n)};ta.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||fc(t);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});r.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var o=function(u,l,v){var f=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(f[2]={capture:v??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:f}),(t.addEventListener||t.on).apply(t,f),this};return{on:o,addEventListener:o,addListener:o,bind:o}};ta.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};ta.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};ta.load=function(){var t=this,e=t.cy.window(),r=function(k){return k.selected()},a=function(k){var z=k.getRootNode();if(z&&z.nodeType===11&&z.host!==void 0)return z},n=function(k,z,H,Q){k==null&&(k=t.cy);for(var K=0;K<z.length;K++){var ee=z[K];k.emit({originalEvent:H,type:ee,position:Q})}},i=function(k){return k.shiftKey||k.metaKey||k.ctrlKey},o=function(k,z){var H=!0;if(t.cy.hasCompoundNodes()&&k&&k.pannable())for(var Q=0;z&&Q<z.length;Q++){var k=z[Q];if(k.isNode()&&k.isParent()&&!k.pannable()){H=!1;break}}else H=!0;return H},s=function(k){k[0]._private.rscratch.inDragLayer=!0},u=function(k){k[0]._private.rscratch.inDragLayer=!1},l=function(k){k[0]._private.rscratch.isGrabTarget=!0},v=function(k){k[0]._private.rscratch.isGrabTarget=!1},f=function(k,z){var H=z.addToList;!H.has(k)&&k.grabbable()&&!k.locked()&&(H.merge(k),Ip(k))},c=function(k,z){if(k.cy().hasCompoundNodes()&&!(z.inDragLayer==null&&z.addToList==null)){var H=k.descendants();z.inDragLayer&&(H.forEach(s),H.connectedEdges().forEach(s)),z.addToList&&f(H,z)}},d=function(k,z){z=z||{};var H=k.cy().hasCompoundNodes();z.inDragLayer&&(k.forEach(s),k.neighborhood().stdFilter(function(Q){return!H||Q.isEdge()}).forEach(s)),z.addToList&&k.forEach(function(Q){f(Q,z)}),c(k,z),p(k,{inDragLayer:z.inDragLayer}),t.updateCachedGrabbedEles()},h=d,g=function(k){k&&(t.getCachedZSortedEles().forEach(function(z){Op(z),u(z),v(z)}),t.updateCachedGrabbedEles())},p=function(k,z){if(!(z.inDragLayer==null&&z.addToList==null)&&k.cy().hasCompoundNodes()){var H=k.ancestors().orphans();if(!H.same(k)){var Q=H.descendants().spawnSelf().merge(H).unmerge(k).unmerge(k.descendants()),K=Q.connectedEdges();z.inDragLayer&&(K.forEach(s),Q.forEach(s)),z.addToList&&Q.forEach(function(ee){f(ee,z)})}}},y=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},b=typeof MutationObserver<"u",m=typeof ResizeObserver<"u";b?(t.removeObserver=new MutationObserver(function(U){for(var k=0;k<U.length;k++){var z=U[k].removedNodes;if(z){for(var H=0;H<z.length;H++)if(z[H]===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(U){t.destroy()});var w=La(function(){t.cy.resize()},100);b&&(t.styleObserver=new MutationObserver(w),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",w),m&&(t.resizeObserver=new ResizeObserver(w),t.resizeObserver.observe(t.container));var T=function(k,z){for(;k!=null;)z(k),k=k.parentNode},C=function(){t.invalidateContainerClientCoordsCache()};T(t.container,function(U){t.registerBinding(U,"transitionend",C),t.registerBinding(U,"animationend",C),t.registerBinding(U,"scroll",C)}),t.registerBinding(t.container,"contextmenu",function(U){U.preventDefault()});var x=function(){return t.selection[4]!==0},S=function(k){for(var z=t.findContainerClientCoords(),H=z[0],Q=z[1],K=z[2],ee=z[3],ne=k.touches?k.touches:[k],de=!1,oe=0;oe<ne.length;oe++){var Se=ne[oe];if(H<=Se.clientX&&Se.clientX<=H+K&&Q<=Se.clientY&&Se.clientY<=Q+ee){de=!0;break}}if(!de)return!1;for(var Fe=t.container,ve=k.target.parentNode,ye=!1;ve;){if(ve===Fe){ye=!0;break}ve=ve.parentNode}return!!ye};t.registerBinding(t.container,"mousedown",function(k){if(S(k)&&!(t.hoverData.which===1&&k.which!==1)){k.preventDefault(),y(),t.hoverData.capture=!0,t.hoverData.which=k.which;var z=t.cy,H=[k.clientX,k.clientY],Q=t.projectIntoViewport(H[0],H[1]),K=t.selection,ee=t.findNearestElements(Q[0],Q[1],!0,!1),ne=ee[0],de=t.dragData.possibleDragElements;t.hoverData.mdownPos=Q,t.hoverData.mdownGPos=H;var oe=function(De){return{originalEvent:k,type:De,position:{x:Q[0],y:Q[1]}}},Se=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var De=t.hoverData.down;De?De.emit(oe("taphold")):z.emit(oe("taphold"))}},t.tapholdDuration)};if(k.which==3){t.hoverData.cxtStarted=!0;var Fe={originalEvent:k,type:"cxttapstart",position:{x:Q[0],y:Q[1]}};ne?(ne.activate(),ne.emit(Fe),t.hoverData.down=ne):z.emit(Fe),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(k.which==1){if(ne&&ne.activate(),ne!=null&&t.nodeIsGrabbable(ne)){var ve=function(De){De.emit(oe("grab"))};if(l(ne),!ne.selected())de=t.dragData.possibleDragElements=z.collection(),h(ne,{addToList:de}),ne.emit(oe("grabon")).emit(oe("grab"));else{de=t.dragData.possibleDragElements=z.collection();var ye=z.$(function(Ve){return Ve.isNode()&&Ve.selected()&&t.nodeIsGrabbable(Ve)});d(ye,{addToList:de}),ne.emit(oe("grabon")),ye.forEach(ve)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=ne,t.hoverData.downs=ee,t.hoverData.downTime=new Date().getTime(),n(ne,["mousedown","tapstart","vmousedown"],k,{x:Q[0],y:Q[1]}),ne==null?(K[4]=1,t.data.bgActivePosistion={x:Q[0],y:Q[1]},t.redrawHint("select",!0),t.redraw()):ne.pannable()&&(K[4]=1),Se()}K[0]=K[2]=Q[0],K[1]=K[3]=Q[1]}},!1);var D=a(t.container);t.registerBinding([e,D],"mousemove",function(k){if(!(!t.hoverData.capture&&!S(k))){var z=!1,H=t.cy,Q=H.zoom(),K=[k.clientX,k.clientY],ee=t.projectIntoViewport(K[0],K[1]),ne=t.hoverData.mdownPos,de=t.hoverData.mdownGPos,oe=t.selection,Se=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(Se=t.findNearestElement(ee[0],ee[1],!0,!1));var Fe=t.hoverData.last,ve=t.hoverData.down,ye=[ee[0]-oe[2],ee[1]-oe[3]],Ve=t.dragData.possibleDragElements,De;if(de){var $e=K[0]-de[0],Ze=$e*$e,it=K[1]-de[1],Ue=Ze+it*it;t.hoverData.isOverThresholdDrag=De=Ue>=t.desktopTapThreshold2}var tt=i(k);De&&(t.hoverData.tapholdCancelled=!0);var ot=function(){var St=t.hoverData.dragDelta=t.hoverData.dragDelta||[];St.length===0?(St.push(ye[0]),St.push(ye[1])):(St[0]+=ye[0],St[1]+=ye[1])};z=!0,n(Se,["mousemove","vmousemove","tapdrag"],k,{x:ee[0],y:ee[1]});var st=function(St){return{originalEvent:k,type:St,position:{x:ee[0],y:ee[1]}}},dr=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||H.emit(st("boxstart")),oe[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(De){var qa=st("cxtdrag");ve?ve.emit(qa):H.emit(qa),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||Se!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(st("cxtdragout")),t.hoverData.cxtOver=Se,Se&&Se.emit(st("cxtdragover")))}}else if(t.hoverData.dragging){if(z=!0,H.panningEnabled()&&H.userPanningEnabled()){var Ar;if(t.hoverData.justStartedPan){var Yt=t.hoverData.mdownPos;Ar={x:(ee[0]-Yt[0])*Q,y:(ee[1]-Yt[1])*Q},t.hoverData.justStartedPan=!1}else Ar={x:ye[0]*Q,y:ye[1]*Q};H.panBy(Ar),H.emit(st("dragpan")),t.hoverData.dragged=!0}ee=t.projectIntoViewport(k.clientX,k.clientY)}else if(oe[4]==1&&(ve==null||ve.pannable()))De&&(!t.hoverData.dragging&&H.boxSelectionEnabled()&&(tt||!H.panningEnabled()||!H.userPanningEnabled())?dr():!t.hoverData.selecting&&H.panningEnabled()&&H.userPanningEnabled()&&o(ve,t.hoverData.downs)&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,oe[4]=0,t.data.bgActivePosistion=qr(ne),t.redrawHint("select",!0),t.redraw()),ve&&ve.pannable()&&ve.active()&&ve.unactivate());else{if(ve&&ve.pannable()&&ve.active()&&ve.unactivate(),(!ve||!ve.grabbed())&&Se!=Fe&&(Fe&&n(Fe,["mouseout","tapdragout"],k,{x:ee[0],y:ee[1]}),Se&&n(Se,["mouseover","tapdragover"],k,{x:ee[0],y:ee[1]}),t.hoverData.last=Se),ve)if(De){if(H.boxSelectionEnabled()&&tt)ve&&ve.grabbed()&&(g(Ve),ve.emit(st("freeon")),Ve.emit(st("free")),t.dragData.didDrag&&(ve.emit(st("dragfreeon")),Ve.emit(st("dragfree")))),dr();else if(ve&&ve.grabbed()&&t.nodeIsDraggable(ve)){var wt=!t.dragData.didDrag;wt&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||d(Ve,{inDragLayer:!0});var ct={x:0,y:0};if(re(ye[0])&&re(ye[1])&&(ct.x+=ye[0],ct.y+=ye[1],wt)){var xt=t.hoverData.dragDelta;xt&&re(xt[0])&&re(xt[1])&&(ct.x+=xt[0],ct.y+=xt[1])}t.hoverData.draggingEles=!0,Ve.silentShift(ct).emit(st("position")).emit(st("drag")),t.redrawHint("drag",!0),t.redraw()}}else ot();z=!0}if(oe[2]=ee[0],oe[3]=ee[1],z)return k.stopPropagation&&k.stopPropagation(),k.preventDefault&&k.preventDefault(),!1}},!1);var E,B,A;t.registerBinding(e,"mouseup",function(k){if(!(t.hoverData.which===1&&k.which!==1&&t.hoverData.capture)&&t.hoverData.capture){t.hoverData.capture=!1;var z=t.cy,H=t.projectIntoViewport(k.clientX,k.clientY),Q=t.selection,K=t.findNearestElement(H[0],H[1],!0,!1),ee=t.dragData.possibleDragElements,ne=t.hoverData.down,de=i(k);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ne&&ne.unactivate();var oe=function($e){return{originalEvent:k,type:$e,position:{x:H[0],y:H[1]}}};if(t.hoverData.which===3){var Se=oe("cxttapend");if(ne?ne.emit(Se):z.emit(Se),!t.hoverData.cxtDragged){var Fe=oe("cxttap");ne?ne.emit(Fe):z.emit(Fe)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(n(K,["mouseup","tapend","vmouseup"],k,{x:H[0],y:H[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(n(ne,["click","tap","vclick"],k,{x:H[0],y:H[1]}),B=!1,k.timeStamp-A<=z.multiClickDebounceTime()?(E&&clearTimeout(E),B=!0,A=null,n(ne,["dblclick","dbltap","vdblclick"],k,{x:H[0],y:H[1]})):(E=setTimeout(function(){B||n(ne,["oneclick","onetap","voneclick"],k,{x:H[0],y:H[1]})},z.multiClickDebounceTime()),A=k.timeStamp)),ne==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!i(k)&&(z.$(r).unselect(["tapunselect"]),ee.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=ee=z.collection()),K==ne&&!t.dragData.didDrag&&!t.hoverData.selecting&&K!=null&&K._private.selectable&&(t.hoverData.dragging||(z.selectionType()==="additive"||de?K.selected()?K.unselect(["tapunselect"]):K.select(["tapselect"]):de||(z.$(r).unmerge(K).unselect(["tapunselect"]),K.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var ve=z.collection(t.getAllInBox(Q[0],Q[1],Q[2],Q[3]));t.redrawHint("select",!0),ve.length>0&&t.redrawHint("eles",!0),z.emit(oe("boxend"));var ye=function($e){return $e.selectable()&&!$e.selected()};z.selectionType()==="additive"||de||z.$(r).unmerge(ve).unselect(),ve.emit(oe("box")).stdFilter(ye).select().emit(oe("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!Q[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Ve=ne&&ne.grabbed();g(ee),Ve&&(ne.emit(oe("freeon")),ee.emit(oe("free")),t.dragData.didDrag&&(ne.emit(oe("dragfreeon")),ee.emit(oe("dragfree"))))}}Q[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}},!1);var P=[],M=4,R,L=1e5,I=function(k,z){for(var H=0;H<k.length;H++)if(k[H]%z!==0)return!1;return!0},F=function(k){for(var z=Math.abs(k[0]),H=1;H<k.length;H++)if(Math.abs(k[H])!==z)return!1;return!0},_=function(k){var z=!1,H=k.deltaY;if(H==null&&(k.wheelDeltaY!=null?H=k.wheelDeltaY/4:k.wheelDelta!=null&&(H=k.wheelDelta/4)),H!==0){if(R==null)if(P.length>=M){var Q=P;if(R=I(Q,5),!R){var K=Math.abs(Q[0]);R=F(Q)&&K>5}if(R)for(var ee=0;ee<Q.length;ee++)L=Math.min(Math.abs(Q[ee]),L)}else P.push(H),z=!0;else R&&(L=Math.min(Math.abs(H),L));if(!t.scrollingPage){var ne=t.cy,de=ne.zoom(),oe=ne.pan(),Se=t.projectIntoViewport(k.clientX,k.clientY),Fe=[Se[0]*de+oe.x,Se[1]*de+oe.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||x()){k.preventDefault();return}if(ne.panningEnabled()&&ne.userPanningEnabled()&&ne.zoomingEnabled()&&ne.userZoomingEnabled()){k.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var ve;z&&Math.abs(H)>5&&(H=es(H)*5),ve=H/-250,R&&(ve/=L,ve*=3),ve=ve*t.wheelSensitivity,k.deltaMode===1&&(ve*=33);var ye=ne.zoom()*Math.pow(10,ve);k.type==="gesturechange"&&(ye=t.gestureStartZoom*k.scale),ne.zoom({level:ye,renderedPosition:{x:Fe[0],y:Fe[1]}}),ne.emit({type:k.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:k,position:{x:Se[0],y:Se[1]}})}}}};t.registerBinding(t.container,"wheel",_,!0),t.registerBinding(e,"scroll",function(k){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(k){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||k.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(U){t.hasTouchStarted||_(U)},!0),t.registerBinding(t.container,"mouseout",function(k){var z=t.projectIntoViewport(k.clientX,k.clientY);t.cy.emit({originalEvent:k,type:"mouseout",position:{x:z[0],y:z[1]}})},!1),t.registerBinding(t.container,"mouseover",function(k){var z=t.projectIntoViewport(k.clientX,k.clientY);t.cy.emit({originalEvent:k,type:"mouseover",position:{x:z[0],y:z[1]}})},!1);var N,G,Z,W,$,Y,te,J,X,O,V,q,j,ue=function(k,z,H,Q){return Math.sqrt((H-k)*(H-k)+(Q-z)*(Q-z))},we=function(k,z,H,Q){return(H-k)*(H-k)+(Q-z)*(Q-z)},be;t.registerBinding(t.container,"touchstart",be=function(k){if(t.hasTouchStarted=!0,!!S(k)){y(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var z=t.cy,H=t.touchData.now,Q=t.touchData.earlier;if(k.touches[0]){var K=t.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);H[0]=K[0],H[1]=K[1]}if(k.touches[1]){var K=t.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);H[2]=K[0],H[3]=K[1]}if(k.touches[2]){var K=t.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);H[4]=K[0],H[5]=K[1]}var ee=function(st){return{originalEvent:k,type:st,position:{x:H[0],y:H[1]}}};if(k.touches[1]){t.touchData.singleTouchMoved=!0,g(t.dragData.touchDragEles);var ne=t.findContainerClientCoords();X=ne[0],O=ne[1],V=ne[2],q=ne[3],N=k.touches[0].clientX-X,G=k.touches[0].clientY-O,Z=k.touches[1].clientX-X,W=k.touches[1].clientY-O,j=0<=N&&N<=V&&0<=Z&&Z<=V&&0<=G&&G<=q&&0<=W&&W<=q;var de=z.pan(),oe=z.zoom();$=ue(N,G,Z,W),Y=we(N,G,Z,W),te=[(N+Z)/2,(G+W)/2],J=[(te[0]-de.x)/oe,(te[1]-de.y)/oe];var Se=200,Fe=Se*Se;if(Y<Fe&&!k.touches[2]){var ve=t.findNearestElement(H[0],H[1],!0,!0),ye=t.findNearestElement(H[2],H[3],!0,!0);ve&&ve.isNode()?(ve.activate().emit(ee("cxttapstart")),t.touchData.start=ve):ye&&ye.isNode()?(ye.activate().emit(ee("cxttapstart")),t.touchData.start=ye):z.emit(ee("cxttapstart")),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(k.touches[2])z.boxSelectionEnabled()&&k.preventDefault();else if(!k.touches[1]){if(k.touches[0]){var Ve=t.findNearestElements(H[0],H[1],!0,!0),De=Ve[0];if(De!=null&&(De.activate(),t.touchData.start=De,t.touchData.starts=Ve,t.nodeIsGrabbable(De))){var $e=t.dragData.touchDragEles=z.collection(),Ze=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),De.selected()?(Ze=z.$(function(ot){return ot.selected()&&t.nodeIsGrabbable(ot)}),d(Ze,{addToList:$e})):h(De,{addToList:$e}),l(De),De.emit(ee("grabon")),Ze?Ze.forEach(function(ot){ot.emit(ee("grab"))}):De.emit(ee("grab"))}n(De,["touchstart","tapstart","vmousedown"],k,{x:H[0],y:H[1]}),De==null&&(t.data.bgActivePosistion={x:K[0],y:K[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&n(t.touchData.start,["taphold"],k,{x:H[0],y:H[1]})},t.tapholdDuration)}}if(k.touches.length>=1){for(var it=t.touchData.startPosition=[null,null,null,null,null,null],Ue=0;Ue<H.length;Ue++)it[Ue]=Q[Ue]=H[Ue];var tt=k.touches[0];t.touchData.startGPosition=[tt.clientX,tt.clientY]}}},!1);var ke;t.registerBinding(e,"touchmove",ke=function(k){var z=t.touchData.capture;if(!(!z&&!S(k))){var H=t.selection,Q=t.cy,K=t.touchData.now,ee=t.touchData.earlier,ne=Q.zoom();if(k.touches[0]){var de=t.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);K[0]=de[0],K[1]=de[1]}if(k.touches[1]){var de=t.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);K[2]=de[0],K[3]=de[1]}if(k.touches[2]){var de=t.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);K[4]=de[0],K[5]=de[1]}var oe=function(Zf){return{originalEvent:k,type:Zf,position:{x:K[0],y:K[1]}}},Se=t.touchData.startGPosition,Fe;if(z&&k.touches[0]&&Se){for(var ve=[],ye=0;ye<K.length;ye++)ve[ye]=K[ye]-ee[ye];var Ve=k.touches[0].clientX-Se[0],De=Ve*Ve,$e=k.touches[0].clientY-Se[1];Fe=De+$e*$e>=t.touchTapThreshold2}if(z&&t.touchData.cxt){k.preventDefault();var Ze=k.touches[0].clientX-X,it=k.touches[0].clientY-O,Ue=k.touches[1].clientX-X,tt=k.touches[1].clientY-O,ot=we(Ze,it,Ue,tt),st=ot/Y,dr=150,qa=dr*dr,Ar=1.5;if(st>=Ar*Ar||ot>=qa){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Yt=oe("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(Yt),t.touchData.start=null):Q.emit(Yt)}}if(z&&t.touchData.cxt){var Yt=oe("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Yt):Q.emit(Yt),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var wt=t.findNearestElement(K[0],K[1],!0,!0);(!t.touchData.cxtOver||wt!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(oe("cxtdragout")),t.touchData.cxtOver=wt,wt&&wt.emit(oe("cxtdragover")))}else if(z&&k.touches[2]&&Q.boxSelectionEnabled())k.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||Q.emit(oe("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,H[4]=1,!H||H.length===0||H[0]===void 0?(H[0]=(K[0]+K[2]+K[4])/3,H[1]=(K[1]+K[3]+K[5])/3,H[2]=(K[0]+K[2]+K[4])/3+1,H[3]=(K[1]+K[3]+K[5])/3+1):(H[2]=(K[0]+K[2]+K[4])/3,H[3]=(K[1]+K[3]+K[5])/3),t.redrawHint("select",!0),t.redraw();else if(z&&k.touches[1]&&!t.touchData.didSelect&&Q.zoomingEnabled()&&Q.panningEnabled()&&Q.userZoomingEnabled()&&Q.userPanningEnabled()){k.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ct=t.dragData.touchDragEles;if(ct){t.redrawHint("drag",!0);for(var xt=0;xt<ct.length;xt++){var aa=ct[xt]._private;aa.grabbed=!1,aa.rscratch.inDragLayer=!1}}var St=t.touchData.start,Ze=k.touches[0].clientX-X,it=k.touches[0].clientY-O,Ue=k.touches[1].clientX-X,tt=k.touches[1].clientY-O,ys=ue(Ze,it,Ue,tt),Gf=ys/$;if(j){var Hf=Ze-N,$f=it-G,Wf=Ue-Z,Uf=tt-W,Kf=(Hf+Wf)/2,Yf=($f+Uf)/2,na=Q.zoom(),Kn=na*Gf,_a=Q.pan(),ms=J[0]*na+_a.x,bs=J[1]*na+_a.y,Xf={x:-Kn/na*(ms-_a.x-Kf)+ms,y:-Kn/na*(bs-_a.y-Yf)+bs};if(St&&St.active()){var ct=t.dragData.touchDragEles;g(ct),t.redrawHint("drag",!0),t.redrawHint("eles",!0),St.unactivate().emit(oe("freeon")),ct.emit(oe("free")),t.dragData.didDrag&&(St.emit(oe("dragfreeon")),ct.emit(oe("dragfree")))}Q.viewport({zoom:Kn,pan:Xf,cancelOnFailedZoom:!0}),Q.emit(oe("pinchzoom")),$=ys,N=Ze,G=it,Z=Ue,W=tt,t.pinching=!0}if(k.touches[0]){var de=t.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);K[0]=de[0],K[1]=de[1]}if(k.touches[1]){var de=t.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);K[2]=de[0],K[3]=de[1]}if(k.touches[2]){var de=t.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);K[4]=de[0],K[5]=de[1]}}else if(k.touches[0]&&!t.touchData.didSelect){var Pt=t.touchData.start,Yn=t.touchData.last,wt;if(!t.hoverData.draggingEles&&!t.swipePanning&&(wt=t.findNearestElement(K[0],K[1],!0,!0)),z&&Pt!=null&&k.preventDefault(),z&&Pt!=null&&t.nodeIsDraggable(Pt))if(Fe){var ct=t.dragData.touchDragEles,ws=!t.dragData.didDrag;ws&&d(ct,{inDragLayer:!0}),t.dragData.didDrag=!0;var ia={x:0,y:0};if(re(ve[0])&&re(ve[1])&&(ia.x+=ve[0],ia.y+=ve[1],ws)){t.redrawHint("eles",!0);var At=t.touchData.dragDelta;At&&re(At[0])&&re(At[1])&&(ia.x+=At[0],ia.y+=At[1])}t.hoverData.draggingEles=!0,ct.silentShift(ia).emit(oe("position")).emit(oe("drag")),t.redrawHint("drag",!0),t.touchData.startPosition[0]==ee[0]&&t.touchData.startPosition[1]==ee[1]&&t.redrawHint("eles",!0),t.redraw()}else{var At=t.touchData.dragDelta=t.touchData.dragDelta||[];At.length===0?(At.push(ve[0]),At.push(ve[1])):(At[0]+=ve[0],At[1]+=ve[1])}if(n(Pt||wt,["touchmove","tapdrag","vmousemove"],k,{x:K[0],y:K[1]}),(!Pt||!Pt.grabbed())&&wt!=Yn&&(Yn&&Yn.emit(oe("tapdragout")),wt&&wt.emit(oe("tapdragover"))),t.touchData.last=wt,z)for(var xt=0;xt<K.length;xt++)K[xt]&&t.touchData.startPosition[xt]&&Fe&&(t.touchData.singleTouchMoved=!0);if(z&&(Pt==null||Pt.pannable())&&Q.panningEnabled()&&Q.userPanningEnabled()){o(Pt,t.touchData.starts)&&(k.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=qr(t.touchData.startPosition)),t.swipePanning?(Q.panBy({x:ve[0]*ne,y:ve[1]*ne}),Q.emit(oe("dragpan"))):Fe&&(t.swipePanning=!0,Q.panBy({x:Ve*ne,y:$e*ne}),Q.emit(oe("dragpan")),Pt&&(Pt.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var de=t.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);K[0]=de[0],K[1]=de[1]}}for(var ye=0;ye<K.length;ye++)ee[ye]=K[ye];z&&k.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var le;t.registerBinding(e,"touchcancel",le=function(k){var z=t.touchData.start;t.touchData.capture=!1,z&&z.unactivate()});var ae,fe,pe,me;if(t.registerBinding(e,"touchend",ae=function(k){var z=t.touchData.start;if(t.touchData.capture)k.touches.length===0&&(t.touchData.capture=!1),k.preventDefault();else return;var H=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var Q=t.cy,K=Q.zoom(),ee=t.touchData.now,ne=t.touchData.earlier;if(k.touches[0]){var de=t.projectIntoViewport(k.touches[0].clientX,k.touches[0].clientY);ee[0]=de[0],ee[1]=de[1]}if(k.touches[1]){var de=t.projectIntoViewport(k.touches[1].clientX,k.touches[1].clientY);ee[2]=de[0],ee[3]=de[1]}if(k.touches[2]){var de=t.projectIntoViewport(k.touches[2].clientX,k.touches[2].clientY);ee[4]=de[0],ee[5]=de[1]}var oe=function(ot){return{originalEvent:k,type:ot,position:{x:ee[0],y:ee[1]}}};z&&z.unactivate();var Se;if(t.touchData.cxt){if(Se=oe("cxttapend"),z?z.emit(Se):Q.emit(Se),!t.touchData.cxtDragged){var Fe=oe("cxttap");z?z.emit(Fe):Q.emit(Fe)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!k.touches[2]&&Q.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var ve=Q.collection(t.getAllInBox(H[0],H[1],H[2],H[3]));H[0]=void 0,H[1]=void 0,H[2]=void 0,H[3]=void 0,H[4]=0,t.redrawHint("select",!0),Q.emit(oe("boxend")),ve.emit(oe("box")).stdFilter(function(ot){return ot.selectable()&&!ot.selected()}).select().emit(oe("boxselect")),ve.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(z?.unactivate(),k.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!k.touches[1]){if(!k.touches[0]){if(!k.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ye=t.dragData.touchDragEles;if(z!=null){var Ve=z._private.grabbed;g(ye),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ve&&(z.emit(oe("freeon")),ye.emit(oe("free")),t.dragData.didDrag&&(z.emit(oe("dragfreeon")),ye.emit(oe("dragfree")))),n(z,["touchend","tapend","vmouseup","tapdragout"],k,{x:ee[0],y:ee[1]}),z.unactivate(),t.touchData.start=null}else n(t.findNearestElement(ee[0],ee[1],!0,!0),["touchend","tapend","vmouseup","tapdragout"],k,{x:ee[0],y:ee[1]});var De=t.touchData.startPosition[0]-ee[0],$e=De*De,Ze=t.touchData.startPosition[1]-ee[1],it=($e+Ze*Ze)*K*K;t.touchData.singleTouchMoved||(z||Q.$(":selected").unselect(["tapunselect"]),n(z,["tap","vclick"],k,{x:ee[0],y:ee[1]}),fe=!1,k.timeStamp-me<=Q.multiClickDebounceTime()?(pe&&clearTimeout(pe),fe=!0,me=null,n(z,["dbltap","vdblclick"],k,{x:ee[0],y:ee[1]})):(pe=setTimeout(function(){fe||n(z,["onetap","voneclick"],k,{x:ee[0],y:ee[1]})},Q.multiClickDebounceTime()),me=k.timeStamp)),z!=null&&!t.dragData.didDrag&&z._private.selectable&&it<t.touchTapThreshold2&&!t.pinching&&(Q.selectionType()==="single"?(Q.$(r).unmerge(z).unselect(["tapunselect"]),z.select(["tapselect"])):z.selected()?z.unselect(["tapunselect"]):z.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Ue=0;Ue<ee.length;Ue++)ne[Ue]=ee[Ue];t.dragData.didDrag=!1,k.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),k.touches.length<2&&(k.touches.length===1&&(t.touchData.startGPosition=[k.touches[0].clientX,k.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var ce=[],Ce=function(k){return{clientX:k.clientX,clientY:k.clientY,force:1,identifier:k.pointerId,pageX:k.pageX,pageY:k.pageY,radiusX:k.width/2,radiusY:k.height/2,screenX:k.screenX,screenY:k.screenY,target:k.target}},Be=function(k){return{event:k,touch:Ce(k)}},Pe=function(k){ce.push(Be(k))},Ne=function(k){for(var z=0;z<ce.length;z++)if(ce[z].event.pointerId===k.pointerId){ce.splice(z,1);return}},Ee=function(k){var z=ce.filter(function(H){return H.event.pointerId===k.pointerId})[0];z.event=k,z.touch=Ce(k)},ie=function(k){k.touches=ce.map(function(z){return z.touch})},xe=function(k){return k.pointerType==="mouse"||k.pointerType===4};t.registerBinding(t.container,"pointerdown",function(U){xe(U)||(U.preventDefault(),Pe(U),ie(U),be(U))}),t.registerBinding(t.container,"pointerup",function(U){xe(U)||(Ne(U),ie(U),ae(U))}),t.registerBinding(t.container,"pointercancel",function(U){xe(U)||(Ne(U),ie(U),le(U))}),t.registerBinding(t.container,"pointermove",function(U){xe(U)||(U.preventDefault(),Ee(U),ie(U),ke(U))})}};var Ut={};Ut.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,n,i,o,s,u){this.renderer.nodeShapeImpl("polygon",a,n,i,o,s,this.points)},intersectLine:function(a,n,i,o,s,u,l,v){return Ca(s,u,this.points,a,n,i/2,o/2,l)},checkPoint:function(a,n,i,o,s,u,l,v){return Wt(a,n,this.points,u,l,o,s,[0,-1],i)},hasMiterBounds:t!=="rectangle",miterBounds:function(a,n,i,o,s,u){return Th(this.points,a,n,i,o,s)}}};Ut.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,o,s,u){return Mh(i,o,e,r,a/2+s,n/2+s)},checkPoint:function(e,r,a,n,i,o,s,u){return xr(e,r,n,i,o,s,a)}}};Ut.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(a,n,i,o,s,u,l){if(u[l]!==void 0&&u[l+"-cx"]===a&&u[l+"-cy"]===n)return u[l];u[l]=new Array(e.length/2),u[l+"-cx"]=a,u[l+"-cy"]=n;var v=i/2,f=o/2;s=s==="auto"?bv(i,o):s;for(var c=new Array(e.length/2),d=0;d<e.length/2;d++)c[d]={x:a+v*e[d*2],y:n+f*e[d*2+1]};var h,g,p,y,b=c.length;for(g=c[b-1],h=0;h<b;h++)p=c[h%b],y=c[(h+1)%b],u[l][h]=hs(g,p,y,s),g=p,p=y;return u[l]},draw:function(a,n,i,o,s,u,l){this.renderer.nodeShapeImpl("round-polygon",a,n,i,o,s,this.points,this.getOrCreateCorners(n,i,o,s,u,l,"drawCorners"))},intersectLine:function(a,n,i,o,s,u,l,v,f){return Ih(s,u,this.points,a,n,i,o,l,this.getOrCreateCorners(a,n,i,o,v,f,"corners"))},checkPoint:function(a,n,i,o,s,u,l,v,f){return Rh(a,n,this.points,u,l,o,s,this.getOrCreateCorners(u,l,o,s,v,f,"corners"))}}};Ut.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:pt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,o)},intersectLine:function(e,r,a,n,i,o,s,u){return yv(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){var l=n/2,v=i/2;u=u==="auto"?ir(n,i):u,u=Math.min(l,v,u);var f=u*2;return!!(Wt(e,r,this.points,o,s,n,i-f,[0,-1],a)||Wt(e,r,this.points,o,s,n-f,i,[0,-1],a)||xr(e,r,f,f,o-l+u,s-v+u,a)||xr(e,r,f,f,o+l-u,s-v+u,a)||xr(e,r,f,f,o+l-u,s+v-u,a)||xr(e,r,f,f,o-l+u,s+v-u,a))}}};Ut.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:rs(),points:pt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,null,o)},generateCutTrianglePts:function(e,r,a,n,i){var o=i==="auto"?this.cornerLength:i,s=r/2,u=e/2,l=a-u,v=a+u,f=n-s,c=n+s;return{topLeft:[l,f+o,l+o,f,l+o,f+o],topRight:[v-o,f,v,f+o,v-o,f+o],bottomRight:[v,c-o,v-o,c,v-o,c-o],bottomLeft:[l+o,c,l,c-o,l+o,c-o]}},intersectLine:function(e,r,a,n,i,o,s,u){var l=this.generateCutTrianglePts(a+2*s,n+2*s,e,r,u);return Ca(i,o,[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]),e,r)},checkPoint:function(e,r,a,n,i,o,s,u){var l=u==="auto"?this.cornerLength:u;if(Wt(e,r,this.points,o,s,n,i-2*l,[0,-1],a)||Wt(e,r,this.points,o,s,n-2*l,i,[0,-1],a))return!0;var v=this.generateCutTrianglePts(n,i,o,s);return Et(e,r,v.topLeft)||Et(e,r,v.topRight)||Et(e,r,v.bottomRight)||Et(e,r,v.bottomLeft)}}};Ut.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:pt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,o,s,u){var l=.15,v=.5,f=.85,c=this.generateBarrelBezierPts(a+2*s,n+2*s,e,r),d=function(g){var p=Hr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},l),y=Hr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},v),b=Hr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},f);return[g[0],g[1],p.x,p.y,y.x,y.y,b.x,b.y,g[4],g[5]]};return Ca(i,o,[].concat(d(c.topLeft),d(c.topRight),d(c.bottomRight),d(c.bottomLeft)),e,r)},generateBarrelBezierPts:function(e,r,a,n){var i=r/2,o=e/2,s=a-o,u=a+o,l=n-i,v=n+i,f=Bo(e,r),c=f.heightOffset,d=f.widthOffset,h=f.ctrlPtOffsetPct*e,g={topLeft:[s,l+c,s+h,l,s+d,l],topRight:[u-d,l,u-h,l,u,l+c],bottomRight:[u,v-c,u-h,v,u-d,v],bottomLeft:[s+d,v,s+h,v,s,v-c]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,r,a,n,i,o,s,u){var l=Bo(n,i),v=l.heightOffset,f=l.widthOffset;if(Wt(e,r,this.points,o,s,n,i-2*v,[0,-1],a)||Wt(e,r,this.points,o,s,n-2*f,i,[0,-1],a))return!0;for(var c=this.generateBarrelBezierPts(n,i,o,s),d=function(x,S,D){var E=D[4],B=D[2],A=D[0],P=D[5],M=D[1];if(Math.min(E,A)<=x&&x<=Math.max(E,A)&&Math.min(P,M)<=S&&S<=Math.max(P,M)){var R=Oh(E,B,A),L=kh(R[0],R[1],R[2],x).filter(function(I){return 0<=I&&I<=1});if(L.length>0)return L[0]}return null},h=Object.keys(c),g=0;g<h.length;g++){var p=c[h[g]],y=d(e,r,p);if(y!=null){var b=p[5],m=p[3],w=p[1],T=rt(b,m,w,y);if(p.isTop&&T<=r||p.isBottom&&r<=T)return!0}}return!1}}};Ut.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:pt(4,0),draw:function(e,r,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,o)},intersectLine:function(e,r,a,n,i,o,s,u){var l=e-(a/2+s),v=r-(n/2+s),f=v,c=er(i,o,e,r,l,v,e+(a/2+s),f,!1);return c.length>0?c:yv(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){u=u==="auto"?ir(n,i):u;var l=2*u;if(Wt(e,r,this.points,o,s,n,i-l,[0,-1],a)||Wt(e,r,this.points,o,s,n-l,i,[0,-1],a))return!0;var v=n/2+2*a,f=i/2+2*a;return!!(Et(e,r,[o-v,s-f,o-v,s,o+v,s,o+v,s-f])||xr(e,r,l,l,o+n/2-u,s+i/2-u,a)||xr(e,r,l,l,o-n/2+u,s+i/2-u,a))}}};Ut.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",pt(3,0)),this.generateRoundPolygon("round-triangle",pt(3,0)),this.generatePolygon("rectangle",pt(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r),this.generatePolygon("pentagon",pt(5,0)),this.generateRoundPolygon("round-pentagon",pt(5,0)),this.generatePolygon("hexagon",pt(6,0)),this.generateRoundPolygon("round-hexagon",pt(6,0)),this.generatePolygon("heptagon",pt(7,0)),this.generateRoundPolygon("round-heptagon",pt(7,0)),this.generatePolygon("octagon",pt(8,0)),this.generateRoundPolygon("round-octagon",pt(8,0));var a=new Array(20),n=ko(5,0),i=ko(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[s*2]*=o,i[s*2+1]*=o;for(var s=0;s<20/4;s++)a[s*4]=n[s*2],a[s*4+1]=n[s*2+1],a[s*4+2]=i[s*2],a[s*4+3]=i[s*2+1];a=mv(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u),t.makePolygon=function(l){var v="polygon-"+l.join("$"),f;return(f=this[v])?f:e.generatePolygon(v,l)}};var Fa={};Fa.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Fa.redraw=function(t){t=t||hv();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t};Fa.beforeRender=function(t,e){if(!this.destroyed){e==null&&He("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,n){return n.priority-a.priority})}};var Ml=function(e,r,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(r,a)};Fa.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function(n){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){Ml(t,!0,n);var i=$t();t.render(t.renderOptions);var o=t.lastDrawTime=$t();t.averageRedrawTime===void 0&&(t.averageRedrawTime=o-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var s=o-i;t.redrawTotalTime+=s,t.lastRedrawTime=s,t.averageRedrawTime=t.averageRedrawTime/2+s/2,t.requestedFrame=!1}else Ml(t,!1,n);t.skipFrame=!1,pn(r)}};pn(r)}};var xf=function(e){this.init(e)},ra=xf.prototype;ra.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];ra.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",u=n.getElementById(o)!=null;if(r.className.indexOf(s)<0&&(r.className=(r.className||"")+" "+s),!u){var l=n.createElement("style");l.id=o,l.textContent="."+s+" { position: relative; }",i.insertBefore(l,i.children[0])}a.getComputedStyle(r).getPropertyValue("position")==="static"&&Ie("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.webgl=t.webgl,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=re(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};ra.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),t==="gc"&&r.redrawHint("gc",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};ra.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r.target;(a.off||a.removeEventListener).apply(a,r.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}};ra.isHeadless=function(){return!1};[cs,mf,bf,ta,Ut,Fa].forEach(function(t){ge(ra,t)});var mo=1e3/60,Ef={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=La(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),o=function(l,v){var f=$t(),c=n.averageRedrawTime,d=n.lastRedrawTime,h=[],g=n.cy.extent(),p=n.getPixelRatio();for(l||n.flushRenderedStyleQueue();;){var y=$t(),b=y-f,m=y-v;if(d<mo){var w=mo-(l?c:0);if(m>=e.deqFastCost*w)break}else if(l){if(b>=e.deqCost*d||b>=e.deqAvgCost*c)break}else if(m>=e.deqNoDrawCost*mo)break;var T=e.deq(a,p,g);if(T.length>0)for(var C=0;C<T.length;C++)h.push(T[C]);else break}h.length>0&&(e.onDeqd(a,h),!l&&e.shouldRedraw(a,h,p,g)&&i())},s=e.priority||Qo;n.beforeRender(o,s(a))}}}},Np=(function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yn;lr(this,t),this.idsByKey=new Ht,this.keyForId=new Ht,this.cachesByLvl=new Ht,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return vr(t,[{key:"getIdsFor",value:function(r){r==null&&He("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new Jr,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id();return this.keyForId.get(a)!==this.getKey(r)}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,i=a.get(r);return i||(i=new Ht,a.set(r,i),n.push(r)),i}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id());return this.getCache(n,a)}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var i=this.getKey(r);this.setCache(i,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}])})(),Ll=25,en=50,cn=-4,_o=3,Cf=7.99,zp=8,Fp=1024,Vp=1024,qp=1024,_p=.2,Gp=.8,Hp=10,$p=.15,Wp=.1,Up=.9,Kp=.9,Yp=100,Xp=1,Gr={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Zp=vt({getKey:null,doesEleInvalidateKey:yn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:vv,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),da=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=Zp(r);ge(a,n),a.lookup=new Np(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},et=da.prototype;et.reasons=Gr;et.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};et.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{};return r[t]=r[t]||[]};et.getElementQueue=function(){var t=this;return t.eleCacheQueue=t.eleCacheQueue||new Ia(function(e,r){return r.reqs-e.reqs})};et.getElementKeyToQueue=function(){var t=this;return t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{}};et.getElement=function(t,e,r,a,n){var i=this,o=this.renderer,s=o.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(jo(s*r))),a<cn)a=cn;else if(s>=Cf||a>_o)return null;var l=Math.pow(2,a),v=e.h*l,f=e.w*l,c=o.eleTextBiggerThanMin(t,l);if(!this.isVisible(t,c))return null;var d=u.get(t,a);if(d&&d.invalidated&&(d.invalidated=!1,d.texture.invalidatedWidth-=d.width),d)return d;var h;if(v<=Ll?h=Ll:v<=en?h=en:h=Math.ceil(v/en)*en,v>qp||f>Vp)return null;var g=i.getTextureQueue(h),p=g[g.length-2],y=function(){return i.recycleTexture(h,f)||i.addTexture(h,f)};p||(p=g[g.length-1]),p||(p=y()),p.width-p.usedWidth<f&&(p=y());for(var b=function(L){return L&&L.scaledLabelShown===c},m=n&&n===Gr.dequeue,w=n&&n===Gr.highQuality,T=n&&n===Gr.downscale,C,x=a+1;x<=_o;x++){var S=u.get(t,x);if(S){C=S;break}}var D=C&&C.level===a+1?C:null,E=function(){p.context.drawImage(D.texture.canvas,D.x,0,D.width,D.height,p.usedWidth,0,f,v)};if(p.context.setTransform(1,0,0,1,0,0),p.context.clearRect(p.usedWidth,0,f,h),b(D))E();else if(b(C))if(w){for(var B=C.level;B>a;B--)D=i.getElement(t,e,r,B,Gr.downscale);E()}else return i.queueElement(t,C.level-1),C;else{var A;if(!m&&!w&&!T)for(var P=a-1;P>=cn;P--){var M=u.get(t,P);if(M){A=M;break}}if(b(A))return i.queueElement(t,a),A;p.context.translate(p.usedWidth,0),p.context.scale(l,l),this.drawElement(p.context,t,e,c,!1),p.context.scale(1/l,1/l),p.context.translate(-p.usedWidth,0)}return d={x:p.usedWidth,texture:p,level:a,scale:l,width:f,height:v,scaledLabelShown:c},p.usedWidth+=Math.ceil(f+zp),p.eleCaches.push(d),u.set(t,a,d),i.checkTextureFullness(p),d};et.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};et.invalidateElement=function(t){var e=this,r=e.lookup,a=[];if(r.isInvalid(t)){for(var n=cn;n<=_o;n++){var i=r.getForCachedKey(t,n);i&&a.push(i)}if(r.invalidate(t))for(var o=0;o<a.length;o++){var s=a[o],u=s.texture;u.invalidatedWidth+=s.width,s.invalidated=!0,e.checkTextureUtility(u)}e.removeFromQueue(t)}};et.checkTextureUtility=function(t){t.invalidatedWidth>=_p*t.width&&this.retireTexture(t)};et.checkTextureFullness=function(t){var e=this.getTextureQueue(t.height);t.usedWidth/t.width>Gp&&t.fullnessChecks>=Hp?nr(e,t):t.fullnessChecks++};et.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;nr(a,t),t.retired=!0;for(var i=t.eleCaches,o=0;o<i.length;o++){var s=i[o];n.deleteCache(s.key,s.level)}Jo(i),e.getRetiredTextureQueue(r).push(t)};et.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),n={};return a.push(n),n.eleCaches=[],n.height=t,n.width=Math.max(Fp,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=r.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n};et.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),n=r.getRetiredTextureQueue(t),i=0;i<n.length;i++){var o=n[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Jo(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),nr(n,o),a.push(o),o}};et.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),o=n[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,a.updateItem(o);else{var s={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(s),n[i]=s}};et.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,o=0;o<Xp&&r.size()>0;o++){var s=r.pop(),u=s.key,l=s.eles[0],v=i.hasCache(l,s.level);if(a[u]=null,v)continue;n.push(s);var f=e.getBoundingBox(l);e.getElement(l,f,t,s.level,Gr.dequeue)}return n};et.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=Zo,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))};et.onDequeue=function(t){this.onDequeues.push(t)};et.offDequeue=function(t){nr(this.onDequeues,t)};et.setupDequeueing=Ef.setupDequeueing({deqRedrawThreshold:Yp,deqCost:$p,deqAvgCost:Wp,deqNoDrawCost:Up,deqFastCost:Kp,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(r)}},shouldRedraw:function(e,r,a,n){for(var i=0;i<r.length;i++)for(var o=r[i].eles,s=0;s<o.length;s++)if(ts(o[s].boundingBox(),n))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Qp=1,ya=-4,kn=2,Jp=3.99,jp=50,ey=50,ty=.15,ry=.1,ay=.9,ny=.9,iy=1,Il=250,oy=4e3*4e3,Ol=32767,sy=!0,Tf=function(e){var r=this,a=r.renderer=e,n=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=$t()-2*Il,r.skipping=!1,r.eleTxrDeqs=n.collection(),r.scheduleElementRefinement=La(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},ey),a.beforeRender(function(i,o){o-r.lastInvalidationTime<=Il?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip),r.layersQueue=new Ia(function(o,s){return s.reqs-o.reqs}),r.setupDequeueing()},ft=Tf.prototype,Nl=0,uy=Math.pow(2,53)-1;ft.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),n=Math.ceil(t.h*r),i=this.renderer.makeOffscreenCanvas(a,n),o={id:Nl=++Nl%uy,bb:t,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,u=-o.bb.x1,l=-o.bb.y1;return s.scale(r,r),s.translate(u,l),o};ft.getLayers=function(t,e,r){var a=this,n=a.renderer.cy.zoom(),i=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil(jo(n*e)),r<ya)r=ya;else if(n>=Jp||r>kn)return null}a.validateLayersElesOrdering(r,t);var o=a.layersByLevel,s=Math.pow(2,r),u=o[r]=o[r]||[],l,v=a.levelIsComplete(r,t),f,c=function(){var S=function(P){if(a.validateLayersElesOrdering(P,t),a.levelIsComplete(P,t))return f=o[P],!0},D=function(P){if(!f)for(var M=r+P;ya<=M&&M<=kn&&!S(M);M+=P);};D(1),D(-1);for(var E=u.length-1;E>=0;E--){var B=u[E];B.invalid&&nr(u,B)}};if(!v)c();else return u;var d=function(){if(!l){l=mt();for(var S=0;S<t.length;S++)xh(l,t[S].boundingBox())}return l},h=function(S){S=S||{};var D=S.after;d();var E=Math.ceil(l.w*s),B=Math.ceil(l.h*s);if(E>Ol||B>Ol||E*B>oy)return null;var A=a.makeLayer(l,r);if(D!=null){var P=u.indexOf(D)+1;u.splice(P,0,A)}else(S.insert===void 0||S.insert)&&u.unshift(A);return A};if(a.skipping&&!i)return null;for(var g=null,p=t.length/Qp,y=!i,b=0;b<t.length;b++){var m=t[b],w=m._private.rscratch,T=w.imgLayerCaches=w.imgLayerCaches||{},C=T[r];if(C){g=C;continue}if((!g||g.eles.length>=p||!pv(g.bb,m.boundingBox()))&&(g=h({insert:!0,after:g}),!g))return null;f||y?a.queueLayer(g,m):a.drawEleInLayer(g,m,r,e),g.eles.push(m),T[r]=g}return f||(y?null:u)};ft.getEleLevelForLayerLevel=function(t,e){return t};ft.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,o=t.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,r,sy),i.setImgSmoothing(o,!0))};ft.levelIsComplete=function(t,e){var r=this.layersByLevel[t];if(!r||r.length===0)return!1;for(var a=0,n=0;n<r.length;n++){var i=r[n];if(i.reqs>0||i.invalid)return!1;a+=i.eles.length}return a===e.length};ft.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var n=r[a],i=-1,o=0;o<e.length;o++)if(n.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(n);continue}for(var s=i,o=0;o<n.eles.length;o++)if(n.eles[o]!==e[s+o]){this.invalidateLayer(n);break}}};ft.updateElementsInLayers=function(t,e){for(var r=this,a=Pa(t[0]),n=0;n<t.length;n++)for(var i=a?null:t[n],o=a?t[n]:t[n].ele,s=o._private.rscratch,u=s.imgLayerCaches=s.imgLayerCaches||{},l=ya;l<=kn;l++){var v=u[l];v&&(i&&r.getEleLevelForLayerLevel(v.level)!==i.level||e(v,o,i))}};ft.haveLayers=function(){for(var t=this,e=!1,r=ya;r<=kn;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e};ft.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=$t(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))};ft.invalidateLayer=function(t){if(this.lastInvalidationTime=$t(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];nr(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var n=0;n<r.length;n++){var i=r[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};ft.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,n,i){var o=a.replacement;if(o||(o=a.replacement=e.makeLayer(a.bb,a.level),o.replaces=a,o.eles=a.eles),!o.reqs)for(var s=0;s<o.eles.length;s++)e.queueLayer(o,o.eles[s])})};ft.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};ft.queueLayer=function(t,e){var r=this.layersQueue,a=t.elesQueue,n=a.hasId=a.hasId||{};if(!t.replacement){if(e){if(n[e.id()])return;a.push(e),n[e.id()]=!0}t.reqs?(t.reqs++,r.updateItem(t)):(t.reqs=1,r.push(t))}};ft.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],n=0;n<iy&&r.size()!==0;){var i=r.peek();if(i.replacement){r.pop();continue}if(i.replaces&&i!==i.replaces.replacement){r.pop();continue}if(i.invalid){r.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,t),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(r.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a};ft.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,n=r.indexOf(a);if(!(n<0||a.invalid)){r[n]=t;for(var i=0;i<t.eles.length;i++){var o=t.eles[i]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[t.level]=t)}e.requestRedraw()}};ft.requestRedraw=La(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);ft.setupDequeueing=Ef.setupDequeueing({deqRedrawThreshold:jp,deqCost:ty,deqAvgCost:ry,deqNoDrawCost:ay,deqFastCost:ny,deq:function(e,r){return e.dequeue(r)},onDeqd:Qo,shouldRedraw:vv,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Sf={},zl;function ly(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function vy(t,e,r){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function Fl(t,e,r){t.beginPath&&t.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];t.lineTo(i.x,i.y)}var o=r,s=r[0];t.moveTo(s.x,s.y);for(var n=1;n<o.length;n++){var i=o[n];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function fy(t,e,r,a,n){t.beginPath&&t.beginPath(),t.arc(r,a,n,0,Math.PI*2,!1);var i=e,o=i[0];t.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var u=i[s];t.lineTo(u.x,u.y)}t.closePath&&t.closePath()}function cy(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}Sf.arrowShapeImpl=function(t){return(zl||(zl={polygon:ly,"triangle-backcurve":vy,"triangle-tee":Fl,"circle-triangle":fy,"triangle-cross":Fl,circle:cy}))[t]};var _t={};_t.drawElement=function(t,e,r,a,n,i){var o=this;e.isNode()?o.drawNode(t,e,r,a,n,i):o.drawEdge(t,e,r,a,n,i)};_t.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};_t.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};_t.drawCachedElementPortion=function(t,e,r,a,n,i,o,s){var u=this,l=r.getBoundingBox(e);if(!(l.w===0||l.h===0)){var v=r.getElement(e,l,a,n,i);if(v!=null){var f=s(u,e);if(f===0)return;var c=o(u,e),d=l.x1,h=l.y1,g=l.w,p=l.h,y,b,m,w,T;if(c!==0){var C=r.getRotationPoint(e);m=C.x,w=C.y,t.translate(m,w),t.rotate(c),T=u.getImgSmoothing(t),T||u.setImgSmoothing(t,!0);var x=r.getRotationOffset(e);y=x.x,b=x.y}else y=d,b=h;var S;f!==1&&(S=t.globalAlpha,t.globalAlpha=S*f),t.drawImage(v.texture.canvas,v.x,0,v.width,v.height,y,b,g,p),f!==1&&(t.globalAlpha=S),c!==0&&(t.rotate(-c),t.translate(-m,-w),T||u.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var hy=function(){return 0},dy=function(e,r){return e.getTextAngle(r,null)},gy=function(e,r){return e.getTextAngle(r,"source")},py=function(e,r){return e.getTextAngle(r,"target")},yy=function(e,r){return r.effectiveOpacity()},bo=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};_t.drawCachedElement=function(t,e,r,a,n,i){var o=this,s=o.data,u=s.eleTxrCache,l=s.lblTxrCache,v=s.slbTxrCache,f=s.tlbTxrCache,c=e.boundingBox(),d=i===!0?u.reasons.highQuality:null;if(!(c.w===0||c.h===0||!e.visible())&&(!a||ts(c,a))){var h=e.isEdge(),g=e.element()._private.rscratch.badLine;o.drawElementUnderlay(t,e),o.drawCachedElementPortion(t,e,u,r,n,d,hy,yy),(!h||!g)&&o.drawCachedElementPortion(t,e,l,r,n,d,dy,bo),h&&!g&&(o.drawCachedElementPortion(t,e,v,r,n,d,gy,bo),o.drawCachedElementPortion(t,e,f,r,n,d,py,bo)),o.drawElementOverlay(t,e)}};_t.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var n=e[a];r.drawElement(t,n)}};_t.drawCachedElements=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];n.drawCachedElement(t,o,r,a)}};_t.drawCachedNodes=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&n.drawCachedElement(t,o,r,a)}};_t.drawLayeredElements=function(t,e,r,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,r);if(i)for(var o=0;o<i.length;o++){var s=i[o],u=s.bb;u.w===0||u.h===0||t.drawImage(s.canvas,u.x1,u.y1,u.w,u.h)}else n.drawCachedElements(t,e,r,a)};var Kt={};Kt.drawEdge=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var u;r&&(u=r,t.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,v=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,d=e.pstyle("width").pfValue,h=e.pstyle("line-cap").value,g=e.pstyle("line-outline-width").value,p=e.pstyle("line-outline-color").value,y=l*v,b=l*v,m=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;f==="straight-triangle"?(o.eleStrokeStyle(t,e,P),o.drawEdgeTrianglePath(e,t,s.allpts)):(t.lineWidth=d,t.lineCap=h,o.eleStrokeStyle(t,e,P),o.drawEdgePath(e,t,s.allpts,c),t.lineCap="butt")},w=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;if(t.lineWidth=d+g,t.lineCap=h,g>0)o.colorStrokeStyle(t,p[0],p[1],p[2],P);else{t.lineCap="butt";return}f==="straight-triangle"?o.drawEdgeTrianglePath(e,t,s.allpts):(o.drawEdgePath(e,t,s.allpts,c),t.lineCap="butt")},T=function(){n&&o.drawEdgeOverlay(t,e)},C=function(){n&&o.drawEdgeUnderlay(t,e)},x=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;o.drawArrowheads(t,e,P)},S=function(){o.drawElementText(t,e,null,a)};if(t.lineJoin="round",e.pstyle("ghost").value==="yes"){var D=e.pstyle("ghost-offset-x").pfValue,E=e.pstyle("ghost-offset-y").pfValue,B=y*e.pstyle("ghost-opacity").value;t.translate(D,E),m(B),x(B),t.translate(-D,-E)}else w();C(),m(),x(),T(),S(),r&&t.translate(u.x1,u.y1)}};var Df=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,o=i.usePaths(),s=a._private.rscratch,u=2*a.pstyle("".concat(e,"-padding")).pfValue,l=a.pstyle("".concat(e,"-color")).value;r.lineWidth=u,s.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,l[0],l[1],l[2],n),i.drawEdgePath(a,r,s.allpts,"solid")}}}};Kt.drawEdgeOverlay=Df("overlay");Kt.drawEdgeUnderlay=Df("underlay");Kt.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,o,s=!1,u=this.usePaths(),l=t.pstyle("line-dash-pattern").pfValue,v=t.pstyle("line-dash-offset").pfValue;if(u){var f=r.join("$");n.pathCacheKey&&n.pathCacheKey===f?(o=e=n.pathCache,s=!0):(o=e=new Path2D,n.pathCacheKey=f,n.pathCache=o)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=v;break;case"solid":i.setLineDash([]);break}if(!s&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var c=2;c+3<r.length;c+=4)e.quadraticCurveTo(r[c],r[c+1],r[c+2],r[c+3]);break;case"straight":case"haystack":for(var d=2;d+1<r.length;d+=2)e.lineTo(r[d],r[d+1]);break;case"segments":if(n.isRound){var h=Ct(n.roundCorners),g;try{for(h.s();!(g=h.n()).done;){var p=g.value;hf(e,p)}}catch(b){h.e(b)}finally{h.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var y=2;y+1<r.length;y+=2)e.lineTo(r[y],r[y+1]);break}e=i,u?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};Kt.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,n=0;n+1<r.length;n+=2){var i=[r[n+2]-r[n],r[n+3]-r[n+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],u=[s[0]*a/2,s[1]*a/2];e.beginPath(),e.moveTo(r[n]-u[0],r[n+1]-u[1]),e.lineTo(r[n]+u[0],r[n+1]+u[1]),e.lineTo(r[n+2],r[n+3]),e.closePath(),e.fill()}};Kt.drawArrowheads=function(t,e,r){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),n||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)};Kt.drawArrowhead=function(t,e,r,a,n,i,o){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var s=this,u=e.pstyle(r+"-arrow-shape").value;if(u!=="none"){var l=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",v=e.pstyle(r+"-arrow-fill").value,f=e.pstyle("width").pfValue,c=e.pstyle(r+"-arrow-width"),d=c.value==="match-line"?f:c.pfValue;c.units==="%"&&(d*=f);var h=e.pstyle("opacity").value;o===void 0&&(o=h);var g=t.globalCompositeOperation;(o!==1||v==="hollow")&&(t.globalCompositeOperation="destination-out",s.colorFillStyle(t,255,255,255,1),s.colorStrokeStyle(t,255,255,255,1),s.drawArrowShape(e,t,l,f,u,d,a,n,i),t.globalCompositeOperation=g);var p=e.pstyle(r+"-arrow-color").value;s.colorFillStyle(t,p[0],p[1],p[2],o),s.colorStrokeStyle(t,p[0],p[1],p[2],o),s.drawArrowShape(e,t,v,f,u,d,a,n,i)}}};Kt.drawArrowShape=function(t,e,r,a,n,i,o,s,u){var l=this,v=this.usePaths()&&n!=="triangle-cross",f=!1,c,d=e,h={x:o,y:s},g=t.pstyle("arrow-scale").value,p=this.getArrowWidth(a,g),y=l.arrowShapes[n];if(v){var b=l.arrowPathCache=l.arrowPathCache||[],m=Er(n),w=b[m];w!=null?(c=e=w,f=!0):(c=e=new Path2D,b[m]=c)}f||(e.beginPath&&e.beginPath(),v?y.draw(e,1,0,{x:0,y:0},1):y.draw(e,p,u,h,a),e.closePath&&e.closePath()),e=d,v&&(e.translate(o,s),e.rotate(u),e.scale(p,p)),(r==="filled"||r==="both")&&(v?e.fill(c):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=i/(v?p:1),e.lineJoin="miter",v?e.stroke(c):e.stroke()),v&&(e.scale(1/p,1/p),e.rotate(-u),e.translate(-o,-s))};var gs={};gs.safeDrawImage=function(t,e,r,a,n,i,o,s,u,l){if(!(n<=0||i<=0||u<=0||l<=0))try{t.drawImage(e,r,a,n,i,o,s,u,l)}catch(v){Ie(v)}};gs.drawInscribedImage=function(t,e,r,a,n){var i=this,o=r.position(),s=o.x,u=o.y,l=r.cy().style(),v=l.getIndexedStyle.bind(l),f=v(r,"background-fit","value",a),c=v(r,"background-repeat","value",a),d=r.width(),h=r.height(),g=r.padding()*2,p=d+(v(r,"background-width-relative-to","value",a)==="inner"?0:g),y=h+(v(r,"background-height-relative-to","value",a)==="inner"?0:g),b=r._private.rscratch,m=v(r,"background-clip","value",a)==="node",w=v(r,"background-image-opacity","value",a)*n,T=v(r,"background-image-smoothing","value",a),C=r.pstyle("corner-radius").value;C!=="auto"&&(C=r.pstyle("corner-radius").pfValue);var x=e.width||e.cachedW,S=e.height||e.cachedH;(x==null||S==null)&&(document.body.appendChild(e),x=e.cachedW=e.width||e.offsetWidth,S=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var D=x,E=S;if(v(r,"background-width","value",a)!=="auto"&&(v(r,"background-width","units",a)==="%"?D=v(r,"background-width","pfValue",a)*p:D=v(r,"background-width","pfValue",a)),v(r,"background-height","value",a)!=="auto"&&(v(r,"background-height","units",a)==="%"?E=v(r,"background-height","pfValue",a)*y:E=v(r,"background-height","pfValue",a)),!(D===0||E===0)){if(f==="contain"){var B=Math.min(p/D,y/E);D*=B,E*=B}else if(f==="cover"){var B=Math.max(p/D,y/E);D*=B,E*=B}var A=s-p/2,P=v(r,"background-position-x","units",a),M=v(r,"background-position-x","pfValue",a);P==="%"?A+=(p-D)*M:A+=M;var R=v(r,"background-offset-x","units",a),L=v(r,"background-offset-x","pfValue",a);R==="%"?A+=(p-D)*L:A+=L;var I=u-y/2,F=v(r,"background-position-y","units",a),_=v(r,"background-position-y","pfValue",a);F==="%"?I+=(y-E)*_:I+=_;var N=v(r,"background-offset-y","units",a),G=v(r,"background-offset-y","pfValue",a);N==="%"?I+=(y-E)*G:I+=G,b.pathCache&&(A-=s,I-=u,s=0,u=0);var Z=t.globalAlpha;t.globalAlpha=w;var W=i.getImgSmoothing(t),$=!1;T==="no"&&W?(i.setImgSmoothing(t,!1),$=!0):T==="yes"&&!W&&(i.setImgSmoothing(t,!0),$=!0),c==="no-repeat"?(m&&(t.save(),b.pathCache?t.clip(b.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,s,u,p,y,C,b),t.clip())),i.safeDrawImage(t,e,0,0,x,S,A,I,D,E),m&&t.restore()):(t.fillStyle=t.createPattern(e,c),i.nodeShapes[i.getNodeShape(r)].draw(t,s,u,p,y,C,b),t.translate(A,I),t.fill(),t.translate(-A,-I)),t.globalAlpha=Z,$&&i.setImgSmoothing(t,W)}};var Pr={};Pr.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(jo(r*a));e=Math.pow(2,n)}return!(t.pstyle("font-size").pfValue*e<t.pstyle("min-zoomed-font-size").pfValue)};Pr.drawElementText=function(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(e),l=e.pstyle("text-metrics").strValue==="glyph";t.textAlign=u,t.textBaseline=l?"alphabetic":"bottom"}else{var v=e.element()._private.rscratch.badLine,f=e.pstyle("label"),c=e.pstyle("source-label"),d=e.pstyle("target-label");if(v||(!f||!f.value)&&(!c||!c.value)&&(!d||!d.value))return;t.textAlign="center",t.textBaseline="bottom"}var h=!r,g;r&&(g=r,t.translate(-g.x1,-g.y1)),n==null?(o.drawText(t,e,null,h,i),e.isEdge()&&(o.drawText(t,e,"source",h,i),o.drawText(t,e,"target",h,i))):o.drawText(t,e,n,h,i),r&&t.translate(g.x1,g.y1)};Pr.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};Pr.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*s,l=e.pstyle("color").value,v=e.pstyle("text-outline-color").value;t.font=a+" "+o+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,l[0],l[1],l[2],s),this.colorStrokeStyle(t,v[0],v[1],v[2],u)};function my(t,e,r,a,n){var i=Math.min(a,n)/2,o=e+a/2,s=r+n/2;t.beginPath(),t.arc(o,s,i,0,Math.PI*2),t.closePath()}function Vl(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(i,a/2,n/2);t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+a-o,r),t.quadraticCurveTo(e+a,r,e+a,r+o),t.lineTo(e+a,r+n-o),t.quadraticCurveTo(e+a,r+n,e+a-o,r+n),t.lineTo(e+o,r+n),t.quadraticCurveTo(e,r+n,e,r+n-o),t.lineTo(e,r+o),t.quadraticCurveTo(e,r,e+o,r),t.closePath()}Pr.getTextAngle=function(t,e){var r,a=t._private.rscratch,n=e?e+"-":"",i=t.pstyle(n+"text-rotation");if(i.strValue==="autorotate"){var o=yt(a,"labelAngle",e);r=t.isEdge()?o:0}else i.strValue==="none"?r=0:r=i.pfValue;return r};Pr.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var s=yt(i,"labelX",r),u=yt(i,"labelY",r),l,v,f=this.getLabelText(e,r);if(f!=null&&f!==""&&!isNaN(s)&&!isNaN(u)){this.setupTextStyle(t,e,n);var c=r?r+"-":"",d=yt(i,"labelWidth",r),h=yt(i,"labelHeight",r),g=yt(i,"labelActualDescent",r),p=e.pstyle(c+"text-margin-x").pfValue,y=e.pstyle(c+"text-margin-y").pfValue,b=e.isEdge(),m=e.pstyle("text-halign").value,w=e.pstyle("text-valign").value;b&&(m="center",w="center"),s+=p,u+=y;var T;a?T=this.getTextAngle(e,r):T=0,T!==0&&(l=s,v=u,t.translate(l,v),t.rotate(T),s=0,u=0);var C=Zr(m),x=Qr(w);switch(x){case"top":break;case"center":u+=h/2;break;case"bottom":u+=h;break}var S=e.pstyle("text-background-opacity").value,D=e.pstyle("text-border-opacity").value,E=e.pstyle("text-border-width").pfValue,B=e.pstyle("text-background-padding").pfValue,A=e.pstyle("text-background-shape").strValue,P=A==="round-rectangle"||A==="roundrectangle",M=A==="circle",R=2;if(S>0||E>0&&D>0){var L=t.fillStyle,I=t.strokeStyle,F=t.lineWidth,_=e.pstyle("text-background-color").value,N=e.pstyle("text-border-color").value,G=e.pstyle("text-border-style").value,Z=S>0,W=E>0&&D>0,$=s-B;switch(C){case"left":$-=d;break;case"center":$-=d/2;break}var Y=u-h-B,te=d+2*B,J=h+2*B;if(Z&&(t.fillStyle="rgba(".concat(_[0],",").concat(_[1],",").concat(_[2],",").concat(S*o,")")),W&&(t.strokeStyle="rgba(".concat(N[0],",").concat(N[1],",").concat(N[2],",").concat(D*o,")"),t.lineWidth=E,t.setLineDash))switch(G){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=E/4,t.setLineDash([]);break;default:t.setLineDash([]);break}if(P?(t.beginPath(),Vl(t,$,Y,te,J,R)):M?(t.beginPath(),my(t,$,Y,te,J)):(t.beginPath(),t.rect($,Y,te,J)),Z&&t.fill(),W&&t.stroke(),W&&G==="double"){var X=E/2;t.beginPath(),P?Vl(t,$+X,Y+X,te-2*X,J-2*X,R):t.rect($+X,Y+X,te-2*X,J-2*X),t.stroke()}t.fillStyle=L,t.strokeStyle=I,t.lineWidth=F,t.setLineDash&&t.setLineDash([])}var O=2*e.pstyle("text-outline-width").pfValue;if(O>0&&(t.lineWidth=O),u-=g,e.pstyle("text-wrap").value==="wrap"){var V=yt(i,"labelWrapCachedLines",r),q=yt(i,"labelLineHeight",r),j=d/2,ue=this.getLabelJustification(e);switch(ue==="auto"||(C==="left"?ue==="left"?s+=-d:ue==="center"&&(s+=-j):C==="center"?ue==="left"?s+=-j:ue==="right"&&(s+=j):C==="right"&&(ue==="center"?s+=j:ue==="right"&&(s+=d))),x){case"top":u-=(V.length-1)*q;break;case"center":case"bottom":u-=(V.length-1)*q;break}for(var we=0;we<V.length;we++)O>0&&t.strokeText(V[we],s,u),t.fillText(V[we],s,u),u+=q}else O>0&&t.strokeText(f,s,u),t.fillText(f,s,u);T!==0&&(t.rotate(-T),t.translate(-l,-v))}}};var cr={};cr.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,u,l=e._private,v=l.rscratch,f=e.position();if(!(!re(f.x)||!re(f.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,d=o.usePaths(),h,g=!1,p=e.padding();s=e.width()+2*p,u=e.height()+2*p;var y;r&&(y=r,t.translate(-y.x1,-y.y1));for(var b=e.pstyle("background-image").value,m=new Array(b.length),w=new Array(b.length),T=0,C=0;C<b.length;C++){var x=b[C];if(m[C]=x!=null&&x!=="none"){var S=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",C);T++,w[C]=o.getCachedImage(x,S,function(){l.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var D=e.pstyle("background-blacken").value,E=e.pstyle("border-width").pfValue,B=e.pstyle("background-opacity").value*c,A=e.pstyle("border-color").value,P=e.pstyle("border-style").value,M=e.pstyle("border-join").value,R=e.pstyle("border-cap").value,L=e.pstyle("border-position").value,I=e.pstyle("border-dash-pattern").pfValue,F=e.pstyle("border-dash-offset").pfValue,_=e.pstyle("border-opacity").value*c,N=e.pstyle("outline-width").pfValue,G=e.pstyle("outline-color").value,Z=e.pstyle("outline-style").value,W=e.pstyle("outline-opacity").value*c,$=e.pstyle("outline-offset").value,Y=e.pstyle("corner-radius").value;Y!=="auto"&&(Y=e.pstyle("corner-radius").pfValue);var te=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B;o.eleFillStyle(t,e,ie)},J=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;o.colorStrokeStyle(t,A[0],A[1],A[2],ie)},X=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:W;o.colorStrokeStyle(t,G[0],G[1],G[2],ie)},O=function(ie,xe,U,k){var z=o.nodePathCache=o.nodePathCache||[],H=lv(U==="polygon"?U+","+k.join(","):U,""+xe,""+ie,""+Y),Q=z[H],K,ee=!1;return Q!=null?(K=Q,ee=!0,v.pathCache=K):(K=new Path2D,z[H]=v.pathCache=K),{path:K,cacheHit:ee}},V=e.pstyle("shape").strValue,q=e.pstyle("shape-polygon-points").pfValue;if(d){t.translate(f.x,f.y);var j=O(s,u,V,q);h=j.path,g=j.cacheHit}var ue=function(){if(!g){var ie=f;d&&(ie={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(h||t,ie.x,ie.y,s,u,Y,v)}d?t.fill(h):t.fill()},we=function(){for(var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,U=l.backgrounding,k=0,z=0;z<w.length;z++){var H=e.cy().style().getIndexedStyle(e,"background-image-containment","value",z);if(xe&&H==="over"||!xe&&H==="inside"){k++;continue}m[z]&&w[z].complete&&!w[z].error&&(k++,o.drawInscribedImage(t,w[z],e,z,ie))}l.backgrounding=k!==T,U!==l.backgrounding&&e.updateStyle(!1)},be=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasPie(e)&&(o.drawPie(t,e,xe),ie&&(d||o.nodeShapes[o.getNodeShape(e)].draw(t,f.x,f.y,s,u,Y,v)))},ke=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasStripe(e)&&(t.save(),d?t.clip(v.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,f.x,f.y,s,u,Y,v),t.clip()),o.drawStripe(t,e,xe),t.restore(),ie&&(d||o.nodeShapes[o.getNodeShape(e)].draw(t,f.x,f.y,s,u,Y,v)))},le=function(){var ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,xe=(D>0?D:-D)*ie,U=D>0?0:255;D!==0&&(o.colorFillStyle(t,U,U,U,xe),d?t.fill(h):t.fill())},ae=function(){if(E>0){if(t.lineWidth=E,t.lineCap=R,t.lineJoin=M,t.setLineDash)switch(P){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(I),t.lineDashOffset=F;break;case"solid":case"double":t.setLineDash([]);break}if(L!=="center"){if(t.save(),t.lineWidth*=2,L==="inside")d?t.clip(h):t.clip();else{var ie=new Path2D;ie.rect(-s/2-E,-u/2-E,s+2*E,u+2*E),ie.addPath(h),t.clip(ie,"evenodd")}d?t.stroke(h):t.stroke(),t.restore()}else d?t.stroke(h):t.stroke();if(P==="double"){t.lineWidth=E/3;var xe=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",d?t.stroke(h):t.stroke(),t.globalCompositeOperation=xe}t.setLineDash&&t.setLineDash([])}},fe=function(){if(N>0){if(t.lineWidth=N,t.lineCap="butt",t.setLineDash)switch(Z){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var ie=f;d&&(ie={x:0,y:0});var xe=o.getNodeShape(e),U=E;L==="inside"&&(U=0),L==="outside"&&(U*=2);var k=(s+U+(N+$))/s,z=(u+U+(N+$))/u,H=s*k,Q=u*z,K=o.nodeShapes[xe].points,ee;if(d&&(ee=O(H,Q,xe,K).path),xe==="ellipse")o.drawEllipsePath(ee||t,ie.x,ie.y,H,Q);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(xe)){var ne=0,de=0,oe=0;xe==="round-diamond"?ne=(U+$+N)*1.4:xe==="round-heptagon"?(ne=(U+$+N)*1.075,oe=-(U/2+$+N)/35):xe==="round-hexagon"?ne=(U+$+N)*1.12:xe==="round-pentagon"?(ne=(U+$+N)*1.13,oe=-(U/2+$+N)/15):xe==="round-tag"?(ne=(U+$+N)*1.12,de=(U/2+N+$)*.07):xe==="round-triangle"&&(ne=(U+$+N)*(Math.PI/2),oe=-(U+$/2+N)/Math.PI),ne!==0&&(k=(s+ne)/s,H=s*k,["round-hexagon","round-tag"].includes(xe)||(z=(u+ne)/u,Q=u*z)),Y=Y==="auto"?bv(H,Q):Y;for(var Se=H/2,Fe=Q/2,ve=Y+(U+N+$)/2,ye=new Array(K.length/2),Ve=new Array(K.length/2),De=0;De<K.length/2;De++)ye[De]={x:ie.x+de+Se*K[De*2],y:ie.y+oe+Fe*K[De*2+1]};var $e,Ze,it,Ue,tt=ye.length;for(Ze=ye[tt-1],$e=0;$e<tt;$e++)it=ye[$e%tt],Ue=ye[($e+1)%tt],Ve[$e]=hs(Ze,it,Ue,ve),Ze=it,it=Ue;o.drawRoundPolygonPath(ee||t,ie.x+de,ie.y+oe,s*k,u*z,K,Ve)}else if(["roundrectangle","round-rectangle"].includes(xe))Y=Y==="auto"?ir(H,Q):Y,o.drawRoundRectanglePath(ee||t,ie.x,ie.y,H,Q,Y+(U+N+$)/2);else if(["cutrectangle","cut-rectangle"].includes(xe))Y=Y==="auto"?rs():Y,o.drawCutRectanglePath(ee||t,ie.x,ie.y,H,Q,null,Y+(U+N+$)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(xe))Y=Y==="auto"?ir(H,Q):Y,o.drawBottomRoundRectanglePath(ee||t,ie.x,ie.y,H,Q,Y+(U+N+$)/2);else if(xe==="barrel")o.drawBarrelPath(ee||t,ie.x,ie.y,H,Q);else if(xe.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(xe)){var ot=(U+N+$)/s;K=mn(bn(K,ot)),o.drawPolygonPath(ee||t,ie.x,ie.y,s,u,K)}else{var st=(U+N+$)/s;K=mn(bn(K,-st)),o.drawPolygonPath(ee||t,ie.x,ie.y,s,u,K)}if(d?t.stroke(ee):t.stroke(),Z==="double"){t.lineWidth=U/3;var dr=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",d?t.stroke(ee):t.stroke(),t.globalCompositeOperation=dr}t.setLineDash&&t.setLineDash([])}},pe=function(){n&&o.drawNodeOverlay(t,e,f,s,u)},me=function(){n&&o.drawNodeUnderlay(t,e,f,s,u)},ce=function(){o.drawElementText(t,e,null,a)};if(e.pstyle("ghost").value==="yes"){var Ce=e.pstyle("ghost-offset-x").pfValue,Be=e.pstyle("ghost-offset-y").pfValue,Pe=e.pstyle("ghost-opacity").value,Ne=Pe*c;t.translate(Ce,Be),X(),fe(),te(Pe*B),ue(),we(Ne,!0),J(Pe*_),ae(),be(D!==0||E!==0),ke(D!==0||E!==0),we(Ne,!1),le(Ne),t.translate(-Ce,-Be)}d&&t.translate(-f.x,-f.y),me(),d&&t.translate(f.x,f.y),X(),fe(),te(),ue(),we(c,!0),J(),ae(),be(D!==0||E!==0),ke(D!==0||E!==0),we(c,!1),le(),d&&t.translate(-f.x,-f.y),ce(),pe(),r&&t.translate(y.x1,y.y1)}};var kf=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,o){var s=this;if(a.visible()){var u=a.pstyle("".concat(e,"-padding")).pfValue,l=a.pstyle("".concat(e,"-opacity")).value,v=a.pstyle("".concat(e,"-color")).value,f=a.pstyle("".concat(e,"-shape")).value,c=a.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(n=n||a.position(),i==null||o==null){var d=a.padding();i=a.width()+2*d,o=a.height()+2*d}s.colorFillStyle(r,v[0],v[1],v[2],l),s.nodeShapes[f].draw(r,n.x,n.y,i+u*2,o+u*2,c),r.fill()}}}};cr.drawNodeOverlay=kf("overlay");cr.drawNodeUnderlay=kf("underlay");cr.hasPie=function(t){return t=t[0],t._private.hasPie};cr.hasStripe=function(t){return t=t[0],t._private.hasStripe};cr.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),s=e.pstyle("pie-start-angle").pfValue,u=a.x,l=a.y,v=e.width(),f=e.height(),c=Math.min(v,f)/2,d,h=0;if(this.usePaths()&&(u=0,l=0),i.units==="%"?c=c*i.pfValue:i.pfValue!==void 0&&(c=i.pfValue/2),o.units==="%"?d=c*o.pfValue:o.pfValue!==void 0&&(d=o.pfValue/2),!(d>=c))for(var g=1;g<=n.pieBackgroundN;g++){var p=e.pstyle("pie-"+g+"-background-size").value,y=e.pstyle("pie-"+g+"-background-color").value,b=e.pstyle("pie-"+g+"-background-opacity").value*r,m=p/100;m+h>1&&(m=1-h);var w=1.5*Math.PI+2*Math.PI*h;w+=s;var T=2*Math.PI*m,C=w+T;p===0||h>=1||h+m>1||(d===0?(t.beginPath(),t.moveTo(u,l),t.arc(u,l,c,w,C),t.closePath()):(t.beginPath(),t.arc(u,l,c,w,C),t.arc(u,l,d,C,w,!0),t.closePath()),this.colorFillStyle(t,y[0],y[1],y[2],b),t.fill(),h+=m)}};cr.drawStripe=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,o=a.y,s=e.width(),u=e.height(),l=0,v=this.usePaths();t.save();var f=e.pstyle("stripe-direction").value,c=e.pstyle("stripe-size");switch(f){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var d=s,h=u;c.units==="%"?(d=d*c.pfValue,h=h*c.pfValue):c.pfValue!==void 0&&(d=c.pfValue,h=c.pfValue),v&&(i=0,o=0),o-=d/2,i-=h/2;for(var g=1;g<=n.stripeBackgroundN;g++){var p=e.pstyle("stripe-"+g+"-background-size").value,y=e.pstyle("stripe-"+g+"-background-color").value,b=e.pstyle("stripe-"+g+"-background-opacity").value*r,m=p/100;m+l>1&&(m=1-l),!(p===0||l>=1||l+m>1)&&(t.beginPath(),t.rect(i,o+h*l,d,h*m),t.closePath(),this.colorFillStyle(t,y[0],y[1],y[2],b),t.fill(),l+=m)}t.restore()};var bt={},by=100;bt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r};bt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a};bt.createGradientStyleFor=function(t,e,r,a,n){var i,o=this.usePaths(),s=r.pstyle(e+"-gradient-stop-colors").value,u=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var l=r.sourceEndpoint(),v=r.targetEndpoint(),f=r.midpoint(),c=Cr(l,f),d=Cr(v,f);i=t.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(c,d))}else{var h=o?{x:0,y:0}:r.position(),g=r.paddedWidth(),p=r.paddedHeight();i=t.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(g,p))}else if(r.isEdge()){var y=r.sourceEndpoint(),b=r.targetEndpoint();i=t.createLinearGradient(y.x,y.y,b.x,b.y)}else{var m=o?{x:0,y:0}:r.position(),w=r.paddedWidth(),T=r.paddedHeight(),C=w/2,x=T/2;switch(r.pstyle("background-gradient-direction").value){case"to-bottom":i=t.createLinearGradient(m.x,m.y-x,m.x,m.y+x);break;case"to-top":i=t.createLinearGradient(m.x,m.y+x,m.x,m.y-x);break;case"to-left":i=t.createLinearGradient(m.x+C,m.y,m.x-C,m.y);break;case"to-right":i=t.createLinearGradient(m.x-C,m.y,m.x+C,m.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(m.x-C,m.y-x,m.x+C,m.y+x);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(m.x-C,m.y+x,m.x+C,m.y-x);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(m.x+C,m.y-x,m.x-C,m.y+x);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(m.x+C,m.y+x,m.x-C,m.y-x);break}}if(!i)return null;for(var S=u.length===s.length,D=s.length,E=0;E<D;E++)i.addColorStop(S?u[E]:E/(D-1),"rgba("+s[E][0]+","+s[E][1]+","+s[E][2]+","+n+")");return i};bt.gradientFillStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"background",e,r,a);if(!n)return null;t.fillStyle=n};bt.colorFillStyle=function(t,e,r,a,n){t.fillStyle="rgba("+e+","+r+","+a+","+n+")"};bt.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var n=e.pstyle("background-color").value;this.colorFillStyle(t,n[0],n[1],n[2],r)}};bt.gradientStrokeStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"line",e,r,a);if(!n)return null;t.strokeStyle=n};bt.colorStrokeStyle=function(t,e,r,a,n){t.strokeStyle="rgba("+e+","+r+","+a+","+n+")"};bt.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(t,n[0],n[1],n[2],r)}};bt.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],o=e.getPixelRatio(),s=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var u=n*o,l=i*o,v;if(!(u===e.canvasWidth&&l===e.canvasHeight)){e.fontCaches=null;var f=r.canvasContainer;f.style.width=n+"px",f.style.height=i+"px";for(var c=0;c<e.CANVAS_LAYERS;c++)v=r.canvases[c],v.width=u,v.height=l,v.style.width=n+"px",v.style.height=i+"px";for(var c=0;c<e.BUFFER_COUNT;c++)v=r.bufferCanvases[c],v.width=u,v.height=l,v.style.width=n+"px",v.style.height=i+"px";e.textureMult=1,o<=1&&(v=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,v.width=u*e.textureMult,v.height=l*e.textureMult),e.canvasWidth=u,e.canvasHeight=l,e.pixelRatio=o}};bt.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})};bt.clearCanvas=function(){var t=this,e=t.data;function r(a){a.clearRect(0,0,t.canvasWidth,t.canvasHeight)}r(e.contexts[t.NODE]),r(e.contexts[t.DRAG])};bt.render=function(t){var e=this;t=t||hv();var r=e.cy,a=t.forcedContext,n=t.drawAllLayers,i=t.drawOnlyNodeLayer,o=t.forcedZoom,s=t.forcedPan,u=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,l=e.data,v=l.canvasNeedsRedraw,f=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),c=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,d=e.motionBlurPxRatio,h=r.hasCompoundNodes(),g=e.hoverData.draggingEles,p=!!(e.hoverData.selecting||e.touchData.selecting);c=c&&!a&&e.motionBlurEnabled&&!p;var y=c;a||(e.prevPxRatio!==u&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=u),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),c&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(y=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!f&&(v[e.NODE]=!0,v[e.SELECT_BOX]=!0);var b=r.style(),m=r.zoom(),w=o!==void 0?o:m,T=r.pan(),C={x:T.x,y:T.y},x={zoom:m,pan:{x:T.x,y:T.y}},S=e.prevViewport;!(S===void 0||x.zoom!==S.zoom||x.pan.x!==S.pan.x||x.pan.y!==S.pan.y)&&!(g&&!h)&&(e.motionBlurPxRatio=1),s&&(C=s),w*=u,C.x*=u,C.y*=u;var D=e.getCachedZSortedEles();function E(J,X,O,V,q){var j=J.globalCompositeOperation;J.globalCompositeOperation="destination-out",e.colorFillStyle(J,255,255,255,e.motionBlurTransparency),J.fillRect(X,O,V,q),J.globalCompositeOperation=j}function B(J,X){var O,V,q,j;!e.clearingMotionBlur&&(J===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||J===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(O={x:T.x*d,y:T.y*d},V=m*d,q=e.canvasWidth*d,j=e.canvasHeight*d):(O=C,V=w,q=e.canvasWidth,j=e.canvasHeight),J.setTransform(1,0,0,1,0,0),X==="motionBlur"?E(J,0,0,q,j):!a&&(X===void 0||X)&&J.clearRect(0,0,q,j),n||(J.translate(O.x,O.y),J.scale(V,V)),s&&J.translate(s.x,s.y),o&&J.scale(o,o)}if(f||(e.textureDrawLastFrame=!1),f){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var A=e.data.bufferContexts[e.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var x=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}v[e.DRAG]=!1,v[e.NODE]=!1;var P=l.contexts[e.NODE],M=e.textureCache.texture,x=e.textureCache.viewport;P.setTransform(1,0,0,1,0,0),c?E(P,0,0,x.width,x.height):P.clearRect(0,0,x.width,x.height);var R=b.core("outside-texture-bg-color").value,L=b.core("outside-texture-bg-opacity").value;e.colorFillStyle(P,R[0],R[1],R[2],L),P.fillRect(0,0,x.width,x.height);var m=r.zoom();B(P,!1),P.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u),P.drawImage(M,x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u)}else e.textureOnViewport&&!a&&(e.textureCache=null);var I=r.extent(),F=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),_=e.hideEdgesOnViewport&&F,N=[];if(N[e.NODE]=!v[e.NODE]&&c&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,N[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),N[e.DRAG]=!v[e.DRAG]&&c&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,N[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),v[e.NODE]||n||i||N[e.NODE]){var G=c&&!N[e.NODE]&&d!==1,P=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]);B(P,c&&!G?"motionBlur":void 0),_?e.drawCachedNodes(P,D.nondrag,u,I):e.drawLayeredElements(P,D.nondrag,u,I),e.debug&&e.drawDebugPoints(P,D.nondrag),!n&&!c&&(v[e.NODE]=!1)}if(!i&&(v[e.DRAG]||n||N[e.DRAG])){var G=c&&!N[e.DRAG]&&d!==1,P=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);B(P,c&&!G?"motionBlur":void 0),_?e.drawCachedNodes(P,D.drag,u,I):e.drawCachedElements(P,D.drag,u,I),e.debug&&e.drawDebugPoints(P,D.drag),!n&&!c&&(v[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,B),c&&d!==1){var Z=l.contexts[e.NODE],W=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],$=l.contexts[e.DRAG],Y=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],te=function(X,O,V){X.setTransform(1,0,0,1,0,0),V||!y?X.clearRect(0,0,e.canvasWidth,e.canvasHeight):E(X,0,0,e.canvasWidth,e.canvasHeight);var q=d;X.drawImage(O,0,0,e.canvasWidth*q,e.canvasHeight*q,0,0,e.canvasWidth,e.canvasHeight)};(v[e.NODE]||N[e.NODE])&&(te(Z,W,N[e.NODE]),v[e.NODE]=!1),(v[e.DRAG]||N[e.DRAG])&&(te($,Y,N[e.DRAG]),v[e.DRAG]=!1)}e.prevViewport=x,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),c&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!f,e.mbFrames=0,v[e.NODE]=!0,v[e.DRAG]=!0,e.redraw()},by)),a||r.emit("render")};var va;bt.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,n=r.data,i=a.style(),o=t.drawOnlyNodeLayer,s=t.drawAllLayers,u=n.canvasNeedsRedraw,l=t.forcedContext;if(r.showFps||!o&&u[r.SELECT_BOX]&&!s){var v=l||n.contexts[r.SELECT_BOX];if(e(v),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var f=r.cy.zoom(),c=i.core("selection-box-border-width").value/f;v.lineWidth=c,v.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",v.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),c>0&&(v.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",v.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(n.bgActivePosistion&&!r.hoverData.selecting){var f=r.cy.zoom(),d=n.bgActivePosistion;v.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",v.beginPath(),v.arc(d.x,d.y,i.core("active-bg-size").pfValue/f,0,2*Math.PI),v.fill()}var h=r.lastRedrawTime;if(r.showFps&&h){h=Math.round(h);var g=Math.round(1e3/h),p="1 frame = "+h+" ms = "+g+" fps";v.setTransform(1,0,0,1,0,0),v.fillStyle="rgba(255, 0, 0, 0.75)",v.strokeStyle="rgba(255, 0, 0, 0.75)",v.font="30px Arial",va||(va=v.measureText(p).actualBoundingBoxAscent),v.fillText(p,0,va);var y=60;v.strokeRect(0,va+10,250,20),v.fillRect(0,va+10,250*Math.min(g/y,1),20)}s||(u[r.SELECT_BOX]=!1)}};function ql(t,e,r){var a=t.createShader(e);if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(a));return a}function wy(t,e,r){var a=ql(t,t.VERTEX_SHADER,e),n=ql(t,t.FRAGMENT_SHADER,r),i=t.createProgram();if(t.attachShader(i,a),t.attachShader(i,n),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function xy(t,e,r){r===void 0&&(r=e);var a=t.makeOffscreenCanvas(e,r),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function ps(t){var e=t.pixelRatio,r=t.cy.zoom(),a=t.cy.pan();return{zoom:r*e,pan:{x:a.x*e,y:a.y*e}}}function Ey(t){var e=t.pixelRatio;return t.cy.zoom()*e}function Cy(t,e,r,a,n){var i=a*r+e.x,o=n*r+e.y;return o=Math.round(t.canvasHeight-o),[i,o]}function Ty(t,e){return e.picking?!0:t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function Sy(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function pr(t,e,r){var a=t[0]/255,n=t[1]/255,i=t[2]/255,o=e,s=r||new Array(4);return s[0]=a*o,s[1]=n*o,s[2]=i*o,s[3]=o,s}function Nr(t,e){var r=e||new Array(4);return r[0]=(t>>0&255)/255,r[1]=(t>>8&255)/255,r[2]=(t>>16&255)/255,r[3]=(t>>24&255)/255,r}function Dy(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function ky(t,e){var r=t.createTexture();return r.buffer=function(a){t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function Bf(t,e){switch(e){case"float":return[1,t.FLOAT,4];case"vec2":return[2,t.FLOAT,4];case"vec3":return[3,t.FLOAT,4];case"vec4":return[4,t.FLOAT,4];case"int":return[1,t.INT,4];case"ivec2":return[2,t.INT,4]}}function Pf(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function By(t,e,r,a,n,i){switch(e){case t.FLOAT:return new Float32Array(r.buffer,i*a,n);case t.INT:return new Int32Array(r.buffer,i*a,n)}}function Py(t,e,r,a){var n=Xe(Bf(t,e),2),i=n[0],o=n[1],s=Pf(t,o,a),u=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,s,t.STATIC_DRAW),o===t.FLOAT?t.vertexAttribPointer(r,i,o,!1,0,0):o===t.INT&&t.vertexAttribIPointer(r,i,o,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),u}function Ot(t,e,r,a){var n=Xe(Bf(t,r),3),i=n[0],o=n[1],s=n[2],u=Pf(t,o,e*i),l=i*s,v=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,v),t.bufferData(t.ARRAY_BUFFER,e*l,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),o===t.FLOAT?t.vertexAttribPointer(a,i,o,!1,l,0):o===t.INT&&t.vertexAttribIPointer(a,i,o,l,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var f=new Array(e),c=0;c<e;c++)f[c]=By(t,o,u,l,i,c);return v.dataArray=u,v.stride=l,v.size=i,v.getView=function(d){return f[d]},v.setPoint=function(d,h,g){var p=f[d];p[0]=h,p[1]=g},v.bufferSubData=function(d){t.bindBuffer(t.ARRAY_BUFFER,v),d?t.bufferSubData(t.ARRAY_BUFFER,0,u,0,d*i):t.bufferSubData(t.ARRAY_BUFFER,0,u)},v}function Ay(t,e,r){for(var a=9,n=new Float32Array(e*a),i=new Array(e),o=0;o<e;o++){var s=o*a*4;i[o]=new Float32Array(n.buffer,s,a)}var u=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,n.byteLength,t.DYNAMIC_DRAW);for(var l=0;l<3;l++){var v=r+l;t.enableVertexAttribArray(v),t.vertexAttribPointer(v,3,t.FLOAT,!1,36,l*12),t.vertexAttribDivisor(v,1)}return t.bindBuffer(t.ARRAY_BUFFER,null),u.getMatrixView=function(f){return i[f]},u.setData=function(f,c){i[c].set(f,0)},u.bufferSubData=function(){t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferSubData(t.ARRAY_BUFFER,0,n)},u}function Ry(t){var e=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,e);var r=t.createTexture();return t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.bindFramebuffer(t.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,n){t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,a,n,0,t.RGBA,t.UNSIGNED_BYTE,null)},e}var _l=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function wo(){var t=new _l(9);return _l!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Gl(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function My(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],v=e[7],f=e[8],c=r[0],d=r[1],h=r[2],g=r[3],p=r[4],y=r[5],b=r[6],m=r[7],w=r[8];return t[0]=c*a+d*o+h*l,t[1]=c*n+d*s+h*v,t[2]=c*i+d*u+h*f,t[3]=g*a+p*o+y*l,t[4]=g*n+p*s+y*v,t[5]=g*i+p*u+y*f,t[6]=b*a+m*o+w*l,t[7]=b*n+m*s+w*v,t[8]=b*i+m*u+w*f,t}function hn(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],v=e[7],f=e[8],c=r[0],d=r[1];return t[0]=a,t[1]=n,t[2]=i,t[3]=o,t[4]=s,t[5]=u,t[6]=c*a+d*o+l,t[7]=c*n+d*s+v,t[8]=c*i+d*u+f,t}function Hl(t,e,r){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],l=e[6],v=e[7],f=e[8],c=Math.sin(r),d=Math.cos(r);return t[0]=d*a+c*o,t[1]=d*n+c*s,t[2]=d*i+c*u,t[3]=d*o-c*a,t[4]=d*s-c*n,t[5]=d*u-c*i,t[6]=l,t[7]=v,t[8]=f,t}function Go(t,e,r){var a=r[0],n=r[1];return t[0]=a*e[0],t[1]=a*e[1],t[2]=a*e[2],t[3]=n*e[3],t[4]=n*e[4],t[5]=n*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function Ly(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}var Iy=(function(){function t(e,r,a,n){lr(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=r,this.texRows=a,this.texHeight=Math.floor(r/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=n(e,r,r),this.scratch=n(e,r,this.texHeight,"scratch")}return vr(t,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(r){var a=r.w,n=r.h,i=this.texHeight,o=this.texSize,s=i/n,u=a*s,l=n*s;return u>o&&(s=o/a,u=a*s,l=n*s),{scale:s,texW:u,texH:l}}},{key:"draw",value:function(r,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,s=this.texRows,u=this.texHeight,l=this.getScale(a),v=l.scale,f=l.texW,c=l.texH,d=function(m,w){if(n&&w){var T=w.context,C=m.x,x=m.row,S=C,D=u*x;T.save(),T.translate(S,D),T.scale(v,v),n(T,a),T.restore()}},h=[null,null],g=function(){d(i.freePointer,i.canvas),h[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:f,h:c},h[1]={x:i.freePointer.x+f,y:i.freePointer.row*u,w:0,h:c},i.freePointer.x+=f,i.freePointer.x==o&&(i.freePointer.x=0,i.freePointer.row++)},p=function(){var m=i.scratch,w=i.canvas;m.clear(),d({x:0,row:0},m);var T=o-i.freePointer.x,C=f-T,x=u,S=i.freePointer.x,D=i.freePointer.row*u,E=T;w.context.drawImage(m,0,0,E,x,S,D,E,x),h[0]={x:S,y:D,w:E,h:c};var B=T,A=(i.freePointer.row+1)*u,P=C;w&&w.context.drawImage(m,B,0,P,x,0,A,P,x),h[1]={x:0,y:A,w:P,h:c},i.freePointer.x=C,i.freePointer.row++},y=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+f<=o)g();else{if(this.freePointer.row>=s-1)return!1;this.freePointer.x===o?(y(),g()):this.enableWrapping?p():(y(),g())}return this.keyToLocation.set(r,h),this.needsBuffer=!0,h}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(r).texW;return this.freePointer.x+i>a?this.freePointer.row<n-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=ky(r,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])})(),Oy=(function(){function t(e,r,a,n){lr(this,t),this.r=e,this.texSize=r,this.texRows=a,this.createTextureCanvas=n,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return vr(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var r=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas;return new Iy(r,a,n,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas,o=Math.floor(a/n);this.scratch=i(r,a,o,"scratch")}return this.scratch}},{key:"draw",value:function(r,a,n){var i=this.styleKeyToAtlas.get(r);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(a))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(r,a,n),this.styleKeyToAtlas.set(r,i)),i}},{key:"getAtlas",value:function(r){return this.styleKeyToAtlas.get(r)}},{key:"hasAtlas",value:function(r){return this.styleKeyToAtlas.has(r)}},{key:"markKeyForGC",value:function(r){this.markedKeys.add(r)}},{key:"gc",value:function(){var r=this,a=this.markedKeys;if(a.size!==0){var n=[],i=new Map,o=null,s=Ct(this.atlases),u;try{var l=function(){var f=u.value,c=f.getKeys(),d=Ny(a,c);if(d.size===0)return n.push(f),c.forEach(function(w){return i.set(w,f)}),1;o||(o=r._createAtlas(),n.push(o));var h=Ct(c),g;try{for(h.s();!(g=h.n()).done;){var p=g.value;if(!d.has(p)){var y=Xe(f.getOffsets(p),2),b=y[0],m=y[1];o.canFit({w:b.w+m.w,h:b.h})||(o.lock(),o=r._createAtlas(),n.push(o)),f.canvas&&(r._copyTextureToNewAtlas(p,f,o),i.set(p,o))}}}catch(w){h.e(w)}finally{h.f()}f.dispose()};for(s.s();!(u=s.n()).done;)l()}catch(v){s.e(v)}finally{s.f()}this.atlases=n,this.styleKeyToAtlas=i,this.markedKeys=new Set}}},{key:"_copyTextureToNewAtlas",value:function(r,a,n){var i=Xe(a.getOffsets(r),2),o=i[0],s=i[1];if(s.w===0)n.draw(r,o,function(f){f.drawImage(a.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var u=this._getScratchCanvas();u.clear(),u.context.drawImage(a.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),u.context.drawImage(a.canvas,s.x,s.y,s.w,s.h,o.w,0,s.w,s.h);var l=o.w+s.w,v=o.h;n.draw(r,{w:l,h:v},function(f){f.drawImage(u,0,0,l,v,0,0,l,v)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])})();function Ny(t,e){return t.intersection?t.intersection(e):new Set(dn(t).filter(function(r){return e.has(r)}))}var zy=(function(){function t(e,r){lr(this,t),this.r=e,this.globalOptions=r,this.atlasSize=r.webglTexSize,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map}return vr(t,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(r,a){var n=this.globalOptions,i=n.webglTexSize,o=n.createTextureCanvas,s=a.texRows,u=this._cacheScratchCanvas(o),l=new Oy(this.r,i,s,u);this.collections.set(r,l)}},{key:"addRenderType",value:function(r,a){var n=a.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var i=ge({type:r,atlasCollection:this.collections.get(n)},a);this.renderTypes.set(r,i)}},{key:"getRenderTypeOpts",value:function(r){return this.renderTypes.get(r)}},{key:"getAtlasCollection",value:function(r){return this.collections.get(r)}},{key:"_cacheScratchCanvas",value:function(r){var a=-1,n=-1,i=null;return function(o,s,u,l){return l?((!i||s!=a||u!=n)&&(a=s,n=u,i=r(o,s,u)),i):r(o,s,u)}}},{key:"_key",value:function(r,a){return"".concat(r,"-").concat(a)}},{key:"invalidate",value:function(r){var a=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,o=i===void 0?!1:i,s=n.filterEle,u=s===void 0?function(){return!0}:s,l=n.filterType,v=l===void 0?function(){return!0}:l,f=!1,c=!1,d=Ct(r),h;try{for(d.s();!(h=d.n()).done;){var g=h.value;if(u(g)){var p=Ct(this.renderTypes.values()),y;try{var b=function(){var w=y.value,T=w.type;if(v(T)){var C=a.collections.get(w.collection),x=w.getKey(g),S=Array.isArray(x)?x:[x];if(o)S.forEach(function(A){return C.markKeyForGC(A)}),c=!0;else{var D=w.getID?w.getID(g):g.id(),E=a._key(T,D),B=a.typeAndIdToKey.get(E);B!==void 0&&!Sy(S,B)&&(f=!0,a.typeAndIdToKey.delete(E),B.forEach(function(A){return C.markKeyForGC(A)}))}}};for(p.s();!(y=p.n()).done;)b()}catch(m){p.e(m)}finally{p.f()}}}}catch(m){d.e(m)}finally{d.f()}return c&&(this.gc(),f=!1),f}},{key:"gc",value:function(){var r=Ct(this.collections.values()),a;try{for(r.s();!(a=r.n()).done;)a.value.gc()}catch(n){r.e(n)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,a,n,i){var o=this.renderTypes.get(a),s=this.collections.get(o.collection),u=!1,l=s.draw(i,n,function(c){o.drawClipped?(c.save(),c.beginPath(),c.rect(0,0,n.w,n.h),c.clip(),o.drawElement(c,r,n,!0,!0),c.restore()):o.drawElement(c,r,n,!0,!0),u=!0});if(u){var v=o.getID?o.getID(r):r.id(),f=this._key(a,v);this.typeAndIdToKey.has(f)?this.typeAndIdToKey.get(f).push(i):this.typeAndIdToKey.set(f,[i])}return l}},{key:"getAtlasInfo",value:function(r,a){var n=this,i=this.renderTypes.get(a),o=i.getKey(r);return(Array.isArray(o)?o:[o]).map(function(s){var u=i.getBoundingBox(r,s),l=n.getOrCreateAtlas(r,a,u,s),v=Xe(l.getOffsets(s),2),f=v[0];return{atlas:l,tex:f,tex1:f,tex2:v[1],bb:u}})}},{key:"getDebugInfo",value:function(){var r=[],a=Ct(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=Xe(n.value,2),o=i[0],s=i[1].getCounts(),u=s.keyCount,l=s.atlasCount;r.push({type:o,keyCount:u,atlasCount:l})}}catch(v){a.e(v)}finally{a.f()}return r}}])})(),Fy=(function(){function t(e){lr(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return vr(t,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(r,a){return a})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var a=this.batchAtlases.indexOf(r);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),a=this.batchAtlases.length-1}return a}}])})(),Vy=`
8
+ float circleSD(vec2 p, float r) {
9
+ return distance(vec2(0), p) - r; // signed distance
10
+ }
11
+ `,qy=`
12
+ float rectangleSD(vec2 p, vec2 b) {
13
+ vec2 d = abs(p)-b;
14
+ return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);
15
+ }
16
+ `,_y=`
17
+ float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {
18
+ cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;
19
+ cr.x = (p.y > 0.0) ? cr.x : cr.y;
20
+ vec2 q = abs(p) - b + cr.x;
21
+ return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;
22
+ }
23
+ `,Gy=`
24
+ float ellipseSD(vec2 p, vec2 ab) {
25
+ p = abs( p ); // symmetry
26
+
27
+ // find root with Newton solver
28
+ vec2 q = ab*(p-ab);
29
+ float w = (q.x<q.y)? 1.570796327 : 0.0;
30
+ for( int i=0; i<5; i++ ) {
31
+ vec2 cs = vec2(cos(w),sin(w));
32
+ vec2 u = ab*vec2( cs.x,cs.y);
33
+ vec2 v = ab*vec2(-cs.y,cs.x);
34
+ w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));
35
+ }
36
+
37
+ // compute final point and distance
38
+ float d = length(p-ab*vec2(cos(w),sin(w)));
39
+
40
+ // return signed distance
41
+ return (dot(p/ab,p/ab)>1.0) ? d : -d;
42
+ }
43
+ `,ma={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Bn={IGNORE:1,USE_BB:2},xo=0,$l=1,Wl=2,Eo=3,zr=4,tn=5,fa=6,ca=7,Hy=(function(){function t(e,r,a){lr(this,t),this.r=e,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=xy,this.atlasManager=new zy(e,a),this.batchManager=new Fy(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(ma.SCREEN),this.pickingProgram=this._createShaderProgram(ma.PICKING),this.vao=this._createVAO()}return vr(t,[{key:"addAtlasCollection",value:function(r,a){this.atlasManager.addAtlasCollection(r,a)}},{key:"addTextureAtlasRenderType",value:function(r,a){this.atlasManager.addRenderType(r,a)}},{key:"addSimpleShapeRenderType",value:function(r,a){this.simpleShapeOptions.set(r,a)}},{key:"invalidate",value:function(r){var a=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=this.atlasManager;return a?n.invalidate(r,{filterType:function(o){return o===a},forceRedraw:!0}):n.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var a=this.gl,n=`#version 300 es
44
+ precision highp float;
45
+
46
+ uniform mat3 uPanZoomMatrix;
47
+ uniform int uAtlasSize;
48
+
49
+ // instanced
50
+ in vec2 aPosition; // a vertex from the unit square
51
+
52
+ in mat3 aTransform; // used to transform verticies, eg into a bounding box
53
+ in int aVertType; // the type of thing we are rendering
54
+
55
+ // the z-index that is output when using picking mode
56
+ in vec4 aIndex;
57
+
58
+ // For textures
59
+ in int aAtlasId; // which shader unit/atlas to use
60
+ in vec4 aTex; // x/y/w/h of texture in atlas
61
+
62
+ // for edges
63
+ in vec4 aPointAPointB;
64
+ in vec4 aPointCPointD;
65
+ in vec2 aLineWidth; // also used for node border width
66
+
67
+ // simple shapes
68
+ in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]
69
+ in vec4 aColor; // also used for edges
70
+ in vec4 aBorderColor; // aLineWidth is used for border width
71
+
72
+ // output values passed to the fragment shader
73
+ out vec2 vTexCoord;
74
+ out vec4 vColor;
75
+ out vec2 vPosition;
76
+ // flat values are not interpolated
77
+ flat out int vAtlasId;
78
+ flat out int vVertType;
79
+ flat out vec2 vTopRight;
80
+ flat out vec2 vBotLeft;
81
+ flat out vec4 vCornerRadius;
82
+ flat out vec4 vBorderColor;
83
+ flat out vec2 vBorderWidth;
84
+ flat out vec4 vIndex;
85
+
86
+ void main(void) {
87
+ int vid = gl_VertexID;
88
+ vec2 position = aPosition; // TODO make this a vec3, simplifies some code below
89
+
90
+ if(aVertType == `.concat(xo,`) {
91
+ float texX = aTex.x; // texture coordinates
92
+ float texY = aTex.y;
93
+ float texW = aTex.z;
94
+ float texH = aTex.w;
95
+
96
+ if(vid == 1 || vid == 2 || vid == 4) {
97
+ texX += texW;
98
+ }
99
+ if(vid == 2 || vid == 4 || vid == 5) {
100
+ texY += texH;
101
+ }
102
+
103
+ float d = float(uAtlasSize);
104
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
105
+
106
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
107
+ }
108
+ else if(aVertType == `).concat(zr," || aVertType == ").concat(ca,`
109
+ || aVertType == `).concat(tn," || aVertType == ").concat(fa,`) { // simple shapes
110
+
111
+ // the bounding box is needed by the fragment shader
112
+ vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat
113
+ vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat
114
+ vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated
115
+
116
+ // calculations are done in the fragment shader, just pass these along
117
+ vColor = aColor;
118
+ vCornerRadius = aCornerRadius;
119
+ vBorderColor = aBorderColor;
120
+ vBorderWidth = aLineWidth;
121
+
122
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
123
+ }
124
+ else if(aVertType == `).concat($l,`) {
125
+ vec2 source = aPointAPointB.xy;
126
+ vec2 target = aPointAPointB.zw;
127
+
128
+ // adjust the geometry so that the line is centered on the edge
129
+ position.y = position.y - 0.5;
130
+
131
+ // stretch the unit square into a long skinny rectangle
132
+ vec2 xBasis = target - source;
133
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
134
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;
135
+
136
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
137
+ vColor = aColor;
138
+ }
139
+ else if(aVertType == `).concat(Wl,`) {
140
+ vec2 pointA = aPointAPointB.xy;
141
+ vec2 pointB = aPointAPointB.zw;
142
+ vec2 pointC = aPointCPointD.xy;
143
+ vec2 pointD = aPointCPointD.zw;
144
+
145
+ // adjust the geometry so that the line is centered on the edge
146
+ position.y = position.y - 0.5;
147
+
148
+ vec2 p0, p1, p2, pos;
149
+ if(position.x == 0.0) { // The left side of the unit square
150
+ p0 = pointA;
151
+ p1 = pointB;
152
+ p2 = pointC;
153
+ pos = position;
154
+ } else { // The right side of the unit square, use same approach but flip the geometry upside down
155
+ p0 = pointD;
156
+ p1 = pointC;
157
+ p2 = pointB;
158
+ pos = vec2(0.0, -position.y);
159
+ }
160
+
161
+ vec2 p01 = p1 - p0;
162
+ vec2 p12 = p2 - p1;
163
+ vec2 p21 = p1 - p2;
164
+
165
+ // Find the normal vector.
166
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
167
+ vec2 normal = vec2(-tangent.y, tangent.x);
168
+
169
+ // Find the vector perpendicular to p0 -> p1.
170
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
171
+
172
+ // Determine the bend direction.
173
+ float sigma = sign(dot(p01 + p21, normal));
174
+ float width = aLineWidth[0];
175
+
176
+ if(sign(pos.y) == -sigma) {
177
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
178
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
179
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
180
+ } else {
181
+ // This is a non-intersecting vertex. Treat it like a mitre join.
182
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
183
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
184
+ }
185
+
186
+ vColor = aColor;
187
+ }
188
+ else if(aVertType == `).concat(Eo,` && vid < 3) {
189
+ // massage the first triangle into an edge arrow
190
+ if(vid == 0)
191
+ position = vec2(-0.15, -0.3);
192
+ if(vid == 1)
193
+ position = vec2( 0.0, 0.0);
194
+ if(vid == 2)
195
+ position = vec2( 0.15, -0.3);
196
+
197
+ gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
198
+ vColor = aColor;
199
+ }
200
+ else {
201
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
202
+ }
203
+
204
+ vAtlasId = aAtlasId;
205
+ vVertType = aVertType;
206
+ vIndex = aIndex;
207
+ }
208
+ `),i=this.batchManager.getIndexArray(),o=wy(a,n,`#version 300 es
209
+ precision highp float;
210
+
211
+ // declare texture unit for each texture atlas in the batch
212
+ `.concat(i.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join(`
213
+ `),`
214
+
215
+ uniform vec4 uBGColor;
216
+ uniform float uZoom;
217
+
218
+ in vec2 vTexCoord;
219
+ in vec4 vColor;
220
+ in vec2 vPosition; // model coordinates
221
+
222
+ flat in int vAtlasId;
223
+ flat in vec4 vIndex;
224
+ flat in int vVertType;
225
+ flat in vec2 vTopRight;
226
+ flat in vec2 vBotLeft;
227
+ flat in vec4 vCornerRadius;
228
+ flat in vec4 vBorderColor;
229
+ flat in vec2 vBorderWidth;
230
+
231
+ out vec4 outColor;
232
+
233
+ `).concat(Vy,`
234
+ `).concat(qy,`
235
+ `).concat(_y,`
236
+ `).concat(Gy,`
237
+
238
+ vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha
239
+ return vec4(
240
+ top.rgb + (bot.rgb * (1.0 - top.a)),
241
+ top.a + (bot.a * (1.0 - top.a))
242
+ );
243
+ }
244
+
245
+ vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance
246
+ // scale to the zoom level so that borders don't look blurry when zoomed in
247
+ // note 1.5 is an aribitrary value chosen because it looks good
248
+ return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d)));
249
+ }
250
+
251
+ void main(void) {
252
+ if(vVertType == `).concat(xo,`) {
253
+ // look up the texel from the texture unit
254
+ `).concat(i.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join(`
255
+ else `),`
256
+ }
257
+ else if(vVertType == `).concat(Eo,`) {
258
+ // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';
259
+ outColor = blend(vColor, uBGColor);
260
+ outColor.a = 1.0; // make opaque, masks out line under arrow
261
+ }
262
+ else if(vVertType == `).concat(zr,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border
263
+ outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done
264
+ }
265
+ else if(vVertType == `).concat(zr," || vVertType == ").concat(ca,`
266
+ || vVertType == `).concat(tn," || vVertType == ").concat(fa,`) { // use SDF
267
+
268
+ float outerBorder = vBorderWidth[0];
269
+ float innerBorder = vBorderWidth[1];
270
+ float borderPadding = outerBorder * 2.0;
271
+ float w = vTopRight.x - vBotLeft.x - borderPadding;
272
+ float h = vTopRight.y - vBotLeft.y - borderPadding;
273
+ vec2 b = vec2(w/2.0, h/2.0); // half width, half height
274
+ vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center
275
+
276
+ float d; // signed distance
277
+ if(vVertType == `).concat(zr,`) {
278
+ d = rectangleSD(p, b);
279
+ } else if(vVertType == `).concat(ca,` && w == h) {
280
+ d = circleSD(p, b.x); // faster than ellipse
281
+ } else if(vVertType == `).concat(ca,`) {
282
+ d = ellipseSD(p, b);
283
+ } else {
284
+ d = roundRectangleSD(p, b, vCornerRadius.wzyx);
285
+ }
286
+
287
+ // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling
288
+ // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box
289
+ if(d > 0.0) {
290
+ if(d > outerBorder) {
291
+ discard;
292
+ } else {
293
+ outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);
294
+ }
295
+ } else {
296
+ if(d > innerBorder) {
297
+ vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;
298
+ vec4 innerBorderColor = blend(vBorderColor, vColor);
299
+ outColor = distInterp(innerBorderColor, outerColor, d);
300
+ }
301
+ else {
302
+ vec4 outerColor;
303
+ if(innerBorder == 0.0 && outerBorder == 0.0) {
304
+ outerColor = vec4(0);
305
+ } else if(innerBorder == 0.0) {
306
+ outerColor = vBorderColor;
307
+ } else {
308
+ outerColor = blend(vBorderColor, vColor);
309
+ }
310
+ outColor = distInterp(vColor, outerColor, d - innerBorder);
311
+ }
312
+ }
313
+ }
314
+ else {
315
+ outColor = vColor;
316
+ }
317
+
318
+ `).concat(r.picking?`if(outColor.a == 0.0) discard;
319
+ else outColor = vIndex;`:"",`
320
+ }
321
+ `));o.aPosition=a.getAttribLocation(o,"aPosition"),o.aIndex=a.getAttribLocation(o,"aIndex"),o.aVertType=a.getAttribLocation(o,"aVertType"),o.aTransform=a.getAttribLocation(o,"aTransform"),o.aAtlasId=a.getAttribLocation(o,"aAtlasId"),o.aTex=a.getAttribLocation(o,"aTex"),o.aPointAPointB=a.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=a.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=a.getAttribLocation(o,"aLineWidth"),o.aColor=a.getAttribLocation(o,"aColor"),o.aCornerRadius=a.getAttribLocation(o,"aCornerRadius"),o.aBorderColor=a.getAttribLocation(o,"aBorderColor"),o.uPanZoomMatrix=a.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=a.getUniformLocation(o,"uAtlasSize"),o.uBGColor=a.getUniformLocation(o,"uBGColor"),o.uZoom=a.getUniformLocation(o,"uZoom"),o.uTextures=[];for(var s=0;s<this.batchManager.getMaxAtlasesPerBatch();s++)o.uTextures.push(a.getUniformLocation(o,"uTexture".concat(s)));return o}},{key:"_createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=r.length/2;var a=this.maxInstances,n=this.gl,i=this.program,o=n.createVertexArray();return n.bindVertexArray(o),Py(n,"vec2",i.aPosition,r),this.transformBuffer=Ay(n,a,i.aTransform),this.indexBuffer=Ot(n,a,"vec4",i.aIndex),this.vertTypeBuffer=Ot(n,a,"int",i.aVertType),this.atlasIdBuffer=Ot(n,a,"int",i.aAtlasId),this.texBuffer=Ot(n,a,"vec4",i.aTex),this.pointAPointBBuffer=Ot(n,a,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Ot(n,a,"vec4",i.aPointCPointD),this.lineWidthBuffer=Ot(n,a,"vec2",i.aLineWidth),this.colorBuffer=Ot(n,a,"vec4",i.aColor),this.cornerRadiusBuffer=Ot(n,a,"vec4",i.aCornerRadius),this.borderColorBuffer=Ot(n,a,"vec4",i.aBorderColor),n.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return Jt(a,"Buffer")}).map(function(a){return r[a]})),this._buffers}},{key:"startFrame",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ma.SCREEN;this.panZoomMatrix=r,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(r,a){return r.visible()?a&&a.isVisible?a.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,a,n){var i=this.atlasManager,o=this.batchManager,s=i.getRenderTypeOpts(n);if(this._isVisible(r,s)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(r);if(u===Bn.IGNORE)return;if(u==Bn.USE_BB){this.drawPickingRectangle(r,a,n);return}}var l=Ct(i.getAtlasInfo(r,n)),v;try{for(l.s();!(v=l.n()).done;){var f=v.value,c=f.atlas,d=f.tex1,h=f.tex2;o.canAddToCurrentBatch(c)||this.endBatch();for(var g=o.getAtlasIndexForBatch(c),p=0,y=[[d,!0],[h,!1]];p<y.length;p++){var b=Xe(y[p],2),m=b[0],w=b[1];if(m.w!=0){var T=this.instanceCount;this.vertTypeBuffer.getView(T)[0]=xo,Nr(a,this.indexBuffer.getView(T));var C=this.atlasIdBuffer.getView(T);C[0]=g;var x=this.texBuffer.getView(T);x[0]=m.x,x[1]=m.y,x[2]=m.w,x[3]=m.h;var S=this.transformBuffer.getMatrixView(T);this.setTransformMatrix(r,S,s,f,w),this.instanceCount++,w||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(D){l.e(D)}finally{l.f()}}}},{key:"setTransformMatrix",value:function(r,a,n,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;if(n.shapeProps&&n.shapeProps.padding&&(s=r.pstyle(n.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,v=i.tex2,f=l.w/(l.w+v.w);o||(f=1-f);var c=this._getAdjustedBB(u,s,o,f);this._applyTransformMatrix(a,c,n,r)}else{var d=n.getBoundingBox(r),h=this._getAdjustedBB(d,s,!0,1);this._applyTransformMatrix(a,h,n,r)}}},{key:"_applyTransformMatrix",value:function(r,a,n,i){var o,s;Gl(r);var u=n.getRotation?n.getRotation(i):0;if(u!==0){var l=n.getRotationPoint(i),v=l.x,f=l.y;hn(r,r,[v,f]),Hl(r,r,u);var c=n.getRotationOffset(i);o=c.x+(a.xOffset||0),s=c.y+(a.yOffset||0)}else o=a.x1,s=a.y1;hn(r,r,[o,s]),Go(r,r,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(r,a,n,i){var o=r.x1,s=r.y1,u=r.w,l=r.h,v=r.yOffset;a&&(o-=a,s-=a,u+=2*a,l+=2*a);var f=0,c=u*i;return n&&i<1?u=c:!n&&i<1&&(f=u-c,o+=f,u=c),{x1:o,y1:s,w:u,h:l,xOffset:f,yOffset:v}}},{key:"drawPickingRectangle",value:function(r,a,n){var i=this.atlasManager.getRenderTypeOpts(n),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=zr,Nr(a,this.indexBuffer.getView(o)),pr([0,0,0],1,this.colorBuffer.getView(o));var s=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,s,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(r,i)){var o=i.shapeProps,s=this._getVertTypeForShape(r,o.shape);if(s===void 0||i.isSimple&&!i.isSimple(r,this.renderTarget)){this.drawTexture(r,a,n);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=s,s===tn||s===fa){var l=i.getBoundingBox(r),v=this._getCornerRadius(r,o.radius,l),f=this.cornerRadiusBuffer.getView(u);f[0]=v,f[1]=v,f[2]=v,f[3]=v,s===fa&&(f[0]=0,f[2]=0)}Nr(a,this.indexBuffer.getView(u));var c=this.renderTarget.picking?1:n==="node-body"?r.effectiveOpacity():1,d=this.renderTarget.picking?1:r.pstyle(o.opacity).value*c,h=r.pstyle(o.color).value;pr(h,d,this.colorBuffer.getView(u));var g=this.lineWidthBuffer.getView(u);if(g[0]=0,g[1]=0,o.border){var p=r.pstyle("border-width").value;if(p>0){var y=r.pstyle("border-color").value;pr(y,c*r.pstyle("border-opacity").value,this.borderColorBuffer.getView(u));var b=r.pstyle("border-position").value;if(b==="inside")g[0]=0,g[1]=-p;else if(b==="outside")g[0]=p,g[1]=0;else{var m=p/2;g[0]=m,g[1]=-m}}}var w=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(r,w,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,a){switch(r.pstyle(a).value){case"rectangle":return zr;case"ellipse":return ca;case"roundrectangle":case"round-rectangle":return tn;case"bottom-round-rectangle":return fa;default:return}}},{key:"_getCornerRadius",value:function(r,a,n){var i=n.w,o=n.h;if(r.pstyle(a).value==="auto")return ir(i,o);var s=r.pstyle(a).pfValue,u=i/2,l=o/2;return Math.min(s,l,u)}},{key:"drawEdgeArrow",value:function(r,a,n){if(r.visible()){var i=r._private.rscratch,o,s,u;if(n==="source"?(o=i.arrowStartX,s=i.arrowStartY,u=i.srcArrowAngle):(o=i.arrowEndX,s=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(s)||s==null||isNaN(u)||u==null)&&r.pstyle(n+"-arrow-shape").value!=="none"){var l=r.pstyle(n+"-arrow-color").value,v=r.pstyle("opacity").value*r.pstyle("line-opacity").value,f=r.pstyle("width").pfValue,c=r.pstyle("arrow-scale").value,d=this.r.getArrowWidth(f,c),h=this.instanceCount,g=this.transformBuffer.getMatrixView(h);Gl(g),hn(g,g,[o,s]),Go(g,g,[d,d]),Hl(g,g,u),this.vertTypeBuffer.getView(h)[0]=Eo,Nr(a,this.indexBuffer.getView(h)),pr(l,v,this.colorBuffer.getView(h)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(r,a){if(r.visible()){var n=this._getEdgePoints(r);if(n){var i=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,s=r.pstyle("width").pfValue,u=r.pstyle("line-color").value,l=i*o;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=$l,Nr(a,this.indexBuffer.getView(v)),pr(u,l,this.colorBuffer.getView(v));var f=this.lineWidthBuffer.getView(v);f[0]=s;var c=this.pointAPointBBuffer.getView(v);c[0]=n[0],c[1]=n[1],c[2]=n[2],c[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var d=0;d<n.length-2;d+=2){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=Wl,Nr(a,this.indexBuffer.getView(h)),pr(u,l,this.colorBuffer.getView(h));var g=this.lineWidthBuffer.getView(h);g[0]=s;var p=n[d-2],y=n[d-1],b=n[d],m=n[d+1],w=n[d+2],T=n[d+3],C=n[d+4],x=n[d+5];d==0&&(p=2*b-w+.001,y=2*m-T+.001),d==n.length-4&&(C=2*w-b+.001,x=2*T-m+.001);var S=this.pointAPointBBuffer.getView(h);S[0]=p,S[1]=y,S[2]=b,S[3]=m;var D=this.pointCPointDBuffer.getView(h);D[0]=w,D[1]=T,D[2]=C,D[3]=x,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var a=r._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var a=r._private.rscratch;if(this._isValidEdge(r)){var n=a.allpts;if(n.length==4)return n;var i=this._getNumSegments(r);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(r){return Math.min(Math.max(15,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,a){if(r.length==4)return r;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=r[0],n[1]=r[1];else if(i==a)n[i*2]=r[r.length-2],n[i*2+1]=r[r.length-1];else{var o=i/a;this._setCurvePoint(r,o,n,i*2)}return n}},{key:"_setCurvePoint",value:function(r,a,n,i){if(r.length<=2)n[i]=r[0],n[i+1]=r[1];else{for(var o=Array(r.length-2),s=0;s<o.length;s+=2){var u=(1-a)*r[s]+a*r[s+2],l=(1-a)*r[s+1]+a*r[s+3];o[s]=u,o[s+1]=l}return this._setCurvePoint(o,a,n,i)}}},{key:"endBatch",value:function(){var r=this.gl,a=this.vao,n=this.vertexCount,i=this.instanceCount;if(i!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(o),r.bindVertexArray(a);var s=Ct(this.buffers),u;try{for(s.s();!(u=s.n()).done;)u.value.bufferSubData(i)}catch(d){s.e(d)}finally{s.f()}for(var l=this.batchManager.getAtlases(),v=0;v<l.length;v++)l[v].bufferIfNeeded(r);for(var f=0;f<l.length;f++)r.activeTexture(r.TEXTURE0+f),r.bindTexture(r.TEXTURE_2D,l[f].texture),r.uniform1i(o.uTextures[f],f);r.uniform1f(o.uZoom,Ey(this.r)),r.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(o.uAtlasSize,this.batchManager.getAtlasSize());var c=pr(this.bgColor,1);r.uniform4fv(o.uBGColor,c),r.drawArraysInstanced(r.TRIANGLES,0,n,i),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:l.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var r=this.atlasManager.getDebugInfo(),a=r.reduce(function(o,s){return o+s.atlasCount},0),n=this.batchDebugInfo,i=n.reduce(function(o,s){return o+s.count},0);return{atlasInfo:r,totalAtlases:a,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:i}}}])})(),Af={};Af.initWebgl=function(t,e){var r=this,a=r.data.contexts[r.WEBGL];t.bgColor=$y(r),t.webglTexSize=Math.min(t.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,54),t.webglTexRowsNodes=Math.min(t.webglTexRowsNodes,54),t.webglBatchSize=Math.min(t.webglBatchSize,16384),t.webglTexPerBatch=Math.min(t.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),r.webglDebug=t.webglDebug,r.webglDebugShowAtlases=t.webglDebugShowAtlases,r.pickingFrameBuffer=Ry(a),r.pickingFrameBuffer.needsDraw=!0,r.drawing=new Hy(r,a,t);var n=function(f){return function(c){return r.getTextAngle(c,f)}},i=function(f){return function(c){var d=c.pstyle(f);return d&&d.value}},o=function(f){return function(c){return c.pstyle("".concat(f,"-opacity")).value>0}},s=function(f){return f.pstyle("text-events").strValue==="yes"?Bn.USE_BB:Bn.IGNORE},u=function(f){var c=f.position(),d=c.x,h=c.y,g=f.outerWidth(),p=f.outerHeight();return{w:g,h:p,x1:d-g/2,y1:h-p/2}};r.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:Ty,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:Co(e.getLabelKey,null),getBoundingBox:To(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:Co(e.getSourceLabelKey,"source"),getBoundingBox:To(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:Co(e.getTargetLabelKey,"target"),getBoundingBox:To(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=La(function(){r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(v,f){var c=!1;f&&f.length>0&&(c|=r.drawing.invalidate(f)),c&&l()}),Wy(r)};function $y(t){var e=t.cy.container();return rv(e&&e.style&&e.style.backgroundColor||"white")}function Rf(t,e){var r=t._private.rscratch;return yt(r,"labelWrapCachedLines",e)||[]}var Co=function(e,r){return function(a){var n=e(a),i=Rf(a,r);return i.length>1?i.map(function(o,s){return"".concat(n,"_").concat(s)}):n}},To=function(e,r){return function(a,n){var i=e(a);if(typeof n=="string"){var o=n.indexOf("_");if(o>0){var s=Number(n.substring(o+1)),u=Rf(a,r),l=i.h/u.length,v=l*s,f=i.y1+v;return{x1:i.x1,w:i.w,y1:f,h:l,yOffset:v}}}return i}};function Wy(t){var e=t.render;t.render=function(i){i=i||{};var o=t.cy;t.webgl&&(o.zoom()>Cf?(Uy(t),e.call(t,i)):(Ky(t),Lf(t,i,ma.SCREEN)))};var r=t.matchCanvasSize;t.matchCanvasSize=function(i){r.call(t,i),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0},t.findNearestElements=function(i,o,s,u){return jy(t,i,o)};var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.call(t),t.pickingFrameBuffer.needsDraw=!0};var n=t.notify;t.notify=function(i,o){n.call(t,i,o),i==="viewport"||i==="bounds"?t.pickingFrameBuffer.needsDraw=!0:i==="background"&&t.drawing.invalidate(o,{type:"node-body"})}}function Uy(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function Ky(t){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,t.canvasWidth,t.canvasHeight),a.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function Yy(t){var e=t.canvasWidth,r=t.canvasHeight,a=ps(t),n=a.pan,i=a.zoom,o=wo();hn(o,o,[n.x,n.y]),Go(o,o,[i,i]);var s=wo();Ly(s,e,r);var u=wo();return My(u,s,o),u}function Mf(t,e){var r=t.canvasWidth,a=t.canvasHeight,n=ps(t),i=n.pan,o=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(i.x,i.y),e.scale(o,o)}function Xy(t,e){t.drawSelectionRectangle(e,function(r){return Mf(t,r)})}function Zy(t){var e=t.data.contexts[t.NODE];e.save(),Mf(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function Qy(t){var e=function(n,i,o){for(var s=n.atlasManager.getAtlasCollection(i),u=t.data.contexts[t.NODE],l=s.atlases,v=0;v<l.length;v++){var f=l[v].canvas;if(f){var c=f.width,d=f.height,h=c*v,g=f.height*o,p=.4;u.save(),u.scale(p,p),u.drawImage(f,h,g),u.strokeStyle="black",u.rect(h,g,c,d),u.stroke(),u.restore()}}},r=0;e(t.drawing,"node",r++),e(t.drawing,"label",r++)}function Jy(t,e,r,a,n){var i,o,s,u,l=ps(t),v=l.pan,f=l.zoom,c=Xe(Cy(t,v,f,e,r),2),d=c[0],h=c[1],g=6;if(i=d-g/2,o=h-g/2,s=g,u=g,s===0||u===0)return[];var p=t.data.contexts[t.WEBGL];p.bindFramebuffer(p.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(p.viewport(0,0,p.canvas.width,p.canvas.height),Lf(t,null,ma.PICKING),t.pickingFrameBuffer.needsDraw=!1);var y=s*u,b=new Uint8Array(y*4);p.readPixels(i,o,s,u,p.RGBA,p.UNSIGNED_BYTE,b),p.bindFramebuffer(p.FRAMEBUFFER,null);for(var m=new Set,w=0;w<y;w++){var T=Dy(b.slice(w*4,w*4+4))-1;T>=0&&m.add(T)}return m}function jy(t,e,r){var a=Jy(t,e,r),n=t.getCachedZSortedEles(),i,o,s=Ct(a),u;try{for(s.s();!(u=s.n()).done;){var l=n[u.value];if(!i&&l.isNode()&&(i=l),!o&&l.isEdge()&&(o=l),i&&o)break}}catch(v){s.e(v)}finally{s.f()}return[i,o].filter(Boolean)}function So(t,e,r){var a=t.drawing;e+=1,r.isNode()?(a.drawNode(r,e,"node-underlay"),a.drawNode(r,e,"node-body"),a.drawTexture(r,e,"label"),a.drawNode(r,e,"node-overlay")):(a.drawEdgeLine(r,e),a.drawEdgeArrow(r,e,"source"),a.drawEdgeArrow(r,e,"target"),a.drawTexture(r,e,"label"),a.drawTexture(r,e,"edge-source-label"),a.drawTexture(r,e,"edge-target-label"))}function Lf(t,e,r){var a;t.webglDebug&&(a=performance.now());var n=t.drawing,i=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&Xy(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=t.data.contexts[t.WEBGL];r.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=Yy(t),u=t.getCachedZSortedEles();if(i=u.length,n.startFrame(s,r),r.screen){for(var l=0;l<u.nondrag.length;l++)So(t,l,u.nondrag[l]);for(var v=0;v<u.drag.length;v++)So(t,v,u.drag[v])}else if(r.picking)for(var f=0;f<u.length;f++)So(t,f,u[f]);n.endFrame(),r.screen&&t.webglDebugShowAtlases&&(Zy(t),Qy(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var c=performance.now(),d=!1,h=Math.ceil(c-a),g=n.getDebugInfo(),p=["".concat(i," elements"),"".concat(g.totalInstances," instances"),"".concat(g.batchCount," batches"),"".concat(g.totalAtlases," atlases"),"".concat(g.wrappedCount," wrapped textures"),"".concat(g.simpleCount," simple shapes")].join(", ");if(d)"WebGL (".concat(r.name,") - time ").concat(h,"ms, ").concat(p);else{"WebGL (".concat(r.name,") - frame time ").concat(h,"ms")," ".concat(p);var y=g.atlasInfo,b=Ct(y),m;try{for(b.s();!(m=b.n()).done;){var w=m.value;" ".concat(w.type,": ").concat(w.keyCount," keys, ").concat(w.atlasCount," atlases")}}catch(T){b.e(T)}finally{b.f()}}}t.data.gc&&(t.data.gc=!1,n.gc())}var hr={};hr.drawPolygonPath=function(t,e,r,a,n,i){var o=a/2,s=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+o*i[0],r+s*i[1]);for(var u=1;u<i.length/2;u++)t.lineTo(e+o*i[u*2],r+s*i[u*2+1]);t.closePath()};hr.drawRoundPolygonPath=function(t,e,r,a,n,i,o){o.forEach(function(s){return hf(t,s)}),t.closePath()};hr.drawRoundRectanglePath=function(t,e,r,a,n,i){var o=a/2,s=n/2,u=i==="auto"?ir(a,n):Math.min(i,s,o);t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.arcTo(e+o,r-s,e+o,r,u),t.arcTo(e+o,r+s,e,r+s,u),t.arcTo(e-o,r+s,e-o,r,u),t.arcTo(e-o,r-s,e,r-s,u),t.lineTo(e,r-s),t.closePath()};hr.drawBottomRoundRectanglePath=function(t,e,r,a,n,i){var o=a/2,s=n/2,u=i==="auto"?ir(a,n):i;t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.lineTo(e+o,r-s),t.lineTo(e+o,r),t.arcTo(e+o,r+s,e,r+s,u),t.arcTo(e-o,r+s,e-o,r,u),t.lineTo(e-o,r-s),t.lineTo(e,r-s),t.closePath()};hr.drawCutRectanglePath=function(t,e,r,a,n,i,o){var s=a/2,u=n/2,l=o==="auto"?rs():o;t.beginPath&&t.beginPath(),t.moveTo(e-s+l,r-u),t.lineTo(e+s-l,r-u),t.lineTo(e+s,r-u+l),t.lineTo(e+s,r+u-l),t.lineTo(e+s-l,r+u),t.lineTo(e-s+l,r+u),t.lineTo(e-s,r+u-l),t.lineTo(e-s,r-u+l),t.closePath()};hr.drawBarrelPath=function(t,e,r,a,n){var i=a/2,o=n/2,s=e-i,u=e+i,l=r-o,v=r+o,f=Bo(a,n),c=f.widthOffset,d=f.heightOffset,h=f.ctrlPtOffsetPct*c;t.beginPath&&t.beginPath(),t.moveTo(s,l+d),t.lineTo(s,v-d),t.quadraticCurveTo(s+h,v,s+c,v),t.lineTo(u-c,v),t.quadraticCurveTo(u-h,v,u,v-d),t.lineTo(u,l+d),t.quadraticCurveTo(u-h,l,u-c,l),t.lineTo(s+c,l),t.quadraticCurveTo(s+h,l,s,l+d),t.closePath()};var Ul=Math.sin(0),Kl=Math.cos(0),Ho={},$o={},If=Math.PI/40;for(var Fr=0*Math.PI;Fr<2*Math.PI;Fr+=If)Ho[Fr]=Math.sin(Fr),$o[Fr]=Math.cos(Fr);hr.drawEllipsePath=function(t,e,r,a,n){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,n/2,0,0,2*Math.PI);else for(var i,o,s=a/2,u=n/2,l=0*Math.PI;l<2*Math.PI;l+=If)i=e-s*Ho[l]*Ul+s*$o[l]*Kl,o=r+u*$o[l]*Ul+u*Ho[l]*Kl,l===0?t.moveTo(i,o):t.lineTo(i,o);t.closePath()};var Va={};Va.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};Va.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements().boundingBox(),a=this.findContainerClientCoords(),n=t.full?Math.ceil(r.w):a[2],i=t.full?Math.ceil(r.h):a[3],o=re(t.maxWidth)||re(t.maxHeight),s=this.getPixelRatio(),u=1;if(t.scale!==void 0)n*=t.scale,i*=t.scale,u=t.scale;else if(o){var l=1/0,v=1/0;re(t.maxWidth)&&(l=u*t.maxWidth/n),re(t.maxHeight)&&(v=u*t.maxHeight/i),u=Math.min(l,v),n*=u,i*=u}o||(n*=s,i*=s,u*=s);var f=document.createElement("canvas");f.width=n,f.height=i,f.style.width=n+"px",f.style.height=i+"px";var c=f.getContext("2d");if(n>0&&i>0){c.clearRect(0,0,n,i),c.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(t.full)c.translate(-r.x1*u,-r.y1*u),c.scale(u,u),this.drawElements(c,d),c.scale(1/u,1/u),c.translate(r.x1*u,r.y1*u);else{var h=e.pan(),g={x:h.x*u,y:h.y*u};u*=e.zoom(),c.translate(g.x,g.y),c.scale(u,u),this.drawElements(c,d),c.scale(1/u,1/u),c.translate(-g.x,-g.y)}t.bg&&(c.globalCompositeOperation="destination-over",c.fillStyle=t.bg,c.rect(0,0,n,i),c.fill())}return f};function em(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new Blob([a],{type:e})}function Yl(t){var e=t.indexOf(",");return t.substr(e+1)}function Of(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new jr(function(n,i){try{e.toBlob(function(o){o!=null?n(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(o){i(o)}});case"blob":return em(Yl(a()),r);case"base64":return Yl(a());default:return a()}}Va.png=function(t){return Of(t,this.bufferCanvasImage(t),"image/png")};Va.jpg=function(t){return Of(t,this.bufferCanvasImage(t),"image/jpeg")};var Nf={};Nf.nodeShapeImpl=function(t,e,r,a,n,i,o,s){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,n,i);case"polygon":return this.drawPolygonPath(e,r,a,n,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,n,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,n,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,n,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,n,i,s);case"barrel":return this.drawBarrelPath(e,r,a,n,i)}};var tm=zf,Te=zf.prototype;Te.CANVAS_LAYERS=3;Te.SELECT_BOX=0;Te.DRAG=1;Te.NODE=2;Te.WEBGL=3;Te.CANVAS_TYPES=["2d","2d","2d","webgl2"];Te.BUFFER_COUNT=3;Te.TEXTURE_BUFFER=0;Te.MOTIONBLUR_BUFFER_NODE=1;Te.MOTIONBLUR_BUFFER_DRAG=2;function zf(t){var e=this,r=e.cy.window().document;t.webgl&&(Te.CANVAS_LAYERS=e.CANVAS_LAYERS=4),e.data={canvases:new Array(Te.CANVAS_LAYERS),contexts:new Array(Te.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Te.CANVAS_LAYERS),bufferCanvases:new Array(Te.BUFFER_COUNT),bufferContexts:new Array(Te.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",n="rgba(0,0,0,0)";e.data.canvasContainer=r.createElement("div");var i=e.data.canvasContainer.style;e.data.canvasContainer.style[a]=n,i.position="relative",i.zIndex="0",i.overflow="hidden";var o=t.cy.container();o.appendChild(e.data.canvasContainer),o.style[a]=n;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};dc()&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var u=0;u<Te.CANVAS_LAYERS;u++){var l=e.data.canvases[u]=r.createElement("canvas"),v=Te.CANVAS_TYPES[u];e.data.contexts[u]=l.getContext(v),e.data.contexts[u]||He("Could not create canvas of type "+v),Object.keys(s).forEach(function(X){l.style[X]=s[X]}),l.style.position="absolute",l.setAttribute("data-id","layer"+u),l.style.zIndex=String(Te.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(l),e.data.canvasNeedsRedraw[u]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Te.NODE].setAttribute("data-id","layer"+Te.NODE+"-node"),e.data.canvases[Te.SELECT_BOX].setAttribute("data-id","layer"+Te.SELECT_BOX+"-selectbox"),e.data.canvases[Te.DRAG].setAttribute("data-id","layer"+Te.DRAG+"-drag"),e.data.canvases[Te.WEBGL]&&e.data.canvases[Te.WEBGL].setAttribute("data-id","layer"+Te.WEBGL+"-webgl");for(var u=0;u<Te.BUFFER_COUNT;u++)e.data.bufferCanvases[u]=r.createElement("canvas"),e.data.bufferContexts[u]=e.data.bufferCanvases[u].getContext("2d"),e.data.bufferCanvases[u].style.position="absolute",e.data.bufferCanvases[u].setAttribute("data-id","buffer"+u),e.data.bufferCanvases[u].style.zIndex=String(-u-1),e.data.bufferCanvases[u].style.visibility="hidden";e.pathsEnabled=!0;var f=mt(),c=function(O){return{x:(O.x1+O.x2)/2,y:(O.y1+O.y2)/2}},d=function(O){return{x:-O.w/2,y:-O.h/2}},h=function(O){var V=O[0]._private;return V.oldBackgroundTimestamp!==V.backgroundTimestamp},g=function(O){return O[0]._private.nodeKey},p=function(O){return O[0]._private.labelStyleKey},y=function(O){return O[0]._private.sourceLabelStyleKey},b=function(O){return O[0]._private.targetLabelStyleKey},m=function(O,V,q,j,ue){return e.drawElement(O,V,q,!1,!1,ue)},w=function(O,V,q,j,ue){return e.drawElementText(O,V,q,j,"main",ue)},T=function(O,V,q,j,ue){return e.drawElementText(O,V,q,j,"source",ue)},C=function(O,V,q,j,ue){return e.drawElementText(O,V,q,j,"target",ue)},x=function(O){return O.boundingBox(),O[0]._private.bodyBounds},S=function(O){return O.boundingBox(),O[0]._private.labelBounds.main||f},D=function(O){return O.boundingBox(),O[0]._private.labelBounds.source||f},E=function(O){return O.boundingBox(),O[0]._private.labelBounds.target||f},B=function(O,V){return V},A=function(O){return c(x(O))},P=function(O,V,q){var j=O?O+"-":"";return{x:V.x+q.pstyle(j+"text-margin-x").pfValue,y:V.y+q.pstyle(j+"text-margin-y").pfValue}},M=function(O,V,q){var j=O[0]._private.rscratch;return{x:j[V],y:j[q]}},R=function(O){return P("",M(O,"labelX","labelY"),O)},L=function(O){return P("source",M(O,"sourceLabelX","sourceLabelY"),O)},I=function(O){return P("target",M(O,"targetLabelX","targetLabelY"),O)},F=function(O){return d(x(O))},_=function(O){return d(D(O))},N=function(O){return d(E(O))},G=function(O){var V=S(O),q=d(S(O));if(O.isNode()){switch(Zr(O.pstyle("text-halign").value)){case"left":q.x=-V.w-(V.leftPad||0);break;case"right":q.x=-(V.rightPad||0);break}switch(Qr(O.pstyle("text-valign").value)){case"top":q.y=-V.h-(V.topPad||0);break;case"bottom":q.y=-(V.botPad||0);break}}return q},Z=e.data.eleTxrCache=new da(e,{getKey:g,doesEleInvalidateKey:h,drawElement:m,getBoundingBox:x,getRotationPoint:A,getRotationOffset:F,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),W=e.data.lblTxrCache=new da(e,{getKey:p,drawElement:w,getBoundingBox:S,getRotationPoint:R,getRotationOffset:G,isVisible:B}),$=e.data.slbTxrCache=new da(e,{getKey:y,drawElement:T,getBoundingBox:D,getRotationPoint:L,getRotationOffset:_,isVisible:B}),Y=e.data.tlbTxrCache=new da(e,{getKey:b,drawElement:C,getBoundingBox:E,getRotationPoint:I,getRotationOffset:N,isVisible:B}),te=e.data.lyrTxrCache=new Tf(e);e.onUpdateEleCalcs(function(O,V){Z.invalidateElements(V),W.invalidateElements(V),$.invalidateElements(V),Y.invalidateElements(V),te.invalidateElements(V);for(var q=0;q<V.length;q++){var j=V[q]._private;j.oldBackgroundTimestamp=j.backgroundTimestamp}});var J=function(O){for(var V=0;V<O.length;V++)te.enqueueElementRefinement(O[V].ele)};Z.onDequeue(J),W.onDequeue(J),$.onDequeue(J),Y.onDequeue(J),t.webgl&&e.initWebgl(t,{getStyleKey:g,getLabelKey:p,getSourceLabelKey:y,getTargetLabelKey:b,drawElement:m,drawLabel:w,drawSourceLabel:T,drawTargetLabel:C,getElementBox:x,getLabelBox:S,getSourceLabelBox:D,getTargetLabelBox:E,getElementRotationPoint:A,getElementRotationOffset:F,getLabelRotationPoint:R,getSourceLabelRotationPoint:L,getTargetLabelRotationPoint:I,getLabelRotationOffset:G,getSourceLabelRotationOffset:_,getTargetLabelRotationOffset:N})}Te.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[Te.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[Te.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[Te.SELECT_BOX]=e;break;case"gc":r.data.gc=!0;break}};var rm=typeof Path2D<"u";Te.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};Te.usePaths=function(){return rm&&this.pathsEnabled};Te.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};Te.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};Te.makeOffscreenCanvas=function(t,e){var r;return(typeof OffscreenCanvas>"u"?"undefined":je(OffscreenCanvas))!=="undefined"?r=new OffscreenCanvas(t,e):(r=this.cy.window().document.createElement("canvas"),r.width=t,r.height=e),r};[Sf,_t,Kt,gs,Pr,cr,bt,Af,hr,Va,Nf].forEach(function(t){ge(Te,t)});var am=[{type:"layout",extensions:Bp},{type:"renderer",extensions:[{name:"null",impl:vf},{name:"base",impl:xf},{name:"canvas",impl:tm}]}],Ff={},Vf={};function qf(t,e,r){var a=r,n=function(x){Ie("Can not register `"+e+"` for `"+t+"` since `"+x+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(Da.prototype[e])return n(e);Da.prototype[e]=r}else if(t==="collection"){if(lt.prototype[e])return n(e);lt.prototype[e]=r}else if(t==="layout"){for(var i=function(x){this.options=x,r.call(this,x),Re(this._private)||(this._private={}),this._private.cy=x.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(r.prototype),s=[],u=0;u<s.length;u++){var l=s[u];o[l]=o[l]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var v=r.prototype.stop;o.stop=function(){var C=this.options;if(C&&C.animate){var x=this.animations;if(x)for(var S=0;S<x.length;S++)x[S].stop()}return v?v.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var f=function(x){return x._private.cy},c={addEventFields:function(x,S){S.layout=x,S.cy=f(x),S.target=x},bubble:function(){return!0},parent:function(x){return f(x)}};ge(o,{createEmitter:function(){return this._private.emitter=new qn(c,this),this},emitter:function(){return this._private.emitter},on:function(x,S){return this.emitter().on(x,S),this},one:function(x,S){return this.emitter().one(x,S),this},once:function(x,S){return this.emitter().one(x,S),this},removeListener:function(x,S){return this.emitter().removeListener(x,S),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(x,S){return this.emitter().emit(x,S),this}}),Le.eventAliasesOn(o),a=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var d=_f("renderer","base"),h=d.prototype,g=r,p=r.prototype,y=function(){d.apply(this,arguments),g.apply(this,arguments)},b=y.prototype;for(var m in h){var w=h[m];if(p[m]!=null)return n(m);b[m]=w}for(var T in p)b[T]=p[T];h.clientFunctions.forEach(function(C){b[C]=b[C]||function(){He("Renderer does not implement `renderer."+C+"()` on its prototype")}}),a=y}else if(t==="__proto__"||t==="constructor"||t==="prototype")return He(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return av({map:Ff,keys:[t,e],value:a})}function _f(t,e){return nv({map:Ff,keys:[t,e]})}function nm(t,e,r,a,n){return av({map:Vf,keys:[t,e,r,a],value:n})}function im(t,e,r,a){return nv({map:Vf,keys:[t,e,r,a]})}var Wo=function(){if(arguments.length===2)return _f.apply(null,arguments);if(arguments.length===3)return qf.apply(null,arguments);if(arguments.length===4)return im.apply(null,arguments);if(arguments.length===5)return nm.apply(null,arguments);He("Invalid extension access syntax")};Da.prototype.extension=Wo;am.forEach(function(t){t.extensions.forEach(function(e){qf(t.type,e.name,e.impl)})});var Pn=function(){if(!(this instanceof Pn))return new Pn;this.length=0},Dr=Pn.prototype;Dr.instanceString=function(){return"stylesheet"};Dr.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};Dr.css=function(t,e){var r=this.length-1;if(he(t))this[r].properties.push({name:t,value:e});else if(Re(t))for(var a=t,n=Object.keys(a),i=0;i<n.length;i++){var o=n[i],s=a[o];if(s!=null){var u=at.properties[o]||at.properties[An(o)];if(u!=null){var l=u.name,v=s;this[r].properties.push({name:l,value:v})}}}return this};Dr.style=Dr.css;Dr.generateStyle=function(t){var e=new at(t);return this.appendToStyle(e)};Dr.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,n=r.properties;t.selector(a);for(var i=0;i<n.length;i++){var o=n[i];t.css(o.name,o.value)}}return t};var om="3.34.0",kr=function(e){if(e===void 0&&(e={}),Re(e))return new Da(e);if(he(e))return Wo.apply(Wo,arguments)};kr.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(kr),t.apply(null,e),this};kr.warnings=function(t){return fv(t)};kr.version=om;kr.stylesheet=kr.Stylesheet=Pn;Object.defineProperty(exports,"cytoscape",{enumerable:!0,get:function(){return kr}});