@aiderdesk/aiderdesk 0.87.0 → 0.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/out/renderer/assets/2DXBBFLN-DhlZjS3f.js +666 -0
  2. package/out/renderer/assets/46IJ22JX-C1e8pvI2.js +853 -0
  3. package/out/renderer/assets/4TTDE5I4-Bea_IXhu.js +501 -0
  4. package/out/renderer/assets/4UF3HTLV-CVqcE2iq.js +29 -0
  5. package/out/renderer/assets/5THPTBWS-2mBFupjU.js +21 -0
  6. package/out/renderer/assets/7WLXJQOR-C8MM6Bra.js +23 -0
  7. package/out/renderer/assets/AAXQQPKT-BVbjBycX.js +1130 -0
  8. package/out/renderer/assets/AKE5O7KZ-Dr4O6i9X.js +184 -0
  9. package/out/renderer/assets/{AgentSettings-Cp7VI6CM.js → AgentSettings-ByYnHHTv.js} +710 -255
  10. package/out/renderer/assets/BNMLP6AG-CHDGj3j_.js +804 -0
  11. package/out/renderer/assets/DKTLEL5E-Dj3316cp.js +42 -0
  12. package/out/renderer/assets/DR6PKOQU-C6a3Tq7K.js +301 -0
  13. package/out/renderer/assets/E4RJ7UJB-BQWgl9gv.js +441 -0
  14. package/out/renderer/assets/ELSXBIJH-CVPK3kX4.js +39 -0
  15. package/out/renderer/assets/ERTIBQVS-71_Ru0iJ.js +182 -0
  16. package/out/renderer/assets/F653G4FO-Dj2Ang6n.js +1497 -0
  17. package/out/renderer/assets/FKCDD66M-DCrQTwBi.js +205 -0
  18. package/out/renderer/assets/FP7KDXVC-DKVnH-En.js +221 -0
  19. package/out/renderer/assets/FT5I3RHX-hlTJy7Nw.js +243 -0
  20. package/out/renderer/assets/FTXIJQGB-BX14b7pN.js +13 -0
  21. package/out/renderer/assets/G3MDBVQH-qZ3yfAIw.js +25 -0
  22. package/out/renderer/assets/GY35JXOZ-cSi0MdIc.js +168 -0
  23. package/out/renderer/assets/H5EEJPP2-bpYW0xE8.js +353 -0
  24. package/out/renderer/assets/HWDLEDTA-uLGgs5fE.js +982 -0
  25. package/out/renderer/assets/{InfoIcon-DesJ60KC.js → InfoIcon-DI4teJbi.js} +1 -1
  26. package/out/renderer/assets/JZWSX6AR-B0pkfB2b.js +67 -0
  27. package/out/renderer/assets/KQOEJWJY-EQFQbIDt.js +84 -0
  28. package/out/renderer/assets/KS3BB3KE-DclWHpbY.js +138 -0
  29. package/out/renderer/assets/KXJRRZHI-CHoCRoQ4.js +502 -0
  30. package/out/renderer/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  31. package/out/renderer/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  32. package/out/renderer/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  33. package/out/renderer/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  34. package/out/renderer/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  35. package/out/renderer/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  36. package/out/renderer/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  37. package/out/renderer/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  38. package/out/renderer/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  39. package/out/renderer/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  40. package/out/renderer/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  41. package/out/renderer/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  42. package/out/renderer/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  43. package/out/renderer/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  44. package/out/renderer/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  45. package/out/renderer/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  46. package/out/renderer/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  47. package/out/renderer/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  48. package/out/renderer/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  49. package/out/renderer/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  50. package/out/renderer/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  51. package/out/renderer/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  52. package/out/renderer/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  53. package/out/renderer/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  54. package/out/renderer/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  55. package/out/renderer/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  56. package/out/renderer/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  57. package/out/renderer/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  58. package/out/renderer/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  59. package/out/renderer/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  60. package/out/renderer/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  61. package/out/renderer/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  62. package/out/renderer/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  63. package/out/renderer/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  64. package/out/renderer/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  65. package/out/renderer/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  66. package/out/renderer/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  67. package/out/renderer/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  68. package/out/renderer/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  69. package/out/renderer/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  70. package/out/renderer/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  71. package/out/renderer/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  72. package/out/renderer/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  73. package/out/renderer/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  74. package/out/renderer/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  75. package/out/renderer/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  76. package/out/renderer/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  77. package/out/renderer/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  78. package/out/renderer/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  79. package/out/renderer/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  80. package/out/renderer/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  81. package/out/renderer/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  82. package/out/renderer/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  83. package/out/renderer/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  84. package/out/renderer/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  85. package/out/renderer/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  86. package/out/renderer/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  87. package/out/renderer/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  88. package/out/renderer/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  89. package/out/renderer/assets/MFVI5XKI-TmPyVySZ.js +10 -0
  90. package/out/renderer/assets/MWY2J62P-BlVjis68.js +1102 -0
  91. package/out/renderer/assets/MXGNCBL2-HvKcixVr.js +216 -0
  92. package/out/renderer/assets/N6DAJLIZ-B0JHSPS3.js +120 -0
  93. package/out/renderer/assets/NU5M23IW-CWgVJ5o_.js +116 -0
  94. package/out/renderer/assets/NV4XNBIS-uOSoaYKk.js +1221 -0
  95. package/out/renderer/assets/OGLU4SIR-CiNpshB1.js +289 -0
  96. package/out/renderer/assets/OUNS5N76-C6p0zhvm.js +1064 -0
  97. package/out/renderer/assets/{Onboarding-B2h7iatR.js → Onboarding-Ct6-CF4Z.js} +4 -4
  98. package/out/renderer/assets/PU4ISKXV-BQc-2oYa.js +515 -0
  99. package/out/renderer/assets/PUZGS23X-Bf89SCAj.js +21 -0
  100. package/out/renderer/assets/{ProviderHeader-BvigqAWX.js → ProviderHeader-Buje398H.js} +2 -2
  101. package/out/renderer/assets/Q3IYVLG5-DbP4qs2C.js +500 -0
  102. package/out/renderer/assets/QYHQDLKZ-dANs6SeT.js +983 -0
  103. package/out/renderer/assets/RVARI57O-DMrXgtoB.js +10 -0
  104. package/out/renderer/assets/RZSVICHU-CeuX_9H4.js +263 -0
  105. package/out/renderer/assets/{SettingsPage-CBonY1bv.js → SettingsPage-CLpPKXG1.js} +978 -848
  106. package/out/renderer/assets/UEXXS2NB-Bmbum3yG.js +25 -0
  107. package/out/renderer/assets/UHTQJXKL-C2OuiQBx.js +134 -0
  108. package/out/renderer/assets/URA2L2QI-DJ2BF8fn.js +201 -0
  109. package/out/renderer/assets/UXCHDUKG-B6wMZRAn.js +173 -0
  110. package/out/renderer/assets/{UsageDashboard-DFgckoeT.js → UsageDashboard-ORnsHGxF.js} +9130 -6449
  111. package/out/renderer/assets/VKNV3BUX-BMK4lviM.js +277 -0
  112. package/out/renderer/assets/VMV7XPHP-CzHnUaWh.js +127 -0
  113. package/out/renderer/assets/WEVWDWVA-BYWYeLxq.js +57 -0
  114. package/out/renderer/assets/XRRJ35LF-DaeQ2kbN.js +119 -0
  115. package/out/renderer/assets/YFKBLVVN-DsXlM7HO.js +990 -0
  116. package/out/renderer/assets/YHRE5QGZ-nB9z3NP1.js +697 -0
  117. package/out/renderer/assets/ZF3OVT4B-Ctn5OOBd.js +420 -0
  118. package/out/renderer/assets/{index-BFhJk8dv.js → index-BCaQe4ny.js} +2 -2
  119. package/out/renderer/assets/{index-Dk4pOCFt.js → index-BD-JYQGT.js} +5 -5
  120. package/out/renderer/assets/{index-bNFXvWqr.js → index-BGR4ZXWZ.js} +2 -2
  121. package/out/renderer/assets/{index-BP0q4HOE.js → index-BZBhErKV.js} +2 -2
  122. package/out/renderer/assets/{index-x_iC3w5N.js → index-BcWszklu.js} +1 -1
  123. package/out/renderer/assets/{index-C8TOzJWw.js → index-BpNNugm2.js} +4 -4
  124. package/out/renderer/assets/{index-uAJ0Zw9K.js → index-BrgyIQaN.js} +2 -2
  125. package/out/renderer/assets/{index-CuQvDzzr.js → index-Bt1dN7k_.js} +1 -1
  126. package/out/renderer/assets/{index-BZmjwrvJ.js → index-Bxu6rqm3.js} +1 -1
  127. package/out/renderer/assets/{index-tNlkrDYM.js → index-C6mXHxX3.js} +1 -1
  128. package/out/renderer/assets/{index-Z71oMk_m.js → index-CCbq90uE.js} +1 -1
  129. package/out/renderer/assets/{index-DE2koGci.js → index-CCm3UXZP.js} +2 -2
  130. package/out/renderer/assets/{index-DKNYbwcH.js → index-CNkiGtsK.js} +3 -3
  131. package/out/renderer/assets/{index-D_o1aMFn.css → index-CWfnJXNI.css} +130 -0
  132. package/out/renderer/assets/{index-47ZLfCU8.js → index-Cc-He418.js} +72999 -82151
  133. package/out/renderer/assets/{index-Dx6kKrXY.js → index-Crdzxx6k.js} +19 -15
  134. package/out/renderer/assets/{index-B_PkNLqT.js → index-D30k3y98.js} +1 -1
  135. package/out/renderer/assets/{index-CasrGDb0.js → index-DAWoHfjM.js} +2 -2
  136. package/out/renderer/assets/{index-D-rE7YVD.js → index-DG5AIC6J.js} +3 -3
  137. package/out/renderer/assets/{index-BzOM6AUj.js → index-DSBgCNMv.js} +2 -2
  138. package/out/renderer/assets/{index-C1I2Idqy.js → index-DeRKeskE.js} +5 -5
  139. package/out/renderer/assets/{index-Bh4xfAPL.js → index-DgQEgdew.js} +2 -2
  140. package/out/renderer/assets/{index-BKmr7UTW.js → index-Dgdp4i2K.js} +1 -1
  141. package/out/renderer/assets/{index-Bbv79qeB.js → index-DnNK6R2g.js} +2 -2
  142. package/out/renderer/assets/{index-CiIr--kg.js → index-DrNutodm.js} +2 -2
  143. package/out/renderer/assets/{index-B2jZTTYL.js → index-FS3mY8Ct.js} +1 -1
  144. package/out/renderer/assets/{index-DvSWnCZD.js → index-KId2jLzt.js} +2 -2
  145. package/out/renderer/assets/{index-DWZF-uSf.js → index-PyRCX6hq.js} +5 -5
  146. package/out/renderer/assets/{index-J-dLn6uq.js → index-U8nE80jx.js} +2 -2
  147. package/out/renderer/assets/{index-cO9XeYPQ.js → index-Vw8jKJU_.js} +5 -5
  148. package/out/renderer/assets/{index-B9bf5T9j.js → index-_a6zbU-0.js} +1 -1
  149. package/out/renderer/assets/{index-CenYyetH.js → index-dsqlqRSG.js} +5 -5
  150. package/out/renderer/assets/{index-D4dhIRp1.js → index-rQL1hwaP.js} +5 -5
  151. package/out/renderer/assets/{jsx-dev-runtime-CtvYhMha.js → jsx-dev-runtime-Bwt8d4vP.js} +1 -1
  152. package/out/renderer/index.html +2 -2
  153. package/out/resources/prompts/system-prompt.hbs +11 -0
  154. package/out/resources/skills/extension-creator/SKILL.md +20 -1
  155. package/out/resources/skills/extension-creator/references/event-types.md +5 -3
  156. package/out/resources/skills/extension-creator/references/extension-interface.md +62 -1
  157. package/out/resources/skills/extension-creator/references/external-agent-providers.md +90 -0
  158. package/out/runner.js +2016 -615
  159. package/package.json +3 -3
  160. package/out/renderer/assets/abnfDiagram-N423BO3Z-DV7pjob8.js +0 -118
  161. package/out/renderer/assets/arc-C2NyJjKR.js +0 -131
  162. package/out/renderer/assets/architectureDiagram-T3A2C74G-BmG8PHmc.js +0 -8829
  163. package/out/renderer/assets/band-zXq5o_Ib.js +0 -77
  164. package/out/renderer/assets/blockDiagram-VBNYF7ZC-CJndPtzf.js +0 -3824
  165. package/out/renderer/assets/c4Diagram-5PPSVZJV-B9DY2Hnr.js +0 -2482
  166. package/out/renderer/assets/channel-CCPkBLnh.js +0 -7
  167. package/out/renderer/assets/chunk-2GRJ4B5K-Bt46bDfT.js +0 -116
  168. package/out/renderer/assets/chunk-2Q5K7J3B-DkQwfKC2.js +0 -19
  169. package/out/renderer/assets/chunk-5RXB4S5H-CFNEWvlR.js +0 -1988
  170. package/out/renderer/assets/chunk-5VM5RSS4-BNeZg_6d.js +0 -19
  171. package/out/renderer/assets/chunk-6Q2QTUOP-BU5gT8Us.js +0 -860
  172. package/out/renderer/assets/chunk-GF5L2VYU-BNML5JwJ.js +0 -2026
  173. package/out/renderer/assets/chunk-JWPE2WC7-Dvih3ku3.js +0 -16
  174. package/out/renderer/assets/chunk-KBJHAD2P-CMgAbRkQ.js +0 -24
  175. package/out/renderer/assets/chunk-RYQCIY6F-CAJ6Qldz.js +0 -474
  176. package/out/renderer/assets/chunk-XXDRQBXY-BDZJ-WFV.js +0 -13
  177. package/out/renderer/assets/classDiagram-JCYQIIEL-BJCilkUQ.js +0 -23
  178. package/out/renderer/assets/classDiagram-v2-OCEON4UE-BJCilkUQ.js +0 -23
  179. package/out/renderer/assets/cose-bilkent-JH36ORCC-D6MsqBP5.js +0 -4942
  180. package/out/renderer/assets/cynefin-VYW2F7L2-3kPlVPG0.js +0 -32093
  181. package/out/renderer/assets/cynefinDiagram-MW4NZA55-6BlkJqWN.js +0 -453
  182. package/out/renderer/assets/cytoscape.esm-Bx_1tVW-.js +0 -30332
  183. package/out/renderer/assets/dagre-VZM6K2ZE-Chj1W0as.js +0 -522
  184. package/out/renderer/assets/defaultLocale-B2RvLBDe.js +0 -206
  185. package/out/renderer/assets/diagram-7IWD3JNH-CHFj7vIm.js +0 -488
  186. package/out/renderer/assets/diagram-B4RE2ZJO-BqOMO30m.js +0 -632
  187. package/out/renderer/assets/diagram-LBJQPF4R-CkiuQM5K.js +0 -212
  188. package/out/renderer/assets/diagram-Q27KOJAE-WVbpb4Iq.js +0 -857
  189. package/out/renderer/assets/diagram-UB23O5K3-B9Q0wQI3.js +0 -311
  190. package/out/renderer/assets/ebnfDiagram-BXEA7PRR-BUhf1ZxU.js +0 -138
  191. package/out/renderer/assets/erDiagram-JOGREHBK-DGxWkssI.js +0 -1238
  192. package/out/renderer/assets/flowDiagram-UKHOOZJN-D3ul5aGG.js +0 -2348
  193. package/out/renderer/assets/ganttDiagram-PKOTCBZU-BD3VbhAZ.js +0 -2782
  194. package/out/renderer/assets/gitGraphDiagram-DS77QQ5N-x-7NMw7v.js +0 -1373
  195. package/out/renderer/assets/graph-BDbmSegI.js +0 -1308
  196. package/out/renderer/assets/infoDiagram-6WML65LV-BMwbA6CU.js +0 -31
  197. package/out/renderer/assets/init-CTO7spbL.js +0 -35
  198. package/out/renderer/assets/ishikawaDiagram-WSZJBQD7-Bx90Gz0s.js +0 -967
  199. package/out/renderer/assets/journeyDiagram-NVQOT4AX-Dh4pUAU5.js +0 -1255
  200. package/out/renderer/assets/kanban-definition-27J2QSJJ-BZ_lX-ko.js +0 -1052
  201. package/out/renderer/assets/katex-oVG3DVWa.js +0 -14499
  202. package/out/renderer/assets/layout-oaOUFeBM.js +0 -2326
  203. package/out/renderer/assets/linear-B2eGZpM_.js +0 -361
  204. package/out/renderer/assets/map-BijQCI9U.js +0 -299
  205. package/out/renderer/assets/mindmap-definition-FAOFIHXS-BeWZh5qg.js +0 -1153
  206. package/out/renderer/assets/ordinal-BD3Y6v77.js +0 -77
  207. package/out/renderer/assets/pegDiagram-VL7TDLO6-BA6NzzN6.js +0 -126
  208. package/out/renderer/assets/pieDiagram-7S7Q4E2Y-KJmT5t-P.js +0 -316
  209. package/out/renderer/assets/quadrantDiagram-CIZ2JOQS-BdFz_bQU.js +0 -1343
  210. package/out/renderer/assets/railroadDiagram-AXF67PYL-CbH2ZZ1S.js +0 -92
  211. package/out/renderer/assets/requirementDiagram-LRYGKXZP-BZXG5Vgf.js +0 -1204
  212. package/out/renderer/assets/sankeyDiagram-W5VNT64P-CV1Upv22.js +0 -1274
  213. package/out/renderer/assets/sequenceDiagram-SI44F4Z6-Csbi3ivi.js +0 -4514
  214. package/out/renderer/assets/sizeCapture-X5ZJPWSS-CaN4k1d3.js +0 -62
  215. package/out/renderer/assets/stateDiagram-OKZ733FA-DSo1KeOQ.js +0 -452
  216. package/out/renderer/assets/stateDiagram-v2-UEYNNEHI-BhXw89HT.js +0 -22
  217. package/out/renderer/assets/swimlanes-SLNWSIFB-p3GZ-wkU.js +0 -8557
  218. package/out/renderer/assets/swimlanesDiagram-ULZ7WXOC-DGBdyiqy.js +0 -20
  219. package/out/renderer/assets/time-4LaKa9ym.js +0 -985
  220. package/out/renderer/assets/timeline-definition-Z64GVDOM-DfY8hG5p.js +0 -1596
  221. package/out/renderer/assets/vennDiagram-T6HMQDX7-wp87GaTi.js +0 -2515
  222. package/out/renderer/assets/wardleyDiagram-T6FBY63Y-DNrC2vOI.js +0 -975
  223. package/out/renderer/assets/xychartDiagram-ELKLHX3M-Bn8J2SKt.js +0 -1943
