rasa-pro 3.11.4__py3-none-any.whl → 3.12.0__py3-none-any.whl

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.

Potentially problematic release.


This version of rasa-pro might be problematic. Click here for more details.

Files changed (580) hide show
  1. README.md +10 -13
  2. rasa/__main__.py +7 -7
  3. rasa/anonymization/anonymisation_rule_yaml_reader.py +1 -1
  4. rasa/anonymization/anonymization_pipeline.py +3 -3
  5. rasa/anonymization/anonymization_rule_executor.py +17 -11
  6. rasa/anonymization/anonymization_rule_orchestrator.py +2 -3
  7. rasa/cli/arguments/data.py +2 -2
  8. rasa/cli/arguments/default_arguments.py +1 -1
  9. rasa/cli/arguments/evaluate.py +2 -1
  10. rasa/cli/arguments/interactive.py +1 -1
  11. rasa/cli/arguments/run.py +1 -1
  12. rasa/cli/arguments/test.py +7 -5
  13. rasa/cli/arguments/train.py +3 -3
  14. rasa/cli/arguments/visualize.py +2 -2
  15. rasa/cli/arguments/x.py +1 -0
  16. rasa/cli/data.py +20 -3
  17. rasa/cli/dialogue_understanding_test.py +386 -0
  18. rasa/cli/evaluate.py +1 -1
  19. rasa/cli/export.py +6 -6
  20. rasa/cli/inspect.py +20 -1
  21. rasa/cli/interactive.py +4 -5
  22. rasa/cli/llm_fine_tuning.py +51 -16
  23. rasa/cli/markers.py +1 -2
  24. rasa/cli/project_templates/calm/actions/add_contact.py +1 -1
  25. rasa/cli/project_templates/calm/config.yml +2 -2
  26. rasa/cli/project_templates/calm/domain/list_contacts.yml +1 -2
  27. rasa/cli/project_templates/calm/domain/remove_contact.yml +1 -2
  28. rasa/cli/project_templates/calm/domain/shared.yml +1 -4
  29. rasa/cli/project_templates/calm/endpoints.yml +2 -2
  30. rasa/cli/project_templates/tutorial/actions/actions.py +3 -2
  31. rasa/cli/shell.py +5 -6
  32. rasa/cli/studio/download.py +1 -2
  33. rasa/cli/studio/studio.py +2 -3
  34. rasa/cli/studio/train.py +0 -1
  35. rasa/cli/telemetry.py +2 -2
  36. rasa/cli/test.py +11 -11
  37. rasa/cli/train.py +3 -0
  38. rasa/cli/utils.py +25 -5
  39. rasa/constants.py +0 -1
  40. rasa/core/__init__.py +0 -1
  41. rasa/core/actions/action.py +137 -208
  42. rasa/core/actions/action_handle_digressions.py +164 -0
  43. rasa/core/actions/action_hangup.py +1 -1
  44. rasa/core/actions/action_repeat_bot_messages.py +2 -2
  45. rasa/core/actions/action_run_slot_rejections.py +18 -6
  46. rasa/core/actions/action_trigger_chitchat.py +1 -1
  47. rasa/core/actions/action_trigger_flow.py +5 -5
  48. rasa/core/actions/action_trigger_search.py +1 -1
  49. rasa/core/actions/custom_action_executor.py +1 -1
  50. rasa/core/actions/direct_custom_actions_executor.py +1 -0
  51. rasa/core/actions/forms.py +22 -15
  52. rasa/core/actions/http_custom_action_executor.py +8 -1
  53. rasa/core/actions/loops.py +3 -3
  54. rasa/core/actions/two_stage_fallback.py +13 -13
  55. rasa/core/auth_retry_tracker_store.py +1 -2
  56. rasa/core/brokers/broker.py +2 -1
  57. rasa/core/brokers/file.py +1 -1
  58. rasa/core/brokers/kafka.py +8 -8
  59. rasa/core/brokers/pika.py +8 -9
  60. rasa/core/brokers/sql.py +4 -3
  61. rasa/core/channels/__init__.py +7 -0
  62. rasa/core/channels/botframework.py +2 -2
  63. rasa/core/channels/callback.py +4 -4
  64. rasa/core/channels/channel.py +11 -11
  65. rasa/core/channels/console.py +0 -1
  66. rasa/core/channels/development_inspector.py +80 -24
  67. rasa/core/channels/facebook.py +5 -5
  68. rasa/core/channels/hangouts.py +7 -8
  69. rasa/core/channels/inspector/dist/assets/Tableau10-1b767f5e.js +1 -0
  70. rasa/core/channels/inspector/dist/assets/arc-9f1365dc.js +1 -0
  71. rasa/core/channels/inspector/dist/assets/blockDiagram-38ab4fdb-e0f81b12.js +118 -0
  72. rasa/core/channels/inspector/dist/assets/c4Diagram-3d4e48cf-9deaee1c.js +10 -0
  73. rasa/core/channels/inspector/dist/assets/channel-44956714.js +1 -0
  74. rasa/core/channels/inspector/dist/assets/classDiagram-70f12bd4-20450a96.js +2 -0
  75. rasa/core/channels/inspector/dist/assets/classDiagram-v2-f2320105-749d2abf.js +2 -0
  76. rasa/core/channels/inspector/dist/assets/clone-a9475142.js +1 -0
  77. rasa/core/channels/inspector/dist/assets/{createText-62fc7601-89c73b31.js → createText-2e5e7dd3-bef0b38c.js} +1 -1
  78. rasa/core/channels/inspector/dist/assets/edges-e0da2a9e-943801a7.js +4 -0
  79. rasa/core/channels/inspector/dist/assets/{erDiagram-9d236eb7-907e0440.js → erDiagram-9861fffd-d523a948.js} +4 -4
  80. rasa/core/channels/inspector/dist/assets/flowDb-956e92f1-54e4cf19.js +10 -0
  81. rasa/core/channels/inspector/dist/assets/flowDiagram-66a62f08-48bfbbe8.js +4 -0
  82. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-96b9c2cf-43fa749a.js +1 -0
  83. rasa/core/channels/inspector/dist/assets/flowchart-elk-definition-4a651766-17c30827.js +139 -0
  84. rasa/core/channels/inspector/dist/assets/ganttDiagram-c361ad54-43086f2d.js +257 -0
  85. rasa/core/channels/inspector/dist/assets/gitGraphDiagram-72cf32ee-5c8b693e.js +70 -0
  86. rasa/core/channels/inspector/dist/assets/graph-41a90d26.js +1 -0
  87. rasa/core/channels/inspector/dist/assets/index-3862675e-b43eeae9.js +1 -0
  88. rasa/core/channels/inspector/dist/assets/{index-e793d777.js → index-e8affe45.js} +201 -196
  89. rasa/core/channels/inspector/dist/assets/{infoDiagram-736b4530-8ceba4db.js → infoDiagram-f8f76790-0b20676b.js} +1 -1
  90. rasa/core/channels/inspector/dist/assets/{journeyDiagram-df861f2b-960d3809.js → journeyDiagram-49397b02-39bce7b5.js} +4 -4
  91. rasa/core/channels/inspector/dist/assets/katex-498eb57e.js +261 -0
  92. rasa/core/channels/inspector/dist/assets/layout-dc8eeea4.js +1 -0
  93. rasa/core/channels/inspector/dist/assets/{line-eeccc4e2.js → line-c4d2e756.js} +1 -1
  94. rasa/core/channels/inspector/dist/assets/linear-86f6f2d9.js +1 -0
  95. rasa/core/channels/inspector/dist/assets/mindmap-definition-fc14e90a-4216f771.js +312 -0
  96. rasa/core/channels/inspector/dist/assets/{pieDiagram-dbbf0591-dc9b5e1b.js → pieDiagram-8a3498a8-1a0cfa96.js} +7 -7
  97. rasa/core/channels/inspector/dist/assets/{quadrantDiagram-4d7f4fd6-a08cba6d.js → quadrantDiagram-120e2f19-f91e67cf.js} +1 -1
  98. rasa/core/channels/inspector/dist/assets/{requirementDiagram-6fc4c22a-87242b9e.js → requirementDiagram-deff3bca-d4046bed.js} +2 -2
  99. rasa/core/channels/inspector/dist/assets/sankeyDiagram-04a897e0-2cf6d1d7.js +8 -0
  100. rasa/core/channels/inspector/dist/assets/sequenceDiagram-704730f1-751ac4f5.js +122 -0
  101. rasa/core/channels/inspector/dist/assets/stateDiagram-587899a1-f734f4d4.js +1 -0
  102. rasa/core/channels/inspector/dist/assets/stateDiagram-v2-d93cdb3a-91c65710.js +1 -0
  103. rasa/core/channels/inspector/dist/assets/{styles-9c745c82-cef936a6.js → styles-6aaf32cf-e0cff7be.js} +1 -1
  104. rasa/core/channels/inspector/dist/assets/styles-9a916d00-c8029e5d.js +160 -0
  105. rasa/core/channels/inspector/dist/assets/styles-c10674c1-114f312a.js +116 -0
  106. rasa/core/channels/inspector/dist/assets/svgDrawCommon-08f97a94-b7b9dc00.js +1 -0
  107. rasa/core/channels/inspector/dist/assets/{timeline-definition-5b62e21b-0d39bdb2.js → timeline-definition-85554ec2-9536d189.js} +3 -3
  108. rasa/core/channels/inspector/dist/assets/{xychartDiagram-2b33534f-a03fa445.js → xychartDiagram-e933f94c-bf3b0f36.js} +3 -3
  109. rasa/core/channels/inspector/dist/index.html +1 -1
  110. rasa/core/channels/inspector/package.json +11 -3
  111. rasa/core/channels/inspector/src/App.tsx +15 -2
  112. rasa/core/channels/inspector/src/components/RasaLogo.tsx +31 -0
  113. rasa/core/channels/inspector/src/components/RecruitmentPanel.tsx +68 -0
  114. rasa/core/channels/inspector/src/components/Welcome.tsx +19 -13
  115. rasa/core/channels/inspector/yarn.lock +94 -99
  116. rasa/core/channels/mattermost.py +4 -4
  117. rasa/core/channels/rasa_chat.py +4 -4
  118. rasa/core/channels/rest.py +11 -12
  119. rasa/core/channels/rocketchat.py +4 -3
  120. rasa/core/channels/slack.py +6 -5
  121. rasa/core/channels/socketio.py +8 -28
  122. rasa/core/channels/studio_chat.py +212 -0
  123. rasa/core/channels/telegram.py +105 -55
  124. rasa/core/channels/twilio.py +3 -3
  125. rasa/core/channels/vier_cvg.py +2 -2
  126. rasa/core/channels/voice_ready/audiocodes.py +51 -32
  127. rasa/core/channels/voice_ready/jambonz.py +5 -5
  128. rasa/core/channels/voice_ready/jambonz_protocol.py +3 -4
  129. rasa/core/channels/voice_ready/twilio_voice.py +9 -8
  130. rasa/core/channels/voice_ready/utils.py +2 -2
  131. rasa/core/channels/voice_stream/asr/asr_engine.py +12 -6
  132. rasa/core/channels/voice_stream/asr/asr_event.py +5 -0
  133. rasa/core/channels/voice_stream/asr/azure.py +16 -3
  134. rasa/core/channels/voice_stream/asr/deepgram.py +76 -19
  135. rasa/core/channels/voice_stream/audiocodes.py +292 -0
  136. rasa/core/channels/voice_stream/browser_audio.py +14 -7
  137. rasa/core/channels/voice_stream/call_state.py +6 -2
  138. rasa/core/channels/voice_stream/genesys.py +320 -0
  139. rasa/core/channels/voice_stream/tts/azure.py +13 -5
  140. rasa/core/channels/voice_stream/tts/cartesia.py +34 -14
  141. rasa/core/channels/voice_stream/tts/tts_cache.py +3 -2
  142. rasa/core/channels/voice_stream/tts/tts_engine.py +1 -1
  143. rasa/core/channels/voice_stream/twilio_media_streams.py +12 -8
  144. rasa/core/channels/voice_stream/util.py +1 -1
  145. rasa/core/channels/voice_stream/voice_channel.py +100 -56
  146. rasa/core/channels/webexteams.py +3 -4
  147. rasa/core/constants.py +2 -0
  148. rasa/core/evaluation/marker.py +7 -6
  149. rasa/core/evaluation/marker_base.py +15 -16
  150. rasa/core/evaluation/marker_stats.py +3 -4
  151. rasa/core/evaluation/marker_tracker_loader.py +5 -4
  152. rasa/core/exporter.py +4 -4
  153. rasa/core/featurizers/precomputation.py +8 -8
  154. rasa/core/featurizers/single_state_featurizer.py +7 -7
  155. rasa/core/featurizers/tracker_featurizers.py +13 -13
  156. rasa/core/http_interpreter.py +3 -4
  157. rasa/core/information_retrieval/__init__.py +1 -1
  158. rasa/core/information_retrieval/faiss.py +4 -4
  159. rasa/core/information_retrieval/information_retrieval.py +2 -2
  160. rasa/core/information_retrieval/milvus.py +3 -3
  161. rasa/core/information_retrieval/qdrant.py +3 -3
  162. rasa/core/jobs.py +1 -0
  163. rasa/core/lock.py +2 -3
  164. rasa/core/lock_store.py +3 -3
  165. rasa/core/migrate.py +12 -9
  166. rasa/core/nlg/__init__.py +1 -1
  167. rasa/core/nlg/callback.py +2 -3
  168. rasa/core/nlg/contextual_response_rephraser.py +82 -14
  169. rasa/core/nlg/generator.py +85 -17
  170. rasa/core/nlg/interpolator.py +4 -3
  171. rasa/core/nlg/response.py +9 -7
  172. rasa/core/nlg/summarize.py +1 -0
  173. rasa/core/nlg/translate.py +55 -0
  174. rasa/core/persistor.py +3 -3
  175. rasa/core/policies/ensemble.py +10 -9
  176. rasa/core/policies/enterprise_search_policy.py +87 -21
  177. rasa/core/policies/enterprise_search_prompt_with_citation_template.jinja2 +1 -1
  178. rasa/core/policies/flow_policy.py +13 -14
  179. rasa/core/policies/flows/flow_executor.py +85 -55
  180. rasa/core/policies/intentless_policy.py +6 -7
  181. rasa/core/policies/memoization.py +22 -20
  182. rasa/core/policies/policy.py +24 -22
  183. rasa/core/policies/rule_policy.py +37 -36
  184. rasa/core/policies/ted_policy.py +87 -85
  185. rasa/core/policies/unexpected_intent_policy.py +77 -75
  186. rasa/core/processor.py +167 -74
  187. rasa/core/run.py +5 -4
  188. rasa/core/secrets_manager/endpoints.py +2 -3
  189. rasa/core/secrets_manager/factory.py +2 -3
  190. rasa/core/secrets_manager/secret_manager.py +2 -3
  191. rasa/core/secrets_manager/vault.py +2 -2
  192. rasa/core/test.py +30 -30
  193. rasa/core/tracker_store.py +138 -49
  194. rasa/core/train.py +1 -1
  195. rasa/core/training/__init__.py +2 -2
  196. rasa/core/training/converters/responses_prefix_converter.py +1 -2
  197. rasa/core/training/interactive.py +13 -13
  198. rasa/core/training/story_conflict.py +4 -5
  199. rasa/core/training/training.py +3 -5
  200. rasa/core/utils.py +5 -5
  201. rasa/core/visualize.py +1 -1
  202. rasa/dialogue_understanding/coexistence/intent_based_router.py +2 -2
  203. rasa/dialogue_understanding/coexistence/llm_based_router.py +5 -5
  204. rasa/dialogue_understanding/commands/__init__.py +22 -22
  205. rasa/dialogue_understanding/commands/can_not_handle_command.py +38 -1
  206. rasa/dialogue_understanding/commands/cancel_flow_command.py +96 -9
  207. rasa/dialogue_understanding/commands/change_flow_command.py +36 -2
  208. rasa/dialogue_understanding/commands/chit_chat_answer_command.py +36 -4
  209. rasa/dialogue_understanding/commands/clarify_command.py +46 -4
  210. rasa/dialogue_understanding/commands/command.py +3 -2
  211. rasa/dialogue_understanding/commands/command_syntax_manager.py +55 -0
  212. rasa/dialogue_understanding/commands/correct_slots_command.py +14 -5
  213. rasa/dialogue_understanding/commands/error_command.py +1 -1
  214. rasa/dialogue_understanding/commands/free_form_answer_command.py +2 -1
  215. rasa/dialogue_understanding/commands/handle_code_change_command.py +2 -2
  216. rasa/dialogue_understanding/commands/handle_digressions_command.py +144 -0
  217. rasa/dialogue_understanding/commands/human_handoff_command.py +34 -4
  218. rasa/dialogue_understanding/commands/knowledge_answer_command.py +36 -4
  219. rasa/dialogue_understanding/commands/noop_command.py +2 -1
  220. rasa/dialogue_understanding/commands/prompt_command.py +94 -0
  221. rasa/dialogue_understanding/commands/repeat_bot_messages_command.py +34 -4
  222. rasa/dialogue_understanding/commands/restart_command.py +2 -5
  223. rasa/dialogue_understanding/commands/session_end_command.py +3 -5
  224. rasa/dialogue_understanding/commands/session_start_command.py +3 -5
  225. rasa/dialogue_understanding/commands/set_slot_command.py +55 -16
  226. rasa/dialogue_understanding/commands/skip_question_command.py +34 -4
  227. rasa/dialogue_understanding/commands/start_flow_command.py +78 -2
  228. rasa/dialogue_understanding/commands/user_silence_command.py +3 -5
  229. rasa/dialogue_understanding/commands/utils.py +126 -43
  230. rasa/dialogue_understanding/constants.py +2 -0
  231. rasa/dialogue_understanding/generator/__init__.py +2 -0
  232. rasa/dialogue_understanding/generator/command_generator.py +120 -79
  233. rasa/dialogue_understanding/generator/command_parser.py +245 -0
  234. rasa/dialogue_understanding/generator/constants.py +12 -4
  235. rasa/dialogue_understanding/generator/flow_retrieval.py +7 -7
  236. rasa/dialogue_understanding/generator/llm_based_command_generator.py +187 -59
  237. rasa/dialogue_understanding/generator/llm_command_generator.py +6 -3
  238. rasa/dialogue_understanding/generator/multi_step/multi_step_llm_command_generator.py +106 -110
  239. rasa/dialogue_understanding/generator/nlu_command_adapter.py +53 -11
  240. rasa/dialogue_understanding/generator/prompt_templates/__init__.py +0 -0
  241. rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_claude_3_5_sonnet_20240620_template.jinja2 +58 -0
  242. rasa/dialogue_understanding/generator/prompt_templates/command_prompt_v2_gpt_4o_2024_11_20_template.jinja2 +57 -0
  243. rasa/dialogue_understanding/generator/single_step/compact_llm_command_generator.py +574 -0
  244. rasa/dialogue_understanding/generator/single_step/single_step_llm_command_generator.py +41 -386
  245. rasa/dialogue_understanding/generator/utils.py +76 -0
  246. rasa/dialogue_understanding/patterns/cancel.py +2 -1
  247. rasa/dialogue_understanding/patterns/cannot_handle.py +1 -0
  248. rasa/dialogue_understanding/patterns/chitchat.py +1 -1
  249. rasa/dialogue_understanding/patterns/clarify.py +2 -1
  250. rasa/dialogue_understanding/patterns/code_change.py +2 -0
  251. rasa/dialogue_understanding/patterns/collect_information.py +7 -4
  252. rasa/dialogue_understanding/patterns/completed.py +1 -1
  253. rasa/dialogue_understanding/patterns/continue_interrupted.py +1 -1
  254. rasa/dialogue_understanding/patterns/correction.py +17 -3
  255. rasa/dialogue_understanding/patterns/default_flows_for_patterns.yml +78 -2
  256. rasa/dialogue_understanding/patterns/handle_digressions.py +81 -0
  257. rasa/dialogue_understanding/patterns/human_handoff.py +1 -1
  258. rasa/dialogue_understanding/patterns/internal_error.py +1 -0
  259. rasa/dialogue_understanding/patterns/search.py +1 -1
  260. rasa/dialogue_understanding/patterns/session_start.py +1 -1
  261. rasa/dialogue_understanding/patterns/skip_question.py +1 -0
  262. rasa/dialogue_understanding/patterns/user_silence.py +1 -1
  263. rasa/dialogue_understanding/patterns/validate_slot.py +65 -0
  264. rasa/dialogue_understanding/processor/command_processor.py +193 -43
  265. rasa/dialogue_understanding/processor/command_processor_component.py +1 -1
  266. rasa/dialogue_understanding/stack/dialogue_stack.py +4 -3
  267. rasa/dialogue_understanding/stack/frames/__init__.py +2 -2
  268. rasa/dialogue_understanding/stack/frames/chit_chat_frame.py +4 -1
  269. rasa/dialogue_understanding/stack/frames/dialogue_stack_frame.py +2 -3
  270. rasa/dialogue_understanding/stack/frames/flow_stack_frame.py +5 -2
  271. rasa/dialogue_understanding/stack/frames/search_frame.py +4 -1
  272. rasa/dialogue_understanding/stack/utils.py +56 -10
  273. rasa/dialogue_understanding/utils.py +164 -0
  274. rasa/dialogue_understanding_test/README.md +429 -0
  275. rasa/dialogue_understanding_test/__init__.py +0 -0
  276. rasa/dialogue_understanding_test/command_comparison.py +60 -0
  277. rasa/dialogue_understanding_test/command_metric_calculation.py +122 -0
  278. rasa/dialogue_understanding_test/constants.py +22 -0
  279. rasa/dialogue_understanding_test/du_test_case.py +448 -0
  280. rasa/dialogue_understanding_test/du_test_result.py +390 -0
  281. rasa/dialogue_understanding_test/du_test_runner.py +322 -0
  282. rasa/dialogue_understanding_test/du_test_schema.yml +161 -0
  283. rasa/dialogue_understanding_test/io.py +443 -0
  284. rasa/dialogue_understanding_test/test_case_simulation/__init__.py +0 -0
  285. rasa/dialogue_understanding_test/test_case_simulation/exception.py +28 -0
  286. rasa/dialogue_understanding_test/test_case_simulation/test_case_tracker_simulator.py +336 -0
  287. rasa/dialogue_understanding_test/utils.py +70 -0
  288. rasa/dialogue_understanding_test/validation.py +77 -0
  289. rasa/e2e_test/aggregate_test_stats_calculator.py +1 -1
  290. rasa/e2e_test/assertions.py +202 -175
  291. rasa/e2e_test/assertions_schema.yml +6 -0
  292. rasa/e2e_test/constants.py +16 -1
  293. rasa/e2e_test/e2e_config.py +102 -41
  294. rasa/e2e_test/e2e_config_schema.yml +28 -10
  295. rasa/e2e_test/e2e_test_case.py +5 -5
  296. rasa/e2e_test/e2e_test_converter.py +2 -3
  297. rasa/e2e_test/e2e_test_coverage_report.py +6 -6
  298. rasa/e2e_test/e2e_test_result.py +1 -1
  299. rasa/e2e_test/e2e_test_runner.py +143 -38
  300. rasa/e2e_test/llm_judge_prompts/answer_relevance_prompt_template.jinja2 +93 -0
  301. rasa/e2e_test/llm_judge_prompts/groundedness_prompt_template.jinja2 +169 -0
  302. rasa/e2e_test/stub_custom_action.py +1 -1
  303. rasa/e2e_test/utils/generative_assertions.py +243 -0
  304. rasa/e2e_test/utils/io.py +123 -93
  305. rasa/e2e_test/utils/validation.py +101 -3
  306. rasa/engine/caching.py +5 -7
  307. rasa/engine/constants.py +1 -1
  308. rasa/engine/graph.py +3 -2
  309. rasa/engine/language.py +182 -0
  310. rasa/engine/recipes/config_files/default_config.yml +4 -0
  311. rasa/engine/recipes/default_components.py +13 -15
  312. rasa/engine/recipes/default_recipe.py +65 -49
  313. rasa/engine/recipes/graph_recipe.py +10 -7
  314. rasa/engine/recipes/recipe.py +2 -2
  315. rasa/engine/runner/dask.py +2 -2
  316. rasa/engine/runner/interface.py +1 -0
  317. rasa/engine/storage/local_model_storage.py +6 -4
  318. rasa/engine/storage/resource.py +2 -1
  319. rasa/engine/storage/storage.py +8 -3
  320. rasa/engine/training/components.py +2 -1
  321. rasa/engine/training/fingerprinting.py +4 -2
  322. rasa/engine/training/graph_trainer.py +4 -4
  323. rasa/engine/training/hooks.py +2 -2
  324. rasa/engine/validation.py +36 -33
  325. rasa/exceptions.py +3 -2
  326. rasa/graph_components/converters/nlu_message_converter.py +3 -3
  327. rasa/graph_components/providers/domain_for_core_training_provider.py +3 -3
  328. rasa/graph_components/providers/domain_provider.py +3 -2
  329. rasa/graph_components/providers/flows_provider.py +2 -3
  330. rasa/graph_components/providers/forms_provider.py +4 -4
  331. rasa/graph_components/providers/nlu_training_data_provider.py +5 -3
  332. rasa/graph_components/providers/responses_provider.py +4 -4
  333. rasa/graph_components/providers/rule_only_provider.py +3 -2
  334. rasa/graph_components/providers/story_graph_provider.py +8 -8
  335. rasa/graph_components/providers/training_tracker_provider.py +3 -2
  336. rasa/graph_components/validators/default_recipe_validator.py +16 -16
  337. rasa/graph_components/validators/finetuning_validator.py +10 -8
  338. rasa/hooks.py +19 -14
  339. rasa/jupyter.py +2 -2
  340. rasa/llm_fine_tuning/annotation_module.py +4 -4
  341. rasa/llm_fine_tuning/conversations.py +5 -33
  342. rasa/llm_fine_tuning/llm_data_preparation_module.py +6 -4
  343. rasa/llm_fine_tuning/paraphrasing/conversation_rephraser.py +4 -4
  344. rasa/llm_fine_tuning/paraphrasing/rephrase_validator.py +18 -13
  345. rasa/llm_fine_tuning/paraphrasing_module.py +6 -2
  346. rasa/llm_fine_tuning/storage.py +3 -3
  347. rasa/llm_fine_tuning/train_test_split_module.py +27 -27
  348. rasa/llm_fine_tuning/utils.py +7 -0
  349. rasa/markers/marker.py +2 -3
  350. rasa/markers/marker_base.py +1 -2
  351. rasa/markers/upload.py +2 -2
  352. rasa/markers/validate.py +2 -3
  353. rasa/model.py +3 -5
  354. rasa/model_manager/config.py +1 -1
  355. rasa/model_manager/model_api.py +5 -4
  356. rasa/model_manager/runner_service.py +13 -10
  357. rasa/model_manager/socket_bridge.py +15 -9
  358. rasa/model_manager/studio_jwt_auth.py +1 -0
  359. rasa/model_manager/trainer_service.py +9 -7
  360. rasa/model_manager/utils.py +1 -1
  361. rasa/model_manager/warm_rasa_process.py +14 -9
  362. rasa/model_service.py +5 -6
  363. rasa/model_testing.py +13 -15
  364. rasa/model_training.py +29 -29
  365. rasa/nlu/classifiers/diet_classifier.py +72 -73
  366. rasa/nlu/classifiers/fallback_classifier.py +9 -8
  367. rasa/nlu/classifiers/keyword_intent_classifier.py +7 -6
  368. rasa/nlu/classifiers/logistic_regression_classifier.py +3 -3
  369. rasa/nlu/classifiers/mitie_intent_classifier.py +5 -4
  370. rasa/nlu/classifiers/regex_message_handler.py +3 -2
  371. rasa/nlu/classifiers/sklearn_intent_classifier.py +2 -2
  372. rasa/nlu/convert.py +2 -2
  373. rasa/nlu/emulators/dialogflow.py +3 -3
  374. rasa/nlu/emulators/luis.py +5 -5
  375. rasa/nlu/emulators/no_emulator.py +1 -0
  376. rasa/nlu/emulators/wit.py +4 -4
  377. rasa/nlu/extractors/crf_entity_extractor.py +11 -11
  378. rasa/nlu/extractors/duckling_entity_extractor.py +7 -6
  379. rasa/nlu/extractors/entity_synonyms.py +10 -9
  380. rasa/nlu/extractors/extractor.py +16 -16
  381. rasa/nlu/extractors/mitie_entity_extractor.py +10 -9
  382. rasa/nlu/extractors/regex_entity_extractor.py +11 -10
  383. rasa/nlu/extractors/spacy_entity_extractor.py +2 -2
  384. rasa/nlu/featurizers/dense_featurizer/convert_featurizer.py +15 -14
  385. rasa/nlu/featurizers/dense_featurizer/dense_featurizer.py +2 -1
  386. rasa/nlu/featurizers/dense_featurizer/lm_featurizer.py +10 -9
  387. rasa/nlu/featurizers/dense_featurizer/mitie_featurizer.py +9 -7
  388. rasa/nlu/featurizers/dense_featurizer/spacy_featurizer.py +13 -12
  389. rasa/nlu/featurizers/featurizer.py +5 -4
  390. rasa/nlu/featurizers/sparse_featurizer/count_vectors_featurizer.py +6 -6
  391. rasa/nlu/featurizers/sparse_featurizer/lexical_syntactic_featurizer.py +4 -4
  392. rasa/nlu/featurizers/sparse_featurizer/regex_featurizer.py +4 -4
  393. rasa/nlu/featurizers/sparse_featurizer/sparse_featurizer.py +2 -0
  394. rasa/nlu/model.py +0 -1
  395. rasa/nlu/selectors/response_selector.py +67 -68
  396. rasa/nlu/test.py +38 -38
  397. rasa/nlu/tokenizers/jieba_tokenizer.py +1 -2
  398. rasa/nlu/tokenizers/mitie_tokenizer.py +2 -2
  399. rasa/nlu/tokenizers/spacy_tokenizer.py +3 -3
  400. rasa/nlu/tokenizers/tokenizer.py +6 -7
  401. rasa/nlu/tokenizers/whitespace_tokenizer.py +1 -1
  402. rasa/nlu/utils/bilou_utils.py +7 -7
  403. rasa/nlu/utils/hugging_face/registry.py +22 -22
  404. rasa/nlu/utils/hugging_face/transformers_pre_post_processors.py +2 -1
  405. rasa/nlu/utils/mitie_utils.py +2 -1
  406. rasa/nlu/utils/pattern_utils.py +1 -1
  407. rasa/nlu/utils/spacy_utils.py +3 -3
  408. rasa/plugin.py +12 -1
  409. rasa/server.py +6 -3
  410. rasa/shared/constants.py +45 -18
  411. rasa/shared/core/command_payload_reader.py +15 -7
  412. rasa/shared/core/constants.py +34 -4
  413. rasa/shared/core/conversation.py +1 -2
  414. rasa/shared/core/domain.py +19 -20
  415. rasa/shared/core/events.py +60 -39
  416. rasa/shared/core/flows/__init__.py +0 -1
  417. rasa/shared/core/flows/constants.py +11 -0
  418. rasa/shared/core/flows/flow.py +107 -26
  419. rasa/shared/core/flows/flow_step.py +4 -3
  420. rasa/shared/core/flows/flow_step_links.py +1 -2
  421. rasa/shared/core/flows/flow_step_sequence.py +1 -1
  422. rasa/shared/core/flows/flows_list.py +3 -3
  423. rasa/shared/core/flows/flows_yaml_schema.json +69 -3
  424. rasa/shared/core/flows/nlu_trigger.py +1 -1
  425. rasa/shared/core/flows/steps/__init__.py +2 -2
  426. rasa/shared/core/flows/steps/action.py +1 -1
  427. rasa/shared/core/flows/steps/call.py +1 -1
  428. rasa/shared/core/flows/steps/collect.py +22 -40
  429. rasa/shared/core/flows/steps/internal.py +1 -1
  430. rasa/shared/core/flows/steps/link.py +1 -1
  431. rasa/shared/core/flows/steps/no_operation.py +2 -2
  432. rasa/shared/core/flows/steps/set_slots.py +1 -1
  433. rasa/shared/core/flows/utils.py +44 -4
  434. rasa/shared/core/flows/validation.py +4 -6
  435. rasa/shared/core/generator.py +20 -21
  436. rasa/shared/core/slot_mappings.py +360 -121
  437. rasa/shared/core/slots.py +163 -6
  438. rasa/shared/core/trackers.py +108 -33
  439. rasa/shared/core/training_data/loading.py +1 -1
  440. rasa/shared/core/training_data/story_reader/story_reader.py +3 -3
  441. rasa/shared/core/training_data/story_reader/story_step_builder.py +4 -4
  442. rasa/shared/core/training_data/story_reader/yaml_story_reader.py +29 -31
  443. rasa/shared/core/training_data/story_writer/yaml_story_writer.py +22 -24
  444. rasa/shared/core/training_data/structures.py +11 -12
  445. rasa/shared/core/training_data/visualization.py +10 -10
  446. rasa/shared/data.py +6 -6
  447. rasa/shared/engine/caching.py +0 -1
  448. rasa/shared/exceptions.py +2 -2
  449. rasa/shared/importers/importer.py +58 -2
  450. rasa/shared/importers/rasa.py +5 -6
  451. rasa/shared/importers/utils.py +1 -1
  452. rasa/shared/nlu/constants.py +9 -0
  453. rasa/shared/nlu/training_data/entities_parser.py +6 -6
  454. rasa/shared/nlu/training_data/features.py +3 -3
  455. rasa/shared/nlu/training_data/formats/__init__.py +1 -1
  456. rasa/shared/nlu/training_data/formats/dialogflow.py +4 -5
  457. rasa/shared/nlu/training_data/formats/luis.py +7 -8
  458. rasa/shared/nlu/training_data/formats/rasa.py +4 -5
  459. rasa/shared/nlu/training_data/formats/rasa_yaml.py +17 -16
  460. rasa/shared/nlu/training_data/formats/readerwriter.py +8 -11
  461. rasa/shared/nlu/training_data/formats/wit.py +3 -4
  462. rasa/shared/nlu/training_data/loading.py +4 -4
  463. rasa/shared/nlu/training_data/lookup_tables_parser.py +1 -1
  464. rasa/shared/nlu/training_data/message.py +13 -14
  465. rasa/shared/nlu/training_data/schemas/data_schema.py +1 -1
  466. rasa/shared/nlu/training_data/schemas/responses.yml +19 -11
  467. rasa/shared/nlu/training_data/synonyms_parser.py +3 -3
  468. rasa/shared/nlu/training_data/training_data.py +12 -13
  469. rasa/shared/nlu/training_data/util.py +11 -10
  470. rasa/shared/providers/_configs/azure_entra_id_config.py +541 -0
  471. rasa/shared/providers/_configs/azure_openai_client_config.py +150 -15
  472. rasa/shared/providers/_configs/client_config.py +3 -1
  473. rasa/shared/providers/_configs/default_litellm_client_config.py +9 -7
  474. rasa/shared/providers/_configs/huggingface_local_embedding_client_config.py +13 -11
  475. rasa/shared/providers/_configs/litellm_router_client_config.py +12 -10
  476. rasa/shared/providers/_configs/model_group_config.py +8 -5
  477. rasa/shared/providers/_configs/oauth_config.py +33 -0
  478. rasa/shared/providers/_configs/openai_client_config.py +14 -12
  479. rasa/shared/providers/_configs/rasa_llm_client_config.py +5 -3
  480. rasa/shared/providers/_configs/self_hosted_llm_client_config.py +12 -11
  481. rasa/shared/providers/_configs/utils.py +1 -0
  482. rasa/shared/providers/_ssl_verification_utils.py +5 -6
  483. rasa/shared/providers/_utils.py +5 -5
  484. rasa/shared/providers/constants.py +6 -0
  485. rasa/shared/providers/embedding/_base_litellm_embedding_client.py +1 -1
  486. rasa/shared/providers/embedding/azure_openai_embedding_client.py +32 -7
  487. rasa/shared/providers/embedding/embedding_client.py +1 -1
  488. rasa/shared/providers/embedding/litellm_router_embedding_client.py +5 -2
  489. rasa/shared/providers/llm/_base_litellm_client.py +43 -18
  490. rasa/shared/providers/llm/azure_openai_llm_client.py +90 -34
  491. rasa/shared/providers/llm/default_litellm_llm_client.py +4 -2
  492. rasa/shared/providers/llm/litellm_router_llm_client.py +32 -9
  493. rasa/shared/providers/llm/llm_client.py +24 -8
  494. rasa/shared/providers/llm/llm_response.py +61 -2
  495. rasa/shared/providers/llm/openai_llm_client.py +11 -5
  496. rasa/shared/providers/llm/rasa_llm_client.py +17 -14
  497. rasa/shared/providers/llm/self_hosted_llm_client.py +35 -15
  498. rasa/shared/providers/mappings.py +18 -19
  499. rasa/shared/providers/router/_base_litellm_router_client.py +48 -15
  500. rasa/shared/providers/router/router_client.py +3 -1
  501. rasa/shared/utils/cli.py +1 -1
  502. rasa/shared/utils/common.py +15 -1
  503. rasa/shared/utils/constants.py +3 -0
  504. rasa/shared/utils/health_check/embeddings_health_check_mixin.py +1 -1
  505. rasa/shared/utils/health_check/health_check.py +3 -3
  506. rasa/shared/utils/health_check/llm_health_check_mixin.py +1 -1
  507. rasa/shared/utils/io.py +1 -1
  508. rasa/shared/utils/llm.py +100 -18
  509. rasa/shared/utils/pykwalify_extensions.py +25 -1
  510. rasa/shared/utils/schemas/domain.yml +26 -1
  511. rasa/shared/utils/schemas/events.py +1 -1
  512. rasa/shared/utils/yaml.py +24 -20
  513. rasa/studio/auth.py +3 -3
  514. rasa/studio/config.py +1 -2
  515. rasa/studio/data_handler.py +3 -3
  516. rasa/studio/download.py +1 -1
  517. rasa/studio/results_logger.py +3 -3
  518. rasa/studio/upload.py +21 -5
  519. rasa/telemetry.py +127 -48
  520. rasa/tracing/config.py +5 -3
  521. rasa/tracing/constants.py +12 -0
  522. rasa/tracing/instrumentation/attribute_extractors.py +92 -14
  523. rasa/tracing/instrumentation/instrumentation.py +61 -5
  524. rasa/tracing/instrumentation/intentless_policy_instrumentation.py +1 -1
  525. rasa/tracing/instrumentation/metrics.py +52 -11
  526. rasa/tracing/metric_instrument_provider.py +54 -14
  527. rasa/utils/common.py +12 -24
  528. rasa/utils/endpoints.py +1 -1
  529. rasa/utils/io.py +7 -7
  530. rasa/utils/licensing.py +3 -4
  531. rasa/utils/log_utils.py +7 -6
  532. rasa/utils/ml_utils.py +1 -0
  533. rasa/utils/plotting.py +3 -3
  534. rasa/utils/sanic_error_handler.py +1 -1
  535. rasa/utils/tensorflow/callback.py +2 -2
  536. rasa/utils/tensorflow/crf.py +2 -2
  537. rasa/utils/tensorflow/data_generator.py +5 -5
  538. rasa/utils/tensorflow/environment.py +3 -3
  539. rasa/utils/tensorflow/feature_array.py +2 -3
  540. rasa/utils/tensorflow/layers.py +18 -12
  541. rasa/utils/tensorflow/layers_utils.py +2 -1
  542. rasa/utils/tensorflow/metrics.py +2 -2
  543. rasa/utils/tensorflow/model_data.py +7 -7
  544. rasa/utils/tensorflow/model_data_utils.py +10 -9
  545. rasa/utils/tensorflow/models.py +31 -32
  546. rasa/utils/tensorflow/rasa_layers.py +20 -19
  547. rasa/utils/tensorflow/types.py +2 -1
  548. rasa/utils/train_utils.py +23 -21
  549. rasa/utils/url_tools.py +1 -1
  550. rasa/validator.py +594 -115
  551. rasa/version.py +1 -1
  552. {rasa_pro-3.11.4.dist-info → rasa_pro-3.12.0.dist-info}/METADATA +23 -26
  553. rasa_pro-3.12.0.dist-info/RECORD +829 -0
  554. rasa/core/channels/inspector/dist/assets/arc-632a63ec.js +0 -1
  555. rasa/core/channels/inspector/dist/assets/c4Diagram-d0fbc5ce-081e0df4.js +0 -10
  556. rasa/core/channels/inspector/dist/assets/classDiagram-936ed81e-3df0afc2.js +0 -2
  557. rasa/core/channels/inspector/dist/assets/classDiagram-v2-c3cb15f1-8c5ed31e.js +0 -2
  558. rasa/core/channels/inspector/dist/assets/edges-f2ad444c-4fc48c3e.js +0 -4
  559. rasa/core/channels/inspector/dist/assets/flowDb-1972c806-9ec53a3c.js +0 -6
  560. rasa/core/channels/inspector/dist/assets/flowDiagram-7ea5b25a-41da787a.js +0 -4
  561. rasa/core/channels/inspector/dist/assets/flowDiagram-v2-855bc5b3-8bea338b.js +0 -1
  562. rasa/core/channels/inspector/dist/assets/flowchart-elk-definition-abe16c3d-ce370633.js +0 -139
  563. rasa/core/channels/inspector/dist/assets/ganttDiagram-9b5ea136-90a36523.js +0 -266
  564. rasa/core/channels/inspector/dist/assets/gitGraphDiagram-99d0ae7c-41e1aa3f.js +0 -70
  565. rasa/core/channels/inspector/dist/assets/index-2c4b9a3b-e6f2af62.js +0 -1
  566. rasa/core/channels/inspector/dist/assets/layout-498807d8.js +0 -1
  567. rasa/core/channels/inspector/dist/assets/linear-8a078617.js +0 -1
  568. rasa/core/channels/inspector/dist/assets/mindmap-definition-beec6740-396d17dd.js +0 -109
  569. rasa/core/channels/inspector/dist/assets/sankeyDiagram-8f13d901-53f6f391.js +0 -8
  570. rasa/core/channels/inspector/dist/assets/sequenceDiagram-b655622a-715c9c20.js +0 -122
  571. rasa/core/channels/inspector/dist/assets/stateDiagram-59f0c015-2e8fb31f.js +0 -1
  572. rasa/core/channels/inspector/dist/assets/stateDiagram-v2-2b26beab-7e2d2aa0.js +0 -1
  573. rasa/core/channels/inspector/dist/assets/styles-080da4f6-4420cea6.js +0 -110
  574. rasa/core/channels/inspector/dist/assets/styles-3dcbcfbf-28676cf4.js +0 -159
  575. rasa/core/channels/inspector/dist/assets/svgDrawCommon-4835440b-151251e9.js +0 -1
  576. rasa_pro-3.11.4.dist-info/RECORD +0 -779
  577. /rasa/dialogue_understanding/generator/{single_step → prompt_templates}/command_prompt_template.jinja2 +0 -0
  578. {rasa_pro-3.11.4.dist-info → rasa_pro-3.12.0.dist-info}/NOTICE +0 -0
  579. {rasa_pro-3.11.4.dist-info → rasa_pro-3.12.0.dist-info}/WHEEL +0 -0
  580. {rasa_pro-3.11.4.dist-info → rasa_pro-3.12.0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,312 @@
1
+ import{P as Li,Q as Nu,l as Sr,c as Ri,U as ku,t as Bu,W as hn,d as dn,h as Fu,at as Gu,au as zu,av as _u,Y as Vu}from"./index-e8affe45.js";import{a as Uu}from"./createText-2e5e7dd3-bef0b38c.js";function qe(t){"@babel/helpers - typeof";return qe=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},qe(t)}function fr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ss(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,a.key,a)}}function cr(t,e,r){return e&&ss(t.prototype,e),r&&ss(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Lo(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ye(t,e){return $u(t)||Xu(t,e)||Ii(t,e)||qu()}function Ro(t){return Yu(t)||Hu(t)||Ii(t)||Wu()}function Yu(t){if(Array.isArray(t))return fi(t)}function $u(t){if(Array.isArray(t))return t}function Hu(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Xu(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a=[],n=!0,i=!1,s,o;try{for(r=r.call(t);!(n=(s=r.next()).done)&&(a.push(s.value),!(e&&a.length===e));n=!0);}catch(l){i=!0,o=l}finally{try{!n&&r.return!=null&&r.return()}finally{if(i)throw o}}return a}}function Ii(t,e){if(t){if(typeof t=="string")return fi(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fi(t,e)}}function fi(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=new Array(e);r<e;r++)a[r]=t[r];return a}function Wu(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qu(){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 Et(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ii(t))||e&&t&&typeof t.length=="number"){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(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
4
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,s=!1,o;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return i=l.done,l},e:function(l){s=!0,o=l},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(s)throw o}}}}var He=typeof window>"u"?null:window,os=He?He.navigator:null;He&&He.document;var Ku=qe(""),Io=qe({}),Zu=qe(function(){}),Qu=typeof HTMLElement>"u"?"undefined":qe(HTMLElement),Oa=function(e){return e&&e.instanceString&&Ve(e.instanceString)?e.instanceString():null},ce=function(e){return e!=null&&qe(e)==Ku},Ve=function(e){return e!=null&&qe(e)===Zu},Ne=function(e){return!xt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Ae=function(e){return e!=null&&qe(e)===Io&&!Ne(e)&&e.constructor===Object},Ju=function(e){return e!=null&&qe(e)===Io},re=function(e){return e!=null&&qe(e)===qe(1)&&!isNaN(e)},ju=function(e){return re(e)&&Math.floor(e)===e},gn=function(e){if(Qu!=="undefined")return e!=null&&e instanceof HTMLElement},xt=function(e){return Pa(e)||Oo(e)},Pa=function(e){return Oa(e)==="collection"&&e._private.single},Oo=function(e){return Oa(e)==="collection"&&!e._private.single},Oi=function(e){return Oa(e)==="core"},Po=function(e){return Oa(e)==="stylesheet"},ef=function(e){return Oa(e)==="event"},ar=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},tf=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},rf=function(e){return Ae(e)&&re(e.x1)&&re(e.x2)&&re(e.y1)&&re(e.y2)},af=function(e){return Ju(e)&&Ve(e.then)},nf=function(){return os&&os.userAgent.match(/msie|trident|edge/i)},wa=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);return i.join("$")});var a=function n(){var i=this,s=arguments,o,l=r.apply(i,s),u=n.cache;return(o=u[l])||(o=u[l]=e.apply(i,s)),o};return a.cache={},a},Pi=wa(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),An=wa(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Mo=wa(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),ls=function(e){return ar(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},We="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",sf="rgb[a]?\\(("+We+"[%]?)\\s*,\\s*("+We+"[%]?)\\s*,\\s*("+We+"[%]?)(?:\\s*,\\s*("+We+"))?\\)",of="rgb[a]?\\((?:"+We+"[%]?)\\s*,\\s*(?:"+We+"[%]?)\\s*,\\s*(?:"+We+"[%]?)(?:\\s*,\\s*(?:"+We+"))?\\)",lf="hsl[a]?\\(("+We+")\\s*,\\s*("+We+"[%])\\s*,\\s*("+We+"[%])(?:\\s*,\\s*("+We+"))?\\)",uf="hsl[a]?\\((?:"+We+")\\s*,\\s*(?:"+We+"[%])\\s*,\\s*(?:"+We+"[%])(?:\\s*,\\s*(?:"+We+"))?\\)",ff="\\#[0-9a-fA-F]{3}",cf="\\#[0-9a-fA-F]{6}",No=function(e,r){return e<r?-1:e>r?1:0},vf=function(e,r){return-1*No(e,r)},he=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 s=n[i];t[s]=a[s]}}return t},hf=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,s=16;return r?(a=parseInt(e[1]+e[1],s),n=parseInt(e[2]+e[2],s),i=parseInt(e[3]+e[3],s)):(a=parseInt(e[1]+e[2],s),n=parseInt(e[3]+e[4],s),i=parseInt(e[5]+e[6],s)),[a,n,i]}},df=function(e){var r,a,n,i,s,o,l,u;function f(d,g,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?d+(g-d)*6*p:p<1/2?g:p<2/3?d+(g-d)*(2/3-p)*6:d}var c=new RegExp("^"+lf+"$").exec(e);if(c){if(a=parseInt(c[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(c[2]),n<0||n>100||(n=n/100,i=parseFloat(c[3]),i<0||i>100)||(i=i/100,s=c[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=l=u=Math.round(i*255);else{var h=i<.5?i*(1+n):i+n-i*n,v=2*i-h;o=Math.round(255*f(v,h,a+1/3)),l=Math.round(255*f(v,h,a)),u=Math.round(255*f(v,h,a-1/3))}r=[o,l,u,s]}return r},gf=function(e){var r,a=new RegExp("^"+sf+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(o&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},pf=function(e){return yf[e.toLowerCase()]},ko=function(e){return(Ne(e)?e:null)||pf(e)||hf(e)||gf(e)||df(e)},yf={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]},Bo=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(Ae(s))throw Error("Tried to set map with object key");i<a.length-1?(r[s]==null&&(r[s]={}),r=r[s]):r[s]=e.value}},Fo=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(Ae(s))throw Error("Tried to get map with object key");if(r=r[s],r==null)return r}return r};function mf(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var wr=mf,ca=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bf(t,e){return e={exports:{}},t(e,e.exports),e.exports}var wf=typeof ca=="object"&&ca&&ca.Object===Object&&ca,Ef=wf,xf=typeof self=="object"&&self&&self.Object===Object&&self,Tf=Ef||xf||Function("return this")(),Ln=Tf,Cf=function(){return Ln.Date.now()},Xn=Cf,Df=/\s/;function Sf(t){for(var e=t.length;e--&&Df.test(t.charAt(e)););return e}var Af=Sf,Lf=/^\s+/;function Rf(t){return t&&t.slice(0,Af(t)+1).replace(Lf,"")}var If=Rf,Of=Ln.Symbol,Ur=Of,Go=Object.prototype,Pf=Go.hasOwnProperty,Mf=Go.toString,na=Ur?Ur.toStringTag:void 0;function Nf(t){var e=Pf.call(t,na),r=t[na];try{t[na]=void 0;var a=!0}catch{}var n=Mf.call(t);return a&&(e?t[na]=r:delete t[na]),n}var kf=Nf,Bf=Object.prototype,Ff=Bf.toString;function Gf(t){return Ff.call(t)}var zf=Gf,_f="[object Null]",Vf="[object Undefined]",us=Ur?Ur.toStringTag:void 0;function Uf(t){return t==null?t===void 0?Vf:_f:us&&us in Object(t)?kf(t):zf(t)}var zo=Uf;function Yf(t){return t!=null&&typeof t=="object"}var $f=Yf,Hf="[object Symbol]";function Xf(t){return typeof t=="symbol"||$f(t)&&zo(t)==Hf}var Ma=Xf,fs=0/0,Wf=/^[-+]0x[0-9a-f]+$/i,qf=/^0b[01]+$/i,Kf=/^0o[0-7]+$/i,Zf=parseInt;function Qf(t){if(typeof t=="number")return t;if(Ma(t))return fs;if(wr(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=wr(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=If(t);var r=qf.test(t);return r||Kf.test(t)?Zf(t.slice(2),r?2:8):Wf.test(t)?fs:+t}var cs=Qf,Jf="Expected a function",jf=Math.max,ec=Math.min;function tc(t,e,r){var a,n,i,s,o,l,u=0,f=!1,c=!1,h=!0;if(typeof t!="function")throw new TypeError(Jf);e=cs(e)||0,wr(r)&&(f=!!r.leading,c="maxWait"in r,i=c?jf(cs(r.maxWait)||0,e):i,h="trailing"in r?!!r.trailing:h);function v(D){var w=a,x=n;return a=n=void 0,u=D,s=t.apply(x,w),s}function d(D){return u=D,o=setTimeout(y,e),f?v(D):s}function g(D){var w=D-l,x=D-u,E=e-w;return c?ec(E,i-x):E}function p(D){var w=D-l,x=D-u;return l===void 0||w>=e||w<0||c&&x>=i}function y(){var D=Xn();if(p(D))return b(D);o=setTimeout(y,g(D))}function b(D){return o=void 0,h&&a?v(D):(a=n=void 0,s)}function m(){o!==void 0&&clearTimeout(o),u=0,a=l=n=o=void 0}function T(){return o===void 0?s:b(Xn())}function C(){var D=Xn(),w=p(D);if(a=arguments,n=this,l=D,w){if(o===void 0)return d(l);if(c)return clearTimeout(o),o=setTimeout(y,e),v(l)}return o===void 0&&(o=setTimeout(y,e)),s}return C.cancel=m,C.flush=T,C}var Na=tc,Wn=He?He.performance:null,_o=Wn&&Wn.now?function(){return Wn.now()}:function(){return Date.now()},rc=function(){if(He){if(He.requestAnimationFrame)return function(t){He.requestAnimationFrame(t)};if(He.mozRequestAnimationFrame)return function(t){He.mozRequestAnimationFrame(t)};if(He.webkitRequestAnimationFrame)return function(t){He.webkitRequestAnimationFrame(t)};if(He.msRequestAnimationFrame)return function(t){He.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(_o())},1e3/60)}}(),pn=function(e){return rc(e)},Xt=_o,kr=9261,Vo=65599,va=5381,Uo=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kr,a=r,n;n=e.next(),!n.done;)a=a*Vo+n.value|0;return a},Ea=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kr;return r*Vo+e|0},xa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:va;return(r<<5)+r+e|0},ac=function(e,r){return e*2097152+r},Qt=function(e){return e[0]*2097152+e[1]},Ya=function(e,r){return[Ea(e[0],r[0]),xa(e[1],r[1])]},nc=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return Uo(s,r)},nr=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return Uo(s,r)},Yo=function(){return ic(arguments)},ic=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=nr(n):r=nr(n,r)}return r},vs=!0,sc=console.warn!=null,oc=console.trace!=null,Mi=Number.MAX_SAFE_INTEGER||9007199254740991,$o=function(){return!0},yn=function(){return!1},hs=function(){return 0},Ni=function(){},_e=function(e){throw new Error(e)},Ho=function(e){if(e!==void 0)vs=!!e;else return vs},Ie=function(e){Ho()&&(sc?console.warn(e):(console.log(e),oc&&console.trace()))},lc=function(e){return he({},e)},Gt=function(e){return e==null?e:Ne(e)?e.slice():Ae(e)?lc(e):e},uc=function(e){return e.slice()},Xo=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},fc={},Wo=function(){return fc},et=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var s=r[i],o=a==null?void 0:a[s];n[s]=o===void 0?e[s]:o}return n}},ir=function(e,r,a){for(var n=e.length-1;n>=0&&!(e[n]===r&&(e.splice(n,1),a));n--);},ki=function(e){e.splice(0,e.length)},cc=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},It=function(e,r,a){return a&&(r=Mo(a,r)),e[r]},jt=function(e,r,a,n){a&&(r=Mo(a,r)),e[r]=n},vc=function(){function t(){fr(this,t),this._obj={}}return cr(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]}}]),t}(),zt=typeof Map<"u"?Map:vc,hc="undefined",dc=function(){function t(e){if(fr(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 cr(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)}}]),t}(),Xr=(typeof Set>"u"?"undefined":qe(Set))!==hc?Set:dc,Rn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!Oi(e)){_e("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"){_e("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 Xr,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 s=r.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];Ne(r.classes)?u=r.classes:ce(r.classes)&&(u=r.classes.split(/\s+/));for(var f=0,c=u.length;f<c;f++){var h=u[f];!h||h===""||i.classes.add(h)}this.createEmitter();var v=r.style||r.css;v&&(Ie("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(v)),(a===void 0||a)&&this.restore()},ds=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var s;Ae(a)&&!xt(a)&&(s=a,a=s.roots||s.root,n=s.visit,i=s.directed),i=arguments.length===2&&!Ve(n)?n:i,n=Ve(n)?n:function(){};for(var o=this._private.cy,l=a=ce(a)?this.filter(a):a,u=[],f=[],c={},h={},v={},d=0,g,p=this.byGroup(),y=p.nodes,b=p.edges,m=0;m<l.length;m++){var T=l[m],C=T.id();T.isNode()&&(u.unshift(T),e.bfs&&(v[C]=!0,f.push(T)),h[C]=0)}for(var D=function(){var I=e.bfs?u.shift():u.pop(),R=I.id();if(e.dfs){if(v[R])return"continue";v[R]=!0,f.push(I)}var P=h[R],M=c[R],k=M!=null?M.source():null,N=M!=null?M.target():null,B=M==null?void 0:I.same(k)?N[0]:k[0],z=void 0;if(z=n(I,M,B,d++,P),z===!0)return g=I,"break";if(z===!1)return"break";for(var F=I.connectedEdges().filter(function(q){return(!i||q.source().same(I))&&b.has(q)}),G=0;G<F.length;G++){var H=F[G],X=H.connectedNodes().filter(function(q){return!q.same(I)&&y.has(q)}),K=X.id();X.length!==0&&!v[K]&&(X=X[0],u.push(X),e.bfs&&(v[K]=!0,f.push(X)),c[K]=H,h[K]=h[R]+1)}};u.length!==0;){var w=D();if(w!=="continue"&&w==="break")break}for(var x=o.collection(),E=0;E<f.length;E++){var S=f[E],A=c[S.id()];A!=null&&x.push(A),x.push(S)}return{path:o.collection(x),found:o.collection(g)}}},Ta={breadthFirstSearch:ds({bfs:!0}),depthFirstSearch:ds({dfs:!0})};Ta.bfs=Ta.breadthFirstSearch;Ta.dfs=Ta.depthFirstSearch;var gc=bf(function(t,e){(function(){var r,a,n,i,s,o,l,u,f,c,h,v,d,g,p;n=Math.floor,c=Math.min,a=function(y,b){return y<b?-1:y>b?1:0},f=function(y,b,m,T,C){var D;if(m==null&&(m=0),C==null&&(C=a),m<0)throw new Error("lo must be non-negative");for(T==null&&(T=y.length);m<T;)D=n((m+T)/2),C(b,y[D])<0?T=D:m=D+1;return[].splice.apply(y,[m,m-m].concat(b)),b},o=function(y,b,m){return m==null&&(m=a),y.push(b),g(y,0,y.length-1,m)},s=function(y,b){var m,T;return b==null&&(b=a),m=y.pop(),y.length?(T=y[0],y[0]=m,p(y,0,b)):T=m,T},u=function(y,b,m){var T;return m==null&&(m=a),T=y[0],y[0]=b,p(y,0,m),T},l=function(y,b,m){var T;return m==null&&(m=a),y.length&&m(y[0],b)<0&&(T=[y[0],b],b=T[0],y[0]=T[1],p(y,0,m)),b},i=function(y,b){var m,T,C,D,w,x;for(b==null&&(b=a),D=(function(){x=[];for(var E=0,S=n(y.length/2);0<=S?E<S:E>S;0<=S?E++:E--)x.push(E);return x}).apply(this).reverse(),w=[],T=0,C=D.length;T<C;T++)m=D[T],w.push(p(y,m,b));return w},d=function(y,b,m){var T;if(m==null&&(m=a),T=y.indexOf(b),T!==-1)return g(y,0,T,m),p(y,T,m)},h=function(y,b,m){var T,C,D,w,x;if(m==null&&(m=a),C=y.slice(0,b),!C.length)return C;for(i(C,m),x=y.slice(b),D=0,w=x.length;D<w;D++)T=x[D],l(C,T,m);return C.sort(m).reverse()},v=function(y,b,m){var T,C,D,w,x,E,S,A,L;if(m==null&&(m=a),b*10<=y.length){if(D=y.slice(0,b).sort(m),!D.length)return D;for(C=D[D.length-1],S=y.slice(b),w=0,E=S.length;w<E;w++)T=S[w],m(T,C)<0&&(f(D,T,0,null,m),D.pop(),C=D[D.length-1]);return D}for(i(y,m),L=[],x=0,A=c(b,y.length);0<=A?x<A:x>A;0<=A?++x:--x)L.push(s(y,m));return L},g=function(y,b,m,T){var C,D,w;for(T==null&&(T=a),C=y[m];m>b;){if(w=m-1>>1,D=y[w],T(C,D)<0){y[m]=D,m=w;continue}break}return y[m]=C},p=function(y,b,m){var T,C,D,w,x;for(m==null&&(m=a),C=y.length,x=b,D=y[b],T=2*b+1;T<C;)w=T+1,w<C&&!(m(y[T],y[w])<0)&&(T=w),y[b]=y[T],b=T,T=2*b+1;return y[b]=D,g(y,x,b,m)},r=function(){y.push=o,y.pop=s,y.replace=u,y.pushpop=l,y.heapify=i,y.updateItem=d,y.nlargest=h,y.nsmallest=v;function y(b){this.cmp=b??a,this.nodes=[]}return y.prototype.push=function(b){return o(this.nodes,b,this.cmp)},y.prototype.pop=function(){return s(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 u(this.nodes,b,this.cmp)},y.prototype.pushpop=function(b){return l(this.nodes,b,this.cmp)},y.prototype.heapify=function(){return i(this.nodes,this.cmp)},y.prototype.updateItem=function(b){return d(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;return b=new y,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(ca)}),ka=gc,pc=et({root:null,weight:function(e){return 1},directed:!1}),yc={dijkstra:function(e){if(!Ae(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=pc(e),n=a.root,i=a.weight,s=a.directed,o=this,l=i,u=ce(n)?this.filter(n)[0]:n[0],f={},c={},h={},v=this.byGroup(),d=v.nodes,g=v.edges;g.unmergeBy(function(P){return P.isLoop()});for(var p=function(M){return f[M.id()]},y=function(M,k){f[M.id()]=k,b.updateItem(M)},b=new ka(function(P,M){return p(P)-p(M)}),m=0;m<d.length;m++){var T=d[m];f[T.id()]=T.same(u)?0:1/0,b.push(T)}for(var C=function(M,k){for(var N=(s?M.edgesTo(k):M.edgesWith(k)).intersect(g),B=1/0,z,F=0;F<N.length;F++){var G=N[F],H=l(G);(H<B||!z)&&(B=H,z=G)}return{edge:z,dist:B}};b.size()>0;){var D=b.pop(),w=p(D),x=D.id();if(h[x]=w,w!==1/0)for(var E=D.neighborhood().intersect(d),S=0;S<E.length;S++){var A=E[S],L=A.id(),I=C(D,A),R=w+I.dist;R<p(A)&&(y(A,R),c[L]={node:D,edge:I.edge})}}return{distanceTo:function(M){var k=ce(M)?d.filter(M)[0]:M[0];return h[k.id()]},pathTo:function(M){var k=ce(M)?d.filter(M)[0]:M[0],N=[],B=k,z=B.id();if(k.length>0)for(N.unshift(k);c[z];){var F=c[z];N.unshift(F.edge),N.unshift(F.node),B=F.node,z=B.id()}return o.spawn(N)}}}},mc={kruskal:function(e){e=e||function(m){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,s=new Array(i),o=a,l=function(T){for(var C=0;C<s.length;C++){var D=s[C];if(D.has(T))return C}},u=0;u<i;u++)s[u]=this.spawn(a[u]);for(var f=n.sort(function(m,T){return e(m)-e(T)}),c=0;c<f.length;c++){var h=f[c],v=h.source()[0],d=h.target()[0],g=l(v),p=l(d),y=s[g],b=s[p];g!==p&&(o.merge(h),y.merge(b),s.splice(p,1))}return o}},bc=et({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),wc={aStar:function(e){var r=this.cy(),a=bc(e),n=a.root,i=a.goal,s=a.heuristic,o=a.directed,l=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var u=n.id(),f=i.id(),c={},h={},v={},d=new ka(function(z,F){return h[z.id()]-h[F.id()]}),g=new Xr,p={},y={},b=function(F,G){d.push(F),g.add(G)},m,T,C=function(){m=d.pop(),T=m.id(),g.delete(T)},D=function(F){return g.has(F)};b(n,u),c[u]=0,h[u]=s(n);for(var w=0;d.size()>0;){if(C(),w++,T===f){for(var x=[],E=i,S=f,A=y[S];x.unshift(E),A!=null&&x.unshift(A),E=p[S],E!=null;)S=E.id(),A=y[S];return{found:!0,distance:c[T],path:this.spawn(x),steps:w}}v[T]=!0;for(var L=m._private.edges,I=0;I<L.length;I++){var R=L[I];if(this.hasElementWithId(R.id())&&!(o&&R.data("source")!==T)){var P=R.source(),M=R.target(),k=P.id()!==T?P:M,N=k.id();if(this.hasElementWithId(N)&&!v[N]){var B=c[T]+l(R);if(!D(N)){c[N]=B,h[N]=B+s(k),b(k,N),p[N]=m,y[N]=R;continue}B<c[N]&&(c[N]=B,h[N]=B+s(k),p[N]=m,y[N]=R)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},Ec=et({weight:function(e){return 1},directed:!1}),xc={floydWarshall:function(e){for(var r=this.cy(),a=Ec(e),n=a.weight,i=a.directed,s=n,o=this.byGroup(),l=o.nodes,u=o.edges,f=l.length,c=f*f,h=function(H){return l.indexOf(H)},v=function(H){return l[H]},d=new Array(c),g=0;g<c;g++){var p=g%f,y=(g-p)/f;y===p?d[g]=0:d[g]=1/0}for(var b=new Array(c),m=new Array(c),T=0;T<u.length;T++){var C=u[T],D=C.source()[0],w=C.target()[0];if(D!==w){var x=h(D),E=h(w),S=x*f+E,A=s(C);if(d[S]>A&&(d[S]=A,b[S]=E,m[S]=C),!i){var L=E*f+x;!i&&d[L]>A&&(d[L]=A,b[L]=x,m[L]=C)}}}for(var I=0;I<f;I++)for(var R=0;R<f;R++)for(var P=R*f+I,M=0;M<f;M++){var k=R*f+M,N=I*f+M;d[P]+d[N]<d[k]&&(d[k]=d[P]+d[N],b[k]=b[P])}var B=function(H){return(ce(H)?r.filter(H):H)[0]},z=function(H){return h(B(H))},F={distance:function(H,X){var K=z(H),q=z(X);return d[K*f+q]},path:function(H,X){var K=z(H),q=z(X),J=v(K);if(K===q)return J.collection();if(b[K*f+q]==null)return r.collection();var j=r.collection(),Y=K,_;for(j.merge(J);K!==q;)Y=K,K=b[K*f+q],_=m[Y*f+K],j.merge(_),j.merge(v(K));return j}};return F}},Tc=et({weight:function(e){return 1},directed:!1,root:null}),Cc={bellmanFord:function(e){var r=this,a=Tc(e),n=a.weight,i=a.directed,s=a.root,o=n,l=this,u=this.cy(),f=this.byGroup(),c=f.edges,h=f.nodes,v=h.length,d=new zt,g=!1,p=[];s=u.collection(s)[0],c.unmergeBy(function(Pe){return Pe.isLoop()});for(var y=c.length,b=function(ue){var le=d.get(ue.id());return le||(le={},d.set(ue.id(),le)),le},m=function(ue){return(ce(ue)?u.$(ue):ue)[0]},T=function(ue){return b(m(ue)).dist},C=function(ue){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,pe=m(ue),ye=[],de=pe;;){if(de==null)return r.spawn();var me=b(de),xe=me.edge,De=me.pred;if(ye.unshift(de[0]),de.same(le)&&ye.length>0)break;xe!=null&&ye.unshift(xe),de=De}return l.spawn(ye)},D=0;D<v;D++){var w=h[D],x=b(w);w.same(s)?x.dist=0:x.dist=1/0,x.pred=null,x.edge=null}for(var E=!1,S=function(ue,le,pe,ye,de,me){var xe=ye.dist+me;xe<de.dist&&!pe.same(ye.edge)&&(de.dist=xe,de.pred=ue,de.edge=pe,E=!0)},A=1;A<v;A++){E=!1;for(var L=0;L<y;L++){var I=c[L],R=I.source(),P=I.target(),M=o(I),k=b(R),N=b(P);S(R,P,I,k,N,M),i||S(P,R,I,N,k,M)}if(!E)break}if(E)for(var B=[],z=0;z<y;z++){var F=c[z],G=F.source(),H=F.target(),X=o(F),K=b(G).dist,q=b(H).dist;if(K+X<q||!i&&q+X<K)if(g||(Ie("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),e.findNegativeWeightCycles!==!1){var J=[];K+X<q&&J.push(G),!i&&q+X<K&&J.push(H);for(var j=J.length,Y=0;Y<j;Y++){var _=J[Y],W=[_];W.push(b(_).edge);for(var te=b(_).pred;W.indexOf(te)===-1;)W.push(te),W.push(b(te).edge),te=b(te).pred;W=W.slice(W.indexOf(te));for(var ae=W[0].id(),se=0,Ce=2;Ce<W.length;Ce+=2)W[Ce].id()<ae&&(ae=W[Ce].id(),se=Ce);W=W.slice(se).concat(W.slice(0,se)),W.push(W[0]);var Oe=W.map(function(Pe){return Pe.id()}).join(",");B.indexOf(Oe)===-1&&(p.push(l.spawn(W)),B.push(Oe))}}else break}return{distanceTo:T,pathTo:C,hasNegativeWeightCycle:g,negativeWeightCycles:p}}},Dc=Math.sqrt(2),Sc=function(e,r,a){a.length===0&&_e("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],s=n[2],o=r[i],l=r[s],u=a,f=u.length-1;f>=0;f--){var c=u[f],h=c[1],v=c[2];(r[h]===o&&r[v]===l||r[h]===l&&r[v]===o)&&u.splice(f,1)}for(var d=0;d<u.length;d++){var g=u[d];g[1]===l?(u[d]=g.slice(),u[d][1]=o):g[2]===l&&(u[d]=g.slice(),u[d][2]=o)}for(var p=0;p<r.length;p++)r[p]===l&&(r[p]=o);return u},qn=function(e,r,a,n){for(;a>n;){var i=Math.floor(Math.random()*r.length);r=Sc(i,e,r),a--}return r},Ac={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(N){return N.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/Dc);if(i<2){_e("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],f=0;f<s;f++){var c=n[f];u.push([f,a.indexOf(c.source()),a.indexOf(c.target())])}for(var h=1/0,v=[],d=new Array(i),g=new Array(i),p=new Array(i),y=function(B,z){for(var F=0;F<i;F++)z[F]=B[F]},b=0;b<=o;b++){for(var m=0;m<i;m++)g[m]=m;var T=qn(g,u.slice(),i,l),C=T.slice();y(g,p);var D=qn(g,T,l,2),w=qn(p,C,l,2);D.length<=w.length&&D.length<h?(h=D.length,v=D,y(g,d)):w.length<=D.length&&w.length<h&&(h=w.length,v=w,y(p,d))}for(var x=this.spawn(v.map(function(N){return n[N[0]]})),E=this.spawn(),S=this.spawn(),A=d[0],L=0;L<d.length;L++){var I=d[L],R=a[L];I===A?E.merge(R):S.merge(R)}var P=function(B){var z=e.spawn();return B.forEach(function(F){z.merge(F),F.connectedEdges().forEach(function(G){e.contains(G)&&!x.contains(G)&&z.merge(G)})}),z},M=[P(E),P(S)],k={cut:x,components:M,partition1:E,partition2:S};return k}},Lc=function(e){return{x:e.x,y:e.y}},In=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},qo=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},Br=function(e){return{x:e[0],y:e[1]}},Rc=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 s=e[i];isFinite(s)&&(n=Math.min(s,n))}return n},Ic=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 s=e[i];isFinite(s)&&(n=Math.max(s,n))}return n},Oc=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,s=r;s<a;s++){var o=e[s];isFinite(o)&&(n+=o,i++)}return n/i},Pc=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,s=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 o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}i&&e.sort(function(h,v){return h-v});var f=e.length,c=Math.floor(f/2);return f%2!==0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},Mc=function(e){return Math.PI*e/180},$a=function(e,r){return Math.atan2(r,e)-Math.PI/2},Bi=Math.log2||function(t){return Math.log(t)/Math.log(2)},Ko=function(e){return e>0?1:e<0?-1:0},Er=function(e,r){return Math.sqrt(gr(e,r))},gr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},Nc=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},je=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},Gr=function(e,r,a,n){return{x:je(e.x,r.x,a.x,n),y:je(e.y,r.y,a.y,n)}},kc=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},s=Er(e,r),o={x:i.x/s,y:i.y/s};return a=a??0,n=n??a*s,{x:e.x+o.x*n,y:e.y+o.y*n}},Ca=function(e,r,a){return Math.max(e,Math.min(a,r))},yt=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}}},Bc=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Fc=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Gc=function(e,r,a){return{x1:e.x1+r,x2:e.x2+r,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}},Zo=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},zc=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,s;if(r.length===1)a=n=i=s=r[0];else if(r.length===2)a=i=r[0],s=n=r[1];else if(r.length===4){var o=Ye(r,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},gs=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},Fi=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)},Yr=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},_c=function(e,r){return Yr(e,r.x,r.y)},Qo=function(e,r){return Yr(e,r.x1,r.y1)&&Yr(e,r.x2,r.y2)},Jo=function(e,r,a,n,i,s,o){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?xr(i,s):l,f=i/2,c=s/2;u=Math.min(u,f,c);var h=u!==f,v=u!==c,d;if(h){var g=a-f+u-o,p=n-c-o,y=a+f-u+o,b=p;if(d=er(e,r,a,n,g,p,y,b,!1),d.length>0)return d}if(v){var m=a+f+o,T=n-c+u-o,C=m,D=n+c-u+o;if(d=er(e,r,a,n,m,T,C,D,!1),d.length>0)return d}if(h){var w=a-f+u-o,x=n+c+o,E=a+f-u+o,S=x;if(d=er(e,r,a,n,w,x,E,S,!1),d.length>0)return d}if(v){var A=a-f-o,L=n-c+u-o,I=A,R=n+c-u+o;if(d=er(e,r,a,n,A,L,I,R,!1),d.length>0)return d}var P;{var M=a-f+u,k=n-c+u;if(P=ha(e,r,a,n,M,k,u+o),P.length>0&&P[0]<=M&&P[1]<=k)return[P[0],P[1]]}{var N=a+f-u,B=n-c+u;if(P=ha(e,r,a,n,N,B,u+o),P.length>0&&P[0]>=N&&P[1]<=B)return[P[0],P[1]]}{var z=a+f-u,F=n+c-u;if(P=ha(e,r,a,n,z,F,u+o),P.length>0&&P[0]>=z&&P[1]>=F)return[P[0],P[1]]}{var G=a-f+u,H=n+c-u;if(P=ha(e,r,a,n,G,H,u+o),P.length>0&&P[0]<=G&&P[1]>=H)return[P[0],P[1]]}return[]},Vc=function(e,r,a,n,i,s,o){var l=o,u=Math.min(a,i),f=Math.max(a,i),c=Math.min(n,s),h=Math.max(n,s);return u-l<=e&&e<=f+l&&c-l<=r&&r<=h+l},Uc=function(e,r,a,n,i,s,o,l,u){var f={x1:Math.min(a,o,i)-u,x2:Math.max(a,o,i)+u,y1:Math.min(n,l,s)-u,y2:Math.max(n,l,s)+u};return!(e<f.x1||e>f.x2||r<f.y1||r>f.y2)},Yc=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,l=(-r+s)/o,u=(-r-s)/o;return[l,u]},$c=function(e,r,a,n,i){var s=1e-5;e===0&&(e=s),r/=e,a/=e,n/=e;var o,l,u,f,c,h,v,d;if(l=(3*a-r*r)/9,u=-(27*n)+r*(9*a-2*(r*r)),u/=54,o=l*l*l+u*u,i[1]=0,v=r/3,o>0){c=u+Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),h=u-Math.sqrt(o),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),i[0]=-v+c+h,v+=(c+h)/2,i[4]=i[2]=-v,v=Math.sqrt(3)*(-h+c)/2,i[3]=v,i[5]=-v;return}if(i[5]=i[3]=0,o===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-v+2*d,i[4]=i[2]=-(d+v);return}l=-l,f=l*l*l,f=Math.acos(u/Math.sqrt(f)),d=2*Math.sqrt(l),i[0]=-v+d*Math.cos(f/3),i[2]=-v+d*Math.cos((f+2*Math.PI)/3),i[4]=-v+d*Math.cos((f+4*Math.PI)/3)},Hc=function(e,r,a,n,i,s,o,l){var u=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*l+4*s*s-4*s*l+l*l,f=1*9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*l-6*s*s+3*s*l,c=1*3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*l-n*r+2*s*s+2*s*r-l*r,h=1*a*i-a*a+a*e-i*e+n*s-n*n+n*r-s*r,v=[];$c(u,f,c,h,v);for(var d=1e-7,g=[],p=0;p<6;p+=2)Math.abs(v[p+1])<d&&v[p]>=0&&v[p]<=1&&g.push(v[p]);g.push(1),g.push(0);for(var y=-1,b,m,T,C=0;C<g.length;C++)b=Math.pow(1-g[C],2)*a+2*(1-g[C])*g[C]*i+g[C]*g[C]*o,m=Math.pow(1-g[C],2)*n+2*(1-g[C])*g[C]*s+g[C]*g[C]*l,T=Math.pow(b-e,2)+Math.pow(m-r,2),y>=0?T<y&&(y=T):y=T;return y},Xc=function(e,r,a,n,i,s){var o=[e-a,r-n],l=[i-a,s-n],u=l[0]*l[0]+l[1]*l[1],f=o[0]*o[0]+o[1]*o[1],c=o[0]*l[0]+o[1]*l[1],h=c*c/u;return c<0?f:h>u?(e-i)*(e-i)+(r-s)*(r-s):f-h},pt=function(e,r,a){for(var n,i,s,o,l,u=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(s=a[(f+1)*2],o=a[(f+1)*2+1]):(s=a[(f+1-a.length/2)*2],o=a[(f+1-a.length/2)*2+1]),!(n==e&&s==e))if(n>=e&&e>=s||n<=e&&e<=s)l=(e-n)/(s-n)*(o-i)+i,l>r&&u++;else continue;return u%2!==0},Wt=function(e,r,a,n,i,s,o,l,u){var f=new Array(a.length),c;l[0]!=null?(c=Math.atan(l[1]/l[0]),l[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=l;for(var h=Math.cos(-c),v=Math.sin(-c),d=0;d<f.length/2;d++)f[d*2]=s/2*(a[d*2]*h-a[d*2+1]*v),f[d*2+1]=o/2*(a[d*2+1]*h+a[d*2]*v),f[d*2]+=n,f[d*2+1]+=i;var g;if(u>0){var p=bn(f,-u);g=mn(p)}else g=f;return pt(e,r,g)},Wc=function(e,r,a,n,i,s,o,l){for(var u=new Array(a.length*2),f=0;f<l.length;f++){var c=l[f];u[f*4+0]=c.startX,u[f*4+1]=c.startY,u[f*4+2]=c.stopX,u[f*4+3]=c.stopY;var h=Math.pow(c.cx-e,2)+Math.pow(c.cy-r,2);if(h<=Math.pow(c.radius,2))return!0}return pt(e,r,u)},mn=function(e){for(var r=new Array(e.length/2),a,n,i,s,o,l,u,f,c=0;c<e.length/4;c++){a=e[c*4],n=e[c*4+1],i=e[c*4+2],s=e[c*4+3],c<e.length/4-1?(o=e[(c+1)*4],l=e[(c+1)*4+1],u=e[(c+1)*4+2],f=e[(c+1)*4+3]):(o=e[0],l=e[1],u=e[2],f=e[3]);var h=er(a,n,i,s,o,l,u,f,!0);r[c*2]=h[0],r[c*2+1]=h[1]}return r},bn=function(e,r){for(var a=new Array(e.length*2),n,i,s,o,l=0;l<e.length/2;l++){n=e[l*2],i=e[l*2+1],l<e.length/2-1?(s=e[(l+1)*2],o=e[(l+1)*2+1]):(s=e[0],o=e[1]);var u=o-i,f=-(s-n),c=Math.sqrt(u*u+f*f),h=u/c,v=f/c;a[l*4]=n+h*r,a[l*4+1]=i+v*r,a[l*4+2]=s+h*r,a[l*4+3]=o+v*r}return a},qc=function(e,r,a,n,i,s){var o=a-e,l=n-r;o/=i,l/=s;var u=Math.sqrt(o*o+l*l),f=u-1;if(f<0)return[];var c=f/u;return[(a-e)*c+e,(n-r)*c+r]},br=function(e,r,a,n,i,s,o){return e-=i,r-=s,e/=a/2+o,r/=n/2+o,e*e+r*r<=1},ha=function(e,r,a,n,i,s,o){var l=[a-e,n-r],u=[e-i,r-s],f=l[0]*l[0]+l[1]*l[1],c=2*(u[0]*l[0]+u[1]*l[1]),h=u[0]*u[0]+u[1]*u[1]-o*o,v=c*c-4*f*h;if(v<0)return[];var d=(-c+Math.sqrt(v))/(2*f),g=(-c-Math.sqrt(v))/(2*f),p=Math.min(d,g),y=Math.max(d,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]*l[0]+e,T=b[0]*l[1]+r;if(b.length>1){if(b[0]==b[1])return[m,T];var C=b[1]*l[0]+e,D=b[1]*l[1]+r;return[m,T,C,D]}else return[m,T]},Kn=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,s,o,l,u){var f=e-i,c=a-e,h=o-i,v=r-s,d=n-r,g=l-s,p=h*v-g*f,y=c*v-d*f,b=g*c-h*d;if(b!==0){var m=p/b,T=y/b,C=.001,D=0-C,w=1+C;return D<=m&&m<=w&&D<=T&&T<=w?[e+m*c,r+m*d]:u?[e+m*c,r+m*d]:[]}else return p===0||y===0?Kn(e,a,o)===o?[o,l]:Kn(e,a,i)===i?[i,s]:Kn(i,o,a)===a?[a,n]:[]:[]},Da=function(e,r,a,n,i,s,o,l){var u=[],f,c=new Array(a.length),h=!0;s==null&&(h=!1);var v;if(h){for(var d=0;d<c.length/2;d++)c[d*2]=a[d*2]*s+n,c[d*2+1]=a[d*2+1]*o+i;if(l>0){var g=bn(c,-l);v=mn(g)}else v=c}else v=a;for(var p,y,b,m,T=0;T<v.length/2;T++)p=v[T*2],y=v[T*2+1],T<v.length/2-1?(b=v[(T+1)*2],m=v[(T+1)*2+1]):(b=v[0],m=v[1]),f=er(e,r,n,i,p,y,b,m),f.length!==0&&u.push(f[0],f[1]);return u},Kc=function(e,r,a,n,i,s,o,l,u){var f=[],c,h=new Array(a.length*2);u.forEach(function(b,m){m===0?(h[h.length-2]=b.startX,h[h.length-1]=b.startY):(h[m*4-2]=b.startX,h[m*4-1]=b.startY),h[m*4]=b.stopX,h[m*4+1]=b.stopY,c=ha(e,r,n,i,b.cx,b.cy,b.radius),c.length!==0&&f.push(c[0],c[1])});for(var v=0;v<h.length/4;v++)c=er(e,r,n,i,h[v*4],h[v*4+1],h[v*4+2],h[v*4+3],!1),c.length!==0&&f.push(c[0],c[1]);if(f.length>2){for(var d=[f[0],f[1]],g=Math.pow(d[0]-e,2)+Math.pow(d[1]-r,2),p=1;p<f.length/2;p++){var y=Math.pow(f[p*2]-e,2)+Math.pow(f[p*2+1]-r,2);y<=g&&(d[0]=f[p*2],d[1]=f[p*2+1],g=y)}return d}return f},Ha=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]),s=(i-a)/i;return s<0&&(s=1e-5),[r[0]+s*n[0],r[1]+s*n[1]]},ht=function(e,r){var a=ci(e,r);return a=jo(a),a},jo=function(e){for(var r,a,n=e.length/2,i=1/0,s=1/0,o=-1/0,l=-1/0,u=0;u<n;u++)r=e[2*u],a=e[2*u+1],i=Math.min(i,r),o=Math.max(o,r),s=Math.min(s,a),l=Math.max(l,a);for(var f=2/(o-i),c=2/(l-s),h=0;h<n;h++)r=e[2*h]=e[2*h]*f,a=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,r),o=Math.max(o,r),s=Math.min(s,a),l=Math.max(l,a);if(s<-1)for(var v=0;v<n;v++)a=e[2*v+1]=e[2*v+1]+(-1-s);return e},ci=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),s,o=0;o<e;o++)s=o*a+n,i[2*o]=Math.cos(s),i[2*o+1]=Math.sin(-s);return i},xr=function(e,r){return Math.min(e/4,r/4,8)},el=function(e,r){return Math.min(e/10,r/10,8)},Gi=function(){return 8},Zc=function(e,r,a){return[e-2*r+a,2*(r-e),e]},vi=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Qc=et({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Jc={pageRank:function(e){for(var r=Qc(e),a=r.dampingFactor,n=r.precision,i=r.iterations,s=r.weight,o=this._private.cy,l=this.byGroup(),u=l.nodes,f=l.edges,c=u.length,h=c*c,v=f.length,d=new Array(h),g=new Array(c),p=(1-a)/c,y=0;y<c;y++){for(var b=0;b<c;b++){var m=y*c+b;d[m]=0}g[y]=0}for(var T=0;T<v;T++){var C=f[T],D=C.data("source"),w=C.data("target");if(D!==w){var x=u.indexOfId(D),E=u.indexOfId(w),S=s(C),A=E*c+x;d[A]+=S,g[x]+=S}}for(var L=1/c+p,I=0;I<c;I++)if(g[I]===0)for(var R=0;R<c;R++){var P=R*c+I;d[P]=L}else for(var M=0;M<c;M++){var k=M*c+I;d[k]=d[k]/g[I]+p}for(var N=new Array(c),B=new Array(c),z,F=0;F<c;F++)N[F]=1;for(var G=0;G<i;G++){for(var H=0;H<c;H++)B[H]=0;for(var X=0;X<c;X++)for(var K=0;K<c;K++){var q=X*c+K;B[X]+=d[q]*N[K]}Nc(B),z=N,N=B,B=z;for(var J=0,j=0;j<c;j++){var Y=z[j]-N[j];J+=Y*Y}if(J<n)break}var _={rank:function(te){return te=o.collection(te)[0],N[u.indexOf(te)]}};return _}},ps=et({root:null,weight:function(e){return 1},directed:!1,alpha:0}),zr={degreeCentralityNormalized:function(e){e=ps(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},c={},h=0,v=0,d=0;d<n;d++){var g=a[d],p=g.id();e.root=g;var y=this.degreeCentrality(e);h<y.indegree&&(h=y.indegree),v<y.outdegree&&(v=y.outdegree),f[p]=y.indegree,c[p]=y.outdegree}return{indegree:function(m){return h==0?0:(ce(m)&&(m=r.filter(m)),f[m.id()]/h)},outdegree:function(m){return v===0?0:(ce(m)&&(m=r.filter(m)),c[m.id()]/v)}}}else{for(var i={},s=0,o=0;o<n;o++){var l=a[o];e.root=l;var u=this.degreeCentrality(e);s<u.degree&&(s=u.degree),i[l.id()]=u.degree}return{degree:function(m){return s===0?0:(ce(m)&&(m=r.filter(m)),i[m.id()]/s)}}}},degreeCentrality:function(e){e=ps(e);var r=this.cy(),a=this,n=e,i=n.root,s=n.weight,o=n.directed,l=n.alpha;if(i=r.collection(i)[0],o){for(var v=i.connectedEdges(),d=v.filter(function(D){return D.target().same(i)&&a.has(D)}),g=v.filter(function(D){return D.source().same(i)&&a.has(D)}),p=d.length,y=g.length,b=0,m=0,T=0;T<d.length;T++)b+=s(d[T]);for(var C=0;C<g.length;C++)m+=s(g[C]);return{indegree:Math.pow(p,1-l)*Math.pow(b,l),outdegree:Math.pow(y,1-l)*Math.pow(m,l)}}else{for(var u=i.connectedEdges().intersection(a),f=u.length,c=0,h=0;h<u.length;h++)c+=s(u[h]);return{degree:Math.pow(f,1-l)*Math.pow(c,l)}}}};zr.dc=zr.degreeCentrality;zr.dcn=zr.degreeCentralityNormalised=zr.degreeCentralityNormalized;var ys=et({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),_r={closenessCentralityNormalized:function(e){for(var r=ys(e),a=r.harmonic,n=r.weight,i=r.directed,s=this.cy(),o={},l=0,u=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),c=0;c<u.length;c++){for(var h=0,v=u[c],d=0;d<u.length;d++)if(c!==d){var g=f.distance(v,u[d]);a?h+=1/g:h+=g}a||(h=1/h),l<h&&(l=h),o[v.id()]=h}return{closeness:function(y){return l==0?0:(ce(y)?y=s.filter(y)[0].id():y=y.id(),o[y]/l)}}},closenessCentrality:function(e){var r=ys(e),a=r.root,n=r.weight,i=r.directed,s=r.harmonic;a=this.filter(a)[0];for(var o=this.dijkstra({root:a,weight:n,directed:i}),l=0,u=this.nodes(),f=0;f<u.length;f++){var c=u[f];if(!c.same(a)){var h=o.distanceTo(c);s?l+=1/h:l+=h}}return s?l:1/l}};_r.cc=_r.closenessCentrality;_r.ccn=_r.closenessCentralityNormalised=_r.closenessCentralityNormalized;var jc=et({weight:null,directed:!1}),hi={betweennessCentrality:function(e){for(var r=jc(e),a=r.directed,n=r.weight,i=n!=null,s=this.cy(),o=this.nodes(),l={},u={},f=0,c={set:function(m,T){u[m]=T,T>f&&(f=T)},get:function(m){return u[m]}},h=0;h<o.length;h++){var v=o[h],d=v.id();a?l[d]=v.outgoers().nodes():l[d]=v.openNeighborhood().nodes(),c.set(d,0)}for(var g=function(m){for(var T=o[m].id(),C=[],D={},w={},x={},E=new ka(function(K,q){return x[K]-x[q]}),S=0;S<o.length;S++){var A=o[S].id();D[A]=[],w[A]=0,x[A]=1/0}for(w[T]=1,x[T]=0,E.push(T);!E.empty();){var L=E.pop();if(C.push(L),i)for(var I=0;I<l[L].length;I++){var R=l[L][I],P=s.getElementById(L),M=void 0;P.edgesTo(R).length>0?M=P.edgesTo(R)[0]:M=R.edgesTo(P)[0];var k=n(M);R=R.id(),x[R]>x[L]+k&&(x[R]=x[L]+k,E.nodes.indexOf(R)<0?E.push(R):E.updateItem(R),w[R]=0,D[R]=[]),x[R]==x[L]+k&&(w[R]=w[R]+w[L],D[R].push(L))}else for(var N=0;N<l[L].length;N++){var B=l[L][N].id();x[B]==1/0&&(E.push(B),x[B]=x[L]+1),x[B]==x[L]+1&&(w[B]=w[B]+w[L],D[B].push(L))}}for(var z={},F=0;F<o.length;F++)z[o[F].id()]=0;for(;C.length>0;){for(var G=C.pop(),H=0;H<D[G].length;H++){var X=D[G][H];z[X]=z[X]+w[X]/w[G]*(1+z[G])}G!=o[m].id()&&c.set(G,c.get(G)+z[G])}},p=0;p<o.length;p++)g(p);var y={betweenness:function(m){var T=s.collection(m).id();return c.get(T)},betweennessNormalized:function(m){if(f==0)return 0;var T=s.collection(m).id();return c.get(T)/f}};return y.betweennessNormalised=y.betweennessNormalized,y}};hi.bc=hi.betweennessCentrality;var ev=et({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),tv=function(e){return ev(e)},rv=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},av=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},tl=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 s=0;s<r;s++)e[s*r+n]=e[s*r+n]/a}},nv=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var s=0;s<a;s++)n[i*a+s]=0;for(var o=0;o<a;o++)for(var l=0;l<a;l++)n[i*a+l]+=e[i*a+o]*r[o*a+l]}return n},iv=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=nv(e,n,r);return e},sv=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 tl(n,r),n},ov=function(e,r,a,n){for(var i=0;i<a;i++){var s=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),o=Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n);if(s!==o)return!1}return!0},lv=function(e,r,a,n){for(var i=[],s=0;s<r;s++){for(var o=[],l=0;l<r;l++)Math.round(e[s*r+l]*1e3)/1e3>0&&o.push(a[l]);o.length!==0&&i.push(n.collection(o))}return i},uv=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},fv=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&uv(e[r],e[a])&&e.splice(a,1);return e},ms=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=tv(e),s={},o=0;o<r.length;o++)s[r[o].id()]=o;for(var l=r.length,u=l*l,f=new Array(u),c,h=0;h<u;h++)f[h]=0;for(var v=0;v<a.length;v++){var d=a[v],g=s[d.source().id()],p=s[d.target().id()],y=rv(d,i.attributes);f[g*l+p]+=y,f[p*l+g]+=y}av(f,l,i.multFactor),tl(f,l);for(var b=!0,m=0;b&&m<i.maxIterations;)b=!1,c=iv(f,l,i.expandFactor),f=sv(c,l,i.inflateFactor),ov(f,c,u,4)||(b=!0),m++;var T=lv(f,l,r,n);return T=fv(T),T},cv={markovClustering:ms,mcl:ms},vv=function(e){return e},rl=function(e,r){return Math.abs(r-e)},bs=function(e,r,a){return e+rl(r,a)},ws=function(e,r,a){return e+Math.pow(a-r,2)},hv=function(e){return Math.sqrt(e)},dv=function(e,r,a){return Math.max(e,rl(r,a))},ia=function(e,r,a,n,i){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:vv,o=n,l,u,f=0;f<e;f++)l=r(f),u=a(f),o=i(o,l,u);return s(o)},$r={euclidean:function(e,r,a){return e>=2?ia(e,r,a,0,ws,hv):ia(e,r,a,0,bs)},squaredEuclidean:function(e,r,a){return ia(e,r,a,0,ws)},manhattan:function(e,r,a){return ia(e,r,a,0,bs)},max:function(e,r,a){return ia(e,r,a,-1/0,dv)}};$r["squared-euclidean"]=$r.squaredEuclidean;$r.squaredeuclidean=$r.squaredEuclidean;function On(t,e,r,a,n,i){var s;return Ve(t)?s=t:s=$r[t]||$r.euclidean,e===0&&Ve(t)?s(n,i):s(e,r,a,n,i)}var gv=et({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),zi=function(e){return gv(e)},wn=function(e,r,a,n,i){var s=i!=="kMedoids",o=s?function(c){return a[c]}:function(c){return n[c](a)},l=function(h){return n[h](r)},u=a,f=r;return On(e,n.length,o,l,u,f)},Zn=function(e,r,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(r),l=null,u=0;u<n;u++)i[u]=e.min(a[u]).value,s[u]=e.max(a[u]).value;for(var f=0;f<r;f++){l=[];for(var c=0;c<n;c++)l[c]=Math.random()*(s[c]-i[c])+i[c];o[f]=l}return o},al=function(e,r,a,n,i){for(var s=1/0,o=0,l=0;l<r.length;l++){var u=wn(a,e,r[l],n,i);u<s&&(s=u,o=l)}return o},nl=function(e,r,a){for(var n=[],i=null,s=0;s<r.length;s++)i=r[s],a[i.id()]===e&&n.push(i);return n},pv=function(e,r,a){return Math.abs(r-e)<=a},yv=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var s=Math.abs(e[n][i]-r[n][i]);if(s>a)return!1}return!0},mv=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},Es=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)];mv(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var s=0;s<r;s++)a[s]=e[Math.floor(Math.random()*e.length)];return a},xs=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=wn("manhattan",r[i],e,a,"kMedoids");return n},bv=function(e){var r=this.cy(),a=this.nodes(),n=null,i=zi(e),s=new Array(i.k),o={},l;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,l=Zn(a,i.k,i.attributes)):qe(i.testCentroids)==="object"?l=i.testCentroids:l=Zn(a,i.k,i.attributes):l=Zn(a,i.k,i.attributes);for(var u=!0,f=0;u&&f<i.maxIterations;){for(var c=0;c<a.length;c++)n=a[c],o[n.id()]=al(n,l,i.distance,i.attributes,"kMeans");u=!1;for(var h=0;h<i.k;h++){var v=nl(h,a,o);if(v.length!==0){for(var d=i.attributes.length,g=l[h],p=new Array(d),y=new Array(d),b=0;b<d;b++){y[b]=0;for(var m=0;m<v.length;m++)n=v[m],y[b]+=i.attributes[b](n);p[b]=y[b]/v.length,pv(p[b],g[b],i.sensitivityThreshold)||(u=!0)}l[h]=p,s[h]=r.collection(v)}}f++}return s},wv=function(e){var r=this.cy(),a=this.nodes(),n=null,i=zi(e),s=new Array(i.k),o,l={},u,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(qe(i.testCentroids)==="object"?o=i.testCentroids:o=Es(a,i.k)):o=Es(a,i.k);for(var c=!0,h=0;c&&h<i.maxIterations;){for(var v=0;v<a.length;v++)n=a[v],l[n.id()]=al(n,o,i.distance,i.attributes,"kMedoids");c=!1;for(var d=0;d<o.length;d++){var g=nl(d,a,l);if(g.length!==0){f[d]=xs(o[d],g,i.attributes);for(var p=0;p<g.length;p++)u=xs(g[p],g,i.attributes),u<f[d]&&(f[d]=u,o[d]=g[p],c=!0);s[d]=r.collection(g)}}h++}return s},Ev=function(e,r,a,n,i){for(var s,o,l=0;l<r.length;l++)for(var u=0;u<e.length;u++)n[l][u]=Math.pow(a[l][u],i.m);for(var f=0;f<e.length;f++)for(var c=0;c<i.attributes.length;c++){s=0,o=0;for(var h=0;h<r.length;h++)s+=n[h][f]*i.attributes[c](r[h]),o+=n[h][f];e[f][c]=s/o}},xv=function(e,r,a,n,i){for(var s=0;s<e.length;s++)r[s]=e[s].slice();for(var o,l,u,f=2/(i.m-1),c=0;c<a.length;c++)for(var h=0;h<n.length;h++){o=0;for(var v=0;v<a.length;v++)l=wn(i.distance,n[h],a[c],i.attributes,"cmeans"),u=wn(i.distance,n[h],a[v],i.attributes,"cmeans"),o+=Math.pow(l/u,f);e[h][c]=1/o}},Tv=function(e,r,a,n){for(var i=new Array(a.k),s=0;s<i.length;s++)i[s]=[];for(var o,l,u=0;u<r.length;u++){o=-1/0,l=-1;for(var f=0;f<r[0].length;f++)r[u][f]>o&&(o=r[u][f],l=f);i[l].push(e[u])}for(var c=0;c<i.length;c++)i[c]=n.collection(i[c]);return i},Ts=function(e){var r=this.cy(),a=this.nodes(),n=zi(e),i,s,o,l,u;l=new Array(a.length);for(var f=0;f<a.length;f++)l[f]=new Array(n.k);o=new Array(a.length);for(var c=0;c<a.length;c++)o[c]=new Array(n.k);for(var h=0;h<a.length;h++){for(var v=0,d=0;d<n.k;d++)o[h][d]=Math.random(),v+=o[h][d];for(var g=0;g<n.k;g++)o[h][g]=o[h][g]/v}s=new Array(n.k);for(var p=0;p<n.k;p++)s[p]=new Array(n.attributes.length);u=new Array(a.length);for(var y=0;y<a.length;y++)u[y]=new Array(n.k);for(var b=!0,m=0;b&&m<n.maxIterations;)b=!1,Ev(s,a,o,u,n),xv(o,l,s,a,n),yv(o,l,n.sensitivityThreshold)||(b=!0),m++;return i=Tv(a,o,n,r),{clusters:i,degreeOfMembership:o}},Cv={kMeans:bv,kMedoids:wv,fuzzyCMeans:Ts,fcm:Ts},Dv=et({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Sv={single:"min",complete:"max"},Av=function(e){var r=Dv(e),a=Sv[r.linkage];return a!=null&&(r.linkage=a),r},Cs=function(e,r,a,n,i){for(var s=0,o=1/0,l,u=i.attributes,f=function(E,S){return On(i.distance,u.length,function(A){return u[A](E)},function(A){return u[A](S)},E,S)},c=0;c<e.length;c++){var h=e[c].key,v=a[h][n[h]];v<o&&(s=h,o=v)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=r[s],g=r[n[s]],p;i.mode==="dendrogram"?p={left:d,right:g,key:d.key}:p={value:d.value.concat(g.value),key:d.key},e[d.index]=p,e.splice(g.index,1),r[d.key]=p;for(var y=0;y<e.length;y++){var b=e[y];d.key===b.key?l=1/0:i.linkage==="min"?(l=a[d.key][b.key],a[d.key][b.key]>a[g.key][b.key]&&(l=a[g.key][b.key])):i.linkage==="max"?(l=a[d.key][b.key],a[d.key][b.key]<a[g.key][b.key]&&(l=a[g.key][b.key])):i.linkage==="mean"?l=(a[d.key][b.key]*d.size+a[g.key][b.key]*g.size)/(d.size+g.size):i.mode==="dendrogram"?l=f(b.value,d.value):l=f(b.value[0],d.value[0]),a[d.key][b.key]=a[b.key][d.key]=l}for(var m=0;m<e.length;m++){var T=e[m].key;if(n[T]===d.key||n[T]===g.key){for(var C=T,D=0;D<e.length;D++){var w=e[D].key;a[T][w]<a[T][C]&&(C=w)}n[T]=C}e[m].index=m}return d.key=g.key=d.index=g.index=null,!0},Xa=function t(e,r,a){e&&(e.value?r.push(e.value):(e.left&&t(e.left,r),e.right&&t(e.right,r)))},Lv=function t(e,r){if(!e)return"";if(e.left&&e.right){var a=t(e.left,r),n=t(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()},Rv=function t(e,r,a){if(!e)return[];var n=[],i=[],s=[];return r===0?(e.left&&Xa(e.left,n),e.right&&Xa(e.right,i),s=n.concat(i),[a.collection(s)]):r===1?e.value?[a.collection(e.value)]:(e.left&&Xa(e.left,n),e.right&&Xa(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=t(e.left,r-1,a)),e.right&&(i=t(e.right,r-1,a)),n.concat(i))},Ds=function(e){for(var r=this.cy(),a=this.nodes(),n=Av(e),i=n.attributes,s=function(m,T){return On(n.distance,i.length,function(C){return i[C](m)},function(C){return i[C](T)},m,T)},o=[],l=[],u=[],f=[],c=0;c<a.length;c++){var h={value:n.mode==="dendrogram"?a[c]:[a[c]],key:c,index:c};o[c]=h,f[c]=h,l[c]=[],u[c]=0}for(var v=0;v<o.length;v++)for(var d=0;d<=v;d++){var g=void 0;n.mode==="dendrogram"?g=v===d?1/0:s(o[v].value,o[d].value):g=v===d?1/0:s(o[v].value[0],o[d].value[0]),l[v][d]=g,l[d][v]=g,g<l[v][u[v]]&&(u[v]=d)}for(var p=Cs(o,f,l,u,n);p;)p=Cs(o,f,l,u,n);var y;return n.mode==="dendrogram"?(y=Rv(o[0],n.dendrogramDepth,r),n.addDendrogram&&Lv(o[0],r)):(y=new Array(o.length),o.forEach(function(b,m){b.key=b.index=null,y[m]=r.collection(b.value)})),y},Iv={hierarchicalClustering:Ds,hca:Ds},Ov=et({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Pv=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||_e("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)||_e("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),Ov(e)},Mv=function(e,r,a,n){var i=function(o,l){return n[l](o)};return-On(e,n.length,function(s){return i(r,s)},function(s){return i(a,s)},r,a)},Nv=function(e,r){var a=null;return r==="median"?a=Pc(e):r==="mean"?a=Oc(e):r==="min"?a=Rc(e):r==="max"?a=Ic(e):a=r,a},kv=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},Ss=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var s=-1,o=-1/0,l=0;l<a.length;l++){var u=a[l];r[i*e+u]>o&&(s=u,o=r[i*e+u])}s>0&&n.push(s)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},Bv=function(e,r,a){for(var n=Ss(e,r,a),i=0;i<a.length;i++){for(var s=[],o=0;o<n.length;o++)n[o]===a[i]&&s.push(o);for(var l=-1,u=-1/0,f=0;f<s.length;f++){for(var c=0,h=0;h<s.length;h++)c+=r[s[h]*e+s[f]];c>u&&(l=f,u=c)}a[i]=s[l]}return n=Ss(e,r,a),n},As=function(e){for(var r=this.cy(),a=this.nodes(),n=Pv(e),i={},s=0;s<a.length;s++)i[a[s].id()]=s;var o,l,u,f,c,h;o=a.length,l=o*o,u=new Array(l);for(var v=0;v<l;v++)u[v]=-1/0;for(var d=0;d<o;d++)for(var g=0;g<o;g++)d!==g&&(u[d*o+g]=Mv(n.distance,a[d],a[g],n.attributes));f=Nv(u,n.preference);for(var p=0;p<o;p++)u[p*o+p]=f;c=new Array(l);for(var y=0;y<l;y++)c[y]=0;h=new Array(l);for(var b=0;b<l;b++)h[b]=0;for(var m=new Array(o),T=new Array(o),C=new Array(o),D=0;D<o;D++)m[D]=0,T[D]=0,C[D]=0;for(var w=new Array(o*n.minIterations),x=0;x<w.length;x++)w[x]=0;var E;for(E=0;E<n.maxIterations;E++){for(var S=0;S<o;S++){for(var A=-1/0,L=-1/0,I=-1,R=0,P=0;P<o;P++)m[P]=c[S*o+P],R=h[S*o+P]+u[S*o+P],R>=A?(L=A,A=R,I=P):R>L&&(L=R);for(var M=0;M<o;M++)c[S*o+M]=(1-n.damping)*(u[S*o+M]-A)+n.damping*m[M];c[S*o+I]=(1-n.damping)*(u[S*o+I]-L)+n.damping*m[I]}for(var k=0;k<o;k++){for(var N=0,B=0;B<o;B++)m[B]=h[B*o+k],T[B]=Math.max(0,c[B*o+k]),N+=T[B];N-=T[k],T[k]=c[k*o+k],N+=T[k];for(var z=0;z<o;z++)h[z*o+k]=(1-n.damping)*Math.min(0,N-T[z])+n.damping*m[z];h[k*o+k]=(1-n.damping)*(N-T[k])+n.damping*m[k]}for(var F=0,G=0;G<o;G++){var H=h[G*o+G]+c[G*o+G]>0?1:0;w[E%n.minIterations*o+G]=H,F+=H}if(F>0&&(E>=n.minIterations-1||E==n.maxIterations-1)){for(var X=0,K=0;K<o;K++){C[K]=0;for(var q=0;q<n.minIterations;q++)C[K]+=w[q*o+K];(C[K]===0||C[K]===n.minIterations)&&X++}if(X===o)break}}for(var J=kv(o,c,h),j=Bv(o,u,J),Y={},_=0;_<J.length;_++)Y[J[_]]=[];for(var W=0;W<a.length;W++){var te=i[a[W].id()],ae=j[te];ae!=null&&Y[ae].push(a[W])}for(var se=new Array(J.length),Ce=0;Ce<J.length;Ce++)se[Ce]=r.collection(Y[J[Ce]]);return se},Fv={affinityPropagation:As,ap:As},Gv=et({root:void 0,directed:!1}),zv={hierholzer:function(e){if(!Ae(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=Gv(e),n=a.root,i=a.directed,s=this,o=!1,l,u,f;n&&(f=ce(n)?this.filter(n)[0].id():n[0].id());var c={},h={};i?s.forEach(function(b){var m=b.id();if(b.isNode()){var T=b.indegree(!0),C=b.outdegree(!0),D=T-C,w=C-T;D==1?l?o=!0:l=m:w==1?u?o=!0:u=m:(w>1||D>1)&&(o=!0),c[m]=[],b.outgoers().forEach(function(x){x.isEdge()&&c[m].push(x.id())})}else h[m]=[void 0,b.target().id()]}):s.forEach(function(b){var m=b.id();if(b.isNode()){var T=b.degree(!0);T%2&&(l?u?o=!0:u=m:l=m),c[m]=[],b.connectedEdges().forEach(function(C){return c[m].push(C.id())})}else h[m]=[b.source().id(),b.target().id()]});var v={found:!1,trail:void 0};if(o)return v;if(u&&l)if(i){if(f&&u!=f)return v;f=u}else{if(f&&u!=f&&l!=f)return v;f||(f=u)}else f||(f=s[0].id());var d=function(m){for(var T=m,C=[m],D,w,x;c[T].length;)D=c[T].shift(),w=h[D][0],x=h[D][1],T!=x?(c[x]=c[x].filter(function(E){return E!=D}),T=x):!i&&T!=w&&(c[w]=c[w].filter(function(E){return E!=D}),T=w),C.unshift(D),C.unshift(T);return C},g=[],p=[];for(p=d(f);p.length!=1;)c[p[0]].length==0?(g.unshift(s.getElementById(p.shift())),g.unshift(s.getElementById(p.shift()))):p=d(p.shift()).concat(p);g.unshift(s.getElementById(p.shift()));for(var y in c)if(c[y].length)return v;return v.found=!0,v.trail=this.spawn(g,!0),v}},Wa=function(){var e=this,r={},a=0,n=0,i=[],s=[],o={},l=function(h,v){for(var d=s.length-1,g=[],p=e.spawn();s[d].x!=h||s[d].y!=v;)g.push(s.pop().edge),d--;g.push(s.pop().edge),g.forEach(function(y){var b=y.connectedNodes().intersection(e);p.merge(y),b.forEach(function(m){var T=m.id(),C=m.connectedEdges().intersection(e);p.merge(m),r[T].cutVertex?p.merge(C.filter(function(D){return D.isLoop()})):p.merge(C)})}),i.push(p)},u=function c(h,v,d){h===d&&(n+=1),r[v]={id:a,low:a++,cutVertex:!1};var g=e.getElementById(v).connectedEdges().intersection(e);if(g.size()===0)i.push(e.spawn(e.getElementById(v)));else{var p,y,b,m;g.forEach(function(T){p=T.source().id(),y=T.target().id(),b=p===v?y:p,b!==d&&(m=T.id(),o[m]||(o[m]=!0,s.push({x:v,y:b,edge:T})),b in r?r[v].low=Math.min(r[v].low,r[b].id):(c(h,b,v),r[v].low=Math.min(r[v].low,r[b].low),r[v].id<=r[b].low&&(r[v].cutVertex=!0,l(v,b))))})}};e.forEach(function(c){if(c.isNode()){var h=c.id();h in r||(n=0,u(h,h),r[h].cutVertex=n>1)}});var f=Object.keys(r).filter(function(c){return r[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(f),components:i}},_v={hopcroftTarjanBiconnected:Wa,htbc:Wa,htb:Wa,hopcroftTarjanBiconnectedComponents:Wa},qa=function(){var e=this,r={},a=0,n=[],i=[],s=e.spawn(e),o=function l(u){i.push(u),r[u]={index:a,low:a++,explored:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.forEach(function(g){var p=g.target().id();p!==u&&(p in r||l(p),r[p].explored||(r[u].low=Math.min(r[u].low,r[p].low)))}),r[u].index===r[u].low){for(var c=e.spawn();;){var h=i.pop();if(c.merge(e.getElementById(h)),r[h].low=r[u].index,r[h].explored=!0,h===u)break}var v=c.edgesWith(c),d=c.merge(v);n.push(d),s=s.difference(d)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||o(u)}}),{cut:s,components:n}},Vv={tarjanStronglyConnected:qa,tsc:qa,tscc:qa,tarjanStronglyConnectedComponents:qa},il={};[Ta,yc,mc,wc,xc,Cc,Ac,Jc,zr,_r,hi,cv,Cv,Iv,Fv,zv,_v,Vv].forEach(function(t){he(il,t)});/*!
5
+ Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
6
+ Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
7
+ Licensed under The MIT License (http://opensource.org/licenses/MIT)
8
+ */var sl=0,ol=1,ll=2,qt=function t(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.7",this.state=sl,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))};qt.prototype={fulfill:function(e){return Ls(this,ol,"fulfillValue",e)},reject:function(e){return Ls(this,ll,"rejectReason",e)},then:function(e,r){var a=this,n=new qt;return a.onFulfilled.push(Is(e,n,"fulfill")),a.onRejected.push(Is(r,n,"reject")),ul(a),n.proxy}};var Ls=function(e,r,a,n){return e.state===sl&&(e.state=r,e[a]=n,ul(e)),e},ul=function(e){e.state===ol?Rs(e,"onFulfilled",e.fulfillValue):e.state===ll&&Rs(e,"onRejected",e.rejectReason)},Rs=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var o=0;o<n.length;o++)n[o](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},Is=function(e,r,a){return function(n){if(typeof e!="function")r[a].call(r,n);else{var i;try{i=e(n)}catch(s){r.reject(s);return}Uv(r,i)}}},Uv=function t(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(qe(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")):t(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(r)};qt.all=function(t){return new qt(function(e,r){for(var a=new Array(t.length),n=0,i=function(l,u){a[l]=u,n++,n===t.length&&e(a)},s=0;s<t.length;s++)(function(o){var l=t[o],u=l!=null&&l.then!=null;if(u)l.then(function(c){i(o,c)},function(c){r(c)});else{var f=l;i(o,f)}})(s)})};qt.resolve=function(t){return new qt(function(e,r){e(t)})};qt.reject=function(t){return new qt(function(e,r){r(t)})};var Wr=typeof Promise<"u"?Promise:qt,di=function(e,r,a){var n=Oi(e),i=!n,s=this._private=he({duration:1e3},r,a);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&Ve(s.complete)&&s.completes.push(s.complete),i){var o=e.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(n){var l=e.pan();s.startPan={x:l.x,y:l.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},Tr=di.prototype;he(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),xt(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(u,f){var c=e[u];c!=null&&(e[u]=e[f],e[f]=c)};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],s=i.name,o=e.startStyle[s];e.startStyle[s]=i,e.style[n]=o}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 Wr(function(n,i){a.push(function(){n()})})}});Tr.complete=Tr.completed;Tr.run=Tr.play;Tr.running=Tr.playing;var Yv={animated:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return!1;var s=n[0];if(s)return s._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s<n.length;s++){var o=n[s];o._private.animation.queue=[]}return this}},delay:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this,l=!i,u=!l;if(!o.styleEnabled())return this;var f=o.style();r=he({},r,a);var c=Object.keys(r).length===0;if(c)return new di(s[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(u&&(r.style=f.getPropsList(r.style||r.css),r.css=void 0),u&&r.renderedPosition!=null){var h=r.renderedPosition,v=o.pan(),d=o.zoom();r.position=qo(h,d,v)}if(l&&r.panBy!=null){var g=r.panBy,p=o.pan();r.pan={x:p.x+g.x,y:p.y+g.y}}var y=r.center||r.centre;if(l&&y!=null){var b=o.getCenterPan(y.eles,r.zoom);b!=null&&(r.pan=b)}if(l&&r.fit!=null){var m=r.fit,T=o.getFitViewport(m.eles||m.boundingBox,m.padding);T!=null&&(r.pan=T.pan,r.zoom=T.zoom)}if(l&&Ae(r.zoom)){var C=o.getZoomedViewport(r.zoom);C!=null?(C.zoomed&&(r.zoom=C.zoom),C.panned&&(r.pan=C.pan)):r.zoom=null}return new di(s[0],r)}},animate:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;a&&(r=he({},r,a));for(var l=0;l<s.length;l++){var u=s[l],f=u.animated()&&(r.queue===void 0||r.queue),c=u.animation(r,f?{queue:!0}:void 0);c.play()}return this}},stop:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var l=0;l<s.length;l++){for(var u=s[l],f=u._private,c=f.animation.current,h=0;h<c.length;h++){var v=c[h],d=v._private;a&&(d.duration=0)}r&&(f.animation.queue=[]),a||(f.animation.current=[])}return o.notify("draw"),this}}},$v=Array.isArray,Pn=$v,Hv=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Xv=/^\w*$/;function Wv(t,e){if(Pn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Ma(t)?!0:Xv.test(t)||!Hv.test(t)||e!=null&&t in Object(e)}var qv=Wv,Kv="[object AsyncFunction]",Zv="[object Function]",Qv="[object GeneratorFunction]",Jv="[object Proxy]";function jv(t){if(!wr(t))return!1;var e=zo(t);return e==Zv||e==Qv||e==Kv||e==Jv}var eh=jv,th=Ln["__core-js_shared__"],Qn=th,Os=function(){var t=/[^.]+$/.exec(Qn&&Qn.keys&&Qn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function rh(t){return!!Os&&Os in t}var ah=rh,nh=Function.prototype,ih=nh.toString;function sh(t){if(t!=null){try{return ih.call(t)}catch{}try{return t+""}catch{}}return""}var oh=sh,lh=/[\\^$.*+?()[\]{}|]/g,uh=/^\[object .+?Constructor\]$/,fh=Function.prototype,ch=Object.prototype,vh=fh.toString,hh=ch.hasOwnProperty,dh=RegExp("^"+vh.call(hh).replace(lh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function gh(t){if(!wr(t)||ah(t))return!1;var e=eh(t)?dh:uh;return e.test(oh(t))}var ph=gh;function yh(t,e){return t==null?void 0:t[e]}var mh=yh;function bh(t,e){var r=mh(t,e);return ph(r)?r:void 0}var _i=bh,wh=_i(Object,"create"),Sa=wh;function Eh(){this.__data__=Sa?Sa(null):{},this.size=0}var xh=Eh;function Th(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Ch=Th,Dh="__lodash_hash_undefined__",Sh=Object.prototype,Ah=Sh.hasOwnProperty;function Lh(t){var e=this.__data__;if(Sa){var r=e[t];return r===Dh?void 0:r}return Ah.call(e,t)?e[t]:void 0}var Rh=Lh,Ih=Object.prototype,Oh=Ih.hasOwnProperty;function Ph(t){var e=this.__data__;return Sa?e[t]!==void 0:Oh.call(e,t)}var Mh=Ph,Nh="__lodash_hash_undefined__";function kh(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Sa&&e===void 0?Nh:e,this}var Bh=kh;function qr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}qr.prototype.clear=xh;qr.prototype.delete=Ch;qr.prototype.get=Rh;qr.prototype.has=Mh;qr.prototype.set=Bh;var Ps=qr;function Fh(){this.__data__=[],this.size=0}var Gh=Fh;function zh(t,e){return t===e||t!==t&&e!==e}var fl=zh;function _h(t,e){for(var r=t.length;r--;)if(fl(t[r][0],e))return r;return-1}var Mn=_h,Vh=Array.prototype,Uh=Vh.splice;function Yh(t){var e=this.__data__,r=Mn(e,t);if(r<0)return!1;var a=e.length-1;return r==a?e.pop():Uh.call(e,r,1),--this.size,!0}var $h=Yh;function Hh(t){var e=this.__data__,r=Mn(e,t);return r<0?void 0:e[r][1]}var Xh=Hh;function Wh(t){return Mn(this.__data__,t)>-1}var qh=Wh;function Kh(t,e){var r=this.__data__,a=Mn(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}var Zh=Kh;function Kr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}Kr.prototype.clear=Gh;Kr.prototype.delete=$h;Kr.prototype.get=Xh;Kr.prototype.has=qh;Kr.prototype.set=Zh;var Qh=Kr,Jh=_i(Ln,"Map"),jh=Jh;function ed(){this.size=0,this.__data__={hash:new Ps,map:new(jh||Qh),string:new Ps}}var td=ed;function rd(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var ad=rd;function nd(t,e){var r=t.__data__;return ad(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Nn=nd;function id(t){var e=Nn(this,t).delete(t);return this.size-=e?1:0,e}var sd=id;function od(t){return Nn(this,t).get(t)}var ld=od;function ud(t){return Nn(this,t).has(t)}var fd=ud;function cd(t,e){var r=Nn(this,t),a=r.size;return r.set(t,e),this.size+=r.size==a?0:1,this}var vd=cd;function Zr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}Zr.prototype.clear=td;Zr.prototype.delete=sd;Zr.prototype.get=ld;Zr.prototype.has=fd;Zr.prototype.set=vd;var cl=Zr,hd="Expected a function";function Vi(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(hd);var r=function(){var a=arguments,n=e?e.apply(this,a):a[0],i=r.cache;if(i.has(n))return i.get(n);var s=t.apply(this,a);return r.cache=i.set(n,s)||i,s};return r.cache=new(Vi.Cache||cl),r}Vi.Cache=cl;var dd=Vi,gd=500;function pd(t){var e=dd(t,function(a){return r.size===gd&&r.clear(),a}),r=e.cache;return e}var yd=pd,md=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bd=/\\(\\)?/g,wd=yd(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(md,function(r,a,n,i){e.push(n?i.replace(bd,"$1"):a||r)}),e}),vl=wd;function Ed(t,e){for(var r=-1,a=t==null?0:t.length,n=Array(a);++r<a;)n[r]=e(t[r],r,t);return n}var hl=Ed,xd=1/0,Ms=Ur?Ur.prototype:void 0,Ns=Ms?Ms.toString:void 0;function dl(t){if(typeof t=="string")return t;if(Pn(t))return hl(t,dl)+"";if(Ma(t))return Ns?Ns.call(t):"";var e=t+"";return e=="0"&&1/t==-xd?"-0":e}var Td=dl;function Cd(t){return t==null?"":Td(t)}var gl=Cd;function Dd(t,e){return Pn(t)?t:qv(t,e)?[t]:vl(gl(t))}var pl=Dd,Sd=1/0;function Ad(t){if(typeof t=="string"||Ma(t))return t;var e=t+"";return e=="0"&&1/t==-Sd?"-0":e}var Ui=Ad;function Ld(t,e){e=pl(e,t);for(var r=0,a=e.length;t!=null&&r<a;)t=t[Ui(e[r++])];return r&&r==a?t:void 0}var Rd=Ld;function Id(t,e,r){var a=t==null?void 0:Rd(t,e);return a===void 0?r:a}var Od=Id,Pd=function(){try{var t=_i(Object,"defineProperty");return t({},"",{}),t}catch{}}(),ks=Pd;function Md(t,e,r){e=="__proto__"&&ks?ks(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Nd=Md,kd=Object.prototype,Bd=kd.hasOwnProperty;function Fd(t,e,r){var a=t[e];(!(Bd.call(t,e)&&fl(a,r))||r===void 0&&!(e in t))&&Nd(t,e,r)}var Gd=Fd,zd=9007199254740991,_d=/^(?:0|[1-9]\d*)$/;function Vd(t,e){var r=typeof t;return e=e??zd,!!e&&(r=="number"||r!="symbol"&&_d.test(t))&&t>-1&&t%1==0&&t<e}var Ud=Vd;function Yd(t,e,r,a){if(!wr(t))return t;e=pl(e,t);for(var n=-1,i=e.length,s=i-1,o=t;o!=null&&++n<i;){var l=Ui(e[n]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(n!=s){var f=o[l];u=a?a(f,l,o):void 0,u===void 0&&(u=wr(f)?f:Ud(e[n+1])?[]:{})}Gd(o,l,u),o=o[l]}return t}var $d=Yd;function Hd(t,e,r){return t==null?t:$d(t,e,r)}var Xd=Hd;function Wd(t,e){var r=-1,a=t.length;for(e||(e=Array(a));++r<a;)e[r]=t[r];return e}var qd=Wd;function Kd(t){return Pn(t)?hl(t,Ui):Ma(t)?[t]:qd(vl(gl(t)))}var Zd=Kd,Qd={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(n){},beforeSet:function(n,i){},onSet:function(n){},canSet:function(n){return!0}};return e=he({},r,e),function(n,i){var s=e,o=this,l=o.length!==void 0,u=l?o:[o],f=l?o[0]:o;if(ce(n)){var c=n.indexOf(".")!==-1,h=c&&Zd(n);if(s.allowGetting&&i===void 0){var v;return f&&(s.beforeGet(f),h&&f._private[s.field][n]===void 0?v=Od(f._private[s.field],h):v=f._private[s.field][n]),v}else if(s.allowSetting&&i!==void 0){var d=!s.immutableKeys[n];if(d){var g=Lo({},n,i);s.beforeSet(o,g);for(var p=0,y=u.length;p<y;p++){var b=u[p];s.canSet(b)&&(h&&f._private[s.field][n]===void 0?Xd(b._private[s.field],h,i):b._private[s.field][n]=i)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}}else if(s.allowSetting&&Ae(n)){var m=n,T,C,D=Object.keys(m);s.beforeSet(o,m);for(var w=0;w<D.length;w++){T=D[w],C=m[T];var x=!s.immutableKeys[T];if(x)for(var E=0;E<u.length;E++){var S=u[E];s.canSet(S)&&(S._private[s.field][T]=C)}}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&Ve(n)){var A=n;o.on(s.bindingEvent,A)}else if(s.allowGetting&&n===void 0){var L;return f&&(s.beforeGet(f),L=f._private[s.field]),L}return o}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=he({},r,e),function(n){var i=e,s=this,o=s.length!==void 0,l=o?s:[s];if(ce(n)){for(var u=n.split(/\s+/),f=u.length,c=0;c<f;c++){var h=u[c];if(!ar(h)){var v=!i.immutableKeys[h];if(v)for(var d=0,g=l.length;d<g;d++)l[d]._private[i.field][h]=void 0}}i.triggerEvent&&s[i.triggerFnName](i.event)}else if(n===void 0){for(var p=0,y=l.length;p<y;p++)for(var b=l[p]._private[i.field],m=Object.keys(b),T=0;T<m.length;T++){var C=m[T],D=!i.immutableKeys[C];D&&(b[C]=void 0)}i.triggerEvent&&s[i.triggerFnName](i.event)}return s}}},Jd={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,s=Array.prototype.slice.call(arguments,0);return new Wr(function(o,l){var u=function(v){i.off.apply(i,c),o(v)},f=s.concat([u]),c=f.concat([]);i.on.apply(i,f)})}}},Re={};[Yv,Qd,Jd].forEach(function(t){he(Re,t)});var jd={animate:Re.animate(),animation:Re.animation(),animated:Re.animated(),clearQueue:Re.clearQueue(),delay:Re.delay(),delayAnimation:Re.delayAnimation(),stop:Re.stop()},sn={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 Ne(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new Xr(e),s=0;s<r.length;s++){for(var o=r[s],l=o._private,u=l.classes,f=!1,c=0;c<e.length;c++){var h=e[c],v=u.has(h);if(!v){f=!0;break}}f||(f=u.size!==e.length),f&&(l.classes=i,n.push(o))}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){Ne(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],s=0,o=a.length;s<o;s++)for(var l=a[s],u=l._private.classes,f=!1,c=0;c<e.length;c++){var h=e[c],v=u.has(h),d=!1;r||n&&!v?(u.add(h),d=!0):(!r||n&&v)&&(u.delete(h),d=!0),!f&&d&&(i.push(l),f=!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}};sn.className=sn.classNames=sn.classes;var Se={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:We,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Se.variable="(?:[\\w-.]|(?:\\\\"+Se.metaChar+"))+";Se.className="(?:[\\w-]|(?:\\\\"+Se.metaChar+"))+";Se.value=Se.string+"|"+Se.number;Se.id=Se.variable;(function(){var t,e,r;for(t=Se.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],Se.comparatorOp+="|@"+e;for(t=Se.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Se.comparatorOp+="|\\!"+e)})();var Me=function(){return{checks:[]}},oe={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},gi=[{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 vf(t.selector,e.selector)}),eg=function(){for(var t={},e,r=0;r<gi.length;r++)e=gi[r],t[e.selector]=e.matches;return t}(),tg=function(e,r){return eg[e](r)},rg="("+gi.map(function(t){return t.selector}).join("|")+")",Rr=function(e){return e.replace(new RegExp("\\\\("+Se.metaChar+")","g"),function(r,a){return a})},Jt=function(e,r,a){e[e.length-1]=a},pi=[{name:"group",query:!0,regex:"("+Se.group+")",populate:function(e,r,a){var n=Ye(a,1),i=n[0];r.checks.push({type:oe.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:rg,populate:function(e,r,a){var n=Ye(a,1),i=n[0];r.checks.push({type:oe.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Se.id+")",populate:function(e,r,a){var n=Ye(a,1),i=n[0];r.checks.push({type:oe.ID,value:Rr(i)})}},{name:"className",query:!0,regex:"\\.("+Se.className+")",populate:function(e,r,a){var n=Ye(a,1),i=n[0];r.checks.push({type:oe.CLASS,value:Rr(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Se.variable+")\\s*\\]",populate:function(e,r,a){var n=Ye(a,1),i=n[0];r.checks.push({type:oe.DATA_EXIST,field:Rr(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Se.variable+")\\s*("+Se.comparatorOp+")\\s*("+Se.value+")\\s*\\]",populate:function(e,r,a){var n=Ye(a,3),i=n[0],s=n[1],o=n[2],l=new RegExp("^"+Se.string+"$").exec(o)!=null;l?o=o.substring(1,o.length-1):o=parseFloat(o),r.checks.push({type:oe.DATA_COMPARE,field:Rr(i),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Se.boolOp+")\\s*("+Se.variable+")\\s*\\]",populate:function(e,r,a){var n=Ye(a,2),i=n[0],s=n[1];r.checks.push({type:oe.DATA_BOOL,field:Rr(s),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Se.meta+")\\s*("+Se.comparatorOp+")\\s*("+Se.number+")\\s*\\]\\]",populate:function(e,r,a){var n=Ye(a,3),i=n[0],s=n[1],o=n[2];r.checks.push({type:oe.META_COMPARE,field:Rr(i),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Se.separator,populate:function(e,r){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,s=e[e.length-1];a!=null&&(s.subject=a,e.currentSubject=null),s.edgeCount=n,s.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=Me();return o}},{name:"directedEdge",separator:!0,regex:Se.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Me(),n=r,i=Me();return a.checks.push({type:oe.DIRECTED_EDGE,source:n,target:i}),Jt(e,r,a),e.edgeCount++,i}else{var s=Me(),o=r,l=Me();return s.checks.push({type:oe.NODE_SOURCE,source:o,target:l}),Jt(e,r,s),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:Se.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Me(),n=r,i=Me();return a.checks.push({type:oe.UNDIRECTED_EDGE,nodes:[n,i]}),Jt(e,r,a),e.edgeCount++,i}else{var s=Me(),o=r,l=Me();return s.checks.push({type:oe.NODE_NEIGHBOR,node:o,neighbor:l}),Jt(e,r,s),l}}},{name:"child",separator:!0,regex:Se.child,populate:function(e,r){if(e.currentSubject==null){var a=Me(),n=Me(),i=e[e.length-1];return a.checks.push({type:oe.CHILD,parent:i,child:n}),Jt(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var s=Me(),o=e[e.length-1],l=Me(),u=Me(),f=Me(),c=Me();return s.checks.push({type:oe.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:oe.TRUE}],c.checks.push({type:oe.TRUE}),l.checks.push({type:oe.PARENT,parent:c,child:f}),Jt(e,o,s),e.currentSubject=u,e.compoundCount++,f}else{var h=Me(),v=Me(),d=[{type:oe.PARENT,parent:h,child:v}];return h.checks=r.checks,r.checks=d,e.compoundCount++,v}}},{name:"descendant",separator:!0,regex:Se.descendant,populate:function(e,r){if(e.currentSubject==null){var a=Me(),n=Me(),i=e[e.length-1];return a.checks.push({type:oe.DESCENDANT,ancestor:i,descendant:n}),Jt(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var s=Me(),o=e[e.length-1],l=Me(),u=Me(),f=Me(),c=Me();return s.checks.push({type:oe.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:oe.TRUE}],c.checks.push({type:oe.TRUE}),l.checks.push({type:oe.ANCESTOR,ancestor:c,descendant:f}),Jt(e,o,s),e.currentSubject=u,e.compoundCount++,f}else{var h=Me(),v=Me(),d=[{type:oe.ANCESTOR,ancestor:h,descendant:v}];return h.checks=r.checks,r.checks=d,e.compoundCount++,v}}},{name:"subject",modifier:!0,regex:Se.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],n=a.checks[0],i=n==null?null:n.type;i===oe.DIRECTED_EDGE?n.type=oe.NODE_TARGET:i===oe.UNDIRECTED_EDGE&&(n.type=oe.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];pi.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var ag=function(e){for(var r,a,n,i=0;i<pi.length;i++){var s=pi[i],o=s.name,l=e.match(s.regexObj);if(l!=null){a=l,r=s,n=o;var u=l[0];e=e.substring(u.length);break}}return{expr:r,match:a,name:n,remaining:e}},ng=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},ig=function(e){var r=this,a=r.inputText=e,n=r[0]=Me();for(r.length=1,a=ng(a);;){var i=ag(a);if(i.expr==null)return Ie("The selector `"+e+"`is invalid"),!1;var s=i.match.slice(1),o=i.expr.populate(r,n,s);if(o===!1)return!1;if(o!=null&&(n=o),a=i.remaining,a.match(/^\s*$/))break}var l=r[r.length-1];r.currentSubject!=null&&(l.subject=r.currentSubject),l.edgeCount=r.edgeCount,l.compoundCount=r.compoundCount;for(var u=0;u<r.length;u++){var f=r[u];if(f.compoundCount>0&&f.edgeCount>0)return Ie("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Ie("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.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},sg=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f??""},r=function(f){return ce(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,c){var h=f.type,v=f.value;switch(h){case oe.GROUP:{var d=e(v);return d.substring(0,d.length-1)}case oe.DATA_COMPARE:{var g=f.field,p=f.operator;return"["+g+a(e(p))+r(v)+"]"}case oe.DATA_BOOL:{var y=f.operator,b=f.field;return"["+e(y)+b+"]"}case oe.DATA_EXIST:{var m=f.field;return"["+m+"]"}case oe.META_COMPARE:{var T=f.operator,C=f.field;return"[["+C+a(e(T))+r(v)+"]]"}case oe.STATE:return v;case oe.ID:return"#"+v;case oe.CLASS:return"."+v;case oe.PARENT:case oe.CHILD:return i(f.parent,c)+a(">")+i(f.child,c);case oe.ANCESTOR:case oe.DESCENDANT:return i(f.ancestor,c)+" "+i(f.descendant,c);case oe.COMPOUND_SPLIT:{var D=i(f.left,c),w=i(f.subject,c),x=i(f.right,c);return D+(D.length>0?" ":"")+w+x}case oe.TRUE:return""}},i=function(f,c){return f.checks.reduce(function(h,v,d){return h+(c===f&&d===0?"$":"")+n(v,c)},"")},s="",o=0;o<this.length;o++){var l=this[o];s+=i(l,l.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s},og={parse:ig,toString:sg},yl=function(e,r,a){var n,i=ce(e),s=re(e),o=ce(a),l,u,f=!1,c=!1,h=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),c=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||o||f)&&(l=!i&&!s?"":""+e,u=""+a),f&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),r){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":h=!0,n=e>a;break;case">=":h=!0,n=e>=a;break;case"<":h=!0,n=e<a;break;case"<=":h=!0,n=e<=a;break;default:n=!1;break}return c&&(e!=null||!h)&&(n=!n),n},lg=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},ug=function(e){return e!==void 0},Yi=function(e,r){return e.data(r)},fg=function(e,r){return e[r]()},Ue=[],Ge=function(e,r){return e.checks.every(function(a){return Ue[a.type](a,r)})};Ue[oe.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};Ue[oe.STATE]=function(t,e){var r=t.value;return tg(r,e)};Ue[oe.ID]=function(t,e){var r=t.value;return e.id()===r};Ue[oe.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};Ue[oe.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return yl(fg(e,r),a,n)};Ue[oe.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return yl(Yi(e,r),a,n)};Ue[oe.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return lg(Yi(e,r),a)};Ue[oe.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,ug(Yi(e,r))};Ue[oe.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)};Ue[oe.NODE_NEIGHBOR]=function(t,e){return Ge(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&Ge(t.neighbor,r)})};Ue[oe.DIRECTED_EDGE]=function(t,e){return Ge(t.source,e.source())&&Ge(t.target,e.target())};Ue[oe.NODE_SOURCE]=function(t,e){return Ge(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&Ge(t.target,r)})};Ue[oe.NODE_TARGET]=function(t,e){return Ge(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&Ge(t.source,r)})};Ue[oe.CHILD]=function(t,e){return Ge(t.child,e)&&Ge(t.parent,e.parent())};Ue[oe.PARENT]=function(t,e){return Ge(t.parent,e)&&e.children().some(function(r){return Ge(t.child,r)})};Ue[oe.DESCENDANT]=function(t,e){return Ge(t.descendant,e)&&e.ancestors().some(function(r){return Ge(t.ancestor,r)})};Ue[oe.ANCESTOR]=function(t,e){return Ge(t.ancestor,e)&&e.descendants().some(function(r){return Ge(t.descendant,r)})};Ue[oe.COMPOUND_SPLIT]=function(t,e){return Ge(t.subject,e)&&Ge(t.left,e)&&Ge(t.right,e)};Ue[oe.TRUE]=function(){return!0};Ue[oe.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};Ue[oe.FILTER]=function(t,e){var r=t.value;return r(e)};var cg=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===oe.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(i){for(var s=0;s<r.length;s++){var o=r[s];if(Ge(o,i))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},vg=function(e){for(var r=this,a=0;a<r.length;a++){var n=r[a];if(Ge(n,e))return!0}return!1},hg={matches:vg,filter:cg},sr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||ce(e)&&e.match(/^\s*$/)||(xt(e)?this.addQuery({checks:[{type:oe.COLLECTION,value:e.collection()}]}):Ve(e)?this.addQuery({checks:[{type:oe.FILTER,value:e}]}):ce(e)?this.parse(e)||(this.invalid=!0):_e("A selector must be created from a string; found "))},or=sr.prototype;[og,hg].forEach(function(t){return he(or,t)});or.text=function(){return this.inputText};or.size=function(){return this.length};or.eq=function(t){return this[t]};or.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};or.addQuery=function(t){this[this.length++]=t};or.selector=or.toString;var tr={allAre:function(e){var r=new sr(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new sr(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,a=e.length;return r!==a?!1:r===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.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 St=function(e,r){return function(n,i,s,o){var l=n,u=this,f;if(l==null?f="":xt(l)&&l.length===1&&(f=l.id()),u.length===1&&f){var c=u[0]._private,h=c.traversalCache=c.traversalCache||{},v=h[r]=h[r]||[],d=nr(f),g=v[d];return g||(v[d]=e.call(u,n,i,s,o))}else return e.call(u,n,i,s,o)}},Hr={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],s=i._private.parent;s&&r.push(s)}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],i=n.parents();r=r||i,r=r.intersect(i)}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:St(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);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 s=n[i];r.push(s),s.children().nonempty()&&a(s.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function $i(t,e,r,a){for(var n=[],i=new Xr,s=t.cy(),o=s.hasCompoundNodes(),l=0;l<t.length;l++){var u=t[l];r?n.push(u):o&&a(n,i,u)}for(;n.length>0;){var f=n.shift();e(f),i.add(f.id()),o&&a(n,i,f)}return t}function ml(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)}}Hr.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return $i(this,t,e,ml)};function bl(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}Hr.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return $i(this,t,e,bl)};function dg(t,e,r){bl(t,e,r),ml(t,e,r)}Hr.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return $i(this,t,e,dg)};Hr.ancestors=Hr.parents;var Aa,wl;Aa=wl={data:Re.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:Re.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Re.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Re.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Re.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Re.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Aa.attr=Aa.data;Aa.removeAttr=Aa.removeData;var gg=wl,kn={};function Jn(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,s=0;s<i.length;s++){var o=i[s];!e&&o.isLoop()||(a+=t(n,o))}return a}else return}}he(kn,{degree:Jn(function(t,e){return e.source().same(e.target())?2:1}),indegree:Jn(function(t,e){return e.target().same(t)?1:0}),outdegree:Jn(function(t,e){return e.source().same(t)?1:0})});function Ir(t,e){return function(r){for(var a,n=this.nodes(),i=0;i<n.length;i++){var s=n[i],o=s[t](r);o!==void 0&&(a===void 0||e(o,a))&&(a=o)}return a}}he(kn,{minDegree:Ir("degree",function(t,e){return t<e}),maxDegree:Ir("degree",function(t,e){return t>e}),minIndegree:Ir("indegree",function(t,e){return t<e}),maxIndegree:Ir("indegree",function(t,e){return t>e}),minOutdegree:Ir("outdegree",function(t,e){return t<e}),maxOutdegree:Ir("outdegree",function(t,e){return t>e})});he(kn,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n<a.length;n++)r+=a[n].degree(e);return r}});var Ot,El,xl=function(e,r,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var s=i._private.position,o={x:r.x!=null?r.x-s.x:0,y:r.y!=null?r.y-s.y:0};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,a),i.dirtyBoundingBoxCache()}}},Bs={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){xl(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Ot=El={position:Re.data(Bs),silentPosition:Re.data(he({},Bs,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){xl(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Ae(e))r?this.silentPosition(e):this.position(e);else if(Ve(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var s=this[i],o=void 0;(o=a(s,i))&&(r?s.silentPosition(o):s.position(o))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var n;if(Ae(e)?(n={x:re(e.x)?e.x:0,y:re(e.y)?e.y:0},a=r):ce(e)&&re(r)&&(n={x:0,y:0},n[e]=r),n!=null){var i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var l=o.position(),u={x:l.x+n.x,y:l.y+n.y};a?o.silentPosition(u):o.position(u)}}i.endBatch()}return this},silentShift:function(e,r){return Ae(e)?this.shift(e,!0):ce(e)&&re(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],n=this.cy(),i=n.zoom(),s=n.pan(),o=Ae(e)?e:void 0,l=o!==void 0||r!==void 0&&ce(e);if(a&&a.isNode())if(l)for(var u=0;u<this.length;u++){var f=this[u];r!==void 0?f.position(e,(r-s[e])/i):o!==void 0&&f.position(qo(o,i,s))}else{var c=a.position();return o=In(c,i,s),e===void 0?o:o[e]}else if(!l)return;return this},relativePosition:function(e,r){var a=this[0],n=this.cy(),i=Ae(e)?e:void 0,s=i!==void 0||r!==void 0&&ce(e),o=n.hasCompoundNodes();if(a&&a.isNode())if(s)for(var l=0;l<this.length;l++){var u=this[l],f=o?u.parent():null,c=f&&f.length>0,h=c;c&&(f=f[0]);var v=h?f.position():{x:0,y:0};r!==void 0?u.position(e,r+v[e]):i!==void 0&&u.position({x:i.x+v.x,y:i.y+v.y})}else{var d=a.position(),g=o?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:d.x-b.x,y:d.y-b.y},e===void 0?i:i[e]}else if(!s)return;return this}};Ot.modelPosition=Ot.point=Ot.position;Ot.modelPositions=Ot.points=Ot.positions;Ot.renderedPoint=Ot.renderedPosition;Ot.relativePoint=Ot.relativePosition;var pg=El,Vr,vr;Vr=vr={};vr.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:l,w:s-i,h:l-o}};vr.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)};vr.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(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},c=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),h=o.position;(c.w===0||c.h===0)&&(c={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},c.x1=h.x-c.w/2,c.x2=h.x+c.w/2,c.y1=h.y-c.h/2,c.y2=h.y+c.h/2);function v(E,S,A){var L=0,I=0,R=S+A;return E>0&&R>0&&(L=S/R*E,I=A/R*E),{biasDiff:L,biasComplementDiff:I}}function d(E,S,A,L){if(A.units==="%")switch(L){case"width":return E>0?A.pfValue*E:0;case"height":return S>0?A.pfValue*S:0;case"average":return E>0&&S>0?A.pfValue*(E+S)/2:0;case"min":return E>0&&S>0?E>S?A.pfValue*S:A.pfValue*E:0;case"max":return E>0&&S>0?E>S?A.pfValue*E:A.pfValue*S:0;default:return 0}else return A.units==="px"?A.pfValue:0}var g=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(g=g*100/f.width.val);var p=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(p=p*100/f.width.val);var y=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(y=y*100/f.height.val);var b=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(b=b*100/f.height.val);var m=v(f.width.val-c.w,g,p),T=m.biasDiff,C=m.biasComplementDiff,D=v(f.height.val-c.h,y,b),w=D.biasDiff,x=D.biasComplementDiff;o.autoPadding=d(c.w,c.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(c.w,f.width.val),h.x=(-T+c.x1+c.x2+C)/2,o.autoHeight=Math.max(c.h,f.height.val),h.y=(-w+c.y1+c.y2+x)/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 Dt=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)},pr=function(e,r){return r==null?e:Rt(e,r.x1,r.y1,r.x2,r.y2)},sa=function(e,r,a){return It(e,r,a)},Ka=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,s=i.arrowWidth/2,o=r.pstyle(a+"-arrow-shape").value,l,u;if(o!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var f=n.arrowBounds=n.arrowBounds||{},c=f[a]=f[a]||{};c.x1=l-s,c.y1=u-s,c.x2=l+s,c.y2=u+s,c.w=c.x2-c.x1,c.h=c.y2-c.y1,an(c,1),Rt(e,c.x1,c.y1,c.x2,c.y2)}}},jn=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,s=i.rstyle,o=r.pstyle(n+"label").strValue;if(o){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),f=sa(s,"labelWidth",a),c=sa(s,"labelHeight",a),h=sa(s,"labelX",a),v=sa(s,"labelY",a),d=r.pstyle(n+"text-margin-x").pfValue,g=r.pstyle(n+"text-margin-y").pfValue,p=r.isEdge(),y=r.pstyle(n+"text-rotation"),b=r.pstyle("text-outline-width").pfValue,m=r.pstyle("text-border-width").pfValue,T=m/2,C=r.pstyle("text-background-padding").pfValue,D=2,w=c,x=f,E=x/2,S=w/2,A,L,I,R;if(p)A=h-E,L=h+E,I=v-S,R=v+S;else{switch(l.value){case"left":A=h-x,L=h;break;case"center":A=h-E,L=h+E;break;case"right":A=h,L=h+x;break}switch(u.value){case"top":I=v-w,R=v;break;case"center":I=v-S,R=v+S;break;case"bottom":I=v,R=v+w;break}}var P=d-Math.max(b,T)-C-D,M=d+Math.max(b,T)+C+D,k=g-Math.max(b,T)-C-D,N=g+Math.max(b,T)+C+D;A+=P,L+=M,I+=k,R+=N;var B=a||"main",z=i.labelBounds,F=z[B]=z[B]||{};F.x1=A,F.y1=I,F.x2=L,F.y2=R,F.w=L-A,F.h=R-I,F.leftPad=P,F.rightPad=M,F.topPad=k,F.botPad=N;var G=p&&y.strValue==="autorotate",H=y.pfValue!=null&&y.pfValue!==0;if(G||H){var X=G?sa(i.rstyle,"labelAngle",a):y.pfValue,K=Math.cos(X),q=Math.sin(X),J=(A+L)/2,j=(I+R)/2;if(!p){switch(l.value){case"left":J=L;break;case"right":J=A;break}switch(u.value){case"top":j=R;break;case"bottom":j=I;break}}var Y=function(Pe,ue){return Pe=Pe-J,ue=ue-j,{x:Pe*K-ue*q+J,y:Pe*q+ue*K+j}},_=Y(A,I),W=Y(A,R),te=Y(L,I),ae=Y(L,R);A=Math.min(_.x,W.x,te.x,ae.x),L=Math.max(_.x,W.x,te.x,ae.x),I=Math.min(_.y,W.y,te.y,ae.y),R=Math.max(_.y,W.y,te.y,ae.y)}var se=B+"Rot",Ce=z[se]=z[se]||{};Ce.x1=A,Ce.y1=I,Ce.x2=L,Ce.y2=R,Ce.w=L-A,Ce.h=R-I,Rt(e,A,I,L,R),Rt(i.labelBounds.all,A,I,L,R)}return e}},yg=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value;if(a>0&&n>0){var i=r.pstyle("outline-offset").value,s=r.pstyle("shape").value,o=n+i,l=(e.w+o*2)/e.w,u=(e.h+o*2)/e.h,f=0,c=0;["diamond","pentagon","round-triangle"].includes(s)?(l=(e.w+o*2.4)/e.w,c=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(s)?l=(e.w+o*2.4)/e.w:s==="star"?(l=(e.w+o*2.8)/e.w,u=(e.h+o*2.6)/e.h,c=-o/3.8):s==="triangle"?(l=(e.w+o*2.8)/e.w,u=(e.h+o*2.4)/e.h,c=-o/1.4):s==="vee"&&(l=(e.w+o*4.4)/e.w,u=(e.h+o*3.8)/e.h,c=-o*.5);var h=e.h*u-e.h,v=e.w*l-e.w;if(nn(e,[Math.ceil(h/2),Math.ceil(v/2)]),f!=0||c!==0){var d=Gc(e,f,c);Zo(e,d)}}}},mg=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=yt(),o=e._private,l=e.isNode(),u=e.isEdge(),f,c,h,v,d,g,p=o.rstyle,y=l&&n?e.pstyle("bounds-expansion").pfValue:[0],b=function(Oe){return Oe.pstyle("display").value!=="none"},m=!n||b(e)&&(!u||b(e.source())&&b(e.target()));if(m){var T=0,C=0;n&&r.includeOverlays&&(T=e.pstyle("overlay-opacity").value,T!==0&&(C=e.pstyle("overlay-padding").value));var D=0,w=0;n&&r.includeUnderlays&&(D=e.pstyle("underlay-opacity").value,D!==0&&(w=e.pstyle("underlay-padding").value));var x=Math.max(C,w),E=0,S=0;if(n&&(E=e.pstyle("width").pfValue,S=E/2),l&&r.includeNodes){var A=e.position();d=A.x,g=A.y;var L=e.outerWidth(),I=L/2,R=e.outerHeight(),P=R/2;f=d-I,c=d+I,h=g-P,v=g+P,Rt(s,f,h,c,v),n&&r.includeOutlines&&yg(s,e)}else if(u&&r.includeEdges)if(n&&!i){var M=e.pstyle("curve-style").strValue;if(f=Math.min(p.srcX,p.midX,p.tgtX),c=Math.max(p.srcX,p.midX,p.tgtX),h=Math.min(p.srcY,p.midY,p.tgtY),v=Math.max(p.srcY,p.midY,p.tgtY),f-=S,c+=S,h-=S,v+=S,Rt(s,f,h,c,v),M==="haystack"){var k=p.haystackPts;if(k&&k.length===2){if(f=k[0].x,h=k[0].y,c=k[1].x,v=k[1].y,f>c){var N=f;f=c,c=N}if(h>v){var B=h;h=v,v=B}Rt(s,f-S,h-S,c+S,v+S)}}else if(M==="bezier"||M==="unbundled-bezier"||M.endsWith("segments")||M.endsWith("taxi")){var z;switch(M){case"bezier":case"unbundled-bezier":z=p.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":z=p.linePts;break}if(z!=null)for(var F=0;F<z.length;F++){var G=z[F];f=G.x-S,c=G.x+S,h=G.y-S,v=G.y+S,Rt(s,f,h,c,v)}}}else{var H=e.source(),X=H.position(),K=e.target(),q=K.position();if(f=X.x,c=q.x,h=X.y,v=q.y,f>c){var J=f;f=c,c=J}if(h>v){var j=h;h=v,v=j}f-=S,c+=S,h-=S,v+=S,Rt(s,f,h,c,v)}if(n&&r.includeEdges&&u&&(Ka(s,e,"mid-source"),Ka(s,e,"mid-target"),Ka(s,e,"source"),Ka(s,e,"target")),n){var Y=e.pstyle("ghost").value==="yes";if(Y){var _=e.pstyle("ghost-offset-x").pfValue,W=e.pstyle("ghost-offset-y").pfValue;Rt(s,s.x1+_,s.y1+W,s.x2+_,s.y2+W)}}var te=o.bodyBounds=o.bodyBounds||{};gs(te,s),nn(te,y),an(te,1),n&&(f=s.x1,c=s.x2,h=s.y1,v=s.y2,Rt(s,f-x,h-x,c+x,v+x));var ae=o.overlayBounds=o.overlayBounds||{};gs(ae,s),nn(ae,y),an(ae,1);var se=o.labelBounds=o.labelBounds||{};se.all!=null?Fc(se.all):se.all=yt(),n&&r.includeLabels&&(r.includeMainLabels&&jn(s,e,null),u&&(r.includeSourceLabels&&jn(s,e,"source"),r.includeTargetLabels&&jn(s,e,"target")))}return s.x1=Dt(s.x1),s.y1=Dt(s.y1),s.x2=Dt(s.x2),s.y2=Dt(s.y2),s.w=Dt(s.x2-s.x1),s.h=Dt(s.y2-s.y1),s.w>0&&s.h>0&&m&&(nn(s,y),an(s,1)),s},Tl=function(e){var r=0,a=function(s){return(s?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},Cl=function(e){if(e.isEdge()){var r=e.source().position(),a=e.target().position(),n=function(s){return Math.round(s)};return nc([n(r.x),n(r.y),n(a.x),n(a.y)])}else return 0},Fs=function(e,r){var a=e._private,n,i=e.isEdge(),s=r==null?Gs:Tl(r),o=s===Gs,l=Cl(e),u=a.bbCachePosKey===l,f=r.useCache&&u,c=function(g){return g._private.bbCache==null||g._private.styleDirty},h=!f||c(e)||i&&(c(e.source())||c(e.target()));if(h?(u||e.recalculateRenderedStyle(f),n=mg(e,La),a.bbCache=n,a.bbCachePosKey=l):n=a.bbCache,!o){var v=e.isNode();n=yt(),(r.includeNodes&&v||r.includeEdges&&!v)&&(r.includeOverlays?pr(n,a.overlayBounds):pr(n,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?pr(n,a.labelBounds.all):(r.includeMainLabels&&pr(n,a.labelBounds.mainRot),r.includeSourceLabels&&pr(n,a.labelBounds.sourceRot),r.includeTargetLabels&&pr(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},La={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Gs=Tl(La),zs=et(La);vr.boundingBox=function(t){var e;if(this.length===1&&this[0]._private.bbCache!=null&&!this[0]._private.styleDirty&&(t===void 0||t.useCache===void 0||t.useCache===!0))t===void 0?t=La:t=zs(t),e=Fs(this[0],t);else{e=yt(),t=t||La;var r=zs(t),a=this,n=a.cy(),i=n.styleEnabled();if(i)for(var s=0;s<a.length;s++){var o=a[s],l=o._private,u=Cl(o),f=l.bbCachePosKey===u,c=r.useCache&&f&&!l.styleDirty;o.recalculateRenderedStyle(c)}this.updateCompoundBounds(!t.useCache);for(var h=0;h<a.length;h++){var v=a[h];pr(e,Fs(v,r))}}return e.x1=Dt(e.x1),e.y1=Dt(e.y1),e.x2=Dt(e.x2),e.y2=Dt(e.y2),e.w=Dt(e.x2-e.x1),e.h=Dt(e.y2-e.y1),e};vr.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};vr.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),n=r.collection();if(a&&(n=e.filter(function(u){return u.isParent()}),e=e.not(n)),Ae(t)){var i=t;t=function(){return i}}var s=function(f,c){return f._private.bbAtOldPos=t(f,c)},o=function(f){return f._private.bbAtOldPos};r.startBatch(),e.forEach(s).silentPositions(t),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var l=Bc(this.boundingBox({useCache:!1}));return e.silentPositions(o),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),r.endBatch(),l};Vr.boundingbox=Vr.bb=Vr.boundingBox;Vr.renderedBoundingbox=Vr.renderedBoundingBox;var bg=vr,da,Ba;da=Ba={};var Dl=function(e){e.uppercaseName=ls(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=ls(e.outerName),da[e.name]=function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var o=a.pstyle(e.name);switch(o.strValue){case"label":return a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return o.pfValue}}else return 1},da["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){var o=a[e.name](),l=a.pstyle("border-width").pfValue,u=2*a.padding();return o+l+u}else return 1},da["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},da["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};Dl({name:"width"});Dl({name:"height"});Ba.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};Ba.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};Ba.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var wg=Ba,Eg=function(e,r){if(e.isEdge())return r(e)},xg=function(e,r){if(e.isEdge()){var a=e.cy();return In(r(e),a.zoom(),a.pan())}},Tg=function(e,r){if(e.isEdge()){var a=e.cy(),n=a.pan(),i=a.zoom();return r(e).map(function(s){return In(s,i,n)})}},Cg=function(e){return e.renderer().getControlPoints(e)},Dg=function(e){return e.renderer().getSegmentPoints(e)},Sg=function(e){return e.renderer().getSourceEndpoint(e)},Ag=function(e){return e.renderer().getTargetEndpoint(e)},Lg=function(e){return e.renderer().getEdgeMidpoint(e)},_s={controlPoints:{get:Cg,mult:!0},segmentPoints:{get:Dg,mult:!0},sourceEndpoint:{get:Sg},targetEndpoint:{get:Ag},midpoint:{get:Lg}},Rg=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},Ig=Object.keys(_s).reduce(function(t,e){var r=_s[e],a=Rg(e);return t[e]=function(){return Eg(this,r.get)},r.mult?t[a]=function(){return Tg(this,r.get)}:t[a]=function(){return xg(this,r.get)},t},{}),Og=he({},pg,bg,wg,Ig);/*!
9
+ Event object based on jQuery events, MIT license
10
+
11
+ https://jquery.org/license/
12
+ https://tldrlegal.com/license/mit-license
13
+ https://github.com/jquery/jquery/blob/master/src/event.js
14
+ */var Sl=function(e,r){this.recycle(e,r)};function oa(){return!1}function Za(){return!0}Sl.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=oa,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Za:oa):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:oa,isPropagationStopped:oa,isImmediatePropagationStopped:oa};var Al=/^([^.]+)(\.(?:[^.]+))?$/,Pg=".*",Ll={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},Vs=Object.keys(Ll),Mg={};function Bn(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Mg,e=arguments.length>1?arguments[1]:void 0,r=0;r<Vs.length;r++){var a=Vs[r];this[a]=t[a]||Ll[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var lr=Bn.prototype,Rl=function(e,r,a,n,i,s,o){Ve(n)&&(i=n,n=null),o&&(s==null?s=o:s=he({},s,o));for(var l=Ne(a)?a:a.split(/\s+/),u=0;u<l.length;u++){var f=l[u];if(!ar(f)){var c=f.match(Al);if(c){var h=c[1],v=c[2]?c[2]:null,d=r(e,f,h,v,n,i,s);if(d===!1)break}}}},Us=function(e,r){return e.addEventFields(e.context,r),new Sl(r.type,r)},Ng=function(e,r,a){if(ef(a)){r(e,a);return}else if(Ae(a)){r(e,Us(e,a));return}for(var n=Ne(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var s=n[i];if(!ar(s)){var o=s.match(Al);if(o){var l=o[1],u=o[2]?o[2]:null,f=Us(e,{type:l,namespace:u,target:e.context});r(e,f)}}}};lr.on=lr.addListener=function(t,e,r,a,n){return Rl(this,function(i,s,o,l,u,f,c){Ve(f)&&i.listeners.push({event:s,callback:f,type:o,namespace:l,qualifier:u,conf:c})},t,e,r,a,n),this};lr.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})};lr.removeListener=lr.off=function(t,e,r,a){var n=this;this.emitting!==0&&(this.listeners=uc(this.listeners));for(var i=this.listeners,s=function(u){var f=i[u];Rl(n,function(c,h,v,d,g,p){if((f.type===v||t==="*")&&(!d&&f.namespace!==".*"||f.namespace===d)&&(!g||c.qualifierCompare(f.qualifier,g))&&(!p||f.callback===p))return i.splice(u,1),!1},t,e,r,a)},o=i.length-1;o>=0;o--)s(o);return this};lr.removeAllListeners=function(){return this.removeListener("*")};lr.emit=lr.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,Ne(e)||(e=[e]),Ng(this,function(i,s){r!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],n=a.length);for(var o=function(f){var c=a[f];if(c.type===s.type&&(!c.namespace||c.namespace===s.namespace||c.namespace===Pg)&&i.eventMatches(i.context,c,s)){var h=[s];e!=null&&cc(h,e),i.beforeEmit(i.context,c,s),c.conf&&c.conf.one&&(i.listeners=i.listeners.filter(function(g){return g!==c}));var v=i.callbackContext(i.context,c,s),d=c.callback.apply(v,h);i.afterEmit(i.context,c,s),d===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l<n;l++)o(l);i.bubble(i.context)&&!s.isPropagationStopped()&&i.parent(i.context).emit(s,e)},t),this.emitting--,this};var kg={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 ce(e)?new sr(e):e},Il={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new Bn(kg,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++){var s=this[i];s.emitter().on(e,n,a)}return this},removeListener:function(e,r,a){for(var n=Qa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var n=Qa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().one(e,n,a)}return this},once:function(e,r,a){for(var n=Qa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var n=this[a];n.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}};Re.eventAliasesOn(Il);var Ol={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(ce(e)||xt(e))return new sr(e).filter(this);if(Ve(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var s=n[i],o=r?e.apply(r,[s,i,n]):e(s,i,n);o&&a.push(s)}return a}return this.spawn()},not:function(e){if(e){ce(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||r.push(n)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(ce(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),n=this,i=e,s=this.length<e.length,o=s?n:i,l=s?i:n,u=0;u<o.length;u++){var f=o[u];l.has(f)&&a.push(f)}return a},xor:function(e){var r=this._private.cy;ce(e)&&(e=r.$(e));var a=this.spawn(),n=this,i=e,s=function(l,u){for(var f=0;f<l.length;f++){var c=l[f],h=c._private.data.id,v=u.hasElementWithId(h);v||a.push(c)}};return s(n,i),s(i,n),a},diff:function(e){var r=this._private.cy;ce(e)&&(e=r.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),s=this,o=e,l=function(f,c,h){for(var v=0;v<f.length;v++){var d=f[v],g=d._private.data.id,p=c.hasElementWithId(g);p?i.merge(d):h.push(d)}};return l(s,o,a),l(o,s,n),{left:a,right:n,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(ce(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var s=e[i],o=!this.has(s);o&&n.push(s)}return n},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&ce(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=r.map,s=0;s<e.length;s++){var o=e[s],l=o._private.data.id,u=!i.has(l);if(u){var f=this.length++;this[f]=o,i.set(l,{ele:o,index:f})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var s=e===this.length-1;if(this.length>1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,i=n.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&ce(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 s=n[i],o=r?e.apply(r,[s,i,n]):e(s,i,n);a.push(o)}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,s=0;s<i.length;s++){var o=i[s],l=r?e.apply(r,[o,s,i]):e(o,s,i);l>a&&(a=l,n=o)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],l=r?e.apply(r,[o,s,i]):e(o,s,i);l<a&&(a=l,n=o)}return{value:a,ele:n}}},Le=Ol;Le.u=Le["|"]=Le["+"]=Le.union=Le.or=Le.add;Le["\\"]=Le["!"]=Le["-"]=Le.difference=Le.relativeComplement=Le.subtract=Le.not;Le.n=Le["&"]=Le["."]=Le.and=Le.intersection=Le.intersect;Le["^"]=Le["(+)"]=Le["(-)"]=Le.symmetricDifference=Le.symdiff=Le.xor;Le.fnFilter=Le.filterFn=Le.stdFilter=Le.filter;Le.complement=Le.abscomp=Le.absoluteComplement;var Bg={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}},Pl=function(e,r){var a=e.cy(),n=a.hasCompoundNodes();function i(f){var c=f.pstyle("z-compound-depth");return c.value==="auto"?n?f.zDepth():0:c.value==="bottom"?-1:c.value==="top"?Mi:0}var s=i(e)-i(r);if(s!==0)return s;function o(f){var c=f.pstyle("z-index-compare");return c.value==="auto"&&f.isNode()?1:0}var l=o(e)-o(r);if(l!==0)return l;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(Ve(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],s=r?e.apply(r,[i,n,this]):e(i,n,this);if(s===!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(!Ve(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(Pl)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var n=r.data.parent?e.parents().size():0;return e.isParent()?n:Mi-1}else{var i=r.source,s=r.target,o=i.zDepth(),l=s.zDepth();return Math.max(o,l,0)}}}};En.each=En.forEach;var Fg=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":qe(Symbol))!=e&&qe(Symbol.iterator)!=e;r&&(En[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return Lo({next:function(){return i<s?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};Fg();var Gg=et({nodeDimensionsIncludeLabels:!1}),on={layoutDimensions:function(e){e=Gg(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(C){return!C.isParent()}),i=this.cy(),s=r.eles,o=function(D){return D.id()},l=wa(a,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(D,w,x){var E={x:w.x1+w.w/2,y:w.y1+w.h/2},S={x:(x.x-E.x)*D,y:(x.y-E.y)*D};return{x:E.x+S.x,y:E.y+S.y}},f=r.spacingFactor&&r.spacingFactor!==1,c=function(){if(!f)return null;for(var D=yt(),w=0;w<n.length;w++){var x=n[w],E=l(x,w);zc(D,E.x,E.y)}return D},h=c(),v=wa(function(C,D){var w=l(C,D);if(f){var x=Math.abs(r.spacingFactor);w=u(x,h,w)}return r.transform!=null&&(w=r.transform(C,w)),w},o);if(r.animate){for(var d=0;d<n.length;d++){var g=n[d],p=v(g,d),y=r.animateFilter==null||r.animateFilter(g,d);if(y){var b=g.animation({position:p,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else g.position(p)}if(r.fit){var m=i.animation({fit:{boundingBox:s.boundingBoxAt(v),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(m)}else if(r.zoom!==void 0&&r.pan!==void 0){var T=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(T)}e.animations.forEach(function(C){return C.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),Wr.all(e.animations.map(function(C){return C.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(v),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){var r=this.cy();return r.makeLayout(he({},e,{eles:this}))}};on.createLayout=on.makeLayout=on.layout;function Ml(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 Fn(t,e){return t=nr(t),function(a){return Ml(t,e,a)}}function Gn(t,e){t=nr(t);var r=function(n){return e.call(n)};return function(){var n=this[0];if(n)return Ml(t,r,n)}}var rt={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;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()){var a=r._private.batchStyleEles;return a.merge(this),this}var n=r.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=i;return e?s.emitAndNotify("style"):s.emit("style"),i.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(Ae(e)){var s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(ce(e))if(r===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?i.getRawStyle(l):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 s=0;s<i.length;s++){var o=i[s];n.removeAllBypasses(o,a)}else{e=e.split(/\s+/);for(var l=0;l<i.length;l++){var u=i[l];n.removeBypasses(u,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 s=n.data.parent?a.parents():null;if(s)for(var o=0;o<s.length;o++){var l=s[o],u=l.pstyle("opacity").value;i=u*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function ei(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function Hi(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],s=n.hasCompoundNodes();if(i){var o=i._private;if(!e(i))return!1;if(i.isNode())return!s||ei(i,a);var l=o.source,u=o.target;return r(l)&&(!s||ei(l,r))&&(l===u||r(u)&&(!s||ei(u,r)))}}}var Qr=Fn("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});rt.takesUpSpace=Gn("takesUpSpace",Hi({ok:Qr}));var zg=Fn("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Qr(t)}),_g=Fn("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Qr(t)});rt.interactive=Gn("interactive",Hi({ok:zg,parentOk:_g,edgeOkViaNode:Qr}));rt.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var Vg=Fn("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Qr(t)}),Ug=Qr;rt.visible=Gn("visible",Hi({ok:Vg,edgeOkViaNode:Ug}));rt.hidden=function(){var t=this[0];if(t)return!t.visible()};rt.isBundledBezier=Gn("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});rt.bypass=rt.css=rt.style;rt.renderedCss=rt.renderedStyle;rt.removeBypass=rt.removeCss=rt.removeStyle;rt.pstyle=rt.parsedStyle;var rr={};function Ys(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&&Ve(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&Ne(e[0])){for(var s=e.length===1?e[0]:null,o=0;o<this.length;o++){var l=this[o],u=!t.ableField||l._private[t.ableField],f=l._private[t.field]!=t.value;if(t.overrideAble){var c=t.overrideAble(l);if(c!==void 0&&(u=c,!c))return this}u&&(l._private[t.field]=t.value,f&&r.push(l))}var h=this.spawn(r);h.updateStyle(),h.emit(t.event),s&&h.emit(s)}return this}}function Jr(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]=Ys({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),rr[t.off]=Ys({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}Jr({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Jr({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Jr({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Jr({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};Jr({field:"active",on:"activate",off:"unactivate"});Jr({field:"pannable",on:"panify",off:"unpanify"});rr.inactive=function(){var t=this[0];if(t)return!t._private.active};var ot={},$s=function(e){return function(a){for(var n=this,i=[],s=0;s<n.length;s++){var o=n[s];if(o.isNode()){for(var l=!1,u=o.connectedEdges(),f=0;f<u.length;f++){var c=u[f],h=c.source(),v=c.target();if(e.noIncomingEdges&&v===o&&h!==o||e.noOutgoingEdges&&h===o&&v!==o){l=!0;break}}l||i.push(o)}}return this.spawn(i,!0).filter(a)}},Hs=function(e){return function(r){for(var a=this,n=[],i=0;i<a.length;i++){var s=a[i];if(s.isNode())for(var o=s.connectedEdges(),l=0;l<o.length;l++){var u=o[l],f=u.source(),c=u.target();e.outgoing&&f===s?(n.push(u),n.push(c)):e.incoming&&c===s&&(n.push(u),n.push(f))}}return this.spawn(n,!0).filter(r)}},Xs=function(e){return function(r){for(var a=this,n=[],i={};;){var s=e.outgoing?a.outgoers():a.incomers();if(s.length===0)break;for(var o=!1,l=0;l<s.length;l++){var u=s[l],f=u.id();i[f]||(i[f]=!0,n.push(u),o=!0)}if(!o)break;a=s}return this.spawn(n,!0).filter(r)}};ot.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};he(ot,{roots:$s({noIncomingEdges:!0}),leaves:$s({noOutgoingEdges:!0}),outgoers:St(Hs({outgoing:!0}),"outgoers"),successors:Xs({outgoing:!0}),incomers:St(Hs({incoming:!0}),"incomers"),predecessors:Xs({incoming:!0})});he(ot,{neighborhood:St(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var n=r[a],i=n.connectedEdges(),s=0;s<i.length;s++){var o=i[s],l=o.source(),u=o.target(),f=n===l?u:l;f.length>0&&e.push(f[0]),e.push(o[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)}});ot.neighbourhood=ot.neighborhood;ot.closedNeighbourhood=ot.closedNeighborhood;ot.openNeighbourhood=ot.openNeighborhood;he(ot,{source:St(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:St(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:Ws({attr:"source"}),targets:Ws({attr:"target"})});function Ws(t){return function(r){for(var a=[],n=0;n<this.length;n++){var i=this[n],s=i._private[t.attr];s&&a.push(s)}return this.spawn(a,!0).filter(r)}}he(ot,{edgesWith:St(qs(),"edgesWith"),edgesTo:St(qs({thisIsSrc:!0}),"edgesTo")});function qs(t){return function(r){var a=[],n=this._private.cy,i=t||{};ce(r)&&(r=n.$(r));for(var s=0;s<r.length;s++)for(var o=r[s]._private.edges,l=0;l<o.length;l++){var u=o[l],f=u._private.data,c=this.hasElementWithId(f.source)&&r.hasElementWithId(f.target),h=r.hasElementWithId(f.source)&&this.hasElementWithId(f.target),v=c||h;v&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!c||i.thisIsTgt&&!h)||a.push(u))}return this.spawn(a,!0)}}he(ot,{connectedEdges:St(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,s=0;s<i.length;s++){var o=i[s];e.push(o)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:St(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:St(Ks(),"parallelEdges"),codirectedEdges:St(Ks({codirected:!0}),"codirectedEdges")});function Ks(t){var e={codirected:!1};return t=he({},e,t),function(a){for(var n=[],i=this.edges(),s=t,o=0;o<i.length;o++)for(var l=i[o],u=l._private,f=u.source,c=f._private.data.id,h=u.data.target,v=f._private.edges,d=0;d<v.length;d++){var g=v[d],p=g._private.data,y=p.target,b=p.source,m=y===h&&b===c,T=c===y&&h===b;(s.codirected&&m||!s.codirected&&(m||T))&&n.push(g)}return this.spawn(n,!0).filter(a)}}he(ot,{components:function(e){var r=this,a=r.cy(),n=a.collection(),i=e==null?r.nodes():e.nodes(),s=[];e!=null&&i.empty()&&(i=e.sources());var o=function(f,c){n.merge(f),i.unmerge(f),c.merge(f)};if(i.empty())return r.spawn();var l=function(){var f=a.collection();s.push(f);var c=i[0];o(c,f),r.bfs({directed:!1,roots:c,visit:function(v){return o(v,f)}}),f.forEach(function(h){h.connectedEdges().forEach(function(v){r.has(v)&&f.has(v.source())&&f.has(v.target())&&f.merge(v)})})};do l();while(i.length>0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});ot.componentsOf=ot.components;var at=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){_e("A collection must have a reference to the core");return}var i=new zt,s=!1;if(!r)r=[];else if(r.length>0&&Ae(r[0])&&!Pa(r[0])){s=!0;for(var o=[],l=new Xr,u=0,f=r.length;u<f;u++){var c=r[u];c.data==null&&(c.data={});var h=c.data;if(h.id==null)h.id=Xo();else if(e.hasElementWithId(h.id)||l.has(h.id))continue;var v=new Rn(e,c,!1);o.push(v),l.add(h.id)}r=o}this.length=0;for(var d=0,g=r.length;d<g;d++){var p=r[d][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 zt,T=this.eles,C=0;C<T.length;C++){var D=T[C];m.set(D.id(),{index:C,ele:D})}}},a&&(this._private.map=i),s&&!n&&this.restore()},Fe=Rn.prototype=at.prototype=Object.create(Array.prototype);Fe.instanceString=function(){return"collection"};Fe.spawn=function(t,e){return new at(this.cy(),t,e)};Fe.spawnSelf=function(){return this.spawn(this)};Fe.cy=function(){return this._private.cy};Fe.renderer=function(){return this._private.cy.renderer()};Fe.element=function(){return this[0]};Fe.collection=function(){return Oo(this)?this:new at(this._private.cy,[this])};Fe.unique=function(){return new at(this._private.cy,this,!0)};Fe.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};Fe.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new at(e)};Fe.$id=Fe.getElementById;Fe.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};Fe.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};Fe.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};Fe.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(Ae(t)){if(r.startBatch(),t.data){e.data(t.data);var n=a.data;if(e.isEdge()){var i=!1,s={},o=t.data.source,l=t.data.target;o!=null&&o!=n.source&&(s.source=""+o,i=!0),l!=null&&l!=n.target&&(s.target=""+l,i=!0),i&&(e=e.move(s))}else{var u="parent"in t.data,f=t.data.parent;u&&(f!=null||n.parent!=null)&&f!=n.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}t.position&&e.position(t.position);var c=function(g,p,y){var b=t[g];b!=null&&b!==a[g]&&(b?e[p]():e[y]())};return c("removed","remove","restore"),c("selected","select","unselect"),c("selectable","selectify","unselectify"),c("locked","lock","unlock"),c("grabbable","grabify","ungrabify"),c("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var h={data:Gt(a.data),position:Gt(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};h.classes="";var v=0;return a.classes.forEach(function(d){return h.classes+=v++===0?d:" "+d}),h}}};Fe.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t};Fe.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],n=a.json(),i=new Rn(t,n,!1);e.push(i)}return new at(t,e)};Fe.copy=Fe.clone;Fe.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=[],s=[],o,l=0,u=r.length;l<u;l++){var f=r[l];e&&!f.removed()||(f.isNode()?i.push(f):s.push(f))}o=i.concat(s);var c,h=function(){o.splice(c,1),c--};for(c=0;c<o.length;c++){var v=o[c],d=v._private,g=d.data;if(v.clearTraversalCache(),!(!e&&!d.removed)){if(g.id===void 0)g.id=Xo();else if(re(g.id))g.id=""+g.id;else if(ar(g.id)||!ce(g.id)){_e("Can not create element with invalid string ID `"+g.id+"`"),h();continue}else if(a.hasElementWithId(g.id)){_e("Can not create second element with ID `"+g.id+"`"),h();continue}}var p=g.id;if(v.isNode()){var y=d.position;y.x==null&&(y.x=0),y.y==null&&(y.y=0)}if(v.isEdge()){for(var b=v,m=["source","target"],T=m.length,C=!1,D=0;D<T;D++){var w=m[D],x=g[w];re(x)&&(x=g[w]=""+g[w]),x==null||x===""?(_e("Can not create edge `"+p+"` with unspecified "+w),C=!0):a.hasElementWithId(x)||(_e("Can not create edge `"+p+"` with nonexistant "+w+" `"+x+"`"),C=!0)}if(C){h();continue}var E=a.getElementById(g.source),S=a.getElementById(g.target);E.same(S)?E._private.edges.push(b):(E._private.edges.push(b),S._private.edges.push(b)),b._private.source=E,b._private.target=S}d.map=new zt,d.map.set(p,{ele:v,index:0}),d.removed=!1,e&&a.addToPool(v)}for(var A=0;A<i.length;A++){var L=i[A],I=L._private.data;re(I.parent)&&(I.parent=""+I.parent);var R=I.parent,P=R!=null;if(P||L._private.parent){var M=L._private.parent?a.collection().merge(L._private.parent):a.getElementById(R);if(M.empty())I.parent=void 0;else if(M[0].removed())Ie("Node added with missing parent, reference to parent removed"),I.parent=void 0,L._private.parent=null;else{for(var k=!1,N=M;!N.empty();){if(L.same(N)){k=!0,I.parent=void 0;break}N=N.parent()}k||(M[0]._private.children.push(L),L._private.parent=M[0],n.hasCompoundNodes=!0)}}}if(o.length>0){for(var B=o.length===r.length?r:new at(a,o),z=0;z<B.length;z++){var F=B[z];F.isNode()||(F.parallelEdges().clearTraversalCache(),F.source().clearTraversalCache(),F.target().clearTraversalCache())}var G;n.hasCompoundNodes?G=a.collection().merge(B).merge(B.connectedNodes()).merge(B.parent()):G=B,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?B.emitAndNotify("add"):e&&B.emit("add")}return r};Fe.removed=function(){var t=this[0];return t&&t._private.removed};Fe.inside=function(){var t=this[0];return t&&!t._private.removed};Fe.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 s(R){for(var P=R._private.edges,M=0;M<P.length;M++)l(P[M])}function o(R){for(var P=R._private.children,M=0;M<P.length;M++)l(P[M])}function l(R){var P=n[R.id()];e&&R.removed()||P||(n[R.id()]=!0,R.isNode()?(a.push(R),s(R),o(R)):a.unshift(R))}for(var u=0,f=r.length;u<f;u++){var c=r[u];l(c)}function h(R,P){var M=R._private.edges;ir(M,P),R.clearTraversalCache()}function v(R){R.clearTraversalCache()}var d=[];d.ids={};function g(R,P){P=P[0],R=R[0];var M=R._private.children,k=R.id();ir(M,P),P._private.parent=null,d.ids[k]||(d.ids[k]=!0,d.push(R))}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];h(b,y),h(m,y);for(var T=y.parallelEdges(),C=0;C<T.length;C++){var D=T[C];v(D),D.isBundledBezier()&&D.dirtyBoundingBoxCache()}}else{var w=y.parent();w.length!==0&&g(w,y)}e&&(y._private.removed=!0)}var x=i._private.elements;i._private.hasCompoundNodes=!1;for(var E=0;E<x.length;E++){var S=x[E];if(S.isParent()){i._private.hasCompoundNodes=!0;break}}var A=new at(this.cy(),a);A.size()>0&&(t?A.emitAndNotify("remove"):e&&A.emit("remove"));for(var L=0;L<d.length;L++){var I=d[L];(!e||!I.removed())&&I.updateStyle()}return A};Fe.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 s=i(t.source),o=i(t.target),l=s!=null&&e.hasElementWithId(s),u=o!=null&&e.hasElementWithId(o);(l||u)&&(e.batch(function(){r.remove(a,n),r.emitAndNotify("moveout");for(var v=0;v<r.length;v++){var d=r[v],g=d._private.data;d.isEdge()&&(l&&(g.source=s),u&&(g.target=o))}r.restore(a,n)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var f=i(t.parent),c=f===null||e.hasElementWithId(f);if(c){var h=f===null?void 0:f;e.batch(function(){var v=r.remove(a,n);v.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var g=r[d],p=g._private.data;g.isNode()&&(p.parent=h)}v.restore(a,n)}),r.emitAndNotify("move")}}return this};[il,jd,sn,tr,Hr,gg,kn,Og,Il,Ol,Bg,En,on,rt,rr,ot].forEach(function(t){he(Fe,t)});var Yg={add:function(e){var r,a=this;if(xt(e)){var n=e;if(n._private.cy===a)r=n.restore();else{for(var i=[],s=0;s<n.length;s++){var o=n[s];i.push(o.json())}r=new at(a,i)}}else if(Ne(e)){var l=e;r=new at(a,l)}else if(Ae(e)&&(Ne(e.nodes)||Ne(e.edges))){for(var u=e,f=[],c=["nodes","edges"],h=0,v=c.length;h<v;h++){var d=c[h],g=u[d];if(Ne(g))for(var p=0,y=g.length;p<y;p++){var b=he({group:d},g[p]);f.push(b)}}r=new at(a,f)}else{var m=e;r=new Rn(a,m).collection()}return r},remove:function(e){if(!xt(e)){if(ce(e)){var r=e;e=this.$(r)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function $g(t,e,r,a){var n=4,i=.001,s=1e-7,o=10,l=11,u=1/(l-1),f=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var c=0;c<4;++c)if(typeof arguments[c]!="number"||isNaN(arguments[c])||!isFinite(arguments[c]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var h=f?new Float32Array(l):new Array(l);function v(S,A){return 1-3*A+3*S}function d(S,A){return 3*A-6*S}function g(S){return 3*S}function p(S,A,L){return((v(A,L)*S+d(A,L))*S+g(A))*S}function y(S,A,L){return 3*v(A,L)*S*S+2*d(A,L)*S+g(A)}function b(S,A){for(var L=0;L<n;++L){var I=y(A,t,r);if(I===0)return A;var R=p(A,t,r)-S;A-=R/I}return A}function m(){for(var S=0;S<l;++S)h[S]=p(S*u,t,r)}function T(S,A,L){var I,R,P=0;do R=A+(L-A)/2,I=p(R,t,r)-S,I>0?L=R:A=R;while(Math.abs(I)>s&&++P<o);return R}function C(S){for(var A=0,L=1,I=l-1;L!==I&&h[L]<=S;++L)A+=u;--L;var R=(S-h[L])/(h[L+1]-h[L]),P=A+R*u,M=y(P,t,r);return M>=i?b(S,P):M===0?P:T(S,A,A+u)}var D=!1;function w(){D=!0,(t!==e||r!==a)&&m()}var x=function(A){return D||w(),t===e&&r===a?A:A===0?0:A===1?1:p(C(A),e,a)};x.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var E="generateBezier("+[t,e,r,a]+")";return x.toString=function(){return E},x}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Hg=function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:t(s)}}function r(a,n){var i={dx:a.v,dv:t(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),l=e(a,n,o),u=1/6*(i.dx+2*(s.dx+o.dx)+l.dx),f=1/6*(i.dv+2*(s.dv+o.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+f*n,a}return function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,f=1/1e4,c=16/1e3,h,v,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,h=s!==null,h?(u=a(n,i),v=u/s*c):v=c;d=r(d||o,v),l.push(1+d.x),u+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return h?function(g){return l[g*(l.length-1)|0]}:u}}(),Be=function(e,r,a,n){var i=$g(e,r,a,n);return function(s,o,l){return s+(o-s)*i(l)}},ln={linear:function(e,r,a){return e+(r-e)*a},ease:Be(.25,.1,.25,1),"ease-in":Be(.42,0,1,1),"ease-out":Be(0,0,.58,1),"ease-in-out":Be(.42,0,.58,1),"ease-in-sine":Be(.47,0,.745,.715),"ease-out-sine":Be(.39,.575,.565,1),"ease-in-out-sine":Be(.445,.05,.55,.95),"ease-in-quad":Be(.55,.085,.68,.53),"ease-out-quad":Be(.25,.46,.45,.94),"ease-in-out-quad":Be(.455,.03,.515,.955),"ease-in-cubic":Be(.55,.055,.675,.19),"ease-out-cubic":Be(.215,.61,.355,1),"ease-in-out-cubic":Be(.645,.045,.355,1),"ease-in-quart":Be(.895,.03,.685,.22),"ease-out-quart":Be(.165,.84,.44,1),"ease-in-out-quart":Be(.77,0,.175,1),"ease-in-quint":Be(.755,.05,.855,.06),"ease-out-quint":Be(.23,1,.32,1),"ease-in-out-quint":Be(.86,0,.07,1),"ease-in-expo":Be(.95,.05,.795,.035),"ease-out-expo":Be(.19,1,.22,1),"ease-in-out-expo":Be(1,0,0,1),"ease-in-circ":Be(.6,.04,.98,.335),"ease-out-circ":Be(.075,.82,.165,1),"ease-in-out-circ":Be(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return ln.linear;var n=Hg(e,r,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":Be};function Zs(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 Qs(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Or(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var s=Qs(t,n),o=Qs(e,n);if(re(s)&&re(o))return Zs(i,s,o,r,a);if(Ne(s)&&Ne(o)){for(var l=[],u=0;u<o.length;u++){var f=s[u],c=o[u];if(f!=null&&c!=null){var h=Zs(i,f,c,r,a);l.push(h)}else l.push(c)}return l}}function Xg(t,e,r,a){var n=!a,i=t._private,s=e._private,o=s.easing,l=s.startTime,u=a?t:t.cy(),f=u.style();if(!s.easingImpl)if(o==null)s.easingImpl=ln.linear;else{var c;if(ce(o)){var h=f.parse("transition-timing-function",o);c=h.value}else c=o;var v,d;ce(c)?(v=c,d=[]):(v=c[1],d=c.slice(2).map(function(B){return+B})),d.length>0?(v==="spring"&&d.push(s.duration),s.easingImpl=ln[v].apply(null,d)):s.easingImpl=ln[v]}var g=s.easingImpl,p;if(s.duration===0?p=1:p=(r-l)/s.duration,s.applying&&(p=s.progress),p<0?p=0:p>1&&(p=1),s.delay==null){var y=s.startPosition,b=s.position;if(b&&n&&!t.locked()){var m={};la(y.x,b.x)&&(m.x=Or(y.x,b.x,p,g)),la(y.y,b.y)&&(m.y=Or(y.y,b.y,p,g)),t.position(m)}var T=s.startPan,C=s.pan,D=i.pan,w=C!=null&&a;w&&(la(T.x,C.x)&&(D.x=Or(T.x,C.x,p,g)),la(T.y,C.y)&&(D.y=Or(T.y,C.y,p,g)),t.emit("pan"));var x=s.startZoom,E=s.zoom,S=E!=null&&a;S&&(la(x,E)&&(i.zoom=Ca(i.minZoom,Or(x,E,p,g),i.maxZoom)),t.emit("zoom")),(w||S)&&t.emit("viewport");var A=s.style;if(A&&A.length>0&&n){for(var L=0;L<A.length;L++){var I=A[L],R=I.name,P=I,M=s.startStyle[R],k=f.properties[M.name],N=Or(M,P,p,g,k);f.overrideBypass(t,R,N)}t.emit("style")}}return s.progress=p,p}function la(t,e){return t==null||e==null?!1:re(t)&&re(e)?!0:!!(t&&e)}function Wg(t,e,r,a){var n=e._private;n.started=!0,n.startTime=r-n.progress*n.duration}function Js(t,e){var r=e._private.aniEles,a=[];function n(f,c){var h=f._private,v=h.animation.current,d=h.animation.queue,g=!1;if(v.length===0){var p=d.shift();p&&v.push(p)}for(var y=function(D){for(var w=D.length-1;w>=0;w--){var x=D[w];x()}D.splice(0,D.length)},b=v.length-1;b>=0;b--){var m=v[b],T=m._private;if(T.stopped){v.splice(b,1),T.hooked=!1,T.playing=!1,T.started=!1,y(T.frames);continue}!T.playing&&!T.applying||(T.playing&&T.applying&&(T.applying=!1),T.started||Wg(f,m,t),Xg(f,m,t,c),T.applying&&(T.applying=!1),y(T.frames),T.step!=null&&T.step(t),m.completed()&&(v.splice(b,1),T.hooked=!1,T.playing=!1,T.started=!1,y(T.completes)),g=!0)}return!c&&v.length===0&&d.length===0&&a.push(f),g}for(var i=!1,s=0;s<r.length;s++){var o=r[s],l=n(o);i=i||l}var u=n(e,!0);(i||u)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var qg={animate:Re.animate(),animation:Re.animation(),animated:Re.animated(),clearQueue:Re.clearQueue(),delay:Re.delay(),delayAnimation:Re.delayAnimation(),stop:Re.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){Js(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){Js(s,e)},a.beforeRenderPriorities.animations):r()}},Kg={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 ce(e)?new sr(e):e},Nl={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Bn(Kg,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}};Re.eventAliasesOn(Nl);var yi={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)}};yi.jpeg=yi.jpg;var un={layout:function(e){var r=this;if(e==null){_e("Layout options must be specified to make a layout");return}if(e.name==null){_e("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){_e("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;ce(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var s=new n(he({},e,{cy:r,eles:i}));return s}};un.createLayout=un.makeLayout=un.layout;var Zg={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],s=e[i],o=r.getElementById(i);o.data(s)}})}},Qg=et({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:12,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),mi={renderTo:function(e,r,a,n){var i=this._private.renderer;return i.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){_e("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=Qg(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)}};mi.invalidateDimensions=mi.resize;var fn={collection:function(e,r){return ce(e)?this.$(e):xt(e)?e.collection():Ne(e)?(r||(r={}),new at(this,e,r.unique,r.removed)):new at(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}};fn.elements=fn.filter=fn.$;var ut={},pa="t",Jg="f";ut.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i<t.length;i++){var s=t[i],o=e.getContextMeta(s);if(!o.empty){var l=e.getContextStyle(o),u=e.applyContextStyle(o,l,s);s._private.appliedInitStyle?e.updateTransitions(s,u.diffProps):s._private.appliedInitStyle=!0;var f=e.updateStyleHints(s);f&&n.push(s)}}return n};ut.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 s=[],o={},l=0;l<r.length;l++){var u=r[l],f=t[l]===pa,c=e[l]===pa,h=f!==c,v=u.mappedProperties.length>0;if(h||c&&v){var d=void 0;h&&v||h?d=u.properties:v&&(d=u.mappedProperties);for(var g=0;g<d.length;g++){for(var p=d[g],y=p.name,b=!1,m=l+1;m<r.length;m++){var T=r[m],C=e[m]===pa;if(C&&(b=T.properties[p.name]!=null,b))break}!o[y]&&!b&&(o[y]=!0,s.push(y))}}}return a[n]=s,s};ut.getContextMeta=function(t){for(var e=this,r="",a,n=t._private.styleCxtKey||"",i=0;i<e.length;i++){var s=e[i],o=s.selector&&s.selector.matches(t);o?r+=pa:r+=Jg}return a=e.getPropertiesDiff(n,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}};ut.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 s=r[i],o=e[i]===pa;if(o)for(var l=0;l<s.properties.length;l++){var u=s.properties[l];n[u.name]=u}}return a[e]=n,n};ut.applyContextStyle=function(t,e,r){for(var a=this,n=t.diffPropNames,i={},s=a.types,o=0;o<n.length;o++){var l=n[o],u=e[l],f=r.pstyle(l);if(!u)if(f)f.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(f!==u){if(u.mapped===s.fn&&f!=null&&f.mapping!=null&&f.mapping.value===u.value){var c=f.mapping,h=c.fnValue=u.value(r);if(h===c.prevFnValue)continue}var v=i[l]={prev:f};a.applyParsedProperty(r,u),v.next=r.pstyle(l),v.next&&v.next.bypass&&(v.next=v.next.bypassed)}}return{diffProps:i}};ut.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,n=r.propertyGroupKeys,i=function(W,te,ae){return r.getPropertiesHash(W,te,ae)},s=e.styleKey;if(t.removed())return!1;var o=e.group==="nodes",l=t._private.style;a=Object.keys(l);for(var u=0;u<n.length;u++){var f=n[u];e.styleKeys[f]=[kr,va]}for(var c=function(W,te){return e.styleKeys[te][0]=Ea(W,e.styleKeys[te][0])},h=function(W,te){return e.styleKeys[te][1]=xa(W,e.styleKeys[te][1])},v=function(W,te){c(W,te),h(W,te)},d=function(W,te){for(var ae=0;ae<W.length;ae++){var se=W.charCodeAt(ae);c(se,te),h(se,te)}},g=2e9,p=function(W){return-128<W&&W<128&&Math.floor(W)!==W?g-(W*1024|0):W},y=0;y<a.length;y++){var b=a[y],m=l[b];if(m!=null){var T=this.properties[b],C=T.type,D=T.groupKey,w=void 0;T.hashOverride!=null?w=T.hashOverride(t,m):m.pfValue!=null&&(w=m.pfValue);var x=T.enums==null?m.value:null,E=w!=null,S=x!=null,A=E||S,L=m.units;if(C.number&&A&&!C.multiple){var I=E?w:x;v(p(I),D),!E&&L!=null&&d(L,D)}else d(m.strValue,D)}}for(var R=[kr,va],P=0;P<n.length;P++){var M=n[P],k=e.styleKeys[M];R[0]=Ea(k[0],R[0]),R[1]=xa(k[1],R[1])}e.styleKey=ac(R[0],R[1]);var N=e.styleKeys;e.labelDimsKey=Qt(N.labelDimensions);var B=i(t,["label"],N.labelDimensions);if(e.labelKey=Qt(B),e.labelStyleKey=Qt(Ya(N.commonLabel,B)),!o){var z=i(t,["source-label"],N.labelDimensions);e.sourceLabelKey=Qt(z),e.sourceLabelStyleKey=Qt(Ya(N.commonLabel,z));var F=i(t,["target-label"],N.labelDimensions);e.targetLabelKey=Qt(F),e.targetLabelStyleKey=Qt(Ya(N.commonLabel,F))}if(o){var G=e.styleKeys,H=G.nodeBody,X=G.nodeBorder,K=G.nodeOutline,q=G.backgroundImage,J=G.compound,j=G.pie,Y=[H,X,K,q,J,j].filter(function(_){return _!=null}).reduce(Ya,[kr,va]);e.nodeKey=Qt(Y),e.hasPie=j!=null&&j[0]!==kr&&j[1]!==va}return s!==e.styleKey};ut.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};ut.applyParsedProperty=function(t,e){var r=this,a=e,n=t._private.style,i,s=r.types,o=r.properties[a.name].type,l=a.bypass,u=n[a.name],f=u&&u.bypass,c=t._private,h="mapping",v=function(H){return H==null?null:H.pfValue!=null?H.pfValue:H.value},d=function(){var H=v(u),X=v(a);r.checkTriggers(t,a.name,H,X)};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",l)),a.delete)return n[a.name]=void 0,d(),!0;if(a.deleteBypassed)return u?u.bypass?(u.bypassed=void 0,d(),!0):!1:(d(),!0);if(a.deleteBypass)return u?u.bypass?(n[a.name]=u.bypassed,d(),!0):!1:(d(),!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 s.mapData:{for(var p=a.field.split("."),y=c.data,b=0;b<p.length&&y;b++){var m=p[b];y=y[m]}if(y==null)return g(),!1;var T;if(re(y)){var C=a.fieldMax-a.fieldMin;C===0?T=0:T=(y-a.fieldMin)/C}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(T<0?T=0:T>1&&(T=1),o.color){var D=a.valueMin[0],w=a.valueMax[0],x=a.valueMin[1],E=a.valueMax[1],S=a.valueMin[2],A=a.valueMax[2],L=a.valueMin[3]==null?1:a.valueMin[3],I=a.valueMax[3]==null?1:a.valueMax[3],R=[Math.round(D+(w-D)*T),Math.round(x+(E-x)*T),Math.round(S+(A-S)*T),Math.round(L+(I-L)*T)];i={bypass:a.bypass,name:a.name,value:R,strValue:"rgb("+R[0]+", "+R[1]+", "+R[2]+")"}}else if(o.number){var P=a.valueMin+(a.valueMax-a.valueMin)*T;i=this.parse(a.name,P,a.bypass,h)}else return!1;if(!i)return g(),!1;i.mapping=a,a=i;break}case s.data:{for(var M=a.field.split("."),k=c.data,N=0;N<M.length&&k;N++){var B=M[N];k=k[B]}if(k!=null&&(i=this.parse(a.name,k,a.bypass,h)),!i)return g(),!1;i.mapping=a,a=i;break}case s.fn:{var z=a.value,F=a.fnValue!=null?a.fnValue:z(t);if(a.prevFnValue=F,F==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,F,a.bypass,h),!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=Gt(a),a=i;break}case void 0:break;default:return!1}return l?(f?a.bypassed=u.bypassed:a.bypassed=u,n[a.name]=a):f?u.bypassed=a:n[a.name]=a,d(),!0};ut.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),s=0;s<i.length;s++){var o=i[s],l=n[o];l!=null&&(l.bypass?l.bypassed=null:n[o]=null)}}};ut.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};ut.updateTransitions=function(t,e){var r=this,a=t._private,n=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,s=t.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var o={},l=!1,u=0;u<n.length;u++){var f=n[u],c=t.pstyle(f),h=e[f];if(h){var v=h.prev,d=v,g=h.next!=null?h.next:c,p=!1,y=void 0,b=1e-6;d&&(re(d.pfValue)&&re(g.pfValue)?(p=g.pfValue-d.pfValue,y=d.pfValue+b*p):re(d.value)&&re(g.value)?(p=g.value-d.value,y=d.value+b*p):Ne(d.value)&&Ne(g.value)&&(p=d.value[0]!==g.value[0]||d.value[1]!==g.value[1]||d.value[2]!==g.value[2],y=d.strValue),p&&(o[f]=g.strValue,this.applyBypass(t,f,y),l=!0))}}if(!l)return;a.transitioning=!0,new Wr(function(m){s>0?t.delayAnimation(s).play().promise().then(m):m()}).then(function(){return t.animation({style:o,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)};ut.checkTrigger=function(t,e,r,a,n,i){var s=this.properties[e],o=n(s);o!=null&&o(r,a)&&i(s)};ut.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)})};ut.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(r==="bezier"||a==="bezier")&&t.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()}),n.triggersBoundsOfConnectedEdges&&e==="display"&&(r==="none"||a==="none")&&t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ut.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a)};var Fa={};Fa.applyBypass=function(t,e,r,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var o=0;o<n.properties.length;o++){var l=n.properties[o],u=l.name,f=this.parse(u,r,!0);f&&i.push(f)}}else if(ce(e)){var c=this.parse(e,r,!0);c&&i.push(c)}else if(Ae(e)){var h=e;a=r;for(var v=Object.keys(h),d=0;d<v.length;d++){var g=v[d],p=h[g];if(p===void 0&&(p=h[An(g)]),p!==void 0){var y=this.parse(g,p,!0);y&&i.push(y)}}}else return!1;if(i.length===0)return!1;for(var b=!1,m=0;m<t.length;m++){for(var T=t[m],C={},D=void 0,w=0;w<i.length;w++){var x=i[w];if(a){var E=T.pstyle(x.name);D=C[x.name]={prev:E}}b=this.applyParsedProperty(T,Gt(x))||b,a&&(D.next=T.pstyle(x.name))}b&&this.updateStyleHints(T),a&&this.updateTransitions(T,C,s)}return b};Fa.overrideBypass=function(t,e,r){e=Pi(e);for(var a=0;a<t.length;a++){var n=t[a],i=n._private.style[e],s=this.properties[e].type,o=s.color,l=s.mutiple,u=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),o?i.strValue="rgb("+r.join(",")+")":l?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(n)),this.checkTriggers(n,e,u,r)}};Fa.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Fa.removeBypasses=function(t,e,r){for(var a=!0,n=0;n<t.length;n++){for(var i=t[n],s={},o=0;o<e.length;o++){var l=e[o],u=this.properties[l],f=i.pstyle(u.name);if(!(!f||!f.bypass)){var c="",h=this.parse(l,c,!0),v=s[u.name]={prev:f};this.applyParsedProperty(i,h),v.next=i.pstyle(u.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,s,a)}};var Xi={};Xi.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};Xi.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 _t={};_t.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};_t.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],s=r.getStylePropertyValue(t,i.name,e);s!=null&&(a[i.name]=s,a[An(i.name)]=s)}return a}};_t.getIndexedStyle=function(t,e,r,a){var n=t.pstyle(e)[r][a];return n??t.cy().style().getDefaultProperty(e)[r][0]};_t.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,s=t.pstyle(n.name);if(s){var o=s.value,l=s.units,u=s.strValue;if(r&&i.number&&o!=null&&re(o)){var f=t.cy().zoom(),c=function(p){return p*f},h=function(p,y){return c(p)+y},v=Ne(o),d=v?l.every(function(g){return g!=null}):l!=null;return d?v?o.map(function(g,p){return h(g,l[p])}).join(" "):h(o,l):v?o.map(function(g){return ce(g)?g:""+c(g)}).join(" "):""+c(o)}else if(u!=null)return u}return null}};_t.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var n=e[a],i=n.name,s=t.pstyle(i);s!==void 0&&(Ae(s)?s=this.parse(i,s.strValue):s=this.parse(i,s)),s&&(r[i]=s)}return r};_t.getPropsList=function(t){var e=this,r=[],a=t,n=e.properties;if(a)for(var i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],l=a[o],u=n[o]||n[Pi(o)],f=this.parse(u.name,l);f&&r.push(f)}return r};_t.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),n,i,s,o,l,u;for(l=0;l<e.length;l++)if(n=e[l],i=t.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=Ea(o,a[0]),a[1]=xa(o,a[1]);else for(s=i.strValue,u=0;u<s.length;u++)o=s.charCodeAt(u),a[0]=Ea(o,a[0]),a[1]=xa(o,a[1]);return a};_t.getPropertiesHash=_t.getNonDefaultPropertiesHash;var zn={};zn.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,s=Object.keys(i);e.selector(n);for(var o=0;o<s.length;o++){var l=s[o],u=i[l];e.css(l,u)}}return e};zn.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};zn.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,n=r.properties,i={},s=0;s<n.length;s++){var o=n[s];i[o.name]=o.strValue}t.push({selector:a?a.toString():"core",style:i})}return t};var Wi={};Wi.appendFromString=function(t){var e=this,r=this,a=""+t,n,i,s;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){a.length>n.length?a=a.substr(n.length):a=""}function l(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Ie("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var c=f[1];if(c!=="core"){var h=new sr(c);if(h.invalid){Ie("Skipping parsing of block: Invalid selector found in string stylesheet: "+c),o();continue}}var v=f[2],d=!1;i=v;for(var g=[];;){var p=i.match(/^\s*$/);if(p)break;var y=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!y){Ie("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+v),d=!0;break}s=y[0];var b=y[1],m=y[2],T=e.properties[b];if(!T){Ie("Skipping property: Invalid property name in: "+s),l();continue}var C=r.parse(b,m);if(!C){Ie("Skipping property: Invalid property definition in: "+s),l();continue}g.push({name:b,val:m}),l()}if(d){o();break}r.selector(c);for(var D=0;D<g.length;D++){var w=g[D];r.css(w.name,w.val)}o()}return r};Wi.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var tt={};(function(){var t=We,e=of,r=uf,a=ff,n=cf,i=function(Y){return"^"+Y+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(Y){var _=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+n;return"^"+Y+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+_+")\\s*\\,\\s*("+_+")\\)$"},o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];tt.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"]},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},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"]},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","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},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:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,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(Y,_){switch(Y.length){case 2:return _[0]!=="deg"&&_[0]!=="rad"&&_[1]!=="deg"&&_[1]!=="rad";case 1:return ce(Y[0])||_[0]==="deg"||_[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(Y){var _=Y.length;return _===1||_===2||_===4}}};var l={zeroNonZero:function(Y,_){return(Y==null||_==null)&&Y!==_||Y==0&&_!=0?!0:Y!=0&&_==0},any:function(Y,_){return Y!=_},emptyNonEmpty:function(Y,_){var W=ar(Y),te=ar(_);return W&&!te||!W&&te}},u=tt.types,f=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],c=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],h=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],v=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],d=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification}],g=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any}],p=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],y=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],b=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],m=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],T=function(Y,_){return _.value==="label"?-Y.poolIndex():_.pfValue},C=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:T},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:T},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],D=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],w=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],x=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],E=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],S=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-outline-width",type:u.size},{name:"line-outline-color",type:u.color},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],A=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],L=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],I=[];tt.pieBackgroundN=16,I.push({name:"pie-size",type:u.sizeMaybePercent});for(var R=1;R<=tt.pieBackgroundN;R++)I.push({name:"pie-"+R+"-background-color",type:u.color}),I.push({name:"pie-"+R+"-background-size",type:u.percent}),I.push({name:"pie-"+R+"-background-opacity",type:u.zeroOneNumber});var P=[],M=tt.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach(function(j){M.forEach(function(Y){var _=Y+"-"+j.name,W=j.type,te=j.triggersBounds;P.push({name:_,type:W,triggersBounds:te})})},{});var k=tt.properties=[].concat(g,m,p,y,b,A,d,v,f,c,h,C,D,w,x,I,E,S,P,L),N=tt.propertyGroups={behavior:g,transition:m,visibility:p,overlay:y,underlay:b,ghost:A,commonLabel:d,labelDimensions:v,mainLabel:f,sourceLabel:c,targetLabel:h,nodeBody:C,nodeBorder:D,nodeOutline:w,backgroundImage:x,pie:I,compound:E,edgeLine:S,edgeArrow:P,core:L},B=tt.propertyGroupNames={},z=tt.propertyGroupKeys=Object.keys(N);z.forEach(function(j){B[j]=N[j].map(function(Y){return Y.name}),N[j].forEach(function(Y){return Y.groupKey=j})});var F=tt.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"}];tt.propertyNames=k.map(function(j){return j.name});for(var G=0;G<k.length;G++){var H=k[G];k[H.name]=H}for(var X=0;X<F.length;X++){var K=F[X],q=k[K.pointsTo],J={name:K.name,alias:!0,pointsTo:q};k.push(J),k[K.name]=J}})();tt.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};tt.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=he({"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","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","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","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%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(l,u){for(var f=1;f<=tt.pieBackgroundN;f++){var c=u.name.replace("{{i}}",f),h=u.value;l[c]=h}return l},{}),{"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(l,u){return tt.arrowPrefixes.forEach(function(f){var c=f+"-"+u.name,h=u.value;l[c]=h}),l},{})),r={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,s=e[i],o=this.parse(i,s);r[i]=o}}return t.defaultProperties=r,t.defaultProperties};tt.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 _n={};_n.parse=function(t,e,r,a){var n=this;if(Ve(e))return n.parseImplWarn(t,e,r,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,s=r?"t":"f",o=""+e,l=Yo(t,o,s,i),u=n.propCache=n.propCache||[],f;return(f=u[l])||(f=u[l]=n.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(f=Gt(f),f&&(f.value=Gt(f.value))),f};_n.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};_n.parseImpl=function(t,e,r,a){var n=this;t=Pi(t);var i=n.properties[t],s=e,o=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var l=ce(e);l&&(e=e.trim());var u=i.type;if(!u)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(Ve(e))return{name:t,value:e,strValue:"fn",mapped:o.fn,bypass:r};var f,c;if(!(!l||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(o.data.regex).exec(e))){if(r)return!1;var h=o.data;return{name:t,value:f,strValue:""+e,mapped:h,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(c=new RegExp(o.mapData.regex).exec(e))){if(r||u.multiple)return!1;var v=o.mapData;if(!(u.color||u.number))return!1;var d=this.parse(t,c[4]);if(!d||d.mapped)return!1;var g=this.parse(t,c[5]);if(!g||g.mapped)return!1;if(d.pfValue===g.pfValue||d.strValue===g.strValue)return Ie("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+d.strValue+"`"),this.parse(t,d.strValue);if(u.color){var p=d.value,y=g.value,b=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));if(b)return!1}return{name:t,value:c,strValue:""+e,mapped:v,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:d.value,valueMax:g.value,bypass:r}}}if(u.multiple&&a!=="multiple"){var m;if(l?m=e.split(/\s+/):Ne(e)?m=e:m=[e],u.evenMultiple&&m.length%2!==0)return null;for(var T=[],C=[],D=[],w="",x=!1,E=0;E<m.length;E++){var S=n.parse(t,m[E],r,"multiple");x=x||ce(S.value),T.push(S.value),D.push(S.pfValue!=null?S.pfValue:S.value),C.push(S.units),w+=(E>0?" ":"")+S.strValue}return u.validate&&!u.validate(T,C)?null:u.singleEnum&&x?T.length===1&&ce(T[0])?{name:t,value:T[0],strValue:T[0],bypass:r}:null:{name:t,value:T,pfValue:D,strValue:w,bypass:r,units:C}}var A=function(){for(var Y=0;Y<u.enums.length;Y++){var _=u.enums[Y];if(_===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(u.number){var L,I="px";if(u.units&&(L=u.units),u.implicitUnits&&(I=u.implicitUnits),!u.unitless)if(l){var R="px|em"+(u.allowPercent?"|\\%":"");L&&(R=L);var P=e.match("^("+We+")("+R+")?$");P&&(e=P[1],L=P[2]||I)}else(!L||u.implicitUnits)&&(L=I);if(e=parseFloat(e),isNaN(e)&&u.enums===void 0)return null;if(isNaN(e)&&u.enums!==void 0)return e=s,A();if(u.integer&&!ju(e)||u.min!==void 0&&(e<u.min||u.strictMin&&e===u.min)||u.max!==void 0&&(e>u.max||u.strictMax&&e===u.max))return null;var M={name:t,value:e,strValue:""+e+(L||""),units:L,bypass:r};return u.unitless||L!=="px"&&L!=="em"?M.pfValue=e:M.pfValue=L==="px"||!L?e:this.getEmSizeInPixels()*e,(L==="ms"||L==="s")&&(M.pfValue=L==="ms"?e:1e3*e),(L==="deg"||L==="rad")&&(M.pfValue=L==="rad"?e:Mc(e)),L==="%"&&(M.pfValue=e/100),M}else if(u.propList){var k=[],N=""+e;if(N!=="none"){for(var B=N.split(/\s*,\s*|\s+/),z=0;z<B.length;z++){var F=B[z].trim();n.properties[F]?k.push(F):Ie("`"+F+"` is not a valid property name")}if(k.length===0)return null}return{name:t,value:k,strValue:k.length===0?"none":k.join(" "),bypass:r}}else if(u.color){var G=ko(e);return G?{name:t,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:r}:null}else if(u.regex||u.regexes){if(u.enums){var H=A();if(H)return H}for(var X=u.regexes?u.regexes:[u.regex],K=0;K<X.length;K++){var q=new RegExp(X[K]),J=q.exec(e);if(J)return{name:t,value:u.singleRegexMatchValue?J[1]:J,strValue:""+e,bypass:r}}return null}else return u.string?{name:t,value:""+e,strValue:""+e,bypass:r}:u.enums?A():null};var st=function t(e){if(!(this instanceof t))return new t(e);if(!Oi(e)){_e("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},lt=st.prototype;lt.instanceString=function(){return"style"};lt.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};lt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};lt.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};lt.selector=function(t){var e=t==="core"?null:new sr(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};lt.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};lt.style=lt.css;lt.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.mapped&&this[a].mappedProperties.push(r);var n=!this[a].selector;n&&(this._private.coreStyle[r.name]=r)}return this};lt.append=function(t){return Po(t)?t.appendToStyle(this):Ne(t)?this.appendFromJson(t):ce(t)&&this.appendFromString(t),this};st.fromJson=function(t,e){var r=new st(t);return r.fromJson(e),r};st.fromString=function(t,e){return new st(t).fromString(e)};[ut,Fa,Xi,_t,zn,Wi,tt,_n].forEach(function(t){he(lt,t)});st.types=lt.types;st.properties=lt.properties;st.propertyGroups=lt.propertyGroups;st.propertyGroupNames=lt.propertyGroupNames;st.propertyGroupKeys=lt.propertyGroupKeys;var jg={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return Po(e)?r.style=e.generateStyle(this):Ne(e)?r.style=st.fromJson(this,e):ce(e)?r.style=st.fromString(this,e):r.style=st(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},ep="single",Cr={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=ep),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,s,o;switch(e.length){case 0:return r;case 1:if(ce(e[0]))return a=e[0],r[a];if(Ae(e[0])){if(!this._private.panningEnabled)return this;i=e[0],s=i.x,o=i.y,re(s)&&(r.x=s),re(o)&&(r.y=o),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,s,o,l,u;if(!this._private.panningEnabled)return this;switch(a.length){case 1:Ae(e)&&(o=a[0],l=o.x,u=o.y,re(l)&&(n.x+=l),re(u)&&(n.y+=u),this.emit("pan viewport"));break;case 2:i=e,s=r,(i==="x"||i==="y")&&re(s)&&(n[i]+=s),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(ce(e)){var n=e;e=this.$(n)}else if(rf(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 xt(e)||(e=this.mutableElements());if(!(xt(e)&&e.empty())){a=a||e.boundingBox();var s=this.width(),o=this.height(),l;if(r=re(r)?r:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((s-2*r)/a.w,(o-2*r)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l<this._private.minZoom?this._private.minZoom:l;var u={x:(s-l*(a.x1+a.x2))/2,y:(o-l*(a.y1+a.y2))/2};return{zoom:l,pan:u}}}}},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,s,o=!1;if(r.zoomingEnabled||(o=!0),re(e)?s=e:Ae(e)&&(s=e.level,e.position!=null?i=In(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=s<r.minZoom?r.minZoom:s,o||!re(s)||s===n||i!=null&&(!re(i.x)||!re(i.y)))return null;if(i!=null){var l=a,u=n,f=s,c={x:-f/u*(i.x-l.x)+i.x,y:-f/u*(i.y-l.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:c}}else return{zoomed:!0,panned:!1,zoom:s,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=[],s=!1,o=!1;if(!e)return this;if(re(e.zoom)||(a=!1),Ae(e.pan)||(n=!1),!a&&!n)return this;if(a){var l=e.zoom;l<r.minZoom||l>r.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=l,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&r.panningEnabled){var u=e.pan;re(u.x)&&(r.pan.x=u.x,o=!1),re(u.y)&&(r.pan.y=u.y,o=!1),o||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(ce(e)){var a=e;e=this.mutableElements().filter(a)}else xt(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(i-r*(n.x1+n.x2))/2,y:(s-r*(n.y1+n.y2))/2};return o}}},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(o){return parseFloat(n.getPropertyValue(o))};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}};Cr.centre=Cr.center;Cr.autolockNodes=Cr.autolock;Cr.autoungrabifyNodes=Cr.autoungrabify;var Ra={data:Re.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Re.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Re.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Re.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ra.attr=Ra.data;Ra.removeAttr=Ra.removeData;var Ia=function(e){var r=this;e=he({},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 s=He!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=he({name:s?"grid":"null"},o.layout),o.renderer=he({name:s?"canvas":"null"},o.renderer);var l=function(d,g,p){return g!==void 0?g:p!==void 0?p:d},u=this._private={container:a,ready:!1,options:o,elements:new at(this),listeners:[],aniEles:new at(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:re(o.zoom)?o.zoom:1,pan:{x:Ae(o.pan)&&re(o.pan.x)?o.pan.x:0,y:Ae(o.pan)&&re(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var f=function(d,g){var p=d.some(af);if(p)return Wr.all(d).then(g);g(d)};u.styleEnabled&&r.setStyle([]);var c=he({},o,o.renderer);r.initRenderer(c);var h=function(d,g,p){r.notifications(!1);var y=r.mutableElements();y.length>0&&y.remove(),d!=null&&(Ae(d)||Ne(d))&&r.add(d),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=he({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()};f([o.style,o.elements],function(v){var d=v[0],g=v[1];u.styleEnabled&&r.style().append(d),h(g,function(){r.startAnimationLoop(),u.ready=!0,Ve(o.ready)&&r.on("ready",o.ready);for(var p=0;p<i.length;p++){var y=i[p];r.on("ready",y)}n&&(n.readies=[]),r.emit("ready")},o.done)})},xn=Ia.prototype;he(xn,{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(){var e=this._private.container;if(e==null)return He;var r=this._private.container.ownerDocument;return r===void 0||r==null?He:r.defaultView||He},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(he({},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 Gt(this._private.options)},json:function(e){var r=this,a=r._private,n=r.mutableElements(),i=function(T){return r.getElementById(T.id())};if(Ae(e)){if(r.startBatch(),e.elements){var s={},o=function(T,C){for(var D=[],w=[],x=0;x<T.length;x++){var E=T[x];if(!E.data.id){Ie("cy.json() cannot handle elements without an ID attribute");continue}var S=""+E.data.id,A=r.getElementById(S);s[S]=!0,A.length!==0?w.push({ele:A,json:E}):(C&&(E.group=C),D.push(E))}r.add(D);for(var L=0;L<w.length;L++){var I=w[L],R=I.ele,P=I.json;R.json(P)}};if(Ne(e.elements))o(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var f=l[u],c=e.elements[f];Ne(c)&&o(c,f)}var h=r.collection();n.filter(function(m){return!s[m.id()]}).forEach(function(m){m.isParent()?h.merge(m):m.remove()}),h.forEach(function(m){return m.children().move({parent:null})}),h.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 v=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<v.length;d++){var g=v[d];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 T=m.group();y.elements[T]||(y.elements[T]=[]),y.elements[T].push(m.json())})),this._private.styleEnabled&&(y.style=r.style().json()),y.data=Gt(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=Gt(a.pan),y.boxSelectionEnabled=a.boxSelectionEnabled,y.renderer=Gt(b.renderer),y.hideEdgesOnViewport=b.hideEdgesOnViewport,y.textureOnViewport=b.textureOnViewport,y.wheelSensitivity=b.wheelSensitivity,y.motionBlur=b.motionBlur,y.multiClickDebounceTime=b.multiClickDebounceTime,y}}});xn.$id=xn.getElementById;[Yg,qg,Nl,yi,un,Zg,mi,fn,jg,Cr,Ra].forEach(function(t){he(xn,t)});var tp={fit:!0,directed:!1,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}},rp={maximal:!1,acyclic:!1},Pr=function(e){return e.scratch("breadthfirst")},js=function(e,r){return e.scratch("breadthfirst",r)};function kl(t){this.options=he({},tp,rp,t)}kl.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=r.nodes().filter(function(ue){return ue.isChildless()}),n=r,i=t.directed,s=t.acyclic||t.maximal||t.maximalAdjustments>0,o=!!t.boundingBox,l=e.extent(),u=yt(o?t.boundingBox:{x1:l.x1,y1:l.y1,w:l.w,h:l.h}),f;if(xt(t.roots))f=t.roots;else if(Ne(t.roots)){for(var c=[],h=0;h<t.roots.length;h++){var v=t.roots[h],d=e.getElementById(v);c.push(d)}f=e.collection(c)}else if(ce(t.roots))f=e.$(t.roots);else if(i)f=a.roots();else{var g=r.components();f=e.collection();for(var p=function(le){var pe=g[le],ye=pe.maxDegree(!1),de=pe.filter(function(me){return me.degree(!1)===ye});f=f.add(de)},y=0;y<g.length;y++)p(y)}var b=[],m={},T=function(le,pe){b[pe]==null&&(b[pe]=[]);var ye=b[pe].length;b[pe].push(le),js(le,{index:ye,depth:pe})},C=function(le,pe){var ye=Pr(le),de=ye.depth,me=ye.index;b[de][me]=null,le.isChildless()&&T(le,pe)};n.bfs({roots:f,directed:t.directed,visit:function(le,pe,ye,de,me){var xe=le[0],De=xe.id();xe.isChildless()&&T(xe,me),m[De]=!0}});for(var D=[],w=0;w<a.length;w++){var x=a[w];m[x.id()]||D.push(x)}var E=function(le){for(var pe=b[le],ye=0;ye<pe.length;ye++){var de=pe[ye];if(de==null){pe.splice(ye,1),ye--;continue}js(de,{depth:le,index:ye})}},S=function(le,pe){for(var ye=Pr(le),de=le.incomers().filter(function(Z){return Z.isNode()&&r.has(Z)}),me=-1,xe=le.id(),De=0;De<de.length;De++){var ee=de[De],O=Pr(ee);me=Math.max(me,O.depth)}if(ye.depth<=me){if(!t.acyclic&&pe[xe])return null;var V=me+1;return C(le,V),pe[xe]=V,!0}return!1};if(i&&s){var A=[],L={},I=function(le){return A.push(le)},R=function(){return A.shift()};for(a.forEach(function(ue){return A.push(ue)});A.length>0;){var P=R(),M=S(P,L);if(M)P.outgoers().filter(function(ue){return ue.isNode()&&r.has(ue)}).forEach(I);else if(M===null){Ie("Detected double maximal shift for node `"+P.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var k=0;if(t.avoidOverlap)for(var N=0;N<a.length;N++){var B=a[N],z=B.layoutDimensions(t),F=z.w,G=z.h;k=Math.max(k,F,G)}var H={},X=function(le){if(H[le.id()])return H[le.id()];for(var pe=Pr(le).depth,ye=le.neighborhood(),de=0,me=0,xe=0;xe<ye.length;xe++){var De=ye[xe];if(!(De.isEdge()||De.isParent()||!a.has(De))){var ee=Pr(De);if(ee!=null){var O=ee.index,V=ee.depth;if(!(O==null||V==null)){var Z=b[V].length;V<pe&&(de+=O/Z,me++)}}}}return me=Math.max(1,me),de=de/me,me===0&&(de=0),H[le.id()]=de,de},K=function(le,pe){var ye=X(le),de=X(pe),me=ye-de;return me===0?No(le.id(),pe.id()):me};t.depthSort!==void 0&&(K=t.depthSort);for(var q=b.length,J=0;J<q;J++)b[J].sort(K),E(J);for(var j=[],Y=0;Y<D.length;Y++)j.push(D[Y]);var _=function(){for(var le=0;le<q;le++)E(le)};j.length&&(b.unshift(j),q=b.length,_());for(var W=0,te=0;te<q;te++)W=Math.max(b[te].length,W);var ae={x:u.x1+u.w/2,y:u.y1+u.h/2},se=a.reduce(function(ue,le){return function(pe){return{w:ue.w===-1?pe.w:(ue.w+pe.w)/2,h:ue.h===-1?pe.h:(ue.h+pe.h)/2}}(le.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),Ce=Math.max(q===1?0:o?(u.h-t.padding*2-se.h)/(q-1):(u.h-t.padding*2-se.h)/(q+1),k),Oe=b.reduce(function(ue,le){return Math.max(ue,le.length)},0),Pe=function(le){var pe=Pr(le),ye=pe.depth,de=pe.index;if(t.circle){var me=Math.min(u.w/2/q,u.h/2/q);me=Math.max(me,k);var xe=me*ye+me-(q>0&&b[0].length<=3?me/2:0),De=2*Math.PI/b[ye].length*de;return ye===0&&b[0].length===1&&(xe=1),{x:ae.x+xe*Math.cos(De),y:ae.y+xe*Math.sin(De)}}else{var ee=b[ye].length,O=Math.max(ee===1?0:o?(u.w-t.padding*2-se.w)/((t.grid?Oe:ee)-1):(u.w-t.padding*2-se.w)/((t.grid?Oe:ee)+1),k),V={x:ae.x+(de+1-(ee+1)/2)*O,y:ae.y+(ye+1-(q+1)/2)*Ce};return V}};return r.nodes().layoutPositions(this,t,Pe),this};var ap={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 Bl(t){this.options=he({},ap,t)}Bl.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 s=yt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),f,c=0,h=0;h<i.length;h++){var v=i[h],d=v.layoutDimensions(e),g=d.w,p=d.h;c=Math.max(c,g,p)}if(re(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(s.h,s.w)/2-c,i.length>1&&e.avoidOverlap){c*=1.75;var y=Math.cos(u)-Math.cos(0),b=Math.sin(u)-Math.sin(0),m=Math.sqrt(c*c/(y*y+b*b));f=Math.max(m,f)}var T=function(D,w){var x=e.startAngle+w*u*(n?1:-1),E=f*Math.cos(x),S=f*Math.sin(x),A={x:o.x+E,y:o.y+S};return A};return a.nodes().layoutPositions(this,e,T),this};var np={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 Fl(t){this.options=he({},np,t)}Fl.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"),s=yt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,f=0;f<i.length;f++){var c=i[f],h=void 0;h=e.concentric(c),l.push({value:h,node:c}),c._private.scratch.concentric=h}i.updateStyle();for(var v=0;v<i.length;v++){var d=i[v],g=d.layoutDimensions(e);u=Math.max(u,g.w,g.h)}l.sort(function(se,Ce){return Ce.value-se.value});for(var p=e.levelWidth(i),y=[[]],b=y[0],m=0;m<l.length;m++){var T=l[m];if(b.length>0){var C=Math.abs(b[0].value-T.value);C>=p&&(b=[],y.push(b))}b.push(T)}var D=u+e.minNodeSpacing;if(!e.avoidOverlap){var w=y.length>0&&y[0].length>1,x=Math.min(s.w,s.h)/2-D,E=x/(y.length+w?1:0);D=Math.min(D,E)}for(var S=0,A=0;A<y.length;A++){var L=y[A],I=e.sweep===void 0?2*Math.PI-2*Math.PI/L.length:e.sweep,R=L.dTheta=I/Math.max(1,L.length-1);if(L.length>1&&e.avoidOverlap){var P=Math.cos(R)-Math.cos(0),M=Math.sin(R)-Math.sin(0),k=Math.sqrt(D*D/(P*P+M*M));S=Math.max(k,S)}L.r=S,S+=D}if(e.equidistant){for(var N=0,B=0,z=0;z<y.length;z++){var F=y[z],G=F.r-B;N=Math.max(N,G)}B=0;for(var H=0;H<y.length;H++){var X=y[H];H===0&&(B=X.r),X.r=B,B+=N}}for(var K={},q=0;q<y.length;q++)for(var J=y[q],j=J.dTheta,Y=J.r,_=0;_<J.length;_++){var W=J[_],te=e.startAngle+(r?1:-1)*j*_,ae={x:o.x+Y*Math.cos(te),y:o.y+Y*Math.sin(te)};K[W.node.id()]=ae}return n.nodes().layoutPositions(this,e,function(se){var Ce=se.id();return K[Ce]}),this};var ti,ip={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 Vn(t){this.options=he({},ip,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),a=r.filter(function(n){var i=n.source().data("id"),s=n.target().data("id"),o=e.some(function(u){return u.data("id")===i}),l=e.some(function(u){return u.data("id")===s});return!o||!l});this.options.eles=this.options.eles.not(a)}Vn.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?ti=!0:ti=!1;var a=sp(e,r,t);ti&&up(a),t.randomize&&fp(a);var n=Xt(),i=function(){cp(a,e,t),t.fit===!0&&e.fit(t.padding)},s=function(h){return!(r.stopped||h>=t.numIter||(vp(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},o=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var h=t.eles.nodes(),v=Gl(a,t,h);h.layoutPositions(r,t,v)}},l=0,u=!0;if(t.animate===!0){var f=function c(){for(var h=0;u&&h<t.refresh;)u=s(l),l++,h++;if(!u)to(a,t),o();else{var v=Xt();v-n>=t.animationThreshold&&i(),pn(c)}};f()}else{for(;u;)u=s(l),l++;to(a,t),o()}return this};Vn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Vn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var sp=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s=yt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=a.eles.components(),u={},f=0;f<l.length;f++)for(var c=l[f],h=0;h<c.length;h++){var v=c[h];u[v.id()]=f}for(var f=0;f<o.nodeSize;f++){var d=i[f],g=d.layoutDimensions(a),p={};p.isLocked=d.locked(),p.id=d.data("id"),p.parentId=d.data("parent"),p.cmptId=u[d.id()],p.children=[],p.positionX=d.position("x"),p.positionY=d.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(d.style("padding")),p.padRight=parseFloat(d.style("padding")),p.padTop=parseFloat(d.style("padding")),p.padBottom=parseFloat(d.style("padding")),p.nodeRepulsion=Ve(a.nodeRepulsion)?a.nodeRepulsion(d):a.nodeRepulsion,o.layoutNodes.push(p),o.idToIndex[p.id]=f}for(var y=[],b=0,m=-1,T=[],f=0;f<o.nodeSize;f++){var d=o.layoutNodes[f],C=d.parentId;C!=null?o.layoutNodes[o.idToIndex[C]].children.push(d.id):(y[++m]=d.id,T.push(d.id))}for(o.graphSet.push(T);b<=m;){var D=y[b++],w=o.idToIndex[D],v=o.layoutNodes[w],x=v.children;if(x.length>0){o.graphSet.push(x);for(var f=0;f<x.length;f++)y[++m]=x[f]}}for(var f=0;f<o.graphSet.length;f++)for(var E=o.graphSet[f],h=0;h<E.length;h++){var S=o.idToIndex[E[h]];o.indexToGraph[S]=f}for(var f=0;f<o.edgeSize;f++){var A=n[f],L={};L.id=A.data("id"),L.sourceId=A.data("source"),L.targetId=A.data("target");var I=Ve(a.idealEdgeLength)?a.idealEdgeLength(A):a.idealEdgeLength,R=Ve(a.edgeElasticity)?a.edgeElasticity(A):a.edgeElasticity,P=o.idToIndex[L.sourceId],M=o.idToIndex[L.targetId],k=o.indexToGraph[P],N=o.indexToGraph[M];if(k!=N){for(var B=op(L.sourceId,L.targetId,o),z=o.graphSet[B],F=0,p=o.layoutNodes[P];z.indexOf(p.id)===-1;)p=o.layoutNodes[o.idToIndex[p.parentId]],F++;for(p=o.layoutNodes[M];z.indexOf(p.id)===-1;)p=o.layoutNodes[o.idToIndex[p.parentId]],F++;I*=F*a.nestingFactor}L.idealLength=I,L.elasticity=R,o.layoutEdges.push(L)}return o},op=function(e,r,a){var n=lp(e,r,0,a);return 2>n.count?0:n.graph},lp=function t(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 s=0,o=0;o<i.length;o++){var l=i[o],u=n.idToIndex[l],f=n.layoutNodes[u].children;if(f.length!==0){var c=n.indexToGraph[n.idToIndex[f[0]]],h=t(e,r,c,n);if(h.count!==0)if(h.count===1){if(s++,s===2)break}else return h}}return{count:s,graph:a}},up,fp=function(e,r){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var s=e.layoutNodes[i];s.children.length===0&&!s.isLocked&&(s.positionX=Math.random()*a,s.positionY=Math.random()*n)}},Gl=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(s){var o=e.layoutNodes[e.idToIndex[s.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(s,o){var l=e.layoutNodes[e.idToIndex[s.data("id")]];if(r.boundingBox){var u=(l.positionX-i.x1)/i.w,f=(l.positionY-i.y1)/i.h;return{x:n.x1+u*n.w,y:n.y1+f*n.h}}else return{x:l.positionX,y:l.positionY}}},cp=function(e,r,a){var n=a.layout,i=a.eles.nodes(),s=Gl(e,a,i);i.positions(s),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},vp=function(e,r,a){hp(e,r),pp(e),yp(e,r),mp(e),bp(e)},hp=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,s=0;s<i;s++)for(var o=e.layoutNodes[e.idToIndex[n[s]]],l=s+1;l<i;l++){var u=e.layoutNodes[e.idToIndex[n[l]]];dp(o,u,e,r)}},eo=function(e){return-e+2*e*Math.random()},dp=function(e,r,a,n){var i=e.cmptId,s=r.cmptId;if(!(i!==s&&!a.isCompound)){var o=r.positionX-e.positionX,l=r.positionY-e.positionY,u=1;o===0&&l===0&&(o=eo(u),l=eo(u));var f=gp(e,r,o,l);if(f>0)var c=n.nodeOverlap*f,h=Math.sqrt(o*o+l*l),v=c*o/h,d=c*l/h;else var g=Tn(e,o,l),p=Tn(r,-1*o,-1*l),y=p.x-g.x,b=p.y-g.y,m=y*y+b*b,h=Math.sqrt(m),c=(e.nodeRepulsion+r.nodeRepulsion)/m,v=c*y/h,d=c*b/h;e.isLocked||(e.offsetX-=v,e.offsetY-=d),r.isLocked||(r.offsetX+=v,r.offsetY+=d)}},gp=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 s=e.maxY-r.minY;else var s=r.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Tn=function(e,r,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,l=a/r,u=s/o,f={};return r===0&&0<a||r===0&&0>a?(f.x=n,f.y=i+s/2,f):0<r&&-1*u<=l&&l<=u?(f.x=n+o/2,f.y=i+o*a/2/r,f):0>r&&-1*u<=l&&l<=u?(f.x=n-o/2,f.y=i-o*a/2/r,f):0<a&&(l<=-1*u||l>=u)?(f.x=n+s*r/2/a,f.y=i+s/2,f):(0>a&&(l<=-1*u||l>=u)&&(f.x=n-s*r/2/a,f.y=i-s/2),f)},pp=function(e,r){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],s=e.layoutNodes[i],o=e.idToIndex[n.targetId],l=e.layoutNodes[o],u=l.positionX-s.positionX,f=l.positionY-s.positionY;if(!(u===0&&f===0)){var c=Tn(s,u,f),h=Tn(l,-1*u,-1*f),v=h.x-c.x,d=h.y-c.y,g=Math.sqrt(v*v+d*d),p=Math.pow(n.idealLength-g,2)/n.elasticity;if(g!==0)var y=p*v/g,b=p*d/g;else var y=0,b=0;s.isLocked||(s.offsetX+=y,s.offsetY+=b),l.isLocked||(l.offsetX-=y,l.offsetY-=b)}}},yp=function(e,r){if(r.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],s=i.length;if(n===0)var o=e.clientHeight/2,l=e.clientWidth/2;else var u=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[u.parentId]],o=f.positionX,l=f.positionY;for(var c=0;c<s;c++){var h=e.layoutNodes[e.idToIndex[i[c]]];if(!h.isLocked){var v=o-h.positionX,d=l-h.positionY,g=Math.sqrt(v*v+d*d);if(g>a){var p=r.gravity*v/g,y=r.gravity*d/g;h.offsetX+=p,h.offsetY+=y}}}}},mp=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 s=a[n++],o=e.idToIndex[s],l=e.layoutNodes[o],u=l.children;if(0<u.length&&!l.isLocked){for(var f=l.offsetX,c=l.offsetY,h=0;h<u.length;h++){var v=e.layoutNodes[e.idToIndex[u[h]]];v.offsetX+=f,v.offsetY+=c,a[++i]=u[h]}l.offsetX=0,l.offsetY=0}}},bp=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=wp(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,Ep(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)}},wp=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},Ep=function t(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 t(n,r)}},to=function(e,r){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var s=a[i],o=s.cmptId,l=n[o]=n[o]||[];l.push(s)}for(var u=0,i=0;i<n.length;i++){var f=n[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var c=0;c<f.length;c++){var h=f[c];f.x1=Math.min(f.x1,h.positionX-h.width/2),f.x2=Math.max(f.x2,h.positionX+h.width/2),f.y1=Math.min(f.y1,h.positionY-h.height/2),f.y2=Math.max(f.y2,h.positionY+h.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,u+=f.w*f.h}}n.sort(function(b,m){return m.w*m.h-b.w*b.h});for(var v=0,d=0,g=0,p=0,y=Math.sqrt(u)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var f=n[i];if(f){for(var c=0;c<f.length;c++){var h=f[c];h.isLocked||(h.positionX+=v-f.x1,h.positionY+=d-f.y1)}v+=f.w+r.componentSpacing,g+=f.w+r.componentSpacing,p=Math.max(p,f.h),g>y&&(d+=p+r.componentSpacing,v=0,g=0,p=0)}}},xp={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 zl(t){this.options=he({},xp,t)}zl.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=yt(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(H){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),l=Math.round(o),u=Math.round(i.w/i.h*o),f=function(X){if(X==null)return Math.min(l,u);var K=Math.min(l,u);K==l?l=X:u=X},c=function(X){if(X==null)return Math.max(l,u);var K=Math.max(l,u);K==l?l=X:u=X},h=e.rows,v=e.cols!=null?e.cols:e.columns;if(h!=null&&v!=null)l=h,u=v;else if(h!=null&&v==null)l=h,u=Math.ceil(s/l);else if(h==null&&v!=null)u=v,l=Math.ceil(s/u);else if(u*l>s){var d=f(),g=c();(d-1)*g>=s?f(d-1):(g-1)*d>=s&&c(g-1)}else for(;u*l<s;){var p=f(),y=c();(y+1)*p>=s?c(y+1):f(p+1)}var b=i.w/u,m=i.h/l;if(e.condense&&(b=0,m=0),e.avoidOverlap)for(var T=0;T<n.length;T++){var C=n[T],D=C._private.position;(D.x==null||D.y==null)&&(D.x=0,D.y=0);var w=C.layoutDimensions(e),x=e.avoidOverlapPadding,E=w.w+x,S=w.h+x;b=Math.max(b,E),m=Math.max(m,S)}for(var A={},L=function(X,K){return!!A["c-"+X+"-"+K]},I=function(X,K){A["c-"+X+"-"+K]=!0},R=0,P=0,M=function(){P++,P>=u&&(P=0,R++)},k={},N=0;N<n.length;N++){var B=n[N],z=e.position(B);if(z&&(z.row!==void 0||z.col!==void 0)){var F={row:z.row,col:z.col};if(F.col===void 0)for(F.col=0;L(F.row,F.col);)F.col++;else if(F.row===void 0)for(F.row=0;L(F.row,F.col);)F.row++;k[B.id()]=F,I(F.row,F.col)}}var G=function(X,K){var q,J;if(X.locked()||X.isParent())return!1;var j=k[X.id()];if(j)q=j.col*b+b/2+i.x1,J=j.row*m+m/2+i.y1;else{for(;L(R,P);)M();q=P*b+b/2+i.x1,J=R*m+m/2+i.y1,I(R,P),M()}return{x:q,y:J}};n.layoutPositions(this,e,G)}return this};var Tp={ready:function(){},stop:function(){}};function qi(t){this.options=he({},Tp,t)}qi.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};qi.prototype.stop=function(){return this};var Cp={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 _l(t){this.options=he({},Cp,t)}_l.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=Ve(t.positions);function n(i){if(t.positions==null)return Lc(i.position());if(a)return t.positions(i);var s=t.positions[i._private.data.id];return s??null}return r.layoutPositions(this,t,function(i,s){var o=n(i);return i.locked()||o==null?!1:o}),this};var Dp={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 Vl(t){this.options=he({},Dp,t)}Vl.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=yt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(s,o){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,n),this};var Sp=[{name:"breadthfirst",impl:kl},{name:"circle",impl:Bl},{name:"concentric",impl:Fl},{name:"cose",impl:Vn},{name:"grid",impl:zl},{name:"null",impl:qi},{name:"preset",impl:_l},{name:"random",impl:Vl}];function Ul(t){this.options=t,this.notifications=0}var ro=function(){},ao=function(){throw new Error("A headless instance can not render images")};Ul.prototype={recalculateRenderedStyle:ro,notify:function(){this.notifications++},init:ro,isHeadless:function(){return!0},png:ao,jpg:ao};var Ki={};Ki.arrowShapeWidth=.3;Ki.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(u,f,c,h,v,d,g){var p=v.x-c/2-g,y=v.x+c/2+g,b=v.y-c/2-g,m=v.y+c/2+g,T=p<=u&&u<=y&&b<=f&&f<=m;return T},a=function(u,f,c,h,v){var d=u*Math.cos(h)-f*Math.sin(h),g=u*Math.sin(h)+f*Math.cos(h),p=d*c,y=g*c,b=p+v.x,m=y+v.y;return{x:b,y:m}},n=function(u,f,c,h){for(var v=[],d=0;d<u.length;d+=2){var g=u[d],p=u[d+1];v.push(a(g,p,f,c,h))}return v},i=function(u){for(var f=[],c=0;c<u.length;c++){var h=u[c];f.push(h.x,h.y)}return f},s=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},o=function(u,f){ce(f)&&(f=t[f]),t[u]=he({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(h,v,d,g,p,y){var b=i(n(this.points,d+2*y,g,p)),m=pt(h,v,b);return m},roughCollide:r,draw:function(h,v,d,g){var p=n(this.points,v,d,g);e.arrowShapeImpl("polygon")(h,p)},spacing:function(h){return 0},gap:s},f)};o("none",{collide:yn,roughCollide:yn,draw:Ni,spacing:hs,gap:hs}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(u,f,c,h,v){var d=n(this.points,f,c,h),g=this.controlPoint,p=a(g[0],g[1],f,c,h);e.arrowShapeImpl(this.name)(u,d,p)},gap:function(u){return s(u)*.8}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,f,c,h,v,d,g){var p=i(n(this.points,c+2*g,h,v)),y=i(n(this.pointsTee,c+2*g,h,v)),b=pt(u,f,p)||pt(u,f,y);return b},draw:function(u,f,c,h,v){var d=n(this.points,f,c,h),g=n(this.pointsTee,f,c,h);e.arrowShapeImpl(this.name)(u,d,g)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,f,c,h,v,d,g){var p=v,y=Math.pow(p.x-u,2)+Math.pow(p.y-f,2)<=Math.pow((c+2*g)*this.radius,2),b=i(n(this.points,c+2*g,h,v));return pt(u,f,b)||y},draw:function(u,f,c,h,v){var d=n(this.pointsTr,f,c,h);e.arrowShapeImpl(this.name)(u,d,h.x,h.y,this.radius*f)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,f){var c=this.baseCrossLinePts.slice(),h=f/u,v=3,d=5;return c[v]=c[v]-h,c[d]=c[d]-h,c},collide:function(u,f,c,h,v,d,g){var p=i(n(this.points,c+2*g,h,v)),y=i(n(this.crossLinePts(c,d),c+2*g,h,v)),b=pt(u,f,p)||pt(u,f,y);return b},draw:function(u,f,c,h,v){var d=n(this.points,f,c,h),g=n(this.crossLinePts(f,v),f,c,h);e.arrowShapeImpl(this.name)(u,d,g)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return s(u)*.525}}),o("circle",{radius:.15,collide:function(u,f,c,h,v,d,g){var p=v,y=Math.pow(p.x-u,2)+Math.pow(p.y-f,2)<=Math.pow((c+2*g)*this.radius,2);return y},draw:function(u,f,c,h,v){e.arrowShapeImpl(this.name)(u,h.x,h.y,this.radius*f)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),o("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return .95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})};var Ar={};Ar.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],s=a[4],o=r.pan(),l=r.zoom(),u=((t-n)/s-o.x)/l,f=((e-i)/s-o.y)/l;return[u,f]};Ar.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")},s=t.clientWidth,o=t.clientHeight,l=n.left+n.right,u=n.top+n.bottom,f=i.left+i.right,c=e.width/(s+f),h=s-l,v=o-u,d=e.left+n.left+i.left,g=e.top+n.top+i.top;return this.containerBB=[d,g,h,v,c]};Ar.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Ar.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]};Ar.findNearestElements=function(t,e,r,a){var n=this,i=this,s=i.getCachedZSortedEles(),o=[],l=i.cy.zoom(),u=i.cy.hasCompoundNodes(),f=(a?24:8)/l,c=(a?8:2)/l,h=(a?8:2)/l,v=1/0,d,g;r&&(s=s.interactive);function p(w,x){if(w.isNode()){if(g)return;g=w,o.push(w)}if(w.isEdge()&&(x==null||x<v))if(d){if(d.pstyle("z-compound-depth").value===w.pstyle("z-compound-depth").value&&d.pstyle("z-compound-depth").value===w.pstyle("z-compound-depth").value){for(var E=0;E<o.length;E++)if(o[E].isEdge()){o[E]=w,d=w,v=x??v;break}}}else o.push(w),d=w,v=x??v}function y(w){var x=w.outerWidth()+2*c,E=w.outerHeight()+2*c,S=x/2,A=E/2,L=w.position(),I=w.pstyle("corner-radius").value==="auto"?"auto":w.pstyle("corner-radius").pfValue,R=w._private.rscratch;if(L.x-S<=t&&t<=L.x+S&&L.y-A<=e&&e<=L.y+A){var P=i.nodeShapes[n.getNodeShape(w)];if(P.checkPoint(t,e,0,x,E,L.x,L.y,I,R))return p(w,0),!0}}function b(w){var x=w._private,E=x.rscratch,S=w.pstyle("width").pfValue,A=w.pstyle("arrow-scale").value,L=S/2+f,I=L*L,R=L*2,N=x.source,B=x.target,P;if(E.edgeType==="segments"||E.edgeType==="straight"||E.edgeType==="haystack"){for(var M=E.allpts,k=0;k+3<M.length;k+=2)if(Vc(t,e,M[k],M[k+1],M[k+2],M[k+3],R)&&I>(P=Xc(t,e,M[k],M[k+1],M[k+2],M[k+3])))return p(w,P),!0}else if(E.edgeType==="bezier"||E.edgeType==="multibezier"||E.edgeType==="self"||E.edgeType==="compound"){for(var M=E.allpts,k=0;k+5<E.allpts.length;k+=4)if(Uc(t,e,M[k],M[k+1],M[k+2],M[k+3],M[k+4],M[k+5],R)&&I>(P=Hc(t,e,M[k],M[k+1],M[k+2],M[k+3],M[k+4],M[k+5])))return p(w,P),!0}for(var N=N||x.source,B=B||x.target,z=n.getArrowWidth(S,A),F=[{name:"source",x:E.arrowStartX,y:E.arrowStartY,angle:E.srcArrowAngle},{name:"target",x:E.arrowEndX,y:E.arrowEndY,angle:E.tgtArrowAngle},{name:"mid-source",x:E.midX,y:E.midY,angle:E.midsrcArrowAngle},{name:"mid-target",x:E.midX,y:E.midY,angle:E.midtgtArrowAngle}],k=0;k<F.length;k++){var G=F[k],H=i.arrowShapes[w.pstyle(G.name+"-arrow-shape").value],X=w.pstyle("width").pfValue;if(H.roughCollide(t,e,z,G.angle,{x:G.x,y:G.y},X,f)&&H.collide(t,e,z,G.angle,{x:G.x,y:G.y},X,f))return p(w),!0}u&&o.length>0&&(y(N),y(B))}function m(w,x,E){return It(w,x,E)}function T(w,x){var E=w._private,S=h,A;x?A=x+"-":A="",w.boundingBox();var L=E.labelBounds[x||"main"],I=w.pstyle(A+"label").value,R=w.pstyle("text-events").strValue==="yes";if(!(!R||!I)){var P=m(E.rscratch,"labelX",x),M=m(E.rscratch,"labelY",x),k=m(E.rscratch,"labelAngle",x),N=w.pstyle(A+"text-margin-x").pfValue,B=w.pstyle(A+"text-margin-y").pfValue,z=L.x1-S-N,F=L.x2+S-N,G=L.y1-S-B,H=L.y2+S-B;if(k){var X=Math.cos(k),K=Math.sin(k),q=function(ae,se){return ae=ae-P,se=se-M,{x:ae*X-se*K+P,y:ae*K+se*X+M}},J=q(z,G),j=q(z,H),Y=q(F,G),_=q(F,H),W=[J.x+N,J.y+B,Y.x+N,Y.y+B,_.x+N,_.y+B,j.x+N,j.y+B];if(pt(t,e,W))return p(w),!0}else if(Yr(L,t,e))return p(w),!0}}for(var C=s.length-1;C>=0;C--){var D=s[C];D.isNode()?y(D)||T(D):b(D)||T(D)||T(D,"source")||T(D,"target")}return o};Ar.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=[],s=Math.min(t,r),o=Math.max(t,r),l=Math.min(e,a),u=Math.max(e,a);t=s,r=o,e=l,a=u;for(var f=yt({x1:t,y1:e,x2:r,y2:a}),c=0;c<n.length;c++){var h=n[c];if(h.isNode()){var v=h,d=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});Fi(f,d)&&!Qo(d,f)&&i.push(v)}else{var g=h,p=g._private,y=p.rscratch;if(y.startX!=null&&y.startY!=null&&!Yr(f,y.startX,y.startY)||y.endX!=null&&y.endY!=null&&!Yr(f,y.endX,y.endY))continue;if(y.edgeType==="bezier"||y.edgeType==="multibezier"||y.edgeType==="self"||y.edgeType==="compound"||y.edgeType==="segments"||y.edgeType==="haystack"){for(var b=p.rstyle.bezierPts||p.rstyle.linePts||p.rstyle.haystackPts,m=!0,T=0;T<b.length;T++)if(!_c(f,b[T])){m=!1;break}m&&i.push(g)}else(y.edgeType==="haystack"||y.edgeType==="straight")&&i.push(g)}}return i};var Cn={};Cn.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",s=e.edgeType==="compound",o=e.edgeType==="self",l,u,f,c,h,v,y,b;if(r?(f=e.haystackPts[0],c=e.haystackPts[1],h=e.haystackPts[2],v=e.haystackPts[3]):(f=e.arrowStartX,c=e.arrowStartY,h=e.arrowEndX,v=e.arrowEndY),y=e.midX,b=e.midY,i)l=f-e.segpts[0],u=c-e.segpts[1];else if(n||s||o||a){var d=e.allpts,g=je(d[0],d[2],d[4],.1),p=je(d[1],d[3],d[5],.1);l=f-g,u=c-p}else l=f-y,u=c-b;e.srcArrowAngle=$a(l,u);var y=e.midX,b=e.midY;if(r&&(y=(f+h)/2,b=(c+v)/2),l=h-f,u=v-c,i){var d=e.allpts;if(d.length/2%2===0){var m=d.length/2,T=m-2;l=d[m]-d[T],u=d[m+1]-d[T+1]}else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var m=d.length/2-1,T=m-2;l=d[m]-d[T],u=d[m+1]-d[T+1]}}else if(n||s||o){var d=e.allpts,C=e.ctrlpts,D,w,x,E;if(C.length/2%2===0){var S=d.length/2-1,A=S+2,L=A+2;D=je(d[S],d[A],d[L],0),w=je(d[S+1],d[A+1],d[L+1],0),x=je(d[S],d[A],d[L],1e-4),E=je(d[S+1],d[A+1],d[L+1],1e-4)}else{var A=d.length/2-1,S=A-2,L=A+2;D=je(d[S],d[A],d[L],.4999),w=je(d[S+1],d[A+1],d[L+1],.4999),x=je(d[S],d[A],d[L],.5),E=je(d[S+1],d[A+1],d[L+1],.5)}l=x-D,u=E-w}if(e.midtgtArrowAngle=$a(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,i){var d=e.allpts;if(d.length/2%2!==0){if(!e.isRound){var m=d.length/2-1,I=m+2;l=-(d[I]-d[m]),u=-(d[I+1]-d[m+1])}}}if(e.midsrcArrowAngle=$a(l,u),i)l=h-e.segpts[e.segpts.length-2],u=v-e.segpts[e.segpts.length-1];else if(n||s||o||a){var d=e.allpts,R=d.length,g=je(d[R-6],d[R-4],d[R-2],.9),p=je(d[R-5],d[R-3],d[R-1],.9);l=h-g,u=v-p}else l=h-y,u=v-b;e.tgtArrowAngle=$a(l,u)};Cn.getArrowWidth=Cn.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 bi,wi,Ft={},Ct={},no,io,mr,cn,Ht,dr,yr,Bt,Mr,ja,Yl,$l,Ei,xi,so,oo=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)},Ap=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},Lp=function(e,r,a,n,i){if(e!==so?oo(r,e,Ft):Ap(Ct,Ft),oo(r,a,Ct),no=Ft.nx*Ct.ny-Ft.ny*Ct.nx,io=Ft.nx*Ct.nx-Ft.ny*-Ct.ny,Ht=Math.asin(Math.max(-1,Math.min(1,no))),Math.abs(Ht)<1e-6){bi=r.x,wi=r.y,yr=Mr=0;return}mr=1,cn=!1,io<0?Ht<0?Ht=Math.PI+Ht:(Ht=Math.PI-Ht,mr=-1,cn=!0):Ht>0&&(mr=-1,cn=!0),r.radius!==void 0?Mr=r.radius:Mr=n,dr=Ht/2,ja=Math.min(Ft.len/2,Ct.len/2),i?(Bt=Math.abs(Math.cos(dr)*Mr/Math.sin(dr)),Bt>ja?(Bt=ja,yr=Math.abs(Bt*Math.sin(dr)/Math.cos(dr))):yr=Mr):(Bt=Math.min(ja,Mr),yr=Math.abs(Bt*Math.sin(dr)/Math.cos(dr))),Ei=r.x+Ct.nx*Bt,xi=r.y+Ct.ny*Bt,bi=Ei-Ct.ny*yr*mr,wi=xi+Ct.nx*yr*mr,Yl=r.x+Ft.nx*Bt,$l=r.y+Ft.ny*Bt,so=r};function Hl(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 Zi(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}:(Lp(t,e,r,a,n),{cx:bi,cy:wi,radius:yr,startX:Yl,startY:$l,stopX:Ei,stopY:xi,startAngle:Ft.ang+Math.PI/2*mr,endAngle:Ct.ang-Math.PI/2*mr,counterClockwise:cn})}var ft={};ft.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,s=t.pstyle("source-endpoint"),o=t.pstyle("target-endpoint"),l=s.units!=null&&o.units!=null,u=function(C,D,w,x){var E=x-D,S=w-C,A=Math.sqrt(S*S+E*E);return{x:-E/A,y:S/A}},f=t.pstyle("edge-distances").value;switch(f){case"node-position":i=r;break;case"intersection":i=a;break;case"endpoints":{if(l){var c=this.manualEndptToPx(t.source()[0],s),h=Ye(c,2),v=h[0],d=h[1],g=this.manualEndptToPx(t.target()[0],o),p=Ye(g,2),y=p[0],b=p[1],m={x1:v,y1:d,x2:y,y2:b};n=u(v,d,y,b),i=m}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}};ft.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 s=a.source,o=a.target,l=s.position(),u=o.position(),f=s.width(),c=o.width(),h=s.height(),v=o.height(),d=r.pstyle("haystack-radius").value,g=d/2;n.haystackPts=n.allpts=[n.source.x*f*g+l.x,n.source.y*h*g+l.y,n.target.x*c*g+u.x,n.target.y*v*g+u.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)}};ft.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),n=t.pstyle("segment-distances"),i=t.pstyle("segment-radii"),s=t.pstyle("radius-type"),o=Math.min(a.pfValue.length,n.pfValue.length),l=i.pfValue[i.pfValue.length-1],u=s.pfValue[s.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var f=0;f<o;f++){var c=a.pfValue[f],h=n.pfValue[f],v=1-c,d=c,g=this.findMidptPtsEtc(t,e),p=g.midptPts,y=g.vectorNormInverse,b={x:p.x1*v+p.x2*d,y:p.y1*v+p.y2*d};r.segpts.push(b.x+y.x*h,b.y+y.y*h),r.radii.push(i.pfValue[f]!==void 0?i.pfValue[f]:l),r.isArcRadius.push((s.pfValue[f]!==void 0?s.pfValue[f]:u)==="arc-radius")}};ft.findLoopPoints=function(t,e,r,a){var n=t._private.rscratch,i=e.dirCounts,s=e.srcPos,o=t.pstyle("control-point-distances"),l=o?o.pfValue[0]:void 0,u=t.pstyle("loop-direction").pfValue,f=t.pstyle("loop-sweep").pfValue,c=t.pstyle("control-point-step-size").pfValue;n.edgeType="self";var h=r,v=c;a&&(h=0,v=l);var d=u-Math.PI/2,g=d-f/2,p=d+f/2,y=u+"_"+f;h=i[y]===void 0?i[y]=0:++i[y],n.ctrlpts=[s.x+Math.cos(g)*1.4*v*(h/3+1),s.y+Math.sin(g)*1.4*v*(h/3+1),s.x+Math.cos(p)*1.4*v*(h/3+1),s.y+Math.sin(p)*1.4*v*(h/3+1)]};ft.findCompoundLoopPoints=function(t,e,r,a){var n=t._private.rscratch;n.edgeType="compound";var i=e.srcPos,s=e.tgtPos,o=e.srcW,l=e.srcH,u=e.tgtW,f=e.tgtH,c=t.pstyle("control-point-step-size").pfValue,h=t.pstyle("control-point-distances"),v=h?h.pfValue[0]:void 0,d=r,g=c;a&&(d=0,g=v);var p=50,y={x:i.x-o/2,y:i.y-l/2},b={x:s.x-u/2,y:s.y-f/2},m={x:Math.min(y.x,b.x),y:Math.min(y.y,b.y)},T=.5,C=Math.max(T,Math.log(o*.01)),D=Math.max(T,Math.log(u*.01));n.ctrlpts=[m.x,m.y-(1+Math.pow(p,1.12)/100)*g*(d/3+1)*C,m.x-(1+Math.pow(p,1.12)/100)*g*(d/3+1)*D,m.y]};ft.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};ft.findBezierPoints=function(t,e,r,a,n){var i=t._private.rscratch,s=t.pstyle("control-point-step-size").pfValue,o=t.pstyle("control-point-distances"),l=t.pstyle("control-point-weights"),u=o&&l?Math.min(o.value.length,l.value.length):1,f=o?o.pfValue[0]:void 0,c=l.value[0],h=a;i.edgeType=h?"multibezier":"bezier",i.ctrlpts=[];for(var v=0;v<u;v++){var d=(.5-e.eles.length/2+r)*s*(n?-1:1),g=void 0,p=Ko(d);h&&(f=o?o.pfValue[v]:s,c=l.value[v]),a?g=f:g=f!==void 0?p*f:void 0;var y=g!==void 0?g:d,b=1-c,m=c,T=this.findMidptPtsEtc(t,e),C=T.midptPts,D=T.vectorNormInverse,w={x:C.x1*b+C.x2*m,y:C.y1*b+C.y2*m};i.ctrlpts.push(w.x+D.x*y,w.y+D.y*y)}};ft.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",n="horizontal",i="leftward",s="rightward",o="downward",l="upward",u="auto",f=e.posPts,c=e.srcW,h=e.srcH,v=e.tgtW,d=e.tgtH,g=t.pstyle("edge-distances").value,p=g!=="node-position",y=t.pstyle("taxi-direction").value,b=y,m=t.pstyle("taxi-turn"),T=m.units==="%",C=m.pfValue,D=C<0,w=t.pstyle("taxi-turn-min-distance").pfValue,x=p?(c+v)/2:0,E=p?(h+d)/2:0,S=f.x2-f.x1,A=f.y2-f.y1,L=function(Q,ie){return Q>0?Math.max(Q-ie,0):Math.min(Q+ie,0)},I=L(S,x),R=L(A,E),P=!1;b===u?y=Math.abs(I)>Math.abs(R)?n:a:b===l||b===o?(y=a,P=!0):(b===i||b===s)&&(y=n,P=!0);var M=y===a,k=M?R:I,N=M?A:S,B=Ko(N),z=!1;!(P&&(T||D))&&(b===o&&N<0||b===l&&N>0||b===i&&N>0||b===s&&N<0)&&(B*=-1,k=B*Math.abs(k),z=!0);var F;if(T){var G=C<0?1+C:C;F=G*k}else{var H=C<0?k:0;F=H+C*B}var X=function(Q){return Math.abs(Q)<w||Math.abs(Q)>=Math.abs(k)},K=X(F),q=X(Math.abs(k)-Math.abs(F)),J=K||q;if(J&&!z)if(M){var j=Math.abs(N)<=h/2,Y=Math.abs(S)<=v/2;if(j){var _=(f.x1+f.x2)/2,W=f.y1,te=f.y2;r.segpts=[_,W,_,te]}else if(Y){var ae=(f.y1+f.y2)/2,se=f.x1,Ce=f.x2;r.segpts=[se,ae,Ce,ae]}else r.segpts=[f.x1,f.y2]}else{var Oe=Math.abs(N)<=c/2,Pe=Math.abs(A)<=d/2;if(Oe){var ue=(f.y1+f.y2)/2,le=f.x1,pe=f.x2;r.segpts=[le,ue,pe,ue]}else if(Pe){var ye=(f.x1+f.x2)/2,de=f.y1,me=f.y2;r.segpts=[ye,de,ye,me]}else r.segpts=[f.x2,f.y1]}else if(M){var xe=f.y1+F+(p?h/2*B:0),De=f.x1,ee=f.x2;r.segpts=[De,xe,ee,xe]}else{var O=f.x1+F+(p?c/2*B:0),V=f.y1,Z=f.y2;r.segpts=[O,V,O,Z]}if(r.isRound){var U=t.pstyle("taxi-radius").value,$=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(U),r.isArcRadius=new Array(r.segpts.length/2).fill($)}};ft.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,f=e.tgtShape,c=e.srcCornerRadius,h=e.tgtCornerRadius,v=e.srcRs,d=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,T=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,C=m*T,D=Er({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),w=D<C,x=Er({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),E=x<C,S=!1;if(g||p||w){S=!0;var A={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},L=Math.sqrt(A.x*A.x+A.y*A.y),I={x:A.x/L,y:A.y/L},R=Math.max(i,s),P={x:r.ctrlpts[0]+I.x*2*R,y:r.ctrlpts[1]+I.y*2*R},M=u.intersectLine(a.x,a.y,i,s,P.x,P.y,0,c,v);w?(r.ctrlpts[0]=r.ctrlpts[0]+I.x*(C-D),r.ctrlpts[1]=r.ctrlpts[1]+I.y*(C-D)):(r.ctrlpts[0]=M[0]+I.x*C,r.ctrlpts[1]=M[1]+I.y*C)}if(y||b||E){S=!0;var k={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},N=Math.sqrt(k.x*k.x+k.y*k.y),B={x:k.x/N,y:k.y/N},z=Math.max(i,s),F={x:r.ctrlpts[0]+B.x*2*z,y:r.ctrlpts[1]+B.y*2*z},G=f.intersectLine(n.x,n.y,o,l,F.x,F.y,0,h,d);E?(r.ctrlpts[0]=r.ctrlpts[0]+B.x*(C-x),r.ctrlpts[1]=r.ctrlpts[1]+B.y*(C-x)):(r.ctrlpts[0]=G[0]+B.x*C,r.ctrlpts[1]=G[1]+B.y*C)}S&&this.findEndpoints(t)}};ft.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=je(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=je(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 s=e.radii[i/2-1],o=e.isArcRadius[i/2-1];e.roundCorners.push(Zi({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:s},{x:e.allpts[i+2],y:e.allpts[i+3]},s,o))}}if(e.segpts.length%4===0){var l=e.segpts.length/2,u=l-2;e.midX=(e.segpts[u]+e.segpts[l])/2,e.midY=(e.segpts[u+1]+e.segpts[l+1])/2}else{var f=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[f],e.midY=e.segpts[f+1];else{var c={x:e.segpts[f],y:e.segpts[f+1]},h=e.roundCorners[f/2],v=[c.x-h.cx,c.y-h.cy],d=h.radius/Math.sqrt(Math.pow(v[0],2)+Math.pow(v[1],2));v=v.map(function(g){return g*d}),e.midX=h.cx+v[0],e.midY=h.cy+v[1],e.midVector=v}}}};ft.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."))};ft.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,n=a.hasCompoundNodes(),i={map:new zt,get:function(w){var x=this.map.get(w[0]);return x!=null?x.get(w[1]):null},set:function(w,x){var E=this.map.get(w[0]);E==null&&(E=new zt,this.map.set(w[0],E)),E.set(w[1],x)}},s=[],o=[],l=0;l<t.length;l++){var u=t[l],f=u._private,c=u.pstyle("curve-style").value;if(!(u.removed()||!u.takesUpSpace())){if(c==="haystack"){o.push(u);continue}var h=c==="unbundled-bezier"||c.endsWith("segments")||c==="straight"||c==="straight-triangle"||c.endsWith("taxi"),v=c==="unbundled-bezier"||c==="bezier",d=f.source,g=f.target,p=d.poolIndex(),y=g.poolIndex(),b=[p,y].sort(),m=i.get(b);m==null&&(m={eles:[]},i.set(b,m),s.push(b)),m.eles.push(u),h&&(m.hasUnbundled=!0),v&&(m.hasBezier=!0)}}for(var T=function(w){var x=s[w],E=i.get(x),S=void 0;if(!E.hasUnbundled){var A=E.eles[0].parallelEdges().filter(function(O){return O.isBundledBezier()});ki(E.eles),A.forEach(function(O){return E.eles.push(O)}),E.eles.sort(function(O,V){return O.poolIndex()-V.poolIndex()})}var L=E.eles[0],I=L.source(),R=L.target();if(I.poolIndex()>R.poolIndex()){var P=I;I=R,R=P}var M=E.srcPos=I.position(),k=E.tgtPos=R.position(),N=E.srcW=I.outerWidth(),B=E.srcH=I.outerHeight(),z=E.tgtW=R.outerWidth(),F=E.tgtH=R.outerHeight(),G=E.srcShape=r.nodeShapes[e.getNodeShape(I)],H=E.tgtShape=r.nodeShapes[e.getNodeShape(R)],X=E.srcCornerRadius=I.pstyle("corner-radius").value==="auto"?"auto":I.pstyle("corner-radius").pfValue,K=E.tgtCornerRadius=R.pstyle("corner-radius").value==="auto"?"auto":R.pstyle("corner-radius").pfValue,q=E.tgtRs=R._private.rscratch,J=E.srcRs=I._private.rscratch;E.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var j=0;j<E.eles.length;j++){var Y=E.eles[j],_=Y[0]._private.rscratch,W=Y.pstyle("curve-style").value,te=W==="unbundled-bezier"||W.endsWith("segments")||W.endsWith("taxi"),ae=!I.same(Y.source());if(!E.calculatedIntersection&&I!==R&&(E.hasBezier||E.hasUnbundled)){E.calculatedIntersection=!0;var se=G.intersectLine(M.x,M.y,N,B,k.x,k.y,0,X,J),Ce=E.srcIntn=se,Oe=H.intersectLine(k.x,k.y,z,F,M.x,M.y,0,K,q),Pe=E.tgtIntn=Oe,ue=E.intersectionPts={x1:se[0],x2:Oe[0],y1:se[1],y2:Oe[1]},le=E.posPts={x1:M.x,x2:k.x,y1:M.y,y2:k.y},pe=Oe[1]-se[1],ye=Oe[0]-se[0],de=Math.sqrt(ye*ye+pe*pe),me=E.vector={x:ye,y:pe},xe=E.vectorNorm={x:me.x/de,y:me.y/de},De={x:-xe.y,y:xe.x};E.nodesOverlap=!re(de)||H.checkPoint(se[0],se[1],0,z,F,k.x,k.y,K,q)||G.checkPoint(Oe[0],Oe[1],0,N,B,M.x,M.y,X,J),E.vectorNormInverse=De,S={nodesOverlap:E.nodesOverlap,dirCounts:E.dirCounts,calculatedIntersection:!0,hasBezier:E.hasBezier,hasUnbundled:E.hasUnbundled,eles:E.eles,srcPos:k,srcRs:q,tgtPos:M,tgtRs:J,srcW:z,srcH:F,tgtW:N,tgtH:B,srcIntn:Pe,tgtIntn:Ce,srcShape:H,tgtShape:G,posPts:{x1:le.x2,y1:le.y2,x2:le.x1,y2:le.y1},intersectionPts:{x1:ue.x2,y1:ue.y2,x2:ue.x1,y2:ue.y1},vector:{x:-me.x,y:-me.y},vectorNorm:{x:-xe.x,y:-xe.y},vectorNormInverse:{x:-De.x,y:-De.y}}}var ee=ae?S:E;_.nodesOverlap=ee.nodesOverlap,_.srcIntn=ee.srcIntn,_.tgtIntn=ee.tgtIntn,_.isRound=W.startsWith("round"),n&&(I.isParent()||I.isChild()||R.isParent()||R.isChild())&&(I.parents().anySame(R)||R.parents().anySame(I)||I.same(R)&&I.isParent())?e.findCompoundLoopPoints(Y,ee,j,te):I===R?e.findLoopPoints(Y,ee,j,te):W.endsWith("segments")?e.findSegmentsPoints(Y,ee):W.endsWith("taxi")?e.findTaxiPoints(Y,ee):W==="straight"||!te&&E.eles.length%2===1&&j===Math.floor(E.eles.length/2)?e.findStraightEdgePoints(Y):e.findBezierPoints(Y,ee,j,te,ae),e.findEndpoints(Y),e.tryToCorrectInvalidPoints(Y,ee),e.checkForInvalidEdgeWarning(Y),e.storeAllpts(Y),e.storeEdgeProjections(Y),e.calculateArrowAngles(Y),e.recalculateEdgeLabelProjections(Y),e.calculateLabelAngles(Y)}},C=0;C<s.length;C++)T(C);this.findHaystackPoints(o)}};function Xl(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}}ft.getSegmentPoints=function(t){var e=t[0]._private.rscratch;this.recalculateRenderedStyle(t);var r=e.edgeType;if(r==="segments")return Xl(e.segpts)};ft.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 Xl(e.ctrlpts)};ft.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Ga={};Ga.manualEndptToPx=function(t,e){var r=this,a=t.position(),n=t.outerWidth(),i=t.outerHeight(),s=t._private.rscratch;if(e.value.length===2){var o=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(o[0]=o[0]*n),e.units[1]==="%"&&(o[1]=o[1]*i),o[0]+=a.x,o[1]+=a.y,o}else{var l=e.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(n,i),f=[a.x+Math.cos(l)*u,a.y+Math.sin(l)*u];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,n,i,f[0],f[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,s)}};Ga.findEndpoints=function(t){var e=this,r,a=t.source()[0],n=t.target()[0],i=a.position(),s=n.position(),o=t.pstyle("target-arrow-shape").value,l=t.pstyle("source-arrow-shape").value,u=t.pstyle("target-distance-from-node").pfValue,f=t.pstyle("source-distance-from-node").pfValue,c=a._private.rscratch,h=n._private.rscratch,v=t.pstyle("curve-style").value,d=t._private.rscratch,g=d.edgeType,p=v==="taxi",y=g==="self"||g==="compound",b=g==="bezier"||g==="multibezier"||y,m=g!=="bezier",T=g==="straight"||g==="segments",C=g==="segments",D=b||m||T,w=y||p,x=t.pstyle("source-endpoint"),E=w?"outside-to-node":x.value,S=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue,A=t.pstyle("target-endpoint"),L=w?"outside-to-node":A.value,I=n.pstyle("corner-radius").value==="auto"?"auto":n.pstyle("corner-radius").pfValue;d.srcManEndpt=x,d.tgtManEndpt=A;var R,P,M,k;if(b){var N=[d.ctrlpts[0],d.ctrlpts[1]],B=m?[d.ctrlpts[d.ctrlpts.length-2],d.ctrlpts[d.ctrlpts.length-1]]:N;R=B,P=N}else if(T){var z=C?d.segpts.slice(0,2):[s.x,s.y],F=C?d.segpts.slice(d.segpts.length-2):[i.x,i.y];R=F,P=z}if(L==="inside-to-node")r=[s.x,s.y];else if(A.units)r=this.manualEndptToPx(n,A);else if(L==="outside-to-line")r=d.tgtIntn;else if(L==="outside-to-node"||L==="outside-to-node-or-label"?M=R:(L==="outside-to-line"||L==="outside-to-line-or-label")&&(M=[i.x,i.y]),r=e.nodeShapes[this.getNodeShape(n)].intersectLine(s.x,s.y,n.outerWidth(),n.outerHeight(),M[0],M[1],0,I,h),L==="outside-to-node-or-label"||L==="outside-to-line-or-label"){var G=n._private.rscratch,H=G.labelWidth,X=G.labelHeight,K=G.labelX,q=G.labelY,J=H/2,j=X/2,Y=n.pstyle("text-valign").value;Y==="top"?q-=j:Y==="bottom"&&(q+=j);var _=n.pstyle("text-halign").value;_==="left"?K-=J:_==="right"&&(K+=J);var W=Da(M[0],M[1],[K-J,q-j,K+J,q-j,K+J,q+j,K-J,q+j],s.x,s.y);if(W.length>0){var te=i,ae=gr(te,Br(r)),se=gr(te,Br(W)),Ce=ae;if(se<ae&&(r=W,Ce=se),W.length>2){var Oe=gr(te,{x:W[2],y:W[3]});Oe<Ce&&(r=[W[2],W[3]])}}}var Pe=Ha(r,R,e.arrowShapes[o].spacing(t)+u),ue=Ha(r,R,e.arrowShapes[o].gap(t)+u);if(d.endX=ue[0],d.endY=ue[1],d.arrowEndX=Pe[0],d.arrowEndY=Pe[1],E==="inside-to-node")r=[i.x,i.y];else if(x.units)r=this.manualEndptToPx(a,x);else if(E==="outside-to-line")r=d.srcIntn;else if(E==="outside-to-node"||E==="outside-to-node-or-label"?k=P:(E==="outside-to-line"||E==="outside-to-line-or-label")&&(k=[s.x,s.y]),r=e.nodeShapes[this.getNodeShape(a)].intersectLine(i.x,i.y,a.outerWidth(),a.outerHeight(),k[0],k[1],0,S,c),E==="outside-to-node-or-label"||E==="outside-to-line-or-label"){var le=a._private.rscratch,pe=le.labelWidth,ye=le.labelHeight,de=le.labelX,me=le.labelY,xe=pe/2,De=ye/2,ee=a.pstyle("text-valign").value;ee==="top"?me-=De:ee==="bottom"&&(me+=De);var O=a.pstyle("text-halign").value;O==="left"?de-=xe:O==="right"&&(de+=xe);var V=Da(k[0],k[1],[de-xe,me-De,de+xe,me-De,de+xe,me+De,de-xe,me+De],i.x,i.y);if(V.length>0){var Z=s,U=gr(Z,Br(r)),$=gr(Z,Br(V)),ne=U;if($<U&&(r=[V[0],V[1]],ne=$),V.length>2){var Q=gr(Z,{x:V[2],y:V[3]});Q<ne&&(r=[V[2],V[3]])}}}var ie=Ha(r,P,e.arrowShapes[l].spacing(t)+f),ve=Ha(r,P,e.arrowShapes[l].gap(t)+f);d.startX=ve[0],d.startY=ve[1],d.arrowStartX=ie[0],d.arrowStartY=ie[1],D&&(!re(d.startX)||!re(d.startY)||!re(d.endX)||!re(d.endY)?d.badLine=!0:d.badLine=!1)};Ga.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Ga.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var Qi={};function Rp(t,e,r){for(var a=function(u,f,c,h){return je(u,f,c,h)},n=e._private,i=n.rstyle.bezierPts,s=0;s<t.bezierProjPcts.length;s++){var o=t.bezierProjPcts[s];i.push({x:a(r[0],r[2],r[4],o),y:a(r[1],r[3],r[5],o)})}}Qi.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)Rp(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 s=r.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};Qi.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Vt={};Vt.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!ar(e)){var r,a,n=t._private,i=t.width(),s=t.height(),o=t.padding(),l=t.position(),u=t.pstyle("text-halign").strValue,f=t.pstyle("text-valign").strValue,c=n.rscratch,h=n.rstyle;switch(u){case"left":r=l.x-i/2-o;break;case"right":r=l.x+i/2+o;break;default:r=l.x}switch(f){case"top":a=l.y-s/2-o;break;case"bottom":a=l.y+s/2+o;break;default:a=l.y}c.labelX=r,c.labelY=a,h.labelX=r,h.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var Wl=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},ql=function(e,r){var a=r.x-e.x,n=r.y-e.y;return Wl(a,n)},Ip=function(e,r,a,n){var i=Ca(0,n-.001,1),s=Ca(0,n+.001,1),o=Gr(e,r,a,i),l=Gr(e,r,a,s);return ql(o,l)};Vt.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 s=function(c,h,v){jt(r.rscratch,c,h,v),jt(r.rstyle,c,h,v)};s("labelX",null,e.x),s("labelY",null,e.y);var o=Wl(a.midDispX,a.midDispY);s("labelAutoAngle",null,o);var l=function f(){if(f.cache)return f.cache;for(var c=[],h=0;h+5<a.allpts.length;h+=4){var v={x:a.allpts[h],y:a.allpts[h+1]},d={x:a.allpts[h+2],y:a.allpts[h+3]},g={x:a.allpts[h+4],y:a.allpts[h+5]};c.push({p0:v,p1:d,p2:g,startDist:0,length:0,segments:[]})}var p=r.rstyle.bezierPts,y=n.bezierProjPcts.length;function b(w,x,E,S,A){var L=Er(x,E),I=w.segments[w.segments.length-1],R={p0:x,p1:E,t0:S,t1:A,startDist:I?I.startDist+I.length:0,length:L};w.segments.push(R),w.length+=L}for(var m=0;m<c.length;m++){var T=c[m],C=c[m-1];C&&(T.startDist=C.startDist+C.length),b(T,T.p0,p[m*y],0,n.bezierProjPcts[0]);for(var D=0;D<y-1;D++)b(T,p[m*y+D],p[m*y+D+1],n.bezierProjPcts[D],n.bezierProjPcts[D+1]);b(T,p[m*y+y-1],T.p2,n.bezierProjPcts[y-1],1)}return f.cache=c},u=function(c){var h,v=c==="source";if(i[c]){var d=t.pstyle(c+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var g=l(),p,y=0,b=0,m=0;m<g.length;m++){for(var T=g[v?m:g.length-1-m],C=0;C<T.segments.length;C++){var D=T.segments[v?C:T.segments.length-1-C],w=m===g.length-1&&C===T.segments.length-1;if(y=b,b+=D.length,b>=d||w){p={cp:T,segment:D};break}}if(p)break}var x=p.cp,E=p.segment,S=(d-y)/E.length,A=E.t1-E.t0,L=v?E.t0+A*S:E.t1-A*S;L=Ca(0,L,1),e=Gr(x.p0,x.p1,x.p2,L),h=Ip(x.p0,x.p1,x.p2,L);break}case"straight":case"segments":case"haystack":{for(var I=0,R,P,M,k,N=a.allpts.length,B=0;B+3<N&&(v?(M={x:a.allpts[B],y:a.allpts[B+1]},k={x:a.allpts[B+2],y:a.allpts[B+3]}):(M={x:a.allpts[N-2-B],y:a.allpts[N-1-B]},k={x:a.allpts[N-4-B],y:a.allpts[N-3-B]}),R=Er(M,k),P=I,I+=R,!(I>=d));B+=2);var z=d-P,F=z/R;F=Ca(0,F,1),e=kc(M,k,F),h=ql(M,k);break}}s("labelX",c,e.x),s("labelY",c,e.y),s("labelAutoAngle",c,h)}};u("source"),u("target"),this.applyLabelDimensions(t)}};Vt.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Vt.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=this.calculateLabelDimensions(t,a),i=t.pstyle("line-height").pfValue,s=t.pstyle("text-wrap").strValue,o=It(r.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(o.length,1),u=n.height/l,f=u*i,c=n.width,h=n.height+(l-1)*(i-1)*u;jt(r.rstyle,"labelWidth",e,c),jt(r.rscratch,"labelWidth",e,c),jt(r.rstyle,"labelHeight",e,h),jt(r.rscratch,"labelHeight",e,h),jt(r.rscratch,"labelLineHeight",e,f)};Vt.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,s=function(H,X){return X?(jt(r.rscratch,H,e,X),X):It(r.rscratch,H,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=t.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="​",f=n.split(`
15
+ `),c=t.pstyle("text-max-width").pfValue,h=t.pstyle("text-overflow-wrap").value,v=h==="anywhere",d=[],g=/[\s\u200b]+|$/g,p=0;p<f.length;p++){var y=f[p],b=this.calculateLabelDimensions(t,y),m=b.width;if(v){var T=y.split("").join(u);y=T}if(m>c){var C=y.matchAll(g),D="",w=0,x=Et(C),E;try{for(x.s();!(E=x.n()).done;){var S=E.value,A=S[0],L=y.substring(w,S.index);w=S.index+A.length;var I=D.length===0?L:D+L+A,R=this.calculateLabelDimensions(t,I),P=R.width;P<=c?D+=L+A:(D&&d.push(D),D=L+A)}}catch(G){x.e(G)}finally{x.f()}D.match(/^[\s\u200b]+$/)||d.push(D)}else d.push(y)}s("labelWrapCachedLines",d),n=s("labelWrapCachedText",d.join(`
16
+ `)),s("labelWrapKey",l)}else if(o==="ellipsis"){var M=t.pstyle("text-max-width").pfValue,k="",N="…",B=!1;if(this.calculateLabelDimensions(t,n).width<M)return n;for(var z=0;z<n.length;z++){var F=this.calculateLabelDimensions(t,k+n[z]+N).width;if(F>M)break;k+=n[z],z===n.length-1&&(B=!0)}return B||(k+=N),k}return n};Vt.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Vt.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),n=a.document,i=nr(e,t._private.labelDimsKey),s=r.labelDimCache||(r.labelDimCache=[]),o=s[i];if(o!=null)return o;var l=0,u=t.pstyle("font-style").strValue,f=t.pstyle("font-size").pfValue,c=t.pstyle("font-family").strValue,h=t.pstyle("font-weight").strValue,v=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!v){v=this.labelCalcCanvas=n.createElement("canvas"),d=this.labelCalcCanvasContext=v.getContext("2d");var g=v.style;g.position="absolute",g.left="-9999px",g.top="-9999px",g.zIndex="-1",g.visibility="hidden",g.pointerEvents="none"}d.font="".concat(u," ").concat(h," ").concat(f,"px ").concat(c);for(var p=0,y=0,b=e.split(`
17
+ `),m=0;m<b.length;m++){var T=b[m],C=d.measureText(T),D=Math.ceil(C.width),w=f;p=Math.max(D,p),y+=w}return p+=l,y+=l,s[i]={width:p,height:y}};Vt.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,n=t.isEdge(),i=e?e+"-":"",s=t.pstyle(i+"text-rotation"),o=s.strValue;return o==="none"?0:n&&o==="autorotate"?a.labelAutoAngle:o==="autorotate"?0:s.pfValue};Vt.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(t),r&&(n.sourceLabelAngle=e.calculateLabelAngle(t,"source"),n.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var Kl={},lo=28,uo=!1;Kl.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<lo||t.height()<lo))return uo||(Ie("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),uo=!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 Un={};Un.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var l=0;l<s.length;l++){var u=s[l],f=u._private,c=f.rstyle;c.clean=!1,c.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(s){var o=s.target;a(o)}).on("style.* background.*",function(s){var o=s.target;a(o,!1)});var n=function(s){if(s){var o=r.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],f=u._private.rstyle;u.isNode()&&!f.cleanConnected&&(a(u.connectedEdges()),f.cleanConnected=!0)}if(o)for(var c=0;c<o.length;c++){var h=o[c];h(s,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){n(!0)},r.beforeRender(n,r.beforeRenderPriorities.eleCalcs)};Un.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};Un.recalculateRenderedStyle=function(t,e){var r=function(T){return T._private.rstyle.cleanConnected},a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var s=t[i],o=s._private,l=o.rstyle;s.isEdge()&&(!r(s.source())||!r(s.target()))&&(l.clean=!1),!(e&&l.clean||s.removed())&&s.pstyle("display").value!=="none"&&(o.group==="nodes"?n.push(s):a.push(s),l.clean=!0)}for(var u=0;u<n.length;u++){var f=n[u],c=f._private,h=c.rstyle,v=f.position();this.recalculateNodeLabelProjection(f),h.nodeX=v.x,h.nodeY=v.y,h.nodeW=f.pstyle("width").pfValue,h.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var g=a[d],p=g._private,y=p.rstyle,b=p.rscratch;y.srcX=b.arrowStartX,y.srcY=b.arrowStartY,y.tgtX=b.arrowEndX,y.tgtY=b.arrowEndY,y.midX=b.midX,y.midY=b.midY,y.labelAngle=b.labelAngle,y.sourceLabelAngle=b.sourceLabelAngle,y.targetLabelAngle=b.targetLabelAngle}}};var Yn={};Yn.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)}}};Yn.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Yn.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(Pl),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var Zl={};[Ar,Cn,ft,Ga,Qi,Vt,Kl,Un,Yn].forEach(function(t){he(Zl,t)});var Ql={};Ql.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 s=i.image=new Image;s.addEventListener("load",r),s.addEventListener("error",function(){s.error=!0});var o="data:",l=t.substring(0,o.length).toLowerCase()===o;return l||(e=e==="null"?null:e,s.crossOrigin=e),s.src=t,s};var jr={};jr.registerBinding=function(t,e,r,a){var n=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(t)){for(var i=[],s=0;s<t.length;s++){var o=t[s];if(o!==void 0){var l=this.binder(o);i.push(l.on.apply(l,n))}}return i}var l=this.binder(t);return l.on.apply(l,n)};jr.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||tf(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 s=function(l,u,f){var c=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(c[2]={capture:f??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:c}),(t.addEventListener||t.on).apply(t,c),this};return{on:s,addEventListener:s,addListener:s,bind:s}};jr.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};jr.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};jr.load=function(){var t=this,e=t.cy.window(),r=function(O){return O.selected()},a=function(O){var V=O.getRootNode();if(V&&V.nodeType===11&&V.host!==void 0)return V},n=function(O,V,Z,U){O==null&&(O=t.cy);for(var $=0;$<V.length;$++){var ne=V[$];O.emit({originalEvent:Z,type:ne,position:U})}},i=function(O){return O.shiftKey||O.metaKey||O.ctrlKey},s=function(O,V){var Z=!0;if(t.cy.hasCompoundNodes()&&O&&O.pannable())for(var U=0;V&&U<V.length;U++){var O=V[U];if(O.isNode()&&O.isParent()&&!O.pannable()){Z=!1;break}}else Z=!0;return Z},o=function(O){O[0]._private.grabbed=!0},l=function(O){O[0]._private.grabbed=!1},u=function(O){O[0]._private.rscratch.inDragLayer=!0},f=function(O){O[0]._private.rscratch.inDragLayer=!1},c=function(O){O[0]._private.rscratch.isGrabTarget=!0},h=function(O){O[0]._private.rscratch.isGrabTarget=!1},v=function(O,V){var Z=V.addToList,U=Z.has(O);!U&&O.grabbable()&&!O.locked()&&(Z.merge(O),o(O))},d=function(O,V){if(O.cy().hasCompoundNodes()&&!(V.inDragLayer==null&&V.addToList==null)){var Z=O.descendants();V.inDragLayer&&(Z.forEach(u),Z.connectedEdges().forEach(u)),V.addToList&&v(Z,V)}},g=function(O,V){V=V||{};var Z=O.cy().hasCompoundNodes();V.inDragLayer&&(O.forEach(u),O.neighborhood().stdFilter(function(U){return!Z||U.isEdge()}).forEach(u)),V.addToList&&O.forEach(function(U){v(U,V)}),d(O,V),b(O,{inDragLayer:V.inDragLayer}),t.updateCachedGrabbedEles()},p=g,y=function(O){O&&(t.getCachedZSortedEles().forEach(function(V){l(V),f(V),h(V)}),t.updateCachedGrabbedEles())},b=function(O,V){if(!(V.inDragLayer==null&&V.addToList==null)&&O.cy().hasCompoundNodes()){var Z=O.ancestors().orphans();if(!Z.same(O)){var U=Z.descendants().spawnSelf().merge(Z).unmerge(O).unmerge(O.descendants()),$=U.connectedEdges();V.inDragLayer&&($.forEach(u),U.forEach(u)),V.addToList&&U.forEach(function(ne){v(ne,V)})}}},m=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},T=typeof MutationObserver<"u",C=typeof ResizeObserver<"u";T?(t.removeObserver=new MutationObserver(function(ee){for(var O=0;O<ee.length;O++){var V=ee[O],Z=V.removedNodes;if(Z)for(var U=0;U<Z.length;U++){var $=Z[U];if($===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(ee){t.destroy()});var D=Na(function(){t.cy.resize()},100);T&&(t.styleObserver=new MutationObserver(D),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",D),C&&(t.resizeObserver=new ResizeObserver(D),t.resizeObserver.observe(t.container));var w=function(O,V){for(;O!=null;)V(O),O=O.parentNode},x=function(){t.invalidateContainerClientCoordsCache()};w(t.container,function(ee){t.registerBinding(ee,"transitionend",x),t.registerBinding(ee,"animationend",x),t.registerBinding(ee,"scroll",x)}),t.registerBinding(t.container,"contextmenu",function(ee){ee.preventDefault()});var E=function(){return t.selection[4]!==0},S=function(O){for(var V=t.findContainerClientCoords(),Z=V[0],U=V[1],$=V[2],ne=V[3],Q=O.touches?O.touches:[O],ie=!1,ve=0;ve<Q.length;ve++){var Ee=Q[ve];if(Z<=Ee.clientX&&Ee.clientX<=Z+$&&U<=Ee.clientY&&Ee.clientY<=U+ne){ie=!0;break}}if(!ie)return!1;for(var fe=t.container,be=O.target,we=be.parentNode,ge=!1;we;){if(we===fe){ge=!0;break}we=we.parentNode}return!!ge};t.registerBinding(t.container,"mousedown",function(O){if(S(O)&&!(t.hoverData.which===1&&O.which!==1)){O.preventDefault(),m(),t.hoverData.capture=!0,t.hoverData.which=O.which;var V=t.cy,Z=[O.clientX,O.clientY],U=t.projectIntoViewport(Z[0],Z[1]),$=t.selection,ne=t.findNearestElements(U[0],U[1],!0,!1),Q=ne[0],ie=t.dragData.possibleDragElements;t.hoverData.mdownPos=U,t.hoverData.mdownGPos=Z;var ve=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var ke=t.hoverData.down;ke?ke.emit({originalEvent:O,type:"taphold",position:{x:U[0],y:U[1]}}):V.emit({originalEvent:O,type:"taphold",position:{x:U[0],y:U[1]}})}},t.tapholdDuration)};if(O.which==3){t.hoverData.cxtStarted=!0;var Ee={originalEvent:O,type:"cxttapstart",position:{x:U[0],y:U[1]}};Q?(Q.activate(),Q.emit(Ee),t.hoverData.down=Q):V.emit(Ee),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(O.which==1){Q&&Q.activate();{if(Q!=null&&t.nodeIsGrabbable(Q)){var fe=function(ke){return{originalEvent:O,type:ke,position:{x:U[0],y:U[1]}}},be=function(ke){ke.emit(fe("grab"))};if(c(Q),!Q.selected())ie=t.dragData.possibleDragElements=V.collection(),p(Q,{addToList:ie}),Q.emit(fe("grabon")).emit(fe("grab"));else{ie=t.dragData.possibleDragElements=V.collection();var we=V.$(function(ge){return ge.isNode()&&ge.selected()&&t.nodeIsGrabbable(ge)});g(we,{addToList:ie}),Q.emit(fe("grabon")),we.forEach(be)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=Q,t.hoverData.downs=ne,t.hoverData.downTime=new Date().getTime()}n(Q,["mousedown","tapstart","vmousedown"],O,{x:U[0],y:U[1]}),Q==null?($[4]=1,t.data.bgActivePosistion={x:U[0],y:U[1]},t.redrawHint("select",!0),t.redraw()):Q.pannable()&&($[4]=1),ve()}$[0]=$[2]=U[0],$[1]=$[3]=U[1]}},!1);var A=a(t.container);t.registerBinding([e,A],"mousemove",function(O){var V=t.hoverData.capture;if(!(!V&&!S(O))){var Z=!1,U=t.cy,$=U.zoom(),ne=[O.clientX,O.clientY],Q=t.projectIntoViewport(ne[0],ne[1]),ie=t.hoverData.mdownPos,ve=t.hoverData.mdownGPos,Ee=t.selection,fe=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(fe=t.findNearestElement(Q[0],Q[1],!0,!1));var be=t.hoverData.last,we=t.hoverData.down,ge=[Q[0]-Ee[2],Q[1]-Ee[3]],ke=t.dragData.possibleDragElements,ze;if(ve){var mt=ne[0]-ve[0],bt=mt*mt,$e=ne[1]-ve[1],Ze=$e*$e,Qe=bt+Ze;t.hoverData.isOverThresholdDrag=ze=Qe>=t.desktopTapThreshold2}var ct=i(O);ze&&(t.hoverData.tapholdCancelled=!0);var vt=function(){var kt=t.hoverData.dragDelta=t.hoverData.dragDelta||[];kt.length===0?(kt.push(ge[0]),kt.push(ge[1])):(kt[0]+=ge[0],kt[1]+=ge[1])};Z=!0,n(fe,["mousemove","vmousemove","tapdrag"],O,{x:Q[0],y:Q[1]});var Mt=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||U.emit({originalEvent:O,type:"boxstart",position:{x:Q[0],y:Q[1]}}),Ee[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(ze){var Tt={originalEvent:O,type:"cxtdrag",position:{x:Q[0],y:Q[1]}};we?we.emit(Tt):U.emit(Tt),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||fe!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:O,type:"cxtdragout",position:{x:Q[0],y:Q[1]}}),t.hoverData.cxtOver=fe,fe&&fe.emit({originalEvent:O,type:"cxtdragover",position:{x:Q[0],y:Q[1]}}))}}else if(t.hoverData.dragging){if(Z=!0,U.panningEnabled()&&U.userPanningEnabled()){var Nt;if(t.hoverData.justStartedPan){var Yt=t.hoverData.mdownPos;Nt={x:(Q[0]-Yt[0])*$,y:(Q[1]-Yt[1])*$},t.hoverData.justStartedPan=!1}else Nt={x:ge[0]*$,y:ge[1]*$};U.panBy(Nt),U.emit("dragpan"),t.hoverData.dragged=!0}Q=t.projectIntoViewport(O.clientX,O.clientY)}else if(Ee[4]==1&&(we==null||we.pannable())){if(ze){if(!t.hoverData.dragging&&U.boxSelectionEnabled()&&(ct||!U.panningEnabled()||!U.userPanningEnabled()))Mt();else if(!t.hoverData.selecting&&U.panningEnabled()&&U.userPanningEnabled()){var $t=s(we,t.hoverData.downs);$t&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Ee[4]=0,t.data.bgActivePosistion=Br(ie),t.redrawHint("select",!0),t.redraw())}we&&we.pannable()&&we.active()&&we.unactivate()}}else{if(we&&we.pannable()&&we.active()&&we.unactivate(),(!we||!we.grabbed())&&fe!=be&&(be&&n(be,["mouseout","tapdragout"],O,{x:Q[0],y:Q[1]}),fe&&n(fe,["mouseover","tapdragover"],O,{x:Q[0],y:Q[1]}),t.hoverData.last=fe),we)if(ze){if(U.boxSelectionEnabled()&&ct)we&&we.grabbed()&&(y(ke),we.emit("freeon"),ke.emit("free"),t.dragData.didDrag&&(we.emit("dragfreeon"),ke.emit("dragfree"))),Mt();else if(we&&we.grabbed()&&t.nodeIsDraggable(we)){var it=!t.dragData.didDrag;it&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||g(ke,{inDragLayer:!0});var Je={x:0,y:0};if(re(ge[0])&&re(ge[1])&&(Je.x+=ge[0],Je.y+=ge[1],it)){var gt=t.hoverData.dragDelta;gt&&re(gt[0])&&re(gt[1])&&(Je.x+=gt[0],Je.y+=gt[1])}t.hoverData.draggingEles=!0,ke.silentShift(Je).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else vt();Z=!0}if(Ee[2]=Q[0],Ee[3]=Q[1],Z)return O.stopPropagation&&O.stopPropagation(),O.preventDefault&&O.preventDefault(),!1}},!1);var L,I,R;t.registerBinding(e,"mouseup",function(O){if(!(t.hoverData.which===1&&O.which!==1&&t.hoverData.capture)){var V=t.hoverData.capture;if(V){t.hoverData.capture=!1;var Z=t.cy,U=t.projectIntoViewport(O.clientX,O.clientY),$=t.selection,ne=t.findNearestElement(U[0],U[1],!0,!1),Q=t.dragData.possibleDragElements,ie=t.hoverData.down,ve=i(O);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ie&&ie.unactivate(),t.hoverData.which===3){var Ee={originalEvent:O,type:"cxttapend",position:{x:U[0],y:U[1]}};if(ie?ie.emit(Ee):Z.emit(Ee),!t.hoverData.cxtDragged){var fe={originalEvent:O,type:"cxttap",position:{x:U[0],y:U[1]}};ie?ie.emit(fe):Z.emit(fe)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(n(ne,["mouseup","tapend","vmouseup"],O,{x:U[0],y:U[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(n(ie,["click","tap","vclick"],O,{x:U[0],y:U[1]}),I=!1,O.timeStamp-R<=Z.multiClickDebounceTime()?(L&&clearTimeout(L),I=!0,R=null,n(ie,["dblclick","dbltap","vdblclick"],O,{x:U[0],y:U[1]})):(L=setTimeout(function(){I||n(ie,["oneclick","onetap","voneclick"],O,{x:U[0],y:U[1]})},Z.multiClickDebounceTime()),R=O.timeStamp)),ie==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!i(O)&&(Z.$(r).unselect(["tapunselect"]),Q.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=Q=Z.collection()),ne==ie&&!t.dragData.didDrag&&!t.hoverData.selecting&&ne!=null&&ne._private.selectable&&(t.hoverData.dragging||(Z.selectionType()==="additive"||ve?ne.selected()?ne.unselect(["tapunselect"]):ne.select(["tapselect"]):ve||(Z.$(r).unmerge(ne).unselect(["tapunselect"]),ne.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var be=Z.collection(t.getAllInBox($[0],$[1],$[2],$[3]));t.redrawHint("select",!0),be.length>0&&t.redrawHint("eles",!0),Z.emit({type:"boxend",originalEvent:O,position:{x:U[0],y:U[1]}});var we=function(ze){return ze.selectable()&&!ze.selected()};Z.selectionType()==="additive"||ve||Z.$(r).unmerge(be).unselect(),be.emit("box").stdFilter(we).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!$[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var ge=ie&&ie.grabbed();y(Q),ge&&(ie.emit("freeon"),Q.emit("free"),t.dragData.didDrag&&(ie.emit("dragfreeon"),Q.emit("dragfree")))}}$[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=function(O){if(!t.scrollingPage){var V=t.cy,Z=V.zoom(),U=V.pan(),$=t.projectIntoViewport(O.clientX,O.clientY),ne=[$[0]*Z+U.x,$[1]*Z+U.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||E()){O.preventDefault();return}if(V.panningEnabled()&&V.userPanningEnabled()&&V.zoomingEnabled()&&V.userZoomingEnabled()){O.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 Q;O.deltaY!=null?Q=O.deltaY/-250:O.wheelDeltaY!=null?Q=O.wheelDeltaY/1e3:Q=O.wheelDelta/1e3,Q=Q*t.wheelSensitivity;var ie=O.deltaMode===1;ie&&(Q*=33);var ve=V.zoom()*Math.pow(10,Q);O.type==="gesturechange"&&(ve=t.gestureStartZoom*O.scale),V.zoom({level:ve,renderedPosition:{x:ne[0],y:ne[1]}}),V.emit(O.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",P,!0),t.registerBinding(e,"scroll",function(O){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(O){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||O.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(ee){t.hasTouchStarted||P(ee)},!0),t.registerBinding(t.container,"mouseout",function(O){var V=t.projectIntoViewport(O.clientX,O.clientY);t.cy.emit({originalEvent:O,type:"mouseout",position:{x:V[0],y:V[1]}})},!1),t.registerBinding(t.container,"mouseover",function(O){var V=t.projectIntoViewport(O.clientX,O.clientY);t.cy.emit({originalEvent:O,type:"mouseover",position:{x:V[0],y:V[1]}})},!1);var M,k,N,B,z,F,G,H,X,K,q,J,j,Y=function(O,V,Z,U){return Math.sqrt((Z-O)*(Z-O)+(U-V)*(U-V))},_=function(O,V,Z,U){return(Z-O)*(Z-O)+(U-V)*(U-V)},W;t.registerBinding(t.container,"touchstart",W=function(O){if(t.hasTouchStarted=!0,!!S(O)){m(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var V=t.cy,Z=t.touchData.now,U=t.touchData.earlier;if(O.touches[0]){var $=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);Z[0]=$[0],Z[1]=$[1]}if(O.touches[1]){var $=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);Z[2]=$[0],Z[3]=$[1]}if(O.touches[2]){var $=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);Z[4]=$[0],Z[5]=$[1]}if(O.touches[1]){t.touchData.singleTouchMoved=!0,y(t.dragData.touchDragEles);var ne=t.findContainerClientCoords();X=ne[0],K=ne[1],q=ne[2],J=ne[3],M=O.touches[0].clientX-X,k=O.touches[0].clientY-K,N=O.touches[1].clientX-X,B=O.touches[1].clientY-K,j=0<=M&&M<=q&&0<=N&&N<=q&&0<=k&&k<=J&&0<=B&&B<=J;var Q=V.pan(),ie=V.zoom();z=Y(M,k,N,B),F=_(M,k,N,B),G=[(M+N)/2,(k+B)/2],H=[(G[0]-Q.x)/ie,(G[1]-Q.y)/ie];var ve=200,Ee=ve*ve;if(F<Ee&&!O.touches[2]){var fe=t.findNearestElement(Z[0],Z[1],!0,!0),be=t.findNearestElement(Z[2],Z[3],!0,!0);fe&&fe.isNode()?(fe.activate().emit({originalEvent:O,type:"cxttapstart",position:{x:Z[0],y:Z[1]}}),t.touchData.start=fe):be&&be.isNode()?(be.activate().emit({originalEvent:O,type:"cxttapstart",position:{x:Z[0],y:Z[1]}}),t.touchData.start=be):V.emit({originalEvent:O,type:"cxttapstart",position:{x:Z[0],y:Z[1]}}),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(O.touches[2])V.boxSelectionEnabled()&&O.preventDefault();else if(!O.touches[1]){if(O.touches[0]){var we=t.findNearestElements(Z[0],Z[1],!0,!0),ge=we[0];if(ge!=null&&(ge.activate(),t.touchData.start=ge,t.touchData.starts=we,t.nodeIsGrabbable(ge))){var ke=t.dragData.touchDragEles=V.collection(),ze=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),ge.selected()?(ze=V.$(function(Qe){return Qe.selected()&&t.nodeIsGrabbable(Qe)}),g(ze,{addToList:ke})):p(ge,{addToList:ke}),c(ge);var mt=function(ct){return{originalEvent:O,type:ct,position:{x:Z[0],y:Z[1]}}};ge.emit(mt("grabon")),ze?ze.forEach(function(Qe){Qe.emit(mt("grab"))}):ge.emit(mt("grab"))}n(ge,["touchstart","tapstart","vmousedown"],O,{x:Z[0],y:Z[1]}),ge==null&&(t.data.bgActivePosistion={x:$[0],y:$[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"],O,{x:Z[0],y:Z[1]})},t.tapholdDuration)}}if(O.touches.length>=1){for(var bt=t.touchData.startPosition=[null,null,null,null,null,null],$e=0;$e<Z.length;$e++)bt[$e]=U[$e]=Z[$e];var Ze=O.touches[0];t.touchData.startGPosition=[Ze.clientX,Ze.clientY]}}},!1);var te;t.registerBinding(e,"touchmove",te=function(O){var V=t.touchData.capture;if(!(!V&&!S(O))){var Z=t.selection,U=t.cy,$=t.touchData.now,ne=t.touchData.earlier,Q=U.zoom();if(O.touches[0]){var ie=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);$[0]=ie[0],$[1]=ie[1]}if(O.touches[1]){var ie=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);$[2]=ie[0],$[3]=ie[1]}if(O.touches[2]){var ie=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);$[4]=ie[0],$[5]=ie[1]}var ve=t.touchData.startGPosition,Ee;if(V&&O.touches[0]&&ve){for(var fe=[],be=0;be<$.length;be++)fe[be]=$[be]-ne[be];var we=O.touches[0].clientX-ve[0],ge=we*we,ke=O.touches[0].clientY-ve[1],ze=ke*ke,mt=ge+ze;Ee=mt>=t.touchTapThreshold2}if(V&&t.touchData.cxt){O.preventDefault();var bt=O.touches[0].clientX-X,$e=O.touches[0].clientY-K,Ze=O.touches[1].clientX-X,Qe=O.touches[1].clientY-K,ct=_(bt,$e,Ze,Qe),vt=ct/F,Mt=150,Tt=Mt*Mt,Nt=1.5,Yt=Nt*Nt;if(vt>=Yt||ct>=Tt){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var $t={originalEvent:O,type:"cxttapend",position:{x:$[0],y:$[1]}};t.touchData.start?(t.touchData.start.unactivate().emit($t),t.touchData.start=null):U.emit($t)}}if(V&&t.touchData.cxt){var $t={originalEvent:O,type:"cxtdrag",position:{x:$[0],y:$[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit($t):U.emit($t),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var it=t.findNearestElement($[0],$[1],!0,!0);(!t.touchData.cxtOver||it!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:O,type:"cxtdragout",position:{x:$[0],y:$[1]}}),t.touchData.cxtOver=it,it&&it.emit({originalEvent:O,type:"cxtdragover",position:{x:$[0],y:$[1]}}))}else if(V&&O.touches[2]&&U.boxSelectionEnabled())O.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||U.emit({originalEvent:O,type:"boxstart",position:{x:$[0],y:$[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,Z[4]=1,!Z||Z.length===0||Z[0]===void 0?(Z[0]=($[0]+$[2]+$[4])/3,Z[1]=($[1]+$[3]+$[5])/3,Z[2]=($[0]+$[2]+$[4])/3+1,Z[3]=($[1]+$[3]+$[5])/3+1):(Z[2]=($[0]+$[2]+$[4])/3,Z[3]=($[1]+$[3]+$[5])/3),t.redrawHint("select",!0),t.redraw();else if(V&&O.touches[1]&&!t.touchData.didSelect&&U.zoomingEnabled()&&U.panningEnabled()&&U.userZoomingEnabled()&&U.userPanningEnabled()){O.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Je=t.dragData.touchDragEles;if(Je){t.redrawHint("drag",!0);for(var gt=0;gt<Je.length;gt++){var Va=Je[gt]._private;Va.grabbed=!1,Va.rscratch.inDragLayer=!1}}var kt=t.touchData.start,bt=O.touches[0].clientX-X,$e=O.touches[0].clientY-K,Ze=O.touches[1].clientX-X,Qe=O.touches[1].clientY-K,rs=Y(bt,$e,Ze,Qe),Du=rs/z;if(j){var Su=bt-M,Au=$e-k,Lu=Ze-N,Ru=Qe-B,Iu=(Su+Lu)/2,Ou=(Au+Ru)/2,ra=U.zoom(),$n=ra*Du,Ua=U.pan(),as=H[0]*ra+Ua.x,ns=H[1]*ra+Ua.y,Pu={x:-$n/ra*(as-Ua.x-Iu)+as,y:-$n/ra*(ns-Ua.y-Ou)+ns};if(kt&&kt.active()){var Je=t.dragData.touchDragEles;y(Je),t.redrawHint("drag",!0),t.redrawHint("eles",!0),kt.unactivate().emit("freeon"),Je.emit("free"),t.dragData.didDrag&&(kt.emit("dragfreeon"),Je.emit("dragfree"))}U.viewport({zoom:$n,pan:Pu,cancelOnFailedZoom:!0}),U.emit("pinchzoom"),z=rs,M=bt,k=$e,N=Ze,B=Qe,t.pinching=!0}if(O.touches[0]){var ie=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);$[0]=ie[0],$[1]=ie[1]}if(O.touches[1]){var ie=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);$[2]=ie[0],$[3]=ie[1]}if(O.touches[2]){var ie=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);$[4]=ie[0],$[5]=ie[1]}}else if(O.touches[0]&&!t.touchData.didSelect){var At=t.touchData.start,Hn=t.touchData.last,it;if(!t.hoverData.draggingEles&&!t.swipePanning&&(it=t.findNearestElement($[0],$[1],!0,!0)),V&&At!=null&&O.preventDefault(),V&&At!=null&&t.nodeIsDraggable(At))if(Ee){var Je=t.dragData.touchDragEles,is=!t.dragData.didDrag;is&&g(Je,{inDragLayer:!0}),t.dragData.didDrag=!0;var aa={x:0,y:0};if(re(fe[0])&&re(fe[1])&&(aa.x+=fe[0],aa.y+=fe[1],is)){t.redrawHint("eles",!0);var Lt=t.touchData.dragDelta;Lt&&re(Lt[0])&&re(Lt[1])&&(aa.x+=Lt[0],aa.y+=Lt[1])}t.hoverData.draggingEles=!0,Je.silentShift(aa).emit("position drag"),t.redrawHint("drag",!0),t.touchData.startPosition[0]==ne[0]&&t.touchData.startPosition[1]==ne[1]&&t.redrawHint("eles",!0),t.redraw()}else{var Lt=t.touchData.dragDelta=t.touchData.dragDelta||[];Lt.length===0?(Lt.push(fe[0]),Lt.push(fe[1])):(Lt[0]+=fe[0],Lt[1]+=fe[1])}if(n(At||it,["touchmove","tapdrag","vmousemove"],O,{x:$[0],y:$[1]}),(!At||!At.grabbed())&&it!=Hn&&(Hn&&Hn.emit({originalEvent:O,type:"tapdragout",position:{x:$[0],y:$[1]}}),it&&it.emit({originalEvent:O,type:"tapdragover",position:{x:$[0],y:$[1]}})),t.touchData.last=it,V)for(var gt=0;gt<$.length;gt++)$[gt]&&t.touchData.startPosition[gt]&&Ee&&(t.touchData.singleTouchMoved=!0);if(V&&(At==null||At.pannable())&&U.panningEnabled()&&U.userPanningEnabled()){var Mu=s(At,t.touchData.starts);Mu&&(O.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=Br(t.touchData.startPosition)),t.swipePanning?(U.panBy({x:fe[0]*Q,y:fe[1]*Q}),U.emit("dragpan")):Ee&&(t.swipePanning=!0,U.panBy({x:we*Q,y:ke*Q}),U.emit("dragpan"),At&&(At.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var ie=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);$[0]=ie[0],$[1]=ie[1]}}for(var be=0;be<$.length;be++)ne[be]=$[be];V&&O.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 ae;t.registerBinding(e,"touchcancel",ae=function(O){var V=t.touchData.start;t.touchData.capture=!1,V&&V.unactivate()});var se,Ce,Oe,Pe;if(t.registerBinding(e,"touchend",se=function(O){var V=t.touchData.start,Z=t.touchData.capture;if(Z)O.touches.length===0&&(t.touchData.capture=!1),O.preventDefault();else return;var U=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var $=t.cy,ne=$.zoom(),Q=t.touchData.now,ie=t.touchData.earlier;if(O.touches[0]){var ve=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);Q[0]=ve[0],Q[1]=ve[1]}if(O.touches[1]){var ve=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);Q[2]=ve[0],Q[3]=ve[1]}if(O.touches[2]){var ve=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);Q[4]=ve[0],Q[5]=ve[1]}V&&V.unactivate();var Ee;if(t.touchData.cxt){if(Ee={originalEvent:O,type:"cxttapend",position:{x:Q[0],y:Q[1]}},V?V.emit(Ee):$.emit(Ee),!t.touchData.cxtDragged){var fe={originalEvent:O,type:"cxttap",position:{x:Q[0],y:Q[1]}};V?V.emit(fe):$.emit(fe)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!O.touches[2]&&$.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var be=$.collection(t.getAllInBox(U[0],U[1],U[2],U[3]));U[0]=void 0,U[1]=void 0,U[2]=void 0,U[3]=void 0,U[4]=0,t.redrawHint("select",!0),$.emit({type:"boxend",originalEvent:O,position:{x:Q[0],y:Q[1]}});var we=function(Tt){return Tt.selectable()&&!Tt.selected()};be.emit("box").stdFilter(we).select().emit("boxselect"),be.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(V!=null&&V.unactivate(),O.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!O.touches[1]){if(!O.touches[0]){if(!O.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ge=t.dragData.touchDragEles;if(V!=null){var ke=V._private.grabbed;y(ge),t.redrawHint("drag",!0),t.redrawHint("eles",!0),ke&&(V.emit("freeon"),ge.emit("free"),t.dragData.didDrag&&(V.emit("dragfreeon"),ge.emit("dragfree"))),n(V,["touchend","tapend","vmouseup","tapdragout"],O,{x:Q[0],y:Q[1]}),V.unactivate(),t.touchData.start=null}else{var ze=t.findNearestElement(Q[0],Q[1],!0,!0);n(ze,["touchend","tapend","vmouseup","tapdragout"],O,{x:Q[0],y:Q[1]})}var mt=t.touchData.startPosition[0]-Q[0],bt=mt*mt,$e=t.touchData.startPosition[1]-Q[1],Ze=$e*$e,Qe=bt+Ze,ct=Qe*ne*ne;t.touchData.singleTouchMoved||(V||$.$(":selected").unselect(["tapunselect"]),n(V,["tap","vclick"],O,{x:Q[0],y:Q[1]}),Ce=!1,O.timeStamp-Pe<=$.multiClickDebounceTime()?(Oe&&clearTimeout(Oe),Ce=!0,Pe=null,n(V,["dbltap","vdblclick"],O,{x:Q[0],y:Q[1]})):(Oe=setTimeout(function(){Ce||n(V,["onetap","voneclick"],O,{x:Q[0],y:Q[1]})},$.multiClickDebounceTime()),Pe=O.timeStamp)),V!=null&&!t.dragData.didDrag&&V._private.selectable&&ct<t.touchTapThreshold2&&!t.pinching&&($.selectionType()==="single"?($.$(r).unmerge(V).unselect(["tapunselect"]),V.select(["tapselect"])):V.selected()?V.unselect(["tapunselect"]):V.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var vt=0;vt<Q.length;vt++)ie[vt]=Q[vt];t.dragData.didDrag=!1,O.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),O.touches.length<2&&(O.touches.length===1&&(t.touchData.startGPosition=[O.touches[0].clientX,O.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var ue=[],le=function(O){return{clientX:O.clientX,clientY:O.clientY,force:1,identifier:O.pointerId,pageX:O.pageX,pageY:O.pageY,radiusX:O.width/2,radiusY:O.height/2,screenX:O.screenX,screenY:O.screenY,target:O.target}},pe=function(O){return{event:O,touch:le(O)}},ye=function(O){ue.push(pe(O))},de=function(O){for(var V=0;V<ue.length;V++){var Z=ue[V];if(Z.event.pointerId===O.pointerId){ue.splice(V,1);return}}},me=function(O){var V=ue.filter(function(Z){return Z.event.pointerId===O.pointerId})[0];V.event=O,V.touch=le(O)},xe=function(O){O.touches=ue.map(function(V){return V.touch})},De=function(O){return O.pointerType==="mouse"||O.pointerType===4};t.registerBinding(t.container,"pointerdown",function(ee){De(ee)||(ee.preventDefault(),ye(ee),xe(ee),W(ee))}),t.registerBinding(t.container,"pointerup",function(ee){De(ee)||(de(ee),xe(ee),se(ee))}),t.registerBinding(t.container,"pointercancel",function(ee){De(ee)||(de(ee),xe(ee),ae(ee))}),t.registerBinding(t.container,"pointermove",function(ee){De(ee)||(ee.preventDefault(),me(ee),xe(ee),te(ee))})}};var Kt={};Kt.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,n,i,s,o,l){this.renderer.nodeShapeImpl("polygon",a,n,i,s,o,this.points)},intersectLine:function(a,n,i,s,o,l,u,f){return Da(o,l,this.points,a,n,i/2,s/2,u)},checkPoint:function(a,n,i,s,o,l,u,f){return Wt(a,n,this.points,l,u,s,o,[0,-1],i)}}};Kt.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o,l){return qc(i,s,e,r,a/2+o,n/2+o)},checkPoint:function(e,r,a,n,i,s,o,l){return br(e,r,n,i,s,o,a)}}};Kt.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(a,n,i,s,o,l,u){if(l[u]!==void 0&&l[u+"-cx"]===a&&l[u+"-cy"]===n)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=a,l[u+"-cy"]=n;var f=i/2,c=s/2;o=o==="auto"?el(i,s):o;for(var h=new Array(e.length/2),v=0;v<e.length/2;v++)h[v]={x:a+f*e[v*2],y:n+c*e[v*2+1]};var d,g,p,y,b=h.length;for(g=h[b-1],d=0;d<b;d++)p=h[d%b],y=h[(d+1)%b],l[u][d]=Zi(g,p,y,o),g=p,p=y;return l[u]},draw:function(a,n,i,s,o,l,u){this.renderer.nodeShapeImpl("round-polygon",a,n,i,s,o,this.points,this.getOrCreateCorners(n,i,s,o,l,u,"drawCorners"))},intersectLine:function(a,n,i,s,o,l,u,f,c){return Kc(o,l,this.points,a,n,i,s,u,this.getOrCreateCorners(a,n,i,s,f,c,"corners"))},checkPoint:function(a,n,i,s,o,l,u,f,c){return Wc(a,n,this.points,l,u,s,o,this.getOrCreateCorners(l,u,s,o,f,c,"corners"))}}};Kt.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:ht(4,0),draw:function(e,r,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,s)},intersectLine:function(e,r,a,n,i,s,o,l){return Jo(i,s,e,r,a,n,o,l)},checkPoint:function(e,r,a,n,i,s,o,l){var u=n/2,f=i/2;l=l==="auto"?xr(n,i):l,l=Math.min(u,f,l);var c=l*2;return!!(Wt(e,r,this.points,s,o,n,i-c,[0,-1],a)||Wt(e,r,this.points,s,o,n-c,i,[0,-1],a)||br(e,r,c,c,s-u+l,o-f+l,a)||br(e,r,c,c,s+u-l,o-f+l,a)||br(e,r,c,c,s+u-l,o+f-l,a)||br(e,r,c,c,s-u+l,o+f-l,a))}}};Kt.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Gi(),points:ht(4,0),draw:function(e,r,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,null,s)},generateCutTrianglePts:function(e,r,a,n,i){var s=i==="auto"?this.cornerLength:i,o=r/2,l=e/2,u=a-l,f=a+l,c=n-o,h=n+o;return{topLeft:[u,c+s,u+s,c,u+s,c+s],topRight:[f-s,c,f,c+s,f-s,c+s],bottomRight:[f,h-s,f-s,h,f-s,h-s],bottomLeft:[u+s,h,u,h-s,u+s,h-s]}},intersectLine:function(e,r,a,n,i,s,o,l){var u=this.generateCutTrianglePts(a+2*o,n+2*o,e,r,l),f=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return Da(i,s,f,e,r)},checkPoint:function(e,r,a,n,i,s,o,l){var u=l==="auto"?this.cornerLength:l;if(Wt(e,r,this.points,s,o,n,i-2*u,[0,-1],a)||Wt(e,r,this.points,s,o,n-2*u,i,[0,-1],a))return!0;var f=this.generateCutTrianglePts(n,i,s,o);return pt(e,r,f.topLeft)||pt(e,r,f.topRight)||pt(e,r,f.bottomRight)||pt(e,r,f.bottomLeft)}}};Kt.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:ht(4,0),draw:function(e,r,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o,l){var u=.15,f=.5,c=.85,h=this.generateBarrelBezierPts(a+2*o,n+2*o,e,r),v=function(p){var y=Gr({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},u),b=Gr({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},f),m=Gr({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},c);return[p[0],p[1],y.x,y.y,b.x,b.y,m.x,m.y,p[4],p[5]]},d=[].concat(v(h.topLeft),v(h.topRight),v(h.bottomRight),v(h.bottomLeft));return Da(i,s,d,e,r)},generateBarrelBezierPts:function(e,r,a,n){var i=r/2,s=e/2,o=a-s,l=a+s,u=n-i,f=n+i,c=vi(e,r),h=c.heightOffset,v=c.widthOffset,d=c.ctrlPtOffsetPct*e,g={topLeft:[o,u+h,o+d,u,o+v,u],topRight:[l-v,u,l-d,u,l,u+h],bottomRight:[l,f-h,l-d,f,l-v,f],bottomLeft:[o+v,f,o+d,f,o,f-h]};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,s,o,l){var u=vi(n,i),f=u.heightOffset,c=u.widthOffset;if(Wt(e,r,this.points,s,o,n,i-2*f,[0,-1],a)||Wt(e,r,this.points,s,o,n-2*c,i,[0,-1],a))return!0;for(var h=this.generateBarrelBezierPts(n,i,s,o),v=function(x,E,S){var A=S[4],L=S[2],I=S[0],R=S[5],P=S[1],M=Math.min(A,I),k=Math.max(A,I),N=Math.min(R,P),B=Math.max(R,P);if(M<=x&&x<=k&&N<=E&&E<=B){var z=Zc(A,L,I),F=Yc(z[0],z[1],z[2],x),G=F.filter(function(H){return 0<=H&&H<=1});if(G.length>0)return G[0]}return null},d=Object.keys(h),g=0;g<d.length;g++){var p=d[g],y=h[p],b=v(e,r,y);if(b!=null){var m=y[5],T=y[3],C=y[1],D=je(m,T,C,b);if(y.isTop&&D<=r||y.isBottom&&r<=D)return!0}}return!1}}};Kt.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:ht(4,0),draw:function(e,r,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,s)},intersectLine:function(e,r,a,n,i,s,o,l){var u=e-(a/2+o),f=r-(n/2+o),c=f,h=e+(a/2+o),v=er(i,s,e,r,u,f,h,c,!1);return v.length>0?v:Jo(i,s,e,r,a,n,o,l)},checkPoint:function(e,r,a,n,i,s,o,l){l=l==="auto"?xr(n,i):l;var u=2*l;if(Wt(e,r,this.points,s,o,n,i-u,[0,-1],a)||Wt(e,r,this.points,s,o,n-u,i,[0,-1],a))return!0;var f=n/2+2*a,c=i/2+2*a,h=[s-f,o-c,s-f,o,s+f,o,s+f,o-c];return!!(pt(e,r,h)||br(e,r,u,u,s+n/2-l,o+i/2-l,a)||br(e,r,u,u,s-n/2+l,o+i/2-l,a))}}};Kt.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",ht(3,0)),this.generateRoundPolygon("round-triangle",ht(3,0)),this.generatePolygon("rectangle",ht(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",ht(5,0)),this.generateRoundPolygon("round-pentagon",ht(5,0)),this.generatePolygon("hexagon",ht(6,0)),this.generateRoundPolygon("round-hexagon",ht(6,0)),this.generatePolygon("heptagon",ht(7,0)),this.generateRoundPolygon("round-heptagon",ht(7,0)),this.generatePolygon("octagon",ht(8,0)),this.generateRoundPolygon("round-octagon",ht(8,0));var a=new Array(20);{var n=ci(5,0),i=ci(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<i.length/2;o++)i[o*2]*=s,i[o*2+1]*=s;for(var o=0;o<20/4;o++)a[o*4]=n[o*2],a[o*4+1]=n[o*2+1],a[o*4+2]=i[o*2],a[o*4+3]=i[o*2+1]}a=jo(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 l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l)}t.makePolygon=function(u){var f=u.join("$"),c="polygon-"+f,h;return(h=this[c])?h:e.generatePolygon(c,u)}};var za={};za.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};za.redraw=function(t){t=t||Wo();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};za.beforeRender=function(t,e){if(!this.destroyed){e==null&&_e("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 fo=function(e,r,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(r,a)};za.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function a(n){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){fo(t,!0,n);var i=Xt();t.render(t.renderOptions);var s=t.lastDrawTime=Xt();t.averageRedrawTime===void 0&&(t.averageRedrawTime=s-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var o=s-i;t.redrawTotalTime+=o,t.lastRedrawTime=o,t.averageRedrawTime=t.averageRedrawTime/2+o/2,t.requestedFrame=!1}else fo(t,!1,n);t.skipFrame=!1,pn(a)}};pn(r)}};var Op=function(e){this.init(e)},Jl=Op,ea=Jl.prototype;ea.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];ea.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,s="__________cytoscape_stylesheet",o="__________cytoscape_container",l=n.getElementById(s)!=null;if(r.className.indexOf(o)<0&&(r.className=(r.className||"")+" "+o),!l){var u=n.createElement("style");u.id=s,u.textContent="."+o+" { position: relative; }",i.insertBefore(u,i.children[0])}var f=a.getComputedStyle(r),c=f.getPropertyValue("position");c==="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()};ea.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()}};ea.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,n=a.target;(n.off||n.removeEventListener).apply(n,a.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{}};ea.isHeadless=function(){return!1};[Ki,Zl,Ql,jr,Kt,za].forEach(function(t){he(ea,t)});var ri=1e3/60,jl={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=Na(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),s=function(u,f){var c=Xt(),h=n.averageRedrawTime,v=n.lastRedrawTime,d=[],g=n.cy.extent(),p=n.getPixelRatio();for(u||n.flushRenderedStyleQueue();;){var y=Xt(),b=y-c,m=y-f;if(v<ri){var T=ri-(u?h:0);if(m>=e.deqFastCost*T)break}else if(u){if(b>=e.deqCost*v||b>=e.deqAvgCost*h)break}else if(m>=e.deqNoDrawCost*ri)break;var C=e.deq(a,p,g);if(C.length>0)for(var D=0;D<C.length;D++)d.push(C[D]);else break}d.length>0&&(e.onDeqd(a,d),!u&&e.shouldRedraw(a,d,p,g)&&i())},o=e.priority||Ni;n.beforeRender(s,o(a))}}}},Pp=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yn;fr(this,t),this.idsByKey=new zt,this.keyForId=new zt,this.cachesByLvl=new zt,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return cr(t,[{key:"getIdsFor",value:function(r){r==null&&_e("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new Xr,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(),n=this.keyForId.get(a),i=this.getKey(r);return n!==i}},{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 zt,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()),i=this.getCache(n,a);return i}},{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}}]),t}(),co=25,en=50,vn=-4,Ti=3,eu=7.99,Mp=8,Np=1024,kp=1024,Bp=1024,Fp=.2,Gp=.8,zp=10,_p=.15,Vp=.1,Up=.9,Yp=.9,$p=100,Hp=1,Fr={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Xp=et({getKey:null,doesEleInvalidateKey:yn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:$o,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ga=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=Xp(r);he(a,n),a.lookup=new Pp(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},Ke=ga.prototype;Ke.reasons=Fr;Ke.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Ke.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};Ke.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new ka(function(r,a){return a.reqs-r.reqs});return e};Ke.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Ke.getElement=function(t,e,r,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),l=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(Bi(o*r))),a<vn)a=vn;else if(o>=eu||a>Ti)return null;var u=Math.pow(2,a),f=e.h*u,c=e.w*u,h=s.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,h))return null;var v=l.get(t,a);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;var d;if(f<=co?d=co:f<=en?d=en:d=Math.ceil(f/en)*en,f>Bp||c>kp)return null;var g=i.getTextureQueue(d),p=g[g.length-2],y=function(){return i.recycleTexture(d,c)||i.addTexture(d,c)};p||(p=g[g.length-1]),p||(p=y()),p.width-p.usedWidth<c&&(p=y());for(var b=function(M){return M&&M.scaledLabelShown===h},m=n&&n===Fr.dequeue,T=n&&n===Fr.highQuality,C=n&&n===Fr.downscale,D,w=a+1;w<=Ti;w++){var x=l.get(t,w);if(x){D=x;break}}var E=D&&D.level===a+1?D:null,S=function(){p.context.drawImage(E.texture.canvas,E.x,0,E.width,E.height,p.usedWidth,0,c,f)};if(p.context.setTransform(1,0,0,1,0,0),p.context.clearRect(p.usedWidth,0,c,d),b(E))S();else if(b(D))if(T){for(var A=D.level;A>a;A--)E=i.getElement(t,e,r,A,Fr.downscale);S()}else return i.queueElement(t,D.level-1),D;else{var L;if(!m&&!T&&!C)for(var I=a-1;I>=vn;I--){var R=l.get(t,I);if(R){L=R;break}}if(b(L))return i.queueElement(t,a),L;p.context.translate(p.usedWidth,0),p.context.scale(u,u),this.drawElement(p.context,t,e,h,!1),p.context.scale(1/u,1/u),p.context.translate(-p.usedWidth,0)}return v={x:p.usedWidth,texture:p,level:a,scale:u,width:c,height:f,scaledLabelShown:h},p.usedWidth+=Math.ceil(c+Mp),p.eleCaches.push(v),l.set(t,a,v),i.checkTextureFullness(p),v};Ke.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};Ke.invalidateElement=function(t){var e=this,r=e.lookup,a=[],n=r.isInvalid(t);if(n){for(var i=vn;i<=Ti;i++){var s=r.getForCachedKey(t,i);s&&a.push(s)}var o=r.invalidate(t);if(o)for(var l=0;l<a.length;l++){var u=a[l],f=u.texture;f.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(t)}};Ke.checkTextureUtility=function(t){t.invalidatedWidth>=Fp*t.width&&this.retireTexture(t)};Ke.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>Gp&&t.fullnessChecks>=zp?ir(r,t):t.fullnessChecks++};Ke.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;ir(a,t),t.retired=!0;for(var i=t.eleCaches,s=0;s<i.length;s++){var o=i[s];n.deleteCache(o.key,o.level)}ki(i);var l=e.getRetiredTextureQueue(r);l.push(t)};Ke.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(Np,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};Ke.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),n=r.getRetiredTextureQueue(t),i=0;i<n.length;i++){var s=n[i];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,ki(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),ir(n,s),a.push(s),s}};Ke.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,a.updateItem(s);else{var o={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(o),n[i]=o}};Ke.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s<Hp&&r.size()>0;s++){var o=r.pop(),l=o.key,u=o.eles[0],f=i.hasCache(u,o.level);if(a[l]=null,f)continue;n.push(o);var c=e.getBoundingBox(u);e.getElement(u,c,t,o.level,Fr.dequeue)}return n};Ke.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=Mi,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))};Ke.onDequeue=function(t){this.onDequeues.push(t)};Ke.offDequeue=function(t){ir(this.onDequeues,t)};Ke.setupDequeueing=jl.setupDequeueing({deqRedrawThreshold:$p,deqCost:_p,deqAvgCost:Vp,deqNoDrawCost:Up,deqFastCost:Yp,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 s=r[i].eles,o=0;o<s.length;o++){var l=s[o].boundingBox();if(Fi(l,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Wp=1,ya=-4,Dn=2,qp=3.99,Kp=50,Zp=50,Qp=.15,Jp=.1,jp=.9,ey=.9,ty=1,vo=250,ry=4e3*4e3,ho=32767,ay=!0,tu=function(e){var r=this,a=r.renderer=e,n=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=Xt()-2*vo,r.skipping=!1,r.eleTxrDeqs=n.collection(),r.scheduleElementRefinement=Na(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},Zp),a.beforeRender(function(s,o){o-r.lastInvalidationTime<=vo?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(o,l){return l.reqs-o.reqs};r.layersQueue=new ka(i),r.setupDequeueing()},nt=tu.prototype,go=0,ny=Math.pow(2,53)-1;nt.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),s={id:go=++go%ny,bb:t,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,l=-s.bb.x1,u=-s.bb.y1;return o.scale(r,r),o.translate(l,u),s};nt.getLayers=function(t,e,r){var a=this,n=a.renderer,i=n.cy,s=i.zoom(),o=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil(Bi(s*e)),r<ya)r=ya;else if(s>=qp||r>Dn)return null}a.validateLayersElesOrdering(r,t);var l=a.layersByLevel,u=Math.pow(2,r),f=l[r]=l[r]||[],c,h=a.levelIsComplete(r,t),v,d=function(){var S=function(P){if(a.validateLayersElesOrdering(P,t),a.levelIsComplete(P,t))return v=l[P],!0},A=function(P){if(!v)for(var M=r+P;ya<=M&&M<=Dn&&!S(M);M+=P);};A(1),A(-1);for(var L=f.length-1;L>=0;L--){var I=f[L];I.invalid&&ir(f,I)}};if(!h)d();else return f;var g=function(){if(!c){c=yt();for(var S=0;S<t.length;S++)Zo(c,t[S].boundingBox())}return c},p=function(S){S=S||{};var A=S.after;g();var L=Math.ceil(c.w*u),I=Math.ceil(c.h*u);if(L>ho||I>ho)return null;var R=L*I;if(R>ry)return null;var P=a.makeLayer(c,r);if(A!=null){var M=f.indexOf(A)+1;f.splice(M,0,P)}else(S.insert===void 0||S.insert)&&f.unshift(P);return P};if(a.skipping&&!o)return null;for(var y=null,b=t.length/Wp,m=!o,T=0;T<t.length;T++){var C=t[T],D=C._private.rscratch,w=D.imgLayerCaches=D.imgLayerCaches||{},x=w[r];if(x){y=x;continue}if((!y||y.eles.length>=b||!Qo(y.bb,C.boundingBox()))&&(y=p({insert:!0,after:y}),!y))return null;v||m?a.queueLayer(y,C):a.drawEleInLayer(y,C,r,e),y.eles.push(C),w[r]=y}return v||(m?null:f)};nt.getEleLevelForLayerLevel=function(t,e){return t};nt.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,s=t.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,r,ay),i.setImgSmoothing(s,!0))};nt.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var s=a[i];if(s.reqs>0||s.invalid)return!1;n+=s.eles.length}return n===e.length};nt.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,s=0;s<e.length;s++)if(n.eles[0]===e[s]){i=s;break}if(i<0){this.invalidateLayer(n);continue}for(var o=i,s=0;s<n.eles.length;s++)if(n.eles[s]!==e[o+s]){this.invalidateLayer(n);break}}};nt.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],s=a?t[n]:t[n].ele,o=s._private.rscratch,l=o.imgLayerCaches=o.imgLayerCaches||{},u=ya;u<=Dn;u++){var f=l[u];f&&(i&&r.getEleLevelForLayerLevel(f.level)!==i.level||e(f,s,i))}};nt.haveLayers=function(){for(var t=this,e=!1,r=ya;r<=Dn;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e};nt.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Xt(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))};nt.invalidateLayer=function(t){if(this.lastInvalidationTime=Xt(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];ir(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)}}};nt.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,n,i){var s=a.replacement;if(s||(s=a.replacement=e.makeLayer(a.bb,a.level),s.replaces=a,s.eles=a.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)e.queueLayer(s,s.eles[o])})};nt.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};nt.queueLayer=function(t,e){var r=this,a=r.layersQueue,n=t.elesQueue,i=n.hasId=n.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,a.updateItem(t)):(t.reqs=1,a.push(t))}};nt.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],n=0;n<ty&&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 s=i.elesQueue.shift();s&&(e.drawEleInLayer(i,s,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};nt.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 s=t.eles[i]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[t.level]=t)}e.requestRedraw()}};nt.requestRedraw=Na(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);nt.setupDequeueing=jl.setupDequeueing({deqRedrawThreshold:Kp,deqCost:Qp,deqAvgCost:Jp,deqNoDrawCost:jp,deqFastCost:ey,deq:function(e,r){return e.dequeue(r)},onDeqd:Ni,shouldRedraw:$o,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var ru={},po;function iy(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function sy(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 yo(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 s=r,o=r[0];t.moveTo(o.x,o.y);for(var n=1;n<s.length;n++){var i=s[n];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function oy(t,e,r,a,n){t.beginPath&&t.beginPath(),t.arc(r,a,n,0,Math.PI*2,!1);var i=e,s=i[0];t.moveTo(s.x,s.y);for(var o=0;o<i.length;o++){var l=i[o];t.lineTo(l.x,l.y)}t.closePath&&t.closePath()}function ly(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}ru.arrowShapeImpl=function(t){return(po||(po={polygon:iy,"triangle-backcurve":sy,"triangle-tee":yo,"circle-triangle":oy,"triangle-cross":yo,circle:ly}))[t]};var Ut={};Ut.drawElement=function(t,e,r,a,n,i){var s=this;e.isNode()?s.drawNode(t,e,r,a,n,i):s.drawEdge(t,e,r,a,n,i)};Ut.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};Ut.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};Ut.drawCachedElementPortion=function(t,e,r,a,n,i,s,o){var l=this,u=r.getBoundingBox(e);if(!(u.w===0||u.h===0)){var f=r.getElement(e,u,a,n,i);if(f!=null){var c=o(l,e);if(c===0)return;var h=s(l,e),v=u.x1,d=u.y1,g=u.w,p=u.h,y,b,m,T,C;if(h!==0){var D=r.getRotationPoint(e);m=D.x,T=D.y,t.translate(m,T),t.rotate(h),C=l.getImgSmoothing(t),C||l.setImgSmoothing(t,!0);var w=r.getRotationOffset(e);y=w.x,b=w.y}else y=v,b=d;var x;c!==1&&(x=t.globalAlpha,t.globalAlpha=x*c),t.drawImage(f.texture.canvas,f.x,0,f.width,f.height,y,b,g,p),c!==1&&(t.globalAlpha=x),h!==0&&(t.rotate(-h),t.translate(-m,-T),C||l.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var uy=function(){return 0},fy=function(e,r){return e.getTextAngle(r,null)},cy=function(e,r){return e.getTextAngle(r,"source")},vy=function(e,r){return e.getTextAngle(r,"target")},hy=function(e,r){return r.effectiveOpacity()},ai=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};Ut.drawCachedElement=function(t,e,r,a,n,i){var s=this,o=s.data,l=o.eleTxrCache,u=o.lblTxrCache,f=o.slbTxrCache,c=o.tlbTxrCache,h=e.boundingBox(),v=i===!0?l.reasons.highQuality:null;if(!(h.w===0||h.h===0||!e.visible())&&(!a||Fi(h,a))){var d=e.isEdge(),g=e.element()._private.rscratch.badLine;s.drawElementUnderlay(t,e),s.drawCachedElementPortion(t,e,l,r,n,v,uy,hy),(!d||!g)&&s.drawCachedElementPortion(t,e,u,r,n,v,fy,ai),d&&!g&&(s.drawCachedElementPortion(t,e,f,r,n,v,cy,ai),s.drawCachedElementPortion(t,e,c,r,n,v,vy,ai)),s.drawElementOverlay(t,e)}};Ut.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var n=e[a];r.drawElement(t,n)}};Ut.drawCachedElements=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];n.drawCachedElement(t,s,r,a)}};Ut.drawCachedNodes=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];s.isNode()&&n.drawCachedElement(t,s,r,a)}};Ut.drawLayeredElements=function(t,e,r,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,r);if(i)for(var s=0;s<i.length;s++){var o=i[s],l=o.bb;l.w===0||l.h===0||t.drawImage(o.canvas,l.x1,l.y1,l.w,l.h)}else n.drawCachedElements(t,e,r,a)};var Zt={};Zt.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,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;r&&(l=r,t.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,c=e.pstyle("curve-style").value,h=e.pstyle("line-style").value,v=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,g=e.pstyle("line-outline-width").value,p=e.pstyle("line-outline-color").value,y=u*f,b=u*f,m=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;c==="straight-triangle"?(s.eleStrokeStyle(t,e,P),s.drawEdgeTrianglePath(e,t,o.allpts)):(t.lineWidth=v,t.lineCap=d,s.eleStrokeStyle(t,e,P),s.drawEdgePath(e,t,o.allpts,h),t.lineCap="butt")},T=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;if(t.lineWidth=v+g,t.lineCap=d,g>0)s.colorStrokeStyle(t,p[0],p[1],p[2],P);else{t.lineCap="butt";return}c==="straight-triangle"?s.drawEdgeTrianglePath(e,t,o.allpts):(s.drawEdgePath(e,t,o.allpts,h),t.lineCap="butt")},C=function(){n&&s.drawEdgeOverlay(t,e)},D=function(){n&&s.drawEdgeUnderlay(t,e)},w=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;s.drawArrowheads(t,e,P)},x=function(){s.drawElementText(t,e,null,a)};t.lineJoin="round";var E=e.pstyle("ghost").value==="yes";if(E){var S=e.pstyle("ghost-offset-x").pfValue,A=e.pstyle("ghost-offset-y").pfValue,L=e.pstyle("ghost-opacity").value,I=y*L;t.translate(S,A),m(I),w(I),t.translate(-S,-A)}else T();D(),m(),w(),C(),x(),r&&t.translate(l.x1,l.y1)}};var au=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,s=i.usePaths(),o=a._private.rscratch,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=u,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,o.allpts,"solid")}}}};Zt.drawEdgeOverlay=au("overlay");Zt.drawEdgeUnderlay=au("underlay");Zt.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,s,o=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(l){var c=r.join("$"),h=n.pathCacheKey&&n.pathCacheKey===c;h?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=c,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!o&&!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 v=2;v+3<r.length;v+=4)e.quadraticCurveTo(r[v],r[v+1],r[v+2],r[v+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 g=Et(n.roundCorners),p;try{for(g.s();!(p=g.n()).done;){var y=p.value;Hl(e,y)}}catch(m){g.e(m)}finally{g.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var b=2;b+1<r.length;b+=2)e.lineTo(r[b],r[b+1]);break}e=i,l?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])};Zt.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]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/s,-i[0]/s],l=[o[0]*a/2,o[1]*a/2];e.beginPath(),e.moveTo(r[n]-l[0],r[n+1]-l[1]),e.lineTo(r[n]+l[0],r[n+1]+l[1]),e.lineTo(r[n+2],r[n+3]),e.closePath(),e.fill()}};Zt.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)};Zt.drawArrowhead=function(t,e,r,a,n,i,s){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var o=this,l=e.pstyle(r+"-arrow-shape").value;if(l!=="none"){var u=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(r+"-arrow-fill").value,c=e.pstyle("width").pfValue,h=e.pstyle(r+"-arrow-width"),v=h.value==="match-line"?c:h.pfValue;h.units==="%"&&(v*=c);var d=e.pstyle("opacity").value;s===void 0&&(s=d);var g=t.globalCompositeOperation;(s!==1||f==="hollow")&&(t.globalCompositeOperation="destination-out",o.colorFillStyle(t,255,255,255,1),o.colorStrokeStyle(t,255,255,255,1),o.drawArrowShape(e,t,u,c,l,v,a,n,i),t.globalCompositeOperation=g);var p=e.pstyle(r+"-arrow-color").value;o.colorFillStyle(t,p[0],p[1],p[2],s),o.colorStrokeStyle(t,p[0],p[1],p[2],s),o.drawArrowShape(e,t,f,c,l,v,a,n,i)}}};Zt.drawArrowShape=function(t,e,r,a,n,i,s,o,l){var u=this,f=this.usePaths()&&n!=="triangle-cross",c=!1,h,v=e,d={x:s,y:o},g=t.pstyle("arrow-scale").value,p=this.getArrowWidth(a,g),y=u.arrowShapes[n];if(f){var b=u.arrowPathCache=u.arrowPathCache||[],m=nr(n),T=b[m];T!=null?(h=e=T,c=!0):(h=e=new Path2D,b[m]=h)}c||(e.beginPath&&e.beginPath(),f?y.draw(e,1,0,{x:0,y:0},1):y.draw(e,p,l,d,a),e.closePath&&e.closePath()),e=v,f&&(e.translate(s,o),e.rotate(l),e.scale(p,p)),(r==="filled"||r==="both")&&(f?e.fill(h):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=i/(f?p:1),e.lineJoin="miter",f?e.stroke(h):e.stroke()),f&&(e.scale(1/p,1/p),e.rotate(-l),e.translate(-s,-o))};var Ji={};Ji.safeDrawImage=function(t,e,r,a,n,i,s,o,l,u){if(!(n<=0||i<=0||l<=0||u<=0))try{t.drawImage(e,r,a,n,i,s,o,l,u)}catch(f){Ie(f)}};Ji.drawInscribedImage=function(t,e,r,a,n){var i=this,s=r.position(),o=s.x,l=s.y,u=r.cy().style(),f=u.getIndexedStyle.bind(u),c=f(r,"background-fit","value",a),h=f(r,"background-repeat","value",a),v=r.width(),d=r.height(),g=r.padding()*2,p=v+(f(r,"background-width-relative-to","value",a)==="inner"?0:g),y=d+(f(r,"background-height-relative-to","value",a)==="inner"?0:g),b=r._private.rscratch,m=f(r,"background-clip","value",a),T=m==="node",C=f(r,"background-image-opacity","value",a)*n,D=f(r,"background-image-smoothing","value",a),w=r.pstyle("corner-radius").value;w!=="auto"&&(w=r.pstyle("corner-radius").pfValue);var x=e.width||e.cachedW,E=e.height||e.cachedH;(x==null||E==null)&&(document.body.appendChild(e),x=e.cachedW=e.width||e.offsetWidth,E=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var S=x,A=E;if(f(r,"background-width","value",a)!=="auto"&&(f(r,"background-width","units",a)==="%"?S=f(r,"background-width","pfValue",a)*p:S=f(r,"background-width","pfValue",a)),f(r,"background-height","value",a)!=="auto"&&(f(r,"background-height","units",a)==="%"?A=f(r,"background-height","pfValue",a)*y:A=f(r,"background-height","pfValue",a)),!(S===0||A===0)){if(c==="contain"){var L=Math.min(p/S,y/A);S*=L,A*=L}else if(c==="cover"){var L=Math.max(p/S,y/A);S*=L,A*=L}var I=o-p/2,R=f(r,"background-position-x","units",a),P=f(r,"background-position-x","pfValue",a);R==="%"?I+=(p-S)*P:I+=P;var M=f(r,"background-offset-x","units",a),k=f(r,"background-offset-x","pfValue",a);M==="%"?I+=(p-S)*k:I+=k;var N=l-y/2,B=f(r,"background-position-y","units",a),z=f(r,"background-position-y","pfValue",a);B==="%"?N+=(y-A)*z:N+=z;var F=f(r,"background-offset-y","units",a),G=f(r,"background-offset-y","pfValue",a);F==="%"?N+=(y-A)*G:N+=G,b.pathCache&&(I-=o,N-=l,o=0,l=0);var H=t.globalAlpha;t.globalAlpha=C;var X=i.getImgSmoothing(t),K=!1;if(D==="no"&&X?(i.setImgSmoothing(t,!1),K=!0):D==="yes"&&!X&&(i.setImgSmoothing(t,!0),K=!0),h==="no-repeat")T&&(t.save(),b.pathCache?t.clip(b.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,o,l,p,y,w,b),t.clip())),i.safeDrawImage(t,e,0,0,x,E,I,N,S,A),T&&t.restore();else{var q=t.createPattern(e,h);t.fillStyle=q,i.nodeShapes[i.getNodeShape(r)].draw(t,o,l,p,y,w,b),t.translate(I,N),t.fill(),t.translate(-I,-N)}t.globalAlpha=H,K&&i.setImgSmoothing(t,X)}};var Lr={};Lr.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(Bi(r*a));e=Math.pow(2,n)}var i=t.pstyle("font-size").pfValue*e,s=t.pstyle("min-zoomed-font-size").pfValue;return!(i<s)};Lr.drawElementText=function(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e);t.textAlign=l,t.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,f=e.pstyle("label"),c=e.pstyle("source-label"),h=e.pstyle("target-label");if(u||(!f||!f.value)&&(!c||!c.value)&&(!h||!h.value))return;t.textAlign="center",t.textBaseline="bottom"}var v=!r,d;r&&(d=r,t.translate(-d.x1,-d.y1)),n==null?(s.drawText(t,e,null,v,i),e.isEdge()&&(s.drawText(t,e,"source",v,i),s.drawText(t,e,"target",v,i))):s.drawText(t,e,n,v,i),r&&t.translate(d.x1,d.y1)};Lr.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};Lr.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,s=e.pstyle("font-weight").strValue,o=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+s+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],o),this.colorStrokeStyle(t,f[0],f[1],f[2],l)};function ni(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;t.beginPath(),t.moveTo(e+i,r),t.lineTo(e+a-i,r),t.quadraticCurveTo(e+a,r,e+a,r+i),t.lineTo(e+a,r+n-i),t.quadraticCurveTo(e+a,r+n,e+a-i,r+n),t.lineTo(e+i,r+n),t.quadraticCurveTo(e,r+n,e,r+n-i),t.lineTo(e,r+i),t.quadraticCurveTo(e,r,e+i,r),t.closePath(),s?t.stroke():t.fill()}Lr.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",s=t.pstyle(i+"text-rotation");if(s.strValue==="autorotate"){var o=It(n,"labelAngle",e);r=t.isEdge()?o:0}else s.strValue==="none"?r=0:r=s.pfValue;return r};Lr.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,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=It(s,"labelX",r),u=It(s,"labelY",r),f,c,h=this.getLabelText(e,r);if(h!=null&&h!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,n);var v=r?r+"-":"",d=It(s,"labelWidth",r),g=It(s,"labelHeight",r),p=e.pstyle(v+"text-margin-x").pfValue,y=e.pstyle(v+"text-margin-y").pfValue,b=e.isEdge(),m=e.pstyle("text-halign").value,T=e.pstyle("text-valign").value;b&&(m="center",T="center"),l+=p,u+=y;var C;switch(a?C=this.getTextAngle(e,r):C=0,C!==0&&(f=l,c=u,t.translate(f,c),t.rotate(C),l=0,u=0),T){case"top":break;case"center":u+=g/2;break;case"bottom":u+=g;break}var D=e.pstyle("text-background-opacity").value,w=e.pstyle("text-border-opacity").value,x=e.pstyle("text-border-width").pfValue,E=e.pstyle("text-background-padding").pfValue,S=e.pstyle("text-background-shape").strValue,A=S.indexOf("round")===0,L=2;if(D>0||x>0&&w>0){var I=l-E;switch(m){case"left":I-=d;break;case"center":I-=d/2;break}var R=u-g-E,P=d+2*E,M=g+2*E;if(D>0){var k=t.fillStyle,N=e.pstyle("text-background-color").value;t.fillStyle="rgba("+N[0]+","+N[1]+","+N[2]+","+D*o+")",A?ni(t,I,R,P,M,L):t.fillRect(I,R,P,M),t.fillStyle=k}if(x>0&&w>0){var B=t.strokeStyle,z=t.lineWidth,F=e.pstyle("text-border-color").value,G=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+F[0]+","+F[1]+","+F[2]+","+w*o+")",t.lineWidth=x,t.setLineDash)switch(G){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=x/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(A?ni(t,I,R,P,M,L,"stroke"):t.strokeRect(I,R,P,M),G==="double"){var H=x/2;A?ni(t,I+H,R+H,P-H*2,M-H*2,L,"stroke"):t.strokeRect(I+H,R+H,P-H*2,M-H*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=z,t.strokeStyle=B}}var X=2*e.pstyle("text-outline-width").pfValue;if(X>0&&(t.lineWidth=X),e.pstyle("text-wrap").value==="wrap"){var K=It(s,"labelWrapCachedLines",r),q=It(s,"labelLineHeight",r),J=d/2,j=this.getLabelJustification(e);switch(j==="auto"||(m==="left"?j==="left"?l+=-d:j==="center"&&(l+=-J):m==="center"?j==="left"?l+=-J:j==="right"&&(l+=J):m==="right"&&(j==="center"?l+=J:j==="right"&&(l+=d))),T){case"top":u-=(K.length-1)*q;break;case"center":case"bottom":u-=(K.length-1)*q;break}for(var Y=0;Y<K.length;Y++)X>0&&t.strokeText(K[Y],l,u),t.fillText(K[Y],l,u),u+=q}else X>0&&t.strokeText(h,l,u),t.fillText(h,l,u);C!==0&&(t.rotate(-C),t.translate(-f,-c))}}};var ta={};ta.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,s=this,o,l,u=e._private,f=u.rscratch,c=e.position();if(!(!re(c.x)||!re(c.y))&&!(i&&!e.visible())){var h=i?e.effectiveOpacity():1,v=s.usePaths(),d,g=!1,p=e.padding();o=e.width()+2*p,l=e.height()+2*p;var y;r&&(y=r,t.translate(-y.x1,-y.y1));for(var b=e.pstyle("background-image"),m=b.value,T=new Array(m.length),C=new Array(m.length),D=0,w=0;w<m.length;w++){var x=m[w],E=T[w]=x!=null&&x!=="none";if(E){var S=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",w);D++,C[w]=s.getCachedImage(x,S,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var A=e.pstyle("background-blacken").value,L=e.pstyle("border-width").pfValue,I=e.pstyle("background-opacity").value*h,R=e.pstyle("border-color").value,P=e.pstyle("border-style").value,M=e.pstyle("border-join").value,k=e.pstyle("border-cap").value,N=e.pstyle("border-position").value,B=e.pstyle("border-dash-pattern").pfValue,z=e.pstyle("border-dash-offset").pfValue,F=e.pstyle("border-opacity").value*h,G=e.pstyle("outline-width").pfValue,H=e.pstyle("outline-color").value,X=e.pstyle("outline-style").value,K=e.pstyle("outline-opacity").value*h,q=e.pstyle("outline-offset").value,J=e.pstyle("corner-radius").value;J!=="auto"&&(J=e.pstyle("corner-radius").pfValue);var j=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:I;s.eleFillStyle(t,e,U)},Y=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;s.colorStrokeStyle(t,R[0],R[1],R[2],U)},_=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:K;s.colorStrokeStyle(t,H[0],H[1],H[2],U)},W=function(U,$,ne,Q){var ie=s.nodePathCache=s.nodePathCache||[],ve=Yo(ne==="polygon"?ne+","+Q.join(","):ne,""+$,""+U,""+J),Ee=ie[ve],fe,be=!1;return Ee!=null?(fe=Ee,be=!0,f.pathCache=fe):(fe=new Path2D,ie[ve]=f.pathCache=fe),{path:fe,cacheHit:be}},te=e.pstyle("shape").strValue,ae=e.pstyle("shape-polygon-points").pfValue;if(v){t.translate(c.x,c.y);var se=W(o,l,te,ae);d=se.path,g=se.cacheHit}var Ce=function(){if(!g){var U=c;v&&(U={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(d||t,U.x,U.y,o,l,J,f)}v?t.fill(d):t.fill()},Oe=function(){for(var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ne=u.backgrounding,Q=0,ie=0;ie<C.length;ie++){var ve=e.cy().style().getIndexedStyle(e,"background-image-containment","value",ie);if($&&ve==="over"||!$&&ve==="inside"){Q++;continue}T[ie]&&C[ie].complete&&!C[ie].error&&(Q++,s.drawInscribedImage(t,C[ie],e,ie,U))}u.backgrounding=Q!==D,ne!==u.backgrounding&&e.updateStyle(!1)},Pe=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;s.hasPie(e)&&(s.drawPie(t,e,$),U&&(v||s.nodeShapes[s.getNodeShape(e)].draw(t,c.x,c.y,o,l,J,f)))},ue=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,$=(A>0?A:-A)*U,ne=A>0?0:255;A!==0&&(s.colorFillStyle(t,ne,ne,ne,$),v?t.fill(d):t.fill())},le=function(){if(L>0){if(t.lineWidth=L,t.lineCap=k,t.lineJoin=M,t.setLineDash)switch(P){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(B),t.lineDashOffset=z;break;case"solid":case"double":t.setLineDash([]);break}if(N!=="center"){if(t.save(),t.lineWidth*=2,N==="inside")v?t.clip(d):t.clip();else{var U=new Path2D;U.rect(-o/2-L,-l/2-L,o+2*L,l+2*L),U.addPath(d),t.clip(U,"evenodd")}v?t.stroke(d):t.stroke(),t.restore()}else v?t.stroke(d):t.stroke();if(P==="double"){t.lineWidth=L/3;var $=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(d):t.stroke(),t.globalCompositeOperation=$}t.setLineDash&&t.setLineDash([])}},pe=function(){if(G>0){if(t.lineWidth=G,t.lineCap="butt",t.setLineDash)switch(X){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var U=c;v&&(U={x:0,y:0});var $=s.getNodeShape(e),ne=L;N==="inside"&&(ne=0),N==="outside"&&(ne*=2);var Q=(o+ne+(G+q))/o,ie=(l+ne+(G+q))/l,ve=o*Q,Ee=l*ie,fe=s.nodeShapes[$].points,be;if(v){var we=W(ve,Ee,$,fe);be=we.path}if($==="ellipse")s.drawEllipsePath(be||t,U.x,U.y,ve,Ee);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes($)){var ge=0,ke=0,ze=0;$==="round-diamond"?ge=(ne+q+G)*1.4:$==="round-heptagon"?(ge=(ne+q+G)*1.075,ze=-(ne/2+q+G)/35):$==="round-hexagon"?ge=(ne+q+G)*1.12:$==="round-pentagon"?(ge=(ne+q+G)*1.13,ze=-(ne/2+q+G)/15):$==="round-tag"?(ge=(ne+q+G)*1.12,ke=(ne/2+G+q)*.07):$==="round-triangle"&&(ge=(ne+q+G)*(Math.PI/2),ze=-(ne+q/2+G)/Math.PI),ge!==0&&(Q=(o+ge)/o,ve=o*Q,["round-hexagon","round-tag"].includes($)||(ie=(l+ge)/l,Ee=l*ie)),J=J==="auto"?el(ve,Ee):J;for(var mt=ve/2,bt=Ee/2,$e=J+(ne+G+q)/2,Ze=new Array(fe.length/2),Qe=new Array(fe.length/2),ct=0;ct<fe.length/2;ct++)Ze[ct]={x:U.x+ke+mt*fe[ct*2],y:U.y+ze+bt*fe[ct*2+1]};var vt,Mt,Tt,Nt,Yt=Ze.length;for(Mt=Ze[Yt-1],vt=0;vt<Yt;vt++)Tt=Ze[vt%Yt],Nt=Ze[(vt+1)%Yt],Qe[vt]=Zi(Mt,Tt,Nt,$e),Mt=Tt,Tt=Nt;s.drawRoundPolygonPath(be||t,U.x+ke,U.y+ze,o*Q,l*ie,fe,Qe)}else if(["roundrectangle","round-rectangle"].includes($))J=J==="auto"?xr(ve,Ee):J,s.drawRoundRectanglePath(be||t,U.x,U.y,ve,Ee,J+(ne+G+q)/2);else if(["cutrectangle","cut-rectangle"].includes($))J=J==="auto"?Gi():J,s.drawCutRectanglePath(be||t,U.x,U.y,ve,Ee,null,J+(ne+G+q)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes($))J=J==="auto"?xr(ve,Ee):J,s.drawBottomRoundRectanglePath(be||t,U.x,U.y,ve,Ee,J+(ne+G+q)/2);else if($==="barrel")s.drawBarrelPath(be||t,U.x,U.y,ve,Ee);else if($.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes($)){var $t=(ne+G+q)/o;fe=mn(bn(fe,$t)),s.drawPolygonPath(be||t,U.x,U.y,o,l,fe)}else{var it=(ne+G+q)/o;fe=mn(bn(fe,-it)),s.drawPolygonPath(be||t,U.x,U.y,o,l,fe)}if(v?t.stroke(be):t.stroke(),X==="double"){t.lineWidth=ne/3;var Je=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(be):t.stroke(),t.globalCompositeOperation=Je}t.setLineDash&&t.setLineDash([])}},ye=function(){n&&s.drawNodeOverlay(t,e,c,o,l)},de=function(){n&&s.drawNodeUnderlay(t,e,c,o,l)},me=function(){s.drawElementText(t,e,null,a)},xe=e.pstyle("ghost").value==="yes";if(xe){var De=e.pstyle("ghost-offset-x").pfValue,ee=e.pstyle("ghost-offset-y").pfValue,O=e.pstyle("ghost-opacity").value,V=O*h;t.translate(De,ee),_(),pe(),j(O*I),Ce(),Oe(V,!0),Y(O*F),le(),Pe(A!==0||L!==0),Oe(V,!1),ue(V),t.translate(-De,-ee)}v&&t.translate(-c.x,-c.y),de(),v&&t.translate(c.x,c.y),_(),pe(),j(),Ce(),Oe(h,!0),Y(),le(),Pe(A!==0||L!==0),Oe(h,!1),ue(),v&&t.translate(-c.x,-c.y),me(),ye(),r&&t.translate(y.x1,y.y1)}};var nu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,s){var o=this;if(a.visible()){var l=a.pstyle("".concat(e,"-padding")).pfValue,u=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,c=a.pstyle("".concat(e,"-shape")).value,h=a.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(n=n||a.position(),i==null||s==null){var v=a.padding();i=a.width()+2*v,s=a.height()+2*v}o.colorFillStyle(r,f[0],f[1],f[2],u),o.nodeShapes[c].draw(r,n.x,n.y,i+l*2,s+l*2,h),r.fill()}}}};ta.drawNodeOverlay=nu("overlay");ta.drawNodeUnderlay=nu("underlay");ta.hasPie=function(t){return t=t[0],t._private.hasPie};ta.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=a.x,o=a.y,l=e.width(),u=e.height(),f=Math.min(l,u)/2,c=0,h=this.usePaths();h&&(s=0,o=0),i.units==="%"?f=f*i.pfValue:i.pfValue!==void 0&&(f=i.pfValue/2);for(var v=1;v<=n.pieBackgroundN;v++){var d=e.pstyle("pie-"+v+"-background-size").value,g=e.pstyle("pie-"+v+"-background-color").value,p=e.pstyle("pie-"+v+"-background-opacity").value*r,y=d/100;y+c>1&&(y=1-c);var b=1.5*Math.PI+2*Math.PI*c,m=2*Math.PI*y,T=b+m;d===0||c>=1||c+y>1||(t.beginPath(),t.moveTo(s,o),t.arc(s,o,f,b,T),t.closePath(),this.colorFillStyle(t,g[0],g[1],g[2],p),t.fill(),c+=y)}};var dt={},dy=100;dt.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};dt.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};dt.createGradientStyleFor=function(t,e,r,a,n){var i,s=this.usePaths(),o=r.pstyle(e+"-gradient-stop-colors").value,l=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var u=r.sourceEndpoint(),f=r.targetEndpoint(),c=r.midpoint(),h=Er(u,c),v=Er(f,c);i=t.createRadialGradient(c.x,c.y,0,c.x,c.y,Math.max(h,v))}else{var d=s?{x:0,y:0}:r.position(),g=r.paddedWidth(),p=r.paddedHeight();i=t.createRadialGradient(d.x,d.y,0,d.x,d.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=s?{x:0,y:0}:r.position(),T=r.paddedWidth(),C=r.paddedHeight(),D=T/2,w=C/2,x=r.pstyle("background-gradient-direction").value;switch(x){case"to-bottom":i=t.createLinearGradient(m.x,m.y-w,m.x,m.y+w);break;case"to-top":i=t.createLinearGradient(m.x,m.y+w,m.x,m.y-w);break;case"to-left":i=t.createLinearGradient(m.x+D,m.y,m.x-D,m.y);break;case"to-right":i=t.createLinearGradient(m.x-D,m.y,m.x+D,m.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(m.x-D,m.y-w,m.x+D,m.y+w);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(m.x-D,m.y+w,m.x+D,m.y-w);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(m.x+D,m.y-w,m.x-D,m.y+w);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(m.x+D,m.y+w,m.x-D,m.y-w);break}}if(!i)return null;for(var E=l.length===o.length,S=o.length,A=0;A<S;A++)i.addColorStop(E?l[A]:A/(S-1),"rgba("+o[A][0]+","+o[A][1]+","+o[A][2]+","+n+")");return i};dt.gradientFillStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"background",e,r,a);if(!n)return null;t.fillStyle=n};dt.colorFillStyle=function(t,e,r,a,n){t.fillStyle="rgba("+e+","+r+","+a+","+n+")"};dt.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)}};dt.gradientStrokeStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"line",e,r,a);if(!n)return null;t.strokeStyle=n};dt.colorStrokeStyle=function(t,e,r,a,n){t.strokeStyle="rgba("+e+","+r+","+a+","+n+")"};dt.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)}};dt.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],s=e.getPixelRatio(),o=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var l=n*s,u=i*s,f;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var c=r.canvasContainer;c.style.width=n+"px",c.style.height=i+"px";for(var h=0;h<e.CANVAS_LAYERS;h++)f=r.canvases[h],f.width=l,f.height=u,f.style.width=n+"px",f.style.height=i+"px";for(var h=0;h<e.BUFFER_COUNT;h++)f=r.bufferCanvases[h],f.width=l,f.height=u,f.style.width=n+"px",f.style.height=i+"px";e.textureMult=1,s<=1&&(f=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=l*e.textureMult,f.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u,e.pixelRatio=s}};dt.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})};dt.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])};dt.render=function(t){var e=this;t=t||Wo();var r=e.cy,a=t.forcedContext,n=t.drawAllLayers,i=t.drawOnlyNodeLayer,s=t.forcedZoom,o=t.forcedPan,l=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,u=e.data,f=u.canvasNeedsRedraw,c=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),h=t.motionBlur!==void 0?t.motionBlur:e.motionBlur,v=e.motionBlurPxRatio,d=r.hasCompoundNodes(),g=e.hoverData.draggingEles,p=!!(e.hoverData.selecting||e.touchData.selecting);h=h&&!a&&e.motionBlurEnabled&&!p;var y=h;a||(e.prevPxRatio!==l&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=l),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),h&&(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&&!c&&(f[e.NODE]=!0,f[e.SELECT_BOX]=!0);var b=r.style(),m=r.zoom(),T=s!==void 0?s:m,C=r.pan(),D={x:C.x,y:C.y},w={zoom:m,pan:{x:C.x,y:C.y}},x=e.prevViewport,E=x===void 0||w.zoom!==x.zoom||w.pan.x!==x.pan.x||w.pan.y!==x.pan.y;!E&&!(g&&!d)&&(e.motionBlurPxRatio=1),o&&(D=o),T*=l,D.x*=l,D.y*=l;var S=e.getCachedZSortedEles();function A(Y,_,W,te,ae){var se=Y.globalCompositeOperation;Y.globalCompositeOperation="destination-out",e.colorFillStyle(Y,255,255,255,e.motionBlurTransparency),Y.fillRect(_,W,te,ae),Y.globalCompositeOperation=se}function L(Y,_){var W,te,ae,se;!e.clearingMotionBlur&&(Y===u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||Y===u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(W={x:C.x*v,y:C.y*v},te=m*v,ae=e.canvasWidth*v,se=e.canvasHeight*v):(W=D,te=T,ae=e.canvasWidth,se=e.canvasHeight),Y.setTransform(1,0,0,1,0,0),_==="motionBlur"?A(Y,0,0,ae,se):!a&&(_===void 0||_)&&Y.clearRect(0,0,ae,se),n||(Y.translate(W.x,W.y),Y.scale(te,te)),o&&Y.translate(o.x,o.y),s&&Y.scale(s,s)}if(c||(e.textureDrawLastFrame=!1),c){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var I=e.data.bufferContexts[e.TEXTURE_BUFFER];I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:I,drawOnlyNodeLayer:!0,forcedPxRatio:l*e.textureMult});var w=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};w.mpan={x:(0-w.pan.x)/w.zoom,y:(0-w.pan.y)/w.zoom}}f[e.DRAG]=!1,f[e.NODE]=!1;var R=u.contexts[e.NODE],P=e.textureCache.texture,w=e.textureCache.viewport;R.setTransform(1,0,0,1,0,0),h?A(R,0,0,w.width,w.height):R.clearRect(0,0,w.width,w.height);var M=b.core("outside-texture-bg-color").value,k=b.core("outside-texture-bg-opacity").value;e.colorFillStyle(R,M[0],M[1],M[2],k),R.fillRect(0,0,w.width,w.height);var m=r.zoom();L(R,!1),R.clearRect(w.mpan.x,w.mpan.y,w.width/w.zoom/l,w.height/w.zoom/l),R.drawImage(P,w.mpan.x,w.mpan.y,w.width/w.zoom/l,w.height/w.zoom/l)}else e.textureOnViewport&&!a&&(e.textureCache=null);var N=r.extent(),B=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),z=e.hideEdgesOnViewport&&B,F=[];if(F[e.NODE]=!f[e.NODE]&&h&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,F[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),F[e.DRAG]=!f[e.DRAG]&&h&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,F[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),f[e.NODE]||n||i||F[e.NODE]){var G=h&&!F[e.NODE]&&v!==1,R=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),H=h&&!G?"motionBlur":void 0;L(R,H),z?e.drawCachedNodes(R,S.nondrag,l,N):e.drawLayeredElements(R,S.nondrag,l,N),e.debug&&e.drawDebugPoints(R,S.nondrag),!n&&!h&&(f[e.NODE]=!1)}if(!i&&(f[e.DRAG]||n||F[e.DRAG])){var G=h&&!F[e.DRAG]&&v!==1,R=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]);L(R,h&&!G?"motionBlur":void 0),z?e.drawCachedNodes(R,S.drag,l,N):e.drawCachedElements(R,S.drag,l,N),e.debug&&e.drawDebugPoints(R,S.drag),!n&&!h&&(f[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,L),h&&v!==1){var X=u.contexts[e.NODE],K=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],q=u.contexts[e.DRAG],J=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],j=function(_,W,te){_.setTransform(1,0,0,1,0,0),te||!y?_.clearRect(0,0,e.canvasWidth,e.canvasHeight):A(_,0,0,e.canvasWidth,e.canvasHeight);var ae=v;_.drawImage(W,0,0,e.canvasWidth*ae,e.canvasHeight*ae,0,0,e.canvasWidth,e.canvasHeight)};(f[e.NODE]||F[e.NODE])&&(j(X,K,F[e.NODE]),f[e.NODE]=!1),(f[e.DRAG]||F[e.DRAG])&&(j(q,J,F[e.DRAG]),f[e.DRAG]=!1)}e.prevViewport=w,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),h&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!c,e.mbFrames=0,f[e.NODE]=!0,f[e.DRAG]=!0,e.redraw()},dy)),a||r.emit("render")};var ua;dt.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,n=r.data,i=a.style(),s=t.drawOnlyNodeLayer,o=t.drawAllLayers,l=n.canvasNeedsRedraw,u=t.forcedContext;if(r.showFps||!s&&l[r.SELECT_BOX]&&!o){var f=u||n.contexts[r.SELECT_BOX];if(e(f),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var c=r.cy.zoom(),h=i.core("selection-box-border-width").value/c;f.lineWidth=h,f.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+")",f.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),h>0&&(f.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+")",f.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 c=r.cy.zoom(),v=n.bgActivePosistion;f.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+")",f.beginPath(),f.arc(v.x,v.y,i.core("active-bg-size").pfValue/c,0,2*Math.PI),f.fill()}var d=r.lastRedrawTime;if(r.showFps&&d){d=Math.round(d);var g=Math.round(1e3/d),p="1 frame = "+d+" ms = "+g+" fps";if(f.setTransform(1,0,0,1,0,0),f.fillStyle="rgba(255, 0, 0, 0.75)",f.strokeStyle="rgba(255, 0, 0, 0.75)",f.font="30px Arial",!ua){var y=f.measureText(p);ua=y.actualBoundingBoxAscent}f.fillText(p,0,ua);var b=60;f.strokeRect(0,ua+10,250,20),f.fillRect(0,ua+10,250*Math.min(g/b,1),20)}o||(l[r.SELECT_BOX]=!1)}};function mo(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 gy(t,e,r){var a=mo(t,t.VERTEX_SHADER,e),n=mo(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 py(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 ji(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 ii(t,e,r,a,n){var i=a*r+e.x,s=n*r+e.y;return s=Math.round(t.canvasHeight-s),[i,s]}function tn(t,e,r){var a=t[0]/255,n=t[1]/255,i=t[2]/255,s=e,o=r||new Array(4);return o[0]=a*s,o[1]=n*s,o[2]=i*s,o[3]=s,o}function rn(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 yy(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function my(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 iu(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 su(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 wy(t,e,r,a){var n=iu(t,e),i=Ye(n,2),s=i[0],o=i[1],l=su(t,o,a),u=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,u),t.bufferData(t.ARRAY_BUFFER,l,t.STATIC_DRAW),o===t.FLOAT?t.vertexAttribPointer(r,s,o,!1,0,0):o===t.INT&&t.vertexAttribIPointer(r,s,o,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),u}function wt(t,e,r,a){var n=iu(t,r),i=Ye(n,3),s=i[0],o=i[1],l=i[2],u=su(t,o,e*s),f=s*l,c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,e*f,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),o===t.FLOAT?t.vertexAttribPointer(a,s,o,!1,f,0):o===t.INT&&t.vertexAttribIPointer(a,s,o,f,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var h=new Array(e),v=0;v<e;v++)h[v]=by(t,o,u,f,s,v);return c.dataArray=u,c.stride=f,c.size=s,c.getView=function(d){return h[d]},c.setPoint=function(d,g,p){var y=h[d];y[0]=g,y[1]=p},c.bufferSubData=function(d){t.bindBuffer(t.ARRAY_BUFFER,c),d?t.bufferSubData(t.ARRAY_BUFFER,0,u,0,d*s):t.bufferSubData(t.ARRAY_BUFFER,0,u)},c}function Ey(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 bo=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 ma(){var t=new bo(9);return bo!=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 ou(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 xy(t,e,r){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],f=e[7],c=e[8],h=r[0],v=r[1],d=r[2],g=r[3],p=r[4],y=r[5],b=r[6],m=r[7],T=r[8];return t[0]=h*a+v*s+d*u,t[1]=h*n+v*o+d*f,t[2]=h*i+v*l+d*c,t[3]=g*a+p*s+y*u,t[4]=g*n+p*o+y*f,t[5]=g*i+p*l+y*c,t[6]=b*a+m*s+T*u,t[7]=b*n+m*o+T*f,t[8]=b*i+m*l+T*c,t}function Sn(t,e,r){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],f=e[7],c=e[8],h=r[0],v=r[1];return t[0]=a,t[1]=n,t[2]=i,t[3]=s,t[4]=o,t[5]=l,t[6]=h*a+v*s+u,t[7]=h*n+v*o+f,t[8]=h*i+v*l+c,t}function lu(t,e,r){var a=e[0],n=e[1],i=e[2],s=e[3],o=e[4],l=e[5],u=e[6],f=e[7],c=e[8],h=Math.sin(r),v=Math.cos(r);return t[0]=v*a+h*s,t[1]=v*n+h*o,t[2]=v*i+h*l,t[3]=v*s-h*a,t[4]=v*o-h*n,t[5]=v*l-h*i,t[6]=u,t[7]=f,t[8]=c,t}function es(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 Ty(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 ba={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},fa=et({getKey:null,drawElement:null,getBoundingBox:null,getRotation:null,getRotationPoint:null,getRotationOffset:null,isVisible:null,getPadding:null}),Cy=function(){function t(e,r){fr(this,t),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.atlasSize=r.webglTexSize,this.rows=r.webglTexRows,this.enableWrapping=r.enableWrapping,this.texHeight=Math.floor(this.atlasSize/this.rows),this.maxTexWidth=this.atlasSize,this.texture=null,this.canvas=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=r.createTextureCanvas(e,this.atlasSize,this.atlasSize),this.scratch=r.createTextureCanvas(e,this.atlasSize,this.texHeight,"scratch")}return cr(t,[{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,s=this.maxTexWidth,o=i/n,l=a*o,u=n*o;return l>s&&(o=s/a,l=a*o,u=n*o),{scale:o,texW:l,texH:u}}},{key:"draw",value:function(r,a,n){var i=this,s=this.atlasSize,o=this.rows,l=this.texHeight,u=this.getScale(a),f=u.scale,c=u.texW,h=u.texH,v=[null,null],d=function(m,T){if(n&&T){var C=T.context,D=m.x,w=m.row,x=D,E=l*w;C.save(),C.translate(x,E),C.scale(f,f),n(C,a),C.restore()}},g=function(){d(i.freePointer,i.canvas),v[0]={x:i.freePointer.x,y:i.freePointer.row*l,w:c,h},v[1]={x:i.freePointer.x+c,y:i.freePointer.row*l,w:0,h},i.freePointer.x+=c,i.freePointer.x==s&&(i.freePointer.x=0,i.freePointer.row++)},p=function(){var m=i.scratch,T=i.canvas;m.clear(),d({x:0,row:0},m);var C=s-i.freePointer.x,D=c-C,w=l;{var x=i.freePointer.x,E=i.freePointer.row*l,S=C;T.context.drawImage(m,0,0,S,w,x,E,S,w),v[0]={x,y:E,w:S,h}}{var A=C,L=(i.freePointer.row+1)*l,I=D;T&&T.context.drawImage(m,A,0,I,w,0,L,I,w),v[1]={x:0,y:L,w:I,h}}i.freePointer.x=D,i.freePointer.row++},y=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+c<=s)g();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(y(),g()):this.enableWrapping?p():(y(),g())}return this.keyToLocation.set(r,v),this.needsBuffer=!0,v}},{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){var a=this.atlasSize,n=this.rows,i=this.getScale(r),s=i.texW;return this.freePointer.x+s>a?this.freePointer.row<n-1:!0}},{key:"bufferIfNeeded",value:function(r){this.texture||(this.texture=my(r,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1)}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null,this.needsBuffer=!0)}}]),t}(),Dy=function(){function t(e,r){fr(this,t),this.r=e,this.opts=r,this.keyToIds=new Map,this.idToKey=new Map,this.atlases=[],this.styleKeyToAtlas=new Map,this.styleKeyNeedsRedraw=new Set,this.forceGC=!1}return cr(t,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"getIdsFor",value:function(r){var a=this.keyToIds.get(r);return a||(a=new Set,this.keyToIds.set(r,a)),a}},{key:"_createAtlas",value:function(){var r=this.r,a=this.opts;return new Cy(r,a)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var r=this.r,a=this.opts,n=a.webglTexSize,i=Math.floor(n/a.webglTexRows);this.scratch=a.createTextureCanvas(r,n,i,"scratch")}return this.scratch}},{key:"draw",value:function(r,a,n,i){if(this.styleKeyNeedsRedraw.has(a)){this.styleKeyNeedsRedraw.delete(a),this.deleteKey(r,a);var s=this.styleKeyToAtlas.get(a);s&&(s.forceGC=!0),this.styleKeyToAtlas.delete(a)}var o=this.styleKeyToAtlas.get(a);return o||(o=this.atlases[this.atlases.length-1],(!o||!o.canFit(n))&&(o=this._createAtlas(),this.atlases.push(o)),o.draw(a,n,i),this.styleKeyToAtlas.set(a,o),this.getIdsFor(a).add(r),this.idToKey.set(r,a)),o}},{key:"getAtlas",value:function(r){return this.styleKeyToAtlas.get(r)}},{key:"hasAtlas",value:function(r){return this.styleKeyToAtlas.has(r)}},{key:"deleteKey",value:function(r,a){this.idToKey.delete(r),this.getIdsFor(a).delete(r)}},{key:"checkKeyIsInvalid",value:function(r,a){if(!this.idToKey.has(r))return!1;var n=this.idToKey.get(r);return n!=a?(this.deleteKey(r,n),!0):!1}},{key:"_getKeysToCollect",value:function(){var r=new Set,a=Et(this.styleKeyToAtlas.keys()),n;try{for(a.s();!(n=a.n()).done;){var i=n.value;this.getIdsFor(i).size==0&&r.add(i)}}catch(s){a.e(s)}finally{a.f()}return r}},{key:"gc",value:function(){var r=this,a=this.atlases.some(function(h){return h.forceGC}),n=this._getKeysToCollect();if(n.size===0&&!a){console.log("nothing to garbage collect");return}var i=[],s=new Map,o=null,l=Et(this.atlases),u;try{var f=function(){var v=u.value,d=v.getKeys(),g=Sy(n,d);if(g.size===0&&!v.forceGC)return i.push(v),d.forEach(function(w){return s.set(w,v)}),"continue";o||(o=r._createAtlas(),i.push(o));var p=Et(d),y;try{for(p.s();!(y=p.n()).done;){var b=y.value;if(!g.has(b)){var m=v.getOffsets(b),T=Ye(m,2),C=T[0],D=T[1];o.canFit({w:C.w+D.w,h:C.h})||(o=r._createAtlas(),i.push(o)),r._copyTextureToNewAtlas(b,v,o),s.set(b,o)}}}catch(w){p.e(w)}finally{p.f()}};for(l.s();!(u=l.n()).done;)var c=f()}catch(h){l.e(h)}finally{l.f()}this.atlases=i,this.styleKeyToAtlas=s}},{key:"_copyTextureToNewAtlas",value:function(r,a,n){var i=a.getOffsets(r),s=Ye(i,2),o=s[0],l=s[1];if(l.w===0)n.draw(r,o,function(h){h.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,l.x,l.y,l.w,l.h,o.w,0,l.w,l.h);var f=o.w+l.w,c=o.h;n.draw(r,{w:f,h:c},function(h){h.drawImage(u,0,0,f,c,0,0,f,c)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}]),t}();function Sy(t,e){return t.intersection?t.intersection(e):new Set(Ro(t).filter(function(r){return e.has(r)}))}var Ay=function(){function t(e,r){fr(this,t),this.r=e;var a=r;this.globalOptions=a,this.maxAtlases=a.webglTexPerBatch,this.atlasSize=a.webglTexSize,this.renderTypes=new Map,this.maxAtlasesPerBatch=r.webglTexPerBatch,this.batchAtlases=[],this._cacheScratchCanvas(a)}return cr(t,[{key:"_cacheScratchCanvas",value:function(r){var a=-1,n=-1,i=null,s=r.createTextureCanvas;r.createTextureCanvas=function(o,l,u,f){return f?((!i||l!=a||u!=n)&&(a=l,n=u,i=s(o,l,u)),i):s(o,l,u)}}},{key:"addRenderType",value:function(r,a){var n=new Dy(this.r,this.globalOptions),i=a;this.renderTypes.set(r,he({type:r,atlasCollection:n},i))}},{key:"getRenderTypes",value:function(){return Ro(this.renderTypes.values())}},{key:"getRenderTypeOpts",value:function(r){return this.renderTypes.get(r)}},{key:"invalidate",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.forceRedraw,i=n===void 0?!1:n,s=a.filterEle,o=s===void 0?function(){return!0}:s,l=a.filterType,u=l===void 0?function(){return!0}:l,f=!1,c=Et(r),h;try{for(c.s();!(h=c.n()).done;){var v=h.value;if(o(v)){var d=v.id(),g=Et(this.getRenderTypes()),p;try{for(g.s();!(p=g.n()).done;){var y=p.value;if(u(y.type)){var b=y.getKey(v);i?(y.atlasCollection.deleteKey(d,b),y.atlasCollection.styleKeyNeedsRedraw.add(b),f=!0):f|=y.atlasCollection.checkKeyIsInvalid(d,b)}}}catch(m){g.e(m)}finally{g.f()}}}}catch(m){c.e(m)}finally{c.f()}return f}},{key:"gc",value:function(){var r=Et(this.getRenderTypes()),a;try{for(r.s();!(a=r.n()).done;){var n=a.value;n.atlasCollection.gc()}}catch(i){r.e(i)}finally{r.f()}}},{key:"isRenderable",value:function(r,a){var n=this.getRenderTypeOpts(a);return n&&n.isVisible(r)}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"getOrCreateAtlas",value:function(r,a,n){var i=this.renderTypes.get(n),s=i.getKey(r),o=r.id();return i.atlasCollection.draw(o,s,a,function(l){i.drawElement(l,r,a,!0,!0)})}},{key:"getAtlasIndexForBatch",value:function(r){var a=this.batchAtlases.indexOf(r);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)return;this.batchAtlases.push(r),a=this.batchAtlases.length-1}return a}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlases},function(r,a){return a})}},{key:"getAtlasInfo",value:function(r,a){var n=this.renderTypes.get(a),i=n.getBoundingBox(r),s=this.getOrCreateAtlas(r,i,a),o=this.getAtlasIndexForBatch(s);if(o!==void 0){var l=n.getKey(r),u=s.getOffsets(l),f=Ye(u,2),c=f[0],h=f[1];return{atlasID:o,tex:c,tex1:c,tex2:h,bb:i,type:a,styleKey:l}}}},{key:"canAddToCurrentBatch",value:function(r,a){if(this.batchAtlases.length===this.maxAtlasesPerBatch){var n=this.renderTypes.get(a),i=n.getKey(r),s=n.atlasCollection.getAtlas(i);return s&&this.batchAtlases.includes(s)}return!0}},{key:"setTransformMatrix",value:function(r,a,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,s=a.bb,o=a.type,l=a.tex1,u=a.tex2,f=this.getRenderTypeOpts(o),c=f.getPadding?f.getPadding(n):0,h=l.w/(l.w+u.w);i||(h=1-h);var v=this.getAdjustedBB(s,c,i,h),d,g;ou(r);var p=f.getRotation?f.getRotation(n):0;if(p!==0){var y=f.getRotationPoint(n),b=y.x,m=y.y;Sn(r,r,[b,m]),lu(r,r,p);var T=f.getRotationOffset(n);d=T.x+v.xOffset,g=T.y}else d=v.x1,g=v.y1;Sn(r,r,[d,g]),es(r,r,[v.w,v.h])}},{key:"getTransformMatrix",value:function(r,a){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=ma();return this.setTransformMatrix(i,r,a,n),i}},{key:"getAdjustedBB",value:function(r,a,n,i){var s=r.x1,o=r.y1,l=r.w,u=r.h;a&&(s-=a,o-=a,l+=2*a,u+=2*a);var f=0,c=l*i;return n&&i<1?l=c:!n&&i<1&&(f=l-c,s+=f,l=c),{x1:s,y1:o,w:l,h:u,xOffset:f}}},{key:"getDebugInfo",value:function(){var r=[],a=Et(this.renderTypes),n;try{for(a.s();!(n=a.n()).done;){var i=Ye(n.value,2),s=i[0],o=i[1],l=o.atlasCollection.getCounts(),u=l.keyCount,f=l.atlasCount;r.push({type:s,keyCount:u,atlasCount:f})}}catch(c){a.e(c)}finally{a.f()}return r}}]),t}(),si=0,wo=1,Eo=2,oi=3,Ly=function(){function t(e,r,a){fr(this,t),this.r=e,this.gl=r,this.maxInstances=a.webglBatchSize,this.maxAtlases=a.webglTexPerBatch,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,a.enableWrapping=!0,a.createTextureCanvas=py,this.atlasManager=new Ay(e,a),this.program=this.createShaderProgram(ba.SCREEN),this.pickingProgram=this.createShaderProgram(ba.PICKING),this.vao=this.createVAO(),this.debugInfo=[]}return cr(t,[{key:"addTextureRenderType",value:function(r,a){this.atlasManager.addRenderType(r,a)}},{key:"invalidate",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(r,{filterType:function(o){return o===n},forceRedraw:!0}):i.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"createShaderProgram",value:function(r){var a=this.gl,n=`#version 300 es
18
+ precision highp float;
19
+
20
+ uniform mat3 uPanZoomMatrix;
21
+ uniform int uAtlasSize;
22
+
23
+ // instanced
24
+ in vec2 aPosition;
25
+
26
+ // what are we rendering?
27
+ in int aVertType;
28
+
29
+ // for picking
30
+ in vec4 aIndex;
31
+
32
+ // For textures
33
+ in int aAtlasId; // which shader unit/atlas to use
34
+ in vec4 aTex1; // x/y/w/h of texture in atlas
35
+ in vec4 aTex2;
36
+
37
+ // for any transforms that are needed
38
+ in vec4 aScaleRotate1; // vectors use fewer attributes than matrices
39
+ in vec2 aTranslate1;
40
+ in vec4 aScaleRotate2;
41
+ in vec2 aTranslate2;
42
+
43
+ // for edges
44
+ in vec4 aPointAPointB;
45
+ in vec4 aPointCPointD;
46
+ in float aLineWidth;
47
+ in vec4 aEdgeColor;
48
+
49
+ out vec2 vTexCoord;
50
+ out vec4 vEdgeColor;
51
+ flat out int vAtlasId;
52
+ flat out vec4 vIndex;
53
+ flat out int vVertType;
54
+
55
+ void main(void) {
56
+ int vid = gl_VertexID;
57
+ vec2 position = aPosition;
58
+
59
+ if(aVertType == `.concat(si,`) {
60
+ float texX;
61
+ float texY;
62
+ float texW;
63
+ float texH;
64
+ mat3 texMatrix;
65
+
66
+ int vid = gl_VertexID;
67
+ if(vid <= 5) {
68
+ texX = aTex1.x;
69
+ texY = aTex1.y;
70
+ texW = aTex1.z;
71
+ texH = aTex1.w;
72
+ texMatrix = mat3(
73
+ vec3(aScaleRotate1.xy, 0.0),
74
+ vec3(aScaleRotate2.zw, 0.0),
75
+ vec3(aTranslate1, 1.0)
76
+ );
77
+ } else {
78
+ texX = aTex2.x;
79
+ texY = aTex2.y;
80
+ texW = aTex2.z;
81
+ texH = aTex2.w;
82
+ texMatrix = mat3(
83
+ vec3(aScaleRotate2.xy, 0.0),
84
+ vec3(aScaleRotate2.zw, 0.0),
85
+ vec3(aTranslate2, 1.0)
86
+ );
87
+ }
88
+
89
+ if(vid == 1 || vid == 2 || vid == 4 || vid == 7 || vid == 8 || vid == 10) {
90
+ texX += texW;
91
+ }
92
+ if(vid == 2 || vid == 4 || vid == 5 || vid == 8 || vid == 10 || vid == 11) {
93
+ texY += texH;
94
+ }
95
+
96
+ float d = float(uAtlasSize);
97
+ vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
98
+
99
+ gl_Position = vec4(uPanZoomMatrix * texMatrix * vec3(position, 1.0), 1.0);
100
+ }
101
+ else if(aVertType == `).concat(wo,` && vid < 6) {
102
+ vec2 source = aPointAPointB.xy;
103
+ vec2 target = aPointAPointB.zw;
104
+
105
+ // adjust the geometry so that the line is centered on the edge
106
+ position.y = position.y - 0.5;
107
+
108
+ vec2 xBasis = target - source;
109
+ vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
110
+ vec2 point = source + xBasis * position.x + yBasis * aLineWidth * position.y;
111
+
112
+ gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
113
+ vEdgeColor = aEdgeColor;
114
+ }
115
+ else if(aVertType == `).concat(Eo,` && vid < 6) {
116
+ vec2 pointA = aPointAPointB.xy;
117
+ vec2 pointB = aPointAPointB.zw;
118
+ vec2 pointC = aPointCPointD.xy;
119
+ vec2 pointD = aPointCPointD.zw;
120
+
121
+ // adjust the geometry so that the line is centered on the edge
122
+ position.y = position.y - 0.5;
123
+
124
+ vec2 p0 = pointA;
125
+ vec2 p1 = pointB;
126
+ vec2 p2 = pointC;
127
+ vec2 pos = position;
128
+ if(position.x == 1.0) {
129
+ p0 = pointD;
130
+ p1 = pointC;
131
+ p2 = pointB;
132
+ pos = vec2(0.0, -position.y);
133
+ }
134
+
135
+ vec2 p01 = p1 - p0;
136
+ vec2 p12 = p2 - p1;
137
+ vec2 p21 = p1 - p2;
138
+
139
+ // Find the normal vector.
140
+ vec2 tangent = normalize(normalize(p12) + normalize(p01));
141
+ vec2 normal = vec2(-tangent.y, tangent.x);
142
+
143
+ // Find the vector perpendicular to p0 -> p1.
144
+ vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
145
+
146
+ // Determine the bend direction.
147
+ float sigma = sign(dot(p01 + p21, normal));
148
+ float width = aLineWidth;
149
+
150
+ if(sign(pos.y) == -sigma) {
151
+ // This is an intersecting vertex. Adjust the position so that there's no overlap.
152
+ vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
153
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
154
+ } else {
155
+ // This is a non-intersecting vertex. Treat it like a mitre join.
156
+ vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
157
+ gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
158
+ }
159
+
160
+ vEdgeColor = aEdgeColor;
161
+ }
162
+ else if(aVertType == `).concat(oi,` && vid < 3) {
163
+ // massage the first triangle into an edge arrow
164
+ if(vid == 0)
165
+ position = vec2(-0.15, -0.3);
166
+ if(vid == 1)
167
+ position = vec2( 0.0, 0.0);
168
+ if(vid == 2)
169
+ position = vec2( 0.15, -0.3);
170
+
171
+ mat3 transform = mat3(
172
+ vec3(aScaleRotate1.xy, 0.0),
173
+ vec3(aScaleRotate1.zw, 0.0),
174
+ vec3(aTranslate1, 1.0)
175
+ );
176
+ gl_Position = vec4(uPanZoomMatrix * transform * vec3(position, 1.0), 1.0);
177
+ vEdgeColor = aEdgeColor;
178
+ } else {
179
+ gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
180
+ }
181
+
182
+ vAtlasId = aAtlasId;
183
+ vIndex = aIndex;
184
+ vVertType = aVertType;
185
+ }
186
+ `),i=this.atlasManager.getIndexArray(),s=`#version 300 es
187
+ precision highp float;
188
+
189
+ // define texture unit for each node in the batch
190
+ `.concat(i.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join(`
191
+ `),`
192
+
193
+ uniform vec4 uBGColor;
194
+
195
+ in vec2 vTexCoord;
196
+ in vec4 vEdgeColor;
197
+ flat in int vAtlasId;
198
+ flat in vec4 vIndex;
199
+ flat in int vVertType;
200
+
201
+ out vec4 outColor;
202
+
203
+ void main(void) {
204
+ if(vVertType == `).concat(si,`) {
205
+ `).concat(i.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join(`
206
+ else `),`
207
+ } else if(vVertType == `).concat(oi,`) {
208
+ // blend arrow color with background (using premultiplied alpha)
209
+ outColor.rgb = vEdgeColor.rgb + (uBGColor.rgb * (1.0 - vEdgeColor.a));
210
+ outColor.a = 1.0; // make opaque, masks out line under arrow
211
+ } else {
212
+ outColor = vEdgeColor;
213
+ }
214
+
215
+ `).concat(r.picking?`if(outColor.a == 0.0) discard;
216
+ else outColor = vIndex;`:"",`
217
+ }
218
+ `),o=gy(a,n,s);o.aPosition=a.getAttribLocation(o,"aPosition"),o.aIndex=a.getAttribLocation(o,"aIndex"),o.aVertType=a.getAttribLocation(o,"aVertType"),o.aAtlasId=a.getAttribLocation(o,"aAtlasId"),o.aTex1=a.getAttribLocation(o,"aTex1"),o.aTex2=a.getAttribLocation(o,"aTex2"),o.aScaleRotate1=a.getAttribLocation(o,"aScaleRotate1"),o.aTranslate1=a.getAttribLocation(o,"aTranslate1"),o.aScaleRotate2=a.getAttribLocation(o,"aScaleRotate2"),o.aTranslate2=a.getAttribLocation(o,"aTranslate2"),o.aPointAPointB=a.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=a.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=a.getAttribLocation(o,"aLineWidth"),o.aEdgeColor=a.getAttribLocation(o,"aEdgeColor"),o.uPanZoomMatrix=a.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=a.getUniformLocation(o,"uAtlasSize"),o.uBGColor=a.getUniformLocation(o,"uBGColor"),o.uTextures=[];for(var l=0;l<this.atlasManager.maxAtlases;l++)o.uTextures.push(a.getUniformLocation(o,"uTexture".concat(l)));return o}},{key:"createVAO",value:function(){var r=[0,0,1,0,1,1,0,0,1,1,0,1],a=[].concat(r,r);this.vertexCount=a.length/2;var n=this.maxInstances,i=this.gl,s=this.program,o=i.createVertexArray();return i.bindVertexArray(o),wy(i,"vec2",s.aPosition,a),this.indexBuffer=wt(i,n,"vec4",s.aIndex),this.vertTypeBuffer=wt(i,n,"int",s.aVertType),this.atlasIdBuffer=wt(i,n,"int",s.aAtlasId),this.tex1Buffer=wt(i,n,"vec4",s.aTex1),this.tex2Buffer=wt(i,n,"vec4",s.aTex2),this.scaleRotate1Buffer=wt(i,n,"vec4",s.aScaleRotate1),this.translate1Buffer=wt(i,n,"vec2",s.aTranslate1),this.scaleRotate2Buffer=wt(i,n,"vec4",s.aScaleRotate2),this.translate2Buffer=wt(i,n,"vec2",s.aTranslate2),this.pointAPointBBuffer=wt(i,n,"vec4",s.aPointAPointB),this.pointCPointDBuffer=wt(i,n,"vec4",s.aPointCPointD),this.lineWidthBuffer=wt(i,n,"float",s.aLineWidth),this.edgeColorBuffer=wt(i,n,"vec4",s.aEdgeColor),i.bindVertexArray(null),o}},{key:"buffers",get:function(){var r=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return a.endsWith("Buffer")}).map(function(a){return r[a]})),this._buffers}},{key:"startFrame",value:function(r,a){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ba.SCREEN;this.panZoomMatrix=r,this.debugInfo=a,this.renderTarget=n,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.atlasManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"getTempMatrix",value:function(){return this.tempMatrix=this.tempMatrix||ma()}},{key:"drawTexture",value:function(r,a,n){var i=this.atlasManager;if(i.isRenderable(r,n)){i.canAddToCurrentBatch(r,n)||this.endBatch();var s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=si;var o=this.indexBuffer.getView(s);rn(a,o);var l=i.getAtlasInfo(r,n,l),u=l.atlasID,f=l.tex1,c=l.tex2,h=this.atlasIdBuffer.getView(s);h[0]=u;var v=this.tex1Buffer.getView(s);v[0]=f.x,v[1]=f.y,v[2]=f.w,v[3]=f.h;var d=this.tex2Buffer.getView(s);d[0]=c.x,d[1]=c.y,d[2]=c.w,d[3]=c.h;for(var g=this.getTempMatrix(),p=0,y=[1,2];p<y.length;p++){var b=y[p];i.setTransformMatrix(g,l,r,b===1);var m=this["scaleRotate".concat(b,"Buffer")].getView(s);m[0]=g[0],m[1]=g[1],m[2]=g[3],m[3]=g[4];var T=this["translate".concat(b,"Buffer")].getView(s);T[0]=g[6],T[1]=g[7]}this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"drawEdgeArrow",value:function(r,a,n){var i=r._private.rscratch,s,o,l;if(n==="source"?(s=i.arrowStartX,o=i.arrowStartY,l=i.srcArrowAngle):(s=i.arrowEndX,o=i.arrowEndY,l=i.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(l)||l==null)){var u=r.pstyle(n+"-arrow-shape").value;if(u!=="none"){var f=r.pstyle(n+"-arrow-color").value,c=r.pstyle("opacity").value,h=r.pstyle("line-opacity").value,v=c*h,d=r.pstyle("width").pfValue,g=r.pstyle("arrow-scale").value,p=this.r.getArrowWidth(d,g),y=this.getTempMatrix();ou(y),Sn(y,y,[s,o]),es(y,y,[p,p]),lu(y,y,l);var b=this.instanceCount;this.vertTypeBuffer.getView(b)[0]=oi;var m=this.indexBuffer.getView(b);rn(a,m);var T=this.edgeColorBuffer.getView(b);tn(f,v,T);var C=this.scaleRotate1Buffer.getView(b);C[0]=y[0],C[1]=y[1],C[2]=y[3],C[3]=y[4];var D=this.translate1Buffer.getView(b);D[0]=y[6],D[1]=y[7],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(r,a){var n=r.pstyle("opacity").value,i=r.pstyle("line-opacity").value,s=r.pstyle("width").pfValue,o=r.pstyle("line-color").value,l=n*i,u=this.getEdgePoints(r);if(u.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),u.length==4){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=wo;var c=this.indexBuffer.getView(f);rn(a,c);var h=this.edgeColorBuffer.getView(f);tn(o,l,h);var v=this.lineWidthBuffer.getView(f);v[0]=s;var d=this.pointAPointBBuffer.getView(f);d[0]=u[0],d[1]=u[1],d[2]=u[2],d[3]=u[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var g=0;g<u.length-2;g+=2){var p=this.instanceCount;this.vertTypeBuffer.getView(p)[0]=Eo;var y=this.indexBuffer.getView(p);rn(a,y);var b=this.edgeColorBuffer.getView(p);tn(o,l,b);var m=this.lineWidthBuffer.getView(p);m[0]=s;var T=u[g-2],C=u[g-1],D=u[g],w=u[g+1],x=u[g+2],E=u[g+3],S=u[g+4],A=u[g+5];g==0&&(T=2*D-x+.001,C=2*w-E+.001),g==u.length-4&&(S=2*x-D+.001,A=2*E-w+.001);var L=this.pointAPointBBuffer.getView(p);L[0]=T,L[1]=C,L[2]=D,L[3]=w;var I=this.pointCPointDBuffer.getView(p);I[0]=x,I[1]=E,I[2]=S,I[3]=A,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"getEdgePoints",value:function(r){var a=r._private.rscratch,n=a.allpts;if(n.length==4)return n;var i=this.getNumSegments(r);return this.getCurveSegmentPoints(n,i)}},{key:"getNumSegments",value:function(r){var a=15;return Math.min(Math.max(a,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 s=i/a;this.setCurvePoint(r,s,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 s=Array(r.length-2),o=0;o<s.length;o+=2){var l=(1-a)*r[o]+a*r[o+2],u=(1-a)*r[o+1]+a*r[o+3];s[o]=l,s[o+1]=u}return this.setCurvePoint(s,a,n,i)}}},{key:"endBatch",value:function(){var r=this.gl,a=this.vao,n=this.vertexCount,i=this.instanceCount;if(i!==0){var s=this.renderTarget.picking?this.pickingProgram:this.program;r.useProgram(s),r.bindVertexArray(a);var o=Et(this.buffers),l;try{for(o.s();!(l=o.n()).done;){var u=l.value;u.bufferSubData(i)}}catch(d){o.e(d)}finally{o.f()}for(var f=this.atlasManager.getAtlases(),c=0;c<f.length;c++)f[c].bufferIfNeeded(r);for(var h=0;h<f.length;h++)r.activeTexture(r.TEXTURE0+h),r.bindTexture(r.TEXTURE_2D,f[h].texture),r.uniform1i(s.uTextures[h],h);r.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),r.uniform1i(s.uAtlasSize,this.atlasManager.atlasSize);var v=tn(this.bgColor,1);r.uniform4fv(s.uBGColor,v),r.drawArraysInstanced(r.TRIANGLES,0,n,i),r.bindVertexArray(null),r.bindTexture(r.TEXTURE_2D,null),this.debugInfo&&this.debugInfo.push({count:i,atlasCount:f.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){return this.debugInfo}},{key:"getAtlasDebugInfo",value:function(){return this.atlasManager.getDebugInfo()}}]),t}();function xo(t,e){return"rgba(".concat(t[0],", ").concat(t[1],", ").concat(t[2],", ").concat(e,")")}var Ry=function(){function t(e){fr(this,t),this.r=e}return cr(t,[{key:"getStyleKey",value:function(r,a){var n=this.getStyle(r,a),i=n.shape,s=n.opacity,o=n.color;if(!i)return null;var l=a.width(),u=a.height(),f=xo(o,s);return nr("".concat(i,"-").concat(l,"-").concat(u,"-").concat(f))}},{key:"isVisible",value:function(r,a){var n=a.pstyle("".concat(r,"-opacity")).value;return n>0}},{key:"getStyle",value:function(r,a){var n=a.pstyle("".concat(r,"-opacity")).value,i=a.pstyle("".concat(r,"-color")).value,s=a.pstyle("".concat(r,"-shape")).value;return{opacity:n,color:i,shape:s}}},{key:"getPadding",value:function(r,a){return a.pstyle("".concat(r,"-padding")).pfValue}},{key:"draw",value:function(r,a,n,i){if(this.isVisible(r,n)){var s=this.r,o=i.w,l=i.h,u=o/2,f=l/2,c=this.getStyle(r,n),h=c.shape,v=c.color,d=c.opacity;a.save(),a.fillStyle=xo(v,d),h==="round-rectangle"||h==="roundrectangle"?s.drawRoundRectanglePath(a,u,f,o,l,"auto"):h==="ellipse"&&s.drawEllipsePath(a,u,f,o,l),a.fill(),a.restore()}}}]),t}();function Iy(t){var e=t&&t.style&&t.style.backgroundColor||"white";return ko(e)}var uu={};uu.initWebgl=function(t,e){var r=this,a=r.data.contexts[r.WEBGL],n=t.cy.container();t.bgColor=Iy(n),t.webglTexSize=Math.min(t.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),t.webglTexRows=Math.min(t.webglTexRows,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,console.log("max texture units",a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),console.log("max texture size",a.getParameter(a.MAX_TEXTURE_SIZE)),console.log("webgl options",t),r.pickingFrameBuffer=Ey(a),r.pickingFrameBuffer.needsDraw=!0;var i=function(f){return r.getTextAngle(f,null)},s=function(f){var c=f.pstyle("label");return c&&c.value};r.eleDrawing=new Ly(r,a,t);var o=new Ry(r);r.eleDrawing.addTextureRenderType("node-body",fa({getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement,isVisible:function(f){return f.visible()}})),r.eleDrawing.addTextureRenderType("node-label",fa({getKey:e.getLabelKey,getBoundingBox:e.getLabelBox,drawElement:e.drawLabel,getRotation:i,getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:s})),r.eleDrawing.addTextureRenderType("node-overlay",fa({getBoundingBox:e.getElementBox,getKey:function(f){return o.getStyleKey("overlay",f)},drawElement:function(f,c,h){return o.draw("overlay",f,c,h)},isVisible:function(f){return o.isVisible("overlay",f)},getPadding:function(f){return o.getPadding("overlay",f)}})),r.eleDrawing.addTextureRenderType("node-underlay",fa({getBoundingBox:e.getElementBox,getKey:function(f){return o.getStyleKey("underlay",f)},drawElement:function(f,c,h){return o.draw("underlay",f,c,h)},isVisible:function(f){return o.isVisible("underlay",f)},getPadding:function(f){return o.getPadding("underlay",f)}})),r.eleDrawing.addTextureRenderType("edge-label",fa({getKey:e.getLabelKey,getBoundingBox:e.getLabelBox,drawElement:e.drawLabel,getRotation:i,getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:s}));var l=Na(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(u,f){var c=!1;f&&f.length>0&&(c|=r.eleDrawing.invalidate(f)),c&&l()}),Oy(r)};function Oy(t){{var e=t.render;t.render=function(i){i=i||{};var s=t.cy;t.webgl&&(s.zoom()>eu?(Py(t),e.call(t,i)):(My(t),cu(t,i,ba.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,s,o,l){return zy(t,i,s)};{var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var n=t.notify;t.notify=function(i,s){n.call(t,i,s),i==="viewport"||i==="bounds"?t.pickingFrameBuffer.needsDraw=!0:i==="background"&&t.eleDrawing.invalidate(s,{type:"node-body"})}}}function Py(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function My(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 Ny(t){var e=t.canvasWidth,r=t.canvasHeight,a=ji(t),n=a.pan,i=a.zoom,s=ma();Sn(s,s,[n.x,n.y]),es(s,s,[i,i]);var o=ma();Ty(o,e,r);var l=ma();return xy(l,o,s),l}function fu(t,e){var r=t.canvasWidth,a=t.canvasHeight,n=ji(t),i=n.pan,s=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(i.x,i.y),e.scale(s,s)}function ky(t,e){t.drawSelectionRectangle(e,function(r){return fu(t,r)})}function By(t){var e=t.data.contexts[t.NODE];e.save(),fu(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 Fy(t){var e=function(n,i,s){for(var o=n.atlasManager.getRenderTypeOpts(i),l=t.data.contexts[t.NODE],u=.125,f=o.atlasCollection.atlases,c=0;c<f.length;c++){var h=f[c],v=h.canvas,d=v.width,g=v.height,p=d*c,y=v.height*s;l.save(),l.scale(u,u),l.drawImage(v,p,y),l.strokeStyle="black",l.rect(p,y,d,g),l.stroke(),l.restore()}},r=0;e(t.eleDrawing,"node-body",r++),e(t.eleDrawing,"node-label",r++)}function Gy(t,e,r,a,n){var i,s,o,l,u=ji(t),f=u.pan,c=u.zoom;if(a===void 0||n===void 0){var h=ii(t,f,c,e,r),v=Ye(h,2),d=v[0],g=v[1],p=6;i=d-p/2,s=g-p/2,o=p,l=p}else{var y=ii(t,f,c,e,r),b=Ye(y,2),m=b[0],T=b[1],C=ii(t,f,c,a,n),D=Ye(C,2),w=D[0],x=D[1];i=m,s=x,o=Math.abs(w-m),l=Math.abs(x-T)}if(o===0||l===0)return[];var E=t.data.contexts[t.WEBGL];E.bindFramebuffer(E.FRAMEBUFFER,t.pickingFrameBuffer),t.pickingFrameBuffer.needsDraw&&(E.viewport(0,0,E.canvas.width,E.canvas.height),cu(t,null,ba.PICKING),t.pickingFrameBuffer.needsDraw=!1);var S=o*l,A=new Uint8Array(S*4);E.readPixels(i,s,o,l,E.RGBA,E.UNSIGNED_BYTE,A),E.bindFramebuffer(E.FRAMEBUFFER,null);for(var L=new Set,I=0;I<S;I++){var R=A.slice(I*4,I*4+4),P=yy(R)-1;P>=0&&L.add(P)}return L}function zy(t,e,r){var a=Gy(t,e,r),n=t.getCachedZSortedEles(),i,s,o=Et(a),l;try{for(o.s();!(l=o.n()).done;){var u=l.value,f=n[u];if(!i&&f.isNode()&&(i=f),!s&&f.isEdge()&&(s=f),i&&s)break}}catch(c){o.e(c)}finally{o.f()}return[i,s].filter(Boolean)}function cu(t,e,r){var a,n;t.webglDebug&&(n=[],a=performance.now());var i=t.eleDrawing,s=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&ky(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=function(L,I){I+=1,L.isNode()?(i.drawTexture(L,I,"node-underlay"),i.drawTexture(L,I,"node-body"),i.drawTexture(L,I,"node-label"),i.drawTexture(L,I,"node-overlay")):(i.drawEdgeLine(L,I),i.drawEdgeArrow(L,I,"source"),i.drawEdgeArrow(L,I,"target"),i.drawTexture(L,I,"edge-label"))},l=t.data.contexts[t.WEBGL];r.screen?(l.clearColor(0,0,0,0),l.enable(l.BLEND),l.blendFunc(l.ONE,l.ONE_MINUS_SRC_ALPHA)):l.disable(l.BLEND),l.clear(l.COLOR_BUFFER_BIT|l.DEPTH_BUFFER_BIT),l.viewport(0,0,l.canvas.width,l.canvas.height);var u=Ny(t),f=t.getCachedZSortedEles();if(s=f.length,i.startFrame(u,n,r),r.screen){for(var c=0;c<f.nondrag.length;c++)o(f.nondrag[c],c);for(var h=0;h<f.drag.length;h++)o(f.drag[h],-1)}else if(r.picking)for(var v=0;v<f.length;v++)o(f[v],v);i.endFrame(),t.data.gc&&(console.log("Garbage Collect!"),t.data.gc=!1,i.gc()),r.screen&&t.webglDebugShowAtlases&&(By(t),Fy(t)),t.data.canvasNeedsRedraw[t.NODE]=!1,t.data.canvasNeedsRedraw[t.DRAG]=!1}if(t.webglDebug){var d=performance.now(),g=!0,p=0,y=0,b=Et(n),m;try{for(b.s();!(m=b.n()).done;){var T=m.value;p++,y+=T.count}}catch(A){b.e(A)}finally{b.f()}var C=Math.ceil(d-a),D="".concat(s," elements, ").concat(y," rectangles, ").concat(p," batches");if(g)console.log("WebGL (".concat(r.name,") - ").concat(D));else{console.log("WebGL render (".concat(r.name,") - frame time ").concat(C,"ms")),console.log(" ".concat(D)),console.log("Texture Atlases Used:");var w=i.getAtlasDebugInfo(),x=Et(w),E;try{for(x.s();!(E=x.n()).done;){var S=E.value;console.log(" ".concat(S.type,": ").concat(S.keyCount," keys, ").concat(S.atlasCount," atlases"))}}catch(A){x.e(A)}finally{x.f()}console.log("")}}}var hr={};hr.drawPolygonPath=function(t,e,r,a,n,i){var s=a/2,o=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*i[0],r+o*i[1]);for(var l=1;l<i.length/2;l++)t.lineTo(e+s*i[l*2],r+o*i[l*2+1]);t.closePath()};hr.drawRoundPolygonPath=function(t,e,r,a,n,i,s){s.forEach(function(o){return Hl(t,o)}),t.closePath()};hr.drawRoundRectanglePath=function(t,e,r,a,n,i){var s=a/2,o=n/2,l=i==="auto"?xr(a,n):Math.min(i,o,s);t.beginPath&&t.beginPath(),t.moveTo(e,r-o),t.arcTo(e+s,r-o,e+s,r,l),t.arcTo(e+s,r+o,e,r+o,l),t.arcTo(e-s,r+o,e-s,r,l),t.arcTo(e-s,r-o,e,r-o,l),t.lineTo(e,r-o),t.closePath()};hr.drawBottomRoundRectanglePath=function(t,e,r,a,n,i){var s=a/2,o=n/2,l=i==="auto"?xr(a,n):i;t.beginPath&&t.beginPath(),t.moveTo(e,r-o),t.lineTo(e+s,r-o),t.lineTo(e+s,r),t.arcTo(e+s,r+o,e,r+o,l),t.arcTo(e-s,r+o,e-s,r,l),t.lineTo(e-s,r-o),t.lineTo(e,r-o),t.closePath()};hr.drawCutRectanglePath=function(t,e,r,a,n,i,s){var o=a/2,l=n/2,u=s==="auto"?Gi():s;t.beginPath&&t.beginPath(),t.moveTo(e-o+u,r-l),t.lineTo(e+o-u,r-l),t.lineTo(e+o,r-l+u),t.lineTo(e+o,r+l-u),t.lineTo(e+o-u,r+l),t.lineTo(e-o+u,r+l),t.lineTo(e-o,r+l-u),t.lineTo(e-o,r-l+u),t.closePath()};hr.drawBarrelPath=function(t,e,r,a,n){var i=a/2,s=n/2,o=e-i,l=e+i,u=r-s,f=r+s,c=vi(a,n),h=c.widthOffset,v=c.heightOffset,d=c.ctrlPtOffsetPct*h;t.beginPath&&t.beginPath(),t.moveTo(o,u+v),t.lineTo(o,f-v),t.quadraticCurveTo(o+d,f,o+h,f),t.lineTo(l-h,f),t.quadraticCurveTo(l-d,f,l,f-v),t.lineTo(l,u+v),t.quadraticCurveTo(l-d,u,l-h,u),t.lineTo(o+h,u),t.quadraticCurveTo(o+d,u,o,u+v),t.closePath()};var To=Math.sin(0),Co=Math.cos(0),Ci={},Di={},vu=Math.PI/40;for(var Nr=0*Math.PI;Nr<2*Math.PI;Nr+=vu)Ci[Nr]=Math.sin(Nr),Di[Nr]=Math.cos(Nr);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,s,o=a/2,l=n/2,u=0*Math.PI;u<2*Math.PI;u+=vu)i=e-o*Ci[u]*To+o*Di[u]*Co,s=r+l*Di[u]*To+l*Ci[u]*Co,u===0?t.moveTo(i,s):t.lineTo(i,s);t.closePath()};var _a={};_a.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};_a.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),n=this.findContainerClientCoords(),i=t.full?Math.ceil(a.w):n[2],s=t.full?Math.ceil(a.h):n[3],o=re(t.maxWidth)||re(t.maxHeight),l=this.getPixelRatio(),u=1;if(t.scale!==void 0)i*=t.scale,s*=t.scale,u=t.scale;else if(o){var f=1/0,c=1/0;re(t.maxWidth)&&(f=u*t.maxWidth/i),re(t.maxHeight)&&(c=u*t.maxHeight/s),u=Math.min(f,c),i*=u,s*=u}o||(i*=l,s*=l,u*=l);var h=document.createElement("canvas");h.width=i,h.height=s,h.style.width=i+"px",h.style.height=s+"px";var v=h.getContext("2d");if(i>0&&s>0){v.clearRect(0,0,i,s),v.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(t.full)v.translate(-a.x1*u,-a.y1*u),v.scale(u,u),this.drawElements(v,d),v.scale(1/u,1/u),v.translate(a.x1*u,a.y1*u);else{var g=e.pan(),p={x:g.x*u,y:g.y*u};u*=e.zoom(),v.translate(p.x,p.y),v.scale(u,u),this.drawElements(v,d),v.scale(1/u,1/u),v.translate(-p.x,-p.y)}t.bg&&(v.globalCompositeOperation="destination-over",v.fillStyle=t.bg,v.rect(0,0,i,s),v.fill())}return h};function _y(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 Do(t){var e=t.indexOf(",");return t.substr(e+1)}function hu(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new Wr(function(n,i){try{e.toBlob(function(s){s!=null?n(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(s){i(s)}});case"blob":return _y(Do(a()),r);case"base64":return Do(a());case"base64uri":default:return a()}}_a.png=function(t){return hu(t,this.bufferCanvasImage(t),"image/png")};_a.jpg=function(t){return hu(t,this.bufferCanvasImage(t),"image/jpeg")};var du={};du.nodeShapeImpl=function(t,e,r,a,n,i,s,o){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,n,i);case"polygon":return this.drawPolygonPath(e,r,a,n,i,s);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,n,i,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,n,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,n,i,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,n,i,o);case"barrel":return this.drawBarrelPath(e,r,a,n,i)}};var Vy=gu,Te=gu.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 gu(t){var e=this,r=e.cy.window(),a=r.document;t.webgl&&(Te.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),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 n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var s=e.data.canvasContainer.style;e.data.canvasContainer.style[n]=i,s.position="relative",s.zIndex="0",s.overflow="hidden";var o=t.cy.container();o.appendChild(e.data.canvasContainer),o.style[n]=i;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};nf()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<Te.CANVAS_LAYERS;u++){var f=e.data.canvases[u]=a.createElement("canvas"),c=Te.CANVAS_TYPES[u];e.data.contexts[u]=f.getContext(c),e.data.contexts[u]||_e("Could not create canvas of type "+c),Object.keys(l).forEach(function(Y){f.style[Y]=l[Y]}),f.style.position="absolute",f.setAttribute("data-id","layer"+u),f.style.zIndex=String(Te.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(f),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]=a.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 h=yt(),v=function(_){return{x:(_.x1+_.x2)/2,y:(_.y1+_.y2)/2}},d=function(_){return{x:-_.w/2,y:-_.h/2}},g=function(_){var W=_[0]._private,te=W.oldBackgroundTimestamp===W.backgroundTimestamp;return!te},p=function(_){return _[0]._private.nodeKey},y=function(_){return _[0]._private.labelStyleKey},b=function(_){return _[0]._private.sourceLabelStyleKey},m=function(_){return _[0]._private.targetLabelStyleKey},T=function(_,W,te,ae,se){return e.drawElement(_,W,te,!1,!1,se)},C=function(_,W,te,ae,se){return e.drawElementText(_,W,te,ae,"main",se)},D=function(_,W,te,ae,se){return e.drawElementText(_,W,te,ae,"source",se)},w=function(_,W,te,ae,se){return e.drawElementText(_,W,te,ae,"target",se)},x=function(_){return _.boundingBox(),_[0]._private.bodyBounds},E=function(_){return _.boundingBox(),_[0]._private.labelBounds.main||h},S=function(_){return _.boundingBox(),_[0]._private.labelBounds.source||h},A=function(_){return _.boundingBox(),_[0]._private.labelBounds.target||h},L=function(_,W){return W},I=function(_){return v(x(_))},R=function(_,W,te){var ae=_?_+"-":"";return{x:W.x+te.pstyle(ae+"text-margin-x").pfValue,y:W.y+te.pstyle(ae+"text-margin-y").pfValue}},P=function(_,W,te){var ae=_[0]._private.rscratch;return{x:ae[W],y:ae[te]}},M=function(_){return R("",P(_,"labelX","labelY"),_)},k=function(_){return R("source",P(_,"sourceLabelX","sourceLabelY"),_)},N=function(_){return R("target",P(_,"targetLabelX","targetLabelY"),_)},B=function(_){return d(x(_))},z=function(_){return d(S(_))},F=function(_){return d(A(_))},G=function(_){var W=E(_),te=d(E(_));if(_.isNode()){switch(_.pstyle("text-halign").value){case"left":te.x=-W.w-(W.leftPad||0);break;case"right":te.x=-(W.rightPad||0);break}switch(_.pstyle("text-valign").value){case"top":te.y=-W.h-(W.topPad||0);break;case"bottom":te.y=-(W.botPad||0);break}}return te},H=e.data.eleTxrCache=new ga(e,{getKey:p,doesEleInvalidateKey:g,drawElement:T,getBoundingBox:x,getRotationPoint:I,getRotationOffset:B,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),X=e.data.lblTxrCache=new ga(e,{getKey:y,drawElement:C,getBoundingBox:E,getRotationPoint:M,getRotationOffset:G,isVisible:L}),K=e.data.slbTxrCache=new ga(e,{getKey:b,drawElement:D,getBoundingBox:S,getRotationPoint:k,getRotationOffset:z,isVisible:L}),q=e.data.tlbTxrCache=new ga(e,{getKey:m,drawElement:w,getBoundingBox:A,getRotationPoint:N,getRotationOffset:F,isVisible:L}),J=e.data.lyrTxrCache=new tu(e);e.onUpdateEleCalcs(function(_,W){H.invalidateElements(W),X.invalidateElements(W),K.invalidateElements(W),q.invalidateElements(W),J.invalidateElements(W);for(var te=0;te<W.length;te++){var ae=W[te]._private;ae.oldBackgroundTimestamp=ae.backgroundTimestamp}});var j=function(_){for(var W=0;W<_.length;W++)J.enqueueElementRefinement(_[W].ele)};H.onDequeue(j),X.onDequeue(j),K.onDequeue(j),q.onDequeue(j),t.webgl&&e.initWebgl(t,{getStyleKey:p,getLabelKey:y,drawElement:T,drawLabel:C,getElementBox:x,getLabelBox:E,getElementRotationPoint:I,getElementRotationOffset:B,getLabelRotationPoint:M,getLabelRotationOffset:G})}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 Uy=typeof Path2D<"u";Te.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};Te.usePaths=function(){return Uy&&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;if((typeof OffscreenCanvas>"u"?"undefined":qe(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var a=this.cy.window(),n=a.document;r=n.createElement("canvas"),r.width=t,r.height=e}return r};[ru,Ut,Zt,Ji,Lr,ta,dt,uu,hr,_a,du].forEach(function(t){he(Te,t)});var Yy=[{name:"null",impl:Ul},{name:"base",impl:Jl},{name:"canvas",impl:Vy}],$y=[{type:"layout",extensions:Sp},{type:"renderer",extensions:Yy}],pu={},yu={};function mu(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(Ia.prototype[e])return n(e);Ia.prototype[e]=r}else if(t==="collection"){if(at.prototype[e])return n(e);at.prototype[e]=r}else if(t==="layout"){for(var i=function(x){this.options=x,r.call(this,x),Ae(this._private)||(this._private={}),this._private.cy=x.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(r.prototype),o=[],l=0;l<o.length;l++){var u=o[l];s[u]=s[u]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var f=r.prototype.stop;s.stop=function(){var w=this.options;if(w&&w.animate){var x=this.animations;if(x)for(var E=0;E<x.length;E++)x[E].stop()}return f?f.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var c=function(x){return x._private.cy},h={addEventFields:function(x,E){E.layout=x,E.cy=c(x),E.target=x},bubble:function(){return!0},parent:function(x){return c(x)}};he(s,{createEmitter:function(){return this._private.emitter=new Bn(h,this),this},emitter:function(){return this._private.emitter},on:function(x,E){return this.emitter().on(x,E),this},one:function(x,E){return this.emitter().one(x,E),this},once:function(x,E){return this.emitter().one(x,E),this},removeListener:function(x,E){return this.emitter().removeListener(x,E),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(x,E){return this.emitter().emit(x,E),this}}),Re.eventAliasesOn(s),a=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var v=bu("renderer","base"),d=v.prototype,g=r,p=r.prototype,y=function(){v.apply(this,arguments),g.apply(this,arguments)},b=y.prototype;for(var m in d){var T=d[m],C=p[m]!=null;if(C)return n(m);b[m]=T}for(var D in p)b[D]=p[D];d.clientFunctions.forEach(function(w){b[w]=b[w]||function(){_e("Renderer does not implement `renderer."+w+"()` on its prototype")}}),a=y}else if(t==="__proto__"||t==="constructor"||t==="prototype")return _e(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return Bo({map:pu,keys:[t,e],value:a})}function bu(t,e){return Fo({map:pu,keys:[t,e]})}function Hy(t,e,r,a,n){return Bo({map:yu,keys:[t,e,r,a],value:n})}function Xy(t,e,r,a){return Fo({map:yu,keys:[t,e,r,a]})}var Si=function(){if(arguments.length===2)return bu.apply(null,arguments);if(arguments.length===3)return mu.apply(null,arguments);if(arguments.length===4)return Xy.apply(null,arguments);if(arguments.length===5)return Hy.apply(null,arguments);_e("Invalid extension access syntax")};Ia.prototype.extension=Si;$y.forEach(function(t){t.extensions.forEach(function(e){mu(t.type,e.name,e.impl)})});var wu=function t(){if(!(this instanceof t))return new t;this.length=0},Dr=wu.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(ce(t))this[r].properties.push({name:t,value:e});else if(Ae(t))for(var a=t,n=Object.keys(a),i=0;i<n.length;i++){var s=n[i],o=a[s];if(o!=null){var l=st.properties[s]||st.properties[An(s)];if(l!=null){var u=l.name,f=o;this[r].properties.push({name:u,value:f})}}}return this};Dr.style=Dr.css;Dr.generateStyle=function(t){var e=new st(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 s=n[i];t.css(s.name,s.value)}}return t};var Wy="3.31.0",ur=function(e){if(e===void 0&&(e={}),Ae(e))return new Ia(e);if(ce(e))return Si.apply(Si,arguments)};ur.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(ur),t.apply(null,e),this};ur.warnings=function(t){return Ho(t)};ur.version=Wy;ur.stylesheet=ur.Stylesheet=wu;var Eu={exports:{}},li={exports:{}},ui={exports:{}},So;function qy(){return So||(So=1,function(t,e){(function(a,n){t.exports=n()})(Li,function(){return function(r){var a={};function n(i){if(a[i])return a[i].exports;var s=a[i]={i,l:!1,exports:{}};return r[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=r,n.c=a,n.i=function(i){return i},n.d=function(i,s,o){n.o(i,s)||Object.defineProperty(i,s,{configurable:!1,enumerable:!0,get:o})},n.n=function(i){var s=i&&i.__esModule?function(){return i.default}:function(){return i};return n.d(s,"a",s),s},n.o=function(i,s){return Object.prototype.hasOwnProperty.call(i,s)},n.p="",n(n.s=26)}([function(r,a,n){function i(){}i.QUALITY=1,i.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,i.DEFAULT_INCREMENTAL=!1,i.DEFAULT_ANIMATION_ON_LAYOUT=!0,i.DEFAULT_ANIMATION_DURING_LAYOUT=!1,i.DEFAULT_ANIMATION_PERIOD=50,i.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,i.DEFAULT_GRAPH_MARGIN=15,i.NODE_DIMENSIONS_INCLUDE_LABELS=!1,i.SIMPLE_NODE_SIZE=40,i.SIMPLE_NODE_HALF_SIZE=i.SIMPLE_NODE_SIZE/2,i.EMPTY_COMPOUND_NODE_SIZE=40,i.MIN_EDGE_LENGTH=1,i.WORLD_BOUNDARY=1e6,i.INITIAL_WORLD_BOUNDARY=i.WORLD_BOUNDARY/1e3,i.WORLD_CENTER_X=1200,i.WORLD_CENTER_Y=900,r.exports=i},function(r,a,n){var i=n(2),s=n(8),o=n(9);function l(f,c,h){i.call(this,h),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=h,this.bendpoints=[],this.source=f,this.target=c}l.prototype=Object.create(i.prototype);for(var u in i)l[u]=i[u];l.prototype.getSource=function(){return this.source},l.prototype.getTarget=function(){return this.target},l.prototype.isInterGraph=function(){return this.isInterGraph},l.prototype.getLength=function(){return this.length},l.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},l.prototype.getBendpoints=function(){return this.bendpoints},l.prototype.getLca=function(){return this.lca},l.prototype.getSourceInLca=function(){return this.sourceInLca},l.prototype.getTargetInLca=function(){return this.targetInLca},l.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},l.prototype.getOtherEndInGraph=function(f,c){for(var h=this.getOtherEnd(f),v=c.getGraphManager().getRoot();;){if(h.getOwner()==c)return h;if(h.getOwner()==v)break;h=h.getOwner().getParent()}return null},l.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=s.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=o.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},l.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=o.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},r.exports=l},function(r,a,n){function i(s){this.vGraphObject=s}r.exports=i},function(r,a,n){var i=n(2),s=n(10),o=n(13),l=n(0),u=n(16),f=n(4);function c(v,d,g,p){g==null&&p==null&&(p=d),i.call(this,p),v.graphManager!=null&&(v=v.graphManager),this.estimatedSize=s.MIN_VALUE,this.inclusionTreeDepth=s.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=v,g!=null&&d!=null?this.rect=new o(d.x,d.y,g.width,g.height):this.rect=new o}c.prototype=Object.create(i.prototype);for(var h in i)c[h]=i[h];c.prototype.getEdges=function(){return this.edges},c.prototype.getChild=function(){return this.child},c.prototype.getOwner=function(){return this.owner},c.prototype.getWidth=function(){return this.rect.width},c.prototype.setWidth=function(v){this.rect.width=v},c.prototype.getHeight=function(){return this.rect.height},c.prototype.setHeight=function(v){this.rect.height=v},c.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},c.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},c.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},c.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},c.prototype.getRect=function(){return this.rect},c.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},c.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},c.prototype.setRect=function(v,d){this.rect.x=v.x,this.rect.y=v.y,this.rect.width=d.width,this.rect.height=d.height},c.prototype.setCenter=function(v,d){this.rect.x=v-this.rect.width/2,this.rect.y=d-this.rect.height/2},c.prototype.setLocation=function(v,d){this.rect.x=v,this.rect.y=d},c.prototype.moveBy=function(v,d){this.rect.x+=v,this.rect.y+=d},c.prototype.getEdgeListToNode=function(v){var d=[],g=this;return g.edges.forEach(function(p){if(p.target==v){if(p.source!=g)throw"Incorrect edge source!";d.push(p)}}),d},c.prototype.getEdgesBetween=function(v){var d=[],g=this;return g.edges.forEach(function(p){if(!(p.source==g||p.target==g))throw"Incorrect edge source and/or target";(p.target==v||p.source==v)&&d.push(p)}),d},c.prototype.getNeighborsList=function(){var v=new Set,d=this;return d.edges.forEach(function(g){if(g.source==d)v.add(g.target);else{if(g.target!=d)throw"Incorrect incidency!";v.add(g.source)}}),v},c.prototype.withChildren=function(){var v=new Set,d,g;if(v.add(this),this.child!=null)for(var p=this.child.getNodes(),y=0;y<p.length;y++)d=p[y],g=d.withChildren(),g.forEach(function(b){v.add(b)});return v},c.prototype.getNoOfChildren=function(){var v=0,d;if(this.child==null)v=1;else for(var g=this.child.getNodes(),p=0;p<g.length;p++)d=g[p],v+=d.getNoOfChildren();return v==0&&(v=1),v},c.prototype.getEstimatedSize=function(){if(this.estimatedSize==s.MIN_VALUE)throw"assert failed";return this.estimatedSize},c.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},c.prototype.scatter=function(){var v,d,g=-l.INITIAL_WORLD_BOUNDARY,p=l.INITIAL_WORLD_BOUNDARY;v=l.WORLD_CENTER_X+u.nextDouble()*(p-g)+g;var y=-l.INITIAL_WORLD_BOUNDARY,b=l.INITIAL_WORLD_BOUNDARY;d=l.WORLD_CENTER_Y+u.nextDouble()*(b-y)+y,this.rect.x=v,this.rect.y=d},c.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var v=this.getChild();if(v.updateBounds(!0),this.rect.x=v.getLeft(),this.rect.y=v.getTop(),this.setWidth(v.getRight()-v.getLeft()),this.setHeight(v.getBottom()-v.getTop()),l.NODE_DIMENSIONS_INCLUDE_LABELS){var d=v.getRight()-v.getLeft(),g=v.getBottom()-v.getTop();this.labelWidth>d&&(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)),this.labelHeight>g&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-g)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-g),this.setHeight(this.labelHeight))}}},c.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==s.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},c.prototype.transform=function(v){var d=this.rect.x;d>l.WORLD_BOUNDARY?d=l.WORLD_BOUNDARY:d<-l.WORLD_BOUNDARY&&(d=-l.WORLD_BOUNDARY);var g=this.rect.y;g>l.WORLD_BOUNDARY?g=l.WORLD_BOUNDARY:g<-l.WORLD_BOUNDARY&&(g=-l.WORLD_BOUNDARY);var p=new f(d,g),y=v.inverseTransformPoint(p);this.setLocation(y.x,y.y)},c.prototype.getLeft=function(){return this.rect.x},c.prototype.getRight=function(){return this.rect.x+this.rect.width},c.prototype.getTop=function(){return this.rect.y},c.prototype.getBottom=function(){return this.rect.y+this.rect.height},c.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=c},function(r,a,n){function i(s,o){s==null&&o==null?(this.x=0,this.y=0):(this.x=s,this.y=o)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.setX=function(s){this.x=s},i.prototype.setY=function(s){this.y=s},i.prototype.getDifference=function(s){return new DimensionD(this.x-s.x,this.y-s.y)},i.prototype.getCopy=function(){return new i(this.x,this.y)},i.prototype.translate=function(s){return this.x+=s.width,this.y+=s.height,this},r.exports=i},function(r,a,n){var i=n(2),s=n(10),o=n(0),l=n(6),u=n(3),f=n(1),c=n(13),h=n(12),v=n(11);function d(p,y,b){i.call(this,b),this.estimatedSize=s.MIN_VALUE,this.margin=o.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,y!=null&&y instanceof l?this.graphManager=y:y!=null&&y instanceof Layout&&(this.graphManager=y.graphManager)}d.prototype=Object.create(i.prototype);for(var g in i)d[g]=i[g];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(p,y,b){if(y==null&&b==null){var m=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(m)>-1)throw"Node already in graph!";return m.owner=this,this.getNodes().push(m),m}else{var T=p;if(!(this.getNodes().indexOf(y)>-1&&this.getNodes().indexOf(b)>-1))throw"Source or target not in graph!";if(!(y.owner==b.owner&&y.owner==this))throw"Both owners must be this graph!";return y.owner!=b.owner?null:(T.source=y,T.target=b,T.isInterGraph=!1,this.getEdges().push(T),y.edges.push(T),b!=y&&b.edges.push(T),T)}},d.prototype.remove=function(p){var y=p;if(p instanceof u){if(y==null)throw"Node is null!";if(!(y.owner!=null&&y.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var b=y.edges.slice(),m,T=b.length,C=0;C<T;C++)m=b[C],m.isInterGraph?this.graphManager.remove(m):m.source.owner.remove(m);var D=this.nodes.indexOf(y);if(D==-1)throw"Node not in owner node list!";this.nodes.splice(D,1)}else if(p instanceof f){var m=p;if(m==null)throw"Edge is null!";if(!(m.source!=null&&m.target!=null))throw"Source and/or target is null!";if(!(m.source.owner!=null&&m.target.owner!=null&&m.source.owner==this&&m.target.owner==this))throw"Source and/or target owner is invalid!";var w=m.source.edges.indexOf(m),x=m.target.edges.indexOf(m);if(!(w>-1&&x>-1))throw"Source and/or target doesn't know this edge!";m.source.edges.splice(w,1),m.target!=m.source&&m.target.edges.splice(x,1);var D=m.source.owner.getEdges().indexOf(m);if(D==-1)throw"Not in owner's edge list!";m.source.owner.getEdges().splice(D,1)}},d.prototype.updateLeftTop=function(){for(var p=s.MAX_VALUE,y=s.MAX_VALUE,b,m,T,C=this.getNodes(),D=C.length,w=0;w<D;w++){var x=C[w];b=x.getTop(),m=x.getLeft(),p>b&&(p=b),y>m&&(y=m)}return p==s.MAX_VALUE?null:(C[0].getParent().paddingLeft!=null?T=C[0].getParent().paddingLeft:T=this.margin,this.left=y-T,this.top=p-T,new h(this.left,this.top))},d.prototype.updateBounds=function(p){for(var y=s.MAX_VALUE,b=-s.MAX_VALUE,m=s.MAX_VALUE,T=-s.MAX_VALUE,C,D,w,x,E,S=this.nodes,A=S.length,L=0;L<A;L++){var I=S[L];p&&I.child!=null&&I.updateBounds(),C=I.getLeft(),D=I.getRight(),w=I.getTop(),x=I.getBottom(),y>C&&(y=C),b<D&&(b=D),m>w&&(m=w),T<x&&(T=x)}var R=new c(y,m,b-y,T-m);y==s.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),S[0].getParent().paddingLeft!=null?E=S[0].getParent().paddingLeft:E=this.margin,this.left=R.x-E,this.right=R.x+R.width+E,this.top=R.y-E,this.bottom=R.y+R.height+E},d.calculateBounds=function(p){for(var y=s.MAX_VALUE,b=-s.MAX_VALUE,m=s.MAX_VALUE,T=-s.MAX_VALUE,C,D,w,x,E=p.length,S=0;S<E;S++){var A=p[S];C=A.getLeft(),D=A.getRight(),w=A.getTop(),x=A.getBottom(),y>C&&(y=C),b<D&&(b=D),m>w&&(m=w),T<x&&(T=x)}var L=new c(y,m,b-y,T-m);return L},d.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==s.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.prototype.calcEstimatedSize=function(){for(var p=0,y=this.nodes,b=y.length,m=0;m<b;m++){var T=y[m];p+=T.calcEstimatedSize()}return p==0?this.estimatedSize=o.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=p/Math.sqrt(this.nodes.length),this.estimatedSize},d.prototype.updateConnected=function(){var p=this;if(this.nodes.length==0){this.isConnected=!0;return}var y=new v,b=new Set,m=this.nodes[0],T,C,D=m.withChildren();for(D.forEach(function(L){y.push(L),b.add(L)});y.length!==0;){m=y.shift(),T=m.getEdges();for(var w=T.length,x=0;x<w;x++){var E=T[x];if(C=E.getOtherEndInGraph(m,this),C!=null&&!b.has(C)){var S=C.withChildren();S.forEach(function(L){y.push(L),b.add(L)})}}}if(this.isConnected=!1,b.size>=this.nodes.length){var A=0;b.forEach(function(L){L.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},r.exports=d},function(r,a,n){var i,s=n(1);function o(l){i=n(5),this.layout=l,this.graphs=[],this.edges=[]}o.prototype.addRoot=function(){var l=this.layout.newGraph(),u=this.layout.newNode(null),f=this.add(l,u);return this.setRootGraph(f),this.rootGraph},o.prototype.add=function(l,u,f,c,h){if(f==null&&c==null&&h==null){if(l==null)throw"Graph is null!";if(u==null)throw"Parent node is null!";if(this.graphs.indexOf(l)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(l),l.parent!=null)throw"Already has a parent!";if(u.child!=null)throw"Already has a child!";return l.parent=u,u.child=l,l}else{h=f,c=u,f=l;var v=c.getOwner(),d=h.getOwner();if(!(v!=null&&v.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(v==d)return f.isInterGraph=!1,v.add(f,c,h);if(f.isInterGraph=!0,f.source=c,f.target=h,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},o.prototype.remove=function(l){if(l instanceof i){var u=l;if(u.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(u==this.rootGraph||u.parent!=null&&u.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(u.getEdges());for(var c,h=f.length,v=0;v<h;v++)c=f[v],u.remove(c);var d=[];d=d.concat(u.getNodes());var g;h=d.length;for(var v=0;v<h;v++)g=d[v],u.remove(g);u==this.rootGraph&&this.setRootGraph(null);var p=this.graphs.indexOf(u);this.graphs.splice(p,1),u.parent=null}else if(l instanceof s){if(c=l,c==null)throw"Edge is null!";if(!c.isInterGraph)throw"Not an inter-graph edge!";if(!(c.source!=null&&c.target!=null))throw"Source and/or target is null!";if(!(c.source.edges.indexOf(c)!=-1&&c.target.edges.indexOf(c)!=-1))throw"Source and/or target doesn't know this edge!";var p=c.source.edges.indexOf(c);if(c.source.edges.splice(p,1),p=c.target.edges.indexOf(c),c.target.edges.splice(p,1),!(c.source.owner!=null&&c.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(c.source.owner.getGraphManager().edges.indexOf(c)==-1)throw"Not in owner graph manager's edge list!";var p=c.source.owner.getGraphManager().edges.indexOf(c);c.source.owner.getGraphManager().edges.splice(p,1)}},o.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},o.prototype.getGraphs=function(){return this.graphs},o.prototype.getAllNodes=function(){if(this.allNodes==null){for(var l=[],u=this.getGraphs(),f=u.length,c=0;c<f;c++)l=l.concat(u[c].getNodes());this.allNodes=l}return this.allNodes},o.prototype.resetAllNodes=function(){this.allNodes=null},o.prototype.resetAllEdges=function(){this.allEdges=null},o.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},o.prototype.getAllEdges=function(){if(this.allEdges==null){var l=[],u=this.getGraphs();u.length;for(var f=0;f<u.length;f++)l=l.concat(u[f].getEdges());l=l.concat(this.edges),this.allEdges=l}return this.allEdges},o.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},o.prototype.setAllNodesToApplyGravitation=function(l){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=l},o.prototype.getRoot=function(){return this.rootGraph},o.prototype.setRootGraph=function(l){if(l.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=l,l.parent==null&&(l.parent=this.layout.newNode("Root node"))},o.prototype.getLayout=function(){return this.layout},o.prototype.isOneAncestorOfOther=function(l,u){if(!(l!=null&&u!=null))throw"assert failed";if(l==u)return!0;var f=l.getOwner(),c;do{if(c=f.getParent(),c==null)break;if(c==u)return!0;if(f=c.getOwner(),f==null)break}while(!0);f=u.getOwner();do{if(c=f.getParent(),c==null)break;if(c==l)return!0;if(f=c.getOwner(),f==null)break}while(!0);return!1},o.prototype.calcLowestCommonAncestors=function(){for(var l,u,f,c,h,v=this.getAllEdges(),d=v.length,g=0;g<d;g++){if(l=v[g],u=l.source,f=l.target,l.lca=null,l.sourceInLca=u,l.targetInLca=f,u==f){l.lca=u.getOwner();continue}for(c=u.getOwner();l.lca==null;){for(l.targetInLca=f,h=f.getOwner();l.lca==null;){if(h==c){l.lca=h;break}if(h==this.rootGraph)break;if(l.lca!=null)throw"assert failed";l.targetInLca=h.getParent(),h=l.targetInLca.getOwner()}if(c==this.rootGraph)break;l.lca==null&&(l.sourceInLca=c.getParent(),c=l.sourceInLca.getOwner())}if(l.lca==null)throw"assert failed"}},o.prototype.calcLowestCommonAncestor=function(l,u){if(l==u)return l.getOwner();var f=l.getOwner();do{if(f==null)break;var c=u.getOwner();do{if(c==null)break;if(c==f)return c;c=c.getParent().getOwner()}while(!0);f=f.getParent().getOwner()}while(!0);return f},o.prototype.calcInclusionTreeDepths=function(l,u){l==null&&u==null&&(l=this.rootGraph,u=1);for(var f,c=l.getNodes(),h=c.length,v=0;v<h;v++)f=c[v],f.inclusionTreeDepth=u,f.child!=null&&this.calcInclusionTreeDepths(f.child,u+1)},o.prototype.includesInvalidEdge=function(){for(var l,u=this.edges.length,f=0;f<u;f++)if(l=this.edges[f],this.isOneAncestorOfOther(l.source,l.target))return!0;return!1},r.exports=o},function(r,a,n){var i=n(0);function s(){}for(var o in i)s[o]=i[o];s.MAX_ITERATIONS=2500,s.DEFAULT_EDGE_LENGTH=50,s.DEFAULT_SPRING_STRENGTH=.45,s.DEFAULT_REPULSION_STRENGTH=4500,s.DEFAULT_GRAVITY_STRENGTH=.4,s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,s.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,s.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,s.COOLING_ADAPTATION_FACTOR=.33,s.ADAPTATION_LOWER_NODE_LIMIT=1e3,s.ADAPTATION_UPPER_NODE_LIMIT=5e3,s.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,s.MAX_NODE_DISPLACEMENT=s.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,s.MIN_REPULSION_DIST=s.DEFAULT_EDGE_LENGTH/10,s.CONVERGENCE_CHECK_PERIOD=100,s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,s.MIN_EDGE_LENGTH=1,s.GRID_CALCULATION_CHECK_PERIOD=10,r.exports=s},function(r,a,n){var i=n(12);function s(){}s.calcSeparationAmount=function(o,l,u,f){if(!o.intersects(l))throw"assert failed";var c=new Array(2);this.decideDirectionsForOverlappingNodes(o,l,c),u[0]=Math.min(o.getRight(),l.getRight())-Math.max(o.x,l.x),u[1]=Math.min(o.getBottom(),l.getBottom())-Math.max(o.y,l.y),o.getX()<=l.getX()&&o.getRight()>=l.getRight()?u[0]+=Math.min(l.getX()-o.getX(),o.getRight()-l.getRight()):l.getX()<=o.getX()&&l.getRight()>=o.getRight()&&(u[0]+=Math.min(o.getX()-l.getX(),l.getRight()-o.getRight())),o.getY()<=l.getY()&&o.getBottom()>=l.getBottom()?u[1]+=Math.min(l.getY()-o.getY(),o.getBottom()-l.getBottom()):l.getY()<=o.getY()&&l.getBottom()>=o.getBottom()&&(u[1]+=Math.min(o.getY()-l.getY(),l.getBottom()-o.getBottom()));var h=Math.abs((l.getCenterY()-o.getCenterY())/(l.getCenterX()-o.getCenterX()));l.getCenterY()===o.getCenterY()&&l.getCenterX()===o.getCenterX()&&(h=1);var v=h*u[0],d=u[1]/h;u[0]<d?d=u[0]:v=u[1],u[0]=-1*c[0]*(d/2+f),u[1]=-1*c[1]*(v/2+f)},s.decideDirectionsForOverlappingNodes=function(o,l,u){o.getCenterX()<l.getCenterX()?u[0]=-1:u[0]=1,o.getCenterY()<l.getCenterY()?u[1]=-1:u[1]=1},s.getIntersection2=function(o,l,u){var f=o.getCenterX(),c=o.getCenterY(),h=l.getCenterX(),v=l.getCenterY();if(o.intersects(l))return u[0]=f,u[1]=c,u[2]=h,u[3]=v,!0;var d=o.getX(),g=o.getY(),p=o.getRight(),y=o.getX(),b=o.getBottom(),m=o.getRight(),T=o.getWidthHalf(),C=o.getHeightHalf(),D=l.getX(),w=l.getY(),x=l.getRight(),E=l.getX(),S=l.getBottom(),A=l.getRight(),L=l.getWidthHalf(),I=l.getHeightHalf(),R=!1,P=!1;if(f===h){if(c>v)return u[0]=f,u[1]=g,u[2]=h,u[3]=S,!1;if(c<v)return u[0]=f,u[1]=b,u[2]=h,u[3]=w,!1}else if(c===v){if(f>h)return u[0]=d,u[1]=c,u[2]=x,u[3]=v,!1;if(f<h)return u[0]=p,u[1]=c,u[2]=D,u[3]=v,!1}else{var M=o.height/o.width,k=l.height/l.width,N=(v-c)/(h-f),B=void 0,z=void 0,F=void 0,G=void 0,H=void 0,X=void 0;if(-M===N?f>h?(u[0]=y,u[1]=b,R=!0):(u[0]=p,u[1]=g,R=!0):M===N&&(f>h?(u[0]=d,u[1]=g,R=!0):(u[0]=m,u[1]=b,R=!0)),-k===N?h>f?(u[2]=E,u[3]=S,P=!0):(u[2]=x,u[3]=w,P=!0):k===N&&(h>f?(u[2]=D,u[3]=w,P=!0):(u[2]=A,u[3]=S,P=!0)),R&&P)return!1;if(f>h?c>v?(B=this.getCardinalDirection(M,N,4),z=this.getCardinalDirection(k,N,2)):(B=this.getCardinalDirection(-M,N,3),z=this.getCardinalDirection(-k,N,1)):c>v?(B=this.getCardinalDirection(-M,N,1),z=this.getCardinalDirection(-k,N,3)):(B=this.getCardinalDirection(M,N,2),z=this.getCardinalDirection(k,N,4)),!R)switch(B){case 1:G=g,F=f+-C/N,u[0]=F,u[1]=G;break;case 2:F=m,G=c+T*N,u[0]=F,u[1]=G;break;case 3:G=b,F=f+C/N,u[0]=F,u[1]=G;break;case 4:F=y,G=c+-T*N,u[0]=F,u[1]=G;break}if(!P)switch(z){case 1:X=w,H=h+-I/N,u[2]=H,u[3]=X;break;case 2:H=A,X=v+L*N,u[2]=H,u[3]=X;break;case 3:X=S,H=h+I/N,u[2]=H,u[3]=X;break;case 4:H=E,X=v+-L*N,u[2]=H,u[3]=X;break}}return!1},s.getCardinalDirection=function(o,l,u){return o>l?u:1+u%4},s.getIntersection=function(o,l,u,f){if(f==null)return this.getIntersection2(o,l,u);var c=o.x,h=o.y,v=l.x,d=l.y,g=u.x,p=u.y,y=f.x,b=f.y,m=void 0,T=void 0,C=void 0,D=void 0,w=void 0,x=void 0,E=void 0,S=void 0,A=void 0;return C=d-h,w=c-v,E=v*h-c*d,D=b-p,x=g-y,S=y*p-g*b,A=C*x-D*w,A===0?null:(m=(w*S-x*E)/A,T=(D*E-C*S)/A,new i(m,T))},s.angleOfVector=function(o,l,u,f){var c=void 0;return o!==u?(c=Math.atan((f-l)/(u-o)),u<o?c+=Math.PI:f<l&&(c+=this.TWO_PI)):f<l?c=this.ONE_AND_HALF_PI:c=this.HALF_PI,c},s.doIntersect=function(o,l,u,f){var c=o.x,h=o.y,v=l.x,d=l.y,g=u.x,p=u.y,y=f.x,b=f.y,m=(v-c)*(b-p)-(y-g)*(d-h);if(m===0)return!1;var T=((b-p)*(y-c)+(g-y)*(b-h))/m,C=((h-d)*(y-c)+(v-c)*(b-h))/m;return 0<T&&T<1&&0<C&&C<1},s.HALF_PI=.5*Math.PI,s.ONE_AND_HALF_PI=1.5*Math.PI,s.TWO_PI=2*Math.PI,s.THREE_PI=3*Math.PI,r.exports=s},function(r,a,n){function i(){}i.sign=function(s){return s>0?1:s<0?-1:0},i.floor=function(s){return s<0?Math.ceil(s):Math.floor(s)},i.ceil=function(s){return s<0?Math.floor(s):Math.ceil(s)},r.exports=i},function(r,a,n){function i(){}i.MAX_VALUE=2147483647,i.MIN_VALUE=-2147483648,r.exports=i},function(r,a,n){var i=function(){function c(h,v){for(var d=0;d<v.length;d++){var g=v[d];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(h,g.key,g)}}return function(h,v,d){return v&&c(h.prototype,v),d&&c(h,d),h}}();function s(c,h){if(!(c instanceof h))throw new TypeError("Cannot call a class as a function")}var o=function(h){return{value:h,next:null,prev:null}},l=function(h,v,d,g){return h!==null?h.next=v:g.head=v,d!==null?d.prev=v:g.tail=v,v.prev=h,v.next=d,g.length++,v},u=function(h,v){var d=h.prev,g=h.next;return d!==null?d.next=g:v.head=g,g!==null?g.prev=d:v.tail=d,h.prev=h.next=null,v.length--,h},f=function(){function c(h){var v=this;s(this,c),this.length=0,this.head=null,this.tail=null,h!=null&&h.forEach(function(d){return v.push(d)})}return i(c,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(v,d){return l(d.prev,o(v),d,this)}},{key:"insertAfter",value:function(v,d){return l(d,o(v),d.next,this)}},{key:"insertNodeBefore",value:function(v,d){return l(d.prev,v,d,this)}},{key:"insertNodeAfter",value:function(v,d){return l(d,v,d.next,this)}},{key:"push",value:function(v){return l(this.tail,o(v),null,this)}},{key:"unshift",value:function(v){return l(null,o(v),this.head,this)}},{key:"remove",value:function(v){return u(v,this)}},{key:"pop",value:function(){return u(this.tail,this).value}},{key:"popNode",value:function(){return u(this.tail,this)}},{key:"shift",value:function(){return u(this.head,this).value}},{key:"shiftNode",value:function(){return u(this.head,this)}},{key:"get_object_at",value:function(v){if(v<=this.length()){for(var d=1,g=this.head;d<v;)g=g.next,d++;return g.value}}},{key:"set_object_at",value:function(v,d){if(v<=this.length()){for(var g=1,p=this.head;g<v;)p=p.next,g++;p.value=d}}}]),c}();r.exports=f},function(r,a,n){function i(s,o,l){this.x=null,this.y=null,s==null&&o==null&&l==null?(this.x=0,this.y=0):typeof s=="number"&&typeof o=="number"&&l==null?(this.x=s,this.y=o):s.constructor.name=="Point"&&o==null&&l==null&&(l=s,this.x=l.x,this.y=l.y)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.getLocation=function(){return new i(this.x,this.y)},i.prototype.setLocation=function(s,o,l){s.constructor.name=="Point"&&o==null&&l==null?(l=s,this.setLocation(l.x,l.y)):typeof s=="number"&&typeof o=="number"&&l==null&&(parseInt(s)==s&&parseInt(o)==o?this.move(s,o):(this.x=Math.floor(s+.5),this.y=Math.floor(o+.5)))},i.prototype.move=function(s,o){this.x=s,this.y=o},i.prototype.translate=function(s,o){this.x+=s,this.y+=o},i.prototype.equals=function(s){if(s.constructor.name=="Point"){var o=s;return this.x==o.x&&this.y==o.y}return this==s},i.prototype.toString=function(){return new i().constructor.name+"[x="+this.x+",y="+this.y+"]"},r.exports=i},function(r,a,n){function i(s,o,l,u){this.x=0,this.y=0,this.width=0,this.height=0,s!=null&&o!=null&&l!=null&&u!=null&&(this.x=s,this.y=o,this.width=l,this.height=u)}i.prototype.getX=function(){return this.x},i.prototype.setX=function(s){this.x=s},i.prototype.getY=function(){return this.y},i.prototype.setY=function(s){this.y=s},i.prototype.getWidth=function(){return this.width},i.prototype.setWidth=function(s){this.width=s},i.prototype.getHeight=function(){return this.height},i.prototype.setHeight=function(s){this.height=s},i.prototype.getRight=function(){return this.x+this.width},i.prototype.getBottom=function(){return this.y+this.height},i.prototype.intersects=function(s){return!(this.getRight()<s.x||this.getBottom()<s.y||s.getRight()<this.x||s.getBottom()<this.y)},i.prototype.getCenterX=function(){return this.x+this.width/2},i.prototype.getMinX=function(){return this.getX()},i.prototype.getMaxX=function(){return this.getX()+this.width},i.prototype.getCenterY=function(){return this.y+this.height/2},i.prototype.getMinY=function(){return this.getY()},i.prototype.getMaxY=function(){return this.getY()+this.height},i.prototype.getWidthHalf=function(){return this.width/2},i.prototype.getHeightHalf=function(){return this.height/2},r.exports=i},function(r,a,n){var i=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function s(){}s.lastID=0,s.createID=function(o){return s.isPrimitive(o)?o:(o.uniqueID!=null||(o.uniqueID=s.getString(),s.lastID++),o.uniqueID)},s.getString=function(o){return o==null&&(o=s.lastID),"Object#"+o},s.isPrimitive=function(o){var l=typeof o>"u"?"undefined":i(o);return o==null||l!="object"&&l!="function"},r.exports=s},function(r,a,n){function i(g){if(Array.isArray(g)){for(var p=0,y=Array(g.length);p<g.length;p++)y[p]=g[p];return y}else return Array.from(g)}var s=n(0),o=n(6),l=n(3),u=n(1),f=n(5),c=n(4),h=n(17),v=n(27);function d(g){v.call(this),this.layoutQuality=s.QUALITY,this.createBendsAsNeeded=s.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=s.DEFAULT_INCREMENTAL,this.animationOnLayout=s.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=s.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=s.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=s.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new o(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,g!=null&&(this.isRemoteUse=g)}d.RANDOM_SEED=1,d.prototype=Object.create(v.prototype),d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},d.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},d.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},d.prototype.newGraphManager=function(){var g=new o(this);return this.graphManager=g,g},d.prototype.newGraph=function(g){return new f(null,this.graphManager,g)},d.prototype.newNode=function(g){return new l(this.graphManager,g)},d.prototype.newEdge=function(g){return new u(null,null,g)},d.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},d.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var g;return this.checkLayoutSuccess()?g=!1:g=this.layout(),s.ANIMATE==="during"?!1:(g&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,g)},d.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},d.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var g=this.graphManager.getAllEdges(),p=0;p<g.length;p++)g[p];for(var y=this.graphManager.getRoot().getNodes(),p=0;p<y.length;p++)y[p];this.update(this.graphManager.getRoot())}},d.prototype.update=function(g){if(g==null)this.update2();else if(g instanceof l){var p=g;if(p.getChild()!=null)for(var y=p.getChild().getNodes(),b=0;b<y.length;b++)update(y[b]);if(p.vGraphObject!=null){var m=p.vGraphObject;m.update(p)}}else if(g instanceof u){var T=g;if(T.vGraphObject!=null){var C=T.vGraphObject;C.update(T)}}else if(g instanceof f){var D=g;if(D.vGraphObject!=null){var w=D.vGraphObject;w.update(D)}}},d.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=s.QUALITY,this.animationDuringLayout=s.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=s.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=s.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=s.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=s.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=s.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},d.prototype.transform=function(g){if(g==null)this.transform(new c(0,0));else{var p=new h,y=this.graphManager.getRoot().updateLeftTop();if(y!=null){p.setWorldOrgX(g.x),p.setWorldOrgY(g.y),p.setDeviceOrgX(y.x),p.setDeviceOrgY(y.y);for(var b=this.getAllNodes(),m,T=0;T<b.length;T++)m=b[T],m.transform(p)}}},d.prototype.positionNodesRandomly=function(g){if(g==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var p,y,b=g.getNodes(),m=0;m<b.length;m++)p=b[m],y=p.getChild(),y==null||y.getNodes().length==0?p.scatter():(this.positionNodesRandomly(y),p.updateBounds())},d.prototype.getFlatForest=function(){for(var g=[],p=!0,y=this.graphManager.getRoot().getNodes(),b=!0,m=0;m<y.length;m++)y[m].getChild()!=null&&(b=!1);if(!b)return g;var T=new Set,C=[],D=new Map,w=[];for(w=w.concat(y);w.length>0&&p;){for(C.push(w[0]);C.length>0&&p;){var x=C[0];C.splice(0,1),T.add(x);for(var E=x.getEdges(),m=0;m<E.length;m++){var S=E[m].getOtherEnd(x);if(D.get(x)!=S)if(!T.has(S))C.push(S),D.set(S,x);else{p=!1;break}}}if(!p)g=[];else{var A=[].concat(i(T));g.push(A);for(var m=0;m<A.length;m++){var L=A[m],I=w.indexOf(L);I>-1&&w.splice(I,1)}T=new Set,D=new Map}}return g},d.prototype.createDummyNodesForBendpoints=function(g){for(var p=[],y=g.source,b=this.graphManager.calcLowestCommonAncestor(g.source,g.target),m=0;m<g.bendpoints.length;m++){var T=this.newNode(null);T.setRect(new Point(0,0),new Dimension(1,1)),b.add(T);var C=this.newEdge(null);this.graphManager.add(C,y,T),p.add(T),y=T}var C=this.newEdge(null);return this.graphManager.add(C,y,g.target),this.edgeToDummyNodes.set(g,p),g.isInterGraph()?this.graphManager.remove(g):b.remove(g),p},d.prototype.createBendpointsFromDummyNodes=function(){var g=[];g=g.concat(this.graphManager.getAllEdges()),g=[].concat(i(this.edgeToDummyNodes.keys())).concat(g);for(var p=0;p<g.length;p++){var y=g[p];if(y.bendpoints.length>0){for(var b=this.edgeToDummyNodes.get(y),m=0;m<b.length;m++){var T=b[m],C=new c(T.getCenterX(),T.getCenterY()),D=y.bendpoints.get(m);D.x=C.x,D.y=C.y,T.getOwner().remove(T)}this.graphManager.add(y,y.source,y.target)}}},d.transform=function(g,p,y,b){if(y!=null&&b!=null){var m=p;if(g<=50){var T=p/y;m-=(p-T)/50*(50-g)}else{var C=p*b;m+=(C-p)/50*(g-50)}return m}else{var D,w;return g<=50?(D=9*p/500,w=p/10):(D=9*p/50,w=-8*p),D*g+w}},d.findCenterOfTree=function(g){var p=[];p=p.concat(g);var y=[],b=new Map,m=!1,T=null;(p.length==1||p.length==2)&&(m=!0,T=p[0]);for(var C=0;C<p.length;C++){var D=p[C],w=D.getNeighborsList().size;b.set(D,D.getNeighborsList().size),w==1&&y.push(D)}var x=[];for(x=x.concat(y);!m;){var E=[];E=E.concat(x),x=[];for(var C=0;C<p.length;C++){var D=p[C],S=p.indexOf(D);S>=0&&p.splice(S,1);var A=D.getNeighborsList();A.forEach(function(R){if(y.indexOf(R)<0){var P=b.get(R),M=P-1;M==1&&x.push(R),b.set(R,M)}})}y=y.concat(x),(p.length==1||p.length==2)&&(m=!0,T=p[0])}return T},d.prototype.setGraphManager=function(g){this.graphManager=g},r.exports=d},function(r,a,n){function i(){}i.seed=1,i.x=0,i.nextDouble=function(){return i.x=Math.sin(i.seed++)*1e4,i.x-Math.floor(i.x)},r.exports=i},function(r,a,n){var i=n(4);function s(o,l){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}s.prototype.getWorldOrgX=function(){return this.lworldOrgX},s.prototype.setWorldOrgX=function(o){this.lworldOrgX=o},s.prototype.getWorldOrgY=function(){return this.lworldOrgY},s.prototype.setWorldOrgY=function(o){this.lworldOrgY=o},s.prototype.getWorldExtX=function(){return this.lworldExtX},s.prototype.setWorldExtX=function(o){this.lworldExtX=o},s.prototype.getWorldExtY=function(){return this.lworldExtY},s.prototype.setWorldExtY=function(o){this.lworldExtY=o},s.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},s.prototype.setDeviceOrgX=function(o){this.ldeviceOrgX=o},s.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},s.prototype.setDeviceOrgY=function(o){this.ldeviceOrgY=o},s.prototype.getDeviceExtX=function(){return this.ldeviceExtX},s.prototype.setDeviceExtX=function(o){this.ldeviceExtX=o},s.prototype.getDeviceExtY=function(){return this.ldeviceExtY},s.prototype.setDeviceExtY=function(o){this.ldeviceExtY=o},s.prototype.transformX=function(o){var l=0,u=this.lworldExtX;return u!=0&&(l=this.ldeviceOrgX+(o-this.lworldOrgX)*this.ldeviceExtX/u),l},s.prototype.transformY=function(o){var l=0,u=this.lworldExtY;return u!=0&&(l=this.ldeviceOrgY+(o-this.lworldOrgY)*this.ldeviceExtY/u),l},s.prototype.inverseTransformX=function(o){var l=0,u=this.ldeviceExtX;return u!=0&&(l=this.lworldOrgX+(o-this.ldeviceOrgX)*this.lworldExtX/u),l},s.prototype.inverseTransformY=function(o){var l=0,u=this.ldeviceExtY;return u!=0&&(l=this.lworldOrgY+(o-this.ldeviceOrgY)*this.lworldExtY/u),l},s.prototype.inverseTransformPoint=function(o){var l=new i(this.inverseTransformX(o.x),this.inverseTransformY(o.y));return l},r.exports=s},function(r,a,n){function i(v){if(Array.isArray(v)){for(var d=0,g=Array(v.length);d<v.length;d++)g[d]=v[d];return g}else return Array.from(v)}var s=n(15),o=n(7),l=n(0),u=n(8),f=n(9);function c(){s.call(this),this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.springConstant=o.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=o.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=o.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=o.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=o.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*o.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=o.MAX_ITERATIONS}c.prototype=Object.create(s.prototype);for(var h in s)c[h]=s[h];c.prototype.initParameters=function(){s.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},c.prototype.calcIdealEdgeLengths=function(){for(var v,d,g,p,y,b,m=this.getGraphManager().getAllEdges(),T=0;T<m.length;T++)v=m[T],v.idealLength=this.idealEdgeLength,v.isInterGraph&&(g=v.getSource(),p=v.getTarget(),y=v.getSourceInLca().getEstimatedSize(),b=v.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(v.idealLength+=y+b-2*l.SIMPLE_NODE_SIZE),d=v.getLca().getInclusionTreeDepth(),v.idealLength+=o.DEFAULT_EDGE_LENGTH*o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(g.getInclusionTreeDepth()+p.getInclusionTreeDepth()-2*d))},c.prototype.initSpringEmbedder=function(){var v=this.getAllNodes().length;this.incremental?(v>o.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*o.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(v-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-o.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT_INCREMENTAL):(v>o.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(o.COOLING_ADAPTATION_FACTOR,1-(v-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*(1-o.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},c.prototype.calcSpringForces=function(){for(var v=this.getAllEdges(),d,g=0;g<v.length;g++)d=v[g],this.calcSpringForce(d,d.idealLength)},c.prototype.calcRepulsionForces=function(){var v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,g,p,y,b,m=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%o.GRID_CALCULATION_CHECK_PERIOD==1&&v&&this.updateGrid(),T=new Set,g=0;g<m.length;g++)y=m[g],this.calculateRepulsionForceOfANode(y,T,v,d),T.add(y);else for(g=0;g<m.length;g++)for(y=m[g],p=g+1;p<m.length;p++)b=m[p],y.getOwner()==b.getOwner()&&this.calcRepulsionForce(y,b)},c.prototype.calcGravitationalForces=function(){for(var v,d=this.getAllNodesToApplyGravitation(),g=0;g<d.length;g++)v=d[g],this.calcGravitationalForce(v)},c.prototype.moveNodes=function(){for(var v=this.getAllNodes(),d,g=0;g<v.length;g++)d=v[g],d.move()},c.prototype.calcSpringForce=function(v,d){var g=v.getSource(),p=v.getTarget(),y,b,m,T;if(this.uniformLeafNodeSizes&&g.getChild()==null&&p.getChild()==null)v.updateLengthSimple();else if(v.updateLength(),v.isOverlapingSourceAndTarget)return;y=v.getLength(),y!=0&&(b=this.springConstant*(y-d),m=b*(v.lengthX/y),T=b*(v.lengthY/y),g.springForceX+=m,g.springForceY+=T,p.springForceX-=m,p.springForceY-=T)},c.prototype.calcRepulsionForce=function(v,d){var g=v.getRect(),p=d.getRect(),y=new Array(2),b=new Array(4),m,T,C,D,w,x,E;if(g.intersects(p)){u.calcSeparationAmount(g,p,y,o.DEFAULT_EDGE_LENGTH/2),x=2*y[0],E=2*y[1];var S=v.noOfChildren*d.noOfChildren/(v.noOfChildren+d.noOfChildren);v.repulsionForceX-=S*x,v.repulsionForceY-=S*E,d.repulsionForceX+=S*x,d.repulsionForceY+=S*E}else this.uniformLeafNodeSizes&&v.getChild()==null&&d.getChild()==null?(m=p.getCenterX()-g.getCenterX(),T=p.getCenterY()-g.getCenterY()):(u.getIntersection(g,p,b),m=b[2]-b[0],T=b[3]-b[1]),Math.abs(m)<o.MIN_REPULSION_DIST&&(m=f.sign(m)*o.MIN_REPULSION_DIST),Math.abs(T)<o.MIN_REPULSION_DIST&&(T=f.sign(T)*o.MIN_REPULSION_DIST),C=m*m+T*T,D=Math.sqrt(C),w=this.repulsionConstant*v.noOfChildren*d.noOfChildren/C,x=w*m/D,E=w*T/D,v.repulsionForceX-=x,v.repulsionForceY-=E,d.repulsionForceX+=x,d.repulsionForceY+=E},c.prototype.calcGravitationalForce=function(v){var d,g,p,y,b,m,T,C;d=v.getOwner(),g=(d.getRight()+d.getLeft())/2,p=(d.getTop()+d.getBottom())/2,y=v.getCenterX()-g,b=v.getCenterY()-p,m=Math.abs(y)+v.getWidth()/2,T=Math.abs(b)+v.getHeight()/2,v.getOwner()==this.graphManager.getRoot()?(C=d.getEstimatedSize()*this.gravityRangeFactor,(m>C||T>C)&&(v.gravitationForceX=-this.gravityConstant*y,v.gravitationForceY=-this.gravityConstant*b)):(C=d.getEstimatedSize()*this.compoundGravityRangeFactor,(m>C||T>C)&&(v.gravitationForceX=-this.gravityConstant*y*this.compoundGravityConstant,v.gravitationForceY=-this.gravityConstant*b*this.compoundGravityConstant))},c.prototype.isConverged=function(){var v,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),v=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,v||d},c.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},c.prototype.calcNoOfChildrenForAllNodes=function(){for(var v,d=this.graphManager.getAllNodes(),g=0;g<d.length;g++)v=d[g],v.noOfChildren=v.getNoOfChildren()},c.prototype.calcGrid=function(v){var d=0,g=0;d=parseInt(Math.ceil((v.getRight()-v.getLeft())/this.repulsionRange)),g=parseInt(Math.ceil((v.getBottom()-v.getTop())/this.repulsionRange));for(var p=new Array(d),y=0;y<d;y++)p[y]=new Array(g);for(var y=0;y<d;y++)for(var b=0;b<g;b++)p[y][b]=new Array;return p},c.prototype.addNodeToGrid=function(v,d,g){var p=0,y=0,b=0,m=0;p=parseInt(Math.floor((v.getRect().x-d)/this.repulsionRange)),y=parseInt(Math.floor((v.getRect().width+v.getRect().x-d)/this.repulsionRange)),b=parseInt(Math.floor((v.getRect().y-g)/this.repulsionRange)),m=parseInt(Math.floor((v.getRect().height+v.getRect().y-g)/this.repulsionRange));for(var T=p;T<=y;T++)for(var C=b;C<=m;C++)this.grid[T][C].push(v),v.setGridCoordinates(p,y,b,m)},c.prototype.updateGrid=function(){var v,d,g=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),v=0;v<g.length;v++)d=g[v],this.addNodeToGrid(d,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},c.prototype.calculateRepulsionForceOfANode=function(v,d,g,p){if(this.totalIterations%o.GRID_CALCULATION_CHECK_PERIOD==1&&g||p){var y=new Set;v.surrounding=new Array;for(var b,m=this.grid,T=v.startX-1;T<v.finishX+2;T++)for(var C=v.startY-1;C<v.finishY+2;C++)if(!(T<0||C<0||T>=m.length||C>=m[0].length)){for(var D=0;D<m[T][C].length;D++)if(b=m[T][C][D],!(v.getOwner()!=b.getOwner()||v==b)&&!d.has(b)&&!y.has(b)){var w=Math.abs(v.getCenterX()-b.getCenterX())-(v.getWidth()/2+b.getWidth()/2),x=Math.abs(v.getCenterY()-b.getCenterY())-(v.getHeight()/2+b.getHeight()/2);w<=this.repulsionRange&&x<=this.repulsionRange&&y.add(b)}}v.surrounding=[].concat(i(y))}for(T=0;T<v.surrounding.length;T++)this.calcRepulsionForce(v,v.surrounding[T])},c.prototype.calcRepulsionRange=function(){return 0},r.exports=c},function(r,a,n){var i=n(1),s=n(7);function o(u,f,c){i.call(this,u,f,c),this.idealLength=s.DEFAULT_EDGE_LENGTH}o.prototype=Object.create(i.prototype);for(var l in i)o[l]=i[l];r.exports=o},function(r,a,n){var i=n(3);function s(l,u,f,c){i.call(this,l,u,f,c),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}s.prototype=Object.create(i.prototype);for(var o in i)s[o]=i[o];s.prototype.setGridCoordinates=function(l,u,f,c){this.startX=l,this.finishX=u,this.startY=f,this.finishY=c},r.exports=s},function(r,a,n){function i(s,o){this.width=0,this.height=0,s!==null&&o!==null&&(this.height=o,this.width=s)}i.prototype.getWidth=function(){return this.width},i.prototype.setWidth=function(s){this.width=s},i.prototype.getHeight=function(){return this.height},i.prototype.setHeight=function(s){this.height=s},r.exports=i},function(r,a,n){var i=n(14);function s(){this.map={},this.keys=[]}s.prototype.put=function(o,l){var u=i.createID(o);this.contains(u)||(this.map[u]=l,this.keys.push(o))},s.prototype.contains=function(o){return i.createID(o),this.map[o]!=null},s.prototype.get=function(o){var l=i.createID(o);return this.map[l]},s.prototype.keySet=function(){return this.keys},r.exports=s},function(r,a,n){var i=n(14);function s(){this.set={}}s.prototype.add=function(o){var l=i.createID(o);this.contains(l)||(this.set[l]=o)},s.prototype.remove=function(o){delete this.set[i.createID(o)]},s.prototype.clear=function(){this.set={}},s.prototype.contains=function(o){return this.set[i.createID(o)]==o},s.prototype.isEmpty=function(){return this.size()===0},s.prototype.size=function(){return Object.keys(this.set).length},s.prototype.addAllTo=function(o){for(var l=Object.keys(this.set),u=l.length,f=0;f<u;f++)o.push(this.set[l[f]])},s.prototype.size=function(){return Object.keys(this.set).length},s.prototype.addAll=function(o){for(var l=o.length,u=0;u<l;u++){var f=o[u];this.add(f)}},r.exports=s},function(r,a,n){var i=function(){function u(f,c){for(var h=0;h<c.length;h++){var v=c[h];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,c,h){return c&&u(f.prototype,c),h&&u(f,h),f}}();function s(u,f){if(!(u instanceof f))throw new TypeError("Cannot call a class as a function")}var o=n(11),l=function(){function u(f,c){s(this,u),(c!==null||c!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var h=void 0;f instanceof o?h=f.size():h=f.length,this._quicksort(f,0,h-1)}return i(u,[{key:"_quicksort",value:function(c,h,v){if(h<v){var d=this._partition(c,h,v);this._quicksort(c,h,d),this._quicksort(c,d+1,v)}}},{key:"_partition",value:function(c,h,v){for(var d=this._get(c,h),g=h,p=v;;){for(;this.compareFunction(d,this._get(c,p));)p--;for(;this.compareFunction(this._get(c,g),d);)g++;if(g<p)this._swap(c,g,p),g++,p--;else return p}}},{key:"_get",value:function(c,h){return c instanceof o?c.get_object_at(h):c[h]}},{key:"_set",value:function(c,h,v){c instanceof o?c.set_object_at(h,v):c[h]=v}},{key:"_swap",value:function(c,h,v){var d=this._get(c,h);this._set(c,h,this._get(c,v)),this._set(c,v,d)}},{key:"_defaultCompareFunction",value:function(c,h){return h>c}}]),u}();r.exports=l},function(r,a,n){var i=function(){function l(u,f){for(var c=0;c<f.length;c++){var h=f[c];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(u,h.key,h)}}return function(u,f,c){return f&&l(u.prototype,f),c&&l(u,c),u}}();function s(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")}var o=function(){function l(u,f){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;s(this,l),this.sequence1=u,this.sequence2=f,this.match_score=c,this.mismatch_penalty=h,this.gap_penalty=v,this.iMax=u.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var d=0;d<this.iMax;d++){this.grid[d]=new Array(this.jMax);for(var g=0;g<this.jMax;g++)this.grid[d][g]=0}this.tracebackGrid=new Array(this.iMax);for(var p=0;p<this.iMax;p++){this.tracebackGrid[p]=new Array(this.jMax);for(var y=0;y<this.jMax;y++)this.tracebackGrid[p][y]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return i(l,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var f=1;f<this.jMax;f++)this.grid[0][f]=this.grid[0][f-1]+this.gap_penalty,this.tracebackGrid[0][f]=[!1,!1,!0];for(var c=1;c<this.iMax;c++)this.grid[c][0]=this.grid[c-1][0]+this.gap_penalty,this.tracebackGrid[c][0]=[!1,!0,!1];for(var h=1;h<this.iMax;h++)for(var v=1;v<this.jMax;v++){var d=void 0;this.sequence1[h-1]===this.sequence2[v-1]?d=this.grid[h-1][v-1]+this.match_score:d=this.grid[h-1][v-1]+this.mismatch_penalty;var g=this.grid[h-1][v]+this.gap_penalty,p=this.grid[h][v-1]+this.gap_penalty,y=[d,g,p],b=this.arrayAllMaxIndexes(y);this.grid[h][v]=y[b[0]],this.tracebackGrid[h][v]=[b.includes(0),b.includes(1),b.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var f=[];for(f.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});f[0];){var c=f[0],h=this.tracebackGrid[c.pos[0]][c.pos[1]];h[0]&&f.push({pos:[c.pos[0]-1,c.pos[1]-1],seq1:this.sequence1[c.pos[0]-1]+c.seq1,seq2:this.sequence2[c.pos[1]-1]+c.seq2}),h[1]&&f.push({pos:[c.pos[0]-1,c.pos[1]],seq1:this.sequence1[c.pos[0]-1]+c.seq1,seq2:"-"+c.seq2}),h[2]&&f.push({pos:[c.pos[0],c.pos[1]-1],seq1:"-"+c.seq1,seq2:this.sequence2[c.pos[1]-1]+c.seq2}),c.pos[0]===0&&c.pos[1]===0&&this.alignments.push({sequence1:c.seq1,sequence2:c.seq2}),f.shift()}return this.alignments}},{key:"getAllIndexes",value:function(f,c){for(var h=[],v=-1;(v=f.indexOf(c,v+1))!==-1;)h.push(v);return h}},{key:"arrayAllMaxIndexes",value:function(f){return this.getAllIndexes(f,Math.max.apply(null,f))}}]),l}();r.exports=o},function(r,a,n){var i=function(){};i.FDLayout=n(18),i.FDLayoutConstants=n(7),i.FDLayoutEdge=n(19),i.FDLayoutNode=n(20),i.DimensionD=n(21),i.HashMap=n(22),i.HashSet=n(23),i.IGeometry=n(8),i.IMath=n(9),i.Integer=n(10),i.Point=n(12),i.PointD=n(4),i.RandomSeed=n(16),i.RectangleD=n(13),i.Transform=n(17),i.UniqueIDGeneretor=n(14),i.Quicksort=n(24),i.LinkedList=n(11),i.LGraphObject=n(2),i.LGraph=n(5),i.LEdge=n(1),i.LGraphManager=n(6),i.LNode=n(3),i.Layout=n(15),i.LayoutConstants=n(0),i.NeedlemanWunsch=n(25),r.exports=i},function(r,a,n){function i(){this.listeners=[]}var s=i.prototype;s.addListener=function(o,l){this.listeners.push({event:o,callback:l})},s.removeListener=function(o,l){for(var u=this.listeners.length;u>=0;u--){var f=this.listeners[u];f.event===o&&f.callback===l&&this.listeners.splice(u,1)}},s.emit=function(o,l){for(var u=0;u<this.listeners.length;u++){var f=this.listeners[u];o===f.event&&f.callback(l)}},r.exports=i}])})}(ui)),ui.exports}var Ao;function Ky(){return Ao||(Ao=1,function(t,e){(function(a,n){t.exports=n(qy())})(Li,function(r){return function(a){var n={};function i(s){if(n[s])return n[s].exports;var o=n[s]={i:s,l:!1,exports:{}};return a[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=a,i.c=n,i.i=function(s){return s},i.d=function(s,o,l){i.o(s,o)||Object.defineProperty(s,o,{configurable:!1,enumerable:!0,get:l})},i.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(o,"a",o),o},i.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},i.p="",i(i.s=7)}([function(a,n){a.exports=r},function(a,n,i){var s=i(0).FDLayoutConstants;function o(){}for(var l in s)o[l]=s[l];o.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,o.DEFAULT_RADIAL_SEPARATION=s.DEFAULT_EDGE_LENGTH,o.DEFAULT_COMPONENT_SEPERATION=60,o.TILE=!0,o.TILING_PADDING_VERTICAL=10,o.TILING_PADDING_HORIZONTAL=10,o.TREE_REDUCTION_ON_INCREMENTAL=!1,a.exports=o},function(a,n,i){var s=i(0).FDLayoutEdge;function o(u,f,c){s.call(this,u,f,c)}o.prototype=Object.create(s.prototype);for(var l in s)o[l]=s[l];a.exports=o},function(a,n,i){var s=i(0).LGraph;function o(u,f,c){s.call(this,u,f,c)}o.prototype=Object.create(s.prototype);for(var l in s)o[l]=s[l];a.exports=o},function(a,n,i){var s=i(0).LGraphManager;function o(u){s.call(this,u)}o.prototype=Object.create(s.prototype);for(var l in s)o[l]=s[l];a.exports=o},function(a,n,i){var s=i(0).FDLayoutNode,o=i(0).IMath;function l(f,c,h,v){s.call(this,f,c,h,v)}l.prototype=Object.create(s.prototype);for(var u in s)l[u]=s[u];l.prototype.move=function(){var f=this.graphManager.getLayout();this.displacementX=f.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=f.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>f.coolingFactor*f.maxNodeDisplacement&&(this.displacementX=f.coolingFactor*f.maxNodeDisplacement*o.sign(this.displacementX)),Math.abs(this.displacementY)>f.coolingFactor*f.maxNodeDisplacement&&(this.displacementY=f.coolingFactor*f.maxNodeDisplacement*o.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),f.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},l.prototype.propogateDisplacementToChildren=function(f,c){for(var h=this.getChild().getNodes(),v,d=0;d<h.length;d++)v=h[d],v.getChild()==null?(v.moveBy(f,c),v.displacementX+=f,v.displacementY+=c):v.propogateDisplacementToChildren(f,c)},l.prototype.setPred1=function(f){this.pred1=f},l.prototype.getPred1=function(){return pred1},l.prototype.getPred2=function(){return pred2},l.prototype.setNext=function(f){this.next=f},l.prototype.getNext=function(){return next},l.prototype.setProcessed=function(f){this.processed=f},l.prototype.isProcessed=function(){return processed},a.exports=l},function(a,n,i){var s=i(0).FDLayout,o=i(4),l=i(3),u=i(5),f=i(2),c=i(1),h=i(0).FDLayoutConstants,v=i(0).LayoutConstants,d=i(0).Point,g=i(0).PointD,p=i(0).Layout,y=i(0).Integer,b=i(0).IGeometry,m=i(0).LGraph,T=i(0).Transform;function C(){s.call(this),this.toBeTiled={}}C.prototype=Object.create(s.prototype);for(var D in s)C[D]=s[D];C.prototype.newGraphManager=function(){var w=new o(this);return this.graphManager=w,w},C.prototype.newGraph=function(w){return new l(null,this.graphManager,w)},C.prototype.newNode=function(w){return new u(this.graphManager,w)},C.prototype.newEdge=function(w){return new f(null,null,w)},C.prototype.initParameters=function(){s.prototype.initParameters.call(this,arguments),this.isSubLayout||(c.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=c.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=c.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=h.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=h.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=h.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=h.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=h.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/h.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=h.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},C.prototype.layout=function(){var w=v.DEFAULT_CREATE_BENDS_AS_NEEDED;return w&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},C.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(c.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(L){return x.has(L)});this.graphManager.setAllNodesToApplyGravitation(E)}}else{var w=this.getFlatForest();if(w.length>0)this.positionNodesRadially(w);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(S){return x.has(S)});this.graphManager.setAllNodesToApplyGravitation(E),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},C.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%h.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var w=new Set(this.getAllNodes()),x=this.nodesWithGravity.filter(function(A){return w.has(A)});this.graphManager.setAllNodesToApplyGravitation(x),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=h.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var E=!this.isTreeGrowing&&!this.isGrowthFinished,S=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(E,S),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},C.prototype.getPositionsData=function(){for(var w=this.graphManager.getAllNodes(),x={},E=0;E<w.length;E++){var S=w[E].rect,A=w[E].id;x[A]={id:A,x:S.getCenterX(),y:S.getCenterY(),w:S.width,h:S.height}}return x},C.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var w=!1;if(h.ANIMATE==="during")this.emit("layoutstarted");else{for(;!w;)w=this.tick();this.graphManager.updateBounds()}},C.prototype.calculateNodesToApplyGravitationTo=function(){var w=[],x,E=this.graphManager.getGraphs(),S=E.length,A;for(A=0;A<S;A++)x=E[A],x.updateConnected(),x.isConnected||(w=w.concat(x.getNodes()));return w},C.prototype.createBendpoints=function(){var w=[];w=w.concat(this.graphManager.getAllEdges());var x=new Set,E;for(E=0;E<w.length;E++){var S=w[E];if(!x.has(S)){var A=S.getSource(),L=S.getTarget();if(A==L)S.getBendpoints().push(new g),S.getBendpoints().push(new g),this.createDummyNodesForBendpoints(S),x.add(S);else{var I=[];if(I=I.concat(A.getEdgeListToNode(L)),I=I.concat(L.getEdgeListToNode(A)),!x.has(I[0])){if(I.length>1){var R;for(R=0;R<I.length;R++){var P=I[R];P.getBendpoints().push(new g),this.createDummyNodesForBendpoints(P)}}I.forEach(function(M){x.add(M)})}}}if(x.size==w.length)break}},C.prototype.positionNodesRadially=function(w){for(var x=new d(0,0),E=Math.ceil(Math.sqrt(w.length)),S=0,A=0,L=0,I=new g(0,0),R=0;R<w.length;R++){R%E==0&&(L=0,A=S,R!=0&&(A+=c.DEFAULT_COMPONENT_SEPERATION),S=0);var P=w[R],M=p.findCenterOfTree(P);x.x=L,x.y=A,I=C.radialLayout(P,M,x),I.y>S&&(S=Math.floor(I.y)),L=Math.floor(I.x+c.DEFAULT_COMPONENT_SEPERATION)}this.transform(new g(v.WORLD_CENTER_X-I.x/2,v.WORLD_CENTER_Y-I.y/2))},C.radialLayout=function(w,x,E){var S=Math.max(this.maxDiagonalInTree(w),c.DEFAULT_RADIAL_SEPARATION);C.branchRadialLayout(x,null,0,359,0,S);var A=m.calculateBounds(w),L=new T;L.setDeviceOrgX(A.getMinX()),L.setDeviceOrgY(A.getMinY()),L.setWorldOrgX(E.x),L.setWorldOrgY(E.y);for(var I=0;I<w.length;I++){var R=w[I];R.transform(L)}var P=new g(A.getMaxX(),A.getMaxY());return L.inverseTransformPoint(P)},C.branchRadialLayout=function(w,x,E,S,A,L){var I=(S-E+1)/2;I<0&&(I+=180);var R=(I+E)%360,P=R*b.TWO_PI/360,M=A*Math.cos(P),k=A*Math.sin(P);w.setCenter(M,k);var N=[];N=N.concat(w.getEdges());var B=N.length;x!=null&&B--;for(var z=0,F=N.length,G,H=w.getEdgesBetween(x);H.length>1;){var X=H[0];H.splice(0,1);var K=N.indexOf(X);K>=0&&N.splice(K,1),F--,B--}x!=null?G=(N.indexOf(H[0])+1)%F:G=0;for(var q=Math.abs(S-E)/B,J=G;z!=B;J=++J%F){var j=N[J].getOtherEnd(w);if(j!=x){var Y=(E+z*q)%360,_=(Y+q)%360;C.branchRadialLayout(j,w,Y,_,A+L,L),z++}}},C.maxDiagonalInTree=function(w){for(var x=y.MIN_VALUE,E=0;E<w.length;E++){var S=w[E],A=S.getDiagonal();A>x&&(x=A)}return x},C.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},C.prototype.groupZeroDegreeMembers=function(){var w=this,x={};this.memberGroups={},this.idToDummyNode={};for(var E=[],S=this.graphManager.getAllNodes(),A=0;A<S.length;A++){var L=S[A],I=L.getParent();this.getNodeDegreeWithChildren(L)===0&&(I.id==null||!this.getToBeTiled(I))&&E.push(L)}for(var A=0;A<E.length;A++){var L=E[A],R=L.getParent().id;typeof x[R]>"u"&&(x[R]=[]),x[R]=x[R].concat(L)}Object.keys(x).forEach(function(P){if(x[P].length>1){var M="DummyCompound_"+P;w.memberGroups[M]=x[P];var k=x[P][0].getParent(),N=new u(w.graphManager);N.id=M,N.paddingLeft=k.paddingLeft||0,N.paddingRight=k.paddingRight||0,N.paddingBottom=k.paddingBottom||0,N.paddingTop=k.paddingTop||0,w.idToDummyNode[M]=N;var B=w.getGraphManager().add(w.newGraph(),N),z=k.getChild();z.add(N);for(var F=0;F<x[P].length;F++){var G=x[P][F];z.remove(G),B.add(G)}}})},C.prototype.clearCompounds=function(){var w={},x={};this.performDFSOnCompounds();for(var E=0;E<this.compoundOrder.length;E++)x[this.compoundOrder[E].id]=this.compoundOrder[E],w[this.compoundOrder[E].id]=[].concat(this.compoundOrder[E].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[E].getChild()),this.compoundOrder[E].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(w,x)},C.prototype.clearZeroDegreeMembers=function(){var w=this,x=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(E){var S=w.idToDummyNode[E];x[E]=w.tileNodes(w.memberGroups[E],S.paddingLeft+S.paddingRight),S.rect.width=x[E].width,S.rect.height=x[E].height})},C.prototype.repopulateCompounds=function(){for(var w=this.compoundOrder.length-1;w>=0;w--){var x=this.compoundOrder[w],E=x.id,S=x.paddingLeft,A=x.paddingTop;this.adjustLocations(this.tiledMemberPack[E],x.rect.x,x.rect.y,S,A)}},C.prototype.repopulateZeroDegreeMembers=function(){var w=this,x=this.tiledZeroDegreePack;Object.keys(x).forEach(function(E){var S=w.idToDummyNode[E],A=S.paddingLeft,L=S.paddingTop;w.adjustLocations(x[E],S.rect.x,S.rect.y,A,L)})},C.prototype.getToBeTiled=function(w){var x=w.id;if(this.toBeTiled[x]!=null)return this.toBeTiled[x];var E=w.getChild();if(E==null)return this.toBeTiled[x]=!1,!1;for(var S=E.getNodes(),A=0;A<S.length;A++){var L=S[A];if(this.getNodeDegree(L)>0)return this.toBeTiled[x]=!1,!1;if(L.getChild()==null){this.toBeTiled[L.id]=!1;continue}if(!this.getToBeTiled(L))return this.toBeTiled[x]=!1,!1}return this.toBeTiled[x]=!0,!0},C.prototype.getNodeDegree=function(w){w.id;for(var x=w.getEdges(),E=0,S=0;S<x.length;S++){var A=x[S];A.getSource().id!==A.getTarget().id&&(E=E+1)}return E},C.prototype.getNodeDegreeWithChildren=function(w){var x=this.getNodeDegree(w);if(w.getChild()==null)return x;for(var E=w.getChild().getNodes(),S=0;S<E.length;S++){var A=E[S];x+=this.getNodeDegreeWithChildren(A)}return x},C.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},C.prototype.fillCompexOrderByDFS=function(w){for(var x=0;x<w.length;x++){var E=w[x];E.getChild()!=null&&this.fillCompexOrderByDFS(E.getChild().getNodes()),this.getToBeTiled(E)&&this.compoundOrder.push(E)}},C.prototype.adjustLocations=function(w,x,E,S,A){x+=S,E+=A;for(var L=x,I=0;I<w.rows.length;I++){var R=w.rows[I];x=L;for(var P=0,M=0;M<R.length;M++){var k=R[M];k.rect.x=x,k.rect.y=E,x+=k.rect.width+w.horizontalPadding,k.rect.height>P&&(P=k.rect.height)}E+=P+w.verticalPadding}},C.prototype.tileCompoundMembers=function(w,x){var E=this;this.tiledMemberPack=[],Object.keys(w).forEach(function(S){var A=x[S];E.tiledMemberPack[S]=E.tileNodes(w[S],A.paddingLeft+A.paddingRight),A.rect.width=E.tiledMemberPack[S].width,A.rect.height=E.tiledMemberPack[S].height})},C.prototype.tileNodes=function(w,x){var E=c.TILING_PADDING_VERTICAL,S=c.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:x,verticalPadding:E,horizontalPadding:S};w.sort(function(R,P){return R.rect.width*R.rect.height>P.rect.width*P.rect.height?-1:R.rect.width*R.rect.height<P.rect.width*P.rect.height?1:0});for(var L=0;L<w.length;L++){var I=w[L];A.rows.length==0?this.insertNodeToRow(A,I,0,x):this.canAddHorizontal(A,I.rect.width,I.rect.height)?this.insertNodeToRow(A,I,this.getShortestRowIndex(A),x):this.insertNodeToRow(A,I,A.rows.length,x),this.shiftToLastRow(A)}return A},C.prototype.insertNodeToRow=function(w,x,E,S){var A=S;if(E==w.rows.length){var L=[];w.rows.push(L),w.rowWidth.push(A),w.rowHeight.push(0)}var I=w.rowWidth[E]+x.rect.width;w.rows[E].length>0&&(I+=w.horizontalPadding),w.rowWidth[E]=I,w.width<I&&(w.width=I);var R=x.rect.height;E>0&&(R+=w.verticalPadding);var P=0;R>w.rowHeight[E]&&(P=w.rowHeight[E],w.rowHeight[E]=R,P=w.rowHeight[E]-P),w.height+=P,w.rows[E].push(x)},C.prototype.getShortestRowIndex=function(w){for(var x=-1,E=Number.MAX_VALUE,S=0;S<w.rows.length;S++)w.rowWidth[S]<E&&(x=S,E=w.rowWidth[S]);return x},C.prototype.getLongestRowIndex=function(w){for(var x=-1,E=Number.MIN_VALUE,S=0;S<w.rows.length;S++)w.rowWidth[S]>E&&(x=S,E=w.rowWidth[S]);return x},C.prototype.canAddHorizontal=function(w,x,E){var S=this.getShortestRowIndex(w);if(S<0)return!0;var A=w.rowWidth[S];if(A+w.horizontalPadding+x<=w.width)return!0;var L=0;w.rowHeight[S]<E&&S>0&&(L=E+w.verticalPadding-w.rowHeight[S]);var I;w.width-A>=x+w.horizontalPadding?I=(w.height+L)/(A+x+w.horizontalPadding):I=(w.height+L)/w.width,L=E+w.verticalPadding;var R;return w.width<x?R=(w.height+L)/x:R=(w.height+L)/w.width,R<1&&(R=1/R),I<1&&(I=1/I),I<R},C.prototype.shiftToLastRow=function(w){var x=this.getLongestRowIndex(w),E=w.rowWidth.length-1,S=w.rows[x],A=S[S.length-1],L=A.width+w.horizontalPadding;if(w.width-w.rowWidth[E]>L&&x!=E){S.splice(-1,1),w.rows[E].push(A),w.rowWidth[x]=w.rowWidth[x]-L,w.rowWidth[E]=w.rowWidth[E]+L,w.width=w.rowWidth[instance.getLongestRowIndex(w)];for(var I=Number.MIN_VALUE,R=0;R<S.length;R++)S[R].height>I&&(I=S[R].height);x>0&&(I+=w.verticalPadding);var P=w.rowHeight[x]+w.rowHeight[E];w.rowHeight[x]=I,w.rowHeight[E]<A.height+w.verticalPadding&&(w.rowHeight[E]=A.height+w.verticalPadding);var M=w.rowHeight[x]+w.rowHeight[E];w.height+=M-P,this.shiftToLastRow(w)}},C.prototype.tilingPreLayout=function(){c.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},C.prototype.tilingPostLayout=function(){c.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},C.prototype.reduceTrees=function(){for(var w=[],x=!0,E;x;){var S=this.graphManager.getAllNodes(),A=[];x=!1;for(var L=0;L<S.length;L++)E=S[L],E.getEdges().length==1&&!E.getEdges()[0].isInterGraph&&E.getChild()==null&&(A.push([E,E.getEdges()[0],E.getOwner()]),x=!0);if(x==!0){for(var I=[],R=0;R<A.length;R++)A[R][0].getEdges().length==1&&(I.push(A[R]),A[R][0].getOwner().remove(A[R][0]));w.push(I),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=w},C.prototype.growTree=function(w){for(var x=w.length,E=w[x-1],S,A=0;A<E.length;A++)S=E[A],this.findPlaceforPrunedNode(S),S[2].add(S[0]),S[2].add(S[1],S[1].source,S[1].target);w.splice(w.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},C.prototype.findPlaceforPrunedNode=function(w){var x,E,S=w[0];S==w[1].source?E=w[1].target:E=w[1].source;var A=E.startX,L=E.finishX,I=E.startY,R=E.finishY,P=0,M=0,k=0,N=0,B=[P,k,M,N];if(I>0)for(var z=A;z<=L;z++)B[0]+=this.grid[z][I-1].length+this.grid[z][I].length-1;if(L<this.grid.length-1)for(var z=I;z<=R;z++)B[1]+=this.grid[L+1][z].length+this.grid[L][z].length-1;if(R<this.grid[0].length-1)for(var z=A;z<=L;z++)B[2]+=this.grid[z][R+1].length+this.grid[z][R].length-1;if(A>0)for(var z=I;z<=R;z++)B[3]+=this.grid[A-1][z].length+this.grid[A][z].length-1;for(var F=y.MAX_VALUE,G,H,X=0;X<B.length;X++)B[X]<F?(F=B[X],G=1,H=X):B[X]==F&&G++;if(G==3&&F==0)B[0]==0&&B[1]==0&&B[2]==0?x=1:B[0]==0&&B[1]==0&&B[3]==0?x=0:B[0]==0&&B[2]==0&&B[3]==0?x=3:B[1]==0&&B[2]==0&&B[3]==0&&(x=2);else if(G==2&&F==0){var K=Math.floor(Math.random()*2);B[0]==0&&B[1]==0?K==0?x=0:x=1:B[0]==0&&B[2]==0?K==0?x=0:x=2:B[0]==0&&B[3]==0?K==0?x=0:x=3:B[1]==0&&B[2]==0?K==0?x=1:x=2:B[1]==0&&B[3]==0?K==0?x=1:x=3:K==0?x=2:x=3}else if(G==4&&F==0){var K=Math.floor(Math.random()*4);x=K}else x=H;x==0?S.setCenter(E.getCenterX(),E.getCenterY()-E.getHeight()/2-h.DEFAULT_EDGE_LENGTH-S.getHeight()/2):x==1?S.setCenter(E.getCenterX()+E.getWidth()/2+h.DEFAULT_EDGE_LENGTH+S.getWidth()/2,E.getCenterY()):x==2?S.setCenter(E.getCenterX(),E.getCenterY()+E.getHeight()/2+h.DEFAULT_EDGE_LENGTH+S.getHeight()/2):S.setCenter(E.getCenterX()-E.getWidth()/2-h.DEFAULT_EDGE_LENGTH-S.getWidth()/2,E.getCenterY())},a.exports=C},function(a,n,i){var s={};s.layoutBase=i(0),s.CoSEConstants=i(1),s.CoSEEdge=i(2),s.CoSEGraph=i(3),s.CoSEGraphManager=i(4),s.CoSELayout=i(6),s.CoSENode=i(5),a.exports=s}])})}(li)),li.exports}(function(t,e){(function(a,n){t.exports=n(Ky())})(Li,function(r){return function(a){var n={};function i(s){if(n[s])return n[s].exports;var o=n[s]={i:s,l:!1,exports:{}};return a[s].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=a,i.c=n,i.i=function(s){return s},i.d=function(s,o,l){i.o(s,o)||Object.defineProperty(s,o,{configurable:!1,enumerable:!0,get:l})},i.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(o,"a",o),o},i.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},i.p="",i(i.s=1)}([function(a,n){a.exports=r},function(a,n,i){var s=i(0).layoutBase.LayoutConstants,o=i(0).layoutBase.FDLayoutConstants,l=i(0).CoSEConstants,u=i(0).CoSELayout,f=i(0).CoSENode,c=i(0).layoutBase.PointD,h=i(0).layoutBase.DimensionD,v={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function d(b,m){var T={};for(var C in b)T[C]=b[C];for(var C in m)T[C]=m[C];return T}function g(b){this.options=d(v,b),p(this.options)}var p=function(m){m.nodeRepulsion!=null&&(l.DEFAULT_REPULSION_STRENGTH=o.DEFAULT_REPULSION_STRENGTH=m.nodeRepulsion),m.idealEdgeLength!=null&&(l.DEFAULT_EDGE_LENGTH=o.DEFAULT_EDGE_LENGTH=m.idealEdgeLength),m.edgeElasticity!=null&&(l.DEFAULT_SPRING_STRENGTH=o.DEFAULT_SPRING_STRENGTH=m.edgeElasticity),m.nestingFactor!=null&&(l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=m.nestingFactor),m.gravity!=null&&(l.DEFAULT_GRAVITY_STRENGTH=o.DEFAULT_GRAVITY_STRENGTH=m.gravity),m.numIter!=null&&(l.MAX_ITERATIONS=o.MAX_ITERATIONS=m.numIter),m.gravityRange!=null&&(l.DEFAULT_GRAVITY_RANGE_FACTOR=o.DEFAULT_GRAVITY_RANGE_FACTOR=m.gravityRange),m.gravityCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=m.gravityCompound),m.gravityRangeCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=m.gravityRangeCompound),m.initialEnergyOnIncremental!=null&&(l.DEFAULT_COOLING_FACTOR_INCREMENTAL=o.DEFAULT_COOLING_FACTOR_INCREMENTAL=m.initialEnergyOnIncremental),m.quality=="draft"?s.QUALITY=0:m.quality=="proof"?s.QUALITY=2:s.QUALITY=1,l.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=s.NODE_DIMENSIONS_INCLUDE_LABELS=m.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=s.DEFAULT_INCREMENTAL=!m.randomize,l.ANIMATE=o.ANIMATE=s.ANIMATE=m.animate,l.TILE=m.tile,l.TILING_PADDING_VERTICAL=typeof m.tilingPaddingVertical=="function"?m.tilingPaddingVertical.call():m.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof m.tilingPaddingHorizontal=="function"?m.tilingPaddingHorizontal.call():m.tilingPaddingHorizontal};g.prototype.run=function(){var b,m,T=this.options;this.idToLNode={};var C=this.layout=new u,D=this;D.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var w=C.newGraphManager();this.gm=w;var x=this.options.eles.nodes(),E=this.options.eles.edges();this.root=w.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(x),C);for(var S=0;S<E.length;S++){var A=E[S],L=this.idToLNode[A.data("source")],I=this.idToLNode[A.data("target")];if(L!==I&&L.getEdgesBetween(I).length==0){var R=w.add(C.newEdge(),L,I);R.id=A.id()}}var P=function(N,B){typeof N=="number"&&(N=B);var z=N.data("id"),F=D.idToLNode[z];return{x:F.getRect().getCenterX(),y:F.getRect().getCenterY()}},M=function k(){for(var N=function(){T.fit&&T.cy.fit(T.eles,T.padding),b||(b=!0,D.cy.one("layoutready",T.ready),D.cy.trigger({type:"layoutready",layout:D}))},B=D.options.refresh,z,F=0;F<B&&!z;F++)z=D.stopped||D.layout.tick();if(z){C.checkLayoutSuccess()&&!C.isSubLayout&&C.doPostLayout(),C.tilingPostLayout&&C.tilingPostLayout(),C.isLayoutFinished=!0,D.options.eles.nodes().positions(P),N(),D.cy.one("layoutstop",D.options.stop),D.cy.trigger({type:"layoutstop",layout:D}),m&&cancelAnimationFrame(m),b=!1;return}var G=D.layout.getPositionsData();T.eles.nodes().positions(function(H,X){if(typeof H=="number"&&(H=X),!H.isParent()){for(var K=H.id(),q=G[K],J=H;q==null&&(q=G[J.data("parent")]||G["DummyCompound_"+J.data("parent")],G[K]=q,J=J.parent()[0],J!=null););return q!=null?{x:q.x,y:q.y}:{x:H.position("x"),y:H.position("y")}}}),N(),m=requestAnimationFrame(k)};return C.addListener("layoutstarted",function(){D.options.animate==="during"&&(m=requestAnimationFrame(M))}),C.runLayout(),this.options.animate!=="during"&&(D.options.eles.nodes().not(":parent").layoutPositions(D,D.options,P),b=!1),this},g.prototype.getTopMostNodes=function(b){for(var m={},T=0;T<b.length;T++)m[b[T].id()]=!0;var C=b.filter(function(D,w){typeof D=="number"&&(D=w);for(var x=D.parent()[0];x!=null;){if(m[x.id()])return!1;x=x.parent()[0]}return!0});return C},g.prototype.processChildrenList=function(b,m,T){for(var C=m.length,D=0;D<C;D++){var w=m[D],x=w.children(),E,S=w.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(w.outerWidth()!=null&&w.outerHeight()!=null?E=b.add(new f(T.graphManager,new c(w.position("x")-S.w/2,w.position("y")-S.h/2),new h(parseFloat(S.w),parseFloat(S.h)))):E=b.add(new f(this.graphManager)),E.id=w.data("id"),E.paddingLeft=parseInt(w.css("padding")),E.paddingTop=parseInt(w.css("padding")),E.paddingRight=parseInt(w.css("padding")),E.paddingBottom=parseInt(w.css("padding")),this.options.nodeDimensionsIncludeLabels&&w.isParent()){var A=w.boundingBox({includeLabels:!0,includeNodes:!1}).w,L=w.boundingBox({includeLabels:!0,includeNodes:!1}).h,I=w.css("text-halign");E.labelWidth=A,E.labelHeight=L,E.labelPos=I}if(this.idToLNode[w.data("id")]=E,isNaN(E.rect.x)&&(E.rect.x=0),isNaN(E.rect.y)&&(E.rect.y=0),x!=null&&x.length>0){var R;R=T.getGraphManager().add(T.newGraph(),E),this.processChildrenList(R,x,T)}}},g.prototype.stop=function(){return this.stopped=!0,this};var y=function(m){m("layout","cose-bilkent",g)};typeof cytoscape<"u"&&y(cytoscape),a.exports=y}])})})(Eu);var Zy=Eu.exports;const Qy=Nu(Zy);var Ai=function(){var t=function(T,C,D,w){for(D=D||{},w=T.length;w--;D[T[w]]=C);return D},e=[1,4],r=[1,13],a=[1,12],n=[1,15],i=[1,16],s=[1,20],o=[1,19],l=[6,7,8],u=[1,26],f=[1,24],c=[1,25],h=[6,7,11],v=[1,6,13,15,16,19,22],d=[1,33],g=[1,34],p=[1,6,7,11,13,15,16,19,22],y={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(C,D,w,x,E,S,A){var L=S.length-1;switch(E){case 6:case 7:return x;case 8:x.getLogger().trace("Stop NL ");break;case 9:x.getLogger().trace("Stop EOF ");break;case 11:x.getLogger().trace("Stop NL2 ");break;case 12:x.getLogger().trace("Stop EOF2 ");break;case 15:x.getLogger().info("Node: ",S[L].id),x.addNode(S[L-1].length,S[L].id,S[L].descr,S[L].type);break;case 16:x.getLogger().trace("Icon: ",S[L]),x.decorateNode({icon:S[L]});break;case 17:case 21:x.decorateNode({class:S[L]});break;case 18:x.getLogger().trace("SPACELIST");break;case 19:x.getLogger().trace("Node: ",S[L].id),x.addNode(0,S[L].id,S[L].descr,S[L].type);break;case 20:x.decorateNode({icon:S[L]});break;case 25:x.getLogger().trace("node found ..",S[L-2]),this.$={id:S[L-1],descr:S[L-1],type:x.getType(S[L-2],S[L])};break;case 26:this.$={id:S[L],descr:S[L],type:x.nodeType.DEFAULT};break;case 27:x.getLogger().trace("node found ..",S[L-3]),this.$={id:S[L-3],descr:S[L-1],type:x.getType(S[L-2],S[L])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:r,7:[1,10],9:9,12:11,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},t(l,[2,3]),{1:[2,2]},t(l,[2,4]),t(l,[2,5]),{1:[2,6],6:r,12:21,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},{6:r,9:22,12:11,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},{6:u,7:f,10:23,11:c},t(h,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:s,22:o}),t(h,[2,18]),t(h,[2,19]),t(h,[2,20]),t(h,[2,21]),t(h,[2,23]),t(h,[2,24]),t(h,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:f,10:32,11:c},{1:[2,7],6:r,12:21,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},t(v,[2,14],{7:d,11:g}),t(p,[2,8]),t(p,[2,9]),t(p,[2,10]),t(h,[2,15]),t(h,[2,16]),t(h,[2,17]),{20:[1,35]},{21:[1,36]},t(v,[2,13],{7:d,11:g}),t(p,[2,11]),t(p,[2,12]),{21:[1,37]},t(h,[2,25]),t(h,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(C,D){if(D.recoverable)this.trace(C);else{var w=new Error(C);throw w.hash=D,w}},parse:function(C){var D=this,w=[0],x=[],E=[null],S=[],A=this.table,L="",I=0,R=0,P=2,M=1,k=S.slice.call(arguments,1),N=Object.create(this.lexer),B={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(B.yy[z]=this.yy[z]);N.setInput(C,B.yy),B.yy.lexer=N,B.yy.parser=this,typeof N.yylloc>"u"&&(N.yylloc={});var F=N.yylloc;S.push(F);var G=N.options&&N.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function H(){var se;return se=x.pop()||N.lex()||M,typeof se!="number"&&(se instanceof Array&&(x=se,se=x.pop()),se=D.symbols_[se]||se),se}for(var X,K,q,J,j={},Y,_,W,te;;){if(K=w[w.length-1],this.defaultActions[K]?q=this.defaultActions[K]:((X===null||typeof X>"u")&&(X=H()),q=A[K]&&A[K][X]),typeof q>"u"||!q.length||!q[0]){var ae="";te=[];for(Y in A[K])this.terminals_[Y]&&Y>P&&te.push("'"+this.terminals_[Y]+"'");N.showPosition?ae="Parse error on line "+(I+1)+`:
219
+ `+N.showPosition()+`
220
+ Expecting `+te.join(", ")+", got '"+(this.terminals_[X]||X)+"'":ae="Parse error on line "+(I+1)+": Unexpected "+(X==M?"end of input":"'"+(this.terminals_[X]||X)+"'"),this.parseError(ae,{text:N.match,token:this.terminals_[X]||X,line:N.yylineno,loc:F,expected:te})}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+K+", token: "+X);switch(q[0]){case 1:w.push(X),E.push(N.yytext),S.push(N.yylloc),w.push(q[1]),X=null,R=N.yyleng,L=N.yytext,I=N.yylineno,F=N.yylloc;break;case 2:if(_=this.productions_[q[1]][1],j.$=E[E.length-_],j._$={first_line:S[S.length-(_||1)].first_line,last_line:S[S.length-1].last_line,first_column:S[S.length-(_||1)].first_column,last_column:S[S.length-1].last_column},G&&(j._$.range=[S[S.length-(_||1)].range[0],S[S.length-1].range[1]]),J=this.performAction.apply(j,[L,R,I,B.yy,q[1],E,S].concat(k)),typeof J<"u")return J;_&&(w=w.slice(0,-1*_*2),E=E.slice(0,-1*_),S=S.slice(0,-1*_)),w.push(this.productions_[q[1]][0]),E.push(j.$),S.push(j._$),W=A[w[w.length-2]][w[w.length-1]],w.push(W);break;case 3:return!0}}return!0}},b=function(){var T={EOF:1,parseError:function(D,w){if(this.yy.parser)this.yy.parser.parseError(D,w);else throw new Error(D)},setInput:function(C,D){return this.yy=D||this.yy||{},this._input=C,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var C=this._input[0];this.yytext+=C,this.yyleng++,this.offset++,this.match+=C,this.matched+=C;var D=C.match(/(?:\r\n?|\n).*/g);return D?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),C},unput:function(C){var D=C.length,w=C.split(/(?:\r\n?|\n)/g);this._input=C+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-D),this.offset-=D;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),w.length-1&&(this.yylineno-=w.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:w?(w.length===x.length?this.yylloc.first_column:0)+x[x.length-w.length].length-w[0].length:this.yylloc.first_column-D},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-D]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
221
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(C){this.unput(this.match.slice(C))},pastInput:function(){var C=this.matched.substr(0,this.matched.length-this.match.length);return(C.length>20?"...":"")+C.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var C=this.match;return C.length<20&&(C+=this._input.substr(0,20-C.length)),(C.substr(0,20)+(C.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var C=this.pastInput(),D=new Array(C.length+1).join("-");return C+this.upcomingInput()+`
222
+ `+D+"^"},test_match:function(C,D){var w,x,E;if(this.options.backtrack_lexer&&(E={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(E.yylloc.range=this.yylloc.range.slice(0))),x=C[0].match(/(?:\r\n?|\n).*/g),x&&(this.yylineno+=x.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:x?x[x.length-1].length-x[x.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+C[0].length},this.yytext+=C[0],this.match+=C[0],this.matches=C,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(C[0].length),this.matched+=C[0],w=this.performAction.call(this,this.yy,this,D,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),w)return w;if(this._backtrack){for(var S in E)this[S]=E[S];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,D,w,x;this._more||(this.yytext="",this.match="");for(var E=this._currentRules(),S=0;S<E.length;S++)if(w=this._input.match(this.rules[E[S]]),w&&(!D||w[0].length>D[0].length)){if(D=w,x=S,this.options.backtrack_lexer){if(C=this.test_match(w,E[S]),C!==!1)return C;if(this._backtrack){D=!1;continue}else return!1}else if(!this.options.flex)break}return D?(C=this.test_match(D,E[x]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
223
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var D=this.next();return D||this.lex()},begin:function(D){this.conditionStack.push(D)},popState:function(){var D=this.conditionStack.length-1;return D>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(D){return D=this.conditionStack.length-1-Math.abs(D||0),D>=0?this.conditionStack[D]:"INITIAL"},pushState:function(D){this.begin(D)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(D,w,x,E){switch(x){case 0:return D.getLogger().trace("Found comment",w.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:D.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return D.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:D.getLogger().trace("end icon"),this.popState();break;case 10:return D.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return D.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return D.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return D.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:D.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return D.getLogger().trace("description:",w.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),D.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),D.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),D.getLogger().trace("node end ...",w.yytext),"NODE_DEND";case 30:return this.popState(),D.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),D.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),D.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),D.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),D.getLogger().trace("node end (("),"NODE_DEND";case 35:return D.getLogger().trace("Long description:",w.yytext),20;case 36:return D.getLogger().trace("Long description:",w.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return T}();y.lexer=b;function m(){this.yy={}}return m.prototype=y,y.Parser=m,new m}();Ai.parser=Ai;const Jy=Ai;let Pt=[],xu=0,ts={};const jy=()=>{Pt=[],xu=0,ts={}},em=function(t){for(let e=Pt.length-1;e>=0;e--)if(Pt[e].level<t)return Pt[e];return null},tm=()=>Pt.length>0?Pt[0]:null,rm=(t,e,r,a)=>{var n,i;Sr.info("addNode",t,e,r,a);const s=Ri();let o=((n=s.mindmap)==null?void 0:n.padding)??hn.mindmap.padding;switch(a){case Xe.ROUNDED_RECT:case Xe.RECT:case Xe.HEXAGON:o*=2}const l={id:xu++,nodeId:dn(e,s),level:t,descr:dn(r,s),type:a,children:[],width:((i=s.mindmap)==null?void 0:i.maxNodeWidth)??hn.mindmap.maxNodeWidth,padding:o},u=em(t);if(u)u.children.push(l),Pt.push(l);else if(Pt.length===0)Pt.push(l);else throw new Error('There can be only one root. No parent could be found for ("'+l.descr+'")')},Xe={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},am=(t,e)=>{switch(Sr.debug("In get type",t,e),t){case"[":return Xe.RECT;case"(":return e===")"?Xe.ROUNDED_RECT:Xe.CLOUD;case"((":return Xe.CIRCLE;case")":return Xe.CLOUD;case"))":return Xe.BANG;case"{{":return Xe.HEXAGON;default:return Xe.DEFAULT}},nm=(t,e)=>{ts[t]=e},im=t=>{if(!t)return;const e=Ri(),r=Pt[Pt.length-1];t.icon&&(r.icon=dn(t.icon,e)),t.class&&(r.class=dn(t.class,e))},sm=t=>{switch(t){case Xe.DEFAULT:return"no-border";case Xe.RECT:return"rect";case Xe.ROUNDED_RECT:return"rounded-rect";case Xe.CIRCLE:return"circle";case Xe.CLOUD:return"cloud";case Xe.BANG:return"bang";case Xe.HEXAGON:return"hexgon";default:return"no-border"}},om=()=>Sr,lm=t=>ts[t],um={clear:jy,addNode:rm,getMindmap:tm,nodeType:Xe,getType:am,setElementForId:nm,decorateNode:im,type2Str:sm,getLogger:om,getElementById:lm},fm=um,cm=12,vm=function(t,e,r,a){e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 ${r.height-5} v${-r.height+2*5} q0,-5 5,-5 h${r.width-2*5} q5,0 5,5 v${r.height-5} H0 Z`),e.append("line").attr("class","node-line-"+a).attr("x1",0).attr("y1",r.height).attr("x2",r.width).attr("y2",r.height)},hm=function(t,e,r){e.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("height",r.height).attr("width",r.width)},dm=function(t,e,r){const a=r.width,n=r.height,i=.15*a,s=.25*a,o=.35*a,l=.2*a;e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 0 a${i},${i} 0 0,1 ${a*.25},${-1*a*.1}
224
+ a${o},${o} 1 0,1 ${a*.4},${-1*a*.1}
225
+ a${s},${s} 1 0,1 ${a*.35},${1*a*.2}
226
+
227
+ a${i},${i} 1 0,1 ${a*.15},${1*n*.35}
228
+ a${l},${l} 1 0,1 ${-1*a*.15},${1*n*.65}
229
+
230
+ a${s},${i} 1 0,1 ${-1*a*.25},${a*.15}
231
+ a${o},${o} 1 0,1 ${-1*a*.5},0
232
+ a${i},${i} 1 0,1 ${-1*a*.25},${-1*a*.15}
233
+
234
+ a${i},${i} 1 0,1 ${-1*a*.1},${-1*n*.35}
235
+ a${l},${l} 1 0,1 ${a*.1},${-1*n*.65}
236
+
237
+ H0 V0 Z`)},gm=function(t,e,r){const a=r.width,n=r.height,i=.15*a;e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 0 a${i},${i} 1 0,0 ${a*.25},${-1*n*.1}
238
+ a${i},${i} 1 0,0 ${a*.25},0
239
+ a${i},${i} 1 0,0 ${a*.25},0
240
+ a${i},${i} 1 0,0 ${a*.25},${1*n*.1}
241
+
242
+ a${i},${i} 1 0,0 ${a*.15},${1*n*.33}
243
+ a${i*.8},${i*.8} 1 0,0 0,${1*n*.34}
244
+ a${i},${i} 1 0,0 ${-1*a*.15},${1*n*.33}
245
+
246
+ a${i},${i} 1 0,0 ${-1*a*.25},${n*.15}
247
+ a${i},${i} 1 0,0 ${-1*a*.25},0
248
+ a${i},${i} 1 0,0 ${-1*a*.25},0
249
+ a${i},${i} 1 0,0 ${-1*a*.25},${-1*n*.15}
250
+
251
+ a${i},${i} 1 0,0 ${-1*a*.1},${-1*n*.33}
252
+ a${i*.8},${i*.8} 1 0,0 0,${-1*n*.34}
253
+ a${i},${i} 1 0,0 ${a*.1},${-1*n*.33}
254
+
255
+ H0 V0 Z`)},pm=function(t,e,r){e.append("circle").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("r",r.width/2)};function ym(t,e,r,a,n){return t.insert("polygon",":first-child").attr("points",a.map(function(i){return i.x+","+i.y}).join(" ")).attr("transform","translate("+(n.width-e)/2+", "+r+")")}const mm=function(t,e,r){const a=r.height,i=a/4,s=r.width-r.padding+2*i,o=[{x:i,y:0},{x:s-i,y:0},{x:s,y:-a/2},{x:s-i,y:-a},{x:i,y:-a},{x:0,y:-a/2}];ym(e,s,a,o,r)},bm=function(t,e,r){e.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("height",r.height).attr("rx",r.padding).attr("ry",r.padding).attr("width",r.width)},wm=function(t,e,r,a,n){const i=n.htmlLabels,s=a%(cm-1),o=e.append("g");r.section=s;let l="section-"+s;s<0&&(l+=" section-root"),o.attr("class",(r.class?r.class+" ":"")+"mindmap-node "+l);const u=o.append("g"),f=o.append("g"),c=r.descr.replace(/(<br\/*>)/g,`
256
+ `);Uu(f,c,{useHtmlLabels:i,width:r.width,classes:"mindmap-node-label"}),i||f.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");const h=f.node().getBBox(),[v]=Vu(n.fontSize);if(r.height=h.height+v*1.1*.5+r.padding,r.width=h.width+2*r.padding,r.icon)if(r.type===t.nodeType.CIRCLE)r.height+=50,r.width+=50,o.append("foreignObject").attr("height","50px").attr("width",r.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+r.icon),f.attr("transform","translate("+r.width/2+", "+(r.height/2-1.5*r.padding)+")");else{r.width+=50;const d=r.height;r.height=Math.max(d,60);const g=Math.abs(r.height-d);o.append("foreignObject").attr("width","60px").attr("height",r.height).attr("style","text-align: center;margin-top:"+g/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+r.icon),f.attr("transform","translate("+(25+r.width/2)+", "+(g/2+r.padding/2)+")")}else if(i){const d=(r.width-h.width)/2,g=(r.height-h.height)/2;f.attr("transform","translate("+d+", "+g+")")}else{const d=r.width/2,g=r.padding/2;f.attr("transform","translate("+d+", "+g+")")}switch(r.type){case t.nodeType.DEFAULT:vm(t,u,r,s);break;case t.nodeType.ROUNDED_RECT:bm(t,u,r);break;case t.nodeType.RECT:hm(t,u,r);break;case t.nodeType.CIRCLE:u.attr("transform","translate("+r.width/2+", "+ +r.height/2+")"),pm(t,u,r);break;case t.nodeType.CLOUD:dm(t,u,r);break;case t.nodeType.BANG:gm(t,u,r);break;case t.nodeType.HEXAGON:mm(t,u,r);break}return t.setElementForId(r.id,o),r.height},Em=function(t,e){const r=t.getElementById(e.id),a=e.x||0,n=e.y||0;r.attr("transform","translate("+a+","+n+")")};ur.use(Qy);function Tu(t,e,r,a,n){wm(t,e,r,a,n),r.children&&r.children.forEach((i,s)=>{Tu(t,e,i,a<0?s:a,n)})}function xm(t,e){e.edges().map((r,a)=>{const n=r.data();if(r[0]._private.bodyBounds){const i=r[0]._private.rscratch;Sr.trace("Edge: ",a,n),t.insert("path").attr("d",`M ${i.startX},${i.startY} L ${i.midX},${i.midY} L${i.endX},${i.endY} `).attr("class","edge section-edge-"+n.section+" edge-depth-"+n.depth)}})}function Cu(t,e,r,a){e.add({group:"nodes",data:{id:t.id.toString(),labelText:t.descr,height:t.height,width:t.width,level:a,nodeId:t.id,padding:t.padding,type:t.type},position:{x:t.x,y:t.y}}),t.children&&t.children.forEach(n=>{Cu(n,e,r,a+1),e.add({group:"edges",data:{id:`${t.id}_${n.id}`,source:t.id,target:n.id,depth:a,section:n.section}})})}function Tm(t,e){return new Promise(r=>{const a=Fu("body").append("div").attr("id","cy").attr("style","display:none"),n=ur({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),Cu(t,n,e,0),n.nodes().forEach(function(i){i.layoutDimensions=()=>{const s=i.data();return{w:s.width,h:s.height}}}),n.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),n.ready(i=>{Sr.info("Ready",i),r(n)})})}function Cm(t,e){e.nodes().map((r,a)=>{const n=r.data();n.x=r.position().x,n.y=r.position().y,Em(t,n);const i=t.getElementById(n.nodeId);Sr.info("Id:",a,"Position: (",r.position().x,", ",r.position().y,")",n),i.attr("transform",`translate(${r.position().x-n.width/2}, ${r.position().y-n.height/2})`),i.attr("attr",`apa-${a})`)})}const Dm=async(t,e,r,a)=>{var n,i;Sr.debug(`Rendering mindmap diagram
257
+ `+t);const s=a.db,o=s.getMindmap();if(!o)return;const l=Ri();l.htmlLabels=!1;const u=ku(e),f=u.append("g");f.attr("class","mindmap-edges");const c=u.append("g");c.attr("class","mindmap-nodes"),Tu(s,c,o,-1,l);const h=await Tm(o,l);xm(f,h),Cm(s,h),Bu(void 0,u,((n=l.mindmap)==null?void 0:n.padding)??hn.mindmap.padding,((i=l.mindmap)==null?void 0:i.useMaxWidth)??hn.mindmap.useMaxWidth)},Sm={draw:Dm},Am=t=>{let e="";for(let r=0;r<t.THEME_COLOR_LIMIT;r++)t["lineColor"+r]=t["lineColor"+r]||t["cScaleInv"+r],Gu(t["lineColor"+r])?t["lineColor"+r]=zu(t["lineColor"+r],20):t["lineColor"+r]=_u(t["lineColor"+r],20);for(let r=0;r<t.THEME_COLOR_LIMIT;r++){const a=""+(17-3*r);e+=`
258
+ .section-${r-1} rect, .section-${r-1} path, .section-${r-1} circle, .section-${r-1} polygon, .section-${r-1} path {
259
+ fill: ${t["cScale"+r]};
260
+ }
261
+ .section-${r-1} text {
262
+ fill: ${t["cScaleLabel"+r]};
263
+ }
264
+ .node-icon-${r-1} {
265
+ font-size: 40px;
266
+ color: ${t["cScaleLabel"+r]};
267
+ }
268
+ .section-edge-${r-1}{
269
+ stroke: ${t["cScale"+r]};
270
+ }
271
+ .edge-depth-${r-1}{
272
+ stroke-width: ${a};
273
+ }
274
+ .section-${r-1} line {
275
+ stroke: ${t["cScaleInv"+r]} ;
276
+ stroke-width: 3;
277
+ }
278
+
279
+ .disabled, .disabled circle, .disabled text {
280
+ fill: lightgray;
281
+ }
282
+ .disabled text {
283
+ fill: #efefef;
284
+ }
285
+ `}return e},Lm=t=>`
286
+ .edge {
287
+ stroke-width: 3;
288
+ }
289
+ ${Am(t)}
290
+ .section-root rect, .section-root path, .section-root circle, .section-root polygon {
291
+ fill: ${t.git0};
292
+ }
293
+ .section-root text {
294
+ fill: ${t.gitBranchLabel0};
295
+ }
296
+ .icon-container {
297
+ height:100%;
298
+ display: flex;
299
+ justify-content: center;
300
+ align-items: center;
301
+ }
302
+ .edge {
303
+ fill: none;
304
+ }
305
+ .mindmap-node-label {
306
+ dy: 1em;
307
+ alignment-baseline: middle;
308
+ text-anchor: middle;
309
+ dominant-baseline: middle;
310
+ text-align: center;
311
+ }
312
+ `,Rm=Lm,Pm={db:fm,renderer:Sm,parser:Jy,styles:Rm};export{Pm as diagram};