@@ -1,1308 +0,0 @@
1
- import { eU as isArray, f$ as isSymbol, eN as Symbol$1, g0 as getNative, g1 as MapCache, g2 as isArguments, eK as arrayPush, eT as Stack, g3 as baseIsEqual, eA as isObject, eG as keys, g4 as isLength, g5 as isIndex, eD as isArrayLike, eO as isObjectLike, g6 as arrayFilter, eS as isBuffer, g7 as isTypedArray, eP as getTag, eC as isPrototype, g8 as baseKeys, g9 as Set, ga as setToArray, gb as SetCache, gc as cacheHas, gd as isFunction } from "./index-47ZLfCU8.js";
2
- function arrayMap(array, iteratee) {
3
- var index = -1, length = array == null ? 0 : array.length, result = Array(length);
4
- while (++index < length) {
5
- result[index] = iteratee(array[index], index, array);
6
- }
7
- return result;
8
- }
9
- var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
10
- function baseToString(value) {
11
- if (typeof value == "string") {
12
- return value;
13
- }
14
- if (isArray(value)) {
15
- return arrayMap(value, baseToString) + "";
16
- }
17
- if (isSymbol(value)) {
18
- return symbolToString ? symbolToString.call(value) : "";
19
- }
20
- var result = value + "";
21
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
22
- }
23
- function identity(value) {
24
- return value;
25
- }
26
- function apply(func, thisArg, args) {
27
- switch (args.length) {
28
- case 0:
29
- return func.call(thisArg);
30
- case 1:
31
- return func.call(thisArg, args[0]);
32
- case 2:
33
- return func.call(thisArg, args[0], args[1]);
34
- case 3:
35
- return func.call(thisArg, args[0], args[1], args[2]);
36
- }
37
- return func.apply(thisArg, args);
38
- }
39
- function noop() {
40
- }
41
- var HOT_COUNT = 800, HOT_SPAN = 16;
42
- var nativeNow = Date.now;
43
- function shortOut(func) {
44
- var count = 0, lastCalled = 0;
45
- return function() {
46
- var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
47
- lastCalled = stamp;
48
- if (remaining > 0) {
49
- if (++count >= HOT_COUNT) {
50
- return arguments[0];
51
- }
52
- } else {
53
- count = 0;
54
- }
55
- return func.apply(void 0, arguments);
56
- };
57
- }
58
- function constant(value) {
59
- return function() {
60
- return value;
61
- };
62
- }
63
- var defineProperty = (function() {
64
- try {
65
- var func = getNative(Object, "defineProperty");
66
- func({}, "", {});
67
- return func;
68
- } catch (e) {
69
- }
70
- })();
71
- var baseSetToString = !defineProperty ? identity : function(func, string) {
72
- return defineProperty(func, "toString", {
73
- "configurable": true,
74
- "enumerable": false,
75
- "value": constant(string),
76
- "writable": true
77
- });
78
- };
79
- var setToString = shortOut(baseSetToString);
80
- function arrayEach(array, iteratee) {
81
- var index = -1, length = array == null ? 0 : array.length;
82
- while (++index < length) {
83
- if (iteratee(array[index], index, array) === false) {
84
- break;
85
- }
86
- }
87
- return array;
88
- }
89
- function baseFindIndex(array, predicate, fromIndex, fromRight) {
90
- var length = array.length, index = fromIndex + -1;
91
- while (++index < length) {
92
- if (predicate(array[index], index, array)) {
93
- return index;
94
- }
95
- }
96
- return -1;
97
- }
98
- function baseIsNaN(value) {
99
- return value !== value;
100
- }
101
- function strictIndexOf(array, value, fromIndex) {
102
- var index = fromIndex - 1, length = array.length;
103
- while (++index < length) {
104
- if (array[index] === value) {
105
- return index;
106
- }
107
- }
108
- return -1;
109
- }
110
- function baseIndexOf(array, value, fromIndex) {
111
- return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
112
- }
113
- function arrayIncludes(array, value) {
114
- var length = array == null ? 0 : array.length;
115
- return !!length && baseIndexOf(array, value, 0) > -1;
116
- }
117
- var nativeMax = Math.max;
118
- function overRest(func, start, transform) {
119
- start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
120
- return function() {
121
- var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
122
- while (++index < length) {
123
- array[index] = args[start + index];
124
- }
125
- index = -1;
126
- var otherArgs = Array(start + 1);
127
- while (++index < start) {
128
- otherArgs[index] = args[index];
129
- }
130
- otherArgs[start] = transform(array);
131
- return apply(func, this, otherArgs);
132
- };
133
- }
134
- function baseRest(func, start) {
135
- return setToString(overRest(func, start, identity), func + "");
136
- }
137
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
138
- function isKey(value, object) {
139
- if (isArray(value)) {
140
- return false;
141
- }
142
- var type = typeof value;
143
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
144
- return true;
145
- }
146
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
147
- }
148
- var FUNC_ERROR_TEXT = "Expected a function";
149
- function memoize(func, resolver) {
150
- if (typeof func != "function" || resolver != null && typeof resolver != "function") {
151
- throw new TypeError(FUNC_ERROR_TEXT);
152
- }
153
- var memoized = function() {
154
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
155
- if (cache.has(key)) {
156
- return cache.get(key);
157
- }
158
- var result = func.apply(this, args);
159
- memoized.cache = cache.set(key, result) || cache;
160
- return result;
161
- };
162
- memoized.cache = new (memoize.Cache || MapCache)();
163
- return memoized;
164
- }
165
- memoize.Cache = MapCache;
166
- var MAX_MEMOIZE_SIZE = 500;
167
- function memoizeCapped(func) {
168
- var result = memoize(func, function(key) {
169
- if (cache.size === MAX_MEMOIZE_SIZE) {
170
- cache.clear();
171
- }
172
- return key;
173
- });
174
- var cache = result.cache;
175
- return result;
176
- }
177
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
178
- var reEscapeChar = /\\(\\)?/g;
179
- var stringToPath = memoizeCapped(function(string) {
180
- var result = [];
181
- if (string.charCodeAt(0) === 46) {
182
- result.push("");
183
- }
184
- string.replace(rePropName, function(match, number, quote, subString) {
185
- result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
186
- });
187
- return result;
188
- });
189
- function toString(value) {
190
- return value == null ? "" : baseToString(value);
191
- }
192
- function castPath(value, object) {
193
- if (isArray(value)) {
194
- return value;
195
- }
196
- return isKey(value, object) ? [value] : stringToPath(toString(value));
197
- }
198
- function toKey(value) {
199
- if (typeof value == "string" || isSymbol(value)) {
200
- return value;
201
- }
202
- var result = value + "";
203
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
204
- }
205
- function baseGet(object, path) {
206
- path = castPath(path, object);
207
- var index = 0, length = path.length;
208
- while (object != null && index < length) {
209
- object = object[toKey(path[index++])];
210
- }
211
- return index && index == length ? object : void 0;
212
- }
213
- function get(object, path, defaultValue) {
214
- var result = object == null ? void 0 : baseGet(object, path);
215
- return result === void 0 ? defaultValue : result;
216
- }
217
- var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
218
- function isFlattenable(value) {
219
- return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
220
- }
221
- function baseFlatten(array, depth, predicate, isStrict, result) {
222
- var index = -1, length = array.length;
223
- predicate || (predicate = isFlattenable);
224
- result || (result = []);
225
- while (++index < length) {
226
- var value = array[index];
227
- if (predicate(value)) {
228
- {
229
- arrayPush(result, value);
230
- }
231
- } else if (!isStrict) {
232
- result[result.length] = value;
233
- }
234
- }
235
- return result;
236
- }
237
- function arrayReduce(array, iteratee, accumulator, initAccum) {
238
- var index = -1, length = array == null ? 0 : array.length;
239
- if (initAccum && length) {
240
- accumulator = array[++index];
241
- }
242
- while (++index < length) {
243
- accumulator = iteratee(accumulator, array[index], index, array);
244
- }
245
- return accumulator;
246
- }
247
- var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
248
- function baseIsMatch(object, source, matchData, customizer) {
249
- var index = matchData.length, length = index;
250
- if (object == null) {
251
- return !length;
252
- }
253
- object = Object(object);
254
- while (index--) {
255
- var data = matchData[index];
256
- if (data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
257
- return false;
258
- }
259
- }
260
- while (++index < length) {
261
- data = matchData[index];
262
- var key = data[0], objValue = object[key], srcValue = data[1];
263
- if (data[2]) {
264
- if (objValue === void 0 && !(key in object)) {
265
- return false;
266
- }
267
- } else {
268
- var stack = new Stack();
269
- var result;
270
- if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
271
- return false;
272
- }
273
- }
274
- }
275
- return true;
276
- }
277
- function isStrictComparable(value) {
278
- return value === value && !isObject(value);
279
- }
280
- function getMatchData(object) {
281
- var result = keys(object), length = result.length;
282
- while (length--) {
283
- var key = result[length], value = object[key];
284
- result[length] = [key, value, isStrictComparable(value)];
285
- }
286
- return result;
287
- }
288
- function matchesStrictComparable(key, srcValue) {
289
- return function(object) {
290
- if (object == null) {
291
- return false;
292
- }
293
- return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
294
- };
295
- }
296
- function baseMatches(source) {
297
- var matchData = getMatchData(source);
298
- if (matchData.length == 1 && matchData[0][2]) {
299
- return matchesStrictComparable(matchData[0][0], matchData[0][1]);
300
- }
301
- return function(object) {
302
- return object === source || baseIsMatch(object, source, matchData);
303
- };
304
- }
305
- function baseHasIn(object, key) {
306
- return object != null && key in Object(object);
307
- }
308
- function hasPath(object, path, hasFunc) {
309
- path = castPath(path, object);
310
- var index = -1, length = path.length, result = false;
311
- while (++index < length) {
312
- var key = toKey(path[index]);
313
- if (!(result = object != null && hasFunc(object, key))) {
314
- break;
315
- }
316
- object = object[key];
317
- }
318
- if (result || ++index != length) {
319
- return result;
320
- }
321
- length = object == null ? 0 : object.length;
322
- return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
323
- }
324
- function hasIn(object, path) {
325
- return object != null && hasPath(object, path, baseHasIn);
326
- }
327
- var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
328
- function baseMatchesProperty(path, srcValue) {
329
- if (isKey(path) && isStrictComparable(srcValue)) {
330
- return matchesStrictComparable(toKey(path), srcValue);
331
- }
332
- return function(object) {
333
- var objValue = get(object, path);
334
- return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
335
- };
336
- }
337
- function baseProperty(key) {
338
- return function(object) {
339
- return object == null ? void 0 : object[key];
340
- };
341
- }
342
- function basePropertyDeep(path) {
343
- return function(object) {
344
- return baseGet(object, path);
345
- };
346
- }
347
- function property(path) {
348
- return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
349
- }
350
- function baseIteratee(value) {
351
- if (typeof value == "function") {
352
- return value;
353
- }
354
- if (value == null) {
355
- return identity;
356
- }
357
- if (typeof value == "object") {
358
- return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
359
- }
360
- return property(value);
361
- }
362
- function createBaseFor(fromRight) {
363
- return function(object, iteratee, keysFunc) {
364
- var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
365
- while (length--) {
366
- var key = props[++index];
367
- if (iteratee(iterable[key], key, iterable) === false) {
368
- break;
369
- }
370
- }
371
- return object;
372
- };
373
- }
374
- var baseFor = createBaseFor();
375
- function baseForOwn(object, iteratee) {
376
- return object && baseFor(object, iteratee, keys);
377
- }
378
- function createBaseEach(eachFunc, fromRight) {
379
- return function(collection, iteratee) {
380
- if (collection == null) {
381
- return collection;
382
- }
383
- if (!isArrayLike(collection)) {
384
- return eachFunc(collection, iteratee);
385
- }
386
- var length = collection.length, index = -1, iterable = Object(collection);
387
- while (++index < length) {
388
- if (iteratee(iterable[index], index, iterable) === false) {
389
- break;
390
- }
391
- }
392
- return collection;
393
- };
394
- }
395
- var baseEach = createBaseEach(baseForOwn);
396
- function isArrayLikeObject(value) {
397
- return isObjectLike(value) && isArrayLike(value);
398
- }
399
- function castFunction(value) {
400
- return typeof value == "function" ? value : identity;
401
- }
402
- function forEach(collection, iteratee) {
403
- var func = isArray(collection) ? arrayEach : baseEach;
404
- return func(collection, castFunction(iteratee));
405
- }
406
- function baseFilter(collection, predicate) {
407
- var result = [];
408
- baseEach(collection, function(value, index, collection2) {
409
- if (predicate(value, index, collection2)) {
410
- result.push(value);
411
- }
412
- });
413
- return result;
414
- }
415
- function filter(collection, predicate) {
416
- var func = isArray(collection) ? arrayFilter : baseFilter;
417
- return func(collection, baseIteratee(predicate));
418
- }
419
- function baseValues(object, props) {
420
- return arrayMap(props, function(key) {
421
- return object[key];
422
- });
423
- }
424
- function values(object) {
425
- return object == null ? [] : baseValues(object, keys(object));
426
- }
427
- var mapTag = "[object Map]", setTag = "[object Set]";
428
- var objectProto = Object.prototype;
429
- var hasOwnProperty = objectProto.hasOwnProperty;
430
- function isEmpty(value) {
431
- if (value == null) {
432
- return true;
433
- }
434
- if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
435
- return !value.length;
436
- }
437
- var tag = getTag(value);
438
- if (tag == mapTag || tag == setTag) {
439
- return !value.size;
440
- }
441
- if (isPrototype(value)) {
442
- return !baseKeys(value).length;
443
- }
444
- for (var key in value) {
445
- if (hasOwnProperty.call(value, key)) {
446
- return false;
447
- }
448
- }
449
- return true;
450
- }
451
- function isUndefined(value) {
452
- return value === void 0;
453
- }
454
- function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
455
- eachFunc(collection, function(value, index, collection2) {
456
- accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
457
- });
458
- return accumulator;
459
- }
460
- function reduce(collection, iteratee, accumulator) {
461
- var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
462
- return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach);
463
- }
464
- var INFINITY = 1 / 0;
465
- var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function(values2) {
466
- return new Set(values2);
467
- };
468
- var LARGE_ARRAY_SIZE = 200;
469
- function baseUniq(array, iteratee, comparator) {
470
- var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
471
- if (length >= LARGE_ARRAY_SIZE) {
472
- var set = createSet(array);
473
- if (set) {
474
- return setToArray(set);
475
- }
476
- isCommon = false;
477
- includes = cacheHas;
478
- seen = new SetCache();
479
- } else {
480
- seen = result;
481
- }
482
- outer:
483
- while (++index < length) {
484
- var value = array[index], computed = value;
485
- value = value !== 0 ? value : 0;
486
- if (isCommon && computed === computed) {
487
- var seenIndex = seen.length;
488
- while (seenIndex--) {
489
- if (seen[seenIndex] === computed) {
490
- continue outer;
491
- }
492
- }
493
- result.push(value);
494
- } else if (!includes(seen, computed, comparator)) {
495
- if (seen !== result) {
496
- seen.push(computed);
497
- }
498
- result.push(value);
499
- }
500
- }
501
- return result;
502
- }
503
- var union = baseRest(function(arrays) {
504
- return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
505
- });
506
- var DEFAULT_EDGE_NAME = "\0";
507
- var GRAPH_NODE = "\0";
508
- var EDGE_KEY_DELIM = "";
509
- class Graph {
510
- /**
511
- * @param {GraphOptions} [opts] - Graph options.
512
- */
513
- constructor(opts = {}) {
514
- this._isDirected = Object.prototype.hasOwnProperty.call(opts, "directed") ? opts.directed : true;
515
- this._isMultigraph = Object.prototype.hasOwnProperty.call(opts, "multigraph") ? opts.multigraph : false;
516
- this._isCompound = Object.prototype.hasOwnProperty.call(opts, "compound") ? opts.compound : false;
517
- this._label = void 0;
518
- this._defaultNodeLabelFn = constant(void 0);
519
- this._defaultEdgeLabelFn = constant(void 0);
520
- this._nodes = {};
521
- if (this._isCompound) {
522
- this._parent = {};
523
- this._children = {};
524
- this._children[GRAPH_NODE] = {};
525
- }
526
- this._in = {};
527
- this._preds = {};
528
- this._out = {};
529
- this._sucs = {};
530
- this._edgeObjs = {};
531
- this._edgeLabels = {};
532
- }
533
- /* === Graph functions ========= */
534
- /**
535
- *
536
- * @returns {boolean} `true` if the graph is [directed](https://en.wikipedia.org/wiki/Directed_graph).
537
- * A directed graph treats the order of nodes in an edge as significant whereas an
538
- * [undirected](https://en.wikipedia.org/wiki/Graph_(mathematics)#Undirected_graph)
539
- * graph does not.
540
- * This example demonstrates the difference:
541
- *
542
- * @example
543
- *
544
- * ```js
545
- * var directed = new Graph({ directed: true });
546
- * directed.setEdge("a", "b", "my-label");
547
- * directed.edge("a", "b"); // returns "my-label"
548
- * directed.edge("b", "a"); // returns undefined
549
- *
550
- * var undirected = new Graph({ directed: false });
551
- * undirected.setEdge("a", "b", "my-label");
552
- * undirected.edge("a", "b"); // returns "my-label"
553
- * undirected.edge("b", "a"); // returns "my-label"
554
- * ```
555
- */
556
- isDirected() {
557
- return this._isDirected;
558
- }
559
- /**
560
- * @returns {boolean} `true` if the graph is a multigraph.
561
- */
562
- isMultigraph() {
563
- return this._isMultigraph;
564
- }
565
- /**
566
- * @returns {boolean} `true` if the graph is compound.
567
- */
568
- isCompound() {
569
- return this._isCompound;
570
- }
571
- /**
572
- * Sets the label for the graph to `label`.
573
- *
574
- * @param {GraphLabel} label - Label for the graph.
575
- * @returns {this}
576
- */
577
- setGraph(label) {
578
- this._label = label;
579
- return this;
580
- }
581
- /**
582
- * @returns {GraphLabel | undefined} the currently assigned label for the graph.
583
- * If no label has been assigned, returns `undefined`.
584
- *
585
- * @example
586
- *
587
- * ```js
588
- * var g = new Graph();
589
- * g.graph(); // returns undefined
590
- * g.setGraph("graph-label");
591
- * g.graph(); // returns "graph-label"
592
- * ```
593
- */
594
- graph() {
595
- return this._label;
596
- }
597
- /* === Node functions ========== */
598
- /**
599
- * Sets a new default value that is assigned to nodes that are created without
600
- * a label.
601
- *
602
- * @param {typeof this._defaultNodeLabelFn | NodeLabel} newDefault - If a function,
603
- * it is called with the id of the node being created.
604
- * Otherwise, it is assigned as the label directly.
605
- * @returns {this}
606
- */
607
- setDefaultNodeLabel(newDefault) {
608
- if (!isFunction(newDefault)) {
609
- newDefault = constant(newDefault);
610
- }
611
- this._defaultNodeLabelFn = newDefault;
612
- return this;
613
- }
614
- /**
615
- * @returns {number} the number of nodes in the graph.
616
- */
617
- nodeCount() {
618
- return this._nodeCount;
619
- }
620
- /**
621
- * @returns {NodeID[]} the ids of the nodes in the graph.
622
- *
623
- * @remarks
624
- * Use {@link node()} to get the label for each node.
625
- * Takes `O(|V|)` time.
626
- */
627
- nodes() {
628
- return keys(this._nodes);
629
- }
630
- /**
631
- * @returns {NodeID[]} those nodes in the graph that have no in-edges.
632
- * @remarks Takes `O(|V|)` time.
633
- */
634
- sources() {
635
- var self = this;
636
- return filter(this.nodes(), function(v) {
637
- return isEmpty(self._in[v]);
638
- });
639
- }
640
- /**
641
- * @returns {NodeID[]} those nodes in the graph that have no out-edges.
642
- * @remarks Takes `O(|V|)` time.
643
- */
644
- sinks() {
645
- var self = this;
646
- return filter(this.nodes(), function(v) {
647
- return isEmpty(self._out[v]);
648
- });
649
- }
650
- /**
651
- * Invokes setNode method for each node in `vs` list.
652
- *
653
- * @param {Collection<NodeID | number>} vs - List of node IDs to create/set.
654
- * @param {NodeLabel} [value] - If set, update all nodes with this value.
655
- * @returns {this}
656
- * @remarks Complexity: O(|names|).
657
- */
658
- setNodes(vs, value) {
659
- var args = arguments;
660
- var self = this;
661
- forEach(vs, function(v) {
662
- if (args.length > 1) {
663
- self.setNode(v, value);
664
- } else {
665
- self.setNode(v);
666
- }
667
- });
668
- return this;
669
- }
670
- /**
671
- * Creates or updates the value for the node `v` in the graph.
672
- *
673
- * @param {NodeID | number} v - ID of the node to create/set.
674
- * @param {NodeLabel} [value] - If supplied, it is set as the value for the node.
675
- * If not supplied and the node was created by this call then
676
- * {@link setDefaultNodeLabel} will be used to set the node's value.
677
- * @returns {this} the graph, allowing this to be chained with other functions.
678
- * @remarks Takes `O(1)` time.
679
- */
680
- setNode(v, value) {
681
- if (Object.prototype.hasOwnProperty.call(this._nodes, v)) {
682
- if (arguments.length > 1) {
683
- this._nodes[v] = value;
684
- }
685
- return this;
686
- }
687
- this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);
688
- if (this._isCompound) {
689
- this._parent[v] = GRAPH_NODE;
690
- this._children[v] = {};
691
- this._children[GRAPH_NODE][v] = true;
692
- }
693
- this._in[v] = {};
694
- this._preds[v] = {};
695
- this._out[v] = {};
696
- this._sucs[v] = {};
697
- ++this._nodeCount;
698
- return this;
699
- }
700
- /**
701
- * Gets the label of node with specified name.
702
- *
703
- * @param {NodeID | number} v - Node ID.
704
- * @returns {NodeLabel | undefined} the label assigned to the node with the id `v`
705
- * if it is in the graph.
706
- * Otherwise returns `undefined`.
707
- * @remarks Takes `O(1)` time.
708
- */
709
- node(v) {
710
- return this._nodes[v];
711
- }
712
- /**
713
- * Detects whether graph has a node with specified name or not.
714
- *
715
- * @param {NodeID | number} v - Node ID.
716
- * @returns {boolean} Returns `true` the graph has a node with the id.
717
- * @remarks Takes `O(1)` time.
718
- */
719
- hasNode(v) {
720
- return Object.prototype.hasOwnProperty.call(this._nodes, v);
721
- }
722
- /**
723
- * Remove the node with the id `v` in the graph or do nothing if the node is
724
- * not in the graph.
725
- *
726
- * If the node was removed this function also removes any incident edges.
727
- *
728
- * @param {NodeID | number} v - Node ID to remove.
729
- * @returns {this} the graph, allowing this to be chained with other functions.
730
- * @remarks Takes `O(|E|)` time.
731
- */
732
- removeNode(v) {
733
- if (Object.prototype.hasOwnProperty.call(this._nodes, v)) {
734
- var removeEdge = (e) => this.removeEdge(this._edgeObjs[e]);
735
- delete this._nodes[v];
736
- if (this._isCompound) {
737
- this._removeFromParentsChildList(v);
738
- delete this._parent[v];
739
- forEach(this.children(v), (child) => {
740
- this.setParent(child);
741
- });
742
- delete this._children[v];
743
- }
744
- forEach(keys(this._in[v]), removeEdge);
745
- delete this._in[v];
746
- delete this._preds[v];
747
- forEach(keys(this._out[v]), removeEdge);
748
- delete this._out[v];
749
- delete this._sucs[v];
750
- --this._nodeCount;
751
- }
752
- return this;
753
- }
754
- /**
755
- * Sets the parent for `v` to `parent` if it is defined or removes the parent
756
- * for `v` if `parent` is undefined.
757
- *
758
- * @param {NodeID | number} v - Node ID to set the parent for.
759
- * @param {NodeID | number} [parent] - Parent node ID. If not defined, removes the parent.
760
- * @returns {this} the graph, allowing this to be chained with other functions.
761
- * @throws if the graph is not compound.
762
- * @throws if setting the parent would create a cycle.
763
- * @remarks Takes `O(1)` time.
764
- */
765
- setParent(v, parent) {
766
- if (!this._isCompound) {
767
- throw new Error("Cannot set parent in a non-compound graph");
768
- }
769
- if (isUndefined(parent)) {
770
- parent = GRAPH_NODE;
771
- } else {
772
- parent += "";
773
- for (var ancestor = parent; !isUndefined(ancestor); ancestor = this.parent(ancestor)) {
774
- if (ancestor === v) {
775
- throw new Error("Setting " + parent + " as parent of " + v + " would create a cycle");
776
- }
777
- }
778
- this.setNode(parent);
779
- }
780
- this.setNode(v);
781
- this._removeFromParentsChildList(v);
782
- this._parent[v] = parent;
783
- this._children[parent][v] = true;
784
- return this;
785
- }
786
- /**
787
- * @private
788
- * @param {NodeID | number} v - Node ID.
789
- */
790
- _removeFromParentsChildList(v) {
791
- delete this._children[this._parent[v]][v];
792
- }
793
- /**
794
- * Get parent node for node `v`.
795
- *
796
- * @param {NodeID | number} v - Node ID.
797
- * @returns {NodeID | undefined} the node that is a parent of node `v`
798
- * or `undefined` if node `v` does not have a parent or is not a member of
799
- * the graph.
800
- * Always returns `undefined` for graphs that are not compound.
801
- * @remarks Takes `O(1)` time.
802
- */
803
- parent(v) {
804
- if (this._isCompound) {
805
- var parent = this._parent[v];
806
- if (parent !== GRAPH_NODE) {
807
- return parent;
808
- }
809
- }
810
- }
811
- /**
812
- * Gets list of direct children of node v.
813
- *
814
- * @param {NodeID | number} [v] - Node ID. If not specified, gets nodes
815
- * with no parent (top-level nodes).
816
- * @returns {NodeID[] | undefined} all nodes that are children of node `v` or
817
- * `undefined` if node `v` is not in the graph.
818
- * Always returns `[]` for graphs that are not compound.
819
- * @remarks Takes `O(|V|)` time.
820
- */
821
- children(v) {
822
- if (isUndefined(v)) {
823
- v = GRAPH_NODE;
824
- }
825
- if (this._isCompound) {
826
- var children = this._children[v];
827
- if (children) {
828
- return keys(children);
829
- }
830
- } else if (v === GRAPH_NODE) {
831
- return this.nodes();
832
- } else if (this.hasNode(v)) {
833
- return [];
834
- }
835
- }
836
- /**
837
- * @param {NodeID | number} v - Node ID.
838
- * @returns {NodeID[] | undefined} all nodes that are predecessors of the
839
- * specified node or `undefined` if node `v` is not in the graph.
840
- * @remarks
841
- * Behavior is undefined for undirected graphs - use {@link neighbors} instead.
842
- * Takes `O(|V|)` time.
843
- */
844
- predecessors(v) {
845
- var predsV = this._preds[v];
846
- if (predsV) {
847
- return keys(predsV);
848
- }
849
- }
850
- /**
851
- * @param {NodeID | number} v - Node ID.
852
- * @returns {NodeID[] | undefined} all nodes that are successors of the
853
- * specified node or `undefined` if node `v` is not in the graph.
854
- * @remarks
855
- * Behavior is undefined for undirected graphs - use {@link neighbors} instead.
856
- * Takes `O(|V|)` time.
857
- */
858
- successors(v) {
859
- var sucsV = this._sucs[v];
860
- if (sucsV) {
861
- return keys(sucsV);
862
- }
863
- }
864
- /**
865
- * @param {NodeID | number} v - Node ID.
866
- * @returns {NodeID[] | undefined} all nodes that are predecessors or
867
- * successors of the specified node
868
- * or `undefined` if node `v` is not in the graph.
869
- * @remarks Takes `O(|V|)` time.
870
- */
871
- neighbors(v) {
872
- var preds = this.predecessors(v);
873
- if (preds) {
874
- return union(preds, this.successors(v));
875
- }
876
- }
877
- /**
878
- * @param {NodeID | number} v - Node ID.
879
- * @returns {boolean} True if the node is a leaf (has no successors), false otherwise.
880
- */
881
- isLeaf(v) {
882
- var neighbors;
883
- if (this.isDirected()) {
884
- neighbors = this.successors(v);
885
- } else {
886
- neighbors = this.neighbors(v);
887
- }
888
- return neighbors.length === 0;
889
- }
890
- /**
891
- * Creates new graph with nodes filtered via `filter`.
892
- * Edges incident to rejected node
893
- * are also removed.
894
- *
895
- * In case of compound graph, if parent is rejected by `filter`,
896
- * than all its children are rejected too.
897
-
898
- * @param {(v: NodeID) => boolean} filter - Function that returns `true` for nodes to keep.
899
- * @returns {Graph<GraphLabel, NodeLabel, EdgeLabel>} A new graph containing only the nodes for which `filter` returns `true`.
900
- * @remarks Average-case complexity: O(|E|+|V|).
901
- */
902
- filterNodes(filter2) {
903
- var copy = new this.constructor({
904
- directed: this._isDirected,
905
- multigraph: this._isMultigraph,
906
- compound: this._isCompound
907
- });
908
- copy.setGraph(this.graph());
909
- var self = this;
910
- forEach(this._nodes, function(value, v) {
911
- if (filter2(v)) {
912
- copy.setNode(v, value);
913
- }
914
- });
915
- forEach(this._edgeObjs, function(e) {
916
- if (copy.hasNode(e.v) && copy.hasNode(e.w)) {
917
- copy.setEdge(e, self.edge(e));
918
- }
919
- });
920
- var parents = {};
921
- function findParent(v) {
922
- var parent = self.parent(v);
923
- if (parent === void 0 || copy.hasNode(parent)) {
924
- parents[v] = parent;
925
- return parent;
926
- } else if (parent in parents) {
927
- return parents[parent];
928
- } else {
929
- return findParent(parent);
930
- }
931
- }
932
- if (this._isCompound) {
933
- forEach(copy.nodes(), function(v) {
934
- copy.setParent(v, findParent(v));
935
- });
936
- }
937
- return copy;
938
- }
939
- /* === Edge functions ========== */
940
- /**
941
- * Sets a new default value that is assigned to edges that are created without
942
- * a label.
943
- *
944
- * @param {typeof this._defaultEdgeLabelFn | EdgeLabel} newDefault - If a function,
945
- * it is called with the parameters `(v, w, name)`.
946
- * Otherwise, it is assigned as the label directly.
947
- * @returns {this}
948
- */
949
- setDefaultEdgeLabel(newDefault) {
950
- if (!isFunction(newDefault)) {
951
- newDefault = constant(newDefault);
952
- }
953
- this._defaultEdgeLabelFn = newDefault;
954
- return this;
955
- }
956
- /**
957
- * @returns {number} the number of edges in the graph.
958
- * @remarks Complexity: O(1).
959
- */
960
- edgeCount() {
961
- return this._edgeCount;
962
- }
963
- /**
964
- * Gets edges of the graph.
965
- *
966
- * @returns {EdgeObj[]} the {@link EdgeObj} for each edge in the graph.
967
- *
968
- * @remarks
969
- * In case of compound graph subgraphs are not considered.
970
- * Use {@link edge()} to get the label for each edge.
971
- * Takes `O(|E|)` time.
972
- */
973
- edges() {
974
- return values(this._edgeObjs);
975
- }
976
- /**
977
- * Establish an edges path over the nodes in nodes list.
978
- *
979
- * If some edge is already exists, it will update its label, otherwise it will
980
- * create an edge between pair of nodes with label provided or default label
981
- * if no label provided.
982
- *
983
- * @param {Collection<NodeID>} vs - List of node IDs to create edges between.
984
- * @param {EdgeLabel} [value] - If set, update all edges with this value.
985
- * @returns {this}
986
- * @remarks Complexity: O(|nodes|).
987
- */
988
- setPath(vs, value) {
989
- var self = this;
990
- var args = arguments;
991
- reduce(vs, function(v, w) {
992
- if (args.length > 1) {
993
- self.setEdge(v, w, value);
994
- } else {
995
- self.setEdge(v, w);
996
- }
997
- return w;
998
- });
999
- return this;
1000
- }
1001
- /**
1002
- * Creates or updates the label for the edge (`v`, `w`) with the optionally
1003
- * supplied `name`.
1004
- *
1005
- * @overload
1006
- * @param {EdgeObj} arg0 - Edge object.
1007
- * @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge.
1008
- * If not supplied and the edge was created by this call then
1009
- * {@link setDefaultEdgeLabel} will be used to assign the edge's label.
1010
- * @returns {this} the graph, allowing this to be chained with other functions.
1011
- * @remarks Takes `O(1)` time.
1012
- */
1013
- /**
1014
- * Creates or updates the label for the edge (`v`, `w`) with the optionally
1015
- * supplied `name`.
1016
- *
1017
- * @overload
1018
- * @param {NodeID | number} v - Source node ID. Number values will be coerced to strings.
1019
- * @param {NodeID | number} w - Target node ID. Number values will be coerced to strings.
1020
- * @param {EdgeLabel} [value] - If supplied, it is set as the label for the edge.
1021
- * If not supplied and the edge was created by this call then
1022
- * {@link setDefaultEdgeLabel} will be used to assign the edge's label.
1023
- * @param {string | number} [name] - Edge name. Only useful with multigraphs.
1024
- * @returns {this} the graph, allowing this to be chained with other functions.
1025
- * @remarks Takes `O(1)` time.
1026
- */
1027
- setEdge() {
1028
- var v, w, name, value;
1029
- var valueSpecified = false;
1030
- var arg0 = arguments[0];
1031
- if (typeof arg0 === "object" && arg0 !== null && "v" in arg0) {
1032
- v = arg0.v;
1033
- w = arg0.w;
1034
- name = arg0.name;
1035
- if (arguments.length === 2) {
1036
- value = arguments[1];
1037
- valueSpecified = true;
1038
- }
1039
- } else {
1040
- v = arg0;
1041
- w = arguments[1];
1042
- name = arguments[3];
1043
- if (arguments.length > 2) {
1044
- value = arguments[2];
1045
- valueSpecified = true;
1046
- }
1047
- }
1048
- v = "" + v;
1049
- w = "" + w;
1050
- if (!isUndefined(name)) {
1051
- name = "" + name;
1052
- }
1053
- var e = edgeArgsToId(this._isDirected, v, w, name);
1054
- if (Object.prototype.hasOwnProperty.call(this._edgeLabels, e)) {
1055
- if (valueSpecified) {
1056
- this._edgeLabels[e] = value;
1057
- }
1058
- return this;
1059
- }
1060
- if (!isUndefined(name) && !this._isMultigraph) {
1061
- throw new Error("Cannot set a named edge when isMultigraph = false");
1062
- }
1063
- this.setNode(v);
1064
- this.setNode(w);
1065
- this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);
1066
- var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);
1067
- v = edgeObj.v;
1068
- w = edgeObj.w;
1069
- Object.freeze(edgeObj);
1070
- this._edgeObjs[e] = edgeObj;
1071
- incrementOrInitEntry(this._preds[w], v);
1072
- incrementOrInitEntry(this._sucs[v], w);
1073
- this._in[w][e] = edgeObj;
1074
- this._out[v][e] = edgeObj;
1075
- this._edgeCount++;
1076
- return this;
1077
- }
1078
- /**
1079
- * Gets the label for the specified edge.
1080
- *
1081
- * @overload
1082
- * @param {EdgeObj} v - Edge object.
1083
- * @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the
1084
- * graph has an edge between `v` and `w` with the optional `name`.
1085
- * Returned `undefined` if there is no such edge in the graph.
1086
- * @remarks
1087
- * `v` and `w` can be interchanged for undirected graphs.
1088
- * Takes `O(1)` time.
1089
- */
1090
- /**
1091
- * Gets the label for the specified edge.
1092
- *
1093
- * @overload
1094
- * @param {NodeID | number} v - Source node ID.
1095
- * @param {NodeID | number} w - Target node ID.
1096
- * @param {string | number} [name] - Edge name. Only useful with multigraphs.
1097
- * @returns {EdgeLabel | undefined} the label for the edge (`v`, `w`) if the
1098
- * graph has an edge between `v` and `w` with the optional `name`.
1099
- * Returned `undefined` if there is no such edge in the graph.
1100
- * @remarks
1101
- * `v` and `w` can be interchanged for undirected graphs.
1102
- * Takes `O(1)` time.
1103
- */
1104
- edge(v, w, name) {
1105
- var e = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v, w, name);
1106
- return this._edgeLabels[e];
1107
- }
1108
- /**
1109
- * Detects whether the graph contains specified edge or not.
1110
- *
1111
- * @overload
1112
- * @param {EdgeObj} v - Edge object.
1113
- * @returns {boolean} `true` if the graph has an edge between `v` and `w`
1114
- * with the optional `name`.
1115
- * @remarks
1116
- * `v` and `w` can be interchanged for undirected graphs.
1117
- * No subgraphs are considered.
1118
- * Takes `O(1)` time.
1119
- */
1120
- /**
1121
- * Detects whether the graph contains specified edge or not.
1122
- *
1123
- * @overload
1124
- * @param {NodeID | number} v - Source node ID.
1125
- * @param {NodeID | number} w - Target node ID.
1126
- * @param {string | number} [name] - Edge name. Only useful with multigraphs.
1127
- * @returns {boolean} `true` if the graph has an edge between `v` and `w`
1128
- * with the optional `name`.
1129
- * @remarks
1130
- * `v` and `w` can be interchanged for undirected graphs.
1131
- * No subgraphs are considered.
1132
- * Takes `O(1)` time.
1133
- */
1134
- hasEdge(v, w, name) {
1135
- var e = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v, w, name);
1136
- return Object.prototype.hasOwnProperty.call(this._edgeLabels, e);
1137
- }
1138
- /**
1139
- * Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w`
1140
- * with the optional `name`. If not this function does nothing.
1141
- *
1142
- * @overload
1143
- * @param {EdgeObj} v - Edge object.
1144
- * @returns {this}
1145
- * @remarks
1146
- * `v` and `w` can be interchanged for undirected graphs.
1147
- * No subgraphs are considered.
1148
- * Takes `O(1)` time.
1149
- */
1150
- /**
1151
- * Removes the edge (`v`, `w`) if the graph has an edge between `v` and `w`
1152
- * with the optional `name`. If not this function does nothing.
1153
- *
1154
- * @overload
1155
- * @param {NodeID | number} v - Source node ID.
1156
- * @param {NodeID | number} w - Target node ID.
1157
- * @param {string | number} [name] - Edge name. Only useful with multigraphs.
1158
- * @returns {this}
1159
- * @remarks
1160
- * `v` and `w` can be interchanged for undirected graphs.
1161
- * Takes `O(1)` time.
1162
- */
1163
- removeEdge(v, w, name) {
1164
- var e = arguments.length === 1 ? edgeObjToId(this._isDirected, arguments[0]) : edgeArgsToId(this._isDirected, v, w, name);
1165
- var edge = this._edgeObjs[e];
1166
- if (edge) {
1167
- v = edge.v;
1168
- w = edge.w;
1169
- delete this._edgeLabels[e];
1170
- delete this._edgeObjs[e];
1171
- decrementOrRemoveEntry(this._preds[w], v);
1172
- decrementOrRemoveEntry(this._sucs[v], w);
1173
- delete this._in[w][e];
1174
- delete this._out[v][e];
1175
- this._edgeCount--;
1176
- }
1177
- return this;
1178
- }
1179
- /**
1180
- * @param {NodeID | number} v - Target node ID.
1181
- * @param {NodeID | number} [u] - Optionally filters edges down to just those
1182
- * coming from node `u`.
1183
- * @returns {EdgeObj[] | undefined} all edges that point to the node `v`.
1184
- * Returns `undefined` if node `v` is not in the graph.
1185
- * @remarks
1186
- * Behavior is undefined for undirected graphs - use {@link nodeEdges} instead.
1187
- * Takes `O(|E|)` time.
1188
- */
1189
- inEdges(v, u) {
1190
- var inV = this._in[v];
1191
- if (inV) {
1192
- var edges = values(inV);
1193
- if (!u) {
1194
- return edges;
1195
- }
1196
- return filter(edges, function(edge) {
1197
- return edge.v === u;
1198
- });
1199
- }
1200
- }
1201
- /**
1202
- * @param {NodeID | number} v - Target node ID.
1203
- * @param {NodeID | number} [w] - Optionally filters edges down to just those
1204
- * that point to `w`.
1205
- * @returns {EdgeObj[] | undefined} all edges that point to the node `v`.
1206
- * Returns `undefined` if node `v` is not in the graph.
1207
- * @remarks
1208
- * Behavior is undefined for undirected graphs - use {@link nodeEdges} instead.
1209
- * Takes `O(|E|)` time.
1210
- */
1211
- outEdges(v, w) {
1212
- var outV = this._out[v];
1213
- if (outV) {
1214
- var edges = values(outV);
1215
- if (!w) {
1216
- return edges;
1217
- }
1218
- return filter(edges, function(edge) {
1219
- return edge.w === w;
1220
- });
1221
- }
1222
- }
1223
- /**
1224
- * @param {NodeID | number} v - Target Node ID.
1225
- * @param {NodeID | number} [w] - If set, filters those edges down to just
1226
- * those between nodes `v` and `w` regardless of direction
1227
- * @returns {EdgeObj[] | undefined} all edges to or from node `v` regardless
1228
- * of direction. Returns `undefined` if node `v` is not in the graph.
1229
- * @remarks Takes `O(|E|)` time.
1230
- */
1231
- nodeEdges(v, w) {
1232
- var inEdges = this.inEdges(v, w);
1233
- if (inEdges) {
1234
- return inEdges.concat(this.outEdges(v, w));
1235
- }
1236
- }
1237
- }
1238
- Graph.prototype._nodeCount = 0;
1239
- Graph.prototype._edgeCount = 0;
1240
- function incrementOrInitEntry(map, k) {
1241
- if (map[k]) {
1242
- map[k]++;
1243
- } else {
1244
- map[k] = 1;
1245
- }
1246
- }
1247
- function decrementOrRemoveEntry(map, k) {
1248
- if (!--map[k]) {
1249
- delete map[k];
1250
- }
1251
- }
1252
- function edgeArgsToId(isDirected, v_, w_, name) {
1253
- var v = "" + v_;
1254
- var w = "" + w_;
1255
- if (!isDirected && v > w) {
1256
- var tmp = v;
1257
- v = w;
1258
- w = tmp;
1259
- }
1260
- return v + EDGE_KEY_DELIM + w + EDGE_KEY_DELIM + (isUndefined(name) ? DEFAULT_EDGE_NAME : name);
1261
- }
1262
- function edgeArgsToObj(isDirected, v_, w_, name) {
1263
- var v = "" + v_;
1264
- var w = "" + w_;
1265
- if (!isDirected && v > w) {
1266
- var tmp = v;
1267
- v = w;
1268
- w = tmp;
1269
- }
1270
- var edgeObj = { v, w };
1271
- if (name) {
1272
- edgeObj.name = name;
1273
- }
1274
- return edgeObj;
1275
- }
1276
- function edgeObjToId(isDirected, edgeObj) {
1277
- return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);
1278
- }
1279
- export {
1280
- reduce as A,
1281
- Graph as G,
1282
- arrayEach as a,
1283
- baseEach as b,
1284
- baseIteratee as c,
1285
- defineProperty as d,
1286
- arrayMap as e,
1287
- baseRest as f,
1288
- baseFlatten as g,
1289
- isArrayLikeObject as h,
1290
- isUndefined as i,
1291
- baseFor as j,
1292
- baseFindIndex as k,
1293
- castFunction as l,
1294
- baseForOwn as m,
1295
- hasPath as n,
1296
- overRest as o,
1297
- identity as p,
1298
- castPath as q,
1299
- baseGet as r,
1300
- setToString as s,
1301
- toKey as t,
1302
- hasIn as u,
1303
- toString as v,
1304
- forEach as w,
1305
- constant as x,
1306
- filter as y,
1307
- values as z
1308
- };