@antv/g6 5.0.0-beta.32 → 5.0.0-beta.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (615) hide show
  1. package/dist/g6.min.js +2 -2
  2. package/dist/lib/behaviors/brush-select.d.ts +104 -0
  3. package/dist/lib/behaviors/click-element.d.ts +77 -0
  4. package/dist/lib/behaviors/drag-element-force.d.ts +14 -0
  5. package/dist/lib/behaviors/drag-element.d.ts +13 -12
  6. package/dist/lib/behaviors/index.d.ts +8 -0
  7. package/dist/lib/behaviors/lasso-select.d.ts +20 -0
  8. package/dist/lib/behaviors/types.d.ts +1 -0
  9. package/dist/lib/constants/change.d.ts +1 -1
  10. package/dist/lib/constants/events/graph.d.ts +9 -7
  11. package/dist/lib/constants/registry.d.ts +3 -1
  12. package/dist/lib/elements/combos/base-combo.d.ts +43 -6
  13. package/dist/lib/elements/combos/circle.d.ts +8 -12
  14. package/dist/lib/elements/combos/rect.d.ts +5 -9
  15. package/dist/lib/elements/edges/base-edge.d.ts +64 -10
  16. package/dist/lib/elements/edges/cubic-horizontal.d.ts +2 -2
  17. package/dist/lib/elements/edges/cubic-vertical.d.ts +2 -2
  18. package/dist/lib/elements/edges/cubic.d.ts +2 -2
  19. package/dist/lib/elements/edges/polyline.d.ts +2 -2
  20. package/dist/lib/elements/edges/quadratic.d.ts +2 -2
  21. package/dist/lib/elements/nodes/base-node.d.ts +104 -13
  22. package/dist/lib/elements/nodes/circle.d.ts +5 -8
  23. package/dist/lib/elements/nodes/diamond.d.ts +2 -4
  24. package/dist/lib/elements/nodes/ellipse.d.ts +5 -8
  25. package/dist/lib/elements/nodes/hexagon.d.ts +6 -9
  26. package/dist/lib/elements/nodes/image.d.ts +9 -11
  27. package/dist/lib/elements/nodes/polygon.d.ts +9 -8
  28. package/dist/lib/elements/nodes/rect.d.ts +2 -3
  29. package/dist/lib/elements/nodes/star.d.ts +7 -10
  30. package/dist/lib/elements/nodes/triangle.d.ts +7 -10
  31. package/dist/lib/exports.d.ts +4 -2
  32. package/dist/lib/layouts/index.d.ts +1 -1
  33. package/dist/lib/layouts/types.d.ts +6 -6
  34. package/dist/lib/palettes/index.d.ts +1 -0
  35. package/dist/lib/plugins/history/events.d.ts +21 -0
  36. package/dist/lib/plugins/history/index.d.ts +82 -0
  37. package/dist/lib/plugins/history/utils.d.ts +31 -0
  38. package/dist/lib/plugins/hull/index.d.ts +59 -0
  39. package/dist/lib/plugins/hull/shape.d.ts +49 -0
  40. package/dist/lib/plugins/hull/util.d.ts +12 -0
  41. package/dist/lib/plugins/index.d.ts +4 -0
  42. package/dist/lib/registry/extension/index.d.ts +1 -1
  43. package/dist/lib/registry/types.d.ts +4 -0
  44. package/dist/lib/runtime/batch.d.ts +11 -0
  45. package/dist/lib/runtime/behavior.d.ts +1 -1
  46. package/dist/lib/runtime/canvas.d.ts +13 -3
  47. package/dist/lib/runtime/data.d.ts +4 -4
  48. package/dist/lib/runtime/element.d.ts +3 -19
  49. package/dist/lib/runtime/graph.d.ts +40 -2
  50. package/dist/lib/runtime/layout.d.ts +5 -11
  51. package/dist/lib/runtime/plugin.d.ts +1 -1
  52. package/dist/lib/runtime/transform.d.ts +11 -0
  53. package/dist/lib/runtime/types.d.ts +14 -0
  54. package/dist/lib/spec/index.d.ts +1 -0
  55. package/dist/lib/spec/spec.d.ts +7 -0
  56. package/dist/lib/spec/transform.d.ts +12 -0
  57. package/dist/lib/transforms/arrange-draw-order.d.ts +10 -0
  58. package/dist/lib/transforms/base-transform.d.ts +7 -0
  59. package/dist/lib/transforms/collapse-expand-combo.d.ts +10 -0
  60. package/dist/lib/transforms/index.d.ts +6 -0
  61. package/dist/lib/transforms/process-parallel-edges.d.ts +84 -0
  62. package/dist/lib/transforms/types.d.ts +20 -0
  63. package/dist/lib/transforms/update-related-edge.d.ts +9 -0
  64. package/dist/lib/types/canvas.d.ts +1 -1
  65. package/dist/lib/types/change.d.ts +27 -10
  66. package/dist/lib/types/element.d.ts +6 -140
  67. package/dist/lib/types/node.d.ts +3 -3
  68. package/dist/lib/types/point.d.ts +1 -0
  69. package/dist/lib/utils/animation.d.ts +1 -1
  70. package/dist/lib/utils/behaviors/brush.d.ts +19 -0
  71. package/dist/lib/utils/behaviors/lasso.d.ts +13 -0
  72. package/dist/lib/utils/behaviors/utils.d.ts +21 -0
  73. package/dist/lib/utils/change.d.ts +9 -1
  74. package/dist/lib/utils/combo.d.ts +5 -4
  75. package/dist/lib/utils/edge.d.ts +11 -0
  76. package/dist/lib/utils/event/events.d.ts +1 -1
  77. package/dist/lib/utils/extension.d.ts +1 -1
  78. package/dist/lib/utils/id.d.ts +3 -8
  79. package/dist/lib/utils/line.d.ts +21 -0
  80. package/dist/lib/utils/path.d.ts +35 -0
  81. package/dist/lib/utils/point.d.ts +74 -20
  82. package/dist/lib/utils/polygon.d.ts +17 -0
  83. package/dist/lib/utils/position.d.ts +14 -1
  84. package/dist/lib/utils/prefix.d.ts +1 -1
  85. package/dist/lib/utils/shortcut.d.ts +1 -0
  86. package/dist/lib/utils/vector.d.ts +3 -2
  87. package/esm/behaviors/brush-select.d.ts +104 -0
  88. package/esm/behaviors/brush-select.js +199 -0
  89. package/esm/behaviors/brush-select.js.map +1 -0
  90. package/esm/behaviors/click-element.d.ts +77 -0
  91. package/esm/behaviors/click-element.js +108 -0
  92. package/esm/behaviors/click-element.js.map +1 -0
  93. package/esm/behaviors/drag-element-force.d.ts +14 -0
  94. package/esm/behaviors/drag-element-force.js +55 -0
  95. package/esm/behaviors/drag-element-force.js.map +1 -0
  96. package/esm/behaviors/drag-element.d.ts +13 -12
  97. package/esm/behaviors/drag-element.js +17 -9
  98. package/esm/behaviors/drag-element.js.map +1 -1
  99. package/esm/behaviors/hover-element.js +2 -2
  100. package/esm/behaviors/hover-element.js.map +1 -1
  101. package/esm/behaviors/index.d.ts +8 -0
  102. package/esm/behaviors/index.js +4 -0
  103. package/esm/behaviors/index.js.map +1 -1
  104. package/esm/behaviors/lasso-select.d.ts +20 -0
  105. package/esm/behaviors/lasso-select.js +79 -0
  106. package/esm/behaviors/lasso-select.js.map +1 -0
  107. package/esm/behaviors/types.d.ts +1 -0
  108. package/esm/constants/change.d.ts +1 -1
  109. package/esm/constants/change.js +12 -12
  110. package/esm/constants/change.js.map +1 -1
  111. package/esm/constants/events/graph.d.ts +9 -7
  112. package/esm/constants/events/graph.js +8 -8
  113. package/esm/constants/events/graph.js.map +1 -1
  114. package/esm/constants/registry.d.ts +3 -1
  115. package/esm/constants/registry.js +2 -0
  116. package/esm/constants/registry.js.map +1 -1
  117. package/esm/elements/combos/base-combo.d.ts +43 -6
  118. package/esm/elements/combos/base-combo.js.map +1 -1
  119. package/esm/elements/combos/circle.d.ts +8 -12
  120. package/esm/elements/combos/circle.js.map +1 -1
  121. package/esm/elements/combos/rect.d.ts +5 -9
  122. package/esm/elements/combos/rect.js.map +1 -1
  123. package/esm/elements/edges/base-edge.d.ts +64 -10
  124. package/esm/elements/edges/base-edge.js.map +1 -1
  125. package/esm/elements/edges/cubic-horizontal.d.ts +2 -2
  126. package/esm/elements/edges/cubic-vertical.d.ts +2 -2
  127. package/esm/elements/edges/cubic.d.ts +2 -2
  128. package/esm/elements/edges/polyline.d.ts +2 -2
  129. package/esm/elements/edges/quadratic.d.ts +2 -2
  130. package/esm/elements/nodes/base-node.d.ts +104 -13
  131. package/esm/elements/nodes/base-node.js +4 -1
  132. package/esm/elements/nodes/base-node.js.map +1 -1
  133. package/esm/elements/nodes/circle.d.ts +5 -8
  134. package/esm/elements/nodes/circle.js.map +1 -1
  135. package/esm/elements/nodes/diamond.d.ts +2 -4
  136. package/esm/elements/nodes/diamond.js +2 -2
  137. package/esm/elements/nodes/diamond.js.map +1 -1
  138. package/esm/elements/nodes/ellipse.d.ts +5 -8
  139. package/esm/elements/nodes/ellipse.js +1 -1
  140. package/esm/elements/nodes/ellipse.js.map +1 -1
  141. package/esm/elements/nodes/hexagon.d.ts +6 -9
  142. package/esm/elements/nodes/hexagon.js.map +1 -1
  143. package/esm/elements/nodes/image.d.ts +9 -11
  144. package/esm/elements/nodes/image.js.map +1 -1
  145. package/esm/elements/nodes/polygon.d.ts +9 -8
  146. package/esm/elements/nodes/polygon.js +4 -1
  147. package/esm/elements/nodes/polygon.js.map +1 -1
  148. package/esm/elements/nodes/rect.d.ts +2 -3
  149. package/esm/elements/nodes/rect.js.map +1 -1
  150. package/esm/elements/nodes/star.d.ts +7 -10
  151. package/esm/elements/nodes/star.js.map +1 -1
  152. package/esm/elements/nodes/triangle.d.ts +7 -10
  153. package/esm/elements/nodes/triangle.js.map +1 -1
  154. package/esm/exports.d.ts +4 -2
  155. package/esm/exports.js +2 -1
  156. package/esm/exports.js.map +1 -1
  157. package/esm/layouts/index.d.ts +1 -1
  158. package/esm/layouts/index.js +1 -1
  159. package/esm/layouts/index.js.map +1 -1
  160. package/esm/layouts/types.d.ts +6 -6
  161. package/esm/palettes/index.d.ts +1 -0
  162. package/esm/palettes/index.js +12 -0
  163. package/esm/palettes/index.js.map +1 -1
  164. package/esm/plugins/history/events.d.ts +21 -0
  165. package/esm/plugins/history/events.js +16 -0
  166. package/esm/plugins/history/events.js.map +1 -0
  167. package/esm/plugins/history/index.d.ts +82 -0
  168. package/esm/plugins/history/index.js +168 -0
  169. package/esm/plugins/history/index.js.map +1 -0
  170. package/esm/plugins/history/utils.d.ts +31 -0
  171. package/esm/plugins/history/utils.js +79 -0
  172. package/esm/plugins/history/utils.js.map +1 -0
  173. package/esm/plugins/hull/index.d.ts +59 -0
  174. package/esm/plugins/hull/index.js +107 -0
  175. package/esm/plugins/hull/index.js.map +1 -0
  176. package/esm/plugins/hull/shape.d.ts +49 -0
  177. package/esm/plugins/hull/shape.js +35 -0
  178. package/esm/plugins/hull/shape.js.map +1 -0
  179. package/esm/plugins/hull/util.d.ts +12 -0
  180. package/esm/plugins/hull/util.js +203 -0
  181. package/esm/plugins/hull/util.js.map +1 -0
  182. package/esm/plugins/index.d.ts +4 -0
  183. package/esm/plugins/index.js +2 -0
  184. package/esm/plugins/index.js.map +1 -1
  185. package/esm/plugins/legend.js.map +1 -1
  186. package/esm/registry/build-in.js +19 -4
  187. package/esm/registry/build-in.js.map +1 -1
  188. package/esm/registry/extension/index.d.ts +1 -1
  189. package/esm/registry/index.js +1 -0
  190. package/esm/registry/index.js.map +1 -1
  191. package/esm/registry/types.d.ts +4 -0
  192. package/esm/runtime/batch.d.ts +11 -0
  193. package/esm/runtime/batch.js +31 -0
  194. package/esm/runtime/batch.js.map +1 -0
  195. package/esm/runtime/behavior.d.ts +1 -1
  196. package/esm/runtime/behavior.js.map +1 -1
  197. package/esm/runtime/canvas.d.ts +13 -3
  198. package/esm/runtime/canvas.js +36 -12
  199. package/esm/runtime/canvas.js.map +1 -1
  200. package/esm/runtime/data.d.ts +4 -4
  201. package/esm/runtime/data.js +23 -25
  202. package/esm/runtime/data.js.map +1 -1
  203. package/esm/runtime/element.d.ts +3 -19
  204. package/esm/runtime/element.js +16 -137
  205. package/esm/runtime/element.js.map +1 -1
  206. package/esm/runtime/graph.d.ts +40 -2
  207. package/esm/runtime/graph.js +57 -1
  208. package/esm/runtime/graph.js.map +1 -1
  209. package/esm/runtime/layout.d.ts +5 -11
  210. package/esm/runtime/layout.js +29 -75
  211. package/esm/runtime/layout.js.map +1 -1
  212. package/esm/runtime/plugin.d.ts +1 -1
  213. package/esm/runtime/plugin.js.map +1 -1
  214. package/esm/runtime/transform.d.ts +11 -0
  215. package/esm/runtime/transform.js +20 -0
  216. package/esm/runtime/transform.js.map +1 -0
  217. package/esm/runtime/types.d.ts +14 -0
  218. package/esm/spec/index.d.ts +1 -0
  219. package/esm/spec/spec.d.ts +7 -0
  220. package/esm/spec/transform.d.ts +12 -0
  221. package/esm/spec/transform.js +2 -0
  222. package/esm/spec/transform.js.map +1 -0
  223. package/esm/themes/base.js +9 -1
  224. package/esm/themes/base.js.map +1 -1
  225. package/esm/transforms/arrange-draw-order.d.ts +10 -0
  226. package/esm/transforms/arrange-draw-order.js +27 -0
  227. package/esm/transforms/arrange-draw-order.js.map +1 -0
  228. package/esm/transforms/base-transform.d.ts +7 -0
  229. package/esm/transforms/base-transform.js +7 -0
  230. package/esm/transforms/base-transform.js.map +1 -0
  231. package/esm/transforms/collapse-expand-combo.d.ts +10 -0
  232. package/esm/transforms/collapse-expand-combo.js +82 -0
  233. package/esm/transforms/collapse-expand-combo.js.map +1 -0
  234. package/esm/transforms/index.d.ts +6 -0
  235. package/esm/transforms/index.js +6 -0
  236. package/esm/transforms/index.js.map +1 -0
  237. package/esm/transforms/process-parallel-edges.d.ts +84 -0
  238. package/esm/transforms/process-parallel-edges.js +215 -0
  239. package/esm/transforms/process-parallel-edges.js.map +1 -0
  240. package/esm/transforms/types.d.ts +20 -0
  241. package/esm/transforms/types.js +11 -0
  242. package/esm/transforms/types.js.map +1 -0
  243. package/esm/transforms/update-related-edge.d.ts +9 -0
  244. package/esm/transforms/update-related-edge.js +20 -0
  245. package/esm/transforms/update-related-edge.js.map +1 -0
  246. package/esm/types/canvas.d.ts +1 -1
  247. package/esm/types/change.d.ts +27 -10
  248. package/esm/types/element.d.ts +6 -140
  249. package/esm/types/node.d.ts +3 -3
  250. package/esm/types/point.d.ts +1 -0
  251. package/esm/utils/animation.d.ts +1 -1
  252. package/esm/utils/animation.js +6 -0
  253. package/esm/utils/animation.js.map +1 -1
  254. package/esm/utils/behaviors/brush.d.ts +19 -0
  255. package/esm/utils/behaviors/brush.js +25 -0
  256. package/esm/utils/behaviors/brush.js.map +1 -0
  257. package/esm/utils/behaviors/lasso.d.ts +13 -0
  258. package/esm/utils/behaviors/lasso.js +112 -0
  259. package/esm/utils/behaviors/lasso.js.map +1 -0
  260. package/esm/utils/behaviors/utils.d.ts +21 -0
  261. package/esm/utils/behaviors/utils.js +42 -0
  262. package/esm/utils/behaviors/utils.js.map +1 -0
  263. package/esm/utils/change.d.ts +9 -1
  264. package/esm/utils/change.js +28 -0
  265. package/esm/utils/change.js.map +1 -1
  266. package/esm/utils/combo.d.ts +5 -4
  267. package/esm/utils/combo.js.map +1 -1
  268. package/esm/utils/edge.d.ts +11 -0
  269. package/esm/utils/edge.js +1 -1
  270. package/esm/utils/edge.js.map +1 -1
  271. package/esm/utils/event/events.d.ts +1 -1
  272. package/esm/utils/event/events.js.map +1 -1
  273. package/esm/utils/extension.d.ts +1 -1
  274. package/esm/utils/extension.js.map +1 -1
  275. package/esm/utils/id.d.ts +3 -8
  276. package/esm/utils/id.js +8 -2
  277. package/esm/utils/id.js.map +1 -1
  278. package/esm/utils/line.d.ts +21 -0
  279. package/esm/utils/line.js +41 -0
  280. package/esm/utils/line.js.map +1 -0
  281. package/esm/utils/path.d.ts +35 -0
  282. package/esm/utils/path.js +143 -0
  283. package/esm/utils/path.js.map +1 -0
  284. package/esm/utils/point.d.ts +74 -20
  285. package/esm/utils/point.js +168 -44
  286. package/esm/utils/point.js.map +1 -1
  287. package/esm/utils/polygon.d.ts +17 -0
  288. package/esm/utils/polygon.js +62 -0
  289. package/esm/utils/polygon.js.map +1 -0
  290. package/esm/utils/position.d.ts +14 -1
  291. package/esm/utils/position.js +16 -0
  292. package/esm/utils/position.js.map +1 -1
  293. package/esm/utils/prefix.d.ts +1 -1
  294. package/esm/utils/prefix.js.map +1 -1
  295. package/esm/utils/shortcut.d.ts +1 -0
  296. package/esm/utils/shortcut.js +13 -2
  297. package/esm/utils/shortcut.js.map +1 -1
  298. package/esm/utils/style.js.map +1 -1
  299. package/esm/utils/vector.d.ts +3 -2
  300. package/esm/utils/vector.js +10 -3
  301. package/esm/utils/vector.js.map +1 -1
  302. package/lib/behaviors/brush-select.d.ts +104 -0
  303. package/lib/behaviors/brush-select.js +203 -0
  304. package/lib/behaviors/brush-select.js.map +1 -0
  305. package/lib/behaviors/click-element.d.ts +77 -0
  306. package/lib/behaviors/click-element.js +112 -0
  307. package/lib/behaviors/click-element.js.map +1 -0
  308. package/lib/behaviors/drag-element-force.d.ts +14 -0
  309. package/lib/behaviors/drag-element-force.js +59 -0
  310. package/lib/behaviors/drag-element-force.js.map +1 -0
  311. package/lib/behaviors/drag-element.d.ts +13 -12
  312. package/lib/behaviors/drag-element.js +17 -9
  313. package/lib/behaviors/drag-element.js.map +1 -1
  314. package/lib/behaviors/hover-element.js +1 -1
  315. package/lib/behaviors/hover-element.js.map +1 -1
  316. package/lib/behaviors/index.d.ts +8 -0
  317. package/lib/behaviors/index.js +9 -1
  318. package/lib/behaviors/index.js.map +1 -1
  319. package/lib/behaviors/lasso-select.d.ts +20 -0
  320. package/lib/behaviors/lasso-select.js +83 -0
  321. package/lib/behaviors/lasso-select.js.map +1 -0
  322. package/lib/behaviors/types.d.ts +1 -0
  323. package/lib/constants/change.d.ts +1 -1
  324. package/lib/constants/change.js +13 -13
  325. package/lib/constants/change.js.map +1 -1
  326. package/lib/constants/events/graph.d.ts +9 -7
  327. package/lib/constants/events/graph.js +9 -9
  328. package/lib/constants/events/graph.js.map +1 -1
  329. package/lib/constants/registry.d.ts +3 -1
  330. package/lib/constants/registry.js +2 -0
  331. package/lib/constants/registry.js.map +1 -1
  332. package/lib/elements/combos/base-combo.d.ts +43 -6
  333. package/lib/elements/combos/base-combo.js.map +1 -1
  334. package/lib/elements/combos/circle.d.ts +8 -12
  335. package/lib/elements/combos/circle.js.map +1 -1
  336. package/lib/elements/combos/rect.d.ts +5 -9
  337. package/lib/elements/combos/rect.js.map +1 -1
  338. package/lib/elements/edges/base-edge.d.ts +64 -10
  339. package/lib/elements/edges/base-edge.js.map +1 -1
  340. package/lib/elements/edges/cubic-horizontal.d.ts +2 -2
  341. package/lib/elements/edges/cubic-vertical.d.ts +2 -2
  342. package/lib/elements/edges/cubic.d.ts +2 -2
  343. package/lib/elements/edges/polyline.d.ts +2 -2
  344. package/lib/elements/edges/quadratic.d.ts +2 -2
  345. package/lib/elements/nodes/base-node.d.ts +104 -13
  346. package/lib/elements/nodes/base-node.js +4 -1
  347. package/lib/elements/nodes/base-node.js.map +1 -1
  348. package/lib/elements/nodes/circle.d.ts +5 -8
  349. package/lib/elements/nodes/circle.js.map +1 -1
  350. package/lib/elements/nodes/diamond.d.ts +2 -4
  351. package/lib/elements/nodes/diamond.js +2 -2
  352. package/lib/elements/nodes/diamond.js.map +1 -1
  353. package/lib/elements/nodes/ellipse.d.ts +5 -8
  354. package/lib/elements/nodes/ellipse.js +1 -1
  355. package/lib/elements/nodes/ellipse.js.map +1 -1
  356. package/lib/elements/nodes/hexagon.d.ts +6 -9
  357. package/lib/elements/nodes/hexagon.js.map +1 -1
  358. package/lib/elements/nodes/image.d.ts +9 -11
  359. package/lib/elements/nodes/image.js.map +1 -1
  360. package/lib/elements/nodes/polygon.d.ts +9 -8
  361. package/lib/elements/nodes/polygon.js +4 -1
  362. package/lib/elements/nodes/polygon.js.map +1 -1
  363. package/lib/elements/nodes/rect.d.ts +2 -3
  364. package/lib/elements/nodes/rect.js.map +1 -1
  365. package/lib/elements/nodes/star.d.ts +7 -10
  366. package/lib/elements/nodes/star.js.map +1 -1
  367. package/lib/elements/nodes/triangle.d.ts +7 -10
  368. package/lib/elements/nodes/triangle.js.map +1 -1
  369. package/lib/exports.d.ts +4 -2
  370. package/lib/exports.js +4 -1
  371. package/lib/exports.js.map +1 -1
  372. package/lib/layouts/index.d.ts +1 -1
  373. package/lib/layouts/index.js +2 -1
  374. package/lib/layouts/index.js.map +1 -1
  375. package/lib/layouts/types.d.ts +6 -6
  376. package/lib/palettes/index.d.ts +1 -0
  377. package/lib/palettes/index.js +13 -1
  378. package/lib/palettes/index.js.map +1 -1
  379. package/lib/plugins/history/events.d.ts +21 -0
  380. package/lib/plugins/history/events.js +19 -0
  381. package/lib/plugins/history/events.js.map +1 -0
  382. package/lib/plugins/history/index.d.ts +82 -0
  383. package/lib/plugins/history/index.js +175 -0
  384. package/lib/plugins/history/index.js.map +1 -0
  385. package/lib/plugins/history/utils.d.ts +31 -0
  386. package/lib/plugins/history/utils.js +84 -0
  387. package/lib/plugins/history/utils.js.map +1 -0
  388. package/lib/plugins/hull/index.d.ts +59 -0
  389. package/lib/plugins/hull/index.js +114 -0
  390. package/lib/plugins/hull/index.js.map +1 -0
  391. package/lib/plugins/hull/shape.d.ts +49 -0
  392. package/lib/plugins/hull/shape.js +39 -0
  393. package/lib/plugins/hull/shape.js.map +1 -0
  394. package/lib/plugins/hull/util.d.ts +12 -0
  395. package/lib/plugins/hull/util.js +207 -0
  396. package/lib/plugins/hull/util.js.map +1 -0
  397. package/lib/plugins/index.d.ts +4 -0
  398. package/lib/plugins/index.js +5 -1
  399. package/lib/plugins/index.js.map +1 -1
  400. package/lib/plugins/legend.js.map +1 -1
  401. package/lib/registry/build-in.js +15 -0
  402. package/lib/registry/build-in.js.map +1 -1
  403. package/lib/registry/extension/index.d.ts +1 -1
  404. package/lib/registry/index.js +1 -0
  405. package/lib/registry/index.js.map +1 -1
  406. package/lib/registry/types.d.ts +4 -0
  407. package/lib/runtime/batch.d.ts +11 -0
  408. package/lib/runtime/batch.js +35 -0
  409. package/lib/runtime/batch.js.map +1 -0
  410. package/lib/runtime/behavior.d.ts +1 -1
  411. package/lib/runtime/behavior.js.map +1 -1
  412. package/lib/runtime/canvas.d.ts +13 -3
  413. package/lib/runtime/canvas.js +34 -10
  414. package/lib/runtime/canvas.js.map +1 -1
  415. package/lib/runtime/data.d.ts +4 -4
  416. package/lib/runtime/data.js +22 -24
  417. package/lib/runtime/data.js.map +1 -1
  418. package/lib/runtime/element.d.ts +3 -19
  419. package/lib/runtime/element.js +16 -137
  420. package/lib/runtime/element.js.map +1 -1
  421. package/lib/runtime/graph.d.ts +40 -2
  422. package/lib/runtime/graph.js +57 -1
  423. package/lib/runtime/graph.js.map +1 -1
  424. package/lib/runtime/layout.d.ts +5 -11
  425. package/lib/runtime/layout.js +27 -73
  426. package/lib/runtime/layout.js.map +1 -1
  427. package/lib/runtime/plugin.d.ts +1 -1
  428. package/lib/runtime/plugin.js.map +1 -1
  429. package/lib/runtime/transform.d.ts +11 -0
  430. package/lib/runtime/transform.js +24 -0
  431. package/lib/runtime/transform.js.map +1 -0
  432. package/lib/runtime/types.d.ts +14 -0
  433. package/lib/spec/index.d.ts +1 -0
  434. package/lib/spec/spec.d.ts +7 -0
  435. package/lib/spec/transform.d.ts +12 -0
  436. package/lib/spec/transform.js +3 -0
  437. package/lib/spec/transform.js.map +1 -0
  438. package/lib/themes/base.js +9 -1
  439. package/lib/themes/base.js.map +1 -1
  440. package/lib/transforms/arrange-draw-order.d.ts +10 -0
  441. package/lib/transforms/arrange-draw-order.js +31 -0
  442. package/lib/transforms/arrange-draw-order.js.map +1 -0
  443. package/lib/transforms/base-transform.d.ts +7 -0
  444. package/lib/transforms/base-transform.js +11 -0
  445. package/lib/transforms/base-transform.js.map +1 -0
  446. package/lib/transforms/collapse-expand-combo.d.ts +10 -0
  447. package/lib/transforms/collapse-expand-combo.js +86 -0
  448. package/lib/transforms/collapse-expand-combo.js.map +1 -0
  449. package/lib/transforms/index.d.ts +6 -0
  450. package/lib/transforms/index.js +14 -0
  451. package/lib/transforms/index.js.map +1 -0
  452. package/lib/transforms/process-parallel-edges.d.ts +84 -0
  453. package/lib/transforms/process-parallel-edges.js +222 -0
  454. package/lib/transforms/process-parallel-edges.js.map +1 -0
  455. package/lib/transforms/types.d.ts +20 -0
  456. package/lib/transforms/types.js +15 -0
  457. package/lib/transforms/types.js.map +1 -0
  458. package/lib/transforms/update-related-edge.d.ts +9 -0
  459. package/lib/transforms/update-related-edge.js +24 -0
  460. package/lib/transforms/update-related-edge.js.map +1 -0
  461. package/lib/types/canvas.d.ts +1 -1
  462. package/lib/types/change.d.ts +27 -10
  463. package/lib/types/element.d.ts +6 -140
  464. package/lib/types/node.d.ts +3 -3
  465. package/lib/types/point.d.ts +1 -0
  466. package/lib/utils/animation.d.ts +1 -1
  467. package/lib/utils/animation.js +6 -0
  468. package/lib/utils/animation.js.map +1 -1
  469. package/lib/utils/behaviors/brush.d.ts +19 -0
  470. package/lib/utils/behaviors/brush.js +30 -0
  471. package/lib/utils/behaviors/brush.js.map +1 -0
  472. package/lib/utils/behaviors/lasso.d.ts +13 -0
  473. package/lib/utils/behaviors/lasso.js +116 -0
  474. package/lib/utils/behaviors/lasso.js.map +1 -0
  475. package/lib/utils/behaviors/utils.d.ts +21 -0
  476. package/lib/utils/behaviors/utils.js +47 -0
  477. package/lib/utils/behaviors/utils.js.map +1 -0
  478. package/lib/utils/change.d.ts +9 -1
  479. package/lib/utils/change.js +30 -1
  480. package/lib/utils/change.js.map +1 -1
  481. package/lib/utils/combo.d.ts +5 -4
  482. package/lib/utils/combo.js.map +1 -1
  483. package/lib/utils/edge.d.ts +11 -0
  484. package/lib/utils/edge.js +2 -1
  485. package/lib/utils/edge.js.map +1 -1
  486. package/lib/utils/event/events.d.ts +1 -1
  487. package/lib/utils/event/events.js.map +1 -1
  488. package/lib/utils/extension.d.ts +1 -1
  489. package/lib/utils/extension.js.map +1 -1
  490. package/lib/utils/id.d.ts +3 -8
  491. package/lib/utils/id.js +10 -4
  492. package/lib/utils/id.js.map +1 -1
  493. package/lib/utils/line.d.ts +21 -0
  494. package/lib/utils/line.js +46 -0
  495. package/lib/utils/line.js.map +1 -0
  496. package/lib/utils/path.d.ts +35 -0
  497. package/lib/utils/path.js +150 -0
  498. package/lib/utils/path.js.map +1 -0
  499. package/lib/utils/point.d.ts +74 -20
  500. package/lib/utils/point.js +178 -48
  501. package/lib/utils/point.js.map +1 -1
  502. package/lib/utils/polygon.d.ts +17 -0
  503. package/lib/utils/polygon.js +66 -0
  504. package/lib/utils/polygon.js.map +1 -0
  505. package/lib/utils/position.d.ts +14 -1
  506. package/lib/utils/position.js +18 -1
  507. package/lib/utils/position.js.map +1 -1
  508. package/lib/utils/prefix.d.ts +1 -1
  509. package/lib/utils/prefix.js.map +1 -1
  510. package/lib/utils/shortcut.d.ts +1 -0
  511. package/lib/utils/shortcut.js +12 -1
  512. package/lib/utils/shortcut.js.map +1 -1
  513. package/lib/utils/style.js.map +1 -1
  514. package/lib/utils/vector.d.ts +3 -2
  515. package/lib/utils/vector.js +10 -3
  516. package/lib/utils/vector.js.map +1 -1
  517. package/package.json +5 -6
  518. package/src/behaviors/brush-select.ts +306 -0
  519. package/src/behaviors/click-element.ts +182 -0
  520. package/src/behaviors/drag-element-force.ts +70 -0
  521. package/src/behaviors/drag-element.ts +27 -17
  522. package/src/behaviors/hover-element.ts +2 -3
  523. package/src/behaviors/index.ts +8 -0
  524. package/src/behaviors/lasso-select.ts +103 -0
  525. package/src/behaviors/types.ts +2 -0
  526. package/src/constants/change.ts +1 -1
  527. package/src/constants/events/graph.ts +8 -8
  528. package/src/constants/registry.ts +2 -0
  529. package/src/elements/combos/base-combo.ts +59 -10
  530. package/src/elements/combos/circle.ts +8 -11
  531. package/src/elements/combos/rect.ts +5 -8
  532. package/src/elements/edges/base-edge.ts +70 -13
  533. package/src/elements/edges/cubic-horizontal.ts +2 -2
  534. package/src/elements/edges/cubic-vertical.ts +2 -2
  535. package/src/elements/edges/cubic.ts +2 -2
  536. package/src/elements/edges/polyline.ts +2 -2
  537. package/src/elements/edges/quadratic.ts +2 -2
  538. package/src/elements/nodes/base-node.ts +115 -19
  539. package/src/elements/nodes/circle.ts +5 -7
  540. package/src/elements/nodes/diamond.ts +4 -6
  541. package/src/elements/nodes/ellipse.ts +6 -8
  542. package/src/elements/nodes/hexagon.ts +7 -9
  543. package/src/elements/nodes/image.ts +12 -13
  544. package/src/elements/nodes/polygon.ts +17 -11
  545. package/src/elements/nodes/rect.ts +3 -4
  546. package/src/elements/nodes/star.ts +9 -11
  547. package/src/elements/nodes/triangle.ts +7 -9
  548. package/src/exports.ts +4 -2
  549. package/src/layouts/index.ts +1 -0
  550. package/src/layouts/types.ts +7 -5
  551. package/src/palettes/index.ts +13 -0
  552. package/src/plugins/history/events.ts +25 -0
  553. package/src/plugins/history/index.ts +222 -0
  554. package/src/plugins/history/utils.ts +98 -0
  555. package/src/plugins/hull/index.ts +149 -0
  556. package/src/plugins/hull/shape.ts +96 -0
  557. package/src/plugins/hull/util.ts +222 -0
  558. package/src/plugins/index.ts +4 -0
  559. package/src/plugins/legend.ts +1 -1
  560. package/src/registry/build-in.ts +22 -2
  561. package/src/registry/extension/index.ts +1 -1
  562. package/src/registry/index.ts +1 -0
  563. package/src/registry/types.ts +2 -0
  564. package/src/runtime/batch.ts +38 -0
  565. package/src/runtime/behavior.ts +1 -1
  566. package/src/runtime/canvas.ts +51 -13
  567. package/src/runtime/data.ts +31 -36
  568. package/src/runtime/element.ts +28 -167
  569. package/src/runtime/graph.ts +65 -3
  570. package/src/runtime/layout.ts +48 -79
  571. package/src/runtime/plugin.ts +1 -1
  572. package/src/runtime/transform.ts +27 -0
  573. package/src/runtime/types.ts +14 -0
  574. package/src/spec/index.ts +1 -0
  575. package/src/spec/spec.ts +7 -0
  576. package/src/spec/transform.ts +15 -0
  577. package/src/themes/base.ts +9 -1
  578. package/src/transforms/arrange-draw-order.ts +36 -0
  579. package/src/transforms/base-transform.ts +11 -0
  580. package/src/transforms/collapse-expand-combo.ts +87 -0
  581. package/src/transforms/index.ts +7 -0
  582. package/src/transforms/process-parallel-edges.ts +286 -0
  583. package/src/transforms/types.ts +23 -0
  584. package/src/transforms/update-related-edge.ts +28 -0
  585. package/src/types/canvas.ts +1 -1
  586. package/src/types/change.ts +28 -10
  587. package/src/types/element.ts +6 -147
  588. package/src/types/node.ts +3 -3
  589. package/src/types/point.ts +1 -0
  590. package/src/utils/animation.ts +6 -0
  591. package/src/utils/behaviors/brush.ts +29 -0
  592. package/src/utils/behaviors/lasso.ts +127 -0
  593. package/src/utils/behaviors/utils.ts +47 -0
  594. package/src/utils/change.ts +42 -1
  595. package/src/utils/combo.ts +6 -5
  596. package/src/utils/edge.ts +6 -1
  597. package/src/utils/event/events.ts +3 -1
  598. package/src/utils/extension.ts +1 -1
  599. package/src/utils/id.ts +11 -2
  600. package/src/utils/line.ts +50 -0
  601. package/src/utils/path.ts +153 -0
  602. package/src/utils/point.ts +190 -51
  603. package/src/utils/polygon.ts +72 -0
  604. package/src/utils/position.ts +18 -1
  605. package/src/utils/prefix.ts +1 -1
  606. package/src/utils/shortcut.ts +13 -2
  607. package/src/utils/style.ts +1 -1
  608. package/src/utils/vector.ts +10 -3
  609. package/esm/elements/types.d.ts +0 -0
  610. package/esm/elements/types.js +0 -15
  611. package/esm/elements/types.js.map +0 -1
  612. package/lib/elements/types.d.ts +0 -0
  613. package/lib/elements/types.js +0 -15
  614. package/lib/elements/types.js.map +0 -1
  615. package/src/elements/types.ts +0 -21
package/dist/g6.min.js CHANGED
@@ -1,6 +1,6 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).G6V5={})}(this,(function(t){"use strict";var e="undefined"!=typeof document?document.currentScript:null,n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i.apply(this,arguments)};function o(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function a(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function s(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function u(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function l(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function h(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}"function"==typeof SuppressedError&&SuppressedError;var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function p(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var g={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},s.prototype.emit=function(t,e,r,i,o,a){var s=n?n+t:t;if(!this._events[s])return!1;var u,c,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,a),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var d,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,i);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==e||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}(g);var m=f(g.exports),v=1e-6,y="undefined"!=typeof Float32Array?Float32Array:Array;function b(){var t=new y(9);return y!=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 E(){var t=new y(16);return y!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function w(t){var e=new y(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function x(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function M(t,e,n,r,i,o,a,s,u,c,l,h,d,f,p,g,m){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=u,t[8]=c,t[9]=l,t[10]=h,t[11]=d,t[12]=f,t[13]=p,t[14]=g,t[15]=m,t}function N(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function S(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function C(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],l=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15],y=n*s-r*a,b=n*u-i*a,E=n*c-o*a,w=r*u-i*s,x=r*c-o*s,M=i*c-o*u,N=l*g-h*p,S=l*m-d*p,C=l*v-f*p,k=h*m-d*g,T=h*v-f*g,P=d*v-f*m,A=y*P-b*T+E*k+w*C-x*S+M*N;return A?(A=1/A,t[0]=(s*P-u*T+c*k)*A,t[1]=(i*T-r*P-o*k)*A,t[2]=(g*M-m*x+v*w)*A,t[3]=(d*x-h*M-f*w)*A,t[4]=(u*C-a*P-c*S)*A,t[5]=(n*P-i*C+o*S)*A,t[6]=(m*E-p*M-v*b)*A,t[7]=(l*M-d*E+f*b)*A,t[8]=(a*T-s*C+c*N)*A,t[9]=(r*C-n*T-o*N)*A,t[10]=(p*x-g*E+v*y)*A,t[11]=(h*E-l*x-f*y)*A,t[12]=(s*S-a*k-u*N)*A,t[13]=(n*k-r*S+i*N)*A,t[14]=(g*b-p*w-m*y)*A,t[15]=(l*w-h*b+d*y)*A,t):null}function k(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8],l=t[9],h=t[10],d=t[11],f=t[12],p=t[13],g=t[14],m=t[15];return(e*a-n*o)*(h*m-d*g)-(e*s-r*o)*(l*m-d*p)+(e*u-i*o)*(l*g-h*p)+(n*s-r*a)*(c*m-d*f)-(n*u-i*a)*(c*g-h*f)+(r*u-i*s)*(c*p-l*f)}function T(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],v=e[14],y=e[15],b=n[0],E=n[1],w=n[2],x=n[3];return t[0]=b*r+E*s+w*h+x*g,t[1]=b*i+E*u+w*d+x*m,t[2]=b*o+E*c+w*f+x*v,t[3]=b*a+E*l+w*p+x*y,b=n[4],E=n[5],w=n[6],x=n[7],t[4]=b*r+E*s+w*h+x*g,t[5]=b*i+E*u+w*d+x*m,t[6]=b*o+E*c+w*f+x*v,t[7]=b*a+E*l+w*p+x*y,b=n[8],E=n[9],w=n[10],x=n[11],t[8]=b*r+E*s+w*h+x*g,t[9]=b*i+E*u+w*d+x*m,t[10]=b*o+E*c+w*f+x*v,t[11]=b*a+E*l+w*p+x*y,b=n[12],E=n[13],w=n[14],x=n[15],t[12]=b*r+E*s+w*h+x*g,t[13]=b*i+E*u+w*d+x*m,t[14]=b*o+E*c+w*f+x*v,t[15]=b*a+E*l+w*p+x*y,t}function P(t,e,n){var r,i,o,a,s,u,c,l,h,d,f,p,g=n[0],m=n[1],v=n[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*v+e[12],t[13]=e[1]*g+e[5]*m+e[9]*v+e[13],t[14]=e[2]*g+e[6]*m+e[10]*v+e[14],t[15]=e[3]*g+e[7]*m+e[11]*v+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],d=e[9],f=e[10],p=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=c,t[7]=l,t[8]=h,t[9]=d,t[10]=f,t[11]=p,t[12]=r*g+s*m+h*v+e[12],t[13]=i*g+u*m+d*v+e[13],t[14]=o*g+c*m+f*v+e[14],t[15]=a*g+l*m+p*v+e[15]),t}function A(t,e,n){var r=n[0],i=n[1],o=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function O(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],h=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+c*r,t[5]=a*i+l*r,t[6]=s*i+h*r,t[7]=u*i+d*r,t[8]=c*i-o*r,t[9]=l*i-a*r,t[10]=h*i-s*r,t[11]=d*i-u*r,t}function _(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],s=e[2],u=e[3],c=e[8],l=e[9],h=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-c*r,t[1]=a*i-l*r,t[2]=s*i-h*r,t[3]=u*i-d*r,t[8]=o*r+c*i,t[9]=a*r+l*i,t[10]=s*r+h*i,t[11]=u*r+d*i,t}function R(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function L(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function D(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=r+r,u=i+i,c=o+o,l=r*s,h=r*u,d=r*c,f=i*u,p=i*c,g=o*c,m=a*s,v=a*u,y=a*c;return t[0]=1-(f+g),t[1]=h+y,t[2]=d-v,t[3]=0,t[4]=h-y,t[5]=1-(l+g),t[6]=p+m,t[7]=0,t[8]=d+v,t[9]=p-m,t[10]=1-(l+f),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function I(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function j(t,e){var n=e[0],r=e[1],i=e[2],o=e[4],a=e[5],s=e[6],u=e[8],c=e[9],l=e[10];return t[0]=Math.hypot(n,r,i),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(u,c,l),t}function z(t,e){var n=new y(3);j(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],a=e[0]*r,s=e[1]*i,u=e[2]*o,c=e[4]*r,l=e[5]*i,h=e[6]*o,d=e[8]*r,f=e[9]*i,p=e[10]*o,g=a+l+p,m=0;return g>0?(m=2*Math.sqrt(g+1),t[3]=.25*m,t[0]=(h-f)/m,t[1]=(d-u)/m,t[2]=(s-c)/m):a>l&&a>p?(m=2*Math.sqrt(1+a-l-p),t[3]=(h-f)/m,t[0]=.25*m,t[1]=(s+c)/m,t[2]=(d+u)/m):l>p?(m=2*Math.sqrt(1+l-a-p),t[3]=(d-u)/m,t[0]=(s+c)/m,t[1]=.25*m,t[2]=(h+f)/m):(m=2*Math.sqrt(1+p-a-l),t[3]=(s-c)/m,t[0]=(d+u)/m,t[1]=(h+f)/m,t[2]=.25*m),t}function B(t,e,n,r,i){var o=e[0],a=e[1],s=e[2],u=e[3],c=o+o,l=a+a,h=s+s,d=o*c,f=o*l,p=o*h,g=a*l,m=a*h,v=s*h,y=u*c,b=u*l,E=u*h,w=r[0],x=r[1],M=r[2],N=i[0],S=i[1],C=i[2],k=(1-(g+v))*w,T=(f+E)*w,P=(p-b)*w,A=(f-E)*x,O=(1-(d+v))*x,_=(m+y)*x,R=(p+b)*M,L=(m-y)*M,D=(1-(d+g))*M;return t[0]=k,t[1]=T,t[2]=P,t[3]=0,t[4]=A,t[5]=O,t[6]=_,t[7]=0,t[8]=R,t[9]=L,t[10]=D,t[11]=0,t[12]=n[0]+N-(k*N+A*S+R*C),t[13]=n[1]+S-(T*N+O*S+L*C),t[14]=n[2]+C-(P*N+_*S+D*C),t[15]=1,t}function F(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,s=r+r,u=i+i,c=n*a,l=r*a,h=r*s,d=i*a,f=i*s,p=i*u,g=o*a,m=o*s,v=o*u;return t[0]=1-h-p,t[1]=l+v,t[2]=d-m,t[3]=0,t[4]=l-v,t[5]=1-c-p,t[6]=f+g,t[7]=0,t[8]=d+m,t[9]=f-g,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function G(t,e,n,r,i){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(r-i),t[10]=(i+r)*o,t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r),t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var V=G;function W(t,e,n,r,i,o,a){var s=1/(e-n),u=1/(r-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*u,t[14]=(a+o)*c,t[15]=1,t}var U=W;function H(t,e,n,r,i,o,a){var s=1/(e-n),u=1/(r-i),c=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=c,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*u,t[14]=o*c,t[15]=1,t}function q(t,e,n,r){var i,o,a,s,u,c,l,h,d,f,p=e[0],g=e[1],m=e[2],y=r[0],b=r[1],E=r[2],w=n[0],x=n[1],M=n[2];return Math.abs(p-w)<v&&Math.abs(g-x)<v&&Math.abs(m-M)<v?N(t):(l=p-w,h=g-x,d=m-M,i=b*(d*=f=1/Math.hypot(l,h,d))-E*(h*=f),o=E*(l*=f)-y*d,a=y*h-b*l,(f=Math.hypot(i,o,a))?(i*=f=1/f,o*=f,a*=f):(i=0,o=0,a=0),s=h*a-d*o,u=d*i-l*a,c=l*o-h*i,(f=Math.hypot(s,u,c))?(s*=f=1/f,u*=f,c*=f):(s=0,u=0,c=0),t[0]=i,t[1]=s,t[2]=l,t[3]=0,t[4]=o,t[5]=u,t[6]=h,t[7]=0,t[8]=a,t[9]=c,t[10]=d,t[11]=0,t[12]=-(i*p+o*g+a*m),t[13]=-(s*p+u*g+c*m),t[14]=-(l*p+h*g+d*m),t[15]=1,t)}function $(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}var Y=T,K=$,X=Object.freeze({__proto__:null,add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},adjoint:function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],l=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15];return t[0]=s*(d*v-f*m)-h*(u*v-c*m)+g*(u*f-c*d),t[1]=-(r*(d*v-f*m)-h*(i*v-o*m)+g*(i*f-o*d)),t[2]=r*(u*v-c*m)-s*(i*v-o*m)+g*(i*c-o*u),t[3]=-(r*(u*f-c*d)-s*(i*f-o*d)+h*(i*c-o*u)),t[4]=-(a*(d*v-f*m)-l*(u*v-c*m)+p*(u*f-c*d)),t[5]=n*(d*v-f*m)-l*(i*v-o*m)+p*(i*f-o*d),t[6]=-(n*(u*v-c*m)-a*(i*v-o*m)+p*(i*c-o*u)),t[7]=n*(u*f-c*d)-a*(i*f-o*d)+l*(i*c-o*u),t[8]=a*(h*v-f*g)-l*(s*v-c*g)+p*(s*f-c*h),t[9]=-(n*(h*v-f*g)-l*(r*v-o*g)+p*(r*f-o*h)),t[10]=n*(s*v-c*g)-a*(r*v-o*g)+p*(r*c-o*s),t[11]=-(n*(s*f-c*h)-a*(r*f-o*h)+l*(r*c-o*s)),t[12]=-(a*(h*m-d*g)-l*(s*m-u*g)+p*(s*d-u*h)),t[13]=n*(h*m-d*g)-l*(r*m-i*g)+p*(r*d-i*h),t[14]=-(n*(s*m-u*g)-a*(r*m-i*g)+p*(r*u-i*s)),t[15]=n*(s*d-u*h)-a*(r*d-i*h)+l*(r*u-i*s),t},clone:w,copy:x,create:E,determinant:k,equals:function(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],c=t[7],l=t[8],h=t[9],d=t[10],f=t[11],p=t[12],g=t[13],m=t[14],y=t[15],b=e[0],E=e[1],w=e[2],x=e[3],M=e[4],N=e[5],S=e[6],C=e[7],k=e[8],T=e[9],P=e[10],A=e[11],O=e[12],_=e[13],R=e[14],L=e[15];return Math.abs(n-b)<=v*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-E)<=v*Math.max(1,Math.abs(r),Math.abs(E))&&Math.abs(i-w)<=v*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(o-x)<=v*Math.max(1,Math.abs(o),Math.abs(x))&&Math.abs(a-M)<=v*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(s-N)<=v*Math.max(1,Math.abs(s),Math.abs(N))&&Math.abs(u-S)<=v*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(c-C)<=v*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(l-k)<=v*Math.max(1,Math.abs(l),Math.abs(k))&&Math.abs(h-T)<=v*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(d-P)<=v*Math.max(1,Math.abs(d),Math.abs(P))&&Math.abs(f-A)<=v*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(p-O)<=v*Math.max(1,Math.abs(p),Math.abs(O))&&Math.abs(g-_)<=v*Math.max(1,Math.abs(g),Math.abs(_))&&Math.abs(m-R)<=v*Math.max(1,Math.abs(m),Math.abs(R))&&Math.abs(y-L)<=v*Math.max(1,Math.abs(y),Math.abs(L))},exactEquals:function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},frob:function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},fromQuat:F,fromQuat2:function(t,e){var n=new y(3),r=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=r*r+i*i+o*o+a*a;return h>0?(n[0]=2*(s*a+l*r+u*o-c*i)/h,n[1]=2*(u*a+l*i+c*r-s*o)/h,n[2]=2*(c*a+l*o+s*i-u*r)/h):(n[0]=2*(s*a+l*r+u*o-c*i),n[1]=2*(u*a+l*i+c*r-s*o),n[2]=2*(c*a+l*o+s*i-u*r)),D(t,e,n),t},fromRotation:function(t,e,n){var r,i,o,a=n[0],s=n[1],u=n[2],c=Math.hypot(a,s,u);return c<v?null:(a*=c=1/c,s*=c,u*=c,r=Math.sin(e),o=1-(i=Math.cos(e)),t[0]=a*a*o+i,t[1]=s*a*o+u*r,t[2]=u*a*o-s*r,t[3]=0,t[4]=a*s*o-u*r,t[5]=s*s*o+i,t[6]=u*s*o+a*r,t[7]=0,t[8]=a*u*o+s*r,t[9]=s*u*o-a*r,t[10]=u*u*o+i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},fromRotationTranslation:D,fromRotationTranslationScale:function(t,e,n,r){var i=e[0],o=e[1],a=e[2],s=e[3],u=i+i,c=o+o,l=a+a,h=i*u,d=i*c,f=i*l,p=o*c,g=o*l,m=a*l,v=s*u,y=s*c,b=s*l,E=r[0],w=r[1],x=r[2];return t[0]=(1-(p+m))*E,t[1]=(d+b)*E,t[2]=(f-y)*E,t[3]=0,t[4]=(d-b)*w,t[5]=(1-(h+m))*w,t[6]=(g+v)*w,t[7]=0,t[8]=(f+y)*x,t[9]=(g-v)*x,t[10]=(1-(h+p))*x,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},fromRotationTranslationScaleOrigin:B,fromScaling:L,fromTranslation:R,fromValues:function(t,e,n,r,i,o,a,s,u,c,l,h,d,f,p,g){var m=new y(16);return m[0]=t,m[1]=e,m[2]=n,m[3]=r,m[4]=i,m[5]=o,m[6]=a,m[7]=s,m[8]=u,m[9]=c,m[10]=l,m[11]=h,m[12]=d,m[13]=f,m[14]=p,m[15]=g,m},fromXRotation:function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},fromYRotation:function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},fromZRotation:function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},frustum:function(t,e,n,r,i,o,a){var s=1/(n-e),u=1/(i-r),c=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*u,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*u,t[10]=(a+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*c,t[15]=0,t},getRotation:z,getScaling:j,getTranslation:I,identity:N,invert:C,lookAt:q,mul:Y,multiply:T,multiplyScalar:function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},multiplyScalarAndAdd:function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},ortho:U,orthoNO:W,orthoZO:H,perspective:V,perspectiveFromFieldOfView:function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(a+s),c=2/(i+o);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(a-s)*u*.5,t[9]=(i-o)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},perspectiveNO:G,perspectiveZO:function(t,e,n,r,i){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(r-i),t[10]=i*o,t[14]=i*r*o):(t[10]=-1,t[14]=-r),t},rotate:function(t,e,n,r){var i,o,a,s,u,c,l,h,d,f,p,g,m,y,b,E,w,x,M,N,S,C,k,T,P=r[0],A=r[1],O=r[2],_=Math.hypot(P,A,O);return _<v?null:(P*=_=1/_,A*=_,O*=_,i=Math.sin(n),a=1-(o=Math.cos(n)),s=e[0],u=e[1],c=e[2],l=e[3],h=e[4],d=e[5],f=e[6],p=e[7],g=e[8],m=e[9],y=e[10],b=e[11],E=P*P*a+o,w=A*P*a+O*i,x=O*P*a-A*i,M=P*A*a-O*i,N=A*A*a+o,S=O*A*a+P*i,C=P*O*a+A*i,k=A*O*a-P*i,T=O*O*a+o,t[0]=s*E+h*w+g*x,t[1]=u*E+d*w+m*x,t[2]=c*E+f*w+y*x,t[3]=l*E+p*w+b*x,t[4]=s*M+h*N+g*S,t[5]=u*M+d*N+m*S,t[6]=c*M+f*N+y*S,t[7]=l*M+p*N+b*S,t[8]=s*C+h*k+g*T,t[9]=u*C+d*k+m*T,t[10]=c*C+f*k+y*T,t[11]=l*C+p*k+b*T,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},rotateX:O,rotateY:_,rotateZ:function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],s=e[2],u=e[3],c=e[4],l=e[5],h=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+c*r,t[1]=a*i+l*r,t[2]=s*i+h*r,t[3]=u*i+d*r,t[4]=c*i-o*r,t[5]=l*i-a*r,t[6]=h*i-s*r,t[7]=d*i-u*r,t},scale:A,set:M,str:function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},sub:K,subtract:$,targetTo:function(t,e,n,r){var i=e[0],o=e[1],a=e[2],s=r[0],u=r[1],c=r[2],l=i-n[0],h=o-n[1],d=a-n[2],f=l*l+h*h+d*d;f>0&&(l*=f=1/Math.sqrt(f),h*=f,d*=f);var p=u*d-c*h,g=c*l-s*d,m=s*h-u*l;return(f=p*p+g*g+m*m)>0&&(p*=f=1/Math.sqrt(f),g*=f,m*=f),t[0]=p,t[1]=g,t[2]=m,t[3]=0,t[4]=h*m-d*g,t[5]=d*p-l*m,t[6]=l*g-h*p,t[7]=0,t[8]=l,t[9]=h,t[10]=d,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t},translate:P,transpose:S});function Z(){var t=new y(3);return y!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Q(t){var e=new y(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function J(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}function tt(t,e,n){var r=new y(3);return r[0]=t,r[1]=e,r[2]=n,r}function et(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function nt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function rt(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function it(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function ot(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function at(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function st(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ut(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],u=n[2];return t[0]=i*u-o*s,t[1]=o*a-r*u,t[2]=r*s-i*a,t}function ct(t,e,n,r){var i=e[0],o=e[1],a=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t}function lt(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/a,t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t}function ht(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],a=e[1],s=e[2];return Math.abs(n-o)<=v*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-a)<=v*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-s)<=v*Math.max(1,Math.abs(i),Math.abs(s))}var dt=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.hypot(n,r,i)},ft=J;function pt(){var t=new y(4);return y!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function gt(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,t}function mt(){var t=new y(4);return y!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function vt(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function yt(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=n[0],u=n[1],c=n[2],l=n[3];return t[0]=r*l+a*s+i*c-o*u,t[1]=i*l+a*u+o*s-r*c,t[2]=o*l+a*c+r*u-i*s,t[3]=a*l-r*s-i*u-o*c,t}function bt(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o,s=a?1/a:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-i*s,t[3]=o*s,t}function Et(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var o=Math.sin(e),a=Math.cos(e),s=Math.sin(n),u=Math.cos(n),c=Math.sin(r),l=Math.cos(r);return t[0]=o*u*l-a*s*c,t[1]=a*s*l+o*u*c,t[2]=a*u*c-o*s*l,t[3]=a*u*l+o*s*c,t}Z(),function(){var t=pt()}();var wt=function(t,e,n,r){var i=new y(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i},xt=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Mt=yt,Nt=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a,t};Z(),tt(1,0,0),tt(0,1,0),mt(),mt(),b(),function(){var t,e=(t=new y(2),y!=Float32Array&&(t[0]=0,t[1]=0),t)}();var St=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},Ct=function(t,e){return!!St(t)&&t.indexOf(e)>-1},kt=function(t,e){return void 0===e&&(e=[]),function(t,e){if(!St(t))return t;for(var n=[],r=0;r<t.length;r++){var i=t[r];e(i,r)&&n.push(i)}return n}(t,(function(t){return!Ct(e,t)}))},Tt=function(t){return"function"==typeof t},Pt=function(t){return null==t},At={}.toString,Ot=function(t,e){return At.call(t)==="[object "+e+"]"},_t=function(t){return Array.isArray?Array.isArray(t):Ot(t,"Array")},Rt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Lt(t,e){if(t)if(_t(t))for(var n=0,r=t.length;n<r&&!1!==e(t[n],n);n++);else if(Rt(t))for(var i in t)if(t.hasOwnProperty(i)&&!1===e(t[i],i))break}var Dt=function(t){return"object"==typeof t&&null!==t},It=function(t){if(!Dt(t)||!Ot(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},jt=function(t){if(_t(t))return t.reduce((function(t,e){return Math.max(t,e)}),t[0])},zt=function(t){if(_t(t))return t.reduce((function(t,e){return Math.min(t,e)}),t[0])},Bt=function(t){return Ot(t,"String")},Ft=Object.prototype.hasOwnProperty;function Gt(t,e){if(!e||!_t(t))return{};for(var n,r={},i=Tt(e)?e:function(t){return t[e]},o=0;o<t.length;o++){var a=t[o];n=i(a),Ft.call(r,n)?r[n].push(a):r[n]=[a]}return r}var Vt=function(t,e,n){return t<e?e:t>n?n:t},Wt=function(t){return Ot(t,"Number")},Ut=1e-5;function Ht(t,e,n){return void 0===n&&(n=Ut),Math.abs(t-e)<n}var qt=function(t,e){return(t%e+e)%e},$t=function(t){return Pt(t)?"":t.toString()},Yt=function(t){var e=$t(t);return e.charAt(0).toLowerCase()+e.substring(1)};var Kt={}.toString,Xt=function(t){return Ot(t,"Boolean")},Zt=Object.prototype,Qt=function(t){return void 0===t},Jt=function(t){if("object"!=typeof t||null===t)return t;var e;if(_t(t)){e=[];for(var n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=Jt(t[n]):e[n]=t[n]}else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=Jt(t[i]):e[i]=t[i];return e};function te(t,e,n){var r;return function(){var i=this,o=arguments,a=n&&!r;clearTimeout(r),r=setTimeout((function(){r=null,n||t.apply(i,o)}),e),a&&t.apply(i,o)}}function ee(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function ne(t,e,n,r){for(var i in n=n||0,r=r||5,e)if(ee(e,i)){var o=e[i];null!==o&&It(o)?(It(t[i])||(t[i]={}),n<r?ne(t[i],o,n+1,r):t[i]=e[i]):_t(o)?(t[i]=[],t[i]=t[i].concat(o)):void 0!==o&&(t[i]=o)}}var re=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)ne(t,e[r]);return t},ie=Object.prototype.hasOwnProperty;function oe(t){if(Pt(t))return!0;if(St(t))return!t.length;var e=function(t){return Kt.call(t).replace(/^\[object /,"").replace(/]$/,"")}(t);if("Map"===e||"Set"===e)return!t.size;if(function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Zt)}(t))return!Object.keys(t).length;for(var n in t)if(ie.call(t,n))return!1;return!0}var ae=function(t,e){if(t===e)return!0;if(!t||!e)return!1;if(Bt(t)||Bt(e))return!1;if(St(t)||St(e)){if(t.length!==e.length)return!1;for(var n=!0,r=0;r<t.length&&(n=ae(t[r],e[r]));r++);return n}if(Dt(t)||Dt(e)){var i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(n=!0,r=0;r<i.length&&(n=ae(t[i[r]],e[i[r]]));r++);return n}return!1},se=function(t,e,n){for(var r=0,i=Bt(e)?e.split("."):e;t&&r<i.length;)t=t[i[r++]];return void 0===t||r<i.length?n:t},ue=function(t,e,n){var r=t,i=Bt(e)?e.split("."):e;return i.forEach((function(t,e){e<i.length-1?(Rt(r[t])||(r[t]=Wt(i[e+1])?[]:{}),r=r[t]):r[t]=n})),t},ce=Object.prototype.hasOwnProperty,le=function(t,e){return function(t,e,n){if(!_t(t)&&!It(t))return t;var r=n;return Lt(t,(function(t,n){r=e(r,t,n)})),r}(t,(function(t,n,r){return e.includes(r)||(t[r]=n),t}),{})},he={},de=function(){},fe={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function pe(t,e,n){if(t[n].length>7){t[n].shift();for(var r=t[n],i=n;r.length;)e[n]="A",t.splice(i+=1,0,["C"].concat(r.splice(0,6)));t.splice(n,1)}}var ge={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function me(t){return Array.isArray(t)&&t.every((function(t){var e=t[0].toLowerCase();return ge[e]===t.length-1&&"achlmqstvz".includes(e)}))}function ve(t){return me(t)&&t.every((function(t){var e=t[0];return e===e.toUpperCase()}))}function ye(t){return ve(t)&&t.every((function(t){var e=t[0];return"ACLMQZ".includes(e)}))}function be(t){for(var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;r.length>=ge[n]&&("m"===n&&r.length>2?(t.segments.push([e].concat(r.splice(0,2))),n="l",e="m"===e?"l":"L"):t.segments.push([e].concat(r.splice(0,ge[n]))),ge[n]););}function Ee(t){var e=t.index,n=t.pathValue,r=n.charCodeAt(e);return 48===r?(t.param=0,void(t.index+=1)):49===r?(t.param=1,void(t.index+=1)):void(t.err='[path-util]: invalid Arc flag "'+n[e]+'", expecting 0 or 1 at index '+e)}function we(t){return t>=48&&t<=57||43===t||45===t||46===t}function xe(t){return t>=48&&t<=57}function Me(t){var e,n=t.max,r=t.pathValue,i=t.index,o=i,a=!1,s=!1,u=!1,c=!1;if(o>=n)t.err="[path-util]: Invalid path value at index "+o+', "pathValue" is missing param';else if(43!==(e=r.charCodeAt(o))&&45!==e||(o+=1,e=r.charCodeAt(o)),xe(e)||46===e){if(46!==e){if(a=48===e,o+=1,e=r.charCodeAt(o),a&&o<n&&e&&xe(e))return void(t.err="[path-util]: Invalid path value at index "+i+', "'+r[i]+'" illegal number');for(;o<n&&xe(r.charCodeAt(o));)o+=1,s=!0;e=r.charCodeAt(o)}if(46===e){for(c=!0,o+=1;xe(r.charCodeAt(o));)o+=1,u=!0;e=r.charCodeAt(o)}if(101===e||69===e){if(c&&!s&&!u)return void(t.err="[path-util]: Invalid path value at index "+o+', "'+r[o]+'" invalid float exponent');if(o+=1,43!==(e=r.charCodeAt(o))&&45!==e||(o+=1),!(o<n&&xe(r.charCodeAt(o))))return void(t.err="[path-util]: Invalid path value at index "+o+', "'+r[o]+'" invalid integer exponent');for(;o<n&&xe(r.charCodeAt(o));)o+=1}t.index=o,t.param=+t.pathValue.slice(i,o)}else t.err="[path-util]: Invalid path value at index "+o+', "'+r[o]+'" is not a number'}function Ne(t){for(var e,n=t.pathValue,r=t.max;t.index<r&&(10===(e=n.charCodeAt(t.index))||13===e||8232===e||8233===e||32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function Se(t){var e=t.max,n=t.pathValue,r=t.index,i=n.charCodeAt(r),o=ge[n[r].toLowerCase()];if(t.segmentStart=r,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(i))if(t.index+=1,Ne(t),t.data=[],o){for(;;){for(var a=o;a>0;a-=1){if(97!=(32|i)||3!==a&&4!==a?Me(t):Ee(t),t.err.length)return;t.data.push(t.param),Ne(t),t.index<e&&44===n.charCodeAt(t.index)&&(t.index+=1,Ne(t))}if(t.index>=t.max)break;if(!we(n.charCodeAt(t.index)))break}be(t)}else be(t);else t.err='[path-util]: Invalid path value "'+n[r]+'" is not a path command'}var Ce=function(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""};function ke(t){if(ve(t))return[].concat(t);var e=function(t){if(me(t))return[].concat(t);var e=new Ce(t);for(Ne(e);e.index<e.max&&!e.err.length;)Se(e);return e.err?e.err:e.segments}(t),n=0,r=0,i=0,o=0;return e.map((function(t){var e,a=t.slice(1).map(Number),s=t[0],u=s.toUpperCase();if("M"===s)return n=a[0],r=a[1],i=n,o=r,["M",n,r];if(s!==u)switch(u){case"A":e=[u,a[0],a[1],a[2],a[3],a[4],a[5]+n,a[6]+r];break;case"V":e=[u,a[0]+r];break;case"H":e=[u,a[0]+n];break;default:var c=a.map((function(t,e){return t+(e%2?r:n)}));e=[u].concat(c)}else e=[u].concat(a);var l=e.length;switch(u){case"Z":n=i,r=o;break;case"H":n=e[1];break;case"V":r=e[1];break;default:n=e[l-2],r=e[l-1],"M"===u&&(i=n,o=r)}return e}))}function Te(t,e){var n=t[0],r=e.x1,i=e.y1,o=e.x2,a=e.y2,s=t.slice(1).map(Number),u=t;if("TQ".includes(n)||(e.qx=null,e.qy=null),"H"===n)u=["L",t[1],i];else if("V"===n)u=["L",r,t[1]];else if("S"===n){var c=2*r-o,l=2*i-a;e.x1=c,e.y1=l,u=["C",c,l].concat(s)}else if("T"===n){var h=2*r-e.qx,d=2*i-e.qy;e.qx=h,e.qy=d,u=["Q",h,d].concat(s)}else if("Q"===n){var f=s[0],p=s[1];e.qx=f,e.qy=p}return u}function Pe(t){if(ye(t))return[].concat(t);for(var e=ke(t),n=i({},fe),r=0;r<e.length;r+=1){e[r]=Te(e[r],n);var o=e[r],a=o.length;n.x1=+o[a-2],n.y1=+o[a-1],n.x2=+o[a-4]||n.x1,n.y2=+o[a-3]||n.y1}return e}function Ae(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function Oe(t,e,n,r,i,o,a,s,u,c){var l,h,d,f,p,g=t,m=e,v=n,y=r,b=s,E=u,w=120*Math.PI/180,x=Math.PI/180*(+i||0),M=[];if(c)h=c[0],d=c[1],f=c[2],p=c[3];else{g=(l=Ae(g,m,-x)).x,m=l.y;var N=(g-(b=(l=Ae(b,E,-x)).x))/2,S=(m-(E=l.y))/2,C=N*N/(v*v)+S*S/(y*y);C>1&&(v*=C=Math.sqrt(C),y*=C);var k=v*v,T=y*y,P=(o===a?-1:1)*Math.sqrt(Math.abs((k*T-k*S*S-T*N*N)/(k*S*S+T*N*N)));f=P*v*S/y+(g+b)/2,p=P*-y*N/v+(m+E)/2,h=Math.asin(((m-p)/y*Math.pow(10,9)|0)/Math.pow(10,9)),d=Math.asin(((E-p)/y*Math.pow(10,9)|0)/Math.pow(10,9)),h=g<f?Math.PI-h:h,d=b<f?Math.PI-d:d,h<0&&(h=2*Math.PI+h),d<0&&(d=2*Math.PI+d),a&&h>d&&(h-=2*Math.PI),!a&&d>h&&(d-=2*Math.PI)}var A=d-h;if(Math.abs(A)>w){var O=d,_=b,R=E;d=h+w*(a&&d>h?1:-1),M=Oe(b=f+v*Math.cos(d),E=p+y*Math.sin(d),v,y,i,0,a,_,R,[d,O,f,p])}A=d-h;var L=Math.cos(h),D=Math.sin(h),I=Math.cos(d),j=Math.sin(d),z=Math.tan(A/4),B=4/3*v*z,F=4/3*y*z,G=[g,m],V=[g+B*D,m-F*L],W=[b+B*j,E-F*I],U=[b,E];if(V[0]=2*G[0]-V[0],V[1]=2*G[1]-V[1],c)return V.concat(W,U,M);for(var H=[],q=0,$=(M=V.concat(W,U,M)).length;q<$;q+=1)H[q]=q%2?Ae(M[q-1],M[q],x).y:Ae(M[q],M[q+1],x).x;return H}function _e(t,e,n){var r=t[0],i=t[1];return[r+(e[0]-r)*n,i+(e[1]-i)*n]}var Re=function(t,e,n,r){return l(l([],_e([t,e],[n,r],.5),!0),[n,r,n,r],!1)};function Le(t,e){var n,r,i,o,a,s,u,c,l,h=t[0],d=t.slice(1).map(Number),f=d[0],p=d[1],g=e.x1,m=e.y1,v=e.x,y=e.y;switch("TQ".includes(h)||(e.qx=null,e.qy=null),h){case"M":return e.x=f,e.y=p,t;case"A":return n=[g,m].concat(d),["C"].concat(Oe(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9]));case"Q":return e.qx=f,e.qy=p,n=[g,m].concat(d),["C"].concat((r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],u=n[5],[(c=1/3)*r+(l=2/3)*o,c*i+l*a,c*s+l*o,c*u+l*a,s,u]));case"L":return["C"].concat(Re(g,m,f,p));case"Z":return g===v&&m===y?["C",g,m,v,y,v,y]:["C"].concat(Re(g,m,v,y))}return t}function De(t,e){if(void 0===e&&(e=!1),function(t){return ye(t)&&t.every((function(t){var e=t[0];return"MC".includes(e)}))}(t)){var n=[].concat(t);return e?[n,[]]:n}for(var r,o,a=Pe(t),s=i({},fe),u=[],c="",l=a.length,h=[],d=0;d<l;d+=1){a[d]&&(c=a[d][0]),u[d]=c;var f=Le(a[d],s);a[d]=f,pe(a,u,d),l=a.length,"Z"===c&&h.push(d),o=(r=a[d]).length,s.x1=+r[o-2],s.y1=+r[o-1],s.x2=+r[o-4]||s.x1,s.y2=+r[o-3]||s.y1}return e?[a,h]:a}function Ie(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function je(t,e,n,r,i){var o=Ie([t,e],[n,r]),a={x:0,y:0};if("number"==typeof i)if(i<=0)a={x:t,y:e};else if(i>=o)a={x:n,y:r};else{var s=_e([t,e],[n,r],i/o);a={x:s[0],y:s[1]}}return{length:o,point:a,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function ze(t,e){var n=t.x,r=t.y,i=e.x,o=e.y,a=n*i+r*o,s=Math.sqrt((Math.pow(n,2)+Math.pow(r,2))*(Math.pow(i,2)+Math.pow(o,2)));return(n*o-r*i<0?-1:1)*Math.acos(a/s)}function Be(t,e,n,r,i,o,a,s,u,c){var l=Math.abs,h=Math.sin,d=Math.cos,f=Math.sqrt,p=Math.PI,g=l(n),m=l(r),v=(i%360+360)%360*(p/180);if(t===s&&e===u)return{x:t,y:e};if(0===g||0===m)return je(t,e,s,u,c).point;var y=(t-s)/2,b=(e-u)/2,E={x:d(v)*y+h(v)*b,y:-h(v)*y+d(v)*b},w=Math.pow(E.x,2)/Math.pow(g,2)+Math.pow(E.y,2)/Math.pow(m,2);w>1&&(g*=f(w),m*=f(w));var x=(Math.pow(g,2)*Math.pow(m,2)-Math.pow(g,2)*Math.pow(E.y,2)-Math.pow(m,2)*Math.pow(E.x,2))/(Math.pow(g,2)*Math.pow(E.y,2)+Math.pow(m,2)*Math.pow(E.x,2)),M=(o!==a?1:-1)*f(x=x<0?0:x),N=M*(g*E.y/m),S=M*(-m*E.x/g),C=d(v)*N-h(v)*S+(t+s)/2,k=h(v)*N+d(v)*S+(e+u)/2,T={x:(E.x-N)/g,y:(E.y-S)/m},P=ze({x:1,y:0},T),A=ze(T,{x:(-E.x-N)/g,y:(-E.y-S)/m});!a&&A>0?A-=2*p:a&&A<0&&(A+=2*p);var O=P+(A%=2*p)*c,_=g*d(O),R=m*h(O);return{x:d(v)*_-h(v)*R+C,y:h(v)*_+d(v)*R+k}}function Fe(t,e,n,r,i,o,a,s,u,c,l){var h,d=l.bbox,f=void 0===d||d,p=l.length,g=void 0===p||p,m=l.sampleSize,v=void 0===m?30:m,y="number"==typeof c,b=t,E=e,w=0,x=[b,E,w],M=[b,E],N={x:0,y:0},S=[{x:b,y:E}];y&&c<=0&&(N={x:b,y:E});for(var C=0;C<=v;C+=1){if(b=(h=Be(t,e,n,r,i,o,a,s,u,C/v)).x,E=h.y,f&&S.push({x:b,y:E}),g&&(w+=Ie(M,[b,E])),M=[b,E],y&&w>=c&&c>x[2]){var k=(w-c)/(w-x[2]);N={x:M[0]*(1-k)+x[0]*k,y:M[1]*(1-k)+x[1]*k}}x=[b,E,w]}return y&&c>=w&&(N={x:s,y:u}),{length:w,point:N,min:{x:Math.min.apply(null,S.map((function(t){return t.x}))),y:Math.min.apply(null,S.map((function(t){return t.y})))},max:{x:Math.max.apply(null,S.map((function(t){return t.x}))),y:Math.max.apply(null,S.map((function(t){return t.y})))}}}function Ge(t,e,n,r,i,o,a,s,u){var c=1-u;return{x:Math.pow(c,3)*t+3*Math.pow(c,2)*u*n+3*c*Math.pow(u,2)*i+Math.pow(u,3)*a,y:Math.pow(c,3)*e+3*Math.pow(c,2)*u*r+3*c*Math.pow(u,2)*o+Math.pow(u,3)*s}}function Ve(t,e,n,r,i,o,a,s,u,c){var l,h=c.bbox,d=void 0===h||h,f=c.length,p=void 0===f||f,g=c.sampleSize,m=void 0===g?10:g,v="number"==typeof u,y=t,b=e,E=0,w=[y,b,E],x=[y,b],M={x:0,y:0},N=[{x:y,y:b}];v&&u<=0&&(M={x:y,y:b});for(var S=0;S<=m;S+=1){if(y=(l=Ge(t,e,n,r,i,o,a,s,S/m)).x,b=l.y,d&&N.push({x:y,y:b}),p&&(E+=Ie(x,[y,b])),x=[y,b],v&&E>=u&&u>w[2]){var C=(E-u)/(E-w[2]);M={x:x[0]*(1-C)+w[0]*C,y:x[1]*(1-C)+w[1]*C}}w=[y,b,E]}return v&&u>=E&&(M={x:a,y:s}),{length:E,point:M,min:{x:Math.min.apply(null,N.map((function(t){return t.x}))),y:Math.min.apply(null,N.map((function(t){return t.y})))},max:{x:Math.max.apply(null,N.map((function(t){return t.x}))),y:Math.max.apply(null,N.map((function(t){return t.y})))}}}function We(t,e,n,r,i,o,a){var s=1-a;return{x:Math.pow(s,2)*t+2*s*a*n+Math.pow(a,2)*i,y:Math.pow(s,2)*e+2*s*a*r+Math.pow(a,2)*o}}function Ue(t,e,n,r,i,o,a,s){var u,c=s.bbox,l=void 0===c||c,h=s.length,d=void 0===h||h,f=s.sampleSize,p=void 0===f?10:f,g="number"==typeof a,m=t,v=e,y=0,b=[m,v,y],E=[m,v],w={x:0,y:0},x=[{x:m,y:v}];g&&a<=0&&(w={x:m,y:v});for(var M=0;M<=p;M+=1){if(m=(u=We(t,e,n,r,i,o,M/p)).x,v=u.y,l&&x.push({x:m,y:v}),d&&(y+=Ie(E,[m,v])),E=[m,v],g&&y>=a&&a>b[2]){var N=(y-a)/(y-b[2]);w={x:E[0]*(1-N)+b[0]*N,y:E[1]*(1-N)+b[1]*N}}b=[m,v,y]}return g&&a>=y&&(w={x:i,y:o}),{length:y,point:w,min:{x:Math.min.apply(null,x.map((function(t){return t.x}))),y:Math.min.apply(null,x.map((function(t){return t.y})))},max:{x:Math.max.apply(null,x.map((function(t){return t.x}))),y:Math.max.apply(null,x.map((function(t){return t.y})))}}}function He(t,e,n){for(var r,i,o,a,s,u,c,l,h,d=Pe(t),f="number"==typeof e,p=[],g=0,m=0,v=0,y=0,b=[],E=[],w=0,x={x:0,y:0},M=x,N=x,S=x,C=0,k=0,T=d.length;k<T;k+=1)p=(c="M"===(l=(h=d[k])[0]))?p:[g,m].concat(h.slice(1)),c?(M=x={x:v=h[1],y:y=h[2]},w=0,f&&e<.001&&(S=x)):"L"===l?(w=(r=je(p[0],p[1],p[2],p[3],(e||0)-C)).length,x=r.min,M=r.max,N=r.point):"A"===l?(w=(i=Fe(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],(e||0)-C,n||{})).length,x=i.min,M=i.max,N=i.point):"C"===l?(w=(o=Ve(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],(e||0)-C,n||{})).length,x=o.min,M=o.max,N=o.point):"Q"===l?(w=(a=Ue(p[0],p[1],p[2],p[3],p[4],p[5],(e||0)-C,n||{})).length,x=a.min,M=a.max,N=a.point):"Z"===l&&(w=(s=je((p=[g,m,v,y])[0],p[1],p[2],p[3],(e||0)-C)).length,x=s.min,M=s.max,N=s.point),f&&C<e&&C+w>=e&&(S=N),E.push(M),b.push(x),C+=w,g=(u="Z"!==l?h.slice(-2):[v,y])[0],m=u[1];return f&&e>=C&&(S={x:g,y:m}),{length:C,point:S,min:{x:Math.min.apply(null,b.map((function(t){return t.x}))),y:Math.min.apply(null,b.map((function(t){return t.y})))},max:{x:Math.max.apply(null,E.map((function(t){return t.x}))),y:Math.max.apply(null,E.map((function(t){return t.y})))}}}function qe(t,e){var n=t.length-1,r=[],i=0,o=function(t){var e=t.length,n=e-1;return t.map((function(r,i){return t.map((function(r,o){var a,s=i+o;return 0===o||t[s]&&"M"===t[s][0]?(a=t[s],["M"].concat(a.slice(-2))):(s>=e&&(s-=n),t[s])}))}))}(t);return o.forEach((function(o,a){t.slice(1).forEach((function(r,o){i+=Ie(t[(a+o)%n].slice(-2),e[o%n].slice(-2))})),r[a]=i,i=0})),o[r.indexOf(Math.min.apply(null,r))]}function $e(t){return function(t){var e=0,n=0,r=0;return De(t).map((function(t){var i;if("M"===t[0])return e=t[1],n=t[2],0;var o=t.slice(1),a=o[0],s=o[1],u=o[2],c=o[3],l=o[4],h=o[5];return r=function(t,e,n,r,i,o,a,s){return 3*((s-e)*(n+i)-(a-t)*(r+o)+r*(t-i)-n*(e-o)+s*(i+t/3)-a*(o+e/3))/20}(e,n,a,s,u,c,l,h),i=t.slice(-2),e=i[0],n=i[1],r})).reduce((function(t,e){return t+e}),0)}(t)>=0}function Ye(t){return t.map((function(t,e,n){var r=e&&n[e-1].slice(-2).concat(t.slice(1)),i=e?Ve(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],{bbox:!1}).length:0;return{s:t,ss:e?i?function(t,e){void 0===e&&(e=.5);var n=t.slice(0,2),r=t.slice(2,4),i=t.slice(4,6),o=t.slice(6,8),a=_e(n,r,e),s=_e(r,i,e),u=_e(i,o,e),c=_e(a,s,e),l=_e(s,u,e),h=_e(c,l,e);return[["C"].concat(a,c,h),["C"].concat(l,u,o)]}(r):[t,t]:[t],l:i}}))}function Ke(t,e,n){var r=Ye(t),i=Ye(e),o=r.length,a=i.length,s=r.filter((function(t){return t.l})).length,u=i.filter((function(t){return t.l})).length,c=r.filter((function(t){return t.l})).reduce((function(t,e){return t+e.l}),0)/s||0,l=i.filter((function(t){return t.l})).reduce((function(t,e){return t+e.l}),0)/u||0,h=n||Math.max(o,a),d=[c,l],f=[h-o,h-a],p=0,g=[r,i].map((function(t,e){return t.l===h?t.map((function(t){return t.s})):t.map((function(t,n){return p=n&&f[e]&&t.l>=d[e],f[e]-=p?1:0,p?t.ss:[t.s]})).flat()}));return g[0].length===g[1].length?g:Ke(g[0],g[1],h)}function Xe(t){var e=document.createElement("div");e.innerHTML=t;var n=e.childNodes[0];return n&&e.contains(n)&&e.removeChild(n),n}function Ze(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Qe(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Je(){}var tn=.7,en=1/tn,nn="\\s*([+-]?\\d+)\\s*",rn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",on="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",an=/^#([0-9a-f]{3,8})$/,sn=new RegExp("^rgb\\("+[nn,nn,nn]+"\\)$"),un=new RegExp("^rgb\\("+[on,on,on]+"\\)$"),cn=new RegExp("^rgba\\("+[nn,nn,nn,rn]+"\\)$"),ln=new RegExp("^rgba\\("+[on,on,on,rn]+"\\)$"),hn=new RegExp("^hsl\\("+[rn,on,on]+"\\)$"),dn=new RegExp("^hsla\\("+[rn,on,on,rn]+"\\)$"),fn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function pn(){return this.rgb().formatHex()}function gn(){return this.rgb().formatRgb()}function mn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=an.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?vn(e):3===n?new bn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?yn(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?yn(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=sn.exec(t))?new bn(e[1],e[2],e[3],1):(e=un.exec(t))?new bn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=cn.exec(t))?yn(e[1],e[2],e[3],e[4]):(e=ln.exec(t))?yn(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=hn.exec(t))?Mn(e[1],e[2]/100,e[3]/100,1):(e=dn.exec(t))?Mn(e[1],e[2]/100,e[3]/100,e[4]):fn.hasOwnProperty(t)?vn(fn[t]):"transparent"===t?new bn(NaN,NaN,NaN,0):null}function vn(t){return new bn(t>>16&255,t>>8&255,255&t,1)}function yn(t,e,n,r){return r<=0&&(t=e=n=NaN),new bn(t,e,n,r)}function bn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function En(){return"#"+xn(this.r)+xn(this.g)+xn(this.b)}function wn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function xn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Mn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Sn(t,e,n,r)}function Nn(t){if(t instanceof Sn)return new Sn(t.h,t.s,t.l,t.opacity);if(t instanceof Je||(t=mn(t)),!t)return new Sn;if(t instanceof Sn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new Sn(a,s,u,t.opacity)}function Sn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Cn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function kn(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function Tn(t,e){var n=Math.min.apply(Math,l([],c(t),!1)),r=Math.min.apply(Math,l([],c(e),!1));return{x:n,y:r,width:Math.max.apply(Math,l([],c(t),!1))-n,height:Math.max.apply(Math,l([],c(e),!1))-r}}function Pn(t,e,n,r,i,o){return n*Math.cos(i)*Math.cos(o)-r*Math.sin(i)*Math.sin(o)+t}function An(t,e,n,r,i,o){return n*Math.sin(i)*Math.cos(o)+r*Math.cos(i)*Math.sin(o)+e}function On(t,e,n,r,i,o,a){for(var s=function(t,e,n){return Math.atan(-e/t*Math.tan(n))}(n,r,i),u=1/0,c=-1/0,l=[o,a],h=2*-Math.PI;h<=2*Math.PI;h+=Math.PI){var d=s+h;o<a?o<d&&d<a&&l.push(d):a<d&&d<o&&l.push(d)}for(h=0;h<l.length;h++){var f=Pn(t,0,n,r,i,l[h]);f<u&&(u=f),f>c&&(c=f)}var p=function(t,e,n){return Math.atan(e/(t*Math.tan(n)))}(n,r,i),g=1/0,m=-1/0,v=[o,a];for(h=2*-Math.PI;h<=2*Math.PI;h+=Math.PI){var y=p+h;o<a?o<y&&y<a&&v.push(y):a<y&&y<o&&v.push(y)}for(h=0;h<v.length;h++){var b=An(0,e,n,r,i,v[h]);b<g&&(g=b),b>m&&(m=b)}return{x:u,y:g,width:c-u,height:m-g}}Ze(Je,mn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:pn,formatHex:pn,formatHsl:function(){return Nn(this).formatHsl()},formatRgb:gn,toString:gn}),Ze(bn,(function(t,e,n,r){return 1===arguments.length?((i=t)instanceof Je||(i=mn(i)),i?new bn((i=i.rgb()).r,i.g,i.b,i.opacity):new bn):new bn(t,e,n,null==r?1:r);var i}),Qe(Je,{brighter:function(t){return t=null==t?en:Math.pow(en,t),new bn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?tn:Math.pow(tn,t),new bn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:En,formatHex:En,formatRgb:wn,toString:wn})),Ze(Sn,(function(t,e,n,r){return 1===arguments.length?Nn(t):new Sn(t,e,n,null==r?1:r)}),Qe(Je,{brighter:function(t){return t=null==t?en:Math.pow(en,t),new Sn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?tn:Math.pow(tn,t),new Sn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new bn(Cn(t>=240?t-240:t+120,i,r),Cn(t,i,r),Cn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var _n=1e-4;function Rn(t,e,n,r,i,o){var a=-1,s=1/0,u=[n,r],h=20;o&&o>200&&(h=o/10);for(var d=1/h,f=d/10,p=0;p<=h;p++){var g=p*d,m=[i.apply(void 0,l([],c(t.concat([g])),!1)),i.apply(void 0,l([],c(e.concat([g])),!1))];(E=kn(u[0],u[1],m[0],m[1]))<s&&(a=g,s=E)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var v=t.length;return{x:t[v-1],y:e[v-1]}}s=1/0;for(p=0;p<32&&!(f<_n);p++){var y=a-f,b=a+f,E=(m=[i.apply(void 0,l([],c(t.concat([y])),!1)),i.apply(void 0,l([],c(e.concat([y])),!1))],kn(u[0],u[1],m[0],m[1]));if(y>=0&&E<s)a=y,s=E;else{var w=[i.apply(void 0,l([],c(t.concat([b])),!1)),i.apply(void 0,l([],c(e.concat([b])),!1))],x=kn(u[0],u[1],w[0],w[1]);b<=1&&x<s?(a=b,s=x):f*=.5}}return{x:i.apply(void 0,l([],c(t.concat([a])),!1)),y:i.apply(void 0,l([],c(e.concat([a])),!1))}}function Ln(t,e,n,r){return kn(t,e,n,r)}function Dn(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}}function In(t,e,n,r,i,o){var a=[n-t,r-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((i-t)*(i-t)+(o-e)*(o-e));var s=[-a[1],a[0]];!function(t,e){var n=e[0],r=e[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i}(s,s);var u=[i-t,o-e];return Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}(u,s))}function jn(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function zn(t,e,n,r){var i,o,a,s=-3*t+9*e-9*n+3*r,u=6*t-12*e+6*n,c=3*e-3*t,l=[];if(Ht(s,0))Ht(u,0)||(i=-c/u)>=0&&i<=1&&l.push(i);else{var h=u*u-4*s*c;Ht(h,0)?l.push(-u/(2*s)):h>0&&(o=(-u-(a=Math.sqrt(h)))/(2*s),(i=(-u+a)/(2*s))>=0&&i<=1&&l.push(i),o>=0&&o<=1&&l.push(o))}return l}function Bn(t,e,n,r,i,o,a,s){for(var u=[t,a],c=[e,s],l=zn(t,n,i,a),h=zn(e,r,o,s),d=0;d<l.length;d++)u.push(jn(t,n,i,a,l[d]));for(d=0;d<h.length;d++)c.push(jn(e,r,o,s,h[d]));return Tn(u,c)}function Fn(t,e,n,r,i,o,a,s,u,c,l){var h=function(t,e,n,r,i,o,a,s,u,c,l){return Rn([t,n,i,a],[e,r,o,s],u,c,jn,l)}(t,e,n,r,i,o,a,s,u,c,l);return kn(h.x,h.y,u,c)}function Gn(t){return function(t){if(t.length<2)return 0;for(var e=0,n=0;n<t.length-1;n++){var r=t[n],i=t[n+1];e+=kn(r[0],r[1],i[0],i[1])}return e}(t)}function Vn(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function Wn(t,e,n){var r=t+n-2*e;if(Ht(r,0))return[.5];var i=(t-e)/r;return i<=1&&i>=0?[i]:[]}function Un(t,e,n,r,i,o){var a=Wn(t,n,i)[0],s=Wn(e,r,o)[0],u=[t,i],c=[e,o];return void 0!==a&&u.push(Vn(t,n,i,a)),void 0!==s&&c.push(Vn(e,r,o,s)),Tn(u,c)}function Hn(t,e,n,r,i,o,a,s){var u=function(t,e,n,r,i,o,a,s){return Rn([t,n,i],[e,r,o],a,s,Vn)}(t,e,n,r,i,o,a,s);return kn(u.x,u.y,a,s)}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var qn={exports:{}};!function(t,e){t.exports=function(){function t(t,n,i,o,a){e(t,n,i||0,o||t.length-1,a||r)}function e(t,r,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,u=r-i+1,c=Math.log(s),l=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*l*(s-l)/s)*(u-s/2<0?-1:1);e(t,r,Math.max(i,Math.floor(r-u*l/s+h)),Math.min(o,Math.floor(r+(s-u)*l/s+h)),a)}var d=t[r],f=i,p=o;for(n(t,i,r),a(t[o],d)>0&&n(t,i,o);f<p;){for(n(t,f,p),f++,p--;a(t[f],d)<0;)f++;for(;a(t[p],d)>0;)p--}0===a(t[i],d)?n(t,i,p):n(t,++p,o),p<=r&&(i=p+1),r<=p&&(o=p-1)}}function n(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function r(t,e){return t<e?-1:t>e?1:0}var i=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function a(t,e){s(t,0,t.children.length,e,t)}function s(t,e,n,r,i){i||(i=v(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=e;o<n;o++){var a=t.children[o];u(i,t.leaf?r(a):a)}return i}function u(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function c(t,e){return t.minX-e.minX}function l(t,e){return t.minY-e.minY}function h(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function d(t){return t.maxX-t.minX+(t.maxY-t.minY)}function f(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function p(t,e){var n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}function g(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function m(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function v(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function y(e,n,r,i,o){for(var a=[n,r];a.length;)if(!((r=a.pop())-(n=a.pop())<=i)){var s=n+Math.ceil((r-n)/i/2)*i;t(e,s,n,r,o),a.push(n,s,s,r)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(t){var e=this.data,n=[];if(!m(t,e))return n;for(var r=this.toBBox,i=[];e;){for(var o=0;o<e.children.length;o++){var a=e.children[o],s=e.leaf?r(a):a;m(t,s)&&(e.leaf?n.push(a):g(t,s)?this._all(a,n):i.push(a))}e=i.pop()}return n},i.prototype.collides=function(t){var e=this.data;if(!m(t,e))return!1;for(var n=[];e;){for(var r=0;r<e.children.length;r++){var i=e.children[r],o=e.leaf?this.toBBox(i):i;if(m(t,o)){if(e.leaf||g(t,o))return!0;n.push(i)}}e=n.pop()}return!1},i.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},i.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},i.prototype.clear=function(){return this.data=v([]),this},i.prototype.remove=function(t,e){if(!t)return this;for(var n,r,i,a=this.data,s=this.toBBox(t),u=[],c=[];a||u.length;){if(a||(a=u.pop(),r=u[u.length-1],n=c.pop(),i=!0),a.leaf){var l=o(t,a.children,e);if(-1!==l)return a.children.splice(l,1),u.push(a),this._condense(u),this}i||a.leaf||!g(a,s)?r?(n++,a=r.children[n],i=!1):a=null:(u.push(a),c.push(n),n=0,r=a,a=a.children[0])}return this},i.prototype.toBBox=function(t){return t},i.prototype.compareMinX=function(t,e){return t.minX-e.minX},i.prototype.compareMinY=function(t,e){return t.minY-e.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(t){return this.data=t,this},i.prototype._all=function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},i.prototype._build=function(t,e,n,r){var i,o=n-e+1,s=this._maxEntries;if(o<=s)return a(i=v(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=v([])).leaf=!1,i.height=r;var u=Math.ceil(o/s),c=u*Math.ceil(Math.sqrt(s));y(t,e,n,c,this.compareMinX);for(var l=e;l<=n;l+=c){var h=Math.min(l+c-1,n);y(t,l,h,u,this.compareMinY);for(var d=l;d<=h;d+=u){var f=Math.min(d+u-1,h);i.children.push(this._build(t,d,f,r-1))}}return a(i,this.toBBox),i},i.prototype._chooseSubtree=function(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){for(var i=1/0,o=1/0,a=void 0,s=0;s<e.children.length;s++){var u=e.children[s],c=h(u),l=f(t,u)-c;l<o?(o=l,i=c<i?c:i,a=u):l===o&&c<i&&(i=c,a=u)}e=a||e.children[0]}return e},i.prototype._insert=function(t,e,n){var r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),u(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)},i.prototype._split=function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=v(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,a(n,this.toBBox),a(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},i.prototype._splitRoot=function(t,e){this.data=v([t,e]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(t,e,n){for(var r,i=1/0,o=1/0,a=e;a<=n-e;a++){var u=s(t,0,a,this.toBBox),c=s(t,a,n,this.toBBox),l=p(u,c),d=h(u)+h(c);l<i?(i=l,r=a,o=d<o?d:o):l===i&&d<o&&(o=d,r=a)}return r||n-e},i.prototype._chooseSplitAxis=function(t,e,n){var r=t.leaf?this.compareMinX:c,i=t.leaf?this.compareMinY:l;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},i.prototype._allDistMargin=function(t,e,n,r){t.children.sort(r);for(var i=this.toBBox,o=s(t,0,e,i),a=s(t,n-e,n,i),c=d(o)+d(a),l=e;l<n-e;l++){var h=t.children[l];u(o,t.leaf?i(h):h),c+=d(o)}for(var f=n-e-1;f>=e;f--){var p=t.children[f];u(a,t.leaf?i(p):p),c+=d(a)}return c},i.prototype._adjustParentBBoxes=function(t,e,n){for(var r=n;r>=0;r--)u(e[r],t)},i.prototype._condense=function(t){for(var e=t.length-1,n=void 0;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children).splice(n.indexOf(t[e]),1):this.clear():a(t[e],this.toBBox)},i}()}(qn);var $n,Yn,Kn=qn.exports;!function(t){t.GROUP="g",t.CIRCLE="circle",t.ELLIPSE="ellipse",t.IMAGE="image",t.RECT="rect",t.LINE="line",t.POLYLINE="polyline",t.POLYGON="polygon",t.TEXT="text",t.PATH="path",t.HTML="html",t.MESH="mesh"}($n||($n={})),function(t){t[t.ZERO=0]="ZERO",t[t.NEGATIVE_ONE=1]="NEGATIVE_ONE"}(Yn||(Yn={}));var Xn=function(){function t(){this.plugins=[]}return t.prototype.addRenderingPlugin=function(t){this.plugins.push(t),this.context.renderingPlugins.push(t)},t.prototype.removeAllRenderingPlugins=function(){var t=this;this.plugins.forEach((function(e){var n=t.context.renderingPlugins.indexOf(e);n>=0&&t.context.renderingPlugins.splice(n,1)}))},t}(),Zn=function(){function t(t){this.clipSpaceNearZ=Yn.NEGATIVE_ONE,this.plugins=[],this.config=i({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0},t)}return t.prototype.registerPlugin=function(t){-1===this.plugins.findIndex((function(e){return e===t}))&&this.plugins.push(t)},t.prototype.unregisterPlugin=function(t){var e=this.plugins.findIndex((function(e){return e===t}));e>-1&&this.plugins.splice(e,1)},t.prototype.getPlugins=function(){return this.plugins},t.prototype.getPlugin=function(t){return this.plugins.find((function(e){return e.name===t}))},t.prototype.getConfig=function(){return this.config},t.prototype.setConfig=function(t){Object.assign(this.config,t)},t}();function Qn(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Jn(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function tr(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function er(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function nr(t){return void 0===t?0:t>360||t<-360?t%360:t}function rr(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),Array.isArray(t)&&3===t.length?Q(t):Wt(t)?tt(t,e,n):tt(t[0],t[1]||e,t[2]||n)}function ir(t){return t*(Math.PI/180)}function or(t){return t*(180/Math.PI)}function ar(t,e){return 16===e.length?function(t,e){var n,r,i=.5*Math.PI,o=c(j(Z(),e),3),a=o[0],s=o[1],u=o[2],l=Math.asin(-e[2]/a);return l<i?l>-i?(n=Math.atan2(e[6]/s,e[10]/u),r=Math.atan2(e[1]/a,e[0]/a)):(r=0,n=-Math.atan2(e[4]/s,e[5]/s)):(r=0,n=Math.atan2(e[4]/s,e[5]/s)),t[0]=n,t[1]=l,t[2]=r,t}(t,e):function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=r*r,s=i*i,u=o*o,c=n*n+a+s+u,l=n*o-r*i;return l>.499995*c?(t[0]=Math.PI/2,t[1]=2*Math.atan2(r,n),t[2]=0):l<-.499995*c?(t[0]=-Math.PI/2,t[1]=2*Math.atan2(r,n),t[2]=0):(t[0]=Math.asin(2*(n*i-o*r)),t[1]=Math.atan2(2*(n*o+r*i),1-2*(s+u)),t[2]=Math.atan2(2*(n*r+i*o),1-2*(a+s))),t}(t,e)}function sr(t,e,n,r,i){var o,a,s,u,c,l,h,d,f,p,g=Math.cos(t),m=Math.sin(t);return o=r*g,a=i*m,s=0,u=-r*m,c=i*g,l=0,h=e,d=n,f=1,(p=new y(9))[0]=o,p[1]=a,p[2]=s,p[3]=u,p[4]=c,p[5]=l,p[6]=h,p[7]=d,p[8]=f,p}function ur(t){var e=t[0],n=t[1],r=t[3],i=t[4],o=Math.sqrt(e*e+n*n),a=Math.sqrt(r*r+i*i);e*i-n*r<0&&(e<i?o=-o:a=-a),o&&(e*=1/o,n*=1/o),a&&(r*=1/a,i*=1/a);var s=or(Math.atan2(n,e));return[t[6],t[7],o,a,s]}var cr=E(),lr=E(),hr=pt(),dr=[Z(),Z(),Z()],fr=Z();function pr(t,e,n,r,i){t[0]=e[0]*r+n[0]*i,t[1]=e[1]*r+n[1]*i,t[2]=e[2]*r+n[2]*i}var gr,mr=function(){function t(){this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return t.isEmpty=function(t){return!t||0===t.halfExtents[0]&&0===t.halfExtents[1]&&0===t.halfExtents[2]},t.prototype.update=function(t,e){Qn(this.center,t),Qn(this.halfExtents,e),Jn(this.min,this.center,this.halfExtents),tr(this.max,this.center,this.halfExtents)},t.prototype.setMinMax=function(t,e){tr(this.center,e,t),er(this.center,this.center,.5),Jn(this.halfExtents,e,t),er(this.halfExtents,this.halfExtents,.5),Qn(this.min,t),Qn(this.max,e)},t.prototype.getMin=function(){return this.min},t.prototype.getMax=function(){return this.max},t.prototype.add=function(e){if(!t.isEmpty(e))if(t.isEmpty(this))this.setMinMax(e.getMin(),e.getMax());else{var n=this.center,r=n[0],i=n[1],o=n[2],a=this.halfExtents,s=a[0],u=a[1],c=a[2],l=r-s,h=r+s,d=i-u,f=i+u,p=o-c,g=o+c,m=e.center,v=m[0],y=m[1],b=m[2],E=e.halfExtents,w=E[0],x=E[1],M=E[2],N=v-w,S=v+w,C=y-x,k=y+x,T=b-M,P=b+M;N<l&&(l=N),S>h&&(h=S),C<d&&(d=C),k>f&&(f=k),T<p&&(p=T),P>g&&(g=P),n[0]=.5*(l+h),n[1]=.5*(d+f),n[2]=.5*(p+g),a[0]=.5*(h-l),a[1]=.5*(f-d),a[2]=.5*(g-p),this.min[0]=l,this.min[1]=d,this.min[2]=p,this.max[0]=h,this.max[1]=f,this.max[2]=g}},t.prototype.setFromTransformedAABB=function(t,e){var n=this.center,r=this.halfExtents,i=t.center,o=t.halfExtents,a=e[0],s=e[4],u=e[8],c=e[1],l=e[5],h=e[9],d=e[2],f=e[6],p=e[10],g=Math.abs(a),m=Math.abs(s),v=Math.abs(u),y=Math.abs(c),b=Math.abs(l),E=Math.abs(h),w=Math.abs(d),x=Math.abs(f),M=Math.abs(p);n[0]=e[12]+a*i[0]+s*i[1]+u*i[2],n[1]=e[13]+c*i[0]+l*i[1]+h*i[2],n[2]=e[14]+d*i[0]+f*i[1]+p*i[2],r[0]=g*o[0]+m*o[1]+v*o[2],r[1]=y*o[0]+b*o[1]+E*o[2],r[2]=w*o[0]+x*o[1]+M*o[2],Jn(this.min,n,r),tr(this.max,n,r)},t.prototype.intersects=function(t){var e=this.getMax(),n=this.getMin(),r=t.getMax(),i=t.getMin();return n[0]<=r[0]&&e[0]>=i[0]&&n[1]<=r[1]&&e[1]>=i[1]&&n[2]<=r[2]&&e[2]>=i[2]},t.prototype.intersection=function(e){if(!this.intersects(e))return null;var n=new t,r=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t}([0,0,0],this.getMin(),e.getMin()),i=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t}([0,0,0],this.getMax(),e.getMax());return n.setMinMax(r,i),n},t.prototype.getNegativeFarPoint=function(t){return 273===t.pnVertexFlag?Qn([0,0,0],this.min):272===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:257===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:256===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:17===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:16===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:1===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]},t.prototype.getPositiveFarPoint=function(t){return 273===t.pnVertexFlag?Qn([0,0,0],this.max):272===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:257===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:256===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:17===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:16===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:1===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]},t}(),vr=function(){function t(t,e){this.distance=t||0,this.normal=e||tt(0,1,0),this.updatePNVertexFlag()}return t.prototype.updatePNVertexFlag=function(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0)},t.prototype.distanceToPoint=function(t){return st(t,this.normal)-this.distance},t.prototype.normalize=function(){var t=1/ft(this.normal);ot(this.normal,this.normal,t),this.distance*=t},t.prototype.intersectsLine=function(t,e,n){var r=this.distanceToPoint(t),i=r/(r-this.distanceToPoint(e)),o=i>=0&&i<=1;return o&&n&&ct(n,t,e,i),o},t}();!function(t){t[t.OUTSIDE=4294967295]="OUTSIDE",t[t.INSIDE=0]="INSIDE",t[t.INDETERMINATE=2147483647]="INDETERMINATE"}(gr||(gr={}));var yr,br,Er,wr=function(){function t(t){if(this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new vr)}return t.prototype.extractFromVPMatrix=function(t){var e=c(t,16),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],l=e[7],h=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],v=e[14],y=e[15];nt(this.planes[0].normal,o-n,l-a,p-h),this.planes[0].distance=y-g,nt(this.planes[1].normal,o+n,l+a,p+h),this.planes[1].distance=y+g,nt(this.planes[2].normal,o+r,l+s,p+d),this.planes[2].distance=y+m,nt(this.planes[3].normal,o-r,l-s,p-d),this.planes[3].distance=y-m,nt(this.planes[4].normal,o-i,l-u,p-f),this.planes[4].distance=y-v,nt(this.planes[5].normal,o+i,l+u,p+f),this.planes[5].distance=y+v,this.planes.forEach((function(t){t.normalize(),t.updatePNVertexFlag()}))},t}(),xr=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y},t}(),Mr=function(){function t(t,e,n,r){this.x=t,this.y=e,this.width=n,this.height=r,this.left=t,this.right=t+n,this.top=e,this.bottom=e+r}return t.prototype.toJSON=function(){},t}(),Nr="Method not implemented.",Sr="Use document.documentElement instead.";!function(t){t[t.ORBITING=0]="ORBITING",t[t.EXPLORING=1]="EXPLORING",t[t.TRACKING=2]="TRACKING"}(yr||(yr={})),function(t){t[t.DEFAULT=0]="DEFAULT",t[t.ROTATIONAL=1]="ROTATIONAL",t[t.TRANSLATIONAL=2]="TRANSLATIONAL",t[t.CINEMATIC=3]="CINEMATIC"}(br||(br={})),function(t){t[t.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",t[t.PERSPECTIVE=1]="PERSPECTIVE"}(Er||(Er={}));var Cr,kr,Tr,Pr,Ar,Or="updated",_r=2e-4,Rr=function(){function t(){this.clipSpaceNearZ=Yn.NEGATIVE_ONE,this.eventEmitter=new m,this.matrix=E(),this.right=tt(1,0,0),this.up=tt(0,1,0),this.forward=tt(0,0,1),this.position=tt(0,0,1),this.focalPoint=tt(0,0,0),this.distanceVector=tt(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=E(),this.projectionMatrixInverse=E(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=yr.EXPLORING,this.trackingMode=br.DEFAULT,this.projectionMode=Er.PERSPECTIVE,this.frustum=new wr,this.orthoMatrix=E()}return t.prototype.isOrtho=function(){return this.projectionMode===Er.ORTHOGRAPHIC},t.prototype.getProjectionMode=function(){return this.projectionMode},t.prototype.getPerspective=function(){return this.jitteredProjectionMatrix||this.projectionMatrix},t.prototype.getPerspectiveInverse=function(){return this.projectionMatrixInverse},t.prototype.getFrustum=function(){return this.frustum},t.prototype.getPosition=function(){return this.position},t.prototype.getFocalPoint=function(){return this.focalPoint},t.prototype.getDollyingStep=function(){return this.dollyingStep},t.prototype.getNear=function(){return this.near},t.prototype.getFar=function(){return this.far},t.prototype.getZoom=function(){return this.zoom},t.prototype.getOrthoMatrix=function(){return this.orthoMatrix},t.prototype.getView=function(){return this.view},t.prototype.setEnableUpdate=function(t){this.enableUpdate=t},t.prototype.setType=function(t,e){return this.type=t,this.type===yr.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===yr.TRACKING&&void 0!==e&&this.setTrackingMode(e),this},t.prototype.setProjectionMode=function(t){return this.projectionMode=t,this},t.prototype.setTrackingMode=function(t){if(this.type!==yr.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this},t.prototype.setWorldRotation=function(t){return this.rotateWorld=t,this._getAngles(),this},t.prototype.getViewTransform=function(){return C(E(),this.matrix)},t.prototype.getWorldTransform=function(){return this.matrix},t.prototype.jitterProjectionMatrix=function(t,e){var n=R(E(),[t,e,0]);this.jitteredProjectionMatrix=T(E(),n,this.projectionMatrix)},t.prototype.clearJitterProjectionMatrix=function(){this.jitteredProjectionMatrix=void 0},t.prototype.setMatrix=function(t){return this.matrix=t,this._update(),this},t.prototype.setFov=function(t){return this.setPerspective(this.near,this.far,t,this.aspect),this},t.prototype.setAspect=function(t){return this.setPerspective(this.near,this.far,this.fov,t),this},t.prototype.setNear=function(t){return this.projectionMode===Er.PERSPECTIVE?this.setPerspective(t,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,t,this.far),this},t.prototype.setFar=function(t){return this.projectionMode===Er.PERSPECTIVE?this.setPerspective(this.near,t,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,t),this},t.prototype.setViewOffset=function(t,e,n,r,i,o){return this.aspect=t/e,void 0===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.projectionMode===Er.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},t.prototype.clearViewOffset=function(){return void 0!==this.view&&(this.view.enabled=!1),this.projectionMode===Er.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},t.prototype.setZoom=function(t){return this.zoom=t,this.projectionMode===Er.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===Er.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this},t.prototype.setZoomByViewportPoint=function(t,e){var n=this.canvas.viewport2Canvas({x:e[0],y:e[1]}),r=n.x,i=n.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(r,i),this.setFocalPoint(r,i),this.setZoom(t),this.rotate(0,0,o);var a=this.canvas.viewport2Canvas({x:e[0],y:e[1]}),s=tt(a.x-r,a.y-i,0),u=st(s,this.right)/J(this.right),c=st(s,this.up)/J(this.up);return this.pan(-u,-c),this},t.prototype.setPerspective=function(t,e,n,r){var i;this.projectionMode=Er.PERSPECTIVE,this.fov=n,this.near=t,this.far=e,this.aspect=r;var o=this.near*Math.tan(ir(.5*this.fov))/this.zoom,a=2*o,s=this.aspect*a,u=-.5*s;if(null===(i=this.view)||void 0===i?void 0:i.enabled){var c=this.view.fullWidth,l=this.view.fullHeight;u+=this.view.offsetX*s/c,o-=this.view.offsetY*a/l,s*=this.view.width/c,a*=this.view.height/l}return function(t,e,n,r,i,o,a,s){void 0===s&&(s=!1);var u,c,l=2*o/(n-e),h=2*o/(r-i),d=(n+e)/(n-e),f=(r+i)/(r-i);s?(u=-a/(a-o),c=-a*o/(a-o)):(u=-(a+o)/(a-o),c=-2*a*o/(a-o)),t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=h,t[6]=0,t[7]=0,t[8]=d,t[9]=f,t[10]=u,t[11]=-1,t[12]=0,t[13]=0,t[14]=c,t[15]=0}(this.projectionMatrix,u,u+s,o,o-a,t,this.far,this.clipSpaceNearZ===Yn.ZERO),A(this.projectionMatrix,this.projectionMatrix,tt(1,-1,1)),C(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this},t.prototype.setOrthographic=function(t,e,n,r,i,o){var a;this.projectionMode=Er.ORTHOGRAPHIC,this.rright=e,this.left=t,this.top=n,this.bottom=r,this.near=i,this.far=o;var s=(this.rright-this.left)/(2*this.zoom),u=(this.top-this.bottom)/(2*this.zoom),c=(this.rright+this.left)/2,l=(this.top+this.bottom)/2,h=c-s,d=c+s,f=l+u,p=l-u;if(null===(a=this.view)||void 0===a?void 0:a.enabled){var g=(this.rright-this.left)/this.view.fullWidth/this.zoom,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d=(h+=g*this.view.offsetX)+g*this.view.width,p=(f-=m*this.view.offsetY)-m*this.view.height}return this.clipSpaceNearZ===Yn.NEGATIVE_ONE?U(this.projectionMatrix,h,d,p,f,i,o):H(this.projectionMatrix,h,d,p,f,i,o),A(this.projectionMatrix,this.projectionMatrix,tt(1,-1,1)),C(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this},t.prototype.setPosition=function(t,e,n){void 0===e&&(e=this.position[1]),void 0===n&&(n=this.position[2]);var r=rr(t,e,n);return this._setPosition(r),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this},t.prototype.setFocalPoint=function(t,e,n){void 0===e&&(e=this.focalPoint[1]),void 0===n&&(n=this.focalPoint[2]);var r=tt(0,1,0);if(this.focalPoint=rr(t,e,n),this.trackingMode===br.CINEMATIC){var i=it(Z(),this.focalPoint,this.position);t=i[0],e=i[1],n=i[2];var o=J(i),a=or(Math.asin(e/o)),s=90+or(Math.atan2(n,t)),u=E();_(u,u,ir(s)),O(u,u,ir(a)),r=lt(Z(),[0,1,0],u)}return C(this.matrix,q(E(),this.position,this.focalPoint,r)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this},t.prototype.getDistance=function(){return this.distance},t.prototype.getDistanceVector=function(){return this.distanceVector},t.prototype.setDistance=function(t){if(this.distance===t||t<0)return this;this.distance=t,this.distance<_r&&(this.distance=_r),this.dollyingStep=this.distance/100;var e=Z();t=this.distance;var n=this.forward,r=this.focalPoint;return e[0]=t*n[0]+r[0],e[1]=t*n[1]+r[1],e[2]=t*n[2]+r[2],this._setPosition(e),this.triggerUpdate(),this},t.prototype.setMaxDistance=function(t){return this.maxDistance=t,this},t.prototype.setMinDistance=function(t){return this.minDistance=t,this},t.prototype.setAzimuth=function(t){return this.azimuth=nr(t),this.computeMatrix(),this._getAxes(),this.type===yr.ORBITING||this.type===yr.EXPLORING?this._getPosition():this.type===yr.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},t.prototype.getAzimuth=function(){return this.azimuth},t.prototype.setElevation=function(t){return this.elevation=nr(t),this.computeMatrix(),this._getAxes(),this.type===yr.ORBITING||this.type===yr.EXPLORING?this._getPosition():this.type===yr.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},t.prototype.getElevation=function(){return this.elevation},t.prototype.setRoll=function(t){return this.roll=nr(t),this.computeMatrix(),this._getAxes(),this.type===yr.ORBITING||this.type===yr.EXPLORING?this._getPosition():this.type===yr.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},t.prototype.getRoll=function(){return this.roll},t.prototype._update=function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()},t.prototype.computeMatrix=function(){var t=vt(mt(),[0,0,1],ir(this.roll));N(this.matrix);var e=vt(mt(),[1,0,0],ir((this.rotateWorld&&this.type!==yr.TRACKING||this.type===yr.TRACKING?1:-1)*this.elevation)),n=vt(mt(),[0,1,0],ir((this.rotateWorld&&this.type!==yr.TRACKING||this.type===yr.TRACKING?1:-1)*this.azimuth)),r=yt(mt(),n,e);r=yt(mt(),r,t);var i=F(E(),r);this.type===yr.ORBITING||this.type===yr.EXPLORING?(P(this.matrix,this.matrix,this.focalPoint),T(this.matrix,this.matrix,i),P(this.matrix,this.matrix,[0,0,this.distance])):this.type===yr.TRACKING&&(P(this.matrix,this.matrix,this.position),T(this.matrix,this.matrix,i))},t.prototype._setPosition=function(t,e,n){this.position=rr(t,e,n);var r=this.matrix;r[12]=this.position[0],r[13]=this.position[1],r[14]=this.position[2],r[15]=1,this._getOrthoMatrix()},t.prototype._getAxes=function(){et(this.right,rr(gt(pt(),[1,0,0,0],this.matrix))),et(this.up,rr(gt(pt(),[0,1,0,0],this.matrix))),et(this.forward,rr(gt(pt(),[0,0,1,0],this.matrix))),at(this.right,this.right),at(this.up,this.up),at(this.forward,this.forward)},t.prototype._getAngles=function(){var t=this.distanceVector[0],e=this.distanceVector[1],n=this.distanceVector[2],r=J(this.distanceVector);if(0===r)return this.elevation=0,void(this.azimuth=0);this.type===yr.TRACKING||this.rotateWorld?(this.elevation=or(Math.asin(e/r)),this.azimuth=or(Math.atan2(-t,-n))):(this.elevation=-or(Math.asin(e/r)),this.azimuth=-or(Math.atan2(-t,-n)))},t.prototype._getPosition=function(){et(this.position,rr(gt(pt(),[0,0,0,1],this.matrix))),this._getDistance()},t.prototype._getFocalPoint=function(){!function(t,e,n){var r=e[0],i=e[1],o=e[2];t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8]}(this.distanceVector,[0,0,-this.distance],function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}(b(),this.matrix)),rt(this.focalPoint,this.position,this.distanceVector),this._getDistance()},t.prototype._getDistance=function(){this.distanceVector=it(Z(),this.focalPoint,this.position),this.distance=J(this.distanceVector),this.dollyingStep=this.distance/100},t.prototype._getOrthoMatrix=function(){if(this.projectionMode===Er.ORTHOGRAPHIC){var t=this.position,e=vt(mt(),[0,0,1],-this.roll*Math.PI/180);B(this.orthoMatrix,e,tt((this.rright-this.left)/2-t[0],(this.top-this.bottom)/2-t[1],0),tt(this.zoom,this.zoom,1),t)}},t.prototype.triggerUpdate=function(){if(this.enableUpdate){var t=this.getViewTransform(),e=T(E(),this.getPerspective(),t);this.getFrustum().extractFromVPMatrix(e),this.eventEmitter.emit(Or)}},t.prototype.rotate=function(t,e,n){throw new Error(Nr)},t.prototype.pan=function(t,e){throw new Error(Nr)},t.prototype.dolly=function(t){throw new Error(Nr)},t.prototype.createLandmark=function(t,e){throw new Error(Nr)},t.prototype.gotoLandmark=function(t,e){throw new Error(Nr)},t.prototype.cancelLandmarkAnimation=function(){throw new Error(Nr)},t}();function Lr(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var s=t.apply(this,r);return n.cache=a.set(o,s)||a,s};return n.cache=new(Lr.Cache||Map),n}Lr.Cache=Map,function(t){t[t.kUnknown=0]="kUnknown",t[t.kNumber=1]="kNumber",t[t.kPercentage=2]="kPercentage",t[t.kEms=3]="kEms",t[t.kPixels=4]="kPixels",t[t.kRems=5]="kRems",t[t.kDegrees=6]="kDegrees",t[t.kRadians=7]="kRadians",t[t.kGradians=8]="kGradians",t[t.kTurns=9]="kTurns",t[t.kMilliseconds=10]="kMilliseconds",t[t.kSeconds=11]="kSeconds",t[t.kInteger=12]="kInteger"}(Cr||(Cr={})),function(t){t[t.kUNumber=0]="kUNumber",t[t.kUPercent=1]="kUPercent",t[t.kULength=2]="kULength",t[t.kUAngle=3]="kUAngle",t[t.kUTime=4]="kUTime",t[t.kUOther=5]="kUOther"}(kr||(kr={})),function(t){t[t.kAll=0]="kAll",t[t.kNonNegative=1]="kNonNegative",t[t.kInteger=2]="kInteger",t[t.kNonNegativeInteger=3]="kNonNegativeInteger",t[t.kPositiveInteger=4]="kPositiveInteger"}(Tr||(Tr={})),function(t){t[t.kYes=0]="kYes",t[t.kNo=1]="kNo"}(Pr||(Pr={})),function(t){t[t.kYes=0]="kYes",t[t.kNo=1]="kNo"}(Ar||(Ar={}));var Dr,Ir=[{name:"em",unit_type:Cr.kEms},{name:"px",unit_type:Cr.kPixels},{name:"deg",unit_type:Cr.kDegrees},{name:"rad",unit_type:Cr.kRadians},{name:"grad",unit_type:Cr.kGradians},{name:"ms",unit_type:Cr.kMilliseconds},{name:"s",unit_type:Cr.kSeconds},{name:"rem",unit_type:Cr.kRems},{name:"turn",unit_type:Cr.kTurns}];!function(t){t[t.kUnknownType=0]="kUnknownType",t[t.kUnparsedType=1]="kUnparsedType",t[t.kKeywordType=2]="kKeywordType",t[t.kUnitType=3]="kUnitType",t[t.kSumType=4]="kSumType",t[t.kProductType=5]="kProductType",t[t.kNegateType=6]="kNegateType",t[t.kInvertType=7]="kInvertType",t[t.kMinType=8]="kMinType",t[t.kMaxType=9]="kMaxType",t[t.kClampType=10]="kClampType",t[t.kTransformType=11]="kTransformType",t[t.kPositionType=12]="kPositionType",t[t.kURLImageType=13]="kURLImageType",t[t.kColorType=14]="kColorType",t[t.kUnsupportedColorType=15]="kUnsupportedColorType"}(Dr||(Dr={}));var jr,zr=function(t){return t?"number"===t?Cr.kNumber:"percent"===t||"%"===t?Cr.kPercentage:function(t){return Ir.find((function(e){return e.name===t})).unit_type}(t):Cr.kUnknown},Br=function(t){var e=1;switch(t){case Cr.kPixels:case Cr.kDegrees:case Cr.kSeconds:break;case Cr.kMilliseconds:e=.001;break;case Cr.kRadians:e=180/Math.PI;break;case Cr.kGradians:e=.9;break;case Cr.kTurns:e=360}return e},Fr=function(t){switch(t){case Cr.kNumber:case Cr.kInteger:return"";case Cr.kPercentage:return"%";case Cr.kEms:return"em";case Cr.kRems:return"rem";case Cr.kPixels:return"px";case Cr.kDegrees:return"deg";case Cr.kRadians:return"rad";case Cr.kGradians:return"grad";case Cr.kMilliseconds:return"ms";case Cr.kSeconds:return"s";case Cr.kTurns:return"turn"}return""},Gr=function(){function t(){}return t.isAngle=function(t){return t===Cr.kDegrees||t===Cr.kRadians||t===Cr.kGradians||t===Cr.kTurns},t.isLength=function(t){return t>=Cr.kEms&&t<Cr.kDegrees},t.isRelativeUnit=function(t){return t===Cr.kPercentage||t===Cr.kEms||t===Cr.kRems},t.isTime=function(t){return t===Cr.kSeconds||t===Cr.kMilliseconds},t.prototype.toString=function(){return this.buildCSSText(Pr.kNo,Ar.kNo,"")},t.prototype.isNumericValue=function(){return this.getType()>=Dr.kUnitType&&this.getType()<=Dr.kClampType},t}(),Vr=function(t){function e(e){var n=t.call(this)||this;return n.colorSpace=e,n}return r(e,t),e.prototype.getType=function(){return Dr.kColorType},e.prototype.to=function(t){return this},e}(Gr);!function(t){t[t.Constant=0]="Constant",t[t.LinearGradient=1]="LinearGradient",t[t.RadialGradient=2]="RadialGradient"}(jr||(jr={}));var Wr=function(t){function e(e,n){var r=t.call(this)||this;return r.type=e,r.value=n,r}return r(e,t),e.prototype.clone=function(){return new e(this.type,this.value)},e.prototype.buildCSSText=function(t,e,n){return n},e.prototype.getType=function(){return Dr.kColorType},e}(Gr),Ur=function(t){function e(e){var n=t.call(this)||this;return n.value=e,n}return r(e,t),e.prototype.clone=function(){return new e(this.value)},e.prototype.getType=function(){return Dr.kKeywordType},e.prototype.buildCSSText=function(t,e,n){return n+this.value},e}(Gr),Hr=Lr((function(t){return void 0===t&&(t=""),t.replace(/-([a-z])/g,(function(t){return t[1].toUpperCase()}))})),qr=function(t){return t.split("").map((function(t,e){return t.toUpperCase()===t?"".concat(0!==e?"-":"").concat(t.toLowerCase()):t})).join("")};function $r(t){return"function"==typeof t}var Yr={d:{alias:"path"},strokeDasharray:{alias:"lineDash"},strokeWidth:{alias:"lineWidth"},textAnchor:{alias:"textAlign"},src:{alias:"img"}},Kr=Lr((function(t){var e=Hr(t),n=Yr[e];return e=(null==n?void 0:n.alias)||e})),Xr=function(t,e){void 0===e&&(e="");var n="";return Number.isFinite(t)?(!function(t){if(!t)throw new Error}(Number.isNaN(t)),n="NaN"):n=t>0?"infinity":"-infinity",n+e},Zr=function(t){return function(t){switch(t){case kr.kUNumber:return Cr.kNumber;case kr.kULength:return Cr.kPixels;case kr.kUPercent:return Cr.kPercentage;case kr.kUTime:return Cr.kSeconds;case kr.kUAngle:return Cr.kDegrees;default:return Cr.kUnknown}}(function(t){switch(t){case Cr.kNumber:case Cr.kInteger:return kr.kUNumber;case Cr.kPercentage:return kr.kUPercent;case Cr.kPixels:return kr.kULength;case Cr.kMilliseconds:case Cr.kSeconds:return kr.kUTime;case Cr.kDegrees:case Cr.kRadians:case Cr.kGradians:case Cr.kTurns:return kr.kUAngle;default:return kr.kUOther}}(t))},Qr=function(t){function e(e,n){void 0===n&&(n=Cr.kNumber);var r,i=t.call(this)||this;return r="string"==typeof n?zr(n):n,i.unit=r,i.value=e,i}return r(e,t),e.prototype.clone=function(){return new e(this.value,this.unit)},e.prototype.equals=function(t){var e=t;return this.value===e.value&&this.unit===e.unit},e.prototype.getType=function(){return Dr.kUnitType},e.prototype.convertTo=function(t){if(this.unit===t)return new e(this.value,this.unit);var n=Zr(this.unit);if(n!==Zr(t)||n===Cr.kUnknown)return null;var r=Br(this.unit)/Br(t);return new e(this.value*r,t)},e.prototype.buildCSSText=function(t,e,n){var r;switch(this.unit){case Cr.kUnknown:break;case Cr.kInteger:r=Number(this.value).toFixed(0);break;case Cr.kNumber:case Cr.kPercentage:case Cr.kEms:case Cr.kRems:case Cr.kPixels:case Cr.kDegrees:case Cr.kRadians:case Cr.kGradians:case Cr.kMilliseconds:case Cr.kSeconds:case Cr.kTurns:var i=this.value,o=Fr(this.unit);if(i<-999999||i>999999){var a=Fr(this.unit);r=!Number.isFinite(i)||Number.isNaN(i)?Xr(i,a):i+(a||"")}else r="".concat(i).concat(o)}return n+=r},e}(Gr),Jr=new Qr(0,"px");new Qr(1,"px");var ti,ei,ni=new Qr(0,"deg"),ri=function(t){function e(e,n,r,i,o){void 0===i&&(i=1),void 0===o&&(o=!1);var a=t.call(this,"rgb")||this;return a.r=e,a.g=n,a.b=r,a.alpha=i,a.isNone=o,a}return r(e,t),e.prototype.clone=function(){return new e(this.r,this.g,this.b,this.alpha)},e.prototype.buildCSSText=function(t,e,n){return n+"rgba(".concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")},e}(Vr),ii=new Ur("unset"),oi=new Ur("initial"),ai=new Ur("inherit"),si={"":ii,unset:ii,initial:oi,inherit:ai},ui=function(t){return si[t]||(si[t]=new Ur(t)),si[t]},ci=new ri(0,0,0,0,!0),li=new ri(0,0,0,0),hi=Lr((function(t,e,n,r){return new ri(t,e,n,r)}),(function(t,e,n,r){return"rgba(".concat(t,",").concat(e,",").concat(n,",").concat(r,")")})),di=function(t,e){return void 0===e&&(e=Cr.kNumber),new Qr(t,e)},fi=new Qr(50,"%");!function(t){t[t.Standard=0]="Standard"}(ti||(ti={})),function(t){t[t.ADDED=0]="ADDED",t[t.REMOVED=1]="REMOVED",t[t.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED"}(ei||(ei={}));var pi,gi={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Mr(0,0,0,0)};function mi(t){var e=t.type,n=t.value;return"hex"===e?"#".concat(n):"literal"===e?n:"rgb"===e?"rgb(".concat(n.join(","),")"):"rgba(".concat(n.join(","),")")}!function(t){t.COORDINATE="<coordinate>",t.COLOR="<color>",t.PAINT="<paint>",t.NUMBER="<number>",t.ANGLE="<angle>",t.OPACITY_VALUE="<opacity-value>",t.SHADOW_BLUR="<shadow-blur>",t.LENGTH="<length>",t.PERCENTAGE="<percentage>",t.LENGTH_PERCENTAGE="<length> | <percentage>",t.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",t.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",t.LIST_OF_POINTS="<list-of-points>",t.PATH="<path>",t.FILTER="<filter>",t.Z_INDEX="<z-index>",t.OFFSET_DISTANCE="<offset-distance>",t.DEFINED_PATH="<defined-path>",t.MARKER="<marker>",t.TRANSFORM="<transform>",t.TRANSFORM_ORIGIN="<transform-origin>",t.TEXT="<text>",t.TEXT_TRANSFORM="<text-transform>"}(pi||(pi={}));var vi=function(){var t={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},e="";function n(t){throw new Error(e+": "+t)}function r(){var t=f(i);return e.length>0&&n("Invalid input not EOF"),t}function i(){return o("linear-gradient",t.linearGradient,s)||o("repeating-linear-gradient",t.repeatingLinearGradient,s)||o("radial-gradient",t.radialGradient,u)||o("repeating-radial-gradient",t.repeatingRadialGradient,u)||o("conic-gradient",t.conicGradient,u)}function o(e,r,i){return a(r,(function(r){var o=i();return o&&(b(t.comma)||n("Missing comma before color stops")),{type:e,orientation:o,colorStops:f(p)}}))}function a(e,r){var i=b(e);if(i){b(t.startCall)||n("Missing (");var o=r(i);return b(t.endCall)||n("Missing )"),o}}function s(){return y("directional",t.sideOrCorner,1)||y("angular",t.angleValue,1)}function u(){var n,r,i=c();return i&&((n=[]).push(i),r=e,b(t.comma)&&((i=c())?n.push(i):e=r)),n}function c(){var t=function(){var t=y("shape",/^(circle)/i,0);t&&(t.style=v()||l());return t}()||function(){var t=y("shape",/^(ellipse)/i,0);t&&(t.style=m()||l());return t}();if(t)t.at=h();else{var e=l();if(e){t=e;var n=h();n&&(t.at=n)}else{var r=d();r&&(t={type:"default-radial",at:r})}}return t}function l(){return y("extent-keyword",t.extentKeywords,1)}function h(){if(y("position",/^at/,0)){var t=d();return t||n("Missing positioning value"),t}}function d(){var t={x:m(),y:m()};if(t.x||t.y)return{type:"position",value:t}}function f(e){var r=e(),i=[];if(r)for(i.push(r);b(t.comma);)(r=e())?i.push(r):n("One extra comma");return i}function p(){var e=y("hex",t.hexColor,1)||a(t.rgbaColor,(function(){return{type:"rgba",value:f(g)}}))||a(t.rgbColor,(function(){return{type:"rgb",value:f(g)}}))||y("literal",t.literalColor,0);return e||n("Expected color definition"),e.length=m(),e}function g(){return b(t.number)[1]}function m(){return y("%",t.percentageValue,1)||y("position-keyword",t.positionKeywords,1)||v()}function v(){return y("px",t.pixelValue,1)||y("em",t.emValue,1)}function y(t,e,n){var r=b(e);if(r)return{type:t,value:r[n]}}function b(t){var n=/^[\n\r\t\s]+/.exec(e);n&&E(n[0].length);var r=t.exec(e);return r&&E(r[0].length),r}function E(t){e=e.substring(t)}return function(t){return e=t,r()}}();var yi=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,bi=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,Ei=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,wi=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;var xi={left:180,top:-90,bottom:90,right:0,"left top":225,"top left":225,"left bottom":135,"bottom left":135,"right top":-45,"top right":-45,"right bottom":45,"bottom right":45},Mi=Lr((function(t){var e;return e="angular"===t.type?Number(t.value):xi[t.value]||0,di(e,"deg")})),Ni=Lr((function(t){var e=50,n=50,r="%",i="%";if("position"===(null==t?void 0:t.type)){var o=t.value,a=o.x,s=o.y;"position-keyword"===(null==a?void 0:a.type)&&("left"===a.value?e=0:"center"===a.value?e=50:"right"===a.value?e=100:"top"===a.value?n=0:"bottom"===a.value&&(n=100)),"position-keyword"===(null==s?void 0:s.type)&&("left"===s.value?e=0:"center"===s.value?n=50:"right"===s.value?e=100:"top"===s.value?n=0:"bottom"===s.value&&(n=100)),"px"!==(null==a?void 0:a.type)&&"%"!==(null==a?void 0:a.type)&&"em"!==(null==a?void 0:a.type)||(r=null==a?void 0:a.type,e=Number(a.value)),"px"!==(null==s?void 0:s.type)&&"%"!==(null==s?void 0:s.type)&&"em"!==(null==s?void 0:s.type)||(i=null==s?void 0:s.type,n=Number(s.value))}return{cx:di(e,r),cy:di(n,i)}})),Si=Lr((function(t){var e;if(t.indexOf("linear")>-1||t.indexOf("radial")>-1)return vi(t).map((function(t){var e=t.type,n=t.orientation,r=t.colorStops;!function(t){var e,n,r,i=t.length;t[i-1].length=null!==(e=t[i-1].length)&&void 0!==e?e:{type:"%",value:"100"},i>1&&(t[0].length=null!==(n=t[0].length)&&void 0!==n?n:{type:"%",value:"0"});for(var o=0,a=Number(t[0].length.value),s=1;s<i;s++){var u=null===(r=t[s].length)||void 0===r?void 0:r.value;if(!Pt(u)&&!Pt(a)){for(var c=1;c<s-o;c++)t[o+c].length={type:"%",value:"".concat(a+(Number(u)-a)*c/(s-o))};o=s,a=Number(u)}}}(r);var i=r.map((function(t){return{offset:di(Number(t.length.value),"%"),color:mi(t)}}));if("linear-gradient"===e)return new Wr(jr.LinearGradient,{angle:n?Mi(n):ni,steps:i});if("radial-gradient"===e&&(n||(n=[{type:"shape",value:"circle"}]),"shape"===n[0].type&&"circle"===n[0].value)){var o=Ni(n[0].at),a=o.cx,s=o.cy,u=void 0;if(n[0].style){var c=n[0].style,l=c.type,h=c.value;u="extent-keyword"===l?ui(h):di(h,l)}return new Wr(jr.RadialGradient,{cx:a,cy:s,size:u,steps:i})}}));var n=t[0];if("("===t[1]||"("===t[2])if("l"===n){var r=yi.exec(t);if(r){var i=(null===(e=r[2].match(wi))||void 0===e?void 0:e.map((function(t){return t.split(":")})))||[];return[new Wr(jr.LinearGradient,{angle:di(parseFloat(r[1]),"deg"),steps:i.map((function(t){var e=c(t,2),n=e[0],r=e[1];return{offset:di(100*Number(n),"%"),color:r}}))})]}}else if("r"===n){var o=function(t){var e,n=bi.exec(t);if(n){var r=(null===(e=n[4].match(wi))||void 0===e?void 0:e.map((function(t){return t.split(":")})))||[];return{cx:di(50,"%"),cy:di(50,"%"),steps:r.map((function(t){var e=c(t,2),n=e[0],r=e[1];return{offset:di(100*Number(n),"%"),color:r}}))}}return null}(t);if(o){if(!Bt(o))return[new Wr(jr.RadialGradient,o)];t=o}}else if("p"===n)return function(t){var e=Ei.exec(t);if(e){var n=e[1],r=e[2];switch(n){case"a":n="repeat";break;case"x":n="repeat-x";break;case"y":n="repeat-y";break;default:n="no-repeat"}return{image:r,repetition:n}}return null}(t)}));function Ci(t){return t&&!!t.image}function ki(t){return t&&!Pt(t.r)&&!Pt(t.g)&&!Pt(t.b)}var Ti=Lr((function(t){if(Ci(t))return i({repetition:"repeat"},t);if(Pt(t)&&(t=""),"transparent"===t)return li;"currentColor"===t&&(t="black");var e=Si(t);if(e)return e;var n=mn(t),r=[0,0,0,0];return null!==n&&(r[0]=n.r||0,r[1]=n.g||0,r[2]=n.b||0,r[3]=n.opacity),hi.apply(void 0,l([],c(r),!1))}));function Pi(t,e){if(ki(t)&&ki(e))return[[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],[Number(e.r),Number(e.g),Number(e.b),Number(e.alpha)],function(t){var e=t.slice();if(e[3])for(var n=0;n<3;n++)e[n]=Math.round(Vt(e[n],0,255));return e[3]=Vt(e[3],0,1),"rgba(".concat(e.join(","),")")}]}function Ai(t,e){if(Pt(e))return di(0,"px");if(e="".concat(e).trim().toLowerCase(),isFinite(Number(e))){if("px".search(t)>=0)return di(Number(e),"px");if("deg".search(t)>=0)return di(Number(e),"deg")}var n=[];e=e.replace(t,(function(t){return n.push(t),"U"+t}));var r="U("+t.source+")";return n.map((function(t){return di(Number(e.replace(new RegExp("U"+t,"g"),"").replace(new RegExp(r,"g"),"*0")),t)}))[0]}var Oi=function(t){return Ai(new RegExp("px","g"),t)},_i=Lr(Oi);Lr((function(t){return Ai(new RegExp("%","g"),t)}));var Ri=function(t){return Wt(t)||isFinite(Number(t))?di(Number(t)||0,"px"):Ai(new RegExp("px|%|em|rem","g"),t)},Li=Lr(Ri),Di=function(t){return Ai(new RegExp("deg|rad|grad|turn","g"),t)},Ii=Lr(Di);function ji(t,e,n,r,i){void 0===i&&(i=0);var o="",a=t.value||0,s=e.value||0,u=Zr(t.unit),c=t.convertTo(u),l=e.convertTo(u);return c&&l?(a=c.value,s=l.value,o=Fr(t.unit)):(Qr.isLength(t.unit)||Qr.isLength(e.unit))&&(a=Gi(t,i,n),s=Gi(e,i,n),o="px"),[a,s,function(t){return r&&(t=Math.max(t,0)),t+o}]}function zi(t){var e=0;return t.unit===Cr.kDegrees?e=t.value:t.unit===Cr.kRadians?e=or(Number(t.value)):t.unit===Cr.kTurns&&(e=360*Number(t.value)),e}function Bi(t,e){var n;return Array.isArray(t)?n=t.map((function(t){return Number(t)})):Bt(t)?n=t.split(" ").map((function(t){return Number(t)})):Wt(t)&&(n=[t]),2===e?1===n.length?[n[0],n[0]]:[n[0],n[1]]:1===n.length?[n[0],n[0],n[0],n[0]]:2===n.length?[n[0],n[1],n[0],n[1]]:3===n.length?[n[0],n[1],n[2],n[1]]:[n[0],n[1],n[2],n[3]]}function Fi(t){return Bt(t)?t.split(" ").map((function(t){return Li(t)})):t.map((function(t){return Li(t.toString())}))}function Gi(t,e,n){if(0===t.value)return 0;if(t.unit===Cr.kPixels)return Number(t.value);if(t.unit===Cr.kPercentage&&n){var r=n.nodeName===$n.GROUP?n.getLocalBounds():n.geometry.contentBounds;return t.value/100*r.halfExtents[e]*2}return 0}var Vi=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function Wi(t){if(void 0===t&&(t=""),"none"===(t=t.toLowerCase().trim()))return[];for(var e,n=/\s*([\w-]+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];if(i=e.index+e[0].length,Vi.indexOf(e[1])>-1&&r.push({name:e[1],params:e[2].split(" ").map((function(t){return Ai(/deg|rad|grad|turn|px|%/g,t)||Ti(t)}))}),n.lastIndex===t.length)return r}return[]}function Ui(t){return t.toString()}var Hi=function(t){return"number"==typeof t?di(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?di(Number(t)):di(0)},qi=Lr(Hi);function $i(t,e){return[t,e,Ui]}function Yi(t,e){return function(n,r){return[n,r,function(n){return Ui(Vt(n,t,e))}]}}function Ki(t,e){if(t.length===e.length)return[t,e,function(t){return t}]}function Xi(t){var e;return 0===t.parsedStyle.path.totalLength&&(t.parsedStyle.path.totalLength=He(t.parsedStyle.path.absolutePath,void 0,i(i({},e),{bbox:!1,length:!0})).length),t.parsedStyle.path.totalLength}function Zi(t,e){return t[0]===e[0]&&t[1]===e[1]}function Qi(t,e){var n=t.prePoint,r=t.currentPoint,i=t.nextPoint,o=Math.pow(r[0]-n[0],2)+Math.pow(r[1]-n[1],2),a=Math.pow(r[0]-i[0],2)+Math.pow(r[1]-i[1],2),s=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),u=Math.acos((o+a-s)/(2*Math.sqrt(o)*Math.sqrt(a)));if(!u||0===Math.sin(u)||Ht(u,0))return{xExtra:0,yExtra:0};var c=Math.abs(Math.atan2(i[1]-r[1],i[0]-r[0])),l=Math.abs(Math.atan2(i[0]-r[0],i[1]-r[1]));return c=c>Math.PI/2?Math.PI-c:c,l=l>Math.PI/2?Math.PI-l:l,{xExtra:Math.cos(u/2-c)*(e/2*(1/Math.sin(u/2)))-e/2||0,yExtra:Math.cos(l-u/2)*(e/2*(1/Math.sin(u/2)))-e/2||0}}function Ji(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}Lr((function(t){return Bt(t)?t.split(" ").map(qi):t.map(qi)}));var to=function(t,e){var n=t.x*e.x+t.y*e.y,r=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2)));return(t.x*e.y-t.y*e.x<0?-1:1)*Math.acos(n/r)},eo=function(t,e,n,r,i,o,a,s){e=Math.abs(e),n=Math.abs(n);var u=ir(r=qt(r,360));if(t.x===a.x&&t.y===a.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(0===e||0===n)return{x:0,y:0,ellipticalArcAngle:0};var c=(t.x-a.x)/2,l=(t.y-a.y)/2,h={x:Math.cos(u)*c+Math.sin(u)*l,y:-Math.sin(u)*c+Math.cos(u)*l},d=Math.pow(h.x,2)/Math.pow(e,2)+Math.pow(h.y,2)/Math.pow(n,2);d>1&&(e=Math.sqrt(d)*e,n=Math.sqrt(d)*n);var f=(Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(h.y,2)-Math.pow(n,2)*Math.pow(h.x,2))/(Math.pow(e,2)*Math.pow(h.y,2)+Math.pow(n,2)*Math.pow(h.x,2));f=f<0?0:f;var p=(i!==o?1:-1)*Math.sqrt(f),g=p*(e*h.y/n),m=p*(-n*h.x/e),v={x:Math.cos(u)*g-Math.sin(u)*m+(t.x+a.x)/2,y:Math.sin(u)*g+Math.cos(u)*m+(t.y+a.y)/2},y={x:(h.x-g)/e,y:(h.y-m)/n},b=to({x:1,y:0},y),E=to(y,{x:(-h.x-g)/e,y:(-h.y-m)/n});!o&&E>0?E-=2*Math.PI:o&&E<0&&(E+=2*Math.PI);var w=b+(E%=2*Math.PI)*s,x=e*Math.cos(w),M=n*Math.sin(w);return{x:Math.cos(u)*x-Math.sin(u)*M+v.x,y:Math.sin(u)*x+Math.cos(u)*M+v.y,ellipticalArcStartAngle:b,ellipticalArcEndAngle:b+E,ellipticalArcAngle:w,ellipticalArcCenter:v,resultantRx:e,resultantRy:n}};function no(t,e,n){void 0===n&&(n=!0);var r=t.arcParams,i=r.rx,o=void 0===i?0:i,a=r.ry,s=void 0===a?0:a,u=r.xRotation,c=r.arcFlag,l=r.sweepFlag,h=eo({x:t.prePoint[0],y:t.prePoint[1]},o,s,u,!!c,!!l,{x:t.currentPoint[0],y:t.currentPoint[1]},e),d=eo({x:t.prePoint[0],y:t.prePoint[1]},o,s,u,!!c,!!l,{x:t.currentPoint[0],y:t.currentPoint[1]},n?e+.005:e-.005),f=d.x-h.x,p=d.y-h.y,g=Math.sqrt(f*f+p*p);return{x:-f/g,y:-p/g}}function ro(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function io(t,e){return ro(t)*ro(e)?(t[0]*e[0]+t[1]*e[1])/(ro(t)*ro(e)):1}function oo(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(io(t,e))}function ao(t,e){var n=e[1],r=e[2],i=qt(ir(e[3]),2*Math.PI),o=e[4],a=e[5],s=t[0],u=t[1],c=e[6],l=e[7],h=Math.cos(i)*(s-c)/2+Math.sin(i)*(u-l)/2,d=-1*Math.sin(i)*(s-c)/2+Math.cos(i)*(u-l)/2,f=h*h/(n*n)+d*d/(r*r);f>1&&(n*=Math.sqrt(f),r*=Math.sqrt(f));var p=n*n*(d*d)+r*r*(h*h),g=p?Math.sqrt((n*n*(r*r)-p)/p):1;o===a&&(g*=-1),isNaN(g)&&(g=0);var m=r?g*n*d/r:0,v=n?g*-r*h/n:0,y=(s+c)/2+Math.cos(i)*m-Math.sin(i)*v,b=(u+l)/2+Math.sin(i)*m+Math.cos(i)*v,E=[(h-m)/n,(d-v)/r],w=[(-1*h-m)/n,(-1*d-v)/r],x=oo([1,0],E),M=oo(E,w);return io(E,w)<=-1&&(M=Math.PI),io(E,w)>=1&&(M=0),0===a&&M>0&&(M-=2*Math.PI),1===a&&M<0&&(M+=2*Math.PI),{cx:y,cy:b,rx:Zi(t,[c,l])?0:n,ry:Zi(t,[c,l])?0:r,startAngle:x,endAngle:x+M,xRotation:i,arcFlag:o,sweepFlag:a}}var so=function(t){if(""===t||Array.isArray(t)&&0===t.length)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=Pe(t)}catch(n){e=Pe(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}!function(t){for(var e=0;e<t.length;e++){var n=t[e-1],r=t[e];if("M"===r[0]&&n){var i=n[0],o=[r[1],r[2]],a=void 0;"L"===i||"M"===i?a=[n[1],n[2]]:"C"!==i&&"A"!==i&&"Q"!==i||(a=[n[n.length-2],n[n.length-1]]),a&&Zi(o,a)&&(t.splice(e,1),e--)}}}(e);var n=function(t){for(var e=!1,n=t.length,r=0;r<n;r++){var i=t[r][0];if("C"===i||"A"===i||"Q"===i){e=!0;break}}return e}(e),r=function(t){for(var e=[],n=[],r=[],i=0;i<t.length;i++){var o=t[i],a=o[0];"M"===a?(r.length&&(n.push(r),r=[]),r.push([o[1],o[2]])):"Z"===a?r.length&&(e.push(r),r=[]):r.push([o[1],o[2]])}return r.length>0&&n.push(r),{polygons:e,polylines:n}}(e),i=r.polygons,o=r.polylines,a=function(t){for(var e=[],n=null,r=null,i=null,o=0,a=t.length,s=0;s<a;s++){var u=t[s];r=t[s+1];var c=u[0],l={command:c,prePoint:n,params:u,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(c){case"M":i=[u[1],u[2]],o=s;break;case"A":var h=ao(n,u);l.arcParams=h}if("Z"===c)n=i,r=t[o+1];else{var d=u.length;n=[u[d-2],u[d-1]]}r&&"Z"===r[0]&&(r=t[o],e[o]&&(e[o].prePoint=n)),l.currentPoint=n,e[o]&&Zi(n,e[o].currentPoint)&&(e[o].prePoint=l.prePoint);var f=r?[r[r.length-2],r[r.length-1]]:null;l.nextPoint=f;var p=l.prePoint;if(["L","H","V"].includes(c))l.startTangent=[p[0]-n[0],p[1]-n[1]],l.endTangent=[n[0]-p[0],n[1]-p[1]];else if("Q"===c){var g=[u[1],u[2]];l.startTangent=[p[0]-g[0],p[1]-g[1]],l.endTangent=[n[0]-g[0],n[1]-g[1]]}else if("T"===c)g=Ji((y=e[s-1]).currentPoint,p),"Q"===y.command?(l.command="Q",l.startTangent=[p[0]-g[0],p[1]-g[1]],l.endTangent=[n[0]-g[0],n[1]-g[1]]):(l.command="TL",l.startTangent=[p[0]-n[0],p[1]-n[1]],l.endTangent=[n[0]-p[0],n[1]-p[1]]);else if("C"===c){var m=[u[1],u[2]],v=[u[3],u[4]];l.startTangent=[p[0]-m[0],p[1]-m[1]],l.endTangent=[n[0]-v[0],n[1]-v[1]],0===l.startTangent[0]&&0===l.startTangent[1]&&(l.startTangent=[m[0]-v[0],m[1]-v[1]]),0===l.endTangent[0]&&0===l.endTangent[1]&&(l.endTangent=[v[0]-m[0],v[1]-m[1]])}else if("S"===c){var y;m=Ji((y=e[s-1]).currentPoint,p),v=[u[1],u[2]],"C"===y.command?(l.command="C",l.startTangent=[p[0]-m[0],p[1]-m[1]],l.endTangent=[n[0]-v[0],n[1]-v[1]]):(l.command="SQ",l.startTangent=[p[0]-v[0],p[1]-v[1]],l.endTangent=[n[0]-v[0],n[1]-v[1]])}else if("A"===c){var b=no(l,0),E=b.x,w=b.y,x=no(l,1,!1),M=x.x,N=x.y;l.startTangent=[E,w],l.endTangent=[M,N]}e.push(l)}return e}(e),s=function(t,e){for(var n=[],r=[],i=[],o=0;o<t.length;o++){var a=(g=t[o]).currentPoint,s=g.params,u=g.prePoint,c=void 0;switch(g.command){case"Q":c=Un(u[0],u[1],s[1],s[2],s[3],s[4]);break;case"C":c=Bn(u[0],u[1],s[1],s[2],s[3],s[4],s[5],s[6]);break;case"A":var l=g.arcParams;c=On(l.cx,l.cy,l.rx,l.ry,l.xRotation,l.startAngle,l.endAngle);break;default:n.push(a[0]),r.push(a[1])}c&&(g.box=c,n.push(c.x,c.x+c.width),r.push(c.y,c.y+c.height)),e&&("L"===g.command||"M"===g.command)&&g.prePoint&&g.nextPoint&&i.push(g)}n=n.filter((function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0})),r=r.filter((function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0}));var h=zt(n),d=zt(r),f=jt(n),p=jt(r);if(0===i.length)return{x:h,y:d,width:f-h,height:p-d};for(o=0;o<i.length;o++){var g;(a=(g=i[o]).currentPoint)[0]===h?h-=Qi(g,e).xExtra:a[0]===f&&(f+=Qi(g,e).xExtra),a[1]===d?d-=Qi(g,e).yExtra:a[1]===p&&(p+=Qi(g,e).yExtra)}return{x:h,y:d,width:f-h,height:p-d}}(a,0),u=s.x,c=s.y,l=s.width,h=s.height;return{absolutePath:e,hasArc:n,segments:a,polygons:i,polylines:o,totalLength:0,rect:{x:Number.isFinite(u)?u:0,y:Number.isFinite(c)?c:0,width:Number.isFinite(l)?l:0,height:Number.isFinite(h)?h:0}}},uo=Lr(so);function co(t){return Bt(t)?uo(t):so(t)}function lo(t,e,n){var r=t.curve,i=e.curve;r&&0!==r.length||(r=De(t.absolutePath,!1),t.curve=r),i&&0!==i.length||(i=De(e.absolutePath,!1),e.curve=i);var o=[r,i];r.length!==i.length&&(o=Ke(r,i));var a,s,u=$e(o[0])!==$e(o[1])?(a=o[0],s=a.slice(1).map((function(t,e,n){return e?n[e-1].slice(-2).concat(t.slice(1)):a[0].slice(1).concat(t.slice(1))})).map((function(t){return t.map((function(e,n){return t[t.length-n-2*(1-n%2)]}))})).reverse(),[["M"].concat(s[0].slice(0,2))].concat(s.map((function(t){return["C"].concat(t.slice(2))})))):o[0].map((function(t){return Array.isArray(t)?[].concat(t):t}));return[u,qe(o[1],u),function(t){return t}]}function ho(t,e){var n;n=Bt(t)?t.split(" ").map((function(t){var e=c(t.split(","),2),n=e[0],r=e[1];return[Number(n),Number(r)]})):t;var r,i,o=[],a=0,s=Gn(n);n.forEach((function(t,e){n[e+1]&&((r=[0,0])[0]=a/s,i=Ln(t[0],t[1],n[e+1][0],n[e+1][1]),a+=i,r[1]=a/s,o.push(r))}));var u=Math.min.apply(Math,l([],c(n.map((function(t){return t[0]}))),!1)),h=Math.min.apply(Math,l([],c(n.map((function(t){return t[1]}))),!1));return e&&(e.parsedStyle.defX=u,e.parsedStyle.defY=h),{points:n,totalLength:s,segments:o}}function fo(t,e){return[t.points,e.points,function(t){return t}]}var po=null;function go(t){return function(e){var n=0;return t.map((function(t){return t===po?e[n++]:t}))}}function mo(t){return t}var vo={matrix:["NNNNNN",[po,po,0,0,po,po,0,0,0,0,1,0,po,po,0,1],mo],matrix3d:["NNNNNNNNNNNNNNNN",mo],rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",go([po,po,new Qr(1)]),mo],scalex:["N",go([po,new Qr(1),new Qr(1)]),go([po,new Qr(1)])],scaley:["N",go([new Qr(1),po,new Qr(1)]),go([new Qr(1),po])],scalez:["N",go([new Qr(1),new Qr(1),po])],scale3d:["NNN",mo],skew:["Aa",null,mo],skewx:["A",null,go([po,ni])],skewy:["A",null,go([ni,po])],translate:["Tt",go([po,po,Jr]),mo],translatex:["T",go([po,Jr,Jr]),go([po,Jr])],translatey:["T",go([Jr,po,Jr]),go([Jr,po])],translatez:["L",go([Jr,Jr,po])],translate3d:["TTL",mo]};function yo(t){if("none"===(t=(t||"none").toLowerCase().trim()))return[];for(var e,n=/\s*(\w+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];i=e.index+e[0].length;var o=e[1],a=vo[o];if(!a)return[];var s=e[2].split(","),u=a[0];if(u.length<s.length)return[];for(var c=[],l=0;l<u.length;l++){var h=s[l],d=u[l],f=void 0;if(void 0===(f=h?{A:function(t){return"0"===t.trim()?ni:Ii(t)},N:qi,T:Li,L:_i}[d.toUpperCase()](h):{a:ni,n:c[0],t:Jr}[d]))return[];c.push(f)}if(r.push({t:o,d:c}),n.lastIndex===t.length)return r}return[]}function bo(t){if("none"===(t=(t||"none").toLowerCase().trim()))return[];for(var e,n=/\s*(\w+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];i=e.index+e[0].length;var o=e[1],a=vo[o];if(!a)return[];var s=e[2].split(","),u=a[0];if(u.length<s.length)return[];for(var c=[],l=0;l<u.length;l++){var h=s[l],d=u[l],f=void 0;if(void 0===(f=h?{A:function(t){return"0"===t.trim()?ni:Di(t)},N:Hi,T:Ri,L:Oi}[d.toUpperCase()](h):{a:ni,n:c[0],t:Jr}[d]))return[];c.push(f)}if(r.push({t:o,d:c}),n.lastIndex===t.length)return r}return[]}function Eo(t){var e,n,r,i;switch(t.t){case"rotatex":return i=ir(zi(t.d[0])),[1,0,0,0,0,Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1];case"rotatey":return i=ir(zi(t.d[0])),[Math.cos(i),0,-Math.sin(i),0,0,1,0,0,Math.sin(i),0,Math.cos(i),0,0,0,0,1];case"rotate":case"rotatez":return i=ir(zi(t.d[0])),[Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1,0,0,0,0,1];case"rotate3d":e=t.d[0].value,n=t.d[1].value,r=t.d[2].value,i=ir(zi(t.d[3]));var o=e*e+n*n+r*r;if(0===o)e=1,n=0,r=0;else if(1!==o){var a=Math.sqrt(o);e/=a,n/=a,r/=a}var s=Math.sin(i/2),u=s*Math.cos(i/2),c=s*s;return[1-2*(n*n+r*r)*c,2*(e*n*c+r*u),2*(e*r*c-n*u),0,2*(e*n*c-r*u),1-2*(e*e+r*r)*c,2*(n*r*c+e*u),0,2*(e*r*c+n*u),2*(n*r*c-e*u),1-2*(e*e+n*n)*c,0,0,0,0,1];case"scale":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scalex":return[t.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaley":return[1,0,0,0,0,t.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scalez":return[1,0,0,0,0,1,0,0,0,0,t.d[0].value,0,0,0,0,1];case"scale3d":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,t.d[2].value,0,0,0,0,1];case"skew":var l=ir(zi(t.d[0])),h=ir(zi(t.d[1]));return[1,Math.tan(h),0,0,Math.tan(l),1,0,0,0,0,1,0,0,0,0,1];case"skewx":return i=ir(zi(t.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewy":return i=ir(zi(t.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Gi(t.d[0],0,null)||0,n=Gi(t.d[1],0,null)||0,0,1];case"translatex":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Gi(t.d[0],0,null)||0,0,0,1];case"translatey":return[1,0,0,0,0,1,0,0,0,0,1,0,0,n=Gi(t.d[0],0,null)||0,0,1];case"translatez":return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,r=Gi(t.d[0],0,null)||0,1];case"translate3d":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Gi(t.d[0],0,null)||0,n=Gi(t.d[1],0,null)||0,r=Gi(t.d[2],0,null)||0,1];case"perspective":var d=Gi(t.d[0],0,null)||0;return[1,0,0,0,0,1,0,0,0,0,1,d?-1/d:0,0,0,0,1];case"matrix":return[t.d[0].value,t.d[1].value,0,0,t.d[2].value,t.d[3].value,0,0,0,0,1,0,t.d[4].value,t.d[5].value,0,1];case"matrix3d":return t.d.map((function(t){return t.value}))}}function wo(t,e){return[t[0]*e[0]+t[4]*e[1]+t[8]*e[2]+t[12]*e[3],t[1]*e[0]+t[5]*e[1]+t[9]*e[2]+t[13]*e[3],t[2]*e[0]+t[6]*e[1]+t[10]*e[2]+t[14]*e[3],t[3]*e[0]+t[7]*e[1]+t[11]*e[2]+t[15]*e[3],t[0]*e[4]+t[4]*e[5]+t[8]*e[6]+t[12]*e[7],t[1]*e[4]+t[5]*e[5]+t[9]*e[6]+t[13]*e[7],t[2]*e[4]+t[6]*e[5]+t[10]*e[6]+t[14]*e[7],t[3]*e[4]+t[7]*e[5]+t[11]*e[6]+t[15]*e[7],t[0]*e[8]+t[4]*e[9]+t[8]*e[10]+t[12]*e[11],t[1]*e[8]+t[5]*e[9]+t[9]*e[10]+t[13]*e[11],t[2]*e[8]+t[6]*e[9]+t[10]*e[10]+t[14]*e[11],t[3]*e[8]+t[7]*e[9]+t[11]*e[10]+t[15]*e[11],t[0]*e[12]+t[4]*e[13]+t[8]*e[14]+t[12]*e[15],t[1]*e[12]+t[5]*e[13]+t[9]*e[14]+t[13]*e[15],t[2]*e[12]+t[6]*e[13]+t[10]*e[14]+t[14]*e[15],t[3]*e[12]+t[7]*e[13]+t[11]*e[14]+t[15]*e[15]]}function xo(t){var e=[0,0,0],n=[1,1,1],r=[0,0,0],i=[0,0,0,1],o=[0,0,0,1];return function(t,e,n,r,i,o){if(!function(t,e){var n=e[15];if(0===n)return!1;for(var r=1/n,i=0;i<16;i++)t[i]=e[i]*r;return!0}(cr,t))return!1;if(x(lr,cr),lr[3]=0,lr[7]=0,lr[11]=0,lr[15]=1,Math.abs(k(lr))<1e-8)return!1;var a,s,u=cr[3],c=cr[7],l=cr[11],h=cr[12],d=cr[13],f=cr[14],p=cr[15];if(0!==u||0!==c||0!==l){if(hr[0]=u,hr[1]=c,hr[2]=l,hr[3]=p,!C(lr,lr))return!1;S(lr,lr),gt(i,hr,lr)}else i[0]=i[1]=i[2]=0,i[3]=1;if(e[0]=h,e[1]=d,e[2]=f,s=cr,(a=dr)[0][0]=s[0],a[0][1]=s[1],a[0][2]=s[2],a[1][0]=s[4],a[1][1]=s[5],a[1][2]=s[6],a[2][0]=s[8],a[2][1]=s[9],a[2][2]=s[10],n[0]=J(dr[0]),at(dr[0],dr[0]),r[0]=st(dr[0],dr[1]),pr(dr[1],dr[1],dr[0],1,-r[0]),n[1]=J(dr[1]),at(dr[1],dr[1]),r[0]/=n[1],r[1]=st(dr[0],dr[2]),pr(dr[2],dr[2],dr[0],1,-r[1]),r[2]=st(dr[1],dr[2]),pr(dr[2],dr[2],dr[1],1,-r[2]),n[2]=J(dr[2]),at(dr[2],dr[2]),r[1]/=n[2],r[2]/=n[2],ut(fr,dr[1],dr[2]),st(dr[0],fr)<0)for(var g=0;g<3;g++)n[g]*=-1,dr[g][0]*=-1,dr[g][1]*=-1,dr[g][2]*=-1;o[0]=.5*Math.sqrt(Math.max(1+dr[0][0]-dr[1][1]-dr[2][2],0)),o[1]=.5*Math.sqrt(Math.max(1-dr[0][0]+dr[1][1]-dr[2][2],0)),o[2]=.5*Math.sqrt(Math.max(1-dr[0][0]-dr[1][1]+dr[2][2],0)),o[3]=.5*Math.sqrt(Math.max(1+dr[0][0]+dr[1][1]+dr[2][2],0)),dr[2][1]>dr[1][2]&&(o[0]=-o[0]),dr[0][2]>dr[2][0]&&(o[1]=-o[1]),dr[1][0]>dr[0][1]&&(o[2]=-o[2])}(function(t){return 0===t.length?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:t.map(Eo).reduce(wo)}(t),e,n,r,i,o),[[e,n,r,o,i]]}var Mo=function(){function t(t,e){for(var n=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],r=0;r<4;r++)for(var i=0;i<4;i++)for(var o=0;o<4;o++)n[r][i]+=e[r][o]*t[o][i];return n}return function(e,n,r,i,o){for(var a=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],s=0;s<4;s++)a[s][3]=o[s];for(s=0;s<3;s++)for(var u=0;u<3;u++)a[3][s]+=e[u]*a[u][s];var c=i[0],l=i[1],h=i[2],d=i[3],f=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];f[0][0]=1-2*(l*l+h*h),f[0][1]=2*(c*l-h*d),f[0][2]=2*(c*h+l*d),f[1][0]=2*(c*l+h*d),f[1][1]=1-2*(c*c+h*h),f[1][2]=2*(l*h-c*d),f[2][0]=2*(c*h-l*d),f[2][1]=2*(l*h+c*d),f[2][2]=1-2*(c*c+l*l),a=t(a,f);var p=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];for(r[2]&&(p[2][1]=r[2],a=t(a,p)),r[1]&&(p[2][1]=0,p[2][0]=r[0],a=t(a,p)),r[0]&&(p[2][0]=0,p[1][0]=r[0],a=t(a,p)),s=0;s<3;s++)for(u=0;u<3;u++)a[s][u]*=n[s];return function(t){return 0==t[0][2]&&0==t[0][3]&&0==t[1][2]&&0==t[1][3]&&0==t[2][0]&&0==t[2][1]&&1==t[2][2]&&0==t[2][3]&&0==t[3][2]&&1==t[3][3]}(a)?[a[0][0],a[0][1],a[1][0],a[1][1],a[3][0],a[3][1]]:a[0].concat(a[1],a[2],a[3])}}();function No(t){return t.toFixed(6).replace(".000000","")}function So(t,e){var n,r;return t.decompositionPair!==e&&(t.decompositionPair=e,n=xo(t)),e.decompositionPair!==t&&(e.decompositionPair=t,r=xo(e)),null===n[0]||null===r[0]?[[!1],[!0],function(n){return n?e[0].d:t[0].d}]:(n[0].push(0),r[0].push(1),[n,r,function(t){var e=function(t,e,n){var r=function(t,e){for(var n=0,r=0;r<t.length;r++)n+=t[r]*e[r];return n}(t,e);r=Vt(r,-1,1);var i=[];if(1===r)i=t;else for(var o=Math.acos(r),a=1*Math.sin(n*o)/Math.sqrt(1-r*r),s=0;s<4;s++)i.push(t[s]*(Math.cos(n*o)-r*a)+e[s]*a);return i}(n[0][3],r[0][3],t[5]);return Mo(t[0],t[1],t[2],e,t[4]).map(No).join(",")}])}function Co(t){return t.replace(/[xy]/,"")}function ko(t){return t.replace(/(x|y|z|3d)?$/,"3d")}function To(t,e,n){var r=!1;if(!t.length||!e.length){t.length||(r=!0,t=e,e=[]);for(var i=function(n){var r=t[n],i=r.t,o=r.d,a="scale"===i.substring(0,5)?1:0;e.push({t:i,d:o.map((function(t){return"number"==typeof t?di(a):di(a,t.unit)}))})},o=0;o<t.length;o++)i(o)}var a,s,u=[],c=[],l=[];if(t.length!==e.length)u=[(y=So(t,e))[0]],c=[y[1]],l=[["matrix",[y[2]]]];else for(o=0;o<t.length;o++){var h=t[o].t,d=e[o].t,f=t[o].d,p=e[o].d,g=vo[h],m=vo[d],v=void 0;if(s=d,"perspective"===(a=h)&&"perspective"===s||!("matrix"!==a&&"matrix3d"!==a||"matrix"!==s&&"matrix3d"!==s)){var y=So([t[o]],[e[o]]);u.push(y[0]),c.push(y[1]),l.push(["matrix",[y[2]]])}else{if(h===d)v=h;else if(g[2]&&m[2]&&Co(h)===Co(d))v=Co(h),f=g[2](f),p=m[2](p);else{if(!g[1]||!m[1]||ko(h)!==ko(d)){u=[(y=So(t,e))[0]],c=[y[1]],l=[["matrix",[y[2]]]];break}v=ko(h),f=g[1](f),p=m[1](p)}for(var b=[],E=[],w=[],x=0;x<f.length;x++){y=ji(f[x],p[x],n,!1,x);b[x]=y[0],E[x]=y[1],w.push(y[2])}u.push(b),c.push(E),l.push([v,w])}}if(r){var M=u;u=c,c=M}return[u,c,function(t){return t.map((function(t,e){var n=t.map((function(t,n){return l[e][1][n](t)})).join(",");return"matrix"===l[e][0]&&16===n.split(",").length&&(l[e][0]="matrix3d"),"matrix3d"===l[e][0]&&6===n.split(",").length&&(l[e][0]="matrix"),l[e][0]+"("+n+")"})).join(" ")}]}var Po=Lr((function(t){if(Bt(t)){if("text-anchor"===t)return[di(0,"px"),di(0,"px")];var e=t.split(" ");return 1===e.length&&("top"===e[0]||"bottom"===e[0]?(e[1]=e[0],e[0]="center"):e[1]="center"),2!==e.length?null:[Li(Oo(e[0])),Li(Oo(e[1]))]}return[di(t[0]||0,"px"),di(t[1]||0,"px")]})),Ao=function(t){if(Bt(t)){if("text-anchor"===t)return[di(0,"px"),di(0,"px")];var e=t.split(" ");return 1===e.length&&("top"===e[0]||"bottom"===e[0]?(e[1]=e[0],e[0]="center"):e[1]="center"),2!==e.length?null:[Ri(Oo(e[0])),Ri(Oo(e[1]))]}return[di(t[0]||0,"px"),di(t[1]||0,"px")]};function Oo(t){return"center"===t?"50%":"left"===t||"top"===t?"0":"right"===t||"bottom"===t?"100%":t}var _o=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:pi.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:pi.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:pi.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:pi.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:pi.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:pi.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:pi.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:pi.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:pi.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:pi.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:pi.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:pi.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:pi.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:pi.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:pi.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:pi.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:pi.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:pi.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:pi.FILTER},{n:"clipPath",syntax:pi.DEFINED_PATH},{n:"textPath",syntax:pi.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:pi.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:pi.TRANSFORM},{n:"transformOrigin",p:100,d:function(t){return t===$n.CIRCLE||t===$n.ELLIPSE?"center":t===$n.TEXT?"text-anchor":"left top"},l:!0,syntax:pi.TRANSFORM_ORIGIN},{n:"anchor",p:99,d:function(t){return t===$n.CIRCLE||t===$n.ELLIPSE?"0.5 0.5":"0 0"},l:!0,syntax:pi.LENGTH_PERCENTAGE_12},{n:"cx",int:!0,d:"0",syntax:pi.COORDINATE},{n:"cy",int:!0,d:"0",syntax:pi.COORDINATE},{n:"cz",int:!0,d:"0",syntax:pi.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:pi.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:pi.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:pi.LENGTH_PERCENTAGE},{n:"x",int:!0,d:"0",syntax:pi.COORDINATE},{n:"y",int:!0,d:"0",syntax:pi.COORDINATE},{n:"z",int:!0,d:"0",syntax:pi.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:pi.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:pi.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:pi.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:pi.COORDINATE},{n:"y1",int:!0,l:!0,syntax:pi.COORDINATE},{n:"z1",int:!0,l:!0,syntax:pi.COORDINATE},{n:"x2",int:!0,l:!0,syntax:pi.COORDINATE},{n:"y2",int:!0,l:!0,syntax:pi.COORDINATE},{n:"z2",int:!0,l:!0,syntax:pi.COORDINATE},{n:"path",int:!0,l:!0,d:"",a:["d"],syntax:pi.PATH,p:50},{n:"points",int:!0,l:!0,syntax:pi.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:pi.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:pi.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:pi.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:pi.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:pi.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:pi.NUMBER,d:function(t){return t===$n.PATH||t===$n.POLYGON||t===$n.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:pi.MARKER},{n:"markerEnd",syntax:pi.MARKER},{n:"markerMid",syntax:pi.MARKER},{n:"markerStartOffset",syntax:pi.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:pi.LENGTH,l:!0,int:!0,d:"0"}],Ro=_o.filter((function(t){return!!t.l})).map((function(t){return t.n})),Lo={},Do=new WeakMap,Io=function(){function t(t){var e=this;this.runtime=t,_o.forEach((function(t){e.registerMetadata(t)}))}return t.prototype.registerMetadata=function(t){l([t.n],c(t.a||[]),!1).forEach((function(e){Lo[e]=t}))},t.prototype.unregisterMetadata=function(t){delete Lo[t]},t.prototype.getPropertySyntax=function(t){return this.runtime.CSSPropertySyntaxFactory[t]},t.prototype.processProperties=function(t,e,n){var r=this;if(void 0===n&&(n={skipUpdateAttribute:!1,skipParse:!1,forceUpdateGeometry:!1,usedAttributes:[],memoize:!0}),!this.runtime.enableCSSParsing){Object.assign(t.attributes,e);var o=Object.keys(e),a=t.parsedStyle.clipPath,s=t.parsedStyle.offsetPath;t.parsedStyle=Object.assign(t.parsedStyle,e);var u=!!n.forceUpdateGeometry;if(!u)for(var c=0;c<Ro.length;c++)if(Ro[c]in e){u=!0;break}return e.fill&&(t.parsedStyle.fill=Ti(e.fill)),e.stroke&&(t.parsedStyle.stroke=Ti(e.stroke)),e.shadowColor&&(t.parsedStyle.shadowColor=Ti(e.shadowColor)),e.filter&&(t.parsedStyle.filter=Wi(e.filter)),Pt(e.radius)||(t.parsedStyle.radius=Bi(e.radius,4)),Pt(e.lineDash)||(t.parsedStyle.lineDash=Bi(e.lineDash,2)),e.points&&(t.parsedStyle.points=ho(e.points,t)),""===e.path&&(t.parsedStyle.path=i({},gi)),e.path&&(t.parsedStyle.path=co(e.path),t.parsedStyle.defX=t.parsedStyle.path.rect.x,t.parsedStyle.defY=t.parsedStyle.path.rect.y),e.textTransform&&this.runtime.CSSPropertySyntaxFactory["<text-transform>"].calculator(null,null,{value:e.textTransform},t,null),e.clipPath&&this.runtime.CSSPropertySyntaxFactory["<defined-path>"].calculator("clipPath",a,e.clipPath,t,this.runtime),e.offsetPath&&this.runtime.CSSPropertySyntaxFactory["<defined-path>"].calculator("offsetPath",s,e.offsetPath,t,this.runtime),e.anchor&&(t.parsedStyle.anchor=Bi(e.anchor,2)),e.transform&&(t.parsedStyle.transform=yo(e.transform)),e.transformOrigin&&(t.parsedStyle.transformOrigin=Po(e.transformOrigin)),e.markerStart&&(t.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory["<marker>"].calculator(null,e.markerStart,e.markerStart,null,null)),e.markerEnd&&(t.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory["<marker>"].calculator(null,e.markerEnd,e.markerEnd,null,null)),e.markerMid&&(t.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory["<marker>"].calculator("",e.markerMid,e.markerMid,null,null)),(t.nodeName!==$n.CIRCLE&&t.nodeName!==$n.ELLIPSE||Pt(e.cx)&&Pt(e.cy))&&(t.nodeName!==$n.RECT&&t.nodeName!==$n.IMAGE&&t.nodeName!==$n.GROUP&&t.nodeName!==$n.HTML&&t.nodeName!==$n.TEXT&&t.nodeName!==$n.MESH||Pt(e.x)&&Pt(e.y)&&Pt(e.z))&&(t.nodeName!==$n.LINE||Pt(e.x1)&&Pt(e.y1)&&Pt(e.z1)&&Pt(e.x2)&&Pt(e.y2)&&Pt(e.z2))||this.runtime.CSSPropertySyntaxFactory["<coordinate>"].postProcessor(t,o),Pt(e.zIndex)||this.runtime.CSSPropertySyntaxFactory["<z-index>"].postProcessor(t,o),e.path&&this.runtime.CSSPropertySyntaxFactory["<path>"].postProcessor(t,o),e.points&&this.runtime.CSSPropertySyntaxFactory["<list-of-points>"].postProcessor(t,o),Pt(e.offsetDistance)||this.runtime.CSSPropertySyntaxFactory["<offset-distance>"].postProcessor(t,o),e.transform&&this.runtime.CSSPropertySyntaxFactory["<transform>"].postProcessor(t,o),void(u&&this.updateGeometry(t))}var l=n.skipUpdateAttribute,h=n.skipParse,d=n.forceUpdateGeometry,f=n.usedAttributes,p=n.memoize,g=d,m=Object.keys(e);m.forEach((function(n){var r;l||(t.attributes[n]=e[n]),!g&&(null===(r=Lo[n])||void 0===r?void 0:r.l)&&(g=!0)})),h||m.forEach((function(e){t.computedStyle[e]=r.parseProperty(e,t.attributes[e],t,p)})),(null==f?void 0:f.length)&&(m=Array.from(new Set(m.concat(f)))),m.forEach((function(e){e in t.computedStyle&&(t.parsedStyle[e]=r.computeProperty(e,t.computedStyle[e],t,p))})),g&&this.updateGeometry(t),m.forEach((function(e){e in t.parsedStyle&&r.postProcessProperty(e,t,m)})),this.runtime.enableCSSParsing&&t.children.length&&m.forEach((function(e){e in t.parsedStyle&&r.isPropertyInheritable(e)&&t.children.forEach((function(t){t.internalSetAttribute(e,null,{skipUpdateAttribute:!0,skipParse:!0})}))}))},t.prototype.parseProperty=function(t,e,n,r){var i=Lo[t],o=e;if((""===e||Pt(e))&&(e="unset"),"unset"===e||"initial"===e||"inherit"===e)o=ui(e);else if(i){var a=i.k,s=i.syntax,u=s&&this.getPropertySyntax(s);a&&a.indexOf(e)>-1?o=ui(e):u&&(!r&&u.parserUnmemoize?o=u.parserUnmemoize(e,n):u.parser&&(o=u.parser(e,n)))}return o},t.prototype.computeProperty=function(t,e,n,r){var i=Lo[t],o="g-root"===n.id,a=e;if(i){var s=i.syntax,u=i.inh,c=i.d;if(e instanceof Ur){var l=e.value;if("unset"===l&&(l=u&&!o?"inherit":"initial"),"initial"===l)Pt(c)||(e=this.parseProperty(t,$r(c)?c(n.nodeName):c,n,r));else if("inherit"===l){var h=this.tryToResolveProperty(n,t,{inherited:!0});return Pt(h)?void this.addUnresolveProperty(n,t):h}}var d=s&&this.getPropertySyntax(s);if(d&&d.calculator){var f=n.parsedStyle[t];a=d.calculator(t,f,e,n,this.runtime)}else a=e instanceof Ur?e.value:e}return a},t.prototype.postProcessProperty=function(t,e,n){var r=Lo[t];if(r&&r.syntax){var i=r.syntax&&this.getPropertySyntax(r.syntax);i&&i.postProcessor&&i.postProcessor(e,n)}},t.prototype.addUnresolveProperty=function(t,e){var n=Do.get(t);n||(Do.set(t,[]),n=Do.get(t)),-1===n.indexOf(e)&&n.push(e)},t.prototype.tryToResolveProperty=function(t,e,n){if(void 0===n&&(n={}),n.inherited&&t.parentElement&&function(t,e){var n=Do.get(t);return!n||0===n.length||n.includes(e)}(t.parentElement,e)){var r=t.parentElement.parsedStyle[e];if("unset"===r||"initial"===r||"inherit"===r)return;return r}},t.prototype.recalc=function(t){var e=Do.get(t);if(e&&e.length){var n={};e.forEach((function(e){n[e]=t.attributes[e]})),this.processProperties(t,n),Do.delete(t)}},t.prototype.updateGeometry=function(t){var e=t.nodeName,n=this.runtime.geometryUpdaterFactory[e];if(n){var r=t.geometry;r.contentBounds||(r.contentBounds=new mr),r.renderBounds||(r.renderBounds=new mr);var i=t.parsedStyle,o=n.update(i,t),a=o.width,s=o.height,u=o.depth,c=void 0===u?0:u,l=o.offsetX,h=void 0===l?0:l,d=o.offsetY,f=void 0===d?0:d,p=o.offsetZ,g=void 0===p?0:p,m=[Math.abs(a)/2,Math.abs(s)/2,c/2],v=i,y=v.stroke,b=v.lineWidth,E=v.increasedLineWidthForHitTesting,w=v.shadowType,x=v.shadowColor,M=v.filter,N=void 0===M?[]:M,S=v.transformOrigin,C=i.anchor;e===$n.TEXT?delete i.anchor:e===$n.MESH&&(i.anchor[2]=.5);var k=[(1-2*(C&&C[0]||0))*a/2+h,(1-2*(C&&C[1]||0))*s/2+f,(1-2*(C&&C[2]||0))*m[2]+g];r.contentBounds.update(k,m);var T=e===$n.POLYLINE||e===$n.POLYGON||e===$n.PATH?Math.SQRT2:.5;if(y&&!y.isNone){var P=((b||0)+(E||0))*T;m[0]+=P,m[1]+=P}if(r.renderBounds.update(k,m),x&&w&&"inner"!==w){var A=r.renderBounds,O=A.min,_=A.max,R=i,L=R.shadowBlur||0,D=R.shadowOffsetX||0,I=R.shadowOffsetY||0,j=O[0]-L+D,z=_[0]+L+D,B=O[1]-L+I,F=_[1]+L+I;O[0]=Math.min(O[0],j),_[0]=Math.max(_[0],z),O[1]=Math.min(O[1],B),_[1]=Math.max(_[1],F),r.renderBounds.setMinMax(O,_)}N.forEach((function(t){var e=t.name,n=t.params;if("blur"===e){var i=n[0].value;r.renderBounds.update(r.renderBounds.center,tr(r.renderBounds.halfExtents,r.renderBounds.halfExtents,[i,i,0]))}else if("drop-shadow"===e){var o=n[0].value,a=n[1].value,s=n[2].value,u=r.renderBounds,c=u.min,l=u.max,h=c[0]-s+o,d=l[0]+s+o,f=c[1]-s+a,p=l[1]+s+a;c[0]=Math.min(c[0],h),l[0]=Math.max(l[0],d),c[1]=Math.min(c[1],f),l[1]=Math.max(l[1],p),r.renderBounds.setMinMax(c,l)}})),C=i.anchor;var G=a<0,V=s<0,W=(G?-1:1)*(S?Gi(S[0],0,t):0),U=(V?-1:1)*(S?Gi(S[1],1,t):0);W-=(G?-1:1)*(C&&C[0]||0)*r.contentBounds.halfExtents[0]*2,U-=(V?-1:1)*(C&&C[1]||0)*r.contentBounds.halfExtents[1]*2,t.setOrigin(W,U),this.runtime.sceneGraphService.dirtifyToRoot(t)}},t.prototype.updateSizeAttenuation=function(t,e){t.style.isSizeAttenuation?(t.style.rawLineWidth||(t.style.rawLineWidth=t.style.lineWidth),t.style.lineWidth=t.style.rawLineWidth/e,t.nodeName===$n.CIRCLE&&(t.style.rawR||(t.style.rawR=t.style.r),t.style.r=t.style.rawR/e)):(t.style.rawLineWidth&&(t.style.lineWidth=t.style.rawLineWidth,delete t.style.rawLineWidth),t.nodeName===$n.CIRCLE&&t.style.rawR&&(t.style.r=t.style.rawR,delete t.style.rawR))},t.prototype.isPropertyInheritable=function(t){var e=Lo[t];return!!e&&e.inh},t}(),jo=function(){function t(){this.parser=Ii,this.parserUnmemoize=Di,this.parserWithCSSDisabled=null,this.mixer=$i}return t.prototype.calculator=function(t,e,n,r){return zi(n)},t}(),zo=function(){function t(){}return t.prototype.calculator=function(t,e,n,r,i){return n instanceof Ur&&(n=null),i.sceneGraphService.updateDisplayObjectDependency(t,e,n,r),"clipPath"===t&&r.forEach((function(t){0===t.childNodes.length&&i.sceneGraphService.dirtifyToRoot(t)})),n},t}(),Bo=function(){function t(){this.parser=Ti,this.parserWithCSSDisabled=Ti,this.mixer=Pi}return t.prototype.calculator=function(t,e,n,r){return n instanceof Ur?"none"===n.value?ci:li:n},t}(),Fo=function(){function t(){this.parser=Wi}return t.prototype.calculator=function(t,e,n){return n instanceof Ur?[]:n},t}();function Go(t){var e=t.parsedStyle.fontSize;return Pt(e)?null:e}var Vo=function(){function t(){this.parser=Li,this.parserUnmemoize=Ri,this.parserWithCSSDisabled=null,this.mixer=$i}return t.prototype.calculator=function(t,e,n,r,i){var o;if(Wt(n))return n;if(!Qr.isRelativeUnit(n.unit))return n.value;var a=i.styleValueRegistry;if(n.unit===Cr.kPercentage)return 0;if(n.unit===Cr.kEms){if(r.parentNode){if(s=Go(r.parentNode))return s*=n.value;a.addUnresolveProperty(r,t)}else a.addUnresolveProperty(r,t);return 0}if(n.unit===Cr.kRems){if(null===(o=null==r?void 0:r.ownerDocument)||void 0===o?void 0:o.documentElement){var s;if(s=Go(r.ownerDocument.documentElement))return s*=n.value;a.addUnresolveProperty(r,t)}else a.addUnresolveProperty(r,t);return 0}},t}(),Wo=function(){function t(){this.mixer=Ki}return t.prototype.parser=function(t){var e=Fi(Wt(t)?[t]:t);return 1===e.length?[e[0],e[0]]:[e[0],e[1]]},t.prototype.calculator=function(t,e,n){return n.map((function(t){return t.value}))},t}(),Uo=function(){function t(){this.mixer=Ki}return t.prototype.parser=function(t){var e=Fi(Wt(t)?[t]:t);return 1===e.length?[e[0],e[0],e[0],e[0]]:2===e.length?[e[0],e[1],e[0],e[1]]:3===e.length?[e[0],e[1],e[2],e[1]]:[e[0],e[1],e[2],e[3]]},t.prototype.calculator=function(t,e,n){return n.map((function(t){return t.value}))},t}(),Ho=E();function qo(t,e){var n=e.parsedStyle.defX||0,r=e.parsedStyle.defY||0;return e.resetLocalTransform(),e.setLocalPosition(n,r),t.forEach((function(t){var i=t.t,o=t.d;if("scale"===i){var a=(null==o?void 0:o.map((function(t){return t.value})))||[1,1];e.scaleLocal(a[0],a[1],1)}else if("scalex"===i){a=(null==o?void 0:o.map((function(t){return t.value})))||[1];e.scaleLocal(a[0],1,1)}else if("scaley"===i){a=(null==o?void 0:o.map((function(t){return t.value})))||[1];e.scaleLocal(1,a[0],1)}else if("scalez"===i){a=(null==o?void 0:o.map((function(t){return t.value})))||[1];e.scaleLocal(1,1,a[0])}else if("scale3d"===i){a=(null==o?void 0:o.map((function(t){return t.value})))||[1,1,1];e.scaleLocal(a[0],a[1],a[2])}else if("translate"===i){var s=o||[Jr,Jr];e.translateLocal(s[0].value,s[1].value,0)}else if("translatex"===i){s=o||[Jr];e.translateLocal(s[0].value,0,0)}else if("translatey"===i){s=o||[Jr];e.translateLocal(0,s[0].value,0)}else if("translatez"===i){s=o||[Jr];e.translateLocal(0,0,s[0].value)}else if("translate3d"===i){s=o||[Jr,Jr,Jr];e.translateLocal(s[0].value,s[1].value,s[2].value)}else if("rotate"===i){var u=o||[ni];e.rotateLocal(0,0,zi(u[0]))}else if("rotatex"===i){u=o||[ni];e.rotateLocal(zi(u[0]),0,0)}else if("rotatey"===i){u=o||[ni];e.rotateLocal(0,zi(u[0]),0)}else if("rotatez"===i){u=o||[ni];e.rotateLocal(0,0,zi(u[0]))}else if("rotate3d"===i);else if("skew"===i){var h=(null==o?void 0:o.map((function(t){return t.value})))||[0,0];e.setLocalSkew(ir(h[0]),ir(h[1]))}else if("skewx"===i){h=(null==o?void 0:o.map((function(t){return t.value})))||[0];e.setLocalSkew(ir(h[0]),e.getLocalSkew()[1])}else if("skewy"===i){h=(null==o?void 0:o.map((function(t){return t.value})))||[0];e.setLocalSkew(e.getLocalSkew()[0],ir(h[0]))}else if("matrix"===i){var d=c(o.map((function(t){return t.value})),6),f=d[0],p=d[1],g=d[2],m=d[3],v=d[4],y=d[5];e.setLocalTransform(M(Ho,f,p,0,0,g,m,0,0,0,0,1,0,v+n,y+r,0,1))}else"matrix3d"===i&&(M.apply(X,l([Ho],c(o.map((function(t){return t.value}))),!1)),Ho[12]+=n,Ho[13]+=r,e.setLocalTransform(Ho))})),e.getLocalTransform()}var $o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.postProcessor=function(t,e){var n,r,i;switch(t.nodeName){case $n.CIRCLE:case $n.ELLIPSE:var o=t.parsedStyle,a=o.cx,s=o.cy,u=o.cz;Pt(a)||(n=a),Pt(s)||(r=s),Pt(u)||(i=u);break;case $n.LINE:var l=t.parsedStyle,h=l.x1,d=l.x2,f=l.y1,p=l.y2;n=Math.min(h,d),r=Math.min(f,p),i=0;break;case $n.RECT:case $n.IMAGE:case $n.GROUP:case $n.HTML:case $n.TEXT:case $n.MESH:Pt(t.parsedStyle.x)||(n=t.parsedStyle.x),Pt(t.parsedStyle.y)||(r=t.parsedStyle.y),Pt(t.parsedStyle.z)||(i=t.parsedStyle.z)}if(t.nodeName!==$n.PATH&&t.nodeName!==$n.POLYLINE&&t.nodeName!==$n.POLYGON&&(t.parsedStyle.defX=n||0,t.parsedStyle.defY=r||0),(!Pt(n)||!Pt(r)||!Pt(i))&&-1===e.indexOf("transform")){var g=t.parsedStyle.transform;if(g&&g.length)qo(g,t);else{var m=c(t.getLocalPosition(),3),v=m[0],y=m[1],b=m[2];t.setLocalPosition(Pt(n)?v:n,Pt(r)?y:r,Pt(i)?b:i)}}},e}(Vo),Yo=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){n instanceof Ur&&(n=null);var i=null==n?void 0:n.cloneNode(!0);return i&&(i.style.isMarker=!0),i},t}(),Ko=function(){function t(){this.mixer=$i,this.parser=qi,this.parserUnmemoize=Hi,this.parserWithCSSDisabled=null}return t.prototype.calculator=function(t,e,n){return n.value},t}(),Xo=function(){function t(){this.parser=qi,this.parserUnmemoize=Hi,this.parserWithCSSDisabled=null,this.mixer=Yi(0,1)}return t.prototype.calculator=function(t,e,n){return n.value},t.prototype.postProcessor=function(t){var e=t.parsedStyle,n=e.offsetPath,r=e.offsetDistance;if(n){var i=n.nodeName;if(i===$n.LINE||i===$n.PATH||i===$n.POLYLINE){var o=n.getPoint(r);o&&(t.parsedStyle.defX=o.x,t.parsedStyle.defY=o.y,t.setLocalPosition(o.x,o.y))}}},t}(),Zo=function(){function t(){this.parser=qi,this.parserUnmemoize=Hi,this.parserWithCSSDisabled=null,this.mixer=Yi(0,1)}return t.prototype.calculator=function(t,e,n){return n.value},t}(),Qo=function(){function t(){this.parser=co,this.parserWithCSSDisabled=co,this.mixer=lo}return t.prototype.calculator=function(t,e,n){return n instanceof Ur&&"unset"===n.value?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Mr(0,0,0,0)}:n},t.prototype.postProcessor=function(t,e){if(t.parsedStyle.defX=t.parsedStyle.path.rect.x,t.parsedStyle.defY=t.parsedStyle.path.rect.y,t.nodeName===$n.PATH&&-1===e.indexOf("transform")){var n=t.parsedStyle,r=n.defX,i=void 0===r?0:r,o=n.defY,a=void 0===o?0:o;t.setLocalPosition(i,a)}},t}(),Jo=function(){function t(){this.parser=ho,this.mixer=fo}return t.prototype.postProcessor=function(t,e){if((t.nodeName===$n.POLYGON||t.nodeName===$n.POLYLINE)&&-1===e.indexOf("transform")){var n=t.parsedStyle,r=n.defX,i=n.defY;t.setLocalPosition(r,i)}},t}(),ta=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.mixer=Yi(0,1/0),e}return r(e,t),e}(Vo),ea=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){return n instanceof Ur?"unset"===n.value?"":n.value:"".concat(n)},t.prototype.postProcessor=function(t){t.nodeValue="".concat(t.parsedStyle.text)||""},t}(),na=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){var i=r.getAttribute("text");if(i){var o=i;"capitalize"===n.value?o=i.charAt(0).toUpperCase()+i.slice(1):"lowercase"===n.value?o=i.toLowerCase():"uppercase"===n.value&&(o=i.toUpperCase()),r.parsedStyle.text=o}return n.value},t}(),ra={},ia=0;var oa="undefined"!=typeof window&&void 0!==window.document;function aa(t){return!!t.getAttribute}function sa(t,e){var n=Number(t.parsedStyle.zIndex),r=Number(e.parsedStyle.zIndex);if(n===r){var i=t.parentNode;if(i){var o=i.childNodes||[];return o.indexOf(t)-o.indexOf(e)}}return n-r}function ua(t){var e,n=t;do{if(null===(e=n.parsedStyle)||void 0===e?void 0:e.clipPath)return n;n=n.parentElement}while(null!==n);return null}function ca(t,e){if(oa)return document.defaultView.getComputedStyle(t,null).getPropertyValue(e)}var la={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},ha="object"==typeof performance&&performance.now?performance:Date;function da(t,e,n){var r=!1,i=!1,o=!!e&&!e.isNone,a=!!n&&!n.isNone;return"visiblepainted"===t||"painted"===t||"auto"===t?(r=o,i=a):"visiblefill"===t||"fill"===t?r=!0:"visiblestroke"===t||"stroke"===t?i=!0:"visible"!==t&&"all"!==t||(r=!0,i=!0),[r,i]}var fa=1,pa="object"==typeof self&&self.self==self?self:"object"==typeof global&&global.global==global?global:{},ga=Date.now(),ma={},va=Date.now(),ya=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");var e=Date.now(),n=e-va,r=n>16?0:16-n,i=fa++;return ma[i]=t,Object.keys(ma).length>1||setTimeout((function(){va=e;var t=ma;ma={},Object.keys(t).forEach((function(e){return t[e](pa.performance&&"function"==typeof pa.performance.now?pa.performance.now():Date.now()-ga)}))}),r),i},ba=function(t){delete ma[t]},Ea=function(t){return"string"!=typeof t?ya:""===t?pa.requestAnimationFrame:pa[t+"RequestAnimationFrame"]},wa=function(t,e){for(var n=0;void 0!==t[n];){if(e(t[n]))return t[n];n+=1}}(["","webkit","moz","ms","o"],(function(t){return!!Ea(t)})),xa=Ea(wa),Ma=function(t){return"string"!=typeof t?ba:""===t?pa.cancelAnimationFrame:pa[t+"CancelAnimationFrame"]||pa[t+"CancelRequestAnimationFrame"]}(wa);pa.requestAnimationFrame=xa,pa.cancelAnimationFrame=Ma;var Na=function(){function t(){this.callbacks=[]}return t.prototype.getCallbacksNum=function(){return this.callbacks.length},t.prototype.tapPromise=function(t,e){this.callbacks.push(e)},t.prototype.promise=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Promise.all(this.callbacks.map((function(e){return e.apply(void 0,l([],c(t),!1))})))},t}(),Sa=function(){function t(){this.callbacks=[]}return t.prototype.tapPromise=function(t,e){this.callbacks.push(e)},t.prototype.promise=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return a(this,void 0,void 0,(function(){var e,n,r;return s(this,(function(i){switch(i.label){case 0:return this.callbacks.length?[4,(r=this.callbacks)[0].apply(r,l([],c(t),!1))]:[3,6];case 1:e=i.sent(),n=0,i.label=2;case 2:return n<this.callbacks.length-1?[4,(0,this.callbacks[n])(e)]:[3,5];case 3:e=i.sent(),i.label=4;case 4:return n++,[3,2];case 5:return[2,e];case 6:return[2,null]}}))}))},t}(),Ca=function(){function t(){this.callbacks=[]}return t.prototype.tap=function(t,e){this.callbacks.push(e)},t.prototype.call=function(){var t=arguments;this.callbacks.forEach((function(e){e.apply(void 0,t)}))},t}(),ka=function(){function t(){this.callbacks=[]}return t.prototype.tap=function(t,e){this.callbacks.push(e)},t.prototype.call=function(){if(this.callbacks.length){for(var t=arguments,e=this.callbacks[0].apply(void 0,t),n=0;n<this.callbacks.length-1;n++){e=(0,this.callbacks[n])(e)}return e}return null},t}(),Ta=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Pa=/([\"\'])[^\'\"]+\1/;var Aa=function(){function t(){this.parser=yo,this.parserUnmemoize=bo,this.parserWithCSSDisabled=bo,this.mixer=To}return t.prototype.calculator=function(t,e,n,r){return n instanceof Ur?[]:n},t.prototype.postProcessor=function(t){qo(t.parsedStyle.transform,t)},t}(),Oa=function(){this.parser=Po,this.parserUnmemoize=Ao},_a=function(){function t(){this.parser=qi,this.parserUnmemoize=Hi}return t.prototype.calculator=function(t,e,n,r){return n.value},t.prototype.postProcessor=function(t){if(t.parentNode){var e=t.parentNode,n=e.renderable,r=e.sortable;n&&(n.dirty=!0),r&&(r.dirty=!0,r.dirtyReason=ei.Z_INDEX_CHANGED)}},t}(),Ra=function(){function t(){}return t.prototype.update=function(t,e){var n=t.r;return{width:2*n,height:2*n}},t}(),La=function(){function t(){}return t.prototype.update=function(t,e){return{width:2*t.rx,height:2*t.ry}},t}(),Da=function(){function t(){}return t.prototype.update=function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2,o=Math.min(e,r),a=Math.max(e,r),s=Math.min(n,i);return{width:a-o,height:Math.max(n,i)-s}},t}(),Ia=function(){function t(){}return t.prototype.update=function(t){var e=t.path.rect;return{width:e.width,height:e.height}},t}(),ja=function(){function t(){}return t.prototype.update=function(t){if(t.points&&_t(t.points.points)){var e=t.points.points,n=Math.min.apply(Math,l([],c(e.map((function(t){return t[0]}))),!1)),r=Math.max.apply(Math,l([],c(e.map((function(t){return t[0]}))),!1)),i=Math.min.apply(Math,l([],c(e.map((function(t){return t[1]}))),!1)),o=Math.max.apply(Math,l([],c(e.map((function(t){return t[1]}))),!1));return{width:r-n,height:o-i}}return{width:0,height:0}},t}(),za=function(){function t(){}return t.prototype.update=function(t,e){var n=t.img,r=t.width,i=void 0===r?0:r,o=t.height,a=i,s=void 0===o?0:o;return n&&!Bt(n)&&(a||(a=n.width,t.width=a),s||(s=n.height,t.height=s)),{width:a,height:s}},t}(),Ba=function(){function t(t){this.globalRuntime=t}return t.prototype.isReadyToMeasure=function(t,e){var n=t.text,r=t.textAlign,i=t.textBaseline,o=t.fontSize,a=t.fontStyle,s=t.fontWeight,u=t.fontVariant,c=t.lineWidth;return n&&o&&a&&s&&u&&r&&i&&!Pt(c)},t.prototype.update=function(t,e){var n,r,i=t.text,o=t.textAlign,a=t.lineWidth,s=t.textBaseline,u=t.dx,c=t.dy;if(!this.isReadyToMeasure(t,e))return t.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{width:0,height:0,x:0,y:0,offsetX:0,offsetY:0};var l=((null===(r=null===(n=null==e?void 0:e.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0===r?void 0:r.getConfig())||{}).offscreenCanvas,h=this.globalRuntime.textService.measureText(i,t,l);t.metrics=h;var d=h.width,f=h.height,p=h.lineHeight,g=h.fontProperties,m=[d/2,f/2,0],v=[0,1],y=0;"center"===o||"middle"===o?(y=a/2,v=[.5,1]):"right"!==o&&"end"!==o||(y=a,v=[1,1]);var b=0;return"middle"===s?b=m[1]:"top"===s||"hanging"===s?b=2*m[1]:"alphabetic"===s?b=this.globalRuntime.enableCSSParsing?p-g.ascent:0:"bottom"!==s&&"ideographic"!==s||(b=0),u&&(y+=u),c&&(b+=c),t.anchor=[v[0],v[1],0],{width:2*m[0],height:2*m[1],offsetX:y,offsetY:b}},t}();var Fa,Ga=function(){function t(e){this.eventPhase=t.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new xr,this.page=new xr,this.canvas=new xr,this.viewport=new xr,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerX",{get:function(){return this.layer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerY",{get:function(){return this.layer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageX",{get:function(){return this.page.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageY",{get:function(){return this.page.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"x",{get:function(){return this.canvas.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.canvas.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasX",{get:function(){return this.canvas.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasY",{get:function(){return this.canvas.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewportX",{get:function(){return this.viewport.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewportY",{get:function(){return this.viewport.y},enumerable:!1,configurable:!0}),t.prototype.composedPath=function(){return!this.manager||this.path&&this.path[0]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},Object.defineProperty(t.prototype,"propagationPath",{get:function(){return this.composedPath()},enumerable:!1,configurable:!0}),t.prototype.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.prototype.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t.prototype.initEvent=function(){},t.prototype.initUIEvent=function(){},t.prototype.clone=function(){throw new Error(Nr)},t}(),Va=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.client=new xr,e.movement=new xr,e.offset=new xr,e.global=new xr,e.screen=new xr,e}return r(e,t),Object.defineProperty(e.prototype,"clientX",{get:function(){return this.client.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clientY",{get:function(){return this.client.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementX",{get:function(){return this.movement.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementY",{get:function(){return this.movement.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetX",{get:function(){return this.offset.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetY",{get:function(){return this.offset.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalX",{get:function(){return this.global.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalY",{get:function(){return this.global.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenX",{get:function(){return this.screen.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenY",{get:function(){return this.screen.y},enumerable:!1,configurable:!0}),e.prototype.getModifierState=function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)},e.prototype.initMouseEvent=function(){throw new Error(Nr)},e}(Ga),Wa=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.width=0,e.height=0,e.isPrimary=!1,e}return r(e,t),e.prototype.getCoalescedEvents=function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]},e.prototype.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e.prototype.clone=function(){return this.manager.clonePointerEvent(this)},e}(Va),Ua=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.clone=function(){return this.manager.cloneWheelEvent(this)},e}(Va),Ha=function(t){function e(e,n){var r=t.call(this,null)||this;return r.type=e,r.detail=n,Object.assign(r,n),r}return r(e,t),e}(Ga),qa=function(){function t(){this.emitter=new m}return t.prototype.on=function(t,e,n){return this.addEventListener(t,e,n),this},t.prototype.addEventListener=function(t,e,n){var r=Xt(n)&&n||Rt(n)&&n.capture,i=Rt(n)&&n.once,o=$r(e)?void 0:e,a=!1,s="";if(t.indexOf(":")>-1){var u=c(t.split(":"),2),h=u[0];t=u[1],s=h,a=!0}if(t=r?"".concat(t,"capture"):t,e=$r(e)?e:e.handleEvent,a){var d=e;e=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];(null===(t=e[0].target)||void 0===t?void 0:t.name)===s&&d.apply(void 0,l([],c(e),!1))}}return i?this.emitter.once(t,e,o):this.emitter.on(t,e,o),this},t.prototype.off=function(t,e,n){return t?this.removeEventListener(t,e,n):this.removeAllEventListeners(),this},t.prototype.removeAllEventListeners=function(){this.emitter.removeAllListeners()},t.prototype.removeEventListener=function(t,e,n){var r=Xt(n)&&n||Rt(n)&&n.capture,i=$r(e)?void 0:e;return t=r?"".concat(t,"capture"):t,e=$r(e)?e:null==e?void 0:e.handleEvent,this.emitter.off(t,e,i),this},t.prototype.emit=function(t,e){this.dispatchEvent(new Ha(t,e))},t.prototype.dispatchEvent=function(t,e){var n,r,i;if(void 0===e&&(e=!1),!t.type)throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");if(i=this.document?this:this.defaultView?this.defaultView:null===(n=this.ownerDocument)||void 0===n?void 0:n.defaultView){if(t.manager=i.getEventService()||null,!t.manager)return!1;t.defaultPrevented=!1,t.path=[],e||(t.target=this),null===(r=t.manager)||void 0===r||r.dispatchEvent(t,t.type,e)}return!t.defaultPrevented},t}(),$a=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.shadow=!1,e.ownerDocument=null,e.isConnected=!1,e.baseURI="",e.childNodes=[],e.nodeType=0,e.nodeName="",e.nodeValue=null,e.parentNode=null,e}return r(e,t),e.isNode=function(t){return!!t.childNodes},Object.defineProperty(e.prototype,"textContent",{get:function(){var t,e,n="";this.nodeName===$n.TEXT&&(n+=this.style.text);try{for(var r=u(this.childNodes),i=r.next();!i.done;i=r.next()){var o=i.value;o.nodeName===$n.TEXT?n+=o.nodeValue:n+=o.textContent}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return n},set:function(t){var e=this;this.childNodes.slice().forEach((function(t){e.removeChild(t)})),this.nodeName===$n.TEXT&&(this.style.text="".concat(t))},enumerable:!1,configurable:!0}),e.prototype.getRootNode=function(t){return void 0===t&&(t={}),this.parentNode?this.parentNode.getRootNode(t):t.composed&&this.host?this.host.getRootNode(t):this},e.prototype.hasChildNodes=function(){return this.childNodes.length>0},e.prototype.isDefaultNamespace=function(t){throw new Error(Nr)},e.prototype.lookupNamespaceURI=function(t){throw new Error(Nr)},e.prototype.lookupPrefix=function(t){throw new Error(Nr)},e.prototype.normalize=function(){throw new Error(Nr)},e.prototype.isEqualNode=function(t){return this===t},e.prototype.isSameNode=function(t){return this.isEqualNode(t)},Object.defineProperty(e.prototype,"parent",{get:function(){return this.parentNode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentElement",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChild",{get:function(){return this.childNodes.length>0?this.childNodes[0]:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChild",{get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null},enumerable:!1,configurable:!0}),e.prototype.compareDocumentPosition=function(t){var n;if(t===this)return 0;for(var r=t,i=this,o=[r],a=[i];null!==(n=r.parentNode)&&void 0!==n?n:i.parentNode;)r=r.parentNode?(o.push(r.parentNode),r.parentNode):r,i=i.parentNode?(a.push(i.parentNode),i.parentNode):i;if(r!==i)return e.DOCUMENT_POSITION_DISCONNECTED|e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|e.DOCUMENT_POSITION_PRECEDING;var s=o.length>a.length?o:a,u=s===o?a:o;if(s[s.length-u.length]===u[0])return s===o?e.DOCUMENT_POSITION_CONTAINED_BY|e.DOCUMENT_POSITION_FOLLOWING:e.DOCUMENT_POSITION_CONTAINS|e.DOCUMENT_POSITION_PRECEDING;for(var c=s.length-u.length,l=u.length-1;l>=0;l--){var h=u[l],d=s[c+l];if(d!==h){var f=h.parentNode.childNodes;return f.indexOf(h)<f.indexOf(d)?u===o?e.DOCUMENT_POSITION_PRECEDING:e.DOCUMENT_POSITION_FOLLOWING:s===o?e.DOCUMENT_POSITION_PRECEDING:e.DOCUMENT_POSITION_FOLLOWING}}return e.DOCUMENT_POSITION_FOLLOWING},e.prototype.contain=function(t){return this.contains(t)},e.prototype.contains=function(t){for(var e=t;e&&this!==e;)e=e.parentNode;return!!e},e.prototype.getAncestor=function(t){for(var e=this;t>0&&e;)e=e.parentNode,t--;return e},e.prototype.forEach=function(t,e){void 0===e&&(e=!1),t(this)||(e?this.childNodes.slice():this.childNodes).forEach((function(e){e.forEach(t)}))},e.DOCUMENT_POSITION_DISCONNECTED=1,e.DOCUMENT_POSITION_PRECEDING=2,e.DOCUMENT_POSITION_FOLLOWING=4,e.DOCUMENT_POSITION_CONTAINS=8,e.DOCUMENT_POSITION_CONTAINED_BY=16,e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32,e}(qa),Ya=function(){function t(t,e){var n=this;this.globalRuntime=t,this.context=e,this.emitter=new m,this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=E(),this.tmpVec3=Z(),this.onPointerDown=function(t){var e=n.createPointerEvent(t);if(n.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)n.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){var r=2===e.button;n.dispatchEvent(e,r?"rightdown":"mousedown")}n.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),n.freeEvent(e)},this.onPointerUp=function(t){var e,r=ha.now(),i=n.createPointerEvent(t,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(i,"pointerup"),"touch"===i.pointerType)n.dispatchEvent(i,"touchend");else if("mouse"===i.pointerType||"pen"===i.pointerType){var o=2===i.button;n.dispatchEvent(i,o?"rightup":"mouseup")}var a=n.trackingData(t.pointerId),s=n.findMountedTarget(a.pressTargetsByButton[t.button]),u=s;if(s&&!i.composedPath().includes(s)){for(var c=s;c&&!i.composedPath().includes(c);){if(i.currentTarget=c,n.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType)n.notifyTarget(i,"touchendoutside");else if("mouse"===i.pointerType||"pen"===i.pointerType){o=2===i.button;n.notifyTarget(i,o?"rightupoutside":"mouseupoutside")}$a.isNode(c)&&(c=c.parentNode)}delete a.pressTargetsByButton[t.button],u=c}if(u){var l=n.clonePointerEvent(i,"click");l.target=u,l.path=[],a.clicksByButton[t.button]||(a.clicksByButton[t.button]={clickCount:0,target:l.target,timeStamp:r});var h=a.clicksByButton[t.button];h.target===l.target&&r-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=l.target,h.timeStamp=r,l.detail=h.clickCount,(null===(e=i.detail)||void 0===e?void 0:e.preventClick)||(n.context.config.useNativeClickEvent||"mouse"!==l.pointerType&&"touch"!==l.pointerType||n.dispatchEvent(l,"click"),n.dispatchEvent(l,"pointertap")),n.freeEvent(l)}n.freeEvent(i)},this.onPointerMove=function(t){var e=n.createPointerEvent(t,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0),r="mouse"===e.pointerType||"pen"===e.pointerType,i=n.trackingData(t.pointerId),o=n.findMountedTarget(i.overTargets);if(i.overTargets&&o!==e.target){var a="mousemove"===t.type?"mouseout":"pointerout",s=n.createPointerEvent(t,a,o||void 0);if(n.dispatchEvent(s,"pointerout"),r&&n.dispatchEvent(s,"mouseout"),!e.composedPath().includes(o)){var u=n.createPointerEvent(t,"pointerleave",o||void 0);for(u.eventPhase=u.AT_TARGET;u.target&&!e.composedPath().includes(u.target);)u.currentTarget=u.target,n.notifyTarget(u),r&&n.notifyTarget(u,"mouseleave"),$a.isNode(u.target)&&(u.target=u.target.parentNode);n.freeEvent(u)}n.freeEvent(s)}if(o!==e.target){var c="mousemove"===t.type?"mouseover":"pointerover",l=n.clonePointerEvent(e,c);n.dispatchEvent(l,"pointerover"),r&&n.dispatchEvent(l,"mouseover");for(var h=o&&$a.isNode(o)&&o.parentNode;h&&h!==($a.isNode(n.rootTarget)&&n.rootTarget.parentNode)&&h!==e.target;)h=h.parentNode;if(!h||h===($a.isNode(n.rootTarget)&&n.rootTarget.parentNode)){var d=n.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==($a.isNode(n.rootTarget)&&n.rootTarget.parentNode);)d.currentTarget=d.target,n.notifyTarget(d),r&&n.notifyTarget(d,"mouseenter"),$a.isNode(d.target)&&(d.target=d.target.parentNode);n.freeEvent(d)}n.freeEvent(l)}n.dispatchEvent(e,"pointermove"),"touch"===e.pointerType&&n.dispatchEvent(e,"touchmove"),r&&(n.dispatchEvent(e,"mousemove"),n.cursor=n.getCursor(e.target)),i.overTargets=e.composedPath(),n.freeEvent(e)},this.onPointerOut=function(t){var e=n.trackingData(t.pointerId);if(e.overTargets){var r="mouse"===t.pointerType||"pen"===t.pointerType,i=n.findMountedTarget(e.overTargets),o=n.createPointerEvent(t,"pointerout",i||void 0);n.dispatchEvent(o),r&&n.dispatchEvent(o,"mouseout");var a=n.createPointerEvent(t,"pointerleave",i||void 0);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==($a.isNode(n.rootTarget)&&n.rootTarget.parentNode);)a.currentTarget=a.target,n.notifyTarget(a),r&&n.notifyTarget(a,"mouseleave"),$a.isNode(a.target)&&(a.target=a.target.parentNode);e.overTargets=null,n.freeEvent(o),n.freeEvent(a)}n.cursor=null},this.onPointerOver=function(t){var e=n.trackingData(t.pointerId),r=n.createPointerEvent(t),i="mouse"===r.pointerType||"pen"===r.pointerType;n.dispatchEvent(r,"pointerover"),i&&n.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(n.cursor=n.getCursor(r.target));var o=n.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==($a.isNode(n.rootTarget)&&n.rootTarget.parentNode);)o.currentTarget=o.target,n.notifyTarget(o),i&&n.notifyTarget(o,"mouseenter"),$a.isNode(o.target)&&(o.target=o.target.parentNode);e.overTargets=r.composedPath(),n.freeEvent(r),n.freeEvent(o)},this.onPointerUpOutside=function(t){var e=n.trackingData(t.pointerId),r=n.findMountedTarget(e.pressTargetsByButton[t.button]),i=n.createPointerEvent(t);if(r){for(var o=r;o;)i.currentTarget=o,n.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType||"mouse"!==i.pointerType&&"pen"!==i.pointerType||n.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),$a.isNode(o)&&(o=o.parentNode);delete e.pressTargetsByButton[t.button]}n.freeEvent(i)},this.onWheel=function(t){var e=n.createWheelEvent(t);n.dispatchEvent(e),n.freeEvent(e)},this.onClick=function(t){if(n.context.config.useNativeClickEvent){var e=n.createPointerEvent(t);n.dispatchEvent(e),n.freeEvent(e)}},this.onPointerCancel=function(t){var e=n.createPointerEvent(t,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);n.dispatchEvent(e),n.freeEvent(e)}}return t.prototype.init=function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)},t.prototype.destroy=function(){this.emitter.removeAllListeners(),this.mappingTable={},this.mappingState={},this.eventPool.clear()},t.prototype.client2Viewport=function(t){var e=this.context.contextService.getBoundingClientRect();return new xr(t.x-((null==e?void 0:e.left)||0),t.y-((null==e?void 0:e.top)||0))},t.prototype.viewport2Client=function(t){var e=this.context.contextService.getBoundingClientRect();return new xr(t.x+((null==e?void 0:e.left)||0),t.y+((null==e?void 0:e.top)||0))},t.prototype.viewport2Canvas=function(t){var e=t.x,n=t.y,r=this.rootTarget.defaultView.getCamera(),i=this.context.config,o=i.width,a=i.height,s=r.getPerspectiveInverse(),u=r.getWorldTransform(),c=T(this.tmpMatrix,u,s),l=nt(this.tmpVec3,e/o*2-1,2*(1-n/a)-1,0);return lt(l,l,c),new xr(l[0],l[1])},t.prototype.canvas2Viewport=function(t){var e=this.rootTarget.defaultView.getCamera(),n=e.getPerspective(),r=e.getViewTransform(),i=T(this.tmpMatrix,n,r),o=nt(this.tmpVec3,t.x,t.y,0);lt(this.tmpVec3,this.tmpVec3,i);var a=this.context.config,s=a.width,u=a.height;return new xr((o[0]+1)/2*s,(1-(o[1]+1)/2)*u)},t.prototype.setPickHandler=function(t){this.pickHandler=t},t.prototype.addEventMapping=function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((function(t,e){return t.priority-e.priority}))},t.prototype.mapEvent=function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,r=e.length;n<r;n++)e[n].fn(t);else console.warn("[EventService]: Event mapping not defined for ".concat(t.type))}},t.prototype.dispatchEvent=function(t,e,n){if(n){t.eventPhase=t.AT_TARGET;var r=this.rootTarget.defaultView||null;t.currentTarget=r,this.notifyListeners(t,e)}else t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e);this.emitter.emit(e||t.type,t)},t.prototype.propagate=function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var r=n.length-1;r>=1;r--)if(t.currentTarget=n[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){var i=n.indexOf(t.currentTarget);t.eventPhase=t.BUBBLING_PHASE;for(r=i+1;r<n.length;r++)if(t.currentTarget=n[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}},t.prototype.propagationPath=function(t){var e=[t],n=this.rootTarget.defaultView||null;if(n&&n===t)return e.unshift(n.document),e;for(var r=0;r<2048&&t!==this.rootTarget;r++)$a.isNode(t)&&t.parentNode&&(e.push(t.parentNode),t=t.parentNode);return n&&e.push(n),e},t.prototype.hitTest=function(t){var e=t.viewportX,n=t.viewportY,r=this.context.config,i=r.width,o=r.height,a=r.disableHitTesting;return e<0||n<0||e>i||n>o?null:!a&&this.pickHandler(t)||this.rootTarget||null},t.prototype.isNativeEventFromCanvas=function(t,e){var n=null==e?void 0:e.target;if((null==n?void 0:n.shadowRoot)&&(n=e.composedPath()[0]),n){if(n===t)return!0;if(t&&t.contains)return t.contains(n)}return!!(null==e?void 0:e.composedPath)&&e.composedPath().indexOf(t)>-1},t.prototype.getExistedHTML=function(t){var e,n;if(t.nativeEvent.composedPath)try{for(var r=u(t.nativeEvent.composedPath()),i=r.next();!i.done;i=r.next()){var o=i.value,a=this.nativeHTMLMap.get(o);if(a)return a}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return null},t.prototype.pickTarget=function(t){return this.hitTest({clientX:t.clientX,clientY:t.clientY,viewportX:t.viewportX,viewportY:t.viewportY,x:t.canvasX,y:t.canvasY})},t.prototype.createPointerEvent=function(t,e,n,r){var i=this.allocateEvent(Wa);this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t;var o=this.getExistedHTML(i),a=this.context.contextService.getDomElement();return i.target=null!=n?n:o||this.isNativeEventFromCanvas(a,i.nativeEvent)&&this.pickTarget(i)||r,"string"==typeof e&&(i.type=e),i},t.prototype.createWheelEvent=function(t){var e=this.allocateEvent(Ua);this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t;var n=this.getExistedHTML(e),r=this.context.contextService.getDomElement();return e.target=n||this.isNativeEventFromCanvas(r,e.nativeEvent)&&this.pickTarget(e),e},t.prototype.trackingData=function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]},t.prototype.cloneWheelEvent=function(t){var e=this.allocateEvent(Ua);return e.nativeEvent=t.nativeEvent,e.originalEvent=t.originalEvent,this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.target=t.target,e.path=t.composedPath().slice(),e.type=t.type,e},t.prototype.clonePointerEvent=function(t,e){var n=this.allocateEvent(Wa);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n},t.prototype.copyPointerData=function(t,e){e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist},t.prototype.copyMouseData=function(t,e){e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.shiftKey=t.shiftKey,e.client.copyFrom(t.client),e.movement.copyFrom(t.movement),e.canvas.copyFrom(t.canvas),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global),e.offset.copyFrom(t.offset)},t.prototype.copyWheelData=function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ},t.prototype.copyData=function(t,e){e.isTrusted=t.isTrusted,e.timeStamp=ha.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.page.copyFrom(t.page),e.viewport.copyFrom(t.viewport)},t.prototype.allocateEvent=function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=[],e.target=null,e},t.prototype.freeEvent=function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)},t.prototype.notifyTarget=function(t,e){e=null!=e?e:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?"".concat(e,"capture"):e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)},t.prototype.notifyListeners=function(t,e){var n=t.currentTarget.emitter,r=n._events[e];if(r)if("fn"in r)r.once&&n.removeListener(e,r.fn,void 0,!0),r.fn.call(t.currentTarget||r.context,t);else for(var i=0;i<r.length&&!t.propagationImmediatelyStopped;i++)r[i].once&&n.removeListener(e,r[i].fn,void 0,!0),r[i].fn.call(t.currentTarget||r[i].context,t)},t.prototype.findMountedTarget=function(t){if(!t)return null;for(var e=t[t.length-1],n=t.length-2;n>=0;n--){var r=t[n];if(!(r===this.rootTarget||$a.isNode(r)&&r.parentNode===e))break;e=t[n]}return e},t.prototype.getCursor=function(t){for(var e=t;e;){var n=aa(e)&&e.getAttribute("cursor");if(n)return n;e=$a.isNode(e)&&e.parentNode}},t}(),Ka=function(){function t(){}return t.prototype.getOrCreateCanvas=function(t,e){if(this.canvas)return this.canvas;if(t||ds.offscreenCanvas)this.canvas=t||ds.offscreenCanvas,this.context=this.canvas.getContext("2d",i({willReadFrequently:!0},e));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",i({willReadFrequently:!0},e)),this.context&&this.context.measureText||(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",i({willReadFrequently:!0},e))}return this.canvas.width=10,this.canvas.height=10,this.canvas},t.prototype.getOrCreateContext=function(t,e){return this.context||this.getOrCreateCanvas(t,e),this.context},t}();!function(t){t[t.CAMERA_CHANGED=0]="CAMERA_CHANGED",t[t.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",t[t.NONE=2]="NONE"}(Fa||(Fa={}));var Xa,Za=function(){function t(t,e){this.globalRuntime=t,this.context=e,this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new Ca,initAsync:new Na,dirtycheck:new ka,cull:new ka,beginFrame:new Ca,beforeRender:new Ca,render:new Ca,afterRender:new Ca,endFrame:new Ca,destroy:new Ca,pick:new Sa,pickSync:new ka,pointerDown:new Ca,pointerUp:new Ca,pointerMove:new Ca,pointerOut:new Ca,pointerOver:new Ca,pointerWheel:new Ca,pointerCancel:new Ca,click:new Ca}}return t.prototype.init=function(t){var e=this,n=i(i({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach((function(t){t.apply(n,e.globalRuntime)})),this.hooks.init.call(),0===this.hooks.initAsync.getCallbacksNum()?(this.inited=!0,t()):this.hooks.initAsync.promise().then((function(){e.inited=!0,t()}))},t.prototype.getStats=function(){return this.stats},t.prototype.disableDirtyRectangleRendering=function(){return!this.context.config.renderer.getConfig().enableDirtyRectangleRendering||this.context.renderingContext.renderReasons.has(Fa.CAMERA_CHANGED)},t.prototype.render=function(t,e){var n=this;this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0;var r=this.context.renderingContext;if(this.globalRuntime.sceneGraphService.syncHierarchy(r.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),r.renderReasons.size&&this.inited){r.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var i=1===r.renderReasons.size&&r.renderReasons.has(Fa.CAMERA_CHANGED),o=!t.disableRenderHooks||!(t.disableRenderHooks&&i);o&&this.renderDisplayObject(r.root,t,r),this.hooks.beginFrame.call(),o&&r.renderListCurrentFrame.forEach((function(t){n.hooks.beforeRender.call(t),n.hooks.render.call(t),n.hooks.afterRender.call(t)})),this.hooks.endFrame.call(),r.renderListCurrentFrame=[],r.renderReasons.clear(),e()}},t.prototype.renderDisplayObject=function(t,e,n){var r=this,i=e.renderer.getConfig(),o=i.enableDirtyCheck,a=i.enableCulling;this.globalRuntime.enableCSSParsing&&this.globalRuntime.styleValueRegistry.recalc(t);var s=t.renderable,u=o?s.dirty||n.dirtyRectangleRenderingDisabled?t:null:t;if(u){var c=a?this.hooks.cull.call(u,this.context.camera):u;c&&(this.stats.rendered++,n.renderListCurrentFrame.push(c))}t.renderable.dirty=!1,t.sortable.renderOrder=this.zIndexCounter++,this.stats.total++;var l=t.sortable;l.dirty&&(this.sort(t,l),l.dirty=!1,l.dirtyChildren=[],l.dirtyReason=void 0),(l.sorted||t.childNodes).forEach((function(t){r.renderDisplayObject(t,e,n)}))},t.prototype.sort=function(t,e){e.sorted&&e.dirtyReason!==ei.Z_INDEX_CHANGED?e.dirtyChildren.forEach((function(n){if(-1===t.childNodes.indexOf(n)){var r=e.sorted.indexOf(n);r>=0&&e.sorted.splice(r,1)}else if(0===e.sorted.length)e.sorted.push(n);else{var i=function(t,e){for(var n=0,r=t.length;n<r;){var i=n+r>>>1;sa(t[i],e)<0?n=i+1:r=i}return n}(e.sorted,n);e.sorted.splice(i,0,n)}})):e.sorted=t.childNodes.slice().sort(sa)},t.prototype.destroy=function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()},t.prototype.dirtify=function(){this.context.renderingContext.renderReasons.add(Fa.DISPLAY_OBJECT_CHANGED)},t}(),Qa=/\[\s*(.*)=(.*)\s*\]/,Ja=function(){function t(){}return t.prototype.selectOne=function(t,e){var n=this;if(t.startsWith("."))return e.find((function(e){return((null==e?void 0:e.classList)||[]).indexOf(n.getIdOrClassname(t))>-1}));if(t.startsWith("#"))return e.find((function(e){return e.id===n.getIdOrClassname(t)}));if(t.startsWith("[")){var r=this.getAttribute(t),i=r.name,o=r.value;return i?e.find((function(t){return e!==t&&("name"===i?t.name===o:n.attributeToString(t,i)===o)})):null}return e.find((function(n){return e!==n&&n.nodeName===t}))},t.prototype.selectAll=function(t,e){var n=this;if(t.startsWith("."))return e.findAll((function(r){return e!==r&&((null==r?void 0:r.classList)||[]).indexOf(n.getIdOrClassname(t))>-1}));if(t.startsWith("#"))return e.findAll((function(r){return e!==r&&r.id===n.getIdOrClassname(t)}));if(t.startsWith("[")){var r=this.getAttribute(t),i=r.name,o=r.value;return i?e.findAll((function(t){return e!==t&&("name"===i?t.name===o:n.attributeToString(t,i)===o)})):[]}return e.findAll((function(n){return e!==n&&n.nodeName===t}))},t.prototype.is=function(t,e){if(t.startsWith("."))return e.className===this.getIdOrClassname(t);if(t.startsWith("#"))return e.id===this.getIdOrClassname(t);if(t.startsWith("[")){var n=this.getAttribute(t),r=n.name,i=n.value;return"name"===r?e.name===i:this.attributeToString(e,r)===i}return e.nodeName===t},t.prototype.getIdOrClassname=function(t){return t.substring(1)},t.prototype.getAttribute=function(t){var e=t.match(Qa),n="",r="";return e&&e.length>2&&(n=e[1].replace(/"/g,""),r=e[2].replace(/"/g,"")),{name:n,value:r}},t.prototype.attributeToString=function(t,e){if(!t.getAttribute)return"";var n=t.getAttribute(e);return Pt(n)?"":n.toString?n.toString():""},t}(),ts=function(t){function e(e,n,r,i,o,a,s,u){var c=t.call(this,null)||this;return c.relatedNode=n,c.prevValue=r,c.newValue=i,c.attrName=o,c.attrChange=a,c.prevParsedValue=s,c.newParsedValue=u,c.type=e,c}return r(e,t),e.ADDITION=2,e.MODIFICATION=1,e.REMOVAL=3,e}(Ga);function es(t){var e=t.renderable;e&&(e.renderBoundsDirty=!0,e.boundsDirty=!0)}!function(t){t.REPARENT="reparent",t.DESTROY="destroy",t.ATTR_MODIFIED="DOMAttrModified",t.INSERTED="DOMNodeInserted",t.REMOVED="removed",t.MOUNTED="DOMNodeInsertedIntoDocument",t.UNMOUNTED="DOMNodeRemovedFromDocument",t.BOUNDS_CHANGED="bounds-changed",t.CULLED="culled"}(Xa||(Xa={}));var ns,rs,is,os=new ts(Xa.REPARENT,null,"","","",0,"",""),as=function(){function t(t){var e,n,r,i,o,a,s,u,c=this;this.runtime=t,this.pendingEvents=[],this.boundsChangedEvent=new Ha(Xa.BOUNDS_CHANGED),this.rotate=(e=mt(),function(t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=0),"number"==typeof n&&(n=tt(n,r,i));var o=t.transformable;if(null!==t.parentNode&&t.parentNode.transformable){var a=mt();Et(a,n[0],n[1],n[2]);var s=c.getRotation(t),u=c.getRotation(t.parentNode);xt(e,u),bt(e,e),yt(a,e,a),yt(o.localRotation,a,s),Nt(o.localRotation,o.localRotation),c.dirtifyLocal(t,o)}else c.rotateLocal(t,n)}),this.rotateLocal=(n=mt(),function(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0),"number"==typeof e&&(e=tt(e,r,i));var o=t.transformable;Et(n,e[0],e[1],e[2]),Mt(o.localRotation,o.localRotation,n),c.dirtifyLocal(t,o)}),this.setEulerAngles=(r=mt(),function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=0),"number"==typeof e&&(e=tt(e,n,i));var o=t.transformable;if(null!==t.parentNode&&t.parentNode.transformable){Et(o.localRotation,e[0],e[1],e[2]);var a=c.getRotation(t.parentNode);xt(r,bt(mt(),a)),Mt(o.localRotation,o.localRotation,r),c.dirtifyLocal(t,o)}else c.setLocalEulerAngles(t,e)}),this.translateLocal=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=tt(e,n,r));var i=t.transformable;ht(e,Z())||(function(t,e,n){var r=n[0],i=n[1],o=n[2],a=n[3],s=e[0],u=e[1],c=e[2],l=i*c-o*u,h=o*s-r*c,d=r*u-i*s,f=i*d-o*h,p=o*l-r*d,g=r*h-i*l,m=2*a;l*=m,h*=m,d*=m,f*=2,p*=2,g*=2,t[0]=s+l+f,t[1]=u+h+p,t[2]=c+d+g}(e,e,i.localRotation),rt(i.localPosition,i.localPosition,e),c.dirtifyLocal(t,i))},this.setPosition=(i=E(),o=Z(),function(t,e){var n=t.transformable;if(o[0]=e[0],o[1]=e[1],o[2]=e[2]||0,!ht(c.getPosition(t),o)){if(et(n.position,o),null!==t.parentNode&&t.parentNode.transformable){var r=t.parentNode.transformable;x(i,r.worldTransform),C(i,i),lt(n.localPosition,o,i)}else et(n.localPosition,o);c.dirtifyLocal(t,n)}}),this.setLocalPosition=function(){var t=Z();return function(e,n){var r=e.transformable;t[0]=n[0],t[1]=n[1],t[2]=n[2]||0,ht(r.localPosition,t)||(et(r.localPosition,t),c.dirtifyLocal(e,r))}}(),this.translate=(a=Z(),s=Z(),u=Z(),function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=nt(s,e,n,r)),ht(e,a)||(rt(u,c.getPosition(t),e),c.setPosition(t,u))}),this.setRotation=function(){var t=mt();return function(e,n,r,i,o){var a=e.transformable;if("number"==typeof n&&(n=wt(n,r,i,o)),null!==e.parentNode&&e.parentNode.transformable){var s=c.getRotation(e.parentNode);xt(t,s),bt(t,t),yt(a.localRotation,t,n),Nt(a.localRotation,a.localRotation),c.dirtifyLocal(e,a)}else c.setLocalRotation(e,n)}},this.displayObjectDependencyMap=new WeakMap,this.calcLocalTransform=function(){var t=E(),e=Z(),n=wt(0,0,0,1);return function(r){if(0!==r.localSkew[0]||0!==r.localSkew[1]){if(B(r.localTransform,r.localRotation,r.localPosition,tt(1,1,1),r.origin),0!==r.localSkew[0]||0!==r.localSkew[1]){var i=N(t);i[4]=Math.tan(r.localSkew[0]),i[1]=Math.tan(r.localSkew[1]),T(r.localTransform,r.localTransform,i)}var o=B(t,n,e,r.localScale,r.origin);T(r.localTransform,r.localTransform,o)}else B(r.localTransform,r.localRotation,r.localPosition,r.localScale,r.origin)}}()}return t.prototype.matches=function(t,e){return this.runtime.sceneGraphSelector.is(t,e)},t.prototype.querySelector=function(t,e){return this.runtime.sceneGraphSelector.selectOne(t,e)},t.prototype.querySelectorAll=function(t,e){return this.runtime.sceneGraphSelector.selectAll(t,e)},t.prototype.attach=function(t,e,n){var r,i,o=!1;t.parentNode&&(o=t.parentNode!==e,this.detach(t)),t.parentNode=e,Pt(n)?t.parentNode.childNodes.push(t):t.parentNode.childNodes.splice(n,0,t);var a=e.sortable;((null===(r=null==a?void 0:a.sorted)||void 0===r?void 0:r.length)||(null===(i=t.style)||void 0===i?void 0:i.zIndex))&&(-1===a.dirtyChildren.indexOf(t)&&a.dirtyChildren.push(t),a.dirty=!0,a.dirtyReason=ei.ADDED);var s=t.transformable;s&&this.dirtifyWorld(t,s),s.frozen&&this.unfreezeParentToRoot(t),o&&t.dispatchEvent(os)},t.prototype.detach=function(t){var e,n;if(t.parentNode){var r=t.transformable,i=t.parentNode.sortable;((null===(e=null==i?void 0:i.sorted)||void 0===e?void 0:e.length)||(null===(n=t.style)||void 0===n?void 0:n.zIndex))&&(-1===i.dirtyChildren.indexOf(t)&&i.dirtyChildren.push(t),i.dirty=!0,i.dirtyReason=ei.REMOVED);var o=t.parentNode.childNodes.indexOf(t);o>-1&&t.parentNode.childNodes.splice(o,1),r&&this.dirtifyWorld(t,r),t.parentNode=null}},t.prototype.getOrigin=function(t){return t.transformable.origin},t.prototype.setOrigin=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=[e,n,r]);var i=t.transformable;if(e[0]!==i.origin[0]||e[1]!==i.origin[1]||e[2]!==i.origin[2]){var o=i.origin;o[0]=e[0],o[1]=e[1],o[2]=e[2]||0,this.dirtifyLocal(t,i)}},t.prototype.setLocalEulerAngles=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=tt(e,n,r));var i=t.transformable;Et(i.localRotation,e[0],e[1],e[2]),this.dirtifyLocal(t,i)},t.prototype.scaleLocal=function(t,e){var n=t.transformable;!function(t,e,n){t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2]}(n.localScale,n.localScale,tt(e[0],e[1],e[2]||1)),this.dirtifyLocal(t,n)},t.prototype.setLocalScale=function(t,e){var n=t.transformable,r=tt(e[0],e[1],e[2]||n.localScale[2]);ht(r,n.localScale)||(et(n.localScale,r),this.dirtifyLocal(t,n))},t.prototype.setLocalRotation=function(t,e,n,r,i){"number"==typeof e&&(e=wt(e,n,r,i));var o=t.transformable;xt(o.localRotation,e),this.dirtifyLocal(t,o)},t.prototype.setLocalSkew=function(t,e,n){"number"==typeof e&&(e=function(t,e){var n=new y(2);return n[0]=t,n[1]=e,n}(e,n));var r=t.transformable;!function(t,e){t[0]=e[0],t[1]=e[1]}(r.localSkew,e),this.dirtifyLocal(t,r)},t.prototype.dirtifyLocal=function(t,e){e.localDirtyFlag||(e.localDirtyFlag=!0,e.dirtyFlag||this.dirtifyWorld(t,e))},t.prototype.dirtifyWorld=function(t,e){e.dirtyFlag||this.unfreezeParentToRoot(t),this.dirtifyWorldInternal(t,e),this.dirtifyToRoot(t,!0)},t.prototype.triggerPendingEvents=function(){var t=this,e=new Set,n=function(n,r){n.isConnected&&!e.has(n.entity)&&(t.boundsChangedEvent.detail=r,t.boundsChangedEvent.target=n,n.isMutationObserved?n.dispatchEvent(t.boundsChangedEvent):n.ownerDocument.defaultView.dispatchEvent(t.boundsChangedEvent,!0),e.add(n.entity))};this.pendingEvents.forEach((function(t){var e=c(t,2),r=e[0],i=e[1];i.affectChildren?r.forEach((function(t){n(t,i)})):n(r,i)})),this.clearPendingEvents(),e.clear()},t.prototype.clearPendingEvents=function(){this.pendingEvents=[]},t.prototype.dirtifyToRoot=function(t,e){void 0===e&&(e=!1);var n=t;for(n.renderable&&(n.renderable.dirty=!0);n;)es(n),n=n.parentNode;e&&t.forEach((function(t){es(t)})),this.informDependentDisplayObjects(t),this.pendingEvents.push([t,{affectChildren:e}])},t.prototype.updateDisplayObjectDependency=function(t,e,n,r){if(e&&e!==n){var i=this.displayObjectDependencyMap.get(e);if(i&&i[t]){var o=i[t].indexOf(r);i[t].splice(o,1)}}if(n){var a=this.displayObjectDependencyMap.get(n);a||(this.displayObjectDependencyMap.set(n,{}),a=this.displayObjectDependencyMap.get(n)),a[t]||(a[t]=[]),a[t].push(r)}},t.prototype.informDependentDisplayObjects=function(t){var e=this,n=this.displayObjectDependencyMap.get(t);n&&Object.keys(n).forEach((function(t){n[t].forEach((function(n){e.dirtifyToRoot(n,!0),n.dispatchEvent(new ts(Xa.ATTR_MODIFIED,n,e,e,t,ts.MODIFICATION,e,e)),n.isCustomElement&&n.isConnected&&n.attributeChangedCallback&&n.attributeChangedCallback(t,e,e)}))}))},t.prototype.getPosition=function(t){var e=t.transformable;return I(e.position,this.getWorldTransform(t,e))},t.prototype.getRotation=function(t){var e=t.transformable;return z(e.rotation,this.getWorldTransform(t,e))},t.prototype.getScale=function(t){var e=t.transformable;return j(e.scaling,this.getWorldTransform(t,e))},t.prototype.getWorldTransform=function(t,e){return void 0===e&&(e=t.transformable),e.localDirtyFlag||e.dirtyFlag?(t.parentNode&&t.parentNode.transformable&&this.getWorldTransform(t.parentNode),this.sync(t,e),e.worldTransform):e.worldTransform},t.prototype.getLocalPosition=function(t){return t.transformable.localPosition},t.prototype.getLocalRotation=function(t){return t.transformable.localRotation},t.prototype.getLocalScale=function(t){return t.transformable.localScale},t.prototype.getLocalSkew=function(t){return t.transformable.localSkew},t.prototype.getLocalTransform=function(t){var e=t.transformable;return e.localDirtyFlag&&(this.calcLocalTransform(e),e.localDirtyFlag=!1),e.localTransform},t.prototype.setLocalTransform=function(t,e){var n=I(Z(),e),r=z(mt(),e),i=j(Z(),e);this.setLocalScale(t,i),this.setLocalPosition(t,n),this.setLocalRotation(t,r)},t.prototype.resetLocalTransform=function(t){this.setLocalScale(t,[1,1,1]),this.setLocalPosition(t,[0,0,0]),this.setLocalEulerAngles(t,[0,0,0]),this.setLocalSkew(t,[0,0])},t.prototype.getTransformedGeometryBounds=function(t,e,n){void 0===e&&(e=!1);var r=this.getGeometryBounds(t,e);if(mr.isEmpty(r))return null;var i=n||new mr;return i.setFromTransformedAABB(r,this.getWorldTransform(t)),i},t.prototype.getGeometryBounds=function(t,e){void 0===e&&(e=!1);var n=t.geometry;return(e?n.renderBounds:n.contentBounds||null)||new mr},t.prototype.getBounds=function(t,e){var n=this;void 0===e&&(e=!1);var r=t.renderable;if(!r.boundsDirty&&!e&&r.bounds)return r.bounds;if(!r.renderBoundsDirty&&e&&r.renderBounds)return r.renderBounds;var i=e?r.renderBounds:r.bounds,o=this.getTransformedGeometryBounds(t,e,i);if(t.childNodes.forEach((function(t){var r=n.getBounds(t,e);r&&(o?o.add(r):(o=i||new mr).update(r.center,r.halfExtents))})),o||(o=new mr),e){var a=ua(t);if(a){var s=a.parsedStyle.clipPath.getBounds(e);o?s&&(o=s.intersection(o)):o.update(s.center,s.halfExtents)}}return e?(r.renderBounds=o,r.renderBoundsDirty=!1):(r.bounds=o,r.boundsDirty=!1),o},t.prototype.getLocalBounds=function(t){if(t.parentNode){var e=E();t.parentNode.transformable&&(e=C(E(),this.getWorldTransform(t.parentNode)));var n=this.getBounds(t);if(!mr.isEmpty(n)){var r=new mr;return r.setFromTransformedAABB(n,e),r}}return this.getBounds(t)},t.prototype.getBoundingClientRect=function(t){var e,n,r,i=this.getGeometryBounds(t);mr.isEmpty(i)||(r=new mr).setFromTransformedAABB(i,this.getWorldTransform(t));var o=null===(n=null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView)||void 0===n?void 0:n.getContextService().getBoundingClientRect();if(r){var a=c(r.getMin(),2),s=a[0],u=a[1],l=c(r.getMax(),2),h=l[0],d=l[1];return new Mr(s+((null==o?void 0:o.left)||0),u+((null==o?void 0:o.top)||0),h-s,d-u)}return new Mr((null==o?void 0:o.left)||0,(null==o?void 0:o.top)||0,0,0)},t.prototype.dirtifyWorldInternal=function(t,e){var n=this;if(!e.dirtyFlag){e.dirtyFlag=!0,e.frozen=!1,t.childNodes.forEach((function(t){var e=t.transformable;e.dirtyFlag||n.dirtifyWorldInternal(t,e)}));var r=t.renderable;r&&(r.renderBoundsDirty=!0,r.boundsDirty=!0,r.dirty=!0)}},t.prototype.syncHierarchy=function(t){var e=t.transformable;if(!e.frozen){e.frozen=!0,(e.localDirtyFlag||e.dirtyFlag)&&this.sync(t,e);for(var n=t.childNodes,r=0;r<n.length;r++)this.syncHierarchy(n[r])}},t.prototype.sync=function(t,e){if(e.localDirtyFlag&&(this.calcLocalTransform(e),e.localDirtyFlag=!1),e.dirtyFlag){var n=t.parentNode,r=n&&n.transformable;null!==n&&r?T(e.worldTransform,r.worldTransform,e.localTransform):x(e.worldTransform,e.localTransform),e.dirtyFlag=!1}},t.prototype.unfreezeParentToRoot=function(t){for(var e=t.parentNode;e;){var n=e.transformable;n&&(n.frozen=!1),e=e.parentNode}},t}(),ss={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},us=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,cs=new RegExp("".concat(/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/.source,"|").concat(/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹓﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/.source,"|").concat(/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/.source,"|").concat(/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/.source)),ls=new RegExp("".concat(/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/.source,"|").concat(/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/.source,"|").concat(/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/.source,"|").concat(/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/.source)),hs=function(){function t(t){var e=this;this.runtime=t,this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(t,n){return!e.isBreakingSpace(n)&&!(!t||!ls.exec(n)&&!cs.exec(t))},this.trimByKinsokuShorui=function(t){var e=l([],c(t),!1),n=e[e.length-2];if(!n)return t;var r=n[n.length-1];return e[e.length-2]=n.slice(0,-1),e[e.length-1]=r+e[e.length-1],e}}return t.prototype.measureFont=function(t,e){if(this.fontMetricsCache[t])return this.fontMetricsCache[t];var n={ascent:0,descent:0,fontSize:0},r=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(e),i=this.runtime.offscreenCanvasCreator.getOrCreateContext(e,{willReadFrequently:!0});i.font=t;var o=ss.MetricsString+ss.BaselineSymbol,a=Math.ceil(i.measureText(o).width),s=Math.ceil(i.measureText(ss.BaselineSymbol).width),u=ss.HeightMultiplier*s;s=s*ss.BaselineMultiplier|0,r.width=a,r.height=u,i.fillStyle="#f00",i.fillRect(0,0,a,u),i.font=t,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(o,0,s);var c=i.getImageData(0,0,a||1,u||1).data,l=c.length,h=4*a,d=0,f=0,p=!1;for(d=0;d<s;++d){for(var g=0;g<h;g+=4)if(255!==c[f+g]){p=!0;break}if(p)break;f+=h}for(n.ascent=s-d,f=l-h,p=!1,d=u;d>s;--d){for(g=0;g<h;g+=4)if(255!==c[f+g]){p=!0;break}if(p)break;f-=h}return n.descent=d-s,n.fontSize=n.ascent+n.descent,this.fontMetricsCache[t]=n,n},t.prototype.measureText=function(t,e,n){var r=e.fontSize,i=e.wordWrap,o=e.lineHeight,a=e.lineWidth,s=e.textBaseline,u=e.textAlign,c=e.letterSpacing,l=e.textPath;e.textPathSide,e.textPathStartOffset;var h=e.leading,d=void 0===h?0:h,f=function(t){for(var e=t.fontSize,n=t.fontFamily,r=t.fontStyle,i=t.fontVariant,o=t.fontWeight,a=Wt(e)&&"".concat(e,"px")||"16px",s=n.split(","),u=s.length-1;u>=0;u--){var c=s[u].trim();!Pa.test(c)&&Ta.indexOf(c)<0&&(c='"'.concat(c,'"')),s[u]=c}return"".concat(r," ").concat(i," ").concat(o," ").concat(a," ").concat(s.join(","))}(e),p=this.measureFont(f,n);0===p.fontSize&&(p.fontSize=r,p.ascent=r);var g=this.runtime.offscreenCanvasCreator.getOrCreateContext(n);g.font=f,e.isOverflowing=!1;var m=(i?this.wordWrap(t,e,n):t).split(/(?:\r\n|\r|\n)/),v=new Array(m.length),y=0;if(!l){for(M=0;M<m.length;M++){var b=g.measureText(m[M]).width+(m[M].length-1)*c;v[M]=b,y=Math.max(y,b)}N=y+a;var E=o||p.fontSize+a,w=Math.max(E,p.fontSize+a)+(m.length-1)*(E+d),x=0;return"middle"===s?x=-w/2:"bottom"===s||"alphabetic"===s||"ideographic"===s?x=-w:"top"!==s&&"hanging"!==s||(x=0),{font:f,width:N,height:w,lines:m,lineWidths:v,lineHeight:E+=d,maxLineWidth:y,fontProperties:p,lineMetrics:v.map((function(t,e){var n=0;return"center"===u||"middle"===u?n-=t/2:"right"!==u&&"end"!==u||(n-=t),new Mr(n-a/2,x+e*E,t+a,E)}))}}l.getTotalLength();for(var M=0;M<m.length;M++)var N=g.measureText(m[M]).width+(m[M].length-1)*c},t.prototype.setGraphemeOnPath=function(){},t.prototype.wordWrap=function(t,e,n){var r=this,i=e.wordWrapWidth,o=void 0===i?0:i,a=e.letterSpacing,s=e.maxLines,u=void 0===s?1/0:s,c=e.textOverflow,l=this.runtime.offscreenCanvasCreator.getOrCreateContext(n),h=o+a,d="";"ellipsis"===c?d="...":c&&"clip"!==c&&(d=c);for(var f=[],p=0,g=0,m={},v=function(t){return r.getFromCache(t,a,m,l)},y=Array.from(d).reduce((function(t,e){return t+v(e)}),0),b=Array.from(t),E=0;E<b.length;E++){var w=b[E],x=t[E-1],M=t[E+1],N=v(w);if(this.isNewline(w)){if(++p>=u){e.isOverflowing=!0;break}g=0,f[p]=""}else{if(g>0&&g+N>h){if(p+1>=u){if(e.isOverflowing=!0,y>0&&y<=h){for(var S=f[p].length,C=0,k=S,T=0;T<S;T++){var P=v(f[p][T]);if(C+P+y>h){k=T;break}C+=P}f[p]=(f[p]||"").slice(0,k)+d}break}if(g=0,f[++p]="",this.isBreakingSpace(w))continue;this.canBreakInLastChar(w)||(f=this.trimToBreakable(f),g=this.sumTextWidthByCache(f[p]||"",m)),this.shouldBreakByKinsokuShorui(w,M)&&(f=this.trimByKinsokuShorui(f),g+=v(x||""))}g+=N,f[p]=(f[p]||"")+w}}return f.join("\n")},t.prototype.isBreakingSpace=function(t){return"string"==typeof t&&ss.BreakingSpaces.indexOf(t.charCodeAt(0))>=0},t.prototype.isNewline=function(t){return"string"==typeof t&&ss.Newlines.indexOf(t.charCodeAt(0))>=0},t.prototype.trimToBreakable=function(t){var e=l([],c(t),!1),n=e[e.length-2],r=this.findBreakableIndex(n);if(-1===r||!n)return e;var i=n.slice(r,r+1),o=r+1,a=r+(this.isBreakingSpace(i)?0:1);return e[e.length-1]+=n.slice(o,n.length),e[e.length-2]=n.slice(0,a),e},t.prototype.canBreakInLastChar=function(t){return!t||!us.test(t)},t.prototype.sumTextWidthByCache=function(t,e){return t.split("").reduce((function(t,n){if(!e[n])throw Error("cannot count the word without cache");return t+e[n]}),0)},t.prototype.findBreakableIndex=function(t){for(var e=t.length-1;e>=0;e--)if(!us.test(t[e]))return e;return-1},t.prototype.getFromCache=function(t,e,n,r){var i=n[t];if("number"!=typeof i){var o=t.length*e;i=r.measureText(t).width+o,n[t]=i}return i},t}(),ds={},fs=(rs=new za,is=new ja,(ns={})[$n.CIRCLE]=new Ra,ns[$n.ELLIPSE]=new La,ns[$n.RECT]=rs,ns[$n.IMAGE]=rs,ns[$n.GROUP]=rs,ns[$n.LINE]=new Da,ns[$n.TEXT]=new Ba(ds),ns[$n.POLYLINE]=is,ns[$n.POLYGON]=is,ns[$n.PATH]=new Ia,ns[$n.HTML]=null,ns[$n.MESH]=null,ns),ps=function(){var t,e=new Bo,n=new Vo;return(t={})[pi.PERCENTAGE]=null,t[pi.NUMBER]=new Ko,t[pi.ANGLE]=new jo,t[pi.DEFINED_PATH]=new zo,t[pi.PAINT]=e,t[pi.COLOR]=e,t[pi.FILTER]=new Fo,t[pi.LENGTH]=n,t[pi.LENGTH_PERCENTAGE]=n,t[pi.LENGTH_PERCENTAGE_12]=new Wo,t[pi.LENGTH_PERCENTAGE_14]=new Uo,t[pi.COORDINATE]=new $o,t[pi.OFFSET_DISTANCE]=new Xo,t[pi.OPACITY_VALUE]=new Zo,t[pi.PATH]=new Qo,t[pi.LIST_OF_POINTS]=new Jo,t[pi.SHADOW_BLUR]=new ta,t[pi.TEXT]=new ea,t[pi.TEXT_TRANSFORM]=new na,t[pi.TRANSFORM]=new Aa,t[pi.TRANSFORM_ORIGIN]=new Oa,t[pi.Z_INDEX]=new _a,t[pi.MARKER]=new Yo,t}();ds.CameraContribution=Rr,ds.AnimationTimeline=null,ds.EasingFunction=null,ds.offscreenCanvasCreator=new Ka,ds.sceneGraphSelector=new Ja,ds.sceneGraphService=new as(ds),ds.textService=new hs(ds),ds.geometryUpdaterFactory=fs,ds.CSSPropertySyntaxFactory=ps,ds.styleValueRegistry=new Io(ds),ds.layoutRegistry=null,ds.globalThis="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},ds.enableCSSParsing=!0,ds.enableDataset=!1,ds.enableStyleSyntax=!0,ds.enableSizeAttenuation=!1;var gs=0,ms=new ts(Xa.INSERTED,null,"","","",0,"",""),vs=new ts(Xa.REMOVED,null,"","","",0,"",""),ys=new Ha(Xa.DESTROY),bs=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.entity=gs++,e.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},e.cullable={strategy:ti.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},e.transformable={dirtyFlag:!1,localDirtyFlag:!1,frozen:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},e.sortable={dirty:!1,sorted:void 0,renderOrder:0,dirtyChildren:[],dirtyReason:void 0},e.geometry={contentBounds:void 0,renderBounds:void 0},e.rBushNode={aabb:void 0},e.namespaceURI="g",e.scrollLeft=0,e.scrollTop=0,e.clientTop=0,e.clientLeft=0,e.destroyed=!1,e.style={},e.computedStyle=ds.enableCSSParsing?{anchor:ii,opacity:ii,fillOpacity:ii,strokeOpacity:ii,fill:ii,stroke:ii,transform:ii,transformOrigin:ii,visibility:ii,pointerEvents:ii,lineWidth:ii,lineCap:ii,lineJoin:ii,increasedLineWidthForHitTesting:ii,fontSize:ii,fontFamily:ii,fontStyle:ii,fontWeight:ii,fontVariant:ii,textAlign:ii,textBaseline:ii,textTransform:ii,zIndex:ii,filter:ii,shadowType:ii}:null,e.parsedStyle={},e.attributes={},e}return r(e,t),Object.defineProperty(e.prototype,"className",{get:function(){return this.getAttribute("class")||""},set:function(t){this.setAttribute("class",t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"classList",{get:function(){return this.className.split(" ").filter((function(t){return""!==t}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tagName",{get:function(){return this.nodeName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){return this.childNodes.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){return this.firstChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){return this.lastChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentElement",{get:function(){return this.parentNode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){if(this.parentNode){var t=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[t+1]||null}return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){if(this.parentNode){var t=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[t-1]||null}return null},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(t){throw new Error(Nr)},e.prototype.appendChild=function(t,e){var n;if(t.destroyed)throw new Error("Cannot append a destroyed element.");return ds.sceneGraphService.attach(t,this,e),(null===(n=this.ownerDocument)||void 0===n?void 0:n.defaultView)&&this.ownerDocument.defaultView.mountChildren(t),ms.relatedNode=this,t.dispatchEvent(ms),t},e.prototype.insertBefore=function(t,e){if(e){t.parentElement&&t.parentElement.removeChild(t);var n=this.childNodes.indexOf(e);-1===n?this.appendChild(t):this.appendChild(t,n)}else this.appendChild(t);return t},e.prototype.replaceChild=function(t,e){var n=this.childNodes.indexOf(e);return this.removeChild(e),this.appendChild(t,n),e},e.prototype.removeChild=function(t){var e;return vs.relatedNode=this,t.dispatchEvent(vs),(null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView)&&t.ownerDocument.defaultView.unmountChildren(t),ds.sceneGraphService.detach(t),t},e.prototype.removeChildren=function(){for(var t=this.childNodes.length-1;t>=0;t--){var e=this.childNodes[t];this.removeChild(e)}},e.prototype.destroyChildren=function(){for(var t=this.childNodes.length-1;t>=0;t--){var e=this.childNodes[t];e.childNodes.length&&e.destroyChildren(),e.destroy()}},e.prototype.matches=function(t){return ds.sceneGraphService.matches(t,this)},e.prototype.getElementById=function(t){return ds.sceneGraphService.querySelector("#".concat(t),this)},e.prototype.getElementsByName=function(t){return ds.sceneGraphService.querySelectorAll('[name="'.concat(t,'"]'),this)},e.prototype.getElementsByClassName=function(t){return ds.sceneGraphService.querySelectorAll(".".concat(t),this)},e.prototype.getElementsByTagName=function(t){return ds.sceneGraphService.querySelectorAll(t,this)},e.prototype.querySelector=function(t){return ds.sceneGraphService.querySelector(t,this)},e.prototype.querySelectorAll=function(t){return ds.sceneGraphService.querySelectorAll(t,this)},e.prototype.closest=function(t){var e=this;do{if(ds.sceneGraphService.matches(t,e))return e;e=e.parentElement}while(null!==e);return null},e.prototype.find=function(t){var e=this,n=null;return this.forEach((function(r){return!(r===e||!t(r))&&(n=r,!0)})),n},e.prototype.findAll=function(t){var e=this,n=[];return this.forEach((function(r){r!==e&&t(r)&&n.push(r)})),n},e.prototype.after=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(this.parentNode){var r=this.parentNode.childNodes.indexOf(this);e.forEach((function(e,n){var i;return null===(i=t.parentNode)||void 0===i?void 0:i.appendChild(e,r+n+1)}))}},e.prototype.before=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(this.parentNode){var r=this.parentNode.childNodes.indexOf(this),i=c(e),o=i[0],a=i.slice(1);this.parentNode.appendChild(o,r),(t=o).after.apply(t,l([],c(a),!1))}},e.prototype.replaceWith=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.after.apply(this,l([],c(t),!1)),this.remove()},e.prototype.append=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e.forEach((function(e){return t.appendChild(e)}))},e.prototype.prepend=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e.forEach((function(e,n){return t.appendChild(e,n)}))},e.prototype.replaceChildren=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,l([],c(t),!1))},e.prototype.remove=function(){return this.parentNode?this.parentNode.removeChild(this):this},e.prototype.destroy=function(){this.dispatchEvent(ys),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0},e.prototype.getGeometryBounds=function(){return ds.sceneGraphService.getGeometryBounds(this)},e.prototype.getRenderBounds=function(){return ds.sceneGraphService.getBounds(this,!0)},e.prototype.getBounds=function(){return ds.sceneGraphService.getBounds(this)},e.prototype.getLocalBounds=function(){return ds.sceneGraphService.getLocalBounds(this)},e.prototype.getBoundingClientRect=function(){return ds.sceneGraphService.getBoundingClientRect(this)},e.prototype.getClientRects=function(){return[this.getBoundingClientRect()]},e.prototype.computedStyleMap=function(){return new Map(Object.entries(this.computedStyle))},e.prototype.getAttributeNames=function(){return Object.keys(this.attributes)},e.prototype.getAttribute=function(t){if(function(t){return"symbol"==typeof t}(t))return ds.enableCSSParsing?null:void 0;var e=this.attributes[t];if(void 0===e){var n=Kr(t);return e=this.attributes[n],ds.enableCSSParsing&&Pt(e)?null:e}return e},e.prototype.hasAttribute=function(t){return this.getAttributeNames().includes(t)},e.prototype.hasAttributes=function(){return!!this.getAttributeNames().length},e.prototype.removeAttribute=function(t){this.setAttribute(t,null),delete this.attributes[t]},e.prototype.setAttribute=function(t,e,n){this.attributes[t]=e},e.prototype.getAttributeNS=function(t,e){throw new Error(Nr)},e.prototype.getAttributeNode=function(t){throw new Error(Nr)},e.prototype.getAttributeNodeNS=function(t,e){throw new Error(Nr)},e.prototype.hasAttributeNS=function(t,e){throw new Error(Nr)},e.prototype.removeAttributeNS=function(t,e){throw new Error(Nr)},e.prototype.removeAttributeNode=function(t){throw new Error(Nr)},e.prototype.setAttributeNS=function(t,e,n){throw new Error(Nr)},e.prototype.setAttributeNode=function(t){throw new Error(Nr)},e.prototype.setAttributeNodeNS=function(t){throw new Error(Nr)},e.prototype.toggleAttribute=function(t,e){throw new Error(Nr)},e}($a);function Es(t){return!!(null==t?void 0:t.nodeName)}var ws,xs=new ts(Xa.ATTR_MODIFIED,null,null,null,null,ts.MODIFICATION,null,null),Ms={anchor:"",opacity:"",fillOpacity:"",strokeOpacity:"",fill:"",stroke:"",transform:"",transformOrigin:"",visibility:"",pointerEvents:"",lineWidth:"",lineCap:"",lineJoin:"",increasedLineWidthForHitTesting:"",fontSize:"",fontFamily:"",fontStyle:"",fontWeight:"",fontVariant:"",textAlign:"",textBaseline:"",textTransform:"",zIndex:"",filter:"",shadowType:""},Ns={anchor:[0,0],fill:ci,stroke:ci,transform:[],zIndex:0,filter:[],shadowType:"outer",miterLimit:10},Ss=i(i({},Ns),{opacity:1,fillOpacity:1,strokeOpacity:1,visibility:"visible",pointerEvents:"auto",lineWidth:1,lineCap:"butt",lineJoin:"miter",increasedLineWidthForHitTesting:0,fillRule:"nonzero"}),Cs=l(l([],c(["opacity","fillOpacity","strokeOpacity","transformOrigin","visibility","pointerEvents","lineWidth","lineCap","lineJoin","increasedLineWidthForHitTesting"]),!1),["fontSize","fontFamily","fontStyle","fontWeight","fontVariant","textAlign","textBaseline","textTransform"],!1),ks="data-",Ts=function(t){function e(e){var n,r=t.call(this)||this;r.isCustomElement=!1,r.isMutationObserved=!1,r.activeAnimations=[],r.getClip=function(){return this.style.clipPath||null},r.config=e,r.config.interactive=null!==(n=r.config.capture)&&void 0!==n?n:r.config.interactive,r.id=r.config.id||"",r.name=r.config.name||"",(r.config.className||r.config.class)&&(r.className=r.config.className||r.config.class),r.nodeName=r.config.type||$n.GROUP,r.config.style=r.config.style||r.config.attrs||{},Object.assign(r.config.style,r.config.attrs),null!=r.config.visible&&(r.config.style.visibility=!1===r.config.visible?"hidden":"visible"),null!=r.config.interactive&&(r.config.style.pointerEvents=!1===r.config.interactive?"none":"auto"),Object.assign(r.parsedStyle,ds.enableCSSParsing?Ns:Ss,r.config.initialParsedStyle),ds.enableCSSParsing&&Object.assign(r.attributes,Ms),r.initAttributes(r.config.style);var i=ds.globalThis.Proxy?ds.globalThis.Proxy:function(){};return ds.enableDataset&&(r.dataset=new i({},{get:function(t,e){var n="".concat(ks).concat(qr(e));return void 0!==t[n]?t[n]:r.getAttribute(n)},set:function(t,e,n){return r.setAttribute("".concat(ks).concat(qr(e)),n),!0}})),ds.enableStyleSyntax&&(r.style=new i({setProperty:function(t,e){r.setAttribute(t,e)},getPropertyValue:function(t){return r.getAttribute(t)},removeProperty:function(t){r.removeAttribute(t)},item:function(){return""}},{get:function(t,e){return void 0!==t[e]?t[e]:r.getAttribute(e)},set:function(t,e,n){return r.setAttribute(e,n),!0}})),r}return r(e,t),e.prototype.destroy=function(){t.prototype.destroy.call(this),this.getAnimations().forEach((function(t){t.cancel()}))},e.prototype.cloneNode=function(t,e){var n=i({},this.attributes);for(var r in n){var o=n[r];Es(o)&&"clipPath"!==r&&"offsetPath"!==r&&"textPath"!==r&&(n[r]=o.cloneNode(t)),e&&(n[r]=e(r,o))}var a=new this.constructor({id:this.id,name:this.name,className:this.name,interactive:this.interactive,style:n});return a.setLocalTransform(this.getLocalTransform()),t&&this.children.forEach((function(e){if(!e.style.isMarker){var n=e.cloneNode(t);a.appendChild(n)}})),a},e.prototype.initAttributes=function(t){void 0===t&&(t={});var e=this.renderable,n={forceUpdateGeometry:!0};ds.enableCSSParsing&&(n.usedAttributes=Cs);var r={};for(var i in t){r[Kr(i)]=t[i]}ds.styleValueRegistry.processProperties(this,r,n),e.dirty=!0},e.prototype.setAttribute=function(e,n,r,i){void 0===r&&(r=!1),void 0===i&&(i=!0);var o=Kr(e);Qt(n)||(r||n!==this.attributes[o])&&(this.internalSetAttribute(o,n,{memoize:i}),t.prototype.setAttribute.call(this,o,n))},e.prototype.internalSetAttribute=function(t,e,n){var r;void 0===n&&(n={});var i=this.renderable,o=this.attributes[t],a=this.parsedStyle[t];ds.styleValueRegistry.processProperties(this,((r={})[t]=e,r),n),i.dirty=!0;var s=this.parsedStyle[t];this.isConnected&&(xs.relatedNode=this,xs.prevValue=o,xs.newValue=e,xs.attrName=t,xs.prevParsedValue=a,xs.newParsedValue=s,this.isMutationObserved?this.dispatchEvent(xs):(xs.target=this,this.ownerDocument.defaultView.dispatchEvent(xs,!0))),(this.isCustomElement&&this.isConnected||!this.isCustomElement)&&this.attributeChangedCallback&&this.attributeChangedCallback(t,o,e,a,s)},e.prototype.getBBox=function(){var t=this.getBounds(),e=c(t.getMin(),2),n=e[0],r=e[1],i=c(t.getMax(),2),o=i[0],a=i[1];return new Mr(n,r,o-n,a-r)},e.prototype.setOrigin=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),ds.sceneGraphService.setOrigin(this,rr(t,e,n)),this},e.prototype.getOrigin=function(){return ds.sceneGraphService.getOrigin(this)},e.prototype.setPosition=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),ds.sceneGraphService.setPosition(this,rr(t,e,n)),this},e.prototype.setLocalPosition=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),ds.sceneGraphService.setLocalPosition(this,rr(t,e,n)),this},e.prototype.translate=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),ds.sceneGraphService.translate(this,rr(t,e,n)),this},e.prototype.translateLocal=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),ds.sceneGraphService.translateLocal(this,rr(t,e,n)),this},e.prototype.getPosition=function(){return ds.sceneGraphService.getPosition(this)},e.prototype.getLocalPosition=function(){return ds.sceneGraphService.getLocalPosition(this)},e.prototype.scale=function(t,e,n){return this.scaleLocal(t,e,n)},e.prototype.scaleLocal=function(t,e,n){return"number"==typeof t&&(t=rr(t,e=e||t,n=n||t)),ds.sceneGraphService.scaleLocal(this,t),this},e.prototype.setLocalScale=function(t,e,n){return"number"==typeof t&&(t=rr(t,e=e||t,n=n||t)),ds.sceneGraphService.setLocalScale(this,t),this},e.prototype.getLocalScale=function(){return ds.sceneGraphService.getLocalScale(this)},e.prototype.getScale=function(){return ds.sceneGraphService.getScale(this)},e.prototype.getEulerAngles=function(){return or(c(ar(Z(),ds.sceneGraphService.getWorldTransform(this)),3)[2])},e.prototype.getLocalEulerAngles=function(){return or(c(ar(Z(),ds.sceneGraphService.getLocalRotation(this)),3)[2])},e.prototype.setEulerAngles=function(t){return ds.sceneGraphService.setEulerAngles(this,0,0,t),this},e.prototype.setLocalEulerAngles=function(t){return ds.sceneGraphService.setLocalEulerAngles(this,0,0,t),this},e.prototype.rotateLocal=function(t,e,n){return Pt(e)&&Pt(n)?ds.sceneGraphService.rotateLocal(this,0,0,t):ds.sceneGraphService.rotateLocal(this,t,e,n),this},e.prototype.rotate=function(t,e,n){return Pt(e)&&Pt(n)?ds.sceneGraphService.rotate(this,0,0,t):ds.sceneGraphService.rotate(this,t,e,n),this},e.prototype.setRotation=function(t,e,n,r){return ds.sceneGraphService.setRotation(this,t,e,n,r),this},e.prototype.setLocalRotation=function(t,e,n,r){return ds.sceneGraphService.setLocalRotation(this,t,e,n,r),this},e.prototype.setLocalSkew=function(t,e){return ds.sceneGraphService.setLocalSkew(this,t,e),this},e.prototype.getRotation=function(){return ds.sceneGraphService.getRotation(this)},e.prototype.getLocalRotation=function(){return ds.sceneGraphService.getLocalRotation(this)},e.prototype.getLocalSkew=function(){return ds.sceneGraphService.getLocalSkew(this)},e.prototype.getLocalTransform=function(){return ds.sceneGraphService.getLocalTransform(this)},e.prototype.getWorldTransform=function(){return ds.sceneGraphService.getWorldTransform(this)},e.prototype.setLocalTransform=function(t){return ds.sceneGraphService.setLocalTransform(this,t),this},e.prototype.resetLocalTransform=function(){ds.sceneGraphService.resetLocalTransform(this)},e.prototype.getAnimations=function(){return this.activeAnimations},e.prototype.animate=function(t,e){var n,r=null===(n=this.ownerDocument)||void 0===n?void 0:n.timeline;return r?r.play(this,t,e):null},e.prototype.isVisible=function(){var t;return"visible"===(null===(t=this.parsedStyle)||void 0===t?void 0:t.visibility)},Object.defineProperty(e.prototype,"interactive",{get:function(){return this.isInteractive()},set:function(t){this.style.pointerEvents=t?"auto":"none"},enumerable:!1,configurable:!0}),e.prototype.isInteractive=function(){var t;return"none"!==(null===(t=this.parsedStyle)||void 0===t?void 0:t.pointerEvents)},e.prototype.isCulled=function(){return!(!this.cullable||!this.cullable.enable||this.cullable.visible)},e.prototype.toFront=function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,l([],c(this.parentNode.children.map((function(t){return Number(t.style.zIndex)}))),!1))+1),this},e.prototype.toBack=function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,l([],c(this.parentNode.children.map((function(t){return Number(t.style.zIndex)}))),!1))-1),this},e.prototype.getConfig=function(){return this.config},e.prototype.attr=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=c(e,2),i=r[0],o=r[1];return i?Rt(i)?(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),this):2===e.length?(this.setAttribute(i,o),this):this.attributes[i]:this.attributes},e.prototype.getMatrix=function(t){var e=t||this.getWorldTransform(),n=c(I(Z(),e),2),r=n[0],i=n[1],o=c(j(Z(),e),2),a=o[0],s=o[1],u=z(mt(),e),l=c(ar(Z(),u),3),h=l[0],d=l[2];return sr(h||d,r,i,a,s)},e.prototype.getLocalMatrix=function(){return this.getMatrix(this.getLocalTransform())},e.prototype.setMatrix=function(t){var e=c(ur(t),5),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4];this.setEulerAngles(a).setPosition(n,r).setLocalScale(i,o)},e.prototype.setLocalMatrix=function(t){var e=c(ur(t),5),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4];this.setLocalEulerAngles(a).setLocalPosition(n,r).setLocalScale(i,o)},e.prototype.show=function(){ds.enableCSSParsing?this.style.visibility="visible":this.forEach((function(t){t.style.visibility="visible"}))},e.prototype.hide=function(){ds.enableCSSParsing?this.style.visibility="hidden":this.forEach((function(t){t.style.visibility="hidden"}))},e.prototype.getCount=function(){return this.childElementCount},e.prototype.getParent=function(){return this.parentElement},e.prototype.getChildren=function(){return this.children},e.prototype.getFirst=function(){return this.firstElementChild},e.prototype.getLast=function(){return this.lastElementChild},e.prototype.getChildByIndex=function(t){return this.children[t]||null},e.prototype.add=function(t,e){return this.appendChild(t,e)},e.prototype.setClip=function(t){this.style.clipPath=t},e.prototype.set=function(t,e){this.config[t]=e},e.prototype.get=function(t){return this.config[t]},e.prototype.moveTo=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),this.setPosition(t,e,n),this},e.prototype.move=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),this.setPosition(t,e,n),this},e.prototype.setZIndex=function(t){return this.style.zIndex=t,this},e}(bs),Ps=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:$n.CIRCLE,style:ds.enableCSSParsing?i({cx:"",cy:"",r:""},n):i({},n),initialParsedStyle:{anchor:[.5,.5],transformOrigin:ds.enableCSSParsing?null:[fi,fi]}},r))||this}return r(e,t),e}(Ts),As=function(t){function e(e){void 0===e&&(e={});var n=this,r=e.style,a=o(e,["style"]);return(n=t.call(this,i({style:ds.enableCSSParsing?i({x:"",y:""},r):i({},r)},a))||this).isCustomElement=!0,n}return r(e,t),e}(Ts),Os=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:$n.ELLIPSE,style:ds.enableCSSParsing?i({cx:"",cy:"",rx:"",ry:""},n):i({},n),initialParsedStyle:{anchor:[.5,.5],transformOrigin:ds.enableCSSParsing?null:[fi,fi]}},r))||this}return r(e,t),e}(Ts),_s=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:$n.GROUP,style:ds.enableCSSParsing?i({x:"",y:"",width:"",height:""},n):i({},n)},r))||this}return r(e,t),e}(Ts),Rs=function(t){function e(e){void 0===e&&(e={});var n=this,r=e.style,a=o(e,["style"]);return(n=t.call(this,i({type:$n.HTML,style:ds.enableCSSParsing?i({x:"",y:"",width:"auto",height:"auto",innerHTML:""},r):i({},r)},a))||this).cullable.enable=!1,n}return r(e,t),e.prototype.getDomElement=function(){return this.parsedStyle.$el},e.prototype.getBoundingClientRect=function(){if(this.parsedStyle.$el)return this.parsedStyle.$el.getBoundingClientRect();var t=this.parsedStyle,e=t.x,n=t.y,r=t.width,i=t.height;return new Mr(e,n,r,i)},e.prototype.getClientRects=function(){return[this.getBoundingClientRect()]},e.prototype.getBounds=function(){var t,e,n=this.getBoundingClientRect(),r=null===(e=null===(t=this.ownerDocument)||void 0===t?void 0:t.defaultView)||void 0===e?void 0:e.getContextService().getBoundingClientRect(),i=new mr,o=n.left-((null==r?void 0:r.left)||0),a=n.top-((null==r?void 0:r.top)||0);return i.setMinMax([o,a,0],[o+n.width,a+n.height,0]),i},e.prototype.getLocalBounds=function(){if(this.parentNode){var t=C(E(),this.parentNode.getWorldTransform()),e=this.getBounds();if(!mr.isEmpty(e)){var n=new mr;return n.setFromTransformedAABB(e,t),n}}return this.getBounds()},e}(Ts),Ls=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:$n.IMAGE,style:ds.enableCSSParsing?i({x:"",y:"",img:"",width:"",height:""},n):i({},n)},r))||this}return r(e,t),e}(Ts),Ds=function(t){function e(e){void 0===e&&(e={});var n=this,r=e.style,a=o(e,["style"]);(n=t.call(this,i({type:$n.LINE,style:i({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},r)},a))||this).markerStartAngle=0,n.markerEndAngle=0;var s=n.parsedStyle,u=s.markerStart,c=s.markerEnd;return u&&Es(u)&&(n.markerStartAngle=u.getLocalEulerAngles(),n.appendChild(u)),c&&Es(c)&&(n.markerEndAngle=c.getLocalEulerAngles(),n.appendChild(c)),n.transformMarker(!0),n.transformMarker(!1),n}return r(e,t),e.prototype.attributeChangedCallback=function(t,e,n,r,i){"x1"===t||"y1"===t||"x2"===t||"y2"===t||"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Es(r)&&(this.markerStartAngle=0,r.remove()),i&&Es(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t&&(r&&Es(r)&&(this.markerEndAngle=0,r.remove()),i&&Es(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1)))},e.prototype.transformMarker=function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,a=e.x1,s=e.x2,u=e.y1,c=e.y2,l=e.defX,h=e.defY,d=t?n:r;if(d&&Es(d)){var f,p,g,m,v,y,b;t?(m=a-l,v=u-h,p=s-a,g=c-u,y=i||0,b=this.markerStartAngle):(m=s-l,v=c-h,p=a-s,g=u-c,y=o||0,b=this.markerEndAngle),f=Math.atan2(g,p),d.setLocalEulerAngles(180*f/Math.PI+b),d.setLocalPosition(m+Math.cos(f)*y,v+Math.sin(f)*y)}},e.prototype.getPoint=function(t,e){void 0===e&&(e=!1);var n=this.parsedStyle,r=n.x1,i=n.y1,o=n.x2,a=n.y2,s=n.defX,u=n.defY,c=Dn(r,i,o,a,t),l=c.x,h=c.y,d=lt(Z(),tt(l-s,h-u,0),e?this.getWorldTransform():this.getLocalTransform());return new xr(d[0],d[1])},e.prototype.getPointAtLength=function(t,e){return void 0===e&&(e=!1),this.getPoint(t/this.getTotalLength(),e)},e.prototype.getTotalLength=function(){var t=this.parsedStyle;return Ln(t.x1,t.y1,t.x2,t.y2)},e}(Ts),Is=function(t){function e(e){void 0===e&&(e={});var n=this,r=e.style,a=o(e,["style"]);(n=t.call(this,i({type:$n.PATH,style:ds.enableCSSParsing?i({path:"",miterLimit:""},r):i({},r),initialParsedStyle:ds.enableCSSParsing?null:{miterLimit:4,path:i({},gi)}},a))||this).markerStartAngle=0,n.markerEndAngle=0,n.markerMidList=[];var s=n.parsedStyle,u=s.markerStart,c=s.markerEnd,l=s.markerMid;return u&&Es(u)&&(n.markerStartAngle=u.getLocalEulerAngles(),n.appendChild(u)),l&&Es(l)&&n.placeMarkerMid(l),c&&Es(c)&&(n.markerEndAngle=c.getLocalEulerAngles(),n.appendChild(c)),n.transformMarker(!0),n.transformMarker(!1),n}return r(e,t),e.prototype.attributeChangedCallback=function(t,e,n,r,i){"path"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Es(r)&&(this.markerStartAngle=0,r.remove()),i&&Es(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&Es(r)&&(this.markerEndAngle=0,r.remove()),i&&Es(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)},e.prototype.transformMarker=function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,a=e.defX,s=e.defY,u=t?n:r;if(u&&Es(u)){var l,h,d,f,p,g,m;if(t){var v=c(this.getStartTangent(),2),y=v[0];f=(b=v[1])[0]-a,p=b[1]-s,h=y[0]-b[0],d=y[1]-b[1],g=i||0,m=this.markerStartAngle}else{var b,E=c(this.getEndTangent(),2);y=E[0];f=(b=E[1])[0]-a,p=b[1]-s,h=y[0]-b[0],d=y[1]-b[1],g=o||0,m=this.markerEndAngle}l=Math.atan2(d,h),u.setLocalEulerAngles(180*l/Math.PI+m),u.setLocalPosition(f+Math.cos(l)*g,p+Math.sin(l)*g)}},e.prototype.placeMarkerMid=function(t){var e=this.parsedStyle,n=e.path.segments,r=e.defX,i=e.defY;if(this.markerMidList.forEach((function(t){t.remove()})),t&&Es(t))for(var o=1;o<n.length-1;o++){var a=c(n[o].currentPoint,2),s=a[0],u=a[1],l=1===o?t:t.cloneNode(!0);this.markerMidList.push(l),this.appendChild(l),l.setLocalPosition(s-r,u-i)}},e.prototype.getTotalLength=function(){return Xi(this)},e.prototype.getPointAtLength=function(t,e){void 0===e&&(e=!1);var n=this.parsedStyle,r=n.defX,o=n.defY,a=function(t,e,n){return He(t,e,i(i({},n),{bbox:!1,length:!0})).point}(n.path.absolutePath,t),s=a.x,u=a.y,c=lt(Z(),tt(s-r,u-o,0),e?this.getWorldTransform():this.getLocalTransform());return new xr(c[0],c[1])},e.prototype.getPoint=function(t,e){return void 0===e&&(e=!1),this.getPointAtLength(t*Xi(this),e)},e.prototype.getStartTangent=function(){var t=this.parsedStyle.path.segments,e=[];if(t.length>1){var n=t[0].currentPoint,r=t[1].currentPoint,i=t[1].startTangent;e=[],i?(e.push([n[0]-i[0],n[1]-i[1]]),e.push([n[0],n[1]])):(e.push([r[0],r[1]]),e.push([n[0],n[1]]))}return e},e.prototype.getEndTangent=function(){var t=this.parsedStyle.path.segments,e=t.length,n=[];if(e>1){var r=t[e-2].currentPoint,i=t[e-1].currentPoint,o=t[e-1].endTangent;n=[],o?(n.push([i[0]-o[0],i[1]-o[1]]),n.push([i[0],i[1]])):(n.push([r[0],r[1]]),n.push([i[0],i[1]]))}return n},e}(Ts),js=function(t){function e(e){void 0===e&&(e={});var n=this,r=e.style,a=o(e,["style"]);(n=t.call(this,i({type:$n.POLYGON,style:ds.enableCSSParsing?i({points:"",miterLimit:"",isClosed:!0},r):i({},r),initialParsedStyle:ds.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a))||this).markerStartAngle=0,n.markerEndAngle=0,n.markerMidList=[];var s=n.parsedStyle,u=s.markerStart,c=s.markerEnd,l=s.markerMid;return u&&Es(u)&&(n.markerStartAngle=u.getLocalEulerAngles(),n.appendChild(u)),l&&Es(l)&&n.placeMarkerMid(l),c&&Es(c)&&(n.markerEndAngle=c.getLocalEulerAngles(),n.appendChild(c)),n.transformMarker(!0),n.transformMarker(!1),n}return r(e,t),e.prototype.attributeChangedCallback=function(t,e,n,r,i){"points"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Es(r)&&(this.markerStartAngle=0,r.remove()),i&&Es(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&Es(r)&&(this.markerEndAngle=0,r.remove()),i&&Es(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)},e.prototype.transformMarker=function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,a=e.points,s=e.defX,u=e.defY,c=(a||{}).points,l=t?n:r;if(l&&Es(l)&&c){var h,d,f,p,g,m,v;if(p=c[0][0]-s,g=c[0][1]-u,t)d=c[1][0]-c[0][0],f=c[1][1]-c[0][1],m=i||0,v=this.markerStartAngle;else{var y=c.length;this.parsedStyle.isClosed?(d=c[y-1][0]-c[0][0],f=c[y-1][1]-c[0][1]):(p=c[y-1][0]-s,g=c[y-1][1]-u,d=c[y-2][0]-c[y-1][0],f=c[y-2][1]-c[y-1][1]),m=o||0,v=this.markerEndAngle}h=Math.atan2(f,d),l.setLocalEulerAngles(180*h/Math.PI+v),l.setLocalPosition(p+Math.cos(h)*m,g+Math.sin(h)*m)}},e.prototype.placeMarkerMid=function(t){var e=this.parsedStyle,n=e.points,r=e.defX,i=e.defY,o=(n||{}).points;if(this.markerMidList.forEach((function(t){t.remove()})),this.markerMidList=[],t&&Es(t)&&o)for(var a=1;a<(this.parsedStyle.isClosed?o.length:o.length-1);a++){var s=o[a][0]-r,u=o[a][1]-i,c=1===a?t:t.cloneNode(!0);this.markerMidList.push(c),this.appendChild(c),c.setLocalPosition(s,u)}},e}(Ts),zs=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:$n.POLYLINE,style:ds.enableCSSParsing?i({points:"",miterLimit:"",isClosed:!1},n):i({},n),initialParsedStyle:ds.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},r))||this}return r(e,t),e.prototype.getTotalLength=function(){return this.parsedStyle.points.totalLength},e.prototype.getPointAtLength=function(t,e){return void 0===e&&(e=!1),this.getPoint(t/this.getTotalLength(),e)},e.prototype.getPoint=function(t,e){void 0===e&&(e=!1);var n=this.parsedStyle,r=n.defX,i=n.defY,o=n.points,a=o.points,s=o.segments,u=0,c=0;s.forEach((function(e,n){t>=e[0]&&t<=e[1]&&(u=(t-e[0])/(e[1]-e[0]),c=n)}));var l=Dn(a[c][0],a[c][1],a[c+1][0],a[c+1][1],u),h=l.x,d=l.y,f=lt(Z(),tt(h-r,d-i,0),e?this.getWorldTransform():this.getLocalTransform());return new xr(f[0],f[1])},e.prototype.getStartTangent=function(){var t=this.parsedStyle.points.points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e},e.prototype.getEndTangent=function(){var t=this.parsedStyle.points.points,e=t.length-1,n=[];return n.push([t[e-1][0],t[e-1][1]]),n.push([t[e][0],t[e][1]]),n},e}(js),Bs=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:$n.RECT,style:ds.enableCSSParsing?i({x:"",y:"",width:"",height:"",radius:""},n):i({},n)},r))||this}return r(e,t),e}(Ts),Fs=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:$n.TEXT,style:ds.enableCSSParsing?i({x:"",y:"",text:"",fontSize:"",fontFamily:"",fontStyle:"",fontWeight:"",fontVariant:"",textAlign:"",textBaseline:"",textTransform:"",fill:"black",letterSpacing:"",lineHeight:"",miterLimit:"",wordWrap:!1,wordWrapWidth:0,leading:0,dx:"",dy:""},n):i({fill:"black"},n),initialParsedStyle:ds.enableCSSParsing?{}:{x:0,y:0,fontSize:16,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",lineHeight:0,letterSpacing:0,textBaseline:"alphabetic",textAlign:"start",wordWrap:!1,wordWrapWidth:0,leading:0,dx:0,dy:0}},r))||this}return r(e,t),e.prototype.getComputedTextLength=function(){var t;return(null===(t=this.parsedStyle.metrics)||void 0===t?void 0:t.maxLineWidth)||0},e.prototype.getLineBoundingRects=function(){var t;return(null===(t=this.parsedStyle.metrics)||void 0===t?void 0:t.lineMetrics)||[]},e.prototype.isOverflowing=function(){return!!this.parsedStyle.isOverflowing},e}(Ts),Gs=function(){function t(){this.registry={},this.define($n.CIRCLE,Ps),this.define($n.ELLIPSE,Os),this.define($n.RECT,Bs),this.define($n.IMAGE,Ls),this.define($n.LINE,Ds),this.define($n.GROUP,_s),this.define($n.PATH,Is),this.define($n.POLYGON,js),this.define($n.POLYLINE,zs),this.define($n.TEXT,Fs),this.define($n.HTML,Rs)}return t.prototype.define=function(t,e){this.registry[t]=e},t.prototype.get=function(t){return this.registry[t]},t}(),Vs=function(t){function e(){var e=t.call(this)||this;e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new ds.AnimationTimeline(e)}catch(t){}var n={};return _o.forEach((function(t){var e=t.n,r=t.inh,i=t.d;r&&i&&(n[e]=$r(i)?i($n.GROUP):i)})),e.documentElement=new _s({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return r(e,t),Object.defineProperty(e.prototype,"children",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){return this.childNodes.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){return this.firstChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){return this.lastChild},enumerable:!1,configurable:!0}),e.prototype.createElement=function(t,e){if("svg"===t)return this.documentElement;var n=this.defaultView.customElements.get(t);n||(console.warn("Unsupported tagName: ",t),n="tspan"===t?Fs:_s);var r=new n(e);return r.ownerDocument=this,r},e.prototype.createElementNS=function(t,e,n){return this.createElement(e,n)},e.prototype.cloneNode=function(t){throw new Error(Nr)},e.prototype.destroy=function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch(t){}},e.prototype.elementsFromBBox=function(t,e,n,r){var i=this.defaultView.context.rBushRoot.search({minX:t,minY:e,maxX:n,maxY:r}),o=[];return i.forEach((function(t){var e=t.displayObject,n=e.parsedStyle.pointerEvents,r=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(n);(!r||r&&e.isVisible())&&!e.isCulled()&&e.isInteractive()&&o.push(e)})),o.sort((function(t,e){return e.sortable.renderOrder-t.sortable.renderOrder})),o},e.prototype.elementFromPointSync=function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),a=o.width,s=o.height;if(r<0||i<0||r>a||i>s)return null;var u=this.defaultView.viewport2Client({x:r,y:i}),c=u.x,l=u.y,h=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:c,clientY:l},picked:[]}).picked;return h&&h[0]||this.documentElement},e.prototype.elementFromPoint=function(t,e){return a(this,void 0,void 0,(function(){var n,r,i,o,a,u,c,l,h,d;return s(this,(function(s){switch(s.label){case 0:return n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),a=o.width,u=o.height,r<0||i<0||r>a||i>u?[2,null]:(c=this.defaultView.viewport2Client({x:r,y:i}),l=c.x,h=c.y,[4,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:l,clientY:h},picked:[]})]);case 1:return[2,(d=s.sent().picked)&&d[0]||this.documentElement]}}))}))},e.prototype.elementsFromPointSync=function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),a=o.width,s=o.height;if(r<0||i<0||r>a||i>s)return[];var u=this.defaultView.viewport2Client({x:r,y:i}),c=u.x,l=u.y,h=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:c,clientY:l},picked:[]}).picked;return h[h.length-1]!==this.documentElement&&h.push(this.documentElement),h},e.prototype.elementsFromPoint=function(t,e){return a(this,void 0,void 0,(function(){var n,r,i,o,a,u,c,l,h,d;return s(this,(function(s){switch(s.label){case 0:return n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),a=o.width,u=o.height,r<0||i<0||r>a||i>u?[2,[]]:(c=this.defaultView.viewport2Client({x:r,y:i}),l=c.x,h=c.y,[4,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:l,clientY:h},picked:[]})]);case 1:return(d=s.sent().picked)[d.length-1]!==this.documentElement&&d.push(this.documentElement),[2,d]}}))}))},e.prototype.appendChild=function(t,e){throw new Error(Sr)},e.prototype.insertBefore=function(t,e){throw new Error(Sr)},e.prototype.removeChild=function(t,e){throw new Error(Sr)},e.prototype.replaceChild=function(t,e,n){throw new Error(Sr)},e.prototype.append=function(){throw new Error(Sr)},e.prototype.prepend=function(){throw new Error(Sr)},e.prototype.getElementById=function(t){return this.documentElement.getElementById(t)},e.prototype.getElementsByName=function(t){return this.documentElement.getElementsByName(t)},e.prototype.getElementsByTagName=function(t){return this.documentElement.getElementsByTagName(t)},e.prototype.getElementsByClassName=function(t){return this.documentElement.getElementsByClassName(t)},e.prototype.querySelector=function(t){return this.documentElement.querySelector(t)},e.prototype.querySelectorAll=function(t){return this.documentElement.querySelectorAll(t)},e.prototype.find=function(t){return this.documentElement.find(t)},e.prototype.findAll=function(t){return this.documentElement.findAll(t)},e}($a),Ws=function(){function t(t){this.strategies=t}return t.prototype.apply=function(e){var n=e.camera,r=e.renderingService,i=e.renderingContext,o=this.strategies;r.hooks.cull.tap(t.tag,(function(t){if(t){var e=t.cullable;return 0===o.length?e.visible=i.unculledEntities.indexOf(t.entity)>-1:e.visible=o.every((function(e){return e.isVisible(n,t)})),!t.isCulled()&&t.isVisible()?t:(t.dispatchEvent(new Ha(Xa.CULLED)),null)}return t})),r.hooks.afterRender.tap(t.tag,(function(t){t.cullable.visibilityPlaneMask=-1}))},t.tag="Culling",t}(),Us=function(){function t(){var t=this;this.autoPreventDefault=!1,this.rootPointerEvent=new Wa(null),this.rootWheelEvent=new Ua(null),this.onPointerMove=function(e){var n,r,i,o,a=null===(o=null===(i=t.context.renderingContext.root)||void 0===i?void 0:i.ownerDocument)||void 0===o?void 0:o.defaultView;if(!a.supportsTouchEvents||"touch"!==e.pointerType){var s=t.normalizeToPointerEvent(e,a);try{for(var c=u(s),l=c.next();!l.done;l=c.next()){var h=l.value,d=t.bootstrapEvent(t.rootPointerEvent,h,a,e);t.context.eventService.mapEvent(d)}}catch(t){n={error:t}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}t.setCursor(t.context.eventService.cursor)}},this.onClick=function(e){var n,r,i,o,a=null===(o=null===(i=t.context.renderingContext.root)||void 0===i?void 0:i.ownerDocument)||void 0===o?void 0:o.defaultView,s=t.normalizeToPointerEvent(e,a);try{for(var c=u(s),l=c.next();!l.done;l=c.next()){var h=l.value,d=t.bootstrapEvent(t.rootPointerEvent,h,a,e);t.context.eventService.mapEvent(d)}}catch(t){n={error:t}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}t.setCursor(t.context.eventService.cursor)}}return t.prototype.apply=function(e){var n=this;this.context=e;var r=e.renderingService,i=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler((function(t){return n.context.renderingService.hooks.pickSync.call({position:t,picked:[],topmost:!0}).picked[0]||null})),r.hooks.pointerWheel.tap(t.tag,(function(t){var e=n.normalizeWheelEvent(t);n.context.eventService.mapEvent(e)})),r.hooks.pointerDown.tap(t.tag,(function(t){var e,r;if(!i.supportsTouchEvents||"touch"!==t.pointerType){var o=n.normalizeToPointerEvent(t,i);if(n.autoPreventDefault&&o[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();try{for(var a=u(o),s=a.next();!s.done;s=a.next()){var c=s.value,l=n.bootstrapEvent(n.rootPointerEvent,c,i,t);n.context.eventService.mapEvent(l)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}n.setCursor(n.context.eventService.cursor)}})),r.hooks.pointerUp.tap(t.tag,(function(t){var e,r;if(!i.supportsTouchEvents||"touch"!==t.pointerType){var o=n.context.contextService.getDomElement(),a=n.context.eventService.isNativeEventFromCanvas(o,t)?"":"outside",s=n.normalizeToPointerEvent(t,i);try{for(var c=u(s),l=c.next();!l.done;l=c.next()){var h=l.value,d=n.bootstrapEvent(n.rootPointerEvent,h,i,t);d.type+=a,n.context.eventService.mapEvent(d)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}n.setCursor(n.context.eventService.cursor)}})),r.hooks.pointerMove.tap(t.tag,this.onPointerMove),r.hooks.pointerOver.tap(t.tag,this.onPointerMove),r.hooks.pointerOut.tap(t.tag,this.onPointerMove),r.hooks.click.tap(t.tag,this.onClick),r.hooks.pointerCancel.tap(t.tag,(function(t){var e,r,o=n.normalizeToPointerEvent(t,i);try{for(var a=u(o),s=a.next();!s.done;s=a.next()){var c=s.value,l=n.bootstrapEvent(n.rootPointerEvent,c,i,t);n.context.eventService.mapEvent(l)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}n.setCursor(n.context.eventService.cursor)}))},t.prototype.getViewportXY=function(t){var e,n,r=t.offsetX,i=t.offsetY,o=t.clientX,a=t.clientY;if(!this.context.config.supportsCSSTransform||Pt(r)||Pt(i)){var s=this.context.eventService.client2Viewport(new xr(o,a));e=s.x,n=s.y}else e=r,n=i;return{x:e,y:n}},t.prototype.bootstrapEvent=function(t,e,n,r){t.view=n,t.originalEvent=null,t.nativeEvent=r,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);var i=this.getViewportXY(e),o=i.x,a=i.y;t.viewport.x=o,t.viewport.y=a;var s=this.context.eventService.viewport2Canvas(t.viewport),u=s.x,c=s.y;return t.canvas.x=u,t.canvas.y=c,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=r.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=la[t.type]||t.type),t},t.prototype.normalizeWheelEvent=function(t){var e=this.rootWheelEvent;this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;var n=this.getViewportXY(t),r=n.x,i=n.y;e.viewport.x=r,e.viewport.y=i;var o=this.context.eventService.viewport2Canvas(e.viewport),a=o.x,s=o.y;return e.canvas.x=a,e.canvas.y=s,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.nativeEvent=t,e.type=t.type,e},t.prototype.transferMouseData=function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=ha.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null},t.prototype.setCursor=function(t){this.context.contextService.applyCursorStyle(t||this.context.config.cursor||"default")},t.prototype.normalizeToPointerEvent=function(t,e){var n=[];if(e.isTouchEvent(t))for(var r=0;r<t.changedTouches.length;r++){var i=t.changedTouches[r];Qt(i.button)&&(i.button=0),Qt(i.buttons)&&(i.buttons=1),Qt(i.isPrimary)&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),Qt(i.width)&&(i.width=i.radiusX||1),Qt(i.height)&&(i.height=i.radiusY||1),Qt(i.tiltX)&&(i.tiltX=0),Qt(i.tiltY)&&(i.tiltY=0),Qt(i.pointerType)&&(i.pointerType="touch"),Qt(i.pointerId)&&(i.pointerId=i.identifier||0),Qt(i.pressure)&&(i.pressure=i.force||.5),Qt(i.twist)&&(i.twist=0),Qt(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,i.type=t.type,n.push(i)}else if(e.isMouseEvent(t)){var o=t;Qt(o.isPrimary)&&(o.isPrimary=!0),Qt(o.width)&&(o.width=1),Qt(o.height)&&(o.height=1),Qt(o.tiltX)&&(o.tiltX=0),Qt(o.tiltY)&&(o.tiltY=0),Qt(o.pointerType)&&(o.pointerType="mouse"),Qt(o.pointerId)&&(o.pointerId=1),Qt(o.pressure)&&(o.pressure=.5),Qt(o.twist)&&(o.twist=0),Qt(o.tangentialPressure)&&(o.tangentialPressure=0),o.isNormalized=!0,n.push(o)}else n.push(t);return n},t.tag="Event",t}(),Hs=[$n.CIRCLE,$n.ELLIPSE,$n.IMAGE,$n.RECT,$n.LINE,$n.POLYLINE,$n.POLYGON,$n.TEXT,$n.PATH,$n.HTML],qs=function(){function t(){}return t.prototype.isVisible=function(t,e){var n,r,i=e.cullable;if(!i.enable)return!0;var o=e.getRenderBounds();if(mr.isEmpty(o))return!1;var a=t.getFrustum(),s=null===(r=null===(n=e.parentNode)||void 0===n?void 0:n.cullable)||void 0===r?void 0:r.visibilityPlaneMask;return i.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(e,o,s||gr.INDETERMINATE,a.planes),i.visible=i.visibilityPlaneMask!==gr.OUTSIDE,i.visible},t.prototype.computeVisibilityWithPlaneMask=function(t,e,n,r){if(n===gr.OUTSIDE||n===gr.INSIDE)return n;for(var i=gr.INSIDE,o=Hs.indexOf(t.nodeName)>-1,a=0,s=r.length;a<s;++a){var u=1<<a;if(n&u&&(!o||4!==a&&5!==a)){var c=r[a],l=c.normal,h=c.distance;if(st(l,e.getPositiveFarPoint(r[a]))+h<0)return gr.OUTSIDE;st(l,e.getNegativeFarPoint(r[a]))+h<0&&(i|=u)}}return i},t}(),$s=function(){function t(){this.toSync=new Set}return t.prototype.apply=function(e){var n=this,r=e.renderingService,i=e.renderingContext,o=e.rBushRoot,a=i.root.ownerDocument.defaultView;this.rBush=o;var s=function(t){t.target.renderable.dirty=!0,r.dirtify()},u=function(t){var e=t.detail.affectChildren,i=t.target;e&&i.forEach((function(t){n.toSync.add(t)}));for(var o=i;o;)o.renderable&&n.toSync.add(o),o=o.parentElement;r.dirtify()},c=function(t){var e=t.target;ds.enableSizeAttenuation&&ds.styleValueRegistry.updateSizeAttenuation(e,a.getCamera().getZoom()),ds.enableCSSParsing&&ds.styleValueRegistry.recalc(e),ds.sceneGraphService.dirtifyToRoot(e),r.dirtify()},l=function(t){var e=t.target,i=e.rBushNode;i.aabb&&n.rBush.remove(i.aabb),n.toSync.delete(e),ds.sceneGraphService.dirtifyToRoot(e),r.dirtify()};r.hooks.init.tap(t.tag,(function(){a.addEventListener(Xa.MOUNTED,c),a.addEventListener(Xa.UNMOUNTED,l),a.addEventListener(Xa.ATTR_MODIFIED,s),a.addEventListener(Xa.BOUNDS_CHANGED,u)})),r.hooks.destroy.tap(t.tag,(function(){a.removeEventListener(Xa.MOUNTED,c),a.removeEventListener(Xa.UNMOUNTED,l),a.removeEventListener(Xa.ATTR_MODIFIED,s),a.removeEventListener(Xa.BOUNDS_CHANGED,u),n.toSync.clear()})),r.hooks.endFrame.tap(t.tag,(function(){n.syncRTree()}))},t.prototype.syncRTree=function(){var t=this,e=[];Array.from(this.toSync).filter((function(t){return t.isConnected})).forEach((function(n){var r=n.rBushNode;r&&r.aabb&&t.rBush.remove(r.aabb);var i=n.getRenderBounds();if(i){var o=c(i.getMin(),2),a=o[0],s=o[1],u=c(i.getMax(),2),l=u[0],h=u[1];r.aabb||(r.aabb={}),r.aabb.displayObject=n,r.aabb.minX=a,r.aabb.minY=s,r.aabb.maxX=l,r.aabb.maxY=h}r.aabb&&(isNaN(r.aabb.maxX)||isNaN(r.aabb.maxX)||isNaN(r.aabb.minX)||isNaN(r.aabb.minY)||e.push(r.aabb))})),this.rBush.load(e),e.length=0,this.toSync.clear()},t.tag="Prepare",t}();!function(t){t.READY="ready",t.BEFORE_RENDER="beforerender",t.RERENDER="rerender",t.AFTER_RENDER="afterrender",t.BEFORE_DESTROY="beforedestroy",t.AFTER_DESTROY="afterdestroy",t.RESIZE="resize",t.DIRTY_RECTANGLE="dirtyrectangle",t.RENDERER_CHANGED="rendererchanged"}(ws||(ws={}));var Ys=new Ha(Xa.MOUNTED),Ks=new Ha(Xa.UNMOUNTED),Xs=new Ha(ws.BEFORE_RENDER),Zs=new Ha(ws.RERENDER),Qs=new Ha(ws.AFTER_RENDER),Js=function(t){function e(e){var n=t.call(this)||this;n.Element=Ts,n.inited=!1,n.context={},n.document=new Vs,n.document.defaultView=n,n.customElements=new Gs;var r=e.container,i=e.canvas,o=e.offscreenCanvas,a=e.width,s=e.height,u=e.devicePixelRatio,c=e.renderer,l=e.background,h=e.cursor,d=e.document,f=e.requestAnimationFrame,p=e.cancelAnimationFrame,g=e.createImage,m=e.supportsPointerEvents,v=e.supportsTouchEvents,y=e.supportsCSSTransform,b=e.supportsMutipleCanvasesInOneContainer,E=e.useNativeClickEvent,w=e.alwaysTriggerPointerEventOnCanvas,x=e.isTouchEvent,M=e.isMouseEvent;b||function(t,e){if(t){var n="string"==typeof t?t:t.id||ia++;ra[n]&&ra[n].destroy(),ra[n]=e}}(r,n);var N=a,S=s,C=u;return i&&(C=(C=u||oa&&window.devicePixelRatio||1)>=1?Math.ceil(C):1,N=a||function(t){var e=ca(t,"width");return"auto"===e?t.offsetWidth:parseFloat(e)}(i)||i.width/C,S=s||function(t){var e=ca(t,"height");return"auto"===e?t.offsetHeight:parseFloat(e)}(i)||i.height/C),o&&(ds.offscreenCanvas=o),n.devicePixelRatio=C,n.requestAnimationFrame=null!=f?f:xa.bind(ds.globalThis),n.cancelAnimationFrame=null!=p?p:Ma.bind(ds.globalThis),n.supportsTouchEvents=null!=v?v:"ontouchstart"in ds.globalThis,n.supportsPointerEvents=null!=m?m:!!ds.globalThis.PointerEvent,n.isTouchEvent=null!=x?x:function(t){return n.supportsTouchEvents&&t instanceof ds.globalThis.TouchEvent},n.isMouseEvent=null!=M?M:function(t){return!ds.globalThis.MouseEvent||t instanceof ds.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(t instanceof ds.globalThis.PointerEvent))},n.initRenderingContext({container:r,canvas:i,width:N,height:S,renderer:c,offscreenCanvas:o,devicePixelRatio:C,cursor:h||"default",background:l||"transparent",createImage:g,document:d,supportsCSSTransform:y,useNativeClickEvent:E,alwaysTriggerPointerEventOnCanvas:w}),n.initDefaultCamera(N,S,c.clipSpaceNearZ),n.initRenderer(c,!0),n}return r(e,t),e.prototype.initRenderingContext=function(t){this.context.config=t,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}},e.prototype.initDefaultCamera=function(t,e,n){var r=this,i=new ds.CameraContribution;i.clipSpaceNearZ=n,i.setType(yr.EXPLORING,br.DEFAULT).setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0).setOrthographic(t/-2,t/2,e/2,e/-2,.1,1e3),i.canvas=this,i.eventEmitter.on(Or,(function(){r.context.renderingContext.renderReasons.add(Fa.CAMERA_CHANGED),ds.enableSizeAttenuation&&r.getConfig().renderer.getConfig().enableSizeAttenuation&&r.updateSizeAttenuation()})),this.context.camera=i},e.prototype.updateSizeAttenuation=function(){var t=this.getCamera().getZoom();this.document.documentElement.forEach((function(e){ds.styleValueRegistry.updateSizeAttenuation(e,t)}))},e.prototype.getConfig=function(){return this.context.config},e.prototype.getRoot=function(){return this.document.documentElement},e.prototype.getCamera=function(){return this.context.camera},e.prototype.getContextService=function(){return this.context.contextService},e.prototype.getEventService=function(){return this.context.eventService},e.prototype.getRenderingService=function(){return this.context.renderingService},e.prototype.getRenderingContext=function(){return this.context.renderingContext},e.prototype.getStats=function(){return this.getRenderingService().getStats()},Object.defineProperty(e.prototype,"ready",{get:function(){var t=this;return this.readyPromise||(this.readyPromise=new Promise((function(e){t.resolveReadyPromise=function(){e(t)}})),this.inited&&this.resolveReadyPromise()),this.readyPromise},enumerable:!1,configurable:!0}),e.prototype.destroy=function(t,e){(void 0===t&&(t=!0),void 0===e&&(e=!1),e||this.dispatchEvent(new Ha(ws.BEFORE_DESTROY)),this.frameId)&&(this.getConfig().cancelAnimationFrame||cancelAnimationFrame)(this.frameId);var n=this.getRoot();this.unmountChildren(n),t&&(this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),t&&this.context.rBushRoot&&(this.context.rBushRoot.clear(),this.context.rBushRoot=null,this.context.renderingContext.root=null),e||this.dispatchEvent(new Ha(ws.AFTER_DESTROY))},e.prototype.changeSize=function(t,e){this.resize(t,e)},e.prototype.resize=function(t,e){var n=this.context.config;n.width=t,n.height=e,this.getContextService().resize(t,e);var r=this.context.camera,i=r.getProjectionMode();r.setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0),i===Er.ORTHOGRAPHIC?r.setOrthographic(t/-2,t/2,e/2,e/-2,r.getNear(),r.getFar()):r.setAspect(t/e),this.dispatchEvent(new Ha(ws.RESIZE,{width:t,height:e}))},e.prototype.appendChild=function(t,e){return this.document.documentElement.appendChild(t,e)},e.prototype.insertBefore=function(t,e){return this.document.documentElement.insertBefore(t,e)},e.prototype.removeChild=function(t){return this.document.documentElement.removeChild(t)},e.prototype.removeChildren=function(){this.document.documentElement.removeChildren()},e.prototype.destroyChildren=function(){this.document.documentElement.destroyChildren()},e.prototype.render=function(){var t=this;this.dispatchEvent(Xs),this.getRenderingService().render(this.getConfig(),(function(){t.dispatchEvent(Zs)})),this.dispatchEvent(Qs)},e.prototype.run=function(){var t=this,e=function(){t.render(),t.frameId=t.requestAnimationFrame(e)};e()},e.prototype.initRenderer=function(t,e){var n=this;if(void 0===e&&(e=!1),!t)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.rBushRoot=new Kn,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new Us,new $s,new Ws([new qs])),this.loadRendererContainerModule(t),this.context.contextService=new this.context.ContextService(i(i({},ds),this.context)),this.context.renderingService=new Za(ds,this.context),this.context.eventService=new Ya(ds,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(t,e,!0)):this.context.contextService.initAsync().then((function(){n.initRenderingService(t,e)}))},e.prototype.initRenderingService=function(t,e,n){var r=this;void 0===e&&(e=!1),void 0===n&&(n=!1),this.context.renderingService.init((function(){r.inited=!0,e?(n?r.requestAnimationFrame((function(){r.dispatchEvent(new Ha(ws.READY))})):r.dispatchEvent(new Ha(ws.READY)),r.readyPromise&&r.resolveReadyPromise()):r.dispatchEvent(new Ha(ws.RENDERER_CHANGED)),e||r.getRoot().forEach((function(t){var e=t.renderable;e&&(e.renderBoundsDirty=!0,e.boundsDirty=!0,e.dirty=!0)})),r.mountChildren(r.getRoot()),t.getConfig().enableAutoRendering&&r.run()}))},e.prototype.loadRendererContainerModule=function(t){var e=this;t.getPlugins().forEach((function(t){t.context=e.context,t.init(ds)}))},e.prototype.setRenderer=function(t){var e=this.getConfig();if(e.renderer!==t){var n=e.renderer;e.renderer=t,this.destroy(!1,!0),l([],c(null==n?void 0:n.getPlugins()),!1).reverse().forEach((function(t){t.destroy(ds)})),this.initRenderer(t)}},e.prototype.setCursor=function(t){this.getConfig().cursor=t,this.getContextService().applyCursorStyle(t)},e.prototype.unmountChildren=function(t){var e=this;t.childNodes.forEach((function(t){e.unmountChildren(t)})),this.inited&&(t.isMutationObserved?t.dispatchEvent(Ks):(Ks.target=t,this.dispatchEvent(Ks,!0)),t!==this.document.documentElement&&(t.ownerDocument=null),t.isConnected=!1),t.isCustomElement&&t.disconnectedCallback&&t.disconnectedCallback()},e.prototype.mountChildren=function(t){var e=this;this.inited?t.isConnected||(t.ownerDocument=this.document,t.isConnected=!0,t.isMutationObserved?t.dispatchEvent(Ys):(Ys.target=t,this.dispatchEvent(Ys,!0))):console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",t.nodeName),t.childNodes.forEach((function(t){e.mountChildren(t)})),t.isCustomElement&&t.connectedCallback&&t.connectedCallback()},e.prototype.client2Viewport=function(t){return this.getEventService().client2Viewport(t)},e.prototype.viewport2Client=function(t){return this.getEventService().viewport2Client(t)},e.prototype.viewport2Canvas=function(t){return this.getEventService().viewport2Canvas(t)},e.prototype.canvas2Viewport=function(t){return this.getEventService().canvas2Viewport(t)},e.prototype.getPointByClient=function(t,e){return this.client2Viewport({x:t,y:e})},e.prototype.getClientByPoint=function(t,e){return this.viewport2Client({x:t,y:e})},e}(qa),tu=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.landmarks=[],e}return r(e,t),e.prototype.rotate=function(t,e,n){if(this.relElevation=nr(e),this.relAzimuth=nr(t),this.relRoll=nr(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===yr.EXPLORING){var r=vt(mt(),[1,0,0],ir((this.rotateWorld?1:-1)*this.relElevation)),i=vt(mt(),[0,1,0],ir((this.rotateWorld?1:-1)*this.relAzimuth)),o=vt(mt(),[0,0,1],ir(this.relRoll)),a=yt(mt(),i,r);a=yt(mt(),a,o);var s=F(E(),a);P(this.matrix,this.matrix,[0,0,-this.distance]),T(this.matrix,this.matrix,s),P(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return this;this.computeMatrix()}return this._getAxes(),this.type===yr.ORBITING||this.type===yr.EXPLORING?this._getPosition():this.type===yr.TRACKING&&this._getFocalPoint(),this._update(),this},e.prototype.pan=function(t,e){var n=rr(t,e,0),r=Q(this.position);return rt(r,r,ot(Z(),this.right,n[0])),rt(r,r,ot(Z(),this.up,n[1])),this._setPosition(r),this.triggerUpdate(),this},e.prototype.dolly=function(t){var e=this.forward,n=Q(this.position),r=this.dollyingStep,i=this.distance+t*this.dollyingStep;return r=Math.max(Math.min(i,this.maxDistance),this.minDistance)-this.distance,n[0]+=r*e[0],n[1]+=r*e[1],n[2]+=r*e[2],this._setPosition(n),this.type===yr.ORBITING||this.type===yr.EXPLORING?this._getDistance():this.type===yr.TRACKING&&rt(this.focalPoint,n,this.distanceVector),this.triggerUpdate(),this},e.prototype.cancelLandmarkAnimation=function(){void 0!==this.landmarkAnimationID&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)},e.prototype.createLandmark=function(t,e){var n,r,i,o;void 0===e&&(e={});var a=e.position,s=void 0===a?this.position:a,u=e.focalPoint,c=void 0===u?this.focalPoint:u,l=e.roll,h=e.zoom,d=new ds.CameraContribution;d.setType(this.type,void 0),d.setPosition(s[0],null!==(n=s[1])&&void 0!==n?n:this.position[1],null!==(r=s[2])&&void 0!==r?r:this.position[2]),d.setFocalPoint(c[0],null!==(i=c[1])&&void 0!==i?i:this.focalPoint[1],null!==(o=c[2])&&void 0!==o?o:this.focalPoint[2]),d.setRoll(null!=l?l:this.roll),d.setZoom(null!=h?h:this.zoom);var f={name:t,matrix:w(d.getWorldTransform()),right:Q(d.right),up:Q(d.up),forward:Q(d.forward),position:Q(d.getPosition()),focalPoint:Q(d.getFocalPoint()),distanceVector:Q(d.getDistanceVector()),distance:d.getDistance(),dollyingStep:d.getDollyingStep(),azimuth:d.getAzimuth(),elevation:d.getElevation(),roll:d.getRoll(),relAzimuth:d.relAzimuth,relElevation:d.relElevation,relRoll:d.relRoll,zoom:d.getZoom()};return this.landmarks.push(f),f},e.prototype.gotoLandmark=function(t,e){var n=this;void 0===e&&(e={});var r=Bt(t)?this.landmarks.find((function(e){return e.name===t})):t;if(r){var i=Wt(e)?{duration:e}:e,o=i.easing,a=void 0===o?"linear":o,s=i.duration,u=void 0===s?100:s,c=i.easingFunction,l=void 0===c?void 0:c,h=i.onfinish,d=void 0===h?void 0:h,f=i.onframe,p=void 0===f?void 0:f;if(0===u)return this.syncFromLandmark(r),void(d&&d());this.cancelLandmarkAnimation();var g,m=r.position,v=r.focalPoint,y=r.zoom,b=r.roll,E=l||ds.EasingFunction(a),w=function(){n.setFocalPoint(v),n.setPosition(m),n.setRoll(b),n.setZoom(y),n.computeMatrix(),n.triggerUpdate(),d&&d()},x=function(t){void 0===g&&(g=t);var e=t-g;if(e>u)w();else{var r,i,o=E(e/u),a=Z(),s=Z();ct(a,n.focalPoint,v,o),ct(s,n.position,m,o),i=n.roll*(1-o)+b*o,r=n.zoom*(1-o)+y*o,n.setFocalPoint(a),n.setPosition(s),n.setRoll(i),n.setZoom(r),dt(a,v)+dt(s,m)<=.01&&null==y&&null==b?w():(n.computeMatrix(),n.triggerUpdate(),e<u&&(p&&p(o),n.landmarkAnimationID=n.canvas.requestAnimationFrame(x)))}};this.canvas.requestAnimationFrame(x)}},e.prototype.syncFromLandmark=function(t){this.matrix=x(this.matrix,t.matrix),this.right=et(this.right,t.right),this.up=et(this.up,t.up),this.forward=et(this.forward,t.forward),this.position=et(this.position,t.position),this.focalPoint=et(this.focalPoint,t.focalPoint),this.distanceVector=et(this.distanceVector,t.distanceVector),this.azimuth=t.azimuth,this.elevation=t.elevation,this.roll=t.roll,this.relAzimuth=t.relAzimuth,this.relElevation=t.relElevation,this.relRoll=t.relRoll,this.dollyingStep=t.dollyingStep,this.distance=t.distance,this.zoom=t.zoom},e}(Rr);ds.CameraContribution=tu;var eu=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.currentTime=r,o.timelineTime=i,o.target=n,o.type="finish",o.bubbles=!1,o.currentTarget=n,o.defaultPrevented=!1,o.eventPhase=o.AT_TARGET,o.timeStamp=Date.now(),o.currentTime=r,o.timelineTime=i,o}return r(e,t),e}(Ga),nu=0,ru=function(){function t(t,e){var n;this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=t,t.animation=this,this.timeline=e,this.id="".concat(nu++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number(null===(n=this.effect)||void 0===n?void 0:n.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}return Object.defineProperty(t.prototype,"pending",{get:function(){return null===this._startTime&&!this._paused&&0!==this.playbackRate||this.currentTimePending},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playState",{get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){var t=this;return this.readyPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise((function(e,n){t.resolveReadyPromise=function(){e(t)},t.rejectReadyPromise=function(){n(new Error)}})),this.pending||this.resolveReadyPromise()),this.readyPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"finished",{get:function(){var t=this;return this.finishedPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise((function(e,n){t.resolveFinishedPromise=function(){e(t)},t.rejectFinishedPromise=function(){n(new Error)}})),"finished"===this.playState&&this.resolveFinishedPromise()),this.finishedPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTime",{get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(t){var e;t=Number(t),isNaN(t)||(this.timeline.restart(),this._paused||null===this._startTime||(this._startTime=Number(null===(e=this.timeline)||void 0===e?void 0:e.currentTime)-t/this.playbackRate),this.currentTimePending=!1,this._currentTime!==t&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(t,!0),this.timeline.applyDirtiedAnimation(this)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startTime",{get:function(){return this._startTime},set:function(t){if(null!==t){if(this.updatePromises(),t=Number(t),isNaN(t))return;if(this._paused||this._idle)return;this._startTime=t,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){if(t!==this._playbackRate){this.updatePromises();var e=this.currentTime;this._playbackRate=t,this.startTime=null,"paused"!==this.playState&&"idle"!==this.playState&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),null!==e&&(this.currentTime=e),this.updatePromises()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isFinished",{get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalDuration",{get:function(){return this._totalDuration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_needsTick",{get:function(){return this.pending||"running"===this.playState||!this._finishedFlag},enumerable:!1,configurable:!0}),t.prototype.updatePromises=function(){var t=this.oldPlayState,e=this.pending?"pending":this.playState;return this.readyPromise&&e!==t&&("idle"===e?(this.rejectReadyPromise(),this.readyPromise=void 0):"pending"===t?this.resolveReadyPromise():"pending"===e&&(this.readyPromise=void 0)),this.finishedPromise&&e!==t&&("idle"===e?(this.rejectFinishedPromise(),this.finishedPromise=void 0):"finished"===e?this.resolveFinishedPromise():"finished"===t&&(this.finishedPromise=void 0)),this.oldPlayState=e,this.readyPromise||this.finishedPromise},t.prototype.play=function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),-1===this.timeline.animations.indexOf(this)&&this.timeline.animations.push(this),this.updatePromises()},t.prototype.pause=function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._isFinished||this._paused||this._idle?this._idle&&(this.rewind(),this._idle=!1):this.currentTimePending=!0,this._startTime=null,this._paused=!0,this.updatePromises()},t.prototype.finish=function(){this.updatePromises(),this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())},t.prototype.cancel=function(){var t=this;if(this.updatePromises(),this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var e=new eu(null,this,this.currentTime,null);setTimeout((function(){t.oncancel(e)}))}},t.prototype.reverse=function(){this.updatePromises();var t=this.currentTime;this.playbackRate*=-1,this.play(),null!==t&&(this.currentTime=t),this.updatePromises()},t.prototype.updatePlaybackRate=function(t){this.playbackRate=t},t.prototype.targetAnimations=function(){var t;return(null===(t=this.effect)||void 0===t?void 0:t.target).getAnimations()},t.prototype.markTarget=function(){var t=this.targetAnimations();-1===t.indexOf(this)&&t.push(this)},t.prototype.unmarkTarget=function(){var t=this.targetAnimations(),e=t.indexOf(this);-1!==e&&t.splice(e,1)},t.prototype.tick=function(t,e){this._idle||this._paused||(null===this._startTime?e&&(this.startTime=t-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((t-this._startTime)*this.playbackRate)),e&&(this.currentTimePending=!1,this.fireEvents(t))},t.prototype.rewind=function(){if(this.playbackRate>=0)this.currentTime=0;else{if(!(this._totalDuration<1/0))throw new Error("Unable to rewind negative playback rate animation with infinite duration");this.currentTime=this._totalDuration}},t.prototype.persist=function(){throw new Error(Nr)},t.prototype.addEventListener=function(t,e,n){throw new Error(Nr)},t.prototype.removeEventListener=function(t,e,n){throw new Error(Nr)},t.prototype.dispatchEvent=function(t){throw new Error(Nr)},t.prototype.commitStyles=function(){throw new Error(Nr)},t.prototype.ensureAlive=function(){var t,e;this.playbackRate<0&&0===this.currentTime?this._inEffect=!!(null===(t=this.effect)||void 0===t?void 0:t.update(-1)):this._inEffect=!!(null===(e=this.effect)||void 0===e?void 0:e.update(this.currentTime)),this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,this.timeline.animations.push(this))},t.prototype.tickCurrentTime=function(t,e){t!==this._currentTime&&(this._currentTime=t,this._isFinished&&!e&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())},t.prototype.fireEvents=function(t){var e=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var n=new eu(null,this,this.currentTime,t);setTimeout((function(){e.onfinish&&e.onfinish(n)}))}this._finishedFlag=!0}}else{if(this.onframe&&"running"===this.playState){var r=new eu(null,this,this.currentTime,t);this.onframe(r)}this._finishedFlag=!1}},t}(),iu=.1,ou="function"==typeof Float32Array,au=function(t,e){return 1-3*e+3*t},su=function(t,e){return 3*e-6*t},uu=function(t){return 3*t},cu=function(t,e,n){return((au(e,n)*t+su(e,n))*t+uu(e))*t},lu=function(t,e,n){return 3*au(e,n)*t*t+2*su(e,n)*t+uu(e)},hu=function(t,e,n,r){if(!(0<=t&&t<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===r)return function(t){return t};for(var i=ou?new Float32Array(11):new Array(11),o=0;o<11;++o)i[o]=cu(o*iu,t,n);var a=function(e){for(var r=0,o=1;10!==o&&i[o]<=e;++o)r+=iu;--o;var a=r+(e-i[o])/(i[o+1]-i[o])*iu,s=lu(a,t,n);return s>=.001?function(t,e,n,r){for(var i=0;i<4;++i){var o=lu(e,n,r);if(0===o)return e;e-=(cu(e,n,r)-t)/o}return e}(e,a,t,n):0===s?a:function(t,e,n,r,i){var o,a,s=0;do{(o=cu(a=e+(n-e)/2,r,i)-t)>0?n=a:e=a}while(Math.abs(o)>1e-7&&++s<10);return a}(e,r,r+iu,t,n)};return function(t){return 0===t||1===t?t:cu(a(t),e,r)}},du=function(t){return Math.pow(t,2)},fu=function(t){return Math.pow(t,3)},pu=function(t){return Math.pow(t,4)},gu=function(t){return Math.pow(t,5)},mu=function(t){return Math.pow(t,6)},vu=function(t){return 1-Math.cos(t*Math.PI/2)},yu=function(t){return 1-Math.sqrt(1-t*t)},bu=function(t){return t*t*(3*t-2)},Eu=function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)},wu=function(t,e){void 0===e&&(e=[]);var n=c(e,2),r=n[0],i=void 0===r?1:r,o=n[1],a=void 0===o?.5:o,s=Vt(Number(i),1,10),u=Vt(Number(a),.1,2);return 0===t||1===t?t:-s*Math.pow(2,10*(t-1))*Math.sin((t-1-u/(2*Math.PI)*Math.asin(1/s))*(2*Math.PI)/u)},xu=function(t,e,n){void 0===e&&(e=[]);var r=c(e,4),i=r[0],o=void 0===i?1:i,a=r[1],s=void 0===a?100:a,u=r[2],l=void 0===u?10:u,h=r[3],d=void 0===h?0:h;o=Vt(o,.1,1e3),s=Vt(s,.1,1e3),l=Vt(l,.1,1e3),d=Vt(d,.1,1e3);var f=Math.sqrt(s/o),p=l/(2*Math.sqrt(s*o)),g=p<1?f*Math.sqrt(1-p*p):0,m=p<1?(p*f-d)/g:-d+f,v=n?n*t/1e3:t;return v=p<1?Math.exp(-v*p*f)*(1*Math.cos(g*v)+m*Math.sin(g*v)):(1+m*v)*Math.exp(-v*f),0===t||1===t?t:1-v},Mu=function(t,e){void 0===e&&(e=[]);var n=c(e,2),r=n[0],i=void 0===r?10:r;return("start"==n[1]?Math.ceil:Math.floor)(Vt(t,0,1)*i)/i},Nu=function(t,e){void 0===e&&(e=[]);var n=c(e,4),r=n[0],i=n[1],o=n[2],a=n[3];return hu(r,i,o,a)(t)},Su=hu(.42,0,1,1),Cu=function(t){return function(e,n,r){return void 0===n&&(n=[]),1-t(1-e,n,r)}},ku=function(t){return function(e,n,r){return void 0===n&&(n=[]),e<.5?t(2*e,n,r)/2:1-t(-2*e+2,n,r)/2}},Tu=function(t){return function(e,n,r){return void 0===n&&(n=[]),e<.5?(1-t(1-2*e,n,r))/2:(t(2*e-1,n,r)+1)/2}},Pu={steps:Mu,"step-start":function(t){return Mu(t,[1,"start"])},"step-end":function(t){return Mu(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":Nu,ease:function(t){return Nu(t,[.25,.1,.25,1])},in:Su,out:Cu(Su),"in-out":ku(Su),"out-in":Tu(Su),"in-quad":du,"out-quad":Cu(du),"in-out-quad":ku(du),"out-in-quad":Tu(du),"in-cubic":fu,"out-cubic":Cu(fu),"in-out-cubic":ku(fu),"out-in-cubic":Tu(fu),"in-quart":pu,"out-quart":Cu(pu),"in-out-quart":ku(pu),"out-in-quart":Tu(pu),"in-quint":gu,"out-quint":Cu(gu),"in-out-quint":ku(gu),"out-in-quint":Tu(gu),"in-expo":mu,"out-expo":Cu(mu),"in-out-expo":ku(mu),"out-in-expo":Tu(mu),"in-sine":vu,"out-sine":Cu(vu),"in-out-sine":ku(vu),"out-in-sine":Tu(vu),"in-circ":yu,"out-circ":Cu(yu),"in-out-circ":ku(yu),"out-in-circ":Tu(yu),"in-back":bu,"out-back":Cu(bu),"in-out-back":ku(bu),"out-in-back":Tu(bu),"in-bounce":Eu,"out-bounce":Cu(Eu),"in-out-bounce":ku(Eu),"out-in-bounce":Tu(Eu),"in-elastic":wu,"out-elastic":Cu(wu),"in-out-elastic":ku(wu),"out-in-elastic":Tu(wu),spring:xu,"spring-in":xu,"spring-out":Cu(xu),"spring-in-out":ku(xu),"spring-out-in":Tu(xu)},Au=function(t){return Pu[function(t){return function(t){return"-"===(t=t.replace(/([A-Z])/g,(function(t){return"-".concat(t.toLowerCase())}))).charAt(0)?t.substring(1):t}(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()}(t)]||Pu.linear},Ou=function(t){return t},_u=1,Ru=.5,Lu=0;function Du(t,e){return function(n){if(n>=1)return 1;var r=1/t;return(n+=e*r)-n%r}}var Iu="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",ju=new RegExp("cubic-bezier\\("+Iu+","+Iu+","+Iu+","+Iu+"\\)"),zu=/steps\(\s*(\d+)\s*\)/,Bu=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function Fu(t){var e=ju.exec(t);if(e)return hu.apply(void 0,l([],c(e.slice(1).map(Number)),!1));var n=zu.exec(t);if(n)return Du(Number(n[1]),Lu);var r=Bu.exec(t);return r?Du(Number(r[1]),{start:_u,middle:Ru,end:Lu}[r[2]]):Au(t)}function Gu(t){return Math.abs(function(t){var e;if(0===t.duration||0===t.iterations)return 0;return("auto"===t.duration?0:Number(t.duration))*(null!==(e=t.iterations)&&void 0!==e?e:1)}(t)/(t.playbackRate||1))}var Vu=0,Wu=1,Uu=2,Hu=3;function qu(t,e,n){var r=function(t,e,n){if(null===e)return Vu;var r=n.endTime;return e<Math.min(n.delay,r)?Wu:e>=Math.min(n.delay+t+n.endDelay,r)?Uu:Hu}(t,e,n),i=function(t,e,n,r,i){switch(r){case Wu:return"backwards"===e||"both"===e?0:null;case Hu:return n-i;case Uu:return"forwards"===e||"both"===e?t:null;case Vu:return null}}(t,n.fill,e,r,n.delay);if(null===i)return null;var o="auto"===n.duration?0:n.duration,a=function(t,e,n,r,i){var o=i;return 0===t?e!==Wu&&(o+=n):o+=r/t,o}(o,r,n.iterations,i,n.iterationStart),s=function(t,e,n,r,i,o){var a=t===1/0?e%1:t%1;return 0!==a||n!==Uu||0===r||0===i&&0!==o||(a=1),a}(a,n.iterationStart,r,n.iterations,i,o),u=function(t,e,n,r){return t===Uu&&e===1/0?1/0:1===n?Math.floor(r)-1:Math.floor(r)}(r,n.iterations,s,a),c=function(t,e,n){var r=t;if("normal"!==t&&"reverse"!==t){var i=e;"alternate-reverse"===t&&(i+=1),r="normal",i!==1/0&&i%2!=0&&(r="reverse")}return"normal"===r?n:1-n}(n.direction,u,s);return n.currentIteration=u,n.progress=c,n.easingFunction(c)}function $u(t,e,n){var r=function(t,e){for(var n={},r=0;r<t.length;r++)for(var i in t[r])if(Yu(i)){var o={offset:t[r].offset,computedOffset:t[r].computedOffset,easing:t[r].easing,easingFunction:Fu(t[r].easing)||e.easingFunction,value:t[r][i]};n[i]=n[i]||[],n[i].push(o)}return n}(t,e),i=function(t,e){var n=[];for(var r in t)for(var i=t[r],o=0;o<i.length-1;o++){var a=o,s=o+1,u=i[a].computedOffset,c=i[s].computedOffset,l=u,h=c;0===o&&(l=-1/0,0===c&&(s=a)),o===i.length-2&&(h=1/0,1===u&&(a=s)),n.push({applyFrom:l,applyTo:h,startOffset:i[a].computedOffset,endOffset:i[s].computedOffset,easingFunction:i[a].easingFunction,property:r,interpolation:Xu(r,i[a].value,i[s].value,e)})}return n.sort((function(t,e){return t.startOffset-e.startOffset})),n}(r,n);return function(t,e){if(null!==e)i.filter((function(t){return e>=t.applyFrom&&e<t.applyTo})).forEach((function(n){var r=e-n.startOffset,i=n.endOffset-n.startOffset,o=0===i?0:n.easingFunction(r/i);t.setAttribute(n.property,n.interpolation(o),!1,!1)}));else for(var n in r)Yu(n)&&t.setAttribute(n,null)}}function Yu(t){return"offset"!==t&&"easing"!==t&&"composite"!==t&&"computedOffset"!==t}var Ku=function(t,e,n){return function(r){var i=Zu(t,e,r);return!ds.enableCSSParsing&&Wt(i)?i:n(i)}};function Xu(t,e,n,r){var i=Lo[t];if(i&&i.syntax&&i.int){var o=ds.styleValueRegistry.getPropertySyntax(i.syntax);if(o){var a=void 0,s=void 0;if(ds.enableCSSParsing){var u=ds.styleValueRegistry.parseProperty(t,e,r,!1),h=ds.styleValueRegistry.parseProperty(t,n,r,!1);a=ds.styleValueRegistry.computeProperty(t,u,r,!1),s=ds.styleValueRegistry.computeProperty(t,h,r,!1)}else{var d=o.parserWithCSSDisabled;a=d?d(e,r):e,s=d?d(n,r):n}var f=o.mixer(a,s,r);if(f){var p=Ku.apply(void 0,l([],c(f),!1));return function(t){return 0===t?e:1===t?n:p(t)}}}}return Ku(!1,!0,(function(t){return t?n:e}))}function Zu(t,e,n){if("number"==typeof t&&"number"==typeof e)return t*(1-n)+e*n;if("boolean"==typeof t&&"boolean"==typeof e||"string"==typeof t&&"string"==typeof e)return n<.5?t:e;if(Array.isArray(t)&&Array.isArray(e)){for(var r=t.length,i=e.length,o=Math.max(r,i),a=[],s=0;s<o;s++)a.push(Zu(t[s<r?s:r-1],e[s<i?s:i-1],n));return a}throw new Error("Mismatched interpolation arguments "+t+":"+e)}var Qu=function(){function t(){this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=Ou,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null}return Object.defineProperty(t.prototype,"easing",{get:function(){return this._easing},set:function(t){this.easingFunction=Fu(t),this._easing=t},enumerable:!1,configurable:!0}),t}();function Ju(t,e){if(null===t)return[];Array.isArray(t)||(t=function(t){var e=[];for(var n in t)if(!(n in["easing","offset","composite"])){var r=t[n];Array.isArray(r)||(r=[r]);for(var i=r.length,o=0;o<i;o++){if(!e[o]){var a={};"offset"in t&&(a.offset=Number(t.offset)),"easing"in t&&(a.easing=t.easing),"composite"in t&&(a.composite=t.composite),e[o]=a}void 0!==r[o]&&null!==r[o]&&(e[o][n]=r[o])}}return e.sort((function(t,e){return(t.computedOffset||0)-(e.computedOffset||0)})),e}(t));for(var n=t.map((function(t){var n={};for(var r in(null==e?void 0:e.composite)&&(n.composite="auto"),t){var i=t[r];if("offset"===r){if(null!==i){if(i=Number(i),!isFinite(i))throw new Error("Keyframe offsets must be numbers.");if(i<0||i>1)throw new Error("Keyframe offsets must be between 0 and 1.");n.computedOffset=i}}else if("composite"===r&&-1===["replace","add","accumulate","auto"].indexOf(i))throw new Error("".concat(i," compositing is not supported"));n[r]=i}return void 0===n.offset&&(n.offset=null),void 0===n.easing&&(n.easing=(null==e?void 0:e.easing)||"linear"),void 0===n.composite&&(n.composite="auto"),n})),r=!0,i=-1/0,o=0;o<n.length;o++){var a=n[o].offset;if(Pt(a))r=!1;else{if(a<i)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");i=a}}return n=n.filter((function(t){return Number(t.offset)>=0&&Number(t.offset)<=1})),r||function(){var t,e,r=n.length;n[r-1].computedOffset=Number(null!==(t=n[r-1].offset)&&void 0!==t?t:1),r>1&&(n[0].computedOffset=Number(null!==(e=n[0].offset)&&void 0!==e?e:0));for(var i=0,o=Number(n[0].computedOffset),a=1;a<r;a++){var s=n[a].computedOffset;if(!Pt(s)&&!Pt(o)){for(var u=1;u<a-i;u++)n[i+u].computedOffset=o+(Number(s)-o)*u/(a-i);i=a,o=Number(s)}}}(),n}var tc="backwards|forwards|both|none".split("|"),ec="reverse|alternate|alternate-reverse".split("|");function nc(t,e){return function(t,e){var n=new Qu;return e&&(n.fill="both",n.duration="auto"),"number"!=typeof t||isNaN(t)?void 0!==t&&Object.keys(t).forEach((function(e){if(void 0!==t[e]&&null!==t[e]&&"auto"!==t[e]){if(("number"==typeof n[e]||"duration"===e)&&("number"!=typeof t[e]||isNaN(t[e])))return;if("fill"===e&&-1===tc.indexOf(t[e]))return;if("direction"===e&&-1===ec.indexOf(t[e]))return;n[e]=t[e]}})):n.duration=t,n}(t=function(t){"number"==typeof t&&(t=isNaN(t)?{duration:"auto"}:{duration:t});return t}(null!=t?t:{duration:"auto"}),e)}var rc=function(){function t(t,e,n){var r=this;this.composite="replace",this.iterationComposite="replace",this.target=t,this.timing=nc(n,!1),this.timing.effect=this,this.timing.activeDuration=Gu(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=Ju(e,this.timing),this.interpolations=$u(this.normalizedKeyframes,this.timing,this.target);var i=ds.globalThis.Proxy;this.computedTiming=i?new i(this.timing,{get:function(t,e){return"duration"===e?"auto"===t.duration?0:t.duration:"fill"===e?"auto"===t.fill?"none":t.fill:"localTime"===e?r.animation&&r.animation.currentTime||null:"currentIteration"===e?r.animation&&"running"===r.animation.playState?t.currentIteration||0:null:"progress"===e?r.animation&&"running"===r.animation.playState?t.progress||0:null:t[e]},set:function(){return!0}}):this.timing}return t.prototype.applyInterpolations=function(){this.interpolations(this.target,Number(this.timeFraction))},t.prototype.update=function(t){return null!==t&&(this.timeFraction=qu(this.timing.activeDuration,t,this.timing),null!==this.timeFraction)},t.prototype.getKeyframes=function(){return this.normalizedKeyframes},t.prototype.setKeyframes=function(t){this.normalizedKeyframes=Ju(t)},t.prototype.getComputedTiming=function(){return this.computedTiming},t.prototype.getTiming=function(){return this.timing},t.prototype.updateTiming=function(t){var e=this;Object.keys(t||{}).forEach((function(n){e.timing[n]=t[n]}))},t}();function ic(t,e){return Number(t.id)-Number(e.id)}var oc=function(){function t(t){var e=this;this.document=t,this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(t){e.currentTime=t,e.discardAnimations(),0===e.animations.length?e.timelineTicking=!1:e.requestAnimationFrame(e.webAnimationsNextTick)},this.processRafCallbacks=function(t){var n=e.rafCallbacks;e.rafCallbacks=[],t<Number(e.currentTime)&&(t=Number(e.currentTime)),e.animations.sort(ic),e.animations=e.tick(t,!0,e.animations)[0],n.forEach((function(e){e[1](t)})),e.applyPendingEffects()}}return t.prototype.getAnimations=function(){return this.discardAnimations(),this.animations.slice()},t.prototype.isTicking=function(){return this.inTick},t.prototype.play=function(t,e,n){var r=new rc(t,e,n),i=new ru(r,this);return this.animations.push(i),this.restartWebAnimationsNextTick(),i.updatePromises(),i.play(),i.updatePromises(),i},t.prototype.applyDirtiedAnimation=function(t){var e=this;if(!this.inTick){t.markTarget();var n=t.targetAnimations();n.sort(ic),this.tick(Number(this.currentTime),!1,n.slice())[1].forEach((function(t){var n=e.animations.indexOf(t);-1!==n&&e.animations.splice(n,1)})),this.applyPendingEffects()}},t.prototype.restart=function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame((function(){})),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame},t.prototype.destroy=function(){this.document.defaultView.cancelAnimationFrame(this.frameId)},t.prototype.applyPendingEffects=function(){this.pendingEffects.forEach((function(t){null==t||t.applyInterpolations()})),this.pendingEffects=[]},t.prototype.updateAnimationsPromises=function(){this.animationsWithPromises=this.animationsWithPromises.filter((function(t){return t.updatePromises()}))},t.prototype.discardAnimations=function(){this.updateAnimationsPromises(),this.animations=this.animations.filter((function(t){return"finished"!==t.playState&&"idle"!==t.playState}))},t.prototype.restartWebAnimationsNextTick=function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))},t.prototype.rAF=function(t){var e=this.rafId++;return 0===this.rafCallbacks.length&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([e,t]),e},t.prototype.requestAnimationFrame=function(t){var e=this;return this.rAF((function(n){e.updateAnimationsPromises(),t(n),e.updateAnimationsPromises()}))},t.prototype.tick=function(t,e,n){var r,i,o=this;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=t,this.ticking=!1;var a=[],s=[],u=[],h=[];return n.forEach((function(n){n.tick(t,e),n._inEffect?(s.push(n.effect),n.markTarget()):(a.push(n.effect),n.unmarkTarget()),n._needsTick&&(o.ticking=!0);var r=n._inEffect||n._needsTick;n._inTimeline=r,r?u.push(n):h.push(n)})),(r=this.pendingEffects).push.apply(r,l([],c(a),!1)),(i=this.pendingEffects).push.apply(i,l([],c(s),!1)),this.ticking&&this.requestAnimationFrame((function(){})),this.inTick=!1,[u,h]},t}();ds.EasingFunction=Fu,ds.AnimationTimeline=oc;const ac={duration:500},sc={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var uc,cc,lc,hc,dc,fc,pc,gc;!function(t){t.NodeAdded="NodeAdded",t.NodeUpdated="NodeUpdated",t.NodeRemoved="NodeRemoved",t.EdgeAdded="EdgeAdded",t.EdgeUpdated="EdgeUpdated",t.EdgeRemoved="EdgeRemoved",t.ComboAdded="ComboAdded",t.ComboUpdated="ComboUpdated",t.ComboRemoved="ComboRemoved"}(uc||(uc={})),function(t){t.DRAW="draw",t.TRANSFORM="transform",t.ELEMENT_VISIBILITY_CHANGE="elementvisibilitychange",t.ELEMENT_STATE_CHANGE="elementstatechange",t.ELEMENT_TRANSLATE="elementtranslate"}(cc||(cc={})),t.CanvasEvent=void 0,function(t){t.CLICK="click",t.DBLCLICK="dblclick",t.POINTER_OVER="pointerover",t.POINTER_LEAVE="pointerleave",t.POINTER_ENTER="pointerenter",t.POINTER_MOVE="pointermove",t.POINTER_OUT="pointerout",t.POINTER_DOWN="pointerdown",t.POINTER_UP="pointerup",t.CONTEXT_MENU="contextmenu",t.DRAG_START="dragstart",t.DRAG="drag",t.DRAG_END="dragend",t.DRAG_ENTER="dragenter",t.DRAG_OVER="dragover",t.DRAG_LEAVE="dragleave",t.DROP="drop",t.WHEEL="wheel"}(t.CanvasEvent||(t.CanvasEvent={})),t.NodeEvent=void 0,(lc=t.NodeEvent||(t.NodeEvent={})).CLICK="click",lc.DBLCLICK="dblclick",lc.POINTER_OVER="pointerover",lc.POINTER_LEAVE="pointerleave",lc.POINTER_ENTER="pointerenter",lc.POINTER_MOVE="pointermove",lc.POINTER_OUT="pointerout",lc.POINTER_DOWN="pointerdown",lc.POINTER_UP="pointerup",lc.CONTEXT_MENU="contextmenu",lc.DRAG_START="dragstart",lc.DRAG="drag",lc.DRAG_END="dragend",lc.DRAG_ENTER="dragenter",lc.DRAG_OVER="dragover",lc.DRAG_LEAVE="dragleave",lc.DROP="drop",t.CommonEvent=void 0,(hc=t.CommonEvent||(t.CommonEvent={})).CLICK="click",hc.DBLCLICK="dblclick",hc.POINTER_OVER="pointerover",hc.POINTER_LEAVE="pointerleave",hc.POINTER_ENTER="pointerenter",hc.POINTER_MOVE="pointermove",hc.POINTER_OUT="pointerout",hc.POINTER_DOWN="pointerdown",hc.POINTER_UP="pointerup",hc.CONTEXT_MENU="contextmenu",hc.DRAG_START="dragstart",hc.DRAG="drag",hc.DRAG_END="dragend",hc.DRAG_ENTER="dragenter",hc.DRAG_OVER="dragover",hc.DRAG_LEAVE="dragleave",hc.DROP="drop",hc.KEY_DOWN="keydown",hc.KEY_UP="keyup",hc.WHEEL="wheel",t.ContainerEvent=void 0,(dc=t.ContainerEvent||(t.ContainerEvent={})).KEY_DOWN="keydown",dc.KEY_UP="keyup",t.EdgeEvent=void 0,(fc=t.EdgeEvent||(t.EdgeEvent={})).CLICK="click",fc.DBLCLICK="dblclick",fc.POINTER_OVER="pointerover",fc.POINTER_LEAVE="pointerleave",fc.POINTER_ENTER="pointerenter",fc.POINTER_MOVE="pointermove",fc.POINTER_OUT="pointerout",fc.POINTER_DOWN="pointerdown",fc.POINTER_UP="pointerup",fc.CONTEXT_MENU="contextmenu",fc.DRAG_ENTER="dragenter",fc.DRAG_OVER="dragover",fc.DRAG_LEAVE="dragleave",fc.DROP="drop",t.GraphEvent=void 0,(pc=t.GraphEvent||(t.GraphEvent={})).BEFORE_CANVAS_INIT="beforecanvasinit",pc.AFTER_CANVAS_INIT="aftercanvasinit",pc.BEFORE_SIZE_CHANGE="beforesizechange",pc.AFTER_SIZE_CHANGE="aftersizechange",pc.BEFORE_ELEMENT_CREATE="beforeelementcreate",pc.AFTER_ELEMENT_CREATE="afterelementcreate",pc.BEFORE_ELEMENT_UPDATE="beforeelementupdate",pc.AFTER_ELEMENT_UPDATE="afterelementupdate",pc.BEFORE_ELEMENT_DESTROY="beforeelementdestroy",pc.AFTER_ELEMENT_DESTROY="afterelementdestroy",pc.BEFORE_ELEMENT_TRANSLATE="beforeelementtranslate",pc.AFTER_ELEMENT_TRANSLATE="afterelementtranslate",pc.BEFORE_DRAW="beforedraw",pc.AFTER_DRAW="afterdraw",pc.BEFORE_RENDER="beforerender",pc.AFTER_RENDER="afterrender",pc.BEFORE_ANIMATE="beforeanimate",pc.AFTER_ANIMATE="afteranimate",pc.BEFORE_LAYOUT="beforelayout",pc.AFTER_LAYOUT="afterlayout",pc.BEFORE_TRANSFORM="beforetransform",pc.AFTER_TRANSFORM="aftertransform",function(t){t.DRAW="draw",t.ELEMENT_VISIBILITY_CHANGE="elementvisibilitychange",t.ELEMENT_STATE_CHANGE="elementstatechange",t.ELEMENT_TRANSLATE="elementtranslate"}(gc||(gc={}));const mc="combo",vc="tree";var yc;function bc(t){return"source"in t&&"target"in t}function Ec(t){return t instanceof Float32Array||!(!Array.isArray(t)||2!==t.length&&3!==t.length)&&t.every((t=>"number"==typeof t))}function wc(t,e,n){return t>=e&&t<=n}function xc(t=0){if(Array.isArray(t)){const[e=0,n=e,r=e,i=n]=t;return[e,n,r,i]}return[t,t,t,t]}function Mc(t){return t.max[0]-t.min[0]}function Nc(t){return t.max[1]-t.min[1]}function Sc(t){return[Mc(t),Nc(t)]}function Cc(t,e){const n=Ec(t)?function(t){const[e,n,r=0]=t,i=new mr;return i.setMinMax([e,n,r],[e,n,r]),i}(t):t.getKey().getBounds();return e?kc(n,e):n}function kc(t,e){const[n,r,i,o]=xc(e),[a,s,u]=t.min,[c,l,h]=t.max,d=new mr;return d.setMinMax([a-o,s-n,u],[c+r,l+i,h]),d}function Tc(t){if(0===t.length)return new mr;if(1===t.length)return t[0];const e=new mr;e.setMinMax(t[0].min,t[0].max);for(let n=1;n<t.length;n++){const r=t[n];e.setMinMax([Math.min(e.min[0],r.min[0]),Math.min(e.min[1],r.min[1]),Math.min(e.min[2],r.min[2])],[Math.max(e.max[0],r.max[0]),Math.max(e.max[1],r.max[1]),Math.max(e.max[2],r.max[2])])}return e}function Pc(t,e){return wc(t[0],e.min[0],e.max[0])&&wc(t[1],e.min[1],e.max[1])}function Ac(t,e){const[n,r]=e,[i,o]=t.min,[a,s]=t.max,u=n-i,c=a-n,l=r-o,h=s-r,d=Math.min(u,c,l,h);return d===u?"left":d===c?"right":d===l?"top":d===h?"bottom":"left"}function Oc(t,e){const n=Jt(e);if(Pc(e,t)){switch(Ac(t,e)){case"left":n[0]=t.min[0];break;case"right":n[0]=t.max[0];break;case"top":n[1]=t.min[1];break;case"bottom":n[1]=t.max[1]}}else{const[r,i]=e,[o,a]=t.min,[s,u]=t.max;n[0]=wc(r,o,s)?r:r<o?o:s,n[1]=wc(i,a,u)?i:i<a?a:u}return n}function _c(t){const{x:e=0,y:n=0,z:r=0}=t.style||{};return[+e,+n,+r]}function Rc(t,e){const[n,r]=e,{min:i,max:o}=t;return[i[0]+n*(o[0]-i[0]),i[1]+r*(o[1]-i[1])]}function Lc(t,e="center"){const n=function(t){if(Array.isArray(t))return wc(t[0],0,1)&&wc(t[1],0,1)?t:[.5,.5];const e=t.split("-");return[e.includes("left")?0:e.includes("right")?1:.5,e.includes("top")?0:e.includes("bottom")?1:.5]}(e);return Rc(t,n)}function Dc(t,e){const n=function(t){const e="string"==typeof t?t.split(" ").map((t=>parseFloat(t))):t.slice(0,2);return wc(e[0],0,1)&&wc(e[1],0,1)?e:[.5,.5]}(e);return Rc(t,n)}function Ic(t=0){if(Wt(t))return Array(3).fill(t);const[e,n=e,r=e]=t;return[e,n,r]}function jc(t,e,n){if(Array.isArray(t))return t;const[r,i]=Ic(n),[o,a]=Ic(e),s=o/2/r,u=a/2/i;switch(t){case"top":return[.5,u];case"bottom":return[.5,1-u];case"left":return[s,.5];case"right":return[1-s,.5];case"top-left":case"left-top":return[s,u];case"top-right":case"right-top":return[1-s,u];case"bottom-left":case"left-bottom":return[s,1-u];case"bottom-right":case"right-bottom":return[1-s,1-u];default:return[.5,.5]}}function zc(t,e,n){if(Array.isArray(t))return t;const r=Ic(n)[0],i=r/2,o=Ic(e)[0]/2,a=o/r;switch(t){case"top":return[.5,a];case"bottom":return[.5,1-a];case"left":return[a,.5];case"right":return[1-a,.5]}const s=(i-o)*(Math.sqrt(2)/2)/r;switch(t){case"top-left":case"left-top":return[.5-s,.5-s];case"top-right":case"right-top":return[.5+s,.5-s];case"bottom-left":case"left-bottom":return[.5-s,.5+s];case"bottom-right":case"right-bottom":return[.5+s,.5+s];default:return[.5,.5]}}function Bc(t,e,n,r,i=jc){const o=i(t,n,r),[a,s]=Ic(r),u=new mr;return u.setMinMax([e[0]-a/2,e[1]-s/2,0],[e[0]+a/2,e[1]+s/2,0]),Dc(u,o)}function Fc(t){if(Bt(t.id)||Wt(t.id))return t.id;if(bc(t))return`${t.source}-${t.target}`;throw new Error("The data does not have available id.")}function Gc(t){return t.style?.parentId}function Vc(t,e){if(!t.startsWith(e))return!1;const n=t[e.length];return n>="A"&&n<="Z"}function Wc(t,e){return Object.entries(t).reduce(((t,[n,r])=>("className"===n||"class"===n||Vc(n,e)&&(t[function(t,e,n=!0){if(!e)return t;if(!Vc(t,e))return t;const r=t.slice(e.length);return n?Yt(r):r}(n,e)]=r),t)),{})}function Uc(t,e){const n=e.length;return Object.keys(t).reduce(((r,i)=>{if(i.startsWith(e)){r[i.slice(n)]=t[i]}return r}),{})}function Hc(t,e){const n=Bt(e)?[e]:e;return Object.entries(t).reduce(((t,[e,r])=>(n.find((t=>e.startsWith(t)))||(t[e]=r),t)),{})}t.ExtensionCategory=void 0,(yc=t.ExtensionCategory||(t.ExtensionCategory={})).NODE="node",yc.EDGE="edge",yc.COMBO="combo",yc.THEME="theme",yc.PALETTE="palette",yc.LAYOUT="layout",yc.BEHAVIOR="behavior",yc.PLUGIN="plugin",yc.ANIMATION="animation";const qc=[0,0,0];function $c(t,e){return t.map(((t,n)=>t+e[n]))}function Yc(t,e){return t.map(((t,n)=>t-e[n]))}function Kc(t,e){return"number"==typeof e?t.map((t=>t*e)):t.map(((t,n)=>t*e[n]))}function Xc(t,e){return"number"==typeof e?t.map((t=>t/e)):t.map(((t,n)=>t/e[n]))}function Zc(t,e){return Math.sqrt(t.reduce(((t,n,r)=>t+(n-e[r]||0)**2),0))}function Qc(t,e){return t.reduce(((t,n,r)=>t+Math.abs(n-e[r])),0)}function Jc(t){const e=t.reduce(((t,e)=>t+e**2),0);return t.map((t=>t/Math.sqrt(e)))}function tl(t){return 2===t.length?[t[0],t[1],0]:t}function el(t){if(t)return"string"==typeof t||"function"==typeof t||Array.isArray(t)?{type:"group",field:t=>t.id,color:t,invert:!1}:t}function nl(t){return[t.x,t.y]}function rl(t){return{x:t[0],y:t[1]}}function il(t,e=0){return t.map((t=>parseFloat(t.toFixed(e))))}function ol(t,e,n,r=!1){const i=Jc(r?Yc(t,e):Yc(e,t)),o=[i[0]*n,i[1]*n];return $c(function(t){return[t[0],t[1]]}(t),o)}function al(t,e){return t[1]===e[1]}function sl(t,e){const[n,r]=t,[i,o]=e;return function(t,e){const n=tl(t),r=tl(e);return[n[1]*r[2]-n[2]*r[1],n[2]*r[0]-n[0]*r[2],n[0]*r[1]-n[1]*r[0]]}(Yc(n,r),Yc(i,o)).every((t=>0===t))}function ul(t,e){if(sl(t,e))return;const[n,r]=t,[i,o]=e,a=((n[0]-i[0])*(i[1]-o[1])-(n[1]-i[1])*(i[0]-o[0]))/((n[0]-r[0])*(i[1]-o[1])-(n[1]-r[1])*(i[0]-o[0])),s=o[0]-i[0]?(n[0]-i[0]+a*(r[0]-n[0]))/(o[0]-i[0]):(n[1]-i[1]+a*(r[1]-n[1]))/(o[1]-i[1]);return wc(a,0,1)&&wc(s,0,1)?[n[0]+a*(r[0]-n[0]),n[1]+a*(r[1]-n[1])]:void 0}function cl(t,e,n,r=!0){for(let i=0;i<n.length;i++){let o=n[i],a=n[(i+1)%n.length];r&&(o=$c(e,o),a=$c(e,a));const s=ul([e,t],[o,a]);if(s)return s}return e}function ll(t,e){const n=e.center,r=Yc(t,e.center),i=Math.atan2(r[1],r[0]);if(isNaN(i))return n;const o=Mc(e)/2,a=Nc(e)/2;return[n[0]+o*Math.cos(i),n[1]+a*Math.sin(i)]}function hl(t,e){let n=2*t;return"string"==typeof e?n=t*Number(e.replace("%",""))/100:"number"==typeof e&&(n=e),isNaN(n)&&(n=2*t),n}function dl(t,e,n=1,r=!1){const i=r?n:1;return hl((t.max[0]-t.min[0])*i,e)}const fl="cachedStyle",pl=t=>`__${t}__`;function gl(t,e){const n=Array.isArray(e)?e:[e];se(t,fl)||ue(t,fl,{}),n.forEach((e=>{ue(se(t,fl),pl(e),t.attributes[e])}))}function ml(t,e){return se(t,[fl,pl(e)])}function vl(t,e){return pl(e)in(se(t,fl)||{})}function yl(t){const e=[],n=t=>{t.children&&t.children.length&&t.children.forEach((t=>{e.push(t),n(t)}))};return n(t),e}const bl="visibility";class El extends As{constructor(t){super(t),this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}shapeMap={};animateMap={};upsert(t,e,n,r){const i=this.shapeMap[t];if(!1!==n){if(!i){const i=new e({style:n});return i.id=t,r.appendChild(i),this.shapeMap[t]=i,i}return kh(i,n),i}i&&(r.removeChild(i),delete this.shapeMap[t])}update(t={}){this.attr(re({},this.attributes,t)),this.render(this.attributes,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){const{x:e,y:n,z:r,className:i,transform:o,transformOrigin:a,context:s,zIndex:u,...c}=t;return c}animate(t,e){const n=[],r=super.animate(t,e);if(r&&n.push(r),Array.isArray(t)&&t.length>0){const r=["anchor","transform","transformOrigin","x","y","z","zIndex"];Object.keys(t[0]).some((t=>!r.includes(t)))&&Object.entries(this.shapeMap).forEach((([r,i])=>{const o=this[`get${r[0].toUpperCase()}${r.slice(1)}Style`];if("function"==typeof o){const r=t.map((t=>o.call(this,{...this.attributes,...t}))),a=i.animate(Ph(r),e);a&&n.push(a)}}))}return Th(n)}setVisibility(){const{visibility:t}=this.attributes;!function(t,e){[t,...yl(t)].forEach((n=>{vl(n,bl)||gl(n,bl);const r=ml(n,bl);t!==n&&"hidden"===r||(n.style.visibility=e)}))}(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}class wl extends El{static defaultStyleProps={padding:0,fontSize:12,wordWrap:!0,maxLines:1,wordWrapWidth:128,textOverflow:"...",textBaseline:"middle",backgroundOpacity:.75,backgroundZIndex:-1,backgroundLineWidth:0};constructor(t){super(re({},{style:wl.defaultStyleProps},t))}isTextStyle(t){return Vc(t,"label")}isBackgroundStyle(t){return Vc(t,"background")}getTextStyle(t){const{padding:e,...n}=this.getGraphicStyle(t);return Hc(n,"background")}getBackgroundStyle(t){if(!1===t.background)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:r,padding:i}=e,o=Wc(e,"background"),{min:[a,s],halfExtents:[u,c]}=this.shapeMap.text.getGeometryBounds(),[l,h,d,f]=xc(i);Object.assign(o,{x:a-f,y:s-l,width:n?Math.min(2*u,r):2*u+f+h,height:2*c+l+d});const{radius:p}=o;if("string"==typeof p&&p.endsWith("%")){const t=Number(p.replace("%",""))/100;o.radius=Math.min(+o.width,+o.height)*t}return o}render(t=this.parsedAttributes,e=this){this.upsert("text",Fs,this.getTextStyle(t),e),this.upsert("background",Bs,this.getBackgroundStyle(t),e)}}class xl extends El{static defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};constructor(t){super(re({},{style:xl.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",wl,this.getBadgeStyle(t),e)}connectedCallback(){this.upsert("label",wl,this.getBadgeStyle(this.parsedAttributes),this)}}class Ml extends El{constructor(t){super(t)}isGImage(){return!!this.getAttribute("src")}getIconStyle(t=this.attributes){const e=this.getGraphicStyle(t);return this.isGImage()?{anchor:[.5,.5],...e}:{textBaseline:"middle",textAlign:"center",...e}}render(t=this.attributes,e=this){this.upsert("icon",this.isGImage()?Ls:Fs,this.getIconStyle(t),e)}connectedCallback(){this.upsert("icon",this.isGImage()?Ls:Fs,this.getIconStyle(this.attributes),this)}}class Nl extends El{type="node";static defaultStyleProps={x:0,y:0,size:24,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};constructor(t){super(re({},{style:Nl.defaultStyleProps},t))}getSize(t=this.parsedAttributes){const{size:e}=t;return Ic(e)}getKeyStyle(t){const{color:e,fill:n,...r}=this.getGraphicStyle(t);return Object.assign({fill:e||n},Hc(r,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(!1===t.label||oe(t.labelText))return!1;const{placement:e,maxWidth:n,...r}=Wc(this.getGraphicStyle(t),"label"),i=this.getKey().getLocalBounds();return Object.assign(Ch(i,e),{wordWrapWidth:dl(i,n)},r)}getHaloStyle(t){if(!1===t.halo)return!1;const{fill:e,...n}=this.getKeyStyle(t);return{...n,stroke:e,...Wc(this.getGraphicStyle(t),"halo")}}getIconStyle(t){if(!1===t.icon||oe(t.iconText||t.iconSrc))return!1;const e=Wc(this.getGraphicStyle(t),"icon"),n=this.getKey(),[r,i]=Lc(n.getLocalBounds(),"center");return{x:r,y:i,...e}}getBadgesStyle(t){const e=Uc(this.shapeMap,"badge-"),n={};if(Object.keys(e).forEach((t=>{n[t]=!1})),!1===t.badge||oe(t.badges))return n;const{badges:r=[],badgePalette:i,...o}=t,a=function(t){const e=Bt(t)?yI("palette",t):t;if(!Tt(e))return e}(i),s=Wc(this.getGraphicStyle(o),"badge");return r.forEach(((t,e)=>{n[e]={backgroundFill:a?a[e%a?.length]:void 0,...s,...this.getBadgeStyle(t)}})),n}getBadgeStyle(t){const e=this.getKey(),{placement:n="top",...r}=t;return{...Ch(e.getLocalBounds(),n,!0),...r}}getPortsStyle(t){const e=this.getPorts(),n={};if(Object.keys(e).forEach((t=>{n[t]=!1})),!1===t.port||oe(t.ports))return n;const r=Wc(this.getGraphicStyle(t),"port"),{ports:i=[]}=t;return i.forEach(((e,i)=>{const o=e.key||i,a={...r,...e};if(bh(a))n[o]=!1;else{const[r,i]=this.getPortXY(t,e);n[o]={cx:r,cy:i,...a}}})),n}getPortXY(t,e){const{placement:n="left"}=e;return vh(this.getKey().getLocalBounds(),n)}getKey(){return this.shapeMap.key}getPorts(){return Uc(this.shapeMap,"port-")}getCenter(){return this.getKey().getBounds().center}getIntersectPoint(t){const e=this.getKey().getBounds();return cl(t,Lc(n=e,"center"),[Lc(n,"left-top"),Lc(n,"right-top"),Lc(n,"right-bottom"),Lc(n,"left-bottom")],!1);var n}drawHaloShape(t,e){const n=this.getKey();this.upsert("halo",n.constructor,this.getHaloStyle(t),e)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach((t=>{this.upsert(`badge-${t}`,xl,n[t],e)}))}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach((t=>{this.upsert(`port-${t}`,Ps,n[t],e)}))}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e)&&(this.drawHaloShape(t,e),this.upsert("icon",Ml,this.getIconStyle(t),e),this.drawBadgeShapes(t,e),this.upsert("label",wl,this.getLabelStyle(t),e),this.drawPortShapes(t,e))}onCreate(){}onUpdate(){}onDestroy(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>{this.drawBadgeShapes(this.parsedAttributes,this)}),n}}const Sl=.8,Cl=["node","edge","combo"];class kl extends Nl{static defaultStyleProps={size:24};constructor(t){super(re({},{style:kl.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Ps,this.getKeyStyle(t),e)}getKeyStyle(t){return{...super.getKeyStyle(t),r:Math.min(...this.getSize(t))/2}}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getKeyStyle(t),r=2*n*Sl;return!!e&&{width:r,height:r,...e}}getIntersectPoint(t){return ll(t,this.getKey().getBounds())}}class Tl extends Nl{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",js,this.getKeyStyle(t),e)}getKeyStyle(t){return{...super.getKeyStyle(t),points:this.getPoints(t)}}getIntersectPoint(t){const{points:e}=this.getKeyStyle(this.parsedAttributes);return cl(t,[+(this.attributes?.x||0),+(this.attributes?.y||0)],e)}}class Pl extends Tl{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return function(t,e){return[[0,-e/2],[t/2,0],[0,e/2],[-t/2,0]]}(e,n)}getIntersectPoint(t){const{points:e}=this.getKeyStyle(this.attributes);return cl(t,[this.attributes.x,this.attributes.y],e)}}class Al extends Nl{static defaultStyleProps={size:[80,40]};constructor(t){super(re({},{style:Al.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Os,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,r]=this.getSize(t);return{...e,rx:n/2,ry:r/2}}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:r}=this.getKeyStyle(t),i=2*Math.min(n,r)*Sl;return!!e&&{width:i,height:i,...e}}getIntersectPoint(t){return ll(t,this.getKey().getBounds())}}class Ol extends Tl{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return[[0,e=this.getOuterR(t)],[e*Math.sqrt(3)/2,e/2],[e*Math.sqrt(3)/2,-e/2],[0,-e],[-e*Math.sqrt(3)/2,-e/2],[-e*Math.sqrt(3)/2,e/2]];var e}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*Sl;return!!e&&{width:n,height:n,...e}}}let _l=class t extends Nl{static defaultStyleProps={size:50};constructor(e){super(re({},{style:t.defaultStyleProps},e))}getKeyStyle(t){const[e,n]=this.getSize(t);return{...super.getKeyStyle(t),width:e,height:n,anchor:[.5,.5]}}getHaloStyle(t){if(!1===t.halo)return!1;const{fill:e,stroke:n,...r}=this.getKeyStyle(t),i=Wc(this.getGraphicStyle(t),"halo"),o=Number(i.lineWidth),[a,s]=$c(this.getSize(t),[o,o]);return{...r,...i,width:a,height:s,fill:"transparent"}}getIconStyle(t){const e=super.getIconStyle(t),[n,r]=this.getSize(t);return!!e&&{width:n*Sl,height:r*Sl,...e}}drawKeyShape(t,e){return this.upsert("key",Ls,this.getKeyStyle(t),e)}drawHaloShape(t,e){this.upsert("halo",Bs,this.getHaloStyle(t),e)}};class Rl extends Nl{static defaultStyleProps={size:[48,24],anchor:[.5,.5]};constructor(t){super(re({},{style:Rl.defaultStyleProps},t))}getKeyStyle(t){const[e,n]=this.getSize(t);return{...super.getKeyStyle(t),width:e,height:n}}getIconStyle(t){const e=super.getIconStyle(t),{width:n,height:r}=this.getKeyStyle(t);return!!e&&{width:n*Sl,height:r*Sl,...e}}drawKeyShape(t,e){return this.upsert("key",Bs,this.getKeyStyle(t),e)}}class Ll extends Tl{constructor(t){super(t)}getInnerR(t){return t.innerR||3*this.getOuterR(t)/8}getOuterR(t){return Math.min(...this.getSize(t))/2}getPoints(t){return e=this.getOuterR(t),n=this.getInnerR(t),[[0,-e],[n*Math.cos(3*Math.PI/10),-n*Math.sin(3*Math.PI/10)],[e*Math.cos(Math.PI/10),-e*Math.sin(Math.PI/10)],[n*Math.cos(Math.PI/10),n*Math.sin(Math.PI/10)],[e*Math.cos(3*Math.PI/10),e*Math.sin(3*Math.PI/10)],[0,n],[-e*Math.cos(3*Math.PI/10),e*Math.sin(3*Math.PI/10)],[-n*Math.cos(Math.PI/10),n*Math.sin(Math.PI/10)],[-e*Math.cos(Math.PI/10),-e*Math.sin(Math.PI/10)],[-n*Math.cos(3*Math.PI/10),-n*Math.sin(3*Math.PI/10)]];var e,n}getIconStyle(t){const e=super.getIconStyle(t),n=2*this.getInnerR(t)*Sl;return!!e&&{width:n,height:n,...e}}getPortXY(t,e){const{placement:n="top"}=e;return vh(this.getKey().getLocalBounds(),n,function(t,e){const n={};return n.top=[0,-t],n.left=[-t*Math.cos(Math.PI/10),-t*Math.sin(Math.PI/10)],n["left-bottom"]=[-t*Math.cos(3*Math.PI/10),t*Math.sin(3*Math.PI/10)],n.bottom=[0,e],n["right-bottom"]=[t*Math.cos(3*Math.PI/10),t*Math.sin(3*Math.PI/10)],n.right=n.default=[t*Math.cos(Math.PI/10),-t*Math.sin(Math.PI/10)],n}(this.getOuterR(t),this.getInnerR(t)),!1)}}class Dl extends Tl{static defaultStyleProps={size:40,direction:"up"};constructor(t){super(re({},{style:Dl.defaultStyleProps},t))}getPoints(t){const{direction:e}=t,[n,r]=this.getSize(t);return function(t,e,n){const r=e/2,i=t/2,o={up:[[-i,r],[i,r],[0,-r]],left:[[-i,0],[i,r],[i,-r]],right:[[-i,r],[-i,-r],[i,0]],down:[[-i,-r],[i,-r],[0,r]]};return o[n]||o.up}(n,r,e)}getPortXY(t,e){const{direction:n}=t,{placement:r="top"}=e,i=this.getKey().getLocalBounds(),[o,a]=this.getSize(t),s=function(t,e,n){const r=e/2,i=t/2,o={};"down"===n?(o.bottom=o.default=[0,r],o.right=[i,-r],o.left=[-i,-r]):"left"===n?(o.top=[i,-r],o.bottom=[i,r],o.left=o.default=[-i,0]):"right"===n?(o.top=[-i,-r],o.bottom=[-i,r],o.right=o.default=[i,0]):(o.left=[-i,r],o.top=o.default=[0,-r],o.right=[i,r]);return o}(o,a,n);return vh(i,r,s,!1)}getIconStyle(t){const{icon:e,iconText:n,iconSrc:r,direction:i}=t;if(!1===e||oe(n||r))return!1;const o=Wc(this.getGraphicStyle(t),"icon"),a=this.getKey().getLocalBounds(),[s,u]=function(t,e){const{center:n}=t,[r,i]=Sc(t);return["up"===e||"down"===e?n[0]:"right"===e?n[0]-r/6:n[0]+r/6,"left"===e||"right"===e?n[1]:"down"===e?n[1]-i/6:n[1]+i/6]}(a,i),c=2*function(t,e){let[n,r]=Sc(t);return[n,r]="up"===e||"down"===e?[n,r]:[r,n],(r**2-(Math.sqrt((n/2)**2+r**2)-n/2)**2)/(2*r)}(a,i)*Sl;return{x:s,y:u,width:c,height:c,...o}}}class Il extends Nl{type="combo";static defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedOrigin:[.5,.5],collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};constructor(t){super(re({},{style:Il.defaultStyleProps},t))}calculatePosition(t){const{x:e=0,y:n=0,collapsed:r,childrenNode:i=[],childrenData:o=[]}=t;if(i.length<o.length){if(o.length>0&&r){return Xc(o.reduce(((t,e)=>$c(t,_c(e))),[0,0,0]),o.length)}return[+e,+n,0]}return o.length?r?this.getCollapsedOriginPosition(t):this.getContentBBox(t).center:[+e,+n,0]}getCollapsedOriginPosition(t){return Bc(t.collapsedOrigin,this.getContentBBox(t).center,this.getCollapsedKeySize(t),this.getExpandedKeySize(t))}getKeySize(t){const{collapsed:e,childrenNode:n=[]}=t;return 0===n.length?this.getEmptyKeySize(t):e?this.getCollapsedKeySize(t):this.getExpandedKeySize(t)}getEmptyKeySize(t){const{padding:e,collapsedSize:n}=t,[r,i,o,a]=xc(e);return $c(Ic(n),[a+i,r+o,0])}getCollapsedKeySize(t){return Ic(t.collapsedSize)}getExpandedKeySize(t){if(!oe(t.size))return Ic(t.size);const e=this.getContentBBox(t);return[Mc(e),Nc(e),0]}getContentBBox(t){const{childrenNode:e=[],padding:n}=t,r=Tc(e.map((t=>t.getBounds())));return n?kc(r,n):r}drawCollapsedMarkerShape(t,e){this.upsert("collapsed-marker",Ml,this.getCollapsedMarkerStyle(t),e)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const{type:e,...n}=Wc(this.getGraphicStyle(t),"collapsedMarker"),r=this.getKey(),[i,o]=Lc(r.getLocalBounds(),"center"),a={...n,x:i,y:o};if(e){const n=this.getCollapsedMarkerText(e,t);Object.assign(a,{text:n})}return a}getCollapsedMarkerText(t,e){const{context:n,childrenData:r=[]}=e;if(!n)return"";const{model:i}=n;return"descendant-count"===t?i.getDescendantsData(this.id).length.toString():"child-count"===t?r.length.toString():"node-count"===t?i.getDescendantsData(this.id).filter((t=>"node"===i.getElementType(Fc(t)))).length.toString():Tt(t)?t(r):""}getComboZIndex(t){return(t.context?.model.getAncestorsData(this.id,mc)||[]).length}getComboStyle(t){const{zIndex:e=this.getComboZIndex(t)}=t,[n,r]=this.calculatePosition(t);return{x:n,y:r,zIndex:e}}render(t,e=this){super.render(t,e);const n=this.getComboStyle(t);Object.assign(this.style,n),t.context?.model.syncComboDatum({id:this.id,style:n}),this.drawCollapsedMarkerShape(t,e)}onCreate(){}onUpdate(){}onDestroy(){}}class jl extends Il{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Ps,this.getKeyStyle(t),e)}getKeyStyle(t){const{collapsed:e}=t,n=super.getKeyStyle(t),r=Wc(n,"collapsed"),[i]=this.getKeySize(t);return{...n,...e&&r,r:i/2}}getCollapsedKeySize(t){const[e,n]=Ic(t.collapsedSize),r=Math.max(e,n)/2;return[2*r,2*r,0]}getExpandedKeySize(t){if(!oe(t.size)){const[e,n]=Ic(t.size),r=Math.sqrt(e**2+n**2)/2;return[2*r,2*r,0]}const e=this.getContentBBox(t),[n,r]=Sc(e),i=Math.sqrt(n**2+r**2)/2;return[2*i,2*i,0]}getCollapsedOriginPosition(t){return Bc(t.collapsedOrigin,this.getContentBBox(t).center,this.getCollapsedKeySize(t),this.getExpandedKeySize(t),zc)}}class zl extends Il{static defaultStyleProps={anchor:[.5,.5]};constructor(t){super(re({},{style:zl.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Bs,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),n=Wc(e,"collapsed"),[r,i]=this.getKeySize(t);return{...e,...t.collapsed&&n,width:r,height:i}}}const Bl={N:"S",S:"N",W:"E",E:"W"},Fl={N:-Math.PI/2,S:Math.PI/2,E:0,W:Math.PI};function Gl(t,e){const[n,r]=t,[i,o]=e;return n===i?r>o?"N":"S":r===o?n>i?"W":"E":null}function Vl(t,e){return"N"===e||"S"===e?Nc(t):Mc(t)}function Wl(t,e,n){const r=[t[0],e[1]],i=[e[0],t[1]],o=Gl(t,r),a=Gl(t,i),s=n?Bl[n]:null,u=o===n||o!==s&&a!==n?r:i;return{points:[u],direction:Gl(u,e)}}function Ul(t,e,n){const r=Yl(t,e,n);return{points:[r],direction:Gl(r,e)}}function Hl(t,e,n,r){const i=[[e[0],t[1]],[t[0],e[1]]],o=i.filter((t=>function(t,e){return!Pc(t,e)}(t,n))),a=o.filter((e=>Gl(e,t)!==r));if(a.length>0){const n=a.find((e=>Gl(t,e)===r))||a[0];return{points:[n],direction:Gl(n,e)}}{const a=ol(e,kt(i,o)[0],Vl(n,r)/2);return{points:[Yl(a,t,n),a],direction:Gl(a,e)}}}function ql(t,e,n,r){let i=Ul(t,e,n);const o=tl(i.points[0]);if(Pc(o,r)){i=Ul(e,t,r);const a=tl(i.points[0]);if(Pc(a,n)){const s=ol(t,a,Vl(n,Gl(t,a))/2),u=ol(e,o,Vl(r,Gl(e,o))/2),c=[(s[0]+u[0])/2,(s[1]+u[1])/2],l=Ul(t,c,n),h=Hl(c,e,r,l.direction);i.points=[l.points[0],h.points[0]],i.direction=h.direction}}return i}function $l(t,e,n,r,i){const o=.01,a=Tc([n,r]),s=Zc(e,a.center)>Zc(t,a.center),[u,c]=s?[e,t]:[t,e],l=Nc(a)+Mc(a);let h;if(i){const t=[u[0]+l*Math.cos(Fl[i]),u[1]+l*Math.sin(Fl[i])];h=ol(Oc(a,t),t,o)}else h=ol(Oc(a,u),u,-.01);let d=Yl(h,c,a),f=[il(h,2),il(d,2)];if(ae(il(h),il(d))){const t=function(t,e){return Math.acos(Kc(t,e).reduce(((t,e)=>t+e),0)/(Zc(t,qc)*Zc(e,qc)))}(Yc(h,u),[1,0,0])+Math.PI/2;d=[c[0]+l*Math.cos(t),c[1]+l*Math.sin(t),0],d=il(ol(Oc(a,d),c,-.01),2);f=[h,Yl(h,d,a),d]}return{points:s?f.reverse():f,direction:Gl(s?h:d,e)}}function Yl(t,e,n){let r=[t[0],e[1]];return Pc(r,n)&&(r=[e[0],t[1]]),r}function Kl(t,e,n,r,i){const[o,a]=nl(t.getPoint(e));let s=n,u=r;return i&&(s=n*Math.cos(i)-r*Math.sin(i),u=n*Math.sin(i)+r*Math.cos(i)),[o+s,a+u]}function Xl(t,e,n,r){if(ae(t,e))return t;const i=Yc(e,t),o=[t[0]+n*i[0],t[1]+n*i[1]],a=Jc(function(t,e=!0){return e?[-t[1],t[0]]:[t[1],-t[0]]}(i,!1));return o[0]+=r*a[0],o[1]+=r*a[1],o}function Zl(t,e,n){return[["M",t[0],t[1]],["C",n[0][0],n[0][1],n[1][0],n[1][1],e[0],e[1]]]}function Ql(t,e=0,n=!1){const r=t[0],i=t[t.length-1],o=t.slice(1,t.length-1),a=[["M",r[0],r[1]]];return o.forEach(((t,n)=>{const s=o[n-1]||r,u=o[n+1]||i;if(!sl([s,c=t],[c,u])&&e){const[n,r]=function(t,e,n,r){const i=Qc(t,e),o=Qc(n,e),a=Math.min(r,Math.min(i,o)/2),s=[e[0]-a/i*(e[0]-t[0]),e[1]-a/i*(e[1]-t[1])],u=[e[0]-a/o*(e[0]-n[0]),e[1]-a/o*(e[1]-n[1])];return[s,u]}(s,t,u,e);a.push(["L",n[0],n[1]],["Q",t[0],t[1],r[0],r[1]],["L",r[0],r[1]])}else a.push(["L",t[0],t[1]]);var c})),a.push(["L",i[0],i[1]]),n&&a.push(["Z"]),a}const Jl=t=>{const e=Math.PI/2,n=Nc(t)/2,r=Mc(t)/2,i=Math.atan2(n,r)/2,o=Math.atan2(r,n)/2;return{top:[-e-o,-e+o],"top-right":[-e+o,-i],"right-top":[-e+o,-i],right:[-i,i],"bottom-right":[i,e-o],"right-bottom":[i,e-o],bottom:[e-o,e+o],"bottom-left":[e+o,Math.PI-i],"left-bottom":[e+o,Math.PI-i],left:[Math.PI-i,Math.PI+i],"top-left":[Math.PI+i,-e-o],"left-top":[Math.PI+i,-e-o]}};function th(t,e,n,r,i){const o=Cc(t),a=t.getCenter();let s=r&&Eh(r),u=i&&Eh(i);if(!s||!u){const r=Jl(o),i=r[e][0],c=r[e][1],[l,h]=Sc(o),d=Math.max(l,h),f=$c(a,[d*Math.cos(i),d*Math.sin(i),0]),p=$c(a,[d*Math.cos(c),d*Math.sin(c),0]);s=Sh(t,f),u=Sh(t,p),n||([s,u]=[u,s])}return[s,u]}function eh(t,e,n,r,i,o){const a=t.getPorts()[i||o],s=t.getPorts()[o||i];let[u,c]=th(t,e,n,a,s);const l=function(t,e,n,r){const i=t.getCenter();if(ae(e,n)){const t=Yc(e,i),o=[r*Math.sign(t[0])||r/2,r*Math.sign(t[1])||-r/2,0];return[$c(e,o),$c(n,Kc(o,[1,-1,1]))]}return[ol(i,e,Zc(i,e)+r),ol(i,n,Zc(i,n)+r)]}(t,u,c,r);return a&&(u=Nh(a,l[0])),s&&(c=Nh(s,l[l.length-1])),Zl(u,c,l)}function nh(t,e,n,r,i,o,a){const s=yh(t),u=s[o||a],c=s[a||o];let[l,h]=th(t,n,r,u,c);const d=function(t,e,n,r){const i=[],o=Cc(t);if(ae(e,n)){switch(Ac(o,e)){case"left":i.push([e[0]-r,e[1]]),i.push([e[0]-r,e[1]+r]),i.push([e[0],e[1]+r]);break;case"right":i.push([e[0]+r,e[1]]),i.push([e[0]+r,e[1]+r]),i.push([e[0],e[1]+r]);break;case"top":i.push([e[0],e[1]-r]),i.push([e[0]+r,e[1]-r]),i.push([e[0]+r,e[1]]);break;case"bottom":i.push([e[0],e[1]+r]),i.push([e[0]+r,e[1]+r]),i.push([e[0]+r,e[1]])}}else{const t=Ac(o,e),a=Ac(o,n);if(t===a){let o,a;switch(t){case"left":o=Math.min(e[0],n[0])-r,i.push([o,e[1]]),i.push([o,n[1]]);break;case"right":o=Math.max(e[0],n[0])+r,i.push([o,e[1]]),i.push([o,n[1]]);break;case"top":a=Math.min(e[1],n[1])-r,i.push([e[0],a]),i.push([n[0],a]);break;case"bottom":a=Math.max(e[1],n[1])+r,i.push([e[0],a]),i.push([n[0],a])}}else{const s=(t,e)=>({left:[e[0]-r,e[1]],right:[e[0]+r,e[1]],top:[e[0],e[1]-r],bottom:[e[0],e[1]+r]}[t]),u=s(t,e),c=s(a,n),l=Yl(u,c,o);i.push(u,l,c)}}return i}(t,l,h,i);return u&&(l=Nh(u,d[0])),c&&(h=Nh(c,d[d.length-1])),Ql([l,...d,h],e)}function rh(t,e){const n=new Set,r=new Set,i=new Set;return t.forEach((o=>{e(o).forEach((e=>{n.add(e),t.includes(e.source)&&t.includes(e.target)?r.add(e):i.add(e)}))})),{edges:Array.from(n),internal:Array.from(r),external:Array.from(i)}}const ih=(t,e)=>[["M",0,0],["L",t,-e/2],["L",t,e/2],["Z"]];var oh=Object.freeze({__proto__:null,circle:(t,e)=>{const n=Math.max(t,e)/2;return[["M",0,0],["A",n,n,0,1,0,2*n,0],["A",n,n,0,1,0,0,0],["Z"]]},diamond:(t,e)=>[["M",0,0],["L",t/2,-e/2],["L",t,0],["L",t/2,e/2],["Z"]],rect:(t,e)=>[["M",0,-e/2],["L",t,-e/2],["L",t,e/2],["L",0,e/2],["Z"]],simple:(t,e)=>[["M",t,-e/2],["L",0,0],["L",t,e/2]],triangle:ih,triangleRect:(t,e)=>{const n=t/2,r=t/7,i=t-r;return[["M",0,0],["L",n,-e/2],["L",n,e/2],["Z"],["M",i,-e/2],["L",i+r,-e/2],["L",i+r,e/2],["L",i,e/2],["Z"]]},vee:(t,e)=>[["M",0,0],["L",t,-e/2],["L",2*t/3,0],["L",t,e/2],["Z"]]});class ah extends El{type="edge";static defaultStyleProps={isBillboard:!0,label:!0,labelAutoRotate:!0,labelIsBillboard:!0,labelMaxWidth:"80%",labelOffsetX:4,labelOffsetY:0,labelPlacement:"center",labelTextBaseline:"middle",labelWordWrap:!1,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloPointerEvents:"none",haloStrokeOpacity:.25,haloZIndex:-1,startArrow:!1,startArrowAnchor:"0.5 0.5",startArrowSize:8,startArrowLineDash:0,startArrowLineWidth:1,startArrowTransformOrigin:"center",startArrowType:"triangle",endArrow:!1,endArrowAnchor:"0.5 0.5",endArrowSize:8,endArrowLineDash:0,endArrowLineWidth:1,endArrowTransformOrigin:"center",endArrowType:"triangle",loopPlacement:"top",loopClockwise:!0};constructor(t){super(re({},{style:ah.defaultStyleProps},t))}getKeyStyle(t){const{sourceNode:e,targetNode:n,color:r,stroke:i,...o}=this.getGraphicStyle(t);var a,s;return{path:(s=n,(a=e)&&s&&a===s?this.getLoopPath(t):this.getKeyPath(t)),...Hc(o,["halo","label","startArrow","endArrow"]),stroke:r||i}}getLoopPath(t){const{sourceNode:e,sourcePort:n,targetPort:r}=t,i=Cc(e),o=Math.max(Mc(i),Nc(i)),{placement:a,clockwise:s,dist:u=o}=Wc(this.getGraphicStyle(t),"loop");return eh(e,a,s,u,n,r)}getEndpoints(t){const{sourceNode:e,targetNode:n,sourcePort:r,targetPort:i}=t,[o,a]=wh(e,n,r,i);return[Mh(o||e,a||n),Mh(a||n,o||e)]}getHaloStyle(t){if(!1===t.halo)return!1;return{...this.getKeyStyle(t),...Wc(this.getGraphicStyle(t),"halo")}}getLabelStyle(t){if(!1===t.label||oe(t.labelText))return!1;const e=Wc(this.getGraphicStyle(t),"label"),{placement:n,offsetX:r,offsetY:i,autoRotate:o,maxWidth:a,...s}=e,u=function(t,e,n,r,i){let o="number"==typeof e?e:.5;"start"===e&&(o=0),"end"===e&&(o=.99);const a=nl(t.getPoint(o)),s=nl(t.getPoint(o+.01));let u="start"===e?"left":"end"===e?"right":"center";if(al(a,s)||!n){const[e,n]=Kl(t,o,r,i);return{x:e,y:n,textAlign:u}}let c=Math.atan2(s[1]-a[1],s[0]-a[0]);s[0]<a[0]&&(u="center"===u?u:"left"===u?"right":"left",r*=-1,c+=Math.PI);const[l,h]=Kl(t,o,r,i,c);return{x:l,y:h,textAlign:u,transform:`rotate(${c/Math.PI*180}deg)`}}(this.shapeMap.key,n,o,r,i),c=this.shapeMap.key.getLocalBounds(),l=function(t,e,n=1){return hl(Zc(t[0],t[1])*n,e)}([c.min,c.max],a);return Object.assign({wordWrapWidth:l},u,s)}drawArrow(t,e){const n="start"===e,r=t["start"===e?"startArrow":"endArrow"],i=this.shapeMap.key;if(r){const e=this.getArrowStyle(t,n),r=oe(e.src)?Is:Ls,[o,a,s]=n?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],u=i.style[o];u?u.attr(e):i.style[o]=new r({style:e}),i.style[a]=t[s]||e.width/2+ +e.lineWidth}else{const t=n?"markerStart":"markerEnd";i.style[t]?.destroy(),i.style[t]=null}}getArrowStyle(t,e){const n=this.getKeyStyle(t),r=e?"startArrow":"endArrow",{size:i,type:o,...a}=Wc(this.getGraphicStyle(t),r),[s,u]=Ic(i),c=(Tt(o)?o:oh[o]||ih)(s,u);return{...n,width:s,height:u,...c&&{path:c,fill:"simple"===o?"":n.stroke},...a}}drawLabelShape(t,e){this.upsert("label",wl,this.getLabelStyle(t),e)}drawHaloShape(t,e){this.upsert("halo",Is,this.getHaloStyle(t),e)}drawKeyShape(t,e){return this.upsert("key",Is,this.getKeyStyle(t),e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e)&&(this.drawArrow(t,"start"),this.drawArrow(t,"end"),this.drawLabelShape(t,e),this.drawHaloShape(t,e))}onCreate(){}onUpdate(){}onDestroy(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>{this.drawLabelShape(this.parsedAttributes,this)}),n}}class sh extends ah{static defaultStyleProps={curvePosition:.5,curveOffset:20};constructor(t){super(re({},{style:sh.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:r,curvePosition:i,curveOffset:o}=t,a=this.getControlPoints(e,n,function(t){return Wt(t)?[t,1-t]:t}(i),function(t){return Wt(t)?[t,-t]:t}(o),r);return Zl(e,n,a)}getControlPoints(t,e,n,r,i){return 2===i?.length?i:[Xl(t,e,n[0],r[0]),Xl(t,e,n[1],r[1])]}}class uh extends sh{static defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};constructor(t){super(re({},{style:uh.defaultStyleProps},t))}getControlPoints(t,e,n,r){const i=e[0]-t[0];return[[t[0]+i*n[0]+r[0],t[1]],[e[0]-i*n[1]+r[1],e[1]]]}}class ch extends sh{static defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};constructor(t){super(re({},{style:ch.defaultStyleProps},t))}getControlPoints(t,e,n,r){const i=e[1]-t[1];return[[t[0],t[1]+i*n[0]+r[0]],[e[0],e[1]-i*n[1]+r[1]]]}}class lh extends ah{static defaultStyleProps={};constructor(t){super(re({},{style:lh.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}}class hh extends ah{static defaultStyleProps={radius:0,controlPoints:[],router:!1,routerName:"orth",routerPadding:10};constructor(t){super(re({},{style:hh.defaultStyleProps},t))}getKeyPath(t){const{sourceNode:e,targetNode:n,radius:r}=t,{sourcePoint:i,targetPoint:o,sourcePort:a,targetPort:s}=this.getEndpointsAndPorts(t),u=this.getControlPoints(t,i,o),c=Mh(a||e,u[0]||s||n),l=Mh(s||n,u[u.length-1]||a||e);return Ql([c,...u,l],r)}getEndpointsAndPorts(t){const{sourceNode:e,targetNode:n,sourcePort:r,targetPort:i}=t,[o,a]=wh(e,n,r,i);return{sourcePoint:o?Eh(o):e.getCenter(),targetPoint:a?Eh(a):n.getCenter(),sourcePort:o,targetPort:a}}getControlPoints(t,e,n){const{controlPoints:r,sourceNode:i,targetNode:o,router:a,routerPadding:s}=t;if(!a)return[...r];return function(t,e,n,r,i,o){const a=[t,...i,e];let s=null;const u=[];for(let t=0,e=a.length;t<e-1;t++){const i=t+1,h=a[t],d=a[i],f=al(c=h,l=d)||function(t,e){return t[0]===e[0]}(c,l);let p=null;0===t?i===e-1?n.intersects(r)?p=$l(h,d,n,r):f||(p=ql(h,d,n,r)):Pc(d,n)?p=$l(h,d,n,Cc(d,o),s):f||(p=Ul(h,d,n)):i===e-1?Pc(h,r)?p=$l(h,d,Cc(h,o),r,s):f||(p=Hl(h,d,r,s)):f||(p=Wl(h,d,s)),p?(u.push(...p.points),s=p.direction):s=Gl(h,d),i<e-1&&u.push(d)}var c,l;return u}(e,n,Cc(i,s),Cc(o,s),r,s)}getLoopPath(t){const{sourceNode:e,sourcePort:n,targetPort:r,radius:i}=t,o=Cc(e),a=Math.max(Mc(o),Nc(o))/4,{placement:s,clockwise:u,dist:c=a}=Wc(this.getGraphicStyle(t),"loop");return nh(e,i,s,u,c,n,r)}}class dh extends ah{static defaultStyleProps={curvePosition:.5,curveOffset:30};constructor(t){super(re({},{style:dh.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[r,i]=this.getEndpoints(t);return function(t,e,n){return[["M",t[0],t[1]],["Q",n[0],n[1],e[0],e[1]]]}(r,i,t.controlPoint||Xl(r,i,e,n))}}function fh(t){return t instanceof Nl&&"node"===t.type}function ph(t){return t instanceof ah}function gh(t){return t instanceof Il}const mh={top:[.5,0],right:[1,.5],bottom:[.5,1],left:[0,.5],default:[.5,.5]};function vh(t,e,n=mh,r=!0){const i=[.5,.5],o=Bt(e)?se(n,e.toLocaleLowerCase(),i):e;if(!r&&Bt(e))return o;const[a,s]=o||i;return[t.min[0]+Mc(t)*a,t.min[1]+Nc(t)*s]}function yh(t){const e=t.getPorts();return(t.attributes.ports||[]).forEach(((n,r)=>{const{key:i,placement:o}=n;bh(n)&&(e[i||r]||=Lc(t.getKey().getBounds(),o))})),e}function bh(t){const{r:e}=t;return!e||0===Number(e)}function Eh(t){return Ec(t)?t:t.getPosition()}function wh(t,e,n,r){return[xh(t,e,n,r),xh(e,t,r,n)]}function xh(t,e,n,r){const i=yh(t);if(n)return i[n];const o=Object.values(i);if(0===o.length)return;const a=o.map((t=>Eh(t))),s=function(t,e){const n=yh(t);if(e)return[Eh(n[e])];const r=Object.values(n);return r.length>0?r.map((t=>Eh(t))):[t.getCenter()]}(e,r),[u]=function(t,e){let n=1/0,r=[t[0],e[0]];return t.forEach((t=>{e.forEach((e=>{const i=Zc(t,e);i<n&&(n=i,r=[t,e])}))})),r}(a,s);return o.find((t=>Eh(t)===u))}function Mh(t,e){return fh(t)?Sh(t,e):Nh(t,e)}function Nh(t,e){if(Ec(t))return t;if(t.attributes.linkToCenter)return t.getPosition();return ll(Ec(e)?e:fh(e)?e.getCenter():e.getPosition(),t.getBounds())}function Sh(t,e){const n=Ec(e)?e:fh(e)?e.getCenter():e.getPosition();return t.getIntersectPoint(n)||t.getCenter()}function Ch(t,e="bottom",n=!1){const r=e.split("-"),[i,o]=Lc(t,e),a=r.includes("left")?"right":r.includes("right")?"left":"center";let s=r.includes("top")?"bottom":r.includes("bottom")?"top":"middle";return n&&(s="top"===s?"bottom":"bottom"===s?"top":s),{x:i,y:o,textBaseline:s,textAlign:a}}function kh(t,e){"update"in t?t.update(e):t.attr(e)}function Th(t,e){if(Array.isArray(t)&&0===t.length)return null;const n=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t.slice(1):e||[];return new Proxy(n,{get:(t,e)=>"function"!=typeof t[e]||["onframe","onfinish"].includes(e)?"finished"===e?Promise.all([n.finished,...r.map((t=>t.finished))]):Reflect.get(t,e):(...n)=>{t[e](...n),r.forEach((t=>t[e]?.(...n)))},set:(t,e,n)=>(["onframe","onfinish"].includes(e)||r.forEach((t=>{t[e]=n})),Reflect.set(t,e,n))})}function Ph(t){const e=t.reduce(((t,e)=>(Object.entries(e).forEach((([e,n])=>{void 0===t[e]?t[e]=[n]:t[e].push(n)})),t)),{});return Object.entries(e).forEach((([n,r])=>{(r.length!==t.length||r.some((t=>Pt(t)))||r.every((t=>!fh(t)&&ae(t,r[0]))))&&delete e[n]})),Object.entries(e).reduce(((t,[e,n])=>(n.forEach(((n,r)=>{t[r]?t[r][e]=n:t[r]={[e]:n}})),t)),[])}function Ah(t){switch(t){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;default:return}}function Oh(t,e){return e.before?.(),t?(e.beforeAnimate?.(t),t.finished.then((()=>{e.afterAnimate?.(t),e.after?.()}))):e.after?.(),t}function _h(t,e){const{animation:n}=t;if(!n||!1===e)return!1;const r={...ac};return Rt(n)&&Object.assign(r,n),Rt(e)&&Object.assign(r,e),r}const Rh=(t,e,n,r)=>{if(!e)return null;const{animationsFilter:i=(()=>!0)}=r,o=(Bt(e)?yI("animation",e)||[]:e).filter(i);if(0===o.length)return null;const{originalStyle:a,modifiedStyle:s,states:u}=r,c=e=>{if(e){const n=t.getElementById(e),r=`get${function(t){var e=$t(t);return e.charAt(0).toUpperCase()+e.substring(1)}(e)}Style`,i=t?.[r]?.bind(t)||(t=>t);return{shape:n,fromStyle:i?.({...t.attributes,...a})||{},toStyle:{...n.attributes}}}return{shape:t,fromStyle:a,toStyle:{...t.attributes,...s}}};let l;const h=o.map((({fields:t,shape:e,states:r,...i})=>{if(void 0===r||r?.some((t=>u.includes(t)))){const{shape:r,fromStyle:o,toStyle:a}=c(e);if(!r)return null;const s=[{},{}];t.forEach((t=>{Object.assign(s[0],{[t]:o[t]??Ah(t)}),Object.assign(s[1],{[t]:a[t]??Ah(t)})}));const u=function(t,e,n){if(0===e.length)return null;const r=["opacity"],i=e.some((t=>Object.keys(t).some((t=>r.includes(t)))));if(!i)return t.animate(e,n);const o=e.map((t=>{const e={};return Object.entries(t).forEach((([t,n])=>{r.includes(t)&&(e[t]=n)})),e})),a=yl(t);return Th(t.animate(e,n),a.map((t=>t.animate(o,n))))}(r,Ph(s),{...sc,...n,...i});return void 0===e&&(l=u),u}return null})).filter(Boolean),d=l||h?.[0];return d?Th(d,h.filter((t=>t!==d))):null};function Lh(t,e,n){const r=new Map(t.map((t=>[n(t),t]))),i=new Map(e.map((t=>[n(t),t]))),o=new Set(r.keys()),a=new Set(i.keys()),s=[],u=[],c=[],l=[];return a.forEach((t=>{o.has(t)?ae(r.get(t),i.get(t))?l.push(i.get(t)):u.push(i.get(t)):s.push(i.get(t))})),o.forEach((t=>{a.has(t)||c.push(r.get(t))})),{enter:s,exit:c,keep:l,update:u}}class Dh{context;extensions=[];extensionMap={};constructor(t){this.context=t}setExtensions(t){const e=function(t,e){const n={},r=e=>(e in n||(n[e]=0),`${t}-${e}-${n[e]++}`);return e.map((t=>"string"==typeof t?{type:t,key:r(t)}:t.key?t:{...t,key:r(t.type)}))}(this.category,t),{enter:n,update:r,exit:i,keep:o}=Lh(this.extensions,e,(t=>t.key));this.createExtensions(n),this.updateExtensions([...r,...o]),this.destroyExtensions(i),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:r}=t,i=yI(e,r);if(!i)return;const o=new i(this.context,t);this.extensionMap[n]=o}createExtensions(t){t.forEach((t=>this.createExtension(t)))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach((t=>this.updateExtension(t)))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach((({key:t})=>this.destroyExtension(t)))}destroy(){Object.values(this.extensionMap).forEach((t=>t.destroy())),this.context={},this.extensions=[],this.extensionMap={}}}class Ih{context;options;events=[];destroyed=!1;constructor(t,e){this.context=t,this.options=e}update(t){this.options=Object.assign(this.options,t)}destroy(){this.context={},this.options={},this.destroyed=!0}}class jh extends Ih{}class zh extends jh{static defaultOptions={enable:!0,animation:!0};constructor(t,e){super(t,Object.assign({},zh.defaultOptions,e)),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),e.on(`combo:${t.CommonEvent.DBLCLICK}`,this.onCollapseExpand)}unbindEvents(){const{graph:e}=this.context;e.off(`combo:${t.CommonEvent.DBLCLICK}`,this.onCollapseExpand)}onCollapseExpand=async t=>{if(!this.validate(t))return;const{target:e}=t;if(!(fh(n=e)||ph(n)||gh(n)))return;var n;const r=e.id,{model:i,graph:o}=this.context,a=i.getComboData([r])[0];if(!a)return!1;const{onCollapse:s,onExpand:u,animation:c}=this.options,l=a.style?.collapsed;l?(await o.expand(r,c),u?.(r)):(await o.collapse(r,c),s?.(r))};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Tt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}const Bh="g6-create-edge-assist-node-id";class Fh extends jh{static defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:t=>t,onFinish:()=>{}};source;constructor(t,e){super(t,Object.assign({},Fh.defaultOptions,e)),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:e}=this.context,{trigger:n}=this.options;this.unbindEvents(),"click"===n?(e.on(`node:${t.CommonEvent.CLICK}`,this.handleCreateEdge),e.on(`combo:${t.CommonEvent.CLICK}`,this.handleCreateEdge),e.on(`canvas:${t.CommonEvent.CLICK}`,this.cancelEdge),e.on(`edge:${t.CommonEvent.CLICK}`,this.cancelEdge)):(e.on(`node:${t.CommonEvent.DRAG_START}`,this.handleCreateEdge),e.on(`combo:${t.CommonEvent.DRAG_START}`,this.handleCreateEdge),e.on(t.CommonEvent.POINTER_UP,this.drop)),e.on(t.CommonEvent.POINTER_MOVE,this.updateAssistEdge)}drop=async t=>{const{targetType:e}=t;["combo","node"].includes(e)&&this.source?await this.handleCreateEdge(t):await this.cancelEdge()};handleCreateEdge=async t=>{if(!this.validate(t))return;const{graph:e,canvas:n}=this.context,{style:r}=this.options;if(this.source)return this.createEdge(t),void await this.cancelEdge();n.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([t.target.id])[0],e.addNodeData([{id:Bh,style:{visibility:"hidden",ports:[{key:"port-1",placement:[.5,.5]}]}}]),e.addEdgeData([{id:"g6-create-edge-assist-edge-id",source:this.source,target:Bh,style:{pointerEvents:"none",...r}}])};updateAssistEdge=async t=>{if(!this.source)return;const{model:e,element:n}=this.context;e.translateNodeTo(Bh,[t.canvas.x,t.canvas.y]),await n.draw({animation:!1,silence:!0})};createEdge=t=>{const{graph:e}=this.context,{style:n,onFinish:r,onCreate:i}=this.options,o=t.target?.id;if(void 0===o||void 0===this.source)return;const a=this.getSelectedNodeIDs([t.target.id])?.[0];var s;const u=i({id:`${this.source}-${a}-${he[s=s||"g"]?he[s]+=1:he[s]=1,s+he[s]}`,source:this.source,target:a,style:n});e.addEdgeData([u]),r(u)};cancelEdge=async()=>{if(!this.source)return;const{graph:t,element:e,canvas:n}=this.context;n.setCursor("default"),t.removeNodeData([Bh]),this.source=void 0,await e.draw({animation:!1,silence:!0})};getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map((t=>t.id)).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Tt(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;e.off(`node:${t.CommonEvent.CLICK}`,this.handleCreateEdge),e.off(`combo:${t.CommonEvent.CLICK}`,this.handleCreateEdge),e.off(`canvas:${t.CommonEvent.CLICK}`,this.cancelEdge),e.off(`edge:${t.CommonEvent.CLICK}`,this.cancelEdge),e.off(`node:${t.CommonEvent.DRAG_START}`,this.handleCreateEdge),e.off(`combo:${t.CommonEvent.DRAG_START}`,this.handleCreateEdge),e.off(t.CommonEvent.POINTER_UP,this.drop),e.off(t.CommonEvent.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}class Gh{map=new Map;emitter;recordKey=new Set;constructor(t){this.emitter=t,this.bindEvents()}bind(t,e){0!==t.length&&this.map.set(t,e)}unbind(t,e){this.map.forEach(((n,r)=>{ae(r,t)&&(e&&e!==n||this.map.delete(r))}))}unbindAll(){this.map.clear()}bindEvents(){const{emitter:e}=this;e.on(t.CommonEvent.KEY_DOWN,this.onKeyDown),e.on(t.CommonEvent.KEY_UP,this.onKeyUp),e.on(t.CommonEvent.WHEEL,this.onWheel),e.on(t.CommonEvent.DRAG,this.onDrag)}onKeyDown=t=>{this.recordKey.add(t.key),this.trigger(t)};onKeyUp=t=>{this.recordKey.delete(t.key)};trigger(t){this.map.forEach(((e,n)=>{ae(Array.from(this.recordKey),n)&&e(t)}))}triggerExtendKey(t,e){this.map.forEach(((n,r)=>{r.includes(t)&&ae(Array.from(this.recordKey),r.filter((e=>e!==t)))&&n(e)}))}onWheel=e=>{this.triggerExtendKey(t.CommonEvent.WHEEL,e)};onDrag=e=>{this.triggerExtendKey(t.CommonEvent.DRAG,e)};destroy(){this.unbindAll(),this.emitter.off(t.CommonEvent.KEY_DOWN,this.onKeyDown),this.emitter.off(t.CommonEvent.KEY_UP,this.onKeyUp),this.emitter.off(t.CommonEvent.WHEEL,this.onWheel),this.emitter.off(t.CommonEvent.DRAG,this.onDrag)}}class Vh extends jh{static defaultOptions={enable:!0,sensitivity:10};shortcut;defaultCursor;constructor(t,e){super(t,Object.assign({},Vh.defaultOptions,e)),this.shortcut=new Gh(t.graph),this.bindEvents(),this.defaultCursor=this.context.canvas.getConfig().cursor||"default",t.canvas.setCursor("grab")}bindEvents(){const{trigger:e}=this.options;this.shortcut.unbindAll();const{graph:n}=this.context;if(Rt(e)){n.off(t.CanvasEvent.DRAG,this.onDrag);const{up:r=[],down:i=[],left:o=[],right:a=[]}=e;this.shortcut.bind(r,(t=>this.onTranslate([0,1],t))),this.shortcut.bind(i,(t=>this.onTranslate([0,-1],t))),this.shortcut.bind(o,(t=>this.onTranslate([1,0],t))),this.shortcut.bind(a,(t=>this.onTranslate([-1,0],t)))}else n.on(t.CanvasEvent.DRAG,this.onDrag)}onDrag=t=>{this.validate(t)&&"canvas"===t.targetType&&(this.translate([t.movement.x,t.movement.y],!1),this.options.onFinish?.())};async onTranslate(t,e){if(!this.validate(e))return;const{sensitivity:n}=this.options,r=-1*n;await this.translate(Kc(t,r),this.options.animation),this.options.onFinish?.()}async translate(t,e){await this.context.graph.translateBy(t,e)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Tt(e)?e(t):!!e}destroy(){this.shortcut.destroy(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}class Wh extends jh{static defaultOptions={animation:!0,enable:t=>["node","combo"].includes(t.targetType),dropEffect:"move",state:"selected",hideEdge:"none",shadowZIndex:100,shadowFill:"#F3F9FF",shadowFillOpacity:.5,shadowStroke:"#1890FF",shadowStrokeOpacity:.9,shadowLineDash:[5,5]};enable=!1;enableElements=["node","combo"];target=[];shadow;shadowOrigin=[0,0];hiddenEdges=[];get animation(){return!!this.options.shadow&&this.options.animation}constructor(t,e){super(t,Object.assign({},Wh.defaultOptions,e)),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),this.enableElements.forEach((n=>{e.on(`${n}:${t.CommonEvent.DRAG_START}`,this.onDragStart),e.on(`${n}:${t.CommonEvent.DRAG}`,this.onDrag),e.on(`${n}:${t.CommonEvent.DRAG_END}`,this.onDragEnd)})),["link"].includes(this.options.dropEffect)&&(e.on(`combo:${t.CommonEvent.DROP}`,this.onDrop),e.on(`canvas:${t.CommonEvent.DROP}`,this.onDrop))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map((t=>t.id)).concat(t)))}onDragStart=t=>{this.enable=this.validate(t),this.enable&&(this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target))};onDrag=t=>{if(!this.enable)return;const e=this.context.graph.getZoom(),{dx:n,dy:r}=t,i=Xc([n,r],e);this.options.shadow?this.moveShadow(i):this.moveElement(this.target,i)};onDragEnd=()=>{if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:t=0,y:e=0}=this.shadow.attributes,[n,r]=Yc([+t,+e],this.shadowOrigin);this.moveElement(this.target,[n,r])}this.showEdges(),this.options.onFinish?.(this.target),this.target=[]};onDrop=async t=>{if("link"!==this.options.dropEffect)return;const{model:e,element:n}=this.context,r=t.target.id;this.target.forEach((t=>{const n=e.getParentData(t,mc);n&&Fc(n)===r&&e.refreshComboData(r),e.setParent(t,r,mc)})),await(n?.draw({animation:!0}))};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Tt(e)?e(t):!!e}async moveElement(t,e){const{model:n,element:r}=this.context,{dropEffect:i}=this.options;t.forEach((t=>{const r=n.getElementType(t);"node"===r?n.translateNodeBy(t,e):"combo"===r&&n.translateComboBy(t,e)})),"move"===i&&t.forEach((t=>n.refreshComboData(t))),await r.draw({animation:this.animation})}moveShadow(t){if(!this.shadow)return;const{x:e=0,y:n=0}=this.shadow.attributes,[r,i]=t;this.shadow.attr({x:+e+r,y:+n+i})}createShadow(t){const e=Wc(this.options,"shadow"),n=Tc(t.map((t=>this.context.element.getElement(t).getBounds()))),[r,i]=n.min;this.shadowOrigin=[r,i];const[o,a]=Sc(n),s={width:o,height:a,x:r,y:i};this.shadow?this.shadow.attr({...e,...s,visibility:"visible"}):(this.shadow=new Bs({style:{...e,...s,pointerEvents:"none",$layer:"transient"}}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||0===this.hiddenEdges.length||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if("none"===t||e)return;const{graph:n}=this.context;this.hiddenEdges="all"===t?n.getEdgeData().map(Fc):Array.from(new Set(this.target.map((e=>n.getRelatedEdgesData(e,t).map(Fc))).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:e}=this.context;this.enableElements.forEach((n=>{e.off(`${n}:${t.CommonEvent.DRAG_START}`,this.onDragStart),e.off(`${n}:${t.CommonEvent.DRAG}`,this.onDrag),e.off(`${n}:${t.CommonEvent.DRAG_END}`,this.onDragEnd)})),e.off(`combo:${t.CommonEvent.DROP}`,this.onDrop),e.off(`canvas:${t.CommonEvent.DROP}`,this.onDrop)}destroy(){this.unbindEvents(),this.shadow?.destroy(),super.destroy()}}const Uh=["node","combo"];class Hh extends jh{static defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0};constructor(t,e){super(t,Object.assign({},Hh.defaultOptions,e)),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),Uh.forEach((n=>{e.on(`${n}:${t.CommonEvent.CLICK}`,this.clickFocusElement)}))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map((t=>t.id)).concat(t)))}clickFocusElement=async t=>{if(!this.validate(t))return;const{animation:e}=this.options,{graph:n}=this.context,r=this.getSelectedNodeIDs([t.target.id]);await n.focusElement(r,e)};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Tt(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;Uh.forEach((n=>{e.off(`${n}:${t.CommonEvent.CLICK}`,this.clickFocusElement)}))}destroy(){this.unbindEvents(),super.destroy()}}function qh(t,e,n,r,i=0){"TB"===r&&e(t,i);const o=n(t);if(o)for(const t of o)qh(t,e,n,r,i+1);"BT"===r&&e(t,i)}function $h(t,e,n){const r=new Set,i=new Set,o=new Set;return function(t,e,n){const r=[[t,0]];for(;r.length;){const[t,i]=r.shift();e(t,i);const o=n(t);if(o)for(const t of o)r.push([t,i+1])}}(e,((e,r)=>{r>n||(o.add(e),t.getRelatedEdgesData(e).forEach((t=>{const e=Fc(t);!i.has(e)&&r<n&&(o.add(e),i.add(e))})))}),(e=>t.getRelatedEdgesData(e).map((t=>t.source===e?t.target:t.source)).filter((t=>!r.has(t)&&(r.add(t),!0))))),Array.from(o)}class Yh extends jh{static defaultOptions={animation:!0,enable:!0,degree:0,activeState:"active",inactiveState:void 0};constructor(t,e){super(t,Object.assign({},Yh.defaultOptions,e)),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),Cl.forEach((n=>{e.on(`${n}:${t.CommonEvent.POINTER_OVER}`,this.hoverElement),e.on(`${n}:${t.CommonEvent.POINTER_OUT}`,this.hoverEndElement)}))}hoverElement=t=>{this.validate(t)&&(this.updateElementsState(t,!0),this.options.onHover?.(t))};hoverEndElement=t=>{this.validate(t)&&(this.updateElementsState(t,!1),this.options.onHoverEnd?.(t))};updateElementsState=(t,e)=>{if(!this.options.activeState&&!this.options.inactiveState)return;const{graph:n}=this.context,{targetType:r,target:i}=t,o=function(t,e,n,r){if("combo"===e||"node"===e)return $h(t,n,r);const i=t.getEdgeData(n);if(!i)return[];const o=$h(t,i.source,r-1),a=$h(t,i.target,r-1);return Array.from(new Set([...o,...a,n]))}(n,r,i.id,this.options.degree),a={};if(this.options.activeState&&Object.assign(a,this.getElementsState(o,this.options.activeState,e)),this.options.inactiveState){const t=function(t){return Object.values(t).flatMap((t=>t.map(Fc)))}(n.getData()).filter((t=>!o.includes(t)));Object.assign(a,this.getElementsState(t,this.options.inactiveState,e))}n.setElementState(a,this.options.animation)};getElementsState=(t,e,n)=>{const{graph:r}=this.context,i={};return t.forEach((t=>{const o=r.getElementState(t),a=n?[...o,e]:o.filter((t=>t!==e));i[t]=a})),i};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Tt(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;Cl.forEach((n=>{e.off(`${n}:${t.CommonEvent.POINTER_OVER}`,this.hoverElement),e.off(`${n}:${t.CommonEvent.POINTER_OUT}`,this.hoverEndElement)}))}destroy(){this.unbindEvents(),super.destroy()}}class Kh extends jh{static defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[]};shortcut;constructor(t,e){super(t,Object.assign({},Kh.defaultOptions,e)),this.shortcut=new Gh(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:e}=this.options;if(this.shortcut.unbindAll(),_t(e)&&(this.preventDefault(t.CanvasEvent.WHEEL),this.shortcut.bind([...e,t.CanvasEvent.WHEEL],(t=>{const{deltaX:e,deltaY:n}=t;this.zoom(-(n??e),t,!1)}))),Rt(e)){const{zoomIn:t=[],zoomOut:n=[],reset:r=[]}=e;this.shortcut.bind(t,(t=>this.zoom(10,t,this.options.animation))),this.shortcut.bind(n,(t=>this.zoom(-10,t,this.options.animation))),this.shortcut.bind(r,this.onReset)}}zoom=async(t,e,n)=>{if(!this.validate(e))return;const{graph:r}=this.context;let i;"viewport"in e&&(i=nl(e.viewport));const{sensitivity:o,onFinish:a}=this.options,s=1+Vt(t,-50,50)*o/100,u=r.getZoom();await r.zoomTo(u*s,n,i),a?.()};onReset=async()=>{await this.context.graph.zoomTo(1,this.options.animation)};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Tt(e)?e(t):!!e}preventDefault(t){const e=this.context.canvas.getContainer();e&&e.addEventListener(t,(t=>t.preventDefault()))}destroy(){this.shortcut.destroy(),super.destroy()}}var Xh=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},Zh=function(t,e){return!!Xh(t)&&t.indexOf(e)>-1},Qh=function(t,e){if(!Xh(t))return t;for(var n=[],r=0;r<t.length;r++){var i=t[r];e(i,r)&&n.push(i)}return n},Jh={}.toString,td=function(t,e){return Jh.call(t)==="[object "+e+"]"},ed=function(t){return td(t,"Function")},nd=function(t){return null==t},rd=function(t){return Array.isArray?Array.isArray(t):td(t,"Array")},id=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function od(t,e){if(t)if(rd(t))for(var n=0,r=t.length;n<r&&!1!==e(t[n],n);n++);else if(id(t))for(var i in t)if(t.hasOwnProperty(i)&&!1===e(t[i],i))break}var ad=Object.keys?function(t){return Object.keys(t)}:function(t){var e=[];return od(t,(function(n,r){ed(t)&&"prototype"===r||e.push(r)})),e};function sd(t,e){var n=ad(e),r=n.length;if(nd(t))return!r;for(var i=0;i<r;i+=1){var o=n[i];if(e[o]!==t[o]||!(o in t))return!1}return!0}var ud=function(t){return"object"==typeof t&&null!==t},cd=function(t){if(!ud(t)||!td(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var ld=function(t,e){if(void 0===e&&(e=[]),rd(t))for(var n=0;n<t.length;n+=1)ld(t[n],e);else e.push(t);return e},hd=function(t){if(rd(t))return t.reduce((function(t,e){return Math.max(t,e)}),t[0])},dd=function(t){if(rd(t))return t.reduce((function(t,e){return Math.min(t,e)}),t[0])},fd=Array.prototype,pd=fd.splice,gd=fd.indexOf,md=Array.prototype.splice,vd=function(t,e){if(!Xh(t))return[];for(var n=t?e.length:0,r=n-1;n--;){var i=void 0,o=e[n];n!==r&&o===i||(i=o,md.call(t,o,1))}return t},yd=function(t,e,n){if(!rd(t)&&!cd(t))return t;var r=n;return od(t,(function(t,n){r=e(r,t,n)})),r},bd=function(t){return td(t,"String")};function Ed(t,e){void 0===e&&(e=new Map);var n=[];if(Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var o=t[r];e.has(o)||(n.push(o),e.set(o,!0))}return n}var wd=Object.prototype.hasOwnProperty;function xd(t,e){if(!e||!rd(t))return{};for(var n,r={},i=ed(e)?e:function(t){return t[e]},o=0;o<t.length;o++){var a=t[o];n=i(a),wd.call(r,n)?r[n].push(a):r[n]=[a]}return r}function Md(t,e){if(!e)return{0:t};if(!ed(e)){var n=rd(e)?e:e.replace(/\s+/g,"").split("*");e=function(t){for(var e="_",r=0,i=n.length;r<i;r++)e+=t[n[r]]&&t[n[r]].toString();return e}}return xd(t,e)}var Nd={};var Sd=function(t){return td(t,"Number")},Cd=Number.isInteger?Number.isInteger:function(t){return Sd(t)&&t%1==0};var kd=180/Math.PI,Td=parseInt,Pd=Math.PI/180,Ad=function(t,e){return t.hasOwnProperty(e)},Od=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return od(t,(function(n,r){ed(t)&&"prototype"===r||e.push(n)})),e},_d=function(t){return nd(t)?"":t.toString()};var Rd={}.toString,Ld=function(t){return Rd.call(t).replace(/^\[object /,"").replace(/]$/,"")};var Dd=Object.prototype,Id=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Dd)};function jd(t,e){for(var n in e)e.hasOwnProperty(n)&&"constructor"!==n&&void 0!==e[n]&&(t[n]=e[n])}function zd(t,e,n,r){return e&&jd(t,e),n&&jd(t,n),r&&jd(t,r),t}var Bd=function(t){if("object"!=typeof t||null===t)return t;var e;if(rd(t)){e=[];for(var n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=Bd(t[n]):e[n]=t[n]}else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=Bd(t[i]):e[i]=t[i];return e};var Fd=function(t,e){if(!ed(t))throw new TypeError("Expected a function");var n=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var s=t.apply(this,r);return a.set(o,s),s};return n.cache=new Map,n};function Gd(t,e,n,r){for(var i in n=n||0,r=r||5,e)if(e.hasOwnProperty(i)){var o=e[i];null!==o&&cd(o)?(cd(t[i])||(t[i]={}),n<r?Gd(t[i],o,n+1,r):t[i]=e[i]):rd(o)?(t[i]=[],t[i]=t[i].concat(o)):void 0!==o&&(t[i]=o)}}var Vd=Object.prototype.hasOwnProperty;var Wd,Ud=function(t,e){if(t===e)return!0;if(!t||!e)return!1;if(bd(t)||bd(e))return!1;if(Xh(t)||Xh(e)){if(t.length!==e.length)return!1;for(var n=!0,r=0;r<t.length&&(n=Ud(t[r],e[r]));r++);return n}if(ud(t)||ud(e)){var i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(n=!0,r=0;r<i.length&&(n=Ud(t[i[r]],e[i[r]]));r++);return n}return!1},Hd=function(t){return t},qd=Object.prototype.hasOwnProperty,$d={};var Yd=Fd((function(t,e){void 0===e&&(e={});var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return Wd||(Wd=document.createElement("canvas").getContext("2d")),Wd.font=[o,a,i,n+"px",r].join(" "),Wd.measureText(bd(t)?t:"").width}),(function(t,e){return void 0===e&&(e={}),function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}([t],Od(e)).join("")})),Kd=function(){function t(){this.map={}}return t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,e){var n=this.map[t];return void 0===n?e:n},t.prototype.set=function(t,e){this.map[t]=e},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length},t}(),Xd=Object.freeze({__proto__:null,Cache:Kd,assign:zd,augment:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=t[0],r=1;r<t.length;r++){var i=t[r];ed(i)&&(i=i.prototype),zd(n.prototype,i)}},clamp:function(t,e,n){return t<e?e:t>n?n:t},clearAnimationFrame:function(t){(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout)(t)},clone:Bd,contains:Zh,debounce:function(t,e,n){var r;return function(){var i=this,o=arguments,a=n&&!r;clearTimeout(r),r=setTimeout((function(){r=null,n||t.apply(i,o)}),e),a&&t.apply(i,o)}},deepMix:function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)Gd(t,e[r]);return t},difference:function(t,e){return void 0===e&&(e=[]),Qh(t,(function(t){return!Zh(e,t)}))},each:od,endsWith:function(t,e){return!(!rd(t)&&!bd(t))&&t[t.length-1]===e},every:function(t,e){for(var n=0;n<t.length;n++)if(!e(t[n],n))return!1;return!0},extend:function(t,e,n,r){ed(e)||(n=e,e=t,t=function(){});var i=Object.create?function(t,e){return Object.create(t,{constructor:{value:e}})}:function(t,e){function n(){}n.prototype=t;var r=new n;return r.constructor=e,r},o=i(e.prototype,t);return t.prototype=zd(o,t.prototype),t.superclass=i(e.prototype,e),zd(o,n),zd(t,r),t},filter:Qh,find:function(t,e){if(!rd(t))return null;var n;if(ed(e)&&(n=e),cd(e)&&(n=function(t){return sd(t,e)}),n)for(var r=0;r<t.length;r+=1)if(n(t[r]))return t[r];return null},findIndex:function(t,e,n){void 0===n&&(n=0);for(var r=n;r<t.length;r++)if(e(t[r],r))return r;return-1},firstValue:function(t,e){for(var n=null,r=0;r<t.length;r++){var i=t[r][e];if(!nd(i)){n=rd(i)?i[0]:i;break}}return n},fixedBase:function(t,e){var n=e.toString(),r=n.indexOf(".");if(-1===r)return Math.round(t);var i=n.substr(r+1).length;return i>20&&(i=20),parseFloat(t.toFixed(i))},flatten:function(t){if(!rd(t))return[];for(var e=[],n=0;n<t.length;n++)e=e.concat(t[n]);return e},flattenDeep:ld,forIn:od,get:function(t,e,n){for(var r=0,i=bd(e)?e.split("."):e;t&&r<i.length;)t=t[i[r++]];return void 0===t||r<i.length?n:t},getEllipsisText:function(t,e,n,r){void 0===r&&(r="...");var i,o,a=Yd(r,n),s=bd(t)?t:_d(t),u=e,c=[];if(Yd(t,n)<=e)return t;for(;i=s.substr(0,16),!((o=Yd(i,n))+a>u&&o>u);)if(c.push(i),u-=o,!(s=s.substr(16)))return c.join("");for(;i=s.substr(0,1),!((o=Yd(i,n))+a>u);)if(c.push(i),u-=o,!(s=s.substr(1)))return c.join("");return""+c.join("")+r},getRange:function(t){var e=t.filter((function(t){return!isNaN(t)}));if(!e.length)return{min:0,max:0};if(rd(t[0])){for(var n=[],r=0;r<t.length;r++)n=n.concat(t[r]);e=n}var i=hd(e);return{min:dd(e),max:i}},getType:Ld,getWrapBehavior:function(t,e){return t["_wrap_"+e]},group:function(t,e){if(!e)return[t];var n=Md(t,e),r=[];for(var i in n)r.push(n[i]);return r},groupBy:xd,groupToMap:Md,has:Ad,hasKey:Ad,hasValue:function(t,e){return Zh(Od(t),e)},head:function(t){if(Xh(t))return t[0]},identity:function(t){return t},includes:Zh,indexOf:function(t,e){if(!Xh(t))return-1;var n=Array.prototype.indexOf;if(n)return n.call(t,e);for(var r=-1,i=0;i<t.length;i++)if(t[i]===e){r=i;break}return r},isArguments:function(t){return td(t,"Arguments")},isArray:rd,isArrayLike:Xh,isBoolean:function(t){return td(t,"Boolean")},isDate:function(t){return td(t,"Date")},isDecimal:function(t){return Sd(t)&&t%1!=0},isElement:function(t){return t instanceof Element||t instanceof HTMLDocument},isEmpty:function(t){if(nd(t))return!0;if(Xh(t))return!t.length;var e=Ld(t);if("Map"===e||"Set"===e)return!t.size;if(Id(t))return!Object.keys(t).length;for(var n in t)if(Vd.call(t,n))return!1;return!0},isEqual:Ud,isEqualWith:function(t,e,n){return ed(n)?!!n(t,e):Ud(t,e)},isError:function(t){return td(t,"Error")},isEven:function(t){return Sd(t)&&t%2==0},isFinite:function(t){return Sd(t)&&isFinite(t)},isFunction:ed,isInteger:Cd,isMatch:sd,isNegative:function(t){return Sd(t)&&t<0},isNil:nd,isNull:function(t){return null===t},isNumber:Sd,isNumberEqual:function(t,e,n){return void 0===n&&(n=1e-5),Math.abs(t-e)<n},isObject:id,isObjectLike:ud,isOdd:function(t){return Sd(t)&&t%2!=0},isPlainObject:cd,isPositive:function(t){return Sd(t)&&t>0},isPrototype:Id,isRegExp:function(t){return td(t,"RegExp")},isString:bd,isType:td,isUndefined:function(t){return void 0===t},keys:ad,last:function(t){if(Xh(t)){return t[t.length-1]}},lowerCase:function(t){return _d(t).toLowerCase()},lowerFirst:function(t){var e=_d(t);return e.charAt(0).toLowerCase()+e.substring(1)},map:function(t,e){if(!Xh(t))return t;for(var n=[],r=0;r<t.length;r++){var i=t[r];n.push(e(i,r))}return n},mapValues:function(t,e){void 0===e&&(e=Hd);var n={};return id(t)&&!nd(t)&&Object.keys(t).forEach((function(r){n[r]=e(t[r],r)})),n},max:hd,maxBy:function(t,e){if(rd(t)){for(var n,r=-1/0,i=0;i<t.length;i++){var o=t[i],a=ed(e)?e(o):o[e];a>r&&(n=o,r=a)}return n}},measureTextWidth:Yd,memoize:Fd,min:dd,minBy:function(t,e){if(rd(t)){for(var n,r=1/0,i=0;i<t.length;i++){var o=t[i],a=ed(e)?e(o):o[e];a<r&&(n=o,r=a)}return n}},mix:zd,mod:function(t,e){return(t%e+e)%e},noop:function(){},number2color:function(t){var e=Nd[t];if(!e){for(var n=t.toString(16),r=n.length;r<6;r++)n="0"+n;e="#"+n,Nd[t]=e}return e},omit:function(t,e){return yd(t,(function(t,n,r){return e.includes(r)||(t[r]=n),t}),{})},parseRadius:function(t){var e=0,n=0,r=0,i=0;return rd(t)?1===t.length?e=n=r=i=t[0]:2===t.length?(e=r=t[0],n=i=t[1]):3===t.length?(e=t[0],n=i=t[1],r=t[2]):(e=t[0],n=t[1],r=t[2],i=t[3]):e=n=r=i=t,{r1:e,r2:n,r3:r,r4:i}},pick:function(t,e){if(null===t||!cd(t))return{};var n={};return od(e,(function(e){qd.call(t,e)&&(n[e]=t[e])})),n},pull:function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r++)for(var i=e[r],o=-1;(o=gd.call(t,i))>-1;)pd.call(t,o,1);return t},pullAt:vd,reduce:yd,remove:function(t,e){var n=[];if(!Xh(t))return n;for(var r=-1,i=[],o=t.length;++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return vd(t,i),n},requestAnimationFrame:function(t){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,16)})(t)},set:function(t,e,n){var r=t,i=bd(e)?e.split("."):e;return i.forEach((function(t,e){e<i.length-1?(id(r[t])||(r[t]=Sd(i[e+1])?[]:{}),r=r[t]):r[t]=n})),t},size:function(t){return nd(t)?0:Xh(t)?t.length:Object.keys(t).length},some:function(t,e){for(var n=0;n<t.length;n++)if(e(t[n],n))return!0;return!1},sortBy:function(t,e){var n;if(ed(e))n=function(t,n){return e(t)-e(n)};else{var r=[];bd(e)?r.push(e):rd(e)&&(r=e),n=function(t,e){for(var n=0;n<r.length;n+=1){var i=r[n];if(t[i]>e[i])return 1;if(t[i]<e[i])return-1}return 0}}return t.sort(n),t},startsWith:function(t,e){return!(!rd(t)&&!bd(t))&&t[0]===e},substitute:function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]})):t},throttle:function(t,e,n){var r,i,o,a,s=0;n||(n={});var u=function(){s=!1===n.leading?0:Date.now(),r=null,a=t.apply(i,o),r||(i=o=null)},c=function(){var c=Date.now();s||!1!==n.leading||(s=c);var l=e-(c-s);return i=this,o=arguments,l<=0||l>e?(r&&(clearTimeout(r),r=null),s=c,a=t.apply(i,o),r||(i=o=null)):r||!1===n.trailing||(r=setTimeout(u,l)),a};return c.cancel=function(){clearTimeout(r),s=0,r=i=o=null},c},toArray:function(t){return Xh(t)?Array.prototype.slice.call(t):[]},toDegree:function(t){return kd*t},toInteger:Td,toRadian:function(t){return Pd*t},toString:_d,union:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Ed([].concat.apply([],t))},uniq:Ed,uniqueId:function(t){return $d[t=t||"g"]?$d[t]+=1:$d[t]=1,t+$d[t]},upperCase:function(t){return _d(t).toUpperCase()},upperFirst:function(t){var e=_d(t);return e.charAt(0).toUpperCase()+e.substring(1)},values:Od,valuesOfKey:function(t,e){for(var n=[],r={},i=0;i<t.length;i++){var o=t[i][e];if(!nd(o)){rd(o)||(o=[o]);for(var a=0;a<o.length;a++){var s=o[a];r[s]||(n.push(s),r[s]=!0)}}}return n},wrapBehavior:function(t,e){if(t["_wrap_"+e])return t["_wrap_"+e];var n=function(n){t[e](n)};return t["_wrap_"+e]=n,n}});var Zd={assign:p(Xd).mix,getHeight:function(t,e,n,r){return void 0===r&&(r="height"),"center"===n?(t[r]+e[r])/2:t.height}},Qd=Zd,Jd={getId:function(t){return t.id||t.name},getPreH:function(t){return t.preH||0},getPreV:function(t){return t.preV||0},getHGap:function(t){return t.hgap||18},getVGap:function(t){return t.vgap||18},getChildren:function(t){return t.children},getHeight:function(t){return t.height||36},getWidth:function(t){var e=t.label||" ";return t.width||18*e.split("").length}};function tf(t,e){var n=this;if(n.vgap=n.hgap=0,t instanceof tf)return t;n.data=t;var r=e.getHGap(t),i=e.getVGap(t);return n.preH=e.getPreH(t),n.preV=e.getPreV(t),n.width=e.getWidth(t),n.height=e.getHeight(t),n.width+=n.preH,n.height+=n.preV,n.id=e.getId(t),n.x=n.y=0,n.depth=0,n.children||(n.children=[]),n.addGap(r,i),n}Qd.assign(tf.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(t,e){var n=this;n.hgap+=t,n.vgap+=e,n.width+=2*t,n.height+=2*e},eachNode:function(t){for(var e,n=[this];e=n.shift();)t(e),n=e.children.concat(n)},DFTraverse:function(t){this.eachNode(t)},BFTraverse:function(t){for(var e,n=[this];e=n.shift();)t(e),n=n.concat(e.children)},getBoundingBox:function(){var t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode((function(e){t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)})),t},translate:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.eachNode((function(n){n.x+=t,n.y+=e,n.x+=n.preH,n.y+=n.preV}))},right2left:function(){var t=this,e=t.getBoundingBox();t.eachNode((function(t){t.x=t.x-2*(t.x-e.left)-t.width})),t.translate(e.width,0)},bottom2top:function(){var t=this,e=t.getBoundingBox();t.eachNode((function(t){t.y=t.y-2*(t.y-e.top)-t.height})),t.translate(0,e.height)}});var ef=function(t,e,n){void 0===e&&(e={});var r,i=new tf(t,e=Qd.assign({},Jd,e)),o=[i];if(!n&&!t.collapsed)for(;r=o.shift();)if(!r.data.collapsed){var a=e.getChildren(r.data),s=a?a.length:0;if(r.children=new Array(s),a&&s)for(var u=0;u<s;u++){var c=new tf(a[u],e);r.children[u]=c,o.push(c),c.parent=r,c.depth=r.depth+1}}return i},nf=ef,rf=function(){function t(t,e){void 0===e&&(e={});this.options=e,this.rootNode=nf(t,e)}return t.prototype.execute=function(){throw new Error("please override this method")},t}(),of=rf;function af(t,e,n,r){void 0===r&&(r=[]);var i=this;i.w=t||0,i.h=e||0,i.y=n||0,i.x=0,i.c=r||[],i.cs=r.length,i.prelim=0,i.mod=0,i.shift=0,i.change=0,i.tl=null,i.tr=null,i.el=null,i.er=null,i.msel=0,i.mser=0}function sf(t,e,n){n?t.y+=e:t.x+=e,t.children.forEach((function(t){sf(t,e,n)}))}function uf(t,e){var n=e?t.y:t.x;return t.children.forEach((function(t){n=Math.min(uf(t,e),n)})),n}function cf(t,e){sf(t,-uf(t,e),e)}function lf(t,e,n){n?e.y=t.x:e.x=t.x,t.c.forEach((function(t,r){lf(t,e.children[r],n)}))}function hf(t,e,n){void 0===n&&(n=0),e?(t.x=n,n+=t.width):(t.y=n,n+=t.height),t.children.forEach((function(t){hf(t,e,n)}))}af.fromNode=function(t,e){if(!t)return null;var n=[];return t.children.forEach((function(t){n.push(af.fromNode(t,e))})),e?new af(t.height,t.width,t.x,n):new af(t.width,t.height,t.y,n)};var df=ef,ff=function(t,e){for(var n=df(t.data,e,!0),r=df(t.data,e,!0),i=t.children.length,o=Math.round(i/2),a=e.getSide||function(t,e){return e<o?"right":"left"},s=0;s<i;s++){var u=t.children[s];"right"===a(u,s)?r.children.push(u):n.children.push(u)}return n.eachNode((function(t){t.isRoot()||(t.side="left")})),r.eachNode((function(t){t.isRoot()||(t.side="right")})),{left:n,right:r}},pf=ff,gf=["LR","RL","TB","BT","H","V"],mf=["LR","RL","H"],vf=gf[0],yf=function(t,e,n){var r=e.direction||vf;if(e.isHorizontal=function(t){return mf.indexOf(t)>-1}(r),r&&-1===gf.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===gf[0])n(t,e);else if(r===gf[1])n(t,e),t.right2left();else if(r===gf[2])n(t,e);else if(r===gf[3])n(t,e),t.bottom2top();else if(r===gf[4]||r===gf[5]){var i=pf(t,e),o=i.left,a=i.right;n(o,e),n(a,e),e.isHorizontal?o.right2left():o.bottom2top(),a.translate(o.x-a.x,o.y-a.y),t.x=o.x,t.y=a.y;var s=t.getBoundingBox();e.isHorizontal?s.top<0&&t.translate(0,-s.top):s.left<0&&t.translate(-s.left,0)}var u=e.fixedRoot;return void 0===u&&(u=!0),u&&t.translate(-(t.x+t.width/2+t.hgap),-(t.y+t.height/2+t.vgap)),t};function bf(t,e){return bf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},bf(t,e)}var Ef=function(t,e){void 0===e&&(e={});var n=e.isHorizontal;function r(t){0===t.cs?(t.el=t,t.er=t,t.msel=t.mser=0):(t.el=t.c[0].el,t.msel=t.c[0].msel,t.er=t.c[t.cs-1].er,t.mser=t.c[t.cs-1].mser)}function i(t,e,n){for(var r=t.c[e-1],i=r.mod,c=t.c[e],l=c.mod;null!==r&&null!==c;){u(r)>n.low&&(n=n.nxt);var h=i+r.prelim+r.w-(l+c.prelim);h>0&&(l+=h,o(t,e,n.index,h));var d=u(r),f=u(c);d<=f&&null!==(r=s(r))&&(i+=r.mod),d>=f&&null!==(c=a(c))&&(l+=c.mod)}!r&&c?function(t,e,n,r){var i=t.c[0].el;i.tl=n;var o=r-n.mod-t.c[0].msel;i.mod+=o,i.prelim-=o,t.c[0].el=t.c[e].el,t.c[0].msel=t.c[e].msel}(t,e,c,l):r&&!c&&function(t,e,n,r){var i=t.c[e].er;i.tr=n;var o=r-n.mod-t.c[e].mser;i.mod+=o,i.prelim-=o,t.c[e].er=t.c[e-1].er,t.c[e].mser=t.c[e-1].mser}(t,e,r,i)}function o(t,e,n,r){t.c[e].mod+=r,t.c[e].msel+=r,t.c[e].mser+=r,function(t,e,n,r){if(n!==e-1){var i=e-n;t.c[n+1].shift+=r/i,t.c[e].shift-=r/i,t.c[e].change-=r-r/i}}(t,e,n,r)}function a(t){return 0===t.cs?t.tl:t.c[0]}function s(t){return 0===t.cs?t.tr:t.c[t.cs-1]}function u(t){return t.y+t.h}function c(t,e,n){for(;null!==n&&t>=n.low;)n=n.nxt;return{low:t,index:e,nxt:n}}hf(t,n);var l=af.fromNode(t,n);return function t(e){if(0!==e.cs){t(e.c[0]);for(var n=c(u(e.c[0].el),0,null),o=1;o<e.cs;++o){t(e.c[o]);var a=u(e.c[o].er);i(e,o,n),n=c(a,o,n)}!function(t){t.prelim=(t.c[0].prelim+t.c[0].mod+t.c[t.cs-1].mod+t.c[t.cs-1].prelim+t.c[t.cs-1].w)/2-t.w/2}(e),r(e)}else r(e)}(l),function t(e,n){n+=e.mod,e.x=e.prelim+n,function(t){for(var e=0,n=0,r=0;r<t.cs;r++)n+=(e+=t.c[r].shift)+t.c[r].change,t.c[r].mod+=n}(e);for(var r=0;r<e.cs;r++)t(e.c[r],n)}(l,0),lf(l,t,n),cf(t,n),t},wf=yf,xf=Zd,Mf=function(t){var e,n;function r(){return t.apply(this,arguments)||this}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,bf(e,n),r.prototype.execute=function(){return wf(this.rootNode,this.options,Ef)},r}(of),Nf={};var Sf=function(t,e){return e=xf.assign({},Nf,e),new Mf(t,e).execute()},Cf=Zd;function kf(t,e){void 0===e&&(e=[]);var n=this;n.x=n.y=0,n.leftChild=n.rightChild=null,n.height=0,n.children=e}var Tf={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function Pf(t,e,n){n?(e.x=t.x,e.y=t.y):(e.x=t.y,e.y=t.x),t.children.forEach((function(t,r){Pf(t,e.children[r],n)}))}function Af(t,e){return Af=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Af(t,e)}var Of=function(t,e){void 0===e&&(e={}),e=Cf.assign({},Tf,e);var n,r=0;var i=function t(e){if(!e)return null;e.width=0,e.depth&&e.depth>r&&(r=e.depth);var n=e.children,i=n.length,o=new kf(e.height,[]);return n.forEach((function(e,n){var r=t(e);o.children.push(r),0===n&&(o.leftChild=r),n===i-1&&(o.rightChild=r)})),o.originNode=e,o.isLeaf=e.isLeaf(),o}(t);return function t(e){if(e.isLeaf||0===e.children.length)e.drawingDepth=r;else{var n=e.children.map((function(e){return t(e)})),i=Math.min.apply(null,n);e.drawingDepth=i-1}return e.drawingDepth}(i),function t(r){r.x=r.drawingDepth*e.rankSep,r.isLeaf?(r.y=0,n&&(r.y=n.y+n.height+e.nodeSep,r.originNode.parent!==n.originNode.parent&&(r.y+=e.subTreeSep)),n=r):(r.children.forEach((function(e){t(e)})),r.y=(r.leftChild.y+r.rightChild.y)/2)}(i),Pf(i,t,e.isHorizontal),t},_f=yf,Rf=Zd,Lf=function(t){var e,n;function r(){return t.apply(this,arguments)||this}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,Af(e,n),r.prototype.execute=function(){var t=this;return t.rootNode.width=0,_f(t.rootNode,t.options,Of)},r}(of),Df={};var If=function(t,e){return e=Rf.assign({},Df,e),new Lf(t,e).execute()},jf=Zd;function zf(t,e){return zf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zf(t,e)}var Bf=of,Ff=function(t,e,n,r){var i=null;t.eachNode((function(t){!function(t,e,n,r,i){var o="function"==typeof n?n(t):n*t.depth;if(!r)try{if(t.id===t.parent.children[0].id)return t.x+=o,void(t.y=e?e.y:0)}catch(t){}if(t.x+=o,e){if(t.y=e.y+jf.getHeight(e,t,i),e.parent&&t.parent.id!==e.parent.id){var a=e.parent,s=a.y+jf.getHeight(a,t,i);t.y=s>t.y?s:t.y}}else t.y=0}(t,i,e,n,r),i=t}))},Gf=ff,Vf=Zd,Wf=["LR","RL","H"],Uf=Wf[0],Hf=function(t){var e,n;function r(){return t.apply(this,arguments)||this}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,zf(e,n),r.prototype.execute=function(){var t=this.options,e=this.rootNode;t.isHorizontal=!0;var n=t.indent,r=void 0===n?20:n,i=t.dropCap,o=void 0===i||i,a=t.direction,s=void 0===a?Uf:a,u=t.align;if(s&&-1===Wf.indexOf(s))throw new TypeError("Invalid direction: "+s);if(s===Wf[0])Ff(e,r,o,u);else if(s===Wf[1])Ff(e,r,o,u),e.right2left();else if(s===Wf[2]){var c=Gf(e,t),l=c.left,h=c.right;Ff(l,r,o,u),l.right2left(),Ff(h,r,o,u);var d=l.getBoundingBox();h.translate(d.width,0),e.x=h.x-e.width/2}return e},r}(Bf),qf={};var $f=function(t,e){return e=Vf.assign({},qf,e),new Hf(t,e).execute()},Yf=Zd;function Kf(t,e){var n=0;return t.children.length?t.children.forEach((function(t){n+=Kf(t,e)})):n=t.height,t._subTreeSep=e.getSubTreeSep(t.data),t.totalHeight=Math.max(t.height,n)+2*t._subTreeSep,t.totalHeight}function Xf(t){var e=t.children,n=e.length;if(n){e.forEach((function(t){Xf(t)}));var r=e[0],i=e[n-1],o=i.y-r.y+i.height,a=0;if(e.forEach((function(t){a+=t.totalHeight})),o>t.height)t.y=r.y+o/2-t.height/2;else if(1!==e.length||t.height>a){var s=t.y+(t.height-o)/2-r.y;e.forEach((function(t){t.translate(0,s)}))}else t.y=(r.y+r.height/2+i.y+i.height/2)/2-t.height/2}}var Zf={getSubTreeSep:function(){return 0}};function Qf(t,e){return Qf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qf(t,e)}var Jf=function(t,e){void 0===e&&(e={}),e=Yf.assign({},Zf,e),t.parent={x:0,width:0,height:0,y:0},t.BFTraverse((function(t){t.x=t.parent.x+t.parent.width})),t.parent=null,Kf(t,e),t.startY=0,t.y=t.totalHeight/2-t.height/2,t.eachNode((function(t){var e=t.children,n=e.length;if(n){var r=e[0];if(r.startY=t.startY+t._subTreeSep,1===n)r.y=t.y+t.height/2-r.height/2;else{r.y=r.startY+r.totalHeight/2-r.height/2;for(var i=1;i<n;i++){var o=e[i];o.startY=e[i-1].startY+e[i-1].totalHeight,o.y=o.startY+o.totalHeight/2-o.height/2}}}})),Xf(t)},tp=yf,ep=Zd,np=function(t){var e,n;function r(){return t.apply(this,arguments)||this}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,Qf(e,n),r.prototype.execute=function(){return tp(this.rootNode,this.options,Jf)},r}(of),rp={};var ip=function(t,e){return e=ep.assign({},rp,e),new np(t,e).execute()},op={compactBox:Sf,dendrogram:If,indented:$f,mindmap:ip},ap=function(){function t(){this._events={}}return t.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this._events[t]||[],o=this._events["*"]||[],a=function(r){for(var i=r.length,o=0;o<i;o++)if(r[o]){var a=r[o],s=a.callback;a.once&&(r.splice(o,1),0===r.length&&delete e._events[t],i--,o--),s.apply(e,n)}};a(i),a(o)},t.prototype.off=function(t,e){if(t)if(e){for(var n=this._events[t]||[],r=n.length,i=0;i<r;i++)n[i].callback===e&&(n.splice(i,1),r--,i--);0===n.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function sp(t,e,n,r){for(;t.length;){const i=t.shift();if(n(i))return!0;e.add(i.id),r(i.id).forEach((n=>{e.has(n.id)||(e.add(n.id),t.push(n))}))}return!1}function up(t,e,n,r){if(n(t))return!0;e.add(t.id);for(const i of r(t.id))if(!e.has(i.id)&&up(i,e,n,r))return!0;return!1}const cp=()=>!0;class lp{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||cp,n=t.edgeFilter||cp;this.nodeFilter=e,this.edgeFilter=t=>{const{source:r,target:i}=this.graph.getEdgeDetail(t.id);return!(!e(r)||!e(i))&&n(t,r,i)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const n=this.bothEdgesMap.get(t);if(n&&n.forEach((t=>e.add(t.id))),this.hasNode(t)){const n=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),r=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),i=Array.from(new Set([...n,...r]));i.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,n),this.outEdgesMap.set(t,r),this.bothEdgesMap.set(t,i),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((n=>{switch(n.type){case"NodeAdded":case"NodeRemoved":e.add(n.value.id);break;case"NodeDataUpdated":e.add(n.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(n.value.source),e.add(n.value.target);break;case"EdgeUpdated":"source"!==n.propertyName&&"target"!==n.propertyName||(e.add(n.oldValue),e.add(n.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(n.id)){const r=t.graph.getEdge(n.id);e.add(r.source),e.add(r.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),this.cacheEnabled)return"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t);return this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const n=this.graph.getParent(t,e);return n&&this.nodeFilter(n)?n:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];sp([this.getNode(t)],new Set,e,r)}dfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];up(this.getNode(t),new Set,e,r)}}let hp=class t extends ap{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let n=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const r=e.value.id===t.value.id;return r&&(n=!0),!r}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),n||e.push(t);break}case"EdgeRemoved":{let n=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const r=e.value.id===t.value.id;return r&&(n=!0),!r}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),n||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const n=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),r=e[n];r?void 0!==t.propertyName?r.newValue=t.newValue:(e.splice(n,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const n=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));n?n.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),n=this.bothEdgesMap.get(t);n?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((e=>{e.childrenMap.get(t)?.forEach((t=>{e.parentMap.delete(t.id)})),e.parentMap.delete(t),e.childrenMap.delete(t)})),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,n){const r=this.getNode(t);this.batch((()=>{const i=r.data[e],o=n;r.data[e]=o,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:i,newValue:o})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,n])=>{this.updateNodeDataProperty(t,e,n)}))}))}updateNodeData(...t){const e=t[0],n=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let r;if("function"==typeof t[1]){const e=t[1];r=e(n.data)}else"object"==typeof t[1]&&(r=t[1]);this.batch((()=>{const t=n.data,i=r;n.data=r,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:i})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),n=this.outEdgesMap.get(t.source),r=this.bothEdgesMap.get(t.source),i=this.bothEdgesMap.get(t.target);e.add(t),n.add(t),r.add(t),i.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),n=this.outEdgesMap.get(e.source),r=this.inEdgesMap.get(e.target),i=this.bothEdgesMap.get(e.source),o=this.bothEdgesMap.get(e.target);n.delete(e),r.delete(e),i.delete(e),o.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const n=this.getEdge(t);this.checkNodeExistence(e);const r=n.source,i=e;this.outEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.outEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:r,newValue:i})}))}updateEdgeTarget(t,e){const n=this.getEdge(t);this.checkNodeExistence(e);const r=n.target,i=e;this.inEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.inEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:r,newValue:i})}))}updateEdgeDataProperty(t,e,n){const r=this.getEdge(t);this.batch((()=>{const i=r.data[e],o=n;r.data[e]=o,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:i,newValue:o})}))}updateEdgeData(...t){const e=t[0],n=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let r;if("function"==typeof t[1]){const e=t[1];r=e(n.data)}else"object"==typeof t[1]&&(r=t[1]);this.batch((()=>{const t=n.data,i=r;n.data=r,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:i})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,n])=>{this.updateEdgeDataProperty(t,e,n)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const n=[],r=Array.isArray(t)?t:[t];for(;r.length;){const t=r.shift();n.push(t),t.children&&r.push(...t.children)}this.addNodes(n),n.forEach((t=>{t.children?.forEach((n=>{this.setParent(n.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const n=this.treeIndices.get(e).childrenMap.get(t);return Array.from(n||[])}getParent(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);return this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const n=[];let r,i=this.getNode(t);for(;r=this.getParent(i.id,e);)n.push(r),i=r;return n}setParent(t,e,n){this.checkTreeExistence(n);const r=this.treeIndices.get(n),i=this.getNode(t),o=r.parentMap.get(t);if(o?.id===e)return;if(void 0===e)return o&&r.childrenMap.get(o.id)?.delete(i),void r.parentMap.delete(t);const a=this.getNode(e);r.parentMap.set(t,a),o&&r.childrenMap.get(o.id)?.delete(i);let s=r.childrenMap.get(a.id);s||(s=new Set,r.childrenMap.set(a.id,s)),s.add(i),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:n,nodeId:t,oldParentId:o?.id,newParentId:a.id})}))}dfsTree(t,e,n){return up(this.getNode(t),new Set,e,(t=>this.getChildren(t,n)))}bfsTree(t,e,n){return sp([this.getNode(t)],new Set,e,(t=>this.getChildren(t,n)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return sp([this.getNode(t)],new Set,e,r)}dfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return up(this.getNode(t),new Set,e,r)}clone(){const e=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),n=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new t({nodes:e,edges:n});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const i=new Map;t.forEach(((t,e)=>{i.set(e,r.getNode(t.id))}));const o=new Map;e.forEach(((t,e)=>{o.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:i,childrenMap:o})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new lp({graph:this,...t})}};const dp=(t,e)=>{if("next"!==t&&"prev"!==t)return e},fp=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};let pp=class{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return fp(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&fp(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let n=e.prev;for(;n!==e;)t.push(JSON.stringify(n,dp)),n=null==n?void 0:n.prev;return`[${t.join(", ")}]`}},gp=class extends pp{};const mp=()=>1,vp=(t,e,n)=>{let r=[];const i=e[e.length-1],o=e[0];let a;for(;t.getAllNodes().length;){for(;a=o.dequeue();)yp(t,e,n,a);for(;a=i.dequeue();)yp(t,e,n,a);if(t.getAllNodes().length)for(let i=e.length-2;i>0;--i)if(a=e[i].dequeue(),a){r=r.concat(yp(t,e,n,a,!0));break}}return r},yp=(t,e,n,r,i)=>{var o,a;const s=[];return t.hasNode(r.v)&&(null===(o=t.getRelatedEdges(r.v,"in"))||void 0===o||o.forEach((r=>{const o=r.data.weight,a=t.getNode(r.source);i&&s.push({v:r.source,w:r.target,in:0,out:0}),void 0===a.data.out&&(a.data.out=0),a.data.out-=o,Ep(e,n,Object.assign({v:a.id},a.data))})),null===(a=t.getRelatedEdges(r.v,"out"))||void 0===a||a.forEach((r=>{const i=r.data.weight,o=r.target,a=t.getNode(o);void 0===a.data.in&&(a.data.in=0),a.data.in-=i,Ep(e,n,Object.assign({v:a.id},a.data))})),t.removeNode(r.v)),i?s:void 0},bp=(t,e)=>{const n=new hp;let r=0,i=0;t.getAllNodes().forEach((t=>{n.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const o=n.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),a=(null==e?void 0:e(t))||1;o?n.updateEdgeData(null==o?void 0:o.id,Object.assign(Object.assign({},o.data),{weight:o.data.weight+a})):n.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:a}}),i=Math.max(i,n.getNode(t.source).data.out+=a),r=Math.max(r,n.getNode(t.target).data.in+=a)}));const o=[],a=i+r+3;for(let t=0;t<a;t++)o.push(new gp);const s=r+1;return n.getAllNodes().forEach((t=>{Ep(o,s,Object.assign({v:t.id},n.getNode(t.id).data))})),{buckets:o,zeroIdx:s,graph:n}},Ep=(t,e,n)=>{n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)},wp=(t,e)=>{const n="greedy"===e?((t,e)=>{var n;if(t.getAllNodes().length<=1)return[];const r=bp(t,e||mp);return null===(n=vp(r.graph,r.buckets,r.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===n?void 0:n.flat()})(t,(t=>t.data.weight||1)):xp(t);null==n||n.forEach((e=>{const n=e.data;t.removeEdge(e.id),n.forwardName=e.data.name,n.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},n)})}))},xp=t=>{const e=[],n={},r={},i=o=>{r[o]||(r[o]=!0,n[o]=!0,t.getRelatedEdges(o,"out").forEach((t=>{n[t.target]?e.push(t):i(t.target)})),delete n[o])};return t.getAllNodes().forEach((t=>i(t.id))),e},Mp=(t,e,n,r)=>{let i;do{i=`${r}${Math.random()}`}while(t.hasNode(i));return n.dummy=e,t.addNode({id:i,data:n}),i},Np=t=>{const e=new hp;return t.getAllNodes().forEach((n=>{t.getChildren(n.id).length||e.addNode(Object.assign({},n))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},Sp=(t,e)=>{const n=Number(t.x),r=Number(t.y),i=Number(e.x)-n,o=Number(e.y)-r;let a,s,u=Number(t.width)/2,c=Number(t.height)/2;return i||o?(Math.abs(o)*u>Math.abs(i)*c?(o<0&&(c=-c),a=c*i/o,s=c):(i<0&&(u=-u),a=u,s=u*o/i),{x:n+a,y:r+s}):{x:0,y:0}},Cp=t=>{const e=[],n=Tp(t)+1;for(let t=0;t<n;t++)e.push([]);t.getAllNodes().forEach((t=>{const n=t.data.rank;void 0!==n&&e[n]&&e[n].push(t.id)}));for(let r=0;r<n;r++)e[r]=e[r].sort(((e,n)=>{return r=t.getNode(e).data.order,i=t.getNode(n).data.order,Number(r)-Number(i);var r,i}));return e},kp=(t,e,n,r)=>{const i={width:0,height:0};return Wt(n)&&Wt(r)&&(i.rank=n,i.order=r),Mp(t,"border",i,e)},Tp=t=>{let e;return t.getAllNodes().forEach((t=>{const n=t.data.rank;void 0!==n&&(void 0===e||n>e)&&(e=n)})),e||(e=0),e},Pp=(t,e)=>t.reduce(((t,n)=>e(t)>e(n)?n:t)),Ap=(t,e,n,r,i,o)=>{r.includes(e.id)||(r.push(e.id),n||o.push(e.id),i(e.id).forEach((e=>Ap(t,e,n,r,i,o))),n&&o.push(e.id))},Op=(t,e,n,r)=>{const i=Array.isArray(e)?e:[e],o=e=>r?t.getSuccessors(e):t.getNeighbors(e),a=[],s=[];return i.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);Ap(t,e,"post"===n,s,o,a)})),a},_p=(t,e,n,r,i,o)=>{const a={rank:o,borderType:e,width:0,height:0},s=i.data[e][o-1],u=Mp(t,"border",a,n);i.data[e][o]=u,t.setParent(u,r),s&&t.addEdge({id:`e${Math.random()}`,source:s,target:u,data:{weight:1}})},Rp=t=>{t.getAllNodes().forEach((t=>{Lp(t)})),t.getAllEdges().forEach((t=>{Lp(t)}))},Lp=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},Dp=t=>{t.getAllNodes().forEach((t=>{Ip(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>Ip(t))),t.data.hasOwnProperty("y")&&Ip(t.data)}))},Ip=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},jp=t=>{t.getAllNodes().forEach((t=>{zp(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>zp(t))),t.data.hasOwnProperty("x")&&zp(t.data)}))},zp=t=>{const e=t.x;t.x=t.y,t.y=e},Bp=(t,e,n,r,i,o,a)=>{const s=t.getChildren(a);if(!(null==s?void 0:s.length))return void(a!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:a,data:{weight:0,minlen:n}}));const u=kp(t,"_bt"),c=kp(t,"_bb"),l=t.getNode(a);t.setParent(u,a),l.data.borderTop=u,t.setParent(c,a),l.data.borderBottom=c,null==s||s.forEach((s=>{Bp(t,e,n,r,i,o,s.id);const l=s.data.borderTop?s.data.borderTop:s.id,h=s.data.borderBottom?s.data.borderBottom:s.id,d=s.data.borderTop?r:2*r,f=l!==h?1:i-o[a]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:l,data:{minlen:f,weight:d,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:h,target:c,data:{minlen:f,weight:d,nestingEdge:!0}})})),t.getParent(a)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:i+o[a]}})},Fp=t=>{const e={},n=(r,i)=>{const o=t.getChildren(r);null==o||o.forEach((t=>n(t.id,i+1))),e[r]=i};return t.getRoots().forEach((t=>n(t.id,1))),e},Gp=t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e},Vp="edge-label",Wp=(t,e,n)=>{let r=e.source,i=t.getNode(r).data.rank;const o=e.target,a=t.getNode(o).data.rank,s=e.data.labelRank;if(a===i+1)return;let u,c,l;for(t.removeEdge(e.id),l=0,++i;i<a;++l,++i)e.data.points=[],c={originalEdge:e,width:0,height:0,rank:i},u=Mp(t,"edge",c,"_d"),i===s&&(c.width=e.data.width,c.height=e.data.height,c.dummy=Vp,c.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:r,target:u,data:{weight:e.data.weight}}),0===l&&n.push(u),r=u;t.addEdge({id:`e${Math.random()}`,source:r,target:o,data:{weight:e.data.weight}})},Up=t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e},Hp=(t,e,n)=>{const r=((t,e)=>null==t?void 0:t.reduce(((t,n,r)=>(t[n]=e[r],t)),{}))(n,n.map(((t,e)=>e))),i=e.map((e=>{const n=t.getRelatedEdges(e,"out").map((t=>({pos:r[t.target]||0,weight:t.data.weight})));return null==n?void 0:n.sort(((t,e)=>t.pos-e.pos))})),o=i.flat().filter((t=>void 0!==t));let a=1;for(;a<n.length;)a<<=1;const s=2*a-1;a-=1;const u=Array(s).fill(0,0,s);let c=0;return null==o||o.forEach((t=>{if(t){let e=t.pos+a;u[e]+=t.weight;let n=0;for(;e>0;)e%2&&(n+=u[e+1]),e=e-1>>1,u[e]+=t.weight;c+=t.weight*n}})),c},qp=(t,e)=>{let n=0;for(let r=1;r<(null==e?void 0:e.length);r+=1)n+=Hp(t,e[r-1],e[r]);return n},$p=t=>{const e={},n=t.getAllNodes(),r=n.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),i=Math.max(...r),o=[];for(let t=0;t<i+1;t++)o.push([]);const a=n.sort(((e,n)=>t.getNode(e.id).data.rank-t.getNode(n.id).data.rank)),s=a.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,n)=>t.getNode(e.id).data.fixorder-t.getNode(n.id).data.fixorder));return null==s||s.forEach((n=>{isNaN(t.getNode(n.id).data.rank)||o[t.getNode(n.id).data.rank].push(n.id),e[n.id]=!0})),null==a||a.forEach((n=>t.dfsTree(n.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||o[t.data.rank].push(t.id)})))),o},Yp=t=>{var e,n;const r=[];for(;null==t?void 0:t.length;){const i=t.pop();r.push(i),null===(e=i.in.reverse())||void 0===e||e.forEach((t=>{return(e=i,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&Kp(e,t)})(t);var e})),null===(n=i.out)||void 0===n||n.forEach((e=>{return(n=i,e=>{e.in.push(n),0==--e.indegree&&t.push(e)})(e);var n}))}const i=r.filter((t=>!t.merged)),o=["vs","i","barycenter","weight"];return i.map((t=>{const e={};return null==o||o.forEach((n=>{void 0!==t[n]&&(e[n]=t[n])})),e}))},Kp=(t,e)=>{var n;let r=0,i=0;t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.vs=null===(n=e.vs)||void 0===n?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0},Xp=(t,e,n)=>{let r,i=n;for(;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),null==t||t.push(r.vs),i++;return i},Zp=(t,e)=>(n,r)=>{if(void 0!==n.fixorder&&void 0!==r.fixorder)return n.fixorder-r.fixorder;if(n.barycenter<r.barycenter)return-1;if(n.barycenter>r.barycenter)return 1;if(e&&void 0!==n.order&&void 0!==r.order){if(n.order<r.order)return-1;if(n.order>r.order)return 1}return t?r.i-n.i:n.i-r.i},Qp=(t,e,n,r,i,o)=>{var a,s,u,c;let l=t.getChildren(e).map((t=>t.id));const h=t.getNode(e),d=h?h.data.borderLeft:void 0,f=h?h.data.borderRight:void 0,p={};d&&(l=null==l?void 0:l.filter((t=>t!==d&&t!==f)));const g=((t,e)=>e.map((e=>{const n=t.getRelatedEdges(e,"in");if(!(null==n?void 0:n.length))return{v:e};const r={sum:0,weight:0};return null==n||n.forEach((e=>{const n=t.getNode(e.source);r.sum+=e.data.weight*n.data.order,r.weight+=e.data.weight})),{v:e,barycenter:r.sum/r.weight,weight:r.weight}})))(t,l||[]);null==g||g.forEach((e=>{var i;if(null===(i=t.getChildren(e.v))||void 0===i?void 0:i.length){const i=Qp(t,e.v,n,r,o);p[e.v]=i,i.hasOwnProperty("barycenter")&&tg(e,i)}}));const m=((t,e)=>{var n,r,i;const o={};null==t||t.forEach(((t,e)=>{o[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const n=o[t.v];void 0!==t.barycenter&&(n.barycenter=t.barycenter,n.weight=t.weight)})),null===(n=e.getAllEdges())||void 0===n||n.forEach((t=>{const e=o[t.source],n=o[t.target];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(o[t.target]))}));const a=null===(i=(r=Object.values(o)).filter)||void 0===i?void 0:i.call(r,(t=>!t.indegree));return Yp(a)})(g,n);Jp(m,p),null===(a=m.filter((t=>t.vs.length>0)))||void 0===a||a.forEach((e=>{const n=t.getNode(e.vs[0]);n&&(e.fixorder=n.data.fixorder,e.order=n.data.order)}));const v=((t,e,n,r)=>{const i=((t,e)=>{const n={lhs:[],rhs:[]};return null==t||t.forEach((t=>{e(t)?n.lhs.push(t):n.rhs.push(t)})),n})(t,(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return r?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})),o=i.lhs,a=i.rhs.sort(((t,e)=>-t.i- -e.i)),s=[];let u=0,c=0,l=0;null==o||o.sort(Zp(!!e,!!n)),l=Xp(s,a,l),null==o||o.forEach((t=>{var e;l+=null===(e=t.vs)||void 0===e?void 0:e.length,s.push(t.vs),u+=t.barycenter*t.weight,c+=t.weight,l=Xp(s,a,l)}));const h={vs:s.flat()};return c&&(h.barycenter=u/c,h.weight=c),h})(m,r,i,o);if(d&&(v.vs=[d,v.vs,f].flat(),null===(s=t.getPredecessors(d))||void 0===s?void 0:s.length)){const e=t.getNode((null===(u=t.getPredecessors(d))||void 0===u?void 0:u[0].id)||""),n=t.getNode((null===(c=t.getPredecessors(f))||void 0===c?void 0:c[0].id)||"");v.hasOwnProperty("barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+e.data.order+n.data.order)/(v.weight+2),v.weight+=2}return v},Jp=(t,e)=>{null==t||t.forEach((t=>{var n;const r=null===(n=t.vs)||void 0===n?void 0:n.map((t=>e[t]?e[t].vs:t));t.vs=r.flat()}))},tg=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},eg=(t,e,n)=>e.map((e=>((t,e,n)=>{const r=Up(t),i=new hp({tree:[{id:r,children:[],data:{}}]});return t.getAllNodes().forEach((o=>{const a=t.getParent(o.id);(o.data.rank===e||o.data.minRank<=e&&e<=o.data.maxRank)&&(i.hasNode(o.id)||i.addNode(Object.assign({},o)),(null==a?void 0:a.id)&&!i.hasNode(null==a?void 0:a.id)&&i.addNode(Object.assign({},a)),i.setParent(o.id,(null==a?void 0:a.id)||r),t.getRelatedEdges(o.id,n).forEach((e=>{const n=e.source===o.id?e.target:e.source;i.hasNode(n)||i.addNode(Object.assign({},t.getNode(n)));const r=i.getRelatedEdges(n,"out").find((({target:t})=>t===o.id)),a=void 0!==r?r.data.weight:0;r?i.updateEdgeData(r.id,Object.assign(Object.assign({},r.data),{weight:e.data.weight+a})):i.addEdge({id:e.id,source:n,target:o.id,data:{weight:e.data.weight+a}})})),o.data.hasOwnProperty("minRank")&&i.updateNodeData(o.id,Object.assign(Object.assign({},o.data),{borderLeft:o.data.borderLeft[e],borderRight:o.data.borderRight[e]})))})),i})(t,e,n))),ng=(t,e,n,r)=>{const i=new hp;null==t||t.forEach((t=>{var o;const a=t.getRoots()[0].id,s=Qp(t,a,i,e,n,r);for(let e=0;e<(null===(o=s.vs)||void 0===o?void 0:o.length);e++){const n=t.getNode(s.vs[e]);n&&(n.data.order=e)}((t,e,n)=>{const r={};let i;null==n||n.forEach((n=>{let o,a,s=t.getParent(n);for(;s;){if(o=t.getParent(s.id),o?(a=r[o.id],r[o.id]=s.id):(a=i,i=s.id),a&&a!==s.id)return e.hasNode(a)||e.addNode({id:a,data:{}}),e.hasNode(s.id)||e.addNode({id:s.id,data:{}}),void(e.hasEdge(`e${a}-${s.id}`)||e.addEdge({id:`e${a}-${s.id}`,source:a,target:s.id,data:{}}));s=o}}))})(t,i,s.vs)}))},rg=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,n)=>{t.getNode(e).data.order=n}))}))},ig=(t,e)=>{const n=(t=>{const e={};let n=0;const r=i=>{const o=n;t.getChildren(i).forEach((t=>r(t.id))),e[i]={low:o,lim:n++}};return t.getRoots().forEach((t=>r(t.id))),e})(t);e.forEach((e=>{var r,i;let o=e,a=t.getNode(o);const s=a.data.originalEdge;if(!s)return;const u=((t,e,n,r)=>{var i,o;const a=[],s=[],u=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);let l,h;l=n;do{l=null===(i=t.getParent(l))||void 0===i?void 0:i.id,a.push(l)}while(l&&(e[l].low>u||c>e[l].lim));for(h=l,l=r;l&&l!==h;)s.push(l),l=null===(o=t.getParent(l))||void 0===o?void 0:o.id;return{lca:h,path:a.concat(s.reverse())}})(t,n,s.source,s.target),c=u.path,l=u.lca;let h=0,d=c[h],f=!0;for(;o!==s.target;){if(a=t.getNode(o),f){for(;d!==l&&(null===(r=t.getNode(d))||void 0===r?void 0:r.data.maxRank)<a.data.rank;)h++,d=c[h];d===l&&(f=!1)}if(!f){for(;h<c.length-1&&(null===(i=t.getNode(c[h+1]))||void 0===i?void 0:i.data.minRank)<=a.data.rank;)h++;d=c[h]}t.hasNode(d)&&t.setParent(o,d),o=t.getSuccessors(o)[0].id}}))},og=(t,e)=>{const n={};function r(e,r){const i=function(t){return JSON.stringify(t.slice(1))}(e);r.get(i)||(!function(e,r,i,o,a){var s,u;let c;for(let l=r;l<i;l++)c=e[l],(null===(s=t.getNode(c))||void 0===s?void 0:s.data.dummy)&&(null===(u=t.getPredecessors(c))||void 0===u||u.forEach((e=>{const r=t.getNode(e.id);r.data.dummy&&(r.data.order<o||r.data.order>a)&&sg(n,e.id,c)})))}(...e),r.set(i,!0))}const i=(e,n)=>{let i,o=-1,a=0;const s=new Map;return null==n||n.forEach(((u,c)=>{var l;if("border"===(null===(l=t.getNode(u))||void 0===l?void 0:l.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(i=t.getNode(e[0].id).data.order,r([n,a,c,o,i],s),a=c,o=i)}r([n,a,n.length,i,e.length],s)})),n};return(null==e?void 0:e.length)&&e.reduce(i),n},ag=(t,e)=>{var n,r;if(null===(n=t.getNode(e))||void 0===n?void 0:n.data.dummy)return null===(r=t.getPredecessors(e))||void 0===r?void 0:r.find((e=>t.getNode(e.id).data.dummy))},sg=(t,e,n)=>{let r=e,i=n;if(r>i){const t=r;r=i,i=t}let o=t[r];o||(t[r]=o={}),o[i]=!0},ug=(t,e,n)=>{let r=e,i=n;if(r>n){r=n,i=e}return!!t[r]},cg=(t,e,n,r,i,o)=>{const a=new hp,s=lg(r,i,o);return null==e||e.forEach((e=>{let r;null==e||e.forEach((e=>{const i=n[e];if(a.hasNode(i)||a.addNode({id:i,data:{}}),r){const o=n[r],u=a.getRelatedEdges(o,"out").find((t=>t.target===i));u?a.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(s(t,e,r),u.data.weight||0)})):a.addEdge({id:`e${Math.random()}`,source:o,target:i,data:{weight:Math.max(s(t,e,r),0)}})}r=e}))})),a};const lg=(t,e,n)=>(r,i,o)=>{const a=r.getNode(i),s=r.getNode(o);let u=0,c=0;if(u+=a.data.width/2,a.data.hasOwnProperty("labelpos"))switch((a.data.labelpos||"").toLowerCase()){case"l":c=-a.data.width/2;break;case"r":c=a.data.width/2}if(c&&(u+=n?c:-c),c=0,u+=(a.data.dummy?e:t)/2,u+=(s.data.dummy?e:t)/2,u+=s.data.width/2,s.data.labelpos)switch((s.data.labelpos||"").toLowerCase()){case"l":c=s.data.width/2;break;case"r":c=-s.data.width/2}return c&&(u+=n?c:-c),c=0,u},hg=(t,e)=>t.getNode(e).data.width||0,dg=(t,e)=>{const{align:n,nodesep:r=0,edgesep:i=0}=e||{},o=Cp(t),a=Object.assign(((t,e)=>{const n={},r=(e,r)=>{let i=0,o=0;const a=e.length,s=null==r?void 0:r[(null==r?void 0:r.length)-1];return null==r||r.forEach(((e,u)=>{var c;const l=ag(t,e),h=l?t.getNode(l.id).data.order:a;(l||e===s)&&(null===(c=r.slice(o,u+1))||void 0===c||c.forEach((e=>{var r;null===(r=t.getPredecessors(e))||void 0===r||r.forEach((r=>{var o;const a=t.getNode(r.id),s=a.data.order;!(s<i||h<s)||a.data.dummy&&(null===(o=t.getNode(e))||void 0===o?void 0:o.data.dummy)||sg(n,r.id,e)}))})),o=u+1,i=h)})),r};return(null==e?void 0:e.length)&&e.reduce(r),n})(t,o),og(t,o)),s={};let u=[];["u","d"].forEach((e=>{u="u"===e?o:Object.values(o).reverse(),["l","r"].forEach((n=>{"r"===n&&(u=u.map((t=>Object.values(t).reverse())));const o=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),c=((t,e,n,r)=>{const i={},o={},a={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{i[t]=t,o[t]=t,a[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let s=r(t).map((t=>t.id));if(s.length){s=s.sort(((t,e)=>a[t]-a[e]));const r=(s.length-1)/2;for(let u=Math.floor(r),c=Math.ceil(r);u<=c;++u){const r=s[u];o[t]===t&&e<a[r]&&!ug(n,t,r)&&(o[r]=t,o[t]=i[t]=i[r],e=a[r])}}}))})),{root:i,align:o}})(0,u,a,o),l=((t,e,n,r,i,o,a)=>{var s;const u={},c=cg(t,e,n,i,o,a),l=a?"borderLeft":"borderRight",h=(t,e)=>{let n=c.getAllNodes(),r=n.pop();const i={};for(;r;)i[r.id]?t(r.id):(i[r.id]=!0,n.push(r),n=n.concat(e(r.id))),r=n.pop()};return h((t=>{u[t]=(c.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),c.getPredecessors.bind(c)),h((e=>{const n=(c.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),r=t.getNode(e);n!==Number.POSITIVE_INFINITY&&r.data.borderType!==l&&(u[e]=Math.max(u[e],n))}),c.getSuccessors.bind(c)),null===(s=Object.values(r))||void 0===s||s.forEach((t=>{u[t]=u[n[t]]})),u})(t,u,c.root,c.align,r,i,"r"===n);"r"===n&&Object.keys(l).forEach((t=>l[t]=-l[t])),s[e+n]=l}))}));const c=((t,e)=>Pp(Object.values(e),(e=>{var n;let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null===(n=Object.keys(e))||void 0===n||n.forEach((n=>{const o=e[n],a=hg(t,n)/2;r=Math.max(o+a,r),i=Math.min(o-a,i)})),r-i})))(t,s);return c&&function(t,e){const n=Object.values(e),r=Math.min(...n),i=Math.max(...n);["u","d"].forEach((n=>{["l","r"].forEach((o=>{const a=n+o,s=t[a];let u;if(s===e)return;const c=Object.values(s);u="l"===o?r-Math.min(...c):i-Math.max(...c),u&&(t[a]={},Object.keys(s).forEach((e=>{t[a][e]=s[e]+u})))}))}))}(s,c),((t,e)=>{const n={};return Object.keys(t.ul).forEach((r=>{if(e)n[r]=t[e.toLowerCase()][r];else{const e=Object.values(t).map((t=>t[r]));n[r]=(e[0]+e[1])/2}})),n})(s,n)},fg=(t,e)=>{var n;const r=Np(t);((t,e)=>{const{ranksep:n=0}=e||{},r=Cp(t);let i=0;null==r||r.forEach((e=>{const r=e.map((e=>t.getNode(e).data.height)),o=Math.max(...r,0);null==e||e.forEach((e=>{t.getNode(e).data.y=i+o/2})),i+=o+n}))})(r,e);const i=dg(r,e);null===(n=Object.keys(i))||void 0===n||n.forEach((t=>{r.getNode(t).data.x=i[t]}))},pg=t=>{const e={},n=r=>{var i;const o=t.getNode(r);if(!o)return 0;if(e[r])return o.data.rank;let a;return e[r]=!0,null===(i=t.getRelatedEdges(r,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),o.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>n(t.id)))},gg=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,mg=(t,e)=>{const n=r=>{e.getRelatedEdges(r,"both").forEach((i=>{const o=i.source,a=r===o?i.target:o;t.hasNode(a)||gg(e,i)||(t.addNode({id:a,data:{}}),t.addEdge({id:i.id,source:r,target:a,data:{}}),n(a))}))};return t.getAllNodes().forEach((t=>n(t.id))),t.getAllNodes().length},vg=(t,e)=>{const n=r=>{var i;null===(i=e.getRelatedEdges(r,"both"))||void 0===i||i.forEach((i=>{const o=i.source,a=r===o?i.target:o;t.hasNode(a)||void 0===e.getNode(a).data.layer&&gg(e,i)||(t.addNode({id:a,data:{}}),t.addEdge({id:i.id,source:r,target:a,data:{}}),n(a))}))};return t.getAllNodes().forEach((t=>n(t.id))),t.getAllNodes().length},yg=(t,e)=>Pp(e.getAllEdges(),(n=>t.hasNode(n.source)!==t.hasNode(n.target)?gg(e,n):1/0)),bg=(t,e,n)=>{t.getAllNodes().forEach((t=>{const r=e.getNode(t.id);r.data.rank||(r.data.rank=0),r.data.rank+=n}))},Eg=t=>{const e=(t=>{const e=new hp;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const n=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));n?e.updateEdgeData(null==n?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+t.data.weight||0,minlen:Math.max(n.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);pg(e);const n=(t=>{const e=new hp({tree:[]}),n=t.getAllNodes()[0],r=t.getAllNodes().length;let i,o;for(e.addNode(n);mg(e,t)<r;)i=yg(e,t),o=e.hasNode(i.source)?gg(t,i):-gg(t,i),bg(e,t,o);return e})(e);let r,i;for(Ng(n),wg(n,e);r=Cg(n);)i=kg(n,e,r),Tg(n,e,r,i)},wg=(t,e)=>{let n=Op(t,t.getAllNodes(),"post",!1);n=n.slice(0,(null==n?void 0:n.length)-1),n.forEach((n=>{xg(t,e,n)}))},xg=(t,e,n)=>{const r=t.getNode(n).data.parent;t.getRelatedEdges(n,"both").find((t=>t.target===r||t.source===r)).data.cutvalue=Mg(t,e,n)},Mg=(t,e,n)=>{const r=t.getNode(n).data.parent;let i=!0,o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),a=0;return o||(i=!1,o=e.getRelatedEdges(r,"out").find((t=>t.target===n))),a=o.data.weight,e.getRelatedEdges(n,"both").forEach((e=>{const o=e.source===n,s=o?e.target:e.source;if(s!==r){const r=o===i,u=e.data.weight;if(a+=r?u:-u,Ag(t,n,s)){const e=t.getRelatedEdges(n,"both").find((t=>t.source===s||t.target===s)).data.cutvalue;a+=r?-e:e}}})),a},Ng=(t,e=t.getAllNodes()[0].id)=>{Sg(t,{},1,e)},Sg=(t,e,n,r,i)=>{var o;const a=n;let s=n;const u=t.getNode(r);return e[r]=!0,null===(o=t.getNeighbors(r))||void 0===o||o.forEach((n=>{e[n.id]||(s=Sg(t,e,s,n.id,r))})),u.data.low=a,u.data.lim=s++,i?u.data.parent=i:delete u.data.parent,s},Cg=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),kg=(t,e,n)=>{let r=n.source,i=n.target;e.getRelatedEdges(r,"out").find((t=>t.target===i))||(r=n.target,i=n.source);const o=t.getNode(r),a=t.getNode(i);let s=o,u=!1;o.data.lim>a.data.lim&&(s=a,u=!0);const c=e.getAllEdges().filter((e=>u===Og(t.getNode(e.source),s)&&u!==Og(t.getNode(e.target),s)));return Pp(c,(t=>gg(e,t)))},Tg=(t,e,n,r)=>{const i=t.getRelatedEdges(n.source,"both").find((t=>t.source===n.target||t.target===n.target));i&&t.removeEdge(i.id),t.addEdge({id:`e${Math.random()}`,source:r.source,target:r.target,data:{}}),Ng(t),wg(t,e),Pg(t,e)},Pg=(t,e)=>{const n=t.getAllNodes().find((t=>!t.data.parent));let r=Op(t,n,"pre",!1);r=r.slice(1),r.forEach((n=>{const r=t.getNode(n).data.parent;let i=e.getRelatedEdges(n,"out").find((t=>t.target===r)),o=!1;!i&&e.hasNode(r)&&(i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),o=!0),e.getNode(n).data.rank=(e.hasNode(r)&&e.getNode(r).data.rank||0)+(o?null==i?void 0:i.data.minlen:-(null==i?void 0:i.data.minlen))}))},Ag=(t,e,n)=>t.getRelatedEdges(e,"both").find((t=>t.source===n||t.target===n)),Og=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,_g=pg,Rg=t=>{(t=>{const e={};let n;const r=i=>{var o;const a=t.getNode(i);if(!a)return 0;if(e[i])return a.data.rank;let s;return e[i]=!0,null===(o=t.getRelatedEdges(i,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),(void 0===n||s<n)&&(n=s),a.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&r(t.id)})),void 0===n&&(n=0);const i={},o=(e,n)=>{var r;const a=t.getNode(e),s=isNaN(a.data.layer)?n:a.data.layer;(void 0===a.data.rank||a.data.rank<s)&&(a.data.rank=s),i[e]||(i[e]=!0,null===(r=t.getRelatedEdges(e,"out"))||void 0===r||r.forEach((t=>{o(t.target,s+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=n:o(t.id,e.layer))}))})(t),(t=>{const e=new hp({tree:[]}),n=t.getAllNodes()[0],r=t.getAllNodes().length;let i,o;for(e.addNode(n);vg(e,t)<r;)i=yg(e,t),o=e.hasNode(i.source)?gg(t,i):-gg(t,i),bg(e,t,o)})(t)},Lg=t=>{Eg(t)},Dg=(t,e)=>{const{acyclicer:n,ranker:r,rankdir:i="tb",nodeOrder:o,keepNodeOrder:a,align:s,nodesep:u=50,edgesep:c=20,ranksep:l=50}=e;Jg(t),wp(t,n);const{nestingRoot:h,nodeRankFactor:d}=(t=>{const e=Mp(t,"root",{},"_root"),n=Fp(t);let r=Math.max(...Object.values(n));Math.abs(r)===1/0&&(r=1);const i=r-1,o=2*i+1;t.getAllEdges().forEach((t=>{t.data.minlen*=o}));const a=Gp(t)+1;return t.getRoots().forEach((r=>{Bp(t,e,o,a,i,n,r.id)})),{nestingRoot:e,nodeRankFactor:o}})(t);((t,e)=>{switch(e){case"network-simplex":Lg(t);break;case"tight-tree":default:Rg(t);break;case"longest-path":_g(t)}})(Np(t),r),Hg(t),((t,e=0)=>{const n=t.getAllNodes(),r=n.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),i=Math.min(...r),o=[];n.forEach((t=>{const e=(t.data.rank||0)-i;o[e]||(o[e]=[]),o[e].push(t.id)}));let a=0;for(let n=0;n<o.length;n++){const r=o[n];void 0===r?n%e!=0&&(a-=1):a&&(null==r||r.forEach((e=>{const n=t.getNode(e);n&&(n.data.rank=n.data.rank||0,n.data.rank+=a)})))}})(t,d),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,h),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),n=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&n!==1/0&&(t.data.rank-=n)}))})(t),qg(t),$g(t);const f=[];((t,e)=>{t.getAllEdges().forEach((n=>Wp(t,n,e)))})(t,f),ig(t,f),(t=>{const e=n=>{const r=t.getChildren(n),i=t.getNode(n);if((null==r?void 0:r.length)&&r.forEach((t=>e(t.id))),i.data.hasOwnProperty("minRank")){i.data.borderLeft=[],i.data.borderRight=[];for(let e=i.data.minRank,r=i.data.maxRank+1;e<r;e+=1)_p(t,"borderLeft","_bl",n,i,e),_p(t,"borderRight","_br",n,i,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),a&&((t,e)=>{const n=t.getAllNodes().filter((e=>{var n;return!(null===(n=t.getChildren(e.id))||void 0===n?void 0:n.length)})),r=n.map((t=>t.data.rank)),i=Math.max(...r),o=[];for(let t=0;t<i+1;t++)o[t]=[];null==e||e.forEach((e=>{const n=t.getNode(e);n&&!n.data.dummy&&(isNaN(n.data.rank)||(n.data.fixorder=o[n.data.rank].length,o[n.data.rank].push(e)))}))})(t,o),((t,e)=>{const n=Tp(t),r=[],i=[];for(let t=1;t<n+1;t++)r.push(t);for(let t=n-1;t>-1;t--)i.push(t);const o=eg(t,r,"in"),a=eg(t,i,"out");let s=$p(t);rg(t,s);let u,c=Number.POSITIVE_INFINITY;for(let n=0,r=0;r<4;++n,++r){ng(n%2?o:a,n%4>=2,!1,e),s=Cp(t);const i=qp(t,s);i<c&&(r=0,u=Jt(s),c=i)}s=$p(t),rg(t,s);for(let n=0,r=0;r<4;++n,++r){ng(n%2?o:a,n%4>=2,!0,e),s=Cp(t);const i=qp(t,s);i<c&&(r=0,u=Jt(s),c=i)}rg(t,u)})(t,a),tm(t),((t,e)=>{const n=e.toLowerCase();"lr"!==n&&"rl"!==n||Rp(t)})(t,i),fg(t,{align:s,nodesep:u,edgesep:c,ranksep:l}),em(t),Qg(t),((t,e)=>{e.forEach((e=>{let n=t.getNode(e);const{data:r}=n,i=r.originalEdge;let o;i&&t.addEdge(i);let a=e;for(;n.data.dummy;)o=t.getSuccessors(a)[0],t.removeNode(a),i.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===Vp&&(i.data.x=n.data.x,i.data.y=n.data.y,i.data.width=n.data.width,i.data.height=n.data.height),a=o.id,n=t.getNode(a)}))})(t,f),Xg(t),((t,e)=>{const n=e.toLowerCase();"bt"!==n&&"rl"!==n||Dp(t),"lr"!==n&&"rl"!==n||(jp(t),Rp(t))})(t,i);const{width:p,height:g}=Yg(t);return Kg(t),Zg(t),(t=>{t.getAllEdges().forEach((e=>{const n=e.data;if(n.reversed){t.removeEdge(e.id);const r=n.forwardName;delete n.reversed,delete n.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},n),{forwardName:r})})}}))})(t),{width:p,height:g}},Ig=(t,e)=>{t.getAllNodes().forEach((n=>{const r=t.getNode(n.id);if(e.hasNode(n.id)){const t=e.getNode(n.id);r.data.fixorder=t.data._order,delete t.data._order}else delete r.data.fixorder}))},jg=(t,e)=>{t.getAllNodes().forEach((n=>{var r;const i=t.getNode(n.id);if(i){const t=e.getNode(n.id);i.data.x=t.data.x,i.data.y=t.data.y,i.data._order=t.data.order,i.data._rank=t.data.rank,(null===(r=e.getChildren(n.id))||void 0===r?void 0:r.length)&&(i.data.width=t.data.width,i.data.height=t.data.height)}})),t.getAllEdges().forEach((n=>{const r=t.getEdge(n.id),i=e.getEdge(n.id);r.data.points=i?i.data.points:[],i&&i.data.hasOwnProperty("x")&&(r.data.x=i.data.x,r.data.y=i.data.y)}))},zg=["width","height","layer","fixorder"],Bg={width:0,height:0},Fg=["minlen","weight","width","height","labeloffset"],Gg={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Vg=["labelpos"],Wg=t=>{const e=new hp({tree:[]});return t.getAllNodes().forEach((n=>{const r=rm(t.getNode(n.id).data),i=Object.assign(Object.assign({},Bg),r),o=nm(i,zg);e.hasNode(n.id)||e.addNode({id:n.id,data:Object.assign({},o)});const a=t.hasTreeStructure("combo")?t.getParent(n.id,"combo"):t.getParent(n.id);Pt(a)||(e.hasNode(a.id)||e.addNode(Object.assign({},a)),e.setParent(n.id,a.id))})),t.getAllEdges().forEach((n=>{const r=rm(t.getEdge(n.id).data),i={};null==Vg||Vg.forEach((t=>{void 0!==r[t]&&(i[t]=r[t])})),e.addEdge({id:n.id,source:n.source,target:n.target,data:Object.assign({},Gg,nm(r,Fg),i)})})),e},Ug=(t,e)=>{const{ranksep:n=0,rankdir:r}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===r||"BT"===r?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),n/2},Hg=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const n=t.getNode(e.source),r={e:e,rank:(t.getNode(e.target).data.rank-n.data.rank)/2+n.data.rank};Mp(t,"edge-proxy",r,"_ep")}}))},qg=t=>{let e=0;return t.getAllNodes().forEach((n=>{var r,i;n.data.borderTop&&(n.data.minRank=null===(r=t.getNode(n.data.borderTop))||void 0===r?void 0:r.data.rank,n.data.maxRank=null===(i=t.getNode(n.data.borderBottom))||void 0===i?void 0:i.data.rank,e=Math.max(e,n.data.maxRank||-1/0))})),e},$g=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},Yg=(t,e)=>{let n,r,i=0,o=0;const{marginx:a=0,marginy:s=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,a=t.data.y,s=t.data.width,u=t.data.height;isNaN(e)||isNaN(s)||(void 0===n&&(n=e-s/2),n=Math.min(n,e-s/2),i=Math.max(i,e+s/2)),isNaN(a)||isNaN(u)||(void 0===r&&(r=a-u/2),r=Math.min(r,a-u/2),o=Math.max(o,a+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),n-=a,r-=s,t.getAllNodes().forEach((t=>{t.data.x-=n,t.data.y-=r})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=n,t.y-=r})),t.data.hasOwnProperty("x")&&(t.data.x-=n),t.data.hasOwnProperty("y")&&(t.data.y-=r)})),{width:i-n+a,height:o-r+s}},Kg=t=>{t.getAllEdges().forEach((e=>{const n=t.getNode(e.source),r=t.getNode(e.target);let i,o;e.data.points?(i=e.data.points[0],o=e.data.points[e.data.points.length-1]):(e.data.points=[],i={x:r.data.x,y:r.data.y},o={x:n.data.x,y:n.data.y}),e.data.points.unshift(Sp(n.data,i)),e.data.points.push(Sp(r.data,o))}))},Xg=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},Zg=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Qg=t=>{t.getAllNodes().forEach((e=>{var n,r,i;if(null===(n=t.getChildren(e.id))||void 0===n?void 0:n.length){const n=t.getNode(e.id),o=t.getNode(n.data.borderTop),a=t.getNode(n.data.borderBottom),s=t.getNode(n.data.borderLeft[(null===(r=n.data.borderLeft)||void 0===r?void 0:r.length)-1]),u=t.getNode(n.data.borderRight[(null===(i=n.data.borderRight)||void 0===i?void 0:i.length)-1]);n.data.width=Math.abs((null==u?void 0:u.data.x)-(null==s?void 0:s.data.x))||10,n.data.height=Math.abs((null==a?void 0:a.data.y)-(null==o?void 0:o.data.y))||10,n.data.x=((null==s?void 0:s.data.x)||0)+n.data.width/2,n.data.y=((null==o?void 0:o.data.y)||0)+n.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},Jg=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const n=t.getNode(e.source);n.data.selfEdges||(n.data.selfEdges=[]),n.data.selfEdges.push(e),t.removeEdge(e.id)}}))},tm=t=>{const e=Cp(t);null==e||e.forEach((e=>{let n=0;null==e||e.forEach(((e,r)=>{var i;const o=t.getNode(e);o.data.order=r+n,null===(i=o.data.selfEdges)||void 0===i||i.forEach((e=>{Mp(t,"selfedge",{width:e.data.width,height:e.data.height,rank:o.data.rank,order:r+ ++n,e:e},"_se")})),delete o.data.selfEdges}))}))},em=t=>{t.getAllNodes().forEach((e=>{const n=t.getNode(e.id);if("selfedge"===n.data.dummy){const r=t.getNode(n.data.e.source),i=r.data.x+r.data.width/2,o=r.data.y,a=n.data.x-i,s=r.data.height/2;t.hasEdge(n.data.e.id)?t.updateEdgeData(n.data.e.id,n.data.e.data):t.addEdge({id:n.data.e.id,source:n.data.e.source,target:n.data.e.target,data:n.data.e.data}),t.removeNode(e.id),n.data.e.data.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{y:o,x:i+a},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.data.e.data.x=n.data.x,n.data.e.data.y=n.data.y}}))},nm=(t,e)=>{const n={};return null==e||e.forEach((e=>{void 0!==t[e]&&(n[e]=+t[e])})),n},rm=(t={})=>{const e={};return Object.keys(t).forEach((n=>{e[n.toLowerCase()]=t[n]})),e},im=Array.isArray,om=t=>{const e=[],n=t.length;for(let r=0;r<n;r+=1){e[r]=[];for(let i=0;i<n;i+=1)r===i?e[r][i]=0:0!==t[r][i]&&t[r][i]?e[r][i]=t[r][i]:e[r][i]=1/0}for(let t=0;t<n;t+=1)for(let r=0;r<n;r+=1)for(let i=0;i<n;i+=1)e[r][i]>e[r][t]+e[t][i]&&(e[r][i]=e[r][t]+e[t][i]);return e},am=(t,e)=>{const{nodes:n,edges:r}=t,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(((t,e)=>{o[t.id]=e;i.push([])})),null==r||r.forEach((t=>{const{source:n,target:r}=t,a=o[n],s=o[r];void 0!==a&&void 0!==s&&(i[a][s]=1,e||(i[s][a]=1))})),i},sm=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),um=(t,e,n,r="TB",i,o={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:a,stopAllFn:s}=o;for(let u=0;u<e.length;u++){const c=e[u];if(t.hasNode(c.id)&&!(null==a?void 0:a(c))){if(null==s?void 0:s(c))return;"TB"===r&&n(c),um(t,t.getChildren(c.id,i),n,r,i,o),"TB"!==r&&n(c)}}},cm=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>cm(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((n=>{e[n]=cm(t[n])})),e}return t},lm=(t,e)=>{const n=cm(t);return n.data=n.data||{},e&&(Wt(n.data.x)||(n.data.x=Math.random()*e[0]),Wt(n.data.y)||(n.data.y=Math.random()*e[1])),n};function hm(t,e){let n;return n=Tt(e)?e:Wt(e)?()=>e:()=>t,n}function dm(t,e,n=!0){return e||0===e?Tt(e)?e:Wt(e)?()=>e:Array.isArray(e)?()=>{if(n){const n=Math.max(...e);return isNaN(n)?t:n}return e}:Rt(e)?()=>{if(n){const n=Math.max(e.width,e.height);return isNaN(n)?t:n}return[e.width,e.height]}:()=>t:e=>{const{size:n}=e.data||{};return n?Array.isArray(n)?n[0]>n[1]?n[0]:n[1]:Rt(n)?n.width>n.height?n.width:n.height:n:t}}const fm=(t,e)=>{let n,r;return r=Wt(e)?()=>e:Tt(e)?e:()=>0,n=t?Array.isArray(t)?e=>(t[0]>t[1]?t[0]:t[1])+r(e):Tt(t)?t:e=>t+r(e):t=>{var e,n;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+r(t);if(null===(n=t.data)||void 0===n?void 0:n.size){if(Array.isArray(t.data.size))return Math.max(t.data.size[0],t.data.size[1])+r(t);const e=t.data.size;if(Rt(e)){return(e.width>e.height?e.width:e.height)+r(t)}return e+r(t)}return 10+r(t)},n},pm={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};const gm=(t,e,n,r,i,o,a)=>{let s=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&n){let{x:t,y:u}=e.data,{x:c,y:l}=n.data;if(i&&(t=e.data.y,u=e.data.x,c=n.data.y,l=n.data.x),l!==u&&t!==c){const h=r.indexOf(u),d=r[h+1];if(d){const t=s[0],e=i?{x:(u+d)/2,y:(null==t?void 0:t.y)||c}:{x:(null==t?void 0:t.x)||c,y:(u+d)/2};t&&!o(t,e)||s.unshift(e)}const f=r.indexOf(l),p=Math.abs(f-h);if(1===p)s=a(s,e.data,n.data),s.length||s.push(i?{x:(u+l)/2,y:t}:{x:t,y:(u+l)/2});else if(p>1){const e=r[f-1];if(e){const n=s[s.length-1],r=i?{x:(l+e)/2,y:(null==n?void 0:n.y)||c}:{x:(null==n?void 0:n.x)||t,y:(l+e)/2};n&&!o(n,r)||s.push(r)}}}}return s},mm=(t,e,n)=>{const r=t.getAllNodes(),i=t.getAllEdges();if(!(null==r?void 0:r.length)){return{nodes:[],edges:i}}if(1===r.length){e&&t.mergeNodeData(r[0].id,{x:n[0],y:n[1]});return{nodes:[Object.assign(Object.assign({},r[0]),{data:Object.assign(Object.assign({},r[0].data),{x:n[0],y:n[1]})})],edges:i}}},vm={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};const ym=(t,e,n=!1)=>{const r=[lm(e[0])],i={},o=e.length;i[e[0].id]=!0;let a=0;return e.forEach(((s,u)=>{if(0!==u)if(u!==o-1&&t.getDegree(s.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(r[a].id,s.id)||i[s.id]){const u=n?t.getSuccessors(r[a].id):t.getNeighbors(r[a].id);let c=!1;for(let e=0;e<u.length;e++){const n=u[e];if(t.getDegree(n.id)===t.getDegree(s.id)&&!i[n.id]){r.push(lm(n)),i[n.id]=!0,c=!0;break}}let l=0;for(;!c&&(i[e[l].id]||(r.push(lm(e[l])),i[e[l].id]=!0,c=!0),l++,l!==o););}else r.push(lm(s)),i[s.id]=!0,a++})),r};const bm=(t,e,n)=>{let r=t,i=e,o=n;return r||"undefined"==typeof window||(r=window.innerWidth),i||"undefined"==typeof window||(i=window.innerHeight),o||(o=[r/2,i/2]),[r,i,o]},Em={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class wm{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},Em),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericConcentricLayout(!0,t,e)}))}genericConcentricLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{center:i,width:o,height:a,sortBy:s,maxLevelDiff:u,sweep:c,clockwise:l,equidistant:h,preventOverlap:d,startAngle:f=1.5*Math.PI,nodeSize:p,nodeSpacing:g}=r,m=e.getAllNodes(),v=e.getAllEdges(),y=o||"undefined"==typeof window?o:window.innerWidth,b=a||"undefined"==typeof window?a:window.innerHeight,E=i||[y/2,b/2];if(!(null==m?void 0:m.length)||1===m.length)return mm(e,t,E);const w=[];let x,M=0;im(p)?x=Math.max(p[0],p[1]):Tt(p)?(x=-1/0,m.forEach((t=>{const e=p(t);e>x&&(x=e)}))):x=p,im(g)?M=Math.max(g[0],g[1]):Wt(g)&&(M=g),m.forEach((t=>{const e=lm(t);w.push(e);let n=x;const{data:r}=e;im(r.size)?n=Math.max(r.size[0],r.size[1]):Wt(r.size)?n=r.size:Rt(r.size)&&(n=Math.max(r.size.width,r.size.height)),x=Math.max(x,n),Tt(g)&&(M=Math.max(g(t),M))}));const N={};w.forEach(((t,e)=>{N[t.id]=e}));let S=s;Bt(S)&&void 0!==w[0].data[S]||(S="degree"),"degree"===S?w.sort(((t,n)=>e.getDegree(n.id,"both")-e.getDegree(t.id,"both"))):w.sort(((t,e)=>e.data[S]-t.data[S]));const C=w[0],k=(u||("degree"===S?e.getDegree(C.id,"both"):C.data[S]))/4,T=[{nodes:[]}];let P=T[0];w.forEach((t=>{if(P.nodes.length>0){const n="degree"===S?Math.abs(e.getDegree(P.nodes[0].id,"both")-e.getDegree(t.id,"both")):Math.abs(P.nodes[0].data[S]-t.data[S]);k&&n>=k&&(P={nodes:[]},T.push(P))}P.nodes.push(t)}));let A=x+M;if(!d){const t=T.length>0&&T[0].nodes.length>1,e=(Math.min(y,b)/2-A)/(T.length+(t?1:0));A=Math.min(A,e)}let O=0;if(T.forEach((t=>{const e=void 0===c?2*Math.PI-2*Math.PI/t.nodes.length:c;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&d){const e=Math.cos(t.dTheta)-Math.cos(0),n=Math.sin(t.dTheta)-Math.sin(0),r=Math.sqrt(A*A/(e*e+n*n));O=Math.max(r,O)}t.r=O,O+=A})),h){let t=0,e=0;for(let n=0;n<T.length;n++){const r=(T[n].r||0)-e;t=Math.max(t,r)}e=0,T.forEach(((n,r)=>{0===r&&(e=n.r||0),n.r=e,e+=t}))}T.forEach((t=>{const e=t.dTheta||0,n=t.r||0;t.nodes.forEach(((t,r)=>{const i=f+(l?1:-1)*e*r;t.data.x=E[0]+n*Math.cos(i),t.data.y=E[1]+n*Math.sin(i)}))})),t&&w.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:w,edges:v}}))}}function xm(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,u,c,l,h,d,f=t._root,p={data:r},g=t._x0,m=t._y0,v=t._x1,y=t._y1;if(!f)return t._root=p,t;for(;f.length;)if((c=e>=(o=(g+v)/2))?g=o:v=o,(l=n>=(a=(m+y)/2))?m=a:y=a,i=f,!(f=f[h=l<<1|c]))return i[h]=p,t;if(s=+t._x.call(null,f.data),u=+t._y.call(null,f.data),e===s&&n===u)return p.next=f,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=e>=(o=(g+v)/2))?g=o:v=o,(l=n>=(a=(m+y)/2))?m=a:y=a}while((h=l<<1|c)==(d=(u>=a)<<1|s>=o));return i[d]=f,i[h]=p,t}function Mm(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function Nm(t){return t[0]}function Sm(t){return t[1]}function Cm(t,e,n){var r=new km(null==e?Nm:e,null==n?Sm:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function km(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Tm(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Pm=Cm.prototype=km.prototype;function Am(t,e,n,r,i){if(isNaN(e)||isNaN(n)||isNaN(r))return t;var o,a,s,u,c,l,h,d,f,p,g,m,v=t._root,y={data:i},b=t._x0,E=t._y0,w=t._z0,x=t._x1,M=t._y1,N=t._z1;if(!v)return t._root=y,t;for(;v.length;)if((d=e>=(a=(b+x)/2))?b=a:x=a,(f=n>=(s=(E+M)/2))?E=s:M=s,(p=r>=(u=(w+N)/2))?w=u:N=u,o=v,!(v=v[g=p<<2|f<<1|d]))return o[g]=y,t;if(c=+t._x.call(null,v.data),l=+t._y.call(null,v.data),h=+t._z.call(null,v.data),e===c&&n===l&&r===h)return y.next=v,o?o[g]=y:t._root=y,t;do{o=o?o[g]=new Array(8):t._root=new Array(8),(d=e>=(a=(b+x)/2))?b=a:x=a,(f=n>=(s=(E+M)/2))?E=s:M=s,(p=r>=(u=(w+N)/2))?w=u:N=u}while((g=p<<2|f<<1|d)==(m=(h>=u)<<2|(l>=s)<<1|c>=a));return o[m]=v,o[g]=y,t}function Om(t,e,n,r,i,o,a){this.node=t,this.x0=e,this.y0=n,this.z0=r,this.x1=i,this.y1=o,this.z1=a}function _m(t){return t[0]}function Rm(t){return t[1]}function Lm(t){return t[2]}function Dm(t,e,n,r){var i=new Im(null==e?_m:e,null==n?Rm:n,null==r?Lm:r,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function Im(t,e,n,r,i,o,a,s,u){this._x=t,this._y=e,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=u,this._root=void 0}function jm(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}Pm.copy=function(){var t,e,n=new km(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=Tm(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=Tm(e));return n},Pm.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return xm(this.cover(e,n),e,n,t)},Pm.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),u=1/0,c=1/0,l=-1/0,h=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,s[n]=i,r<u&&(u=r),r>l&&(l=r),i<c&&(c=i),i>h&&(h=i));if(u>l||c>h)return this;for(this.cover(u,c).cover(l,h),n=0;n<o;++n)xm(this,a[n],s[n],t[n]);return this},Pm.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,u=i-n||1,c=this._root;n>t||t>=i||r>e||e>=o;)switch(s=(e<r)<<1|t<n,(a=new Array(4))[s]=c,c=a,u*=2,s){case 0:i=n+u,o=r+u;break;case 1:n=i-u,o=r+u;break;case 2:i=n+u,r=o-u;break;case 3:n=i-u,r=o-u}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},Pm.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Pm.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Pm.find=function(t,e,n){var r,i,o,a,s,u,c,l=this._x0,h=this._y0,d=this._x1,f=this._y1,p=[],g=this._root;for(g&&p.push(new Mm(g,l,h,d,f)),null==n?n=1/0:(l=t-n,h=e-n,d=t+n,f=e+n,n*=n);u=p.pop();)if(!(!(g=u.node)||(i=u.x0)>d||(o=u.y0)>f||(a=u.x1)<l||(s=u.y1)<h))if(g.length){var m=(i+a)/2,v=(o+s)/2;p.push(new Mm(g[3],m,v,a,s),new Mm(g[2],i,v,m,s),new Mm(g[1],m,o,a,v),new Mm(g[0],i,o,m,v)),(c=(e>=v)<<1|t>=m)&&(u=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=u)}else{var y=t-+this._x.call(null,g.data),b=e-+this._y.call(null,g.data),E=y*y+b*b;if(E<n){var w=Math.sqrt(n=E);l=t-w,h=e-w,d=t+w,f=e+w,r=g.data}}return r},Pm.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,s,u,c,l,h,d,f=this._root,p=this._x0,g=this._y0,m=this._x1,v=this._y1;if(!f)return this;if(f.length)for(;;){if((c=o>=(s=(p+m)/2))?p=s:m=s,(l=a>=(u=(g+v)/2))?g=u:v=u,e=f,!(f=f[h=l<<1|c]))return this;if(!f.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,d=h)}for(;f.data!==t;)if(r=f,!(f=f.next))return this;return(i=f.next)&&delete f.next,r?(i?r.next=i:delete r.next,this):e?(i?e[h]=i:delete e[h],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(n?n[d]=f:this._root=f),this):(this._root=i,this)},Pm.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},Pm.root=function(){return this._root},Pm.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Pm.visit=function(t){var e,n,r,i,o,a,s=[],u=this._root;for(u&&s.push(new Mm(u,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(u=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&u.length){var c=(r+o)/2,l=(i+a)/2;(n=u[3])&&s.push(new Mm(n,c,l,o,a)),(n=u[2])&&s.push(new Mm(n,r,l,c,a)),(n=u[1])&&s.push(new Mm(n,c,i,o,l)),(n=u[0])&&s.push(new Mm(n,r,i,c,l))}return this},Pm.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new Mm(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,u=e.x1,c=e.y1,l=(a+u)/2,h=(s+c)/2;(o=i[0])&&n.push(new Mm(o,a,s,l,h)),(o=i[1])&&n.push(new Mm(o,l,s,u,h)),(o=i[2])&&n.push(new Mm(o,a,h,l,c)),(o=i[3])&&n.push(new Mm(o,l,h,u,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},Pm.x=function(t){return arguments.length?(this._x=t,this):this._x},Pm.y=function(t){return arguments.length?(this._y=t,this):this._y};var zm=Dm.prototype=Im.prototype;zm.copy=function(){var t,e,n=new Im(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),r=this._root;if(!r)return n;if(!r.length)return n._root=jm(r),n;for(t=[{source:r,target:n._root=new Array(8)}];r=t.pop();)for(var i=0;i<8;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(8)}):r.target[i]=jm(e));return n},zm.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t),r=+this._z.call(null,t);return Am(this.cover(e,n,r),e,n,r,t)},zm.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,n=new Float64Array(e),r=new Float64Array(e),i=new Float64Array(e);let o=1/0,a=1/0,s=1/0,u=-1/0,c=-1/0,l=-1/0;for(let h,d,f,p,g=0;g<e;++g)isNaN(d=+this._x.call(null,h=t[g]))||isNaN(f=+this._y.call(null,h))||isNaN(p=+this._z.call(null,h))||(n[g]=d,r[g]=f,i[g]=p,d<o&&(o=d),d>u&&(u=d),f<a&&(a=f),f>c&&(c=f),p<s&&(s=p),p>l&&(l=p));if(o>u||a>c||s>l)return this;this.cover(o,a,s).cover(u,c,l);for(let o=0;o<e;++o)Am(this,n[o],r[o],i[o],t[o]);return this},zm.cover=function(t,e,n){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,o=this._z0,a=this._x1,s=this._y1,u=this._z1;if(isNaN(r))a=(r=Math.floor(t))+1,s=(i=Math.floor(e))+1,u=(o=Math.floor(n))+1;else{for(var c,l,h=a-r||1,d=this._root;r>t||t>=a||i>e||e>=s||o>n||n>=u;)switch(l=(n<o)<<2|(e<i)<<1|t<r,(c=new Array(8))[l]=d,d=c,h*=2,l){case 0:a=r+h,s=i+h,u=o+h;break;case 1:r=a-h,s=i+h,u=o+h;break;case 2:a=r+h,i=s-h,u=o+h;break;case 3:r=a-h,i=s-h,u=o+h;break;case 4:a=r+h,s=i+h,o=u-h;break;case 5:r=a-h,s=i+h,o=u-h;break;case 6:a=r+h,i=s-h,o=u-h;break;case 7:r=a-h,i=s-h,o=u-h}this._root&&this._root.length&&(this._root=d)}return this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=u,this},zm.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},zm.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},zm.find=function(t,e,n,r){var i,o,a,s,u,c,l,h,d,f=this._x0,p=this._y0,g=this._z0,m=this._x1,v=this._y1,y=this._z1,b=[],E=this._root;for(E&&b.push(new Om(E,f,p,g,m,v,y)),null==r?r=1/0:(f=t-r,p=e-r,g=n-r,m=t+r,v=e+r,y=n+r,r*=r);h=b.pop();)if(!(!(E=h.node)||(o=h.x0)>m||(a=h.y0)>v||(s=h.z0)>y||(u=h.x1)<f||(c=h.y1)<p||(l=h.z1)<g))if(E.length){var w=(o+u)/2,x=(a+c)/2,M=(s+l)/2;b.push(new Om(E[7],w,x,M,u,c,l),new Om(E[6],o,x,M,w,c,l),new Om(E[5],w,a,M,u,x,l),new Om(E[4],o,a,M,w,x,l),new Om(E[3],w,x,s,u,c,M),new Om(E[2],o,x,s,w,c,M),new Om(E[1],w,a,s,u,x,M),new Om(E[0],o,a,s,w,x,M)),(d=(n>=M)<<2|(e>=x)<<1|t>=w)&&(h=b[b.length-1],b[b.length-1]=b[b.length-1-d],b[b.length-1-d]=h)}else{var N=t-+this._x.call(null,E.data),S=e-+this._y.call(null,E.data),C=n-+this._z.call(null,E.data),k=N*N+S*S+C*C;if(k<r){var T=Math.sqrt(r=k);f=t-T,p=e-T,g=n-T,m=t+T,v=e+T,y=n+T,i=E.data}}return i},zm.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var e,n,r,i,o,a,s,u,c,l,h,d,f,p,g,m=this._root,v=this._x0,y=this._y0,b=this._z0,E=this._x1,w=this._y1,x=this._z1;if(!m)return this;if(m.length)for(;;){if((h=o>=(u=(v+E)/2))?v=u:E=u,(d=a>=(c=(y+w)/2))?y=c:w=c,(f=s>=(l=(b+x)/2))?b=l:x=l,e=m,!(m=m[p=f<<2|d<<1|h]))return this;if(!m.length)break;(e[p+1&7]||e[p+2&7]||e[p+3&7]||e[p+4&7]||e[p+5&7]||e[p+6&7]||e[p+7&7])&&(n=e,g=p)}for(;m.data!==t;)if(r=m,!(m=m.next))return this;return(i=m.next)&&delete m.next,r?(i?r.next=i:delete r.next,this):e?(i?e[p]=i:delete e[p],(m=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&m===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!m.length&&(n?n[g]=m:this._root=m),this):(this._root=i,this)},zm.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},zm.root=function(){return this._root},zm.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},zm.visit=function(t){var e,n,r,i,o,a,s,u,c=[],l=this._root;for(l&&c.push(new Om(l,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,o=e.z0,a=e.x1,s=e.y1,u=e.z1)&&l.length){var h=(r+a)/2,d=(i+s)/2,f=(o+u)/2;(n=l[7])&&c.push(new Om(n,h,d,f,a,s,u)),(n=l[6])&&c.push(new Om(n,r,d,f,h,s,u)),(n=l[5])&&c.push(new Om(n,h,i,f,a,d,u)),(n=l[4])&&c.push(new Om(n,r,i,f,h,d,u)),(n=l[3])&&c.push(new Om(n,h,d,o,a,s,f)),(n=l[2])&&c.push(new Om(n,r,d,o,h,s,f)),(n=l[1])&&c.push(new Om(n,h,i,o,a,d,f)),(n=l[0])&&c.push(new Om(n,r,i,o,h,d,f))}return this},zm.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new Om(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,u=e.z0,c=e.x1,l=e.y1,h=e.z1,d=(a+c)/2,f=(s+l)/2,p=(u+h)/2;(o=i[0])&&n.push(new Om(o,a,s,u,d,f,p)),(o=i[1])&&n.push(new Om(o,d,s,u,c,f,p)),(o=i[2])&&n.push(new Om(o,a,f,u,d,l,p)),(o=i[3])&&n.push(new Om(o,d,f,u,c,l,p)),(o=i[4])&&n.push(new Om(o,a,s,p,d,f,h)),(o=i[5])&&n.push(new Om(o,d,s,p,c,f,h)),(o=i[6])&&n.push(new Om(o,a,f,p,d,l,h)),(o=i[7])&&n.push(new Om(o,d,f,p,c,l,h))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},zm.x=function(t){return arguments.length?(this._x=t,this):this._x},zm.y=function(t){return arguments.length?(this._y=t,this):this._y},zm.z=function(t){return arguments.length?(this._z=t,this):this._z};function Bm(t,e,n,r,i=2){const o=e/n,a=t.getAllNodes(),s=a.map(((t,e)=>{const{nodeStrength:n,x:r,y:i,z:a,size:s}=t.data;return{x:r,y:i,z:a,size:s,index:e,id:t.id,vx:0,vy:0,vz:0,weight:o*n}})),u=(2===i?Cm(s,(t=>t.x),(t=>t.y)):Dm(s,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(Fm),c=new Map;return s.forEach((t=>{c.set(t.id,t),function(t,e,n){e.visit(((e,r,i,o,a)=>Gm(e,r,i,o,a,t,n)))}(t,u,i)})),s.map(((t,e)=>{const{id:n,data:i}=a[e],{mass:o=1}=i;r[n]={x:t.vx/o,y:t.vy/o,z:t.vz/o}})),r}function Fm(t){let e=0,n=0,r=0,i=0,o=0;const a=t.length;if(a){for(let s=0;s<a;s++){const a=t[s];a&&a.weight&&(e+=a.weight,n+=a.x*a.weight,r+=a.y*a.weight,i+=a.z*a.weight,o+=a.size*a.weight)}t.x=n/e,t.y=r/e,t.z=i/e,t.size=o/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}const Gm=(t,e,n,r,i,o,a)=>{var s;if((null===(s=t.data)||void 0===s?void 0:s.id)===o.id)return;const u=[n,r,i][a-1],c=o.x-t.x||.1,l=o.y-t.y||.1,h=o.z-t.z||.1,d=[c,l,h],f=u-e;let p=0;for(let t=0;t<a;t++)p+=d[t]*d[t];const g=Math.sqrt(p)*p;if(f*f*.81<p){const e=t.weight/g;return o.vx+=c*e,o.vy+=l*e,o.vz+=h*e,!0}if(t.length)return!1;if(t.data!==o){const e=t.data.weight/g;o.vx+=c*e,o.vy+=l*e,o.vz+=h*e}};const Vm={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class Wm{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},Vm),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericForceLayout(!0,t,e)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),i=e.getAllNodes(),o=e.getAllEdges(),a=this.formatOptions(r,e),{dimensions:s,width:u,height:c,nodeSize:l,getMass:h,nodeStrength:d,edgeStrength:f,linkDistance:p}=a,g=i.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:Wt(t.data.x)?t.data.x:Math.random()*u,y:Wt(t.data.y)?t.data.y:Math.random()*c,z:Wt(t.data.z)?t.data.z:Math.random()*Math.sqrt(u*c),size:l(t)||30,mass:h(t),nodeStrength:d(t)})}))),m=o.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:f(t),linkDistance:p(t,e.getNode(t.source),e.getNode(t.target))})})));if(!(null==i?void 0:i.length))return this.lastResult={nodes:[],edges:o},{nodes:[],edges:o};const v={};i.forEach(((t,e)=>{v[t.id]={x:0,y:0,z:0}}));const y=new hp({nodes:g,edges:m});this.formatCentripetal(a,y);const{maxIteration:b,minMovement:E,onTick:w}=a;if(this.lastLayoutNodes=g,this.lastLayoutEdges=m,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=y,this.lastOptions=a,this.lastVelMap=v,"undefined"==typeof window)return;let x=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{i&&this.running||n({nodes:Ym(e,g),edges:o}),this.runOneStep(y,e,x,v,a),this.updatePosition(e,y,v,a),t&&g.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===s?t.data.z:void 0}))),null==w||w({nodes:Ym(e,g),edges:o}),x++,(x>=b||this.judgingDistance<E)&&(window.clearInterval(this.timeInterval),n({nodes:Ym(e,g),edges:o}))}),0),this.running=!0}))}))}formatOptions(t,e){const n=Object.assign({},t),{width:r,height:i,getMass:o,nodeSize:a}=t;n.width=r||"undefined"==typeof window?r:window.innerWidth,n.height=i||"undefined"==typeof window?i:window.innerHeight,t.center||(n.center=[n.width/2,n.height/2]),o||(n.getMass=t=>{let n=1;Wt(null==t?void 0:t.data.mass)&&(n=null==t?void 0:t.data.mass);const r=e.getDegree(t.id,"both");return!r||r<5?n:5*r*n});const s=hm(0,t.nodeSpacing);let u;u=a?Tt(a)?t=>a(t)+s(t):im(a)?t=>{const e=a;return Math.max(e[0],e[1])+s(t)}:t=>a+s(t):t=>{const{size:e}=(null==t?void 0:t.data)||{};return e?im(e)?Math.max(e[0],e[1])+s(t):Rt(e)?Math.max(e.width,e.height)+s(t):e+s(t):10+s(t)},n.nodeSize=u;const c=t.linkDistance?hm(1,t.linkDistance):t=>1+n.nodeSize(e.getNode(t.source))+n.nodeSize(e.getNode(t.target));return n.linkDistance=c,n.nodeStrength=hm(1,t.nodeStrength),n.edgeStrength=hm(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:r,center:i,clusterNodeStrength:o,leafCluster:a,clustering:s,nodeClusterBy:u}=t,c=e.getAllNodes(),l=r||{leaf:2,single:2,others:1,center:t=>({x:i[0],y:i[1],z:3===n?i[2]:void 0})};let h,d;if("function"!=typeof o&&(t.clusterNodeStrength=t=>o),a&&u&&(h=Um(e,u),d=Array.from(new Set(null==c?void 0:c.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(l,{single:100,leaf:e=>{const{siblingLeaves:n,sameTypeLeaves:r}=h[e.id]||{};return(null==r?void 0:r.length)===(null==n?void 0:n.length)||1===(null==d?void 0:d.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const n=e.getDegree(t.id,"both");if(!n)return{x:100,y:100,z:0};let r;if(1===n){const{sameTypeLeaves:e=[]}=h[t.id]||{};1===e.length?r=void 0:e.length>1&&(r=$m(e))}else r=void 0;return{x:null==r?void 0:r.x,y:null==r?void 0:r.y,z:null==r?void 0:r.z}}})),s&&u){h||(h=Um(e,u)),d||(d=Array.from(new Set(c.map((t=>t.data[u]))))),d=d.filter((t=>void 0!==t));const n={};d.forEach((t=>{const r=c.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));n[t]=$m(r)})),t.centripetalOptions=Object.assign(l,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=n[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:p,others:g}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),p&&"function"!=typeof p&&(t.centripetalOptions.single=()=>p),g&&"function"!=typeof g&&(t.centripetalOptions.others=()=>g)}runOneStep(t,e,n,r,i){const o={},a=t.getAllNodes(),s=t.getAllEdges();if(!(null==a?void 0:a.length))return;const{monitor:u}=i;if(this.calRepulsive(t,o,i),s&&this.calAttractive(t,o,i),this.calGravity(t,e,o,i),this.updateVelocity(t,o,r,i),u){u({energy:this.calTotalEnergy(o,a),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})}}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let n=0;return e.forEach(((e,r)=>{const i=t[e.id].x,o=t[e.id].y,a=3===this.options.dimensions?t[e.id].z:0,s=i*i+o*o+a*a,{mass:u=1}=e.data;n+=u*s*.5})),n}calRepulsive(t,e,n){const{dimensions:r,factor:i,coulombDisScale:o}=n;Bm(t,i,o*o,e,r)}calAttractive(t,e,n){const{dimensions:r,nodeSize:i}=n;t.getAllEdges().forEach(((n,o)=>{const{source:a,target:s}=n,u=t.getNode(a),c=t.getNode(s);if(!u||!c)return;let l=c.data.x-u.data.x,h=c.data.y-u.data.y,d=3===r?c.data.z-u.data.z:0;l||h||(l=.01*Math.random(),h=.01*Math.random(),3!==r||d||(d=.01*Math.random()));const f=Math.sqrt(l*l+h*h+d*d);if(f<i(u)+i(c))return;const p=l/f,g=h/f,m=d/f,{linkDistance:v=200,edgeStrength:y=200}=n.data||{},b=(v-f)*y,E=1/(u.data.mass||1),w=1/(c.data.mass||1),x=p*b,M=g*b,N=m*b;e[a].x-=x*E,e[a].y-=M*E,e[a].z-=N*E,e[s].x+=x*w,e[s].y+=M*w,e[s].z+=N*w}))}calGravity(t,e,n,r){const{getCenter:i}=r,o=t.getAllNodes(),a=e.getAllNodes(),s=e.getAllEdges(),{width:u,height:c,center:l,gravity:h,centripetalOptions:d}=r;o&&o.forEach((r=>{const{id:o,data:f}=r,{mass:p,x:g,y:m,z:v}=f,y=e.getNode(o);let b=0,E=0,w=0,x=h;const M=t.getDegree(o,"in"),N=t.getDegree(o,"out"),S=t.getDegree(o,"both"),C=null==i?void 0:i(y,S);if(C){const[t,e,n]=C;b=g-t,E=m-e,x=n}else b=g-l[0],E=m-l[1],w=v-l[2];if(x&&(n[o].x-=x*b/p,n[o].y-=x*E/p,n[o].z-=x*w/p),d){const{leaf:t,single:e,others:r,center:i}=d,{x:l,y:h,z:f,centerStrength:b}=(null==i?void 0:i(y,a,s,u,c))||{x:0,y:0,z:0,centerStrength:0};if(!Wt(l)||!Wt(h))return;const E=(g-l)/p,w=(m-h)/p,x=(v-f)/p;if(b&&(n[o].x-=b*E,n[o].y-=b*w,n[o].z-=b*x),0===S){const t=e(y);if(!t)return;return n[o].x-=t*E,n[o].y-=t*w,void(n[o].z-=t*x)}if(0===M||0===N){const e=t(y,a,s);if(!e)return;return n[o].x-=e*E,n[o].y-=e*w,void(n[o].z-=e*x)}const C=r(y);if(!C)return;n[o].x-=C*E,n[o].y-=C*w,n[o].z-=C*x}}))}updateVelocity(t,e,n,r){const{damping:i,maxSpeed:o,interval:a,dimensions:s}=r,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:r}=t;let u=(n[r].x+e[r].x*a)*i||.01,c=(n[r].y+e[r].y*a)*i||.01,l=3===s?(n[r].z+e[r].z*a)*i||.01:0;const h=Math.sqrt(u*u+c*c+l*l);if(h>o){const t=o/h;u*=t,c*=t,l*=t}n[r]={x:u,y:c,z:l}}))}updatePosition(t,e,n,r){const{distanceThresholdMode:i,interval:o,dimensions:a}=r,s=e.getAllNodes();if(!(null==s?void 0:s.length))return void(this.judgingDistance=0);let u=0;"max"===i?this.judgingDistance=-1/0:"min"===i&&(this.judgingDistance=1/0),s.forEach((r=>{const{id:s}=r,c=t.getNode(s);if(Wt(c.data.fx)&&Wt(c.data.fy))return void e.mergeNodeData(s,{x:c.data.fx,y:c.data.fy,z:3===a?c.data.fz:void 0});const l=n[s].x*o,h=n[s].y*o,d=3===a?n[s].z*o:0;e.mergeNodeData(s,{x:r.data.x+l,y:r.data.y+h,z:r.data.z+d});const f=Math.sqrt(l*l+h*h+d*d);switch(i){case"max":this.judgingDistance<f&&(this.judgingDistance=f);break;case"min":this.judgingDistance>f&&(this.judgingDistance=f);break;default:u+=f}})),i&&"mean"!==i||(this.judgingDistance=u/s.length)}}const Um=(t,e)=>{const n=t.getAllNodes();if(!(null==n?void 0:n.length))return{};const r={};return n.forEach(((n,i)=>{1===t.getDegree(n.id,"both")&&(r[n.id]=Hm(t,"leaf",n,e))})),r},Hm=(t,e,n,r)=>{const i=t.getDegree(n.id,"in"),o=t.getDegree(n.id,"out");let a=n,s=[];0===i?(a=t.getSuccessors(n.id)[0],s=t.getNeighbors(a.id)):0===o&&(a=t.getPredecessors(n.id)[0],s=t.getNeighbors(a.id)),s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")));return{coreNode:a,siblingLeaves:s,sameTypeLeaves:qm(t,e,r,n,s)}},qm=(t,e,n,r,i)=>{const o=r.data[n]||"";let a=(null==i?void 0:i.filter((t=>t.data[n]===o)))||[];return"leaf"===e&&(a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),a},$m=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:n,y:r}=t.data;e.x+=n||0,e.y+=r||0}));const n=t.length||1;return{x:e.x/n,y:e.y/n}},Ym=(t,e)=>e.map((e=>{const{id:n,data:r}=e,i=t.getNode(n);return Object.assign(Object.assign({},i),{data:Object.assign(Object.assign({},i.data),{x:r.x,y:r.y,z:r.z})})}));var Km={};const Xm=Object.prototype.toString;function Zm(t){const e=Xm.call(t);return e.endsWith("Array]")&&!e.includes("Big")}var Qm=p(Object.freeze({__proto__:null,isAnyArray:Zm}));var Jm=Object.freeze({__proto__:null,default:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Zm(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!Zm(n.output))throw new TypeError("output option must be an array if specified");e=n.output}else e=new Array(t.length);var r=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Zm(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],s=r+1;s<o;s++)t[s]<a&&(a=t[s]);return a}(t),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Zm(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],s=r+1;s<o;s++)t[s]>a&&(a=t[s]);return a}(t);if(r===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=n.min,a=void 0===o?n.autoMinMax?r:0:o,s=n.max,u=void 0===s?n.autoMinMax?i:1:s;if(a>=u)throw new RangeError("min option must be smaller than max option");for(var c=(u-a)/(i-r),l=0;l<t.length;l++)e[l]=(t[l]-r)*c+a;return e}}),tv=p(Jm);Object.defineProperty(Km,"__esModule",{value:!0});var ev=Qm,nv=tv;const rv=" ".repeat(2),iv=" ".repeat(4);function ov(t,e={}){const{maxRows:n=15,maxColumns:r=10,maxNumSize:i=8,padMinus:o="auto"}=e;return`${t.constructor.name} {\n${rv}[\n${iv}${function(t,e,n,r,i){const{rows:o,columns:a}=t,s=Math.min(o,e),u=Math.min(a,n),c=[];if("auto"===i){i=!1;t:for(let e=0;e<s;e++)for(let n=0;n<u;n++)if(t.get(e,n)<0){i=!0;break t}}for(let e=0;e<s;e++){let n=[];for(let o=0;o<u;o++)n.push(av(t.get(e,o),r,i));c.push(`${n.join(" ")}`)}u!==a&&(c[c.length-1]+=` ... ${a-n} more columns`);s!==o&&c.push(`... ${o-e} more rows`);return c.join(`\n${iv}`)}(t,n,r,i,o)}\n${rv}]\n${rv}rows: ${t.rows}\n${rv}columns: ${t.columns}\n}`}function av(t,e,n){return(t>=0&&n?` ${sv(t,e-1)}`:sv(t,e)).padEnd(e)}function sv(t,e){let n=t.toString();if(n.length<=e)return n;let r=t.toFixed(e);if(r.length>e&&(r=t.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let i=t.toExponential(e);return i.length>e&&(i=t.toExponential(Math.max(0,e-(i.length-e)))),i.slice(0)}function uv(t,e,n){let r=n?t.rows:t.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function cv(t,e,n){let r=n?t.columns:t.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function lv(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function hv(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function dv(t,e){if(!ev.isAnyArray(e))throw new TypeError("row indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.rows)throw new RangeError("row indices are out of range")}function fv(t,e){if(!ev.isAnyArray(e))throw new TypeError("column indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.columns)throw new RangeError("column indices are out of range")}function pv(t,e,n,r,i){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(mv("startRow",e),mv("endRow",n),mv("startColumn",r),mv("endColumn",i),e>n||r>i||e<0||e>=t.rows||n<0||n>=t.rows||r<0||r>=t.columns||i<0||i>=t.columns)throw new RangeError("Submatrix indices are out of range")}function gv(t,e=0){let n=[];for(let r=0;r<t;r++)n.push(e);return n}function mv(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function vv(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class yv{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let r=new Ev(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)r.set(i,t,n[i*e+t]);return r}static rowVector(t){let e=new Ev(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new Ev(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new Ev(t,e)}static ones(t,e){return new Ev(t,e).fill(1)}static rand(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:r=Math.random}=n;let i=new Ev(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.set(n,t,r());return i}static randInt(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:r=0,max:i=1e3,random:o=Math.random}=n;if(!Number.isInteger(r))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(r>=i)throw new RangeError("min must be smaller than max");let a=i-r,s=new Ev(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++){let e=r+Math.round(o()*a);s.set(n,t,e)}return s}static eye(t,e,n){void 0===e&&(e=t),void 0===n&&(n=1);let r=Math.min(t,e),i=this.zeros(t,e);for(let t=0;t<r;t++)i.set(t,t,n);return i}static diag(t,e,n){let r=t.length;void 0===e&&(e=r),void 0===n&&(n=e);let i=Math.min(r,e,n),o=this.zeros(e,n);for(let e=0;e<i;e++)o.set(e,e,t[e]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new Ev(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.min(t.get(o,n),e.get(o,n)));return i}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new this(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.max(t.get(o,n),e.get(o,n)));return i}static checkMatrix(t){return yv.isMatrix(t)?t:new Ev(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);t++}return r}isReducedEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);for(let n=e+1;n<this.rows;n++)0!==this.get(t,n)&&(r=!1);t++}return r}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let r=e;for(let i=e;i<t.rows;i++)t.get(i,n)>t.get(r,n)&&(r=i);if(0===t.get(r,n))n++;else{t.swapRows(e,r);let i=t.get(e,n);for(let r=n;r<t.columns;r++)t.set(e,r,t.get(e,r)/i);for(let r=e+1;r<t.rows;r++){let i=t.get(r,n)/t.get(e,n);t.set(r,n,0);for(let o=n+1;o<t.columns;o++)t.set(r,o,t.get(r,o)-t.get(e,o)*i)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,r=n-1;for(;r>=0;)if(0===t.maxRow(r))r--;else{let i=0,o=!1;for(;i<n&&!1===o;)1===t.get(r,i)?o=!0:i++;for(let n=0;n<r;n++){let o=t.get(n,i);for(let a=i;a<e;a++){let e=t.get(n,a)-o*t.get(r,a);t.set(n,a,e)}}r--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let r=new Ev(this.rows*e,this.columns*n);for(let t=0;t<e;t++)for(let e=0;e<n;e++)r.setSubMatrix(this,this.rows*t,this.columns*e);return r}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){uv(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return Ev.rowVector(this.getRow(t))}setRow(t,e){uv(this,t),e=lv(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){uv(this,t),uv(this,e);for(let n=0;n<this.columns;n++){let r=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,r)}return this}getColumn(t){cv(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return Ev.columnVector(this.getColumn(t))}setColumn(t,e){cv(this,t),e=hv(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){cv(this,t),cv(this,e);for(let n=0;n<this.rows;n++){let r=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,r)}return this}addRowVector(t){t=lv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=lv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=lv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=lv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=hv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=hv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=hv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=hv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){uv(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){cv(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){vv(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)>t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){vv(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)<t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}maxRow(t){if(uv(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){uv(this,t),vv(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r),n[1]=r);return n}minRow(t){if(uv(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){uv(this,t),vv(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r),n[1]=r);return n}maxColumn(t){if(cv(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){cv(this,t),vv(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t),n[0]=r);return n}minColumn(t){if(cv(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){cv(this,t),vv(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t),n[0]=r);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){yv.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}mmul(t){t=Ev.checkMatrix(t);let e=this.rows,n=this.columns,r=t.columns,i=new Ev(e,r),o=new Float64Array(n);for(let a=0;a<r;a++){for(let e=0;e<n;e++)o[e]=t.get(e,a);for(let t=0;t<e;t++){let e=0;for(let r=0;r<n;r++)e+=this.get(t,r)*o[r];i.set(t,a,e)}}return i}strassen2x2(t){t=Ev.checkMatrix(t);let e=new Ev(2,2);const n=this.get(0,0),r=t.get(0,0),i=this.get(0,1),o=t.get(0,1),a=this.get(1,0),s=t.get(1,0),u=this.get(1,1),c=t.get(1,1),l=(n+u)*(r+c),h=(a+u)*r,d=n*(o-c),f=u*(s-r),p=(n+i)*c,g=l+f-p+(i-u)*(s+c),m=d+p,v=h+f,y=l-h+d+(a-n)*(r+o);return e.set(0,0,g),e.set(0,1,m),e.set(1,0,v),e.set(1,1,y),e}strassen3x3(t){t=Ev.checkMatrix(t);let e=new Ev(3,3);const n=this.get(0,0),r=this.get(0,1),i=this.get(0,2),o=this.get(1,0),a=this.get(1,1),s=this.get(1,2),u=this.get(2,0),c=this.get(2,1),l=this.get(2,2),h=t.get(0,0),d=t.get(0,1),f=t.get(0,2),p=t.get(1,0),g=t.get(1,1),m=t.get(1,2),v=t.get(2,0),y=t.get(2,1),b=t.get(2,2),E=(n-o)*(-d+g),w=(-n+o+a)*(h-d+g),x=(o+a)*(-h+d),M=n*h,N=(-n+u+c)*(h-f+m),S=(-n+u)*(f-m),C=(u+c)*(-h+f),k=(-i+c+l)*(g+v-y),T=(i-l)*(g-y),P=i*v,A=(c+l)*(-v+y),O=(-i+a+s)*(m+v-b),_=(i-s)*(m-b),R=(a+s)*(-v+b),L=M+P+r*p,D=(n+r+i-o-a-c-l)*g+w+x+M+k+P+A,I=M+N+C+(n+r+i-a-s-u-c)*m+P+O+R,j=E+a*(-h+d+p-g-m-v+b)+w+M+P+O+_,z=E+w+x+M+s*y,B=P+O+_+R+o*f,F=M+N+S+c*(-h+f+p-g-m-v+y)+k+T+P,G=k+T+P+A+u*d,V=M+N+S+C+l*b;return e.set(0,0,L),e.set(0,1,D),e.set(0,2,I),e.set(1,0,j),e.set(1,1,z),e.set(1,2,B),e.set(2,0,F),e.set(2,1,G),e.set(2,2,V),e}mmulStrassen(t){t=Ev.checkMatrix(t);let e=this.clone(),n=e.rows,r=e.columns,i=t.rows,o=t.columns;function a(t,e,n){let r=t.rows,i=t.columns;if(r===e&&i===n)return t;{let r=yv.zeros(e,n);return r=r.setSubMatrix(t,0,0),r}}r!==i&&console.warn(`Multiplying ${n} x ${r} and ${i} x ${o} matrix: dimensions do not match.`);let s=Math.max(n,i),u=Math.max(r,o);return e=a(e,s,u),function t(e,n,r,i){if(r<=512||i<=512)return e.mmul(n);r%2==1&&i%2==1?(e=a(e,r+1,i+1),n=a(n,r+1,i+1)):r%2==1?(e=a(e,r+1,i),n=a(n,r+1,i)):i%2==1&&(e=a(e,r,i+1),n=a(n,r,i+1));let o=parseInt(e.rows/2,10),s=parseInt(e.columns/2,10),u=e.subMatrix(0,o-1,0,s-1),c=n.subMatrix(0,o-1,0,s-1),l=e.subMatrix(0,o-1,s,e.columns-1),h=n.subMatrix(0,o-1,s,n.columns-1),d=e.subMatrix(o,e.rows-1,0,s-1),f=n.subMatrix(o,n.rows-1,0,s-1),p=e.subMatrix(o,e.rows-1,s,e.columns-1),g=n.subMatrix(o,n.rows-1,s,n.columns-1),m=t(yv.add(u,p),yv.add(c,g),o,s),v=t(yv.add(d,p),c,o,s),y=t(u,yv.sub(h,g),o,s),b=t(p,yv.sub(f,c),o,s),E=t(yv.add(u,l),g,o,s),w=t(yv.sub(d,u),yv.add(c,h),o,s),x=t(yv.sub(l,p),yv.add(f,g),o,s),M=yv.add(m,b);M.sub(E),M.add(x);let N=yv.add(y,E),S=yv.add(v,b),C=yv.sub(m,v);C.add(y),C.add(w);let k=yv.zeros(2*M.rows,2*M.columns);return k=k.setSubMatrix(M,0,0),k=k.setSubMatrix(N,M.rows,0),k=k.setSubMatrix(S,0,M.columns),k=k.setSubMatrix(C,M.rows,M.columns),k.subMatrix(0,r-1,0,i-1)}(e,t=a(t,s,u),s,u)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Ev(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&nv(i,{min:e,max:n,output:i}),r.setRow(t,i)}return r}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Ev(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&nv(i,{min:e,max:n,output:i}),r.setColumn(t,i)}return r}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let t=this.get(e,n),r=this.get(e,this.columns-1-n);this.set(e,n,r),this.set(e,this.columns-1-n,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let t=this.get(n,e),r=this.get(this.rows-1-n,e);this.set(n,e,r),this.set(this.rows-1-n,e,t)}return this}kroneckerProduct(t){t=Ev.checkMatrix(t);let e=this.rows,n=this.columns,r=t.rows,i=t.columns,o=new Ev(e*r,n*i);for(let a=0;a<e;a++)for(let e=0;e<n;e++)for(let n=0;n<r;n++)for(let s=0;s<i;s++)o.set(r*a+n,i*e+s,this.get(a,e)*t.get(n,s));return o}kroneckerSum(t){if(t=Ev.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,r=this.kroneckerProduct(Ev.eye(n,n)),i=Ev.eye(e,e).kroneckerProduct(t);return r.add(i)}transpose(){let t=new Ev(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=bv){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=bv){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,r){pv(this,t,e,n,r);let i=new Ev(e-t+1,r-n+1);for(let o=t;o<=e;o++)for(let e=n;e<=r;e++)i.set(o-t,e-n,this.get(o,e));return i}subMatrixRow(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let r=new Ev(t.length,n-e+1);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.rows)throw new RangeError(`Row index out of range: ${t[i]}`);r.set(i,o-e,this.get(t[i],o))}return r}subMatrixColumn(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let r=new Ev(n-e+1,t.length);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.columns)throw new RangeError(`Column index out of range: ${t[i]}`);r.set(o-e,i,this.get(o,t[i]))}return r}setSubMatrix(t,e,n){if((t=Ev.checkMatrix(t)).isEmpty())return this;pv(this,e,e+t.rows-1,n,n+t.columns-1);for(let r=0;r<t.rows;r++)for(let i=0;i<t.columns;i++)this.set(e+r,n+i,t.get(r,i));return this}selection(t,e){dv(this,t),fv(this,e);let n=new Ev(t.length,e.length);for(let r=0;r<t.length;r++){let i=t[r];for(let t=0;t<e.length;t++){let o=e[t];n.set(r,t,this.get(i,o))}}return n}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){return this.constructor.copy(this,new Ev(this.rows,this.columns))}static copy(t,e){for(const[n,r,i]of t.entries())e.set(n,r,i);return e}sum(t){switch(t){case"row":return function(t){let e=gv(t.rows);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]+=t.get(n,r);return e}(this);case"column":return function(t){let e=gv(t.columns);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]+=t.get(n,r);return e}(this);case void 0:return function(t){let e=0;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e+=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=gv(t.rows,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]*=t.get(n,r);return e}(this);case"column":return function(t){let e=gv(t.columns,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]*=t.get(n,r);return e}(this);case void 0:return function(t){let e=1;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e*=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:r=this.mean(t)}=e;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!ev.isAnyArray(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<r;a++){let r=0,s=0,u=0;for(let e=0;e<i;e++)u=t.get(a,e)-n[a],r+=u,s+=u*u;e?o.push((s-r*r/i)/(i-1)):o.push((s-r*r/i)/i)}return o}(this,n,r);case"column":if(!ev.isAnyArray(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<i;a++){let i=0,s=0,u=0;for(let e=0;e<r;e++)u=t.get(e,a)-n[a],i+=u,s+=u*u;e?o.push((s-i*i/r)/(r-1)):o.push((s-i*i/r)/r)}return o}(this,n,r);case void 0:if("number"!=typeof r)throw new TypeError("mean must be a number");return function(t,e,n){const r=t.rows,i=t.columns,o=r*i;let a=0,s=0,u=0;for(let e=0;e<r;e++)for(let r=0;r<i;r++)u=t.get(e,r)-n,a+=u,s+=u*u;return e?(s-a*a/o)/(o-1):(s-a*a/o)/o}(this,n,r);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const n=this.variance(t,e);if(void 0===t)return Math.sqrt(n);for(let t=0;t<n.length;t++)n[t]=Math.sqrt(n[t]);return n}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":if(!ev.isAnyArray(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[n])}(this,n),this;case"column":if(!ev.isAnyArray(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[r])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.rows;n++){let r=0;for(let e=0;e<t.columns;e++)r+=Math.pow(t.get(n,e),2)/(t.columns-1);e.push(Math.sqrt(r))}return e}(this);else if(!ev.isAnyArray(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[n])}(this,n),this;case"column":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.columns;n++){let r=0;for(let e=0;e<t.rows;e++)r+=Math.pow(t.get(e,n),2)/(t.rows-1);e.push(Math.sqrt(r))}return e}(this);else if(!ev.isAnyArray(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[r])}(this,n),this;case void 0:if(void 0===n)n=function(t){const e=t.size-1;let n=0;for(let r=0;r<t.columns;r++)for(let i=0;i<t.rows;i++)n+=Math.pow(t.get(i,r),2)/e;return Math.sqrt(n)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return ov(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function bv(t,e){return t-e}yv.prototype.klass="Matrix","undefined"!=typeof Symbol&&(yv.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return ov(this)}),yv.random=yv.rand,yv.randomInt=yv.randInt,yv.diagonal=yv.diag,yv.prototype.diagonal=yv.prototype.diag,yv.identity=yv.eye,yv.prototype.negate=yv.prototype.neg,yv.prototype.tensorProduct=yv.prototype.kroneckerProduct;let Ev=class t extends yv{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<t;n++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(e,n){if(super(),t.isMatrix(e))this.#t(e.rows,e.columns),t.copy(e,this);else if(Number.isInteger(e)&&e>=0)this.#t(e,n);else{if(!ev.isAnyArray(e))throw new TypeError("First argument must be a positive number or an array");{const t=e;if("number"!=typeof(n=(e=t.length)?t[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let r=0;r<e;r++){if(t[r].length!==n)throw new RangeError("Inconsistent array dimensions");if(!t[r].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(t[r]))}this.rows=e,this.columns=n}}}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}removeRow(t){return uv(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),uv(this,t,!0),e=Float64Array.from(lv(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){cv(this,t);for(let e=0;e<this.rows;e++){const n=new Float64Array(this.columns-1);for(let r=0;r<t;r++)n[r]=this.data[e][r];for(let r=t+1;r<this.columns;r++)n[r-1]=this.data[e][r];this.data[e]=n}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),cv(this,t,!0),e=hv(this,e);for(let n=0;n<this.rows;n++){const r=new Float64Array(this.columns+1);let i=0;for(;i<t;i++)r[i]=this.data[n][i];for(r[i++]=e[n];i<this.columns+1;i++)r[i]=this.data[n][i-1];this.data[n]=r}return this.columns+=1,this}};!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t.get(e,n));return this},t.add=function(t,n){return new e(t).add(n)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t.get(e,n));return this},t.sub=function(t,n){return new e(t).sub(n)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t.get(e,n));return this},t.mul=function(t,n){return new e(t).mul(n)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t.get(e,n));return this},t.div=function(t,n){return new e(t).div(n)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t.get(e,n));return this},t.mod=function(t,n){return new e(t).mod(n)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t.get(e,n));return this},t.and=function(t,n){return new e(t).and(n)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t.get(e,n));return this},t.or=function(t,n){return new e(t).or(n)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t.get(e,n));return this},t.xor=function(t,n){return new e(t).xor(n)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t.get(e,n));return this},t.leftShift=function(t,n){return new e(t).leftShift(n)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t.get(e,n));return this},t.signPropagatingRightShift=function(t,n){return new e(t).signPropagatingRightShift(n)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t.get(e,n));return this},t.rightShift=function(t,n){return new e(t).rightShift(n)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,n){return new e(t).pow(n)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t.get(e,n)));return this}}(yv,Ev);class wv extends yv{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return Ev.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),Ev.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=Ev.copy(t,new Ev(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new Ev(t,t);else if(this.#e=new Ev(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new wv(this.diagonalSize);for(const[e,n,r]of this.upperRightEntries())t.set(e,n,r);return t}toMatrix(){return new Ev(this)}get(t,e){return this.#e.get(t,e)}set(t,e,n){return this.#e.set(t,e,n),this.#e.set(e,t,n),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const n=e.slice();return n.splice(t,1),this.#e.addRow(t,n),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[n,r]of t.entries())r||e.push(n);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let n=0,r=0,i=0;i<e.length;i++)e[i]=this.get(r,n),++n>=t&&(n=++r);return e}static fromCompact(t){const e=t.length,n=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const r=new wv(n);for(let i=0,o=0,a=0;a<e;a++)r.set(i,o,t[a]),++i>=n&&(i=++o);return r}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const n=this.get(t,e);yield[t,e,n],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const n=this.get(t,e);yield n,++e>=this.diagonalSize&&(e=++t)}}}wv.prototype.klassType="SymmetricMatrix";class xv extends wv{static isDistanceMatrix(t){return wv.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,n){return t===e&&(n=0),super.set(t,e,n)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new wv(this)}clone(){const t=new xv(this.diagonalSize);for(const[e,n,r]of this.upperRightEntries())e!==n&&t.set(e,n,r);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let n=1,r=0,i=0;i<e.length;i++)e[i]=this.get(r,n),++n>=t&&(n=1+ ++r);return e}static fromCompact(t){const e=t.length,n=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const r=new this(n);for(let i=1,o=0,a=0;a<e;a++)r.set(i,o,t[a]),++i>=n&&(i=1+ ++o);return r}}xv.prototype.klassSubType="DistanceMatrix";class Mv extends yv{constructor(t,e,n){super(),this.matrix=t,this.rows=e,this.columns=n}}class Nv extends Mv{constructor(t,e,n){dv(t,e),fv(t,n),super(t,e.length,n.length),this.rowIndices=e,this.columnIndices=n}set(t,e,n){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],n),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class Sv extends yv{constructor(t,e={}){const{rows:n=1}=e;if(t.length%n!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=t.length/n,this.data=t}set(t,e,n){let r=this._calculateIndex(t,e);return this.data[r]=n,this}get(t,e){let n=this._calculateIndex(t,e);return this.data[n]}_calculateIndex(t,e){return t*this.columns+e}}class Cv extends yv{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}class kv{constructor(t){let e,n,r,i,o,a,s,u,c,l=(t=Cv.checkMatrix(t)).clone(),h=l.rows,d=l.columns,f=new Float64Array(h),p=1;for(e=0;e<h;e++)f[e]=e;for(u=new Float64Array(h),n=0;n<d;n++){for(e=0;e<h;e++)u[e]=l.get(e,n);for(e=0;e<h;e++){for(c=Math.min(e,n),o=0,r=0;r<c;r++)o+=l.get(e,r)*u[r];u[e]-=o,l.set(e,n,u[e])}for(i=n,e=n+1;e<h;e++)Math.abs(u[e])>Math.abs(u[i])&&(i=e);if(i!==n){for(r=0;r<d;r++)a=l.get(i,r),l.set(i,r,l.get(n,r)),l.set(n,r,a);s=f[i],f[i]=f[n],f[n]=s,p=-p}if(n<h&&0!==l.get(n,n))for(e=n+1;e<h;e++)l.set(e,n,l.get(e,n)/l.get(n,n))}this.LU=l,this.pivotVector=f,this.pivotSign=p}isSingular(){let t=this.LU,e=t.columns;for(let n=0;n<e;n++)if(0===t.get(n,n))return!0;return!1}solve(t){t=Ev.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n,r,i,o=t.columns,a=t.subMatrixRow(this.pivotVector,0,o-1),s=e.columns;for(i=0;i<s;i++)for(n=i+1;n<s;n++)for(r=0;r<o;r++)a.set(n,r,a.get(n,r)-a.get(i,r)*e.get(n,i));for(i=s-1;i>=0;i--){for(r=0;r<o;r++)a.set(i,r,a.get(i,r)/e.get(i,i));for(n=0;n<i;n++)for(r=0;r<o;r++)a.set(n,r,a.get(n,r)-a.get(i,r)*e.get(n,i))}return a}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,n=t.columns;for(let r=0;r<n;r++)e*=t.get(r,r);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,r=new Ev(e,n);for(let i=0;i<e;i++)for(let e=0;e<n;e++)i>e?r.set(i,e,t.get(i,e)):i===e?r.set(i,e,1):r.set(i,e,0);return r}get upperTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,r=new Ev(e,n);for(let i=0;i<e;i++)for(let e=0;e<n;e++)i<=e?r.set(i,e,t.get(i,e)):r.set(i,e,0);return r}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Tv(t,e){let n=0;return Math.abs(t)>Math.abs(e)?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0!==e?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0}class Pv{constructor(t){let e,n,r,i,o=(t=Cv.checkMatrix(t)).clone(),a=t.rows,s=t.columns,u=new Float64Array(s);for(r=0;r<s;r++){let t=0;for(e=r;e<a;e++)t=Tv(t,o.get(e,r));if(0!==t){for(o.get(r,r)<0&&(t=-t),e=r;e<a;e++)o.set(e,r,o.get(e,r)/t);for(o.set(r,r,o.get(r,r)+1),n=r+1;n<s;n++){for(i=0,e=r;e<a;e++)i+=o.get(e,r)*o.get(e,n);for(i=-i/o.get(r,r),e=r;e<a;e++)o.set(e,n,o.get(e,n)+i*o.get(e,r))}}u[r]=-t}this.QR=o,this.Rdiag=u}solve(t){t=Ev.checkMatrix(t);let e=this.QR,n=e.rows;if(t.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let r,i,o,a,s=t.columns,u=t.clone(),c=e.columns;for(o=0;o<c;o++)for(i=0;i<s;i++){for(a=0,r=o;r<n;r++)a+=e.get(r,o)*u.get(r,i);for(a=-a/e.get(o,o),r=o;r<n;r++)u.set(r,i,u.get(r,i)+a*e.get(r,o))}for(o=c-1;o>=0;o--){for(i=0;i<s;i++)u.set(o,i,u.get(o,i)/this.Rdiag[o]);for(r=0;r<o;r++)for(i=0;i<s;i++)u.set(r,i,u.get(r,i)-u.get(o,i)*e.get(r,o))}return u.subMatrix(0,c-1,0,s-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,n=this.QR,r=n.columns,i=new Ev(r,r);for(t=0;t<r;t++)for(e=0;e<r;e++)t<e?i.set(t,e,n.get(t,e)):t===e?i.set(t,e,this.Rdiag[t]):i.set(t,e,0);return i}get orthogonalMatrix(){let t,e,n,r,i=this.QR,o=i.rows,a=i.columns,s=new Ev(o,a);for(n=a-1;n>=0;n--){for(t=0;t<o;t++)s.set(t,n,0);for(s.set(n,n,1),e=n;e<a;e++)if(0!==i.get(n,n)){for(r=0,t=n;t<o;t++)r+=i.get(t,n)*s.get(t,e);for(r=-r/i.get(n,n),t=n;t<o;t++)s.set(t,e,s.get(t,e)+r*i.get(t,n))}}return s}}let Av=class{constructor(t,e={}){if((t=Cv.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,r=t.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:o=!0,autoTranspose:a=!1}=e;let s,u=Boolean(i),c=Boolean(o),l=!1;if(n<r)if(a){s=t.transpose(),n=s.rows,r=s.columns,l=!0;let e=u;u=c,c=e}else s=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else s=t.clone();let h=Math.min(n,r),d=Math.min(n+1,r),f=new Float64Array(d),p=new Ev(n,h),g=new Ev(r,r),m=new Float64Array(r),v=new Float64Array(n),y=new Float64Array(d);for(let t=0;t<d;t++)y[t]=t;let b=Math.min(n-1,r),E=Math.max(0,Math.min(r-2,n)),w=Math.max(b,E);for(let t=0;t<w;t++){if(t<b){f[t]=0;for(let e=t;e<n;e++)f[t]=Tv(f[t],s.get(e,t));if(0!==f[t]){s.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<n;e++)s.set(e,t,s.get(e,t)/f[t]);s.set(t,t,s.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<r;e++){if(t<b&&0!==f[t]){let r=0;for(let i=t;i<n;i++)r+=s.get(i,t)*s.get(i,e);r=-r/s.get(t,t);for(let i=t;i<n;i++)s.set(i,e,s.get(i,e)+r*s.get(i,t))}m[e]=s.get(t,e)}if(u&&t<b)for(let e=t;e<n;e++)p.set(e,t,s.get(e,t));if(t<E){m[t]=0;for(let e=t+1;e<r;e++)m[t]=Tv(m[t],m[e]);if(0!==m[t]){m[t+1]<0&&(m[t]=0-m[t]);for(let e=t+1;e<r;e++)m[e]/=m[t];m[t+1]+=1}if(m[t]=-m[t],t+1<n&&0!==m[t]){for(let e=t+1;e<n;e++)v[e]=0;for(let e=t+1;e<n;e++)for(let n=t+1;n<r;n++)v[e]+=m[n]*s.get(e,n);for(let e=t+1;e<r;e++){let r=-m[e]/m[t+1];for(let i=t+1;i<n;i++)s.set(i,e,s.get(i,e)+r*v[i])}}if(c)for(let e=t+1;e<r;e++)g.set(e,t,m[e])}}let x=Math.min(r,n+1);if(b<r&&(f[b]=s.get(b,b)),n<x&&(f[x-1]=0),E+1<x&&(m[E]=s.get(E,x-1)),m[x-1]=0,u){for(let t=b;t<h;t++){for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}for(let t=b-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<h;e++){let r=0;for(let i=t;i<n;i++)r+=p.get(i,t)*p.get(i,e);r=-r/p.get(t,t);for(let i=t;i<n;i++)p.set(i,e,p.get(i,e)+r*p.get(i,t))}for(let e=t;e<n;e++)p.set(e,t,-p.get(e,t));p.set(t,t,1+p.get(t,t));for(let e=0;e<t-1;e++)p.set(e,t,0)}else{for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}}if(c)for(let t=r-1;t>=0;t--){if(t<E&&0!==m[t])for(let e=t+1;e<r;e++){let n=0;for(let i=t+1;i<r;i++)n+=g.get(i,t)*g.get(i,e);n=-n/g.get(t+1,t);for(let i=t+1;i<r;i++)g.set(i,e,g.get(i,e)+n*g.get(i,t))}for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}let M=x-1,N=Number.EPSILON;for(;x>0;){let t,e;for(t=x-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+N*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(m[t])<=e||Number.isNaN(m[t])){m[t]=0;break}}if(t===x-2)e=4;else{let n;for(n=x-1;n>=t&&n!==t;n--){let e=(n!==x?Math.abs(m[n]):0)+(n!==t+1?Math.abs(m[n-1]):0);if(Math.abs(f[n])<=N*e){f[n]=0;break}}n===t?e=3:n===x-1?e=1:(e=2,t=n)}switch(t++,e){case 1:{let e=m[x-2];m[x-2]=0;for(let n=x-2;n>=t;n--){let i=Tv(f[n],e),o=f[n]/i,a=e/i;if(f[n]=i,n!==t&&(e=-a*m[n-1],m[n-1]=o*m[n-1]),c)for(let t=0;t<r;t++)i=o*g.get(t,n)+a*g.get(t,x-1),g.set(t,x-1,-a*g.get(t,n)+o*g.get(t,x-1)),g.set(t,n,i)}break}case 2:{let e=m[t-1];m[t-1]=0;for(let r=t;r<x;r++){let i=Tv(f[r],e),o=f[r]/i,a=e/i;if(f[r]=i,e=-a*m[r],m[r]=o*m[r],u)for(let e=0;e<n;e++)i=o*p.get(e,r)+a*p.get(e,t-1),p.set(e,t-1,-a*p.get(e,r)+o*p.get(e,t-1)),p.set(e,r,i)}break}case 3:{const e=Math.max(Math.abs(f[x-1]),Math.abs(f[x-2]),Math.abs(m[x-2]),Math.abs(f[t]),Math.abs(m[t])),i=f[x-1]/e,o=f[x-2]/e,a=m[x-2]/e,s=f[t]/e,l=m[t]/e,h=((o+i)*(o-i)+a*a)/2,d=i*a*(i*a);let v=0;0===h&&0===d||(v=h<0?0-Math.sqrt(h*h+d):Math.sqrt(h*h+d),v=d/(h+v));let y=(s+i)*(s-i)+v,b=s*l;for(let e=t;e<x-1;e++){let i=Tv(y,b);0===i&&(i=Number.MIN_VALUE);let o=y/i,a=b/i;if(e!==t&&(m[e-1]=i),y=o*f[e]+a*m[e],m[e]=o*m[e]-a*f[e],b=a*f[e+1],f[e+1]=o*f[e+1],c)for(let t=0;t<r;t++)i=o*g.get(t,e)+a*g.get(t,e+1),g.set(t,e+1,-a*g.get(t,e)+o*g.get(t,e+1)),g.set(t,e,i);if(i=Tv(y,b),0===i&&(i=Number.MIN_VALUE),o=y/i,a=b/i,f[e]=i,y=o*m[e]+a*f[e+1],f[e+1]=-a*m[e]+o*f[e+1],b=a*m[e+1],m[e+1]=o*m[e+1],u&&e<n-1)for(let t=0;t<n;t++)i=o*p.get(t,e)+a*p.get(t,e+1),p.set(t,e+1,-a*p.get(t,e)+o*p.get(t,e+1)),p.set(t,e,i)}m[x-2]=y;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,c))for(let e=0;e<=M;e++)g.set(e,t,-g.get(e,t));for(;t<M&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,c&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);if(u&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);t++}x--}}if(l){let t=g;g=p,p=t}this.m=n,this.n=r,this.s=f,this.U=p,this.V=g}solve(t){let e=t,n=this.threshold,r=this.s.length,i=Ev.zeros(r,r);for(let t=0;t<r;t++)Math.abs(this.s[t])<=n?i.set(t,t,0):i.set(t,t,1/this.s[t]);let o=this.U,a=this.rightSingularVectors,s=a.mmul(i),u=a.rows,c=o.rows,l=Ev.zeros(u,c);for(let t=0;t<u;t++)for(let e=0;e<c;e++){let n=0;for(let i=0;i<r;i++)n+=s.get(t,i)*o.get(e,i);l.set(t,e,n)}return l.mmul(e)}solveForDiagonal(t){return this.solve(Ev.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,r=t.columns,i=new Ev(n,this.s.length);for(let o=0;o<n;o++)for(let n=0;n<r;n++)Math.abs(this.s[n])>e&&i.set(o,n,t.get(o,n)/this.s[n]);let o=this.U,a=o.rows,s=o.columns,u=new Ev(n,a);for(let t=0;t<n;t++)for(let e=0;e<a;e++){let n=0;for(let r=0;r<s;r++)n+=i.get(t,r)*o.get(e,r);u.set(t,e,n)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let r=0,i=n.length;r<i;r++)n[r]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return Ev.diag(this.s)}};function Ov(t,e,n=!1){return t=Cv.checkMatrix(t),e=Cv.checkMatrix(e),n?new Av(t).solve(e):t.isSquare()?new kv(t).solve(e):new Pv(t).solve(e)}function _v(t,e){let n=[];for(let r=0;r<t;r++)r!==e&&n.push(r);return n}function Rv(t,e,n,r=1e-9,i=1e-9){if(t>i)return new Array(e.rows+1).fill(0);{let t=e.addRow(n,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<r&&t.set(e,0,0);return t.to1DArray()}}class Lv{constructor(t,e={}){const{assumeSymmetric:n=!1}=e;if(!(t=Cv.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let r,i,o=t.columns,a=new Ev(o,o),s=new Float64Array(o),u=new Float64Array(o),c=t,l=!1;if(l=!!n||t.isSymmetric(),l){for(r=0;r<o;r++)for(i=0;i<o;i++)a.set(r,i,c.get(r,i));!function(t,e,n,r){let i,o,a,s,u,c,l,h;for(u=0;u<t;u++)n[u]=r.get(t-1,u);for(s=t-1;s>0;s--){for(h=0,a=0,c=0;c<s;c++)h+=Math.abs(n[c]);if(0===h)for(e[s]=n[s-1],u=0;u<s;u++)n[u]=r.get(s-1,u),r.set(s,u,0),r.set(u,s,0);else{for(c=0;c<s;c++)n[c]/=h,a+=n[c]*n[c];for(i=n[s-1],o=Math.sqrt(a),i>0&&(o=-o),e[s]=h*o,a-=i*o,n[s-1]=i-o,u=0;u<s;u++)e[u]=0;for(u=0;u<s;u++){for(i=n[u],r.set(u,s,i),o=e[u]+r.get(u,u)*i,c=u+1;c<=s-1;c++)o+=r.get(c,u)*n[c],e[c]+=r.get(c,u)*i;e[u]=o}for(i=0,u=0;u<s;u++)e[u]/=a,i+=e[u]*n[u];for(l=i/(a+a),u=0;u<s;u++)e[u]-=l*n[u];for(u=0;u<s;u++){for(i=n[u],o=e[u],c=u;c<=s-1;c++)r.set(c,u,r.get(c,u)-(i*e[c]+o*n[c]));n[u]=r.get(s-1,u),r.set(s,u,0)}}n[s]=a}for(s=0;s<t-1;s++){if(r.set(t-1,s,r.get(s,s)),r.set(s,s,1),a=n[s+1],0!==a){for(c=0;c<=s;c++)n[c]=r.get(c,s+1)/a;for(u=0;u<=s;u++){for(o=0,c=0;c<=s;c++)o+=r.get(c,s+1)*r.get(c,u);for(c=0;c<=s;c++)r.set(c,u,r.get(c,u)-o*n[c])}}for(c=0;c<=s;c++)r.set(c,s+1,0)}for(u=0;u<t;u++)n[u]=r.get(t-1,u),r.set(t-1,u,0);r.set(t-1,t-1,1),e[0]=0}(o,u,s,a),function(t,e,n,r){let i,o,a,s,u,c,l,h,d,f,p,g,m,v,y,b;for(a=1;a<t;a++)e[a-1]=e[a];e[t-1]=0;let E=0,w=0,x=Number.EPSILON;for(c=0;c<t;c++){for(w=Math.max(w,Math.abs(n[c])+Math.abs(e[c])),l=c;l<t&&!(Math.abs(e[l])<=x*w);)l++;if(l>c)do{for(i=n[c],h=(n[c+1]-i)/(2*e[c]),d=Tv(h,1),h<0&&(d=-d),n[c]=e[c]/(h+d),n[c+1]=e[c]*(h+d),f=n[c+1],o=i-n[c],a=c+2;a<t;a++)n[a]-=o;for(E+=o,h=n[l],p=1,g=p,m=p,v=e[c+1],y=0,b=0,a=l-1;a>=c;a--)for(m=g,g=p,b=y,i=p*e[a],o=p*h,d=Tv(h,e[a]),e[a+1]=y*d,y=e[a]/d,p=h/d,h=p*n[a]-y*i,n[a+1]=o+y*(p*i+y*n[a]),u=0;u<t;u++)o=r.get(u,a+1),r.set(u,a+1,y*r.get(u,a)+p*o),r.set(u,a,p*r.get(u,a)-y*o);h=-y*b*m*v*e[c]/f,e[c]=y*h,n[c]=p*h}while(Math.abs(e[c])>x*w);n[c]=n[c]+E,e[c]=0}for(a=0;a<t-1;a++){for(u=a,h=n[a],s=a+1;s<t;s++)n[s]<h&&(u=s,h=n[s]);if(u!==a)for(n[u]=n[a],n[a]=h,s=0;s<t;s++)h=r.get(s,a),r.set(s,a,r.get(s,u)),r.set(s,u,h)}}(o,u,s,a)}else{let t=new Ev(o,o),e=new Float64Array(o);for(i=0;i<o;i++)for(r=0;r<o;r++)t.set(r,i,c.get(r,i));!function(t,e,n,r){let i,o,a,s,u,c,l,h=0,d=t-1;for(c=h+1;c<=d-1;c++){for(l=0,s=c;s<=d;s++)l+=Math.abs(e.get(s,c-1));if(0!==l){for(a=0,s=d;s>=c;s--)n[s]=e.get(s,c-1)/l,a+=n[s]*n[s];for(o=Math.sqrt(a),n[c]>0&&(o=-o),a-=n[c]*o,n[c]=n[c]-o,u=c;u<t;u++){for(i=0,s=d;s>=c;s--)i+=n[s]*e.get(s,u);for(i/=a,s=c;s<=d;s++)e.set(s,u,e.get(s,u)-i*n[s])}for(s=0;s<=d;s++){for(i=0,u=d;u>=c;u--)i+=n[u]*e.get(s,u);for(i/=a,u=c;u<=d;u++)e.set(s,u,e.get(s,u)-i*n[u])}n[c]=l*n[c],e.set(c,c-1,l*o)}}for(s=0;s<t;s++)for(u=0;u<t;u++)r.set(s,u,s===u?1:0);for(c=d-1;c>=h+1;c--)if(0!==e.get(c,c-1)){for(s=c+1;s<=d;s++)n[s]=e.get(s,c-1);for(u=c;u<=d;u++){for(o=0,s=c;s<=d;s++)o+=n[s]*r.get(s,u);for(o=o/n[c]/e.get(c,c-1),s=c;s<=d;s++)r.set(s,u,r.get(s,u)+o*n[s])}}}(o,t,e,a),function(t,e,n,r,i){let o,a,s,u,c,l,h,d,f,p,g,m,v,y,b,E=t-1,w=0,x=t-1,M=Number.EPSILON,N=0,S=0,C=0,k=0,T=0,P=0,A=0,O=0;for(o=0;o<t;o++)for((o<w||o>x)&&(n[o]=i.get(o,o),e[o]=0),a=Math.max(o-1,0);a<t;a++)S+=Math.abs(i.get(o,a));for(;E>=w;){for(u=E;u>w&&(P=Math.abs(i.get(u-1,u-1))+Math.abs(i.get(u,u)),0===P&&(P=S),!(Math.abs(i.get(u,u-1))<M*P));)u--;if(u===E)i.set(E,E,i.get(E,E)+N),n[E]=i.get(E,E),e[E]=0,E--,O=0;else if(u===E-1){if(h=i.get(E,E-1)*i.get(E-1,E),C=(i.get(E-1,E-1)-i.get(E,E))/2,k=C*C+h,A=Math.sqrt(Math.abs(k)),i.set(E,E,i.get(E,E)+N),i.set(E-1,E-1,i.get(E-1,E-1)+N),d=i.get(E,E),k>=0){for(A=C>=0?C+A:C-A,n[E-1]=d+A,n[E]=n[E-1],0!==A&&(n[E]=d-h/A),e[E-1]=0,e[E]=0,d=i.get(E,E-1),P=Math.abs(d)+Math.abs(A),C=d/P,k=A/P,T=Math.sqrt(C*C+k*k),C/=T,k/=T,a=E-1;a<t;a++)A=i.get(E-1,a),i.set(E-1,a,k*A+C*i.get(E,a)),i.set(E,a,k*i.get(E,a)-C*A);for(o=0;o<=E;o++)A=i.get(o,E-1),i.set(o,E-1,k*A+C*i.get(o,E)),i.set(o,E,k*i.get(o,E)-C*A);for(o=w;o<=x;o++)A=r.get(o,E-1),r.set(o,E-1,k*A+C*r.get(o,E)),r.set(o,E,k*r.get(o,E)-C*A)}else n[E-1]=d+C,n[E]=d+C,e[E-1]=A,e[E]=-A;E-=2,O=0}else{if(d=i.get(E,E),f=0,h=0,u<E&&(f=i.get(E-1,E-1),h=i.get(E,E-1)*i.get(E-1,E)),10===O){for(N+=d,o=w;o<=E;o++)i.set(o,o,i.get(o,o)-d);P=Math.abs(i.get(E,E-1))+Math.abs(i.get(E-1,E-2)),d=f=.75*P,h=-.4375*P*P}if(30===O&&(P=(f-d)/2,P=P*P+h,P>0)){for(P=Math.sqrt(P),f<d&&(P=-P),P=d-h/((f-d)/2+P),o=w;o<=E;o++)i.set(o,o,i.get(o,o)-P);N+=P,d=f=h=.964}for(O+=1,c=E-2;c>=u&&(A=i.get(c,c),T=d-A,P=f-A,C=(T*P-h)/i.get(c+1,c)+i.get(c,c+1),k=i.get(c+1,c+1)-A-T-P,T=i.get(c+2,c+1),P=Math.abs(C)+Math.abs(k)+Math.abs(T),C/=P,k/=P,T/=P,c!==u)&&!(Math.abs(i.get(c,c-1))*(Math.abs(k)+Math.abs(T))<M*(Math.abs(C)*(Math.abs(i.get(c-1,c-1))+Math.abs(A)+Math.abs(i.get(c+1,c+1)))));)c--;for(o=c+2;o<=E;o++)i.set(o,o-2,0),o>c+2&&i.set(o,o-3,0);for(s=c;s<=E-1&&(y=s!==E-1,s!==c&&(C=i.get(s,s-1),k=i.get(s+1,s-1),T=y?i.get(s+2,s-1):0,d=Math.abs(C)+Math.abs(k)+Math.abs(T),0!==d&&(C/=d,k/=d,T/=d)),0!==d);s++)if(P=Math.sqrt(C*C+k*k+T*T),C<0&&(P=-P),0!==P){for(s!==c?i.set(s,s-1,-P*d):u!==c&&i.set(s,s-1,-i.get(s,s-1)),C+=P,d=C/P,f=k/P,A=T/P,k/=C,T/=C,a=s;a<t;a++)C=i.get(s,a)+k*i.get(s+1,a),y&&(C+=T*i.get(s+2,a),i.set(s+2,a,i.get(s+2,a)-C*A)),i.set(s,a,i.get(s,a)-C*d),i.set(s+1,a,i.get(s+1,a)-C*f);for(o=0;o<=Math.min(E,s+3);o++)C=d*i.get(o,s)+f*i.get(o,s+1),y&&(C+=A*i.get(o,s+2),i.set(o,s+2,i.get(o,s+2)-C*T)),i.set(o,s,i.get(o,s)-C),i.set(o,s+1,i.get(o,s+1)-C*k);for(o=w;o<=x;o++)C=d*r.get(o,s)+f*r.get(o,s+1),y&&(C+=A*r.get(o,s+2),r.set(o,s+2,r.get(o,s+2)-C*T)),r.set(o,s,r.get(o,s)-C),r.set(o,s+1,r.get(o,s+1)-C*k)}}}if(0===S)return;for(E=t-1;E>=0;E--)if(C=n[E],k=e[E],0===k)for(u=E,i.set(E,E,1),o=E-1;o>=0;o--){for(h=i.get(o,o)-C,T=0,a=u;a<=E;a++)T+=i.get(o,a)*i.get(a,E);if(e[o]<0)A=h,P=T;else if(u=o,0===e[o]?i.set(o,E,0!==h?-T/h:-T/(M*S)):(d=i.get(o,o+1),f=i.get(o+1,o),k=(n[o]-C)*(n[o]-C)+e[o]*e[o],l=(d*P-A*T)/k,i.set(o,E,l),i.set(o+1,E,Math.abs(d)>Math.abs(A)?(-T-h*l)/d:(-P-f*l)/A)),l=Math.abs(i.get(o,E)),M*l*l>1)for(a=o;a<=E;a++)i.set(a,E,i.get(a,E)/l)}else if(k<0)for(u=E-1,Math.abs(i.get(E,E-1))>Math.abs(i.get(E-1,E))?(i.set(E-1,E-1,k/i.get(E,E-1)),i.set(E-1,E,-(i.get(E,E)-C)/i.get(E,E-1))):(b=Dv(0,-i.get(E-1,E),i.get(E-1,E-1)-C,k),i.set(E-1,E-1,b[0]),i.set(E-1,E,b[1])),i.set(E,E-1,0),i.set(E,E,1),o=E-2;o>=0;o--){for(p=0,g=0,a=u;a<=E;a++)p+=i.get(o,a)*i.get(a,E-1),g+=i.get(o,a)*i.get(a,E);if(h=i.get(o,o)-C,e[o]<0)A=h,T=p,P=g;else if(u=o,0===e[o]?(b=Dv(-p,-g,h,k),i.set(o,E-1,b[0]),i.set(o,E,b[1])):(d=i.get(o,o+1),f=i.get(o+1,o),m=(n[o]-C)*(n[o]-C)+e[o]*e[o]-k*k,v=2*(n[o]-C)*k,0===m&&0===v&&(m=M*S*(Math.abs(h)+Math.abs(k)+Math.abs(d)+Math.abs(f)+Math.abs(A))),b=Dv(d*T-A*p+k*g,d*P-A*g-k*p,m,v),i.set(o,E-1,b[0]),i.set(o,E,b[1]),Math.abs(d)>Math.abs(A)+Math.abs(k)?(i.set(o+1,E-1,(-p-h*i.get(o,E-1)+k*i.get(o,E))/d),i.set(o+1,E,(-g-h*i.get(o,E)-k*i.get(o,E-1))/d)):(b=Dv(-T-f*i.get(o,E-1),-P-f*i.get(o,E),A,k),i.set(o+1,E-1,b[0]),i.set(o+1,E,b[1]))),l=Math.max(Math.abs(i.get(o,E-1)),Math.abs(i.get(o,E))),M*l*l>1)for(a=o;a<=E;a++)i.set(a,E-1,i.get(a,E-1)/l),i.set(a,E,i.get(a,E)/l)}for(o=0;o<t;o++)if(o<w||o>x)for(a=o;a<t;a++)r.set(o,a,i.get(o,a));for(a=t-1;a>=w;a--)for(o=w;o<=x;o++){for(A=0,s=w;s<=Math.min(a,x);s++)A+=r.get(o,s)*i.get(s,a);r.set(o,a,A)}}(o,u,s,a,t)}this.n=o,this.e=u,this.d=s,this.V=a}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,n=this.n,r=this.e,i=this.d,o=new Ev(n,n);for(t=0;t<n;t++){for(e=0;e<n;e++)o.set(t,e,0);o.set(t,t,i[t]),r[t]>0?o.set(t,t+1,r[t]):r[t]<0&&o.set(t,t-1,r[t])}return o}}function Dv(t,e,n,r){let i,o;return Math.abs(n)>Math.abs(r)?(i=r/n,o=n+i*r,[(t+i*e)/o,(e-i*t)/o]):(i=n/r,o=r+i*n,[(i*t+e)/o,(i*e-t)/o])}class Iv{constructor(t){if(!(t=Cv.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,n,r,i=t,o=i.rows,a=new Ev(o,o),s=!0;for(n=0;n<o;n++){let t=0;for(r=0;r<n;r++){let o=0;for(e=0;e<r;e++)o+=a.get(r,e)*a.get(n,e);o=(i.get(n,r)-o)/a.get(r,r),a.set(n,r,o),t+=o*o}for(t=i.get(n,n)-t,s&=t>0,a.set(n,n,Math.sqrt(Math.max(t,0))),r=n+1;r<o;r++)a.set(n,r,0)}this.L=a,this.positiveDefinite=Boolean(s)}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=Cv.checkMatrix(t);let e=this.L,n=e.rows;if(t.rows!==n)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let r,i,o,a=t.columns,s=t.clone();for(o=0;o<n;o++)for(i=0;i<a;i++){for(r=0;r<o;r++)s.set(o,i,s.get(o,i)-s.get(r,i)*e.get(o,r));s.set(o,i,s.get(o,i)/e.get(o,o))}for(o=n-1;o>=0;o--)for(i=0;i<a;i++){for(r=o+1;r<n;r++)s.set(o,i,s.get(o,i)-s.get(r,i)*e.get(r,o));s.set(o,i,s.get(o,i)/e.get(o,o))}return s}get lowerTriangularMatrix(){return this.L}}class jv{constructor(t,e={}){t=Cv.checkMatrix(t);let{Y:n}=e;const{scaleScores:r=!1,maxIterations:i=1e3,terminationCriteria:o=1e-10}=e;let a;if(n){if(n=ev.isAnyArray(n)&&"number"==typeof n[0]?Ev.columnVector(n):Cv.checkMatrix(n),n.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=n.getColumnVector(0)}else a=t.getColumnVector(0);let s,u,c,l,h=1;for(let e=0;e<i&&h>o;e++)c=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),c=c.div(c.norm()),s=t.mmul(c).div(c.transpose().mmul(c).get(0,0)),e>0&&(h=s.clone().sub(l).pow(2).sum()),l=s.clone(),n?(u=n.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),u=u.div(u.norm()),a=n.mmul(u).div(u.transpose().mmul(u).get(0,0))):a=s;if(n){let e=t.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0));e=e.div(e.norm());let r=t.clone().sub(s.clone().mmul(e.transpose())),i=a.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),o=n.clone().sub(s.clone().mulS(i.get(0,0)).mmul(u.transpose()));this.t=s,this.p=e.transpose(),this.w=c.transpose(),this.q=u,this.u=a,this.s=s.transpose().mmul(s),this.xResidual=r,this.yResidual=o,this.betas=i}else this.w=c.transpose(),this.s=s.transpose().mmul(s).sqrt(),this.t=r?s.clone().div(this.s.get(0,0)):s,this.xResidual=t.sub(s.mmul(c.transpose()))}}Km.AbstractMatrix=yv,Km.CHO=Iv,Km.CholeskyDecomposition=Iv,Km.DistanceMatrix=xv,Km.EVD=Lv,Km.EigenvalueDecomposition=Lv,Km.LU=kv,Km.LuDecomposition=kv;var zv=Km.Matrix=Ev;Km.MatrixColumnSelectionView=class extends Mv{constructor(t,e){fv(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,n){return this.matrix.set(t,this.columnIndices[e],n),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},Km.MatrixColumnView=class extends Mv{constructor(t,e){cv(t,e),super(t,t.rows,1),this.column=e}set(t,e,n){return this.matrix.set(t,this.column,n),this}get(t){return this.matrix.get(t,this.column)}},Km.MatrixFlipColumnView=class extends Mv{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(t,this.columns-e-1,n),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},Km.MatrixFlipRowView=class extends Mv{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(this.rows-t-1,e,n),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},Km.MatrixRowSelectionView=class extends Mv{constructor(t,e){dv(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,n){return this.matrix.set(this.rowIndices[t],e,n),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},Km.MatrixRowView=class extends Mv{constructor(t,e){uv(t,e),super(t,1,t.columns),this.row=e}set(t,e,n){return this.matrix.set(this.row,e,n),this}get(t,e){return this.matrix.get(this.row,e)}},Km.MatrixSelectionView=Nv,Km.MatrixSubView=class extends Mv{constructor(t,e,n,r,i){pv(t,e,n,r,i),super(t,n-e+1,i-r+1),this.startRow=e,this.startColumn=r}set(t,e,n){return this.matrix.set(this.startRow+t,this.startColumn+e,n),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},Km.MatrixTransposeView=class extends Mv{constructor(t){super(t,t.columns,t.rows)}set(t,e,n){return this.matrix.set(e,t,n),this}get(t,e){return this.matrix.get(e,t)}},Km.NIPALS=jv,Km.Nipals=jv,Km.QR=Pv,Km.QrDecomposition=Pv,Km.SVD=Av;var Bv=Km.SingularValueDecomposition=Av;Km.SymmetricMatrix=wv,Km.WrapperMatrix1D=Sv,Km.WrapperMatrix2D=Cv,Km.correlation=function(t,e=t,n={}){t=new Ev(t);let r=!1;if("object"!=typeof e||Ev.isMatrix(e)||ev.isAnyArray(e)?e=new Ev(e):(n=e,e=t,r=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:o=!0}=n;i&&(t.center("column"),r||e.center("column")),o&&(t.scale("column"),r||e.scale("column"));const a=t.standardDeviation("column",{unbiased:!0}),s=r?a:e.standardDeviation("column",{unbiased:!0}),u=t.transpose().mmul(e);for(let e=0;e<u.rows;e++)for(let n=0;n<u.columns;n++)u.set(e,n,u.get(e,n)*(1/(a[e]*s[n]))*(1/(t.rows-1)));return u},Km.covariance=function(t,e=t,n={}){t=new Ev(t);let r=!1;if("object"!=typeof e||Ev.isMatrix(e)||ev.isAnyArray(e)?e=new Ev(e):(n=e,e=t,r=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=n;i&&(t=t.center("column"),r||(e=e.center("column")));const o=t.transpose().mmul(e);for(let e=0;e<o.rows;e++)for(let n=0;n<o.columns;n++)o.set(e,n,o.get(e,n)*(1/(t.rows-1)));return o};var Fv=Km.default=Ev;Km.determinant=function t(e){if((e=Ev.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let n,r,i,o;if(2===e.columns)return n=e.get(0,0),r=e.get(0,1),i=e.get(1,0),o=e.get(1,1),n*o-r*i;if(3===e.columns){let o,a,s;return o=new Nv(e,[1,2],[1,2]),a=new Nv(e,[1,2],[0,2]),s=new Nv(e,[1,2],[0,1]),n=e.get(0,0),r=e.get(0,1),i=e.get(0,2),n*t(o)-r*t(a)+i*t(s)}return new kv(e).determinant}throw Error("determinant can only be calculated for a square matrix")},Km.inverse=function(t,e=!1){return t=Cv.checkMatrix(t),e?new Av(t).inverse():Ov(t,Ev.eye(t.rows))},Km.linearDependencies=function(t,e={}){const{thresholdValue:n=1e-9,thresholdError:r=1e-9}=e;let i=(t=Ev.checkMatrix(t)).rows,o=new Ev(i,i);for(let e=0;e<i;e++){let a=Ev.columnVector(t.getRow(e)),s=t.subMatrixRow(_v(i,e)).transpose(),u=new Av(s).solve(a),c=Ev.sub(a,s.mmul(u)).abs().max();o.setRow(e,Rv(c,u,e,n,r))}return o},Km.pseudoInverse=function(t,e=Number.EPSILON){if((t=Ev.checkMatrix(t)).isEmpty())return t.transpose();let n=new Av(t,{autoTranspose:!0}),r=n.leftSingularVectors,i=n.rightSingularVectors,o=n.diagonal;for(let t=0;t<o.length;t++)Math.abs(o[t])>e?o[t]=1/o[t]:o[t]=0;return i.mmul(Ev.diag(o).mmul(r.transpose()))},Km.solve=Ov,Km.wrap=function(t,e){if(ev.isAnyArray(t))return t[0]&&ev.isAnyArray(t[0])?new Cv(t):new Sv(t,e);throw new Error("the argument is not an array")};const Gv=zv,Vv=Bv;Fv.Matrix&&Fv.Matrix;const Wv={center:[0,0],linkDistance:50};class Uv{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},Wv),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericMDSLayout(!0,t,e)}))}genericMDSLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{center:i=[0,0],linkDistance:o=50}=r,a=e.getAllNodes(),s=e.getAllEdges();if(!(null==a?void 0:a.length)||1===a.length)return mm(e,t,i);const u=am({nodes:a,edges:s},!1),c=om(u);Hv(c);const l=((t,e)=>{const n=[];return t.forEach((t=>{const r=[];t.forEach((t=>{r.push(t*e)})),n.push(r)})),n})(c,o),h=qv(l),d=[];h.forEach(((t,e)=>{const n=lm(a[e]);n.data.x=t[0]+i[0],n.data.y=t[1]+i[1],d.push(n)})),t&&d.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:d,edges:s}}))}}const Hv=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((n,r)=>{n.forEach(((n,i)=>{n===1/0&&(t[r][i]=e)}))}))},qv=t=>{const e=Gv.mul(Gv.pow(t,2),-.5),n=e.mean("row"),r=e.mean("column"),i=e.mean();e.add(i).subRowVector(n).subColumnVector(r);const o=new Vv(e),a=Gv.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map((t=>Gv.mul([t],[a]).toJSON()[0].splice(0,2)))},$v={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},Yv={center:[0,0],comboPadding:10,treeKey:"combo"};function Kv(t){return function(){return t}}function Xv(t){return 1e-6*(t()-.5)}function Zv(t){return t.x+t.vx}function Qv(t){return t.y+t.vy}function Jv(t){var e,n,r,i=1,o=1;function a(){for(var t,a,u,c,l,h,d,f=e.length,p=0;p<o;++p)for(a=Cm(e,Zv,Qv).visitAfter(s),t=0;t<f;++t)u=e[t],h=n[u.index],d=h*h,c=u.x+u.vx,l=u.y+u.vy,a.visit(g);function g(t,e,n,o,a){var s=t.data,f=t.r,p=h+f;if(!s)return e>c+p||o<c-p||n>l+p||a<l-p;if(s.index>u.index){var g=c-s.x-s.vx,m=l-s.y-s.vy,v=g*g+m*m;v<p*p&&(0===g&&(v+=(g=Xv(r))*g),0===m&&(v+=(m=Xv(r))*m),v=(p-(v=Math.sqrt(v)))/v*i,u.vx+=(g*=v)*(p=(f*=f)/(d+f)),u.vy+=(m*=v)*p,s.vx-=g*(p=1-p),s.vy-=m*p)}}}function s(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=Kv(null==t?1:+t)),a.initialize=function(t,n){e=t,r=n,u()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Kv(+e),u(),a):t},a}function ty(t){return t.index}function ey(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function ny(t){var e,n,r,i,o,a,s=ty,u=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=Kv(30),l=1;function h(r){for(var i=0,s=t.length;i<l;++i)for(var u,c,h,d,f,p,g,m=0;m<s;++m)c=(u=t[m]).source,d=(h=u.target).x+h.vx-c.x-c.vx||Xv(a),f=h.y+h.vy-c.y-c.vy||Xv(a),d*=p=((p=Math.sqrt(d*d+f*f))-n[m])/p*r*e[m],f*=p,h.vx-=d*(g=o[m]),h.vy-=f*g,c.vx+=d*(g=1-g),c.vy+=f*g}function d(){if(r){var a,u,c=r.length,l=t.length,h=new Map(r.map(((t,e)=>[s(t,e,r),t])));for(a=0,i=new Array(c);a<l;++a)(u=t[a]).index=a,"object"!=typeof u.source&&(u.source=ey(h,u.source)),"object"!=typeof u.target&&(u.target=ey(h,u.target)),i[u.source.index]=(i[u.source.index]||0)+1,i[u.target.index]=(i[u.target.index]||0)+1;for(a=0,o=new Array(l);a<l;++a)u=t[a],o[a]=i[u.source.index]/(i[u.source.index]+i[u.target.index]);e=new Array(l),f(),n=new Array(l),p()}}function f(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+u(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+c(t[e],e,t)}return null==t&&(t=[]),h.initialize=function(t,e){r=t,a=e,d()},h.links=function(e){return arguments.length?(t=e,d(),h):t},h.id=function(t){return arguments.length?(s=t,h):s},h.iterations=function(t){return arguments.length?(l=+t,h):l},h.strength=function(t){return arguments.length?(u="function"==typeof t?t:Kv(+t),f(),h):u},h.distance=function(t){return arguments.length?(c="function"==typeof t?t:Kv(+t),p(),h):c},h}var ry={value:()=>{}};function iy(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new oy(r)}function oy(t){this._=t}function ay(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function sy(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=ry,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}oy.prototype=iy.prototype={constructor:oy,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=sy(i[n],t.name,e);else if(null==e)for(n in i)i[n]=sy(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=ay(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new oy(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var uy,cy,ly=0,hy=0,dy=0,fy=1e3,py=0,gy=0,my=0,vy="object"==typeof performance&&performance.now?performance:Date,yy="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function by(){return gy||(yy(Ey),gy=vy.now()+my)}function Ey(){gy=0}function wy(){this._call=this._time=this._next=null}function xy(t,e,n){var r=new wy;return r.restart(t,e,n),r}function My(){gy=(py=vy.now())+my,ly=hy=0;try{!function(){by(),++ly;for(var t,e=uy;e;)(t=gy-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ly}()}finally{ly=0,function(){var t,e,n=uy,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:uy=e);cy=t,Sy(r)}(),gy=0}}function Ny(){var t=vy.now(),e=t-py;e>fy&&(my-=e,py=t)}function Sy(t){ly||(hy&&(hy=clearTimeout(hy)),t-gy>24?(t<1/0&&(hy=setTimeout(My,t-vy.now()-my)),dy&&(dy=clearInterval(dy))):(dy||(py=vy.now(),dy=setInterval(Ny,fy)),ly=1,yy(My)))}wy.prototype=xy.prototype={constructor:wy,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?by():+n)+(null==e?0:+e),this._next||cy===this||(cy?cy._next=this:uy=this,cy=this),this._call=t,this._time=n,Sy()},stop:function(){this._call&&(this._call=null,this._time=1/0,Sy())}};const Cy=1664525,ky=1013904223,Ty=4294967296;function Py(t){return t.x}function Ay(t){return t.y}var Oy=10,_y=Math.PI*(3-Math.sqrt(5));function Ry(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,u=xy(h),c=iy("tick","end"),l=function(){let t=1;return()=>(t=(Cy*t+ky)%Ty)/Ty}();function h(){d(),c.call("tick",e),n<r&&(u.stop(),c.call("end",e))}function d(r){var u,c,l=t.length;void 0===r&&(r=1);for(var h=0;h<r;++h)for(n+=(o-n)*i,s.forEach((function(t){t(n)})),u=0;u<l;++u)null==(c=t[u]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return e}function f(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=Oy*Math.sqrt(.5+n),o=n*_y;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,l),e}return null==t&&(t=[]),f(),e={tick:d,restart:function(){return u.restart(h),e},stop:function(){return u.stop(),e},nodes:function(n){return arguments.length?(t=n,f(),s.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(l=t,s.forEach(p),e):l},force:function(t,n){return arguments.length>1?(null==n?s.delete(t):s.set(t,p(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,u,c=0,l=t.length;for(null==r?r=1/0:r*=r,c=0;c<l;++c)(a=(i=e-(s=t[c]).x)*i+(o=n-s.y)*o)<r&&(u=s,r=a);return u},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}function Ly(){var t,e,n,r,i,o=Kv(-30),a=1,s=1/0,u=.81;function c(n){var i,o=t.length,a=Cm(t,Py,Ay).visitAfter(h);for(r=n,i=0;i<o;++i)e=t[i],a.visit(d)}function l(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function h(t){var e,n,r,o,a,s=0,u=0;if(t.length){for(r=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(s+=e.value,u+=n,r+=n*e.x,o+=n*e.y);t.x=r/u,t.y=o/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=i[e.data.index]}while(e=e.next)}t.value=s}function d(t,o,c,l){if(!t.value)return!0;var h=t.x-e.x,d=t.y-e.y,f=l-o,p=h*h+d*d;if(f*f/u<p)return p<s&&(0===h&&(p+=(h=Xv(n))*h),0===d&&(p+=(d=Xv(n))*d),p<a&&(p=Math.sqrt(a*p)),e.vx+=h*t.value*r/p,e.vy+=d*t.value*r/p),!0;if(!(t.length||p>=s)){(t.data!==e||t.next)&&(0===h&&(p+=(h=Xv(n))*h),0===d&&(p+=(d=Xv(n))*d),p<a&&(p=Math.sqrt(a*p)));do{t.data!==e&&(f=i[t.data.index]*r/p,e.vx+=h*f,e.vy+=d*f)}while(t=t.next)}}return c.initialize=function(e,r){t=e,n=r,l()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:Kv(+t),l(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c.theta=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c}function Dy(t){var e,n,r,i=Kv(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=Kv(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Kv(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:Kv(+e),a(),o):t},o}function Iy(t){var e,n,r,i=Kv(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=Kv(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Kv(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:Kv(+e),a(),o):t},o}function jy(){function t(t){return()=>t}let e,n=t=>t.cluster,r=t(1),i=t(-1),o=t(100),a=t(.1),s=[0,0],u=[],c={},l=[],h=100,d=100,f={none:{x:0,y:0}},p=[],g="force",m=!0,v=.1;function y(t){if(!m)return y;e.tick(),E();for(let e,r=0,i=u.length,o=t*v;r<i;++r)e=u[r],e.vx+=(f[n(e)].x-e.x)*o,e.vy+=(f[n(e)].y-e.y)*o}function b(){u&&function(){if(!u||!u.length)return;if(void 0===n(u[0]))throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInBox.groupBy('clusterAttr') before calling .links()");const t=function(){const t=[],e=[],i={};let o=[],a={},s=[];return a=function(t){const e={};return t.forEach((t=>{const r=n(t);e[r]||(e[r]={count:0,sumforceNodeSize:0})})),t.forEach((t=>{const i=n(t),o=r(t),a=e[i];a.count=a.count+1,a.sumforceNodeSize=a.sumforceNodeSize+Math.PI*(o*o)*1.3,e[i]=a})),e}(u),s=function(t){const e={},r=[];t.forEach((t=>{const r=function(t){const e=t.source,r=t.target,i=n(c[e]),o=n(c[r]);return i<=o?`${i}~${o}`:`${o}~${i}`}(t);let i=0;void 0!==e[r]&&(i=e[r]),i+=1,e[r]=i}));return Object.entries(e).forEach((([t,e])=>{const n=t.split("~")[0],i=t.split("~")[1];void 0!==n&&void 0!==i&&r.push({source:n,target:i,count:e})})),r}(l),o=Object.keys(a),o.forEach(((e,n)=>{const r=a[e];t.push({id:e,size:r.count,r:Math.sqrt(r.sumforceNodeSize/Math.PI)}),i[e]=n})),s.forEach((t=>{const n=t.source,r=t.target,o=i[n],a=i[r];void 0!==o&&void 0!==a&&e.push({source:o,target:a,count:t.count})})),{nodes:t,links:e}}();e=Ry(t.nodes).force("x",Dy(h).strength(.1)).force("y",Iy(d).strength(.1)).force("collide",Jv((t=>t.r)).iterations(4)).force("charge",Ly().strength(i)).force("links",ny(t.nodes.length?t.links:[]).distance(o).strength(a)),p=e.nodes(),E()}()}function E(){return f={none:{x:0,y:0}},p.forEach((t=>{f[t.id]={x:t.x-s[0],y:t.y-s[1]}})),f}return y.initialize=t=>{u=t,b()},y.template=function(t){return arguments.length?(g=t,b(),y):g},y.groupBy=function(t){return arguments.length?"string"==typeof t?(n=e=>e[t],y):(n=t,y):n},y.enableGrouping=function(t){return arguments.length?(m=t,y):m},y.strength=function(t){return arguments.length?(v=t,y):v},y.centerX=function(t){return arguments.length?(h=t,y):h},y.centerY=function(t){return arguments.length?(d=t,y):d},y.nodes=function(t){return arguments.length?(function(t){c={},t.forEach((t=>{c[t.id]=t}))}(t||[]),u=t||[],y):u},y.links=function(t){return arguments.length?(l=t||[],b(),y):l},y.forceNodeSize=function(e){return arguments.length?(r="function"==typeof e?e:t(+e),b(),y):r},y.nodeSize=y.forceNodeSize,y.forceCharge=function(e){return arguments.length?(i="function"==typeof e?e:t(+e),b(),y):i},y.forceLinkDistance=function(e){return arguments.length?(o="function"==typeof e?e:t(+e),b(),y):o},y.forceLinkStrength=function(e){return arguments.length?(a="function"==typeof e?e:t(+e),b(),y):a},y.offset=function(t){return arguments.length?(s=t,y):s},y.getFocis=E,y}const zy={center:[0,0],preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,linkDistance:50,forceSimulation:null,alphaDecay:.028,alphaMin:.001,alpha:.3,collideStrength:1,clustering:!1,clusterNodeStrength:-1,clusterEdgeStrength:.1,clusterEdgeDistance:100,clusterFociStrength:.8,clusterNodeSize:10};const By=t=>t.map((t=>{const{x:e,y:n}=t,r=o(t,["x","y"]);return Object.assign(Object.assign({},r),{data:Object.assign(Object.assign({},r.data),{x:e,y:n})})})),Fy=t=>t.map((t=>{const{source:e,target:n}=t,r=o(t,["source","target"]);return Object.assign(Object.assign({},r),{source:e.id,target:n.id})}));var Gy,Vy,Wy,Uy,Hy,qy,$y,Yy,Ky,Xy,Zy,Qy,Jy,tb,eb,nb,rb,ib,ob,ab,sb,ub,cb,lb,hb,db,fb,pb,gb,mb,vb,yb,bb,Eb,wb,xb,Mb,Nb,Sb,Cb,kb,Tb,Pb,Ab,Ob,_b,Rb,Lb,Db,Ib,jb,zb,Bb,Fb,Gb,Vb,Wb,Ub,Hb,qb,$b,Yb,Kb,Xb,Zb,Qb,Jb,tE,eE,nE,rE,iE,oE,aE,sE,uE,cE,lE,hE,dE,fE,pE,gE,mE,vE,yE,bE,EE,wE,xE,ME,NE,SE,CE,kE,TE,PE,AE,OE,_E,RE,LE,DE,IE,jE,zE,BE,FE;function GE(){if(Uy)return Wy;return Uy=1,Wy=function(t,e){return t===e||t!=t&&e!=e}}function VE(){if(qy)return Hy;qy=1;var t=GE();return Hy=function(e,n){for(var r=e.length;r--;)if(t(e[r][0],n))return r;return-1},Hy}function WE(){if(nb)return eb;nb=1;var t=Vy?Gy:(Vy=1,Gy=function(){this.__data__=[],this.size=0}),e=function(){if(Yy)return $y;Yy=1;var t=VE(),e=Array.prototype.splice;return $y=function(n){var r=this.__data__,i=t(r,n);return!(i<0||(i==r.length-1?r.pop():e.call(r,i,1),--this.size,0))},$y}(),n=function(){if(Xy)return Ky;Xy=1;var t=VE();return Ky=function(e){var n=this.__data__,r=t(n,e);return r<0?void 0:n[r][1]},Ky}(),r=function(){if(Qy)return Zy;Qy=1;var t=VE();return Zy=function(e){return t(this.__data__,e)>-1}}(),i=function(){if(tb)return Jy;tb=1;var t=VE();return Jy=function(e,n){var r=this.__data__,i=t(r,e);return i<0?(++this.size,r.push([e,n])):r[i][1]=n,this},Jy}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,eb=o}function UE(){if(db)return hb;db=1;var t="object"==typeof d&&d&&d.Object===Object&&d;return hb=t}function HE(){if(pb)return fb;pb=1;var t=UE(),e="object"==typeof self&&self&&self.Object===Object&&self,n=t||e||Function("return this")();return fb=n}function qE(){if(mb)return gb;mb=1;var t=HE().Symbol;return gb=t}function $E(){if(xb)return wb;xb=1;var t=qE(),e=function(){if(yb)return vb;yb=1;var t=qE(),e=Object.prototype,n=e.hasOwnProperty,r=e.toString,i=t?t.toStringTag:void 0;return vb=function(t){var e=n.call(t,i),o=t[i];try{t[i]=void 0;var a=!0}catch(t){}var s=r.call(t);return a&&(e?t[i]=o:delete t[i]),s}}(),n=function(){if(Eb)return bb;Eb=1;var t=Object.prototype.toString;return bb=function(e){return t.call(e)}}(),r=t?t.toStringTag:void 0;return wb=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":r&&r in Object(t)?e(t):n(t)}}function YE(){if(Nb)return Mb;return Nb=1,Mb=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function KE(){if(Cb)return Sb;Cb=1;var t=$E(),e=YE();return Sb=function(n){if(!e(n))return!1;var r=t(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function XE(){if(Ab)return Pb;Ab=1;var t,e=function(){if(Tb)return kb;Tb=1;var t=HE()["__core-js_shared__"];return kb=t}(),n=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return Pb=function(t){return!!n&&n in t}}function ZE(){if(_b)return Ob;_b=1;var t=Function.prototype.toString;return Ob=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}function QE(){if(zb)return jb;zb=1;var t=function(){if(Lb)return Rb;Lb=1;var t=KE(),e=XE(),n=YE(),r=ZE(),i=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,s=o.toString,u=a.hasOwnProperty,c=RegExp("^"+s.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Rb=function(o){return!(!n(o)||e(o))&&(t(o)?c:i).test(r(o))}}(),e=Ib?Db:(Ib=1,Db=function(t,e){return null==t?void 0:t[e]});return jb=function(n,r){var i=e(n,r);return t(i)?i:void 0}}function JE(){if(Fb)return Bb;Fb=1;var t=QE()(HE(),"Map");return Bb=t}function tw(){if(Vb)return Gb;Vb=1;var t=QE()(Object,"create");return Gb=t}function ew(){if(tE)return Jb;tE=1;var t=function(){if(Ub)return Wb;Ub=1;var t=tw();return Wb=function(){this.__data__=t?t(null):{},this.size=0}}(),e=qb?Hb:(qb=1,Hb=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}),n=function(){if(Yb)return $b;Yb=1;var t=tw(),e=Object.prototype.hasOwnProperty;return $b=function(n){var r=this.__data__;if(t){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return e.call(r,n)?r[n]:void 0},$b}(),r=function(){if(Xb)return Kb;Xb=1;var t=tw(),e=Object.prototype.hasOwnProperty;return Kb=function(n){var r=this.__data__;return t?void 0!==r[n]:e.call(r,n)},Kb}(),i=function(){if(Qb)return Zb;Qb=1;var t=tw();return Zb=function(e,n){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=t&&void 0===n?"__lodash_hash_undefined__":n,this},Zb}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Jb=o}function nw(){if(aE)return oE;aE=1;var t=iE?rE:(iE=1,rE=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t});return oE=function(e,n){var r=e.__data__;return t(n)?r["string"==typeof n?"string":"hash"]:r.map},oE}function rw(){if(mE)return gE;mE=1;var t=function(){if(nE)return eE;nE=1;var t=ew(),e=WE(),n=JE();return eE=function(){this.size=0,this.__data__={hash:new t,map:new(n||e),string:new t}}}(),e=function(){if(uE)return sE;uE=1;var t=nw();return sE=function(e){var n=t(this,e).delete(e);return this.size-=n?1:0,n}}(),n=function(){if(lE)return cE;lE=1;var t=nw();return cE=function(e){return t(this,e).get(e)}}(),r=function(){if(dE)return hE;dE=1;var t=nw();return hE=function(e){return t(this,e).has(e)}}(),i=function(){if(pE)return fE;pE=1;var t=nw();return fE=function(e,n){var r=t(this,e),i=r.size;return r.set(e,n),this.size+=r.size==i?0:1,this},fE}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,gE=o}function iw(){if(EE)return bE;EE=1;var t=WE(),e=function(){if(ib)return rb;ib=1;var t=WE();return rb=function(){this.__data__=new t,this.size=0}}(),n=(ab||(ab=1,ob=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}),ob),r=ub?sb:(ub=1,sb=function(t){return this.__data__.get(t)}),i=lb?cb:(lb=1,cb=function(t){return this.__data__.has(t)}),o=function(){if(yE)return vE;yE=1;var t=WE(),e=JE(),n=rw();return vE=function(r,i){var o=this.__data__;if(o instanceof t){var a=o.__data__;if(!e||a.length<199)return a.push([r,i]),this.size=++o.size,this;o=this.__data__=new n(a)}return o.set(r,i),this.size=o.size,this},vE}();function a(e){var n=this.__data__=new t(e);this.size=n.size}return a.prototype.clear=e,a.prototype.delete=n,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,bE=a}function ow(){if(xE)return wE;return xE=1,wE=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t},wE}function aw(){if(NE)return ME;NE=1;var t=QE(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return ME=e}function sw(){if(CE)return SE;CE=1;var t=aw();return SE=function(e,n,r){"__proto__"==n&&t?t(e,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[n]=r}}function uw(){if(TE)return kE;TE=1;var t=sw(),e=GE(),n=Object.prototype.hasOwnProperty;return kE=function(r,i,o){var a=r[i];n.call(r,i)&&e(a,o)&&(void 0!==o||i in r)||t(r,i,o)}}function cw(){if(AE)return PE;AE=1;var t=uw(),e=sw();return PE=function(n,r,i,o){var a=!i;i||(i={});for(var s=-1,u=r.length;++s<u;){var c=r[s],l=o?o(i[c],n[c],c,i,n):void 0;void 0===l&&(l=n[c]),a?e(i,c,l):t(i,c,l)}return i},PE}function lw(){if(LE)return RE;return LE=1,RE=function(t){return null!=t&&"object"==typeof t}}function hw(){if(zE)return jE;zE=1;var t=function(){if(IE)return DE;IE=1;var t=$E(),e=lw();return DE=function(n){return e(n)&&"[object Arguments]"==t(n)}}(),e=lw(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,o=t(function(){return arguments}())?t:function(t){return e(t)&&r.call(t,"callee")&&!i.call(t,"callee")};return jE=o}function dw(){if(FE)return BE;FE=1;var t=Array.isArray;return BE=t}var fw,pw,gw,mw,vw,yw,bw,Ew,ww,xw,Mw,Nw={exports:{}};function Sw(){return gw||(gw=1,function(t,e){var n=HE(),r=pw?fw:(pw=1,fw=function(){return!1}),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,a=o&&o.exports===i?n.Buffer:void 0,s=(a?a.isBuffer:void 0)||r;t.exports=s}(Nw,Nw.exports)),Nw.exports}function Cw(){if(vw)return mw;vw=1;var t=/^(?:0|[1-9]\d*)$/;return mw=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e<n},mw}function kw(){if(bw)return yw;bw=1;return yw=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function Tw(){if(Mw)return xw;return Mw=1,xw=function(t){return function(e){return t(e)}}}Nw.exports;var Pw,Aw,Ow,_w,Rw,Lw,Dw,Iw,jw,zw,Bw,Fw,Gw,Vw,Ww,Uw,Hw,qw,$w,Yw,Kw,Xw,Zw,Qw,Jw,tx,ex,nx={exports:{}};function rx(){return Pw||(Pw=1,function(t,e){var n=UE(),r=e&&!e.nodeType&&e,i=r&&t&&!t.nodeType&&t,o=i&&i.exports===r&&n.process,a=function(){try{var t=i&&i.require&&i.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a}(nx,nx.exports)),nx.exports}function ix(){if(Ow)return Aw;Ow=1;var t=function(){if(ww)return Ew;ww=1;var t=$E(),e=kw(),n=lw(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,Ew=function(i){return n(i)&&e(i.length)&&!!r[t(i)]}}(),e=Tw(),n=rx(),r=n&&n.isTypedArray,i=r?e(r):t;return Aw=i}function ox(){if(Rw)return _w;Rw=1;var t=(_E||(_E=1,OE=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}),OE),e=hw(),n=dw(),r=Sw(),i=Cw(),o=ix(),a=Object.prototype.hasOwnProperty;return _w=function(s,u){var c=n(s),l=!c&&e(s),h=!c&&!l&&r(s),d=!c&&!l&&!h&&o(s),f=c||l||h||d,p=f?t(s.length,String):[],g=p.length;for(var m in s)!u&&!a.call(s,m)||f&&("length"==m||h&&("offset"==m||"parent"==m)||d&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||i(m,g))||p.push(m);return p},_w}function ax(){if(Dw)return Lw;Dw=1;var t=Object.prototype;return Lw=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}}function sx(){if(jw)return Iw;return jw=1,Iw=function(t,e){return function(n){return t(e(n))}}}function ux(){if(Gw)return Fw;Gw=1;var t=ax(),e=function(){if(Bw)return zw;Bw=1;var t=sx()(Object.keys,Object);return zw=t}(),n=Object.prototype.hasOwnProperty;return Fw=function(r){if(!t(r))return e(r);var i=[];for(var o in Object(r))n.call(r,o)&&"constructor"!=o&&i.push(o);return i}}function cx(){if(Ww)return Vw;Ww=1;var t=KE(),e=kw();return Vw=function(n){return null!=n&&e(n.length)&&!t(n)}}function lx(){if(Hw)return Uw;Hw=1;var t=ox(),e=ux(),n=cx();return Uw=function(r){return n(r)?t(r):e(r)}}function hx(){if(Zw)return Xw;Zw=1;var t=YE(),e=ax(),n=Kw?Yw:(Kw=1,Yw=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}),r=Object.prototype.hasOwnProperty;return Xw=function(i){if(!t(i))return n(i);var o=e(i),a=[];for(var s in i)("constructor"!=s||!o&&r.call(i,s))&&a.push(s);return a}}function dx(){if(Jw)return Qw;Jw=1;var t=ox(),e=hx(),n=cx();return Qw=function(r){return n(r)?t(r,!0):e(r)}}nx.exports;var fx,px,gx,mx,vx,yx,bx,Ex,wx,xx,Mx,Nx,Sx,Cx,kx,Tx,Px,Ax,Ox,_x,Rx,Lx,Dx,Ix,jx,zx,Bx,Fx,Gx,Vx,Wx,Ux,Hx,qx,$x,Yx,Kx,Xx,Zx,Qx,Jx,tM,eM,nM,rM,iM,oM,aM,sM,uM,cM,lM,hM,dM,fM,pM,gM,mM,vM,yM,bM,EM,wM,xM,MM,NM,SM,CM,kM,TM,PM,AM,OM,_M,RM,LM,DM,IM,jM,zM,BM,FM,GM,VM,WM,UM,HM,qM,$M,YM,KM,XM,ZM,QM,JM,tN,eN,nN,rN,iN,oN,aN,sN,uN,cN,lN,hN,dN,fN,pN,gN,mN,vN,yN,bN,EN,wN,xN,MN,NN,SN,CN,kN,TN,PN,AN,ON,_N,RN,LN,DN,IN,jN,zN,BN,FN,GN,VN,WN,UN,HN,qN,$N,YN,KN,XN,ZN,QN,JN,tS,eS,nS,rS,iS,oS,aS,sS,uS,cS,lS,hS,dS,fS,pS,gS,mS,vS,yS,bS,ES,wS,xS,MS,NS,SS,CS,kS,TS,PS,AS,OS,_S,RS,LS,DS,IS,jS,zS,BS,FS,GS,VS,WS,US,HS,qS,$S,YS,KS,XS,ZS,QS,JS,tC,eC,nC,rC,iC,oC,aC,sC,uC,cC,lC,hC,dC,fC,pC,gC,mC,vC,yC,bC,EC,wC,xC,MC,NC,SC,CC,kC,TC,PC,AC,OC,_C,RC,LC,DC,IC,jC,zC,BC,FC,GC,VC,WC,UC,HC,qC,$C,YC,KC,XC,ZC,QC,JC,tk,ek,nk,rk,ik,ok,ak,sk,uk,ck,lk,hk,dk,fk,pk,gk,mk,vk,yk,bk,Ek,wk,xk,Mk={exports:{}};function Nk(){return fx||(fx=1,function(t,e){var n=HE(),r=e&&!e.nodeType&&e,i=r&&t&&!t.nodeType&&t,o=i&&i.exports===r?n.Buffer:void 0,a=o?o.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}}(Mk,Mk.exports)),Mk.exports}function Sk(){if(gx)return px;return gx=1,px=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e},px}function Ck(){if(vx)return mx;return vx=1,mx=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o},mx}function kk(){if(bx)return yx;return bx=1,yx=function(){return[]}}function Tk(){if(wx)return Ex;wx=1;var t=Ck(),e=kk(),n=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Ex=r?function(e){return null==e?[]:(e=Object(e),t(r(e),(function(t){return n.call(e,t)})))}:e}function Pk(){if(Sx)return Nx;return Sx=1,Nx=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t},Nx}function Ak(){if(kx)return Cx;kx=1;var t=sx()(Object.getPrototypeOf,Object);return Cx=t}function Ok(){if(Px)return Tx;Px=1;var t=Pk(),e=Ak(),n=Tk(),r=kk(),i=Object.getOwnPropertySymbols;return Tx=i?function(r){for(var i=[];r;)t(i,n(r)),r=e(r);return i}:r}function _k(){if(Rx)return _x;Rx=1;var t=Pk(),e=dw();return _x=function(n,r,i){var o=r(n);return e(n)?o:t(o,i(n))}}function Rk(){if(Dx)return Lx;Dx=1;var t=_k(),e=Tk(),n=lx();return Lx=function(r){return t(r,n,e)}}function Lk(){if(Wx)return Vx;Wx=1;var t=QE()(HE(),"Set");return Vx=t}function Dk(){if($x)return qx;$x=1;var t=function(){if(Bx)return zx;Bx=1;var t=QE()(HE(),"DataView");return zx=t}(),e=JE(),n=function(){if(Gx)return Fx;Gx=1;var t=QE()(HE(),"Promise");return Fx=t}(),r=Lk(),i=function(){if(Hx)return Ux;Hx=1;var t=QE()(HE(),"WeakMap");return Ux=t}(),o=$E(),a=ZE(),s="[object Map]",u="[object Promise]",c="[object Set]",l="[object WeakMap]",h="[object DataView]",d=a(t),f=a(e),p=a(n),g=a(r),m=a(i),v=o;return(t&&v(new t(new ArrayBuffer(1)))!=h||e&&v(new e)!=s||n&&v(n.resolve())!=u||r&&v(new r)!=c||i&&v(new i)!=l)&&(v=function(t){var e=o(t),n="[object Object]"==e?t.constructor:void 0,r=n?a(n):"";if(r)switch(r){case d:return h;case f:return s;case p:return u;case g:return c;case m:return l}return e}),qx=v}function Ik(){if(Zx)return Xx;Zx=1;var t=HE().Uint8Array;return Xx=t}function jk(){if(Jx)return Qx;Jx=1;var t=Ik();return Qx=function(e){var n=new e.constructor(e.byteLength);return new t(n).set(new t(e)),n}}function zk(){if(sM)return aM;sM=1;var t=jk();return aM=function(e,n){var r=n?t(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}}function Bk(){if(cM)return uM;cM=1;var t=jk(),e=function(){if(eM)return tM;eM=1;var t=jk();return tM=function(e,n){var r=n?t(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}}(),n=function(){if(rM)return nM;rM=1;var t=/\w*$/;return nM=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}}(),r=function(){if(oM)return iM;oM=1;var t=qE(),e=t?t.prototype:void 0,n=e?e.valueOf:void 0;return iM=function(t){return n?Object(n.call(t)):{}}}(),i=zk();return uM=function(o,a,s){var u=o.constructor;switch(a){case"[object ArrayBuffer]":return t(o);case"[object Boolean]":case"[object Date]":return new u(+o);case"[object DataView]":return e(o,s);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return i(o,s);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(o);case"[object RegExp]":return n(o);case"[object Symbol]":return r(o)}}}function Fk(){if(hM)return lM;hM=1;var t=YE(),e=Object.create,n=function(){function n(){}return function(r){if(!t(r))return{};if(e)return e(r);n.prototype=r;var i=new n;return n.prototype=void 0,i}}();return lM=n}function Gk(){if(fM)return dM;fM=1;var t=Fk(),e=Ak(),n=ax();return dM=function(r){return"function"!=typeof r.constructor||n(r)?{}:t(e(r))}}function Vk(){if(vM)return mM;vM=1;var t=function(){if(gM)return pM;gM=1;var t=Dk(),e=lw();return pM=function(n){return e(n)&&"[object Map]"==t(n)}}(),e=Tw(),n=rx(),r=n&&n.isMap,i=r?e(r):t;return mM=i}function Wk(){if(wM)return EM;wM=1;var t=function(){if(bM)return yM;bM=1;var t=Dk(),e=lw();return yM=function(n){return e(n)&&"[object Set]"==t(n)}}(),e=Tw(),n=rx(),r=n&&n.isSet,i=r?e(r):t;return EM=i}function Uk(){if(MM)return xM;MM=1;var t=iw(),e=ow(),n=uw(),r=function(){if($w)return qw;$w=1;var t=cw(),e=lx();return qw=function(n,r){return n&&t(r,e(r),n)}}(),i=function(){if(ex)return tx;ex=1;var t=cw(),e=dx();return tx=function(n,r){return n&&t(r,e(r),n)}}(),o=Nk(),a=Sk(),s=function(){if(Mx)return xx;Mx=1;var t=cw(),e=Tk();return xx=function(n,r){return t(n,e(n),r)}}(),u=function(){if(Ox)return Ax;Ox=1;var t=cw(),e=Ok();return Ax=function(n,r){return t(n,e(n),r)}}(),c=Rk(),l=function(){if(jx)return Ix;jx=1;var t=_k(),e=Ok(),n=dx();return Ix=function(r){return t(r,n,e)}}(),h=Dk(),d=function(){if(Kx)return Yx;Kx=1;var t=Object.prototype.hasOwnProperty;return Yx=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r},Yx}(),f=Bk(),p=Gk(),g=dw(),m=Sw(),v=Vk(),y=YE(),b=Wk(),E=lx(),w=dx(),x="[object Arguments]",M="[object Function]",N="[object Object]",S={};return S[x]=S["[object Array]"]=S["[object ArrayBuffer]"]=S["[object DataView]"]=S["[object Boolean]"]=S["[object Date]"]=S["[object Float32Array]"]=S["[object Float64Array]"]=S["[object Int8Array]"]=S["[object Int16Array]"]=S["[object Int32Array]"]=S["[object Map]"]=S["[object Number]"]=S[N]=S["[object RegExp]"]=S["[object Set]"]=S["[object String]"]=S["[object Symbol]"]=S["[object Uint8Array]"]=S["[object Uint8ClampedArray]"]=S["[object Uint16Array]"]=S["[object Uint32Array]"]=!0,S["[object Error]"]=S[M]=S["[object WeakMap]"]=!1,xM=function C(k,T,P,A,O,_){var R,L=1&T,D=2&T,I=4&T;if(P&&(R=O?P(k,A,O,_):P(k)),void 0!==R)return R;if(!y(k))return k;var j=g(k);if(j){if(R=d(k),!L)return a(k,R)}else{var z=h(k),B=z==M||"[object GeneratorFunction]"==z;if(m(k))return o(k,L);if(z==N||z==x||B&&!O){if(R=D||B?{}:p(k),!L)return D?u(k,i(R,k)):s(k,r(R,k))}else{if(!S[z])return O?k:{};R=f(k,z,L)}}_||(_=new t);var F=_.get(k);if(F)return F;_.set(k,R),b(k)?k.forEach((function(t){R.add(C(t,T,P,t,k,_))})):v(k)&&k.forEach((function(t,e){R.set(e,C(t,T,P,e,k,_))}));var G=j?void 0:(I?D?l:c:D?w:E)(k);return e(G||k,(function(t,e){G&&(t=k[e=t]),n(R,e,C(t,T,P,e,k,_))})),R},xM}function Hk(){if(SM)return NM;SM=1;var t=Uk();return NM=function(e){return t(e,4)}}function qk(){if(kM)return CM;return kM=1,CM=function(t){return function(){return t}}}function $k(){if(OM)return AM;OM=1;var t=(PM||(PM=1,TM=function(t){return function(e,n,r){for(var i=-1,o=Object(e),a=r(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===n(o[u],u,o))break}return e}}),TM),e=t();return AM=e}function Yk(){if(RM)return _M;RM=1;var t=$k(),e=lx();return _M=function(n,r){return n&&t(n,r,e)}}function Kk(){if(jM)return IM;jM=1;var t=Yk(),e=function(){if(DM)return LM;DM=1;var t=cx();return LM=function(e,n){return function(r,i){if(null==r)return r;if(!t(r))return e(r,i);for(var o=r.length,a=n?o:-1,s=Object(r);(n?a--:++a<o)&&!1!==i(s[a],a,s););return r}},LM}(),n=e(t);return IM=n}function Xk(){if(BM)return zM;return BM=1,zM=function(t){return t}}function Zk(){if(GM)return FM;GM=1;var t=Xk();return FM=function(e){return"function"==typeof e?e:t}}function Qk(){if(WM)return VM;WM=1;var t=ow(),e=Kk(),n=Zk(),r=dw();return VM=function(i,o){return(r(i)?t:e)(i,n(o))}}function Jk(){return HM?UM:(HM=1,UM=Qk())}function tT(){if(JM)return QM;JM=1;var t=rw(),e=KM?YM:(KM=1,YM=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}),n=ZM?XM:(ZM=1,XM=function(t){return this.__data__.has(t)});function r(e){var n=-1,r=null==e?0:e.length;for(this.__data__=new t;++n<r;)this.add(e[n])}return r.prototype.add=r.prototype.push=e,r.prototype.has=n,QM=r}function eT(){if(rN)return nN;return rN=1,nN=function(t,e){return t.has(e)}}function nT(){if(oN)return iN;oN=1;var t=tT(),e=(eN||(eN=1,tN=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}),tN),n=eT();return iN=function(r,i,o,a,s,u){var c=1&o,l=r.length,h=i.length;if(l!=h&&!(c&&h>l))return!1;var d=u.get(r),f=u.get(i);if(d&&f)return d==i&&f==r;var p=-1,g=!0,m=2&o?new t:void 0;for(u.set(r,i),u.set(i,r);++p<l;){var v=r[p],y=i[p];if(a)var b=c?a(y,v,p,i,r,u):a(v,y,p,r,i,u);if(void 0!==b){if(b)continue;g=!1;break}if(m){if(!e(i,(function(t,e){if(!n(m,e)&&(v===t||s(v,t,o,a,u)))return m.push(e)}))){g=!1;break}}else if(v!==y&&!s(v,y,o,a,u)){g=!1;break}}return u.delete(r),u.delete(i),g},iN}function rT(){if(cN)return uN;return cN=1,uN=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},uN}function iT(){if(hN)return lN;hN=1;var t=qE(),e=Ik(),n=GE(),r=nT(),i=(sN||(sN=1,aN=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}),aN),o=rT(),a=t?t.prototype:void 0,s=a?a.valueOf:void 0;return lN=function(t,a,u,c,l,h,d){switch(u){case"[object DataView]":if(t.byteLength!=a.byteLength||t.byteOffset!=a.byteOffset)return!1;t=t.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=a.byteLength||!h(new e(t),new e(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return n(+t,+a);case"[object Error]":return t.name==a.name&&t.message==a.message;case"[object RegExp]":case"[object String]":return t==a+"";case"[object Map]":var f=i;case"[object Set]":var p=1&c;if(f||(f=o),t.size!=a.size&&!p)return!1;var g=d.get(t);if(g)return g==a;c|=2,d.set(t,a);var m=r(f(t),f(a),c,l,h,d);return d.delete(t),m;case"[object Symbol]":if(s)return s.call(t)==s.call(a)}return!1}}function oT(){if(gN)return pN;gN=1;var t=iw(),e=nT(),n=iT(),r=function(){if(fN)return dN;fN=1;var t=Rk(),e=Object.prototype.hasOwnProperty;return dN=function(n,r,i,o,a,s){var u=1&i,c=t(n),l=c.length;if(l!=t(r).length&&!u)return!1;for(var h=l;h--;){var d=c[h];if(!(u?d in r:e.call(r,d)))return!1}var f=s.get(n),p=s.get(r);if(f&&p)return f==r&&p==n;var g=!0;s.set(n,r),s.set(r,n);for(var m=u;++h<l;){var v=n[d=c[h]],y=r[d];if(o)var b=u?o(y,v,d,r,n,s):o(v,y,d,n,r,s);if(!(void 0===b?v===y||a(v,y,i,o,s):b)){g=!1;break}m||(m="constructor"==d)}if(g&&!m){var E=n.constructor,w=r.constructor;E==w||!("constructor"in n)||!("constructor"in r)||"function"==typeof E&&E instanceof E&&"function"==typeof w&&w instanceof w||(g=!1)}return s.delete(n),s.delete(r),g},dN}(),i=Dk(),o=dw(),a=Sw(),s=ix(),u="[object Arguments]",c="[object Array]",l="[object Object]",h=Object.prototype.hasOwnProperty;return pN=function(d,f,p,g,m,v){var y=o(d),b=o(f),E=y?c:i(d),w=b?c:i(f),x=(E=E==u?l:E)==l,M=(w=w==u?l:w)==l,N=E==w;if(N&&a(d)){if(!a(f))return!1;y=!0,x=!1}if(N&&!x)return v||(v=new t),y||s(d)?e(d,f,p,g,m,v):n(d,f,E,p,g,m,v);if(!(1&p)){var S=x&&h.call(d,"__wrapped__"),C=M&&h.call(f,"__wrapped__");if(S||C){var k=S?d.value():d,T=C?f.value():f;return v||(v=new t),m(k,T,p,g,v)}}return!!N&&(v||(v=new t),r(d,f,p,g,m,v))}}function aT(){if(vN)return mN;vN=1;var t=oT(),e=lw();return mN=function n(r,i,o,a,s){return r===i||(null==r||null==i||!e(r)&&!e(i)?r!=r&&i!=i:t(r,i,o,a,n,s))},mN}function sT(){if(wN)return EN;wN=1;var t=YE();return EN=function(e){return e==e&&!t(e)}}function uT(){if(SN)return NN;return SN=1,NN=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}}function cT(){if(kN)return CN;kN=1;var t=function(){if(bN)return yN;bN=1;var t=iw(),e=aT();return yN=function(n,r,i,o){var a=i.length,s=a,u=!o;if(null==n)return!s;for(n=Object(n);a--;){var c=i[a];if(u&&c[2]?c[1]!==n[c[0]]:!(c[0]in n))return!1}for(;++a<s;){var l=(c=i[a])[0],h=n[l],d=c[1];if(u&&c[2]){if(void 0===h&&!(l in n))return!1}else{var f=new t;if(o)var p=o(h,d,l,n,r,f);if(!(void 0===p?e(d,h,3,o,f):p))return!1}}return!0},yN}(),e=function(){if(MN)return xN;MN=1;var t=sT(),e=lx();return xN=function(n){for(var r=e(n),i=r.length;i--;){var o=r[i],a=n[o];r[i]=[o,a,t(a)]}return r},xN}(),n=uT();return CN=function(r){var i=e(r);return 1==i.length&&i[0][2]?n(i[0][0],i[0][1]):function(e){return e===r||t(e,r,i)}}}function lT(){if(PN)return TN;PN=1;var t=$E(),e=lw();return TN=function(n){return"symbol"==typeof n||e(n)&&"[object Symbol]"==t(n)}}function hT(){if(ON)return AN;ON=1;var t=dw(),e=lT(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return AN=function(i,o){if(t(i))return!1;var a=typeof i;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=i&&!e(i))||(r.test(i)||!n.test(i)||null!=o&&i in Object(o))}}function dT(){if(DN)return LN;DN=1;var t=function(){if(RN)return _N;RN=1;var t=rw();function e(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var i=function(){var t=arguments,e=r?r.apply(this,t):t[0],o=i.cache;if(o.has(e))return o.get(e);var a=n.apply(this,t);return i.cache=o.set(e,a)||o,a};return i.cache=new(e.Cache||t),i}return e.Cache=t,_N=e}();return LN=function(e){var n=t(e,(function(t){return 500===r.size&&r.clear(),t})),r=n.cache;return n}}function fT(){if(BN)return zN;return BN=1,zN=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i},zN}function pT(){if(WN)return VN;WN=1;var t=function(){if(GN)return FN;GN=1;var t=qE(),e=fT(),n=dw(),r=lT(),i=t?t.prototype:void 0,o=i?i.toString:void 0;return FN=function t(i){if("string"==typeof i)return i;if(n(i))return e(i,t)+"";if(r(i))return o?o.call(i):"";var a=i+"";return"0"==a&&1/i==-1/0?"-0":a},FN}();return VN=function(e){return null==e?"":t(e)}}function gT(){if(HN)return UN;HN=1;var t=dw(),e=hT(),n=function(){if(jN)return IN;jN=1;var t=dT(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=t((function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(e,(function(t,e,i,o){r.push(i?o.replace(n,"$1"):e||t)})),r}));return IN=r}(),r=pT();return UN=function(i,o){return t(i)?i:e(i,o)?[i]:n(r(i))}}function mT(){if($N)return qN;$N=1;var t=lT();return qN=function(e){if("string"==typeof e||t(e))return e;var n=e+"";return"0"==n&&1/e==-1/0?"-0":n}}function vT(){if(KN)return YN;KN=1;var t=gT(),e=mT();return YN=function(n,r){for(var i=0,o=(r=t(r,n)).length;null!=n&&i<o;)n=n[e(r[i++])];return i&&i==o?n:void 0},YN}function yT(){if(eS)return tS;eS=1;var t=gT(),e=hw(),n=dw(),r=Cw(),i=kw(),o=mT();return tS=function(a,s,u){for(var c=-1,l=(s=t(s,a)).length,h=!1;++c<l;){var d=o(s[c]);if(!(h=null!=a&&u(a,d)))break;a=a[d]}return h||++c!=l?h:!!(l=null==a?0:a.length)&&i(l)&&r(d,l)&&(n(a)||e(a))},tS}function bT(){if(rS)return nS;rS=1;var t=JN?QN:(JN=1,QN=function(t,e){return null!=t&&e in Object(t)}),e=yT();return nS=function(n,r){return null!=n&&e(n,r,t)}}function ET(){if(oS)return iS;oS=1;var t=aT(),e=function(){if(ZN)return XN;ZN=1;var t=vT();return XN=function(e,n,r){var i=null==e?void 0:t(e,n);return void 0===i?r:i}}(),n=bT(),r=hT(),i=sT(),o=uT(),a=mT();return iS=function(s,u){return r(s)&&i(u)?o(a(s),u):function(r){var i=e(r,s);return void 0===i&&i===u?n(r,s):t(u,i,3)}}}function wT(){if(sS)return aS;return sS=1,aS=function(t){return function(e){return null==e?void 0:e[t]}}}function xT(){if(hS)return lS;hS=1;var t=wT(),e=function(){if(cS)return uS;cS=1;var t=vT();return uS=function(e){return function(n){return t(n,e)}}}(),n=hT(),r=mT();return lS=function(i){return n(i)?t(r(i)):e(i)}}function MT(){if(fS)return dS;fS=1;var t=cT(),e=ET(),n=Xk(),r=dw(),i=xT();return dS=function(o){return"function"==typeof o?o:null==o?n:"object"==typeof o?r(o)?e(o[0],o[1]):t(o):i(o)}}function NT(){if(gS)return pS;gS=1;var t=Ck(),e=function(){if($M)return qM;$M=1;var t=Kk();return qM=function(e,n){var r=[];return t(e,(function(t,e,i){n(t,e,i)&&r.push(t)})),r},qM}(),n=MT(),r=dw();return pS=function(i,o){return(r(i)?t:e)(i,n(o,3))}}function ST(){if(bS)return yS;bS=1;var t=function(){if(vS)return mS;vS=1;var t=Object.prototype.hasOwnProperty;return mS=function(e,n){return null!=e&&t.call(e,n)}}(),e=yT();return yS=function(n,r){return null!=n&&e(n,r,t)}}function CT(){if(wS)return ES;wS=1;var t=ux(),e=Dk(),n=hw(),r=dw(),i=cx(),o=Sw(),a=ax(),s=ix(),u=Object.prototype.hasOwnProperty;return ES=function(c){if(null==c)return!0;if(i(c)&&(r(c)||"string"==typeof c||"function"==typeof c.splice||o(c)||s(c)||n(c)))return!c.length;var l=e(c);if("[object Map]"==l||"[object Set]"==l)return!c.size;if(a(c))return!t(c).length;for(var h in c)if(u.call(c,h))return!1;return!0}}function kT(){if(MS)return xS;return MS=1,xS=function(t){return void 0===t}}function TT(){if(SS)return NS;SS=1;var t=Kk(),e=cx();return NS=function(n,r){var i=-1,o=e(n)?Array(n.length):[];return t(n,(function(t,e,n){o[++i]=r(t,e,n)})),o},NS}function PT(){if(kS)return CS;kS=1;var t=fT(),e=MT(),n=TT(),r=dw();return CS=function(i,o){return(r(i)?t:n)(i,e(o,3))}}function AT(){if(RS)return _S;RS=1;var t=(PS||(PS=1,TS=function(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}),TS),e=Kk(),n=MT(),r=(OS||(OS=1,AS=function(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}),AS),i=dw();return _S=function(o,a,s){var u=i(o)?t:r,c=arguments.length<3;return u(o,n(a,4),s,c,e)},_S}function OT(){if(WS)return VS;WS=1;var t=function(){if(jS)return IS;jS=1;var t=wT()("length");return IS=t}(),e=function(){if(BS)return zS;BS=1;var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return zS=function(e){return t.test(e)}}(),n=function(){if(GS)return FS;GS=1;var t="\\ud800-\\udfff",e="["+t+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",i="[^"+t+"]",o="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",s="(?:"+n+"|"+r+")?",u="[\\ufe0e\\ufe0f]?",c=u+s+"(?:\\u200d(?:"+[i,o,a].join("|")+")"+u+s+")*",l="(?:"+[i+n+"?",n,o,a,e].join("|")+")",h=RegExp(r+"(?="+r+")|"+l+c,"g");return FS=function(t){for(var e=h.lastIndex=0;h.test(t);)++e;return e}}();return VS=function(r){return e(r)?n(r):t(r)}}function _T(){if(HS)return US;HS=1;var t=ux(),e=Dk(),n=cx(),r=function(){if(DS)return LS;DS=1;var t=$E(),e=dw(),n=lw();return LS=function(r){return"string"==typeof r||!e(r)&&n(r)&&"[object String]"==t(r)}}(),i=OT();return US=function(o){if(null==o)return 0;if(n(o))return r(o)?i(o):o.length;var a=e(o);return"[object Map]"==a||"[object Set]"==a?o.size:t(o).length}}function RT(){if($S)return qS;$S=1;var t=ow(),e=Fk(),n=Yk(),r=MT(),i=Ak(),o=dw(),a=Sw(),s=KE(),u=YE(),c=ix();return qS=function(l,h,d){var f=o(l),p=f||a(l)||c(l);if(h=r(h,4),null==d){var g=l&&l.constructor;d=p?f?new g:[]:u(l)&&s(g)?e(i(l)):{}}return(p?t:n)(l,(function(t,e,n){return h(d,t,e,n)})),d},qS}function LT(){if(ZS)return XS;ZS=1;var t=Pk(),e=function(){if(KS)return YS;KS=1;var t=qE(),e=hw(),n=dw(),r=t?t.isConcatSpreadable:void 0;return YS=function(t){return n(t)||e(t)||!!(r&&t&&t[r])}}();return XS=function n(r,i,o,a,s){var u=-1,c=r.length;for(o||(o=e),s||(s=[]);++u<c;){var l=r[u];i>0&&o(l)?i>1?n(l,i-1,o,a,s):t(s,l):a||(s[s.length]=l)}return s},XS}function DT(){if(eC)return tC;eC=1;var t=JS?QS:(JS=1,QS=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}),e=Math.max;return tC=function(n,r,i){return r=e(void 0===r?n.length-1:r,0),function(){for(var o=arguments,a=-1,s=e(o.length-r,0),u=Array(s);++a<s;)u[a]=o[r+a];a=-1;for(var c=Array(r+1);++a<r;)c[a]=o[a];return c[r]=i(u),t(n,this,c)}},tC}function IT(){if(sC)return aC;sC=1;var t=function(){if(rC)return nC;rC=1;var t=qk(),e=aw(),n=Xk();return nC=e?function(n,r){return e(n,"toString",{configurable:!0,enumerable:!1,value:t(r),writable:!0})}:n}(),e=function(){if(oC)return iC;oC=1;var t=Date.now;return iC=function(e){var n=0,r=0;return function(){var i=t(),o=16-(i-r);if(r=i,o>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}},iC}(),n=e(t);return aC=n}function jT(){if(cC)return uC;cC=1;var t=Xk(),e=DT(),n=IT();return uC=function(r,i){return n(e(r,i,t),r+"")}}function zT(){if(hC)return lC;return hC=1,lC=function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1},lC}function BT(){if(vC)return mC;vC=1;var t=zT(),e=fC?dC:(fC=1,dC=function(t){return t!=t}),n=(gC||(gC=1,pC=function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}),pC);return mC=function(r,i,o){return i==i?n(r,i,o):t(r,e,o)}}function FT(){if(SC)return NC;SC=1;var t=Lk(),e=MC?xC:(MC=1,xC=function(){}),n=rT(),r=t&&1/n(new t([,-0]))[1]==1/0?function(e){return new t(e)}:e;return NC=r}function GT(){if(kC)return CC;kC=1;var t=tT(),e=function(){if(bC)return yC;bC=1;var t=BT();return yC=function(e,n){return!(null==e||!e.length)&&t(e,n,0)>-1}}(),n=(wC||(wC=1,EC=function(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}),EC),r=eT(),i=FT(),o=rT();return CC=function(a,s,u){var c=-1,l=e,h=a.length,d=!0,f=[],p=f;if(u)d=!1,l=n;else if(h>=200){var g=s?null:i(a);if(g)return o(g);d=!1,l=r,p=new t}else p=s?[]:f;t:for(;++c<h;){var m=a[c],v=s?s(m):m;if(m=u||0!==m?m:0,d&&v==v){for(var y=p.length;y--;)if(p[y]===v)continue t;s&&p.push(v),f.push(m)}else l(p,v,u)||(p!==f&&p.push(v),f.push(m))}return f},CC}function VT(){if(PC)return TC;PC=1;var t=cx(),e=lw();return TC=function(n){return e(n)&&t(n)}}function WT(){if(OC)return AC;OC=1;var t=LT(),e=jT(),n=GT(),r=VT(),i=e((function(e){return n(t(e,1,r,!0))}));return AC=i}function UT(){if(DC)return LC;DC=1;var t=function(){if(RC)return _C;RC=1;var t=fT();return _C=function(e,n){return t(n,(function(t){return e[t]}))}}(),e=lx();return LC=function(n){return null==n?[]:t(n,e(n))}}function HT(){if(jC)return IC;var t;jC=1;try{t={clone:Hk(),constant:qk(),each:Jk(),filter:NT(),has:ST(),isArray:dw(),isEmpty:CT(),isFunction:KE(),isUndefined:kT(),keys:lx(),map:PT(),reduce:AT(),size:_T(),transform:RT(),union:WT(),values:UT()}}catch(t){}return t||(t=window._),IC=t}function qT(){if(BC)return zC;BC=1;var t=HT();zC=i;var e="\0",n="\0",r="";function i(e){this._isDirected=!t.has(e,"directed")||e.directed,this._isMultigraph=!!t.has(e,"multigraph")&&e.multigraph,this._isCompound=!!t.has(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=t.constant(void 0),this._defaultEdgeLabelFn=t.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function o(t,e){t[e]?t[e]++:t[e]=1}function a(t,e){--t[e]||delete t[e]}function s(n,i,o,a){var s=""+i,u=""+o;if(!n&&s>u){var c=s;s=u,u=c}return s+r+u+r+(t.isUndefined(a)?e:a)}function u(t,e){return s(t,e.v,e.w,e.name)}return i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(t){return this._label=t,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(e){return t.isFunction(e)||(e=t.constant(e)),this._defaultNodeLabelFn=e,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return t.keys(this._nodes)},i.prototype.sources=function(){var e=this;return t.filter(this.nodes(),(function(n){return t.isEmpty(e._in[n])}))},i.prototype.sinks=function(){var e=this;return t.filter(this.nodes(),(function(n){return t.isEmpty(e._out[n])}))},i.prototype.setNodes=function(e,n){var r=arguments,i=this;return t.each(e,(function(t){r.length>1?i.setNode(t,n):i.setNode(t)})),this},i.prototype.setNode=function(e,r){return t.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=r),this):(this._nodes[e]=arguments.length>1?r:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=n,this._children[e]={},this._children[n][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},i.prototype.node=function(t){return this._nodes[t]},i.prototype.hasNode=function(e){return t.has(this._nodes,e)},i.prototype.removeNode=function(e){var n=this;if(t.has(this._nodes,e)){var r=function(t){n.removeEdge(n._edgeObjs[t])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],t.each(this.children(e),(function(t){n.setParent(t)})),delete this._children[e]),t.each(t.keys(this._in[e]),r),delete this._in[e],delete this._preds[e],t.each(t.keys(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},i.prototype.setParent=function(e,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(r))r=n;else{for(var i=r+="";!t.isUndefined(i);i=this.parent(i))if(i===e)throw new Error("Setting "+r+" as parent of "+e+" would create a cycle");this.setNode(r)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=r,this._children[r][e]=!0,this},i.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},i.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==n)return e}},i.prototype.children=function(e){if(t.isUndefined(e)&&(e=n),this._isCompound){var r=this._children[e];if(r)return t.keys(r)}else{if(e===n)return this.nodes();if(this.hasNode(e))return[]}},i.prototype.predecessors=function(e){var n=this._preds[e];if(n)return t.keys(n)},i.prototype.successors=function(e){var n=this._sucs[e];if(n)return t.keys(n)},i.prototype.neighbors=function(e){var n=this.predecessors(e);if(n)return t.union(n,this.successors(e))},i.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},i.prototype.filterNodes=function(e){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;t.each(this._nodes,(function(t,r){e(r)&&n.setNode(r,t)})),t.each(this._edgeObjs,(function(t){n.hasNode(t.v)&&n.hasNode(t.w)&&n.setEdge(t,r.edge(t))}));var i={};function o(t){var e=r.parent(t);return void 0===e||n.hasNode(e)?(i[t]=e,e):e in i?i[e]:o(e)}return this._isCompound&&t.each(n.nodes(),(function(t){n.setParent(t,o(t))})),n},i.prototype.setDefaultEdgeLabel=function(e){return t.isFunction(e)||(e=t.constant(e)),this._defaultEdgeLabelFn=e,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return t.values(this._edgeObjs)},i.prototype.setPath=function(e,n){var r=this,i=arguments;return t.reduce(e,(function(t,e){return i.length>1?r.setEdge(t,e,n):r.setEdge(t,e),e})),this},i.prototype.setEdge=function(){var e,n,r,i,a=!1,u=arguments[0];"object"==typeof u&&null!==u&&"v"in u?(e=u.v,n=u.w,r=u.name,2===arguments.length&&(i=arguments[1],a=!0)):(e=u,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,n=""+n,t.isUndefined(r)||(r=""+r);var c=s(this._isDirected,e,n,r);if(t.has(this._edgeLabels,c))return a&&(this._edgeLabels[c]=i),this;if(!t.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[c]=a?i:this._defaultEdgeLabelFn(e,n,r);var l=function(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,e,n,r);return e=l.v,n=l.w,Object.freeze(l),this._edgeObjs[c]=l,o(this._preds[n],e),o(this._sucs[e],n),this._in[n][c]=l,this._out[e][c]=l,this._edgeCount++,this},i.prototype.edge=function(t,e,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):s(this._isDirected,t,e,n);return this._edgeLabels[r]},i.prototype.hasEdge=function(e,n,r){var i=1===arguments.length?u(this._isDirected,arguments[0]):s(this._isDirected,e,n,r);return t.has(this._edgeLabels,i)},i.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?u(this._isDirected,arguments[0]):s(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[e],t),a(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},i.prototype.inEdges=function(e,n){var r=this._in[e];if(r){var i=t.values(r);return n?t.filter(i,(function(t){return t.v===n})):i}},i.prototype.outEdges=function(e,n){var r=this._out[e];if(r){var i=t.values(r);return n?t.filter(i,(function(t){return t.w===n})):i}},i.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))},zC}function $T(){return WC?VC:(WC=1,VC={Graph:qT(),version:GC?FC:(GC=1,FC="2.1.8")})}function YT(){if(HC)return UC;HC=1;var t=HT(),e=qT();function n(e){return t.map(e.nodes(),(function(n){var r=e.node(n),i=e.parent(n),o={v:n};return t.isUndefined(r)||(o.value=r),t.isUndefined(i)||(o.parent=i),o}))}function r(e){return t.map(e.edges(),(function(n){var r=e.edge(n),i={v:n.v,w:n.w};return t.isUndefined(n.name)||(i.name=n.name),t.isUndefined(r)||(i.value=r),i}))}return UC={write:function(e){var i={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:n(e),edges:r(e)};t.isUndefined(e.graph())||(i.value=t.clone(e.graph()));return i},read:function(n){var r=new e(n.options).setGraph(n.value);return t.each(n.nodes,(function(t){r.setNode(t.v,t.value),t.parent&&r.setParent(t.v,t.parent)})),t.each(n.edges,(function(t){r.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),r}}}function KT(){if($C)return qC;$C=1;var t=HT();return qC=function(e){var n,r={},i=[];function o(i){t.has(r,i)||(r[i]=!0,n.push(i),t.each(e.successors(i),o),t.each(e.predecessors(i),o))}return t.each(e.nodes(),(function(t){n=[],o(t),n.length&&i.push(n)})),i},qC}function XT(){if(KC)return YC;KC=1;var t=HT();function e(){this._arr=[],this._keyIndices={}}return YC=e,e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},e.prototype.has=function(e){return t.has(this._keyIndices,e)},e.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},e.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(e,n){var r=this._keyIndices;if(e=String(e),!t.has(r,e)){var i=this._arr,o=i.length;return r[e]=o,i.push({key:e,priority:n}),this._decrease(o),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},e.prototype.decrease=function(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},e.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))},e.prototype._decrease=function(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e},e.prototype._swap=function(t,e){var n=this._arr,r=this._keyIndices,i=n[t],o=n[e];n[t]=o,n[e]=i,r[o.key]=t,r[i.key]=e},YC}function ZT(){if(ZC)return XC;ZC=1;var t=HT(),e=XT();XC=function(t,r,i,o){return function(t,n,r,i){var o,a,s={},u=new e,c=function(t){var e=t.v!==o?t.v:t.w,n=s[e],i=r(t),c=a.distance+i;if(i<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+i);c<n.distance&&(n.distance=c,n.predecessor=o,u.decrease(e,c))};t.nodes().forEach((function(t){var e=t===n?0:Number.POSITIVE_INFINITY;s[t]={distance:e},u.add(t,e)}));for(;u.size()>0&&(o=u.removeMin(),(a=s[o]).distance!==Number.POSITIVE_INFINITY);)i(o).forEach(c);return s}(t,String(r),i||n,o||function(e){return t.outEdges(e)})};var n=t.constant(1);return XC}function QT(){if(JC)return QC;JC=1;var t=ZT(),e=HT();return QC=function(n,r,i){return e.transform(n.nodes(),(function(e,o){e[o]=t(n,o,r,i)}),{})}}function JT(){if(ek)return tk;ek=1;var t=HT();return tk=function(e){var n=0,r=[],i={},o=[];function a(s){var u=i[s]={onStack:!0,lowlink:n,index:n++};if(r.push(s),e.successors(s).forEach((function(e){t.has(i,e)?i[e].onStack&&(u.lowlink=Math.min(u.lowlink,i[e].index)):(a(e),u.lowlink=Math.min(u.lowlink,i[e].lowlink))})),u.lowlink===u.index){var c,l=[];do{c=r.pop(),i[c].onStack=!1,l.push(c)}while(s!==c);o.push(l)}}return e.nodes().forEach((function(e){t.has(i,e)||a(e)})),o},tk}function tP(){if(rk)return nk;rk=1;var t=HT(),e=JT();return nk=function(n){return t.filter(e(n),(function(t){return t.length>1||1===t.length&&n.hasEdge(t[0],t[0])}))}}function eP(){if(ok)return ik;ok=1;var t=HT();ik=function(t,n,r){return function(t,e,n){var r={},i=t.nodes();return i.forEach((function(t){r[t]={},r[t][t]={distance:0},i.forEach((function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})})),n(t).forEach((function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}}))})),i.forEach((function(t){var e=r[t];i.forEach((function(n){var o=r[n];i.forEach((function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s<a.distance&&(a.distance=s,a.predecessor=i.predecessor)}))}))})),r}(t,n||e,r||function(e){return t.outEdges(e)})};var e=t.constant(1);return ik}function nP(){if(sk)return ak;sk=1;var t=HT();function e(e){var r={},i={},o=[];if(t.each(e.sinks(),(function a(s){if(t.has(i,s))throw new n;t.has(r,s)||(i[s]=!0,r[s]=!0,t.each(e.predecessors(s),a),delete i[s],o.push(s))})),t.size(r)!==e.nodeCount())throw new n;return o}function n(){}return ak=e,e.CycleException=n,n.prototype=new Error,ak}function rP(){if(ck)return uk;ck=1;var t=nP();return uk=function(e){try{t(e)}catch(e){if(e instanceof t.CycleException)return!1;throw e}return!0}}function iP(){if(hk)return lk;hk=1;var t=HT();function e(n,r,i,o,a,s){t.has(o,r)||(o[r]=!0,i||s.push(r),t.each(a(r),(function(t){e(n,t,i,o,a,s)})),i&&s.push(r))}return lk=function(n,r,i){t.isArray(r)||(r=[r]);var o=(n.isDirected()?n.successors:n.neighbors).bind(n),a=[],s={};return t.each(r,(function(t){if(!n.hasNode(t))throw new Error("Graph does not have node: "+t);e(n,t,"post"===i,s,o,a)})),a},lk}function oP(){if(fk)return dk;fk=1;var t=iP();return dk=function(e,n){return t(e,n,"post")}}function aP(){if(gk)return pk;gk=1;var t=iP();return pk=function(e,n){return t(e,n,"pre")}}function sP(){if(vk)return mk;vk=1;var t=HT(),e=qT(),n=XT();return mk=function(r,i){var o,a=new e,s={},u=new n;function c(t){var e=t.v===o?t.w:t.v,n=u.priority(e);if(void 0!==n){var r=i(t);r<n&&(s[e]=o,u.decrease(e,r))}}if(0===r.nodeCount())return a;t.each(r.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),a.setNode(t)})),u.decrease(r.nodes()[0],0);var l=!1;for(;u.size()>0;){if(o=u.removeMin(),t.has(s,o))a.setEdge(o,s[o]);else{if(l)throw new Error("Input graph is not connected: "+r);l=!0}r.nodeEdges(o).forEach(c)}return a}}Mk.exports;try{xk=function(){if(wk)return Ek;wk=1;var t=$T();return Ek={Graph:t.Graph,json:YT(),alg:bk?yk:(bk=1,yk={components:KT(),dijkstra:ZT(),dijkstraAll:QT(),findCycles:tP(),floydWarshall:eP(),isAcyclic:rP(),postorder:oP(),preorder:aP(),prim:sP(),tarjan:JT(),topsort:nP()}),version:t.version}}()}catch(t){}xk||(xk=window.graphlib);var uP,cP,lP,hP,dP,fP,pP,gP,mP,vP,yP,bP,EP,wP,xP,MP,NP,SP,CP,kP,TP,PP,AP,OP,_P,RP,LP,DP,IP,jP,zP,BP,FP,GP,VP,WP,UP,HP,qP,$P,YP,KP,XP,ZP,QP,JP,tA,eA,nA,rA,iA,oA,aA,sA,uA,cA,lA,hA,dA,fA,pA,gA,mA,vA,yA,bA,EA,wA,xA,MA,NA,SA,CA,kA,TA,PA,AA,OA,_A,RA,LA,DA,IA,jA,zA,BA,FA,GA,VA,WA,UA,HA,qA,$A=xk;function YA(){if(hP)return lP;hP=1;var t=GE(),e=cx(),n=Cw(),r=YE();return lP=function(i,o,a){if(!r(a))return!1;var s=typeof o;return!!("number"==s?e(a)&&n(o,a.length):"string"==s&&o in a)&&t(a[o],i)},lP}function KA(){if(bP)return yP;bP=1;var t=function(){if(vP)return mP;vP=1;var t=/\s/;return mP=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n},mP}(),e=/^\s+/;return yP=function(n){return n?n.slice(0,t(n)+1).replace(e,""):n}}function XA(){if(MP)return xP;MP=1;var t=function(){if(wP)return EP;wP=1;var t=KA(),e=YE(),n=lT(),r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;return EP=function(s){if("number"==typeof s)return s;if(n(s))return NaN;if(e(s)){var u="function"==typeof s.valueOf?s.valueOf():s;s=e(u)?u+"":u}if("string"!=typeof s)return 0===s?s:+s;s=t(s);var c=i.test(s);return c||o.test(s)?a(s.slice(2),c?2:8):r.test(s)?NaN:+s}}(),e=1/0;return xP=function(n){return n?(n=t(n))===e||n===-1/0?17976931348623157e292*(n<0?-1:1):n==n?n:0:0===n?n:0}}function ZA(){if(kP)return CP;kP=1;var t=zT(),e=MT(),n=function(){if(SP)return NP;SP=1;var t=XA();return NP=function(e){var n=t(e),r=n%1;return n==n?r?n-r:n:0}}(),r=Math.max;return CP=function(i,o,a){var s=null==i?0:i.length;if(!s)return-1;var u=null==a?0:n(a);return u<0&&(u=r(s+u,0)),t(i,e(o,3),u)},CP}function QA(){if(OP)return AP;OP=1;var t=LT();return AP=function(e){return(null==e?0:e.length)?t(e,1):[]}}function JA(){if(BP)return zP;BP=1;var t=lT();return zP=function(e,n,r){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=n(a);if(null!=s&&(void 0===u?s==s&&!t(s):r(s,u)))var u=s,c=a}return c},zP}function tO(){if(HP)return UP;HP=1;var t=sw(),e=GE();return UP=function(n,r,i){(void 0!==i&&!e(n[r],i)||void 0===i&&!(r in n))&&t(n,r,i)}}function eO(){if(KP)return YP;return KP=1,YP=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}}function nO(){if(JP)return QP;JP=1;var t=tO(),e=Nk(),n=zk(),r=Sk(),i=Gk(),o=hw(),a=dw(),s=VT(),u=Sw(),c=KE(),l=YE(),h=function(){if($P)return qP;$P=1;var t=$E(),e=Ak(),n=lw(),r=Function.prototype,i=Object.prototype,o=r.toString,a=i.hasOwnProperty,s=o.call(Object);return qP=function(r){if(!n(r)||"[object Object]"!=t(r))return!1;var i=e(r);if(null===i)return!0;var u=a.call(i,"constructor")&&i.constructor;return"function"==typeof u&&u instanceof u&&o.call(u)==s}}(),d=ix(),f=eO(),p=function(){if(ZP)return XP;ZP=1;var t=cw(),e=dx();return XP=function(n){return t(n,e(n))}}();return QP=function(g,m,v,y,b,E,w){var x=f(g,v),M=f(m,v),N=w.get(M);if(N)t(g,v,N);else{var S=E?E(x,M,v+"",g,m,w):void 0,C=void 0===S;if(C){var k=a(M),T=!k&&u(M),P=!k&&!T&&d(M);S=M,k||T||P?a(x)?S=x:s(x)?S=r(x):T?(C=!1,S=e(M,!0)):P?(C=!1,S=n(M,!0)):S=[]:h(M)||o(M)?(S=x,o(x)?S=p(x):l(x)&&!c(x)||(S=i(M))):C=!1}C&&(w.set(M,S),b(S,M,y,E,w),w.delete(M)),t(g,v,S)}}}function rO(){if(sA)return aA;return sA=1,aA=function(t,e){return t<e}}function iO(){if(vA)return mA;vA=1;var t=vT(),e=function(){if(gA)return pA;gA=1;var t=uw(),e=gT(),n=Cw(),r=YE(),i=mT();return pA=function(o,a,s,u){if(!r(o))return o;for(var c=-1,l=(a=e(a,o)).length,h=l-1,d=o;null!=d&&++c<l;){var f=i(a[c]),p=s;if("__proto__"===f||"constructor"===f||"prototype"===f)return o;if(c!=h){var g=d[f];void 0===(p=u?u(g,f,d):void 0)&&(p=r(g)?g:n(a[c+1])?[]:{})}t(d,f,p),d=d[f]}return o},pA}(),n=gT();return mA=function(r,i,o){for(var a=-1,s=i.length,u={};++a<s;){var c=i[a],l=t(r,c);o(l,c)&&e(u,n(c,r),l)}return u},mA}function oO(){if(kA)return CA;kA=1;var t=function(){if(SA)return NA;SA=1;var t=Math.ceil,e=Math.max;return NA=function(n,r,i,o){for(var a=-1,s=e(t((r-n)/(i||1)),0),u=Array(s);s--;)u[o?s:++a]=n,n+=i;return u},NA}(),e=YA(),n=XA();return CA=function(r){return function(i,o,a){return a&&"number"!=typeof a&&e(i,o,a)&&(o=a=void 0),i=n(i),void 0===o?(o=i,i=0):o=n(o),a=void 0===a?i<o?1:-1:n(a),t(i,o,a,r)}},CA}function aO(){if(DA)return LA;DA=1;var t=function(){if(RA)return _A;RA=1;var t=lT();return _A=function(e,n){if(e!==n){var r=void 0!==e,i=null===e,o=e==e,a=t(e),s=void 0!==n,u=null===n,c=n==n,l=t(n);if(!u&&!l&&!a&&e>n||a&&s&&c&&!u&&!l||i&&s&&c||!r&&c||!o)return 1;if(!i&&!a&&!l&&e<n||l&&r&&o&&!i&&!a||u&&r&&o||!s&&o||!c)return-1}return 0}}();return LA=function(e,n,r){for(var i=-1,o=e.criteria,a=n.criteria,s=o.length,u=r.length;++i<s;){var c=t(o[i],a[i]);if(c)return i>=u?c:c*("desc"==r[i]?-1:1)}return e.index-n.index},LA}function sO(){if(jA)return IA;jA=1;var t=fT(),e=vT(),n=MT(),r=TT(),i=(OA||(OA=1,AA=function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}),AA),o=Tw(),a=aO(),s=Xk(),u=dw();return IA=function(c,l,h){l=l.length?t(l,(function(t){return u(t)?function(n){return e(n,1===t.length?t[0]:t)}:t})):[s];var d=-1;l=t(l,o(n));var f=r(c,(function(e,n,r){return{criteria:t(l,(function(t){return t(e)})),index:++d,value:e}}));return i(f,(function(t,e){return a(t,e,h)}))},IA}try{qA={cloneDeep:function(){if(cP)return uP;cP=1;var t=Uk();return uP=function(e){return t(e,5)}}(),constant:qk(),defaults:function(){if(fP)return dP;fP=1;var t=jT(),e=GE(),n=YA(),r=dx(),i=Object.prototype,o=i.hasOwnProperty,a=t((function(t,a){t=Object(t);var s=-1,u=a.length,c=u>2?a[2]:void 0;for(c&&n(a[0],a[1],c)&&(u=1);++s<u;)for(var l=a[s],h=r(l),d=-1,f=h.length;++d<f;){var p=h[d],g=t[p];(void 0===g||e(g,i[p])&&!o.call(t,p))&&(t[p]=l[p])}return t}));return dP=a}(),each:Jk(),filter:NT(),find:function(){if(PP)return TP;PP=1;var t=function(){if(gP)return pP;gP=1;var t=MT(),e=cx(),n=lx();return pP=function(r){return function(i,o,a){var s=Object(i);if(!e(i)){var u=t(o,3);i=n(i),o=function(t){return u(s[t],t,s)}}var c=r(i,o,a);return c>-1?s[u?i[c]:c]:void 0}},pP}(),e=t(ZA());return TP=e}(),flatten:QA(),forEach:Qk(),forIn:function(){if(RP)return _P;RP=1;var t=$k(),e=Zk(),n=dx();return _P=function(r,i){return null==r?r:t(r,e(i),n)}}(),has:ST(),isUndefined:kT(),last:(DP||(DP=1,LP=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}),LP),map:PT(),mapValues:function(){if(jP)return IP;jP=1;var t=sw(),e=Yk(),n=MT();return IP=function(r,i){var o={};return i=n(i,3),e(r,(function(e,n,r){t(o,n,i(e,n,r))})),o}}(),max:function(){if(WP)return VP;WP=1;var t=JA(),e=GP?FP:(GP=1,FP=function(t,e){return t>e}),n=Xk();return VP=function(r){return r&&r.length?t(r,n,e):void 0}}(),merge:function(){if(oA)return iA;oA=1;var t=function(){if(eA)return tA;eA=1;var t=iw(),e=tO(),n=$k(),r=nO(),i=YE(),o=dx(),a=eO();return tA=function s(u,c,l,h,d){u!==c&&n(c,(function(n,o){if(d||(d=new t),i(n))r(u,c,o,l,s,h,d);else{var f=h?h(a(u,o),n,o+"",u,c,d):void 0;void 0===f&&(f=n),e(u,o,f)}}),o)},tA}(),e=function(){if(rA)return nA;rA=1;var t=jT(),e=YA();return nA=function(n){return t((function(t,r){var i=-1,o=r.length,a=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(a=n.length>3&&"function"==typeof a?(o--,a):void 0,s&&e(r[0],r[1],s)&&(a=o<3?void 0:a,o=1),t=Object(t);++i<o;){var u=r[i];u&&n(t,u,i,a)}return t}))},nA}(),n=e((function(e,n,r){t(e,n,r)}));return iA=n}(),min:function(){if(cA)return uA;cA=1;var t=JA(),e=rO(),n=Xk();return uA=function(r){return r&&r.length?t(r,n,e):void 0}}(),minBy:function(){if(hA)return lA;hA=1;var t=JA(),e=MT(),n=rO();return lA=function(r,i){return r&&r.length?t(r,e(i,2),n):void 0}}(),now:function(){if(fA)return dA;fA=1;var t=HE();return dA=function(){return t.Date.now()}}(),pick:function(){if(MA)return xA;MA=1;var t=function(){if(bA)return yA;bA=1;var t=iO(),e=bT();return yA=function(n,r){return t(n,r,(function(t,r){return e(n,r)}))}}(),e=function(){if(wA)return EA;wA=1;var t=QA(),e=DT(),n=IT();return EA=function(r){return n(e(r,void 0,t),r+"")}}(),n=e((function(e,n){return null==e?{}:t(e,n)}));return xA=n}(),range:function(){if(PA)return TA;PA=1;var t=oO()();return TA=t}(),reduce:AT(),sortBy:function(){if(BA)return zA;BA=1;var t=LT(),e=sO(),n=jT(),r=YA(),i=n((function(n,i){if(null==n)return[];var o=i.length;return o>1&&r(n,i[0],i[1])?i=[]:o>2&&r(i[0],i[1],i[2])&&(i=[i[0]]),e(n,t(i,1),[])}));return zA=i}(),uniqueId:function(){if(GA)return FA;GA=1;var t=pT(),e=0;return FA=function(n){var r=++e;return t(n)+r},FA}(),values:UT(),zipObject:function(){if(HA)return UA;HA=1;var t=uw(),e=(WA||(WA=1,VA=function(t,e,n){for(var r=-1,i=t.length,o=e.length,a={};++r<i;){var s=r<o?e[r]:void 0;n(a,t[r],s)}return a}),VA);return UA=function(n,r){return e(n||[],r||[],t)},UA}()}}catch(t){}qA||(qA=window._);var uO=qA,cO=lO;function lO(){var t={};t._next=t._prev=t,this._sentinel=t}function hO(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function dO(t,e){if("_next"!==t&&"_prev"!==t)return e}lO.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return hO(e),e},lO.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&hO(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},lO.prototype.toString=function(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,dO)),n=n._prev;return"["+t.join(", ")+"]"};var fO=uO,pO=$A.Graph,gO=cO,mO=function(t,e){if(t.nodeCount()<=1)return[];var n=function(t,e){var n=new pO,r=0,i=0;fO.forEach(t.nodes(),(function(t){n.setNode(t,{v:t,in:0,out:0})})),fO.forEach(t.edges(),(function(t){var o=n.edge(t.v,t.w)||0,a=e(t),s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)}));var o=fO.range(i+r+3).map((function(){return new gO})),a=r+1;return fO.forEach(n.nodes(),(function(t){bO(o,a,n.node(t))})),{graph:n,buckets:o,zeroIdx:a}}(t,e||vO),r=function(t,e,n){var r,i=[],o=e[e.length-1],a=e[0];for(;t.nodeCount();){for(;r=a.dequeue();)yO(t,e,n,r);for(;r=o.dequeue();)yO(t,e,n,r);if(t.nodeCount())for(var s=e.length-2;s>0;--s)if(r=e[s].dequeue()){i=i.concat(yO(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return fO.flatten(fO.map(r,(function(e){return t.outEdges(e.v,e.w)})),!0)},vO=fO.constant(1);function yO(t,e,n,r,i){var o=i?[]:void 0;return fO.forEach(t.inEdges(r.v),(function(r){var a=t.edge(r),s=t.node(r.v);i&&o.push({v:r.v,w:r.w}),s.out-=a,bO(e,n,s)})),fO.forEach(t.outEdges(r.v),(function(r){var i=t.edge(r),o=r.w,a=t.node(o);a.in-=i,bO(e,n,a)})),t.removeNode(r.v),o}function bO(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}var EO=uO,wO=mO,xO={run:function(t){var e="greedy"===t.graph().acyclicer?wO(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},r={};function i(o){EO.has(r,o)||(r[o]=!0,n[o]=!0,EO.forEach(t.outEdges(o),(function(t){EO.has(n,t.w)?e.push(t):i(t.w)})),delete n[o])}return EO.forEach(t.nodes(),i),e}(t);EO.forEach(e,(function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,EO.uniqueId("rev"))}))},undo:function(t){EO.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}};var MO=uO,NO=$A.Graph,SO={addDummyNode:CO,simplify:function(t){var e=(new NO).setGraph(t.graph());return MO.forEach(t.nodes(),(function(n){e.setNode(n,t.node(n))})),MO.forEach(t.edges(),(function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e},asNonCompoundGraph:function(t){var e=new NO({multigraph:t.isMultigraph()}).setGraph(t.graph());return MO.forEach(t.nodes(),(function(n){t.children(n).length||e.setNode(n,t.node(n))})),MO.forEach(t.edges(),(function(n){e.setEdge(n,t.edge(n))})),e},successorWeights:function(t){var e=MO.map(t.nodes(),(function(e){var n={};return MO.forEach(t.outEdges(e),(function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight})),n}));return MO.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=MO.map(t.nodes(),(function(e){var n={};return MO.forEach(t.inEdges(e),(function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight})),n}));return MO.zipObject(t.nodes(),e)},intersectRect:function(t,e){var n,r,i=t.x,o=t.y,a=e.x-i,s=e.y-o,u=t.width/2,c=t.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*u>Math.abs(a)*c?(s<0&&(c=-c),n=c*a/s,r=c):(a<0&&(u=-u),n=u,r=u*s/a);return{x:i+n,y:o+r}},buildLayerMatrix:function(t){var e=MO.map(MO.range(kO(t)+1),(function(){return[]}));return MO.forEach(t.nodes(),(function(n){var r=t.node(n),i=r.rank;MO.isUndefined(i)||(e[i][r.order]=n)})),e},normalizeRanks:function(t){var e=MO.min(MO.map(t.nodes(),(function(e){return t.node(e).rank})));MO.forEach(t.nodes(),(function(n){var r=t.node(n);MO.has(r,"rank")&&(r.rank-=e)}))},removeEmptyRanks:function(t){var e=MO.min(MO.map(t.nodes(),(function(e){return t.node(e).rank}))),n=[];MO.forEach(t.nodes(),(function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)}));var r=0,i=t.graph().nodeRankFactor;MO.forEach(n,(function(e,n){MO.isUndefined(e)&&n%i!=0?--r:r&&MO.forEach(e,(function(e){t.node(e).rank+=r}))}))},addBorderNode:function(t,e,n,r){var i={width:0,height:0};arguments.length>=4&&(i.rank=n,i.order=r);return CO(t,"border",i,e)},maxRank:kO,partition:function(t,e){var n={lhs:[],rhs:[]};return MO.forEach(t,(function(t){e(t)?n.lhs.push(t):n.rhs.push(t)})),n},time:function(t,e){var n=MO.now();try{return e()}finally{console.log(t+" time: "+(MO.now()-n)+"ms")}},notime:function(t,e){return e()}};function CO(t,e,n,r){var i;do{i=MO.uniqueId(r)}while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i}function kO(t){return MO.max(MO.map(t.nodes(),(function(e){var n=t.node(e).rank;if(!MO.isUndefined(n))return n})))}var TO=uO,PO=SO,AO={run:function(t){t.graph().dummyChains=[],TO.forEach(t.edges(),(function(e){!function(t,e){var n,r,i,o=e.v,a=t.node(o).rank,s=e.w,u=t.node(s).rank,c=e.name,l=t.edge(e),h=l.labelRank;if(u===a+1)return;for(t.removeEdge(e),i=0,++a;a<u;++i,++a)l.points=[],r={width:0,height:0,edgeLabel:l,edgeObj:e,rank:a},n=PO.addDummyNode(t,"edge",r,"_d"),a===h&&(r.width=l.width,r.height=l.height,r.dummy="edge-label",r.labelpos=l.labelpos),t.setEdge(o,n,{weight:l.weight},c),0===i&&t.graph().dummyChains.push(n),o=n;t.setEdge(o,s,{weight:l.weight},c)}(t,e)}))},undo:function(t){TO.forEach(t.graph().dummyChains,(function(e){var n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)}))}};var OO=uO,_O={longestPath:function(t){var e={};OO.forEach(t.sources(),(function n(r){var i=t.node(r);if(OO.has(e,r))return i.rank;e[r]=!0;var o=OO.min(OO.map(t.outEdges(r),(function(e){return n(e.w)-t.edge(e).minlen})));return o!==Number.POSITIVE_INFINITY&&null!=o||(o=0),i.rank=o}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}};var RO=uO,LO=$A.Graph,DO=_O.slack,IO=function(t){var e,n,r=new LO({directed:!1}),i=t.nodes()[0],o=t.nodeCount();r.setNode(i,{});for(;jO(r,t)<o;)e=zO(r,t),n=r.hasNode(e.v)?DO(t,e):-DO(t,e),BO(r,t,n);return r};function jO(t,e){return RO.forEach(t.nodes(),(function n(r){RO.forEach(e.nodeEdges(r),(function(i){var o=i.v,a=r===o?i.w:o;t.hasNode(a)||DO(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))}))})),t.nodeCount()}function zO(t,e){return RO.minBy(e.edges(),(function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return DO(e,n)}))}function BO(t,e,n){RO.forEach(t.nodes(),(function(t){e.node(t).rank+=n}))}var FO=uO,GO=IO,VO=_O.slack,WO=_O.longestPath,UO=$A.alg.preorder,HO=$A.alg.postorder,qO=SO.simplify,$O=YO;function YO(t){t=qO(t),WO(t);var e,n=GO(t);for(ZO(n),KO(n,t);e=JO(n);)e_(n,t,e,t_(n,t,e))}function KO(t,e){var n=HO(t,t.nodes());n=n.slice(0,n.length-1),FO.forEach(n,(function(n){!function(t,e,n){var r=t.node(n),i=r.parent;t.edge(n,i).cutvalue=XO(t,e,n)}(t,e,n)}))}function XO(t,e,n){var r=t.node(n).parent,i=!0,o=e.edge(n,r),a=0;return o||(i=!1,o=e.edge(r,n)),a=o.weight,FO.forEach(e.nodeEdges(n),(function(o){var s,u,c=o.v===n,l=c?o.w:o.v;if(l!==r){var h=c===i,d=e.edge(o).weight;if(a+=h?d:-d,s=n,u=l,t.hasEdge(s,u)){var f=t.edge(n,l).cutvalue;a+=h?-f:f}}})),a}function ZO(t,e){arguments.length<2&&(e=t.nodes()[0]),QO(t,{},1,e)}function QO(t,e,n,r,i){var o=n,a=t.node(r);return e[r]=!0,FO.forEach(t.neighbors(r),(function(i){FO.has(e,i)||(n=QO(t,e,n,i,r))})),a.low=o,a.lim=n++,i?a.parent=i:delete a.parent,n}function JO(t){return FO.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function t_(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var o=t.node(r),a=t.node(i),s=o,u=!1;o.lim>a.lim&&(s=a,u=!0);var c=FO.filter(e.edges(),(function(e){return u===n_(t,t.node(e.v),s)&&u!==n_(t,t.node(e.w),s)}));return FO.minBy(c,(function(t){return VO(e,t)}))}function e_(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),ZO(t),KO(t,e),function(t,e){var n=FO.find(t.nodes(),(function(t){return!e.node(t).parent})),r=UO(t,n);r=r.slice(1),FO.forEach(r,(function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))}(t,e)}function n_(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}YO.initLowLimValues=ZO,YO.initCutValues=KO,YO.calcCutValue=XO,YO.leaveEdge=JO,YO.enterEdge=t_,YO.exchangeEdges=e_;var r_=_O.longestPath,i_=IO,o_=$O,a_=function(t){switch(t.graph().ranker){case"network-simplex":default:u_(t);break;case"tight-tree":!function(t){r_(t),i_(t)}(t);break;case"longest-path":s_(t)}};var s_=r_;function u_(t){o_(t)}var c_=uO,l_=function(t){var e=function(t){var e={},n=0;function r(i){var o=n;c_.forEach(t.children(i),r),e[i]={low:o,lim:n++}}return c_.forEach(t.children(),r),e}(t);c_.forEach(t.graph().dummyChains,(function(n){for(var r=t.node(n),i=r.edgeObj,o=function(t,e,n,r){var i,o,a=[],s=[],u=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>u||c>e[i].lim));o=i,i=r;for(;(i=t.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}(t,e,i.v,i.w),a=o.path,s=o.lca,u=0,c=a[u],l=!0;n!==i.w;){if(r=t.node(n),l){for(;(c=a[u])!==s&&t.node(c).maxRank<r.rank;)u++;c===s&&(l=!1)}if(!l){for(;u<a.length-1&&t.node(c=a[u+1]).minRank<=r.rank;)u++;c=a[u]}t.setParent(n,c),n=t.successors(n)[0]}}))};var h_=uO,d_=SO,f_={run:function(t){var e=d_.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var o=t.children(r);o&&o.length&&h_.forEach(o,(function(t){n(t,i+1)})),e[r]=i}return h_.forEach(t.children(),(function(t){n(t,1)})),e}(t),r=h_.max(h_.values(n))-1,i=2*r+1;t.graph().nestingRoot=e,h_.forEach(t.edges(),(function(e){t.edge(e).minlen*=i}));var o=function(t){return h_.reduce(t.edges(),(function(e,n){return e+t.edge(n).weight}),0)}(t)+1;h_.forEach(t.children(),(function(a){p_(t,e,i,o,r,n,a)})),t.graph().nodeRankFactor=i},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,h_.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}};function p_(t,e,n,r,i,o,a){var s=t.children(a);if(s.length){var u=d_.addBorderNode(t,"_bt"),c=d_.addBorderNode(t,"_bb"),l=t.node(a);t.setParent(u,a),l.borderTop=u,t.setParent(c,a),l.borderBottom=c,h_.forEach(s,(function(s){p_(t,e,n,r,i,o,s);var l=t.node(s),h=l.borderTop?l.borderTop:s,d=l.borderBottom?l.borderBottom:s,f=l.borderTop?r:2*r,p=h!==d?1:i-o[a]+1;t.setEdge(u,h,{weight:f,minlen:p,nestingEdge:!0}),t.setEdge(d,c,{weight:f,minlen:p,nestingEdge:!0})})),t.parent(a)||t.setEdge(e,u,{weight:0,minlen:i+o[a]})}else a!==e&&t.setEdge(e,a,{weight:0,minlen:n})}var g_=uO,m_=SO,v_=function(t){g_.forEach(t.children(),(function e(n){var r=t.children(n),i=t.node(n);if(r.length&&g_.forEach(r,e),g_.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;++o)y_(t,"borderLeft","_bl",n,i,o),y_(t,"borderRight","_br",n,i,o)}}))};function y_(t,e,n,r,i,o){var a={width:0,height:0,rank:o,borderType:e},s=i[e][o-1],u=m_.addDummyNode(t,"border",a,n);i[e][o]=u,t.setParent(u,r),s&&t.setEdge(s,u,{weight:1})}var b_=uO,E_={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||w_(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){b_.forEach(t.nodes(),(function(e){M_(t.node(e))})),b_.forEach(t.edges(),(function(e){var n=t.edge(e);b_.forEach(n.points,M_),b_.has(n,"y")&&M_(n)}))}(t);"lr"!==e&&"rl"!==e||(!function(t){b_.forEach(t.nodes(),(function(e){N_(t.node(e))})),b_.forEach(t.edges(),(function(e){var n=t.edge(e);b_.forEach(n.points,N_),b_.has(n,"x")&&N_(n)}))}(t),w_(t))}};function w_(t){b_.forEach(t.nodes(),(function(e){x_(t.node(e))})),b_.forEach(t.edges(),(function(e){x_(t.edge(e))}))}function x_(t){var e=t.width;t.width=t.height,t.height=e}function M_(t){t.y=-t.y}function N_(t){var e=t.x;t.x=t.y,t.y=e}var S_=uO,C_=function(t){var e={},n=S_.filter(t.nodes(),(function(e){return!t.children(e).length})),r=S_.max(S_.map(n,(function(e){return t.node(e).rank}))),i=S_.map(S_.range(r+1),(function(){return[]}));function o(n){if(!S_.has(e,n)){e[n]=!0;var r=t.node(n);i[r.rank].push(n),S_.forEach(t.successors(n),o)}}var a=S_.sortBy(n,(function(e){return t.node(e).rank}));return S_.forEach(a,o),i};var k_=uO,T_=function(t,e){for(var n=0,r=1;r<e.length;++r)n+=P_(t,e[r-1],e[r]);return n};function P_(t,e,n){for(var r=k_.zipObject(n,k_.map(n,(function(t,e){return e}))),i=k_.flatten(k_.map(e,(function(e){return k_.sortBy(k_.map(t.outEdges(e),(function(e){return{pos:r[e.w],weight:t.edge(e).weight}})),"pos")})),!0),o=1;o<n.length;)o<<=1;var a=2*o-1;o-=1;var s=k_.map(new Array(a),(function(){return 0})),u=0;return k_.forEach(i.forEach((function(t){var e=t.pos+o;s[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=s[e+1]),s[e=e-1>>1]+=t.weight;u+=t.weight*n}))),u}var A_=uO;var O_=uO,__=function(t,e){var n={};return O_.forEach(t,(function(t,e){var r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};O_.isUndefined(t.barycenter)||(r.barycenter=t.barycenter,r.weight=t.weight)})),O_.forEach(e.edges(),(function(t){var e=n[t.v],r=n[t.w];O_.isUndefined(e)||O_.isUndefined(r)||(r.indegree++,e.out.push(n[t.w]))})),function(t){var e=[];function n(t){return function(e){e.merged||(O_.isUndefined(e.barycenter)||O_.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&function(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return function(n){n.in.push(e),0==--n.indegree&&t.push(n)}}for(;t.length;){var i=t.pop();e.push(i),O_.forEach(i.in.reverse(),n(i)),O_.forEach(i.out,r(i))}return O_.map(O_.filter(e,(function(t){return!t.merged})),(function(t){return O_.pick(t,["vs","i","barycenter","weight"])}))}(O_.filter(n,(function(t){return!t.indegree})))};var R_=uO,L_=SO;function D_(t,e,n){for(var r;e.length&&(r=R_.last(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}var I_=uO,j_=function(t,e){return A_.map(e,(function(e){var n=t.inEdges(e);if(n.length){var r=A_.reduce(n,(function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}}))},z_=__,B_=function(t,e){var n=L_.partition(t,(function(t){return R_.has(t,"barycenter")})),r=n.lhs,i=R_.sortBy(n.rhs,(function(t){return-t.i})),o=[],a=0,s=0,u=0;r.sort((c=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:c?e.i-t.i:t.i-e.i})),u=D_(o,i,u),R_.forEach(r,(function(t){u+=t.vs.length,o.push(t.vs),a+=t.barycenter*t.weight,s+=t.weight,u=D_(o,i,u)}));var c;var l={vs:R_.flatten(o,!0)};s&&(l.barycenter=a/s,l.weight=s);return l},F_=function t(e,n,r,i){var o=e.children(n),a=e.node(n),s=a?a.borderLeft:void 0,u=a?a.borderRight:void 0,c={};s&&(o=I_.filter(o,(function(t){return t!==s&&t!==u})));var l=j_(e,o);I_.forEach(l,(function(n){if(e.children(n.v).length){var o=t(e,n.v,r,i);c[n.v]=o,I_.has(o,"barycenter")&&(a=n,s=o,I_.isUndefined(a.barycenter)?(a.barycenter=s.barycenter,a.weight=s.weight):(a.barycenter=(a.barycenter*a.weight+s.barycenter*s.weight)/(a.weight+s.weight),a.weight+=s.weight))}var a,s}));var h=z_(l,r);!function(t,e){I_.forEach(t,(function(t){t.vs=I_.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(h,c);var d=B_(h,i);if(s&&(d.vs=I_.flatten([s,d.vs,u],!0),e.predecessors(s).length)){var f=e.node(e.predecessors(s)[0]),p=e.node(e.predecessors(u)[0]);I_.has(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d};var G_=uO,V_=$A.Graph,W_=function(t,e,n){var r=function(t){var e;for(;t.hasNode(e=G_.uniqueId("_root")););return e}(t),i=new V_({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return t.node(e)}));return G_.forEach(t.nodes(),(function(o){var a=t.node(o),s=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(i.setNode(o),i.setParent(o,s||r),G_.forEach(t[n](o),(function(e){var n=e.v===o?e.w:e.v,r=i.edge(n,o),a=G_.isUndefined(r)?0:r.weight;i.setEdge(n,o,{weight:t.edge(e).weight+a})})),G_.has(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),i};var U_=uO;var H_=uO,q_=C_,$_=T_,Y_=F_,K_=W_,X_=function(t,e,n){var r,i={};U_.forEach(n,(function(n){for(var o,a,s=t.parent(n);s;){if((o=t.parent(s))?(a=i[o],i[o]=s):(a=r,r=s),a&&a!==s)return void e.setEdge(a,s);s=o}}))},Z_=$A.Graph,Q_=SO,J_=function(t){var e=Q_.maxRank(t),n=tR(t,H_.range(1,e+1),"inEdges"),r=tR(t,H_.range(e-1,-1,-1),"outEdges"),i=q_(t);nR(t,i);for(var o,a=Number.POSITIVE_INFINITY,s=0,u=0;u<4;++s,++u){eR(s%2?n:r,s%4>=2),i=Q_.buildLayerMatrix(t);var c=$_(t,i);c<a&&(u=0,o=H_.cloneDeep(i),a=c)}nR(t,o)};function tR(t,e,n){return H_.map(e,(function(e){return K_(t,e,n)}))}function eR(t,e){var n=new Z_;H_.forEach(t,(function(t){var r=t.graph().root,i=Y_(t,r,n,e);H_.forEach(i.vs,(function(e,n){t.node(e).order=n})),X_(t,n,i.vs)}))}function nR(t,e){H_.forEach(e,(function(e){H_.forEach(e,(function(e,n){t.node(e).order=n}))}))}var rR=uO,iR=$A.Graph,oR=SO,aR=function(t){var e,n=oR.buildLayerMatrix(t),r=rR.merge(sR(t,n),uR(t,n)),i={};rR.forEach(["u","d"],(function(o){e="u"===o?n:rR.values(n).reverse(),rR.forEach(["l","r"],(function(n){"r"===n&&(e=rR.map(e,(function(t){return rR.values(t).reverse()})));var a=("u"===o?t.predecessors:t.successors).bind(t),s=hR(t,e,r,a),u=dR(t,e,s.root,s.align,"r"===n);"r"===n&&(u=rR.mapValues(u,(function(t){return-t}))),i[o+n]=u}))}));var o=fR(t,i);return pR(i,o),gR(i,t.graph().align)};function sR(t,e){var n={};return rR.reduce(e,(function(e,r){var i=0,o=0,a=e.length,s=rR.last(r);return rR.forEach(r,(function(e,u){var c=function(t,e){if(t.node(e).dummy)return rR.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=c?t.node(c).order:a;(c||e===s)&&(rR.forEach(r.slice(o,u+1),(function(e){rR.forEach(t.predecessors(e),(function(r){var o=t.node(r),a=o.order;!(a<i||l<a)||o.dummy&&t.node(e).dummy||cR(n,r,e)}))})),o=u+1,i=l)})),r})),n}function uR(t,e){var n={};function r(e,r,i,o,a){var s;rR.forEach(rR.range(r,i),(function(r){s=e[r],t.node(s).dummy&&rR.forEach(t.predecessors(s),(function(e){var r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&cR(n,e,s)}))}))}return rR.reduce(e,(function(e,n){var i,o=-1,a=0;return rR.forEach(n,(function(s,u){if("border"===t.node(s).dummy){var c=t.predecessors(s);c.length&&(i=t.node(c[0]).order,r(n,a,u,o,i),a=u,o=i)}r(n,a,n.length,i,e.length)})),n})),n}function cR(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function lR(t,e,n){if(e>n){var r=e;e=n,n=r}return rR.has(t[e],n)}function hR(t,e,n,r){var i={},o={},a={};return rR.forEach(e,(function(t){rR.forEach(t,(function(t,e){i[t]=t,o[t]=t,a[t]=e}))})),rR.forEach(e,(function(t){var e=-1;rR.forEach(t,(function(t){var s=r(t);if(s.length){s=rR.sortBy(s,(function(t){return a[t]}));for(var u=(s.length-1)/2,c=Math.floor(u),l=Math.ceil(u);c<=l;++c){var h=s[c];o[t]===t&&e<a[h]&&!lR(n,t,h)&&(o[h]=t,o[t]=i[t]=i[h],e=a[h])}}}))})),{root:i,align:o}}function dR(t,e,n,r,i){var o={},a=function(t,e,n,r){var i=new iR,o=t.graph(),a=function(t,e,n){return function(r,i,o){var a,s=r.node(i),u=r.node(o),c=0;if(c+=s.width/2,rR.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2}if(a&&(c+=n?a:-a),a=0,c+=(s.dummy?e:t)/2,c+=(u.dummy?e:t)/2,c+=u.width/2,rR.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=u.width/2;break;case"r":a=-u.width/2}return a&&(c+=n?a:-a),a=0,c}}(o.nodesep,o.edgesep,r);return rR.forEach(e,(function(e){var r;rR.forEach(e,(function(e){var o=n[e];if(i.setNode(o),r){var s=n[r],u=i.edge(s,o);i.setEdge(s,o,Math.max(a(t,e,r),u||0))}r=e}))})),i}(t,e,n,i),s=i?"borderLeft":"borderRight";function u(t,e){for(var n=a.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}return u((function(t){o[t]=a.inEdges(t).reduce((function(t,e){return Math.max(t,o[e.v]+a.edge(e))}),0)}),a.predecessors.bind(a)),u((function(e){var n=a.outEdges(e).reduce((function(t,e){return Math.min(t,o[e.w]-a.edge(e))}),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==s&&(o[e]=Math.max(o[e],n))}),a.successors.bind(a)),rR.forEach(r,(function(t){o[t]=o[n[t]]})),o}function fR(t,e){return rR.minBy(rR.values(e),(function(e){var n=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return rR.forIn(e,(function(e,i){var o=function(t,e){return t.node(e).width}(t,i)/2;n=Math.max(e+o,n),r=Math.min(e-o,r)})),n-r}))}function pR(t,e){var n=rR.values(e),r=rR.min(n),i=rR.max(n);rR.forEach(["u","d"],(function(n){rR.forEach(["l","r"],(function(o){var a,s=n+o,u=t[s];if(u!==e){var c=rR.values(u);(a="l"===o?r-rR.min(c):i-rR.max(c))&&(t[s]=rR.mapValues(u,(function(t){return t+a})))}}))}))}function gR(t,e){return rR.mapValues(t.ul,(function(n,r){if(e)return t[e.toLowerCase()][r];var i=rR.sortBy(rR.map(t,r));return(i[1]+i[2])/2}))}var mR=uO,vR=SO,yR=aR,bR=function(t){(function(t){var e=vR.buildLayerMatrix(t),n=t.graph().ranksep,r=0;mR.forEach(e,(function(e){var i=mR.max(mR.map(e,(function(e){return t.node(e).height})));mR.forEach(e,(function(e){t.node(e).y=r+i/2})),r+=i+n}))})(t=vR.asNonCompoundGraph(t)),mR.forEach(yR(t),(function(e,n){t.node(n).x=e}))};var ER=uO,wR=xO,xR=AO,MR=a_,NR=SO.normalizeRanks,SR=l_,CR=SO.removeEmptyRanks,kR=f_,TR=v_,PR=E_,AR=J_,OR=bR,_R=SO,RR=$A.Graph,LR=function(t,e){var n=e&&e.debugTiming?_R.time:_R.notime;n("layout",(function(){var e=n(" buildLayoutGraph",(function(){return function(t){var e=new RR({multigraph:!0,compound:!0}),n=UR(t.graph());return e.setGraph(ER.merge({},IR,WR(n,DR),ER.pick(n,jR))),ER.forEach(t.nodes(),(function(n){var r=UR(t.node(n));e.setNode(n,ER.defaults(WR(r,zR),BR)),e.setParent(n,t.parent(n))})),ER.forEach(t.edges(),(function(n){var r=UR(t.edge(n));e.setEdge(n,ER.merge({},GR,WR(r,FR),ER.pick(r,VR)))})),e}(t)}));n(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,ER.forEach(t.edges(),(function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){ER.forEach(t.edges(),(function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){wR.run(t)})),e(" nestingGraph.run",(function(){kR.run(t)})),e(" rank",(function(){MR(_R.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){ER.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};_R.addDummyNode(t,"edge-proxy",i,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){CR(t)})),e(" nestingGraph.cleanup",(function(){kR.cleanup(t)})),e(" normalizeRanks",(function(){NR(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;ER.forEach(t.nodes(),(function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=ER.max(e,r.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){ER.forEach(t.nodes(),(function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){xR.run(t)})),e(" parentDummyChains",(function(){SR(t)})),e(" addBorderSegments",(function(){TR(t)})),e(" order",(function(){AR(t)})),e(" insertSelfEdges",(function(){!function(t){var e=_R.buildLayerMatrix(t);ER.forEach(e,(function(e){var n=0;ER.forEach(e,(function(e,r){var i=t.node(e);i.order=r+n,ER.forEach(i.selfEdges,(function(e){_R.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){PR.adjust(t)})),e(" position",(function(){OR(t)})),e(" positionSelfEdges",(function(){!function(t){ER.forEach(t.nodes(),(function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){ER.forEach(t.nodes(),(function(e){if(t.children(e).length){var n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(ER.last(n.borderLeft)),a=t.node(ER.last(n.borderRight));n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}})),ER.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){xR.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){ER.forEach(t.edges(),(function(e){var n=t.edge(e);if(ER.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){PR.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=t.graph(),a=o.marginx||0,s=o.marginy||0;function u(t){var o=t.x,a=t.y,s=t.width,u=t.height;e=Math.min(e,o-s/2),n=Math.max(n,o+s/2),r=Math.min(r,a-u/2),i=Math.max(i,a+u/2)}ER.forEach(t.nodes(),(function(e){u(t.node(e))})),ER.forEach(t.edges(),(function(e){var n=t.edge(e);ER.has(n,"x")&&u(n)})),e-=a,r-=s,ER.forEach(t.nodes(),(function(n){var i=t.node(n);i.x-=e,i.y-=r})),ER.forEach(t.edges(),(function(n){var i=t.edge(n);ER.forEach(i.points,(function(t){t.x-=e,t.y-=r})),ER.has(i,"x")&&(i.x-=e),ER.has(i,"y")&&(i.y-=r)})),o.width=n-e+a,o.height=i-r+s}(t)})),e(" assignNodeIntersects",(function(){!function(t){ER.forEach(t.edges(),(function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(_R.intersectRect(o,n)),i.points.push(_R.intersectRect(a,r))}))}(t)})),e(" reversePoints",(function(){!function(t){ER.forEach(t.edges(),(function(e){var n=t.edge(e);n.reversed&&n.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){wR.undo(t)}))}(e,n)})),n(" updateInputGraph",(function(){!function(t,e){ER.forEach(t.nodes(),(function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))})),ER.forEach(t.edges(),(function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,ER.has(i,"x")&&(r.x=i.x,r.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var DR=["nodesep","edgesep","ranksep","marginx","marginy"],IR={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},jR=["acyclicer","ranker","rankdir","align"],zR=["width","height"],BR={width:0,height:0},FR=["minlen","weight","width","height","labeloffset"],GR={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},VR=["labelpos"];function WR(t,e){return ER.mapValues(ER.pick(t,e),Number)}function UR(t){var e={};return ER.forEach(t,(function(t,n){e[n.toLowerCase()]=t})),e}var HR=uO,qR=SO,$R=$A.Graph,YR={debugOrdering:function(t){var e=qR.buildLayerMatrix(t),n=new $R({compound:!0,multigraph:!0}).setGraph({});return HR.forEach(t.nodes(),(function(e){n.setNode(e,{label:e}),n.setParent(e,"layer"+t.node(e).rank)})),HR.forEach(t.edges(),(function(t){n.setEdge(t.v,t.w,{},t.name)})),HR.forEach(e,(function(t,e){var r="layer"+e;n.setNode(r,{rank:"same"}),HR.reduce(t,(function(t,e){return n.setEdge(t,e,{style:"invis"}),e}))})),n}};var KR={graphlib:$A,layout:LR,debug:YR,util:{time:SO.time,notime:SO.notime},version:"0.8.5"},XR=f(KR);class ZR{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,ZR.defaultOptions,t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))}))}assign(t,e){return a(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))}))}genericDagreLayout(t,e,n){return a(this,void 0,void 0,(function*(){const{nodeSize:r}=n,i=new KR.graphlib.Graph;i.setGraph(n),i.setDefaultEdgeLabel((()=>({})));[...e.getAllNodes(),...e.getAllEdges()].some((({id:t})=>Wt(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach((t=>{const{id:e}=t,n=Object.assign({},t.data);if(void 0!==r){const[e,i]=function(t){if(!t)return[0,0,0];if(Wt(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,n=e,r=e]=t;return[e,n,r]}(Tt(r)?r(t):r);Object.assign(n,{width:e,height:i})}i.setNode(e.toString(),n)})),e.getAllEdges().forEach((({id:t,source:e,target:n})=>{i.setEdge(e.toString(),n.toString(),{id:t})})),XR.layout(i);const a={nodes:[],edges:[]};return i.nodes().forEach((n=>{const r=i.node(n);a.nodes.push({id:n,data:r}),t&&e.mergeNodeData(n,r)})),i.edges().forEach((n=>{const r=i.edge(n),{id:s}=r,u=o(r,["id"]),{v:c,w:l}=n;a.edges.push({id:s,source:c,target:l,data:u}),t&&e.mergeEdgeData(s,u)})),a}))}}ZR.defaultOptions={};class QR{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,n=t.ry-this.ry;let r=Math.hypot(e,n);r=r<1e-4?1e-4:r;const i=this.g*(this.degree+1)*(t.degree+1)/r;this.fx+=i*e/r,this.fy+=i*n/r}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,n=(this.rx*this.mass+t.rx*t.mass)/e,r=(this.ry*this.mass+t.ry*t.mass)/e,i=this.degree+t.degree;return new QR({rx:n,ry:r,mass:e,degree:i})}}class JR{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,n=this.length/2;return new JR({xmid:t,ymid:e,length:n})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,n=this.length/2;return new JR({xmid:t,ymid:e,length:n})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,n=this.length/2;return new JR({xmid:t,ymid:e,length:n})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,n=this.length/2;return new JR({xmid:t,ymid:e,length:n})}}class tL{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new tL(this.quad.NW()),this.NE=new tL(this.quad.NE()),this.SW=new tL(this.quad.SW()),this.SE=new tL(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){if(null!=this.body&&t!==this.body)if(this._isExternal())t.addForce(this.body);else{(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t))}}}const eL={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};const nL={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"};const rL={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};const iL=(t,e)=>{let n;const r=t.rows||5,i=t.cols||5;if(null==e)n=Math.min(r,i);else{Math.min(r,i)===t.rows?t.rows=e:t.cols=e}return n},oL=(t,e)=>{let n;const r=t.rows||5,i=t.cols||5;if(null==e)n=Math.max(r,i);else{Math.max(r,i)===t.rows?t.rows=e:t.cols=e}return n},aL=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,sL=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,uL=(t,e)=>{const n=t.cols||5;e.col++,e.col>=n&&(e.col=0,e.row++)},cL=(t,e,n,r,i,o,a,s)=>{let u,c;const l=i[t.id];if(l)u=l.col*n+n/2+e[0],c=l.row*r+r/2+e[1];else{for(;aL(s,a);)uL(o,a);u=a.col*n+n/2+e[0],c=a.row*r+r/2+e[1],sL(s,a),uL(o,a)}t.data.x=u,t.data.y=c},lL={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},hL=(t,e,n,r,i,o)=>{e.forEach(((a,s)=>{n[s]={x:0,y:0},e.forEach(((e,u)=>{if(s===u)return;if(i[s]!==i[u])return;let c=a.x-e.x,l=a.y-e.y,h=Math.sqrt(c*c+l*l);if(0===h){h=1;const t=s>u?1:-1;c=.01*t,l=.01*t}if(h<o(t[s])/2+o(t[u])/2){const t=r*r/h;n[s].x+=c/h*t,n[s].y+=l/h*t}}))}))},dL=(t,e,n,r,i,o,a,s)=>{const u=o||a/10;return r&&e.forEach(((e,n)=>{const r=t[n].x-t[i].x,o=t[n].y-t[i].y,a=Math.sqrt(r*r+o*o);let s=o/a,u=-r/a;const c=Math.sqrt(e.x*e.x+e.y*e.y);let l=Math.acos((s*e.x+u*e.y)/c);l>Math.PI/2&&(l-=Math.PI/2,s*=-1,u*=-1);const h=Math.cos(l)*c;e.x=s*h,e.y=u*h})),t.forEach(((o,a)=>{if(a===i)return;const c=Math.sqrt(e[a].x*e[a].x+e[a].y*e[a].y);if(c>0&&a!==i){const l=Math.min(u*(n/800),c);if(o.x+=e[a].x/c*l,o.y+=e[a].y/c*l,r){let e=o.x-t[i].x,n=o.y-t[i].y;const r=Math.sqrt(e*e+n*n);e=e/r*s[a],n=n/r*s[a],o.x=t[i].x+e,o.y=t[i].y+n}}})),t},fL={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};const pL=(t,e,n,r,i,o,a)=>{if(!t)return[];const s=[];if(e){const u={};e.forEach(((e,c)=>{const l=[];e.forEach(((e,s)=>{var h,d;if(c===s)l.push(0);else if(r[c]===r[s])if("data"===o)l.push(e*(Math.abs(c-s)*a)/(r[c]/i));else if(o){let n,f;if(u[t[c].id])n=u[t[c].id];else{const e=("id"===o?t[c].id:null===(h=t[c].data)||void 0===h?void 0:h[o])||0;n=Bt(e)?e.charCodeAt(0):e,u[t[c].id]=n}if(u[t[s].id])f=u[t[s].id];else{const e=("id"===o?t[s].id:null===(d=t[s].data)||void 0===d?void 0:d[o])||0;f=Bt(e)?e.charCodeAt(0):e,u[t[s].id]=f}l.push(e*(Math.abs(n-f)*a)/(r[c]/i))}else l.push(e*n/(r[c]/i));else{const t=(n+i)/2;l.push(e*t)}})),s.push(l)}))}return s},gL=t=>{const e=t.length,n=t[0].length,r=[];for(let i=0;i<e;i++){const e=[];for(let r=0;r<n;r++)0!==t[i][r]?e.push(1/(t[i][r]*t[i][r])):e.push(0);r.push(e)}return r},mL=(t,e)=>{let n=-1;return t.forEach(((t,r)=>{t.id===e&&(n=r)})),Math.max(n,0)},vL=(t,e,n)=>{const r=t.length;for(let i=0;i<r;i++)if(t[e][i]===1/0){t[e][i]=n,t[i][e]=n;for(let o=0;o<r;o++)t[i][o]!==1/0&&t[e][o]===1/0&&(t[e][o]=n+t[i][o],t[o][e]=n+t[i][o])}for(let n=0;n<r;n++)if(n!==e)for(let i=0;i<r;i++)if(t[n][i]===1/0){let r=Math.abs(t[e][n]-t[e][i]);r=0===r?1:r,t[n][i]=r}},yL=(t,e)=>{let n=0;for(let r=0;r<t[e].length;r++)t[e][r]!==1/0&&(n=t[e][r]>n?t[e][r]:n);return n},bL={center:[0,0],width:300,height:300};function EL(t){return!!t.tick&&!!t.stop}
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).G6V5={})}(this,(function(t){"use strict";var e="undefined"!=typeof document?document.currentScript:null,n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)};function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=function(){return i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},i.apply(this,arguments)};function o(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function a(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))}function s(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function c(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function l(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function h(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}"function"==typeof SuppressedError&&SuppressedError;var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function p(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var g={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),c=n?n+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],s]:t._events[c].push(s):(t._events[c]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},s.prototype.emit=function(t,e,r,i,o,a){var s=n?n+t:t;if(!this._events[s])return!1;var c,u,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,a),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d,f=l.length;for(u=0;u<f;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,r);break;case 4:l[u].fn.call(l[u].context,e,r,i);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];l[u].fn.apply(l[u].context,c)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var c=0,u=[],l=s.length;c<l;c++)(s[c].fn!==e||i&&!s[c].once||r&&s[c].context!==r)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}(g);var m=f(g.exports),v=1e-6,y="undefined"!=typeof Float32Array?Float32Array:Array;function b(){var t=new y(9);return y!=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 x(){var t=new y(16);return y!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function E(t){var e=new y(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function w(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function M(t,e,n,r,i,o,a,s,c,u,l,h,d,f,p,g,m){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=u,t[9]=l,t[10]=h,t[11]=d,t[12]=f,t[13]=p,t[14]=g,t[15]=m,t}function N(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function S(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function C(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],u=e[7],l=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15],y=n*s-r*a,b=n*c-i*a,x=n*u-o*a,E=r*c-i*s,w=r*u-o*s,M=i*u-o*c,N=l*g-h*p,S=l*m-d*p,C=l*v-f*p,T=h*m-d*g,k=h*v-f*g,P=d*v-f*m,A=y*P-b*k+x*T+E*C-w*S+M*N;return A?(A=1/A,t[0]=(s*P-c*k+u*T)*A,t[1]=(i*k-r*P-o*T)*A,t[2]=(g*M-m*w+v*E)*A,t[3]=(d*w-h*M-f*E)*A,t[4]=(c*C-a*P-u*S)*A,t[5]=(n*P-i*C+o*S)*A,t[6]=(m*x-p*M-v*b)*A,t[7]=(l*M-d*x+f*b)*A,t[8]=(a*k-s*C+u*N)*A,t[9]=(r*C-n*k-o*N)*A,t[10]=(p*w-g*x+v*y)*A,t[11]=(h*x-l*w-f*y)*A,t[12]=(s*S-a*T-c*N)*A,t[13]=(n*T-r*S+i*N)*A,t[14]=(g*b-p*E-m*y)*A,t[15]=(l*E-h*b+d*y)*A,t):null}function T(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],c=t[7],u=t[8],l=t[9],h=t[10],d=t[11],f=t[12],p=t[13],g=t[14],m=t[15];return(e*a-n*o)*(h*m-d*g)-(e*s-r*o)*(l*m-d*p)+(e*c-i*o)*(l*g-h*p)+(n*s-r*a)*(u*m-d*f)-(n*c-i*a)*(u*g-h*f)+(r*c-i*s)*(u*p-l*f)}function k(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],u=e[6],l=e[7],h=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],v=e[14],y=e[15],b=n[0],x=n[1],E=n[2],w=n[3];return t[0]=b*r+x*s+E*h+w*g,t[1]=b*i+x*c+E*d+w*m,t[2]=b*o+x*u+E*f+w*v,t[3]=b*a+x*l+E*p+w*y,b=n[4],x=n[5],E=n[6],w=n[7],t[4]=b*r+x*s+E*h+w*g,t[5]=b*i+x*c+E*d+w*m,t[6]=b*o+x*u+E*f+w*v,t[7]=b*a+x*l+E*p+w*y,b=n[8],x=n[9],E=n[10],w=n[11],t[8]=b*r+x*s+E*h+w*g,t[9]=b*i+x*c+E*d+w*m,t[10]=b*o+x*u+E*f+w*v,t[11]=b*a+x*l+E*p+w*y,b=n[12],x=n[13],E=n[14],w=n[15],t[12]=b*r+x*s+E*h+w*g,t[13]=b*i+x*c+E*d+w*m,t[14]=b*o+x*u+E*f+w*v,t[15]=b*a+x*l+E*p+w*y,t}function P(t,e,n){var r,i,o,a,s,c,u,l,h,d,f,p,g=n[0],m=n[1],v=n[2];return e===t?(t[12]=e[0]*g+e[4]*m+e[8]*v+e[12],t[13]=e[1]*g+e[5]*m+e[9]*v+e[13],t[14]=e[2]*g+e[6]*m+e[10]*v+e[14],t[15]=e[3]*g+e[7]*m+e[11]*v+e[15]):(r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],c=e[5],u=e[6],l=e[7],h=e[8],d=e[9],f=e[10],p=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=c,t[6]=u,t[7]=l,t[8]=h,t[9]=d,t[10]=f,t[11]=p,t[12]=r*g+s*m+h*v+e[12],t[13]=i*g+c*m+d*v+e[13],t[14]=o*g+u*m+f*v+e[14],t[15]=a*g+l*m+p*v+e[15]),t}function A(t,e,n){var r=n[0],i=n[1],o=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function O(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],a=e[5],s=e[6],c=e[7],u=e[8],l=e[9],h=e[10],d=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*r,t[5]=a*i+l*r,t[6]=s*i+h*r,t[7]=c*i+d*r,t[8]=u*i-o*r,t[9]=l*i-a*r,t[10]=h*i-s*r,t[11]=d*i-c*r,t}function _(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],s=e[2],c=e[3],u=e[8],l=e[9],h=e[10],d=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*r,t[1]=a*i-l*r,t[2]=s*i-h*r,t[3]=c*i-d*r,t[8]=o*r+u*i,t[9]=a*r+l*i,t[10]=s*r+h*i,t[11]=c*r+d*i,t}function R(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function D(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function I(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=r+r,c=i+i,u=o+o,l=r*s,h=r*c,d=r*u,f=i*c,p=i*u,g=o*u,m=a*s,v=a*c,y=a*u;return t[0]=1-(f+g),t[1]=h+y,t[2]=d-v,t[3]=0,t[4]=h-y,t[5]=1-(l+g),t[6]=p+m,t[7]=0,t[8]=d+v,t[9]=p-m,t[10]=1-(l+f),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function L(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function j(t,e){var n=e[0],r=e[1],i=e[2],o=e[4],a=e[5],s=e[6],c=e[8],u=e[9],l=e[10];return t[0]=Math.hypot(n,r,i),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(c,u,l),t}function z(t,e){var n=new y(3);j(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],a=e[0]*r,s=e[1]*i,c=e[2]*o,u=e[4]*r,l=e[5]*i,h=e[6]*o,d=e[8]*r,f=e[9]*i,p=e[10]*o,g=a+l+p,m=0;return g>0?(m=2*Math.sqrt(g+1),t[3]=.25*m,t[0]=(h-f)/m,t[1]=(d-c)/m,t[2]=(s-u)/m):a>l&&a>p?(m=2*Math.sqrt(1+a-l-p),t[3]=(h-f)/m,t[0]=.25*m,t[1]=(s+u)/m,t[2]=(d+c)/m):l>p?(m=2*Math.sqrt(1+l-a-p),t[3]=(d-c)/m,t[0]=(s+u)/m,t[1]=.25*m,t[2]=(h+f)/m):(m=2*Math.sqrt(1+p-a-l),t[3]=(s-u)/m,t[0]=(d+c)/m,t[1]=(h+f)/m,t[2]=.25*m),t}function B(t,e,n,r,i){var o=e[0],a=e[1],s=e[2],c=e[3],u=o+o,l=a+a,h=s+s,d=o*u,f=o*l,p=o*h,g=a*l,m=a*h,v=s*h,y=c*u,b=c*l,x=c*h,E=r[0],w=r[1],M=r[2],N=i[0],S=i[1],C=i[2],T=(1-(g+v))*E,k=(f+x)*E,P=(p-b)*E,A=(f-x)*w,O=(1-(d+v))*w,_=(m+y)*w,R=(p+b)*M,D=(m-y)*M,I=(1-(d+g))*M;return t[0]=T,t[1]=k,t[2]=P,t[3]=0,t[4]=A,t[5]=O,t[6]=_,t[7]=0,t[8]=R,t[9]=D,t[10]=I,t[11]=0,t[12]=n[0]+N-(T*N+A*S+R*C),t[13]=n[1]+S-(k*N+O*S+D*C),t[14]=n[2]+C-(P*N+_*S+I*C),t[15]=1,t}function F(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,s=r+r,c=i+i,u=n*a,l=r*a,h=r*s,d=i*a,f=i*s,p=i*c,g=o*a,m=o*s,v=o*c;return t[0]=1-h-p,t[1]=l+v,t[2]=d-m,t[3]=0,t[4]=l-v,t[5]=1-u-p,t[6]=f+g,t[7]=0,t[8]=d+m,t[9]=f-g,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function G(t,e,n,r,i){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(r-i),t[10]=(i+r)*o,t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r),t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var V=G;function W(t,e,n,r,i,o,a){var s=1/(e-n),c=1/(r-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*c,t[14]=(a+o)*u,t[15]=1,t}var U=W;function H(t,e,n,r,i,o,a){var s=1/(e-n),c=1/(r-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=u,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*c,t[14]=o*u,t[15]=1,t}function q(t,e,n,r){var i,o,a,s,c,u,l,h,d,f,p=e[0],g=e[1],m=e[2],y=r[0],b=r[1],x=r[2],E=n[0],w=n[1],M=n[2];return Math.abs(p-E)<v&&Math.abs(g-w)<v&&Math.abs(m-M)<v?N(t):(l=p-E,h=g-w,d=m-M,i=b*(d*=f=1/Math.hypot(l,h,d))-x*(h*=f),o=x*(l*=f)-y*d,a=y*h-b*l,(f=Math.hypot(i,o,a))?(i*=f=1/f,o*=f,a*=f):(i=0,o=0,a=0),s=h*a-d*o,c=d*i-l*a,u=l*o-h*i,(f=Math.hypot(s,c,u))?(s*=f=1/f,c*=f,u*=f):(s=0,c=0,u=0),t[0]=i,t[1]=s,t[2]=l,t[3]=0,t[4]=o,t[5]=c,t[6]=h,t[7]=0,t[8]=a,t[9]=u,t[10]=d,t[11]=0,t[12]=-(i*p+o*g+a*m),t[13]=-(s*p+c*g+u*m),t[14]=-(l*p+h*g+d*m),t[15]=1,t)}function $(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}var Y=k,K=$,X=Object.freeze({__proto__:null,add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},adjoint:function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],u=e[7],l=e[8],h=e[9],d=e[10],f=e[11],p=e[12],g=e[13],m=e[14],v=e[15];return t[0]=s*(d*v-f*m)-h*(c*v-u*m)+g*(c*f-u*d),t[1]=-(r*(d*v-f*m)-h*(i*v-o*m)+g*(i*f-o*d)),t[2]=r*(c*v-u*m)-s*(i*v-o*m)+g*(i*u-o*c),t[3]=-(r*(c*f-u*d)-s*(i*f-o*d)+h*(i*u-o*c)),t[4]=-(a*(d*v-f*m)-l*(c*v-u*m)+p*(c*f-u*d)),t[5]=n*(d*v-f*m)-l*(i*v-o*m)+p*(i*f-o*d),t[6]=-(n*(c*v-u*m)-a*(i*v-o*m)+p*(i*u-o*c)),t[7]=n*(c*f-u*d)-a*(i*f-o*d)+l*(i*u-o*c),t[8]=a*(h*v-f*g)-l*(s*v-u*g)+p*(s*f-u*h),t[9]=-(n*(h*v-f*g)-l*(r*v-o*g)+p*(r*f-o*h)),t[10]=n*(s*v-u*g)-a*(r*v-o*g)+p*(r*u-o*s),t[11]=-(n*(s*f-u*h)-a*(r*f-o*h)+l*(r*u-o*s)),t[12]=-(a*(h*m-d*g)-l*(s*m-c*g)+p*(s*d-c*h)),t[13]=n*(h*m-d*g)-l*(r*m-i*g)+p*(r*d-i*h),t[14]=-(n*(s*m-c*g)-a*(r*m-i*g)+p*(r*c-i*s)),t[15]=n*(s*d-c*h)-a*(r*d-i*h)+l*(r*c-i*s),t},clone:E,copy:w,create:x,determinant:T,equals:function(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],c=t[6],u=t[7],l=t[8],h=t[9],d=t[10],f=t[11],p=t[12],g=t[13],m=t[14],y=t[15],b=e[0],x=e[1],E=e[2],w=e[3],M=e[4],N=e[5],S=e[6],C=e[7],T=e[8],k=e[9],P=e[10],A=e[11],O=e[12],_=e[13],R=e[14],D=e[15];return Math.abs(n-b)<=v*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(r-x)<=v*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(i-E)<=v*Math.max(1,Math.abs(i),Math.abs(E))&&Math.abs(o-w)<=v*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(a-M)<=v*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(s-N)<=v*Math.max(1,Math.abs(s),Math.abs(N))&&Math.abs(c-S)<=v*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(u-C)<=v*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(l-T)<=v*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(h-k)<=v*Math.max(1,Math.abs(h),Math.abs(k))&&Math.abs(d-P)<=v*Math.max(1,Math.abs(d),Math.abs(P))&&Math.abs(f-A)<=v*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(p-O)<=v*Math.max(1,Math.abs(p),Math.abs(O))&&Math.abs(g-_)<=v*Math.max(1,Math.abs(g),Math.abs(_))&&Math.abs(m-R)<=v*Math.max(1,Math.abs(m),Math.abs(R))&&Math.abs(y-D)<=v*Math.max(1,Math.abs(y),Math.abs(D))},exactEquals:function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},frob:function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},fromQuat:F,fromQuat2:function(t,e){var n=new y(3),r=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],c=e[5],u=e[6],l=e[7],h=r*r+i*i+o*o+a*a;return h>0?(n[0]=2*(s*a+l*r+c*o-u*i)/h,n[1]=2*(c*a+l*i+u*r-s*o)/h,n[2]=2*(u*a+l*o+s*i-c*r)/h):(n[0]=2*(s*a+l*r+c*o-u*i),n[1]=2*(c*a+l*i+u*r-s*o),n[2]=2*(u*a+l*o+s*i-c*r)),I(t,e,n),t},fromRotation:function(t,e,n){var r,i,o,a=n[0],s=n[1],c=n[2],u=Math.hypot(a,s,c);return u<v?null:(a*=u=1/u,s*=u,c*=u,r=Math.sin(e),o=1-(i=Math.cos(e)),t[0]=a*a*o+i,t[1]=s*a*o+c*r,t[2]=c*a*o-s*r,t[3]=0,t[4]=a*s*o-c*r,t[5]=s*s*o+i,t[6]=c*s*o+a*r,t[7]=0,t[8]=a*c*o+s*r,t[9]=s*c*o-a*r,t[10]=c*c*o+i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},fromRotationTranslation:I,fromRotationTranslationScale:function(t,e,n,r){var i=e[0],o=e[1],a=e[2],s=e[3],c=i+i,u=o+o,l=a+a,h=i*c,d=i*u,f=i*l,p=o*u,g=o*l,m=a*l,v=s*c,y=s*u,b=s*l,x=r[0],E=r[1],w=r[2];return t[0]=(1-(p+m))*x,t[1]=(d+b)*x,t[2]=(f-y)*x,t[3]=0,t[4]=(d-b)*E,t[5]=(1-(h+m))*E,t[6]=(g+v)*E,t[7]=0,t[8]=(f+y)*w,t[9]=(g-v)*w,t[10]=(1-(h+p))*w,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},fromRotationTranslationScaleOrigin:B,fromScaling:D,fromTranslation:R,fromValues:function(t,e,n,r,i,o,a,s,c,u,l,h,d,f,p,g){var m=new y(16);return m[0]=t,m[1]=e,m[2]=n,m[3]=r,m[4]=i,m[5]=o,m[6]=a,m[7]=s,m[8]=c,m[9]=u,m[10]=l,m[11]=h,m[12]=d,m[13]=f,m[14]=p,m[15]=g,m},fromXRotation:function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},fromYRotation:function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},fromZRotation:function(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},frustum:function(t,e,n,r,i,o,a){var s=1/(n-e),c=1/(i-r),u=1/(o-a);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*c,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*c,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t},getRotation:z,getScaling:j,getTranslation:L,identity:N,invert:C,lookAt:q,mul:Y,multiply:k,multiplyScalar:function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},multiplyScalarAndAdd:function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},ortho:U,orthoNO:W,orthoZO:H,perspective:V,perspectiveFromFieldOfView:function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),a=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),c=2/(a+s),u=2/(i+o);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-(a-s)*c*.5,t[9]=(i-o)*u*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},perspectiveNO:G,perspectiveZO:function(t,e,n,r,i){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(o=1/(r-i),t[10]=i*o,t[14]=i*r*o):(t[10]=-1,t[14]=-r),t},rotate:function(t,e,n,r){var i,o,a,s,c,u,l,h,d,f,p,g,m,y,b,x,E,w,M,N,S,C,T,k,P=r[0],A=r[1],O=r[2],_=Math.hypot(P,A,O);return _<v?null:(P*=_=1/_,A*=_,O*=_,i=Math.sin(n),a=1-(o=Math.cos(n)),s=e[0],c=e[1],u=e[2],l=e[3],h=e[4],d=e[5],f=e[6],p=e[7],g=e[8],m=e[9],y=e[10],b=e[11],x=P*P*a+o,E=A*P*a+O*i,w=O*P*a-A*i,M=P*A*a-O*i,N=A*A*a+o,S=O*A*a+P*i,C=P*O*a+A*i,T=A*O*a-P*i,k=O*O*a+o,t[0]=s*x+h*E+g*w,t[1]=c*x+d*E+m*w,t[2]=u*x+f*E+y*w,t[3]=l*x+p*E+b*w,t[4]=s*M+h*N+g*S,t[5]=c*M+d*N+m*S,t[6]=u*M+f*N+y*S,t[7]=l*M+p*N+b*S,t[8]=s*C+h*T+g*k,t[9]=c*C+d*T+m*k,t[10]=u*C+f*T+y*k,t[11]=l*C+p*T+b*k,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},rotateX:O,rotateY:_,rotateZ:function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],a=e[1],s=e[2],c=e[3],u=e[4],l=e[5],h=e[6],d=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*r,t[1]=a*i+l*r,t[2]=s*i+h*r,t[3]=c*i+d*r,t[4]=u*i-o*r,t[5]=l*i-a*r,t[6]=h*i-s*r,t[7]=d*i-c*r,t},scale:A,set:M,str:function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},sub:K,subtract:$,targetTo:function(t,e,n,r){var i=e[0],o=e[1],a=e[2],s=r[0],c=r[1],u=r[2],l=i-n[0],h=o-n[1],d=a-n[2],f=l*l+h*h+d*d;f>0&&(l*=f=1/Math.sqrt(f),h*=f,d*=f);var p=c*d-u*h,g=u*l-s*d,m=s*h-c*l;return(f=p*p+g*g+m*m)>0&&(p*=f=1/Math.sqrt(f),g*=f,m*=f),t[0]=p,t[1]=g,t[2]=m,t[3]=0,t[4]=h*m-d*g,t[5]=d*p-l*m,t[6]=l*g-h*p,t[7]=0,t[8]=l,t[9]=h,t[10]=d,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t},translate:P,transpose:S});function Z(){var t=new y(3);return y!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Q(t){var e=new y(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function J(t){var e=t[0],n=t[1],r=t[2];return Math.hypot(e,n,r)}function tt(t,e,n){var r=new y(3);return r[0]=t,r[1]=e,r[2]=n,r}function et(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function nt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function rt(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function it(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function ot(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function at(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function st(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ct(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],c=n[2];return t[0]=i*c-o*s,t[1]=o*a-r*c,t[2]=r*s-i*a,t}function ut(t,e,n,r){var i=e[0],o=e[1],a=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t}function lt(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return a=a||1,t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/a,t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t}function ht(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],a=e[1],s=e[2];return Math.abs(n-o)<=v*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-a)<=v*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-s)<=v*Math.max(1,Math.abs(i),Math.abs(s))}var dt=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.hypot(n,r,i)},ft=J;function pt(){var t=new y(4);return y!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function gt(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,t}function mt(){var t=new y(4);return y!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function vt(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function yt(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=n[0],c=n[1],u=n[2],l=n[3];return t[0]=r*l+a*s+i*u-o*c,t[1]=i*l+a*c+o*s-r*u,t[2]=o*l+a*u+r*c-i*s,t[3]=a*l-r*s-i*c-o*u,t}function bt(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o,s=a?1/a:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-i*s,t[3]=o*s,t}function xt(t,e,n,r){var i=.5*Math.PI/180;e*=i,n*=i,r*=i;var o=Math.sin(e),a=Math.cos(e),s=Math.sin(n),c=Math.cos(n),u=Math.sin(r),l=Math.cos(r);return t[0]=o*c*l-a*s*u,t[1]=a*s*l+o*c*u,t[2]=a*c*u-o*s*l,t[3]=a*c*l+o*s*u,t}Z(),function(){var t=pt()}();var Et=function(t,e,n,r){var i=new y(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i},wt=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Mt=yt,Nt=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a,t};Z(),tt(1,0,0),tt(0,1,0),mt(),mt(),b(),function(){var t,e=(t=new y(2),y!=Float32Array&&(t[0]=0,t[1]=0),t)}();var St=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},Ct=function(t,e){return!!St(t)&&t.indexOf(e)>-1},Tt=function(t,e){return void 0===e&&(e=[]),function(t,e){if(!St(t))return t;for(var n=[],r=0;r<t.length;r++){var i=t[r];e(i,r)&&n.push(i)}return n}(t,(function(t){return!Ct(e,t)}))},kt=function(t){return"function"==typeof t},Pt=function(t){return null==t},At={}.toString,Ot=function(t,e){return At.call(t)==="[object "+e+"]"},_t=function(t){return Array.isArray?Array.isArray(t):Ot(t,"Array")},Rt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Dt(t,e){if(t)if(_t(t))for(var n=0,r=t.length;n<r&&!1!==e(t[n],n);n++);else if(Rt(t))for(var i in t)if(t.hasOwnProperty(i)&&!1===e(t[i],i))break}var It=function(t){return"object"==typeof t&&null!==t},Lt=function(t){if(!It(t)||!Ot(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e},jt=function(t){if(_t(t))return t.reduce((function(t,e){return Math.max(t,e)}),t[0])},zt=function(t){if(_t(t))return t.reduce((function(t,e){return Math.min(t,e)}),t[0])},Bt=function(t){return Ot(t,"String")},Ft=Object.prototype.hasOwnProperty;function Gt(t,e){if(!e||!_t(t))return{};for(var n,r={},i=kt(e)?e:function(t){return t[e]},o=0;o<t.length;o++){var a=t[o];n=i(a),Ft.call(r,n)?r[n].push(a):r[n]=[a]}return r}var Vt=function(t,e,n){return t<e?e:t>n?n:t},Wt=function(t){return Ot(t,"Number")},Ut=1e-5;function Ht(t,e,n){return void 0===n&&(n=Ut),Math.abs(t-e)<n}var qt=function(t,e){return(t%e+e)%e},$t=function(t){return Pt(t)?"":t.toString()},Yt=function(t){var e=$t(t);return e.charAt(0).toLowerCase()+e.substring(1)};var Kt={}.toString,Xt=function(t){return Ot(t,"Boolean")},Zt=Object.prototype,Qt=function(t){return void 0===t},Jt=function(t){if("object"!=typeof t||null===t)return t;var e;if(_t(t)){e=[];for(var n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=Jt(t[n]):e[n]=t[n]}else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=Jt(t[i]):e[i]=t[i];return e};function te(t,e,n){var r;return function(){var i=this,o=arguments,a=n&&!r;clearTimeout(r),r=setTimeout((function(){r=null,n||t.apply(i,o)}),e),a&&t.apply(i,o)}}function ee(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function ne(t,e,n,r){for(var i in n=n||0,r=r||5,e)if(ee(e,i)){var o=e[i];null!==o&&Lt(o)?(Lt(t[i])||(t[i]={}),n<r?ne(t[i],o,n+1,r):t[i]=e[i]):_t(o)?(t[i]=[],t[i]=t[i].concat(o)):void 0!==o&&(t[i]=o)}}var re=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)ne(t,e[r]);return t},ie=Object.prototype.hasOwnProperty;function oe(t){if(Pt(t))return!0;if(St(t))return!t.length;var e=function(t){return Kt.call(t).replace(/^\[object /,"").replace(/]$/,"")}(t);if("Map"===e||"Set"===e)return!t.size;if(function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Zt)}(t))return!Object.keys(t).length;for(var n in t)if(ie.call(t,n))return!1;return!0}var ae=function(t,e){if(t===e)return!0;if(!t||!e)return!1;if(Bt(t)||Bt(e))return!1;if(St(t)||St(e)){if(t.length!==e.length)return!1;for(var n=!0,r=0;r<t.length&&(n=ae(t[r],e[r]));r++);return n}if(It(t)||It(e)){var i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(n=!0,r=0;r<i.length&&(n=ae(t[i[r]],e[i[r]]));r++);return n}return!1},se=function(t,e,n){for(var r=0,i=Bt(e)?e.split("."):e;t&&r<i.length;)t=t[i[r++]];return void 0===t||r<i.length?n:t},ce=function(t,e,n){var r=t,i=Bt(e)?e.split("."):e;return i.forEach((function(t,e){e<i.length-1?(Rt(r[t])||(r[t]=Wt(i[e+1])?[]:{}),r=r[t]):r[t]=n})),t},ue=Object.prototype.hasOwnProperty,le=function(t,e){if(null===t||!Lt(t))return{};var n={};return Dt(e,(function(e){ue.call(t,e)&&(n[e]=t[e])})),n},he=function(t,e){return function(t,e,n){if(!_t(t)&&!Lt(t))return t;var r=n;return Dt(t,(function(t,n){r=e(r,t,n)})),r}(t,(function(t,n,r){return e.includes(r)||(t[r]=n),t}),{})},de={},fe=function(){},pe={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function ge(t,e,n){if(t[n].length>7){t[n].shift();for(var r=t[n],i=n;r.length;)e[n]="A",t.splice(i+=1,0,["C"].concat(r.splice(0,6)));t.splice(n,1)}}var me={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function ve(t){return Array.isArray(t)&&t.every((function(t){var e=t[0].toLowerCase();return me[e]===t.length-1&&"achlmqstvz".includes(e)}))}function ye(t){return ve(t)&&t.every((function(t){var e=t[0];return e===e.toUpperCase()}))}function be(t){return ye(t)&&t.every((function(t){var e=t[0];return"ACLMQZ".includes(e)}))}function xe(t){for(var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;r.length>=me[n]&&("m"===n&&r.length>2?(t.segments.push([e].concat(r.splice(0,2))),n="l",e="m"===e?"l":"L"):t.segments.push([e].concat(r.splice(0,me[n]))),me[n]););}function Ee(t){var e=t.index,n=t.pathValue,r=n.charCodeAt(e);return 48===r?(t.param=0,void(t.index+=1)):49===r?(t.param=1,void(t.index+=1)):void(t.err='[path-util]: invalid Arc flag "'+n[e]+'", expecting 0 or 1 at index '+e)}function we(t){return t>=48&&t<=57||43===t||45===t||46===t}function Me(t){return t>=48&&t<=57}function Ne(t){var e,n=t.max,r=t.pathValue,i=t.index,o=i,a=!1,s=!1,c=!1,u=!1;if(o>=n)t.err="[path-util]: Invalid path value at index "+o+', "pathValue" is missing param';else if(43!==(e=r.charCodeAt(o))&&45!==e||(o+=1,e=r.charCodeAt(o)),Me(e)||46===e){if(46!==e){if(a=48===e,o+=1,e=r.charCodeAt(o),a&&o<n&&e&&Me(e))return void(t.err="[path-util]: Invalid path value at index "+i+', "'+r[i]+'" illegal number');for(;o<n&&Me(r.charCodeAt(o));)o+=1,s=!0;e=r.charCodeAt(o)}if(46===e){for(u=!0,o+=1;Me(r.charCodeAt(o));)o+=1,c=!0;e=r.charCodeAt(o)}if(101===e||69===e){if(u&&!s&&!c)return void(t.err="[path-util]: Invalid path value at index "+o+', "'+r[o]+'" invalid float exponent');if(o+=1,43!==(e=r.charCodeAt(o))&&45!==e||(o+=1),!(o<n&&Me(r.charCodeAt(o))))return void(t.err="[path-util]: Invalid path value at index "+o+', "'+r[o]+'" invalid integer exponent');for(;o<n&&Me(r.charCodeAt(o));)o+=1}t.index=o,t.param=+t.pathValue.slice(i,o)}else t.err="[path-util]: Invalid path value at index "+o+', "'+r[o]+'" is not a number'}function Se(t){for(var e,n=t.pathValue,r=t.max;t.index<r&&(10===(e=n.charCodeAt(t.index))||13===e||8232===e||8233===e||32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function Ce(t){var e=t.max,n=t.pathValue,r=t.index,i=n.charCodeAt(r),o=me[n[r].toLowerCase()];if(t.segmentStart=r,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(i))if(t.index+=1,Se(t),t.data=[],o){for(;;){for(var a=o;a>0;a-=1){if(97!=(32|i)||3!==a&&4!==a?Ne(t):Ee(t),t.err.length)return;t.data.push(t.param),Se(t),t.index<e&&44===n.charCodeAt(t.index)&&(t.index+=1,Se(t))}if(t.index>=t.max)break;if(!we(n.charCodeAt(t.index)))break}xe(t)}else xe(t);else t.err='[path-util]: Invalid path value "'+n[r]+'" is not a path command'}var Te=function(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""};function ke(t){if(ye(t))return[].concat(t);var e=function(t){if(ve(t))return[].concat(t);var e=new Te(t);for(Se(e);e.index<e.max&&!e.err.length;)Ce(e);return e.err?e.err:e.segments}(t),n=0,r=0,i=0,o=0;return e.map((function(t){var e,a=t.slice(1).map(Number),s=t[0],c=s.toUpperCase();if("M"===s)return n=a[0],r=a[1],i=n,o=r,["M",n,r];if(s!==c)switch(c){case"A":e=[c,a[0],a[1],a[2],a[3],a[4],a[5]+n,a[6]+r];break;case"V":e=[c,a[0]+r];break;case"H":e=[c,a[0]+n];break;default:var u=a.map((function(t,e){return t+(e%2?r:n)}));e=[c].concat(u)}else e=[c].concat(a);var l=e.length;switch(c){case"Z":n=i,r=o;break;case"H":n=e[1];break;case"V":r=e[1];break;default:n=e[l-2],r=e[l-1],"M"===c&&(i=n,o=r)}return e}))}function Pe(t,e){var n=t[0],r=e.x1,i=e.y1,o=e.x2,a=e.y2,s=t.slice(1).map(Number),c=t;if("TQ".includes(n)||(e.qx=null,e.qy=null),"H"===n)c=["L",t[1],i];else if("V"===n)c=["L",r,t[1]];else if("S"===n){var u=2*r-o,l=2*i-a;e.x1=u,e.y1=l,c=["C",u,l].concat(s)}else if("T"===n){var h=2*r-e.qx,d=2*i-e.qy;e.qx=h,e.qy=d,c=["Q",h,d].concat(s)}else if("Q"===n){var f=s[0],p=s[1];e.qx=f,e.qy=p}return c}function Ae(t){if(be(t))return[].concat(t);for(var e=ke(t),n=i({},pe),r=0;r<e.length;r+=1){e[r]=Pe(e[r],n);var o=e[r],a=o.length;n.x1=+o[a-2],n.y1=+o[a-1],n.x2=+o[a-4]||n.x1,n.y2=+o[a-3]||n.y1}return e}function Oe(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function _e(t,e,n,r,i,o,a,s,c,u){var l,h,d,f,p,g=t,m=e,v=n,y=r,b=s,x=c,E=120*Math.PI/180,w=Math.PI/180*(+i||0),M=[];if(u)h=u[0],d=u[1],f=u[2],p=u[3];else{g=(l=Oe(g,m,-w)).x,m=l.y;var N=(g-(b=(l=Oe(b,x,-w)).x))/2,S=(m-(x=l.y))/2,C=N*N/(v*v)+S*S/(y*y);C>1&&(v*=C=Math.sqrt(C),y*=C);var T=v*v,k=y*y,P=(o===a?-1:1)*Math.sqrt(Math.abs((T*k-T*S*S-k*N*N)/(T*S*S+k*N*N)));f=P*v*S/y+(g+b)/2,p=P*-y*N/v+(m+x)/2,h=Math.asin(((m-p)/y*Math.pow(10,9)|0)/Math.pow(10,9)),d=Math.asin(((x-p)/y*Math.pow(10,9)|0)/Math.pow(10,9)),h=g<f?Math.PI-h:h,d=b<f?Math.PI-d:d,h<0&&(h=2*Math.PI+h),d<0&&(d=2*Math.PI+d),a&&h>d&&(h-=2*Math.PI),!a&&d>h&&(d-=2*Math.PI)}var A=d-h;if(Math.abs(A)>E){var O=d,_=b,R=x;d=h+E*(a&&d>h?1:-1),M=_e(b=f+v*Math.cos(d),x=p+y*Math.sin(d),v,y,i,0,a,_,R,[d,O,f,p])}A=d-h;var D=Math.cos(h),I=Math.sin(h),L=Math.cos(d),j=Math.sin(d),z=Math.tan(A/4),B=4/3*v*z,F=4/3*y*z,G=[g,m],V=[g+B*I,m-F*D],W=[b+B*j,x-F*L],U=[b,x];if(V[0]=2*G[0]-V[0],V[1]=2*G[1]-V[1],u)return V.concat(W,U,M);for(var H=[],q=0,$=(M=V.concat(W,U,M)).length;q<$;q+=1)H[q]=q%2?Oe(M[q-1],M[q],w).y:Oe(M[q],M[q+1],w).x;return H}function Re(t,e,n){var r=t[0],i=t[1];return[r+(e[0]-r)*n,i+(e[1]-i)*n]}var De=function(t,e,n,r){return l(l([],Re([t,e],[n,r],.5),!0),[n,r,n,r],!1)};function Ie(t,e){var n,r,i,o,a,s,c,u,l,h=t[0],d=t.slice(1).map(Number),f=d[0],p=d[1],g=e.x1,m=e.y1,v=e.x,y=e.y;switch("TQ".includes(h)||(e.qx=null,e.qy=null),h){case"M":return e.x=f,e.y=p,t;case"A":return n=[g,m].concat(d),["C"].concat(_e(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9]));case"Q":return e.qx=f,e.qy=p,n=[g,m].concat(d),["C"].concat((r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],c=n[5],[(u=1/3)*r+(l=2/3)*o,u*i+l*a,u*s+l*o,u*c+l*a,s,c]));case"L":return["C"].concat(De(g,m,f,p));case"Z":return g===v&&m===y?["C",g,m,v,y,v,y]:["C"].concat(De(g,m,v,y))}return t}function Le(t,e){if(void 0===e&&(e=!1),function(t){return be(t)&&t.every((function(t){var e=t[0];return"MC".includes(e)}))}(t)){var n=[].concat(t);return e?[n,[]]:n}for(var r,o,a=Ae(t),s=i({},pe),c=[],u="",l=a.length,h=[],d=0;d<l;d+=1){a[d]&&(u=a[d][0]),c[d]=u;var f=Ie(a[d],s);a[d]=f,ge(a,c,d),l=a.length,"Z"===u&&h.push(d),o=(r=a[d]).length,s.x1=+r[o-2],s.y1=+r[o-1],s.x2=+r[o-4]||s.x1,s.y2=+r[o-3]||s.y1}return e?[a,h]:a}function je(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function ze(t,e,n,r,i){var o=je([t,e],[n,r]),a={x:0,y:0};if("number"==typeof i)if(i<=0)a={x:t,y:e};else if(i>=o)a={x:n,y:r};else{var s=Re([t,e],[n,r],i/o);a={x:s[0],y:s[1]}}return{length:o,point:a,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function Be(t,e){var n=t.x,r=t.y,i=e.x,o=e.y,a=n*i+r*o,s=Math.sqrt((Math.pow(n,2)+Math.pow(r,2))*(Math.pow(i,2)+Math.pow(o,2)));return(n*o-r*i<0?-1:1)*Math.acos(a/s)}function Fe(t,e,n,r,i,o,a,s,c,u){var l=Math.abs,h=Math.sin,d=Math.cos,f=Math.sqrt,p=Math.PI,g=l(n),m=l(r),v=(i%360+360)%360*(p/180);if(t===s&&e===c)return{x:t,y:e};if(0===g||0===m)return ze(t,e,s,c,u).point;var y=(t-s)/2,b=(e-c)/2,x={x:d(v)*y+h(v)*b,y:-h(v)*y+d(v)*b},E=Math.pow(x.x,2)/Math.pow(g,2)+Math.pow(x.y,2)/Math.pow(m,2);E>1&&(g*=f(E),m*=f(E));var w=(Math.pow(g,2)*Math.pow(m,2)-Math.pow(g,2)*Math.pow(x.y,2)-Math.pow(m,2)*Math.pow(x.x,2))/(Math.pow(g,2)*Math.pow(x.y,2)+Math.pow(m,2)*Math.pow(x.x,2)),M=(o!==a?1:-1)*f(w=w<0?0:w),N=M*(g*x.y/m),S=M*(-m*x.x/g),C=d(v)*N-h(v)*S+(t+s)/2,T=h(v)*N+d(v)*S+(e+c)/2,k={x:(x.x-N)/g,y:(x.y-S)/m},P=Be({x:1,y:0},k),A=Be(k,{x:(-x.x-N)/g,y:(-x.y-S)/m});!a&&A>0?A-=2*p:a&&A<0&&(A+=2*p);var O=P+(A%=2*p)*u,_=g*d(O),R=m*h(O);return{x:d(v)*_-h(v)*R+C,y:h(v)*_+d(v)*R+T}}function Ge(t,e,n,r,i,o,a,s,c,u,l){var h,d=l.bbox,f=void 0===d||d,p=l.length,g=void 0===p||p,m=l.sampleSize,v=void 0===m?30:m,y="number"==typeof u,b=t,x=e,E=0,w=[b,x,E],M=[b,x],N={x:0,y:0},S=[{x:b,y:x}];y&&u<=0&&(N={x:b,y:x});for(var C=0;C<=v;C+=1){if(b=(h=Fe(t,e,n,r,i,o,a,s,c,C/v)).x,x=h.y,f&&S.push({x:b,y:x}),g&&(E+=je(M,[b,x])),M=[b,x],y&&E>=u&&u>w[2]){var T=(E-u)/(E-w[2]);N={x:M[0]*(1-T)+w[0]*T,y:M[1]*(1-T)+w[1]*T}}w=[b,x,E]}return y&&u>=E&&(N={x:s,y:c}),{length:E,point:N,min:{x:Math.min.apply(null,S.map((function(t){return t.x}))),y:Math.min.apply(null,S.map((function(t){return t.y})))},max:{x:Math.max.apply(null,S.map((function(t){return t.x}))),y:Math.max.apply(null,S.map((function(t){return t.y})))}}}function Ve(t,e,n,r,i,o,a,s,c){var u=1-c;return{x:Math.pow(u,3)*t+3*Math.pow(u,2)*c*n+3*u*Math.pow(c,2)*i+Math.pow(c,3)*a,y:Math.pow(u,3)*e+3*Math.pow(u,2)*c*r+3*u*Math.pow(c,2)*o+Math.pow(c,3)*s}}function We(t,e,n,r,i,o,a,s,c,u){var l,h=u.bbox,d=void 0===h||h,f=u.length,p=void 0===f||f,g=u.sampleSize,m=void 0===g?10:g,v="number"==typeof c,y=t,b=e,x=0,E=[y,b,x],w=[y,b],M={x:0,y:0},N=[{x:y,y:b}];v&&c<=0&&(M={x:y,y:b});for(var S=0;S<=m;S+=1){if(y=(l=Ve(t,e,n,r,i,o,a,s,S/m)).x,b=l.y,d&&N.push({x:y,y:b}),p&&(x+=je(w,[y,b])),w=[y,b],v&&x>=c&&c>E[2]){var C=(x-c)/(x-E[2]);M={x:w[0]*(1-C)+E[0]*C,y:w[1]*(1-C)+E[1]*C}}E=[y,b,x]}return v&&c>=x&&(M={x:a,y:s}),{length:x,point:M,min:{x:Math.min.apply(null,N.map((function(t){return t.x}))),y:Math.min.apply(null,N.map((function(t){return t.y})))},max:{x:Math.max.apply(null,N.map((function(t){return t.x}))),y:Math.max.apply(null,N.map((function(t){return t.y})))}}}function Ue(t,e,n,r,i,o,a){var s=1-a;return{x:Math.pow(s,2)*t+2*s*a*n+Math.pow(a,2)*i,y:Math.pow(s,2)*e+2*s*a*r+Math.pow(a,2)*o}}function He(t,e,n,r,i,o,a,s){var c,u=s.bbox,l=void 0===u||u,h=s.length,d=void 0===h||h,f=s.sampleSize,p=void 0===f?10:f,g="number"==typeof a,m=t,v=e,y=0,b=[m,v,y],x=[m,v],E={x:0,y:0},w=[{x:m,y:v}];g&&a<=0&&(E={x:m,y:v});for(var M=0;M<=p;M+=1){if(m=(c=Ue(t,e,n,r,i,o,M/p)).x,v=c.y,l&&w.push({x:m,y:v}),d&&(y+=je(x,[m,v])),x=[m,v],g&&y>=a&&a>b[2]){var N=(y-a)/(y-b[2]);E={x:x[0]*(1-N)+b[0]*N,y:x[1]*(1-N)+b[1]*N}}b=[m,v,y]}return g&&a>=y&&(E={x:i,y:o}),{length:y,point:E,min:{x:Math.min.apply(null,w.map((function(t){return t.x}))),y:Math.min.apply(null,w.map((function(t){return t.y})))},max:{x:Math.max.apply(null,w.map((function(t){return t.x}))),y:Math.max.apply(null,w.map((function(t){return t.y})))}}}function qe(t,e,n){for(var r,i,o,a,s,c,u,l,h,d=Ae(t),f="number"==typeof e,p=[],g=0,m=0,v=0,y=0,b=[],x=[],E=0,w={x:0,y:0},M=w,N=w,S=w,C=0,T=0,k=d.length;T<k;T+=1)p=(u="M"===(l=(h=d[T])[0]))?p:[g,m].concat(h.slice(1)),u?(M=w={x:v=h[1],y:y=h[2]},E=0,f&&e<.001&&(S=w)):"L"===l?(E=(r=ze(p[0],p[1],p[2],p[3],(e||0)-C)).length,w=r.min,M=r.max,N=r.point):"A"===l?(E=(i=Ge(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],(e||0)-C,n||{})).length,w=i.min,M=i.max,N=i.point):"C"===l?(E=(o=We(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],(e||0)-C,n||{})).length,w=o.min,M=o.max,N=o.point):"Q"===l?(E=(a=He(p[0],p[1],p[2],p[3],p[4],p[5],(e||0)-C,n||{})).length,w=a.min,M=a.max,N=a.point):"Z"===l&&(E=(s=ze((p=[g,m,v,y])[0],p[1],p[2],p[3],(e||0)-C)).length,w=s.min,M=s.max,N=s.point),f&&C<e&&C+E>=e&&(S=N),x.push(M),b.push(w),C+=E,g=(c="Z"!==l?h.slice(-2):[v,y])[0],m=c[1];return f&&e>=C&&(S={x:g,y:m}),{length:C,point:S,min:{x:Math.min.apply(null,b.map((function(t){return t.x}))),y:Math.min.apply(null,b.map((function(t){return t.y})))},max:{x:Math.max.apply(null,x.map((function(t){return t.x}))),y:Math.max.apply(null,x.map((function(t){return t.y})))}}}function $e(t,e){var n=t.length-1,r=[],i=0,o=function(t){var e=t.length,n=e-1;return t.map((function(r,i){return t.map((function(r,o){var a,s=i+o;return 0===o||t[s]&&"M"===t[s][0]?(a=t[s],["M"].concat(a.slice(-2))):(s>=e&&(s-=n),t[s])}))}))}(t);return o.forEach((function(o,a){t.slice(1).forEach((function(r,o){i+=je(t[(a+o)%n].slice(-2),e[o%n].slice(-2))})),r[a]=i,i=0})),o[r.indexOf(Math.min.apply(null,r))]}function Ye(t){return function(t){var e=0,n=0,r=0;return Le(t).map((function(t){var i;if("M"===t[0])return e=t[1],n=t[2],0;var o=t.slice(1),a=o[0],s=o[1],c=o[2],u=o[3],l=o[4],h=o[5];return r=function(t,e,n,r,i,o,a,s){return 3*((s-e)*(n+i)-(a-t)*(r+o)+r*(t-i)-n*(e-o)+s*(i+t/3)-a*(o+e/3))/20}(e,n,a,s,c,u,l,h),i=t.slice(-2),e=i[0],n=i[1],r})).reduce((function(t,e){return t+e}),0)}(t)>=0}function Ke(t){return t.map((function(t,e,n){var r=e&&n[e-1].slice(-2).concat(t.slice(1)),i=e?We(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],{bbox:!1}).length:0;return{s:t,ss:e?i?function(t,e){void 0===e&&(e=.5);var n=t.slice(0,2),r=t.slice(2,4),i=t.slice(4,6),o=t.slice(6,8),a=Re(n,r,e),s=Re(r,i,e),c=Re(i,o,e),u=Re(a,s,e),l=Re(s,c,e),h=Re(u,l,e);return[["C"].concat(a,u,h),["C"].concat(l,c,o)]}(r):[t,t]:[t],l:i}}))}function Xe(t,e,n){var r=Ke(t),i=Ke(e),o=r.length,a=i.length,s=r.filter((function(t){return t.l})).length,c=i.filter((function(t){return t.l})).length,u=r.filter((function(t){return t.l})).reduce((function(t,e){return t+e.l}),0)/s||0,l=i.filter((function(t){return t.l})).reduce((function(t,e){return t+e.l}),0)/c||0,h=n||Math.max(o,a),d=[u,l],f=[h-o,h-a],p=0,g=[r,i].map((function(t,e){return t.l===h?t.map((function(t){return t.s})):t.map((function(t,n){return p=n&&f[e]&&t.l>=d[e],f[e]-=p?1:0,p?t.ss:[t.s]})).flat()}));return g[0].length===g[1].length?g:Xe(g[0],g[1],h)}function Ze(t){var e=document.createElement("div");e.innerHTML=t;var n=e.childNodes[0];return n&&e.contains(n)&&e.removeChild(n),n}function Qe(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Je(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function tn(){}var en=.7,nn=1/en,rn="\\s*([+-]?\\d+)\\s*",on="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",an="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sn=/^#([0-9a-f]{3,8})$/,cn=new RegExp("^rgb\\("+[rn,rn,rn]+"\\)$"),un=new RegExp("^rgb\\("+[an,an,an]+"\\)$"),ln=new RegExp("^rgba\\("+[rn,rn,rn,on]+"\\)$"),hn=new RegExp("^rgba\\("+[an,an,an,on]+"\\)$"),dn=new RegExp("^hsl\\("+[on,an,an]+"\\)$"),fn=new RegExp("^hsla\\("+[on,an,an,on]+"\\)$"),pn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function gn(){return this.rgb().formatHex()}function mn(){return this.rgb().formatRgb()}function vn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=sn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?yn(e):3===n?new xn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?bn(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?bn(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=cn.exec(t))?new xn(e[1],e[2],e[3],1):(e=un.exec(t))?new xn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=ln.exec(t))?bn(e[1],e[2],e[3],e[4]):(e=hn.exec(t))?bn(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=dn.exec(t))?Nn(e[1],e[2]/100,e[3]/100,1):(e=fn.exec(t))?Nn(e[1],e[2]/100,e[3]/100,e[4]):pn.hasOwnProperty(t)?yn(pn[t]):"transparent"===t?new xn(NaN,NaN,NaN,0):null}function yn(t){return new xn(t>>16&255,t>>8&255,255&t,1)}function bn(t,e,n,r){return r<=0&&(t=e=n=NaN),new xn(t,e,n,r)}function xn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function En(){return"#"+Mn(this.r)+Mn(this.g)+Mn(this.b)}function wn(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Mn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Nn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Cn(t,e,n,r)}function Sn(t){if(t instanceof Cn)return new Cn(t.h,t.s,t.l,t.opacity);if(t instanceof tn||(t=vn(t)),!t)return new Cn;if(t instanceof Cn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,c=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=c<.5?o+i:2-o-i,a*=60):s=c>0&&c<1?0:a,new Cn(a,s,c,t.opacity)}function Cn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Tn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function kn(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function Pn(t,e){var n=Math.min.apply(Math,l([],u(t),!1)),r=Math.min.apply(Math,l([],u(e),!1));return{x:n,y:r,width:Math.max.apply(Math,l([],u(t),!1))-n,height:Math.max.apply(Math,l([],u(e),!1))-r}}function An(t,e,n,r,i,o){return n*Math.cos(i)*Math.cos(o)-r*Math.sin(i)*Math.sin(o)+t}function On(t,e,n,r,i,o){return n*Math.sin(i)*Math.cos(o)+r*Math.cos(i)*Math.sin(o)+e}function _n(t,e,n,r,i,o,a){for(var s=function(t,e,n){return Math.atan(-e/t*Math.tan(n))}(n,r,i),c=1/0,u=-1/0,l=[o,a],h=2*-Math.PI;h<=2*Math.PI;h+=Math.PI){var d=s+h;o<a?o<d&&d<a&&l.push(d):a<d&&d<o&&l.push(d)}for(h=0;h<l.length;h++){var f=An(t,0,n,r,i,l[h]);f<c&&(c=f),f>u&&(u=f)}var p=function(t,e,n){return Math.atan(e/(t*Math.tan(n)))}(n,r,i),g=1/0,m=-1/0,v=[o,a];for(h=2*-Math.PI;h<=2*Math.PI;h+=Math.PI){var y=p+h;o<a?o<y&&y<a&&v.push(y):a<y&&y<o&&v.push(y)}for(h=0;h<v.length;h++){var b=On(0,e,n,r,i,v[h]);b<g&&(g=b),b>m&&(m=b)}return{x:c,y:g,width:u-c,height:m-g}}Qe(tn,vn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:gn,formatHex:gn,formatHsl:function(){return Sn(this).formatHsl()},formatRgb:mn,toString:mn}),Qe(xn,(function(t,e,n,r){return 1===arguments.length?((i=t)instanceof tn||(i=vn(i)),i?new xn((i=i.rgb()).r,i.g,i.b,i.opacity):new xn):new xn(t,e,n,null==r?1:r);var i}),Je(tn,{brighter:function(t){return t=null==t?nn:Math.pow(nn,t),new xn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?en:Math.pow(en,t),new xn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:En,formatHex:En,formatRgb:wn,toString:wn})),Qe(Cn,(function(t,e,n,r){return 1===arguments.length?Sn(t):new Cn(t,e,n,null==r?1:r)}),Je(tn,{brighter:function(t){return t=null==t?nn:Math.pow(nn,t),new Cn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?en:Math.pow(en,t),new Cn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new xn(Tn(t>=240?t-240:t+120,i,r),Tn(t,i,r),Tn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Rn=1e-4;function Dn(t,e,n,r,i,o){var a=-1,s=1/0,c=[n,r],h=20;o&&o>200&&(h=o/10);for(var d=1/h,f=d/10,p=0;p<=h;p++){var g=p*d,m=[i.apply(void 0,l([],u(t.concat([g])),!1)),i.apply(void 0,l([],u(e.concat([g])),!1))];(x=kn(c[0],c[1],m[0],m[1]))<s&&(a=g,s=x)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var v=t.length;return{x:t[v-1],y:e[v-1]}}s=1/0;for(p=0;p<32&&!(f<Rn);p++){var y=a-f,b=a+f,x=(m=[i.apply(void 0,l([],u(t.concat([y])),!1)),i.apply(void 0,l([],u(e.concat([y])),!1))],kn(c[0],c[1],m[0],m[1]));if(y>=0&&x<s)a=y,s=x;else{var E=[i.apply(void 0,l([],u(t.concat([b])),!1)),i.apply(void 0,l([],u(e.concat([b])),!1))],w=kn(c[0],c[1],E[0],E[1]);b<=1&&w<s?(a=b,s=w):f*=.5}}return{x:i.apply(void 0,l([],u(t.concat([a])),!1)),y:i.apply(void 0,l([],u(e.concat([a])),!1))}}function In(t,e,n,r){return kn(t,e,n,r)}function Ln(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}}function jn(t,e,n,r,i,o){var a=[n-t,r-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((i-t)*(i-t)+(o-e)*(o-e));var s=[-a[1],a[0]];!function(t,e){var n=e[0],r=e[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i}(s,s);var c=[i-t,o-e];return Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}(c,s))}function zn(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function Bn(t,e,n,r){var i,o,a,s=-3*t+9*e-9*n+3*r,c=6*t-12*e+6*n,u=3*e-3*t,l=[];if(Ht(s,0))Ht(c,0)||(i=-u/c)>=0&&i<=1&&l.push(i);else{var h=c*c-4*s*u;Ht(h,0)?l.push(-c/(2*s)):h>0&&(o=(-c-(a=Math.sqrt(h)))/(2*s),(i=(-c+a)/(2*s))>=0&&i<=1&&l.push(i),o>=0&&o<=1&&l.push(o))}return l}function Fn(t,e,n,r,i,o,a,s){for(var c=[t,a],u=[e,s],l=Bn(t,n,i,a),h=Bn(e,r,o,s),d=0;d<l.length;d++)c.push(zn(t,n,i,a,l[d]));for(d=0;d<h.length;d++)u.push(zn(e,r,o,s,h[d]));return Pn(c,u)}function Gn(t,e,n,r,i,o,a,s,c,u,l){var h=function(t,e,n,r,i,o,a,s,c,u,l){return Dn([t,n,i,a],[e,r,o,s],c,u,zn,l)}(t,e,n,r,i,o,a,s,c,u,l);return kn(h.x,h.y,c,u)}function Vn(t){return function(t){if(t.length<2)return 0;for(var e=0,n=0;n<t.length-1;n++){var r=t[n],i=t[n+1];e+=kn(r[0],r[1],i[0],i[1])}return e}(t)}function Wn(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function Un(t,e,n){var r=t+n-2*e;if(Ht(r,0))return[.5];var i=(t-e)/r;return i<=1&&i>=0?[i]:[]}function Hn(t,e,n,r,i,o){var a=Un(t,n,i)[0],s=Un(e,r,o)[0],c=[t,i],u=[e,o];return void 0!==a&&c.push(Wn(t,n,i,a)),void 0!==s&&u.push(Wn(e,r,o,s)),Pn(c,u)}function qn(t,e,n,r,i,o,a,s){var c=function(t,e,n,r,i,o,a,s){return Dn([t,n,i],[e,r,o],a,s,Wn)}(t,e,n,r,i,o,a,s);return kn(c.x,c.y,a,s)}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var $n={exports:{}};!function(t,e){t.exports=function(){function t(t,n,i,o,a){e(t,n,i||0,o||t.length-1,a||r)}function e(t,r,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,c=r-i+1,u=Math.log(s),l=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*l*(s-l)/s)*(c-s/2<0?-1:1);e(t,r,Math.max(i,Math.floor(r-c*l/s+h)),Math.min(o,Math.floor(r+(s-c)*l/s+h)),a)}var d=t[r],f=i,p=o;for(n(t,i,r),a(t[o],d)>0&&n(t,i,o);f<p;){for(n(t,f,p),f++,p--;a(t[f],d)<0;)f++;for(;a(t[p],d)>0;)p--}0===a(t[i],d)?n(t,i,p):n(t,++p,o),p<=r&&(i=p+1),r<=p&&(o=p-1)}}function n(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function r(t,e){return t<e?-1:t>e?1:0}var i=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function a(t,e){s(t,0,t.children.length,e,t)}function s(t,e,n,r,i){i||(i=v(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=e;o<n;o++){var a=t.children[o];c(i,t.leaf?r(a):a)}return i}function c(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function u(t,e){return t.minX-e.minX}function l(t,e){return t.minY-e.minY}function h(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function d(t){return t.maxX-t.minX+(t.maxY-t.minY)}function f(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function p(t,e){var n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}function g(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function m(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function v(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function y(e,n,r,i,o){for(var a=[n,r];a.length;)if(!((r=a.pop())-(n=a.pop())<=i)){var s=n+Math.ceil((r-n)/i/2)*i;t(e,s,n,r,o),a.push(n,s,s,r)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(t){var e=this.data,n=[];if(!m(t,e))return n;for(var r=this.toBBox,i=[];e;){for(var o=0;o<e.children.length;o++){var a=e.children[o],s=e.leaf?r(a):a;m(t,s)&&(e.leaf?n.push(a):g(t,s)?this._all(a,n):i.push(a))}e=i.pop()}return n},i.prototype.collides=function(t){var e=this.data;if(!m(t,e))return!1;for(var n=[];e;){for(var r=0;r<e.children.length;r++){var i=e.children[r],o=e.leaf?this.toBBox(i):i;if(m(t,o)){if(e.leaf||g(t,o))return!0;n.push(i)}}e=n.pop()}return!1},i.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},i.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},i.prototype.clear=function(){return this.data=v([]),this},i.prototype.remove=function(t,e){if(!t)return this;for(var n,r,i,a=this.data,s=this.toBBox(t),c=[],u=[];a||c.length;){if(a||(a=c.pop(),r=c[c.length-1],n=u.pop(),i=!0),a.leaf){var l=o(t,a.children,e);if(-1!==l)return a.children.splice(l,1),c.push(a),this._condense(c),this}i||a.leaf||!g(a,s)?r?(n++,a=r.children[n],i=!1):a=null:(c.push(a),u.push(n),n=0,r=a,a=a.children[0])}return this},i.prototype.toBBox=function(t){return t},i.prototype.compareMinX=function(t,e){return t.minX-e.minX},i.prototype.compareMinY=function(t,e){return t.minY-e.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(t){return this.data=t,this},i.prototype._all=function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},i.prototype._build=function(t,e,n,r){var i,o=n-e+1,s=this._maxEntries;if(o<=s)return a(i=v(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=v([])).leaf=!1,i.height=r;var c=Math.ceil(o/s),u=c*Math.ceil(Math.sqrt(s));y(t,e,n,u,this.compareMinX);for(var l=e;l<=n;l+=u){var h=Math.min(l+u-1,n);y(t,l,h,c,this.compareMinY);for(var d=l;d<=h;d+=c){var f=Math.min(d+c-1,h);i.children.push(this._build(t,d,f,r-1))}}return a(i,this.toBBox),i},i.prototype._chooseSubtree=function(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){for(var i=1/0,o=1/0,a=void 0,s=0;s<e.children.length;s++){var c=e.children[s],u=h(c),l=f(t,c)-u;l<o?(o=l,i=u<i?u:i,a=c):l===o&&u<i&&(i=u,a=c)}e=a||e.children[0]}return e},i.prototype._insert=function(t,e,n){var r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),c(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)},i.prototype._split=function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=v(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,a(n,this.toBBox),a(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},i.prototype._splitRoot=function(t,e){this.data=v([t,e]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(t,e,n){for(var r,i=1/0,o=1/0,a=e;a<=n-e;a++){var c=s(t,0,a,this.toBBox),u=s(t,a,n,this.toBBox),l=p(c,u),d=h(c)+h(u);l<i?(i=l,r=a,o=d<o?d:o):l===i&&d<o&&(o=d,r=a)}return r||n-e},i.prototype._chooseSplitAxis=function(t,e,n){var r=t.leaf?this.compareMinX:u,i=t.leaf?this.compareMinY:l;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},i.prototype._allDistMargin=function(t,e,n,r){t.children.sort(r);for(var i=this.toBBox,o=s(t,0,e,i),a=s(t,n-e,n,i),u=d(o)+d(a),l=e;l<n-e;l++){var h=t.children[l];c(o,t.leaf?i(h):h),u+=d(o)}for(var f=n-e-1;f>=e;f--){var p=t.children[f];c(a,t.leaf?i(p):p),u+=d(a)}return u},i.prototype._adjustParentBBoxes=function(t,e,n){for(var r=n;r>=0;r--)c(e[r],t)},i.prototype._condense=function(t){for(var e=t.length-1,n=void 0;e>=0;e--)0===t[e].children.length?e>0?(n=t[e-1].children).splice(n.indexOf(t[e]),1):this.clear():a(t[e],this.toBBox)},i}()}($n);var Yn,Kn,Xn=$n.exports;!function(t){t.GROUP="g",t.CIRCLE="circle",t.ELLIPSE="ellipse",t.IMAGE="image",t.RECT="rect",t.LINE="line",t.POLYLINE="polyline",t.POLYGON="polygon",t.TEXT="text",t.PATH="path",t.HTML="html",t.MESH="mesh"}(Yn||(Yn={})),function(t){t[t.ZERO=0]="ZERO",t[t.NEGATIVE_ONE=1]="NEGATIVE_ONE"}(Kn||(Kn={}));var Zn=function(){function t(){this.plugins=[]}return t.prototype.addRenderingPlugin=function(t){this.plugins.push(t),this.context.renderingPlugins.push(t)},t.prototype.removeAllRenderingPlugins=function(){var t=this;this.plugins.forEach((function(e){var n=t.context.renderingPlugins.indexOf(e);n>=0&&t.context.renderingPlugins.splice(n,1)}))},t}(),Qn=function(){function t(t){this.clipSpaceNearZ=Kn.NEGATIVE_ONE,this.plugins=[],this.config=i({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0},t)}return t.prototype.registerPlugin=function(t){-1===this.plugins.findIndex((function(e){return e===t}))&&this.plugins.push(t)},t.prototype.unregisterPlugin=function(t){var e=this.plugins.findIndex((function(e){return e===t}));e>-1&&this.plugins.splice(e,1)},t.prototype.getPlugins=function(){return this.plugins},t.prototype.getPlugin=function(t){return this.plugins.find((function(e){return e.name===t}))},t.prototype.getConfig=function(){return this.config},t.prototype.setConfig=function(t){Object.assign(this.config,t)},t}();function Jn(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function tr(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function er(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function nr(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function rr(t){return void 0===t?0:t>360||t<-360?t%360:t}function ir(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),Array.isArray(t)&&3===t.length?Q(t):Wt(t)?tt(t,e,n):tt(t[0],t[1]||e,t[2]||n)}function or(t){return t*(Math.PI/180)}function ar(t){return t*(180/Math.PI)}function sr(t,e){return 16===e.length?function(t,e){var n,r,i=.5*Math.PI,o=u(j(Z(),e),3),a=o[0],s=o[1],c=o[2],l=Math.asin(-e[2]/a);return l<i?l>-i?(n=Math.atan2(e[6]/s,e[10]/c),r=Math.atan2(e[1]/a,e[0]/a)):(r=0,n=-Math.atan2(e[4]/s,e[5]/s)):(r=0,n=Math.atan2(e[4]/s,e[5]/s)),t[0]=n,t[1]=l,t[2]=r,t}(t,e):function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=r*r,s=i*i,c=o*o,u=n*n+a+s+c,l=n*o-r*i;return l>.499995*u?(t[0]=Math.PI/2,t[1]=2*Math.atan2(r,n),t[2]=0):l<-.499995*u?(t[0]=-Math.PI/2,t[1]=2*Math.atan2(r,n),t[2]=0):(t[0]=Math.asin(2*(n*i-o*r)),t[1]=Math.atan2(2*(n*o+r*i),1-2*(s+c)),t[2]=Math.atan2(2*(n*r+i*o),1-2*(a+s))),t}(t,e)}function cr(t,e,n,r,i){var o,a,s,c,u,l,h,d,f,p,g=Math.cos(t),m=Math.sin(t);return o=r*g,a=i*m,s=0,c=-r*m,u=i*g,l=0,h=e,d=n,f=1,(p=new y(9))[0]=o,p[1]=a,p[2]=s,p[3]=c,p[4]=u,p[5]=l,p[6]=h,p[7]=d,p[8]=f,p}function ur(t){var e=t[0],n=t[1],r=t[3],i=t[4],o=Math.sqrt(e*e+n*n),a=Math.sqrt(r*r+i*i);e*i-n*r<0&&(e<i?o=-o:a=-a),o&&(e*=1/o,n*=1/o),a&&(r*=1/a,i*=1/a);var s=ar(Math.atan2(n,e));return[t[6],t[7],o,a,s]}var lr=x(),hr=x(),dr=pt(),fr=[Z(),Z(),Z()],pr=Z();function gr(t,e,n,r,i){t[0]=e[0]*r+n[0]*i,t[1]=e[1]*r+n[1]*i,t[2]=e[2]*r+n[2]*i}var mr,vr=function(){function t(){this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return t.isEmpty=function(t){return!t||0===t.halfExtents[0]&&0===t.halfExtents[1]&&0===t.halfExtents[2]},t.prototype.update=function(t,e){Jn(this.center,t),Jn(this.halfExtents,e),tr(this.min,this.center,this.halfExtents),er(this.max,this.center,this.halfExtents)},t.prototype.setMinMax=function(t,e){er(this.center,e,t),nr(this.center,this.center,.5),tr(this.halfExtents,e,t),nr(this.halfExtents,this.halfExtents,.5),Jn(this.min,t),Jn(this.max,e)},t.prototype.getMin=function(){return this.min},t.prototype.getMax=function(){return this.max},t.prototype.add=function(e){if(!t.isEmpty(e))if(t.isEmpty(this))this.setMinMax(e.getMin(),e.getMax());else{var n=this.center,r=n[0],i=n[1],o=n[2],a=this.halfExtents,s=a[0],c=a[1],u=a[2],l=r-s,h=r+s,d=i-c,f=i+c,p=o-u,g=o+u,m=e.center,v=m[0],y=m[1],b=m[2],x=e.halfExtents,E=x[0],w=x[1],M=x[2],N=v-E,S=v+E,C=y-w,T=y+w,k=b-M,P=b+M;N<l&&(l=N),S>h&&(h=S),C<d&&(d=C),T>f&&(f=T),k<p&&(p=k),P>g&&(g=P),n[0]=.5*(l+h),n[1]=.5*(d+f),n[2]=.5*(p+g),a[0]=.5*(h-l),a[1]=.5*(f-d),a[2]=.5*(g-p),this.min[0]=l,this.min[1]=d,this.min[2]=p,this.max[0]=h,this.max[1]=f,this.max[2]=g}},t.prototype.setFromTransformedAABB=function(t,e){var n=this.center,r=this.halfExtents,i=t.center,o=t.halfExtents,a=e[0],s=e[4],c=e[8],u=e[1],l=e[5],h=e[9],d=e[2],f=e[6],p=e[10],g=Math.abs(a),m=Math.abs(s),v=Math.abs(c),y=Math.abs(u),b=Math.abs(l),x=Math.abs(h),E=Math.abs(d),w=Math.abs(f),M=Math.abs(p);n[0]=e[12]+a*i[0]+s*i[1]+c*i[2],n[1]=e[13]+u*i[0]+l*i[1]+h*i[2],n[2]=e[14]+d*i[0]+f*i[1]+p*i[2],r[0]=g*o[0]+m*o[1]+v*o[2],r[1]=y*o[0]+b*o[1]+x*o[2],r[2]=E*o[0]+w*o[1]+M*o[2],tr(this.min,n,r),er(this.max,n,r)},t.prototype.intersects=function(t){var e=this.getMax(),n=this.getMin(),r=t.getMax(),i=t.getMin();return n[0]<=r[0]&&e[0]>=i[0]&&n[1]<=r[1]&&e[1]>=i[1]&&n[2]<=r[2]&&e[2]>=i[2]},t.prototype.intersection=function(e){if(!this.intersects(e))return null;var n=new t,r=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t}([0,0,0],this.getMin(),e.getMin()),i=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t}([0,0,0],this.getMax(),e.getMax());return n.setMinMax(r,i),n},t.prototype.getNegativeFarPoint=function(t){return 273===t.pnVertexFlag?Jn([0,0,0],this.min):272===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:257===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:256===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:17===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:16===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:1===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]},t.prototype.getPositiveFarPoint=function(t){return 273===t.pnVertexFlag?Jn([0,0,0],this.max):272===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:257===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:256===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:17===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:16===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:1===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]},t}(),yr=function(){function t(t,e){this.distance=t||0,this.normal=e||tt(0,1,0),this.updatePNVertexFlag()}return t.prototype.updatePNVertexFlag=function(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0)},t.prototype.distanceToPoint=function(t){return st(t,this.normal)-this.distance},t.prototype.normalize=function(){var t=1/ft(this.normal);ot(this.normal,this.normal,t),this.distance*=t},t.prototype.intersectsLine=function(t,e,n){var r=this.distanceToPoint(t),i=r/(r-this.distanceToPoint(e)),o=i>=0&&i<=1;return o&&n&&ut(n,t,e,i),o},t}();!function(t){t[t.OUTSIDE=4294967295]="OUTSIDE",t[t.INSIDE=0]="INSIDE",t[t.INDETERMINATE=2147483647]="INDETERMINATE"}(mr||(mr={}));var br,xr,Er,wr=function(){function t(t){if(this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new yr)}return t.prototype.extractFromVPMatrix=function(t){var e=u(t,16),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],l=e[7],h=e[8],d=e[9],f=e[10],p=e[11],g=e[12],m=e[13],v=e[14],y=e[15];nt(this.planes[0].normal,o-n,l-a,p-h),this.planes[0].distance=y-g,nt(this.planes[1].normal,o+n,l+a,p+h),this.planes[1].distance=y+g,nt(this.planes[2].normal,o+r,l+s,p+d),this.planes[2].distance=y+m,nt(this.planes[3].normal,o-r,l-s,p-d),this.planes[3].distance=y-m,nt(this.planes[4].normal,o-i,l-c,p-f),this.planes[4].distance=y-v,nt(this.planes[5].normal,o+i,l+c,p+f),this.planes[5].distance=y+v,this.planes.forEach((function(t){t.normalize(),t.updatePNVertexFlag()}))},t}(),Mr=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}return t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y},t}(),Nr=function(){function t(t,e,n,r){this.x=t,this.y=e,this.width=n,this.height=r,this.left=t,this.right=t+n,this.top=e,this.bottom=e+r}return t.prototype.toJSON=function(){},t}(),Sr="Method not implemented.",Cr="Use document.documentElement instead.";!function(t){t[t.ORBITING=0]="ORBITING",t[t.EXPLORING=1]="EXPLORING",t[t.TRACKING=2]="TRACKING"}(br||(br={})),function(t){t[t.DEFAULT=0]="DEFAULT",t[t.ROTATIONAL=1]="ROTATIONAL",t[t.TRANSLATIONAL=2]="TRANSLATIONAL",t[t.CINEMATIC=3]="CINEMATIC"}(xr||(xr={})),function(t){t[t.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",t[t.PERSPECTIVE=1]="PERSPECTIVE"}(Er||(Er={}));var Tr,kr,Pr,Ar,Or,_r="updated",Rr=2e-4,Dr=function(){function t(){this.clipSpaceNearZ=Kn.NEGATIVE_ONE,this.eventEmitter=new m,this.matrix=x(),this.right=tt(1,0,0),this.up=tt(0,1,0),this.forward=tt(0,0,1),this.position=tt(0,0,1),this.focalPoint=tt(0,0,0),this.distanceVector=tt(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=x(),this.projectionMatrixInverse=x(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=br.EXPLORING,this.trackingMode=xr.DEFAULT,this.projectionMode=Er.PERSPECTIVE,this.frustum=new wr,this.orthoMatrix=x()}return t.prototype.isOrtho=function(){return this.projectionMode===Er.ORTHOGRAPHIC},t.prototype.getProjectionMode=function(){return this.projectionMode},t.prototype.getPerspective=function(){return this.jitteredProjectionMatrix||this.projectionMatrix},t.prototype.getPerspectiveInverse=function(){return this.projectionMatrixInverse},t.prototype.getFrustum=function(){return this.frustum},t.prototype.getPosition=function(){return this.position},t.prototype.getFocalPoint=function(){return this.focalPoint},t.prototype.getDollyingStep=function(){return this.dollyingStep},t.prototype.getNear=function(){return this.near},t.prototype.getFar=function(){return this.far},t.prototype.getZoom=function(){return this.zoom},t.prototype.getOrthoMatrix=function(){return this.orthoMatrix},t.prototype.getView=function(){return this.view},t.prototype.setEnableUpdate=function(t){this.enableUpdate=t},t.prototype.setType=function(t,e){return this.type=t,this.type===br.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===br.TRACKING&&void 0!==e&&this.setTrackingMode(e),this},t.prototype.setProjectionMode=function(t){return this.projectionMode=t,this},t.prototype.setTrackingMode=function(t){if(this.type!==br.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this},t.prototype.setWorldRotation=function(t){return this.rotateWorld=t,this._getAngles(),this},t.prototype.getViewTransform=function(){return C(x(),this.matrix)},t.prototype.getWorldTransform=function(){return this.matrix},t.prototype.jitterProjectionMatrix=function(t,e){var n=R(x(),[t,e,0]);this.jitteredProjectionMatrix=k(x(),n,this.projectionMatrix)},t.prototype.clearJitterProjectionMatrix=function(){this.jitteredProjectionMatrix=void 0},t.prototype.setMatrix=function(t){return this.matrix=t,this._update(),this},t.prototype.setFov=function(t){return this.setPerspective(this.near,this.far,t,this.aspect),this},t.prototype.setAspect=function(t){return this.setPerspective(this.near,this.far,this.fov,t),this},t.prototype.setNear=function(t){return this.projectionMode===Er.PERSPECTIVE?this.setPerspective(t,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,t,this.far),this},t.prototype.setFar=function(t){return this.projectionMode===Er.PERSPECTIVE?this.setPerspective(this.near,t,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,t),this},t.prototype.setViewOffset=function(t,e,n,r,i,o){return this.aspect=t/e,void 0===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.projectionMode===Er.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},t.prototype.clearViewOffset=function(){return void 0!==this.view&&(this.view.enabled=!1),this.projectionMode===Er.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this},t.prototype.setZoom=function(t){return this.zoom=t,this.projectionMode===Er.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===Er.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this},t.prototype.setZoomByViewportPoint=function(t,e){var n=this.canvas.viewport2Canvas({x:e[0],y:e[1]}),r=n.x,i=n.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(r,i),this.setFocalPoint(r,i),this.setZoom(t),this.rotate(0,0,o);var a=this.canvas.viewport2Canvas({x:e[0],y:e[1]}),s=tt(a.x-r,a.y-i,0),c=st(s,this.right)/J(this.right),u=st(s,this.up)/J(this.up);return this.pan(-c,-u),this},t.prototype.setPerspective=function(t,e,n,r){var i;this.projectionMode=Er.PERSPECTIVE,this.fov=n,this.near=t,this.far=e,this.aspect=r;var o=this.near*Math.tan(or(.5*this.fov))/this.zoom,a=2*o,s=this.aspect*a,c=-.5*s;if(null===(i=this.view)||void 0===i?void 0:i.enabled){var u=this.view.fullWidth,l=this.view.fullHeight;c+=this.view.offsetX*s/u,o-=this.view.offsetY*a/l,s*=this.view.width/u,a*=this.view.height/l}return function(t,e,n,r,i,o,a,s){void 0===s&&(s=!1);var c,u,l=2*o/(n-e),h=2*o/(r-i),d=(n+e)/(n-e),f=(r+i)/(r-i);s?(c=-a/(a-o),u=-a*o/(a-o)):(c=-(a+o)/(a-o),u=-2*a*o/(a-o)),t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=h,t[6]=0,t[7]=0,t[8]=d,t[9]=f,t[10]=c,t[11]=-1,t[12]=0,t[13]=0,t[14]=u,t[15]=0}(this.projectionMatrix,c,c+s,o,o-a,t,this.far,this.clipSpaceNearZ===Kn.ZERO),A(this.projectionMatrix,this.projectionMatrix,tt(1,-1,1)),C(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this},t.prototype.setOrthographic=function(t,e,n,r,i,o){var a;this.projectionMode=Er.ORTHOGRAPHIC,this.rright=e,this.left=t,this.top=n,this.bottom=r,this.near=i,this.far=o;var s=(this.rright-this.left)/(2*this.zoom),c=(this.top-this.bottom)/(2*this.zoom),u=(this.rright+this.left)/2,l=(this.top+this.bottom)/2,h=u-s,d=u+s,f=l+c,p=l-c;if(null===(a=this.view)||void 0===a?void 0:a.enabled){var g=(this.rright-this.left)/this.view.fullWidth/this.zoom,m=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d=(h+=g*this.view.offsetX)+g*this.view.width,p=(f-=m*this.view.offsetY)-m*this.view.height}return this.clipSpaceNearZ===Kn.NEGATIVE_ONE?U(this.projectionMatrix,h,d,p,f,i,o):H(this.projectionMatrix,h,d,p,f,i,o),A(this.projectionMatrix,this.projectionMatrix,tt(1,-1,1)),C(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this},t.prototype.setPosition=function(t,e,n){void 0===e&&(e=this.position[1]),void 0===n&&(n=this.position[2]);var r=ir(t,e,n);return this._setPosition(r),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this},t.prototype.setFocalPoint=function(t,e,n){void 0===e&&(e=this.focalPoint[1]),void 0===n&&(n=this.focalPoint[2]);var r=tt(0,1,0);if(this.focalPoint=ir(t,e,n),this.trackingMode===xr.CINEMATIC){var i=it(Z(),this.focalPoint,this.position);t=i[0],e=i[1],n=i[2];var o=J(i),a=ar(Math.asin(e/o)),s=90+ar(Math.atan2(n,t)),c=x();_(c,c,or(s)),O(c,c,or(a)),r=lt(Z(),[0,1,0],c)}return C(this.matrix,q(x(),this.position,this.focalPoint,r)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this},t.prototype.getDistance=function(){return this.distance},t.prototype.getDistanceVector=function(){return this.distanceVector},t.prototype.setDistance=function(t){if(this.distance===t||t<0)return this;this.distance=t,this.distance<Rr&&(this.distance=Rr),this.dollyingStep=this.distance/100;var e=Z();t=this.distance;var n=this.forward,r=this.focalPoint;return e[0]=t*n[0]+r[0],e[1]=t*n[1]+r[1],e[2]=t*n[2]+r[2],this._setPosition(e),this.triggerUpdate(),this},t.prototype.setMaxDistance=function(t){return this.maxDistance=t,this},t.prototype.setMinDistance=function(t){return this.minDistance=t,this},t.prototype.setAzimuth=function(t){return this.azimuth=rr(t),this.computeMatrix(),this._getAxes(),this.type===br.ORBITING||this.type===br.EXPLORING?this._getPosition():this.type===br.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},t.prototype.getAzimuth=function(){return this.azimuth},t.prototype.setElevation=function(t){return this.elevation=rr(t),this.computeMatrix(),this._getAxes(),this.type===br.ORBITING||this.type===br.EXPLORING?this._getPosition():this.type===br.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},t.prototype.getElevation=function(){return this.elevation},t.prototype.setRoll=function(t){return this.roll=rr(t),this.computeMatrix(),this._getAxes(),this.type===br.ORBITING||this.type===br.EXPLORING?this._getPosition():this.type===br.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this},t.prototype.getRoll=function(){return this.roll},t.prototype._update=function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()},t.prototype.computeMatrix=function(){var t=vt(mt(),[0,0,1],or(this.roll));N(this.matrix);var e=vt(mt(),[1,0,0],or((this.rotateWorld&&this.type!==br.TRACKING||this.type===br.TRACKING?1:-1)*this.elevation)),n=vt(mt(),[0,1,0],or((this.rotateWorld&&this.type!==br.TRACKING||this.type===br.TRACKING?1:-1)*this.azimuth)),r=yt(mt(),n,e);r=yt(mt(),r,t);var i=F(x(),r);this.type===br.ORBITING||this.type===br.EXPLORING?(P(this.matrix,this.matrix,this.focalPoint),k(this.matrix,this.matrix,i),P(this.matrix,this.matrix,[0,0,this.distance])):this.type===br.TRACKING&&(P(this.matrix,this.matrix,this.position),k(this.matrix,this.matrix,i))},t.prototype._setPosition=function(t,e,n){this.position=ir(t,e,n);var r=this.matrix;r[12]=this.position[0],r[13]=this.position[1],r[14]=this.position[2],r[15]=1,this._getOrthoMatrix()},t.prototype._getAxes=function(){et(this.right,ir(gt(pt(),[1,0,0,0],this.matrix))),et(this.up,ir(gt(pt(),[0,1,0,0],this.matrix))),et(this.forward,ir(gt(pt(),[0,0,1,0],this.matrix))),at(this.right,this.right),at(this.up,this.up),at(this.forward,this.forward)},t.prototype._getAngles=function(){var t=this.distanceVector[0],e=this.distanceVector[1],n=this.distanceVector[2],r=J(this.distanceVector);if(0===r)return this.elevation=0,void(this.azimuth=0);this.type===br.TRACKING||this.rotateWorld?(this.elevation=ar(Math.asin(e/r)),this.azimuth=ar(Math.atan2(-t,-n))):(this.elevation=-ar(Math.asin(e/r)),this.azimuth=-ar(Math.atan2(-t,-n)))},t.prototype._getPosition=function(){et(this.position,ir(gt(pt(),[0,0,0,1],this.matrix))),this._getDistance()},t.prototype._getFocalPoint=function(){!function(t,e,n){var r=e[0],i=e[1],o=e[2];t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8]}(this.distanceVector,[0,0,-this.distance],function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}(b(),this.matrix)),rt(this.focalPoint,this.position,this.distanceVector),this._getDistance()},t.prototype._getDistance=function(){this.distanceVector=it(Z(),this.focalPoint,this.position),this.distance=J(this.distanceVector),this.dollyingStep=this.distance/100},t.prototype._getOrthoMatrix=function(){if(this.projectionMode===Er.ORTHOGRAPHIC){var t=this.position,e=vt(mt(),[0,0,1],-this.roll*Math.PI/180);B(this.orthoMatrix,e,tt((this.rright-this.left)/2-t[0],(this.top-this.bottom)/2-t[1],0),tt(this.zoom,this.zoom,1),t)}},t.prototype.triggerUpdate=function(){if(this.enableUpdate){var t=this.getViewTransform(),e=k(x(),this.getPerspective(),t);this.getFrustum().extractFromVPMatrix(e),this.eventEmitter.emit(_r)}},t.prototype.rotate=function(t,e,n){throw new Error(Sr)},t.prototype.pan=function(t,e){throw new Error(Sr)},t.prototype.dolly=function(t){throw new Error(Sr)},t.prototype.createLandmark=function(t,e){throw new Error(Sr)},t.prototype.gotoLandmark=function(t,e){throw new Error(Sr)},t.prototype.cancelLandmarkAnimation=function(){throw new Error(Sr)},t}();function Ir(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var s=t.apply(this,r);return n.cache=a.set(o,s)||a,s};return n.cache=new(Ir.Cache||Map),n}Ir.Cache=Map,function(t){t[t.kUnknown=0]="kUnknown",t[t.kNumber=1]="kNumber",t[t.kPercentage=2]="kPercentage",t[t.kEms=3]="kEms",t[t.kPixels=4]="kPixels",t[t.kRems=5]="kRems",t[t.kDegrees=6]="kDegrees",t[t.kRadians=7]="kRadians",t[t.kGradians=8]="kGradians",t[t.kTurns=9]="kTurns",t[t.kMilliseconds=10]="kMilliseconds",t[t.kSeconds=11]="kSeconds",t[t.kInteger=12]="kInteger"}(Tr||(Tr={})),function(t){t[t.kUNumber=0]="kUNumber",t[t.kUPercent=1]="kUPercent",t[t.kULength=2]="kULength",t[t.kUAngle=3]="kUAngle",t[t.kUTime=4]="kUTime",t[t.kUOther=5]="kUOther"}(kr||(kr={})),function(t){t[t.kAll=0]="kAll",t[t.kNonNegative=1]="kNonNegative",t[t.kInteger=2]="kInteger",t[t.kNonNegativeInteger=3]="kNonNegativeInteger",t[t.kPositiveInteger=4]="kPositiveInteger"}(Pr||(Pr={})),function(t){t[t.kYes=0]="kYes",t[t.kNo=1]="kNo"}(Ar||(Ar={})),function(t){t[t.kYes=0]="kYes",t[t.kNo=1]="kNo"}(Or||(Or={}));var Lr,jr=[{name:"em",unit_type:Tr.kEms},{name:"px",unit_type:Tr.kPixels},{name:"deg",unit_type:Tr.kDegrees},{name:"rad",unit_type:Tr.kRadians},{name:"grad",unit_type:Tr.kGradians},{name:"ms",unit_type:Tr.kMilliseconds},{name:"s",unit_type:Tr.kSeconds},{name:"rem",unit_type:Tr.kRems},{name:"turn",unit_type:Tr.kTurns}];!function(t){t[t.kUnknownType=0]="kUnknownType",t[t.kUnparsedType=1]="kUnparsedType",t[t.kKeywordType=2]="kKeywordType",t[t.kUnitType=3]="kUnitType",t[t.kSumType=4]="kSumType",t[t.kProductType=5]="kProductType",t[t.kNegateType=6]="kNegateType",t[t.kInvertType=7]="kInvertType",t[t.kMinType=8]="kMinType",t[t.kMaxType=9]="kMaxType",t[t.kClampType=10]="kClampType",t[t.kTransformType=11]="kTransformType",t[t.kPositionType=12]="kPositionType",t[t.kURLImageType=13]="kURLImageType",t[t.kColorType=14]="kColorType",t[t.kUnsupportedColorType=15]="kUnsupportedColorType"}(Lr||(Lr={}));var zr,Br=function(t){return t?"number"===t?Tr.kNumber:"percent"===t||"%"===t?Tr.kPercentage:function(t){return jr.find((function(e){return e.name===t})).unit_type}(t):Tr.kUnknown},Fr=function(t){var e=1;switch(t){case Tr.kPixels:case Tr.kDegrees:case Tr.kSeconds:break;case Tr.kMilliseconds:e=.001;break;case Tr.kRadians:e=180/Math.PI;break;case Tr.kGradians:e=.9;break;case Tr.kTurns:e=360}return e},Gr=function(t){switch(t){case Tr.kNumber:case Tr.kInteger:return"";case Tr.kPercentage:return"%";case Tr.kEms:return"em";case Tr.kRems:return"rem";case Tr.kPixels:return"px";case Tr.kDegrees:return"deg";case Tr.kRadians:return"rad";case Tr.kGradians:return"grad";case Tr.kMilliseconds:return"ms";case Tr.kSeconds:return"s";case Tr.kTurns:return"turn"}return""},Vr=function(){function t(){}return t.isAngle=function(t){return t===Tr.kDegrees||t===Tr.kRadians||t===Tr.kGradians||t===Tr.kTurns},t.isLength=function(t){return t>=Tr.kEms&&t<Tr.kDegrees},t.isRelativeUnit=function(t){return t===Tr.kPercentage||t===Tr.kEms||t===Tr.kRems},t.isTime=function(t){return t===Tr.kSeconds||t===Tr.kMilliseconds},t.prototype.toString=function(){return this.buildCSSText(Ar.kNo,Or.kNo,"")},t.prototype.isNumericValue=function(){return this.getType()>=Lr.kUnitType&&this.getType()<=Lr.kClampType},t}(),Wr=function(t){function e(e){var n=t.call(this)||this;return n.colorSpace=e,n}return r(e,t),e.prototype.getType=function(){return Lr.kColorType},e.prototype.to=function(t){return this},e}(Vr);!function(t){t[t.Constant=0]="Constant",t[t.LinearGradient=1]="LinearGradient",t[t.RadialGradient=2]="RadialGradient"}(zr||(zr={}));var Ur=function(t){function e(e,n){var r=t.call(this)||this;return r.type=e,r.value=n,r}return r(e,t),e.prototype.clone=function(){return new e(this.type,this.value)},e.prototype.buildCSSText=function(t,e,n){return n},e.prototype.getType=function(){return Lr.kColorType},e}(Vr),Hr=function(t){function e(e){var n=t.call(this)||this;return n.value=e,n}return r(e,t),e.prototype.clone=function(){return new e(this.value)},e.prototype.getType=function(){return Lr.kKeywordType},e.prototype.buildCSSText=function(t,e,n){return n+this.value},e}(Vr),qr=Ir((function(t){return void 0===t&&(t=""),t.replace(/-([a-z])/g,(function(t){return t[1].toUpperCase()}))})),$r=function(t){return t.split("").map((function(t,e){return t.toUpperCase()===t?"".concat(0!==e?"-":"").concat(t.toLowerCase()):t})).join("")};function Yr(t){return"function"==typeof t}var Kr={d:{alias:"path"},strokeDasharray:{alias:"lineDash"},strokeWidth:{alias:"lineWidth"},textAnchor:{alias:"textAlign"},src:{alias:"img"}},Xr=Ir((function(t){var e=qr(t),n=Kr[e];return e=(null==n?void 0:n.alias)||e})),Zr=function(t,e){void 0===e&&(e="");var n="";return Number.isFinite(t)?(!function(t){if(!t)throw new Error}(Number.isNaN(t)),n="NaN"):n=t>0?"infinity":"-infinity",n+e},Qr=function(t){return function(t){switch(t){case kr.kUNumber:return Tr.kNumber;case kr.kULength:return Tr.kPixels;case kr.kUPercent:return Tr.kPercentage;case kr.kUTime:return Tr.kSeconds;case kr.kUAngle:return Tr.kDegrees;default:return Tr.kUnknown}}(function(t){switch(t){case Tr.kNumber:case Tr.kInteger:return kr.kUNumber;case Tr.kPercentage:return kr.kUPercent;case Tr.kPixels:return kr.kULength;case Tr.kMilliseconds:case Tr.kSeconds:return kr.kUTime;case Tr.kDegrees:case Tr.kRadians:case Tr.kGradians:case Tr.kTurns:return kr.kUAngle;default:return kr.kUOther}}(t))},Jr=function(t){function e(e,n){void 0===n&&(n=Tr.kNumber);var r,i=t.call(this)||this;return r="string"==typeof n?Br(n):n,i.unit=r,i.value=e,i}return r(e,t),e.prototype.clone=function(){return new e(this.value,this.unit)},e.prototype.equals=function(t){var e=t;return this.value===e.value&&this.unit===e.unit},e.prototype.getType=function(){return Lr.kUnitType},e.prototype.convertTo=function(t){if(this.unit===t)return new e(this.value,this.unit);var n=Qr(this.unit);if(n!==Qr(t)||n===Tr.kUnknown)return null;var r=Fr(this.unit)/Fr(t);return new e(this.value*r,t)},e.prototype.buildCSSText=function(t,e,n){var r;switch(this.unit){case Tr.kUnknown:break;case Tr.kInteger:r=Number(this.value).toFixed(0);break;case Tr.kNumber:case Tr.kPercentage:case Tr.kEms:case Tr.kRems:case Tr.kPixels:case Tr.kDegrees:case Tr.kRadians:case Tr.kGradians:case Tr.kMilliseconds:case Tr.kSeconds:case Tr.kTurns:var i=this.value,o=Gr(this.unit);if(i<-999999||i>999999){var a=Gr(this.unit);r=!Number.isFinite(i)||Number.isNaN(i)?Zr(i,a):i+(a||"")}else r="".concat(i).concat(o)}return n+=r},e}(Vr),ti=new Jr(0,"px");new Jr(1,"px");var ei,ni,ri=new Jr(0,"deg"),ii=function(t){function e(e,n,r,i,o){void 0===i&&(i=1),void 0===o&&(o=!1);var a=t.call(this,"rgb")||this;return a.r=e,a.g=n,a.b=r,a.alpha=i,a.isNone=o,a}return r(e,t),e.prototype.clone=function(){return new e(this.r,this.g,this.b,this.alpha)},e.prototype.buildCSSText=function(t,e,n){return n+"rgba(".concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")},e}(Wr),oi=new Hr("unset"),ai=new Hr("initial"),si=new Hr("inherit"),ci={"":oi,unset:oi,initial:ai,inherit:si},ui=function(t){return ci[t]||(ci[t]=new Hr(t)),ci[t]},li=new ii(0,0,0,0,!0),hi=new ii(0,0,0,0),di=Ir((function(t,e,n,r){return new ii(t,e,n,r)}),(function(t,e,n,r){return"rgba(".concat(t,",").concat(e,",").concat(n,",").concat(r,")")})),fi=function(t,e){return void 0===e&&(e=Tr.kNumber),new Jr(t,e)},pi=new Jr(50,"%");!function(t){t[t.Standard=0]="Standard"}(ei||(ei={})),function(t){t[t.ADDED=0]="ADDED",t[t.REMOVED=1]="REMOVED",t[t.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED"}(ni||(ni={}));var gi,mi={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Nr(0,0,0,0)};function vi(t){var e=t.type,n=t.value;return"hex"===e?"#".concat(n):"literal"===e?n:"rgb"===e?"rgb(".concat(n.join(","),")"):"rgba(".concat(n.join(","),")")}!function(t){t.COORDINATE="<coordinate>",t.COLOR="<color>",t.PAINT="<paint>",t.NUMBER="<number>",t.ANGLE="<angle>",t.OPACITY_VALUE="<opacity-value>",t.SHADOW_BLUR="<shadow-blur>",t.LENGTH="<length>",t.PERCENTAGE="<percentage>",t.LENGTH_PERCENTAGE="<length> | <percentage>",t.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",t.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",t.LIST_OF_POINTS="<list-of-points>",t.PATH="<path>",t.FILTER="<filter>",t.Z_INDEX="<z-index>",t.OFFSET_DISTANCE="<offset-distance>",t.DEFINED_PATH="<defined-path>",t.MARKER="<marker>",t.TRANSFORM="<transform>",t.TRANSFORM_ORIGIN="<transform-origin>",t.TEXT="<text>",t.TEXT_TRANSFORM="<text-transform>"}(gi||(gi={}));var yi=function(){var t={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},e="";function n(t){throw new Error(e+": "+t)}function r(){var t=f(i);return e.length>0&&n("Invalid input not EOF"),t}function i(){return o("linear-gradient",t.linearGradient,s)||o("repeating-linear-gradient",t.repeatingLinearGradient,s)||o("radial-gradient",t.radialGradient,c)||o("repeating-radial-gradient",t.repeatingRadialGradient,c)||o("conic-gradient",t.conicGradient,c)}function o(e,r,i){return a(r,(function(r){var o=i();return o&&(b(t.comma)||n("Missing comma before color stops")),{type:e,orientation:o,colorStops:f(p)}}))}function a(e,r){var i=b(e);if(i){b(t.startCall)||n("Missing (");var o=r(i);return b(t.endCall)||n("Missing )"),o}}function s(){return y("directional",t.sideOrCorner,1)||y("angular",t.angleValue,1)}function c(){var n,r,i=u();return i&&((n=[]).push(i),r=e,b(t.comma)&&((i=u())?n.push(i):e=r)),n}function u(){var t=function(){var t=y("shape",/^(circle)/i,0);t&&(t.style=v()||l());return t}()||function(){var t=y("shape",/^(ellipse)/i,0);t&&(t.style=m()||l());return t}();if(t)t.at=h();else{var e=l();if(e){t=e;var n=h();n&&(t.at=n)}else{var r=d();r&&(t={type:"default-radial",at:r})}}return t}function l(){return y("extent-keyword",t.extentKeywords,1)}function h(){if(y("position",/^at/,0)){var t=d();return t||n("Missing positioning value"),t}}function d(){var t={x:m(),y:m()};if(t.x||t.y)return{type:"position",value:t}}function f(e){var r=e(),i=[];if(r)for(i.push(r);b(t.comma);)(r=e())?i.push(r):n("One extra comma");return i}function p(){var e=y("hex",t.hexColor,1)||a(t.rgbaColor,(function(){return{type:"rgba",value:f(g)}}))||a(t.rgbColor,(function(){return{type:"rgb",value:f(g)}}))||y("literal",t.literalColor,0);return e||n("Expected color definition"),e.length=m(),e}function g(){return b(t.number)[1]}function m(){return y("%",t.percentageValue,1)||y("position-keyword",t.positionKeywords,1)||v()}function v(){return y("px",t.pixelValue,1)||y("em",t.emValue,1)}function y(t,e,n){var r=b(e);if(r)return{type:t,value:r[n]}}function b(t){var n=/^[\n\r\t\s]+/.exec(e);n&&x(n[0].length);var r=t.exec(e);return r&&x(r[0].length),r}function x(t){e=e.substring(t)}return function(t){return e=t,r()}}();var bi=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,xi=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,Ei=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,wi=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;var Mi={left:180,top:-90,bottom:90,right:0,"left top":225,"top left":225,"left bottom":135,"bottom left":135,"right top":-45,"top right":-45,"right bottom":45,"bottom right":45},Ni=Ir((function(t){var e;return e="angular"===t.type?Number(t.value):Mi[t.value]||0,fi(e,"deg")})),Si=Ir((function(t){var e=50,n=50,r="%",i="%";if("position"===(null==t?void 0:t.type)){var o=t.value,a=o.x,s=o.y;"position-keyword"===(null==a?void 0:a.type)&&("left"===a.value?e=0:"center"===a.value?e=50:"right"===a.value?e=100:"top"===a.value?n=0:"bottom"===a.value&&(n=100)),"position-keyword"===(null==s?void 0:s.type)&&("left"===s.value?e=0:"center"===s.value?n=50:"right"===s.value?e=100:"top"===s.value?n=0:"bottom"===s.value&&(n=100)),"px"!==(null==a?void 0:a.type)&&"%"!==(null==a?void 0:a.type)&&"em"!==(null==a?void 0:a.type)||(r=null==a?void 0:a.type,e=Number(a.value)),"px"!==(null==s?void 0:s.type)&&"%"!==(null==s?void 0:s.type)&&"em"!==(null==s?void 0:s.type)||(i=null==s?void 0:s.type,n=Number(s.value))}return{cx:fi(e,r),cy:fi(n,i)}})),Ci=Ir((function(t){var e;if(t.indexOf("linear")>-1||t.indexOf("radial")>-1)return yi(t).map((function(t){var e=t.type,n=t.orientation,r=t.colorStops;!function(t){var e,n,r,i=t.length;t[i-1].length=null!==(e=t[i-1].length)&&void 0!==e?e:{type:"%",value:"100"},i>1&&(t[0].length=null!==(n=t[0].length)&&void 0!==n?n:{type:"%",value:"0"});for(var o=0,a=Number(t[0].length.value),s=1;s<i;s++){var c=null===(r=t[s].length)||void 0===r?void 0:r.value;if(!Pt(c)&&!Pt(a)){for(var u=1;u<s-o;u++)t[o+u].length={type:"%",value:"".concat(a+(Number(c)-a)*u/(s-o))};o=s,a=Number(c)}}}(r);var i=r.map((function(t){return{offset:fi(Number(t.length.value),"%"),color:vi(t)}}));if("linear-gradient"===e)return new Ur(zr.LinearGradient,{angle:n?Ni(n):ri,steps:i});if("radial-gradient"===e&&(n||(n=[{type:"shape",value:"circle"}]),"shape"===n[0].type&&"circle"===n[0].value)){var o=Si(n[0].at),a=o.cx,s=o.cy,c=void 0;if(n[0].style){var u=n[0].style,l=u.type,h=u.value;c="extent-keyword"===l?ui(h):fi(h,l)}return new Ur(zr.RadialGradient,{cx:a,cy:s,size:c,steps:i})}}));var n=t[0];if("("===t[1]||"("===t[2])if("l"===n){var r=bi.exec(t);if(r){var i=(null===(e=r[2].match(wi))||void 0===e?void 0:e.map((function(t){return t.split(":")})))||[];return[new Ur(zr.LinearGradient,{angle:fi(parseFloat(r[1]),"deg"),steps:i.map((function(t){var e=u(t,2),n=e[0],r=e[1];return{offset:fi(100*Number(n),"%"),color:r}}))})]}}else if("r"===n){var o=function(t){var e,n=xi.exec(t);if(n){var r=(null===(e=n[4].match(wi))||void 0===e?void 0:e.map((function(t){return t.split(":")})))||[];return{cx:fi(50,"%"),cy:fi(50,"%"),steps:r.map((function(t){var e=u(t,2),n=e[0],r=e[1];return{offset:fi(100*Number(n),"%"),color:r}}))}}return null}(t);if(o){if(!Bt(o))return[new Ur(zr.RadialGradient,o)];t=o}}else if("p"===n)return function(t){var e=Ei.exec(t);if(e){var n=e[1],r=e[2];switch(n){case"a":n="repeat";break;case"x":n="repeat-x";break;case"y":n="repeat-y";break;default:n="no-repeat"}return{image:r,repetition:n}}return null}(t)}));function Ti(t){return t&&!!t.image}function ki(t){return t&&!Pt(t.r)&&!Pt(t.g)&&!Pt(t.b)}var Pi=Ir((function(t){if(Ti(t))return i({repetition:"repeat"},t);if(Pt(t)&&(t=""),"transparent"===t)return hi;"currentColor"===t&&(t="black");var e=Ci(t);if(e)return e;var n=vn(t),r=[0,0,0,0];return null!==n&&(r[0]=n.r||0,r[1]=n.g||0,r[2]=n.b||0,r[3]=n.opacity),di.apply(void 0,l([],u(r),!1))}));function Ai(t,e){if(ki(t)&&ki(e))return[[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],[Number(e.r),Number(e.g),Number(e.b),Number(e.alpha)],function(t){var e=t.slice();if(e[3])for(var n=0;n<3;n++)e[n]=Math.round(Vt(e[n],0,255));return e[3]=Vt(e[3],0,1),"rgba(".concat(e.join(","),")")}]}function Oi(t,e){if(Pt(e))return fi(0,"px");if(e="".concat(e).trim().toLowerCase(),isFinite(Number(e))){if("px".search(t)>=0)return fi(Number(e),"px");if("deg".search(t)>=0)return fi(Number(e),"deg")}var n=[];e=e.replace(t,(function(t){return n.push(t),"U"+t}));var r="U("+t.source+")";return n.map((function(t){return fi(Number(e.replace(new RegExp("U"+t,"g"),"").replace(new RegExp(r,"g"),"*0")),t)}))[0]}var _i=function(t){return Oi(new RegExp("px","g"),t)},Ri=Ir(_i);Ir((function(t){return Oi(new RegExp("%","g"),t)}));var Di=function(t){return Wt(t)||isFinite(Number(t))?fi(Number(t)||0,"px"):Oi(new RegExp("px|%|em|rem","g"),t)},Ii=Ir(Di),Li=function(t){return Oi(new RegExp("deg|rad|grad|turn","g"),t)},ji=Ir(Li);function zi(t,e,n,r,i){void 0===i&&(i=0);var o="",a=t.value||0,s=e.value||0,c=Qr(t.unit),u=t.convertTo(c),l=e.convertTo(c);return u&&l?(a=u.value,s=l.value,o=Gr(t.unit)):(Jr.isLength(t.unit)||Jr.isLength(e.unit))&&(a=Vi(t,i,n),s=Vi(e,i,n),o="px"),[a,s,function(t){return r&&(t=Math.max(t,0)),t+o}]}function Bi(t){var e=0;return t.unit===Tr.kDegrees?e=t.value:t.unit===Tr.kRadians?e=ar(Number(t.value)):t.unit===Tr.kTurns&&(e=360*Number(t.value)),e}function Fi(t,e){var n;return Array.isArray(t)?n=t.map((function(t){return Number(t)})):Bt(t)?n=t.split(" ").map((function(t){return Number(t)})):Wt(t)&&(n=[t]),2===e?1===n.length?[n[0],n[0]]:[n[0],n[1]]:1===n.length?[n[0],n[0],n[0],n[0]]:2===n.length?[n[0],n[1],n[0],n[1]]:3===n.length?[n[0],n[1],n[2],n[1]]:[n[0],n[1],n[2],n[3]]}function Gi(t){return Bt(t)?t.split(" ").map((function(t){return Ii(t)})):t.map((function(t){return Ii(t.toString())}))}function Vi(t,e,n){if(0===t.value)return 0;if(t.unit===Tr.kPixels)return Number(t.value);if(t.unit===Tr.kPercentage&&n){var r=n.nodeName===Yn.GROUP?n.getLocalBounds():n.geometry.contentBounds;return t.value/100*r.halfExtents[e]*2}return 0}var Wi=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function Ui(t){if(void 0===t&&(t=""),"none"===(t=t.toLowerCase().trim()))return[];for(var e,n=/\s*([\w-]+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];if(i=e.index+e[0].length,Wi.indexOf(e[1])>-1&&r.push({name:e[1],params:e[2].split(" ").map((function(t){return Oi(/deg|rad|grad|turn|px|%/g,t)||Pi(t)}))}),n.lastIndex===t.length)return r}return[]}function Hi(t){return t.toString()}var qi=function(t){return"number"==typeof t?fi(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?fi(Number(t)):fi(0)},$i=Ir(qi);function Yi(t,e){return[t,e,Hi]}function Ki(t,e){return function(n,r){return[n,r,function(n){return Hi(Vt(n,t,e))}]}}function Xi(t,e){if(t.length===e.length)return[t,e,function(t){return t}]}function Zi(t){var e;return 0===t.parsedStyle.path.totalLength&&(t.parsedStyle.path.totalLength=qe(t.parsedStyle.path.absolutePath,void 0,i(i({},e),{bbox:!1,length:!0})).length),t.parsedStyle.path.totalLength}function Qi(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ji(t,e){var n=t.prePoint,r=t.currentPoint,i=t.nextPoint,o=Math.pow(r[0]-n[0],2)+Math.pow(r[1]-n[1],2),a=Math.pow(r[0]-i[0],2)+Math.pow(r[1]-i[1],2),s=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),c=Math.acos((o+a-s)/(2*Math.sqrt(o)*Math.sqrt(a)));if(!c||0===Math.sin(c)||Ht(c,0))return{xExtra:0,yExtra:0};var u=Math.abs(Math.atan2(i[1]-r[1],i[0]-r[0])),l=Math.abs(Math.atan2(i[0]-r[0],i[1]-r[1]));return u=u>Math.PI/2?Math.PI-u:u,l=l>Math.PI/2?Math.PI-l:l,{xExtra:Math.cos(c/2-u)*(e/2*(1/Math.sin(c/2)))-e/2||0,yExtra:Math.cos(l-c/2)*(e/2*(1/Math.sin(c/2)))-e/2||0}}function to(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}Ir((function(t){return Bt(t)?t.split(" ").map($i):t.map($i)}));var eo=function(t,e){var n=t.x*e.x+t.y*e.y,r=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2)));return(t.x*e.y-t.y*e.x<0?-1:1)*Math.acos(n/r)},no=function(t,e,n,r,i,o,a,s){e=Math.abs(e),n=Math.abs(n);var c=or(r=qt(r,360));if(t.x===a.x&&t.y===a.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(0===e||0===n)return{x:0,y:0,ellipticalArcAngle:0};var u=(t.x-a.x)/2,l=(t.y-a.y)/2,h={x:Math.cos(c)*u+Math.sin(c)*l,y:-Math.sin(c)*u+Math.cos(c)*l},d=Math.pow(h.x,2)/Math.pow(e,2)+Math.pow(h.y,2)/Math.pow(n,2);d>1&&(e=Math.sqrt(d)*e,n=Math.sqrt(d)*n);var f=(Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(h.y,2)-Math.pow(n,2)*Math.pow(h.x,2))/(Math.pow(e,2)*Math.pow(h.y,2)+Math.pow(n,2)*Math.pow(h.x,2));f=f<0?0:f;var p=(i!==o?1:-1)*Math.sqrt(f),g=p*(e*h.y/n),m=p*(-n*h.x/e),v={x:Math.cos(c)*g-Math.sin(c)*m+(t.x+a.x)/2,y:Math.sin(c)*g+Math.cos(c)*m+(t.y+a.y)/2},y={x:(h.x-g)/e,y:(h.y-m)/n},b=eo({x:1,y:0},y),x=eo(y,{x:(-h.x-g)/e,y:(-h.y-m)/n});!o&&x>0?x-=2*Math.PI:o&&x<0&&(x+=2*Math.PI);var E=b+(x%=2*Math.PI)*s,w=e*Math.cos(E),M=n*Math.sin(E);return{x:Math.cos(c)*w-Math.sin(c)*M+v.x,y:Math.sin(c)*w+Math.cos(c)*M+v.y,ellipticalArcStartAngle:b,ellipticalArcEndAngle:b+x,ellipticalArcAngle:E,ellipticalArcCenter:v,resultantRx:e,resultantRy:n}};function ro(t,e,n){void 0===n&&(n=!0);var r=t.arcParams,i=r.rx,o=void 0===i?0:i,a=r.ry,s=void 0===a?0:a,c=r.xRotation,u=r.arcFlag,l=r.sweepFlag,h=no({x:t.prePoint[0],y:t.prePoint[1]},o,s,c,!!u,!!l,{x:t.currentPoint[0],y:t.currentPoint[1]},e),d=no({x:t.prePoint[0],y:t.prePoint[1]},o,s,c,!!u,!!l,{x:t.currentPoint[0],y:t.currentPoint[1]},n?e+.005:e-.005),f=d.x-h.x,p=d.y-h.y,g=Math.sqrt(f*f+p*p);return{x:-f/g,y:-p/g}}function io(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function oo(t,e){return io(t)*io(e)?(t[0]*e[0]+t[1]*e[1])/(io(t)*io(e)):1}function ao(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(oo(t,e))}function so(t,e){var n=e[1],r=e[2],i=qt(or(e[3]),2*Math.PI),o=e[4],a=e[5],s=t[0],c=t[1],u=e[6],l=e[7],h=Math.cos(i)*(s-u)/2+Math.sin(i)*(c-l)/2,d=-1*Math.sin(i)*(s-u)/2+Math.cos(i)*(c-l)/2,f=h*h/(n*n)+d*d/(r*r);f>1&&(n*=Math.sqrt(f),r*=Math.sqrt(f));var p=n*n*(d*d)+r*r*(h*h),g=p?Math.sqrt((n*n*(r*r)-p)/p):1;o===a&&(g*=-1),isNaN(g)&&(g=0);var m=r?g*n*d/r:0,v=n?g*-r*h/n:0,y=(s+u)/2+Math.cos(i)*m-Math.sin(i)*v,b=(c+l)/2+Math.sin(i)*m+Math.cos(i)*v,x=[(h-m)/n,(d-v)/r],E=[(-1*h-m)/n,(-1*d-v)/r],w=ao([1,0],x),M=ao(x,E);return oo(x,E)<=-1&&(M=Math.PI),oo(x,E)>=1&&(M=0),0===a&&M>0&&(M-=2*Math.PI),1===a&&M<0&&(M+=2*Math.PI),{cx:y,cy:b,rx:Qi(t,[u,l])?0:n,ry:Qi(t,[u,l])?0:r,startAngle:w,endAngle:w+M,xRotation:i,arcFlag:o,sweepFlag:a}}var co=function(t){if(""===t||Array.isArray(t)&&0===t.length)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=Ae(t)}catch(n){e=Ae(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}!function(t){for(var e=0;e<t.length;e++){var n=t[e-1],r=t[e];if("M"===r[0]&&n){var i=n[0],o=[r[1],r[2]],a=void 0;"L"===i||"M"===i?a=[n[1],n[2]]:"C"!==i&&"A"!==i&&"Q"!==i||(a=[n[n.length-2],n[n.length-1]]),a&&Qi(o,a)&&(t.splice(e,1),e--)}}}(e);var n=function(t){for(var e=!1,n=t.length,r=0;r<n;r++){var i=t[r][0];if("C"===i||"A"===i||"Q"===i){e=!0;break}}return e}(e),r=function(t){for(var e=[],n=[],r=[],i=0;i<t.length;i++){var o=t[i],a=o[0];"M"===a?(r.length&&(n.push(r),r=[]),r.push([o[1],o[2]])):"Z"===a?r.length&&(e.push(r),r=[]):r.push([o[1],o[2]])}return r.length>0&&n.push(r),{polygons:e,polylines:n}}(e),i=r.polygons,o=r.polylines,a=function(t){for(var e=[],n=null,r=null,i=null,o=0,a=t.length,s=0;s<a;s++){var c=t[s];r=t[s+1];var u=c[0],l={command:u,prePoint:n,params:c,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(u){case"M":i=[c[1],c[2]],o=s;break;case"A":var h=so(n,c);l.arcParams=h}if("Z"===u)n=i,r=t[o+1];else{var d=c.length;n=[c[d-2],c[d-1]]}r&&"Z"===r[0]&&(r=t[o],e[o]&&(e[o].prePoint=n)),l.currentPoint=n,e[o]&&Qi(n,e[o].currentPoint)&&(e[o].prePoint=l.prePoint);var f=r?[r[r.length-2],r[r.length-1]]:null;l.nextPoint=f;var p=l.prePoint;if(["L","H","V"].includes(u))l.startTangent=[p[0]-n[0],p[1]-n[1]],l.endTangent=[n[0]-p[0],n[1]-p[1]];else if("Q"===u){var g=[c[1],c[2]];l.startTangent=[p[0]-g[0],p[1]-g[1]],l.endTangent=[n[0]-g[0],n[1]-g[1]]}else if("T"===u)g=to((y=e[s-1]).currentPoint,p),"Q"===y.command?(l.command="Q",l.startTangent=[p[0]-g[0],p[1]-g[1]],l.endTangent=[n[0]-g[0],n[1]-g[1]]):(l.command="TL",l.startTangent=[p[0]-n[0],p[1]-n[1]],l.endTangent=[n[0]-p[0],n[1]-p[1]]);else if("C"===u){var m=[c[1],c[2]],v=[c[3],c[4]];l.startTangent=[p[0]-m[0],p[1]-m[1]],l.endTangent=[n[0]-v[0],n[1]-v[1]],0===l.startTangent[0]&&0===l.startTangent[1]&&(l.startTangent=[m[0]-v[0],m[1]-v[1]]),0===l.endTangent[0]&&0===l.endTangent[1]&&(l.endTangent=[v[0]-m[0],v[1]-m[1]])}else if("S"===u){var y;m=to((y=e[s-1]).currentPoint,p),v=[c[1],c[2]],"C"===y.command?(l.command="C",l.startTangent=[p[0]-m[0],p[1]-m[1]],l.endTangent=[n[0]-v[0],n[1]-v[1]]):(l.command="SQ",l.startTangent=[p[0]-v[0],p[1]-v[1]],l.endTangent=[n[0]-v[0],n[1]-v[1]])}else if("A"===u){var b=ro(l,0),x=b.x,E=b.y,w=ro(l,1,!1),M=w.x,N=w.y;l.startTangent=[x,E],l.endTangent=[M,N]}e.push(l)}return e}(e),s=function(t,e){for(var n=[],r=[],i=[],o=0;o<t.length;o++){var a=(g=t[o]).currentPoint,s=g.params,c=g.prePoint,u=void 0;switch(g.command){case"Q":u=Hn(c[0],c[1],s[1],s[2],s[3],s[4]);break;case"C":u=Fn(c[0],c[1],s[1],s[2],s[3],s[4],s[5],s[6]);break;case"A":var l=g.arcParams;u=_n(l.cx,l.cy,l.rx,l.ry,l.xRotation,l.startAngle,l.endAngle);break;default:n.push(a[0]),r.push(a[1])}u&&(g.box=u,n.push(u.x,u.x+u.width),r.push(u.y,u.y+u.height)),e&&("L"===g.command||"M"===g.command)&&g.prePoint&&g.nextPoint&&i.push(g)}n=n.filter((function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0})),r=r.filter((function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0}));var h=zt(n),d=zt(r),f=jt(n),p=jt(r);if(0===i.length)return{x:h,y:d,width:f-h,height:p-d};for(o=0;o<i.length;o++){var g;(a=(g=i[o]).currentPoint)[0]===h?h-=Ji(g,e).xExtra:a[0]===f&&(f+=Ji(g,e).xExtra),a[1]===d?d-=Ji(g,e).yExtra:a[1]===p&&(p+=Ji(g,e).yExtra)}return{x:h,y:d,width:f-h,height:p-d}}(a,0),c=s.x,u=s.y,l=s.width,h=s.height;return{absolutePath:e,hasArc:n,segments:a,polygons:i,polylines:o,totalLength:0,rect:{x:Number.isFinite(c)?c:0,y:Number.isFinite(u)?u:0,width:Number.isFinite(l)?l:0,height:Number.isFinite(h)?h:0}}},uo=Ir(co);function lo(t){return Bt(t)?uo(t):co(t)}function ho(t,e,n){var r=t.curve,i=e.curve;r&&0!==r.length||(r=Le(t.absolutePath,!1),t.curve=r),i&&0!==i.length||(i=Le(e.absolutePath,!1),e.curve=i);var o=[r,i];r.length!==i.length&&(o=Xe(r,i));var a,s,c=Ye(o[0])!==Ye(o[1])?(a=o[0],s=a.slice(1).map((function(t,e,n){return e?n[e-1].slice(-2).concat(t.slice(1)):a[0].slice(1).concat(t.slice(1))})).map((function(t){return t.map((function(e,n){return t[t.length-n-2*(1-n%2)]}))})).reverse(),[["M"].concat(s[0].slice(0,2))].concat(s.map((function(t){return["C"].concat(t.slice(2))})))):o[0].map((function(t){return Array.isArray(t)?[].concat(t):t}));return[c,$e(o[1],c),function(t){return t}]}function fo(t,e){var n;n=Bt(t)?t.split(" ").map((function(t){var e=u(t.split(","),2),n=e[0],r=e[1];return[Number(n),Number(r)]})):t;var r,i,o=[],a=0,s=Vn(n);n.forEach((function(t,e){n[e+1]&&((r=[0,0])[0]=a/s,i=In(t[0],t[1],n[e+1][0],n[e+1][1]),a+=i,r[1]=a/s,o.push(r))}));var c=Math.min.apply(Math,l([],u(n.map((function(t){return t[0]}))),!1)),h=Math.min.apply(Math,l([],u(n.map((function(t){return t[1]}))),!1));return e&&(e.parsedStyle.defX=c,e.parsedStyle.defY=h),{points:n,totalLength:s,segments:o}}function po(t,e){return[t.points,e.points,function(t){return t}]}var go=null;function mo(t){return function(e){var n=0;return t.map((function(t){return t===go?e[n++]:t}))}}function vo(t){return t}var yo={matrix:["NNNNNN",[go,go,0,0,go,go,0,0,0,0,1,0,go,go,0,1],vo],matrix3d:["NNNNNNNNNNNNNNNN",vo],rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",mo([go,go,new Jr(1)]),vo],scalex:["N",mo([go,new Jr(1),new Jr(1)]),mo([go,new Jr(1)])],scaley:["N",mo([new Jr(1),go,new Jr(1)]),mo([new Jr(1),go])],scalez:["N",mo([new Jr(1),new Jr(1),go])],scale3d:["NNN",vo],skew:["Aa",null,vo],skewx:["A",null,mo([go,ri])],skewy:["A",null,mo([ri,go])],translate:["Tt",mo([go,go,ti]),vo],translatex:["T",mo([go,ti,ti]),mo([go,ti])],translatey:["T",mo([ti,go,ti]),mo([ti,go])],translatez:["L",mo([ti,ti,go])],translate3d:["TTL",vo]};function bo(t){if("none"===(t=(t||"none").toLowerCase().trim()))return[];for(var e,n=/\s*(\w+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];i=e.index+e[0].length;var o=e[1],a=yo[o];if(!a)return[];var s=e[2].split(","),c=a[0];if(c.length<s.length)return[];for(var u=[],l=0;l<c.length;l++){var h=s[l],d=c[l],f=void 0;if(void 0===(f=h?{A:function(t){return"0"===t.trim()?ri:ji(t)},N:$i,T:Ii,L:Ri}[d.toUpperCase()](h):{a:ri,n:u[0],t:ti}[d]))return[];u.push(f)}if(r.push({t:o,d:u}),n.lastIndex===t.length)return r}return[]}function xo(t){if("none"===(t=(t||"none").toLowerCase().trim()))return[];for(var e,n=/\s*(\w+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];i=e.index+e[0].length;var o=e[1],a=yo[o];if(!a)return[];var s=e[2].split(","),c=a[0];if(c.length<s.length)return[];for(var u=[],l=0;l<c.length;l++){var h=s[l],d=c[l],f=void 0;if(void 0===(f=h?{A:function(t){return"0"===t.trim()?ri:Li(t)},N:qi,T:Di,L:_i}[d.toUpperCase()](h):{a:ri,n:u[0],t:ti}[d]))return[];u.push(f)}if(r.push({t:o,d:u}),n.lastIndex===t.length)return r}return[]}function Eo(t){var e,n,r,i;switch(t.t){case"rotatex":return i=or(Bi(t.d[0])),[1,0,0,0,0,Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1];case"rotatey":return i=or(Bi(t.d[0])),[Math.cos(i),0,-Math.sin(i),0,0,1,0,0,Math.sin(i),0,Math.cos(i),0,0,0,0,1];case"rotate":case"rotatez":return i=or(Bi(t.d[0])),[Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1,0,0,0,0,1];case"rotate3d":e=t.d[0].value,n=t.d[1].value,r=t.d[2].value,i=or(Bi(t.d[3]));var o=e*e+n*n+r*r;if(0===o)e=1,n=0,r=0;else if(1!==o){var a=Math.sqrt(o);e/=a,n/=a,r/=a}var s=Math.sin(i/2),c=s*Math.cos(i/2),u=s*s;return[1-2*(n*n+r*r)*u,2*(e*n*u+r*c),2*(e*r*u-n*c),0,2*(e*n*u-r*c),1-2*(e*e+r*r)*u,2*(n*r*u+e*c),0,2*(e*r*u+n*c),2*(n*r*u-e*c),1-2*(e*e+n*n)*u,0,0,0,0,1];case"scale":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scalex":return[t.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaley":return[1,0,0,0,0,t.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scalez":return[1,0,0,0,0,1,0,0,0,0,t.d[0].value,0,0,0,0,1];case"scale3d":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,t.d[2].value,0,0,0,0,1];case"skew":var l=or(Bi(t.d[0])),h=or(Bi(t.d[1]));return[1,Math.tan(h),0,0,Math.tan(l),1,0,0,0,0,1,0,0,0,0,1];case"skewx":return i=or(Bi(t.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewy":return i=or(Bi(t.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Vi(t.d[0],0,null)||0,n=Vi(t.d[1],0,null)||0,0,1];case"translatex":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Vi(t.d[0],0,null)||0,0,0,1];case"translatey":return[1,0,0,0,0,1,0,0,0,0,1,0,0,n=Vi(t.d[0],0,null)||0,0,1];case"translatez":return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,r=Vi(t.d[0],0,null)||0,1];case"translate3d":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Vi(t.d[0],0,null)||0,n=Vi(t.d[1],0,null)||0,r=Vi(t.d[2],0,null)||0,1];case"perspective":var d=Vi(t.d[0],0,null)||0;return[1,0,0,0,0,1,0,0,0,0,1,d?-1/d:0,0,0,0,1];case"matrix":return[t.d[0].value,t.d[1].value,0,0,t.d[2].value,t.d[3].value,0,0,0,0,1,0,t.d[4].value,t.d[5].value,0,1];case"matrix3d":return t.d.map((function(t){return t.value}))}}function wo(t,e){return[t[0]*e[0]+t[4]*e[1]+t[8]*e[2]+t[12]*e[3],t[1]*e[0]+t[5]*e[1]+t[9]*e[2]+t[13]*e[3],t[2]*e[0]+t[6]*e[1]+t[10]*e[2]+t[14]*e[3],t[3]*e[0]+t[7]*e[1]+t[11]*e[2]+t[15]*e[3],t[0]*e[4]+t[4]*e[5]+t[8]*e[6]+t[12]*e[7],t[1]*e[4]+t[5]*e[5]+t[9]*e[6]+t[13]*e[7],t[2]*e[4]+t[6]*e[5]+t[10]*e[6]+t[14]*e[7],t[3]*e[4]+t[7]*e[5]+t[11]*e[6]+t[15]*e[7],t[0]*e[8]+t[4]*e[9]+t[8]*e[10]+t[12]*e[11],t[1]*e[8]+t[5]*e[9]+t[9]*e[10]+t[13]*e[11],t[2]*e[8]+t[6]*e[9]+t[10]*e[10]+t[14]*e[11],t[3]*e[8]+t[7]*e[9]+t[11]*e[10]+t[15]*e[11],t[0]*e[12]+t[4]*e[13]+t[8]*e[14]+t[12]*e[15],t[1]*e[12]+t[5]*e[13]+t[9]*e[14]+t[13]*e[15],t[2]*e[12]+t[6]*e[13]+t[10]*e[14]+t[14]*e[15],t[3]*e[12]+t[7]*e[13]+t[11]*e[14]+t[15]*e[15]]}function Mo(t){var e=[0,0,0],n=[1,1,1],r=[0,0,0],i=[0,0,0,1],o=[0,0,0,1];return function(t,e,n,r,i,o){if(!function(t,e){var n=e[15];if(0===n)return!1;for(var r=1/n,i=0;i<16;i++)t[i]=e[i]*r;return!0}(lr,t))return!1;if(w(hr,lr),hr[3]=0,hr[7]=0,hr[11]=0,hr[15]=1,Math.abs(T(hr))<1e-8)return!1;var a,s,c=lr[3],u=lr[7],l=lr[11],h=lr[12],d=lr[13],f=lr[14],p=lr[15];if(0!==c||0!==u||0!==l){if(dr[0]=c,dr[1]=u,dr[2]=l,dr[3]=p,!C(hr,hr))return!1;S(hr,hr),gt(i,dr,hr)}else i[0]=i[1]=i[2]=0,i[3]=1;if(e[0]=h,e[1]=d,e[2]=f,s=lr,(a=fr)[0][0]=s[0],a[0][1]=s[1],a[0][2]=s[2],a[1][0]=s[4],a[1][1]=s[5],a[1][2]=s[6],a[2][0]=s[8],a[2][1]=s[9],a[2][2]=s[10],n[0]=J(fr[0]),at(fr[0],fr[0]),r[0]=st(fr[0],fr[1]),gr(fr[1],fr[1],fr[0],1,-r[0]),n[1]=J(fr[1]),at(fr[1],fr[1]),r[0]/=n[1],r[1]=st(fr[0],fr[2]),gr(fr[2],fr[2],fr[0],1,-r[1]),r[2]=st(fr[1],fr[2]),gr(fr[2],fr[2],fr[1],1,-r[2]),n[2]=J(fr[2]),at(fr[2],fr[2]),r[1]/=n[2],r[2]/=n[2],ct(pr,fr[1],fr[2]),st(fr[0],pr)<0)for(var g=0;g<3;g++)n[g]*=-1,fr[g][0]*=-1,fr[g][1]*=-1,fr[g][2]*=-1;o[0]=.5*Math.sqrt(Math.max(1+fr[0][0]-fr[1][1]-fr[2][2],0)),o[1]=.5*Math.sqrt(Math.max(1-fr[0][0]+fr[1][1]-fr[2][2],0)),o[2]=.5*Math.sqrt(Math.max(1-fr[0][0]-fr[1][1]+fr[2][2],0)),o[3]=.5*Math.sqrt(Math.max(1+fr[0][0]+fr[1][1]+fr[2][2],0)),fr[2][1]>fr[1][2]&&(o[0]=-o[0]),fr[0][2]>fr[2][0]&&(o[1]=-o[1]),fr[1][0]>fr[0][1]&&(o[2]=-o[2])}(function(t){return 0===t.length?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:t.map(Eo).reduce(wo)}(t),e,n,r,i,o),[[e,n,r,o,i]]}var No=function(){function t(t,e){for(var n=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],r=0;r<4;r++)for(var i=0;i<4;i++)for(var o=0;o<4;o++)n[r][i]+=e[r][o]*t[o][i];return n}return function(e,n,r,i,o){for(var a=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],s=0;s<4;s++)a[s][3]=o[s];for(s=0;s<3;s++)for(var c=0;c<3;c++)a[3][s]+=e[c]*a[c][s];var u=i[0],l=i[1],h=i[2],d=i[3],f=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];f[0][0]=1-2*(l*l+h*h),f[0][1]=2*(u*l-h*d),f[0][2]=2*(u*h+l*d),f[1][0]=2*(u*l+h*d),f[1][1]=1-2*(u*u+h*h),f[1][2]=2*(l*h-u*d),f[2][0]=2*(u*h-l*d),f[2][1]=2*(l*h+u*d),f[2][2]=1-2*(u*u+l*l),a=t(a,f);var p=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];for(r[2]&&(p[2][1]=r[2],a=t(a,p)),r[1]&&(p[2][1]=0,p[2][0]=r[0],a=t(a,p)),r[0]&&(p[2][0]=0,p[1][0]=r[0],a=t(a,p)),s=0;s<3;s++)for(c=0;c<3;c++)a[s][c]*=n[s];return function(t){return 0==t[0][2]&&0==t[0][3]&&0==t[1][2]&&0==t[1][3]&&0==t[2][0]&&0==t[2][1]&&1==t[2][2]&&0==t[2][3]&&0==t[3][2]&&1==t[3][3]}(a)?[a[0][0],a[0][1],a[1][0],a[1][1],a[3][0],a[3][1]]:a[0].concat(a[1],a[2],a[3])}}();function So(t){return t.toFixed(6).replace(".000000","")}function Co(t,e){var n,r;return t.decompositionPair!==e&&(t.decompositionPair=e,n=Mo(t)),e.decompositionPair!==t&&(e.decompositionPair=t,r=Mo(e)),null===n[0]||null===r[0]?[[!1],[!0],function(n){return n?e[0].d:t[0].d}]:(n[0].push(0),r[0].push(1),[n,r,function(t){var e=function(t,e,n){var r=function(t,e){for(var n=0,r=0;r<t.length;r++)n+=t[r]*e[r];return n}(t,e);r=Vt(r,-1,1);var i=[];if(1===r)i=t;else for(var o=Math.acos(r),a=1*Math.sin(n*o)/Math.sqrt(1-r*r),s=0;s<4;s++)i.push(t[s]*(Math.cos(n*o)-r*a)+e[s]*a);return i}(n[0][3],r[0][3],t[5]);return No(t[0],t[1],t[2],e,t[4]).map(So).join(",")}])}function To(t){return t.replace(/[xy]/,"")}function ko(t){return t.replace(/(x|y|z|3d)?$/,"3d")}function Po(t,e,n){var r=!1;if(!t.length||!e.length){t.length||(r=!0,t=e,e=[]);for(var i=function(n){var r=t[n],i=r.t,o=r.d,a="scale"===i.substring(0,5)?1:0;e.push({t:i,d:o.map((function(t){return"number"==typeof t?fi(a):fi(a,t.unit)}))})},o=0;o<t.length;o++)i(o)}var a,s,c=[],u=[],l=[];if(t.length!==e.length)c=[(y=Co(t,e))[0]],u=[y[1]],l=[["matrix",[y[2]]]];else for(o=0;o<t.length;o++){var h=t[o].t,d=e[o].t,f=t[o].d,p=e[o].d,g=yo[h],m=yo[d],v=void 0;if(s=d,"perspective"===(a=h)&&"perspective"===s||!("matrix"!==a&&"matrix3d"!==a||"matrix"!==s&&"matrix3d"!==s)){var y=Co([t[o]],[e[o]]);c.push(y[0]),u.push(y[1]),l.push(["matrix",[y[2]]])}else{if(h===d)v=h;else if(g[2]&&m[2]&&To(h)===To(d))v=To(h),f=g[2](f),p=m[2](p);else{if(!g[1]||!m[1]||ko(h)!==ko(d)){c=[(y=Co(t,e))[0]],u=[y[1]],l=[["matrix",[y[2]]]];break}v=ko(h),f=g[1](f),p=m[1](p)}for(var b=[],x=[],E=[],w=0;w<f.length;w++){y=zi(f[w],p[w],n,!1,w);b[w]=y[0],x[w]=y[1],E.push(y[2])}c.push(b),u.push(x),l.push([v,E])}}if(r){var M=c;c=u,u=M}return[c,u,function(t){return t.map((function(t,e){var n=t.map((function(t,n){return l[e][1][n](t)})).join(",");return"matrix"===l[e][0]&&16===n.split(",").length&&(l[e][0]="matrix3d"),"matrix3d"===l[e][0]&&6===n.split(",").length&&(l[e][0]="matrix"),l[e][0]+"("+n+")"})).join(" ")}]}var Ao=Ir((function(t){if(Bt(t)){if("text-anchor"===t)return[fi(0,"px"),fi(0,"px")];var e=t.split(" ");return 1===e.length&&("top"===e[0]||"bottom"===e[0]?(e[1]=e[0],e[0]="center"):e[1]="center"),2!==e.length?null:[Ii(_o(e[0])),Ii(_o(e[1]))]}return[fi(t[0]||0,"px"),fi(t[1]||0,"px")]})),Oo=function(t){if(Bt(t)){if("text-anchor"===t)return[fi(0,"px"),fi(0,"px")];var e=t.split(" ");return 1===e.length&&("top"===e[0]||"bottom"===e[0]?(e[1]=e[0],e[0]="center"):e[1]="center"),2!==e.length?null:[Di(_o(e[0])),Di(_o(e[1]))]}return[fi(t[0]||0,"px"),fi(t[1]||0,"px")]};function _o(t){return"center"===t?"50%":"left"===t||"top"===t?"0":"right"===t||"bottom"===t?"100%":t}var Ro=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:gi.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:gi.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:gi.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:gi.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:gi.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:gi.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:gi.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:gi.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:gi.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:gi.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:gi.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:gi.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:gi.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:gi.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:gi.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:gi.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:gi.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:gi.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:gi.FILTER},{n:"clipPath",syntax:gi.DEFINED_PATH},{n:"textPath",syntax:gi.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:gi.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:gi.TRANSFORM},{n:"transformOrigin",p:100,d:function(t){return t===Yn.CIRCLE||t===Yn.ELLIPSE?"center":t===Yn.TEXT?"text-anchor":"left top"},l:!0,syntax:gi.TRANSFORM_ORIGIN},{n:"anchor",p:99,d:function(t){return t===Yn.CIRCLE||t===Yn.ELLIPSE?"0.5 0.5":"0 0"},l:!0,syntax:gi.LENGTH_PERCENTAGE_12},{n:"cx",int:!0,d:"0",syntax:gi.COORDINATE},{n:"cy",int:!0,d:"0",syntax:gi.COORDINATE},{n:"cz",int:!0,d:"0",syntax:gi.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:gi.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:gi.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:gi.LENGTH_PERCENTAGE},{n:"x",int:!0,d:"0",syntax:gi.COORDINATE},{n:"y",int:!0,d:"0",syntax:gi.COORDINATE},{n:"z",int:!0,d:"0",syntax:gi.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:gi.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:gi.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:gi.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:gi.COORDINATE},{n:"y1",int:!0,l:!0,syntax:gi.COORDINATE},{n:"z1",int:!0,l:!0,syntax:gi.COORDINATE},{n:"x2",int:!0,l:!0,syntax:gi.COORDINATE},{n:"y2",int:!0,l:!0,syntax:gi.COORDINATE},{n:"z2",int:!0,l:!0,syntax:gi.COORDINATE},{n:"path",int:!0,l:!0,d:"",a:["d"],syntax:gi.PATH,p:50},{n:"points",int:!0,l:!0,syntax:gi.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:gi.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:gi.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:gi.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:gi.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:gi.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:gi.NUMBER,d:function(t){return t===Yn.PATH||t===Yn.POLYGON||t===Yn.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:gi.MARKER},{n:"markerEnd",syntax:gi.MARKER},{n:"markerMid",syntax:gi.MARKER},{n:"markerStartOffset",syntax:gi.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:gi.LENGTH,l:!0,int:!0,d:"0"}],Do=Ro.filter((function(t){return!!t.l})).map((function(t){return t.n})),Io={},Lo=new WeakMap,jo=function(){function t(t){var e=this;this.runtime=t,Ro.forEach((function(t){e.registerMetadata(t)}))}return t.prototype.registerMetadata=function(t){l([t.n],u(t.a||[]),!1).forEach((function(e){Io[e]=t}))},t.prototype.unregisterMetadata=function(t){delete Io[t]},t.prototype.getPropertySyntax=function(t){return this.runtime.CSSPropertySyntaxFactory[t]},t.prototype.processProperties=function(t,e,n){var r=this;if(void 0===n&&(n={skipUpdateAttribute:!1,skipParse:!1,forceUpdateGeometry:!1,usedAttributes:[],memoize:!0}),!this.runtime.enableCSSParsing){Object.assign(t.attributes,e);var o=Object.keys(e),a=t.parsedStyle.clipPath,s=t.parsedStyle.offsetPath;t.parsedStyle=Object.assign(t.parsedStyle,e);var c=!!n.forceUpdateGeometry;if(!c)for(var u=0;u<Do.length;u++)if(Do[u]in e){c=!0;break}return e.fill&&(t.parsedStyle.fill=Pi(e.fill)),e.stroke&&(t.parsedStyle.stroke=Pi(e.stroke)),e.shadowColor&&(t.parsedStyle.shadowColor=Pi(e.shadowColor)),e.filter&&(t.parsedStyle.filter=Ui(e.filter)),Pt(e.radius)||(t.parsedStyle.radius=Fi(e.radius,4)),Pt(e.lineDash)||(t.parsedStyle.lineDash=Fi(e.lineDash,2)),e.points&&(t.parsedStyle.points=fo(e.points,t)),""===e.path&&(t.parsedStyle.path=i({},mi)),e.path&&(t.parsedStyle.path=lo(e.path),t.parsedStyle.defX=t.parsedStyle.path.rect.x,t.parsedStyle.defY=t.parsedStyle.path.rect.y),e.textTransform&&this.runtime.CSSPropertySyntaxFactory["<text-transform>"].calculator(null,null,{value:e.textTransform},t,null),e.clipPath&&this.runtime.CSSPropertySyntaxFactory["<defined-path>"].calculator("clipPath",a,e.clipPath,t,this.runtime),e.offsetPath&&this.runtime.CSSPropertySyntaxFactory["<defined-path>"].calculator("offsetPath",s,e.offsetPath,t,this.runtime),e.anchor&&(t.parsedStyle.anchor=Fi(e.anchor,2)),e.transform&&(t.parsedStyle.transform=bo(e.transform)),e.transformOrigin&&(t.parsedStyle.transformOrigin=Ao(e.transformOrigin)),e.markerStart&&(t.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory["<marker>"].calculator(null,e.markerStart,e.markerStart,null,null)),e.markerEnd&&(t.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory["<marker>"].calculator(null,e.markerEnd,e.markerEnd,null,null)),e.markerMid&&(t.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory["<marker>"].calculator("",e.markerMid,e.markerMid,null,null)),(t.nodeName!==Yn.CIRCLE&&t.nodeName!==Yn.ELLIPSE||Pt(e.cx)&&Pt(e.cy))&&(t.nodeName!==Yn.RECT&&t.nodeName!==Yn.IMAGE&&t.nodeName!==Yn.GROUP&&t.nodeName!==Yn.HTML&&t.nodeName!==Yn.TEXT&&t.nodeName!==Yn.MESH||Pt(e.x)&&Pt(e.y)&&Pt(e.z))&&(t.nodeName!==Yn.LINE||Pt(e.x1)&&Pt(e.y1)&&Pt(e.z1)&&Pt(e.x2)&&Pt(e.y2)&&Pt(e.z2))||this.runtime.CSSPropertySyntaxFactory["<coordinate>"].postProcessor(t,o),Pt(e.zIndex)||this.runtime.CSSPropertySyntaxFactory["<z-index>"].postProcessor(t,o),e.path&&this.runtime.CSSPropertySyntaxFactory["<path>"].postProcessor(t,o),e.points&&this.runtime.CSSPropertySyntaxFactory["<list-of-points>"].postProcessor(t,o),Pt(e.offsetDistance)||this.runtime.CSSPropertySyntaxFactory["<offset-distance>"].postProcessor(t,o),e.transform&&this.runtime.CSSPropertySyntaxFactory["<transform>"].postProcessor(t,o),void(c&&this.updateGeometry(t))}var l=n.skipUpdateAttribute,h=n.skipParse,d=n.forceUpdateGeometry,f=n.usedAttributes,p=n.memoize,g=d,m=Object.keys(e);m.forEach((function(n){var r;l||(t.attributes[n]=e[n]),!g&&(null===(r=Io[n])||void 0===r?void 0:r.l)&&(g=!0)})),h||m.forEach((function(e){t.computedStyle[e]=r.parseProperty(e,t.attributes[e],t,p)})),(null==f?void 0:f.length)&&(m=Array.from(new Set(m.concat(f)))),m.forEach((function(e){e in t.computedStyle&&(t.parsedStyle[e]=r.computeProperty(e,t.computedStyle[e],t,p))})),g&&this.updateGeometry(t),m.forEach((function(e){e in t.parsedStyle&&r.postProcessProperty(e,t,m)})),this.runtime.enableCSSParsing&&t.children.length&&m.forEach((function(e){e in t.parsedStyle&&r.isPropertyInheritable(e)&&t.children.forEach((function(t){t.internalSetAttribute(e,null,{skipUpdateAttribute:!0,skipParse:!0})}))}))},t.prototype.parseProperty=function(t,e,n,r){var i=Io[t],o=e;if((""===e||Pt(e))&&(e="unset"),"unset"===e||"initial"===e||"inherit"===e)o=ui(e);else if(i){var a=i.k,s=i.syntax,c=s&&this.getPropertySyntax(s);a&&a.indexOf(e)>-1?o=ui(e):c&&(!r&&c.parserUnmemoize?o=c.parserUnmemoize(e,n):c.parser&&(o=c.parser(e,n)))}return o},t.prototype.computeProperty=function(t,e,n,r){var i=Io[t],o="g-root"===n.id,a=e;if(i){var s=i.syntax,c=i.inh,u=i.d;if(e instanceof Hr){var l=e.value;if("unset"===l&&(l=c&&!o?"inherit":"initial"),"initial"===l)Pt(u)||(e=this.parseProperty(t,Yr(u)?u(n.nodeName):u,n,r));else if("inherit"===l){var h=this.tryToResolveProperty(n,t,{inherited:!0});return Pt(h)?void this.addUnresolveProperty(n,t):h}}var d=s&&this.getPropertySyntax(s);if(d&&d.calculator){var f=n.parsedStyle[t];a=d.calculator(t,f,e,n,this.runtime)}else a=e instanceof Hr?e.value:e}return a},t.prototype.postProcessProperty=function(t,e,n){var r=Io[t];if(r&&r.syntax){var i=r.syntax&&this.getPropertySyntax(r.syntax);i&&i.postProcessor&&i.postProcessor(e,n)}},t.prototype.addUnresolveProperty=function(t,e){var n=Lo.get(t);n||(Lo.set(t,[]),n=Lo.get(t)),-1===n.indexOf(e)&&n.push(e)},t.prototype.tryToResolveProperty=function(t,e,n){if(void 0===n&&(n={}),n.inherited&&t.parentElement&&function(t,e){var n=Lo.get(t);return!n||0===n.length||n.includes(e)}(t.parentElement,e)){var r=t.parentElement.parsedStyle[e];if("unset"===r||"initial"===r||"inherit"===r)return;return r}},t.prototype.recalc=function(t){var e=Lo.get(t);if(e&&e.length){var n={};e.forEach((function(e){n[e]=t.attributes[e]})),this.processProperties(t,n),Lo.delete(t)}},t.prototype.updateGeometry=function(t){var e=t.nodeName,n=this.runtime.geometryUpdaterFactory[e];if(n){var r=t.geometry;r.contentBounds||(r.contentBounds=new vr),r.renderBounds||(r.renderBounds=new vr);var i=t.parsedStyle,o=n.update(i,t),a=o.width,s=o.height,c=o.depth,u=void 0===c?0:c,l=o.offsetX,h=void 0===l?0:l,d=o.offsetY,f=void 0===d?0:d,p=o.offsetZ,g=void 0===p?0:p,m=[Math.abs(a)/2,Math.abs(s)/2,u/2],v=i,y=v.stroke,b=v.lineWidth,x=v.increasedLineWidthForHitTesting,E=v.shadowType,w=v.shadowColor,M=v.filter,N=void 0===M?[]:M,S=v.transformOrigin,C=i.anchor;e===Yn.TEXT?delete i.anchor:e===Yn.MESH&&(i.anchor[2]=.5);var T=[(1-2*(C&&C[0]||0))*a/2+h,(1-2*(C&&C[1]||0))*s/2+f,(1-2*(C&&C[2]||0))*m[2]+g];r.contentBounds.update(T,m);var k=e===Yn.POLYLINE||e===Yn.POLYGON||e===Yn.PATH?Math.SQRT2:.5;if(y&&!y.isNone){var P=((b||0)+(x||0))*k;m[0]+=P,m[1]+=P}if(r.renderBounds.update(T,m),w&&E&&"inner"!==E){var A=r.renderBounds,O=A.min,_=A.max,R=i,D=R.shadowBlur||0,I=R.shadowOffsetX||0,L=R.shadowOffsetY||0,j=O[0]-D+I,z=_[0]+D+I,B=O[1]-D+L,F=_[1]+D+L;O[0]=Math.min(O[0],j),_[0]=Math.max(_[0],z),O[1]=Math.min(O[1],B),_[1]=Math.max(_[1],F),r.renderBounds.setMinMax(O,_)}N.forEach((function(t){var e=t.name,n=t.params;if("blur"===e){var i=n[0].value;r.renderBounds.update(r.renderBounds.center,er(r.renderBounds.halfExtents,r.renderBounds.halfExtents,[i,i,0]))}else if("drop-shadow"===e){var o=n[0].value,a=n[1].value,s=n[2].value,c=r.renderBounds,u=c.min,l=c.max,h=u[0]-s+o,d=l[0]+s+o,f=u[1]-s+a,p=l[1]+s+a;u[0]=Math.min(u[0],h),l[0]=Math.max(l[0],d),u[1]=Math.min(u[1],f),l[1]=Math.max(l[1],p),r.renderBounds.setMinMax(u,l)}})),C=i.anchor;var G=a<0,V=s<0,W=(G?-1:1)*(S?Vi(S[0],0,t):0),U=(V?-1:1)*(S?Vi(S[1],1,t):0);W-=(G?-1:1)*(C&&C[0]||0)*r.contentBounds.halfExtents[0]*2,U-=(V?-1:1)*(C&&C[1]||0)*r.contentBounds.halfExtents[1]*2,t.setOrigin(W,U),this.runtime.sceneGraphService.dirtifyToRoot(t)}},t.prototype.updateSizeAttenuation=function(t,e){t.style.isSizeAttenuation?(t.style.rawLineWidth||(t.style.rawLineWidth=t.style.lineWidth),t.style.lineWidth=t.style.rawLineWidth/e,t.nodeName===Yn.CIRCLE&&(t.style.rawR||(t.style.rawR=t.style.r),t.style.r=t.style.rawR/e)):(t.style.rawLineWidth&&(t.style.lineWidth=t.style.rawLineWidth,delete t.style.rawLineWidth),t.nodeName===Yn.CIRCLE&&t.style.rawR&&(t.style.r=t.style.rawR,delete t.style.rawR))},t.prototype.isPropertyInheritable=function(t){var e=Io[t];return!!e&&e.inh},t}(),zo=function(){function t(){this.parser=ji,this.parserUnmemoize=Li,this.parserWithCSSDisabled=null,this.mixer=Yi}return t.prototype.calculator=function(t,e,n,r){return Bi(n)},t}(),Bo=function(){function t(){}return t.prototype.calculator=function(t,e,n,r,i){return n instanceof Hr&&(n=null),i.sceneGraphService.updateDisplayObjectDependency(t,e,n,r),"clipPath"===t&&r.forEach((function(t){0===t.childNodes.length&&i.sceneGraphService.dirtifyToRoot(t)})),n},t}(),Fo=function(){function t(){this.parser=Pi,this.parserWithCSSDisabled=Pi,this.mixer=Ai}return t.prototype.calculator=function(t,e,n,r){return n instanceof Hr?"none"===n.value?li:hi:n},t}(),Go=function(){function t(){this.parser=Ui}return t.prototype.calculator=function(t,e,n){return n instanceof Hr?[]:n},t}();function Vo(t){var e=t.parsedStyle.fontSize;return Pt(e)?null:e}var Wo=function(){function t(){this.parser=Ii,this.parserUnmemoize=Di,this.parserWithCSSDisabled=null,this.mixer=Yi}return t.prototype.calculator=function(t,e,n,r,i){var o;if(Wt(n))return n;if(!Jr.isRelativeUnit(n.unit))return n.value;var a=i.styleValueRegistry;if(n.unit===Tr.kPercentage)return 0;if(n.unit===Tr.kEms){if(r.parentNode){if(s=Vo(r.parentNode))return s*=n.value;a.addUnresolveProperty(r,t)}else a.addUnresolveProperty(r,t);return 0}if(n.unit===Tr.kRems){if(null===(o=null==r?void 0:r.ownerDocument)||void 0===o?void 0:o.documentElement){var s;if(s=Vo(r.ownerDocument.documentElement))return s*=n.value;a.addUnresolveProperty(r,t)}else a.addUnresolveProperty(r,t);return 0}},t}(),Uo=function(){function t(){this.mixer=Xi}return t.prototype.parser=function(t){var e=Gi(Wt(t)?[t]:t);return 1===e.length?[e[0],e[0]]:[e[0],e[1]]},t.prototype.calculator=function(t,e,n){return n.map((function(t){return t.value}))},t}(),Ho=function(){function t(){this.mixer=Xi}return t.prototype.parser=function(t){var e=Gi(Wt(t)?[t]:t);return 1===e.length?[e[0],e[0],e[0],e[0]]:2===e.length?[e[0],e[1],e[0],e[1]]:3===e.length?[e[0],e[1],e[2],e[1]]:[e[0],e[1],e[2],e[3]]},t.prototype.calculator=function(t,e,n){return n.map((function(t){return t.value}))},t}(),qo=x();function $o(t,e){var n=e.parsedStyle.defX||0,r=e.parsedStyle.defY||0;return e.resetLocalTransform(),e.setLocalPosition(n,r),t.forEach((function(t){var i=t.t,o=t.d;if("scale"===i){var a=(null==o?void 0:o.map((function(t){return t.value})))||[1,1];e.scaleLocal(a[0],a[1],1)}else if("scalex"===i){a=(null==o?void 0:o.map((function(t){return t.value})))||[1];e.scaleLocal(a[0],1,1)}else if("scaley"===i){a=(null==o?void 0:o.map((function(t){return t.value})))||[1];e.scaleLocal(1,a[0],1)}else if("scalez"===i){a=(null==o?void 0:o.map((function(t){return t.value})))||[1];e.scaleLocal(1,1,a[0])}else if("scale3d"===i){a=(null==o?void 0:o.map((function(t){return t.value})))||[1,1,1];e.scaleLocal(a[0],a[1],a[2])}else if("translate"===i){var s=o||[ti,ti];e.translateLocal(s[0].value,s[1].value,0)}else if("translatex"===i){s=o||[ti];e.translateLocal(s[0].value,0,0)}else if("translatey"===i){s=o||[ti];e.translateLocal(0,s[0].value,0)}else if("translatez"===i){s=o||[ti];e.translateLocal(0,0,s[0].value)}else if("translate3d"===i){s=o||[ti,ti,ti];e.translateLocal(s[0].value,s[1].value,s[2].value)}else if("rotate"===i){var c=o||[ri];e.rotateLocal(0,0,Bi(c[0]))}else if("rotatex"===i){c=o||[ri];e.rotateLocal(Bi(c[0]),0,0)}else if("rotatey"===i){c=o||[ri];e.rotateLocal(0,Bi(c[0]),0)}else if("rotatez"===i){c=o||[ri];e.rotateLocal(0,0,Bi(c[0]))}else if("rotate3d"===i);else if("skew"===i){var h=(null==o?void 0:o.map((function(t){return t.value})))||[0,0];e.setLocalSkew(or(h[0]),or(h[1]))}else if("skewx"===i){h=(null==o?void 0:o.map((function(t){return t.value})))||[0];e.setLocalSkew(or(h[0]),e.getLocalSkew()[1])}else if("skewy"===i){h=(null==o?void 0:o.map((function(t){return t.value})))||[0];e.setLocalSkew(e.getLocalSkew()[0],or(h[0]))}else if("matrix"===i){var d=u(o.map((function(t){return t.value})),6),f=d[0],p=d[1],g=d[2],m=d[3],v=d[4],y=d[5];e.setLocalTransform(M(qo,f,p,0,0,g,m,0,0,0,0,1,0,v+n,y+r,0,1))}else"matrix3d"===i&&(M.apply(X,l([qo],u(o.map((function(t){return t.value}))),!1)),qo[12]+=n,qo[13]+=r,e.setLocalTransform(qo))})),e.getLocalTransform()}var Yo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.postProcessor=function(t,e){var n,r,i;switch(t.nodeName){case Yn.CIRCLE:case Yn.ELLIPSE:var o=t.parsedStyle,a=o.cx,s=o.cy,c=o.cz;Pt(a)||(n=a),Pt(s)||(r=s),Pt(c)||(i=c);break;case Yn.LINE:var l=t.parsedStyle,h=l.x1,d=l.x2,f=l.y1,p=l.y2;n=Math.min(h,d),r=Math.min(f,p),i=0;break;case Yn.RECT:case Yn.IMAGE:case Yn.GROUP:case Yn.HTML:case Yn.TEXT:case Yn.MESH:Pt(t.parsedStyle.x)||(n=t.parsedStyle.x),Pt(t.parsedStyle.y)||(r=t.parsedStyle.y),Pt(t.parsedStyle.z)||(i=t.parsedStyle.z)}if(t.nodeName!==Yn.PATH&&t.nodeName!==Yn.POLYLINE&&t.nodeName!==Yn.POLYGON&&(t.parsedStyle.defX=n||0,t.parsedStyle.defY=r||0),(!Pt(n)||!Pt(r)||!Pt(i))&&-1===e.indexOf("transform")){var g=t.parsedStyle.transform;if(g&&g.length)$o(g,t);else{var m=u(t.getLocalPosition(),3),v=m[0],y=m[1],b=m[2];t.setLocalPosition(Pt(n)?v:n,Pt(r)?y:r,Pt(i)?b:i)}}},e}(Wo),Ko=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){n instanceof Hr&&(n=null);var i=null==n?void 0:n.cloneNode(!0);return i&&(i.style.isMarker=!0),i},t}(),Xo=function(){function t(){this.mixer=Yi,this.parser=$i,this.parserUnmemoize=qi,this.parserWithCSSDisabled=null}return t.prototype.calculator=function(t,e,n){return n.value},t}(),Zo=function(){function t(){this.parser=$i,this.parserUnmemoize=qi,this.parserWithCSSDisabled=null,this.mixer=Ki(0,1)}return t.prototype.calculator=function(t,e,n){return n.value},t.prototype.postProcessor=function(t){var e=t.parsedStyle,n=e.offsetPath,r=e.offsetDistance;if(n){var i=n.nodeName;if(i===Yn.LINE||i===Yn.PATH||i===Yn.POLYLINE){var o=n.getPoint(r);o&&(t.parsedStyle.defX=o.x,t.parsedStyle.defY=o.y,t.setLocalPosition(o.x,o.y))}}},t}(),Qo=function(){function t(){this.parser=$i,this.parserUnmemoize=qi,this.parserWithCSSDisabled=null,this.mixer=Ki(0,1)}return t.prototype.calculator=function(t,e,n){return n.value},t}(),Jo=function(){function t(){this.parser=lo,this.parserWithCSSDisabled=lo,this.mixer=ho}return t.prototype.calculator=function(t,e,n){return n instanceof Hr&&"unset"===n.value?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Nr(0,0,0,0)}:n},t.prototype.postProcessor=function(t,e){if(t.parsedStyle.defX=t.parsedStyle.path.rect.x,t.parsedStyle.defY=t.parsedStyle.path.rect.y,t.nodeName===Yn.PATH&&-1===e.indexOf("transform")){var n=t.parsedStyle,r=n.defX,i=void 0===r?0:r,o=n.defY,a=void 0===o?0:o;t.setLocalPosition(i,a)}},t}(),ta=function(){function t(){this.parser=fo,this.mixer=po}return t.prototype.postProcessor=function(t,e){if((t.nodeName===Yn.POLYGON||t.nodeName===Yn.POLYLINE)&&-1===e.indexOf("transform")){var n=t.parsedStyle,r=n.defX,i=n.defY;t.setLocalPosition(r,i)}},t}(),ea=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.mixer=Ki(0,1/0),e}return r(e,t),e}(Wo),na=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){return n instanceof Hr?"unset"===n.value?"":n.value:"".concat(n)},t.prototype.postProcessor=function(t){t.nodeValue="".concat(t.parsedStyle.text)||""},t}(),ra=function(){function t(){}return t.prototype.calculator=function(t,e,n,r){var i=r.getAttribute("text");if(i){var o=i;"capitalize"===n.value?o=i.charAt(0).toUpperCase()+i.slice(1):"lowercase"===n.value?o=i.toLowerCase():"uppercase"===n.value&&(o=i.toUpperCase()),r.parsedStyle.text=o}return n.value},t}(),ia={},oa=0;var aa="undefined"!=typeof window&&void 0!==window.document;function sa(t){return!!t.getAttribute}function ca(t,e){var n=Number(t.parsedStyle.zIndex),r=Number(e.parsedStyle.zIndex);if(n===r){var i=t.parentNode;if(i){var o=i.childNodes||[];return o.indexOf(t)-o.indexOf(e)}}return n-r}function ua(t){var e,n=t;do{if(null===(e=n.parsedStyle)||void 0===e?void 0:e.clipPath)return n;n=n.parentElement}while(null!==n);return null}function la(t,e){if(aa)return document.defaultView.getComputedStyle(t,null).getPropertyValue(e)}var ha={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},da="object"==typeof performance&&performance.now?performance:Date;function fa(t,e,n){var r=!1,i=!1,o=!!e&&!e.isNone,a=!!n&&!n.isNone;return"visiblepainted"===t||"painted"===t||"auto"===t?(r=o,i=a):"visiblefill"===t||"fill"===t?r=!0:"visiblestroke"===t||"stroke"===t?i=!0:"visible"!==t&&"all"!==t||(r=!0,i=!0),[r,i]}var pa=1,ga="object"==typeof self&&self.self==self?self:"object"==typeof global&&global.global==global?global:{},ma=Date.now(),va={},ya=Date.now(),ba=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");var e=Date.now(),n=e-ya,r=n>16?0:16-n,i=pa++;return va[i]=t,Object.keys(va).length>1||setTimeout((function(){ya=e;var t=va;va={},Object.keys(t).forEach((function(e){return t[e](ga.performance&&"function"==typeof ga.performance.now?ga.performance.now():Date.now()-ma)}))}),r),i},xa=function(t){delete va[t]},Ea=function(t){return"string"!=typeof t?ba:""===t?ga.requestAnimationFrame:ga[t+"RequestAnimationFrame"]},wa=function(t,e){for(var n=0;void 0!==t[n];){if(e(t[n]))return t[n];n+=1}}(["","webkit","moz","ms","o"],(function(t){return!!Ea(t)})),Ma=Ea(wa),Na=function(t){return"string"!=typeof t?xa:""===t?ga.cancelAnimationFrame:ga[t+"CancelAnimationFrame"]||ga[t+"CancelRequestAnimationFrame"]}(wa);ga.requestAnimationFrame=Ma,ga.cancelAnimationFrame=Na;var Sa=function(){function t(){this.callbacks=[]}return t.prototype.getCallbacksNum=function(){return this.callbacks.length},t.prototype.tapPromise=function(t,e){this.callbacks.push(e)},t.prototype.promise=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Promise.all(this.callbacks.map((function(e){return e.apply(void 0,l([],u(t),!1))})))},t}(),Ca=function(){function t(){this.callbacks=[]}return t.prototype.tapPromise=function(t,e){this.callbacks.push(e)},t.prototype.promise=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return a(this,void 0,void 0,(function(){var e,n,r;return s(this,(function(i){switch(i.label){case 0:return this.callbacks.length?[4,(r=this.callbacks)[0].apply(r,l([],u(t),!1))]:[3,6];case 1:e=i.sent(),n=0,i.label=2;case 2:return n<this.callbacks.length-1?[4,(0,this.callbacks[n])(e)]:[3,5];case 3:e=i.sent(),i.label=4;case 4:return n++,[3,2];case 5:return[2,e];case 6:return[2,null]}}))}))},t}(),Ta=function(){function t(){this.callbacks=[]}return t.prototype.tap=function(t,e){this.callbacks.push(e)},t.prototype.call=function(){var t=arguments;this.callbacks.forEach((function(e){e.apply(void 0,t)}))},t}(),ka=function(){function t(){this.callbacks=[]}return t.prototype.tap=function(t,e){this.callbacks.push(e)},t.prototype.call=function(){if(this.callbacks.length){for(var t=arguments,e=this.callbacks[0].apply(void 0,t),n=0;n<this.callbacks.length-1;n++){e=(0,this.callbacks[n])(e)}return e}return null},t}(),Pa=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Aa=/([\"\'])[^\'\"]+\1/;var Oa=function(){function t(){this.parser=bo,this.parserUnmemoize=xo,this.parserWithCSSDisabled=xo,this.mixer=Po}return t.prototype.calculator=function(t,e,n,r){return n instanceof Hr?[]:n},t.prototype.postProcessor=function(t){$o(t.parsedStyle.transform,t)},t}(),_a=function(){this.parser=Ao,this.parserUnmemoize=Oo},Ra=function(){function t(){this.parser=$i,this.parserUnmemoize=qi}return t.prototype.calculator=function(t,e,n,r){return n.value},t.prototype.postProcessor=function(t){if(t.parentNode){var e=t.parentNode,n=e.renderable,r=e.sortable;n&&(n.dirty=!0),r&&(r.dirty=!0,r.dirtyReason=ni.Z_INDEX_CHANGED)}},t}(),Da=function(){function t(){}return t.prototype.update=function(t,e){var n=t.r;return{width:2*n,height:2*n}},t}(),Ia=function(){function t(){}return t.prototype.update=function(t,e){return{width:2*t.rx,height:2*t.ry}},t}(),La=function(){function t(){}return t.prototype.update=function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2,o=Math.min(e,r),a=Math.max(e,r),s=Math.min(n,i);return{width:a-o,height:Math.max(n,i)-s}},t}(),ja=function(){function t(){}return t.prototype.update=function(t){var e=t.path.rect;return{width:e.width,height:e.height}},t}(),za=function(){function t(){}return t.prototype.update=function(t){if(t.points&&_t(t.points.points)){var e=t.points.points,n=Math.min.apply(Math,l([],u(e.map((function(t){return t[0]}))),!1)),r=Math.max.apply(Math,l([],u(e.map((function(t){return t[0]}))),!1)),i=Math.min.apply(Math,l([],u(e.map((function(t){return t[1]}))),!1)),o=Math.max.apply(Math,l([],u(e.map((function(t){return t[1]}))),!1));return{width:r-n,height:o-i}}return{width:0,height:0}},t}(),Ba=function(){function t(){}return t.prototype.update=function(t,e){var n=t.img,r=t.width,i=void 0===r?0:r,o=t.height,a=i,s=void 0===o?0:o;return n&&!Bt(n)&&(a||(a=n.width,t.width=a),s||(s=n.height,t.height=s)),{width:a,height:s}},t}(),Fa=function(){function t(t){this.globalRuntime=t}return t.prototype.isReadyToMeasure=function(t,e){var n=t.text,r=t.textAlign,i=t.textBaseline,o=t.fontSize,a=t.fontStyle,s=t.fontWeight,c=t.fontVariant,u=t.lineWidth;return n&&o&&a&&s&&c&&r&&i&&!Pt(u)},t.prototype.update=function(t,e){var n,r,i=t.text,o=t.textAlign,a=t.lineWidth,s=t.textBaseline,c=t.dx,u=t.dy;if(!this.isReadyToMeasure(t,e))return t.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{width:0,height:0,x:0,y:0,offsetX:0,offsetY:0};var l=((null===(r=null===(n=null==e?void 0:e.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0===r?void 0:r.getConfig())||{}).offscreenCanvas,h=this.globalRuntime.textService.measureText(i,t,l);t.metrics=h;var d=h.width,f=h.height,p=h.lineHeight,g=h.fontProperties,m=[d/2,f/2,0],v=[0,1],y=0;"center"===o||"middle"===o?(y=a/2,v=[.5,1]):"right"!==o&&"end"!==o||(y=a,v=[1,1]);var b=0;return"middle"===s?b=m[1]:"top"===s||"hanging"===s?b=2*m[1]:"alphabetic"===s?b=this.globalRuntime.enableCSSParsing?p-g.ascent:0:"bottom"!==s&&"ideographic"!==s||(b=0),c&&(y+=c),u&&(b+=u),t.anchor=[v[0],v[1],0],{width:2*m[0],height:2*m[1],offsetX:y,offsetY:b}},t}();var Ga,Va=function(){function t(e){this.eventPhase=t.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Mr,this.page=new Mr,this.canvas=new Mr,this.viewport=new Mr,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this.type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerX",{get:function(){return this.layer.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layerY",{get:function(){return this.layer.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageX",{get:function(){return this.page.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageY",{get:function(){return this.page.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"x",{get:function(){return this.canvas.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this.canvas.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasX",{get:function(){return this.canvas.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvasY",{get:function(){return this.canvas.y},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewportX",{get:function(){return this.viewport.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewportY",{get:function(){return this.viewport.y},enumerable:!1,configurable:!0}),t.prototype.composedPath=function(){return!this.manager||this.path&&this.path[0]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path},Object.defineProperty(t.prototype,"propagationPath",{get:function(){return this.composedPath()},enumerable:!1,configurable:!0}),t.prototype.preventDefault=function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0},t.prototype.stopImmediatePropagation=function(){this.propagationImmediatelyStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t.prototype.initEvent=function(){},t.prototype.initUIEvent=function(){},t.prototype.clone=function(){throw new Error(Sr)},t}(),Wa=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.client=new Mr,e.movement=new Mr,e.offset=new Mr,e.global=new Mr,e.screen=new Mr,e}return r(e,t),Object.defineProperty(e.prototype,"clientX",{get:function(){return this.client.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clientY",{get:function(){return this.client.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementX",{get:function(){return this.movement.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"movementY",{get:function(){return this.movement.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetX",{get:function(){return this.offset.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"offsetY",{get:function(){return this.offset.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalX",{get:function(){return this.global.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalY",{get:function(){return this.global.y},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenX",{get:function(){return this.screen.x},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"screenY",{get:function(){return this.screen.y},enumerable:!1,configurable:!0}),e.prototype.getModifierState=function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)},e.prototype.initMouseEvent=function(){throw new Error(Sr)},e}(Va),Ua=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.width=0,e.height=0,e.isPrimary=!1,e}return r(e,t),e.prototype.getCoalescedEvents=function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]},e.prototype.getPredictedEvents=function(){throw new Error("getPredictedEvents is not supported!")},e.prototype.clone=function(){return this.manager.clonePointerEvent(this)},e}(Wa),Ha=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.clone=function(){return this.manager.cloneWheelEvent(this)},e}(Wa),qa=function(t){function e(e,n){var r=t.call(this,null)||this;return r.type=e,r.detail=n,Object.assign(r,n),r}return r(e,t),e}(Va),$a=function(){function t(){this.emitter=new m}return t.prototype.on=function(t,e,n){return this.addEventListener(t,e,n),this},t.prototype.addEventListener=function(t,e,n){var r=Xt(n)&&n||Rt(n)&&n.capture,i=Rt(n)&&n.once,o=Yr(e)?void 0:e,a=!1,s="";if(t.indexOf(":")>-1){var c=u(t.split(":"),2),h=c[0];t=c[1],s=h,a=!0}if(t=r?"".concat(t,"capture"):t,e=Yr(e)?e:e.handleEvent,a){var d=e;e=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];(null===(t=e[0].target)||void 0===t?void 0:t.name)===s&&d.apply(void 0,l([],u(e),!1))}}return i?this.emitter.once(t,e,o):this.emitter.on(t,e,o),this},t.prototype.off=function(t,e,n){return t?this.removeEventListener(t,e,n):this.removeAllEventListeners(),this},t.prototype.removeAllEventListeners=function(){this.emitter.removeAllListeners()},t.prototype.removeEventListener=function(t,e,n){var r=Xt(n)&&n||Rt(n)&&n.capture,i=Yr(e)?void 0:e;return t=r?"".concat(t,"capture"):t,e=Yr(e)?e:null==e?void 0:e.handleEvent,this.emitter.off(t,e,i),this},t.prototype.emit=function(t,e){this.dispatchEvent(new qa(t,e))},t.prototype.dispatchEvent=function(t,e){var n,r,i;if(void 0===e&&(e=!1),!t.type)throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");if(i=this.document?this:this.defaultView?this.defaultView:null===(n=this.ownerDocument)||void 0===n?void 0:n.defaultView){if(t.manager=i.getEventService()||null,!t.manager)return!1;t.defaultPrevented=!1,t.path=[],e||(t.target=this),null===(r=t.manager)||void 0===r||r.dispatchEvent(t,t.type,e)}return!t.defaultPrevented},t}(),Ya=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.shadow=!1,e.ownerDocument=null,e.isConnected=!1,e.baseURI="",e.childNodes=[],e.nodeType=0,e.nodeName="",e.nodeValue=null,e.parentNode=null,e}return r(e,t),e.isNode=function(t){return!!t.childNodes},Object.defineProperty(e.prototype,"textContent",{get:function(){var t,e,n="";this.nodeName===Yn.TEXT&&(n+=this.style.text);try{for(var r=c(this.childNodes),i=r.next();!i.done;i=r.next()){var o=i.value;o.nodeName===Yn.TEXT?n+=o.nodeValue:n+=o.textContent}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return n},set:function(t){var e=this;this.childNodes.slice().forEach((function(t){e.removeChild(t)})),this.nodeName===Yn.TEXT&&(this.style.text="".concat(t))},enumerable:!1,configurable:!0}),e.prototype.getRootNode=function(t){return void 0===t&&(t={}),this.parentNode?this.parentNode.getRootNode(t):t.composed&&this.host?this.host.getRootNode(t):this},e.prototype.hasChildNodes=function(){return this.childNodes.length>0},e.prototype.isDefaultNamespace=function(t){throw new Error(Sr)},e.prototype.lookupNamespaceURI=function(t){throw new Error(Sr)},e.prototype.lookupPrefix=function(t){throw new Error(Sr)},e.prototype.normalize=function(){throw new Error(Sr)},e.prototype.isEqualNode=function(t){return this===t},e.prototype.isSameNode=function(t){return this.isEqualNode(t)},Object.defineProperty(e.prototype,"parent",{get:function(){return this.parentNode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentElement",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstChild",{get:function(){return this.childNodes.length>0?this.childNodes[0]:null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastChild",{get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null},enumerable:!1,configurable:!0}),e.prototype.compareDocumentPosition=function(t){var n;if(t===this)return 0;for(var r=t,i=this,o=[r],a=[i];null!==(n=r.parentNode)&&void 0!==n?n:i.parentNode;)r=r.parentNode?(o.push(r.parentNode),r.parentNode):r,i=i.parentNode?(a.push(i.parentNode),i.parentNode):i;if(r!==i)return e.DOCUMENT_POSITION_DISCONNECTED|e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|e.DOCUMENT_POSITION_PRECEDING;var s=o.length>a.length?o:a,c=s===o?a:o;if(s[s.length-c.length]===c[0])return s===o?e.DOCUMENT_POSITION_CONTAINED_BY|e.DOCUMENT_POSITION_FOLLOWING:e.DOCUMENT_POSITION_CONTAINS|e.DOCUMENT_POSITION_PRECEDING;for(var u=s.length-c.length,l=c.length-1;l>=0;l--){var h=c[l],d=s[u+l];if(d!==h){var f=h.parentNode.childNodes;return f.indexOf(h)<f.indexOf(d)?c===o?e.DOCUMENT_POSITION_PRECEDING:e.DOCUMENT_POSITION_FOLLOWING:s===o?e.DOCUMENT_POSITION_PRECEDING:e.DOCUMENT_POSITION_FOLLOWING}}return e.DOCUMENT_POSITION_FOLLOWING},e.prototype.contain=function(t){return this.contains(t)},e.prototype.contains=function(t){for(var e=t;e&&this!==e;)e=e.parentNode;return!!e},e.prototype.getAncestor=function(t){for(var e=this;t>0&&e;)e=e.parentNode,t--;return e},e.prototype.forEach=function(t,e){void 0===e&&(e=!1),t(this)||(e?this.childNodes.slice():this.childNodes).forEach((function(e){e.forEach(t)}))},e.DOCUMENT_POSITION_DISCONNECTED=1,e.DOCUMENT_POSITION_PRECEDING=2,e.DOCUMENT_POSITION_FOLLOWING=4,e.DOCUMENT_POSITION_CONTAINS=8,e.DOCUMENT_POSITION_CONTAINED_BY=16,e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32,e}($a),Ka=function(){function t(t,e){var n=this;this.globalRuntime=t,this.context=e,this.emitter=new m,this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=x(),this.tmpVec3=Z(),this.onPointerDown=function(t){var e=n.createPointerEvent(t);if(n.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)n.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){var r=2===e.button;n.dispatchEvent(e,r?"rightdown":"mousedown")}n.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),n.freeEvent(e)},this.onPointerUp=function(t){var e,r=da.now(),i=n.createPointerEvent(t,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(i,"pointerup"),"touch"===i.pointerType)n.dispatchEvent(i,"touchend");else if("mouse"===i.pointerType||"pen"===i.pointerType){var o=2===i.button;n.dispatchEvent(i,o?"rightup":"mouseup")}var a=n.trackingData(t.pointerId),s=n.findMountedTarget(a.pressTargetsByButton[t.button]),c=s;if(s&&!i.composedPath().includes(s)){for(var u=s;u&&!i.composedPath().includes(u);){if(i.currentTarget=u,n.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType)n.notifyTarget(i,"touchendoutside");else if("mouse"===i.pointerType||"pen"===i.pointerType){o=2===i.button;n.notifyTarget(i,o?"rightupoutside":"mouseupoutside")}Ya.isNode(u)&&(u=u.parentNode)}delete a.pressTargetsByButton[t.button],c=u}if(c){var l=n.clonePointerEvent(i,"click");l.target=c,l.path=[],a.clicksByButton[t.button]||(a.clicksByButton[t.button]={clickCount:0,target:l.target,timeStamp:r});var h=a.clicksByButton[t.button];h.target===l.target&&r-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=l.target,h.timeStamp=r,l.detail=h.clickCount,(null===(e=i.detail)||void 0===e?void 0:e.preventClick)||(n.context.config.useNativeClickEvent||"mouse"!==l.pointerType&&"touch"!==l.pointerType||n.dispatchEvent(l,"click"),n.dispatchEvent(l,"pointertap")),n.freeEvent(l)}n.freeEvent(i)},this.onPointerMove=function(t){var e=n.createPointerEvent(t,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0),r="mouse"===e.pointerType||"pen"===e.pointerType,i=n.trackingData(t.pointerId),o=n.findMountedTarget(i.overTargets);if(i.overTargets&&o!==e.target){var a="mousemove"===t.type?"mouseout":"pointerout",s=n.createPointerEvent(t,a,o||void 0);if(n.dispatchEvent(s,"pointerout"),r&&n.dispatchEvent(s,"mouseout"),!e.composedPath().includes(o)){var c=n.createPointerEvent(t,"pointerleave",o||void 0);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,n.notifyTarget(c),r&&n.notifyTarget(c,"mouseleave"),Ya.isNode(c.target)&&(c.target=c.target.parentNode);n.freeEvent(c)}n.freeEvent(s)}if(o!==e.target){var u="mousemove"===t.type?"mouseover":"pointerover",l=n.clonePointerEvent(e,u);n.dispatchEvent(l,"pointerover"),r&&n.dispatchEvent(l,"mouseover");for(var h=o&&Ya.isNode(o)&&o.parentNode;h&&h!==(Ya.isNode(n.rootTarget)&&n.rootTarget.parentNode)&&h!==e.target;)h=h.parentNode;if(!h||h===(Ya.isNode(n.rootTarget)&&n.rootTarget.parentNode)){var d=n.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==(Ya.isNode(n.rootTarget)&&n.rootTarget.parentNode);)d.currentTarget=d.target,n.notifyTarget(d),r&&n.notifyTarget(d,"mouseenter"),Ya.isNode(d.target)&&(d.target=d.target.parentNode);n.freeEvent(d)}n.freeEvent(l)}n.dispatchEvent(e,"pointermove"),"touch"===e.pointerType&&n.dispatchEvent(e,"touchmove"),r&&(n.dispatchEvent(e,"mousemove"),n.cursor=n.getCursor(e.target)),i.overTargets=e.composedPath(),n.freeEvent(e)},this.onPointerOut=function(t){var e=n.trackingData(t.pointerId);if(e.overTargets){var r="mouse"===t.pointerType||"pen"===t.pointerType,i=n.findMountedTarget(e.overTargets),o=n.createPointerEvent(t,"pointerout",i||void 0);n.dispatchEvent(o),r&&n.dispatchEvent(o,"mouseout");var a=n.createPointerEvent(t,"pointerleave",i||void 0);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==(Ya.isNode(n.rootTarget)&&n.rootTarget.parentNode);)a.currentTarget=a.target,n.notifyTarget(a),r&&n.notifyTarget(a,"mouseleave"),Ya.isNode(a.target)&&(a.target=a.target.parentNode);e.overTargets=null,n.freeEvent(o),n.freeEvent(a)}n.cursor=null},this.onPointerOver=function(t){var e=n.trackingData(t.pointerId),r=n.createPointerEvent(t),i="mouse"===r.pointerType||"pen"===r.pointerType;n.dispatchEvent(r,"pointerover"),i&&n.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(n.cursor=n.getCursor(r.target));var o=n.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==(Ya.isNode(n.rootTarget)&&n.rootTarget.parentNode);)o.currentTarget=o.target,n.notifyTarget(o),i&&n.notifyTarget(o,"mouseenter"),Ya.isNode(o.target)&&(o.target=o.target.parentNode);e.overTargets=r.composedPath(),n.freeEvent(r),n.freeEvent(o)},this.onPointerUpOutside=function(t){var e=n.trackingData(t.pointerId),r=n.findMountedTarget(e.pressTargetsByButton[t.button]),i=n.createPointerEvent(t);if(r){for(var o=r;o;)i.currentTarget=o,n.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType||"mouse"!==i.pointerType&&"pen"!==i.pointerType||n.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),Ya.isNode(o)&&(o=o.parentNode);delete e.pressTargetsByButton[t.button]}n.freeEvent(i)},this.onWheel=function(t){var e=n.createWheelEvent(t);n.dispatchEvent(e),n.freeEvent(e)},this.onClick=function(t){if(n.context.config.useNativeClickEvent){var e=n.createPointerEvent(t);n.dispatchEvent(e),n.freeEvent(e)}},this.onPointerCancel=function(t){var e=n.createPointerEvent(t,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);n.dispatchEvent(e),n.freeEvent(e)}}return t.prototype.init=function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)},t.prototype.destroy=function(){this.emitter.removeAllListeners(),this.mappingTable={},this.mappingState={},this.eventPool.clear()},t.prototype.client2Viewport=function(t){var e=this.context.contextService.getBoundingClientRect();return new Mr(t.x-((null==e?void 0:e.left)||0),t.y-((null==e?void 0:e.top)||0))},t.prototype.viewport2Client=function(t){var e=this.context.contextService.getBoundingClientRect();return new Mr(t.x+((null==e?void 0:e.left)||0),t.y+((null==e?void 0:e.top)||0))},t.prototype.viewport2Canvas=function(t){var e=t.x,n=t.y,r=this.rootTarget.defaultView.getCamera(),i=this.context.config,o=i.width,a=i.height,s=r.getPerspectiveInverse(),c=r.getWorldTransform(),u=k(this.tmpMatrix,c,s),l=nt(this.tmpVec3,e/o*2-1,2*(1-n/a)-1,0);return lt(l,l,u),new Mr(l[0],l[1])},t.prototype.canvas2Viewport=function(t){var e=this.rootTarget.defaultView.getCamera(),n=e.getPerspective(),r=e.getViewTransform(),i=k(this.tmpMatrix,n,r),o=nt(this.tmpVec3,t.x,t.y,0);lt(this.tmpVec3,this.tmpVec3,i);var a=this.context.config,s=a.width,c=a.height;return new Mr((o[0]+1)/2*s,(1-(o[1]+1)/2)*c)},t.prototype.setPickHandler=function(t){this.pickHandler=t},t.prototype.addEventMapping=function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((function(t,e){return t.priority-e.priority}))},t.prototype.mapEvent=function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,r=e.length;n<r;n++)e[n].fn(t);else console.warn("[EventService]: Event mapping not defined for ".concat(t.type))}},t.prototype.dispatchEvent=function(t,e,n){if(n){t.eventPhase=t.AT_TARGET;var r=this.rootTarget.defaultView||null;t.currentTarget=r,this.notifyListeners(t,e)}else t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e);this.emitter.emit(e||t.type,t)},t.prototype.propagate=function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var r=n.length-1;r>=1;r--)if(t.currentTarget=n[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){var i=n.indexOf(t.currentTarget);t.eventPhase=t.BUBBLING_PHASE;for(r=i+1;r<n.length;r++)if(t.currentTarget=n[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}},t.prototype.propagationPath=function(t){var e=[t],n=this.rootTarget.defaultView||null;if(n&&n===t)return e.unshift(n.document),e;for(var r=0;r<2048&&t!==this.rootTarget;r++)Ya.isNode(t)&&t.parentNode&&(e.push(t.parentNode),t=t.parentNode);return n&&e.push(n),e},t.prototype.hitTest=function(t){var e=t.viewportX,n=t.viewportY,r=this.context.config,i=r.width,o=r.height,a=r.disableHitTesting;return e<0||n<0||e>i||n>o?null:!a&&this.pickHandler(t)||this.rootTarget||null},t.prototype.isNativeEventFromCanvas=function(t,e){var n=null==e?void 0:e.target;if((null==n?void 0:n.shadowRoot)&&(n=e.composedPath()[0]),n){if(n===t)return!0;if(t&&t.contains)return t.contains(n)}return!!(null==e?void 0:e.composedPath)&&e.composedPath().indexOf(t)>-1},t.prototype.getExistedHTML=function(t){var e,n;if(t.nativeEvent.composedPath)try{for(var r=c(t.nativeEvent.composedPath()),i=r.next();!i.done;i=r.next()){var o=i.value,a=this.nativeHTMLMap.get(o);if(a)return a}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return null},t.prototype.pickTarget=function(t){return this.hitTest({clientX:t.clientX,clientY:t.clientY,viewportX:t.viewportX,viewportY:t.viewportY,x:t.canvasX,y:t.canvasY})},t.prototype.createPointerEvent=function(t,e,n,r){var i=this.allocateEvent(Ua);this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t;var o=this.getExistedHTML(i),a=this.context.contextService.getDomElement();return i.target=null!=n?n:o||this.isNativeEventFromCanvas(a,i.nativeEvent)&&this.pickTarget(i)||r,"string"==typeof e&&(i.type=e),i},t.prototype.createWheelEvent=function(t){var e=this.allocateEvent(Ha);this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t;var n=this.getExistedHTML(e),r=this.context.contextService.getDomElement();return e.target=n||this.isNativeEventFromCanvas(r,e.nativeEvent)&&this.pickTarget(e),e},t.prototype.trackingData=function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]},t.prototype.cloneWheelEvent=function(t){var e=this.allocateEvent(Ha);return e.nativeEvent=t.nativeEvent,e.originalEvent=t.originalEvent,this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.target=t.target,e.path=t.composedPath().slice(),e.type=t.type,e},t.prototype.clonePointerEvent=function(t,e){var n=this.allocateEvent(Ua);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n},t.prototype.copyPointerData=function(t,e){e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist},t.prototype.copyMouseData=function(t,e){e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.shiftKey=t.shiftKey,e.client.copyFrom(t.client),e.movement.copyFrom(t.movement),e.canvas.copyFrom(t.canvas),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global),e.offset.copyFrom(t.offset)},t.prototype.copyWheelData=function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ},t.prototype.copyData=function(t,e){e.isTrusted=t.isTrusted,e.timeStamp=da.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.page.copyFrom(t.page),e.viewport.copyFrom(t.viewport)},t.prototype.allocateEvent=function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=[],e.target=null,e},t.prototype.freeEvent=function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)},t.prototype.notifyTarget=function(t,e){e=null!=e?e:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?"".concat(e,"capture"):e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)},t.prototype.notifyListeners=function(t,e){var n=t.currentTarget.emitter,r=n._events[e];if(r)if("fn"in r)r.once&&n.removeListener(e,r.fn,void 0,!0),r.fn.call(t.currentTarget||r.context,t);else for(var i=0;i<r.length&&!t.propagationImmediatelyStopped;i++)r[i].once&&n.removeListener(e,r[i].fn,void 0,!0),r[i].fn.call(t.currentTarget||r[i].context,t)},t.prototype.findMountedTarget=function(t){if(!t)return null;for(var e=t[t.length-1],n=t.length-2;n>=0;n--){var r=t[n];if(!(r===this.rootTarget||Ya.isNode(r)&&r.parentNode===e))break;e=t[n]}return e},t.prototype.getCursor=function(t){for(var e=t;e;){var n=sa(e)&&e.getAttribute("cursor");if(n)return n;e=Ya.isNode(e)&&e.parentNode}},t}(),Xa=function(){function t(){}return t.prototype.getOrCreateCanvas=function(t,e){if(this.canvas)return this.canvas;if(t||fs.offscreenCanvas)this.canvas=t||fs.offscreenCanvas,this.context=this.canvas.getContext("2d",i({willReadFrequently:!0},e));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",i({willReadFrequently:!0},e)),this.context&&this.context.measureText||(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",i({willReadFrequently:!0},e))}return this.canvas.width=10,this.canvas.height=10,this.canvas},t.prototype.getOrCreateContext=function(t,e){return this.context||this.getOrCreateCanvas(t,e),this.context},t}();!function(t){t[t.CAMERA_CHANGED=0]="CAMERA_CHANGED",t[t.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",t[t.NONE=2]="NONE"}(Ga||(Ga={}));var Za,Qa=function(){function t(t,e){this.globalRuntime=t,this.context=e,this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new Ta,initAsync:new Sa,dirtycheck:new ka,cull:new ka,beginFrame:new Ta,beforeRender:new Ta,render:new Ta,afterRender:new Ta,endFrame:new Ta,destroy:new Ta,pick:new Ca,pickSync:new ka,pointerDown:new Ta,pointerUp:new Ta,pointerMove:new Ta,pointerOut:new Ta,pointerOver:new Ta,pointerWheel:new Ta,pointerCancel:new Ta,click:new Ta}}return t.prototype.init=function(t){var e=this,n=i(i({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach((function(t){t.apply(n,e.globalRuntime)})),this.hooks.init.call(),0===this.hooks.initAsync.getCallbacksNum()?(this.inited=!0,t()):this.hooks.initAsync.promise().then((function(){e.inited=!0,t()}))},t.prototype.getStats=function(){return this.stats},t.prototype.disableDirtyRectangleRendering=function(){return!this.context.config.renderer.getConfig().enableDirtyRectangleRendering||this.context.renderingContext.renderReasons.has(Ga.CAMERA_CHANGED)},t.prototype.render=function(t,e){var n=this;this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0;var r=this.context.renderingContext;if(this.globalRuntime.sceneGraphService.syncHierarchy(r.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),r.renderReasons.size&&this.inited){r.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var i=1===r.renderReasons.size&&r.renderReasons.has(Ga.CAMERA_CHANGED),o=!t.disableRenderHooks||!(t.disableRenderHooks&&i);o&&this.renderDisplayObject(r.root,t,r),this.hooks.beginFrame.call(),o&&r.renderListCurrentFrame.forEach((function(t){n.hooks.beforeRender.call(t),n.hooks.render.call(t),n.hooks.afterRender.call(t)})),this.hooks.endFrame.call(),r.renderListCurrentFrame=[],r.renderReasons.clear(),e()}},t.prototype.renderDisplayObject=function(t,e,n){var r=this,i=e.renderer.getConfig(),o=i.enableDirtyCheck,a=i.enableCulling;this.globalRuntime.enableCSSParsing&&this.globalRuntime.styleValueRegistry.recalc(t);var s=t.renderable,c=o?s.dirty||n.dirtyRectangleRenderingDisabled?t:null:t;if(c){var u=a?this.hooks.cull.call(c,this.context.camera):c;u&&(this.stats.rendered++,n.renderListCurrentFrame.push(u))}t.renderable.dirty=!1,t.sortable.renderOrder=this.zIndexCounter++,this.stats.total++;var l=t.sortable;l.dirty&&(this.sort(t,l),l.dirty=!1,l.dirtyChildren=[],l.dirtyReason=void 0),(l.sorted||t.childNodes).forEach((function(t){r.renderDisplayObject(t,e,n)}))},t.prototype.sort=function(t,e){e.sorted&&e.dirtyReason!==ni.Z_INDEX_CHANGED?e.dirtyChildren.forEach((function(n){if(-1===t.childNodes.indexOf(n)){var r=e.sorted.indexOf(n);r>=0&&e.sorted.splice(r,1)}else if(0===e.sorted.length)e.sorted.push(n);else{var i=function(t,e){for(var n=0,r=t.length;n<r;){var i=n+r>>>1;ca(t[i],e)<0?n=i+1:r=i}return n}(e.sorted,n);e.sorted.splice(i,0,n)}})):e.sorted=t.childNodes.slice().sort(ca)},t.prototype.destroy=function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()},t.prototype.dirtify=function(){this.context.renderingContext.renderReasons.add(Ga.DISPLAY_OBJECT_CHANGED)},t}(),Ja=/\[\s*(.*)=(.*)\s*\]/,ts=function(){function t(){}return t.prototype.selectOne=function(t,e){var n=this;if(t.startsWith("."))return e.find((function(e){return((null==e?void 0:e.classList)||[]).indexOf(n.getIdOrClassname(t))>-1}));if(t.startsWith("#"))return e.find((function(e){return e.id===n.getIdOrClassname(t)}));if(t.startsWith("[")){var r=this.getAttribute(t),i=r.name,o=r.value;return i?e.find((function(t){return e!==t&&("name"===i?t.name===o:n.attributeToString(t,i)===o)})):null}return e.find((function(n){return e!==n&&n.nodeName===t}))},t.prototype.selectAll=function(t,e){var n=this;if(t.startsWith("."))return e.findAll((function(r){return e!==r&&((null==r?void 0:r.classList)||[]).indexOf(n.getIdOrClassname(t))>-1}));if(t.startsWith("#"))return e.findAll((function(r){return e!==r&&r.id===n.getIdOrClassname(t)}));if(t.startsWith("[")){var r=this.getAttribute(t),i=r.name,o=r.value;return i?e.findAll((function(t){return e!==t&&("name"===i?t.name===o:n.attributeToString(t,i)===o)})):[]}return e.findAll((function(n){return e!==n&&n.nodeName===t}))},t.prototype.is=function(t,e){if(t.startsWith("."))return e.className===this.getIdOrClassname(t);if(t.startsWith("#"))return e.id===this.getIdOrClassname(t);if(t.startsWith("[")){var n=this.getAttribute(t),r=n.name,i=n.value;return"name"===r?e.name===i:this.attributeToString(e,r)===i}return e.nodeName===t},t.prototype.getIdOrClassname=function(t){return t.substring(1)},t.prototype.getAttribute=function(t){var e=t.match(Ja),n="",r="";return e&&e.length>2&&(n=e[1].replace(/"/g,""),r=e[2].replace(/"/g,"")),{name:n,value:r}},t.prototype.attributeToString=function(t,e){if(!t.getAttribute)return"";var n=t.getAttribute(e);return Pt(n)?"":n.toString?n.toString():""},t}(),es=function(t){function e(e,n,r,i,o,a,s,c){var u=t.call(this,null)||this;return u.relatedNode=n,u.prevValue=r,u.newValue=i,u.attrName=o,u.attrChange=a,u.prevParsedValue=s,u.newParsedValue=c,u.type=e,u}return r(e,t),e.ADDITION=2,e.MODIFICATION=1,e.REMOVAL=3,e}(Va);function ns(t){var e=t.renderable;e&&(e.renderBoundsDirty=!0,e.boundsDirty=!0)}!function(t){t.REPARENT="reparent",t.DESTROY="destroy",t.ATTR_MODIFIED="DOMAttrModified",t.INSERTED="DOMNodeInserted",t.REMOVED="removed",t.MOUNTED="DOMNodeInsertedIntoDocument",t.UNMOUNTED="DOMNodeRemovedFromDocument",t.BOUNDS_CHANGED="bounds-changed",t.CULLED="culled"}(Za||(Za={}));var rs,is,os,as=new es(Za.REPARENT,null,"","","",0,"",""),ss=function(){function t(t){var e,n,r,i,o,a,s,c,u=this;this.runtime=t,this.pendingEvents=[],this.boundsChangedEvent=new qa(Za.BOUNDS_CHANGED),this.rotate=(e=mt(),function(t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=0),"number"==typeof n&&(n=tt(n,r,i));var o=t.transformable;if(null!==t.parentNode&&t.parentNode.transformable){var a=mt();xt(a,n[0],n[1],n[2]);var s=u.getRotation(t),c=u.getRotation(t.parentNode);wt(e,c),bt(e,e),yt(a,e,a),yt(o.localRotation,a,s),Nt(o.localRotation,o.localRotation),u.dirtifyLocal(t,o)}else u.rotateLocal(t,n)}),this.rotateLocal=(n=mt(),function(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0),"number"==typeof e&&(e=tt(e,r,i));var o=t.transformable;xt(n,e[0],e[1],e[2]),Mt(o.localRotation,o.localRotation,n),u.dirtifyLocal(t,o)}),this.setEulerAngles=(r=mt(),function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=0),"number"==typeof e&&(e=tt(e,n,i));var o=t.transformable;if(null!==t.parentNode&&t.parentNode.transformable){xt(o.localRotation,e[0],e[1],e[2]);var a=u.getRotation(t.parentNode);wt(r,bt(mt(),a)),Mt(o.localRotation,o.localRotation,r),u.dirtifyLocal(t,o)}else u.setLocalEulerAngles(t,e)}),this.translateLocal=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=tt(e,n,r));var i=t.transformable;ht(e,Z())||(function(t,e,n){var r=n[0],i=n[1],o=n[2],a=n[3],s=e[0],c=e[1],u=e[2],l=i*u-o*c,h=o*s-r*u,d=r*c-i*s,f=i*d-o*h,p=o*l-r*d,g=r*h-i*l,m=2*a;l*=m,h*=m,d*=m,f*=2,p*=2,g*=2,t[0]=s+l+f,t[1]=c+h+p,t[2]=u+d+g}(e,e,i.localRotation),rt(i.localPosition,i.localPosition,e),u.dirtifyLocal(t,i))},this.setPosition=(i=x(),o=Z(),function(t,e){var n=t.transformable;if(o[0]=e[0],o[1]=e[1],o[2]=e[2]||0,!ht(u.getPosition(t),o)){if(et(n.position,o),null!==t.parentNode&&t.parentNode.transformable){var r=t.parentNode.transformable;w(i,r.worldTransform),C(i,i),lt(n.localPosition,o,i)}else et(n.localPosition,o);u.dirtifyLocal(t,n)}}),this.setLocalPosition=function(){var t=Z();return function(e,n){var r=e.transformable;t[0]=n[0],t[1]=n[1],t[2]=n[2]||0,ht(r.localPosition,t)||(et(r.localPosition,t),u.dirtifyLocal(e,r))}}(),this.translate=(a=Z(),s=Z(),c=Z(),function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=nt(s,e,n,r)),ht(e,a)||(rt(c,u.getPosition(t),e),u.setPosition(t,c))}),this.setRotation=function(){var t=mt();return function(e,n,r,i,o){var a=e.transformable;if("number"==typeof n&&(n=Et(n,r,i,o)),null!==e.parentNode&&e.parentNode.transformable){var s=u.getRotation(e.parentNode);wt(t,s),bt(t,t),yt(a.localRotation,t,n),Nt(a.localRotation,a.localRotation),u.dirtifyLocal(e,a)}else u.setLocalRotation(e,n)}},this.displayObjectDependencyMap=new WeakMap,this.calcLocalTransform=function(){var t=x(),e=Z(),n=Et(0,0,0,1);return function(r){if(0!==r.localSkew[0]||0!==r.localSkew[1]){if(B(r.localTransform,r.localRotation,r.localPosition,tt(1,1,1),r.origin),0!==r.localSkew[0]||0!==r.localSkew[1]){var i=N(t);i[4]=Math.tan(r.localSkew[0]),i[1]=Math.tan(r.localSkew[1]),k(r.localTransform,r.localTransform,i)}var o=B(t,n,e,r.localScale,r.origin);k(r.localTransform,r.localTransform,o)}else B(r.localTransform,r.localRotation,r.localPosition,r.localScale,r.origin)}}()}return t.prototype.matches=function(t,e){return this.runtime.sceneGraphSelector.is(t,e)},t.prototype.querySelector=function(t,e){return this.runtime.sceneGraphSelector.selectOne(t,e)},t.prototype.querySelectorAll=function(t,e){return this.runtime.sceneGraphSelector.selectAll(t,e)},t.prototype.attach=function(t,e,n){var r,i,o=!1;t.parentNode&&(o=t.parentNode!==e,this.detach(t)),t.parentNode=e,Pt(n)?t.parentNode.childNodes.push(t):t.parentNode.childNodes.splice(n,0,t);var a=e.sortable;((null===(r=null==a?void 0:a.sorted)||void 0===r?void 0:r.length)||(null===(i=t.style)||void 0===i?void 0:i.zIndex))&&(-1===a.dirtyChildren.indexOf(t)&&a.dirtyChildren.push(t),a.dirty=!0,a.dirtyReason=ni.ADDED);var s=t.transformable;s&&this.dirtifyWorld(t,s),s.frozen&&this.unfreezeParentToRoot(t),o&&t.dispatchEvent(as)},t.prototype.detach=function(t){var e,n;if(t.parentNode){var r=t.transformable,i=t.parentNode.sortable;((null===(e=null==i?void 0:i.sorted)||void 0===e?void 0:e.length)||(null===(n=t.style)||void 0===n?void 0:n.zIndex))&&(-1===i.dirtyChildren.indexOf(t)&&i.dirtyChildren.push(t),i.dirty=!0,i.dirtyReason=ni.REMOVED);var o=t.parentNode.childNodes.indexOf(t);o>-1&&t.parentNode.childNodes.splice(o,1),r&&this.dirtifyWorld(t,r),t.parentNode=null}},t.prototype.getOrigin=function(t){return t.transformable.origin},t.prototype.setOrigin=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=[e,n,r]);var i=t.transformable;if(e[0]!==i.origin[0]||e[1]!==i.origin[1]||e[2]!==i.origin[2]){var o=i.origin;o[0]=e[0],o[1]=e[1],o[2]=e[2]||0,this.dirtifyLocal(t,i)}},t.prototype.setLocalEulerAngles=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0),"number"==typeof e&&(e=tt(e,n,r));var i=t.transformable;xt(i.localRotation,e[0],e[1],e[2]),this.dirtifyLocal(t,i)},t.prototype.scaleLocal=function(t,e){var n=t.transformable;!function(t,e,n){t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2]}(n.localScale,n.localScale,tt(e[0],e[1],e[2]||1)),this.dirtifyLocal(t,n)},t.prototype.setLocalScale=function(t,e){var n=t.transformable,r=tt(e[0],e[1],e[2]||n.localScale[2]);ht(r,n.localScale)||(et(n.localScale,r),this.dirtifyLocal(t,n))},t.prototype.setLocalRotation=function(t,e,n,r,i){"number"==typeof e&&(e=Et(e,n,r,i));var o=t.transformable;wt(o.localRotation,e),this.dirtifyLocal(t,o)},t.prototype.setLocalSkew=function(t,e,n){"number"==typeof e&&(e=function(t,e){var n=new y(2);return n[0]=t,n[1]=e,n}(e,n));var r=t.transformable;!function(t,e){t[0]=e[0],t[1]=e[1]}(r.localSkew,e),this.dirtifyLocal(t,r)},t.prototype.dirtifyLocal=function(t,e){e.localDirtyFlag||(e.localDirtyFlag=!0,e.dirtyFlag||this.dirtifyWorld(t,e))},t.prototype.dirtifyWorld=function(t,e){e.dirtyFlag||this.unfreezeParentToRoot(t),this.dirtifyWorldInternal(t,e),this.dirtifyToRoot(t,!0)},t.prototype.triggerPendingEvents=function(){var t=this,e=new Set,n=function(n,r){n.isConnected&&!e.has(n.entity)&&(t.boundsChangedEvent.detail=r,t.boundsChangedEvent.target=n,n.isMutationObserved?n.dispatchEvent(t.boundsChangedEvent):n.ownerDocument.defaultView.dispatchEvent(t.boundsChangedEvent,!0),e.add(n.entity))};this.pendingEvents.forEach((function(t){var e=u(t,2),r=e[0],i=e[1];i.affectChildren?r.forEach((function(t){n(t,i)})):n(r,i)})),this.clearPendingEvents(),e.clear()},t.prototype.clearPendingEvents=function(){this.pendingEvents=[]},t.prototype.dirtifyToRoot=function(t,e){void 0===e&&(e=!1);var n=t;for(n.renderable&&(n.renderable.dirty=!0);n;)ns(n),n=n.parentNode;e&&t.forEach((function(t){ns(t)})),this.informDependentDisplayObjects(t),this.pendingEvents.push([t,{affectChildren:e}])},t.prototype.updateDisplayObjectDependency=function(t,e,n,r){if(e&&e!==n){var i=this.displayObjectDependencyMap.get(e);if(i&&i[t]){var o=i[t].indexOf(r);i[t].splice(o,1)}}if(n){var a=this.displayObjectDependencyMap.get(n);a||(this.displayObjectDependencyMap.set(n,{}),a=this.displayObjectDependencyMap.get(n)),a[t]||(a[t]=[]),a[t].push(r)}},t.prototype.informDependentDisplayObjects=function(t){var e=this,n=this.displayObjectDependencyMap.get(t);n&&Object.keys(n).forEach((function(t){n[t].forEach((function(n){e.dirtifyToRoot(n,!0),n.dispatchEvent(new es(Za.ATTR_MODIFIED,n,e,e,t,es.MODIFICATION,e,e)),n.isCustomElement&&n.isConnected&&n.attributeChangedCallback&&n.attributeChangedCallback(t,e,e)}))}))},t.prototype.getPosition=function(t){var e=t.transformable;return L(e.position,this.getWorldTransform(t,e))},t.prototype.getRotation=function(t){var e=t.transformable;return z(e.rotation,this.getWorldTransform(t,e))},t.prototype.getScale=function(t){var e=t.transformable;return j(e.scaling,this.getWorldTransform(t,e))},t.prototype.getWorldTransform=function(t,e){return void 0===e&&(e=t.transformable),e.localDirtyFlag||e.dirtyFlag?(t.parentNode&&t.parentNode.transformable&&this.getWorldTransform(t.parentNode),this.sync(t,e),e.worldTransform):e.worldTransform},t.prototype.getLocalPosition=function(t){return t.transformable.localPosition},t.prototype.getLocalRotation=function(t){return t.transformable.localRotation},t.prototype.getLocalScale=function(t){return t.transformable.localScale},t.prototype.getLocalSkew=function(t){return t.transformable.localSkew},t.prototype.getLocalTransform=function(t){var e=t.transformable;return e.localDirtyFlag&&(this.calcLocalTransform(e),e.localDirtyFlag=!1),e.localTransform},t.prototype.setLocalTransform=function(t,e){var n=L(Z(),e),r=z(mt(),e),i=j(Z(),e);this.setLocalScale(t,i),this.setLocalPosition(t,n),this.setLocalRotation(t,r)},t.prototype.resetLocalTransform=function(t){this.setLocalScale(t,[1,1,1]),this.setLocalPosition(t,[0,0,0]),this.setLocalEulerAngles(t,[0,0,0]),this.setLocalSkew(t,[0,0])},t.prototype.getTransformedGeometryBounds=function(t,e,n){void 0===e&&(e=!1);var r=this.getGeometryBounds(t,e);if(vr.isEmpty(r))return null;var i=n||new vr;return i.setFromTransformedAABB(r,this.getWorldTransform(t)),i},t.prototype.getGeometryBounds=function(t,e){void 0===e&&(e=!1);var n=t.geometry;return(e?n.renderBounds:n.contentBounds||null)||new vr},t.prototype.getBounds=function(t,e){var n=this;void 0===e&&(e=!1);var r=t.renderable;if(!r.boundsDirty&&!e&&r.bounds)return r.bounds;if(!r.renderBoundsDirty&&e&&r.renderBounds)return r.renderBounds;var i=e?r.renderBounds:r.bounds,o=this.getTransformedGeometryBounds(t,e,i);if(t.childNodes.forEach((function(t){var r=n.getBounds(t,e);r&&(o?o.add(r):(o=i||new vr).update(r.center,r.halfExtents))})),o||(o=new vr),e){var a=ua(t);if(a){var s=a.parsedStyle.clipPath.getBounds(e);o?s&&(o=s.intersection(o)):o.update(s.center,s.halfExtents)}}return e?(r.renderBounds=o,r.renderBoundsDirty=!1):(r.bounds=o,r.boundsDirty=!1),o},t.prototype.getLocalBounds=function(t){if(t.parentNode){var e=x();t.parentNode.transformable&&(e=C(x(),this.getWorldTransform(t.parentNode)));var n=this.getBounds(t);if(!vr.isEmpty(n)){var r=new vr;return r.setFromTransformedAABB(n,e),r}}return this.getBounds(t)},t.prototype.getBoundingClientRect=function(t){var e,n,r,i=this.getGeometryBounds(t);vr.isEmpty(i)||(r=new vr).setFromTransformedAABB(i,this.getWorldTransform(t));var o=null===(n=null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView)||void 0===n?void 0:n.getContextService().getBoundingClientRect();if(r){var a=u(r.getMin(),2),s=a[0],c=a[1],l=u(r.getMax(),2),h=l[0],d=l[1];return new Nr(s+((null==o?void 0:o.left)||0),c+((null==o?void 0:o.top)||0),h-s,d-c)}return new Nr((null==o?void 0:o.left)||0,(null==o?void 0:o.top)||0,0,0)},t.prototype.dirtifyWorldInternal=function(t,e){var n=this;if(!e.dirtyFlag){e.dirtyFlag=!0,e.frozen=!1,t.childNodes.forEach((function(t){var e=t.transformable;e.dirtyFlag||n.dirtifyWorldInternal(t,e)}));var r=t.renderable;r&&(r.renderBoundsDirty=!0,r.boundsDirty=!0,r.dirty=!0)}},t.prototype.syncHierarchy=function(t){var e=t.transformable;if(!e.frozen){e.frozen=!0,(e.localDirtyFlag||e.dirtyFlag)&&this.sync(t,e);for(var n=t.childNodes,r=0;r<n.length;r++)this.syncHierarchy(n[r])}},t.prototype.sync=function(t,e){if(e.localDirtyFlag&&(this.calcLocalTransform(e),e.localDirtyFlag=!1),e.dirtyFlag){var n=t.parentNode,r=n&&n.transformable;null!==n&&r?k(e.worldTransform,r.worldTransform,e.localTransform):w(e.worldTransform,e.localTransform),e.dirtyFlag=!1}},t.prototype.unfreezeParentToRoot=function(t){for(var e=t.parentNode;e;){var n=e.transformable;n&&(n.frozen=!1),e=e.parentNode}},t}(),cs={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},us=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,ls=new RegExp("".concat(/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/.source,"|").concat(/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹓﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/.source,"|").concat(/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/.source,"|").concat(/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/.source)),hs=new RegExp("".concat(/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/.source,"|").concat(/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/.source,"|").concat(/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/.source,"|").concat(/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/.source)),ds=function(){function t(t){var e=this;this.runtime=t,this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(t,n){return!e.isBreakingSpace(n)&&!(!t||!hs.exec(n)&&!ls.exec(t))},this.trimByKinsokuShorui=function(t){var e=l([],u(t),!1),n=e[e.length-2];if(!n)return t;var r=n[n.length-1];return e[e.length-2]=n.slice(0,-1),e[e.length-1]=r+e[e.length-1],e}}return t.prototype.measureFont=function(t,e){if(this.fontMetricsCache[t])return this.fontMetricsCache[t];var n={ascent:0,descent:0,fontSize:0},r=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(e),i=this.runtime.offscreenCanvasCreator.getOrCreateContext(e,{willReadFrequently:!0});i.font=t;var o=cs.MetricsString+cs.BaselineSymbol,a=Math.ceil(i.measureText(o).width),s=Math.ceil(i.measureText(cs.BaselineSymbol).width),c=cs.HeightMultiplier*s;s=s*cs.BaselineMultiplier|0,r.width=a,r.height=c,i.fillStyle="#f00",i.fillRect(0,0,a,c),i.font=t,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(o,0,s);var u=i.getImageData(0,0,a||1,c||1).data,l=u.length,h=4*a,d=0,f=0,p=!1;for(d=0;d<s;++d){for(var g=0;g<h;g+=4)if(255!==u[f+g]){p=!0;break}if(p)break;f+=h}for(n.ascent=s-d,f=l-h,p=!1,d=c;d>s;--d){for(g=0;g<h;g+=4)if(255!==u[f+g]){p=!0;break}if(p)break;f-=h}return n.descent=d-s,n.fontSize=n.ascent+n.descent,this.fontMetricsCache[t]=n,n},t.prototype.measureText=function(t,e,n){var r=e.fontSize,i=e.wordWrap,o=e.lineHeight,a=e.lineWidth,s=e.textBaseline,c=e.textAlign,u=e.letterSpacing,l=e.textPath;e.textPathSide,e.textPathStartOffset;var h=e.leading,d=void 0===h?0:h,f=function(t){for(var e=t.fontSize,n=t.fontFamily,r=t.fontStyle,i=t.fontVariant,o=t.fontWeight,a=Wt(e)&&"".concat(e,"px")||"16px",s=n.split(","),c=s.length-1;c>=0;c--){var u=s[c].trim();!Aa.test(u)&&Pa.indexOf(u)<0&&(u='"'.concat(u,'"')),s[c]=u}return"".concat(r," ").concat(i," ").concat(o," ").concat(a," ").concat(s.join(","))}(e),p=this.measureFont(f,n);0===p.fontSize&&(p.fontSize=r,p.ascent=r);var g=this.runtime.offscreenCanvasCreator.getOrCreateContext(n);g.font=f,e.isOverflowing=!1;var m=(i?this.wordWrap(t,e,n):t).split(/(?:\r\n|\r|\n)/),v=new Array(m.length),y=0;if(!l){for(M=0;M<m.length;M++){var b=g.measureText(m[M]).width+(m[M].length-1)*u;v[M]=b,y=Math.max(y,b)}N=y+a;var x=o||p.fontSize+a,E=Math.max(x,p.fontSize+a)+(m.length-1)*(x+d),w=0;return"middle"===s?w=-E/2:"bottom"===s||"alphabetic"===s||"ideographic"===s?w=-E:"top"!==s&&"hanging"!==s||(w=0),{font:f,width:N,height:E,lines:m,lineWidths:v,lineHeight:x+=d,maxLineWidth:y,fontProperties:p,lineMetrics:v.map((function(t,e){var n=0;return"center"===c||"middle"===c?n-=t/2:"right"!==c&&"end"!==c||(n-=t),new Nr(n-a/2,w+e*x,t+a,x)}))}}l.getTotalLength();for(var M=0;M<m.length;M++)var N=g.measureText(m[M]).width+(m[M].length-1)*u},t.prototype.setGraphemeOnPath=function(){},t.prototype.wordWrap=function(t,e,n){var r=this,i=e.wordWrapWidth,o=void 0===i?0:i,a=e.letterSpacing,s=e.maxLines,c=void 0===s?1/0:s,u=e.textOverflow,l=this.runtime.offscreenCanvasCreator.getOrCreateContext(n),h=o+a,d="";"ellipsis"===u?d="...":u&&"clip"!==u&&(d=u);for(var f=[],p=0,g=0,m={},v=function(t){return r.getFromCache(t,a,m,l)},y=Array.from(d).reduce((function(t,e){return t+v(e)}),0),b=Array.from(t),x=0;x<b.length;x++){var E=b[x],w=t[x-1],M=t[x+1],N=v(E);if(this.isNewline(E)){if(++p>=c){e.isOverflowing=!0;break}g=0,f[p]=""}else{if(g>0&&g+N>h){if(p+1>=c){if(e.isOverflowing=!0,y>0&&y<=h){for(var S=f[p].length,C=0,T=S,k=0;k<S;k++){var P=v(f[p][k]);if(C+P+y>h){T=k;break}C+=P}f[p]=(f[p]||"").slice(0,T)+d}break}if(g=0,f[++p]="",this.isBreakingSpace(E))continue;this.canBreakInLastChar(E)||(f=this.trimToBreakable(f),g=this.sumTextWidthByCache(f[p]||"",m)),this.shouldBreakByKinsokuShorui(E,M)&&(f=this.trimByKinsokuShorui(f),g+=v(w||""))}g+=N,f[p]=(f[p]||"")+E}}return f.join("\n")},t.prototype.isBreakingSpace=function(t){return"string"==typeof t&&cs.BreakingSpaces.indexOf(t.charCodeAt(0))>=0},t.prototype.isNewline=function(t){return"string"==typeof t&&cs.Newlines.indexOf(t.charCodeAt(0))>=0},t.prototype.trimToBreakable=function(t){var e=l([],u(t),!1),n=e[e.length-2],r=this.findBreakableIndex(n);if(-1===r||!n)return e;var i=n.slice(r,r+1),o=r+1,a=r+(this.isBreakingSpace(i)?0:1);return e[e.length-1]+=n.slice(o,n.length),e[e.length-2]=n.slice(0,a),e},t.prototype.canBreakInLastChar=function(t){return!t||!us.test(t)},t.prototype.sumTextWidthByCache=function(t,e){return t.split("").reduce((function(t,n){if(!e[n])throw Error("cannot count the word without cache");return t+e[n]}),0)},t.prototype.findBreakableIndex=function(t){for(var e=t.length-1;e>=0;e--)if(!us.test(t[e]))return e;return-1},t.prototype.getFromCache=function(t,e,n,r){var i=n[t];if("number"!=typeof i){var o=t.length*e;i=r.measureText(t).width+o,n[t]=i}return i},t}(),fs={},ps=(is=new Ba,os=new za,(rs={})[Yn.CIRCLE]=new Da,rs[Yn.ELLIPSE]=new Ia,rs[Yn.RECT]=is,rs[Yn.IMAGE]=is,rs[Yn.GROUP]=is,rs[Yn.LINE]=new La,rs[Yn.TEXT]=new Fa(fs),rs[Yn.POLYLINE]=os,rs[Yn.POLYGON]=os,rs[Yn.PATH]=new ja,rs[Yn.HTML]=null,rs[Yn.MESH]=null,rs),gs=function(){var t,e=new Fo,n=new Wo;return(t={})[gi.PERCENTAGE]=null,t[gi.NUMBER]=new Xo,t[gi.ANGLE]=new zo,t[gi.DEFINED_PATH]=new Bo,t[gi.PAINT]=e,t[gi.COLOR]=e,t[gi.FILTER]=new Go,t[gi.LENGTH]=n,t[gi.LENGTH_PERCENTAGE]=n,t[gi.LENGTH_PERCENTAGE_12]=new Uo,t[gi.LENGTH_PERCENTAGE_14]=new Ho,t[gi.COORDINATE]=new Yo,t[gi.OFFSET_DISTANCE]=new Zo,t[gi.OPACITY_VALUE]=new Qo,t[gi.PATH]=new Jo,t[gi.LIST_OF_POINTS]=new ta,t[gi.SHADOW_BLUR]=new ea,t[gi.TEXT]=new na,t[gi.TEXT_TRANSFORM]=new ra,t[gi.TRANSFORM]=new Oa,t[gi.TRANSFORM_ORIGIN]=new _a,t[gi.Z_INDEX]=new Ra,t[gi.MARKER]=new Ko,t}();fs.CameraContribution=Dr,fs.AnimationTimeline=null,fs.EasingFunction=null,fs.offscreenCanvasCreator=new Xa,fs.sceneGraphSelector=new ts,fs.sceneGraphService=new ss(fs),fs.textService=new ds(fs),fs.geometryUpdaterFactory=ps,fs.CSSPropertySyntaxFactory=gs,fs.styleValueRegistry=new jo(fs),fs.layoutRegistry=null,fs.globalThis="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},fs.enableCSSParsing=!0,fs.enableDataset=!1,fs.enableStyleSyntax=!0,fs.enableSizeAttenuation=!1;var ms=0,vs=new es(Za.INSERTED,null,"","","",0,"",""),ys=new es(Za.REMOVED,null,"","","",0,"",""),bs=new qa(Za.DESTROY),xs=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.entity=ms++,e.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},e.cullable={strategy:ei.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},e.transformable={dirtyFlag:!1,localDirtyFlag:!1,frozen:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},e.sortable={dirty:!1,sorted:void 0,renderOrder:0,dirtyChildren:[],dirtyReason:void 0},e.geometry={contentBounds:void 0,renderBounds:void 0},e.rBushNode={aabb:void 0},e.namespaceURI="g",e.scrollLeft=0,e.scrollTop=0,e.clientTop=0,e.clientLeft=0,e.destroyed=!1,e.style={},e.computedStyle=fs.enableCSSParsing?{anchor:oi,opacity:oi,fillOpacity:oi,strokeOpacity:oi,fill:oi,stroke:oi,transform:oi,transformOrigin:oi,visibility:oi,pointerEvents:oi,lineWidth:oi,lineCap:oi,lineJoin:oi,increasedLineWidthForHitTesting:oi,fontSize:oi,fontFamily:oi,fontStyle:oi,fontWeight:oi,fontVariant:oi,textAlign:oi,textBaseline:oi,textTransform:oi,zIndex:oi,filter:oi,shadowType:oi}:null,e.parsedStyle={},e.attributes={},e}return r(e,t),Object.defineProperty(e.prototype,"className",{get:function(){return this.getAttribute("class")||""},set:function(t){this.setAttribute("class",t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"classList",{get:function(){return this.className.split(" ").filter((function(t){return""!==t}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tagName",{get:function(){return this.nodeName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){return this.childNodes.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){return this.firstChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){return this.lastChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentElement",{get:function(){return this.parentNode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){if(this.parentNode){var t=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[t+1]||null}return null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){if(this.parentNode){var t=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[t-1]||null}return null},enumerable:!1,configurable:!0}),e.prototype.cloneNode=function(t){throw new Error(Sr)},e.prototype.appendChild=function(t,e){var n;if(t.destroyed)throw new Error("Cannot append a destroyed element.");return fs.sceneGraphService.attach(t,this,e),(null===(n=this.ownerDocument)||void 0===n?void 0:n.defaultView)&&this.ownerDocument.defaultView.mountChildren(t),vs.relatedNode=this,t.dispatchEvent(vs),t},e.prototype.insertBefore=function(t,e){if(e){t.parentElement&&t.parentElement.removeChild(t);var n=this.childNodes.indexOf(e);-1===n?this.appendChild(t):this.appendChild(t,n)}else this.appendChild(t);return t},e.prototype.replaceChild=function(t,e){var n=this.childNodes.indexOf(e);return this.removeChild(e),this.appendChild(t,n),e},e.prototype.removeChild=function(t){var e;return ys.relatedNode=this,t.dispatchEvent(ys),(null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView)&&t.ownerDocument.defaultView.unmountChildren(t),fs.sceneGraphService.detach(t),t},e.prototype.removeChildren=function(){for(var t=this.childNodes.length-1;t>=0;t--){var e=this.childNodes[t];this.removeChild(e)}},e.prototype.destroyChildren=function(){for(var t=this.childNodes.length-1;t>=0;t--){var e=this.childNodes[t];e.childNodes.length&&e.destroyChildren(),e.destroy()}},e.prototype.matches=function(t){return fs.sceneGraphService.matches(t,this)},e.prototype.getElementById=function(t){return fs.sceneGraphService.querySelector("#".concat(t),this)},e.prototype.getElementsByName=function(t){return fs.sceneGraphService.querySelectorAll('[name="'.concat(t,'"]'),this)},e.prototype.getElementsByClassName=function(t){return fs.sceneGraphService.querySelectorAll(".".concat(t),this)},e.prototype.getElementsByTagName=function(t){return fs.sceneGraphService.querySelectorAll(t,this)},e.prototype.querySelector=function(t){return fs.sceneGraphService.querySelector(t,this)},e.prototype.querySelectorAll=function(t){return fs.sceneGraphService.querySelectorAll(t,this)},e.prototype.closest=function(t){var e=this;do{if(fs.sceneGraphService.matches(t,e))return e;e=e.parentElement}while(null!==e);return null},e.prototype.find=function(t){var e=this,n=null;return this.forEach((function(r){return!(r===e||!t(r))&&(n=r,!0)})),n},e.prototype.findAll=function(t){var e=this,n=[];return this.forEach((function(r){r!==e&&t(r)&&n.push(r)})),n},e.prototype.after=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(this.parentNode){var r=this.parentNode.childNodes.indexOf(this);e.forEach((function(e,n){var i;return null===(i=t.parentNode)||void 0===i?void 0:i.appendChild(e,r+n+1)}))}},e.prototype.before=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(this.parentNode){var r=this.parentNode.childNodes.indexOf(this),i=u(e),o=i[0],a=i.slice(1);this.parentNode.appendChild(o,r),(t=o).after.apply(t,l([],u(a),!1))}},e.prototype.replaceWith=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.after.apply(this,l([],u(t),!1)),this.remove()},e.prototype.append=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e.forEach((function(e){return t.appendChild(e)}))},e.prototype.prepend=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];e.forEach((function(e,n){return t.appendChild(e,n)}))},e.prototype.replaceChildren=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,l([],u(t),!1))},e.prototype.remove=function(){return this.parentNode?this.parentNode.removeChild(this):this},e.prototype.destroy=function(){this.dispatchEvent(bs),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0},e.prototype.getGeometryBounds=function(){return fs.sceneGraphService.getGeometryBounds(this)},e.prototype.getRenderBounds=function(){return fs.sceneGraphService.getBounds(this,!0)},e.prototype.getBounds=function(){return fs.sceneGraphService.getBounds(this)},e.prototype.getLocalBounds=function(){return fs.sceneGraphService.getLocalBounds(this)},e.prototype.getBoundingClientRect=function(){return fs.sceneGraphService.getBoundingClientRect(this)},e.prototype.getClientRects=function(){return[this.getBoundingClientRect()]},e.prototype.computedStyleMap=function(){return new Map(Object.entries(this.computedStyle))},e.prototype.getAttributeNames=function(){return Object.keys(this.attributes)},e.prototype.getAttribute=function(t){if(function(t){return"symbol"==typeof t}(t))return fs.enableCSSParsing?null:void 0;var e=this.attributes[t];if(void 0===e){var n=Xr(t);return e=this.attributes[n],fs.enableCSSParsing&&Pt(e)?null:e}return e},e.prototype.hasAttribute=function(t){return this.getAttributeNames().includes(t)},e.prototype.hasAttributes=function(){return!!this.getAttributeNames().length},e.prototype.removeAttribute=function(t){this.setAttribute(t,null),delete this.attributes[t]},e.prototype.setAttribute=function(t,e,n){this.attributes[t]=e},e.prototype.getAttributeNS=function(t,e){throw new Error(Sr)},e.prototype.getAttributeNode=function(t){throw new Error(Sr)},e.prototype.getAttributeNodeNS=function(t,e){throw new Error(Sr)},e.prototype.hasAttributeNS=function(t,e){throw new Error(Sr)},e.prototype.removeAttributeNS=function(t,e){throw new Error(Sr)},e.prototype.removeAttributeNode=function(t){throw new Error(Sr)},e.prototype.setAttributeNS=function(t,e,n){throw new Error(Sr)},e.prototype.setAttributeNode=function(t){throw new Error(Sr)},e.prototype.setAttributeNodeNS=function(t){throw new Error(Sr)},e.prototype.toggleAttribute=function(t,e){throw new Error(Sr)},e}(Ya);function Es(t){return!!(null==t?void 0:t.nodeName)}var ws,Ms=new es(Za.ATTR_MODIFIED,null,null,null,null,es.MODIFICATION,null,null),Ns={anchor:"",opacity:"",fillOpacity:"",strokeOpacity:"",fill:"",stroke:"",transform:"",transformOrigin:"",visibility:"",pointerEvents:"",lineWidth:"",lineCap:"",lineJoin:"",increasedLineWidthForHitTesting:"",fontSize:"",fontFamily:"",fontStyle:"",fontWeight:"",fontVariant:"",textAlign:"",textBaseline:"",textTransform:"",zIndex:"",filter:"",shadowType:""},Ss={anchor:[0,0],fill:li,stroke:li,transform:[],zIndex:0,filter:[],shadowType:"outer",miterLimit:10},Cs=i(i({},Ss),{opacity:1,fillOpacity:1,strokeOpacity:1,visibility:"visible",pointerEvents:"auto",lineWidth:1,lineCap:"butt",lineJoin:"miter",increasedLineWidthForHitTesting:0,fillRule:"nonzero"}),Ts=l(l([],u(["opacity","fillOpacity","strokeOpacity","transformOrigin","visibility","pointerEvents","lineWidth","lineCap","lineJoin","increasedLineWidthForHitTesting"]),!1),["fontSize","fontFamily","fontStyle","fontWeight","fontVariant","textAlign","textBaseline","textTransform"],!1),ks="data-",Ps=function(t){function e(e){var n,r=t.call(this)||this;r.isCustomElement=!1,r.isMutationObserved=!1,r.activeAnimations=[],r.getClip=function(){return this.style.clipPath||null},r.config=e,r.config.interactive=null!==(n=r.config.capture)&&void 0!==n?n:r.config.interactive,r.id=r.config.id||"",r.name=r.config.name||"",(r.config.className||r.config.class)&&(r.className=r.config.className||r.config.class),r.nodeName=r.config.type||Yn.GROUP,r.config.style=r.config.style||r.config.attrs||{},Object.assign(r.config.style,r.config.attrs),null!=r.config.visible&&(r.config.style.visibility=!1===r.config.visible?"hidden":"visible"),null!=r.config.interactive&&(r.config.style.pointerEvents=!1===r.config.interactive?"none":"auto"),Object.assign(r.parsedStyle,fs.enableCSSParsing?Ss:Cs,r.config.initialParsedStyle),fs.enableCSSParsing&&Object.assign(r.attributes,Ns),r.initAttributes(r.config.style);var i=fs.globalThis.Proxy?fs.globalThis.Proxy:function(){};return fs.enableDataset&&(r.dataset=new i({},{get:function(t,e){var n="".concat(ks).concat($r(e));return void 0!==t[n]?t[n]:r.getAttribute(n)},set:function(t,e,n){return r.setAttribute("".concat(ks).concat($r(e)),n),!0}})),fs.enableStyleSyntax&&(r.style=new i({setProperty:function(t,e){r.setAttribute(t,e)},getPropertyValue:function(t){return r.getAttribute(t)},removeProperty:function(t){r.removeAttribute(t)},item:function(){return""}},{get:function(t,e){return void 0!==t[e]?t[e]:r.getAttribute(e)},set:function(t,e,n){return r.setAttribute(e,n),!0}})),r}return r(e,t),e.prototype.destroy=function(){t.prototype.destroy.call(this),this.getAnimations().forEach((function(t){t.cancel()}))},e.prototype.cloneNode=function(t,e){var n=i({},this.attributes);for(var r in n){var o=n[r];Es(o)&&"clipPath"!==r&&"offsetPath"!==r&&"textPath"!==r&&(n[r]=o.cloneNode(t)),e&&(n[r]=e(r,o))}var a=new this.constructor({id:this.id,name:this.name,className:this.name,interactive:this.interactive,style:n});return a.setLocalTransform(this.getLocalTransform()),t&&this.children.forEach((function(e){if(!e.style.isMarker){var n=e.cloneNode(t);a.appendChild(n)}})),a},e.prototype.initAttributes=function(t){void 0===t&&(t={});var e=this.renderable,n={forceUpdateGeometry:!0};fs.enableCSSParsing&&(n.usedAttributes=Ts);var r={};for(var i in t){r[Xr(i)]=t[i]}fs.styleValueRegistry.processProperties(this,r,n),e.dirty=!0},e.prototype.setAttribute=function(e,n,r,i){void 0===r&&(r=!1),void 0===i&&(i=!0);var o=Xr(e);Qt(n)||(r||n!==this.attributes[o])&&(this.internalSetAttribute(o,n,{memoize:i}),t.prototype.setAttribute.call(this,o,n))},e.prototype.internalSetAttribute=function(t,e,n){var r;void 0===n&&(n={});var i=this.renderable,o=this.attributes[t],a=this.parsedStyle[t];fs.styleValueRegistry.processProperties(this,((r={})[t]=e,r),n),i.dirty=!0;var s=this.parsedStyle[t];this.isConnected&&(Ms.relatedNode=this,Ms.prevValue=o,Ms.newValue=e,Ms.attrName=t,Ms.prevParsedValue=a,Ms.newParsedValue=s,this.isMutationObserved?this.dispatchEvent(Ms):(Ms.target=this,this.ownerDocument.defaultView.dispatchEvent(Ms,!0))),(this.isCustomElement&&this.isConnected||!this.isCustomElement)&&this.attributeChangedCallback&&this.attributeChangedCallback(t,o,e,a,s)},e.prototype.getBBox=function(){var t=this.getBounds(),e=u(t.getMin(),2),n=e[0],r=e[1],i=u(t.getMax(),2),o=i[0],a=i[1];return new Nr(n,r,o-n,a-r)},e.prototype.setOrigin=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),fs.sceneGraphService.setOrigin(this,ir(t,e,n)),this},e.prototype.getOrigin=function(){return fs.sceneGraphService.getOrigin(this)},e.prototype.setPosition=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),fs.sceneGraphService.setPosition(this,ir(t,e,n)),this},e.prototype.setLocalPosition=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),fs.sceneGraphService.setLocalPosition(this,ir(t,e,n)),this},e.prototype.translate=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),fs.sceneGraphService.translate(this,ir(t,e,n)),this},e.prototype.translateLocal=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),fs.sceneGraphService.translateLocal(this,ir(t,e,n)),this},e.prototype.getPosition=function(){return fs.sceneGraphService.getPosition(this)},e.prototype.getLocalPosition=function(){return fs.sceneGraphService.getLocalPosition(this)},e.prototype.scale=function(t,e,n){return this.scaleLocal(t,e,n)},e.prototype.scaleLocal=function(t,e,n){return"number"==typeof t&&(t=ir(t,e=e||t,n=n||t)),fs.sceneGraphService.scaleLocal(this,t),this},e.prototype.setLocalScale=function(t,e,n){return"number"==typeof t&&(t=ir(t,e=e||t,n=n||t)),fs.sceneGraphService.setLocalScale(this,t),this},e.prototype.getLocalScale=function(){return fs.sceneGraphService.getLocalScale(this)},e.prototype.getScale=function(){return fs.sceneGraphService.getScale(this)},e.prototype.getEulerAngles=function(){return ar(u(sr(Z(),fs.sceneGraphService.getWorldTransform(this)),3)[2])},e.prototype.getLocalEulerAngles=function(){return ar(u(sr(Z(),fs.sceneGraphService.getLocalRotation(this)),3)[2])},e.prototype.setEulerAngles=function(t){return fs.sceneGraphService.setEulerAngles(this,0,0,t),this},e.prototype.setLocalEulerAngles=function(t){return fs.sceneGraphService.setLocalEulerAngles(this,0,0,t),this},e.prototype.rotateLocal=function(t,e,n){return Pt(e)&&Pt(n)?fs.sceneGraphService.rotateLocal(this,0,0,t):fs.sceneGraphService.rotateLocal(this,t,e,n),this},e.prototype.rotate=function(t,e,n){return Pt(e)&&Pt(n)?fs.sceneGraphService.rotate(this,0,0,t):fs.sceneGraphService.rotate(this,t,e,n),this},e.prototype.setRotation=function(t,e,n,r){return fs.sceneGraphService.setRotation(this,t,e,n,r),this},e.prototype.setLocalRotation=function(t,e,n,r){return fs.sceneGraphService.setLocalRotation(this,t,e,n,r),this},e.prototype.setLocalSkew=function(t,e){return fs.sceneGraphService.setLocalSkew(this,t,e),this},e.prototype.getRotation=function(){return fs.sceneGraphService.getRotation(this)},e.prototype.getLocalRotation=function(){return fs.sceneGraphService.getLocalRotation(this)},e.prototype.getLocalSkew=function(){return fs.sceneGraphService.getLocalSkew(this)},e.prototype.getLocalTransform=function(){return fs.sceneGraphService.getLocalTransform(this)},e.prototype.getWorldTransform=function(){return fs.sceneGraphService.getWorldTransform(this)},e.prototype.setLocalTransform=function(t){return fs.sceneGraphService.setLocalTransform(this,t),this},e.prototype.resetLocalTransform=function(){fs.sceneGraphService.resetLocalTransform(this)},e.prototype.getAnimations=function(){return this.activeAnimations},e.prototype.animate=function(t,e){var n,r=null===(n=this.ownerDocument)||void 0===n?void 0:n.timeline;return r?r.play(this,t,e):null},e.prototype.isVisible=function(){var t;return"visible"===(null===(t=this.parsedStyle)||void 0===t?void 0:t.visibility)},Object.defineProperty(e.prototype,"interactive",{get:function(){return this.isInteractive()},set:function(t){this.style.pointerEvents=t?"auto":"none"},enumerable:!1,configurable:!0}),e.prototype.isInteractive=function(){var t;return"none"!==(null===(t=this.parsedStyle)||void 0===t?void 0:t.pointerEvents)},e.prototype.isCulled=function(){return!(!this.cullable||!this.cullable.enable||this.cullable.visible)},e.prototype.toFront=function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,l([],u(this.parentNode.children.map((function(t){return Number(t.style.zIndex)}))),!1))+1),this},e.prototype.toBack=function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,l([],u(this.parentNode.children.map((function(t){return Number(t.style.zIndex)}))),!1))-1),this},e.prototype.getConfig=function(){return this.config},e.prototype.attr=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=u(e,2),i=r[0],o=r[1];return i?Rt(i)?(Object.keys(i).forEach((function(e){t.setAttribute(e,i[e])})),this):2===e.length?(this.setAttribute(i,o),this):this.attributes[i]:this.attributes},e.prototype.getMatrix=function(t){var e=t||this.getWorldTransform(),n=u(L(Z(),e),2),r=n[0],i=n[1],o=u(j(Z(),e),2),a=o[0],s=o[1],c=z(mt(),e),l=u(sr(Z(),c),3),h=l[0],d=l[2];return cr(h||d,r,i,a,s)},e.prototype.getLocalMatrix=function(){return this.getMatrix(this.getLocalTransform())},e.prototype.setMatrix=function(t){var e=u(ur(t),5),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4];this.setEulerAngles(a).setPosition(n,r).setLocalScale(i,o)},e.prototype.setLocalMatrix=function(t){var e=u(ur(t),5),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4];this.setLocalEulerAngles(a).setLocalPosition(n,r).setLocalScale(i,o)},e.prototype.show=function(){fs.enableCSSParsing?this.style.visibility="visible":this.forEach((function(t){t.style.visibility="visible"}))},e.prototype.hide=function(){fs.enableCSSParsing?this.style.visibility="hidden":this.forEach((function(t){t.style.visibility="hidden"}))},e.prototype.getCount=function(){return this.childElementCount},e.prototype.getParent=function(){return this.parentElement},e.prototype.getChildren=function(){return this.children},e.prototype.getFirst=function(){return this.firstElementChild},e.prototype.getLast=function(){return this.lastElementChild},e.prototype.getChildByIndex=function(t){return this.children[t]||null},e.prototype.add=function(t,e){return this.appendChild(t,e)},e.prototype.setClip=function(t){this.style.clipPath=t},e.prototype.set=function(t,e){this.config[t]=e},e.prototype.get=function(t){return this.config[t]},e.prototype.moveTo=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),this.setPosition(t,e,n),this},e.prototype.move=function(t,e,n){return void 0===e&&(e=0),void 0===n&&(n=0),this.setPosition(t,e,n),this},e.prototype.setZIndex=function(t){return this.style.zIndex=t,this},e}(xs),As=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:Yn.CIRCLE,style:fs.enableCSSParsing?i({cx:"",cy:"",r:""},n):i({},n),initialParsedStyle:{anchor:[.5,.5],transformOrigin:fs.enableCSSParsing?null:[pi,pi]}},r))||this}return r(e,t),e}(Ps),Os=function(t){function e(e){void 0===e&&(e={});var n=this,r=e.style,a=o(e,["style"]);return(n=t.call(this,i({style:fs.enableCSSParsing?i({x:"",y:""},r):i({},r)},a))||this).isCustomElement=!0,n}return r(e,t),e}(Ps),_s=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:Yn.ELLIPSE,style:fs.enableCSSParsing?i({cx:"",cy:"",rx:"",ry:""},n):i({},n),initialParsedStyle:{anchor:[.5,.5],transformOrigin:fs.enableCSSParsing?null:[pi,pi]}},r))||this}return r(e,t),e}(Ps),Rs=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:Yn.GROUP,style:fs.enableCSSParsing?i({x:"",y:"",width:"",height:""},n):i({},n)},r))||this}return r(e,t),e}(Ps),Ds=function(t){function e(e){void 0===e&&(e={});var n=this,r=e.style,a=o(e,["style"]);return(n=t.call(this,i({type:Yn.HTML,style:fs.enableCSSParsing?i({x:"",y:"",width:"auto",height:"auto",innerHTML:""},r):i({},r)},a))||this).cullable.enable=!1,n}return r(e,t),e.prototype.getDomElement=function(){return this.parsedStyle.$el},e.prototype.getBoundingClientRect=function(){if(this.parsedStyle.$el)return this.parsedStyle.$el.getBoundingClientRect();var t=this.parsedStyle,e=t.x,n=t.y,r=t.width,i=t.height;return new Nr(e,n,r,i)},e.prototype.getClientRects=function(){return[this.getBoundingClientRect()]},e.prototype.getBounds=function(){var t,e,n=this.getBoundingClientRect(),r=null===(e=null===(t=this.ownerDocument)||void 0===t?void 0:t.defaultView)||void 0===e?void 0:e.getContextService().getBoundingClientRect(),i=new vr,o=n.left-((null==r?void 0:r.left)||0),a=n.top-((null==r?void 0:r.top)||0);return i.setMinMax([o,a,0],[o+n.width,a+n.height,0]),i},e.prototype.getLocalBounds=function(){if(this.parentNode){var t=C(x(),this.parentNode.getWorldTransform()),e=this.getBounds();if(!vr.isEmpty(e)){var n=new vr;return n.setFromTransformedAABB(e,t),n}}return this.getBounds()},e}(Ps),Is=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:Yn.IMAGE,style:fs.enableCSSParsing?i({x:"",y:"",img:"",width:"",height:""},n):i({},n)},r))||this}return r(e,t),e}(Ps),Ls=function(t){function e(e){void 0===e&&(e={});var n=this,r=e.style,a=o(e,["style"]);(n=t.call(this,i({type:Yn.LINE,style:i({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},r)},a))||this).markerStartAngle=0,n.markerEndAngle=0;var s=n.parsedStyle,c=s.markerStart,u=s.markerEnd;return c&&Es(c)&&(n.markerStartAngle=c.getLocalEulerAngles(),n.appendChild(c)),u&&Es(u)&&(n.markerEndAngle=u.getLocalEulerAngles(),n.appendChild(u)),n.transformMarker(!0),n.transformMarker(!1),n}return r(e,t),e.prototype.attributeChangedCallback=function(t,e,n,r,i){"x1"===t||"y1"===t||"x2"===t||"y2"===t||"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Es(r)&&(this.markerStartAngle=0,r.remove()),i&&Es(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t&&(r&&Es(r)&&(this.markerEndAngle=0,r.remove()),i&&Es(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1)))},e.prototype.transformMarker=function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,a=e.x1,s=e.x2,c=e.y1,u=e.y2,l=e.defX,h=e.defY,d=t?n:r;if(d&&Es(d)){var f,p,g,m,v,y,b;t?(m=a-l,v=c-h,p=s-a,g=u-c,y=i||0,b=this.markerStartAngle):(m=s-l,v=u-h,p=a-s,g=c-u,y=o||0,b=this.markerEndAngle),f=Math.atan2(g,p),d.setLocalEulerAngles(180*f/Math.PI+b),d.setLocalPosition(m+Math.cos(f)*y,v+Math.sin(f)*y)}},e.prototype.getPoint=function(t,e){void 0===e&&(e=!1);var n=this.parsedStyle,r=n.x1,i=n.y1,o=n.x2,a=n.y2,s=n.defX,c=n.defY,u=Ln(r,i,o,a,t),l=u.x,h=u.y,d=lt(Z(),tt(l-s,h-c,0),e?this.getWorldTransform():this.getLocalTransform());return new Mr(d[0],d[1])},e.prototype.getPointAtLength=function(t,e){return void 0===e&&(e=!1),this.getPoint(t/this.getTotalLength(),e)},e.prototype.getTotalLength=function(){var t=this.parsedStyle;return In(t.x1,t.y1,t.x2,t.y2)},e}(Ps),js=function(t){function e(e){void 0===e&&(e={});var n=this,r=e.style,a=o(e,["style"]);(n=t.call(this,i({type:Yn.PATH,style:fs.enableCSSParsing?i({path:"",miterLimit:""},r):i({},r),initialParsedStyle:fs.enableCSSParsing?null:{miterLimit:4,path:i({},mi)}},a))||this).markerStartAngle=0,n.markerEndAngle=0,n.markerMidList=[];var s=n.parsedStyle,c=s.markerStart,u=s.markerEnd,l=s.markerMid;return c&&Es(c)&&(n.markerStartAngle=c.getLocalEulerAngles(),n.appendChild(c)),l&&Es(l)&&n.placeMarkerMid(l),u&&Es(u)&&(n.markerEndAngle=u.getLocalEulerAngles(),n.appendChild(u)),n.transformMarker(!0),n.transformMarker(!1),n}return r(e,t),e.prototype.attributeChangedCallback=function(t,e,n,r,i){"path"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Es(r)&&(this.markerStartAngle=0,r.remove()),i&&Es(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&Es(r)&&(this.markerEndAngle=0,r.remove()),i&&Es(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)},e.prototype.transformMarker=function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,a=e.defX,s=e.defY,c=t?n:r;if(c&&Es(c)){var l,h,d,f,p,g,m;if(t){var v=u(this.getStartTangent(),2),y=v[0];f=(b=v[1])[0]-a,p=b[1]-s,h=y[0]-b[0],d=y[1]-b[1],g=i||0,m=this.markerStartAngle}else{var b,x=u(this.getEndTangent(),2);y=x[0];f=(b=x[1])[0]-a,p=b[1]-s,h=y[0]-b[0],d=y[1]-b[1],g=o||0,m=this.markerEndAngle}l=Math.atan2(d,h),c.setLocalEulerAngles(180*l/Math.PI+m),c.setLocalPosition(f+Math.cos(l)*g,p+Math.sin(l)*g)}},e.prototype.placeMarkerMid=function(t){var e=this.parsedStyle,n=e.path.segments,r=e.defX,i=e.defY;if(this.markerMidList.forEach((function(t){t.remove()})),t&&Es(t))for(var o=1;o<n.length-1;o++){var a=u(n[o].currentPoint,2),s=a[0],c=a[1],l=1===o?t:t.cloneNode(!0);this.markerMidList.push(l),this.appendChild(l),l.setLocalPosition(s-r,c-i)}},e.prototype.getTotalLength=function(){return Zi(this)},e.prototype.getPointAtLength=function(t,e){void 0===e&&(e=!1);var n=this.parsedStyle,r=n.defX,o=n.defY,a=function(t,e,n){return qe(t,e,i(i({},n),{bbox:!1,length:!0})).point}(n.path.absolutePath,t),s=a.x,c=a.y,u=lt(Z(),tt(s-r,c-o,0),e?this.getWorldTransform():this.getLocalTransform());return new Mr(u[0],u[1])},e.prototype.getPoint=function(t,e){return void 0===e&&(e=!1),this.getPointAtLength(t*Zi(this),e)},e.prototype.getStartTangent=function(){var t=this.parsedStyle.path.segments,e=[];if(t.length>1){var n=t[0].currentPoint,r=t[1].currentPoint,i=t[1].startTangent;e=[],i?(e.push([n[0]-i[0],n[1]-i[1]]),e.push([n[0],n[1]])):(e.push([r[0],r[1]]),e.push([n[0],n[1]]))}return e},e.prototype.getEndTangent=function(){var t=this.parsedStyle.path.segments,e=t.length,n=[];if(e>1){var r=t[e-2].currentPoint,i=t[e-1].currentPoint,o=t[e-1].endTangent;n=[],o?(n.push([i[0]-o[0],i[1]-o[1]]),n.push([i[0],i[1]])):(n.push([r[0],r[1]]),n.push([i[0],i[1]]))}return n},e}(Ps),zs=function(t){function e(e){void 0===e&&(e={});var n=this,r=e.style,a=o(e,["style"]);(n=t.call(this,i({type:Yn.POLYGON,style:fs.enableCSSParsing?i({points:"",miterLimit:"",isClosed:!0},r):i({},r),initialParsedStyle:fs.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a))||this).markerStartAngle=0,n.markerEndAngle=0,n.markerMidList=[];var s=n.parsedStyle,c=s.markerStart,u=s.markerEnd,l=s.markerMid;return c&&Es(c)&&(n.markerStartAngle=c.getLocalEulerAngles(),n.appendChild(c)),l&&Es(l)&&n.placeMarkerMid(l),u&&Es(u)&&(n.markerEndAngle=u.getLocalEulerAngles(),n.appendChild(u)),n.transformMarker(!0),n.transformMarker(!1),n}return r(e,t),e.prototype.attributeChangedCallback=function(t,e,n,r,i){"points"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Es(r)&&(this.markerStartAngle=0,r.remove()),i&&Es(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&Es(r)&&(this.markerEndAngle=0,r.remove()),i&&Es(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)},e.prototype.transformMarker=function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,a=e.points,s=e.defX,c=e.defY,u=(a||{}).points,l=t?n:r;if(l&&Es(l)&&u){var h,d,f,p,g,m,v;if(p=u[0][0]-s,g=u[0][1]-c,t)d=u[1][0]-u[0][0],f=u[1][1]-u[0][1],m=i||0,v=this.markerStartAngle;else{var y=u.length;this.parsedStyle.isClosed?(d=u[y-1][0]-u[0][0],f=u[y-1][1]-u[0][1]):(p=u[y-1][0]-s,g=u[y-1][1]-c,d=u[y-2][0]-u[y-1][0],f=u[y-2][1]-u[y-1][1]),m=o||0,v=this.markerEndAngle}h=Math.atan2(f,d),l.setLocalEulerAngles(180*h/Math.PI+v),l.setLocalPosition(p+Math.cos(h)*m,g+Math.sin(h)*m)}},e.prototype.placeMarkerMid=function(t){var e=this.parsedStyle,n=e.points,r=e.defX,i=e.defY,o=(n||{}).points;if(this.markerMidList.forEach((function(t){t.remove()})),this.markerMidList=[],t&&Es(t)&&o)for(var a=1;a<(this.parsedStyle.isClosed?o.length:o.length-1);a++){var s=o[a][0]-r,c=o[a][1]-i,u=1===a?t:t.cloneNode(!0);this.markerMidList.push(u),this.appendChild(u),u.setLocalPosition(s,c)}},e}(Ps),Bs=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:Yn.POLYLINE,style:fs.enableCSSParsing?i({points:"",miterLimit:"",isClosed:!1},n):i({},n),initialParsedStyle:fs.enableCSSParsing?null:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},r))||this}return r(e,t),e.prototype.getTotalLength=function(){return this.parsedStyle.points.totalLength},e.prototype.getPointAtLength=function(t,e){return void 0===e&&(e=!1),this.getPoint(t/this.getTotalLength(),e)},e.prototype.getPoint=function(t,e){void 0===e&&(e=!1);var n=this.parsedStyle,r=n.defX,i=n.defY,o=n.points,a=o.points,s=o.segments,c=0,u=0;s.forEach((function(e,n){t>=e[0]&&t<=e[1]&&(c=(t-e[0])/(e[1]-e[0]),u=n)}));var l=Ln(a[u][0],a[u][1],a[u+1][0],a[u+1][1],c),h=l.x,d=l.y,f=lt(Z(),tt(h-r,d-i,0),e?this.getWorldTransform():this.getLocalTransform());return new Mr(f[0],f[1])},e.prototype.getStartTangent=function(){var t=this.parsedStyle.points.points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e},e.prototype.getEndTangent=function(){var t=this.parsedStyle.points.points,e=t.length-1,n=[];return n.push([t[e-1][0],t[e-1][1]]),n.push([t[e][0],t[e][1]]),n},e}(zs),Fs=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:Yn.RECT,style:fs.enableCSSParsing?i({x:"",y:"",width:"",height:"",radius:""},n):i({},n)},r))||this}return r(e,t),e}(Ps),Gs=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({type:Yn.TEXT,style:fs.enableCSSParsing?i({x:"",y:"",text:"",fontSize:"",fontFamily:"",fontStyle:"",fontWeight:"",fontVariant:"",textAlign:"",textBaseline:"",textTransform:"",fill:"black",letterSpacing:"",lineHeight:"",miterLimit:"",wordWrap:!1,wordWrapWidth:0,leading:0,dx:"",dy:""},n):i({fill:"black"},n),initialParsedStyle:fs.enableCSSParsing?{}:{x:0,y:0,fontSize:16,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",lineHeight:0,letterSpacing:0,textBaseline:"alphabetic",textAlign:"start",wordWrap:!1,wordWrapWidth:0,leading:0,dx:0,dy:0}},r))||this}return r(e,t),e.prototype.getComputedTextLength=function(){var t;return(null===(t=this.parsedStyle.metrics)||void 0===t?void 0:t.maxLineWidth)||0},e.prototype.getLineBoundingRects=function(){var t;return(null===(t=this.parsedStyle.metrics)||void 0===t?void 0:t.lineMetrics)||[]},e.prototype.isOverflowing=function(){return!!this.parsedStyle.isOverflowing},e}(Ps),Vs=function(){function t(){this.registry={},this.define(Yn.CIRCLE,As),this.define(Yn.ELLIPSE,_s),this.define(Yn.RECT,Fs),this.define(Yn.IMAGE,Is),this.define(Yn.LINE,Ls),this.define(Yn.GROUP,Rs),this.define(Yn.PATH,js),this.define(Yn.POLYGON,zs),this.define(Yn.POLYLINE,Bs),this.define(Yn.TEXT,Gs),this.define(Yn.HTML,Ds)}return t.prototype.define=function(t,e){this.registry[t]=e},t.prototype.get=function(t){return this.registry[t]},t}(),Ws=function(t){function e(){var e=t.call(this)||this;e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new fs.AnimationTimeline(e)}catch(t){}var n={};return Ro.forEach((function(t){var e=t.n,r=t.inh,i=t.d;r&&i&&(n[e]=Yr(i)?i(Yn.GROUP):i)})),e.documentElement=new Rs({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return r(e,t),Object.defineProperty(e.prototype,"children",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"childElementCount",{get:function(){return this.childNodes.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"firstElementChild",{get:function(){return this.firstChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastElementChild",{get:function(){return this.lastChild},enumerable:!1,configurable:!0}),e.prototype.createElement=function(t,e){if("svg"===t)return this.documentElement;var n=this.defaultView.customElements.get(t);n||(console.warn("Unsupported tagName: ",t),n="tspan"===t?Gs:Rs);var r=new n(e);return r.ownerDocument=this,r},e.prototype.createElementNS=function(t,e,n){return this.createElement(e,n)},e.prototype.cloneNode=function(t){throw new Error(Sr)},e.prototype.destroy=function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch(t){}},e.prototype.elementsFromBBox=function(t,e,n,r){var i=this.defaultView.context.rBushRoot.search({minX:t,minY:e,maxX:n,maxY:r}),o=[];return i.forEach((function(t){var e=t.displayObject,n=e.parsedStyle.pointerEvents,r=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(n);(!r||r&&e.isVisible())&&!e.isCulled()&&e.isInteractive()&&o.push(e)})),o.sort((function(t,e){return e.sortable.renderOrder-t.sortable.renderOrder})),o},e.prototype.elementFromPointSync=function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),a=o.width,s=o.height;if(r<0||i<0||r>a||i>s)return null;var c=this.defaultView.viewport2Client({x:r,y:i}),u=c.x,l=c.y,h=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:u,clientY:l},picked:[]}).picked;return h&&h[0]||this.documentElement},e.prototype.elementFromPoint=function(t,e){return a(this,void 0,void 0,(function(){var n,r,i,o,a,c,u,l,h,d;return s(this,(function(s){switch(s.label){case 0:return n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),a=o.width,c=o.height,r<0||i<0||r>a||i>c?[2,null]:(u=this.defaultView.viewport2Client({x:r,y:i}),l=u.x,h=u.y,[4,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:l,clientY:h},picked:[]})]);case 1:return[2,(d=s.sent().picked)&&d[0]||this.documentElement]}}))}))},e.prototype.elementsFromPointSync=function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),a=o.width,s=o.height;if(r<0||i<0||r>a||i>s)return[];var c=this.defaultView.viewport2Client({x:r,y:i}),u=c.x,l=c.y,h=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:u,clientY:l},picked:[]}).picked;return h[h.length-1]!==this.documentElement&&h.push(this.documentElement),h},e.prototype.elementsFromPoint=function(t,e){return a(this,void 0,void 0,(function(){var n,r,i,o,a,c,u,l,h,d;return s(this,(function(s){switch(s.label){case 0:return n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),a=o.width,c=o.height,r<0||i<0||r>a||i>c?[2,[]]:(u=this.defaultView.viewport2Client({x:r,y:i}),l=u.x,h=u.y,[4,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:l,clientY:h},picked:[]})]);case 1:return(d=s.sent().picked)[d.length-1]!==this.documentElement&&d.push(this.documentElement),[2,d]}}))}))},e.prototype.appendChild=function(t,e){throw new Error(Cr)},e.prototype.insertBefore=function(t,e){throw new Error(Cr)},e.prototype.removeChild=function(t,e){throw new Error(Cr)},e.prototype.replaceChild=function(t,e,n){throw new Error(Cr)},e.prototype.append=function(){throw new Error(Cr)},e.prototype.prepend=function(){throw new Error(Cr)},e.prototype.getElementById=function(t){return this.documentElement.getElementById(t)},e.prototype.getElementsByName=function(t){return this.documentElement.getElementsByName(t)},e.prototype.getElementsByTagName=function(t){return this.documentElement.getElementsByTagName(t)},e.prototype.getElementsByClassName=function(t){return this.documentElement.getElementsByClassName(t)},e.prototype.querySelector=function(t){return this.documentElement.querySelector(t)},e.prototype.querySelectorAll=function(t){return this.documentElement.querySelectorAll(t)},e.prototype.find=function(t){return this.documentElement.find(t)},e.prototype.findAll=function(t){return this.documentElement.findAll(t)},e}(Ya),Us=function(){function t(t){this.strategies=t}return t.prototype.apply=function(e){var n=e.camera,r=e.renderingService,i=e.renderingContext,o=this.strategies;r.hooks.cull.tap(t.tag,(function(t){if(t){var e=t.cullable;return 0===o.length?e.visible=i.unculledEntities.indexOf(t.entity)>-1:e.visible=o.every((function(e){return e.isVisible(n,t)})),!t.isCulled()&&t.isVisible()?t:(t.dispatchEvent(new qa(Za.CULLED)),null)}return t})),r.hooks.afterRender.tap(t.tag,(function(t){t.cullable.visibilityPlaneMask=-1}))},t.tag="Culling",t}(),Hs=function(){function t(){var t=this;this.autoPreventDefault=!1,this.rootPointerEvent=new Ua(null),this.rootWheelEvent=new Ha(null),this.onPointerMove=function(e){var n,r,i,o,a=null===(o=null===(i=t.context.renderingContext.root)||void 0===i?void 0:i.ownerDocument)||void 0===o?void 0:o.defaultView;if(!a.supportsTouchEvents||"touch"!==e.pointerType){var s=t.normalizeToPointerEvent(e,a);try{for(var u=c(s),l=u.next();!l.done;l=u.next()){var h=l.value,d=t.bootstrapEvent(t.rootPointerEvent,h,a,e);t.context.eventService.mapEvent(d)}}catch(t){n={error:t}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}t.setCursor(t.context.eventService.cursor)}},this.onClick=function(e){var n,r,i,o,a=null===(o=null===(i=t.context.renderingContext.root)||void 0===i?void 0:i.ownerDocument)||void 0===o?void 0:o.defaultView,s=t.normalizeToPointerEvent(e,a);try{for(var u=c(s),l=u.next();!l.done;l=u.next()){var h=l.value,d=t.bootstrapEvent(t.rootPointerEvent,h,a,e);t.context.eventService.mapEvent(d)}}catch(t){n={error:t}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}t.setCursor(t.context.eventService.cursor)}}return t.prototype.apply=function(e){var n=this;this.context=e;var r=e.renderingService,i=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler((function(t){return n.context.renderingService.hooks.pickSync.call({position:t,picked:[],topmost:!0}).picked[0]||null})),r.hooks.pointerWheel.tap(t.tag,(function(t){var e=n.normalizeWheelEvent(t);n.context.eventService.mapEvent(e)})),r.hooks.pointerDown.tap(t.tag,(function(t){var e,r;if(!i.supportsTouchEvents||"touch"!==t.pointerType){var o=n.normalizeToPointerEvent(t,i);if(n.autoPreventDefault&&o[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();try{for(var a=c(o),s=a.next();!s.done;s=a.next()){var u=s.value,l=n.bootstrapEvent(n.rootPointerEvent,u,i,t);n.context.eventService.mapEvent(l)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}n.setCursor(n.context.eventService.cursor)}})),r.hooks.pointerUp.tap(t.tag,(function(t){var e,r;if(!i.supportsTouchEvents||"touch"!==t.pointerType){var o=n.context.contextService.getDomElement(),a=n.context.eventService.isNativeEventFromCanvas(o,t)?"":"outside",s=n.normalizeToPointerEvent(t,i);try{for(var u=c(s),l=u.next();!l.done;l=u.next()){var h=l.value,d=n.bootstrapEvent(n.rootPointerEvent,h,i,t);d.type+=a,n.context.eventService.mapEvent(d)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}n.setCursor(n.context.eventService.cursor)}})),r.hooks.pointerMove.tap(t.tag,this.onPointerMove),r.hooks.pointerOver.tap(t.tag,this.onPointerMove),r.hooks.pointerOut.tap(t.tag,this.onPointerMove),r.hooks.click.tap(t.tag,this.onClick),r.hooks.pointerCancel.tap(t.tag,(function(t){var e,r,o=n.normalizeToPointerEvent(t,i);try{for(var a=c(o),s=a.next();!s.done;s=a.next()){var u=s.value,l=n.bootstrapEvent(n.rootPointerEvent,u,i,t);n.context.eventService.mapEvent(l)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}n.setCursor(n.context.eventService.cursor)}))},t.prototype.getViewportXY=function(t){var e,n,r=t.offsetX,i=t.offsetY,o=t.clientX,a=t.clientY;if(!this.context.config.supportsCSSTransform||Pt(r)||Pt(i)){var s=this.context.eventService.client2Viewport(new Mr(o,a));e=s.x,n=s.y}else e=r,n=i;return{x:e,y:n}},t.prototype.bootstrapEvent=function(t,e,n,r){t.view=n,t.originalEvent=null,t.nativeEvent=r,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);var i=this.getViewportXY(e),o=i.x,a=i.y;t.viewport.x=o,t.viewport.y=a;var s=this.context.eventService.viewport2Canvas(t.viewport),c=s.x,u=s.y;return t.canvas.x=c,t.canvas.y=u,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=r.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=ha[t.type]||t.type),t},t.prototype.normalizeWheelEvent=function(t){var e=this.rootWheelEvent;this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;var n=this.getViewportXY(t),r=n.x,i=n.y;e.viewport.x=r,e.viewport.y=i;var o=this.context.eventService.viewport2Canvas(e.viewport),a=o.x,s=o.y;return e.canvas.x=a,e.canvas.y=s,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.nativeEvent=t,e.type=t.type,e},t.prototype.transferMouseData=function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=da.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null},t.prototype.setCursor=function(t){this.context.contextService.applyCursorStyle(t||this.context.config.cursor||"default")},t.prototype.normalizeToPointerEvent=function(t,e){var n=[];if(e.isTouchEvent(t))for(var r=0;r<t.changedTouches.length;r++){var i=t.changedTouches[r];Qt(i.button)&&(i.button=0),Qt(i.buttons)&&(i.buttons=1),Qt(i.isPrimary)&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),Qt(i.width)&&(i.width=i.radiusX||1),Qt(i.height)&&(i.height=i.radiusY||1),Qt(i.tiltX)&&(i.tiltX=0),Qt(i.tiltY)&&(i.tiltY=0),Qt(i.pointerType)&&(i.pointerType="touch"),Qt(i.pointerId)&&(i.pointerId=i.identifier||0),Qt(i.pressure)&&(i.pressure=i.force||.5),Qt(i.twist)&&(i.twist=0),Qt(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,i.type=t.type,n.push(i)}else if(e.isMouseEvent(t)){var o=t;Qt(o.isPrimary)&&(o.isPrimary=!0),Qt(o.width)&&(o.width=1),Qt(o.height)&&(o.height=1),Qt(o.tiltX)&&(o.tiltX=0),Qt(o.tiltY)&&(o.tiltY=0),Qt(o.pointerType)&&(o.pointerType="mouse"),Qt(o.pointerId)&&(o.pointerId=1),Qt(o.pressure)&&(o.pressure=.5),Qt(o.twist)&&(o.twist=0),Qt(o.tangentialPressure)&&(o.tangentialPressure=0),o.isNormalized=!0,n.push(o)}else n.push(t);return n},t.tag="Event",t}(),qs=[Yn.CIRCLE,Yn.ELLIPSE,Yn.IMAGE,Yn.RECT,Yn.LINE,Yn.POLYLINE,Yn.POLYGON,Yn.TEXT,Yn.PATH,Yn.HTML],$s=function(){function t(){}return t.prototype.isVisible=function(t,e){var n,r,i=e.cullable;if(!i.enable)return!0;var o=e.getRenderBounds();if(vr.isEmpty(o))return!1;var a=t.getFrustum(),s=null===(r=null===(n=e.parentNode)||void 0===n?void 0:n.cullable)||void 0===r?void 0:r.visibilityPlaneMask;return i.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(e,o,s||mr.INDETERMINATE,a.planes),i.visible=i.visibilityPlaneMask!==mr.OUTSIDE,i.visible},t.prototype.computeVisibilityWithPlaneMask=function(t,e,n,r){if(n===mr.OUTSIDE||n===mr.INSIDE)return n;for(var i=mr.INSIDE,o=qs.indexOf(t.nodeName)>-1,a=0,s=r.length;a<s;++a){var c=1<<a;if(n&c&&(!o||4!==a&&5!==a)){var u=r[a],l=u.normal,h=u.distance;if(st(l,e.getPositiveFarPoint(r[a]))+h<0)return mr.OUTSIDE;st(l,e.getNegativeFarPoint(r[a]))+h<0&&(i|=c)}}return i},t}(),Ys=function(){function t(){this.toSync=new Set}return t.prototype.apply=function(e){var n=this,r=e.renderingService,i=e.renderingContext,o=e.rBushRoot,a=i.root.ownerDocument.defaultView;this.rBush=o;var s=function(t){t.target.renderable.dirty=!0,r.dirtify()},c=function(t){var e=t.detail.affectChildren,i=t.target;e&&i.forEach((function(t){n.toSync.add(t)}));for(var o=i;o;)o.renderable&&n.toSync.add(o),o=o.parentElement;r.dirtify()},u=function(t){var e=t.target;fs.enableSizeAttenuation&&fs.styleValueRegistry.updateSizeAttenuation(e,a.getCamera().getZoom()),fs.enableCSSParsing&&fs.styleValueRegistry.recalc(e),fs.sceneGraphService.dirtifyToRoot(e),r.dirtify()},l=function(t){var e=t.target,i=e.rBushNode;i.aabb&&n.rBush.remove(i.aabb),n.toSync.delete(e),fs.sceneGraphService.dirtifyToRoot(e),r.dirtify()};r.hooks.init.tap(t.tag,(function(){a.addEventListener(Za.MOUNTED,u),a.addEventListener(Za.UNMOUNTED,l),a.addEventListener(Za.ATTR_MODIFIED,s),a.addEventListener(Za.BOUNDS_CHANGED,c)})),r.hooks.destroy.tap(t.tag,(function(){a.removeEventListener(Za.MOUNTED,u),a.removeEventListener(Za.UNMOUNTED,l),a.removeEventListener(Za.ATTR_MODIFIED,s),a.removeEventListener(Za.BOUNDS_CHANGED,c),n.toSync.clear()})),r.hooks.endFrame.tap(t.tag,(function(){n.syncRTree()}))},t.prototype.syncRTree=function(){var t=this,e=[];Array.from(this.toSync).filter((function(t){return t.isConnected})).forEach((function(n){var r=n.rBushNode;r&&r.aabb&&t.rBush.remove(r.aabb);var i=n.getRenderBounds();if(i){var o=u(i.getMin(),2),a=o[0],s=o[1],c=u(i.getMax(),2),l=c[0],h=c[1];r.aabb||(r.aabb={}),r.aabb.displayObject=n,r.aabb.minX=a,r.aabb.minY=s,r.aabb.maxX=l,r.aabb.maxY=h}r.aabb&&(isNaN(r.aabb.maxX)||isNaN(r.aabb.maxX)||isNaN(r.aabb.minX)||isNaN(r.aabb.minY)||e.push(r.aabb))})),this.rBush.load(e),e.length=0,this.toSync.clear()},t.tag="Prepare",t}();!function(t){t.READY="ready",t.BEFORE_RENDER="beforerender",t.RERENDER="rerender",t.AFTER_RENDER="afterrender",t.BEFORE_DESTROY="beforedestroy",t.AFTER_DESTROY="afterdestroy",t.RESIZE="resize",t.DIRTY_RECTANGLE="dirtyrectangle",t.RENDERER_CHANGED="rendererchanged"}(ws||(ws={}));var Ks=new qa(Za.MOUNTED),Xs=new qa(Za.UNMOUNTED),Zs=new qa(ws.BEFORE_RENDER),Qs=new qa(ws.RERENDER),Js=new qa(ws.AFTER_RENDER),tc=function(t){function e(e){var n=t.call(this)||this;n.Element=Ps,n.inited=!1,n.context={},n.document=new Ws,n.document.defaultView=n,n.customElements=new Vs;var r=e.container,i=e.canvas,o=e.offscreenCanvas,a=e.width,s=e.height,c=e.devicePixelRatio,u=e.renderer,l=e.background,h=e.cursor,d=e.document,f=e.requestAnimationFrame,p=e.cancelAnimationFrame,g=e.createImage,m=e.supportsPointerEvents,v=e.supportsTouchEvents,y=e.supportsCSSTransform,b=e.supportsMutipleCanvasesInOneContainer,x=e.useNativeClickEvent,E=e.alwaysTriggerPointerEventOnCanvas,w=e.isTouchEvent,M=e.isMouseEvent;b||function(t,e){if(t){var n="string"==typeof t?t:t.id||oa++;ia[n]&&ia[n].destroy(),ia[n]=e}}(r,n);var N=a,S=s,C=c;return i&&(C=(C=c||aa&&window.devicePixelRatio||1)>=1?Math.ceil(C):1,N=a||function(t){var e=la(t,"width");return"auto"===e?t.offsetWidth:parseFloat(e)}(i)||i.width/C,S=s||function(t){var e=la(t,"height");return"auto"===e?t.offsetHeight:parseFloat(e)}(i)||i.height/C),o&&(fs.offscreenCanvas=o),n.devicePixelRatio=C,n.requestAnimationFrame=null!=f?f:Ma.bind(fs.globalThis),n.cancelAnimationFrame=null!=p?p:Na.bind(fs.globalThis),n.supportsTouchEvents=null!=v?v:"ontouchstart"in fs.globalThis,n.supportsPointerEvents=null!=m?m:!!fs.globalThis.PointerEvent,n.isTouchEvent=null!=w?w:function(t){return n.supportsTouchEvents&&t instanceof fs.globalThis.TouchEvent},n.isMouseEvent=null!=M?M:function(t){return!fs.globalThis.MouseEvent||t instanceof fs.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(t instanceof fs.globalThis.PointerEvent))},n.initRenderingContext({container:r,canvas:i,width:N,height:S,renderer:u,offscreenCanvas:o,devicePixelRatio:C,cursor:h||"default",background:l||"transparent",createImage:g,document:d,supportsCSSTransform:y,useNativeClickEvent:x,alwaysTriggerPointerEventOnCanvas:E}),n.initDefaultCamera(N,S,u.clipSpaceNearZ),n.initRenderer(u,!0),n}return r(e,t),e.prototype.initRenderingContext=function(t){this.context.config=t,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}},e.prototype.initDefaultCamera=function(t,e,n){var r=this,i=new fs.CameraContribution;i.clipSpaceNearZ=n,i.setType(br.EXPLORING,xr.DEFAULT).setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0).setOrthographic(t/-2,t/2,e/2,e/-2,.1,1e3),i.canvas=this,i.eventEmitter.on(_r,(function(){r.context.renderingContext.renderReasons.add(Ga.CAMERA_CHANGED),fs.enableSizeAttenuation&&r.getConfig().renderer.getConfig().enableSizeAttenuation&&r.updateSizeAttenuation()})),this.context.camera=i},e.prototype.updateSizeAttenuation=function(){var t=this.getCamera().getZoom();this.document.documentElement.forEach((function(e){fs.styleValueRegistry.updateSizeAttenuation(e,t)}))},e.prototype.getConfig=function(){return this.context.config},e.prototype.getRoot=function(){return this.document.documentElement},e.prototype.getCamera=function(){return this.context.camera},e.prototype.getContextService=function(){return this.context.contextService},e.prototype.getEventService=function(){return this.context.eventService},e.prototype.getRenderingService=function(){return this.context.renderingService},e.prototype.getRenderingContext=function(){return this.context.renderingContext},e.prototype.getStats=function(){return this.getRenderingService().getStats()},Object.defineProperty(e.prototype,"ready",{get:function(){var t=this;return this.readyPromise||(this.readyPromise=new Promise((function(e){t.resolveReadyPromise=function(){e(t)}})),this.inited&&this.resolveReadyPromise()),this.readyPromise},enumerable:!1,configurable:!0}),e.prototype.destroy=function(t,e){(void 0===t&&(t=!0),void 0===e&&(e=!1),e||this.dispatchEvent(new qa(ws.BEFORE_DESTROY)),this.frameId)&&(this.getConfig().cancelAnimationFrame||cancelAnimationFrame)(this.frameId);var n=this.getRoot();this.unmountChildren(n),t&&(this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),t&&this.context.rBushRoot&&(this.context.rBushRoot.clear(),this.context.rBushRoot=null,this.context.renderingContext.root=null),e||this.dispatchEvent(new qa(ws.AFTER_DESTROY))},e.prototype.changeSize=function(t,e){this.resize(t,e)},e.prototype.resize=function(t,e){var n=this.context.config;n.width=t,n.height=e,this.getContextService().resize(t,e);var r=this.context.camera,i=r.getProjectionMode();r.setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0),i===Er.ORTHOGRAPHIC?r.setOrthographic(t/-2,t/2,e/2,e/-2,r.getNear(),r.getFar()):r.setAspect(t/e),this.dispatchEvent(new qa(ws.RESIZE,{width:t,height:e}))},e.prototype.appendChild=function(t,e){return this.document.documentElement.appendChild(t,e)},e.prototype.insertBefore=function(t,e){return this.document.documentElement.insertBefore(t,e)},e.prototype.removeChild=function(t){return this.document.documentElement.removeChild(t)},e.prototype.removeChildren=function(){this.document.documentElement.removeChildren()},e.prototype.destroyChildren=function(){this.document.documentElement.destroyChildren()},e.prototype.render=function(){var t=this;this.dispatchEvent(Zs),this.getRenderingService().render(this.getConfig(),(function(){t.dispatchEvent(Qs)})),this.dispatchEvent(Js)},e.prototype.run=function(){var t=this,e=function(){t.render(),t.frameId=t.requestAnimationFrame(e)};e()},e.prototype.initRenderer=function(t,e){var n=this;if(void 0===e&&(e=!1),!t)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.rBushRoot=new Xn,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new Hs,new Ys,new Us([new $s])),this.loadRendererContainerModule(t),this.context.contextService=new this.context.ContextService(i(i({},fs),this.context)),this.context.renderingService=new Qa(fs,this.context),this.context.eventService=new Ka(fs,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(t,e,!0)):this.context.contextService.initAsync().then((function(){n.initRenderingService(t,e)}))},e.prototype.initRenderingService=function(t,e,n){var r=this;void 0===e&&(e=!1),void 0===n&&(n=!1),this.context.renderingService.init((function(){r.inited=!0,e?(n?r.requestAnimationFrame((function(){r.dispatchEvent(new qa(ws.READY))})):r.dispatchEvent(new qa(ws.READY)),r.readyPromise&&r.resolveReadyPromise()):r.dispatchEvent(new qa(ws.RENDERER_CHANGED)),e||r.getRoot().forEach((function(t){var e=t.renderable;e&&(e.renderBoundsDirty=!0,e.boundsDirty=!0,e.dirty=!0)})),r.mountChildren(r.getRoot()),t.getConfig().enableAutoRendering&&r.run()}))},e.prototype.loadRendererContainerModule=function(t){var e=this;t.getPlugins().forEach((function(t){t.context=e.context,t.init(fs)}))},e.prototype.setRenderer=function(t){var e=this.getConfig();if(e.renderer!==t){var n=e.renderer;e.renderer=t,this.destroy(!1,!0),l([],u(null==n?void 0:n.getPlugins()),!1).reverse().forEach((function(t){t.destroy(fs)})),this.initRenderer(t)}},e.prototype.setCursor=function(t){this.getConfig().cursor=t,this.getContextService().applyCursorStyle(t)},e.prototype.unmountChildren=function(t){var e=this;t.childNodes.forEach((function(t){e.unmountChildren(t)})),this.inited&&(t.isMutationObserved?t.dispatchEvent(Xs):(Xs.target=t,this.dispatchEvent(Xs,!0)),t!==this.document.documentElement&&(t.ownerDocument=null),t.isConnected=!1),t.isCustomElement&&t.disconnectedCallback&&t.disconnectedCallback()},e.prototype.mountChildren=function(t){var e=this;this.inited?t.isConnected||(t.ownerDocument=this.document,t.isConnected=!0,t.isMutationObserved?t.dispatchEvent(Ks):(Ks.target=t,this.dispatchEvent(Ks,!0))):console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",t.nodeName),t.childNodes.forEach((function(t){e.mountChildren(t)})),t.isCustomElement&&t.connectedCallback&&t.connectedCallback()},e.prototype.client2Viewport=function(t){return this.getEventService().client2Viewport(t)},e.prototype.viewport2Client=function(t){return this.getEventService().viewport2Client(t)},e.prototype.viewport2Canvas=function(t){return this.getEventService().viewport2Canvas(t)},e.prototype.canvas2Viewport=function(t){return this.getEventService().canvas2Viewport(t)},e.prototype.getPointByClient=function(t,e){return this.client2Viewport({x:t,y:e})},e.prototype.getClientByPoint=function(t,e){return this.viewport2Client({x:t,y:e})},e}($a),ec=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.landmarks=[],e}return r(e,t),e.prototype.rotate=function(t,e,n){if(this.relElevation=rr(e),this.relAzimuth=rr(t),this.relRoll=rr(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===br.EXPLORING){var r=vt(mt(),[1,0,0],or((this.rotateWorld?1:-1)*this.relElevation)),i=vt(mt(),[0,1,0],or((this.rotateWorld?1:-1)*this.relAzimuth)),o=vt(mt(),[0,0,1],or(this.relRoll)),a=yt(mt(),i,r);a=yt(mt(),a,o);var s=F(x(),a);P(this.matrix,this.matrix,[0,0,-this.distance]),k(this.matrix,this.matrix,s),P(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return this;this.computeMatrix()}return this._getAxes(),this.type===br.ORBITING||this.type===br.EXPLORING?this._getPosition():this.type===br.TRACKING&&this._getFocalPoint(),this._update(),this},e.prototype.pan=function(t,e){var n=ir(t,e,0),r=Q(this.position);return rt(r,r,ot(Z(),this.right,n[0])),rt(r,r,ot(Z(),this.up,n[1])),this._setPosition(r),this.triggerUpdate(),this},e.prototype.dolly=function(t){var e=this.forward,n=Q(this.position),r=this.dollyingStep,i=this.distance+t*this.dollyingStep;return r=Math.max(Math.min(i,this.maxDistance),this.minDistance)-this.distance,n[0]+=r*e[0],n[1]+=r*e[1],n[2]+=r*e[2],this._setPosition(n),this.type===br.ORBITING||this.type===br.EXPLORING?this._getDistance():this.type===br.TRACKING&&rt(this.focalPoint,n,this.distanceVector),this.triggerUpdate(),this},e.prototype.cancelLandmarkAnimation=function(){void 0!==this.landmarkAnimationID&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)},e.prototype.createLandmark=function(t,e){var n,r,i,o;void 0===e&&(e={});var a=e.position,s=void 0===a?this.position:a,c=e.focalPoint,u=void 0===c?this.focalPoint:c,l=e.roll,h=e.zoom,d=new fs.CameraContribution;d.setType(this.type,void 0),d.setPosition(s[0],null!==(n=s[1])&&void 0!==n?n:this.position[1],null!==(r=s[2])&&void 0!==r?r:this.position[2]),d.setFocalPoint(u[0],null!==(i=u[1])&&void 0!==i?i:this.focalPoint[1],null!==(o=u[2])&&void 0!==o?o:this.focalPoint[2]),d.setRoll(null!=l?l:this.roll),d.setZoom(null!=h?h:this.zoom);var f={name:t,matrix:E(d.getWorldTransform()),right:Q(d.right),up:Q(d.up),forward:Q(d.forward),position:Q(d.getPosition()),focalPoint:Q(d.getFocalPoint()),distanceVector:Q(d.getDistanceVector()),distance:d.getDistance(),dollyingStep:d.getDollyingStep(),azimuth:d.getAzimuth(),elevation:d.getElevation(),roll:d.getRoll(),relAzimuth:d.relAzimuth,relElevation:d.relElevation,relRoll:d.relRoll,zoom:d.getZoom()};return this.landmarks.push(f),f},e.prototype.gotoLandmark=function(t,e){var n=this;void 0===e&&(e={});var r=Bt(t)?this.landmarks.find((function(e){return e.name===t})):t;if(r){var i=Wt(e)?{duration:e}:e,o=i.easing,a=void 0===o?"linear":o,s=i.duration,c=void 0===s?100:s,u=i.easingFunction,l=void 0===u?void 0:u,h=i.onfinish,d=void 0===h?void 0:h,f=i.onframe,p=void 0===f?void 0:f;if(0===c)return this.syncFromLandmark(r),void(d&&d());this.cancelLandmarkAnimation();var g,m=r.position,v=r.focalPoint,y=r.zoom,b=r.roll,x=l||fs.EasingFunction(a),E=function(){n.setFocalPoint(v),n.setPosition(m),n.setRoll(b),n.setZoom(y),n.computeMatrix(),n.triggerUpdate(),d&&d()},w=function(t){void 0===g&&(g=t);var e=t-g;if(e>c)E();else{var r,i,o=x(e/c),a=Z(),s=Z();ut(a,n.focalPoint,v,o),ut(s,n.position,m,o),i=n.roll*(1-o)+b*o,r=n.zoom*(1-o)+y*o,n.setFocalPoint(a),n.setPosition(s),n.setRoll(i),n.setZoom(r),dt(a,v)+dt(s,m)<=.01&&null==y&&null==b?E():(n.computeMatrix(),n.triggerUpdate(),e<c&&(p&&p(o),n.landmarkAnimationID=n.canvas.requestAnimationFrame(w)))}};this.canvas.requestAnimationFrame(w)}},e.prototype.syncFromLandmark=function(t){this.matrix=w(this.matrix,t.matrix),this.right=et(this.right,t.right),this.up=et(this.up,t.up),this.forward=et(this.forward,t.forward),this.position=et(this.position,t.position),this.focalPoint=et(this.focalPoint,t.focalPoint),this.distanceVector=et(this.distanceVector,t.distanceVector),this.azimuth=t.azimuth,this.elevation=t.elevation,this.roll=t.roll,this.relAzimuth=t.relAzimuth,this.relElevation=t.relElevation,this.relRoll=t.relRoll,this.dollyingStep=t.dollyingStep,this.distance=t.distance,this.zoom=t.zoom},e}(Dr);fs.CameraContribution=ec;var nc=function(t){function e(e,n,r,i){var o=t.call(this,e)||this;return o.currentTime=r,o.timelineTime=i,o.target=n,o.type="finish",o.bubbles=!1,o.currentTarget=n,o.defaultPrevented=!1,o.eventPhase=o.AT_TARGET,o.timeStamp=Date.now(),o.currentTime=r,o.timelineTime=i,o}return r(e,t),e}(Va),rc=0,ic=function(){function t(t,e){var n;this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=t,t.animation=this,this.timeline=e,this.id="".concat(rc++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number(null===(n=this.effect)||void 0===n?void 0:n.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}return Object.defineProperty(t.prototype,"pending",{get:function(){return null===this._startTime&&!this._paused&&0!==this.playbackRate||this.currentTimePending},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playState",{get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get:function(){var t=this;return this.readyPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise((function(e,n){t.resolveReadyPromise=function(){e(t)},t.rejectReadyPromise=function(){n(new Error)}})),this.pending||this.resolveReadyPromise()),this.readyPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"finished",{get:function(){var t=this;return this.finishedPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise((function(e,n){t.resolveFinishedPromise=function(){e(t)},t.rejectFinishedPromise=function(){n(new Error)}})),"finished"===this.playState&&this.resolveFinishedPromise()),this.finishedPromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentTime",{get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(t){var e;t=Number(t),isNaN(t)||(this.timeline.restart(),this._paused||null===this._startTime||(this._startTime=Number(null===(e=this.timeline)||void 0===e?void 0:e.currentTime)-t/this.playbackRate),this.currentTimePending=!1,this._currentTime!==t&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(t,!0),this.timeline.applyDirtiedAnimation(this)))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startTime",{get:function(){return this._startTime},set:function(t){if(null!==t){if(this.updatePromises(),t=Number(t),isNaN(t))return;if(this._paused||this._idle)return;this._startTime=t,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){if(t!==this._playbackRate){this.updatePromises();var e=this.currentTime;this._playbackRate=t,this.startTime=null,"paused"!==this.playState&&"idle"!==this.playState&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),null!==e&&(this.currentTime=e),this.updatePromises()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isFinished",{get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"totalDuration",{get:function(){return this._totalDuration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_needsTick",{get:function(){return this.pending||"running"===this.playState||!this._finishedFlag},enumerable:!1,configurable:!0}),t.prototype.updatePromises=function(){var t=this.oldPlayState,e=this.pending?"pending":this.playState;return this.readyPromise&&e!==t&&("idle"===e?(this.rejectReadyPromise(),this.readyPromise=void 0):"pending"===t?this.resolveReadyPromise():"pending"===e&&(this.readyPromise=void 0)),this.finishedPromise&&e!==t&&("idle"===e?(this.rejectFinishedPromise(),this.finishedPromise=void 0):"finished"===e?this.resolveFinishedPromise():"finished"===t&&(this.finishedPromise=void 0)),this.oldPlayState=e,this.readyPromise||this.finishedPromise},t.prototype.play=function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),-1===this.timeline.animations.indexOf(this)&&this.timeline.animations.push(this),this.updatePromises()},t.prototype.pause=function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._isFinished||this._paused||this._idle?this._idle&&(this.rewind(),this._idle=!1):this.currentTimePending=!0,this._startTime=null,this._paused=!0,this.updatePromises()},t.prototype.finish=function(){this.updatePromises(),this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())},t.prototype.cancel=function(){var t=this;if(this.updatePromises(),this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var e=new nc(null,this,this.currentTime,null);setTimeout((function(){t.oncancel(e)}))}},t.prototype.reverse=function(){this.updatePromises();var t=this.currentTime;this.playbackRate*=-1,this.play(),null!==t&&(this.currentTime=t),this.updatePromises()},t.prototype.updatePlaybackRate=function(t){this.playbackRate=t},t.prototype.targetAnimations=function(){var t;return(null===(t=this.effect)||void 0===t?void 0:t.target).getAnimations()},t.prototype.markTarget=function(){var t=this.targetAnimations();-1===t.indexOf(this)&&t.push(this)},t.prototype.unmarkTarget=function(){var t=this.targetAnimations(),e=t.indexOf(this);-1!==e&&t.splice(e,1)},t.prototype.tick=function(t,e){this._idle||this._paused||(null===this._startTime?e&&(this.startTime=t-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((t-this._startTime)*this.playbackRate)),e&&(this.currentTimePending=!1,this.fireEvents(t))},t.prototype.rewind=function(){if(this.playbackRate>=0)this.currentTime=0;else{if(!(this._totalDuration<1/0))throw new Error("Unable to rewind negative playback rate animation with infinite duration");this.currentTime=this._totalDuration}},t.prototype.persist=function(){throw new Error(Sr)},t.prototype.addEventListener=function(t,e,n){throw new Error(Sr)},t.prototype.removeEventListener=function(t,e,n){throw new Error(Sr)},t.prototype.dispatchEvent=function(t){throw new Error(Sr)},t.prototype.commitStyles=function(){throw new Error(Sr)},t.prototype.ensureAlive=function(){var t,e;this.playbackRate<0&&0===this.currentTime?this._inEffect=!!(null===(t=this.effect)||void 0===t?void 0:t.update(-1)):this._inEffect=!!(null===(e=this.effect)||void 0===e?void 0:e.update(this.currentTime)),this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,this.timeline.animations.push(this))},t.prototype.tickCurrentTime=function(t,e){t!==this._currentTime&&(this._currentTime=t,this._isFinished&&!e&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())},t.prototype.fireEvents=function(t){var e=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var n=new nc(null,this,this.currentTime,t);setTimeout((function(){e.onfinish&&e.onfinish(n)}))}this._finishedFlag=!0}}else{if(this.onframe&&"running"===this.playState){var r=new nc(null,this,this.currentTime,t);this.onframe(r)}this._finishedFlag=!1}},t}(),oc=.1,ac="function"==typeof Float32Array,sc=function(t,e){return 1-3*e+3*t},cc=function(t,e){return 3*e-6*t},uc=function(t){return 3*t},lc=function(t,e,n){return((sc(e,n)*t+cc(e,n))*t+uc(e))*t},hc=function(t,e,n){return 3*sc(e,n)*t*t+2*cc(e,n)*t+uc(e)},dc=function(t,e,n,r){if(!(0<=t&&t<=1&&0<=n&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===r)return function(t){return t};for(var i=ac?new Float32Array(11):new Array(11),o=0;o<11;++o)i[o]=lc(o*oc,t,n);var a=function(e){for(var r=0,o=1;10!==o&&i[o]<=e;++o)r+=oc;--o;var a=r+(e-i[o])/(i[o+1]-i[o])*oc,s=hc(a,t,n);return s>=.001?function(t,e,n,r){for(var i=0;i<4;++i){var o=hc(e,n,r);if(0===o)return e;e-=(lc(e,n,r)-t)/o}return e}(e,a,t,n):0===s?a:function(t,e,n,r,i){var o,a,s=0;do{(o=lc(a=e+(n-e)/2,r,i)-t)>0?n=a:e=a}while(Math.abs(o)>1e-7&&++s<10);return a}(e,r,r+oc,t,n)};return function(t){return 0===t||1===t?t:lc(a(t),e,r)}},fc=function(t){return Math.pow(t,2)},pc=function(t){return Math.pow(t,3)},gc=function(t){return Math.pow(t,4)},mc=function(t){return Math.pow(t,5)},vc=function(t){return Math.pow(t,6)},yc=function(t){return 1-Math.cos(t*Math.PI/2)},bc=function(t){return 1-Math.sqrt(1-t*t)},xc=function(t){return t*t*(3*t-2)},Ec=function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)},wc=function(t,e){void 0===e&&(e=[]);var n=u(e,2),r=n[0],i=void 0===r?1:r,o=n[1],a=void 0===o?.5:o,s=Vt(Number(i),1,10),c=Vt(Number(a),.1,2);return 0===t||1===t?t:-s*Math.pow(2,10*(t-1))*Math.sin((t-1-c/(2*Math.PI)*Math.asin(1/s))*(2*Math.PI)/c)},Mc=function(t,e,n){void 0===e&&(e=[]);var r=u(e,4),i=r[0],o=void 0===i?1:i,a=r[1],s=void 0===a?100:a,c=r[2],l=void 0===c?10:c,h=r[3],d=void 0===h?0:h;o=Vt(o,.1,1e3),s=Vt(s,.1,1e3),l=Vt(l,.1,1e3),d=Vt(d,.1,1e3);var f=Math.sqrt(s/o),p=l/(2*Math.sqrt(s*o)),g=p<1?f*Math.sqrt(1-p*p):0,m=p<1?(p*f-d)/g:-d+f,v=n?n*t/1e3:t;return v=p<1?Math.exp(-v*p*f)*(1*Math.cos(g*v)+m*Math.sin(g*v)):(1+m*v)*Math.exp(-v*f),0===t||1===t?t:1-v},Nc=function(t,e){void 0===e&&(e=[]);var n=u(e,2),r=n[0],i=void 0===r?10:r;return("start"==n[1]?Math.ceil:Math.floor)(Vt(t,0,1)*i)/i},Sc=function(t,e){void 0===e&&(e=[]);var n=u(e,4),r=n[0],i=n[1],o=n[2],a=n[3];return dc(r,i,o,a)(t)},Cc=dc(.42,0,1,1),Tc=function(t){return function(e,n,r){return void 0===n&&(n=[]),1-t(1-e,n,r)}},kc=function(t){return function(e,n,r){return void 0===n&&(n=[]),e<.5?t(2*e,n,r)/2:1-t(-2*e+2,n,r)/2}},Pc=function(t){return function(e,n,r){return void 0===n&&(n=[]),e<.5?(1-t(1-2*e,n,r))/2:(t(2*e-1,n,r)+1)/2}},Ac={steps:Nc,"step-start":function(t){return Nc(t,[1,"start"])},"step-end":function(t){return Nc(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":Sc,ease:function(t){return Sc(t,[.25,.1,.25,1])},in:Cc,out:Tc(Cc),"in-out":kc(Cc),"out-in":Pc(Cc),"in-quad":fc,"out-quad":Tc(fc),"in-out-quad":kc(fc),"out-in-quad":Pc(fc),"in-cubic":pc,"out-cubic":Tc(pc),"in-out-cubic":kc(pc),"out-in-cubic":Pc(pc),"in-quart":gc,"out-quart":Tc(gc),"in-out-quart":kc(gc),"out-in-quart":Pc(gc),"in-quint":mc,"out-quint":Tc(mc),"in-out-quint":kc(mc),"out-in-quint":Pc(mc),"in-expo":vc,"out-expo":Tc(vc),"in-out-expo":kc(vc),"out-in-expo":Pc(vc),"in-sine":yc,"out-sine":Tc(yc),"in-out-sine":kc(yc),"out-in-sine":Pc(yc),"in-circ":bc,"out-circ":Tc(bc),"in-out-circ":kc(bc),"out-in-circ":Pc(bc),"in-back":xc,"out-back":Tc(xc),"in-out-back":kc(xc),"out-in-back":Pc(xc),"in-bounce":Ec,"out-bounce":Tc(Ec),"in-out-bounce":kc(Ec),"out-in-bounce":Pc(Ec),"in-elastic":wc,"out-elastic":Tc(wc),"in-out-elastic":kc(wc),"out-in-elastic":Pc(wc),spring:Mc,"spring-in":Mc,"spring-out":Tc(Mc),"spring-in-out":kc(Mc),"spring-out-in":Pc(Mc)},Oc=function(t){return Ac[function(t){return function(t){return"-"===(t=t.replace(/([A-Z])/g,(function(t){return"-".concat(t.toLowerCase())}))).charAt(0)?t.substring(1):t}(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()}(t)]||Ac.linear},_c=function(t){return t},Rc=1,Dc=.5,Ic=0;function Lc(t,e){return function(n){if(n>=1)return 1;var r=1/t;return(n+=e*r)-n%r}}var jc="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",zc=new RegExp("cubic-bezier\\("+jc+","+jc+","+jc+","+jc+"\\)"),Bc=/steps\(\s*(\d+)\s*\)/,Fc=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function Gc(t){var e=zc.exec(t);if(e)return dc.apply(void 0,l([],u(e.slice(1).map(Number)),!1));var n=Bc.exec(t);if(n)return Lc(Number(n[1]),Ic);var r=Fc.exec(t);return r?Lc(Number(r[1]),{start:Rc,middle:Dc,end:Ic}[r[2]]):Oc(t)}function Vc(t){return Math.abs(function(t){var e;if(0===t.duration||0===t.iterations)return 0;return("auto"===t.duration?0:Number(t.duration))*(null!==(e=t.iterations)&&void 0!==e?e:1)}(t)/(t.playbackRate||1))}var Wc=0,Uc=1,Hc=2,qc=3;function $c(t,e,n){var r=function(t,e,n){if(null===e)return Wc;var r=n.endTime;return e<Math.min(n.delay,r)?Uc:e>=Math.min(n.delay+t+n.endDelay,r)?Hc:qc}(t,e,n),i=function(t,e,n,r,i){switch(r){case Uc:return"backwards"===e||"both"===e?0:null;case qc:return n-i;case Hc:return"forwards"===e||"both"===e?t:null;case Wc:return null}}(t,n.fill,e,r,n.delay);if(null===i)return null;var o="auto"===n.duration?0:n.duration,a=function(t,e,n,r,i){var o=i;return 0===t?e!==Uc&&(o+=n):o+=r/t,o}(o,r,n.iterations,i,n.iterationStart),s=function(t,e,n,r,i,o){var a=t===1/0?e%1:t%1;return 0!==a||n!==Hc||0===r||0===i&&0!==o||(a=1),a}(a,n.iterationStart,r,n.iterations,i,o),c=function(t,e,n,r){return t===Hc&&e===1/0?1/0:1===n?Math.floor(r)-1:Math.floor(r)}(r,n.iterations,s,a),u=function(t,e,n){var r=t;if("normal"!==t&&"reverse"!==t){var i=e;"alternate-reverse"===t&&(i+=1),r="normal",i!==1/0&&i%2!=0&&(r="reverse")}return"normal"===r?n:1-n}(n.direction,c,s);return n.currentIteration=c,n.progress=u,n.easingFunction(u)}function Yc(t,e,n){var r=function(t,e){for(var n={},r=0;r<t.length;r++)for(var i in t[r])if(Kc(i)){var o={offset:t[r].offset,computedOffset:t[r].computedOffset,easing:t[r].easing,easingFunction:Gc(t[r].easing)||e.easingFunction,value:t[r][i]};n[i]=n[i]||[],n[i].push(o)}return n}(t,e),i=function(t,e){var n=[];for(var r in t)for(var i=t[r],o=0;o<i.length-1;o++){var a=o,s=o+1,c=i[a].computedOffset,u=i[s].computedOffset,l=c,h=u;0===o&&(l=-1/0,0===u&&(s=a)),o===i.length-2&&(h=1/0,1===c&&(a=s)),n.push({applyFrom:l,applyTo:h,startOffset:i[a].computedOffset,endOffset:i[s].computedOffset,easingFunction:i[a].easingFunction,property:r,interpolation:Zc(r,i[a].value,i[s].value,e)})}return n.sort((function(t,e){return t.startOffset-e.startOffset})),n}(r,n);return function(t,e){if(null!==e)i.filter((function(t){return e>=t.applyFrom&&e<t.applyTo})).forEach((function(n){var r=e-n.startOffset,i=n.endOffset-n.startOffset,o=0===i?0:n.easingFunction(r/i);t.setAttribute(n.property,n.interpolation(o),!1,!1)}));else for(var n in r)Kc(n)&&t.setAttribute(n,null)}}function Kc(t){return"offset"!==t&&"easing"!==t&&"composite"!==t&&"computedOffset"!==t}var Xc=function(t,e,n){return function(r){var i=Qc(t,e,r);return!fs.enableCSSParsing&&Wt(i)?i:n(i)}};function Zc(t,e,n,r){var i=Io[t];if(i&&i.syntax&&i.int){var o=fs.styleValueRegistry.getPropertySyntax(i.syntax);if(o){var a=void 0,s=void 0;if(fs.enableCSSParsing){var c=fs.styleValueRegistry.parseProperty(t,e,r,!1),h=fs.styleValueRegistry.parseProperty(t,n,r,!1);a=fs.styleValueRegistry.computeProperty(t,c,r,!1),s=fs.styleValueRegistry.computeProperty(t,h,r,!1)}else{var d=o.parserWithCSSDisabled;a=d?d(e,r):e,s=d?d(n,r):n}var f=o.mixer(a,s,r);if(f){var p=Xc.apply(void 0,l([],u(f),!1));return function(t){return 0===t?e:1===t?n:p(t)}}}}return Xc(!1,!0,(function(t){return t?n:e}))}function Qc(t,e,n){if("number"==typeof t&&"number"==typeof e)return t*(1-n)+e*n;if("boolean"==typeof t&&"boolean"==typeof e||"string"==typeof t&&"string"==typeof e)return n<.5?t:e;if(Array.isArray(t)&&Array.isArray(e)){for(var r=t.length,i=e.length,o=Math.max(r,i),a=[],s=0;s<o;s++)a.push(Qc(t[s<r?s:r-1],e[s<i?s:i-1],n));return a}throw new Error("Mismatched interpolation arguments "+t+":"+e)}var Jc=function(){function t(){this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=_c,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null}return Object.defineProperty(t.prototype,"easing",{get:function(){return this._easing},set:function(t){this.easingFunction=Gc(t),this._easing=t},enumerable:!1,configurable:!0}),t}();function tu(t,e){if(null===t)return[];Array.isArray(t)||(t=function(t){var e=[];for(var n in t)if(!(n in["easing","offset","composite"])){var r=t[n];Array.isArray(r)||(r=[r]);for(var i=r.length,o=0;o<i;o++){if(!e[o]){var a={};"offset"in t&&(a.offset=Number(t.offset)),"easing"in t&&(a.easing=t.easing),"composite"in t&&(a.composite=t.composite),e[o]=a}void 0!==r[o]&&null!==r[o]&&(e[o][n]=r[o])}}return e.sort((function(t,e){return(t.computedOffset||0)-(e.computedOffset||0)})),e}(t));for(var n=t.map((function(t){var n={};for(var r in(null==e?void 0:e.composite)&&(n.composite="auto"),t){var i=t[r];if("offset"===r){if(null!==i){if(i=Number(i),!isFinite(i))throw new Error("Keyframe offsets must be numbers.");if(i<0||i>1)throw new Error("Keyframe offsets must be between 0 and 1.");n.computedOffset=i}}else if("composite"===r&&-1===["replace","add","accumulate","auto"].indexOf(i))throw new Error("".concat(i," compositing is not supported"));n[r]=i}return void 0===n.offset&&(n.offset=null),void 0===n.easing&&(n.easing=(null==e?void 0:e.easing)||"linear"),void 0===n.composite&&(n.composite="auto"),n})),r=!0,i=-1/0,o=0;o<n.length;o++){var a=n[o].offset;if(Pt(a))r=!1;else{if(a<i)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");i=a}}return n=n.filter((function(t){return Number(t.offset)>=0&&Number(t.offset)<=1})),r||function(){var t,e,r=n.length;n[r-1].computedOffset=Number(null!==(t=n[r-1].offset)&&void 0!==t?t:1),r>1&&(n[0].computedOffset=Number(null!==(e=n[0].offset)&&void 0!==e?e:0));for(var i=0,o=Number(n[0].computedOffset),a=1;a<r;a++){var s=n[a].computedOffset;if(!Pt(s)&&!Pt(o)){for(var c=1;c<a-i;c++)n[i+c].computedOffset=o+(Number(s)-o)*c/(a-i);i=a,o=Number(s)}}}(),n}var eu="backwards|forwards|both|none".split("|"),nu="reverse|alternate|alternate-reverse".split("|");function ru(t,e){return function(t,e){var n=new Jc;return e&&(n.fill="both",n.duration="auto"),"number"!=typeof t||isNaN(t)?void 0!==t&&Object.keys(t).forEach((function(e){if(void 0!==t[e]&&null!==t[e]&&"auto"!==t[e]){if(("number"==typeof n[e]||"duration"===e)&&("number"!=typeof t[e]||isNaN(t[e])))return;if("fill"===e&&-1===eu.indexOf(t[e]))return;if("direction"===e&&-1===nu.indexOf(t[e]))return;n[e]=t[e]}})):n.duration=t,n}(t=function(t){"number"==typeof t&&(t=isNaN(t)?{duration:"auto"}:{duration:t});return t}(null!=t?t:{duration:"auto"}),e)}var iu=function(){function t(t,e,n){var r=this;this.composite="replace",this.iterationComposite="replace",this.target=t,this.timing=ru(n,!1),this.timing.effect=this,this.timing.activeDuration=Vc(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=tu(e,this.timing),this.interpolations=Yc(this.normalizedKeyframes,this.timing,this.target);var i=fs.globalThis.Proxy;this.computedTiming=i?new i(this.timing,{get:function(t,e){return"duration"===e?"auto"===t.duration?0:t.duration:"fill"===e?"auto"===t.fill?"none":t.fill:"localTime"===e?r.animation&&r.animation.currentTime||null:"currentIteration"===e?r.animation&&"running"===r.animation.playState?t.currentIteration||0:null:"progress"===e?r.animation&&"running"===r.animation.playState?t.progress||0:null:t[e]},set:function(){return!0}}):this.timing}return t.prototype.applyInterpolations=function(){this.interpolations(this.target,Number(this.timeFraction))},t.prototype.update=function(t){return null!==t&&(this.timeFraction=$c(this.timing.activeDuration,t,this.timing),null!==this.timeFraction)},t.prototype.getKeyframes=function(){return this.normalizedKeyframes},t.prototype.setKeyframes=function(t){this.normalizedKeyframes=tu(t)},t.prototype.getComputedTiming=function(){return this.computedTiming},t.prototype.getTiming=function(){return this.timing},t.prototype.updateTiming=function(t){var e=this;Object.keys(t||{}).forEach((function(n){e.timing[n]=t[n]}))},t}();function ou(t,e){return Number(t.id)-Number(e.id)}var au=function(){function t(t){var e=this;this.document=t,this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(t){e.currentTime=t,e.discardAnimations(),0===e.animations.length?e.timelineTicking=!1:e.requestAnimationFrame(e.webAnimationsNextTick)},this.processRafCallbacks=function(t){var n=e.rafCallbacks;e.rafCallbacks=[],t<Number(e.currentTime)&&(t=Number(e.currentTime)),e.animations.sort(ou),e.animations=e.tick(t,!0,e.animations)[0],n.forEach((function(e){e[1](t)})),e.applyPendingEffects()}}return t.prototype.getAnimations=function(){return this.discardAnimations(),this.animations.slice()},t.prototype.isTicking=function(){return this.inTick},t.prototype.play=function(t,e,n){var r=new iu(t,e,n),i=new ic(r,this);return this.animations.push(i),this.restartWebAnimationsNextTick(),i.updatePromises(),i.play(),i.updatePromises(),i},t.prototype.applyDirtiedAnimation=function(t){var e=this;if(!this.inTick){t.markTarget();var n=t.targetAnimations();n.sort(ou),this.tick(Number(this.currentTime),!1,n.slice())[1].forEach((function(t){var n=e.animations.indexOf(t);-1!==n&&e.animations.splice(n,1)})),this.applyPendingEffects()}},t.prototype.restart=function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame((function(){})),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame},t.prototype.destroy=function(){this.document.defaultView.cancelAnimationFrame(this.frameId)},t.prototype.applyPendingEffects=function(){this.pendingEffects.forEach((function(t){null==t||t.applyInterpolations()})),this.pendingEffects=[]},t.prototype.updateAnimationsPromises=function(){this.animationsWithPromises=this.animationsWithPromises.filter((function(t){return t.updatePromises()}))},t.prototype.discardAnimations=function(){this.updateAnimationsPromises(),this.animations=this.animations.filter((function(t){return"finished"!==t.playState&&"idle"!==t.playState}))},t.prototype.restartWebAnimationsNextTick=function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))},t.prototype.rAF=function(t){var e=this.rafId++;return 0===this.rafCallbacks.length&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([e,t]),e},t.prototype.requestAnimationFrame=function(t){var e=this;return this.rAF((function(n){e.updateAnimationsPromises(),t(n),e.updateAnimationsPromises()}))},t.prototype.tick=function(t,e,n){var r,i,o=this;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=t,this.ticking=!1;var a=[],s=[],c=[],h=[];return n.forEach((function(n){n.tick(t,e),n._inEffect?(s.push(n.effect),n.markTarget()):(a.push(n.effect),n.unmarkTarget()),n._needsTick&&(o.ticking=!0);var r=n._inEffect||n._needsTick;n._inTimeline=r,r?c.push(n):h.push(n)})),(r=this.pendingEffects).push.apply(r,l([],u(a),!1)),(i=this.pendingEffects).push.apply(i,l([],u(s),!1)),this.ticking&&this.requestAnimationFrame((function(){})),this.inTick=!1,[c,h]},t}();fs.EasingFunction=Gc,fs.AnimationTimeline=au;const su={duration:500},cu={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var uu,lu,hu,du,fu,pu,gu;!function(t){t.NodeAdded="NodeAdded",t.NodeUpdated="NodeUpdated",t.NodeRemoved="NodeRemoved",t.EdgeAdded="EdgeAdded",t.EdgeUpdated="EdgeUpdated",t.EdgeRemoved="EdgeRemoved",t.ComboAdded="ComboAdded",t.ComboUpdated="ComboUpdated",t.ComboRemoved="ComboRemoved"}(uu||(uu={})),function(t){t.DRAW="draw",t.TRANSFORM="transform",t.ELEMENT_VISIBILITY_CHANGE="elementvisibilitychange",t.ELEMENT_STATE_CHANGE="elementstatechange",t.ELEMENT_TRANSLATE="elementtranslate"}(lu||(lu={})),t.CanvasEvent=void 0,function(t){t.CLICK="click",t.DBLCLICK="dblclick",t.POINTER_OVER="pointerover",t.POINTER_LEAVE="pointerleave",t.POINTER_ENTER="pointerenter",t.POINTER_MOVE="pointermove",t.POINTER_OUT="pointerout",t.POINTER_DOWN="pointerdown",t.POINTER_UP="pointerup",t.CONTEXT_MENU="contextmenu",t.DRAG_START="dragstart",t.DRAG="drag",t.DRAG_END="dragend",t.DRAG_ENTER="dragenter",t.DRAG_OVER="dragover",t.DRAG_LEAVE="dragleave",t.DROP="drop",t.WHEEL="wheel"}(t.CanvasEvent||(t.CanvasEvent={})),t.NodeEvent=void 0,(hu=t.NodeEvent||(t.NodeEvent={})).CLICK="click",hu.DBLCLICK="dblclick",hu.POINTER_OVER="pointerover",hu.POINTER_LEAVE="pointerleave",hu.POINTER_ENTER="pointerenter",hu.POINTER_MOVE="pointermove",hu.POINTER_OUT="pointerout",hu.POINTER_DOWN="pointerdown",hu.POINTER_UP="pointerup",hu.CONTEXT_MENU="contextmenu",hu.DRAG_START="dragstart",hu.DRAG="drag",hu.DRAG_END="dragend",hu.DRAG_ENTER="dragenter",hu.DRAG_OVER="dragover",hu.DRAG_LEAVE="dragleave",hu.DROP="drop",t.CommonEvent=void 0,(du=t.CommonEvent||(t.CommonEvent={})).CLICK="click",du.DBLCLICK="dblclick",du.POINTER_OVER="pointerover",du.POINTER_LEAVE="pointerleave",du.POINTER_ENTER="pointerenter",du.POINTER_MOVE="pointermove",du.POINTER_OUT="pointerout",du.POINTER_DOWN="pointerdown",du.POINTER_UP="pointerup",du.CONTEXT_MENU="contextmenu",du.DRAG_START="dragstart",du.DRAG="drag",du.DRAG_END="dragend",du.DRAG_ENTER="dragenter",du.DRAG_OVER="dragover",du.DRAG_LEAVE="dragleave",du.DROP="drop",du.KEY_DOWN="keydown",du.KEY_UP="keyup",du.WHEEL="wheel",t.ContainerEvent=void 0,(fu=t.ContainerEvent||(t.ContainerEvent={})).KEY_DOWN="keydown",fu.KEY_UP="keyup",t.EdgeEvent=void 0,(pu=t.EdgeEvent||(t.EdgeEvent={})).CLICK="click",pu.DBLCLICK="dblclick",pu.POINTER_OVER="pointerover",pu.POINTER_LEAVE="pointerleave",pu.POINTER_ENTER="pointerenter",pu.POINTER_MOVE="pointermove",pu.POINTER_OUT="pointerout",pu.POINTER_DOWN="pointerdown",pu.POINTER_UP="pointerup",pu.CONTEXT_MENU="contextmenu",pu.DRAG_ENTER="dragenter",pu.DRAG_OVER="dragover",pu.DRAG_LEAVE="dragleave",pu.DROP="drop",t.GraphEvent=void 0,(gu=t.GraphEvent||(t.GraphEvent={})).BEFORE_CANVAS_INIT="beforecanvasinit",gu.AFTER_CANVAS_INIT="aftercanvasinit",gu.BEFORE_SIZE_CHANGE="beforesizechange",gu.AFTER_SIZE_CHANGE="aftersizechange",gu.BEFORE_ELEMENT_CREATE="beforeelementcreate",gu.AFTER_ELEMENT_CREATE="afterelementcreate",gu.BEFORE_ELEMENT_UPDATE="beforeelementupdate",gu.AFTER_ELEMENT_UPDATE="afterelementupdate",gu.BEFORE_ELEMENT_DESTROY="beforeelementdestroy",gu.AFTER_ELEMENT_DESTROY="afterelementdestroy",gu.BEFORE_ELEMENT_TRANSLATE="beforeelementtranslate",gu.AFTER_ELEMENT_TRANSLATE="afterelementtranslate",gu.BEFORE_DRAW="beforedraw",gu.AFTER_DRAW="afterdraw",gu.BEFORE_RENDER="beforerender",gu.AFTER_RENDER="afterrender",gu.BEFORE_ANIMATE="beforeanimate",gu.AFTER_ANIMATE="afteranimate",gu.BEFORE_LAYOUT="beforelayout",gu.AFTER_LAYOUT="afterlayout",gu.BEFORE_TRANSFORM="beforetransform",gu.AFTER_TRANSFORM="aftertransform",gu.BEFORE_ELEMENT_STATE_CHANGE="beforeelementstatechange",gu.AFTER_ELEMENT_STATE_CHANGE="afterelementstatechange",gu.BATCH_START="batchstart",gu.BATCH_END="batchend";const mu="combo",vu="tree";var yu;function bu(t){return"source"in t&&"target"in t}function xu(t){return t instanceof Float32Array||!(!Array.isArray(t)||2!==t.length&&3!==t.length)&&t.every((t=>"number"==typeof t))}function Eu(t,e,n){return t>=e&&t<=n}function wu(t=0){if(Array.isArray(t)){const[e=0,n=e,r=e,i=n]=t;return[e,n,r,i]}return[t,t,t,t]}function Mu(t){return t.max[0]-t.min[0]}function Nu(t){return t.max[1]-t.min[1]}function Su(t){return[Mu(t),Nu(t)]}function Cu(t,e){const n=xu(t)?function(t){const[e,n,r=0]=t,i=new vr;return i.setMinMax([e,n,r],[e,n,r]),i}(t):t.getKey().getBounds();return e?Tu(n,e):n}function Tu(t,e){const[n,r,i,o]=wu(e),[a,s,c]=t.min,[u,l,h]=t.max,d=new vr;return d.setMinMax([a-o,s-n,c],[u+r,l+i,h]),d}function ku(t){if(0===t.length)return new vr;if(1===t.length)return t[0];const e=new vr;e.setMinMax(t[0].min,t[0].max);for(let n=1;n<t.length;n++){const r=t[n];e.setMinMax([Math.min(e.min[0],r.min[0]),Math.min(e.min[1],r.min[1]),Math.min(e.min[2],r.min[2])],[Math.max(e.max[0],r.max[0]),Math.max(e.max[1],r.max[1]),Math.max(e.max[2],r.max[2])])}return e}function Pu(t,e){return Eu(t[0],e.min[0],e.max[0])&&Eu(t[1],e.min[1],e.max[1])}function Au(t,e){const[n,r]=e,[i,o]=t.min,[a,s]=t.max,c=n-i,u=a-n,l=r-o,h=s-r,d=Math.min(c,u,l,h);return d===c?"left":d===u?"right":d===l?"top":d===h?"bottom":"left"}function Ou(t,e){const n=Jt(e);if(Pu(e,t)){switch(Au(t,e)){case"left":n[0]=t.min[0];break;case"right":n[0]=t.max[0];break;case"top":n[1]=t.min[1];break;case"bottom":n[1]=t.max[1]}}else{const[r,i]=e,[o,a]=t.min,[s,c]=t.max;n[0]=Eu(r,o,s)?r:r<o?o:s,n[1]=Eu(i,a,c)?i:i<a?a:c}return n}function _u(t){const{x:e=0,y:n=0,z:r=0}=t.style||{};return[+e,+n,+r]}function Ru(t,e){const[n,r]=e,{min:i,max:o}=t;return[i[0]+n*(o[0]-i[0]),i[1]+r*(o[1]-i[1])]}function Du(t,e="center"){const n=function(t){if(Array.isArray(t))return Eu(t[0],0,1)&&Eu(t[1],0,1)?t:[.5,.5];const e=t.split("-");return[e.includes("left")?0:e.includes("right")?1:.5,e.includes("top")?0:e.includes("bottom")?1:.5]}(e);return Ru(t,n)}function Iu(t,e){const n=function(t){const e="string"==typeof t?t.split(" ").map((t=>parseFloat(t))):t.slice(0,2);return Eu(e[0],0,1)&&Eu(e[1],0,1)?e:[.5,.5]}(e);return Ru(t,n)}function Lu(t=0){if(Wt(t))return Array(3).fill(t);const[e,n=e,r=e]=t;return[e,n,r]}function ju(t,e,n){if(Array.isArray(t))return t;const[r,i]=Lu(n),[o,a]=Lu(e),s=o/2/r,c=a/2/i;switch(t){case"top":return[.5,c];case"bottom":return[.5,1-c];case"left":return[s,.5];case"right":return[1-s,.5];case"top-left":case"left-top":return[s,c];case"top-right":case"right-top":return[1-s,c];case"bottom-left":case"left-bottom":return[s,1-c];case"bottom-right":case"right-bottom":return[1-s,1-c];default:return[.5,.5]}}function zu(t,e,n){if(Array.isArray(t))return t;const r=Lu(n)[0],i=r/2,o=Lu(e)[0]/2,a=o/r;switch(t){case"top":return[.5,a];case"bottom":return[.5,1-a];case"left":return[a,.5];case"right":return[1-a,.5]}const s=(i-o)*(Math.sqrt(2)/2)/r;switch(t){case"top-left":case"left-top":return[.5-s,.5-s];case"top-right":case"right-top":return[.5+s,.5-s];case"bottom-left":case"left-bottom":return[.5-s,.5+s];case"bottom-right":case"right-bottom":return[.5+s,.5+s];default:return[.5,.5]}}function Bu(t,e,n,r,i=ju){const o=i(t,n,r),[a,s]=Lu(r),c=new vr;return c.setMinMax([e[0]-a/2,e[1]-s/2,0],[e[0]+a/2,e[1]+s/2,0]),Iu(c,o)}function Fu(t){if(Bt(t.id)||Wt(t.id))return t.id;if(bu(t))return`${t.source}-${t.target}`;throw new Error("The data does not have available id.")}function Gu(t){return t.style?.parentId}function Vu(t,e){const n={nodes:(t.nodes||[]).map(Fu),edges:(t.edges||[]).map(Fu),combos:(t.combos||[]).map(Fu)};return e?Object.values(n).flat():n}function Wu(t,e){if(!t.startsWith(e))return!1;const n=t[e.length];return n>="A"&&n<="Z"}function Uu(t,e){return Object.entries(t).reduce(((t,[n,r])=>("className"===n||"class"===n||Wu(n,e)&&(t[function(t,e,n=!0){if(!e)return t;if(!Wu(t,e))return t;const r=t.slice(e.length);return n?Yt(r):r}(n,e)]=r),t)),{})}function Hu(t,e){const n=e.length;return Object.keys(t).reduce(((r,i)=>{if(i.startsWith(e)){r[i.slice(n)]=t[i]}return r}),{})}function qu(t,e){const n=Bt(e)?[e]:e;return Object.entries(t).reduce(((t,[e,r])=>(n.find((t=>e.startsWith(t)))||(t[e]=r),t)),{})}t.ExtensionCategory=void 0,(yu=t.ExtensionCategory||(t.ExtensionCategory={})).NODE="node",yu.EDGE="edge",yu.COMBO="combo",yu.THEME="theme",yu.PALETTE="palette",yu.LAYOUT="layout",yu.BEHAVIOR="behavior",yu.PLUGIN="plugin",yu.ANIMATION="animation",yu.TRANSFORM="transform";const $u=[0,0,0];function Yu(t,e){return t.map(((t,n)=>t+e[n]))}function Ku(t,e){return t.map(((t,n)=>t-e[n]))}function Xu(t,e){return"number"==typeof e?t.map((t=>t*e)):t.map(((t,n)=>t*e[n]))}function Zu(t,e){return"number"==typeof e?t.map((t=>t/e)):t.map(((t,n)=>t/e[n]))}function Qu(t,e){return t.map((t=>t*e))}function Ju(t,e){return Math.sqrt(t.reduce(((t,n,r)=>t+(n-e[r]||0)**2),0))}function tl(t,e){return t.reduce(((t,n,r)=>t+Math.abs(n-e[r])),0)}function el(t){const e=t.reduce(((t,e)=>t+e**2),0);return t.map((t=>t/Math.sqrt(e)))}function nl(t,e,n=!1){const r=t[0]*e[1]-t[1]*e[0];let i=Math.acos(Xu(t,e).reduce(((t,e)=>t+e),0)/(Ju(t,$u)*Ju(e,$u)));return n&&r<0&&(i=2*Math.PI-i),i}function rl(t,e=!0){return e?[-t[1],t[0]]:[t[1],-t[0]]}function il(t){return[t[0],t[1]]}function ol(t){return 2===t.length?[t[0],t[1],0]:t}function al(t){if(t)return"string"==typeof t||"function"==typeof t||Array.isArray(t)?{type:"group",field:t=>t.id,color:t,invert:!1}:t}function sl(t,e){const[n,r]=t,[i,o]=e;return function(t,e){const n=ol(t),r=ol(e);return[n[1]*r[2]-n[2]*r[1],n[2]*r[0]-n[0]*r[2],n[0]*r[1]-n[1]*r[0]]}(Ku(n,r),Ku(i,o)).every((t=>0===t))}function cl(t,e,n=!1){if(sl(t,e))return;const[r,i]=t,[o,a]=e,s=((r[0]-o[0])*(o[1]-a[1])-(r[1]-o[1])*(o[0]-a[0]))/((r[0]-i[0])*(o[1]-a[1])-(r[1]-i[1])*(o[0]-a[0])),c=a[0]-o[0]?(r[0]-o[0]+s*(i[0]-r[0]))/(a[0]-o[0]):(r[1]-o[1]+s*(i[1]-r[1]))/(a[1]-o[1]);return n||Eu(s,0,1)&&Eu(c,0,1)?[r[0]+s*(i[0]-r[0]),r[1]+s*(i[1]-r[1])]:void 0}function ul(t){return[t.x,t.y]}function ll(t){return{x:t[0],y:t[1]}}function hl(t,e=0){return t.map((t=>parseFloat(t.toFixed(e))))}function dl(t,e,n,r=!1){const i=el(r?Ku(t,e):Ku(e,t)),o=[i[0]*n,i[1]*n];return Yu(il(t),o)}function fl(t,e){return t[1]===e[1]}function pl(t,e,n){return sl([t,e],[e,n])}function gl(t,e,n,r=!0){for(let i=0;i<n.length;i++){let o=n[i],a=n[(i+1)%n.length];r&&(o=Yu(e,o),a=Yu(e,a));const s=cl([e,t],[o,a]);if(s)return{point:s,line:[o,a]}}return{point:e,line:void 0}}function ml(t,e){const[n,r]=t;let i=!1;const o=e.length;if(o<=2)return!1;const a=t=>Math.abs(t)<1e-6?0:t<0?-1:1;for(let s=0;s<o;s++){const c=e[s],u=e[(s+1)%o];if(pl(c,u,t))return!0;a(c[1]-r)>0!=a(u[1]-r)>0&&a(n-(r-c[1])*(c[0]-u[0])/(c[1]-u[1])-c[0])<0&&(i=!i)}return i}function vl(t,e){const n=e.center,r=Ku(t,e.center),i=Math.atan2(r[1],r[0]);if(isNaN(i))return n;const o=Mu(e)/2,a=Nu(e)/2;return[n[0]+o*Math.cos(i),n[1]+a*Math.sin(i)]}function yl(t,e){return Ju(t,bl(t,e))}function bl(t,e){const[n,r]=e[0],[i,o]=e[1],[a,s]=t,c=i-n,u=o-r;if(0===c&&0===u)return[n,r];let l=((a-n)*c+(s-r)*u)/(c*c+u*u);l>1?l=1:l<0&&(l=0);return[n+l*c,r+l*u]}function xl(t,e=!0){const n=function(t){return Zu(t.reduce(((t,e)=>Yu(t,e)),[0,0]),t.length)}(t);return t.sort((([t,r],[i,o])=>{const a=Math.atan2(r-n[1],t-n[0]),s=Math.atan2(o-n[1],i-n[0]);return e?s-a:a-s}))}function El(t,e){let n=2*t;return"string"==typeof e?n=t*Number(e.replace("%",""))/100:"number"==typeof e&&(n=e),isNaN(n)&&(n=2*t),n}function wl(t,e,n=1,r=!1){const i=r?n:1;return El((t.max[0]-t.min[0])*i,e)}const Ml="cachedStyle",Nl=t=>`__${t}__`;function Sl(t,e){const n=Array.isArray(e)?e:[e];se(t,Ml)||ce(t,Ml,{}),n.forEach((e=>{ce(se(t,Ml),Nl(e),t.attributes[e])}))}function Cl(t,e){return se(t,[Ml,Nl(e)])}function Tl(t,e){return Nl(e)in(se(t,Ml)||{})}function kl(t){const e=[],n=t=>{t.children&&t.children.length&&t.children.forEach((t=>{e.push(t),n(t)}))};return n(t),e}const Pl="visibility";class Al extends Os{constructor(t){super(t),this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}shapeMap={};animateMap={};upsert(t,e,n,r){const i=this.shapeMap[t];if(!1!==n){if(!i){const i=new e({style:n});return i.id=t,r.appendChild(i),this.shapeMap[t]=i,i}return jh(i,n),i}i&&(r.removeChild(i),delete this.shapeMap[t])}update(t={}){this.attr(re({},this.attributes,t)),this.render(this.attributes,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){const{x:e,y:n,z:r,className:i,transform:o,transformOrigin:a,context:s,zIndex:c,...u}=t;return u}animate(t,e){const n=[],r=super.animate(t,e);if(r&&n.push(r),Array.isArray(t)&&t.length>0){const r=["anchor","transform","transformOrigin","x","y","z","zIndex"];Object.keys(t[0]).some((t=>!r.includes(t)))&&Object.entries(this.shapeMap).forEach((([r,i])=>{const o=this[`get${r[0].toUpperCase()}${r.slice(1)}Style`];if("function"==typeof o){const r=t.map((t=>o.call(this,{...this.attributes,...t}))),a=i.animate(Bh(r),e);a&&n.push(a)}}))}return zh(n)}setVisibility(){const{visibility:t}=this.attributes;!function(t,e){[t,...kl(t)].forEach((n=>{Tl(n,Pl)||Sl(n,Pl);const r=Cl(n,Pl);t!==n&&"hidden"===r||(n.style.visibility=e)}))}(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}class Ol extends Al{static defaultStyleProps={padding:0,fontSize:12,wordWrap:!0,maxLines:1,wordWrapWidth:128,textOverflow:"...",textBaseline:"middle",backgroundOpacity:.75,backgroundZIndex:-1,backgroundLineWidth:0};constructor(t){super(re({},{style:Ol.defaultStyleProps},t))}isTextStyle(t){return Wu(t,"label")}isBackgroundStyle(t){return Wu(t,"background")}getTextStyle(t){const{padding:e,...n}=this.getGraphicStyle(t);return qu(n,"background")}getBackgroundStyle(t){if(!1===t.background)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:r,padding:i}=e,o=Uu(e,"background"),{min:[a,s],halfExtents:[c,u]}=this.shapeMap.text.getGeometryBounds(),[l,h,d,f]=wu(i);Object.assign(o,{x:a-f,y:s-l,width:n?Math.min(2*c,r):2*c+f+h,height:2*u+l+d});const{radius:p}=o;if("string"==typeof p&&p.endsWith("%")){const t=Number(p.replace("%",""))/100;o.radius=Math.min(+o.width,+o.height)*t}return o}render(t=this.parsedAttributes,e=this){this.upsert("text",Gs,this.getTextStyle(t),e),this.upsert("background",Fs,this.getBackgroundStyle(t),e)}}class _l extends Al{static defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};constructor(t){super(re({},{style:_l.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",Ol,this.getBadgeStyle(t),e)}connectedCallback(){this.upsert("label",Ol,this.getBadgeStyle(this.parsedAttributes),this)}}class Rl extends Al{constructor(t){super(t)}isGImage(){return!!this.getAttribute("src")}getIconStyle(t=this.attributes){const e=this.getGraphicStyle(t);return this.isGImage()?{anchor:[.5,.5],...e}:{textBaseline:"middle",textAlign:"center",...e}}render(t=this.attributes,e=this){this.upsert("icon",this.isGImage()?Is:Gs,this.getIconStyle(t),e)}connectedCallback(){this.upsert("icon",this.isGImage()?Is:Gs,this.getIconStyle(this.attributes),this)}}class Dl extends Al{type="node";static defaultStyleProps={x:0,y:0,size:24,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};constructor(t){super(re({},{style:Dl.defaultStyleProps},t))}get parsedAttributes(){return this.attributes}getSize(t=this.attributes){const{size:e}=t;return Lu(e)}getKeyStyle(t){const{color:e,fill:n,...r}=this.getGraphicStyle(t);return Object.assign({fill:e||n},qu(r,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(!1===t.label||oe(t.labelText))return!1;const{placement:e,maxWidth:n,...r}=Uu(this.getGraphicStyle(t),"label"),i=this.getKey().getLocalBounds();return Object.assign(Lh(i,e),{wordWrapWidth:wl(i,n)},r)}getHaloStyle(t){if(!1===t.halo)return!1;const{fill:e,...n}=this.getKeyStyle(t);return{...n,stroke:e,...Uu(this.getGraphicStyle(t),"halo")}}getIconStyle(t){if(!1===t.icon||oe(t.iconText||t.iconSrc))return!1;const e=Uu(this.getGraphicStyle(t),"icon"),n=this.getKey(),[r,i]=Du(n.getLocalBounds(),"center");return{x:r,y:i,...e}}getBadgesStyle(t){const e=Hu(this.shapeMap,"badge-"),n={};if(Object.keys(e).forEach((t=>{n[t]=!1})),!1===t.badge||oe(t.badges))return n;const{badges:r=[],badgePalette:i,...o}=t,a=function(t){const e=Bt(t)?iz("palette",t):t;if(!kt(e))return e}(i),s=Uu(this.getGraphicStyle(o),"badge");return r.forEach(((t,e)=>{n[e]={backgroundFill:a?a[e%a?.length]:void 0,...s,...this.getBadgeStyle(t)}})),n}getBadgeStyle(t){const e=this.getKey(),{placement:n="top",...r}=t;return{...Lh(e.getLocalBounds(),n,!0),...r}}getPortsStyle(t){const e=this.getPorts(),n={};if(Object.keys(e).forEach((t=>{n[t]=!1})),!1===t.port||oe(t.ports))return n;const r=Uu(this.getGraphicStyle(t),"port"),{ports:i=[]}=t;return i.forEach(((e,i)=>{const o=e.key||i,a={...r,...e};if(Ph(a))n[o]=!1;else{const[r,i]=this.getPortXY(t,e);n[o]={cx:r,cy:i,...a}}})),n}getPortXY(t,e){const{placement:n="left"}=e;return Th(this.getKey().getLocalBounds(),n)}getKey(){return this.shapeMap.key}getPorts(){return Hu(this.shapeMap,"port-")}getCenter(){return this.getKey().getBounds().center}getIntersectPoint(t){const e=this.getKey().getBounds();return gl(t,Du(n=e,"center"),[Du(n,"left-top"),Du(n,"right-top"),Du(n,"right-bottom"),Du(n,"left-bottom")],!1).point;var n}drawHaloShape(t,e){const n=this.getKey();this.upsert("halo",n.constructor,this.getHaloStyle(t),e)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach((t=>{this.upsert(`badge-${t}`,_l,n[t],e)}))}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach((t=>{this.upsert(`port-${t}`,As,n[t],e)}))}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e)&&(this.drawHaloShape(t,e),this.upsert("icon",Rl,this.getIconStyle(t),e),this.drawBadgeShapes(t,e),this.upsert("label",Ol,this.getLabelStyle(t),e),this.drawPortShapes(t,e))}onCreate(){}onUpdate(){}onDestroy(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>{this.drawBadgeShapes(this.parsedAttributes,this)}),n}}const Il=.8,Ll=["node","edge","combo"];class jl extends Dl{static defaultStyleProps={size:24};constructor(t){super(re({},{style:jl.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",As,this.getKeyStyle(t),e)}getKeyStyle(t){return{...super.getKeyStyle(t),r:Math.min(...this.getSize(t))/2}}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getKeyStyle(t),r=2*n*Il;return!!e&&{width:r,height:r,...e}}getIntersectPoint(t){return vl(t,this.getKey().getBounds())}}class zl extends Dl{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",zs,this.getKeyStyle(t),e)}getKeyStyle(t){return{...super.getKeyStyle(t),points:this.getPoints(t)}}getIntersectPoint(t){const{points:e}=this.getKeyStyle(this.parsedAttributes);return gl(t,[+(this.attributes?.x||0),+(this.attributes?.y||0)],e).point}}class Bl extends zl{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return function(t,e){return[[0,-e/2],[t/2,0],[0,e/2],[-t/2,0]]}(e,n)}getIntersectPoint(t){const{points:e}=this.getKeyStyle(this.parsedAttributes);return gl(t,[this.attributes.x,this.attributes.y],e).point}}class Fl extends Dl{static defaultStyleProps={size:[80,40]};constructor(t){super(re({},{style:Fl.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",_s,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,r]=this.getSize(t);return{...e,rx:n/2,ry:r/2}}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:r}=this.getKeyStyle(t),i=2*Math.min(+n,+r)*Il;return!!e&&{width:i,height:i,...e}}getIntersectPoint(t){return vl(t,this.getKey().getBounds())}}class Gl extends zl{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return[[0,e=this.getOuterR(t)],[e*Math.sqrt(3)/2,e/2],[e*Math.sqrt(3)/2,-e/2],[0,-e],[-e*Math.sqrt(3)/2,-e/2],[-e*Math.sqrt(3)/2,e/2]];var e}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*Il;return!!e&&{width:n,height:n,...e}}}let Vl=class t extends Dl{static defaultStyleProps={size:50};constructor(e){super(re({},{style:t.defaultStyleProps},e))}getKeyStyle(t){const[e,n]=this.getSize(t);return{...super.getKeyStyle(t),width:e,height:n,anchor:[.5,.5]}}getHaloStyle(t){if(!1===t.halo)return!1;const{fill:e,stroke:n,...r}=this.getKeyStyle(t),i=Uu(this.getGraphicStyle(t),"halo"),o=Number(i.lineWidth),[a,s]=Yu(this.getSize(t),[o,o]);return{...r,...i,width:a,height:s,fill:"transparent"}}getIconStyle(t){const e=super.getIconStyle(t),[n,r]=this.getSize(t);return!!e&&{width:n*Il,height:r*Il,...e}}drawKeyShape(t,e){return this.upsert("key",Is,this.getKeyStyle(t),e)}drawHaloShape(t,e){this.upsert("halo",Fs,this.getHaloStyle(t),e)}};class Wl extends Dl{static defaultStyleProps={size:[48,24],anchor:[.5,.5]};constructor(t){super(re({},{style:Wl.defaultStyleProps},t))}getKeyStyle(t){const[e,n]=this.getSize(t);return{...super.getKeyStyle(t),width:e,height:n}}getIconStyle(t){const e=super.getIconStyle(t),{width:n,height:r}=this.getKeyStyle(t);return!!e&&{width:n*Il,height:r*Il,...e}}drawKeyShape(t,e){return this.upsert("key",Fs,this.getKeyStyle(t),e)}}class Ul extends zl{constructor(t){super(t)}getInnerR(t){return t.innerR||3*this.getOuterR(t)/8}getOuterR(t){return Math.min(...this.getSize(t))/2}getPoints(t){return e=this.getOuterR(t),n=this.getInnerR(t),[[0,-e],[n*Math.cos(3*Math.PI/10),-n*Math.sin(3*Math.PI/10)],[e*Math.cos(Math.PI/10),-e*Math.sin(Math.PI/10)],[n*Math.cos(Math.PI/10),n*Math.sin(Math.PI/10)],[e*Math.cos(3*Math.PI/10),e*Math.sin(3*Math.PI/10)],[0,n],[-e*Math.cos(3*Math.PI/10),e*Math.sin(3*Math.PI/10)],[-n*Math.cos(Math.PI/10),n*Math.sin(Math.PI/10)],[-e*Math.cos(Math.PI/10),-e*Math.sin(Math.PI/10)],[-n*Math.cos(3*Math.PI/10),-n*Math.sin(3*Math.PI/10)]];var e,n}getIconStyle(t){const e=super.getIconStyle(t),n=2*this.getInnerR(t)*Il;return!!e&&{width:n,height:n,...e}}getPortXY(t,e){const{placement:n="top"}=e;return Th(this.getKey().getLocalBounds(),n,function(t,e){const n={};return n.top=[0,-t],n.left=[-t*Math.cos(Math.PI/10),-t*Math.sin(Math.PI/10)],n["left-bottom"]=[-t*Math.cos(3*Math.PI/10),t*Math.sin(3*Math.PI/10)],n.bottom=[0,e],n["right-bottom"]=[t*Math.cos(3*Math.PI/10),t*Math.sin(3*Math.PI/10)],n.right=n.default=[t*Math.cos(Math.PI/10),-t*Math.sin(Math.PI/10)],n}(this.getOuterR(t),this.getInnerR(t)),!1)}}class Hl extends zl{static defaultStyleProps={size:40,direction:"up"};constructor(t){super(re({},{style:Hl.defaultStyleProps},t))}getPoints(t){const{direction:e}=t,[n,r]=this.getSize(t);return function(t,e,n){const r=e/2,i=t/2,o={up:[[-i,r],[i,r],[0,-r]],left:[[-i,0],[i,r],[i,-r]],right:[[-i,r],[-i,-r],[i,0]],down:[[-i,-r],[i,-r],[0,r]]};return o[n]||o.up}(n,r,e)}getPortXY(t,e){const{direction:n}=t,{placement:r="top"}=e,i=this.getKey().getLocalBounds(),[o,a]=this.getSize(t),s=function(t,e,n){const r=e/2,i=t/2,o={};"down"===n?(o.bottom=o.default=[0,r],o.right=[i,-r],o.left=[-i,-r]):"left"===n?(o.top=[i,-r],o.bottom=[i,r],o.left=o.default=[-i,0]):"right"===n?(o.top=[-i,-r],o.bottom=[-i,r],o.right=o.default=[i,0]):(o.left=[-i,r],o.top=o.default=[0,-r],o.right=[i,r]);return o}(o,a,n);return Th(i,r,s,!1)}getIconStyle(t){const{icon:e,iconText:n,iconSrc:r,direction:i}=t;if(!1===e||oe(n||r))return!1;const o=Uu(this.getGraphicStyle(t),"icon"),a=this.getKey().getLocalBounds(),[s,c]=function(t,e){const{center:n}=t,[r,i]=Su(t);return["up"===e||"down"===e?n[0]:"right"===e?n[0]-r/6:n[0]+r/6,"left"===e||"right"===e?n[1]:"down"===e?n[1]-i/6:n[1]+i/6]}(a,i),u=2*function(t,e){let[n,r]=Su(t);return[n,r]="up"===e||"down"===e?[n,r]:[r,n],(r**2-(Math.sqrt((n/2)**2+r**2)-n/2)**2)/(2*r)}(a,i)*Il;return{x:s,y:c,width:u,height:u,...o}}}class ql extends Dl{type="combo";static defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedOrigin:[.5,.5],collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};constructor(t){super(re({},{style:ql.defaultStyleProps},t))}calculatePosition(t){const{x:e=0,y:n=0,collapsed:r,childrenNode:i=[],childrenData:o=[]}=t;if(i.length<o.length){if(o.length>0&&r){return Zu(o.reduce(((t,e)=>Yu(t,_u(e))),[0,0,0]),o.length)}return[+e,+n,0]}return o.length?r?this.getCollapsedOriginPosition(t):this.getContentBBox(t).center:[+e,+n,0]}getCollapsedOriginPosition(t){return Bu(t.collapsedOrigin,this.getContentBBox(t).center,this.getCollapsedKeySize(t),this.getExpandedKeySize(t))}getKeySize(t){const{collapsed:e,childrenNode:n=[]}=t;return 0===n.length?this.getEmptyKeySize(t):e?this.getCollapsedKeySize(t):this.getExpandedKeySize(t)}getEmptyKeySize(t){const{padding:e,collapsedSize:n}=t,[r,i,o,a]=wu(e);return Yu(Lu(n),[a+i,r+o,0])}getCollapsedKeySize(t){return Lu(t.collapsedSize)}getExpandedKeySize(t){if(!oe(t.size))return Lu(t.size);const e=this.getContentBBox(t);return[Mu(e),Nu(e),0]}getContentBBox(t){const{childrenNode:e=[],padding:n}=t,r=ku(e.map((t=>t.getBounds())));return n?Tu(r,n):r}drawCollapsedMarkerShape(t,e){this.upsert("collapsed-marker",Rl,this.getCollapsedMarkerStyle(t),e)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const{type:e,...n}=Uu(this.getGraphicStyle(t),"collapsedMarker"),r=this.getKey(),[i,o]=Du(r.getLocalBounds(),"center"),a={...n,x:i,y:o};if(e){const n=this.getCollapsedMarkerText(e,t);Object.assign(a,{text:n})}return a}getCollapsedMarkerText(t,e){const{context:n,childrenData:r=[]}=e;if(!n)return"";const{model:i}=n;return"descendant-count"===t?i.getDescendantsData(this.id).length.toString():"child-count"===t?r.length.toString():"node-count"===t?i.getDescendantsData(this.id).filter((t=>"node"===i.getElementType(Fu(t)))).length.toString():kt(t)?t(r):""}getComboZIndex(t){return(t.context?.model.getAncestorsData(this.id,mu)||[]).length}getComboStyle(t){const{zIndex:e=this.getComboZIndex(t)}=t,[n,r]=this.calculatePosition(t);return{x:n,y:r,zIndex:e}}render(t,e=this){super.render(t,e);const n=this.getComboStyle(t);Object.assign(this.style,n),t.context?.model.syncComboDatum({id:this.id,style:n}),this.drawCollapsedMarkerShape(t,e)}onCreate(){}onUpdate(){}onDestroy(){}}class $l extends ql{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",As,this.getKeyStyle(t),e)}getKeyStyle(t){const{collapsed:e}=t,n=super.getKeyStyle(t),r=Uu(n,"collapsed"),[i]=this.getKeySize(t);return{...n,...e&&r,r:i/2}}getCollapsedKeySize(t){const[e,n]=Lu(t.collapsedSize),r=Math.max(e,n)/2;return[2*r,2*r,0]}getExpandedKeySize(t){if(!oe(t.size)){const[e,n]=Lu(t.size),r=Math.sqrt(e**2+n**2)/2;return[2*r,2*r,0]}const e=this.getContentBBox(t),[n,r]=Su(e),i=Math.sqrt(n**2+r**2)/2;return[2*i,2*i,0]}getCollapsedOriginPosition(t){return Bu(t.collapsedOrigin,this.getContentBBox(t).center,this.getCollapsedKeySize(t),this.getExpandedKeySize(t),zu)}}class Yl extends ql{static defaultStyleProps={anchor:[.5,.5]};constructor(t){super(re({},{style:Yl.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Fs,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),n=Uu(e,"collapsed"),[r,i]=this.getKeySize(t);return{...e,...t.collapsed&&n,width:r,height:i}}}const Kl={N:"S",S:"N",W:"E",E:"W"},Xl={N:-Math.PI/2,S:Math.PI/2,E:0,W:Math.PI};function Zl(t,e){const[n,r]=t,[i,o]=e;return n===i?r>o?"N":"S":r===o?n>i?"W":"E":null}function Ql(t,e){return"N"===e||"S"===e?Nu(t):Mu(t)}function Jl(t,e,n){const r=[t[0],e[1]],i=[e[0],t[1]],o=Zl(t,r),a=Zl(t,i),s=n?Kl[n]:null,c=o===n||o!==s&&a!==n?r:i;return{points:[c],direction:Zl(c,e)}}function th(t,e,n){const r=ih(t,e,n);return{points:[r],direction:Zl(r,e)}}function eh(t,e,n,r){const i=[[e[0],t[1]],[t[0],e[1]]],o=i.filter((t=>function(t,e){return!Pu(t,e)}(t,n))),a=o.filter((e=>Zl(e,t)!==r));if(a.length>0){const n=a.find((e=>Zl(t,e)===r))||a[0];return{points:[n],direction:Zl(n,e)}}{const a=dl(e,Tt(i,o)[0],Ql(n,r)/2);return{points:[ih(a,t,n),a],direction:Zl(a,e)}}}function nh(t,e,n,r){let i=th(t,e,n);const o=ol(i.points[0]);if(Pu(o,r)){i=th(e,t,r);const a=ol(i.points[0]);if(Pu(a,n)){const s=dl(t,a,Ql(n,Zl(t,a))/2),c=dl(e,o,Ql(r,Zl(e,o))/2),u=[(s[0]+c[0])/2,(s[1]+c[1])/2],l=th(t,u,n),h=eh(u,e,r,l.direction);i.points=[l.points[0],h.points[0]],i.direction=h.direction}}return i}function rh(t,e,n,r,i){const o=.01,a=ku([n,r]),s=Ju(e,a.center)>Ju(t,a.center),[c,u]=s?[e,t]:[t,e],l=Nu(a)+Mu(a);let h;if(i){const t=[c[0]+l*Math.cos(Xl[i]),c[1]+l*Math.sin(Xl[i])];h=dl(Ou(a,t),t,o)}else h=dl(Ou(a,c),c,-.01);let d=ih(h,u,a),f=[hl(h,2),hl(d,2)];if(ae(hl(h),hl(d))){const t=nl(Ku(h,c),[1,0,0])+Math.PI/2;d=[u[0]+l*Math.cos(t),u[1]+l*Math.sin(t),0],d=hl(dl(Ou(a,d),u,-.01),2);f=[h,ih(h,d,a),d]}return{points:s?f.reverse():f,direction:Zl(s?h:d,e)}}function ih(t,e,n){let r=[t[0],e[1]];return Pu(r,n)&&(r=[e[0],t[1]]),r}function oh(t,e,n,r,i){const[o,a]=ul(t.getPoint(e));let s=n,c=r;return i&&(s=n*Math.cos(i)-r*Math.sin(i),c=n*Math.sin(i)+r*Math.cos(i)),[o+s,a+c]}function ah(t,e,n,r){if(ae(t,e))return t;const i=Ku(e,t),o=[t[0]+n*i[0],t[1]+n*i[1]],a=el(rl(i,!1));return o[0]+=r*a[0],o[1]+=r*a[1],o}function sh(t,e,n){return[["M",t[0],t[1]],["C",n[0][0],n[0][1],n[1][0],n[1][1],e[0],e[1]]]}function ch(t,e=0,n=!1){const r=t[0],i=t[t.length-1],o=t.slice(1,t.length-1),a=[["M",r[0],r[1]]];return o.forEach(((t,n)=>{const s=o[n-1]||r,c=o[n+1]||i;if(!pl(s,t,c)&&e){const[n,r]=function(t,e,n,r){const i=tl(t,e),o=tl(n,e),a=Math.min(r,Math.min(i,o)/2),s=[e[0]-a/i*(e[0]-t[0]),e[1]-a/i*(e[1]-t[1])],c=[e[0]-a/o*(e[0]-n[0]),e[1]-a/o*(e[1]-n[1])];return[s,c]}(s,t,c,e);a.push(["L",n[0],n[1]],["Q",t[0],t[1],r[0],r[1]],["L",r[0],r[1]])}else a.push(["L",t[0],t[1]])})),a.push(["L",i[0],i[1]]),n&&a.push(["Z"]),a}const uh=t=>{const e=Math.PI/2,n=Nu(t)/2,r=Mu(t)/2,i=Math.atan2(n,r)/2,o=Math.atan2(r,n)/2;return{top:[-e-o,-e+o],"top-right":[-e+o,-i],"right-top":[-e+o,-i],right:[-i,i],"bottom-right":[i,e-o],"right-bottom":[i,e-o],bottom:[e-o,e+o],"bottom-left":[e+o,Math.PI-i],"left-bottom":[e+o,Math.PI-i],left:[Math.PI-i,Math.PI+i],"top-left":[Math.PI+i,-e-o],"left-top":[Math.PI+i,-e-o]}};function lh(t,e,n,r,i){const o=Cu(t),a=t.getCenter();let s=r&&Ah(r),c=i&&Ah(i);if(!s||!c){const r=uh(o),i=r[e][0],u=r[e][1],[l,h]=Su(o),d=Math.max(l,h),f=Yu(a,[d*Math.cos(i),d*Math.sin(i),0]),p=Yu(a,[d*Math.cos(u),d*Math.sin(u),0]);s=Ih(t,f),c=Ih(t,p),n||([s,c]=[c,s])}return[s,c]}function hh(t,e,n,r,i,o){const a=t.getPorts()[i||o],s=t.getPorts()[o||i];let[c,u]=lh(t,e,n,a,s);const l=function(t,e,n,r){const i=t.getCenter();if(ae(e,n)){const t=Ku(e,i),o=[r*Math.sign(t[0])||r/2,r*Math.sign(t[1])||-r/2,0];return[Yu(e,o),Yu(n,Xu(o,[1,-1,1]))]}return[dl(i,e,Ju(i,e)+r),dl(i,n,Ju(i,n)+r)]}(t,c,u,r);return a&&(c=Dh(a,l[0])),s&&(u=Dh(s,l[l.length-1])),sh(c,u,l)}function dh(t,e,n,r,i,o,a){const s=kh(t),c=s[o||a],u=s[a||o];let[l,h]=lh(t,n,r,c,u);const d=function(t,e,n,r){const i=[],o=Cu(t);if(ae(e,n)){switch(Au(o,e)){case"left":i.push([e[0]-r,e[1]]),i.push([e[0]-r,e[1]+r]),i.push([e[0],e[1]+r]);break;case"right":i.push([e[0]+r,e[1]]),i.push([e[0]+r,e[1]+r]),i.push([e[0],e[1]+r]);break;case"top":i.push([e[0],e[1]-r]),i.push([e[0]+r,e[1]-r]),i.push([e[0]+r,e[1]]);break;case"bottom":i.push([e[0],e[1]+r]),i.push([e[0]+r,e[1]+r]),i.push([e[0]+r,e[1]])}}else{const t=Au(o,e),a=Au(o,n);if(t===a){let o,a;switch(t){case"left":o=Math.min(e[0],n[0])-r,i.push([o,e[1]]),i.push([o,n[1]]);break;case"right":o=Math.max(e[0],n[0])+r,i.push([o,e[1]]),i.push([o,n[1]]);break;case"top":a=Math.min(e[1],n[1])-r,i.push([e[0],a]),i.push([n[0],a]);break;case"bottom":a=Math.max(e[1],n[1])+r,i.push([e[0],a]),i.push([n[0],a])}}else{const s=(t,e)=>({left:[e[0]-r,e[1]],right:[e[0]+r,e[1]],top:[e[0],e[1]-r],bottom:[e[0],e[1]+r]}[t]),c=s(t,e),u=s(a,n),l=ih(c,u,o);i.push(c,l,u)}}return i}(t,l,h,i);return c&&(l=Dh(c,d[0])),u&&(h=Dh(u,d[d.length-1])),ch([l,...d,h],e)}function fh(t,e){const n=new Set,r=new Set,i=new Set;return t.forEach((o=>{e(o).forEach((e=>{n.add(e),t.includes(e.source)&&t.includes(e.target)?r.add(e):i.add(e)}))})),{edges:Array.from(n),internal:Array.from(r),external:Array.from(i)}}const ph=(t,e)=>[["M",0,0],["L",t,-e/2],["L",t,e/2],["Z"]];var gh=Object.freeze({__proto__:null,circle:(t,e)=>{const n=Math.max(t,e)/2;return[["M",0,0],["A",n,n,0,1,0,2*n,0],["A",n,n,0,1,0,0,0],["Z"]]},diamond:(t,e)=>[["M",0,0],["L",t/2,-e/2],["L",t,0],["L",t/2,e/2],["Z"]],rect:(t,e)=>[["M",0,-e/2],["L",t,-e/2],["L",t,e/2],["L",0,e/2],["Z"]],simple:(t,e)=>[["M",t,-e/2],["L",0,0],["L",t,e/2]],triangle:ph,triangleRect:(t,e)=>{const n=t/2,r=t/7,i=t-r;return[["M",0,0],["L",n,-e/2],["L",n,e/2],["Z"],["M",i,-e/2],["L",i+r,-e/2],["L",i+r,e/2],["L",i,e/2],["Z"]]},vee:(t,e)=>[["M",0,0],["L",t,-e/2],["L",2*t/3,0],["L",t,e/2],["Z"]]});class mh extends Al{type="edge";static defaultStyleProps={isBillboard:!0,label:!0,labelAutoRotate:!0,labelIsBillboard:!0,labelMaxWidth:"80%",labelOffsetX:4,labelOffsetY:0,labelPlacement:"center",labelTextBaseline:"middle",labelWordWrap:!1,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloPointerEvents:"none",haloStrokeOpacity:.25,haloZIndex:-1,startArrow:!1,startArrowAnchor:"0.5 0.5",startArrowSize:8,startArrowLineDash:0,startArrowLineWidth:1,startArrowTransformOrigin:"center",startArrowType:"triangle",endArrow:!1,endArrowAnchor:"0.5 0.5",endArrowSize:8,endArrowLineDash:0,endArrowLineWidth:1,endArrowTransformOrigin:"center",endArrowType:"triangle",loopPlacement:"top",loopClockwise:!0};constructor(t){super(re({},{style:mh.defaultStyleProps},t))}getKeyStyle(t){const{sourceNode:e,targetNode:n,color:r,stroke:i,...o}=this.getGraphicStyle(t);var a,s;return{path:(s=n,(a=e)&&s&&a===s?this.getLoopPath(t):this.getKeyPath(t)),...qu(o,["halo","label","startArrow","endArrow"]),stroke:r||i}}getLoopPath(t){const{sourceNode:e,sourcePort:n,targetPort:r}=t,i=Cu(e),o=Math.max(Mu(i),Nu(i)),{placement:a,clockwise:s,dist:c=o}=Uu(this.getGraphicStyle(t),"loop");return hh(e,a,s,c,n,r)}getEndpoints(t){const{sourceNode:e,targetNode:n,sourcePort:r,targetPort:i}=t,[o,a]=Oh(e,n,r,i);return[Rh(o||e,a||n),Rh(a||n,o||e)]}getHaloStyle(t){if(!1===t.halo)return!1;return{...this.getKeyStyle(t),...Uu(this.getGraphicStyle(t),"halo")}}getLabelStyle(t){if(!1===t.label||oe(t.labelText))return!1;const e=Uu(this.getGraphicStyle(t),"label"),{placement:n,offsetX:r,offsetY:i,autoRotate:o,maxWidth:a,...s}=e,c=function(t,e,n,r,i){let o="number"==typeof e?e:.5;"start"===e&&(o=0),"end"===e&&(o=.99);const a=ul(t.getPoint(o)),s=ul(t.getPoint(o+.01));let c="start"===e?"left":"end"===e?"right":"center";if(fl(a,s)||!n){const[e,n]=oh(t,o,r,i);return{x:e,y:n,textAlign:c}}let u=Math.atan2(s[1]-a[1],s[0]-a[0]);s[0]<a[0]&&(c="center"===c?c:"left"===c?"right":"left",r*=-1,u+=Math.PI);const[l,h]=oh(t,o,r,i,u);return{x:l,y:h,textAlign:c,transform:`rotate(${u/Math.PI*180}deg)`}}(this.shapeMap.key,n,o,r,i),u=this.shapeMap.key.getLocalBounds(),l=function(t,e,n=1){return El(Ju(t[0],t[1])*n,e)}([u.min,u.max],a);return Object.assign({wordWrapWidth:l},c,s)}drawArrow(t,e){const n="start"===e,r=t["start"===e?"startArrow":"endArrow"],i=this.shapeMap.key;if(r){const e=this.getArrowStyle(t,n),r=oe(e.src)?js:Is,[o,a,s]=n?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],c=i.style[o];c?c.attr(e):i.style[o]=new r({style:e}),i.style[a]=t[s]||e.width/2+ +e.lineWidth}else{const t=n?"markerStart":"markerEnd";i.style[t]?.destroy(),i.style[t]=null}}getArrowStyle(t,e){const n=this.getKeyStyle(t),r=e?"startArrow":"endArrow",{size:i,type:o,...a}=Uu(this.getGraphicStyle(t),r),[s,c]=Lu(i),u=(kt(o)?o:gh[o]||ph)(s,c);return{...n,width:s,height:c,...u&&{path:u,fill:"simple"===o?"":n.stroke},...a}}drawLabelShape(t,e){this.upsert("label",Ol,this.getLabelStyle(t),e)}drawHaloShape(t,e){this.upsert("halo",js,this.getHaloStyle(t),e)}drawKeyShape(t,e){return this.upsert("key",js,this.getKeyStyle(t),e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e)&&(this.drawArrow(t,"start"),this.drawArrow(t,"end"),this.drawLabelShape(t,e),this.drawHaloShape(t,e))}onCreate(){}onUpdate(){}onDestroy(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>{this.drawLabelShape(this.parsedAttributes,this)}),n}}class vh extends mh{static defaultStyleProps={curvePosition:.5,curveOffset:20};constructor(t){super(re({},{style:vh.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:r,curvePosition:i,curveOffset:o}=t,a=this.getControlPoints(e,n,function(t){return Wt(t)?[t,1-t]:t}(i),function(t){return Wt(t)?[t,-t]:t}(o),r);return sh(e,n,a)}getControlPoints(t,e,n,r,i){return 2===i?.length?i:[ah(t,e,n[0],r[0]),ah(t,e,n[1],r[1])]}}class yh extends vh{static defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};constructor(t){super(re({},{style:yh.defaultStyleProps},t))}getControlPoints(t,e,n,r){const i=e[0]-t[0];return[[t[0]+i*n[0]+r[0],t[1]],[e[0]-i*n[1]+r[1],e[1]]]}}class bh extends vh{static defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};constructor(t){super(re({},{style:bh.defaultStyleProps},t))}getControlPoints(t,e,n,r){const i=e[1]-t[1];return[[t[0],t[1]+i*n[0]+r[0]],[e[0],e[1]-i*n[1]+r[1]]]}}class xh extends mh{static defaultStyleProps={};constructor(t){super(re({},{style:xh.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}}class Eh extends mh{static defaultStyleProps={radius:0,controlPoints:[],router:!1,routerName:"orth",routerPadding:10};constructor(t){super(re({},{style:Eh.defaultStyleProps},t))}getKeyPath(t){const{sourceNode:e,targetNode:n,radius:r}=t,{sourcePoint:i,targetPoint:o,sourcePort:a,targetPort:s}=this.getEndpointsAndPorts(t),c=this.getControlPoints(t,i,o),u=Rh(a||e,c[0]||s||n),l=Rh(s||n,c[c.length-1]||a||e);return ch([u,...c,l],r)}getEndpointsAndPorts(t){const{sourceNode:e,targetNode:n,sourcePort:r,targetPort:i}=t,[o,a]=Oh(e,n,r,i);return{sourcePoint:o?Ah(o):e.getCenter(),targetPoint:a?Ah(a):n.getCenter(),sourcePort:o,targetPort:a}}getControlPoints(t,e,n){const{controlPoints:r,sourceNode:i,targetNode:o,router:a,routerPadding:s}=t;if(!a)return[...r];return function(t,e,n,r,i,o){const a=[t,...i,e];let s=null;const c=[];for(let t=0,e=a.length;t<e-1;t++){const i=t+1,h=a[t],d=a[i],f=fl(u=h,l=d)||function(t,e){return t[0]===e[0]}(u,l);let p=null;0===t?i===e-1?n.intersects(r)?p=rh(h,d,n,r):f||(p=nh(h,d,n,r)):Pu(d,n)?p=rh(h,d,n,Cu(d,o),s):f||(p=th(h,d,n)):i===e-1?Pu(h,r)?p=rh(h,d,Cu(h,o),r,s):f||(p=eh(h,d,r,s)):f||(p=Jl(h,d,s)),p?(c.push(...p.points),s=p.direction):s=Zl(h,d),i<e-1&&c.push(d)}var u,l;return c}(e,n,Cu(i,s),Cu(o,s),r,s)}getLoopPath(t){const{sourceNode:e,sourcePort:n,targetPort:r,radius:i}=t,o=Cu(e),a=Math.max(Mu(o),Nu(o))/4,{placement:s,clockwise:c,dist:u=a}=Uu(this.getGraphicStyle(t),"loop");return dh(e,i,s,c,u,n,r)}}class wh extends mh{static defaultStyleProps={curvePosition:.5,curveOffset:30};constructor(t){super(re({},{style:wh.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[r,i]=this.getEndpoints(t);return function(t,e,n){return[["M",t[0],t[1]],["Q",n[0],n[1],e[0],e[1]]]}(r,i,t.controlPoint||ah(r,i,e,n))}}function Mh(t){return t instanceof Dl&&"node"===t.type}function Nh(t){return t instanceof mh}function Sh(t){return t instanceof ql}const Ch={top:[.5,0],right:[1,.5],bottom:[.5,1],left:[0,.5],default:[.5,.5]};function Th(t,e,n=Ch,r=!0){const i=[.5,.5],o=Bt(e)?se(n,e.toLocaleLowerCase(),i):e;if(!r&&Bt(e))return o;const[a,s]=o||i;return[t.min[0]+Mu(t)*a,t.min[1]+Nu(t)*s]}function kh(t){const e=t.getPorts();return(t.attributes.ports||[]).forEach(((n,r)=>{const{key:i,placement:o}=n;Ph(n)&&(e[i||r]||=Du(t.getKey().getBounds(),o))})),e}function Ph(t){const{r:e}=t;return!e||0===Number(e)}function Ah(t){return xu(t)?t:t.getPosition()}function Oh(t,e,n,r){return[_h(t,e,n,r),_h(e,t,r,n)]}function _h(t,e,n,r){const i=kh(t);if(n)return i[n];const o=Object.values(i);if(0===o.length)return;const a=o.map((t=>Ah(t))),s=function(t,e){const n=kh(t);if(e)return[Ah(n[e])];const r=Object.values(n);return r.length>0?r.map((t=>Ah(t))):[t.getCenter()]}(e,r),[c]=function(t,e){let n=1/0,r=[t[0],e[0]];return t.forEach((t=>{e.forEach((e=>{const i=Ju(t,e);i<n&&(n=i,r=[t,e])}))})),r}(a,s);return o.find((t=>Ah(t)===c))}function Rh(t,e){return Mh(t)?Ih(t,e):Dh(t,e)}function Dh(t,e){if(xu(t))return t;if(t.attributes.linkToCenter)return t.getPosition();return vl(xu(e)?e:Mh(e)?e.getCenter():e.getPosition(),t.getBounds())}function Ih(t,e){const n=xu(e)?e:Mh(e)?e.getCenter():e.getPosition();return t.getIntersectPoint(n)||t.getCenter()}function Lh(t,e="bottom",n=!1){const r=e.split("-"),[i,o]=Du(t,e),a=r.includes("left")?"right":r.includes("right")?"left":"center";let s=r.includes("top")?"bottom":r.includes("bottom")?"top":"middle";return n&&(s="top"===s?"bottom":"bottom"===s?"top":s),{x:i,y:o,textBaseline:s,textAlign:a}}function jh(t,e){"update"in t?t.update(e):t.attr(e)}function zh(t,e){if(Array.isArray(t)&&0===t.length)return null;const n=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t.slice(1):e||[];return new Proxy(n,{get:(t,e)=>"function"!=typeof t[e]||["onframe","onfinish"].includes(e)?"finished"===e?Promise.all([n.finished,...r.map((t=>t.finished))]):Reflect.get(t,e):(...n)=>{t[e](...n),r.forEach((t=>t[e]?.(...n)))},set:(t,e,n)=>(["onframe","onfinish"].includes(e)||r.forEach((t=>{t[e]=n})),Reflect.set(t,e,n))})}function Bh(t){const e=t.reduce(((t,e)=>(Object.entries(e).forEach((([e,n])=>{void 0===t[e]?t[e]=[n]:t[e].push(n)})),t)),{});return Object.entries(e).forEach((([n,r])=>{(r.length!==t.length||r.some((t=>Pt(t)))||r.every((t=>!Mh(t)&&ae(t,r[0]))))&&delete e[n]})),Object.entries(e).reduce(((t,[e,n])=>(n.forEach(((n,r)=>{t[r]?t[r][e]=n:t[r]={[e]:n}})),t)),[])}function Fh(t){switch(t){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;case"visibility":return"visible";case"collapsed":return!1;case"states":return[];default:return}}function Gh(t,e){return e.before?.(),t?(e.beforeAnimate?.(t),t.finished.then((()=>{e.afterAnimate?.(t),e.after?.()}))):e.after?.(),t}function Vh(t,e){const{animation:n}=t;if(!n||!1===e)return!1;const r={...su};return Rt(n)&&Object.assign(r,n),Rt(e)&&Object.assign(r,e),r}const Wh=(t,e,n,r)=>{if(!e)return null;const{animationsFilter:i=(()=>!0)}=r,o=(Bt(e)?iz("animation",e)||[]:e).filter(i);if(0===o.length)return null;const{originalStyle:a,modifiedStyle:s,states:c}=r,u=e=>{if(e){const n=t.getElementById(e),r=`get${function(t){var e=$t(t);return e.charAt(0).toUpperCase()+e.substring(1)}(e)}Style`,i=t?.[r]?.bind(t)||(t=>t);return{shape:n,fromStyle:i?.({...t.attributes,...a})||{},toStyle:{...n.attributes}}}return{shape:t,fromStyle:a,toStyle:{...t.attributes,...s}}};let l;const h=o.map((({fields:t,shape:e,states:r,...i})=>{if(void 0===r||r?.some((t=>c.includes(t)))){const{shape:r,fromStyle:o,toStyle:a}=u(e);if(!r)return null;const s=[{},{}];t.forEach((t=>{Object.assign(s[0],{[t]:o[t]??Fh(t)}),Object.assign(s[1],{[t]:a[t]??Fh(t)})}));const c=function(t,e,n){if(0===e.length)return null;const r=["opacity"],i=e.some((t=>Object.keys(t).some((t=>r.includes(t)))));if(!i)return t.animate(e,n);const o=e.map((t=>{const e={};return Object.entries(t).forEach((([t,n])=>{r.includes(t)&&(e[t]=n)})),e})),a=kl(t);return zh(t.animate(e,n),a.map((t=>t.animate(o,n))))}(r,Bh(s),{...cu,...n,...i});return void 0===e&&(l=c),c}return null})).filter(Boolean),d=l||h?.[0];return d?zh(d,h.filter((t=>t!==d))):null};function Uh(t,e,n){const r=new Map(t.map((t=>[n(t),t]))),i=new Map(e.map((t=>[n(t),t]))),o=new Set(r.keys()),a=new Set(i.keys()),s=[],c=[],u=[],l=[];return a.forEach((t=>{o.has(t)?ae(r.get(t),i.get(t))?l.push(i.get(t)):c.push(i.get(t)):s.push(i.get(t))})),o.forEach((t=>{a.has(t)||u.push(r.get(t))})),{enter:s,exit:u,keep:l,update:c}}class Hh{context;extensions=[];extensionMap={};constructor(t){this.context=t}setExtensions(t){const e=function(t,e){const n={},r=e=>(e in n||(n[e]=0),`${t}-${e}-${n[e]++}`);return e.map((t=>"string"==typeof t?{type:t,key:r(t)}:t.key?t:{...t,key:r(t.type)}))}(this.category,t),{enter:n,update:r,exit:i,keep:o}=Uh(this.extensions,e,(t=>t.key));this.createExtensions(n),this.updateExtensions([...r,...o]),this.destroyExtensions(i),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:r}=t,i=iz(e,r);if(!i)return;const o=new i(this.context,t);this.extensionMap[n]=o}createExtensions(t){t.forEach((t=>this.createExtension(t)))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach((t=>this.updateExtension(t)))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach((({key:t})=>this.destroyExtension(t)))}destroy(){Object.values(this.extensionMap).forEach((t=>t.destroy())),this.context={},this.extensions=[],this.extensionMap={}}}class qh{context;options;events=[];destroyed=!1;constructor(t,e){this.context=t,this.options=e}update(t){this.options=Object.assign(this.options,t)}destroy(){this.context={},this.options={},this.destroyed=!0}}class $h extends qh{}function Yh(t,e,n){const r=t.getElementRenderBounds(e);return!!r&&ml(r.center,n)}function Kh(t,e){return[t,[t[0],e[1]],e,[e[0],t[1]]]}const Xh=(t,e)=>{const n={},r=t.getData();return Object.values(r).forEach((r=>{r.map((r=>{const i=t.getElementState(r.id);n[r.id]=kt(e)?e(r.id,i):i}))})),n},Zh=t=>t.map((t=>Bt(t)?t.toLocaleLowerCase():t));class Qh{map=new Map;emitter;recordKey=new Set;constructor(t){this.emitter=t,this.bindEvents()}bind(t,e){0!==t.length&&this.map.set(t,e)}unbind(t,e){this.map.forEach(((n,r)=>{ae(r,t)&&(e&&e!==n||this.map.delete(r))}))}unbindAll(){this.map.clear()}match(t){const e=Zh(Array.from(this.recordKey)).sort(),n=Zh(t).sort();return ae(e,n)}bindEvents(){const{emitter:e}=this;e.on(t.CommonEvent.KEY_DOWN,this.onKeyDown),e.on(t.CommonEvent.KEY_UP,this.onKeyUp),e.on(t.CommonEvent.WHEEL,this.onWheel),e.on(t.CommonEvent.DRAG,this.onDrag)}onKeyDown=t=>{t?.key&&(this.recordKey.add(t.key),this.trigger(t))};onKeyUp=t=>{t?.key&&this.recordKey.delete(t.key)};trigger(t){this.map.forEach(((e,n)=>{this.match(n)&&e(t)}))}triggerExtendKey(t,e){this.map.forEach(((n,r)=>{r.includes(t)&&ae(Array.from(this.recordKey),r.filter((e=>e!==t)))&&n(e)}))}onWheel=e=>{this.triggerExtendKey(t.CommonEvent.WHEEL,e)};onDrag=e=>{this.triggerExtendKey(t.CommonEvent.DRAG,e)};destroy(){this.unbindAll(),this.emitter.off(t.CommonEvent.KEY_DOWN,this.onKeyDown),this.emitter.off(t.CommonEvent.KEY_UP,this.onKeyUp),this.emitter.off(t.CommonEvent.WHEEL,this.onWheel),this.emitter.off(t.CommonEvent.DRAG,this.onDrag)}}const Jh={lineWidth:1,color:"#EEF6FF",stroke:"#DDEEFE",fillOpacity:.4,zIndex:2};class td extends $h{static defaultOptions={enable:!0,trigger:["drag"],immediately:!1,state:"selected",mode:"default",animation:!1,enableElements:["node","combo","edge"],style:{size:0,type:"rect",...Jh,pointerEvents:"none"}};startPoint;endPoint;rectShape;shortcut;selectElementFn=Yh;constructor(t,e){super(t,Object.assign({},td.defaultOptions,e)),this.shortcut=new Qh(t.graph),"lasso-select"!==e.type&&this.bindEvents()}pointerDown=async t=>{if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{style:e,trigger:n}=this.options,r=Array.isArray(n)?n:[n];if("canvas"!==t.targetType&&r.includes("drag"))return;const{canvas:i}=this.context;this.rectShape=new Fs({id:"g6-brush-select-rect-id",style:{...td.defaultOptions.style,fill:e.color||Jh.color,...e,pointerEvents:"none"}}),i.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]};pointerMove=async t=>{if(!this.startPoint)return;const{immediately:e,mode:n}=this.options;this.endPoint=[t.canvas.x,t.canvas.y],this.rectShape?.attr({x:Math.min(this.endPoint[0],this.startPoint[0]),y:Math.min(this.endPoint[1],this.startPoint[1]),width:Math.abs(this.endPoint[0]-this.startPoint[0]),height:Math.abs(this.endPoint[1]-this.startPoint[1])}),e&&"default"===n&&this.updateElementState(Kh(this.startPoint,this.endPoint))};pointerUp=async t=>{if(!this.startPoint)return;if(!this.endPoint)return void await this.clearBrush();const e=Kh(this.startPoint,[t.canvas.x,t.canvas.y]);this.updateElementState(e),await this.clearBrush()};clearSelected=()=>{if(this.endPoint)return;const{graph:t}=this.context,e=Xh(t,(()=>[]));t.setElementState(e,this.options.animation)};updateElementState=t=>{const{graph:e}=this.context,{enableElements:n,state:r,mode:i,onSelect:o}=this.options,a=this.getPointsSelectIds(e,t,n);let s=(t,e)=>a.includes(t)?[r]:[];switch(i){case"union":s=(t,e)=>a.includes(t)?[r]:e;break;case"diff":s=(t,e)=>a.includes(t)?e.includes(r)?[]:[r]:e;break;case"intersect":s=(t,e)=>a.includes(t)?e.includes(r)?[r]:[]:e}let c=Xh(e,s);n.includes("edge")&&((t,e,n)=>{t.getEdgeData().forEach((({id:t,target:r,source:i})=>{t&&(e[r].includes(n)&&e[i].includes(n)?e[t]=[n]:e[t]=[])}))})(e,c,r),kt(o)&&(c=o(c)),e.setElementState(c,this.options.animation)};clearBrush=async()=>{this.rectShape?.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0};getPointsSelectIds=(t,e,n)=>{const r=[],i=[];return n.includes("node")&&t.getNodeData().forEach((n=>{const{id:i}=n;"hidden"!==t.getElementVisibility(i)&&this.selectElementFn(t,i,e)&&r.push(i)})),n.includes("combo")&&t.getComboData().forEach((n=>{const{id:r}=n;"hidden"!==t.getElementVisibility(r)&&this.selectElementFn(t,r,e)&&i.push(r)})),[...r,...i]};isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return!(0!==e.length&&!e.includes("drag"))||this.shortcut?.match(e)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return kt(e)?e(t):!!e}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),e.on(t.CommonEvent.POINTER_DOWN,this.pointerDown),e.on(t.CommonEvent.POINTER_MOVE,this.pointerMove),e.on(t.CommonEvent.POINTER_UP,this.pointerUp),e.on(`canvas:${t.CommonEvent.CLICK}`,this.clearSelected)}unbindEvents(){const{graph:e}=this.context;e.off(t.CommonEvent.POINTER_DOWN,this.pointerDown),e.off(t.CommonEvent.POINTER_MOVE,this.pointerMove),e.off(t.CommonEvent.POINTER_UP,this.pointerUp),e.off(`canvas:${t.CommonEvent.CLICK}`,this.clearSelected)}destroy(){this.unbindEvents(),super.destroy()}}function ed(t,e,n,r,i=0){"TB"===r&&e(t,i);const o=n(t);if(o)for(const t of o)ed(t,e,n,r,i+1);"BT"===r&&e(t,i)}function nd(t,e,n,r){if("combo"===e||"node"===e)return rd(t,n,r);const i=t.getEdgeData(n);if(!i)return[];const o=rd(t,i.source,r-1),a=rd(t,i.target,r-1);return Array.from(new Set([...o,...a,n]))}function rd(t,e,n){const r=new Set,i=new Set,o=new Set;return function(t,e,n){const r=[[t,0]];for(;r.length;){const[t,i]=r.shift();e(t,i);const o=n(t);if(o)for(const t of o)r.push([t,i+1])}}(e,((e,r)=>{r>n||(o.add(e),t.getRelatedEdgesData(e).forEach((t=>{const e=Fu(t);!i.has(e)&&r<n&&(o.add(e),i.add(e))})))}),(e=>t.getRelatedEdgesData(e).map((t=>t.source===e?t.target:t.source)).filter((t=>!r.has(t)&&(r.add(t),!0))))),Array.from(o)}class id extends $h{selectedElementIds=[];shortcut;static defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],selectedState:"selected",unselectedState:void 0,degree:0};constructor(t,e){super(t,Object.assign({},id.defaultOptions,e)),this.shortcut=new Qh(t.graph),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),Ll.forEach((n=>{e.on(`${n}:${t.CommonEvent.CLICK}`,this.onClickElement)})),e.on(`canvas:${t.CommonEvent.CLICK}`,this.onClickCanvas)}onClickElement=t=>{this.validate(t)&&(this.updateElementsState(t,!1),this.updateElementsState(t,!0))};onClickCanvas=t=>{this.validate(t)&&(this.updateElementsState(t,!1),this.selectedElementIds=[])};updateElementsState=(t,e)=>{if(!this.options.selectedState&&!this.options.unselectedState)return;const{graph:n}=this.context,{targetType:r,target:i}=t;if(e)if(this.selectedElementIds.includes(i.id))this.selectedElementIds=this.selectedElementIds.filter((t=>t!==i.id));else{const t=nd(n,r,i.id,this.options.degree);this.options.multiple&&this.shortcut.match(this.options.trigger)?this.selectedElementIds.push(...t):this.selectedElementIds=t}if(!this.selectedElementIds.length)return;const o={};if(this.options.selectedState&&Object.assign(o,this.getElementsState(this.selectedElementIds,this.options.selectedState,e)),this.options.unselectedState){const t=Vu(n.getData(),!0).filter((t=>!this.selectedElementIds.includes(t)));Object.assign(o,this.getElementsState(t,this.options.unselectedState,e))}n.setElementState(o,this.options.animation)};getElementsState=(t,e,n)=>{const{graph:r}=this.context,i={};return t.forEach((t=>{const o=r.getElementState(t),a=n?[...o,e]:o.filter((t=>t!==e));i[t]=a})),i};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return kt(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;Ll.forEach((n=>{e.off(`${n}:${t.CommonEvent.CLICK}`,this.onClickElement)})),e.off(`canvas:${t.CommonEvent.CLICK}`,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}class od extends $h{static defaultOptions={enable:!0,animation:!0};constructor(t,e){super(t,Object.assign({},od.defaultOptions,e)),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),e.on(`combo:${t.CommonEvent.DBLCLICK}`,this.onCollapseExpand)}unbindEvents(){const{graph:e}=this.context;e.off(`combo:${t.CommonEvent.DBLCLICK}`,this.onCollapseExpand)}onCollapseExpand=async t=>{if(!this.validate(t))return;const{target:e}=t;if(!(Mh(n=e)||Nh(n)||Sh(n)))return;var n;const r=e.id,{model:i,graph:o}=this.context,a=i.getComboData([r])[0];if(!a)return!1;const{onCollapse:s,onExpand:c,animation:u}=this.options,l=a.style?.collapsed;l?(await o.expand(r,u),c?.(r)):(await o.collapse(r,u),s?.(r))};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return kt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}const ad="g6-create-edge-assist-node-id";class sd extends $h{static defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:t=>t,onFinish:()=>{}};source;constructor(t,e){super(t,Object.assign({},sd.defaultOptions,e)),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:e}=this.context,{trigger:n}=this.options;this.unbindEvents(),"click"===n?(e.on(`node:${t.CommonEvent.CLICK}`,this.handleCreateEdge),e.on(`combo:${t.CommonEvent.CLICK}`,this.handleCreateEdge),e.on(`canvas:${t.CommonEvent.CLICK}`,this.cancelEdge),e.on(`edge:${t.CommonEvent.CLICK}`,this.cancelEdge)):(e.on(`node:${t.CommonEvent.DRAG_START}`,this.handleCreateEdge),e.on(`combo:${t.CommonEvent.DRAG_START}`,this.handleCreateEdge),e.on(t.CommonEvent.POINTER_UP,this.drop)),e.on(t.CommonEvent.POINTER_MOVE,this.updateAssistEdge)}drop=async t=>{const{targetType:e}=t;["combo","node"].includes(e)&&this.source?await this.handleCreateEdge(t):await this.cancelEdge()};handleCreateEdge=async t=>{if(!this.validate(t))return;const{graph:e,canvas:n}=this.context,{style:r}=this.options;if(this.source)return this.createEdge(t),void await this.cancelEdge();n.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([t.target.id])[0],e.addNodeData([{id:ad,style:{visibility:"hidden",ports:[{key:"port-1",placement:[.5,.5]}]}}]),e.addEdgeData([{id:"g6-create-edge-assist-edge-id",source:this.source,target:ad,style:{pointerEvents:"none",...r}}])};updateAssistEdge=async t=>{if(!this.source)return;const{model:e,element:n}=this.context;e.translateNodeTo(ad,[t.canvas.x,t.canvas.y]),await n.draw({animation:!1,silence:!0})};createEdge=t=>{const{graph:e}=this.context,{style:n,onFinish:r,onCreate:i}=this.options,o=t.target?.id;if(void 0===o||void 0===this.source)return;const a=this.getSelectedNodeIDs([t.target.id])?.[0];var s;const c=i({id:`${this.source}-${a}-${de[s=s||"g"]?de[s]+=1:de[s]=1,s+de[s]}`,source:this.source,target:a,style:n});e.addEdgeData([c]),r(c)};cancelEdge=async()=>{if(!this.source)return;const{graph:t,element:e,canvas:n}=this.context;n.setCursor("default"),t.removeNodeData([ad]),this.source=void 0,await e.draw({animation:!1,silence:!0})};getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map((t=>t.id)).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return kt(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;e.off(`node:${t.CommonEvent.CLICK}`,this.handleCreateEdge),e.off(`combo:${t.CommonEvent.CLICK}`,this.handleCreateEdge),e.off(`canvas:${t.CommonEvent.CLICK}`,this.cancelEdge),e.off(`edge:${t.CommonEvent.CLICK}`,this.cancelEdge),e.off(`node:${t.CommonEvent.DRAG_START}`,this.handleCreateEdge),e.off(`combo:${t.CommonEvent.DRAG_START}`,this.handleCreateEdge),e.off(t.CommonEvent.POINTER_UP,this.drop),e.off(t.CommonEvent.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}class cd extends $h{static defaultOptions={enable:!0,sensitivity:10};shortcut;defaultCursor;constructor(t,e){super(t,Object.assign({},cd.defaultOptions,e)),this.shortcut=new Qh(t.graph),this.bindEvents(),this.defaultCursor=this.context.canvas.getConfig().cursor||"default",t.canvas.setCursor("grab")}bindEvents(){const{trigger:e}=this.options;this.shortcut.unbindAll();const{graph:n}=this.context;if(Rt(e)){n.off(t.CanvasEvent.DRAG,this.onDrag);const{up:r=[],down:i=[],left:o=[],right:a=[]}=e;this.shortcut.bind(r,(t=>this.onTranslate([0,1],t))),this.shortcut.bind(i,(t=>this.onTranslate([0,-1],t))),this.shortcut.bind(o,(t=>this.onTranslate([1,0],t))),this.shortcut.bind(a,(t=>this.onTranslate([-1,0],t)))}else n.on(t.CanvasEvent.DRAG,this.onDrag)}onDrag=t=>{this.validate(t)&&"canvas"===t.targetType&&(this.translate([t.movement.x,t.movement.y],!1),this.options.onFinish?.())};async onTranslate(t,e){if(!this.validate(e))return;const{sensitivity:n}=this.options,r=-1*n;await this.translate(Xu(t,r),this.options.animation),this.options.onFinish?.()}async translate(t,e){await this.context.graph.translateBy(t,e)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return kt(e)?e(t):!!e}destroy(){this.shortcut.destroy(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}class ud extends $h{static defaultOptions={animation:!0,enable:t=>["node","combo"].includes(t.targetType),dropEffect:"move",state:"selected",hideEdge:"none",shadowZIndex:100,shadowFill:"#F3F9FF",shadowFillOpacity:.5,shadowStroke:"#1890FF",shadowStrokeOpacity:.9,shadowLineDash:[5,5]};enable=!1;enableElements=["node","combo"];target=[];shadow;shadowOrigin=[0,0];hiddenEdges=[];get animation(){return!!this.options.shadow&&this.options.animation}constructor(t,e){super(t,Object.assign({},ud.defaultOptions,e)),this.onDragStart=this.onDragStart.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.onDrop=this.onDrop.bind(this),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),this.enableElements.forEach((n=>{e.on(`${n}:${t.CommonEvent.DRAG_START}`,this.onDragStart),e.on(`${n}:${t.CommonEvent.DRAG}`,this.onDrag),e.on(`${n}:${t.CommonEvent.DRAG_END}`,this.onDragEnd)})),["link"].includes(this.options.dropEffect)&&(e.on(`combo:${t.CommonEvent.DROP}`,this.onDrop),e.on(`canvas:${t.CommonEvent.DROP}`,this.onDrop))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map((t=>t.id)).concat(t)))}getDelta(t){const e=this.context.graph.getZoom();return Zu([t.dx,t.dy],e)}onDragStart(t){this.enable=this.validate(t),this.enable&&(this.context.batch?.startBatch(),this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target))}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.options.shadow?this.moveShadow(e):this.moveElement(this.target,e)}onDragEnd(){if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:t=0,y:e=0}=this.shadow.attributes,[n,r]=Ku([+t,+e],this.shadowOrigin);this.moveElement(this.target,[n,r])}this.showEdges(),this.options.onFinish?.(this.target),this.context.batch?.endBatch(),this.target=[]}onDrop=async t=>{if("link"!==this.options.dropEffect)return;const{model:e,element:n}=this.context,r=t.target.id;this.target.forEach((t=>{const n=e.getParentData(t,mu);n&&Fu(n)===r&&e.refreshComboData(r),e.setParent(t,r,mu)})),await(n?.draw({animation:!0}))};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return kt(e)?e(t):!!e}async moveElement(t,e){const{model:n,element:r}=this.context,{dropEffect:i}=this.options;t.forEach((t=>{const r=n.getElementType(t);"node"===r?n.translateNodeBy(t,e):"combo"===r&&n.translateComboBy(t,e)})),"move"===i&&t.forEach((t=>n.refreshComboData(t))),await r.draw({animation:this.animation})}moveShadow(t){if(!this.shadow)return;const{x:e=0,y:n=0}=this.shadow.attributes,[r,i]=t;this.shadow.attr({x:+e+r,y:+n+i})}createShadow(t){const e=Uu(this.options,"shadow"),n=ku(t.map((t=>this.context.element.getElement(t).getBounds()))),[r,i]=n.min;this.shadowOrigin=[r,i];const[o,a]=Su(n),s={width:o,height:a,x:r,y:i};this.shadow?this.shadow.attr({...e,...s,visibility:"visible"}):(this.shadow=new Fs({style:{...e,...s,pointerEvents:"none",$layer:"transient"}}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||0===this.hiddenEdges.length||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if("none"===t||e)return;const{graph:n}=this.context;this.hiddenEdges="all"===t?n.getEdgeData().map(Fu):Array.from(new Set(this.target.map((e=>n.getRelatedEdgesData(e,t).map(Fu))).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:e}=this.context;this.enableElements.forEach((n=>{e.off(`${n}:${t.CommonEvent.DRAG_START}`,this.onDragStart),e.off(`${n}:${t.CommonEvent.DRAG}`,this.onDrag),e.off(`${n}:${t.CommonEvent.DRAG_END}`,this.onDragEnd)})),e.off(`combo:${t.CommonEvent.DROP}`,this.onDrop),e.off(`canvas:${t.CommonEvent.DROP}`,this.onDrop)}destroy(){this.unbindEvents(),this.shadow?.destroy(),super.destroy()}}const ld=["node","combo"];class hd extends $h{static defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0};constructor(t,e){super(t,Object.assign({},hd.defaultOptions,e)),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),ld.forEach((n=>{e.on(`${n}:${t.CommonEvent.CLICK}`,this.clickFocusElement)}))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map((t=>t.id)).concat(t)))}clickFocusElement=async t=>{if(!this.validate(t))return;const{animation:e}=this.options,{graph:n}=this.context,r=this.getSelectedNodeIDs([t.target.id]);await n.focusElement(r,e)};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return kt(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;ld.forEach((n=>{e.off(`${n}:${t.CommonEvent.CLICK}`,this.clickFocusElement)}))}destroy(){this.unbindEvents(),super.destroy()}}class dd extends $h{static defaultOptions={animation:!0,enable:!0,degree:0,activeState:"active",inactiveState:void 0};constructor(t,e){super(t,Object.assign({},dd.defaultOptions,e)),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),Ll.forEach((n=>{e.on(`${n}:${t.CommonEvent.POINTER_OVER}`,this.hoverElement),e.on(`${n}:${t.CommonEvent.POINTER_OUT}`,this.hoverEndElement)}))}hoverElement=t=>{this.validate(t)&&(this.updateElementsState(t,!0),this.options.onHover?.(t))};hoverEndElement=t=>{this.validate(t)&&(this.updateElementsState(t,!1),this.options.onHoverEnd?.(t))};updateElementsState=(t,e)=>{if(!this.options.activeState&&!this.options.inactiveState)return;const{graph:n}=this.context,{targetType:r,target:i}=t,o=nd(n,r,i.id,this.options.degree),a={};if(this.options.activeState&&Object.assign(a,this.getElementsState(o,this.options.activeState,e)),this.options.inactiveState){const t=Vu(n.getData(),!0).filter((t=>!o.includes(t)));Object.assign(a,this.getElementsState(t,this.options.inactiveState,e))}n.setElementState(a,this.options.animation)};getElementsState=(t,e,n)=>{const{graph:r}=this.context,i={};return t.forEach((t=>{const o=r.getElementState(t),a=n?[...o,e]:o.filter((t=>t!==e));i[t]=a})),i};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return kt(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;Ll.forEach((n=>{e.off(`${n}:${t.CommonEvent.POINTER_OVER}`,this.hoverElement),e.off(`${n}:${t.CommonEvent.POINTER_OUT}`,this.hoverEndElement)}))}destroy(){this.unbindEvents(),super.destroy()}}const fd=(t,e,n)=>{const r=t.getElementRenderBounds(e);if(!r)return!1;const i=[[r.min[0],r.min[1]],[r.max[0],r.min[1]],[r.max[0],r.max[1]],[r.min[0],r.max[1]]];return pd(n,i)},pd=(t,e)=>{const n=t=>{const e=t.map((t=>t[0])),n=t.map((t=>t[1]));return{min:[Math.min.apply(null,e),Math.min.apply(null,n),0],max:[Math.max.apply(null,e),Math.max.apply(null,n),0]}},r=t=>{const e=[],n=t.length;for(let r=0;r<n-1;r++){const n=t[r],i=t[r+1];e.push([n,i])}if(e.length>1){const r=t[0],i=t[n-1];e.push([i,r])}return e};if(t.length<2||e.length<2)return!1;const i=n(t),o=n(e);if(!gd(i,o))return!1;let a=!1;if(e.forEach((e=>{if(ml(e,t))return a=!0,!1})),a)return!0;if(t.forEach((t=>{if(ml(t,e))return a=!0,!1})),a)return!0;const s=r(t),c=r(e);let u=!1;return c.forEach((t=>{if(md(s,t))return u=!0,!1})),u},gd=(t,e)=>!!(e?.min&&t?.min&&e?.max&&t?.max)&&(e.min[0]<=t.max[0]&&e.max[0]>=t.min[0]&&e.min[1]<=t.max[1]&&e.max[1]>=t.min[1]),md=(t,e)=>{let n=!1;return t.forEach((t=>{if(t.length>1&&e.length>1&&cl(t,e))return n=!0,!1})),n};const vd={M:["x","y"],m:["dx","dy"],H:["x"],h:["dx"],V:["y"],v:["dy"],L:["x","y"],l:["dx","dy"],Z:[],z:[],C:["x1","y1","x2","y2","x","y"],c:["dx1","dy1","dx2","dy2","dx","dy"],S:["x2","y2","x","y"],s:["dx2","dy2","dx","dy"],Q:["x1","y1","x","y"],q:["dx1","dy1","dx","dy"],T:["x","y"],t:["dx","dy"],A:["rx","ry","rotation","large-arc","sweep","x","y"],a:["rx","ry","rotation","large-arc","sweep","dx","dy"]};function yd(t){const e=[],n="string"==typeof t?function(t){const e=t.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").trim().split(/\s*,|\s+/),n=[];let r="",i={};for(;e.length>0;){let t=e.shift();t in vd?r=t:e.unshift(t),i={type:r},vd[r].forEach((n=>{t=e.shift(),i[n]=t})),"M"===r?r="L":"m"===r&&(r="l");const[o,...a]=Object.values(i);n.push([o,...a.map(Number)])}return n}(t):t;return n.forEach((t=>{const n=t[0];if("Z"!==n)if("A"!==n)for(let n=1;n<t.length;n+=2)e.push([t[n],t[n+1],0]);else{const n=t.length;e.push([t[n-2],t[n-1],0])}else e.push(e[0])})),e}class bd extends td{static defaultOptions={...td.defaultOptions,style:Jh};points;pathShape;selectElementFn=fd;constructor(t,e){super(t,Object.assign({},bd.defaultOptions,e)),this.bindEvents()}pointerDown=async t=>{if(!this.validate(t)||!this.isKeydown()||this.points)return;const{style:e,trigger:n}=this.options,r=Array.isArray(n)?n:[n];if("canvas"!==t.targetType&&r.includes("drag"))return;const{canvas:i}=this.context;this.pathShape=new js({id:"g6-lasso-select-path-id",style:{...bd.defaultOptions.style,fill:e.color||Jh.color,...e,pointerEvents:"none"}}),i.appendChild(this.pathShape),this.points=[[t.canvas.x,t.canvas.y]]};pointerMove=async t=>{if(!this.points)return;const{immediately:e,mode:n}=this.options,{element:r}=this.context;this.points.push([t.canvas.x,t.canvas.y]),this.pathShape?.setAttribute("path",function(t,e=!0){const n=[];return t.forEach(((t,e)=>{n.push([0===e?"M":"L",...t])})),e&&n.push(["Z"]),n}(this.points)),e&&"default"===n&&this.lassoUpdateElementState(),await(r?.draw({animation:!1,silence:!0}))};pointerUp=async()=>{this.points&&(this.points.length<2||this.lassoUpdateElementState(),await this.clearLasso())};clearSelected=()=>{if(this.points)return;const{graph:t}=this.context,e=Xh(t,(()=>[]));t.setElementState(e,this.options.animation)};lassoUpdateElementState=()=>{!this.points||this.points?.length<2||this.updateElementState(this.points)};clearLasso=async()=>{this.pathShape?.remove(),this.pathShape=void 0,this.points=void 0}}class xd extends $h{static defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[]};shortcut;constructor(t,e){super(t,Object.assign({},xd.defaultOptions,e)),this.shortcut=new Qh(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:e}=this.options;if(this.shortcut.unbindAll(),_t(e)&&(this.preventDefault(t.CanvasEvent.WHEEL),this.shortcut.bind([...e,t.CanvasEvent.WHEEL],(t=>{const{deltaX:e,deltaY:n}=t;this.zoom(-(n??e),t,!1)}))),Rt(e)){const{zoomIn:t=[],zoomOut:n=[],reset:r=[]}=e;this.shortcut.bind(t,(t=>this.zoom(10,t,this.options.animation))),this.shortcut.bind(n,(t=>this.zoom(-10,t,this.options.animation))),this.shortcut.bind(r,this.onReset)}}zoom=async(t,e,n)=>{if(!this.validate(e))return;const{graph:r}=this.context;let i;"viewport"in e&&(i=ul(e.viewport));const{sensitivity:o,onFinish:a}=this.options,s=1+Vt(t,-50,50)*o/100,c=r.getZoom();await r.zoomTo(c*s,n,i),a?.()};onReset=async()=>{await this.context.graph.zoomTo(1,this.options.animation)};validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return kt(e)?e(t):!!e}preventDefault(t){const e=this.context.canvas.getContainer();e&&e.addEventListener(t,(t=>t.preventDefault()))}destroy(){this.shortcut.destroy(),super.destroy()}}var Ed=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},wd=function(t,e){return!!Ed(t)&&t.indexOf(e)>-1},Md=function(t,e){if(!Ed(t))return t;for(var n=[],r=0;r<t.length;r++){var i=t[r];e(i,r)&&n.push(i)}return n},Nd={}.toString,Sd=function(t,e){return Nd.call(t)==="[object "+e+"]"},Cd=function(t){return Sd(t,"Function")},Td=function(t){return null==t},kd=function(t){return Array.isArray?Array.isArray(t):Sd(t,"Array")},Pd=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Ad(t,e){if(t)if(kd(t))for(var n=0,r=t.length;n<r&&!1!==e(t[n],n);n++);else if(Pd(t))for(var i in t)if(t.hasOwnProperty(i)&&!1===e(t[i],i))break}var Od=Object.keys?function(t){return Object.keys(t)}:function(t){var e=[];return Ad(t,(function(n,r){Cd(t)&&"prototype"===r||e.push(r)})),e};function _d(t,e){var n=Od(e),r=n.length;if(Td(t))return!r;for(var i=0;i<r;i+=1){var o=n[i];if(e[o]!==t[o]||!(o in t))return!1}return!0}var Rd=function(t){return"object"==typeof t&&null!==t},Dd=function(t){if(!Rd(t)||!Sd(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var Id=function(t,e){if(void 0===e&&(e=[]),kd(t))for(var n=0;n<t.length;n+=1)Id(t[n],e);else e.push(t);return e},Ld=function(t){if(kd(t))return t.reduce((function(t,e){return Math.max(t,e)}),t[0])},jd=function(t){if(kd(t))return t.reduce((function(t,e){return Math.min(t,e)}),t[0])},zd=Array.prototype,Bd=zd.splice,Fd=zd.indexOf,Gd=Array.prototype.splice,Vd=function(t,e){if(!Ed(t))return[];for(var n=t?e.length:0,r=n-1;n--;){var i=void 0,o=e[n];n!==r&&o===i||(i=o,Gd.call(t,o,1))}return t},Wd=function(t,e,n){if(!kd(t)&&!Dd(t))return t;var r=n;return Ad(t,(function(t,n){r=e(r,t,n)})),r},Ud=function(t){return Sd(t,"String")};function Hd(t,e){void 0===e&&(e=new Map);var n=[];if(Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var o=t[r];e.has(o)||(n.push(o),e.set(o,!0))}return n}var qd=Object.prototype.hasOwnProperty;function $d(t,e){if(!e||!kd(t))return{};for(var n,r={},i=Cd(e)?e:function(t){return t[e]},o=0;o<t.length;o++){var a=t[o];n=i(a),qd.call(r,n)?r[n].push(a):r[n]=[a]}return r}function Yd(t,e){if(!e)return{0:t};if(!Cd(e)){var n=kd(e)?e:e.replace(/\s+/g,"").split("*");e=function(t){for(var e="_",r=0,i=n.length;r<i;r++)e+=t[n[r]]&&t[n[r]].toString();return e}}return $d(t,e)}var Kd={};var Xd=function(t){return Sd(t,"Number")},Zd=Number.isInteger?Number.isInteger:function(t){return Xd(t)&&t%1==0};var Qd=180/Math.PI,Jd=parseInt,tf=Math.PI/180,ef=function(t,e){return t.hasOwnProperty(e)},nf=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return Ad(t,(function(n,r){Cd(t)&&"prototype"===r||e.push(n)})),e},rf=function(t){return Td(t)?"":t.toString()};var of={}.toString,af=function(t){return of.call(t).replace(/^\[object /,"").replace(/]$/,"")};var sf=Object.prototype,cf=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||sf)};function uf(t,e){for(var n in e)e.hasOwnProperty(n)&&"constructor"!==n&&void 0!==e[n]&&(t[n]=e[n])}function lf(t,e,n,r){return e&&uf(t,e),n&&uf(t,n),r&&uf(t,r),t}var hf=function(t){if("object"!=typeof t||null===t)return t;var e;if(kd(t)){e=[];for(var n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=hf(t[n]):e[n]=t[n]}else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=hf(t[i]):e[i]=t[i];return e};var df=function(t,e){if(!Cd(t))throw new TypeError("Expected a function");var n=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0],a=n.cache;if(a.has(o))return a.get(o);var s=t.apply(this,r);return a.set(o,s),s};return n.cache=new Map,n};function ff(t,e,n,r){for(var i in n=n||0,r=r||5,e)if(e.hasOwnProperty(i)){var o=e[i];null!==o&&Dd(o)?(Dd(t[i])||(t[i]={}),n<r?ff(t[i],o,n+1,r):t[i]=e[i]):kd(o)?(t[i]=[],t[i]=t[i].concat(o)):void 0!==o&&(t[i]=o)}}var pf=Object.prototype.hasOwnProperty;var gf,mf=function(t,e){if(t===e)return!0;if(!t||!e)return!1;if(Ud(t)||Ud(e))return!1;if(Ed(t)||Ed(e)){if(t.length!==e.length)return!1;for(var n=!0,r=0;r<t.length&&(n=mf(t[r],e[r]));r++);return n}if(Rd(t)||Rd(e)){var i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(n=!0,r=0;r<i.length&&(n=mf(t[i[r]],e[i[r]]));r++);return n}return!1},vf=function(t){return t},yf=Object.prototype.hasOwnProperty,bf={};var xf=df((function(t,e){void 0===e&&(e={});var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return gf||(gf=document.createElement("canvas").getContext("2d")),gf.font=[o,a,i,n+"px",r].join(" "),gf.measureText(Ud(t)?t:"").width}),(function(t,e){return void 0===e&&(e={}),function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}([t],nf(e)).join("")})),Ef=function(){function t(){this.map={}}return t.prototype.has=function(t){return void 0!==this.map[t]},t.prototype.get=function(t,e){var n=this.map[t];return void 0===n?e:n},t.prototype.set=function(t,e){this.map[t]=e},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(t){delete this.map[t]},t.prototype.size=function(){return Object.keys(this.map).length},t}(),wf=Object.freeze({__proto__:null,Cache:Ef,assign:lf,augment:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=t[0],r=1;r<t.length;r++){var i=t[r];Cd(i)&&(i=i.prototype),lf(n.prototype,i)}},clamp:function(t,e,n){return t<e?e:t>n?n:t},clearAnimationFrame:function(t){(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout)(t)},clone:hf,contains:wd,debounce:function(t,e,n){var r;return function(){var i=this,o=arguments,a=n&&!r;clearTimeout(r),r=setTimeout((function(){r=null,n||t.apply(i,o)}),e),a&&t.apply(i,o)}},deepMix:function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)ff(t,e[r]);return t},difference:function(t,e){return void 0===e&&(e=[]),Md(t,(function(t){return!wd(e,t)}))},each:Ad,endsWith:function(t,e){return!(!kd(t)&&!Ud(t))&&t[t.length-1]===e},every:function(t,e){for(var n=0;n<t.length;n++)if(!e(t[n],n))return!1;return!0},extend:function(t,e,n,r){Cd(e)||(n=e,e=t,t=function(){});var i=Object.create?function(t,e){return Object.create(t,{constructor:{value:e}})}:function(t,e){function n(){}n.prototype=t;var r=new n;return r.constructor=e,r},o=i(e.prototype,t);return t.prototype=lf(o,t.prototype),t.superclass=i(e.prototype,e),lf(o,n),lf(t,r),t},filter:Md,find:function(t,e){if(!kd(t))return null;var n;if(Cd(e)&&(n=e),Dd(e)&&(n=function(t){return _d(t,e)}),n)for(var r=0;r<t.length;r+=1)if(n(t[r]))return t[r];return null},findIndex:function(t,e,n){void 0===n&&(n=0);for(var r=n;r<t.length;r++)if(e(t[r],r))return r;return-1},firstValue:function(t,e){for(var n=null,r=0;r<t.length;r++){var i=t[r][e];if(!Td(i)){n=kd(i)?i[0]:i;break}}return n},fixedBase:function(t,e){var n=e.toString(),r=n.indexOf(".");if(-1===r)return Math.round(t);var i=n.substr(r+1).length;return i>20&&(i=20),parseFloat(t.toFixed(i))},flatten:function(t){if(!kd(t))return[];for(var e=[],n=0;n<t.length;n++)e=e.concat(t[n]);return e},flattenDeep:Id,forIn:Ad,get:function(t,e,n){for(var r=0,i=Ud(e)?e.split("."):e;t&&r<i.length;)t=t[i[r++]];return void 0===t||r<i.length?n:t},getEllipsisText:function(t,e,n,r){void 0===r&&(r="...");var i,o,a=xf(r,n),s=Ud(t)?t:rf(t),c=e,u=[];if(xf(t,n)<=e)return t;for(;i=s.substr(0,16),!((o=xf(i,n))+a>c&&o>c);)if(u.push(i),c-=o,!(s=s.substr(16)))return u.join("");for(;i=s.substr(0,1),!((o=xf(i,n))+a>c);)if(u.push(i),c-=o,!(s=s.substr(1)))return u.join("");return""+u.join("")+r},getRange:function(t){var e=t.filter((function(t){return!isNaN(t)}));if(!e.length)return{min:0,max:0};if(kd(t[0])){for(var n=[],r=0;r<t.length;r++)n=n.concat(t[r]);e=n}var i=Ld(e);return{min:jd(e),max:i}},getType:af,getWrapBehavior:function(t,e){return t["_wrap_"+e]},group:function(t,e){if(!e)return[t];var n=Yd(t,e),r=[];for(var i in n)r.push(n[i]);return r},groupBy:$d,groupToMap:Yd,has:ef,hasKey:ef,hasValue:function(t,e){return wd(nf(t),e)},head:function(t){if(Ed(t))return t[0]},identity:function(t){return t},includes:wd,indexOf:function(t,e){if(!Ed(t))return-1;var n=Array.prototype.indexOf;if(n)return n.call(t,e);for(var r=-1,i=0;i<t.length;i++)if(t[i]===e){r=i;break}return r},isArguments:function(t){return Sd(t,"Arguments")},isArray:kd,isArrayLike:Ed,isBoolean:function(t){return Sd(t,"Boolean")},isDate:function(t){return Sd(t,"Date")},isDecimal:function(t){return Xd(t)&&t%1!=0},isElement:function(t){return t instanceof Element||t instanceof HTMLDocument},isEmpty:function(t){if(Td(t))return!0;if(Ed(t))return!t.length;var e=af(t);if("Map"===e||"Set"===e)return!t.size;if(cf(t))return!Object.keys(t).length;for(var n in t)if(pf.call(t,n))return!1;return!0},isEqual:mf,isEqualWith:function(t,e,n){return Cd(n)?!!n(t,e):mf(t,e)},isError:function(t){return Sd(t,"Error")},isEven:function(t){return Xd(t)&&t%2==0},isFinite:function(t){return Xd(t)&&isFinite(t)},isFunction:Cd,isInteger:Zd,isMatch:_d,isNegative:function(t){return Xd(t)&&t<0},isNil:Td,isNull:function(t){return null===t},isNumber:Xd,isNumberEqual:function(t,e,n){return void 0===n&&(n=1e-5),Math.abs(t-e)<n},isObject:Pd,isObjectLike:Rd,isOdd:function(t){return Xd(t)&&t%2!=0},isPlainObject:Dd,isPositive:function(t){return Xd(t)&&t>0},isPrototype:cf,isRegExp:function(t){return Sd(t,"RegExp")},isString:Ud,isType:Sd,isUndefined:function(t){return void 0===t},keys:Od,last:function(t){if(Ed(t)){return t[t.length-1]}},lowerCase:function(t){return rf(t).toLowerCase()},lowerFirst:function(t){var e=rf(t);return e.charAt(0).toLowerCase()+e.substring(1)},map:function(t,e){if(!Ed(t))return t;for(var n=[],r=0;r<t.length;r++){var i=t[r];n.push(e(i,r))}return n},mapValues:function(t,e){void 0===e&&(e=vf);var n={};return Pd(t)&&!Td(t)&&Object.keys(t).forEach((function(r){n[r]=e(t[r],r)})),n},max:Ld,maxBy:function(t,e){if(kd(t)){for(var n,r=-1/0,i=0;i<t.length;i++){var o=t[i],a=Cd(e)?e(o):o[e];a>r&&(n=o,r=a)}return n}},measureTextWidth:xf,memoize:df,min:jd,minBy:function(t,e){if(kd(t)){for(var n,r=1/0,i=0;i<t.length;i++){var o=t[i],a=Cd(e)?e(o):o[e];a<r&&(n=o,r=a)}return n}},mix:lf,mod:function(t,e){return(t%e+e)%e},noop:function(){},number2color:function(t){var e=Kd[t];if(!e){for(var n=t.toString(16),r=n.length;r<6;r++)n="0"+n;e="#"+n,Kd[t]=e}return e},omit:function(t,e){return Wd(t,(function(t,n,r){return e.includes(r)||(t[r]=n),t}),{})},parseRadius:function(t){var e=0,n=0,r=0,i=0;return kd(t)?1===t.length?e=n=r=i=t[0]:2===t.length?(e=r=t[0],n=i=t[1]):3===t.length?(e=t[0],n=i=t[1],r=t[2]):(e=t[0],n=t[1],r=t[2],i=t[3]):e=n=r=i=t,{r1:e,r2:n,r3:r,r4:i}},pick:function(t,e){if(null===t||!Dd(t))return{};var n={};return Ad(e,(function(e){yf.call(t,e)&&(n[e]=t[e])})),n},pull:function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r++)for(var i=e[r],o=-1;(o=Fd.call(t,i))>-1;)Bd.call(t,o,1);return t},pullAt:Vd,reduce:Wd,remove:function(t,e){var n=[];if(!Ed(t))return n;for(var r=-1,i=[],o=t.length;++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return Vd(t,i),n},requestAnimationFrame:function(t){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return setTimeout(t,16)})(t)},set:function(t,e,n){var r=t,i=Ud(e)?e.split("."):e;return i.forEach((function(t,e){e<i.length-1?(Pd(r[t])||(r[t]=Xd(i[e+1])?[]:{}),r=r[t]):r[t]=n})),t},size:function(t){return Td(t)?0:Ed(t)?t.length:Object.keys(t).length},some:function(t,e){for(var n=0;n<t.length;n++)if(e(t[n],n))return!0;return!1},sortBy:function(t,e){var n;if(Cd(e))n=function(t,n){return e(t)-e(n)};else{var r=[];Ud(e)?r.push(e):kd(e)&&(r=e),n=function(t,e){for(var n=0;n<r.length;n+=1){var i=r[n];if(t[i]>e[i])return 1;if(t[i]<e[i])return-1}return 0}}return t.sort(n),t},startsWith:function(t,e){return!(!kd(t)&&!Ud(t))&&t[0]===e},substitute:function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]})):t},throttle:function(t,e,n){var r,i,o,a,s=0;n||(n={});var c=function(){s=!1===n.leading?0:Date.now(),r=null,a=t.apply(i,o),r||(i=o=null)},u=function(){var u=Date.now();s||!1!==n.leading||(s=u);var l=e-(u-s);return i=this,o=arguments,l<=0||l>e?(r&&(clearTimeout(r),r=null),s=u,a=t.apply(i,o),r||(i=o=null)):r||!1===n.trailing||(r=setTimeout(c,l)),a};return u.cancel=function(){clearTimeout(r),s=0,r=i=o=null},u},toArray:function(t){return Ed(t)?Array.prototype.slice.call(t):[]},toDegree:function(t){return Qd*t},toInteger:Jd,toRadian:function(t){return tf*t},toString:rf,union:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Hd([].concat.apply([],t))},uniq:Hd,uniqueId:function(t){return bf[t=t||"g"]?bf[t]+=1:bf[t]=1,t+bf[t]},upperCase:function(t){return rf(t).toUpperCase()},upperFirst:function(t){var e=rf(t);return e.charAt(0).toUpperCase()+e.substring(1)},values:nf,valuesOfKey:function(t,e){for(var n=[],r={},i=0;i<t.length;i++){var o=t[i][e];if(!Td(o)){kd(o)||(o=[o]);for(var a=0;a<o.length;a++){var s=o[a];r[s]||(n.push(s),r[s]=!0)}}}return n},wrapBehavior:function(t,e){if(t["_wrap_"+e])return t["_wrap_"+e];var n=function(n){t[e](n)};return t["_wrap_"+e]=n,n}});var Mf={assign:p(wf).mix,getHeight:function(t,e,n,r){return void 0===r&&(r="height"),"center"===n?(t[r]+e[r])/2:t.height}},Nf=Mf,Sf={getId:function(t){return t.id||t.name},getPreH:function(t){return t.preH||0},getPreV:function(t){return t.preV||0},getHGap:function(t){return t.hgap||18},getVGap:function(t){return t.vgap||18},getChildren:function(t){return t.children},getHeight:function(t){return t.height||36},getWidth:function(t){var e=t.label||" ";return t.width||18*e.split("").length}};function Cf(t,e){var n=this;if(n.vgap=n.hgap=0,t instanceof Cf)return t;n.data=t;var r=e.getHGap(t),i=e.getVGap(t);return n.preH=e.getPreH(t),n.preV=e.getPreV(t),n.width=e.getWidth(t),n.height=e.getHeight(t),n.width+=n.preH,n.height+=n.preV,n.id=e.getId(t),n.x=n.y=0,n.depth=0,n.children||(n.children=[]),n.addGap(r,i),n}Nf.assign(Cf.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(t,e){var n=this;n.hgap+=t,n.vgap+=e,n.width+=2*t,n.height+=2*e},eachNode:function(t){for(var e,n=[this];e=n.shift();)t(e),n=e.children.concat(n)},DFTraverse:function(t){this.eachNode(t)},BFTraverse:function(t){for(var e,n=[this];e=n.shift();)t(e),n=n.concat(e.children)},getBoundingBox:function(){var t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode((function(e){t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)})),t},translate:function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.eachNode((function(n){n.x+=t,n.y+=e,n.x+=n.preH,n.y+=n.preV}))},right2left:function(){var t=this,e=t.getBoundingBox();t.eachNode((function(t){t.x=t.x-2*(t.x-e.left)-t.width})),t.translate(e.width,0)},bottom2top:function(){var t=this,e=t.getBoundingBox();t.eachNode((function(t){t.y=t.y-2*(t.y-e.top)-t.height})),t.translate(0,e.height)}});var Tf=function(t,e,n){void 0===e&&(e={});var r,i=new Cf(t,e=Nf.assign({},Sf,e)),o=[i];if(!n&&!t.collapsed)for(;r=o.shift();)if(!r.data.collapsed){var a=e.getChildren(r.data),s=a?a.length:0;if(r.children=new Array(s),a&&s)for(var c=0;c<s;c++){var u=new Cf(a[c],e);r.children[c]=u,o.push(u),u.parent=r,u.depth=r.depth+1}}return i},kf=Tf,Pf=function(){function t(t,e){void 0===e&&(e={});this.options=e,this.rootNode=kf(t,e)}return t.prototype.execute=function(){throw new Error("please override this method")},t}(),Af=Pf;function Of(t,e,n,r){void 0===r&&(r=[]);var i=this;i.w=t||0,i.h=e||0,i.y=n||0,i.x=0,i.c=r||[],i.cs=r.length,i.prelim=0,i.mod=0,i.shift=0,i.change=0,i.tl=null,i.tr=null,i.el=null,i.er=null,i.msel=0,i.mser=0}function _f(t,e,n){n?t.y+=e:t.x+=e,t.children.forEach((function(t){_f(t,e,n)}))}function Rf(t,e){var n=e?t.y:t.x;return t.children.forEach((function(t){n=Math.min(Rf(t,e),n)})),n}function Df(t,e){_f(t,-Rf(t,e),e)}function If(t,e,n){n?e.y=t.x:e.x=t.x,t.c.forEach((function(t,r){If(t,e.children[r],n)}))}function Lf(t,e,n){void 0===n&&(n=0),e?(t.x=n,n+=t.width):(t.y=n,n+=t.height),t.children.forEach((function(t){Lf(t,e,n)}))}Of.fromNode=function(t,e){if(!t)return null;var n=[];return t.children.forEach((function(t){n.push(Of.fromNode(t,e))})),e?new Of(t.height,t.width,t.x,n):new Of(t.width,t.height,t.y,n)};var jf=Tf,zf=function(t,e){for(var n=jf(t.data,e,!0),r=jf(t.data,e,!0),i=t.children.length,o=Math.round(i/2),a=e.getSide||function(t,e){return e<o?"right":"left"},s=0;s<i;s++){var c=t.children[s];"right"===a(c,s)?r.children.push(c):n.children.push(c)}return n.eachNode((function(t){t.isRoot()||(t.side="left")})),r.eachNode((function(t){t.isRoot()||(t.side="right")})),{left:n,right:r}},Bf=zf,Ff=["LR","RL","TB","BT","H","V"],Gf=["LR","RL","H"],Vf=Ff[0],Wf=function(t,e,n){var r=e.direction||Vf;if(e.isHorizontal=function(t){return Gf.indexOf(t)>-1}(r),r&&-1===Ff.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===Ff[0])n(t,e);else if(r===Ff[1])n(t,e),t.right2left();else if(r===Ff[2])n(t,e);else if(r===Ff[3])n(t,e),t.bottom2top();else if(r===Ff[4]||r===Ff[5]){var i=Bf(t,e),o=i.left,a=i.right;n(o,e),n(a,e),e.isHorizontal?o.right2left():o.bottom2top(),a.translate(o.x-a.x,o.y-a.y),t.x=o.x,t.y=a.y;var s=t.getBoundingBox();e.isHorizontal?s.top<0&&t.translate(0,-s.top):s.left<0&&t.translate(-s.left,0)}var c=e.fixedRoot;return void 0===c&&(c=!0),c&&t.translate(-(t.x+t.width/2+t.hgap),-(t.y+t.height/2+t.vgap)),t};function Uf(t,e){return Uf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Uf(t,e)}var Hf=function(t,e){void 0===e&&(e={});var n=e.isHorizontal;function r(t){0===t.cs?(t.el=t,t.er=t,t.msel=t.mser=0):(t.el=t.c[0].el,t.msel=t.c[0].msel,t.er=t.c[t.cs-1].er,t.mser=t.c[t.cs-1].mser)}function i(t,e,n){for(var r=t.c[e-1],i=r.mod,u=t.c[e],l=u.mod;null!==r&&null!==u;){c(r)>n.low&&(n=n.nxt);var h=i+r.prelim+r.w-(l+u.prelim);h>0&&(l+=h,o(t,e,n.index,h));var d=c(r),f=c(u);d<=f&&null!==(r=s(r))&&(i+=r.mod),d>=f&&null!==(u=a(u))&&(l+=u.mod)}!r&&u?function(t,e,n,r){var i=t.c[0].el;i.tl=n;var o=r-n.mod-t.c[0].msel;i.mod+=o,i.prelim-=o,t.c[0].el=t.c[e].el,t.c[0].msel=t.c[e].msel}(t,e,u,l):r&&!u&&function(t,e,n,r){var i=t.c[e].er;i.tr=n;var o=r-n.mod-t.c[e].mser;i.mod+=o,i.prelim-=o,t.c[e].er=t.c[e-1].er,t.c[e].mser=t.c[e-1].mser}(t,e,r,i)}function o(t,e,n,r){t.c[e].mod+=r,t.c[e].msel+=r,t.c[e].mser+=r,function(t,e,n,r){if(n!==e-1){var i=e-n;t.c[n+1].shift+=r/i,t.c[e].shift-=r/i,t.c[e].change-=r-r/i}}(t,e,n,r)}function a(t){return 0===t.cs?t.tl:t.c[0]}function s(t){return 0===t.cs?t.tr:t.c[t.cs-1]}function c(t){return t.y+t.h}function u(t,e,n){for(;null!==n&&t>=n.low;)n=n.nxt;return{low:t,index:e,nxt:n}}Lf(t,n);var l=Of.fromNode(t,n);return function t(e){if(0!==e.cs){t(e.c[0]);for(var n=u(c(e.c[0].el),0,null),o=1;o<e.cs;++o){t(e.c[o]);var a=c(e.c[o].er);i(e,o,n),n=u(a,o,n)}!function(t){t.prelim=(t.c[0].prelim+t.c[0].mod+t.c[t.cs-1].mod+t.c[t.cs-1].prelim+t.c[t.cs-1].w)/2-t.w/2}(e),r(e)}else r(e)}(l),function t(e,n){n+=e.mod,e.x=e.prelim+n,function(t){for(var e=0,n=0,r=0;r<t.cs;r++)n+=(e+=t.c[r].shift)+t.c[r].change,t.c[r].mod+=n}(e);for(var r=0;r<e.cs;r++)t(e.c[r],n)}(l,0),If(l,t,n),Df(t,n),t},qf=Wf,$f=Mf,Yf=function(t){var e,n;function r(){return t.apply(this,arguments)||this}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,Uf(e,n),r.prototype.execute=function(){return qf(this.rootNode,this.options,Hf)},r}(Af),Kf={};var Xf=function(t,e){return e=$f.assign({},Kf,e),new Yf(t,e).execute()},Zf=Mf;function Qf(t,e){void 0===e&&(e=[]);var n=this;n.x=n.y=0,n.leftChild=n.rightChild=null,n.height=0,n.children=e}var Jf={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function tp(t,e,n){n?(e.x=t.x,e.y=t.y):(e.x=t.y,e.y=t.x),t.children.forEach((function(t,r){tp(t,e.children[r],n)}))}function ep(t,e){return ep=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ep(t,e)}var np=function(t,e){void 0===e&&(e={}),e=Zf.assign({},Jf,e);var n,r=0;var i=function t(e){if(!e)return null;e.width=0,e.depth&&e.depth>r&&(r=e.depth);var n=e.children,i=n.length,o=new Qf(e.height,[]);return n.forEach((function(e,n){var r=t(e);o.children.push(r),0===n&&(o.leftChild=r),n===i-1&&(o.rightChild=r)})),o.originNode=e,o.isLeaf=e.isLeaf(),o}(t);return function t(e){if(e.isLeaf||0===e.children.length)e.drawingDepth=r;else{var n=e.children.map((function(e){return t(e)})),i=Math.min.apply(null,n);e.drawingDepth=i-1}return e.drawingDepth}(i),function t(r){r.x=r.drawingDepth*e.rankSep,r.isLeaf?(r.y=0,n&&(r.y=n.y+n.height+e.nodeSep,r.originNode.parent!==n.originNode.parent&&(r.y+=e.subTreeSep)),n=r):(r.children.forEach((function(e){t(e)})),r.y=(r.leftChild.y+r.rightChild.y)/2)}(i),tp(i,t,e.isHorizontal),t},rp=Wf,ip=Mf,op=function(t){var e,n;function r(){return t.apply(this,arguments)||this}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,ep(e,n),r.prototype.execute=function(){var t=this;return t.rootNode.width=0,rp(t.rootNode,t.options,np)},r}(Af),ap={};var sp=function(t,e){return e=ip.assign({},ap,e),new op(t,e).execute()},cp=Mf;function up(t,e){return up=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},up(t,e)}var lp=Af,hp=function(t,e,n,r){var i=null;t.eachNode((function(t){!function(t,e,n,r,i){var o="function"==typeof n?n(t):n*t.depth;if(!r)try{if(t.id===t.parent.children[0].id)return t.x+=o,void(t.y=e?e.y:0)}catch(t){}if(t.x+=o,e){if(t.y=e.y+cp.getHeight(e,t,i),e.parent&&t.parent.id!==e.parent.id){var a=e.parent,s=a.y+cp.getHeight(a,t,i);t.y=s>t.y?s:t.y}}else t.y=0}(t,i,e,n,r),i=t}))},dp=zf,fp=Mf,pp=["LR","RL","H"],gp=pp[0],mp=function(t){var e,n;function r(){return t.apply(this,arguments)||this}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,up(e,n),r.prototype.execute=function(){var t=this.options,e=this.rootNode;t.isHorizontal=!0;var n=t.indent,r=void 0===n?20:n,i=t.dropCap,o=void 0===i||i,a=t.direction,s=void 0===a?gp:a,c=t.align;if(s&&-1===pp.indexOf(s))throw new TypeError("Invalid direction: "+s);if(s===pp[0])hp(e,r,o,c);else if(s===pp[1])hp(e,r,o,c),e.right2left();else if(s===pp[2]){var u=dp(e,t),l=u.left,h=u.right;hp(l,r,o,c),l.right2left(),hp(h,r,o,c);var d=l.getBoundingBox();h.translate(d.width,0),e.x=h.x-e.width/2}return e},r}(lp),vp={};var yp=function(t,e){return e=fp.assign({},vp,e),new mp(t,e).execute()},bp=Mf;function xp(t,e){var n=0;return t.children.length?t.children.forEach((function(t){n+=xp(t,e)})):n=t.height,t._subTreeSep=e.getSubTreeSep(t.data),t.totalHeight=Math.max(t.height,n)+2*t._subTreeSep,t.totalHeight}function Ep(t){var e=t.children,n=e.length;if(n){e.forEach((function(t){Ep(t)}));var r=e[0],i=e[n-1],o=i.y-r.y+i.height,a=0;if(e.forEach((function(t){a+=t.totalHeight})),o>t.height)t.y=r.y+o/2-t.height/2;else if(1!==e.length||t.height>a){var s=t.y+(t.height-o)/2-r.y;e.forEach((function(t){t.translate(0,s)}))}else t.y=(r.y+r.height/2+i.y+i.height/2)/2-t.height/2}}var wp={getSubTreeSep:function(){return 0}};function Mp(t,e){return Mp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Mp(t,e)}var Np=function(t,e){void 0===e&&(e={}),e=bp.assign({},wp,e),t.parent={x:0,width:0,height:0,y:0},t.BFTraverse((function(t){t.x=t.parent.x+t.parent.width})),t.parent=null,xp(t,e),t.startY=0,t.y=t.totalHeight/2-t.height/2,t.eachNode((function(t){var e=t.children,n=e.length;if(n){var r=e[0];if(r.startY=t.startY+t._subTreeSep,1===n)r.y=t.y+t.height/2-r.height/2;else{r.y=r.startY+r.totalHeight/2-r.height/2;for(var i=1;i<n;i++){var o=e[i];o.startY=e[i-1].startY+e[i-1].totalHeight,o.y=o.startY+o.totalHeight/2-o.height/2}}}})),Ep(t)},Sp=Wf,Cp=Mf,Tp=function(t){var e,n;function r(){return t.apply(this,arguments)||this}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,Mp(e,n),r.prototype.execute=function(){return Sp(this.rootNode,this.options,Np)},r}(Af),kp={};var Pp=function(t,e){return e=Cp.assign({},kp,e),new Tp(t,e).execute()},Ap={compactBox:Xf,dendrogram:sp,indented:yp,mindmap:Pp},Op=function(){function t(){this._events={}}return t.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this._events[t]||[],o=this._events["*"]||[],a=function(r){for(var i=r.length,o=0;o<i;o++)if(r[o]){var a=r[o],s=a.callback;a.once&&(r.splice(o,1),0===r.length&&delete e._events[t],i--,o--),s.apply(e,n)}};a(i),a(o)},t.prototype.off=function(t,e){if(t)if(e){for(var n=this._events[t]||[],r=n.length,i=0;i<r;i++)n[i].callback===e&&(n.splice(i,1),r--,i--);0===n.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function _p(t,e,n,r){for(;t.length;){const i=t.shift();if(n(i))return!0;e.add(i.id),r(i.id).forEach((n=>{e.has(n.id)||(e.add(n.id),t.push(n))}))}return!1}function Rp(t,e,n,r){if(n(t))return!0;e.add(t.id);for(const i of r(t.id))if(!e.has(i.id)&&Rp(i,e,n,r))return!0;return!1}const Dp=()=>!0;class Ip{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||Dp,n=t.edgeFilter||Dp;this.nodeFilter=e,this.edgeFilter=t=>{const{source:r,target:i}=this.graph.getEdgeDetail(t.id);return!(!e(r)||!e(i))&&n(t,r,i)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const n=this.bothEdgesMap.get(t);if(n&&n.forEach((t=>e.add(t.id))),this.hasNode(t)){const n=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),r=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),i=Array.from(new Set([...n,...r]));i.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,n),this.outEdgesMap.set(t,r),this.bothEdgesMap.set(t,i),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((n=>{switch(n.type){case"NodeAdded":case"NodeRemoved":e.add(n.value.id);break;case"NodeDataUpdated":e.add(n.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(n.value.source),e.add(n.value.target);break;case"EdgeUpdated":"source"!==n.propertyName&&"target"!==n.propertyName||(e.add(n.oldValue),e.add(n.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(n.id)){const r=t.graph.getEdge(n.id);e.add(r.source),e.add(r.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),this.cacheEnabled)return"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t);return this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const n=this.graph.getParent(t,e);return n&&this.nodeFilter(n)?n:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];_p([this.getNode(t)],new Set,e,r)}dfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];Rp(this.getNode(t),new Set,e,r)}}let Lp=class t extends Op{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let n=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const r=e.value.id===t.value.id;return r&&(n=!0),!r}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),n||e.push(t);break}case"EdgeRemoved":{let n=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const r=e.value.id===t.value.id;return r&&(n=!0),!r}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),n||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const n=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),r=e[n];r?void 0!==t.propertyName?r.newValue=t.newValue:(e.splice(n,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const n=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));n?n.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),n=this.bothEdgesMap.get(t);n?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((e=>{e.childrenMap.get(t)?.forEach((t=>{e.parentMap.delete(t.id)})),e.parentMap.delete(t),e.childrenMap.delete(t)})),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,n){const r=this.getNode(t);this.batch((()=>{const i=r.data[e],o=n;r.data[e]=o,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:i,newValue:o})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,n])=>{this.updateNodeDataProperty(t,e,n)}))}))}updateNodeData(...t){const e=t[0],n=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let r;if("function"==typeof t[1]){const e=t[1];r=e(n.data)}else"object"==typeof t[1]&&(r=t[1]);this.batch((()=>{const t=n.data,i=r;n.data=r,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:i})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),n=this.outEdgesMap.get(t.source),r=this.bothEdgesMap.get(t.source),i=this.bothEdgesMap.get(t.target);e.add(t),n.add(t),r.add(t),i.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),n=this.outEdgesMap.get(e.source),r=this.inEdgesMap.get(e.target),i=this.bothEdgesMap.get(e.source),o=this.bothEdgesMap.get(e.target);n.delete(e),r.delete(e),i.delete(e),o.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const n=this.getEdge(t);this.checkNodeExistence(e);const r=n.source,i=e;this.outEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.outEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:r,newValue:i})}))}updateEdgeTarget(t,e){const n=this.getEdge(t);this.checkNodeExistence(e);const r=n.target,i=e;this.inEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.inEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:r,newValue:i})}))}updateEdgeDataProperty(t,e,n){const r=this.getEdge(t);this.batch((()=>{const i=r.data[e],o=n;r.data[e]=o,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:i,newValue:o})}))}updateEdgeData(...t){const e=t[0],n=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let r;if("function"==typeof t[1]){const e=t[1];r=e(n.data)}else"object"==typeof t[1]&&(r=t[1]);this.batch((()=>{const t=n.data,i=r;n.data=r,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:i})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,n])=>{this.updateEdgeDataProperty(t,e,n)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const n=[],r=Array.isArray(t)?t:[t];for(;r.length;){const t=r.shift();n.push(t),t.children&&r.push(...t.children)}this.addNodes(n),n.forEach((t=>{t.children?.forEach((n=>{this.setParent(n.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const n=this.treeIndices.get(e).childrenMap.get(t);return Array.from(n||[])}getParent(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);return this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const n=[];let r,i=this.getNode(t);for(;r=this.getParent(i.id,e);)n.push(r),i=r;return n}setParent(t,e,n){this.checkTreeExistence(n);const r=this.treeIndices.get(n),i=this.getNode(t),o=r.parentMap.get(t);if(o?.id===e)return;if(void 0===e)return o&&r.childrenMap.get(o.id)?.delete(i),void r.parentMap.delete(t);const a=this.getNode(e);r.parentMap.set(t,a),o&&r.childrenMap.get(o.id)?.delete(i);let s=r.childrenMap.get(a.id);s||(s=new Set,r.childrenMap.set(a.id,s)),s.add(i),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:n,nodeId:t,oldParentId:o?.id,newParentId:a.id})}))}dfsTree(t,e,n){return Rp(this.getNode(t),new Set,e,(t=>this.getChildren(t,n)))}bfsTree(t,e,n){return _p([this.getNode(t)],new Set,e,(t=>this.getChildren(t,n)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return _p([this.getNode(t)],new Set,e,r)}dfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return Rp(this.getNode(t),new Set,e,r)}clone(){const e=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),n=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new t({nodes:e,edges:n});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const i=new Map;t.forEach(((t,e)=>{i.set(e,r.getNode(t.id))}));const o=new Map;e.forEach(((t,e)=>{o.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:i,childrenMap:o})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new Ip({graph:this,...t})}};const jp=(t,e)=>{if("next"!==t&&"prev"!==t)return e},zp=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};let Bp=class{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return zp(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&zp(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let n=e.prev;for(;n!==e;)t.push(JSON.stringify(n,jp)),n=null==n?void 0:n.prev;return`[${t.join(", ")}]`}},Fp=class extends Bp{};const Gp=()=>1,Vp=(t,e,n)=>{let r=[];const i=e[e.length-1],o=e[0];let a;for(;t.getAllNodes().length;){for(;a=o.dequeue();)Wp(t,e,n,a);for(;a=i.dequeue();)Wp(t,e,n,a);if(t.getAllNodes().length)for(let i=e.length-2;i>0;--i)if(a=e[i].dequeue(),a){r=r.concat(Wp(t,e,n,a,!0));break}}return r},Wp=(t,e,n,r,i)=>{var o,a;const s=[];return t.hasNode(r.v)&&(null===(o=t.getRelatedEdges(r.v,"in"))||void 0===o||o.forEach((r=>{const o=r.data.weight,a=t.getNode(r.source);i&&s.push({v:r.source,w:r.target,in:0,out:0}),void 0===a.data.out&&(a.data.out=0),a.data.out-=o,Hp(e,n,Object.assign({v:a.id},a.data))})),null===(a=t.getRelatedEdges(r.v,"out"))||void 0===a||a.forEach((r=>{const i=r.data.weight,o=r.target,a=t.getNode(o);void 0===a.data.in&&(a.data.in=0),a.data.in-=i,Hp(e,n,Object.assign({v:a.id},a.data))})),t.removeNode(r.v)),i?s:void 0},Up=(t,e)=>{const n=new Lp;let r=0,i=0;t.getAllNodes().forEach((t=>{n.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const o=n.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),a=(null==e?void 0:e(t))||1;o?n.updateEdgeData(null==o?void 0:o.id,Object.assign(Object.assign({},o.data),{weight:o.data.weight+a})):n.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:a}}),i=Math.max(i,n.getNode(t.source).data.out+=a),r=Math.max(r,n.getNode(t.target).data.in+=a)}));const o=[],a=i+r+3;for(let t=0;t<a;t++)o.push(new Fp);const s=r+1;return n.getAllNodes().forEach((t=>{Hp(o,s,Object.assign({v:t.id},n.getNode(t.id).data))})),{buckets:o,zeroIdx:s,graph:n}},Hp=(t,e,n)=>{n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)},qp=(t,e)=>{const n="greedy"===e?((t,e)=>{var n;if(t.getAllNodes().length<=1)return[];const r=Up(t,e||Gp);return null===(n=Vp(r.graph,r.buckets,r.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===n?void 0:n.flat()})(t,(t=>t.data.weight||1)):$p(t);null==n||n.forEach((e=>{const n=e.data;t.removeEdge(e.id),n.forwardName=e.data.name,n.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},n)})}))},$p=t=>{const e=[],n={},r={},i=o=>{r[o]||(r[o]=!0,n[o]=!0,t.getRelatedEdges(o,"out").forEach((t=>{n[t.target]?e.push(t):i(t.target)})),delete n[o])};return t.getAllNodes().forEach((t=>i(t.id))),e},Yp=(t,e,n,r)=>{let i;do{i=`${r}${Math.random()}`}while(t.hasNode(i));return n.dummy=e,t.addNode({id:i,data:n}),i},Kp=t=>{const e=new Lp;return t.getAllNodes().forEach((n=>{t.getChildren(n.id).length||e.addNode(Object.assign({},n))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},Xp=(t,e)=>{const n=Number(t.x),r=Number(t.y),i=Number(e.x)-n,o=Number(e.y)-r;let a,s,c=Number(t.width)/2,u=Number(t.height)/2;return i||o?(Math.abs(o)*c>Math.abs(i)*u?(o<0&&(u=-u),a=u*i/o,s=u):(i<0&&(c=-c),a=c,s=c*o/i),{x:n+a,y:r+s}):{x:0,y:0}},Zp=t=>{const e=[],n=Jp(t)+1;for(let t=0;t<n;t++)e.push([]);t.getAllNodes().forEach((t=>{const n=t.data.rank;void 0!==n&&e[n]&&e[n].push(t.id)}));for(let r=0;r<n;r++)e[r]=e[r].sort(((e,n)=>{return r=t.getNode(e).data.order,i=t.getNode(n).data.order,Number(r)-Number(i);var r,i}));return e},Qp=(t,e,n,r)=>{const i={width:0,height:0};return Wt(n)&&Wt(r)&&(i.rank=n,i.order=r),Yp(t,"border",i,e)},Jp=t=>{let e;return t.getAllNodes().forEach((t=>{const n=t.data.rank;void 0!==n&&(void 0===e||n>e)&&(e=n)})),e||(e=0),e},tg=(t,e)=>t.reduce(((t,n)=>e(t)>e(n)?n:t)),eg=(t,e,n,r,i,o)=>{r.includes(e.id)||(r.push(e.id),n||o.push(e.id),i(e.id).forEach((e=>eg(t,e,n,r,i,o))),n&&o.push(e.id))},ng=(t,e,n,r)=>{const i=Array.isArray(e)?e:[e],o=e=>r?t.getSuccessors(e):t.getNeighbors(e),a=[],s=[];return i.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);eg(t,e,"post"===n,s,o,a)})),a},rg=(t,e,n,r,i,o)=>{const a={rank:o,borderType:e,width:0,height:0},s=i.data[e][o-1],c=Yp(t,"border",a,n);i.data[e][o]=c,t.setParent(c,r),s&&t.addEdge({id:`e${Math.random()}`,source:s,target:c,data:{weight:1}})},ig=t=>{t.getAllNodes().forEach((t=>{og(t)})),t.getAllEdges().forEach((t=>{og(t)}))},og=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},ag=t=>{t.getAllNodes().forEach((t=>{sg(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>sg(t))),t.data.hasOwnProperty("y")&&sg(t.data)}))},sg=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},cg=t=>{t.getAllNodes().forEach((t=>{ug(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>ug(t))),t.data.hasOwnProperty("x")&&ug(t.data)}))},ug=t=>{const e=t.x;t.x=t.y,t.y=e},lg=(t,e,n,r,i,o,a)=>{const s=t.getChildren(a);if(!(null==s?void 0:s.length))return void(a!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:a,data:{weight:0,minlen:n}}));const c=Qp(t,"_bt"),u=Qp(t,"_bb"),l=t.getNode(a);t.setParent(c,a),l.data.borderTop=c,t.setParent(u,a),l.data.borderBottom=u,null==s||s.forEach((s=>{lg(t,e,n,r,i,o,s.id);const l=s.data.borderTop?s.data.borderTop:s.id,h=s.data.borderBottom?s.data.borderBottom:s.id,d=s.data.borderTop?r:2*r,f=l!==h?1:i-o[a]+1;t.addEdge({id:`e${Math.random()}`,source:c,target:l,data:{minlen:f,weight:d,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:h,target:u,data:{minlen:f,weight:d,nestingEdge:!0}})})),t.getParent(a)||t.addEdge({id:`e${Math.random()}`,source:e,target:c,data:{weight:0,minlen:i+o[a]}})},hg=t=>{const e={},n=(r,i)=>{const o=t.getChildren(r);null==o||o.forEach((t=>n(t.id,i+1))),e[r]=i};return t.getRoots().forEach((t=>n(t.id,1))),e},dg=t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e},fg="edge-label",pg=(t,e,n)=>{let r=e.source,i=t.getNode(r).data.rank;const o=e.target,a=t.getNode(o).data.rank,s=e.data.labelRank;if(a===i+1)return;let c,u,l;for(t.removeEdge(e.id),l=0,++i;i<a;++l,++i)e.data.points=[],u={originalEdge:e,width:0,height:0,rank:i},c=Yp(t,"edge",u,"_d"),i===s&&(u.width=e.data.width,u.height=e.data.height,u.dummy=fg,u.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:r,target:c,data:{weight:e.data.weight}}),0===l&&n.push(c),r=c;t.addEdge({id:`e${Math.random()}`,source:r,target:o,data:{weight:e.data.weight}})},gg=t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e},mg=(t,e,n)=>{const r=((t,e)=>null==t?void 0:t.reduce(((t,n,r)=>(t[n]=e[r],t)),{}))(n,n.map(((t,e)=>e))),i=e.map((e=>{const n=t.getRelatedEdges(e,"out").map((t=>({pos:r[t.target]||0,weight:t.data.weight})));return null==n?void 0:n.sort(((t,e)=>t.pos-e.pos))})),o=i.flat().filter((t=>void 0!==t));let a=1;for(;a<n.length;)a<<=1;const s=2*a-1;a-=1;const c=Array(s).fill(0,0,s);let u=0;return null==o||o.forEach((t=>{if(t){let e=t.pos+a;c[e]+=t.weight;let n=0;for(;e>0;)e%2&&(n+=c[e+1]),e=e-1>>1,c[e]+=t.weight;u+=t.weight*n}})),u},vg=(t,e)=>{let n=0;for(let r=1;r<(null==e?void 0:e.length);r+=1)n+=mg(t,e[r-1],e[r]);return n},yg=t=>{const e={},n=t.getAllNodes(),r=n.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),i=Math.max(...r),o=[];for(let t=0;t<i+1;t++)o.push([]);const a=n.sort(((e,n)=>t.getNode(e.id).data.rank-t.getNode(n.id).data.rank)),s=a.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,n)=>t.getNode(e.id).data.fixorder-t.getNode(n.id).data.fixorder));return null==s||s.forEach((n=>{isNaN(t.getNode(n.id).data.rank)||o[t.getNode(n.id).data.rank].push(n.id),e[n.id]=!0})),null==a||a.forEach((n=>t.dfsTree(n.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||o[t.data.rank].push(t.id)})))),o},bg=t=>{var e,n;const r=[];for(;null==t?void 0:t.length;){const i=t.pop();r.push(i),null===(e=i.in.reverse())||void 0===e||e.forEach((t=>{return(e=i,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&xg(e,t)})(t);var e})),null===(n=i.out)||void 0===n||n.forEach((e=>{return(n=i,e=>{e.in.push(n),0==--e.indegree&&t.push(e)})(e);var n}))}const i=r.filter((t=>!t.merged)),o=["vs","i","barycenter","weight"];return i.map((t=>{const e={};return null==o||o.forEach((n=>{void 0!==t[n]&&(e[n]=t[n])})),e}))},xg=(t,e)=>{var n;let r=0,i=0;t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.vs=null===(n=e.vs)||void 0===n?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0},Eg=(t,e,n)=>{let r,i=n;for(;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),null==t||t.push(r.vs),i++;return i},wg=(t,e)=>(n,r)=>{if(void 0!==n.fixorder&&void 0!==r.fixorder)return n.fixorder-r.fixorder;if(n.barycenter<r.barycenter)return-1;if(n.barycenter>r.barycenter)return 1;if(e&&void 0!==n.order&&void 0!==r.order){if(n.order<r.order)return-1;if(n.order>r.order)return 1}return t?r.i-n.i:n.i-r.i},Mg=(t,e,n,r,i,o)=>{var a,s,c,u;let l=t.getChildren(e).map((t=>t.id));const h=t.getNode(e),d=h?h.data.borderLeft:void 0,f=h?h.data.borderRight:void 0,p={};d&&(l=null==l?void 0:l.filter((t=>t!==d&&t!==f)));const g=((t,e)=>e.map((e=>{const n=t.getRelatedEdges(e,"in");if(!(null==n?void 0:n.length))return{v:e};const r={sum:0,weight:0};return null==n||n.forEach((e=>{const n=t.getNode(e.source);r.sum+=e.data.weight*n.data.order,r.weight+=e.data.weight})),{v:e,barycenter:r.sum/r.weight,weight:r.weight}})))(t,l||[]);null==g||g.forEach((e=>{var i;if(null===(i=t.getChildren(e.v))||void 0===i?void 0:i.length){const i=Mg(t,e.v,n,r,o);p[e.v]=i,i.hasOwnProperty("barycenter")&&Sg(e,i)}}));const m=((t,e)=>{var n,r,i;const o={};null==t||t.forEach(((t,e)=>{o[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const n=o[t.v];void 0!==t.barycenter&&(n.barycenter=t.barycenter,n.weight=t.weight)})),null===(n=e.getAllEdges())||void 0===n||n.forEach((t=>{const e=o[t.source],n=o[t.target];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(o[t.target]))}));const a=null===(i=(r=Object.values(o)).filter)||void 0===i?void 0:i.call(r,(t=>!t.indegree));return bg(a)})(g,n);Ng(m,p),null===(a=m.filter((t=>t.vs.length>0)))||void 0===a||a.forEach((e=>{const n=t.getNode(e.vs[0]);n&&(e.fixorder=n.data.fixorder,e.order=n.data.order)}));const v=((t,e,n,r)=>{const i=((t,e)=>{const n={lhs:[],rhs:[]};return null==t||t.forEach((t=>{e(t)?n.lhs.push(t):n.rhs.push(t)})),n})(t,(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return r?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})),o=i.lhs,a=i.rhs.sort(((t,e)=>-t.i- -e.i)),s=[];let c=0,u=0,l=0;null==o||o.sort(wg(!!e,!!n)),l=Eg(s,a,l),null==o||o.forEach((t=>{var e;l+=null===(e=t.vs)||void 0===e?void 0:e.length,s.push(t.vs),c+=t.barycenter*t.weight,u+=t.weight,l=Eg(s,a,l)}));const h={vs:s.flat()};return u&&(h.barycenter=c/u,h.weight=u),h})(m,r,i,o);if(d&&(v.vs=[d,v.vs,f].flat(),null===(s=t.getPredecessors(d))||void 0===s?void 0:s.length)){const e=t.getNode((null===(c=t.getPredecessors(d))||void 0===c?void 0:c[0].id)||""),n=t.getNode((null===(u=t.getPredecessors(f))||void 0===u?void 0:u[0].id)||"");v.hasOwnProperty("barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+e.data.order+n.data.order)/(v.weight+2),v.weight+=2}return v},Ng=(t,e)=>{null==t||t.forEach((t=>{var n;const r=null===(n=t.vs)||void 0===n?void 0:n.map((t=>e[t]?e[t].vs:t));t.vs=r.flat()}))},Sg=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},Cg=(t,e,n)=>e.map((e=>((t,e,n)=>{const r=gg(t),i=new Lp({tree:[{id:r,children:[],data:{}}]});return t.getAllNodes().forEach((o=>{const a=t.getParent(o.id);(o.data.rank===e||o.data.minRank<=e&&e<=o.data.maxRank)&&(i.hasNode(o.id)||i.addNode(Object.assign({},o)),(null==a?void 0:a.id)&&!i.hasNode(null==a?void 0:a.id)&&i.addNode(Object.assign({},a)),i.setParent(o.id,(null==a?void 0:a.id)||r),t.getRelatedEdges(o.id,n).forEach((e=>{const n=e.source===o.id?e.target:e.source;i.hasNode(n)||i.addNode(Object.assign({},t.getNode(n)));const r=i.getRelatedEdges(n,"out").find((({target:t})=>t===o.id)),a=void 0!==r?r.data.weight:0;r?i.updateEdgeData(r.id,Object.assign(Object.assign({},r.data),{weight:e.data.weight+a})):i.addEdge({id:e.id,source:n,target:o.id,data:{weight:e.data.weight+a}})})),o.data.hasOwnProperty("minRank")&&i.updateNodeData(o.id,Object.assign(Object.assign({},o.data),{borderLeft:o.data.borderLeft[e],borderRight:o.data.borderRight[e]})))})),i})(t,e,n))),Tg=(t,e,n,r)=>{const i=new Lp;null==t||t.forEach((t=>{var o;const a=t.getRoots()[0].id,s=Mg(t,a,i,e,n,r);for(let e=0;e<(null===(o=s.vs)||void 0===o?void 0:o.length);e++){const n=t.getNode(s.vs[e]);n&&(n.data.order=e)}((t,e,n)=>{const r={};let i;null==n||n.forEach((n=>{let o,a,s=t.getParent(n);for(;s;){if(o=t.getParent(s.id),o?(a=r[o.id],r[o.id]=s.id):(a=i,i=s.id),a&&a!==s.id)return e.hasNode(a)||e.addNode({id:a,data:{}}),e.hasNode(s.id)||e.addNode({id:s.id,data:{}}),void(e.hasEdge(`e${a}-${s.id}`)||e.addEdge({id:`e${a}-${s.id}`,source:a,target:s.id,data:{}}));s=o}}))})(t,i,s.vs)}))},kg=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,n)=>{t.getNode(e).data.order=n}))}))},Pg=(t,e)=>{const n=(t=>{const e={};let n=0;const r=i=>{const o=n;t.getChildren(i).forEach((t=>r(t.id))),e[i]={low:o,lim:n++}};return t.getRoots().forEach((t=>r(t.id))),e})(t);e.forEach((e=>{var r,i;let o=e,a=t.getNode(o);const s=a.data.originalEdge;if(!s)return;const c=((t,e,n,r)=>{var i,o;const a=[],s=[],c=Math.min(e[n].low,e[r].low),u=Math.max(e[n].lim,e[r].lim);let l,h;l=n;do{l=null===(i=t.getParent(l))||void 0===i?void 0:i.id,a.push(l)}while(l&&(e[l].low>c||u>e[l].lim));for(h=l,l=r;l&&l!==h;)s.push(l),l=null===(o=t.getParent(l))||void 0===o?void 0:o.id;return{lca:h,path:a.concat(s.reverse())}})(t,n,s.source,s.target),u=c.path,l=c.lca;let h=0,d=u[h],f=!0;for(;o!==s.target;){if(a=t.getNode(o),f){for(;d!==l&&(null===(r=t.getNode(d))||void 0===r?void 0:r.data.maxRank)<a.data.rank;)h++,d=u[h];d===l&&(f=!1)}if(!f){for(;h<u.length-1&&(null===(i=t.getNode(u[h+1]))||void 0===i?void 0:i.data.minRank)<=a.data.rank;)h++;d=u[h]}t.hasNode(d)&&t.setParent(o,d),o=t.getSuccessors(o)[0].id}}))},Ag=(t,e)=>{const n={};function r(e,r){const i=function(t){return JSON.stringify(t.slice(1))}(e);r.get(i)||(!function(e,r,i,o,a){var s,c;let u;for(let l=r;l<i;l++)u=e[l],(null===(s=t.getNode(u))||void 0===s?void 0:s.data.dummy)&&(null===(c=t.getPredecessors(u))||void 0===c||c.forEach((e=>{const r=t.getNode(e.id);r.data.dummy&&(r.data.order<o||r.data.order>a)&&_g(n,e.id,u)})))}(...e),r.set(i,!0))}const i=(e,n)=>{let i,o=-1,a=0;const s=new Map;return null==n||n.forEach(((c,u)=>{var l;if("border"===(null===(l=t.getNode(c))||void 0===l?void 0:l.data.dummy)){const e=t.getPredecessors(c)||[];e.length&&(i=t.getNode(e[0].id).data.order,r([n,a,u,o,i],s),a=u,o=i)}r([n,a,n.length,i,e.length],s)})),n};return(null==e?void 0:e.length)&&e.reduce(i),n},Og=(t,e)=>{var n,r;if(null===(n=t.getNode(e))||void 0===n?void 0:n.data.dummy)return null===(r=t.getPredecessors(e))||void 0===r?void 0:r.find((e=>t.getNode(e.id).data.dummy))},_g=(t,e,n)=>{let r=e,i=n;if(r>i){const t=r;r=i,i=t}let o=t[r];o||(t[r]=o={}),o[i]=!0},Rg=(t,e,n)=>{let r=e,i=n;if(r>n){r=n,i=e}return!!t[r]},Dg=(t,e,n,r,i,o)=>{const a=new Lp,s=Ig(r,i,o);return null==e||e.forEach((e=>{let r;null==e||e.forEach((e=>{const i=n[e];if(a.hasNode(i)||a.addNode({id:i,data:{}}),r){const o=n[r],c=a.getRelatedEdges(o,"out").find((t=>t.target===i));c?a.updateEdgeData(c.id,Object.assign(Object.assign({},c.data),{weight:Math.max(s(t,e,r),c.data.weight||0)})):a.addEdge({id:`e${Math.random()}`,source:o,target:i,data:{weight:Math.max(s(t,e,r),0)}})}r=e}))})),a};const Ig=(t,e,n)=>(r,i,o)=>{const a=r.getNode(i),s=r.getNode(o);let c=0,u=0;if(c+=a.data.width/2,a.data.hasOwnProperty("labelpos"))switch((a.data.labelpos||"").toLowerCase()){case"l":u=-a.data.width/2;break;case"r":u=a.data.width/2}if(u&&(c+=n?u:-u),u=0,c+=(a.data.dummy?e:t)/2,c+=(s.data.dummy?e:t)/2,c+=s.data.width/2,s.data.labelpos)switch((s.data.labelpos||"").toLowerCase()){case"l":u=s.data.width/2;break;case"r":u=-s.data.width/2}return u&&(c+=n?u:-u),u=0,c},Lg=(t,e)=>t.getNode(e).data.width||0,jg=(t,e)=>{const{align:n,nodesep:r=0,edgesep:i=0}=e||{},o=Zp(t),a=Object.assign(((t,e)=>{const n={},r=(e,r)=>{let i=0,o=0;const a=e.length,s=null==r?void 0:r[(null==r?void 0:r.length)-1];return null==r||r.forEach(((e,c)=>{var u;const l=Og(t,e),h=l?t.getNode(l.id).data.order:a;(l||e===s)&&(null===(u=r.slice(o,c+1))||void 0===u||u.forEach((e=>{var r;null===(r=t.getPredecessors(e))||void 0===r||r.forEach((r=>{var o;const a=t.getNode(r.id),s=a.data.order;!(s<i||h<s)||a.data.dummy&&(null===(o=t.getNode(e))||void 0===o?void 0:o.data.dummy)||_g(n,r.id,e)}))})),o=c+1,i=h)})),r};return(null==e?void 0:e.length)&&e.reduce(r),n})(t,o),Ag(t,o)),s={};let c=[];["u","d"].forEach((e=>{c="u"===e?o:Object.values(o).reverse(),["l","r"].forEach((n=>{"r"===n&&(c=c.map((t=>Object.values(t).reverse())));const o=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),u=((t,e,n,r)=>{const i={},o={},a={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{i[t]=t,o[t]=t,a[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let s=r(t).map((t=>t.id));if(s.length){s=s.sort(((t,e)=>a[t]-a[e]));const r=(s.length-1)/2;for(let c=Math.floor(r),u=Math.ceil(r);c<=u;++c){const r=s[c];o[t]===t&&e<a[r]&&!Rg(n,t,r)&&(o[r]=t,o[t]=i[t]=i[r],e=a[r])}}}))})),{root:i,align:o}})(0,c,a,o),l=((t,e,n,r,i,o,a)=>{var s;const c={},u=Dg(t,e,n,i,o,a),l=a?"borderLeft":"borderRight",h=(t,e)=>{let n=u.getAllNodes(),r=n.pop();const i={};for(;r;)i[r.id]?t(r.id):(i[r.id]=!0,n.push(r),n=n.concat(e(r.id))),r=n.pop()};return h((t=>{c[t]=(u.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(c[e.source]||0)+e.data.weight)),0)}),u.getPredecessors.bind(u)),h((e=>{const n=(u.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(c[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),r=t.getNode(e);n!==Number.POSITIVE_INFINITY&&r.data.borderType!==l&&(c[e]=Math.max(c[e],n))}),u.getSuccessors.bind(u)),null===(s=Object.values(r))||void 0===s||s.forEach((t=>{c[t]=c[n[t]]})),c})(t,c,u.root,u.align,r,i,"r"===n);"r"===n&&Object.keys(l).forEach((t=>l[t]=-l[t])),s[e+n]=l}))}));const u=((t,e)=>tg(Object.values(e),(e=>{var n;let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null===(n=Object.keys(e))||void 0===n||n.forEach((n=>{const o=e[n],a=Lg(t,n)/2;r=Math.max(o+a,r),i=Math.min(o-a,i)})),r-i})))(t,s);return u&&function(t,e){const n=Object.values(e),r=Math.min(...n),i=Math.max(...n);["u","d"].forEach((n=>{["l","r"].forEach((o=>{const a=n+o,s=t[a];let c;if(s===e)return;const u=Object.values(s);c="l"===o?r-Math.min(...u):i-Math.max(...u),c&&(t[a]={},Object.keys(s).forEach((e=>{t[a][e]=s[e]+c})))}))}))}(s,u),((t,e)=>{const n={};return Object.keys(t.ul).forEach((r=>{if(e)n[r]=t[e.toLowerCase()][r];else{const e=Object.values(t).map((t=>t[r]));n[r]=(e[0]+e[1])/2}})),n})(s,n)},zg=(t,e)=>{var n;const r=Kp(t);((t,e)=>{const{ranksep:n=0}=e||{},r=Zp(t);let i=0;null==r||r.forEach((e=>{const r=e.map((e=>t.getNode(e).data.height)),o=Math.max(...r,0);null==e||e.forEach((e=>{t.getNode(e).data.y=i+o/2})),i+=o+n}))})(r,e);const i=jg(r,e);null===(n=Object.keys(i))||void 0===n||n.forEach((t=>{r.getNode(t).data.x=i[t]}))},Bg=t=>{const e={},n=r=>{var i;const o=t.getNode(r);if(!o)return 0;if(e[r])return o.data.rank;let a;return e[r]=!0,null===(i=t.getRelatedEdges(r,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),o.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>n(t.id)))},Fg=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,Gg=(t,e)=>{const n=r=>{e.getRelatedEdges(r,"both").forEach((i=>{const o=i.source,a=r===o?i.target:o;t.hasNode(a)||Fg(e,i)||(t.addNode({id:a,data:{}}),t.addEdge({id:i.id,source:r,target:a,data:{}}),n(a))}))};return t.getAllNodes().forEach((t=>n(t.id))),t.getAllNodes().length},Vg=(t,e)=>{const n=r=>{var i;null===(i=e.getRelatedEdges(r,"both"))||void 0===i||i.forEach((i=>{const o=i.source,a=r===o?i.target:o;t.hasNode(a)||void 0===e.getNode(a).data.layer&&Fg(e,i)||(t.addNode({id:a,data:{}}),t.addEdge({id:i.id,source:r,target:a,data:{}}),n(a))}))};return t.getAllNodes().forEach((t=>n(t.id))),t.getAllNodes().length},Wg=(t,e)=>tg(e.getAllEdges(),(n=>t.hasNode(n.source)!==t.hasNode(n.target)?Fg(e,n):1/0)),Ug=(t,e,n)=>{t.getAllNodes().forEach((t=>{const r=e.getNode(t.id);r.data.rank||(r.data.rank=0),r.data.rank+=n}))},Hg=t=>{const e=(t=>{const e=new Lp;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const n=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));n?e.updateEdgeData(null==n?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+t.data.weight||0,minlen:Math.max(n.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);Bg(e);const n=(t=>{const e=new Lp({tree:[]}),n=t.getAllNodes()[0],r=t.getAllNodes().length;let i,o;for(e.addNode(n);Gg(e,t)<r;)i=Wg(e,t),o=e.hasNode(i.source)?Fg(t,i):-Fg(t,i),Ug(e,t,o);return e})(e);let r,i;for(Kg(n),qg(n,e);r=Zg(n);)i=Qg(n,e,r),Jg(n,e,r,i)},qg=(t,e)=>{let n=ng(t,t.getAllNodes(),"post",!1);n=n.slice(0,(null==n?void 0:n.length)-1),n.forEach((n=>{$g(t,e,n)}))},$g=(t,e,n)=>{const r=t.getNode(n).data.parent;t.getRelatedEdges(n,"both").find((t=>t.target===r||t.source===r)).data.cutvalue=Yg(t,e,n)},Yg=(t,e,n)=>{const r=t.getNode(n).data.parent;let i=!0,o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),a=0;return o||(i=!1,o=e.getRelatedEdges(r,"out").find((t=>t.target===n))),a=o.data.weight,e.getRelatedEdges(n,"both").forEach((e=>{const o=e.source===n,s=o?e.target:e.source;if(s!==r){const r=o===i,c=e.data.weight;if(a+=r?c:-c,em(t,n,s)){const e=t.getRelatedEdges(n,"both").find((t=>t.source===s||t.target===s)).data.cutvalue;a+=r?-e:e}}})),a},Kg=(t,e=t.getAllNodes()[0].id)=>{Xg(t,{},1,e)},Xg=(t,e,n,r,i)=>{var o;const a=n;let s=n;const c=t.getNode(r);return e[r]=!0,null===(o=t.getNeighbors(r))||void 0===o||o.forEach((n=>{e[n.id]||(s=Xg(t,e,s,n.id,r))})),c.data.low=a,c.data.lim=s++,i?c.data.parent=i:delete c.data.parent,s},Zg=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),Qg=(t,e,n)=>{let r=n.source,i=n.target;e.getRelatedEdges(r,"out").find((t=>t.target===i))||(r=n.target,i=n.source);const o=t.getNode(r),a=t.getNode(i);let s=o,c=!1;o.data.lim>a.data.lim&&(s=a,c=!0);const u=e.getAllEdges().filter((e=>c===nm(t.getNode(e.source),s)&&c!==nm(t.getNode(e.target),s)));return tg(u,(t=>Fg(e,t)))},Jg=(t,e,n,r)=>{const i=t.getRelatedEdges(n.source,"both").find((t=>t.source===n.target||t.target===n.target));i&&t.removeEdge(i.id),t.addEdge({id:`e${Math.random()}`,source:r.source,target:r.target,data:{}}),Kg(t),qg(t,e),tm(t,e)},tm=(t,e)=>{const n=t.getAllNodes().find((t=>!t.data.parent));let r=ng(t,n,"pre",!1);r=r.slice(1),r.forEach((n=>{const r=t.getNode(n).data.parent;let i=e.getRelatedEdges(n,"out").find((t=>t.target===r)),o=!1;!i&&e.hasNode(r)&&(i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),o=!0),e.getNode(n).data.rank=(e.hasNode(r)&&e.getNode(r).data.rank||0)+(o?null==i?void 0:i.data.minlen:-(null==i?void 0:i.data.minlen))}))},em=(t,e,n)=>t.getRelatedEdges(e,"both").find((t=>t.source===n||t.target===n)),nm=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,rm=Bg,im=t=>{(t=>{const e={};let n;const r=i=>{var o;const a=t.getNode(i);if(!a)return 0;if(e[i])return a.data.rank;let s;return e[i]=!0,null===(o=t.getRelatedEdges(i,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),(void 0===n||s<n)&&(n=s),a.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&r(t.id)})),void 0===n&&(n=0);const i={},o=(e,n)=>{var r;const a=t.getNode(e),s=isNaN(a.data.layer)?n:a.data.layer;(void 0===a.data.rank||a.data.rank<s)&&(a.data.rank=s),i[e]||(i[e]=!0,null===(r=t.getRelatedEdges(e,"out"))||void 0===r||r.forEach((t=>{o(t.target,s+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=n:o(t.id,e.layer))}))})(t),(t=>{const e=new Lp({tree:[]}),n=t.getAllNodes()[0],r=t.getAllNodes().length;let i,o;for(e.addNode(n);Vg(e,t)<r;)i=Wg(e,t),o=e.hasNode(i.source)?Fg(t,i):-Fg(t,i),Ug(e,t,o)})(t)},om=t=>{Hg(t)},am=(t,e)=>{const{acyclicer:n,ranker:r,rankdir:i="tb",nodeOrder:o,keepNodeOrder:a,align:s,nodesep:c=50,edgesep:u=20,ranksep:l=50}=e;Nm(t),qp(t,n);const{nestingRoot:h,nodeRankFactor:d}=(t=>{const e=Yp(t,"root",{},"_root"),n=hg(t);let r=Math.max(...Object.values(n));Math.abs(r)===1/0&&(r=1);const i=r-1,o=2*i+1;t.getAllEdges().forEach((t=>{t.data.minlen*=o}));const a=dg(t)+1;return t.getRoots().forEach((r=>{lg(t,e,o,a,i,n,r.id)})),{nestingRoot:e,nodeRankFactor:o}})(t);((t,e)=>{switch(e){case"network-simplex":om(t);break;case"tight-tree":default:im(t);break;case"longest-path":rm(t)}})(Kp(t),r),mm(t),((t,e=0)=>{const n=t.getAllNodes(),r=n.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),i=Math.min(...r),o=[];n.forEach((t=>{const e=(t.data.rank||0)-i;o[e]||(o[e]=[]),o[e].push(t.id)}));let a=0;for(let n=0;n<o.length;n++){const r=o[n];void 0===r?n%e!=0&&(a-=1):a&&(null==r||r.forEach((e=>{const n=t.getNode(e);n&&(n.data.rank=n.data.rank||0,n.data.rank+=a)})))}})(t,d),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,h),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),n=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&n!==1/0&&(t.data.rank-=n)}))})(t),vm(t),ym(t);const f=[];((t,e)=>{t.getAllEdges().forEach((n=>pg(t,n,e)))})(t,f),Pg(t,f),(t=>{const e=n=>{const r=t.getChildren(n),i=t.getNode(n);if((null==r?void 0:r.length)&&r.forEach((t=>e(t.id))),i.data.hasOwnProperty("minRank")){i.data.borderLeft=[],i.data.borderRight=[];for(let e=i.data.minRank,r=i.data.maxRank+1;e<r;e+=1)rg(t,"borderLeft","_bl",n,i,e),rg(t,"borderRight","_br",n,i,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),a&&((t,e)=>{const n=t.getAllNodes().filter((e=>{var n;return!(null===(n=t.getChildren(e.id))||void 0===n?void 0:n.length)})),r=n.map((t=>t.data.rank)),i=Math.max(...r),o=[];for(let t=0;t<i+1;t++)o[t]=[];null==e||e.forEach((e=>{const n=t.getNode(e);n&&!n.data.dummy&&(isNaN(n.data.rank)||(n.data.fixorder=o[n.data.rank].length,o[n.data.rank].push(e)))}))})(t,o),((t,e)=>{const n=Jp(t),r=[],i=[];for(let t=1;t<n+1;t++)r.push(t);for(let t=n-1;t>-1;t--)i.push(t);const o=Cg(t,r,"in"),a=Cg(t,i,"out");let s=yg(t);kg(t,s);let c,u=Number.POSITIVE_INFINITY;for(let n=0,r=0;r<4;++n,++r){Tg(n%2?o:a,n%4>=2,!1,e),s=Zp(t);const i=vg(t,s);i<u&&(r=0,c=Jt(s),u=i)}s=yg(t),kg(t,s);for(let n=0,r=0;r<4;++n,++r){Tg(n%2?o:a,n%4>=2,!0,e),s=Zp(t);const i=vg(t,s);i<u&&(r=0,c=Jt(s),u=i)}kg(t,c)})(t,a),Sm(t),((t,e)=>{const n=e.toLowerCase();"lr"!==n&&"rl"!==n||ig(t)})(t,i),zg(t,{align:s,nodesep:c,edgesep:u,ranksep:l}),Cm(t),Mm(t),((t,e)=>{e.forEach((e=>{let n=t.getNode(e);const{data:r}=n,i=r.originalEdge;let o;i&&t.addEdge(i);let a=e;for(;n.data.dummy;)o=t.getSuccessors(a)[0],t.removeNode(a),i.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===fg&&(i.data.x=n.data.x,i.data.y=n.data.y,i.data.width=n.data.width,i.data.height=n.data.height),a=o.id,n=t.getNode(a)}))})(t,f),Em(t),((t,e)=>{const n=e.toLowerCase();"bt"!==n&&"rl"!==n||ag(t),"lr"!==n&&"rl"!==n||(cg(t),ig(t))})(t,i);const{width:p,height:g}=bm(t);return xm(t),wm(t),(t=>{t.getAllEdges().forEach((e=>{const n=e.data;if(n.reversed){t.removeEdge(e.id);const r=n.forwardName;delete n.reversed,delete n.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},n),{forwardName:r})})}}))})(t),{width:p,height:g}},sm=(t,e)=>{t.getAllNodes().forEach((n=>{const r=t.getNode(n.id);if(e.hasNode(n.id)){const t=e.getNode(n.id);r.data.fixorder=t.data._order,delete t.data._order}else delete r.data.fixorder}))},cm=(t,e)=>{t.getAllNodes().forEach((n=>{var r;const i=t.getNode(n.id);if(i){const t=e.getNode(n.id);i.data.x=t.data.x,i.data.y=t.data.y,i.data._order=t.data.order,i.data._rank=t.data.rank,(null===(r=e.getChildren(n.id))||void 0===r?void 0:r.length)&&(i.data.width=t.data.width,i.data.height=t.data.height)}})),t.getAllEdges().forEach((n=>{const r=t.getEdge(n.id),i=e.getEdge(n.id);r.data.points=i?i.data.points:[],i&&i.data.hasOwnProperty("x")&&(r.data.x=i.data.x,r.data.y=i.data.y)}))},um=["width","height","layer","fixorder"],lm={width:0,height:0},hm=["minlen","weight","width","height","labeloffset"],dm={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},fm=["labelpos"],pm=t=>{const e=new Lp({tree:[]});return t.getAllNodes().forEach((n=>{const r=km(t.getNode(n.id).data),i=Object.assign(Object.assign({},lm),r),o=Tm(i,um);e.hasNode(n.id)||e.addNode({id:n.id,data:Object.assign({},o)});const a=t.hasTreeStructure("combo")?t.getParent(n.id,"combo"):t.getParent(n.id);Pt(a)||(e.hasNode(a.id)||e.addNode(Object.assign({},a)),e.setParent(n.id,a.id))})),t.getAllEdges().forEach((n=>{const r=km(t.getEdge(n.id).data),i={};null==fm||fm.forEach((t=>{void 0!==r[t]&&(i[t]=r[t])})),e.addEdge({id:n.id,source:n.source,target:n.target,data:Object.assign({},dm,Tm(r,hm),i)})})),e},gm=(t,e)=>{const{ranksep:n=0,rankdir:r}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===r||"BT"===r?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),n/2},mm=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const n=t.getNode(e.source),r={e:e,rank:(t.getNode(e.target).data.rank-n.data.rank)/2+n.data.rank};Yp(t,"edge-proxy",r,"_ep")}}))},vm=t=>{let e=0;return t.getAllNodes().forEach((n=>{var r,i;n.data.borderTop&&(n.data.minRank=null===(r=t.getNode(n.data.borderTop))||void 0===r?void 0:r.data.rank,n.data.maxRank=null===(i=t.getNode(n.data.borderBottom))||void 0===i?void 0:i.data.rank,e=Math.max(e,n.data.maxRank||-1/0))})),e},ym=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},bm=(t,e)=>{let n,r,i=0,o=0;const{marginx:a=0,marginy:s=0}=e||{},c=t=>{if(!t.data)return;const e=t.data.x,a=t.data.y,s=t.data.width,c=t.data.height;isNaN(e)||isNaN(s)||(void 0===n&&(n=e-s/2),n=Math.min(n,e-s/2),i=Math.max(i,e+s/2)),isNaN(a)||isNaN(c)||(void 0===r&&(r=a-c/2),r=Math.min(r,a-c/2),o=Math.max(o,a+c/2))};return t.getAllNodes().forEach((t=>{c(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&c(t)})),n-=a,r-=s,t.getAllNodes().forEach((t=>{t.data.x-=n,t.data.y-=r})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=n,t.y-=r})),t.data.hasOwnProperty("x")&&(t.data.x-=n),t.data.hasOwnProperty("y")&&(t.data.y-=r)})),{width:i-n+a,height:o-r+s}},xm=t=>{t.getAllEdges().forEach((e=>{const n=t.getNode(e.source),r=t.getNode(e.target);let i,o;e.data.points?(i=e.data.points[0],o=e.data.points[e.data.points.length-1]):(e.data.points=[],i={x:r.data.x,y:r.data.y},o={x:n.data.x,y:n.data.y}),e.data.points.unshift(Xp(n.data,i)),e.data.points.push(Xp(r.data,o))}))},Em=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},wm=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Mm=t=>{t.getAllNodes().forEach((e=>{var n,r,i;if(null===(n=t.getChildren(e.id))||void 0===n?void 0:n.length){const n=t.getNode(e.id),o=t.getNode(n.data.borderTop),a=t.getNode(n.data.borderBottom),s=t.getNode(n.data.borderLeft[(null===(r=n.data.borderLeft)||void 0===r?void 0:r.length)-1]),c=t.getNode(n.data.borderRight[(null===(i=n.data.borderRight)||void 0===i?void 0:i.length)-1]);n.data.width=Math.abs((null==c?void 0:c.data.x)-(null==s?void 0:s.data.x))||10,n.data.height=Math.abs((null==a?void 0:a.data.y)-(null==o?void 0:o.data.y))||10,n.data.x=((null==s?void 0:s.data.x)||0)+n.data.width/2,n.data.y=((null==o?void 0:o.data.y)||0)+n.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},Nm=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const n=t.getNode(e.source);n.data.selfEdges||(n.data.selfEdges=[]),n.data.selfEdges.push(e),t.removeEdge(e.id)}}))},Sm=t=>{const e=Zp(t);null==e||e.forEach((e=>{let n=0;null==e||e.forEach(((e,r)=>{var i;const o=t.getNode(e);o.data.order=r+n,null===(i=o.data.selfEdges)||void 0===i||i.forEach((e=>{Yp(t,"selfedge",{width:e.data.width,height:e.data.height,rank:o.data.rank,order:r+ ++n,e:e},"_se")})),delete o.data.selfEdges}))}))},Cm=t=>{t.getAllNodes().forEach((e=>{const n=t.getNode(e.id);if("selfedge"===n.data.dummy){const r=t.getNode(n.data.e.source),i=r.data.x+r.data.width/2,o=r.data.y,a=n.data.x-i,s=r.data.height/2;t.hasEdge(n.data.e.id)?t.updateEdgeData(n.data.e.id,n.data.e.data):t.addEdge({id:n.data.e.id,source:n.data.e.source,target:n.data.e.target,data:n.data.e.data}),t.removeNode(e.id),n.data.e.data.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{y:o,x:i+a},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.data.e.data.x=n.data.x,n.data.e.data.y=n.data.y}}))},Tm=(t,e)=>{const n={};return null==e||e.forEach((e=>{void 0!==t[e]&&(n[e]=+t[e])})),n},km=(t={})=>{const e={};return Object.keys(t).forEach((n=>{e[n.toLowerCase()]=t[n]})),e},Pm=Array.isArray,Am=t=>{const e=[],n=t.length;for(let r=0;r<n;r+=1){e[r]=[];for(let i=0;i<n;i+=1)r===i?e[r][i]=0:0!==t[r][i]&&t[r][i]?e[r][i]=t[r][i]:e[r][i]=1/0}for(let t=0;t<n;t+=1)for(let r=0;r<n;r+=1)for(let i=0;i<n;i+=1)e[r][i]>e[r][t]+e[t][i]&&(e[r][i]=e[r][t]+e[t][i]);return e},Om=(t,e)=>{const{nodes:n,edges:r}=t,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(((t,e)=>{o[t.id]=e;i.push([])})),null==r||r.forEach((t=>{const{source:n,target:r}=t,a=o[n],s=o[r];void 0!==a&&void 0!==s&&(i[a][s]=1,e||(i[s][a]=1))})),i},_m=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),Rm=(t,e,n,r="TB",i,o={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:a,stopAllFn:s}=o;for(let c=0;c<e.length;c++){const u=e[c];if(t.hasNode(u.id)&&!(null==a?void 0:a(u))){if(null==s?void 0:s(u))return;"TB"===r&&n(u),Rm(t,t.getChildren(u.id,i),n,r,i,o),"TB"!==r&&n(u)}}},Dm=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>Dm(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((n=>{e[n]=Dm(t[n])})),e}return t},Im=(t,e)=>{const n=Dm(t);return n.data=n.data||{},e&&(Wt(n.data.x)||(n.data.x=Math.random()*e[0]),Wt(n.data.y)||(n.data.y=Math.random()*e[1])),n};function Lm(t,e){let n;return n=kt(e)?e:Wt(e)?()=>e:()=>t,n}function jm(t,e,n=!0){return e||0===e?kt(e)?e:Wt(e)?()=>e:Array.isArray(e)?()=>{if(n){const n=Math.max(...e);return isNaN(n)?t:n}return e}:Rt(e)?()=>{if(n){const n=Math.max(e.width,e.height);return isNaN(n)?t:n}return[e.width,e.height]}:()=>t:e=>{const{size:n}=e.data||{};return n?Array.isArray(n)?n[0]>n[1]?n[0]:n[1]:Rt(n)?n.width>n.height?n.width:n.height:n:t}}const zm=(t,e)=>{let n,r;return r=Wt(e)?()=>e:kt(e)?e:()=>0,n=t?Array.isArray(t)?e=>(t[0]>t[1]?t[0]:t[1])+r(e):kt(t)?t:e=>t+r(e):t=>{var e,n;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return Math.max(t.data.bboxSize[0],t.data.bboxSize[1])+r(t);if(null===(n=t.data)||void 0===n?void 0:n.size){if(Array.isArray(t.data.size))return Math.max(t.data.size[0],t.data.size[1])+r(t);const e=t.data.size;if(Rt(e)){return(e.width>e.height?e.width:e.height)+r(t)}return e+r(t)}return 10+r(t)},n},Bm={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};const Fm=(t,e,n,r,i,o,a)=>{let s=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&n){let{x:t,y:c}=e.data,{x:u,y:l}=n.data;if(i&&(t=e.data.y,c=e.data.x,u=n.data.y,l=n.data.x),l!==c&&t!==u){const h=r.indexOf(c),d=r[h+1];if(d){const t=s[0],e=i?{x:(c+d)/2,y:(null==t?void 0:t.y)||u}:{x:(null==t?void 0:t.x)||u,y:(c+d)/2};t&&!o(t,e)||s.unshift(e)}const f=r.indexOf(l),p=Math.abs(f-h);if(1===p)s=a(s,e.data,n.data),s.length||s.push(i?{x:(c+l)/2,y:t}:{x:t,y:(c+l)/2});else if(p>1){const e=r[f-1];if(e){const n=s[s.length-1],r=i?{x:(l+e)/2,y:(null==n?void 0:n.y)||u}:{x:(null==n?void 0:n.x)||t,y:(l+e)/2};n&&!o(n,r)||s.push(r)}}}}return s},Gm=(t,e,n)=>{const r=t.getAllNodes(),i=t.getAllEdges();if(!(null==r?void 0:r.length)){return{nodes:[],edges:i}}if(1===r.length){e&&t.mergeNodeData(r[0].id,{x:n[0],y:n[1]});return{nodes:[Object.assign(Object.assign({},r[0]),{data:Object.assign(Object.assign({},r[0].data),{x:n[0],y:n[1]})})],edges:i}}},Vm={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};const Wm=(t,e,n=!1)=>{const r=[Im(e[0])],i={},o=e.length;i[e[0].id]=!0;let a=0;return e.forEach(((s,c)=>{if(0!==c)if(c!==o-1&&t.getDegree(s.id,"both")===t.getDegree(e[c+1].id,"both")&&!t.areNeighbors(r[a].id,s.id)||i[s.id]){const c=n?t.getSuccessors(r[a].id):t.getNeighbors(r[a].id);let u=!1;for(let e=0;e<c.length;e++){const n=c[e];if(t.getDegree(n.id)===t.getDegree(s.id)&&!i[n.id]){r.push(Im(n)),i[n.id]=!0,u=!0;break}}let l=0;for(;!u&&(i[e[l].id]||(r.push(Im(e[l])),i[e[l].id]=!0,u=!0),l++,l!==o););}else r.push(Im(s)),i[s.id]=!0,a++})),r};const Um=(t,e,n)=>{let r=t,i=e,o=n;return r||"undefined"==typeof window||(r=window.innerWidth),i||"undefined"==typeof window||(i=window.innerHeight),o||(o=[r/2,i/2]),[r,i,o]},Hm={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class qm{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},Hm),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericConcentricLayout(!0,t,e)}))}genericConcentricLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{center:i,width:o,height:a,sortBy:s,maxLevelDiff:c,sweep:u,clockwise:l,equidistant:h,preventOverlap:d,startAngle:f=1.5*Math.PI,nodeSize:p,nodeSpacing:g}=r,m=e.getAllNodes(),v=e.getAllEdges(),y=o||"undefined"==typeof window?o:window.innerWidth,b=a||"undefined"==typeof window?a:window.innerHeight,x=i||[y/2,b/2];if(!(null==m?void 0:m.length)||1===m.length)return Gm(e,t,x);const E=[];let w,M=0;Pm(p)?w=Math.max(p[0],p[1]):kt(p)?(w=-1/0,m.forEach((t=>{const e=p(t);e>w&&(w=e)}))):w=p,Pm(g)?M=Math.max(g[0],g[1]):Wt(g)&&(M=g),m.forEach((t=>{const e=Im(t);E.push(e);let n=w;const{data:r}=e;Pm(r.size)?n=Math.max(r.size[0],r.size[1]):Wt(r.size)?n=r.size:Rt(r.size)&&(n=Math.max(r.size.width,r.size.height)),w=Math.max(w,n),kt(g)&&(M=Math.max(g(t),M))}));const N={};E.forEach(((t,e)=>{N[t.id]=e}));let S=s;Bt(S)&&void 0!==E[0].data[S]||(S="degree"),"degree"===S?E.sort(((t,n)=>e.getDegree(n.id,"both")-e.getDegree(t.id,"both"))):E.sort(((t,e)=>e.data[S]-t.data[S]));const C=E[0],T=(c||("degree"===S?e.getDegree(C.id,"both"):C.data[S]))/4,k=[{nodes:[]}];let P=k[0];E.forEach((t=>{if(P.nodes.length>0){const n="degree"===S?Math.abs(e.getDegree(P.nodes[0].id,"both")-e.getDegree(t.id,"both")):Math.abs(P.nodes[0].data[S]-t.data[S]);T&&n>=T&&(P={nodes:[]},k.push(P))}P.nodes.push(t)}));let A=w+M;if(!d){const t=k.length>0&&k[0].nodes.length>1,e=(Math.min(y,b)/2-A)/(k.length+(t?1:0));A=Math.min(A,e)}let O=0;if(k.forEach((t=>{const e=void 0===u?2*Math.PI-2*Math.PI/t.nodes.length:u;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&d){const e=Math.cos(t.dTheta)-Math.cos(0),n=Math.sin(t.dTheta)-Math.sin(0),r=Math.sqrt(A*A/(e*e+n*n));O=Math.max(r,O)}t.r=O,O+=A})),h){let t=0,e=0;for(let n=0;n<k.length;n++){const r=(k[n].r||0)-e;t=Math.max(t,r)}e=0,k.forEach(((n,r)=>{0===r&&(e=n.r||0),n.r=e,e+=t}))}k.forEach((t=>{const e=t.dTheta||0,n=t.r||0;t.nodes.forEach(((t,r)=>{const i=f+(l?1:-1)*e*r;t.data.x=x[0]+n*Math.cos(i),t.data.y=x[1]+n*Math.sin(i)}))})),t&&E.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:E,edges:v}}))}}function $m(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,c,u,l,h,d,f=t._root,p={data:r},g=t._x0,m=t._y0,v=t._x1,y=t._y1;if(!f)return t._root=p,t;for(;f.length;)if((u=e>=(o=(g+v)/2))?g=o:v=o,(l=n>=(a=(m+y)/2))?m=a:y=a,i=f,!(f=f[h=l<<1|u]))return i[h]=p,t;if(s=+t._x.call(null,f.data),c=+t._y.call(null,f.data),e===s&&n===c)return p.next=f,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(u=e>=(o=(g+v)/2))?g=o:v=o,(l=n>=(a=(m+y)/2))?m=a:y=a}while((h=l<<1|u)==(d=(c>=a)<<1|s>=o));return i[d]=f,i[h]=p,t}function Ym(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function Km(t){return t[0]}function Xm(t){return t[1]}function Zm(t,e,n){var r=new Qm(null==e?Km:e,null==n?Xm:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Qm(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Jm(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var tv=Zm.prototype=Qm.prototype;function ev(t,e,n,r,i){if(isNaN(e)||isNaN(n)||isNaN(r))return t;var o,a,s,c,u,l,h,d,f,p,g,m,v=t._root,y={data:i},b=t._x0,x=t._y0,E=t._z0,w=t._x1,M=t._y1,N=t._z1;if(!v)return t._root=y,t;for(;v.length;)if((d=e>=(a=(b+w)/2))?b=a:w=a,(f=n>=(s=(x+M)/2))?x=s:M=s,(p=r>=(c=(E+N)/2))?E=c:N=c,o=v,!(v=v[g=p<<2|f<<1|d]))return o[g]=y,t;if(u=+t._x.call(null,v.data),l=+t._y.call(null,v.data),h=+t._z.call(null,v.data),e===u&&n===l&&r===h)return y.next=v,o?o[g]=y:t._root=y,t;do{o=o?o[g]=new Array(8):t._root=new Array(8),(d=e>=(a=(b+w)/2))?b=a:w=a,(f=n>=(s=(x+M)/2))?x=s:M=s,(p=r>=(c=(E+N)/2))?E=c:N=c}while((g=p<<2|f<<1|d)==(m=(h>=c)<<2|(l>=s)<<1|u>=a));return o[m]=v,o[g]=y,t}function nv(t,e,n,r,i,o,a){this.node=t,this.x0=e,this.y0=n,this.z0=r,this.x1=i,this.y1=o,this.z1=a}function rv(t){return t[0]}function iv(t){return t[1]}function ov(t){return t[2]}function av(t,e,n,r){var i=new sv(null==e?rv:e,null==n?iv:n,null==r?ov:r,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function sv(t,e,n,r,i,o,a,s,c){this._x=t,this._y=e,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=c,this._root=void 0}function cv(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}tv.copy=function(){var t,e,n=new Qm(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=Jm(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=Jm(e));return n},tv.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return $m(this.cover(e,n),e,n,t)},tv.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),c=1/0,u=1/0,l=-1/0,h=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,s[n]=i,r<c&&(c=r),r>l&&(l=r),i<u&&(u=i),i>h&&(h=i));if(c>l||u>h)return this;for(this.cover(c,u).cover(l,h),n=0;n<o;++n)$m(this,a[n],s[n],t[n]);return this},tv.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,c=i-n||1,u=this._root;n>t||t>=i||r>e||e>=o;)switch(s=(e<r)<<1|t<n,(a=new Array(4))[s]=u,u=a,c*=2,s){case 0:i=n+c,o=r+c;break;case 1:n=i-c,o=r+c;break;case 2:i=n+c,r=o-c;break;case 3:n=i-c,r=o-c}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},tv.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},tv.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},tv.find=function(t,e,n){var r,i,o,a,s,c,u,l=this._x0,h=this._y0,d=this._x1,f=this._y1,p=[],g=this._root;for(g&&p.push(new Ym(g,l,h,d,f)),null==n?n=1/0:(l=t-n,h=e-n,d=t+n,f=e+n,n*=n);c=p.pop();)if(!(!(g=c.node)||(i=c.x0)>d||(o=c.y0)>f||(a=c.x1)<l||(s=c.y1)<h))if(g.length){var m=(i+a)/2,v=(o+s)/2;p.push(new Ym(g[3],m,v,a,s),new Ym(g[2],i,v,m,s),new Ym(g[1],m,o,a,v),new Ym(g[0],i,o,m,v)),(u=(e>=v)<<1|t>=m)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=c)}else{var y=t-+this._x.call(null,g.data),b=e-+this._y.call(null,g.data),x=y*y+b*b;if(x<n){var E=Math.sqrt(n=x);l=t-E,h=e-E,d=t+E,f=e+E,r=g.data}}return r},tv.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,s,c,u,l,h,d,f=this._root,p=this._x0,g=this._y0,m=this._x1,v=this._y1;if(!f)return this;if(f.length)for(;;){if((u=o>=(s=(p+m)/2))?p=s:m=s,(l=a>=(c=(g+v)/2))?g=c:v=c,e=f,!(f=f[h=l<<1|u]))return this;if(!f.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,d=h)}for(;f.data!==t;)if(r=f,!(f=f.next))return this;return(i=f.next)&&delete f.next,r?(i?r.next=i:delete r.next,this):e?(i?e[h]=i:delete e[h],(f=e[0]||e[1]||e[2]||e[3])&&f===(e[3]||e[2]||e[1]||e[0])&&!f.length&&(n?n[d]=f:this._root=f),this):(this._root=i,this)},tv.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},tv.root=function(){return this._root},tv.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},tv.visit=function(t){var e,n,r,i,o,a,s=[],c=this._root;for(c&&s.push(new Ym(c,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(c=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&c.length){var u=(r+o)/2,l=(i+a)/2;(n=c[3])&&s.push(new Ym(n,u,l,o,a)),(n=c[2])&&s.push(new Ym(n,r,l,u,a)),(n=c[1])&&s.push(new Ym(n,u,i,o,l)),(n=c[0])&&s.push(new Ym(n,r,i,u,l))}return this},tv.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new Ym(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,c=e.x1,u=e.y1,l=(a+c)/2,h=(s+u)/2;(o=i[0])&&n.push(new Ym(o,a,s,l,h)),(o=i[1])&&n.push(new Ym(o,l,s,c,h)),(o=i[2])&&n.push(new Ym(o,a,h,l,u)),(o=i[3])&&n.push(new Ym(o,l,h,c,u))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},tv.x=function(t){return arguments.length?(this._x=t,this):this._x},tv.y=function(t){return arguments.length?(this._y=t,this):this._y};var uv=av.prototype=sv.prototype;uv.copy=function(){var t,e,n=new sv(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),r=this._root;if(!r)return n;if(!r.length)return n._root=cv(r),n;for(t=[{source:r,target:n._root=new Array(8)}];r=t.pop();)for(var i=0;i<8;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(8)}):r.target[i]=cv(e));return n},uv.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t),r=+this._z.call(null,t);return ev(this.cover(e,n,r),e,n,r,t)},uv.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,n=new Float64Array(e),r=new Float64Array(e),i=new Float64Array(e);let o=1/0,a=1/0,s=1/0,c=-1/0,u=-1/0,l=-1/0;for(let h,d,f,p,g=0;g<e;++g)isNaN(d=+this._x.call(null,h=t[g]))||isNaN(f=+this._y.call(null,h))||isNaN(p=+this._z.call(null,h))||(n[g]=d,r[g]=f,i[g]=p,d<o&&(o=d),d>c&&(c=d),f<a&&(a=f),f>u&&(u=f),p<s&&(s=p),p>l&&(l=p));if(o>c||a>u||s>l)return this;this.cover(o,a,s).cover(c,u,l);for(let o=0;o<e;++o)ev(this,n[o],r[o],i[o],t[o]);return this},uv.cover=function(t,e,n){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,o=this._z0,a=this._x1,s=this._y1,c=this._z1;if(isNaN(r))a=(r=Math.floor(t))+1,s=(i=Math.floor(e))+1,c=(o=Math.floor(n))+1;else{for(var u,l,h=a-r||1,d=this._root;r>t||t>=a||i>e||e>=s||o>n||n>=c;)switch(l=(n<o)<<2|(e<i)<<1|t<r,(u=new Array(8))[l]=d,d=u,h*=2,l){case 0:a=r+h,s=i+h,c=o+h;break;case 1:r=a-h,s=i+h,c=o+h;break;case 2:a=r+h,i=s-h,c=o+h;break;case 3:r=a-h,i=s-h,c=o+h;break;case 4:a=r+h,s=i+h,o=c-h;break;case 5:r=a-h,s=i+h,o=c-h;break;case 6:a=r+h,i=s-h,o=c-h;break;case 7:r=a-h,i=s-h,o=c-h}this._root&&this._root.length&&(this._root=d)}return this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=c,this},uv.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},uv.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},uv.find=function(t,e,n,r){var i,o,a,s,c,u,l,h,d,f=this._x0,p=this._y0,g=this._z0,m=this._x1,v=this._y1,y=this._z1,b=[],x=this._root;for(x&&b.push(new nv(x,f,p,g,m,v,y)),null==r?r=1/0:(f=t-r,p=e-r,g=n-r,m=t+r,v=e+r,y=n+r,r*=r);h=b.pop();)if(!(!(x=h.node)||(o=h.x0)>m||(a=h.y0)>v||(s=h.z0)>y||(c=h.x1)<f||(u=h.y1)<p||(l=h.z1)<g))if(x.length){var E=(o+c)/2,w=(a+u)/2,M=(s+l)/2;b.push(new nv(x[7],E,w,M,c,u,l),new nv(x[6],o,w,M,E,u,l),new nv(x[5],E,a,M,c,w,l),new nv(x[4],o,a,M,E,w,l),new nv(x[3],E,w,s,c,u,M),new nv(x[2],o,w,s,E,u,M),new nv(x[1],E,a,s,c,w,M),new nv(x[0],o,a,s,E,w,M)),(d=(n>=M)<<2|(e>=w)<<1|t>=E)&&(h=b[b.length-1],b[b.length-1]=b[b.length-1-d],b[b.length-1-d]=h)}else{var N=t-+this._x.call(null,x.data),S=e-+this._y.call(null,x.data),C=n-+this._z.call(null,x.data),T=N*N+S*S+C*C;if(T<r){var k=Math.sqrt(r=T);f=t-k,p=e-k,g=n-k,m=t+k,v=e+k,y=n+k,i=x.data}}return i},uv.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var e,n,r,i,o,a,s,c,u,l,h,d,f,p,g,m=this._root,v=this._x0,y=this._y0,b=this._z0,x=this._x1,E=this._y1,w=this._z1;if(!m)return this;if(m.length)for(;;){if((h=o>=(c=(v+x)/2))?v=c:x=c,(d=a>=(u=(y+E)/2))?y=u:E=u,(f=s>=(l=(b+w)/2))?b=l:w=l,e=m,!(m=m[p=f<<2|d<<1|h]))return this;if(!m.length)break;(e[p+1&7]||e[p+2&7]||e[p+3&7]||e[p+4&7]||e[p+5&7]||e[p+6&7]||e[p+7&7])&&(n=e,g=p)}for(;m.data!==t;)if(r=m,!(m=m.next))return this;return(i=m.next)&&delete m.next,r?(i?r.next=i:delete r.next,this):e?(i?e[p]=i:delete e[p],(m=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&m===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!m.length&&(n?n[g]=m:this._root=m),this):(this._root=i,this)},uv.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},uv.root=function(){return this._root},uv.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},uv.visit=function(t){var e,n,r,i,o,a,s,c,u=[],l=this._root;for(l&&u.push(new nv(l,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=u.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,o=e.z0,a=e.x1,s=e.y1,c=e.z1)&&l.length){var h=(r+a)/2,d=(i+s)/2,f=(o+c)/2;(n=l[7])&&u.push(new nv(n,h,d,f,a,s,c)),(n=l[6])&&u.push(new nv(n,r,d,f,h,s,c)),(n=l[5])&&u.push(new nv(n,h,i,f,a,d,c)),(n=l[4])&&u.push(new nv(n,r,i,f,h,d,c)),(n=l[3])&&u.push(new nv(n,h,d,o,a,s,f)),(n=l[2])&&u.push(new nv(n,r,d,o,h,s,f)),(n=l[1])&&u.push(new nv(n,h,i,o,a,d,f)),(n=l[0])&&u.push(new nv(n,r,i,o,h,d,f))}return this},uv.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new nv(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,c=e.z0,u=e.x1,l=e.y1,h=e.z1,d=(a+u)/2,f=(s+l)/2,p=(c+h)/2;(o=i[0])&&n.push(new nv(o,a,s,c,d,f,p)),(o=i[1])&&n.push(new nv(o,d,s,c,u,f,p)),(o=i[2])&&n.push(new nv(o,a,f,c,d,l,p)),(o=i[3])&&n.push(new nv(o,d,f,c,u,l,p)),(o=i[4])&&n.push(new nv(o,a,s,p,d,f,h)),(o=i[5])&&n.push(new nv(o,d,s,p,u,f,h)),(o=i[6])&&n.push(new nv(o,a,f,p,d,l,h)),(o=i[7])&&n.push(new nv(o,d,f,p,u,l,h))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},uv.x=function(t){return arguments.length?(this._x=t,this):this._x},uv.y=function(t){return arguments.length?(this._y=t,this):this._y},uv.z=function(t){return arguments.length?(this._z=t,this):this._z};function lv(t,e,n,r,i=2){const o=e/n,a=t.getAllNodes(),s=a.map(((t,e)=>{const{nodeStrength:n,x:r,y:i,z:a,size:s}=t.data;return{x:r,y:i,z:a,size:s,index:e,id:t.id,vx:0,vy:0,vz:0,weight:o*n}})),c=(2===i?Zm(s,(t=>t.x),(t=>t.y)):av(s,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(hv),u=new Map;return s.forEach((t=>{u.set(t.id,t),function(t,e,n){e.visit(((e,r,i,o,a)=>dv(e,r,i,o,a,t,n)))}(t,c,i)})),s.map(((t,e)=>{const{id:n,data:i}=a[e],{mass:o=1}=i;r[n]={x:t.vx/o,y:t.vy/o,z:t.vz/o}})),r}function hv(t){let e=0,n=0,r=0,i=0,o=0;const a=t.length;if(a){for(let s=0;s<a;s++){const a=t[s];a&&a.weight&&(e+=a.weight,n+=a.x*a.weight,r+=a.y*a.weight,i+=a.z*a.weight,o+=a.size*a.weight)}t.x=n/e,t.y=r/e,t.z=i/e,t.size=o/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}const dv=(t,e,n,r,i,o,a)=>{var s;if((null===(s=t.data)||void 0===s?void 0:s.id)===o.id)return;const c=[n,r,i][a-1],u=o.x-t.x||.1,l=o.y-t.y||.1,h=o.z-t.z||.1,d=[u,l,h],f=c-e;let p=0;for(let t=0;t<a;t++)p+=d[t]*d[t];const g=Math.sqrt(p)*p;if(f*f*.81<p){const e=t.weight/g;return o.vx+=u*e,o.vy+=l*e,o.vz+=h*e,!0}if(t.length)return!1;if(t.data!==o){const e=t.data.weight/g;o.vx+=u*e,o.vy+=l*e,o.vz+=h*e}};const fv={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class pv{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},fv),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericForceLayout(!0,t,e)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),i=e.getAllNodes(),o=e.getAllEdges(),a=this.formatOptions(r,e),{dimensions:s,width:c,height:u,nodeSize:l,getMass:h,nodeStrength:d,edgeStrength:f,linkDistance:p}=a,g=i.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:Wt(t.data.x)?t.data.x:Math.random()*c,y:Wt(t.data.y)?t.data.y:Math.random()*u,z:Wt(t.data.z)?t.data.z:Math.random()*Math.sqrt(c*u),size:l(t)||30,mass:h(t),nodeStrength:d(t)})}))),m=o.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:f(t),linkDistance:p(t,e.getNode(t.source),e.getNode(t.target))})})));if(!(null==i?void 0:i.length))return this.lastResult={nodes:[],edges:o},{nodes:[],edges:o};const v={};i.forEach(((t,e)=>{v[t.id]={x:0,y:0,z:0}}));const y=new Lp({nodes:g,edges:m});this.formatCentripetal(a,y);const{maxIteration:b,minMovement:x,onTick:E}=a;if(this.lastLayoutNodes=g,this.lastLayoutEdges=m,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=y,this.lastOptions=a,this.lastVelMap=v,"undefined"==typeof window)return;let w=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{i&&this.running||n({nodes:bv(e,g),edges:o}),this.runOneStep(y,e,w,v,a),this.updatePosition(e,y,v,a),t&&g.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===s?t.data.z:void 0}))),null==E||E({nodes:bv(e,g),edges:o}),w++,(w>=b||this.judgingDistance<x)&&(window.clearInterval(this.timeInterval),n({nodes:bv(e,g),edges:o}))}),0),this.running=!0}))}))}formatOptions(t,e){const n=Object.assign({},t),{width:r,height:i,getMass:o,nodeSize:a}=t;n.width=r||"undefined"==typeof window?r:window.innerWidth,n.height=i||"undefined"==typeof window?i:window.innerHeight,t.center||(n.center=[n.width/2,n.height/2]),o||(n.getMass=t=>{let n=1;Wt(null==t?void 0:t.data.mass)&&(n=null==t?void 0:t.data.mass);const r=e.getDegree(t.id,"both");return!r||r<5?n:5*r*n});const s=Lm(0,t.nodeSpacing);let c;c=a?kt(a)?t=>a(t)+s(t):Pm(a)?t=>{const e=a;return Math.max(e[0],e[1])+s(t)}:t=>a+s(t):t=>{const{size:e}=(null==t?void 0:t.data)||{};return e?Pm(e)?Math.max(e[0],e[1])+s(t):Rt(e)?Math.max(e.width,e.height)+s(t):e+s(t):10+s(t)},n.nodeSize=c;const u=t.linkDistance?Lm(1,t.linkDistance):t=>1+n.nodeSize(e.getNode(t.source))+n.nodeSize(e.getNode(t.target));return n.linkDistance=u,n.nodeStrength=Lm(1,t.nodeStrength),n.edgeStrength=Lm(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:r,center:i,clusterNodeStrength:o,leafCluster:a,clustering:s,nodeClusterBy:c}=t,u=e.getAllNodes(),l=r||{leaf:2,single:2,others:1,center:t=>({x:i[0],y:i[1],z:3===n?i[2]:void 0})};let h,d;if("function"!=typeof o&&(t.clusterNodeStrength=t=>o),a&&c&&(h=gv(e,c),d=Array.from(new Set(null==u?void 0:u.map((t=>t.data[c]))))||[],t.centripetalOptions=Object.assign(l,{single:100,leaf:e=>{const{siblingLeaves:n,sameTypeLeaves:r}=h[e.id]||{};return(null==r?void 0:r.length)===(null==n?void 0:n.length)||1===(null==d?void 0:d.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const n=e.getDegree(t.id,"both");if(!n)return{x:100,y:100,z:0};let r;if(1===n){const{sameTypeLeaves:e=[]}=h[t.id]||{};1===e.length?r=void 0:e.length>1&&(r=yv(e))}else r=void 0;return{x:null==r?void 0:r.x,y:null==r?void 0:r.y,z:null==r?void 0:r.z}}})),s&&c){h||(h=gv(e,c)),d||(d=Array.from(new Set(u.map((t=>t.data[c]))))),d=d.filter((t=>void 0!==t));const n={};d.forEach((t=>{const r=u.filter((e=>e.data[c]===t)).map((t=>e.getNode(t.id)));n[t]=yv(r)})),t.centripetalOptions=Object.assign(l,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=n[t.data[c]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:f,single:p,others:g}=t.centripetalOptions||{};f&&"function"!=typeof f&&(t.centripetalOptions.leaf=()=>f),p&&"function"!=typeof p&&(t.centripetalOptions.single=()=>p),g&&"function"!=typeof g&&(t.centripetalOptions.others=()=>g)}runOneStep(t,e,n,r,i){const o={},a=t.getAllNodes(),s=t.getAllEdges();if(!(null==a?void 0:a.length))return;const{monitor:c}=i;if(this.calRepulsive(t,o,i),s&&this.calAttractive(t,o,i),this.calGravity(t,e,o,i),this.updateVelocity(t,o,r,i),c){c({energy:this.calTotalEnergy(o,a),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})}}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let n=0;return e.forEach(((e,r)=>{const i=t[e.id].x,o=t[e.id].y,a=3===this.options.dimensions?t[e.id].z:0,s=i*i+o*o+a*a,{mass:c=1}=e.data;n+=c*s*.5})),n}calRepulsive(t,e,n){const{dimensions:r,factor:i,coulombDisScale:o}=n;lv(t,i,o*o,e,r)}calAttractive(t,e,n){const{dimensions:r,nodeSize:i}=n;t.getAllEdges().forEach(((n,o)=>{const{source:a,target:s}=n,c=t.getNode(a),u=t.getNode(s);if(!c||!u)return;let l=u.data.x-c.data.x,h=u.data.y-c.data.y,d=3===r?u.data.z-c.data.z:0;l||h||(l=.01*Math.random(),h=.01*Math.random(),3!==r||d||(d=.01*Math.random()));const f=Math.sqrt(l*l+h*h+d*d);if(f<i(c)+i(u))return;const p=l/f,g=h/f,m=d/f,{linkDistance:v=200,edgeStrength:y=200}=n.data||{},b=(v-f)*y,x=1/(c.data.mass||1),E=1/(u.data.mass||1),w=p*b,M=g*b,N=m*b;e[a].x-=w*x,e[a].y-=M*x,e[a].z-=N*x,e[s].x+=w*E,e[s].y+=M*E,e[s].z+=N*E}))}calGravity(t,e,n,r){const{getCenter:i}=r,o=t.getAllNodes(),a=e.getAllNodes(),s=e.getAllEdges(),{width:c,height:u,center:l,gravity:h,centripetalOptions:d}=r;o&&o.forEach((r=>{const{id:o,data:f}=r,{mass:p,x:g,y:m,z:v}=f,y=e.getNode(o);let b=0,x=0,E=0,w=h;const M=t.getDegree(o,"in"),N=t.getDegree(o,"out"),S=t.getDegree(o,"both"),C=null==i?void 0:i(y,S);if(C){const[t,e,n]=C;b=g-t,x=m-e,w=n}else b=g-l[0],x=m-l[1],E=v-l[2];if(w&&(n[o].x-=w*b/p,n[o].y-=w*x/p,n[o].z-=w*E/p),d){const{leaf:t,single:e,others:r,center:i}=d,{x:l,y:h,z:f,centerStrength:b}=(null==i?void 0:i(y,a,s,c,u))||{x:0,y:0,z:0,centerStrength:0};if(!Wt(l)||!Wt(h))return;const x=(g-l)/p,E=(m-h)/p,w=(v-f)/p;if(b&&(n[o].x-=b*x,n[o].y-=b*E,n[o].z-=b*w),0===S){const t=e(y);if(!t)return;return n[o].x-=t*x,n[o].y-=t*E,void(n[o].z-=t*w)}if(0===M||0===N){const e=t(y,a,s);if(!e)return;return n[o].x-=e*x,n[o].y-=e*E,void(n[o].z-=e*w)}const C=r(y);if(!C)return;n[o].x-=C*x,n[o].y-=C*E,n[o].z-=C*w}}))}updateVelocity(t,e,n,r){const{damping:i,maxSpeed:o,interval:a,dimensions:s}=r,c=t.getAllNodes();(null==c?void 0:c.length)&&c.forEach((t=>{const{id:r}=t;let c=(n[r].x+e[r].x*a)*i||.01,u=(n[r].y+e[r].y*a)*i||.01,l=3===s?(n[r].z+e[r].z*a)*i||.01:0;const h=Math.sqrt(c*c+u*u+l*l);if(h>o){const t=o/h;c*=t,u*=t,l*=t}n[r]={x:c,y:u,z:l}}))}updatePosition(t,e,n,r){const{distanceThresholdMode:i,interval:o,dimensions:a}=r,s=e.getAllNodes();if(!(null==s?void 0:s.length))return void(this.judgingDistance=0);let c=0;"max"===i?this.judgingDistance=-1/0:"min"===i&&(this.judgingDistance=1/0),s.forEach((r=>{const{id:s}=r,u=t.getNode(s);if(Wt(u.data.fx)&&Wt(u.data.fy))return void e.mergeNodeData(s,{x:u.data.fx,y:u.data.fy,z:3===a?u.data.fz:void 0});const l=n[s].x*o,h=n[s].y*o,d=3===a?n[s].z*o:0;e.mergeNodeData(s,{x:r.data.x+l,y:r.data.y+h,z:r.data.z+d});const f=Math.sqrt(l*l+h*h+d*d);switch(i){case"max":this.judgingDistance<f&&(this.judgingDistance=f);break;case"min":this.judgingDistance>f&&(this.judgingDistance=f);break;default:c+=f}})),i&&"mean"!==i||(this.judgingDistance=c/s.length)}}const gv=(t,e)=>{const n=t.getAllNodes();if(!(null==n?void 0:n.length))return{};const r={};return n.forEach(((n,i)=>{1===t.getDegree(n.id,"both")&&(r[n.id]=mv(t,"leaf",n,e))})),r},mv=(t,e,n,r)=>{const i=t.getDegree(n.id,"in"),o=t.getDegree(n.id,"out");let a=n,s=[];0===i?(a=t.getSuccessors(n.id)[0],s=t.getNeighbors(a.id)):0===o&&(a=t.getPredecessors(n.id)[0],s=t.getNeighbors(a.id)),s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")));return{coreNode:a,siblingLeaves:s,sameTypeLeaves:vv(t,e,r,n,s)}},vv=(t,e,n,r,i)=>{const o=r.data[n]||"";let a=(null==i?void 0:i.filter((t=>t.data[n]===o)))||[];return"leaf"===e&&(a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),a},yv=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:n,y:r}=t.data;e.x+=n||0,e.y+=r||0}));const n=t.length||1;return{x:e.x/n,y:e.y/n}},bv=(t,e)=>e.map((e=>{const{id:n,data:r}=e,i=t.getNode(n);return Object.assign(Object.assign({},i),{data:Object.assign(Object.assign({},i.data),{x:r.x,y:r.y,z:r.z})})}));var xv={};const Ev=Object.prototype.toString;function wv(t){const e=Ev.call(t);return e.endsWith("Array]")&&!e.includes("Big")}var Mv=p(Object.freeze({__proto__:null,isAnyArray:wv}));var Nv=Object.freeze({__proto__:null,default:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!wv(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!wv(n.output))throw new TypeError("output option must be an array if specified");e=n.output}else e=new Array(t.length);var r=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!wv(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],s=r+1;s<o;s++)t[s]<a&&(a=t[s]);return a}(t),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!wv(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[r],s=r+1;s<o;s++)t[s]>a&&(a=t[s]);return a}(t);if(r===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=n.min,a=void 0===o?n.autoMinMax?r:0:o,s=n.max,c=void 0===s?n.autoMinMax?i:1:s;if(a>=c)throw new RangeError("min option must be smaller than max option");for(var u=(c-a)/(i-r),l=0;l<t.length;l++)e[l]=(t[l]-r)*u+a;return e}}),Sv=p(Nv);Object.defineProperty(xv,"__esModule",{value:!0});var Cv=Mv,Tv=Sv;const kv=" ".repeat(2),Pv=" ".repeat(4);function Av(t,e={}){const{maxRows:n=15,maxColumns:r=10,maxNumSize:i=8,padMinus:o="auto"}=e;return`${t.constructor.name} {\n${kv}[\n${Pv}${function(t,e,n,r,i){const{rows:o,columns:a}=t,s=Math.min(o,e),c=Math.min(a,n),u=[];if("auto"===i){i=!1;t:for(let e=0;e<s;e++)for(let n=0;n<c;n++)if(t.get(e,n)<0){i=!0;break t}}for(let e=0;e<s;e++){let n=[];for(let o=0;o<c;o++)n.push(Ov(t.get(e,o),r,i));u.push(`${n.join(" ")}`)}c!==a&&(u[u.length-1]+=` ... ${a-n} more columns`);s!==o&&u.push(`... ${o-e} more rows`);return u.join(`\n${Pv}`)}(t,n,r,i,o)}\n${kv}]\n${kv}rows: ${t.rows}\n${kv}columns: ${t.columns}\n}`}function Ov(t,e,n){return(t>=0&&n?` ${_v(t,e-1)}`:_v(t,e)).padEnd(e)}function _v(t,e){let n=t.toString();if(n.length<=e)return n;let r=t.toFixed(e);if(r.length>e&&(r=t.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let i=t.toExponential(e);return i.length>e&&(i=t.toExponential(Math.max(0,e-(i.length-e)))),i.slice(0)}function Rv(t,e,n){let r=n?t.rows:t.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function Dv(t,e,n){let r=n?t.columns:t.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function Iv(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Lv(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function jv(t,e){if(!Cv.isAnyArray(e))throw new TypeError("row indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.rows)throw new RangeError("row indices are out of range")}function zv(t,e){if(!Cv.isAnyArray(e))throw new TypeError("column indices must be an array");for(let n=0;n<e.length;n++)if(e[n]<0||e[n]>=t.columns)throw new RangeError("column indices are out of range")}function Bv(t,e,n,r,i){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(Gv("startRow",e),Gv("endRow",n),Gv("startColumn",r),Gv("endColumn",i),e>n||r>i||e<0||e>=t.rows||n<0||n>=t.rows||r<0||r>=t.columns||i<0||i>=t.columns)throw new RangeError("Submatrix indices are out of range")}function Fv(t,e=0){let n=[];for(let r=0;r<t;r++)n.push(e);return n}function Gv(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function Vv(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class Wv{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let r=new Hv(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)r.set(i,t,n[i*e+t]);return r}static rowVector(t){let e=new Hv(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new Hv(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new Hv(t,e)}static ones(t,e){return new Hv(t,e).fill(1)}static rand(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:r=Math.random}=n;let i=new Hv(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.set(n,t,r());return i}static randInt(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:r=0,max:i=1e3,random:o=Math.random}=n;if(!Number.isInteger(r))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(r>=i)throw new RangeError("min must be smaller than max");let a=i-r,s=new Hv(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++){let e=r+Math.round(o()*a);s.set(n,t,e)}return s}static eye(t,e,n){void 0===e&&(e=t),void 0===n&&(n=1);let r=Math.min(t,e),i=this.zeros(t,e);for(let t=0;t<r;t++)i.set(t,t,n);return i}static diag(t,e,n){let r=t.length;void 0===e&&(e=r),void 0===n&&(n=e);let i=Math.min(r,e,n),o=this.zeros(e,n);for(let e=0;e<i;e++)o.set(e,e,t[e]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new Hv(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.min(t.get(o,n),e.get(o,n)));return i}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new this(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.max(t.get(o,n),e.get(o,n)));return i}static checkMatrix(t){return Wv.isMatrix(t)?t:new Hv(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);t++}return r}isReducedEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);for(let n=e+1;n<this.rows;n++)0!==this.get(t,n)&&(r=!1);t++}return r}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let r=e;for(let i=e;i<t.rows;i++)t.get(i,n)>t.get(r,n)&&(r=i);if(0===t.get(r,n))n++;else{t.swapRows(e,r);let i=t.get(e,n);for(let r=n;r<t.columns;r++)t.set(e,r,t.get(e,r)/i);for(let r=e+1;r<t.rows;r++){let i=t.get(r,n)/t.get(e,n);t.set(r,n,0);for(let o=n+1;o<t.columns;o++)t.set(r,o,t.get(r,o)-t.get(e,o)*i)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,r=n-1;for(;r>=0;)if(0===t.maxRow(r))r--;else{let i=0,o=!1;for(;i<n&&!1===o;)1===t.get(r,i)?o=!0:i++;for(let n=0;n<r;n++){let o=t.get(n,i);for(let a=i;a<e;a++){let e=t.get(n,a)-o*t.get(r,a);t.set(n,a,e)}}r--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let r=new Hv(this.rows*e,this.columns*n);for(let t=0;t<e;t++)for(let e=0;e<n;e++)r.setSubMatrix(this,this.rows*t,this.columns*e);return r}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){Rv(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return Hv.rowVector(this.getRow(t))}setRow(t,e){Rv(this,t),e=Iv(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){Rv(this,t),Rv(this,e);for(let n=0;n<this.columns;n++){let r=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,r)}return this}getColumn(t){Dv(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return Hv.columnVector(this.getColumn(t))}setColumn(t,e){Dv(this,t),e=Lv(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){Dv(this,t),Dv(this,e);for(let n=0;n<this.rows;n++){let r=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,r)}return this}addRowVector(t){t=Iv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=Iv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=Iv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=Iv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=Lv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=Lv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=Lv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=Lv(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){Rv(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){Dv(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){Vv(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)>t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){Vv(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)<t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}maxRow(t){if(Rv(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){Rv(this,t),Vv(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r),n[1]=r);return n}minRow(t){if(Rv(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){Rv(this,t),Vv(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r),n[1]=r);return n}maxColumn(t){if(Dv(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){Dv(this,t),Vv(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t),n[0]=r);return n}minColumn(t){if(Dv(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){Dv(this,t),Vv(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t),n[0]=r);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){Wv.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}mmul(t){t=Hv.checkMatrix(t);let e=this.rows,n=this.columns,r=t.columns,i=new Hv(e,r),o=new Float64Array(n);for(let a=0;a<r;a++){for(let e=0;e<n;e++)o[e]=t.get(e,a);for(let t=0;t<e;t++){let e=0;for(let r=0;r<n;r++)e+=this.get(t,r)*o[r];i.set(t,a,e)}}return i}strassen2x2(t){t=Hv.checkMatrix(t);let e=new Hv(2,2);const n=this.get(0,0),r=t.get(0,0),i=this.get(0,1),o=t.get(0,1),a=this.get(1,0),s=t.get(1,0),c=this.get(1,1),u=t.get(1,1),l=(n+c)*(r+u),h=(a+c)*r,d=n*(o-u),f=c*(s-r),p=(n+i)*u,g=l+f-p+(i-c)*(s+u),m=d+p,v=h+f,y=l-h+d+(a-n)*(r+o);return e.set(0,0,g),e.set(0,1,m),e.set(1,0,v),e.set(1,1,y),e}strassen3x3(t){t=Hv.checkMatrix(t);let e=new Hv(3,3);const n=this.get(0,0),r=this.get(0,1),i=this.get(0,2),o=this.get(1,0),a=this.get(1,1),s=this.get(1,2),c=this.get(2,0),u=this.get(2,1),l=this.get(2,2),h=t.get(0,0),d=t.get(0,1),f=t.get(0,2),p=t.get(1,0),g=t.get(1,1),m=t.get(1,2),v=t.get(2,0),y=t.get(2,1),b=t.get(2,2),x=(n-o)*(-d+g),E=(-n+o+a)*(h-d+g),w=(o+a)*(-h+d),M=n*h,N=(-n+c+u)*(h-f+m),S=(-n+c)*(f-m),C=(c+u)*(-h+f),T=(-i+u+l)*(g+v-y),k=(i-l)*(g-y),P=i*v,A=(u+l)*(-v+y),O=(-i+a+s)*(m+v-b),_=(i-s)*(m-b),R=(a+s)*(-v+b),D=M+P+r*p,I=(n+r+i-o-a-u-l)*g+E+w+M+T+P+A,L=M+N+C+(n+r+i-a-s-c-u)*m+P+O+R,j=x+a*(-h+d+p-g-m-v+b)+E+M+P+O+_,z=x+E+w+M+s*y,B=P+O+_+R+o*f,F=M+N+S+u*(-h+f+p-g-m-v+y)+T+k+P,G=T+k+P+A+c*d,V=M+N+S+C+l*b;return e.set(0,0,D),e.set(0,1,I),e.set(0,2,L),e.set(1,0,j),e.set(1,1,z),e.set(1,2,B),e.set(2,0,F),e.set(2,1,G),e.set(2,2,V),e}mmulStrassen(t){t=Hv.checkMatrix(t);let e=this.clone(),n=e.rows,r=e.columns,i=t.rows,o=t.columns;function a(t,e,n){let r=t.rows,i=t.columns;if(r===e&&i===n)return t;{let r=Wv.zeros(e,n);return r=r.setSubMatrix(t,0,0),r}}r!==i&&console.warn(`Multiplying ${n} x ${r} and ${i} x ${o} matrix: dimensions do not match.`);let s=Math.max(n,i),c=Math.max(r,o);return e=a(e,s,c),function t(e,n,r,i){if(r<=512||i<=512)return e.mmul(n);r%2==1&&i%2==1?(e=a(e,r+1,i+1),n=a(n,r+1,i+1)):r%2==1?(e=a(e,r+1,i),n=a(n,r+1,i)):i%2==1&&(e=a(e,r,i+1),n=a(n,r,i+1));let o=parseInt(e.rows/2,10),s=parseInt(e.columns/2,10),c=e.subMatrix(0,o-1,0,s-1),u=n.subMatrix(0,o-1,0,s-1),l=e.subMatrix(0,o-1,s,e.columns-1),h=n.subMatrix(0,o-1,s,n.columns-1),d=e.subMatrix(o,e.rows-1,0,s-1),f=n.subMatrix(o,n.rows-1,0,s-1),p=e.subMatrix(o,e.rows-1,s,e.columns-1),g=n.subMatrix(o,n.rows-1,s,n.columns-1),m=t(Wv.add(c,p),Wv.add(u,g),o,s),v=t(Wv.add(d,p),u,o,s),y=t(c,Wv.sub(h,g),o,s),b=t(p,Wv.sub(f,u),o,s),x=t(Wv.add(c,l),g,o,s),E=t(Wv.sub(d,c),Wv.add(u,h),o,s),w=t(Wv.sub(l,p),Wv.add(f,g),o,s),M=Wv.add(m,b);M.sub(x),M.add(w);let N=Wv.add(y,x),S=Wv.add(v,b),C=Wv.sub(m,v);C.add(y),C.add(E);let T=Wv.zeros(2*M.rows,2*M.columns);return T=T.setSubMatrix(M,0,0),T=T.setSubMatrix(N,M.rows,0),T=T.setSubMatrix(S,0,M.columns),T=T.setSubMatrix(C,M.rows,M.columns),T.subMatrix(0,r-1,0,i-1)}(e,t=a(t,s,c),s,c)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Hv(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&Tv(i,{min:e,max:n,output:i}),r.setRow(t,i)}return r}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let r=new Hv(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&Tv(i,{min:e,max:n,output:i}),r.setColumn(t,i)}return r}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let t=this.get(e,n),r=this.get(e,this.columns-1-n);this.set(e,n,r),this.set(e,this.columns-1-n,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let t=this.get(n,e),r=this.get(this.rows-1-n,e);this.set(n,e,r),this.set(this.rows-1-n,e,t)}return this}kroneckerProduct(t){t=Hv.checkMatrix(t);let e=this.rows,n=this.columns,r=t.rows,i=t.columns,o=new Hv(e*r,n*i);for(let a=0;a<e;a++)for(let e=0;e<n;e++)for(let n=0;n<r;n++)for(let s=0;s<i;s++)o.set(r*a+n,i*e+s,this.get(a,e)*t.get(n,s));return o}kroneckerSum(t){if(t=Hv.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,r=this.kroneckerProduct(Hv.eye(n,n)),i=Hv.eye(e,e).kroneckerProduct(t);return r.add(i)}transpose(){let t=new Hv(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=Uv){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=Uv){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,r){Bv(this,t,e,n,r);let i=new Hv(e-t+1,r-n+1);for(let o=t;o<=e;o++)for(let e=n;e<=r;e++)i.set(o-t,e-n,this.get(o,e));return i}subMatrixRow(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let r=new Hv(t.length,n-e+1);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.rows)throw new RangeError(`Row index out of range: ${t[i]}`);r.set(i,o-e,this.get(t[i],o))}return r}subMatrixColumn(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let r=new Hv(n-e+1,t.length);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.columns)throw new RangeError(`Column index out of range: ${t[i]}`);r.set(o-e,i,this.get(o,t[i]))}return r}setSubMatrix(t,e,n){if((t=Hv.checkMatrix(t)).isEmpty())return this;Bv(this,e,e+t.rows-1,n,n+t.columns-1);for(let r=0;r<t.rows;r++)for(let i=0;i<t.columns;i++)this.set(e+r,n+i,t.get(r,i));return this}selection(t,e){jv(this,t),zv(this,e);let n=new Hv(t.length,e.length);for(let r=0;r<t.length;r++){let i=t[r];for(let t=0;t<e.length;t++){let o=e[t];n.set(r,t,this.get(i,o))}}return n}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){return this.constructor.copy(this,new Hv(this.rows,this.columns))}static copy(t,e){for(const[n,r,i]of t.entries())e.set(n,r,i);return e}sum(t){switch(t){case"row":return function(t){let e=Fv(t.rows);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]+=t.get(n,r);return e}(this);case"column":return function(t){let e=Fv(t.columns);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]+=t.get(n,r);return e}(this);case void 0:return function(t){let e=0;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e+=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=Fv(t.rows,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]*=t.get(n,r);return e}(this);case"column":return function(t){let e=Fv(t.columns,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]*=t.get(n,r);return e}(this);case void 0:return function(t){let e=1;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e*=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:n=!0,mean:r=this.mean(t)}=e;if("boolean"!=typeof n)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!Cv.isAnyArray(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<r;a++){let r=0,s=0,c=0;for(let e=0;e<i;e++)c=t.get(a,e)-n[a],r+=c,s+=c*c;e?o.push((s-r*r/i)/(i-1)):o.push((s-r*r/i)/i)}return o}(this,n,r);case"column":if(!Cv.isAnyArray(r))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let a=0;a<i;a++){let i=0,s=0,c=0;for(let e=0;e<r;e++)c=t.get(e,a)-n[a],i+=c,s+=c*c;e?o.push((s-i*i/r)/(r-1)):o.push((s-i*i/r)/r)}return o}(this,n,r);case void 0:if("number"!=typeof r)throw new TypeError("mean must be a number");return function(t,e,n){const r=t.rows,i=t.columns,o=r*i;let a=0,s=0,c=0;for(let e=0;e<r;e++)for(let r=0;r<i;r++)c=t.get(e,r)-n,a+=c,s+=c*c;return e?(s-a*a/o)/(o-1):(s-a*a/o)/o}(this,n,r);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const n=this.variance(t,e);if(void 0===t)return Math.sqrt(n);for(let t=0;t<n.length;t++)n[t]=Math.sqrt(n[t]);return n}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":if(!Cv.isAnyArray(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[n])}(this,n),this;case"column":if(!Cv.isAnyArray(n))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[r])}(this,n),this;case void 0:if("number"!=typeof n)throw new TypeError("center must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.rows;n++){let r=0;for(let e=0;e<t.columns;e++)r+=Math.pow(t.get(n,e),2)/(t.columns-1);e.push(Math.sqrt(r))}return e}(this);else if(!Cv.isAnyArray(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[n])}(this,n),this;case"column":if(void 0===n)n=function(t){const e=[];for(let n=0;n<t.columns;n++){let r=0;for(let e=0;e<t.rows;e++)r+=Math.pow(t.get(e,n),2)/(t.rows-1);e.push(Math.sqrt(r))}return e}(this);else if(!Cv.isAnyArray(n))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[r])}(this,n),this;case void 0:if(void 0===n)n=function(t){const e=t.size-1;let n=0;for(let r=0;r<t.columns;r++)for(let i=0;i<t.rows;i++)n+=Math.pow(t.get(i,r),2)/e;return Math.sqrt(n)}(this);else if("number"!=typeof n)throw new TypeError("scale must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e)}(this,n),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return Av(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function Uv(t,e){return t-e}Wv.prototype.klass="Matrix","undefined"!=typeof Symbol&&(Wv.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return Av(this)}),Wv.random=Wv.rand,Wv.randomInt=Wv.randInt,Wv.diagonal=Wv.diag,Wv.prototype.diagonal=Wv.prototype.diag,Wv.identity=Wv.eye,Wv.prototype.negate=Wv.prototype.neg,Wv.prototype.tensorProduct=Wv.prototype.kroneckerProduct;let Hv=class t extends Wv{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<t;n++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(e,n){if(super(),t.isMatrix(e))this.#t(e.rows,e.columns),t.copy(e,this);else if(Number.isInteger(e)&&e>=0)this.#t(e,n);else{if(!Cv.isAnyArray(e))throw new TypeError("First argument must be a positive number or an array");{const t=e;if("number"!=typeof(n=(e=t.length)?t[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let r=0;r<e;r++){if(t[r].length!==n)throw new RangeError("Inconsistent array dimensions");if(!t[r].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(t[r]))}this.rows=e,this.columns=n}}}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}removeRow(t){return Rv(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),Rv(this,t,!0),e=Float64Array.from(Iv(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){Dv(this,t);for(let e=0;e<this.rows;e++){const n=new Float64Array(this.columns-1);for(let r=0;r<t;r++)n[r]=this.data[e][r];for(let r=t+1;r<this.columns;r++)n[r-1]=this.data[e][r];this.data[e]=n}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),Dv(this,t,!0),e=Lv(this,e);for(let n=0;n<this.rows;n++){const r=new Float64Array(this.columns+1);let i=0;for(;i<t;i++)r[i]=this.data[n][i];for(r[i++]=e[n];i<this.columns+1;i++)r[i]=this.data[n][i-1];this.data[n]=r}return this.columns+=1,this}};!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t.get(e,n));return this},t.add=function(t,n){return new e(t).add(n)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t.get(e,n));return this},t.sub=function(t,n){return new e(t).sub(n)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t.get(e,n));return this},t.mul=function(t,n){return new e(t).mul(n)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t.get(e,n));return this},t.div=function(t,n){return new e(t).div(n)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t.get(e,n));return this},t.mod=function(t,n){return new e(t).mod(n)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t.get(e,n));return this},t.and=function(t,n){return new e(t).and(n)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t.get(e,n));return this},t.or=function(t,n){return new e(t).or(n)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t.get(e,n));return this},t.xor=function(t,n){return new e(t).xor(n)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t.get(e,n));return this},t.leftShift=function(t,n){return new e(t).leftShift(n)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t.get(e,n));return this},t.signPropagatingRightShift=function(t,n){return new e(t).signPropagatingRightShift(n)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t.get(e,n));return this},t.rightShift=function(t,n){return new e(t).rightShift(n)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,n){return new e(t).pow(n)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,Math.pow(this.get(e,n),t.get(e,n)));return this}}(Wv,Hv);class qv extends Wv{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return Hv.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),Hv.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=Hv.copy(t,new Hv(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new Hv(t,t);else if(this.#e=new Hv(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new qv(this.diagonalSize);for(const[e,n,r]of this.upperRightEntries())t.set(e,n,r);return t}toMatrix(){return new Hv(this)}get(t,e){return this.#e.get(t,e)}set(t,e,n){return this.#e.set(t,e,n),this.#e.set(e,t,n),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const n=e.slice();return n.splice(t,1),this.#e.addRow(t,n),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[n,r]of t.entries())r||e.push(n);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let n=0,r=0,i=0;i<e.length;i++)e[i]=this.get(r,n),++n>=t&&(n=++r);return e}static fromCompact(t){const e=t.length,n=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const r=new qv(n);for(let i=0,o=0,a=0;a<e;a++)r.set(i,o,t[a]),++i>=n&&(i=++o);return r}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const n=this.get(t,e);yield[t,e,n],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const n=this.get(t,e);yield n,++e>=this.diagonalSize&&(e=++t)}}}qv.prototype.klassType="SymmetricMatrix";class $v extends qv{static isDistanceMatrix(t){return qv.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,n){return t===e&&(n=0),super.set(t,e,n)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new qv(this)}clone(){const t=new $v(this.diagonalSize);for(const[e,n,r]of this.upperRightEntries())e!==n&&t.set(e,n,r);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let n=1,r=0,i=0;i<e.length;i++)e[i]=this.get(r,n),++n>=t&&(n=1+ ++r);return e}static fromCompact(t){const e=t.length,n=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const r=new this(n);for(let i=1,o=0,a=0;a<e;a++)r.set(i,o,t[a]),++i>=n&&(i=1+ ++o);return r}}$v.prototype.klassSubType="DistanceMatrix";class Yv extends Wv{constructor(t,e,n){super(),this.matrix=t,this.rows=e,this.columns=n}}class Kv extends Yv{constructor(t,e,n){jv(t,e),zv(t,n),super(t,e.length,n.length),this.rowIndices=e,this.columnIndices=n}set(t,e,n){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],n),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class Xv extends Wv{constructor(t,e={}){const{rows:n=1}=e;if(t.length%n!=0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=t.length/n,this.data=t}set(t,e,n){let r=this._calculateIndex(t,e);return this.data[r]=n,this}get(t,e){let n=this._calculateIndex(t,e);return this.data[n]}_calculateIndex(t,e){return t*this.columns+e}}class Zv extends Wv{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}class Qv{constructor(t){let e,n,r,i,o,a,s,c,u,l=(t=Zv.checkMatrix(t)).clone(),h=l.rows,d=l.columns,f=new Float64Array(h),p=1;for(e=0;e<h;e++)f[e]=e;for(c=new Float64Array(h),n=0;n<d;n++){for(e=0;e<h;e++)c[e]=l.get(e,n);for(e=0;e<h;e++){for(u=Math.min(e,n),o=0,r=0;r<u;r++)o+=l.get(e,r)*c[r];c[e]-=o,l.set(e,n,c[e])}for(i=n,e=n+1;e<h;e++)Math.abs(c[e])>Math.abs(c[i])&&(i=e);if(i!==n){for(r=0;r<d;r++)a=l.get(i,r),l.set(i,r,l.get(n,r)),l.set(n,r,a);s=f[i],f[i]=f[n],f[n]=s,p=-p}if(n<h&&0!==l.get(n,n))for(e=n+1;e<h;e++)l.set(e,n,l.get(e,n)/l.get(n,n))}this.LU=l,this.pivotVector=f,this.pivotSign=p}isSingular(){let t=this.LU,e=t.columns;for(let n=0;n<e;n++)if(0===t.get(n,n))return!0;return!1}solve(t){t=Hv.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n,r,i,o=t.columns,a=t.subMatrixRow(this.pivotVector,0,o-1),s=e.columns;for(i=0;i<s;i++)for(n=i+1;n<s;n++)for(r=0;r<o;r++)a.set(n,r,a.get(n,r)-a.get(i,r)*e.get(n,i));for(i=s-1;i>=0;i--){for(r=0;r<o;r++)a.set(i,r,a.get(i,r)/e.get(i,i));for(n=0;n<i;n++)for(r=0;r<o;r++)a.set(n,r,a.get(n,r)-a.get(i,r)*e.get(n,i))}return a}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,n=t.columns;for(let r=0;r<n;r++)e*=t.get(r,r);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,r=new Hv(e,n);for(let i=0;i<e;i++)for(let e=0;e<n;e++)i>e?r.set(i,e,t.get(i,e)):i===e?r.set(i,e,1):r.set(i,e,0);return r}get upperTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,r=new Hv(e,n);for(let i=0;i<e;i++)for(let e=0;e<n;e++)i<=e?r.set(i,e,t.get(i,e)):r.set(i,e,0);return r}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Jv(t,e){let n=0;return Math.abs(t)>Math.abs(e)?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0!==e?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0}class ty{constructor(t){let e,n,r,i,o=(t=Zv.checkMatrix(t)).clone(),a=t.rows,s=t.columns,c=new Float64Array(s);for(r=0;r<s;r++){let t=0;for(e=r;e<a;e++)t=Jv(t,o.get(e,r));if(0!==t){for(o.get(r,r)<0&&(t=-t),e=r;e<a;e++)o.set(e,r,o.get(e,r)/t);for(o.set(r,r,o.get(r,r)+1),n=r+1;n<s;n++){for(i=0,e=r;e<a;e++)i+=o.get(e,r)*o.get(e,n);for(i=-i/o.get(r,r),e=r;e<a;e++)o.set(e,n,o.get(e,n)+i*o.get(e,r))}}c[r]=-t}this.QR=o,this.Rdiag=c}solve(t){t=Hv.checkMatrix(t);let e=this.QR,n=e.rows;if(t.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let r,i,o,a,s=t.columns,c=t.clone(),u=e.columns;for(o=0;o<u;o++)for(i=0;i<s;i++){for(a=0,r=o;r<n;r++)a+=e.get(r,o)*c.get(r,i);for(a=-a/e.get(o,o),r=o;r<n;r++)c.set(r,i,c.get(r,i)+a*e.get(r,o))}for(o=u-1;o>=0;o--){for(i=0;i<s;i++)c.set(o,i,c.get(o,i)/this.Rdiag[o]);for(r=0;r<o;r++)for(i=0;i<s;i++)c.set(r,i,c.get(r,i)-c.get(o,i)*e.get(r,o))}return c.subMatrix(0,u-1,0,s-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,n=this.QR,r=n.columns,i=new Hv(r,r);for(t=0;t<r;t++)for(e=0;e<r;e++)t<e?i.set(t,e,n.get(t,e)):t===e?i.set(t,e,this.Rdiag[t]):i.set(t,e,0);return i}get orthogonalMatrix(){let t,e,n,r,i=this.QR,o=i.rows,a=i.columns,s=new Hv(o,a);for(n=a-1;n>=0;n--){for(t=0;t<o;t++)s.set(t,n,0);for(s.set(n,n,1),e=n;e<a;e++)if(0!==i.get(n,n)){for(r=0,t=n;t<o;t++)r+=i.get(t,n)*s.get(t,e);for(r=-r/i.get(n,n),t=n;t<o;t++)s.set(t,e,s.get(t,e)+r*i.get(t,n))}}return s}}let ey=class{constructor(t,e={}){if((t=Zv.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,r=t.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:o=!0,autoTranspose:a=!1}=e;let s,c=Boolean(i),u=Boolean(o),l=!1;if(n<r)if(a){s=t.transpose(),n=s.rows,r=s.columns,l=!0;let e=c;c=u,u=e}else s=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else s=t.clone();let h=Math.min(n,r),d=Math.min(n+1,r),f=new Float64Array(d),p=new Hv(n,h),g=new Hv(r,r),m=new Float64Array(r),v=new Float64Array(n),y=new Float64Array(d);for(let t=0;t<d;t++)y[t]=t;let b=Math.min(n-1,r),x=Math.max(0,Math.min(r-2,n)),E=Math.max(b,x);for(let t=0;t<E;t++){if(t<b){f[t]=0;for(let e=t;e<n;e++)f[t]=Jv(f[t],s.get(e,t));if(0!==f[t]){s.get(t,t)<0&&(f[t]=-f[t]);for(let e=t;e<n;e++)s.set(e,t,s.get(e,t)/f[t]);s.set(t,t,s.get(t,t)+1)}f[t]=-f[t]}for(let e=t+1;e<r;e++){if(t<b&&0!==f[t]){let r=0;for(let i=t;i<n;i++)r+=s.get(i,t)*s.get(i,e);r=-r/s.get(t,t);for(let i=t;i<n;i++)s.set(i,e,s.get(i,e)+r*s.get(i,t))}m[e]=s.get(t,e)}if(c&&t<b)for(let e=t;e<n;e++)p.set(e,t,s.get(e,t));if(t<x){m[t]=0;for(let e=t+1;e<r;e++)m[t]=Jv(m[t],m[e]);if(0!==m[t]){m[t+1]<0&&(m[t]=0-m[t]);for(let e=t+1;e<r;e++)m[e]/=m[t];m[t+1]+=1}if(m[t]=-m[t],t+1<n&&0!==m[t]){for(let e=t+1;e<n;e++)v[e]=0;for(let e=t+1;e<n;e++)for(let n=t+1;n<r;n++)v[e]+=m[n]*s.get(e,n);for(let e=t+1;e<r;e++){let r=-m[e]/m[t+1];for(let i=t+1;i<n;i++)s.set(i,e,s.get(i,e)+r*v[i])}}if(u)for(let e=t+1;e<r;e++)g.set(e,t,m[e])}}let w=Math.min(r,n+1);if(b<r&&(f[b]=s.get(b,b)),n<w&&(f[w-1]=0),x+1<w&&(m[x]=s.get(x,w-1)),m[w-1]=0,c){for(let t=b;t<h;t++){for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}for(let t=b-1;t>=0;t--)if(0!==f[t]){for(let e=t+1;e<h;e++){let r=0;for(let i=t;i<n;i++)r+=p.get(i,t)*p.get(i,e);r=-r/p.get(t,t);for(let i=t;i<n;i++)p.set(i,e,p.get(i,e)+r*p.get(i,t))}for(let e=t;e<n;e++)p.set(e,t,-p.get(e,t));p.set(t,t,1+p.get(t,t));for(let e=0;e<t-1;e++)p.set(e,t,0)}else{for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}}if(u)for(let t=r-1;t>=0;t--){if(t<x&&0!==m[t])for(let e=t+1;e<r;e++){let n=0;for(let i=t+1;i<r;i++)n+=g.get(i,t)*g.get(i,e);n=-n/g.get(t+1,t);for(let i=t+1;i<r;i++)g.set(i,e,g.get(i,e)+n*g.get(i,t))}for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}let M=w-1,N=Number.EPSILON;for(;w>0;){let t,e;for(t=w-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+N*Math.abs(f[t]+Math.abs(f[t+1]));if(Math.abs(m[t])<=e||Number.isNaN(m[t])){m[t]=0;break}}if(t===w-2)e=4;else{let n;for(n=w-1;n>=t&&n!==t;n--){let e=(n!==w?Math.abs(m[n]):0)+(n!==t+1?Math.abs(m[n-1]):0);if(Math.abs(f[n])<=N*e){f[n]=0;break}}n===t?e=3:n===w-1?e=1:(e=2,t=n)}switch(t++,e){case 1:{let e=m[w-2];m[w-2]=0;for(let n=w-2;n>=t;n--){let i=Jv(f[n],e),o=f[n]/i,a=e/i;if(f[n]=i,n!==t&&(e=-a*m[n-1],m[n-1]=o*m[n-1]),u)for(let t=0;t<r;t++)i=o*g.get(t,n)+a*g.get(t,w-1),g.set(t,w-1,-a*g.get(t,n)+o*g.get(t,w-1)),g.set(t,n,i)}break}case 2:{let e=m[t-1];m[t-1]=0;for(let r=t;r<w;r++){let i=Jv(f[r],e),o=f[r]/i,a=e/i;if(f[r]=i,e=-a*m[r],m[r]=o*m[r],c)for(let e=0;e<n;e++)i=o*p.get(e,r)+a*p.get(e,t-1),p.set(e,t-1,-a*p.get(e,r)+o*p.get(e,t-1)),p.set(e,r,i)}break}case 3:{const e=Math.max(Math.abs(f[w-1]),Math.abs(f[w-2]),Math.abs(m[w-2]),Math.abs(f[t]),Math.abs(m[t])),i=f[w-1]/e,o=f[w-2]/e,a=m[w-2]/e,s=f[t]/e,l=m[t]/e,h=((o+i)*(o-i)+a*a)/2,d=i*a*(i*a);let v=0;0===h&&0===d||(v=h<0?0-Math.sqrt(h*h+d):Math.sqrt(h*h+d),v=d/(h+v));let y=(s+i)*(s-i)+v,b=s*l;for(let e=t;e<w-1;e++){let i=Jv(y,b);0===i&&(i=Number.MIN_VALUE);let o=y/i,a=b/i;if(e!==t&&(m[e-1]=i),y=o*f[e]+a*m[e],m[e]=o*m[e]-a*f[e],b=a*f[e+1],f[e+1]=o*f[e+1],u)for(let t=0;t<r;t++)i=o*g.get(t,e)+a*g.get(t,e+1),g.set(t,e+1,-a*g.get(t,e)+o*g.get(t,e+1)),g.set(t,e,i);if(i=Jv(y,b),0===i&&(i=Number.MIN_VALUE),o=y/i,a=b/i,f[e]=i,y=o*m[e]+a*f[e+1],f[e+1]=-a*m[e]+o*f[e+1],b=a*m[e+1],m[e+1]=o*m[e+1],c&&e<n-1)for(let t=0;t<n;t++)i=o*p.get(t,e)+a*p.get(t,e+1),p.set(t,e+1,-a*p.get(t,e)+o*p.get(t,e+1)),p.set(t,e,i)}m[w-2]=y;break}case 4:if(f[t]<=0&&(f[t]=f[t]<0?-f[t]:0,u))for(let e=0;e<=M;e++)g.set(e,t,-g.get(e,t));for(;t<M&&!(f[t]>=f[t+1]);){let e=f[t];if(f[t]=f[t+1],f[t+1]=e,u&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);if(c&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);t++}w--}}if(l){let t=g;g=p,p=t}this.m=n,this.n=r,this.s=f,this.U=p,this.V=g}solve(t){let e=t,n=this.threshold,r=this.s.length,i=Hv.zeros(r,r);for(let t=0;t<r;t++)Math.abs(this.s[t])<=n?i.set(t,t,0):i.set(t,t,1/this.s[t]);let o=this.U,a=this.rightSingularVectors,s=a.mmul(i),c=a.rows,u=o.rows,l=Hv.zeros(c,u);for(let t=0;t<c;t++)for(let e=0;e<u;e++){let n=0;for(let i=0;i<r;i++)n+=s.get(t,i)*o.get(e,i);l.set(t,e,n)}return l.mmul(e)}solveForDiagonal(t){return this.solve(Hv.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,r=t.columns,i=new Hv(n,this.s.length);for(let o=0;o<n;o++)for(let n=0;n<r;n++)Math.abs(this.s[n])>e&&i.set(o,n,t.get(o,n)/this.s[n]);let o=this.U,a=o.rows,s=o.columns,c=new Hv(n,a);for(let t=0;t<n;t++)for(let e=0;e<a;e++){let n=0;for(let r=0;r<s;r++)n+=i.get(t,r)*o.get(e,r);c.set(t,e,n)}return c}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let r=0,i=n.length;r<i;r++)n[r]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return Hv.diag(this.s)}};function ny(t,e,n=!1){return t=Zv.checkMatrix(t),e=Zv.checkMatrix(e),n?new ey(t).solve(e):t.isSquare()?new Qv(t).solve(e):new ty(t).solve(e)}function ry(t,e){let n=[];for(let r=0;r<t;r++)r!==e&&n.push(r);return n}function iy(t,e,n,r=1e-9,i=1e-9){if(t>i)return new Array(e.rows+1).fill(0);{let t=e.addRow(n,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<r&&t.set(e,0,0);return t.to1DArray()}}class oy{constructor(t,e={}){const{assumeSymmetric:n=!1}=e;if(!(t=Zv.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let r,i,o=t.columns,a=new Hv(o,o),s=new Float64Array(o),c=new Float64Array(o),u=t,l=!1;if(l=!!n||t.isSymmetric(),l){for(r=0;r<o;r++)for(i=0;i<o;i++)a.set(r,i,u.get(r,i));!function(t,e,n,r){let i,o,a,s,c,u,l,h;for(c=0;c<t;c++)n[c]=r.get(t-1,c);for(s=t-1;s>0;s--){for(h=0,a=0,u=0;u<s;u++)h+=Math.abs(n[u]);if(0===h)for(e[s]=n[s-1],c=0;c<s;c++)n[c]=r.get(s-1,c),r.set(s,c,0),r.set(c,s,0);else{for(u=0;u<s;u++)n[u]/=h,a+=n[u]*n[u];for(i=n[s-1],o=Math.sqrt(a),i>0&&(o=-o),e[s]=h*o,a-=i*o,n[s-1]=i-o,c=0;c<s;c++)e[c]=0;for(c=0;c<s;c++){for(i=n[c],r.set(c,s,i),o=e[c]+r.get(c,c)*i,u=c+1;u<=s-1;u++)o+=r.get(u,c)*n[u],e[u]+=r.get(u,c)*i;e[c]=o}for(i=0,c=0;c<s;c++)e[c]/=a,i+=e[c]*n[c];for(l=i/(a+a),c=0;c<s;c++)e[c]-=l*n[c];for(c=0;c<s;c++){for(i=n[c],o=e[c],u=c;u<=s-1;u++)r.set(u,c,r.get(u,c)-(i*e[u]+o*n[u]));n[c]=r.get(s-1,c),r.set(s,c,0)}}n[s]=a}for(s=0;s<t-1;s++){if(r.set(t-1,s,r.get(s,s)),r.set(s,s,1),a=n[s+1],0!==a){for(u=0;u<=s;u++)n[u]=r.get(u,s+1)/a;for(c=0;c<=s;c++){for(o=0,u=0;u<=s;u++)o+=r.get(u,s+1)*r.get(u,c);for(u=0;u<=s;u++)r.set(u,c,r.get(u,c)-o*n[u])}}for(u=0;u<=s;u++)r.set(u,s+1,0)}for(c=0;c<t;c++)n[c]=r.get(t-1,c),r.set(t-1,c,0);r.set(t-1,t-1,1),e[0]=0}(o,c,s,a),function(t,e,n,r){let i,o,a,s,c,u,l,h,d,f,p,g,m,v,y,b;for(a=1;a<t;a++)e[a-1]=e[a];e[t-1]=0;let x=0,E=0,w=Number.EPSILON;for(u=0;u<t;u++){for(E=Math.max(E,Math.abs(n[u])+Math.abs(e[u])),l=u;l<t&&!(Math.abs(e[l])<=w*E);)l++;if(l>u)do{for(i=n[u],h=(n[u+1]-i)/(2*e[u]),d=Jv(h,1),h<0&&(d=-d),n[u]=e[u]/(h+d),n[u+1]=e[u]*(h+d),f=n[u+1],o=i-n[u],a=u+2;a<t;a++)n[a]-=o;for(x+=o,h=n[l],p=1,g=p,m=p,v=e[u+1],y=0,b=0,a=l-1;a>=u;a--)for(m=g,g=p,b=y,i=p*e[a],o=p*h,d=Jv(h,e[a]),e[a+1]=y*d,y=e[a]/d,p=h/d,h=p*n[a]-y*i,n[a+1]=o+y*(p*i+y*n[a]),c=0;c<t;c++)o=r.get(c,a+1),r.set(c,a+1,y*r.get(c,a)+p*o),r.set(c,a,p*r.get(c,a)-y*o);h=-y*b*m*v*e[u]/f,e[u]=y*h,n[u]=p*h}while(Math.abs(e[u])>w*E);n[u]=n[u]+x,e[u]=0}for(a=0;a<t-1;a++){for(c=a,h=n[a],s=a+1;s<t;s++)n[s]<h&&(c=s,h=n[s]);if(c!==a)for(n[c]=n[a],n[a]=h,s=0;s<t;s++)h=r.get(s,a),r.set(s,a,r.get(s,c)),r.set(s,c,h)}}(o,c,s,a)}else{let t=new Hv(o,o),e=new Float64Array(o);for(i=0;i<o;i++)for(r=0;r<o;r++)t.set(r,i,u.get(r,i));!function(t,e,n,r){let i,o,a,s,c,u,l,h=0,d=t-1;for(u=h+1;u<=d-1;u++){for(l=0,s=u;s<=d;s++)l+=Math.abs(e.get(s,u-1));if(0!==l){for(a=0,s=d;s>=u;s--)n[s]=e.get(s,u-1)/l,a+=n[s]*n[s];for(o=Math.sqrt(a),n[u]>0&&(o=-o),a-=n[u]*o,n[u]=n[u]-o,c=u;c<t;c++){for(i=0,s=d;s>=u;s--)i+=n[s]*e.get(s,c);for(i/=a,s=u;s<=d;s++)e.set(s,c,e.get(s,c)-i*n[s])}for(s=0;s<=d;s++){for(i=0,c=d;c>=u;c--)i+=n[c]*e.get(s,c);for(i/=a,c=u;c<=d;c++)e.set(s,c,e.get(s,c)-i*n[c])}n[u]=l*n[u],e.set(u,u-1,l*o)}}for(s=0;s<t;s++)for(c=0;c<t;c++)r.set(s,c,s===c?1:0);for(u=d-1;u>=h+1;u--)if(0!==e.get(u,u-1)){for(s=u+1;s<=d;s++)n[s]=e.get(s,u-1);for(c=u;c<=d;c++){for(o=0,s=u;s<=d;s++)o+=n[s]*r.get(s,c);for(o=o/n[u]/e.get(u,u-1),s=u;s<=d;s++)r.set(s,c,r.get(s,c)+o*n[s])}}}(o,t,e,a),function(t,e,n,r,i){let o,a,s,c,u,l,h,d,f,p,g,m,v,y,b,x=t-1,E=0,w=t-1,M=Number.EPSILON,N=0,S=0,C=0,T=0,k=0,P=0,A=0,O=0;for(o=0;o<t;o++)for((o<E||o>w)&&(n[o]=i.get(o,o),e[o]=0),a=Math.max(o-1,0);a<t;a++)S+=Math.abs(i.get(o,a));for(;x>=E;){for(c=x;c>E&&(P=Math.abs(i.get(c-1,c-1))+Math.abs(i.get(c,c)),0===P&&(P=S),!(Math.abs(i.get(c,c-1))<M*P));)c--;if(c===x)i.set(x,x,i.get(x,x)+N),n[x]=i.get(x,x),e[x]=0,x--,O=0;else if(c===x-1){if(h=i.get(x,x-1)*i.get(x-1,x),C=(i.get(x-1,x-1)-i.get(x,x))/2,T=C*C+h,A=Math.sqrt(Math.abs(T)),i.set(x,x,i.get(x,x)+N),i.set(x-1,x-1,i.get(x-1,x-1)+N),d=i.get(x,x),T>=0){for(A=C>=0?C+A:C-A,n[x-1]=d+A,n[x]=n[x-1],0!==A&&(n[x]=d-h/A),e[x-1]=0,e[x]=0,d=i.get(x,x-1),P=Math.abs(d)+Math.abs(A),C=d/P,T=A/P,k=Math.sqrt(C*C+T*T),C/=k,T/=k,a=x-1;a<t;a++)A=i.get(x-1,a),i.set(x-1,a,T*A+C*i.get(x,a)),i.set(x,a,T*i.get(x,a)-C*A);for(o=0;o<=x;o++)A=i.get(o,x-1),i.set(o,x-1,T*A+C*i.get(o,x)),i.set(o,x,T*i.get(o,x)-C*A);for(o=E;o<=w;o++)A=r.get(o,x-1),r.set(o,x-1,T*A+C*r.get(o,x)),r.set(o,x,T*r.get(o,x)-C*A)}else n[x-1]=d+C,n[x]=d+C,e[x-1]=A,e[x]=-A;x-=2,O=0}else{if(d=i.get(x,x),f=0,h=0,c<x&&(f=i.get(x-1,x-1),h=i.get(x,x-1)*i.get(x-1,x)),10===O){for(N+=d,o=E;o<=x;o++)i.set(o,o,i.get(o,o)-d);P=Math.abs(i.get(x,x-1))+Math.abs(i.get(x-1,x-2)),d=f=.75*P,h=-.4375*P*P}if(30===O&&(P=(f-d)/2,P=P*P+h,P>0)){for(P=Math.sqrt(P),f<d&&(P=-P),P=d-h/((f-d)/2+P),o=E;o<=x;o++)i.set(o,o,i.get(o,o)-P);N+=P,d=f=h=.964}for(O+=1,u=x-2;u>=c&&(A=i.get(u,u),k=d-A,P=f-A,C=(k*P-h)/i.get(u+1,u)+i.get(u,u+1),T=i.get(u+1,u+1)-A-k-P,k=i.get(u+2,u+1),P=Math.abs(C)+Math.abs(T)+Math.abs(k),C/=P,T/=P,k/=P,u!==c)&&!(Math.abs(i.get(u,u-1))*(Math.abs(T)+Math.abs(k))<M*(Math.abs(C)*(Math.abs(i.get(u-1,u-1))+Math.abs(A)+Math.abs(i.get(u+1,u+1)))));)u--;for(o=u+2;o<=x;o++)i.set(o,o-2,0),o>u+2&&i.set(o,o-3,0);for(s=u;s<=x-1&&(y=s!==x-1,s!==u&&(C=i.get(s,s-1),T=i.get(s+1,s-1),k=y?i.get(s+2,s-1):0,d=Math.abs(C)+Math.abs(T)+Math.abs(k),0!==d&&(C/=d,T/=d,k/=d)),0!==d);s++)if(P=Math.sqrt(C*C+T*T+k*k),C<0&&(P=-P),0!==P){for(s!==u?i.set(s,s-1,-P*d):c!==u&&i.set(s,s-1,-i.get(s,s-1)),C+=P,d=C/P,f=T/P,A=k/P,T/=C,k/=C,a=s;a<t;a++)C=i.get(s,a)+T*i.get(s+1,a),y&&(C+=k*i.get(s+2,a),i.set(s+2,a,i.get(s+2,a)-C*A)),i.set(s,a,i.get(s,a)-C*d),i.set(s+1,a,i.get(s+1,a)-C*f);for(o=0;o<=Math.min(x,s+3);o++)C=d*i.get(o,s)+f*i.get(o,s+1),y&&(C+=A*i.get(o,s+2),i.set(o,s+2,i.get(o,s+2)-C*k)),i.set(o,s,i.get(o,s)-C),i.set(o,s+1,i.get(o,s+1)-C*T);for(o=E;o<=w;o++)C=d*r.get(o,s)+f*r.get(o,s+1),y&&(C+=A*r.get(o,s+2),r.set(o,s+2,r.get(o,s+2)-C*k)),r.set(o,s,r.get(o,s)-C),r.set(o,s+1,r.get(o,s+1)-C*T)}}}if(0===S)return;for(x=t-1;x>=0;x--)if(C=n[x],T=e[x],0===T)for(c=x,i.set(x,x,1),o=x-1;o>=0;o--){for(h=i.get(o,o)-C,k=0,a=c;a<=x;a++)k+=i.get(o,a)*i.get(a,x);if(e[o]<0)A=h,P=k;else if(c=o,0===e[o]?i.set(o,x,0!==h?-k/h:-k/(M*S)):(d=i.get(o,o+1),f=i.get(o+1,o),T=(n[o]-C)*(n[o]-C)+e[o]*e[o],l=(d*P-A*k)/T,i.set(o,x,l),i.set(o+1,x,Math.abs(d)>Math.abs(A)?(-k-h*l)/d:(-P-f*l)/A)),l=Math.abs(i.get(o,x)),M*l*l>1)for(a=o;a<=x;a++)i.set(a,x,i.get(a,x)/l)}else if(T<0)for(c=x-1,Math.abs(i.get(x,x-1))>Math.abs(i.get(x-1,x))?(i.set(x-1,x-1,T/i.get(x,x-1)),i.set(x-1,x,-(i.get(x,x)-C)/i.get(x,x-1))):(b=ay(0,-i.get(x-1,x),i.get(x-1,x-1)-C,T),i.set(x-1,x-1,b[0]),i.set(x-1,x,b[1])),i.set(x,x-1,0),i.set(x,x,1),o=x-2;o>=0;o--){for(p=0,g=0,a=c;a<=x;a++)p+=i.get(o,a)*i.get(a,x-1),g+=i.get(o,a)*i.get(a,x);if(h=i.get(o,o)-C,e[o]<0)A=h,k=p,P=g;else if(c=o,0===e[o]?(b=ay(-p,-g,h,T),i.set(o,x-1,b[0]),i.set(o,x,b[1])):(d=i.get(o,o+1),f=i.get(o+1,o),m=(n[o]-C)*(n[o]-C)+e[o]*e[o]-T*T,v=2*(n[o]-C)*T,0===m&&0===v&&(m=M*S*(Math.abs(h)+Math.abs(T)+Math.abs(d)+Math.abs(f)+Math.abs(A))),b=ay(d*k-A*p+T*g,d*P-A*g-T*p,m,v),i.set(o,x-1,b[0]),i.set(o,x,b[1]),Math.abs(d)>Math.abs(A)+Math.abs(T)?(i.set(o+1,x-1,(-p-h*i.get(o,x-1)+T*i.get(o,x))/d),i.set(o+1,x,(-g-h*i.get(o,x)-T*i.get(o,x-1))/d)):(b=ay(-k-f*i.get(o,x-1),-P-f*i.get(o,x),A,T),i.set(o+1,x-1,b[0]),i.set(o+1,x,b[1]))),l=Math.max(Math.abs(i.get(o,x-1)),Math.abs(i.get(o,x))),M*l*l>1)for(a=o;a<=x;a++)i.set(a,x-1,i.get(a,x-1)/l),i.set(a,x,i.get(a,x)/l)}for(o=0;o<t;o++)if(o<E||o>w)for(a=o;a<t;a++)r.set(o,a,i.get(o,a));for(a=t-1;a>=E;a--)for(o=E;o<=w;o++){for(A=0,s=E;s<=Math.min(a,w);s++)A+=r.get(o,s)*i.get(s,a);r.set(o,a,A)}}(o,c,s,a,t)}this.n=o,this.e=c,this.d=s,this.V=a}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,n=this.n,r=this.e,i=this.d,o=new Hv(n,n);for(t=0;t<n;t++){for(e=0;e<n;e++)o.set(t,e,0);o.set(t,t,i[t]),r[t]>0?o.set(t,t+1,r[t]):r[t]<0&&o.set(t,t-1,r[t])}return o}}function ay(t,e,n,r){let i,o;return Math.abs(n)>Math.abs(r)?(i=r/n,o=n+i*r,[(t+i*e)/o,(e-i*t)/o]):(i=n/r,o=r+i*n,[(i*t+e)/o,(i*e-t)/o])}class sy{constructor(t){if(!(t=Zv.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,n,r,i=t,o=i.rows,a=new Hv(o,o),s=!0;for(n=0;n<o;n++){let t=0;for(r=0;r<n;r++){let o=0;for(e=0;e<r;e++)o+=a.get(r,e)*a.get(n,e);o=(i.get(n,r)-o)/a.get(r,r),a.set(n,r,o),t+=o*o}for(t=i.get(n,n)-t,s&=t>0,a.set(n,n,Math.sqrt(Math.max(t,0))),r=n+1;r<o;r++)a.set(n,r,0)}this.L=a,this.positiveDefinite=Boolean(s)}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=Zv.checkMatrix(t);let e=this.L,n=e.rows;if(t.rows!==n)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let r,i,o,a=t.columns,s=t.clone();for(o=0;o<n;o++)for(i=0;i<a;i++){for(r=0;r<o;r++)s.set(o,i,s.get(o,i)-s.get(r,i)*e.get(o,r));s.set(o,i,s.get(o,i)/e.get(o,o))}for(o=n-1;o>=0;o--)for(i=0;i<a;i++){for(r=o+1;r<n;r++)s.set(o,i,s.get(o,i)-s.get(r,i)*e.get(r,o));s.set(o,i,s.get(o,i)/e.get(o,o))}return s}get lowerTriangularMatrix(){return this.L}}class cy{constructor(t,e={}){t=Zv.checkMatrix(t);let{Y:n}=e;const{scaleScores:r=!1,maxIterations:i=1e3,terminationCriteria:o=1e-10}=e;let a;if(n){if(n=Cv.isAnyArray(n)&&"number"==typeof n[0]?Hv.columnVector(n):Zv.checkMatrix(n),n.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=n.getColumnVector(0)}else a=t.getColumnVector(0);let s,c,u,l,h=1;for(let e=0;e<i&&h>o;e++)u=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),u=u.div(u.norm()),s=t.mmul(u).div(u.transpose().mmul(u).get(0,0)),e>0&&(h=s.clone().sub(l).pow(2).sum()),l=s.clone(),n?(c=n.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),c=c.div(c.norm()),a=n.mmul(c).div(c.transpose().mmul(c).get(0,0))):a=s;if(n){let e=t.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0));e=e.div(e.norm());let r=t.clone().sub(s.clone().mmul(e.transpose())),i=a.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),o=n.clone().sub(s.clone().mulS(i.get(0,0)).mmul(c.transpose()));this.t=s,this.p=e.transpose(),this.w=u.transpose(),this.q=c,this.u=a,this.s=s.transpose().mmul(s),this.xResidual=r,this.yResidual=o,this.betas=i}else this.w=u.transpose(),this.s=s.transpose().mmul(s).sqrt(),this.t=r?s.clone().div(this.s.get(0,0)):s,this.xResidual=t.sub(s.mmul(u.transpose()))}}xv.AbstractMatrix=Wv,xv.CHO=sy,xv.CholeskyDecomposition=sy,xv.DistanceMatrix=$v,xv.EVD=oy,xv.EigenvalueDecomposition=oy,xv.LU=Qv,xv.LuDecomposition=Qv;var uy=xv.Matrix=Hv;xv.MatrixColumnSelectionView=class extends Yv{constructor(t,e){zv(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,n){return this.matrix.set(t,this.columnIndices[e],n),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},xv.MatrixColumnView=class extends Yv{constructor(t,e){Dv(t,e),super(t,t.rows,1),this.column=e}set(t,e,n){return this.matrix.set(t,this.column,n),this}get(t){return this.matrix.get(t,this.column)}},xv.MatrixFlipColumnView=class extends Yv{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(t,this.columns-e-1,n),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},xv.MatrixFlipRowView=class extends Yv{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(this.rows-t-1,e,n),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},xv.MatrixRowSelectionView=class extends Yv{constructor(t,e){jv(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,n){return this.matrix.set(this.rowIndices[t],e,n),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},xv.MatrixRowView=class extends Yv{constructor(t,e){Rv(t,e),super(t,1,t.columns),this.row=e}set(t,e,n){return this.matrix.set(this.row,e,n),this}get(t,e){return this.matrix.get(this.row,e)}},xv.MatrixSelectionView=Kv,xv.MatrixSubView=class extends Yv{constructor(t,e,n,r,i){Bv(t,e,n,r,i),super(t,n-e+1,i-r+1),this.startRow=e,this.startColumn=r}set(t,e,n){return this.matrix.set(this.startRow+t,this.startColumn+e,n),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},xv.MatrixTransposeView=class extends Yv{constructor(t){super(t,t.columns,t.rows)}set(t,e,n){return this.matrix.set(e,t,n),this}get(t,e){return this.matrix.get(e,t)}},xv.NIPALS=cy,xv.Nipals=cy,xv.QR=ty,xv.QrDecomposition=ty,xv.SVD=ey;var ly=xv.SingularValueDecomposition=ey;xv.SymmetricMatrix=qv,xv.WrapperMatrix1D=Xv,xv.WrapperMatrix2D=Zv,xv.correlation=function(t,e=t,n={}){t=new Hv(t);let r=!1;if("object"!=typeof e||Hv.isMatrix(e)||Cv.isAnyArray(e)?e=new Hv(e):(n=e,e=t,r=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:o=!0}=n;i&&(t.center("column"),r||e.center("column")),o&&(t.scale("column"),r||e.scale("column"));const a=t.standardDeviation("column",{unbiased:!0}),s=r?a:e.standardDeviation("column",{unbiased:!0}),c=t.transpose().mmul(e);for(let e=0;e<c.rows;e++)for(let n=0;n<c.columns;n++)c.set(e,n,c.get(e,n)*(1/(a[e]*s[n]))*(1/(t.rows-1)));return c},xv.covariance=function(t,e=t,n={}){t=new Hv(t);let r=!1;if("object"!=typeof e||Hv.isMatrix(e)||Cv.isAnyArray(e)?e=new Hv(e):(n=e,e=t,r=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=n;i&&(t=t.center("column"),r||(e=e.center("column")));const o=t.transpose().mmul(e);for(let e=0;e<o.rows;e++)for(let n=0;n<o.columns;n++)o.set(e,n,o.get(e,n)*(1/(t.rows-1)));return o};var hy=xv.default=Hv;xv.determinant=function t(e){if((e=Hv.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let n,r,i,o;if(2===e.columns)return n=e.get(0,0),r=e.get(0,1),i=e.get(1,0),o=e.get(1,1),n*o-r*i;if(3===e.columns){let o,a,s;return o=new Kv(e,[1,2],[1,2]),a=new Kv(e,[1,2],[0,2]),s=new Kv(e,[1,2],[0,1]),n=e.get(0,0),r=e.get(0,1),i=e.get(0,2),n*t(o)-r*t(a)+i*t(s)}return new Qv(e).determinant}throw Error("determinant can only be calculated for a square matrix")},xv.inverse=function(t,e=!1){return t=Zv.checkMatrix(t),e?new ey(t).inverse():ny(t,Hv.eye(t.rows))},xv.linearDependencies=function(t,e={}){const{thresholdValue:n=1e-9,thresholdError:r=1e-9}=e;let i=(t=Hv.checkMatrix(t)).rows,o=new Hv(i,i);for(let e=0;e<i;e++){let a=Hv.columnVector(t.getRow(e)),s=t.subMatrixRow(ry(i,e)).transpose(),c=new ey(s).solve(a),u=Hv.sub(a,s.mmul(c)).abs().max();o.setRow(e,iy(u,c,e,n,r))}return o},xv.pseudoInverse=function(t,e=Number.EPSILON){if((t=Hv.checkMatrix(t)).isEmpty())return t.transpose();let n=new ey(t,{autoTranspose:!0}),r=n.leftSingularVectors,i=n.rightSingularVectors,o=n.diagonal;for(let t=0;t<o.length;t++)Math.abs(o[t])>e?o[t]=1/o[t]:o[t]=0;return i.mmul(Hv.diag(o).mmul(r.transpose()))},xv.solve=ny,xv.wrap=function(t,e){if(Cv.isAnyArray(t))return t[0]&&Cv.isAnyArray(t[0])?new Zv(t):new Xv(t,e);throw new Error("the argument is not an array")};const dy=uy,fy=ly;hy.Matrix&&hy.Matrix;const py={center:[0,0],linkDistance:50};class gy{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},py),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericMDSLayout(!0,t,e)}))}genericMDSLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{center:i=[0,0],linkDistance:o=50}=r,a=e.getAllNodes(),s=e.getAllEdges();if(!(null==a?void 0:a.length)||1===a.length)return Gm(e,t,i);const c=Om({nodes:a,edges:s},!1),u=Am(c);my(u);const l=((t,e)=>{const n=[];return t.forEach((t=>{const r=[];t.forEach((t=>{r.push(t*e)})),n.push(r)})),n})(u,o),h=vy(l),d=[];h.forEach(((t,e)=>{const n=Im(a[e]);n.data.x=t[0]+i[0],n.data.y=t[1]+i[1],d.push(n)})),t&&d.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:d,edges:s}}))}}const my=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((n,r)=>{n.forEach(((n,i)=>{n===1/0&&(t[r][i]=e)}))}))},vy=t=>{const e=dy.mul(dy.pow(t,2),-.5),n=e.mean("row"),r=e.mean("column"),i=e.mean();e.add(i).subRowVector(n).subColumnVector(r);const o=new fy(e),a=dy.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map((t=>dy.mul([t],[a]).toJSON()[0].splice(0,2)))},yy={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},by={center:[0,0],comboPadding:10,treeKey:"combo"};function xy(t,e){var n,r=1;function i(){var i,o,a=n.length,s=0,c=0;for(i=0;i<a;++i)s+=(o=n[i]).x,c+=o.y;for(s=(s/a-t)*r,c=(c/a-e)*r,i=0;i<a;++i)(o=n[i]).x-=s,o.y-=c}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i}function Ey(t){return function(){return t}}function wy(t){return 1e-6*(t()-.5)}function My(t){return t.x+t.vx}function Ny(t){return t.y+t.vy}function Sy(t){var e,n,r,i=1,o=1;function a(){for(var t,a,c,u,l,h,d,f=e.length,p=0;p<o;++p)for(a=Zm(e,My,Ny).visitAfter(s),t=0;t<f;++t)c=e[t],h=n[c.index],d=h*h,u=c.x+c.vx,l=c.y+c.vy,a.visit(g);function g(t,e,n,o,a){var s=t.data,f=t.r,p=h+f;if(!s)return e>u+p||o<u-p||n>l+p||a<l-p;if(s.index>c.index){var g=u-s.x-s.vx,m=l-s.y-s.vy,v=g*g+m*m;v<p*p&&(0===g&&(v+=(g=wy(r))*g),0===m&&(v+=(m=wy(r))*m),v=(p-(v=Math.sqrt(v)))/v*i,c.vx+=(g*=v)*(p=(f*=f)/(d+f)),c.vy+=(m*=v)*p,s.vx-=g*(p=1-p),s.vy-=m*p)}}}function s(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function c(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=Ey(null==t?1:+t)),a.initialize=function(t,n){e=t,r=n,c()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ey(+e),c(),a):t},a}function Cy(t){return t.index}function Ty(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function ky(t){var e,n,r,i,o,a,s=Cy,c=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},u=Ey(30),l=1;function h(r){for(var i=0,s=t.length;i<l;++i)for(var c,u,h,d,f,p,g,m=0;m<s;++m)u=(c=t[m]).source,d=(h=c.target).x+h.vx-u.x-u.vx||wy(a),f=h.y+h.vy-u.y-u.vy||wy(a),d*=p=((p=Math.sqrt(d*d+f*f))-n[m])/p*r*e[m],f*=p,h.vx-=d*(g=o[m]),h.vy-=f*g,u.vx+=d*(g=1-g),u.vy+=f*g}function d(){if(r){var a,c,u=r.length,l=t.length,h=new Map(r.map(((t,e)=>[s(t,e,r),t])));for(a=0,i=new Array(u);a<l;++a)(c=t[a]).index=a,"object"!=typeof c.source&&(c.source=Ty(h,c.source)),"object"!=typeof c.target&&(c.target=Ty(h,c.target)),i[c.source.index]=(i[c.source.index]||0)+1,i[c.target.index]=(i[c.target.index]||0)+1;for(a=0,o=new Array(l);a<l;++a)c=t[a],o[a]=i[c.source.index]/(i[c.source.index]+i[c.target.index]);e=new Array(l),f(),n=new Array(l),p()}}function f(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+c(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+u(t[e],e,t)}return null==t&&(t=[]),h.initialize=function(t,e){r=t,a=e,d()},h.links=function(e){return arguments.length?(t=e,d(),h):t},h.id=function(t){return arguments.length?(s=t,h):s},h.iterations=function(t){return arguments.length?(l=+t,h):l},h.strength=function(t){return arguments.length?(c="function"==typeof t?t:Ey(+t),f(),h):c},h.distance=function(t){return arguments.length?(u="function"==typeof t?t:Ey(+t),p(),h):u},h}var Py={value:()=>{}};function Ay(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Oy(r)}function Oy(t){this._=t}function _y(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Ry(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Py,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Oy.prototype=Ay.prototype={constructor:Oy,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=Ry(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Ry(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=_y(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Oy(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var Dy,Iy,Ly=0,jy=0,zy=0,By=1e3,Fy=0,Gy=0,Vy=0,Wy="object"==typeof performance&&performance.now?performance:Date,Uy="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Hy(){return Gy||(Uy(qy),Gy=Wy.now()+Vy)}function qy(){Gy=0}function $y(){this._call=this._time=this._next=null}function Yy(t,e,n){var r=new $y;return r.restart(t,e,n),r}function Ky(){Gy=(Fy=Wy.now())+Vy,Ly=jy=0;try{!function(){Hy(),++Ly;for(var t,e=Dy;e;)(t=Gy-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ly}()}finally{Ly=0,function(){var t,e,n=Dy,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:Dy=e);Iy=t,Zy(r)}(),Gy=0}}function Xy(){var t=Wy.now(),e=t-Fy;e>By&&(Vy-=e,Fy=t)}function Zy(t){Ly||(jy&&(jy=clearTimeout(jy)),t-Gy>24?(t<1/0&&(jy=setTimeout(Ky,t-Wy.now()-Vy)),zy&&(zy=clearInterval(zy))):(zy||(Fy=Wy.now(),zy=setInterval(Xy,By)),Ly=1,Uy(Ky)))}$y.prototype=Yy.prototype={constructor:$y,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Hy():+n)+(null==e?0:+e),this._next||Iy===this||(Iy?Iy._next=this:Dy=this,Iy=this),this._call=t,this._time=n,Zy()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zy())}};const Qy=1664525,Jy=1013904223,tb=4294967296;function eb(t){return t.x}function nb(t){return t.y}var rb=Math.PI*(3-Math.sqrt(5));function ib(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,c=Yy(h),u=Ay("tick","end"),l=function(){let t=1;return()=>(t=(Qy*t+Jy)%tb)/tb}();function h(){d(),u.call("tick",e),n<r&&(c.stop(),u.call("end",e))}function d(r){var c,u,l=t.length;void 0===r&&(r=1);for(var h=0;h<r;++h)for(n+=(o-n)*i,s.forEach((function(t){t(n)})),c=0;c<l;++c)null==(u=t[c]).fx?u.x+=u.vx*=a:(u.x=u.fx,u.vx=0),null==u.fy?u.y+=u.vy*=a:(u.y=u.fy,u.vy=0);return e}function f(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),o=n*rb;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,l),e}return null==t&&(t=[]),f(),e={tick:d,restart:function(){return c.restart(h),e},stop:function(){return c.stop(),e},nodes:function(n){return arguments.length?(t=n,f(),s.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(l=t,s.forEach(p),e):l},force:function(t,n){return arguments.length>1?(null==n?s.delete(t):s.set(t,p(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,c,u=0,l=t.length;for(null==r?r=1/0:r*=r,u=0;u<l;++u)(a=(i=e-(s=t[u]).x)*i+(o=n-s.y)*o)<r&&(c=s,r=a);return c},on:function(t,n){return arguments.length>1?(u.on(t,n),e):u.on(t)}}}function ob(){var t,e,n,r,i,o=Ey(-30),a=1,s=1/0,c=.81;function u(n){var i,o=t.length,a=Zm(t,eb,nb).visitAfter(h);for(r=n,i=0;i<o;++i)e=t[i],a.visit(d)}function l(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function h(t){var e,n,r,o,a,s=0,c=0;if(t.length){for(r=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(s+=e.value,c+=n,r+=n*e.x,o+=n*e.y);t.x=r/c,t.y=o/c}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=i[e.data.index]}while(e=e.next)}t.value=s}function d(t,o,u,l){if(!t.value)return!0;var h=t.x-e.x,d=t.y-e.y,f=l-o,p=h*h+d*d;if(f*f/c<p)return p<s&&(0===h&&(p+=(h=wy(n))*h),0===d&&(p+=(d=wy(n))*d),p<a&&(p=Math.sqrt(a*p)),e.vx+=h*t.value*r/p,e.vy+=d*t.value*r/p),!0;if(!(t.length||p>=s)){(t.data!==e||t.next)&&(0===h&&(p+=(h=wy(n))*h),0===d&&(p+=(d=wy(n))*d),p<a&&(p=Math.sqrt(a*p)));do{t.data!==e&&(f=i[t.data.index]*r/p,e.vx+=h*f,e.vy+=d*f)}while(t=t.next)}}return u.initialize=function(e,r){t=e,n=r,l()},u.strength=function(t){return arguments.length?(o="function"==typeof t?t:Ey(+t),l(),u):o},u.distanceMin=function(t){return arguments.length?(a=t*t,u):Math.sqrt(a)},u.distanceMax=function(t){return arguments.length?(s=t*t,u):Math.sqrt(s)},u.theta=function(t){return arguments.length?(c=t*t,u):Math.sqrt(c)},u}function ab(t,e,n){var r,i,o,a=Ey(.1);function s(t){for(var a=0,s=r.length;a<s;++a){var c=r[a],u=c.x-e||1e-6,l=c.y-n||1e-6,h=Math.sqrt(u*u+l*l),d=(o[a]-h)*i[a]*t/h;c.vx+=u*d,c.vy+=l*d}}function c(){if(r){var e,n=r.length;for(i=new Array(n),o=new Array(n),e=0;e<n;++e)o[e]=+t(r[e],e,r),i[e]=isNaN(o[e])?0:+a(r[e],e,r)}}return"function"!=typeof t&&(t=Ey(+t)),null==e&&(e=0),null==n&&(n=0),s.initialize=function(t){r=t,c()},s.strength=function(t){return arguments.length?(a="function"==typeof t?t:Ey(+t),c(),s):a},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ey(+e),c(),s):t},s.x=function(t){return arguments.length?(e=+t,s):e},s.y=function(t){return arguments.length?(n=+t,s):n},s}function sb(t){var e,n,r,i=Ey(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=Ey(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Ey(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:Ey(+e),a(),o):t},o}function cb(t){var e,n,r,i=Ey(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=Ey(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Ey(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:Ey(+e),a(),o):t},o}class ub{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:ky,manyBody:ob,center:xy,collide:Sy,radial:ab,x:sb,y:cb},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},re(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){yield this.genericLayout(!0,t,e)}))}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const n=this.context.nodes.find((e=>e.id===t));n&&e.forEach(((t,e)=>{if("number"==typeof t||null===t){n[["fx","fy","fz"][e]]=t}}))}getOptions(t){var e,n;const r=re({},this.options,t);return r.collide&&void 0===(null===(e=r.collide)||void 0===e?void 0:e.radius)&&(r.collide=r.collide||{},r.collide.radius=null!==(n=r.nodeSize)&&void 0!==n?n:10),void 0===r.iterations&&(r.link&&void 0===r.link.iterations&&(r.iterations=r.link.iterations),r.collide&&void 0===r.collide.iterations&&(r.iterations=r.collide.iterations)),this.context.options=r,r}genericLayout(t,e,n){var r;return a(this,void 0,void 0,(function*(){const i=this.getOptions(n),o=e.getAllNodes().map((({id:t,data:e})=>Object.assign({id:t,data:e},le(e,this.config.inputNodeAttrs)))),a=e.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:t,nodes:o,edges:a,graph:e});const s=new Promise((t=>{this.resolver=t})),c=this.setSimulation(i);return c.nodes(o),null===(r=c.force("link"))||void 0===r||r.links(a),s}))}getResult(){const{assign:t,nodes:e,edges:n,graph:r}=this.context,i=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),le(t,this.config.outputNodeAttrs))}))),o=n.map((({id:t,source:e,target:n,data:r})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof n?n.id:n,data:r})));return t&&i.forEach((t=>r.mergeNodeData(t.id,t.data))),{nodes:i,edges:o}}initSimulation(){return ib()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),lb(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([n,r])=>{const i=n;if(t[n]){let n=e.force(i);n||(n=r(),e.force(i,n)),lb(n,Object.entries(t[i]))}else e.force(i,null)})),e}}const lb=(t,e)=>e.reduce(((e,[n,r])=>e[n]&&void 0!==r?e[n].call(t,r):e),t);function hb(t,e,n){var r,i=1;function o(){var o,a,s=r.length,c=0,u=0,l=0;for(o=0;o<s;++o)c+=(a=r[o]).x||0,u+=a.y||0,l+=a.z||0;for(c=(c/s-t)*i,u=(u/s-e)*i,l=(l/s-n)*i,o=0;o<s;++o)a=r[o],c&&(a.x-=c),u&&(a.y-=u),l&&(a.z-=l)}return null==t&&(t=0),null==e&&(e=0),null==n&&(n=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.z=function(t){return arguments.length?(n=+t,o):n},o.strength=function(t){return arguments.length?(i=+t,o):i},o}function db(t,e,n){if(isNaN(e))return t;var r,i,o,a,s,c,u=t._root,l={data:n},h=t._x0,d=t._x1;if(!u)return t._root=l,t;for(;u.length;)if((a=e>=(i=(h+d)/2))?h=i:d=i,r=u,!(u=u[s=+a]))return r[s]=l,t;if(e===(o=+t._x.call(null,u.data)))return l.next=u,r?r[s]=l:t._root=l,t;do{r=r?r[s]=new Array(2):t._root=new Array(2),(a=e>=(i=(h+d)/2))?h=i:d=i}while((s=+a)==(c=+(o>=i)));return r[c]=u,r[s]=l,t}function fb(t,e,n){this.node=t,this.x0=e,this.x1=n}function pb(t){return t[0]}function gb(t,e){var n=new mb(null==e?pb:e,NaN,NaN);return null==t?n:n.addAll(t)}function mb(t,e,n){this._x=t,this._x0=e,this._x1=n,this._root=void 0}function vb(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var yb=gb.prototype=mb.prototype;function bb(t){return function(){return t}}function xb(t){return 1e-6*(t()-.5)}function Eb(t){return t.x+t.vx}function wb(t){return t.y+t.vy}function Mb(t){return t.z+t.vz}function Nb(t){var e,n,r,i,o=1,a=1;function s(){for(var t,s,u,l,h,d,f,p,g=e.length,m=0;m<a;++m)for(s=(1===n?gb(e,Eb):2===n?Zm(e,Eb,wb):3===n?av(e,Eb,wb,Mb):null).visitAfter(c),t=0;t<g;++t)u=e[t],f=r[u.index],p=f*f,l=u.x+u.vx,n>1&&(h=u.y+u.vy),n>2&&(d=u.z+u.vz),s.visit(v);function v(t,e,r,a,s,c,g){var m=[e,r,a,s,c,g],v=m[0],y=m[1],b=m[2],x=m[n],E=m[n+1],w=m[n+2],M=t.data,N=t.r,S=f+N;if(!M)return v>l+S||x<l-S||n>1&&(y>h+S||E<h-S)||n>2&&(b>d+S||w<d-S);if(M.index>u.index){var C=l-M.x-M.vx,T=n>1?h-M.y-M.vy:0,k=n>2?d-M.z-M.vz:0,P=C*C+T*T+k*k;P<S*S&&(0===C&&(P+=(C=xb(i))*C),n>1&&0===T&&(P+=(T=xb(i))*T),n>2&&0===k&&(P+=(k=xb(i))*k),P=(S-(P=Math.sqrt(P)))/P*o,u.vx+=(C*=P)*(S=(N*=N)/(p+N)),n>1&&(u.vy+=(T*=P)*S),n>2&&(u.vz+=(k*=P)*S),M.vx-=C*(S=1-S),n>1&&(M.vy-=T*S),n>2&&(M.vz-=k*S))}}}function c(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<Math.pow(2,n);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,i,o=e.length;for(r=new Array(o),n=0;n<o;++n)i=e[n],r[i.index]=+t(i,n,e)}}return"function"!=typeof t&&(t=bb(null==t?1:+t)),s.initialize=function(t,...r){e=t,i=r.find((t=>"function"==typeof t))||Math.random,n=r.find((t=>[1,2,3].includes(t)))||2,u()},s.iterations=function(t){return arguments.length?(a=+t,s):a},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:bb(+e),u(),s):t},s}function Sb(t){return t.index}function Cb(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Tb(t){var e,n,r,i,o,a,s,c=Sb,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},l=bb(30),h=1;function d(r){for(var o=0,c=t.length;o<h;++o)for(var u,l,d,f,p,g=0,m=0,v=0,y=0;g<c;++g)l=(u=t[g]).source,m=(d=u.target).x+d.vx-l.x-l.vx||xb(s),i>1&&(v=d.y+d.vy-l.y-l.vy||xb(s)),i>2&&(y=d.z+d.vz-l.z-l.vz||xb(s)),m*=f=((f=Math.sqrt(m*m+v*v+y*y))-n[g])/f*r*e[g],v*=f,y*=f,d.vx-=m*(p=a[g]),i>1&&(d.vy-=v*p),i>2&&(d.vz-=y*p),l.vx+=m*(p=1-p),i>1&&(l.vy+=v*p),i>2&&(l.vz+=y*p)}function f(){if(r){var i,s,u=r.length,l=t.length,h=new Map(r.map(((t,e)=>[c(t,e,r),t])));for(i=0,o=new Array(u);i<l;++i)(s=t[i]).index=i,"object"!=typeof s.source&&(s.source=Cb(h,s.source)),"object"!=typeof s.target&&(s.target=Cb(h,s.target)),o[s.source.index]=(o[s.source.index]||0)+1,o[s.target.index]=(o[s.target.index]||0)+1;for(i=0,a=new Array(l);i<l;++i)s=t[i],a[i]=o[s.source.index]/(o[s.source.index]+o[s.target.index]);e=new Array(l),p(),n=new Array(l),g()}}function p(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+u(t[n],n,t)}function g(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+l(t[e],e,t)}return null==t&&(t=[]),d.initialize=function(t,...e){r=t,s=e.find((t=>"function"==typeof t))||Math.random,i=e.find((t=>[1,2,3].includes(t)))||2,f()},d.links=function(e){return arguments.length?(t=e,f(),d):t},d.id=function(t){return arguments.length?(c=t,d):c},d.iterations=function(t){return arguments.length?(h=+t,d):h},d.strength=function(t){return arguments.length?(u="function"==typeof t?t:bb(+t),p(),d):u},d.distance=function(t){return arguments.length?(l="function"==typeof t?t:bb(+t),g(),d):l},d}yb.copy=function(){var t,e,n=new mb(this._x,this._x0,this._x1),r=this._root;if(!r)return n;if(!r.length)return n._root=vb(r),n;for(t=[{source:r,target:n._root=new Array(2)}];r=t.pop();)for(var i=0;i<2;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(2)}):r.target[i]=vb(e));return n},yb.add=function(t){const e=+this._x.call(null,t);return db(this.cover(e),e,t)},yb.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,n=new Float64Array(e);let r=1/0,i=-1/0;for(let o,a=0;a<e;++a)isNaN(o=+this._x.call(null,t[a]))||(n[a]=o,o<r&&(r=o),o>i&&(i=o));if(r>i)return this;this.cover(r).cover(i);for(let r=0;r<e;++r)db(this,n[r],t[r]);return this},yb.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,n=this._x1;if(isNaN(e))n=(e=Math.floor(t))+1;else{for(var r,i,o=n-e||1,a=this._root;e>t||t>=n;)switch(i=+(t<e),(r=new Array(2))[i]=a,a=r,o*=2,i){case 0:n=e+o;break;case 1:e=n-o}this._root&&this._root.length&&(this._root=a)}return this._x0=e,this._x1=n,this},yb.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},yb.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},yb.find=function(t,e){var n,r,i,o,a,s=this._x0,c=this._x1,u=[],l=this._root;for(l&&u.push(new fb(l,s,c)),null==e?e=1/0:(s=t-e,c=t+e);o=u.pop();)if(!(!(l=o.node)||(r=o.x0)>c||(i=o.x1)<s))if(l.length){var h=(r+i)/2;u.push(new fb(l[1],h,i),new fb(l[0],r,h)),(a=+(t>=h))&&(o=u[u.length-1],u[u.length-1]=u[u.length-1-a],u[u.length-1-a]=o)}else{var d=Math.abs(t-+this._x.call(null,l.data));d<e&&(e=d,s=t-d,c=t+d,n=l.data)}return n},yb.remove=function(t){if(isNaN(o=+this._x.call(null,t)))return this;var e,n,r,i,o,a,s,c,u,l=this._root,h=this._x0,d=this._x1;if(!l)return this;if(l.length)for(;;){if((s=o>=(a=(h+d)/2))?h=a:d=a,e=l,!(l=l[c=+s]))return this;if(!l.length)break;e[c+1&1]&&(n=e,u=c)}for(;l.data!==t;)if(r=l,!(l=l.next))return this;return(i=l.next)&&delete l.next,r?(i?r.next=i:delete r.next,this):e?(i?e[c]=i:delete e[c],(l=e[0]||e[1])&&l===(e[1]||e[0])&&!l.length&&(n?n[u]=l:this._root=l),this):(this._root=i,this)},yb.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},yb.root=function(){return this._root},yb.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},yb.visit=function(t){var e,n,r,i,o=[],a=this._root;for(a&&o.push(new fb(a,this._x0,this._x1));e=o.pop();)if(!t(a=e.node,r=e.x0,i=e.x1)&&a.length){var s=(r+i)/2;(n=a[1])&&o.push(new fb(n,s,i)),(n=a[0])&&o.push(new fb(n,r,s))}return this},yb.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new fb(this._root,this._x0,this._x1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.x1,c=(a+s)/2;(o=i[0])&&n.push(new fb(o,a,c)),(o=i[1])&&n.push(new fb(o,c,s))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.x1);return this},yb.x=function(t){return arguments.length?(this._x=t,this):this._x};const kb=1664525,Pb=1013904223,Ab=4294967296;function Ob(t){return t.x}function _b(t){return t.y}function Rb(t){return t.z}var Db,Ib,Lb,jb,zb,Bb,Fb,Gb,Vb,Wb,Ub,Hb,qb,$b,Yb,Kb,Xb,Zb,Qb,Jb,tx,ex,nx,rx,ix,ox,ax,sx,cx,ux,lx,hx,dx,fx,px,gx,mx,vx,yx,bx,xx,Ex,wx,Mx,Nx,Sx,Cx,Tx,kx,Px,Ax,Ox,_x,Rx,Dx,Ix,Lx,jx,zx,Bx,Fx,Gx,Vx,Wx,Ux,Hx,qx,$x,Yx,Kx,Xx,Zx,Qx,Jx,tE,eE,nE,rE,iE,oE,aE,sE,cE,uE,lE,hE,dE,fE,pE,gE,mE,vE,yE,bE,xE,EE,wE,ME,NE,SE,CE,TE,kE,PE,AE,OE,_E,RE,DE=Math.PI*(3-Math.sqrt(5)),IE=20*Math.PI/(9+Math.sqrt(221));function LE(t,e){e=e||2;var n,r=Math.min(3,Math.max(1,Math.round(e))),i=1,o=.001,a=1-Math.pow(o,1/300),s=0,c=.6,u=new Map,l=Yy(f),h=Ay("tick","end"),d=function(){let t=1;return()=>(t=(kb*t+Pb)%Ab)/Ab}();function f(){p(),h.call("tick",n),i<o&&(l.stop(),h.call("end",n))}function p(e){var o,l,h=t.length;void 0===e&&(e=1);for(var d=0;d<e;++d)for(i+=(s-i)*a,u.forEach((function(t){t(i)})),o=0;o<h;++o)null==(l=t[o]).fx?l.x+=l.vx*=c:(l.x=l.fx,l.vx=0),r>1&&(null==l.fy?l.y+=l.vy*=c:(l.y=l.fy,l.vy=0)),r>2&&(null==l.fz?l.z+=l.vz*=c:(l.z=l.fz,l.vz=0));return n}function g(){for(var e,n=0,i=t.length;n<i;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||r>1&&isNaN(e.y)||r>2&&isNaN(e.z)){var o=10*(r>2?Math.cbrt(.5+n):r>1?Math.sqrt(.5+n):n),a=n*DE,s=n*IE;1===r?e.x=o:2===r?(e.x=o*Math.cos(a),e.y=o*Math.sin(a)):(e.x=o*Math.sin(a)*Math.cos(s),e.y=o*Math.cos(a),e.z=o*Math.sin(a)*Math.sin(s))}(isNaN(e.vx)||r>1&&isNaN(e.vy)||r>2&&isNaN(e.vz))&&(e.vx=0,r>1&&(e.vy=0),r>2&&(e.vz=0))}}function m(e){return e.initialize&&e.initialize(t,d,r),e}return null==t&&(t=[]),g(),n={tick:p,restart:function(){return l.restart(f),n},stop:function(){return l.stop(),n},numDimensions:function(t){return arguments.length?(r=Math.min(3,Math.max(1,Math.round(t))),u.forEach(m),n):r},nodes:function(e){return arguments.length?(t=e,g(),u.forEach(m),n):t},alpha:function(t){return arguments.length?(i=+t,n):i},alphaMin:function(t){return arguments.length?(o=+t,n):o},alphaDecay:function(t){return arguments.length?(a=+t,n):+a},alphaTarget:function(t){return arguments.length?(s=+t,n):s},velocityDecay:function(t){return arguments.length?(c=1-t,n):1-c},randomSource:function(t){return arguments.length?(d=t,u.forEach(m),n):d},force:function(t,e){return arguments.length>1?(null==e?u.delete(t):u.set(t,m(e)),n):u.get(t)},find:function(){var e,n,i,o,a,s,c=Array.prototype.slice.call(arguments),u=c.shift()||0,l=(r>1?c.shift():null)||0,h=(r>2?c.shift():null)||0,d=c.shift()||1/0,f=0,p=t.length;for(d*=d,f=0;f<p;++f)(o=(e=u-(a=t[f]).x)*e+(n=l-(a.y||0))*n+(i=h-(a.z||0))*i)<d&&(s=a,d=o);return s},on:function(t,e){return arguments.length>1?(h.on(t,e),n):h.on(t)}}}function jE(){var t,e,n,r,i,o,a=bb(-30),s=1,c=1/0,u=.81;function l(r){var o,a=t.length,s=(1===e?gb(t,Ob):2===e?Zm(t,Ob,_b):3===e?av(t,Ob,_b,Rb):null).visitAfter(d);for(i=r,o=0;o<a;++o)n=t[o],s.visit(f)}function h(){if(t){var e,n,r=t.length;for(o=new Array(r),e=0;e<r;++e)n=t[e],o[n.index]=+a(n,e,t)}}function d(t){var n,r,i,a,s,c,u=0,l=0,h=t.length;if(h){for(i=a=s=c=0;c<h;++c)(n=t[c])&&(r=Math.abs(n.value))&&(u+=n.value,l+=r,i+=r*(n.x||0),a+=r*(n.y||0),s+=r*(n.z||0));u*=Math.sqrt(4/h),t.x=i/l,e>1&&(t.y=a/l),e>2&&(t.z=s/l)}else{(n=t).x=n.data.x,e>1&&(n.y=n.data.y),e>2&&(n.z=n.data.z);do{u+=o[n.data.index]}while(n=n.next)}t.value=u}function f(t,a,l,h,d){if(!t.value)return!0;var f=[l,h,d][e-1],p=t.x-n.x,g=e>1?t.y-n.y:0,m=e>2?t.z-n.z:0,v=f-a,y=p*p+g*g+m*m;if(v*v/u<y)return y<c&&(0===p&&(y+=(p=xb(r))*p),e>1&&0===g&&(y+=(g=xb(r))*g),e>2&&0===m&&(y+=(m=xb(r))*m),y<s&&(y=Math.sqrt(s*y)),n.vx+=p*t.value*i/y,e>1&&(n.vy+=g*t.value*i/y),e>2&&(n.vz+=m*t.value*i/y)),!0;if(!(t.length||y>=c)){(t.data!==n||t.next)&&(0===p&&(y+=(p=xb(r))*p),e>1&&0===g&&(y+=(g=xb(r))*g),e>2&&0===m&&(y+=(m=xb(r))*m),y<s&&(y=Math.sqrt(s*y)));do{t.data!==n&&(v=o[t.data.index]*i/y,n.vx+=p*v,e>1&&(n.vy+=g*v),e>2&&(n.vz+=m*v))}while(t=t.next)}}return l.initialize=function(n,...i){t=n,r=i.find((t=>"function"==typeof t))||Math.random,e=i.find((t=>[1,2,3].includes(t)))||2,h()},l.strength=function(t){return arguments.length?(a="function"==typeof t?t:bb(+t),h(),l):a},l.distanceMin=function(t){return arguments.length?(s=t*t,l):Math.sqrt(s)},l.distanceMax=function(t){return arguments.length?(c=t*t,l):Math.sqrt(c)},l.theta=function(t){return arguments.length?(u=t*t,l):Math.sqrt(u)},l}function zE(t,e,n,r){var i,o,a,s,c=bb(.1);function u(t){for(var c=0,u=i.length;c<u;++c){var l=i[c],h=l.x-e||1e-6,d=(l.y||0)-n||1e-6,f=(l.z||0)-r||1e-6,p=Math.sqrt(h*h+d*d+f*f),g=(s[c]-p)*a[c]*t/p;l.vx+=h*g,o>1&&(l.vy+=d*g),o>2&&(l.vz+=f*g)}}function l(){if(i){var e,n=i.length;for(a=new Array(n),s=new Array(n),e=0;e<n;++e)s[e]=+t(i[e],e,i),a[e]=isNaN(s[e])?0:+c(i[e],e,i)}}return"function"!=typeof t&&(t=bb(+t)),null==e&&(e=0),null==n&&(n=0),null==r&&(r=0),u.initialize=function(t,...e){i=t,o=e.find((t=>[1,2,3].includes(t)))||2,l()},u.strength=function(t){return arguments.length?(c="function"==typeof t?t:bb(+t),l(),u):c},u.radius=function(e){return arguments.length?(t="function"==typeof e?e:bb(+e),l(),u):t},u.x=function(t){return arguments.length?(e=+t,u):e},u.y=function(t){return arguments.length?(n=+t,u):n},u.z=function(t){return arguments.length?(r=+t,u):r},u}function BE(t){var e,n,r,i=bb(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=bb(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:bb(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:bb(+e),a(),o):t},o}function FE(t){var e,n,r,i=bb(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=bb(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:bb(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:bb(+e),a(),o):t},o}function GE(t){var e,n,r,i=bb(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vz+=(r[o]-i.z)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=bb(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:bb(+t),a(),o):i},o.z=function(e){return arguments.length?(t="function"==typeof e?e:bb(+e),a(),o):t},o}function VE(){if(jb)return Lb;return jb=1,Lb=function(t,e){return t===e||t!=t&&e!=e}}function WE(){if(Bb)return zb;Bb=1;var t=VE();return zb=function(e,n){for(var r=e.length;r--;)if(t(e[r][0],n))return r;return-1},zb}function UE(){if(Kb)return Yb;Kb=1;var t=Ib?Db:(Ib=1,Db=function(){this.__data__=[],this.size=0}),e=function(){if(Gb)return Fb;Gb=1;var t=WE(),e=Array.prototype.splice;return Fb=function(n){var r=this.__data__,i=t(r,n);return!(i<0||(i==r.length-1?r.pop():e.call(r,i,1),--this.size,0))},Fb}(),n=function(){if(Wb)return Vb;Wb=1;var t=WE();return Vb=function(e){var n=this.__data__,r=t(n,e);return r<0?void 0:n[r][1]},Vb}(),r=function(){if(Hb)return Ub;Hb=1;var t=WE();return Ub=function(e){return t(this.__data__,e)>-1}}(),i=function(){if($b)return qb;$b=1;var t=WE();return qb=function(e,n){var r=this.__data__,i=t(r,e);return i<0?(++this.size,r.push([e,n])):r[i][1]=n,this},qb}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,Yb=o}function HE(){if(ox)return ix;ox=1;var t="object"==typeof d&&d&&d.Object===Object&&d;return ix=t}function qE(){if(sx)return ax;sx=1;var t=HE(),e="object"==typeof self&&self&&self.Object===Object&&self,n=t||e||Function("return this")();return ax=n}function $E(){if(ux)return cx;ux=1;var t=qE().Symbol;return cx=t}function YE(){if(gx)return px;gx=1;var t=$E(),e=function(){if(hx)return lx;hx=1;var t=$E(),e=Object.prototype,n=e.hasOwnProperty,r=e.toString,i=t?t.toStringTag:void 0;return lx=function(t){var e=n.call(t,i),o=t[i];try{t[i]=void 0;var a=!0}catch(t){}var s=r.call(t);return a&&(e?t[i]=o:delete t[i]),s}}(),n=function(){if(fx)return dx;fx=1;var t=Object.prototype.toString;return dx=function(e){return t.call(e)}}(),r=t?t.toStringTag:void 0;return px=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":r&&r in Object(t)?e(t):n(t)}}function KE(){if(vx)return mx;return vx=1,mx=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function XE(){if(bx)return yx;bx=1;var t=YE(),e=KE();return yx=function(n){if(!e(n))return!1;var r=t(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function ZE(){if(Mx)return wx;Mx=1;var t,e=function(){if(Ex)return xx;Ex=1;var t=qE()["__core-js_shared__"];return xx=t}(),n=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return wx=function(t){return!!n&&n in t}}function QE(){if(Sx)return Nx;Sx=1;var t=Function.prototype.toString;return Nx=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}function JE(){if(Ox)return Ax;Ox=1;var t=function(){if(Tx)return Cx;Tx=1;var t=XE(),e=ZE(),n=KE(),r=QE(),i=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,s=o.toString,c=a.hasOwnProperty,u=RegExp("^"+s.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Cx=function(o){return!(!n(o)||e(o))&&(t(o)?u:i).test(r(o))}}(),e=Px?kx:(Px=1,kx=function(t,e){return null==t?void 0:t[e]});return Ax=function(n,r){var i=e(n,r);return t(i)?i:void 0}}function tw(){if(Rx)return _x;Rx=1;var t=JE()(qE(),"Map");return _x=t}function ew(){if(Ix)return Dx;Ix=1;var t=JE()(Object,"create");return Dx=t}function nw(){if($x)return qx;$x=1;var t=function(){if(jx)return Lx;jx=1;var t=ew();return Lx=function(){this.__data__=t?t(null):{},this.size=0}}(),e=Bx?zx:(Bx=1,zx=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}),n=function(){if(Gx)return Fx;Gx=1;var t=ew(),e=Object.prototype.hasOwnProperty;return Fx=function(n){var r=this.__data__;if(t){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return e.call(r,n)?r[n]:void 0},Fx}(),r=function(){if(Wx)return Vx;Wx=1;var t=ew(),e=Object.prototype.hasOwnProperty;return Vx=function(n){var r=this.__data__;return t?void 0!==r[n]:e.call(r,n)},Vx}(),i=function(){if(Hx)return Ux;Hx=1;var t=ew();return Ux=function(e,n){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=t&&void 0===n?"__lodash_hash_undefined__":n,this},Ux}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,qx=o}function rw(){if(Jx)return Qx;Jx=1;var t=Zx?Xx:(Zx=1,Xx=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t});return Qx=function(e,n){var r=e.__data__;return t(n)?r["string"==typeof n?"string":"hash"]:r.map},Qx}function iw(){if(uE)return cE;uE=1;var t=function(){if(Kx)return Yx;Kx=1;var t=nw(),e=UE(),n=tw();return Yx=function(){this.size=0,this.__data__={hash:new t,map:new(n||e),string:new t}}}(),e=function(){if(eE)return tE;eE=1;var t=rw();return tE=function(e){var n=t(this,e).delete(e);return this.size-=n?1:0,n}}(),n=function(){if(rE)return nE;rE=1;var t=rw();return nE=function(e){return t(this,e).get(e)}}(),r=function(){if(oE)return iE;oE=1;var t=rw();return iE=function(e){return t(this,e).has(e)}}(),i=function(){if(sE)return aE;sE=1;var t=rw();return aE=function(e,n){var r=t(this,e),i=r.size;return r.set(e,n),this.size+=r.size==i?0:1,this},aE}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,cE=o}function ow(){if(fE)return dE;fE=1;var t=UE(),e=function(){if(Zb)return Xb;Zb=1;var t=UE();return Xb=function(){this.__data__=new t,this.size=0}}(),n=(Jb||(Jb=1,Qb=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}),Qb),r=ex?tx:(ex=1,tx=function(t){return this.__data__.get(t)}),i=rx?nx:(rx=1,nx=function(t){return this.__data__.has(t)}),o=function(){if(hE)return lE;hE=1;var t=UE(),e=tw(),n=iw();return lE=function(r,i){var o=this.__data__;if(o instanceof t){var a=o.__data__;if(!e||a.length<199)return a.push([r,i]),this.size=++o.size,this;o=this.__data__=new n(a)}return o.set(r,i),this.size=o.size,this},lE}();function a(e){var n=this.__data__=new t(e);this.size=n.size}return a.prototype.clear=e,a.prototype.delete=n,a.prototype.get=r,a.prototype.has=i,a.prototype.set=o,dE=a}function aw(){if(gE)return pE;return gE=1,pE=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t},pE}function sw(){if(vE)return mE;vE=1;var t=JE(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return mE=e}function cw(){if(bE)return yE;bE=1;var t=sw();return yE=function(e,n,r){"__proto__"==n&&t?t(e,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[n]=r}}function uw(){if(EE)return xE;EE=1;var t=cw(),e=VE(),n=Object.prototype.hasOwnProperty;return xE=function(r,i,o){var a=r[i];n.call(r,i)&&e(a,o)&&(void 0!==o||i in r)||t(r,i,o)}}function lw(){if(ME)return wE;ME=1;var t=uw(),e=cw();return wE=function(n,r,i,o){var a=!i;i||(i={});for(var s=-1,c=r.length;++s<c;){var u=r[s],l=o?o(i[u],n[u],u,i,n):void 0;void 0===l&&(l=n[u]),a?e(i,u,l):t(i,u,l)}return i},wE}function hw(){if(TE)return CE;return TE=1,CE=function(t){return null!=t&&"object"==typeof t}}function dw(){if(OE)return AE;OE=1;var t=function(){if(PE)return kE;PE=1;var t=YE(),e=hw();return kE=function(n){return e(n)&&"[object Arguments]"==t(n)}}(),e=hw(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,o=t(function(){return arguments}())?t:function(t){return e(t)&&r.call(t,"callee")&&!i.call(t,"callee")};return AE=o}function fw(){if(RE)return _E;RE=1;var t=Array.isArray;return _E=t}var pw,gw,mw,vw,yw,bw,xw,Ew,ww,Mw,Nw,Sw={exports:{}};function Cw(){return mw||(mw=1,function(t,e){var n=qE(),r=gw?pw:(gw=1,pw=function(){return!1}),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,a=o&&o.exports===i?n.Buffer:void 0,s=(a?a.isBuffer:void 0)||r;t.exports=s}(Sw,Sw.exports)),Sw.exports}function Tw(){if(yw)return vw;yw=1;var t=/^(?:0|[1-9]\d*)$/;return vw=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e<n},vw}function kw(){if(xw)return bw;xw=1;return bw=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function Pw(){if(Nw)return Mw;return Nw=1,Mw=function(t){return function(e){return t(e)}}}Sw.exports;var Aw,Ow,_w,Rw,Dw,Iw,Lw,jw,zw,Bw,Fw,Gw,Vw,Ww,Uw,Hw,qw,$w,Yw,Kw,Xw,Zw,Qw,Jw,tM,eM,nM,rM={exports:{}};function iM(){return Aw||(Aw=1,function(t,e){var n=HE(),r=e&&!e.nodeType&&e,i=r&&t&&!t.nodeType&&t,o=i&&i.exports===r&&n.process,a=function(){try{var t=i&&i.require&&i.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a}(rM,rM.exports)),rM.exports}function oM(){if(_w)return Ow;_w=1;var t=function(){if(ww)return Ew;ww=1;var t=YE(),e=kw(),n=hw(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,Ew=function(i){return n(i)&&e(i.length)&&!!r[t(i)]}}(),e=Pw(),n=iM(),r=n&&n.isTypedArray,i=r?e(r):t;return Ow=i}function aM(){if(Dw)return Rw;Dw=1;var t=(SE||(SE=1,NE=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}),NE),e=dw(),n=fw(),r=Cw(),i=Tw(),o=oM(),a=Object.prototype.hasOwnProperty;return Rw=function(s,c){var u=n(s),l=!u&&e(s),h=!u&&!l&&r(s),d=!u&&!l&&!h&&o(s),f=u||l||h||d,p=f?t(s.length,String):[],g=p.length;for(var m in s)!c&&!a.call(s,m)||f&&("length"==m||h&&("offset"==m||"parent"==m)||d&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||i(m,g))||p.push(m);return p},Rw}function sM(){if(Lw)return Iw;Lw=1;var t=Object.prototype;return Iw=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}}function cM(){if(zw)return jw;return zw=1,jw=function(t,e){return function(n){return t(e(n))}}}function uM(){if(Vw)return Gw;Vw=1;var t=sM(),e=function(){if(Fw)return Bw;Fw=1;var t=cM()(Object.keys,Object);return Bw=t}(),n=Object.prototype.hasOwnProperty;return Gw=function(r){if(!t(r))return e(r);var i=[];for(var o in Object(r))n.call(r,o)&&"constructor"!=o&&i.push(o);return i}}function lM(){if(Uw)return Ww;Uw=1;var t=XE(),e=kw();return Ww=function(n){return null!=n&&e(n.length)&&!t(n)}}function hM(){if(qw)return Hw;qw=1;var t=aM(),e=uM(),n=lM();return Hw=function(r){return n(r)?t(r):e(r)}}function dM(){if(Qw)return Zw;Qw=1;var t=KE(),e=sM(),n=Xw?Kw:(Xw=1,Kw=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}),r=Object.prototype.hasOwnProperty;return Zw=function(i){if(!t(i))return n(i);var o=e(i),a=[];for(var s in i)("constructor"!=s||!o&&r.call(i,s))&&a.push(s);return a}}function fM(){if(tM)return Jw;tM=1;var t=aM(),e=dM(),n=lM();return Jw=function(r){return n(r)?t(r,!0):e(r)}}rM.exports;var pM,gM,mM,vM,yM,bM,xM,EM,wM,MM,NM,SM,CM,TM,kM,PM,AM,OM,_M,RM,DM,IM,LM,jM,zM,BM,FM,GM,VM,WM,UM,HM,qM,$M,YM,KM,XM,ZM,QM,JM,tN,eN,nN,rN,iN,oN,aN,sN,cN,uN,lN,hN,dN,fN,pN,gN,mN,vN,yN,bN,xN,EN,wN,MN,NN,SN,CN,TN,kN,PN,AN,ON,_N,RN,DN,IN,LN,jN,zN,BN,FN,GN,VN,WN,UN,HN,qN,$N,YN,KN,XN,ZN,QN,JN,tS,eS,nS,rS,iS,oS,aS,sS,cS,uS,lS,hS,dS,fS,pS,gS,mS,vS,yS,bS,xS,ES,wS,MS,NS,SS,CS,TS,kS,PS,AS,OS,_S,RS,DS,IS,LS,jS,zS,BS,FS,GS,VS,WS,US,HS,qS,$S,YS,KS,XS,ZS,QS,JS,tC,eC,nC,rC,iC,oC,aC,sC,cC,uC,lC,hC,dC,fC,pC,gC,mC,vC,yC,bC,xC,EC,wC,MC,NC,SC,CC,TC,kC,PC,AC,OC,_C,RC,DC,IC,LC,jC,zC,BC,FC,GC,VC,WC,UC,HC,qC,$C,YC,KC,XC,ZC,QC,JC,tT,eT,nT,rT,iT,oT,aT,sT,cT,uT,lT,hT,dT,fT,pT,gT,mT,vT,yT,bT,xT,ET,wT,MT,NT,ST,CT,TT,kT,PT,AT,OT,_T,RT,DT,IT,LT,jT,zT,BT,FT,GT,VT,WT,UT,HT,qT,$T,YT,KT,XT,ZT,QT,JT,tk,ek,nk,rk,ik,ok,ak,sk,ck,uk,lk,hk,dk,fk,pk,gk,mk,vk,yk,bk,xk,Ek,wk,Mk,Nk={exports:{}};function Sk(){return pM||(pM=1,function(t,e){var n=qE(),r=e&&!e.nodeType&&e,i=r&&t&&!t.nodeType&&t,o=i&&i.exports===r?n.Buffer:void 0,a=o?o.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}}(Nk,Nk.exports)),Nk.exports}function Ck(){if(mM)return gM;return mM=1,gM=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e},gM}function Tk(){if(yM)return vM;return yM=1,vM=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o},vM}function kk(){if(xM)return bM;return xM=1,bM=function(){return[]}}function Pk(){if(wM)return EM;wM=1;var t=Tk(),e=kk(),n=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return EM=r?function(e){return null==e?[]:(e=Object(e),t(r(e),(function(t){return n.call(e,t)})))}:e}function Ak(){if(CM)return SM;return CM=1,SM=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t},SM}function Ok(){if(kM)return TM;kM=1;var t=cM()(Object.getPrototypeOf,Object);return TM=t}function _k(){if(AM)return PM;AM=1;var t=Ak(),e=Ok(),n=Pk(),r=kk(),i=Object.getOwnPropertySymbols;return PM=i?function(r){for(var i=[];r;)t(i,n(r)),r=e(r);return i}:r}function Rk(){if(DM)return RM;DM=1;var t=Ak(),e=fw();return RM=function(n,r,i){var o=r(n);return e(n)?o:t(o,i(n))}}function Dk(){if(LM)return IM;LM=1;var t=Rk(),e=Pk(),n=hM();return IM=function(r){return t(r,n,e)}}function Ik(){if(UM)return WM;UM=1;var t=JE()(qE(),"Set");return WM=t}function Lk(){if(YM)return $M;YM=1;var t=function(){if(FM)return BM;FM=1;var t=JE()(qE(),"DataView");return BM=t}(),e=tw(),n=function(){if(VM)return GM;VM=1;var t=JE()(qE(),"Promise");return GM=t}(),r=Ik(),i=function(){if(qM)return HM;qM=1;var t=JE()(qE(),"WeakMap");return HM=t}(),o=YE(),a=QE(),s="[object Map]",c="[object Promise]",u="[object Set]",l="[object WeakMap]",h="[object DataView]",d=a(t),f=a(e),p=a(n),g=a(r),m=a(i),v=o;return(t&&v(new t(new ArrayBuffer(1)))!=h||e&&v(new e)!=s||n&&v(n.resolve())!=c||r&&v(new r)!=u||i&&v(new i)!=l)&&(v=function(t){var e=o(t),n="[object Object]"==e?t.constructor:void 0,r=n?a(n):"";if(r)switch(r){case d:return h;case f:return s;case p:return c;case g:return u;case m:return l}return e}),$M=v}function jk(){if(QM)return ZM;QM=1;var t=qE().Uint8Array;return ZM=t}function zk(){if(tN)return JM;tN=1;var t=jk();return JM=function(e){var n=new e.constructor(e.byteLength);return new t(n).set(new t(e)),n}}function Bk(){if(cN)return sN;cN=1;var t=zk();return sN=function(e,n){var r=n?t(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}}function Fk(){if(lN)return uN;lN=1;var t=zk(),e=function(){if(nN)return eN;nN=1;var t=zk();return eN=function(e,n){var r=n?t(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}}(),n=function(){if(iN)return rN;iN=1;var t=/\w*$/;return rN=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}}(),r=function(){if(aN)return oN;aN=1;var t=$E(),e=t?t.prototype:void 0,n=e?e.valueOf:void 0;return oN=function(t){return n?Object(n.call(t)):{}}}(),i=Bk();return uN=function(o,a,s){var c=o.constructor;switch(a){case"[object ArrayBuffer]":return t(o);case"[object Boolean]":case"[object Date]":return new c(+o);case"[object DataView]":return e(o,s);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return i(o,s);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(o);case"[object RegExp]":return n(o);case"[object Symbol]":return r(o)}}}function Gk(){if(dN)return hN;dN=1;var t=KE(),e=Object.create,n=function(){function n(){}return function(r){if(!t(r))return{};if(e)return e(r);n.prototype=r;var i=new n;return n.prototype=void 0,i}}();return hN=n}function Vk(){if(pN)return fN;pN=1;var t=Gk(),e=Ok(),n=sM();return fN=function(r){return"function"!=typeof r.constructor||n(r)?{}:t(e(r))}}function Wk(){if(yN)return vN;yN=1;var t=function(){if(mN)return gN;mN=1;var t=Lk(),e=hw();return gN=function(n){return e(n)&&"[object Map]"==t(n)}}(),e=Pw(),n=iM(),r=n&&n.isMap,i=r?e(r):t;return vN=i}function Uk(){if(wN)return EN;wN=1;var t=function(){if(xN)return bN;xN=1;var t=Lk(),e=hw();return bN=function(n){return e(n)&&"[object Set]"==t(n)}}(),e=Pw(),n=iM(),r=n&&n.isSet,i=r?e(r):t;return EN=i}function Hk(){if(NN)return MN;NN=1;var t=ow(),e=aw(),n=uw(),r=function(){if(Yw)return $w;Yw=1;var t=lw(),e=hM();return $w=function(n,r){return n&&t(r,e(r),n)}}(),i=function(){if(nM)return eM;nM=1;var t=lw(),e=fM();return eM=function(n,r){return n&&t(r,e(r),n)}}(),o=Sk(),a=Ck(),s=function(){if(NM)return MM;NM=1;var t=lw(),e=Pk();return MM=function(n,r){return t(n,e(n),r)}}(),c=function(){if(_M)return OM;_M=1;var t=lw(),e=_k();return OM=function(n,r){return t(n,e(n),r)}}(),u=Dk(),l=function(){if(zM)return jM;zM=1;var t=Rk(),e=_k(),n=fM();return jM=function(r){return t(r,n,e)}}(),h=Lk(),d=function(){if(XM)return KM;XM=1;var t=Object.prototype.hasOwnProperty;return KM=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r},KM}(),f=Fk(),p=Vk(),g=fw(),m=Cw(),v=Wk(),y=KE(),b=Uk(),x=hM(),E=fM(),w="[object Arguments]",M="[object Function]",N="[object Object]",S={};return S[w]=S["[object Array]"]=S["[object ArrayBuffer]"]=S["[object DataView]"]=S["[object Boolean]"]=S["[object Date]"]=S["[object Float32Array]"]=S["[object Float64Array]"]=S["[object Int8Array]"]=S["[object Int16Array]"]=S["[object Int32Array]"]=S["[object Map]"]=S["[object Number]"]=S[N]=S["[object RegExp]"]=S["[object Set]"]=S["[object String]"]=S["[object Symbol]"]=S["[object Uint8Array]"]=S["[object Uint8ClampedArray]"]=S["[object Uint16Array]"]=S["[object Uint32Array]"]=!0,S["[object Error]"]=S[M]=S["[object WeakMap]"]=!1,MN=function C(T,k,P,A,O,_){var R,D=1&k,I=2&k,L=4&k;if(P&&(R=O?P(T,A,O,_):P(T)),void 0!==R)return R;if(!y(T))return T;var j=g(T);if(j){if(R=d(T),!D)return a(T,R)}else{var z=h(T),B=z==M||"[object GeneratorFunction]"==z;if(m(T))return o(T,D);if(z==N||z==w||B&&!O){if(R=I||B?{}:p(T),!D)return I?c(T,i(R,T)):s(T,r(R,T))}else{if(!S[z])return O?T:{};R=f(T,z,D)}}_||(_=new t);var F=_.get(T);if(F)return F;_.set(T,R),b(T)?T.forEach((function(t){R.add(C(t,k,P,t,T,_))})):v(T)&&T.forEach((function(t,e){R.set(e,C(t,k,P,e,T,_))}));var G=j?void 0:(L?I?l:u:I?E:x)(T);return e(G||T,(function(t,e){G&&(t=T[e=t]),n(R,e,C(t,k,P,e,T,_))})),R},MN}function qk(){if(CN)return SN;CN=1;var t=Hk();return SN=function(e){return t(e,4)}}function $k(){if(kN)return TN;return kN=1,TN=function(t){return function(){return t}}}function Yk(){if(_N)return ON;_N=1;var t=(AN||(AN=1,PN=function(t){return function(e,n,r){for(var i=-1,o=Object(e),a=r(e),s=a.length;s--;){var c=a[t?s:++i];if(!1===n(o[c],c,o))break}return e}}),PN),e=t();return ON=e}function Kk(){if(DN)return RN;DN=1;var t=Yk(),e=hM();return RN=function(n,r){return n&&t(n,r,e)}}function Xk(){if(zN)return jN;zN=1;var t=Kk(),e=function(){if(LN)return IN;LN=1;var t=lM();return IN=function(e,n){return function(r,i){if(null==r)return r;if(!t(r))return e(r,i);for(var o=r.length,a=n?o:-1,s=Object(r);(n?a--:++a<o)&&!1!==i(s[a],a,s););return r}},IN}(),n=e(t);return jN=n}function Zk(){if(FN)return BN;return FN=1,BN=function(t){return t}}function Qk(){if(VN)return GN;VN=1;var t=Zk();return GN=function(e){return"function"==typeof e?e:t}}function Jk(){if(UN)return WN;UN=1;var t=aw(),e=Xk(),n=Qk(),r=fw();return WN=function(i,o){return(r(i)?t:e)(i,n(o))}}function tP(){return qN?HN:(qN=1,HN=Jk())}function eP(){if(tS)return JN;tS=1;var t=iw(),e=XN?KN:(XN=1,KN=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}),n=QN?ZN:(QN=1,ZN=function(t){return this.__data__.has(t)});function r(e){var n=-1,r=null==e?0:e.length;for(this.__data__=new t;++n<r;)this.add(e[n])}return r.prototype.add=r.prototype.push=e,r.prototype.has=n,JN=r}function nP(){if(iS)return rS;return iS=1,rS=function(t,e){return t.has(e)}}function rP(){if(aS)return oS;aS=1;var t=eP(),e=(nS||(nS=1,eS=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}),eS),n=nP();return oS=function(r,i,o,a,s,c){var u=1&o,l=r.length,h=i.length;if(l!=h&&!(u&&h>l))return!1;var d=c.get(r),f=c.get(i);if(d&&f)return d==i&&f==r;var p=-1,g=!0,m=2&o?new t:void 0;for(c.set(r,i),c.set(i,r);++p<l;){var v=r[p],y=i[p];if(a)var b=u?a(y,v,p,i,r,c):a(v,y,p,r,i,c);if(void 0!==b){if(b)continue;g=!1;break}if(m){if(!e(i,(function(t,e){if(!n(m,e)&&(v===t||s(v,t,o,a,c)))return m.push(e)}))){g=!1;break}}else if(v!==y&&!s(v,y,o,a,c)){g=!1;break}}return c.delete(r),c.delete(i),g},oS}function iP(){if(lS)return uS;return lS=1,uS=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n},uS}function oP(){if(dS)return hS;dS=1;var t=$E(),e=jk(),n=VE(),r=rP(),i=(cS||(cS=1,sS=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}),sS),o=iP(),a=t?t.prototype:void 0,s=a?a.valueOf:void 0;return hS=function(t,a,c,u,l,h,d){switch(c){case"[object DataView]":if(t.byteLength!=a.byteLength||t.byteOffset!=a.byteOffset)return!1;t=t.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=a.byteLength||!h(new e(t),new e(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return n(+t,+a);case"[object Error]":return t.name==a.name&&t.message==a.message;case"[object RegExp]":case"[object String]":return t==a+"";case"[object Map]":var f=i;case"[object Set]":var p=1&u;if(f||(f=o),t.size!=a.size&&!p)return!1;var g=d.get(t);if(g)return g==a;u|=2,d.set(t,a);var m=r(f(t),f(a),u,l,h,d);return d.delete(t),m;case"[object Symbol]":if(s)return s.call(t)==s.call(a)}return!1}}function aP(){if(mS)return gS;mS=1;var t=ow(),e=rP(),n=oP(),r=function(){if(pS)return fS;pS=1;var t=Dk(),e=Object.prototype.hasOwnProperty;return fS=function(n,r,i,o,a,s){var c=1&i,u=t(n),l=u.length;if(l!=t(r).length&&!c)return!1;for(var h=l;h--;){var d=u[h];if(!(c?d in r:e.call(r,d)))return!1}var f=s.get(n),p=s.get(r);if(f&&p)return f==r&&p==n;var g=!0;s.set(n,r),s.set(r,n);for(var m=c;++h<l;){var v=n[d=u[h]],y=r[d];if(o)var b=c?o(y,v,d,r,n,s):o(v,y,d,n,r,s);if(!(void 0===b?v===y||a(v,y,i,o,s):b)){g=!1;break}m||(m="constructor"==d)}if(g&&!m){var x=n.constructor,E=r.constructor;x==E||!("constructor"in n)||!("constructor"in r)||"function"==typeof x&&x instanceof x&&"function"==typeof E&&E instanceof E||(g=!1)}return s.delete(n),s.delete(r),g},fS}(),i=Lk(),o=fw(),a=Cw(),s=oM(),c="[object Arguments]",u="[object Array]",l="[object Object]",h=Object.prototype.hasOwnProperty;return gS=function(d,f,p,g,m,v){var y=o(d),b=o(f),x=y?u:i(d),E=b?u:i(f),w=(x=x==c?l:x)==l,M=(E=E==c?l:E)==l,N=x==E;if(N&&a(d)){if(!a(f))return!1;y=!0,w=!1}if(N&&!w)return v||(v=new t),y||s(d)?e(d,f,p,g,m,v):n(d,f,x,p,g,m,v);if(!(1&p)){var S=w&&h.call(d,"__wrapped__"),C=M&&h.call(f,"__wrapped__");if(S||C){var T=S?d.value():d,k=C?f.value():f;return v||(v=new t),m(T,k,p,g,v)}}return!!N&&(v||(v=new t),r(d,f,p,g,m,v))}}function sP(){if(yS)return vS;yS=1;var t=aP(),e=hw();return vS=function n(r,i,o,a,s){return r===i||(null==r||null==i||!e(r)&&!e(i)?r!=r&&i!=i:t(r,i,o,a,n,s))},vS}function cP(){if(wS)return ES;wS=1;var t=KE();return ES=function(e){return e==e&&!t(e)}}function uP(){if(CS)return SS;return CS=1,SS=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}}function lP(){if(kS)return TS;kS=1;var t=function(){if(xS)return bS;xS=1;var t=ow(),e=sP();return bS=function(n,r,i,o){var a=i.length,s=a,c=!o;if(null==n)return!s;for(n=Object(n);a--;){var u=i[a];if(c&&u[2]?u[1]!==n[u[0]]:!(u[0]in n))return!1}for(;++a<s;){var l=(u=i[a])[0],h=n[l],d=u[1];if(c&&u[2]){if(void 0===h&&!(l in n))return!1}else{var f=new t;if(o)var p=o(h,d,l,n,r,f);if(!(void 0===p?e(d,h,3,o,f):p))return!1}}return!0},bS}(),e=function(){if(NS)return MS;NS=1;var t=cP(),e=hM();return MS=function(n){for(var r=e(n),i=r.length;i--;){var o=r[i],a=n[o];r[i]=[o,a,t(a)]}return r},MS}(),n=uP();return TS=function(r){var i=e(r);return 1==i.length&&i[0][2]?n(i[0][0],i[0][1]):function(e){return e===r||t(e,r,i)}}}function hP(){if(AS)return PS;AS=1;var t=YE(),e=hw();return PS=function(n){return"symbol"==typeof n||e(n)&&"[object Symbol]"==t(n)}}function dP(){if(_S)return OS;_S=1;var t=fw(),e=hP(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return OS=function(i,o){if(t(i))return!1;var a=typeof i;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=i&&!e(i))||(r.test(i)||!n.test(i)||null!=o&&i in Object(o))}}function fP(){if(LS)return IS;LS=1;var t=function(){if(DS)return RS;DS=1;var t=iw();function e(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var i=function(){var t=arguments,e=r?r.apply(this,t):t[0],o=i.cache;if(o.has(e))return o.get(e);var a=n.apply(this,t);return i.cache=o.set(e,a)||o,a};return i.cache=new(e.Cache||t),i}return e.Cache=t,RS=e}();return IS=function(e){var n=t(e,(function(t){return 500===r.size&&r.clear(),t})),r=n.cache;return n}}function pP(){if(FS)return BS;return FS=1,BS=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i},BS}function gP(){if(US)return WS;US=1;var t=function(){if(VS)return GS;VS=1;var t=$E(),e=pP(),n=fw(),r=hP(),i=t?t.prototype:void 0,o=i?i.toString:void 0;return GS=function t(i){if("string"==typeof i)return i;if(n(i))return e(i,t)+"";if(r(i))return o?o.call(i):"";var a=i+"";return"0"==a&&1/i==-1/0?"-0":a},GS}();return WS=function(e){return null==e?"":t(e)}}function mP(){if(qS)return HS;qS=1;var t=fw(),e=dP(),n=function(){if(zS)return jS;zS=1;var t=fP(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=t((function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(e,(function(t,e,i,o){r.push(i?o.replace(n,"$1"):e||t)})),r}));return jS=r}(),r=gP();return HS=function(i,o){return t(i)?i:e(i,o)?[i]:n(r(i))}}function vP(){if(YS)return $S;YS=1;var t=hP();return $S=function(e){if("string"==typeof e||t(e))return e;var n=e+"";return"0"==n&&1/e==-1/0?"-0":n}}function yP(){if(XS)return KS;XS=1;var t=mP(),e=vP();return KS=function(n,r){for(var i=0,o=(r=t(r,n)).length;null!=n&&i<o;)n=n[e(r[i++])];return i&&i==o?n:void 0},KS}function bP(){if(nC)return eC;nC=1;var t=mP(),e=dw(),n=fw(),r=Tw(),i=kw(),o=vP();return eC=function(a,s,c){for(var u=-1,l=(s=t(s,a)).length,h=!1;++u<l;){var d=o(s[u]);if(!(h=null!=a&&c(a,d)))break;a=a[d]}return h||++u!=l?h:!!(l=null==a?0:a.length)&&i(l)&&r(d,l)&&(n(a)||e(a))},eC}function xP(){if(iC)return rC;iC=1;var t=tC?JS:(tC=1,JS=function(t,e){return null!=t&&e in Object(t)}),e=bP();return rC=function(n,r){return null!=n&&e(n,r,t)}}function EP(){if(aC)return oC;aC=1;var t=sP(),e=function(){if(QS)return ZS;QS=1;var t=yP();return ZS=function(e,n,r){var i=null==e?void 0:t(e,n);return void 0===i?r:i}}(),n=xP(),r=dP(),i=cP(),o=uP(),a=vP();return oC=function(s,c){return r(s)&&i(c)?o(a(s),c):function(r){var i=e(r,s);return void 0===i&&i===c?n(r,s):t(c,i,3)}}}function wP(){if(cC)return sC;return cC=1,sC=function(t){return function(e){return null==e?void 0:e[t]}}}function MP(){if(dC)return hC;dC=1;var t=wP(),e=function(){if(lC)return uC;lC=1;var t=yP();return uC=function(e){return function(n){return t(n,e)}}}(),n=dP(),r=vP();return hC=function(i){return n(i)?t(r(i)):e(i)}}function NP(){if(pC)return fC;pC=1;var t=lP(),e=EP(),n=Zk(),r=fw(),i=MP();return fC=function(o){return"function"==typeof o?o:null==o?n:"object"==typeof o?r(o)?e(o[0],o[1]):t(o):i(o)}}function SP(){if(mC)return gC;mC=1;var t=Tk(),e=function(){if(YN)return $N;YN=1;var t=Xk();return $N=function(e,n){var r=[];return t(e,(function(t,e,i){n(t,e,i)&&r.push(t)})),r},$N}(),n=NP(),r=fw();return gC=function(i,o){return(r(i)?t:e)(i,n(o,3))}}function CP(){if(xC)return bC;xC=1;var t=function(){if(yC)return vC;yC=1;var t=Object.prototype.hasOwnProperty;return vC=function(e,n){return null!=e&&t.call(e,n)}}(),e=bP();return bC=function(n,r){return null!=n&&e(n,r,t)}}function TP(){if(wC)return EC;wC=1;var t=uM(),e=Lk(),n=dw(),r=fw(),i=lM(),o=Cw(),a=sM(),s=oM(),c=Object.prototype.hasOwnProperty;return EC=function(u){if(null==u)return!0;if(i(u)&&(r(u)||"string"==typeof u||"function"==typeof u.splice||o(u)||s(u)||n(u)))return!u.length;var l=e(u);if("[object Map]"==l||"[object Set]"==l)return!u.size;if(a(u))return!t(u).length;for(var h in u)if(c.call(u,h))return!1;return!0}}function kP(){if(NC)return MC;return NC=1,MC=function(t){return void 0===t}}function PP(){if(CC)return SC;CC=1;var t=Xk(),e=lM();return SC=function(n,r){var i=-1,o=e(n)?Array(n.length):[];return t(n,(function(t,e,n){o[++i]=r(t,e,n)})),o},SC}function AP(){if(kC)return TC;kC=1;var t=pP(),e=NP(),n=PP(),r=fw();return TC=function(i,o){return(r(i)?t:n)(i,e(o,3))}}function OP(){if(DC)return RC;DC=1;var t=(AC||(AC=1,PC=function(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}),PC),e=Xk(),n=NP(),r=(_C||(_C=1,OC=function(t,e,n,r,i){return i(t,(function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)})),n}),OC),i=fw();return RC=function(o,a,s){var c=i(o)?t:r,u=arguments.length<3;return c(o,n(a,4),s,u,e)},RC}function _P(){if(UC)return WC;UC=1;var t=function(){if(zC)return jC;zC=1;var t=wP()("length");return jC=t}(),e=function(){if(FC)return BC;FC=1;var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return BC=function(e){return t.test(e)}}(),n=function(){if(VC)return GC;VC=1;var t="\\ud800-\\udfff",e="["+t+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",i="[^"+t+"]",o="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",s="(?:"+n+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",u=c+s+"(?:\\u200d(?:"+[i,o,a].join("|")+")"+c+s+")*",l="(?:"+[i+n+"?",n,o,a,e].join("|")+")",h=RegExp(r+"(?="+r+")|"+l+u,"g");return GC=function(t){for(var e=h.lastIndex=0;h.test(t);)++e;return e}}();return WC=function(r){return e(r)?n(r):t(r)}}function RP(){if(qC)return HC;qC=1;var t=uM(),e=Lk(),n=lM(),r=function(){if(LC)return IC;LC=1;var t=YE(),e=fw(),n=hw();return IC=function(r){return"string"==typeof r||!e(r)&&n(r)&&"[object String]"==t(r)}}(),i=_P();return HC=function(o){if(null==o)return 0;if(n(o))return r(o)?i(o):o.length;var a=e(o);return"[object Map]"==a||"[object Set]"==a?o.size:t(o).length}}function DP(){if(YC)return $C;YC=1;var t=aw(),e=Gk(),n=Kk(),r=NP(),i=Ok(),o=fw(),a=Cw(),s=XE(),c=KE(),u=oM();return $C=function(l,h,d){var f=o(l),p=f||a(l)||u(l);if(h=r(h,4),null==d){var g=l&&l.constructor;d=p?f?new g:[]:c(l)&&s(g)?e(i(l)):{}}return(p?t:n)(l,(function(t,e,n){return h(d,t,e,n)})),d},$C}function IP(){if(QC)return ZC;QC=1;var t=Ak(),e=function(){if(XC)return KC;XC=1;var t=$E(),e=dw(),n=fw(),r=t?t.isConcatSpreadable:void 0;return KC=function(t){return n(t)||e(t)||!!(r&&t&&t[r])}}();return ZC=function n(r,i,o,a,s){var c=-1,u=r.length;for(o||(o=e),s||(s=[]);++c<u;){var l=r[c];i>0&&o(l)?i>1?n(l,i-1,o,a,s):t(s,l):a||(s[s.length]=l)}return s},ZC}function LP(){if(nT)return eT;nT=1;var t=tT?JC:(tT=1,JC=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}),e=Math.max;return eT=function(n,r,i){return r=e(void 0===r?n.length-1:r,0),function(){for(var o=arguments,a=-1,s=e(o.length-r,0),c=Array(s);++a<s;)c[a]=o[r+a];a=-1;for(var u=Array(r+1);++a<r;)u[a]=o[a];return u[r]=i(c),t(n,this,u)}},eT}function jP(){if(cT)return sT;cT=1;var t=function(){if(iT)return rT;iT=1;var t=$k(),e=sw(),n=Zk();return rT=e?function(n,r){return e(n,"toString",{configurable:!0,enumerable:!1,value:t(r),writable:!0})}:n}(),e=function(){if(aT)return oT;aT=1;var t=Date.now;return oT=function(e){var n=0,r=0;return function(){var i=t(),o=16-(i-r);if(r=i,o>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}},oT}(),n=e(t);return sT=n}function zP(){if(lT)return uT;lT=1;var t=Zk(),e=LP(),n=jP();return uT=function(r,i){return n(e(r,i,t),r+"")}}function BP(){if(dT)return hT;return dT=1,hT=function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1},hT}function FP(){if(yT)return vT;yT=1;var t=BP(),e=pT?fT:(pT=1,fT=function(t){return t!=t}),n=(mT||(mT=1,gT=function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}),gT);return vT=function(r,i,o){return i==i?n(r,i,o):t(r,e,o)}}function GP(){if(CT)return ST;CT=1;var t=Ik(),e=NT?MT:(NT=1,MT=function(){}),n=iP(),r=t&&1/n(new t([,-0]))[1]==1/0?function(e){return new t(e)}:e;return ST=r}function VP(){if(kT)return TT;kT=1;var t=eP(),e=function(){if(xT)return bT;xT=1;var t=FP();return bT=function(e,n){return!(null==e||!e.length)&&t(e,n,0)>-1}}(),n=(wT||(wT=1,ET=function(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}),ET),r=nP(),i=GP(),o=iP();return TT=function(a,s,c){var u=-1,l=e,h=a.length,d=!0,f=[],p=f;if(c)d=!1,l=n;else if(h>=200){var g=s?null:i(a);if(g)return o(g);d=!1,l=r,p=new t}else p=s?[]:f;t:for(;++u<h;){var m=a[u],v=s?s(m):m;if(m=c||0!==m?m:0,d&&v==v){for(var y=p.length;y--;)if(p[y]===v)continue t;s&&p.push(v),f.push(m)}else l(p,v,c)||(p!==f&&p.push(v),f.push(m))}return f},TT}function WP(){if(AT)return PT;AT=1;var t=lM(),e=hw();return PT=function(n){return e(n)&&t(n)}}function UP(){if(_T)return OT;_T=1;var t=IP(),e=zP(),n=VP(),r=WP(),i=e((function(e){return n(t(e,1,r,!0))}));return OT=i}function HP(){if(LT)return IT;LT=1;var t=function(){if(DT)return RT;DT=1;var t=pP();return RT=function(e,n){return t(n,(function(t){return e[t]}))}}(),e=hM();return IT=function(n){return null==n?[]:t(n,e(n))}}function qP(){if(zT)return jT;var t;zT=1;try{t={clone:qk(),constant:$k(),each:tP(),filter:SP(),has:CP(),isArray:fw(),isEmpty:TP(),isFunction:XE(),isUndefined:kP(),keys:hM(),map:AP(),reduce:OP(),size:RP(),transform:DP(),union:UP(),values:HP()}}catch(t){}return t||(t=window._),jT=t}function $P(){if(FT)return BT;FT=1;var t=qP();BT=i;var e="\0",n="\0",r="";function i(e){this._isDirected=!t.has(e,"directed")||e.directed,this._isMultigraph=!!t.has(e,"multigraph")&&e.multigraph,this._isCompound=!!t.has(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=t.constant(void 0),this._defaultEdgeLabelFn=t.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function o(t,e){t[e]?t[e]++:t[e]=1}function a(t,e){--t[e]||delete t[e]}function s(n,i,o,a){var s=""+i,c=""+o;if(!n&&s>c){var u=s;s=c,c=u}return s+r+c+r+(t.isUndefined(a)?e:a)}function c(t,e){return s(t,e.v,e.w,e.name)}return i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(t){return this._label=t,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(e){return t.isFunction(e)||(e=t.constant(e)),this._defaultNodeLabelFn=e,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return t.keys(this._nodes)},i.prototype.sources=function(){var e=this;return t.filter(this.nodes(),(function(n){return t.isEmpty(e._in[n])}))},i.prototype.sinks=function(){var e=this;return t.filter(this.nodes(),(function(n){return t.isEmpty(e._out[n])}))},i.prototype.setNodes=function(e,n){var r=arguments,i=this;return t.each(e,(function(t){r.length>1?i.setNode(t,n):i.setNode(t)})),this},i.prototype.setNode=function(e,r){return t.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=r),this):(this._nodes[e]=arguments.length>1?r:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=n,this._children[e]={},this._children[n][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},i.prototype.node=function(t){return this._nodes[t]},i.prototype.hasNode=function(e){return t.has(this._nodes,e)},i.prototype.removeNode=function(e){var n=this;if(t.has(this._nodes,e)){var r=function(t){n.removeEdge(n._edgeObjs[t])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],t.each(this.children(e),(function(t){n.setParent(t)})),delete this._children[e]),t.each(t.keys(this._in[e]),r),delete this._in[e],delete this._preds[e],t.each(t.keys(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},i.prototype.setParent=function(e,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(r))r=n;else{for(var i=r+="";!t.isUndefined(i);i=this.parent(i))if(i===e)throw new Error("Setting "+r+" as parent of "+e+" would create a cycle");this.setNode(r)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=r,this._children[r][e]=!0,this},i.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},i.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==n)return e}},i.prototype.children=function(e){if(t.isUndefined(e)&&(e=n),this._isCompound){var r=this._children[e];if(r)return t.keys(r)}else{if(e===n)return this.nodes();if(this.hasNode(e))return[]}},i.prototype.predecessors=function(e){var n=this._preds[e];if(n)return t.keys(n)},i.prototype.successors=function(e){var n=this._sucs[e];if(n)return t.keys(n)},i.prototype.neighbors=function(e){var n=this.predecessors(e);if(n)return t.union(n,this.successors(e))},i.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},i.prototype.filterNodes=function(e){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;t.each(this._nodes,(function(t,r){e(r)&&n.setNode(r,t)})),t.each(this._edgeObjs,(function(t){n.hasNode(t.v)&&n.hasNode(t.w)&&n.setEdge(t,r.edge(t))}));var i={};function o(t){var e=r.parent(t);return void 0===e||n.hasNode(e)?(i[t]=e,e):e in i?i[e]:o(e)}return this._isCompound&&t.each(n.nodes(),(function(t){n.setParent(t,o(t))})),n},i.prototype.setDefaultEdgeLabel=function(e){return t.isFunction(e)||(e=t.constant(e)),this._defaultEdgeLabelFn=e,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return t.values(this._edgeObjs)},i.prototype.setPath=function(e,n){var r=this,i=arguments;return t.reduce(e,(function(t,e){return i.length>1?r.setEdge(t,e,n):r.setEdge(t,e),e})),this},i.prototype.setEdge=function(){var e,n,r,i,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(e=c.v,n=c.w,r=c.name,2===arguments.length&&(i=arguments[1],a=!0)):(e=c,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,n=""+n,t.isUndefined(r)||(r=""+r);var u=s(this._isDirected,e,n,r);if(t.has(this._edgeLabels,u))return a&&(this._edgeLabels[u]=i),this;if(!t.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[u]=a?i:this._defaultEdgeLabelFn(e,n,r);var l=function(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,e,n,r);return e=l.v,n=l.w,Object.freeze(l),this._edgeObjs[u]=l,o(this._preds[n],e),o(this._sucs[e],n),this._in[n][u]=l,this._out[e][u]=l,this._edgeCount++,this},i.prototype.edge=function(t,e,n){var r=1===arguments.length?c(this._isDirected,arguments[0]):s(this._isDirected,t,e,n);return this._edgeLabels[r]},i.prototype.hasEdge=function(e,n,r){var i=1===arguments.length?c(this._isDirected,arguments[0]):s(this._isDirected,e,n,r);return t.has(this._edgeLabels,i)},i.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?c(this._isDirected,arguments[0]):s(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[e],t),a(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},i.prototype.inEdges=function(e,n){var r=this._in[e];if(r){var i=t.values(r);return n?t.filter(i,(function(t){return t.v===n})):i}},i.prototype.outEdges=function(e,n){var r=this._out[e];if(r){var i=t.values(r);return n?t.filter(i,(function(t){return t.w===n})):i}},i.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))},BT}function YP(){return UT?WT:(UT=1,WT={Graph:$P(),version:VT?GT:(VT=1,GT="2.1.8")})}function KP(){if(qT)return HT;qT=1;var t=qP(),e=$P();function n(e){return t.map(e.nodes(),(function(n){var r=e.node(n),i=e.parent(n),o={v:n};return t.isUndefined(r)||(o.value=r),t.isUndefined(i)||(o.parent=i),o}))}function r(e){return t.map(e.edges(),(function(n){var r=e.edge(n),i={v:n.v,w:n.w};return t.isUndefined(n.name)||(i.name=n.name),t.isUndefined(r)||(i.value=r),i}))}return HT={write:function(e){var i={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:n(e),edges:r(e)};t.isUndefined(e.graph())||(i.value=t.clone(e.graph()));return i},read:function(n){var r=new e(n.options).setGraph(n.value);return t.each(n.nodes,(function(t){r.setNode(t.v,t.value),t.parent&&r.setParent(t.v,t.parent)})),t.each(n.edges,(function(t){r.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),r}}}function XP(){if(YT)return $T;YT=1;var t=qP();return $T=function(e){var n,r={},i=[];function o(i){t.has(r,i)||(r[i]=!0,n.push(i),t.each(e.successors(i),o),t.each(e.predecessors(i),o))}return t.each(e.nodes(),(function(t){n=[],o(t),n.length&&i.push(n)})),i},$T}function ZP(){if(XT)return KT;XT=1;var t=qP();function e(){this._arr=[],this._keyIndices={}}return KT=e,e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},e.prototype.has=function(e){return t.has(this._keyIndices,e)},e.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},e.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(e,n){var r=this._keyIndices;if(e=String(e),!t.has(r,e)){var i=this._arr,o=i.length;return r[e]=o,i.push({key:e,priority:n}),this._decrease(o),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},e.prototype.decrease=function(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},e.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))},e.prototype._decrease=function(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e},e.prototype._swap=function(t,e){var n=this._arr,r=this._keyIndices,i=n[t],o=n[e];n[t]=o,n[e]=i,r[o.key]=t,r[i.key]=e},KT}function QP(){if(QT)return ZT;QT=1;var t=qP(),e=ZP();ZT=function(t,r,i,o){return function(t,n,r,i){var o,a,s={},c=new e,u=function(t){var e=t.v!==o?t.v:t.w,n=s[e],i=r(t),u=a.distance+i;if(i<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+i);u<n.distance&&(n.distance=u,n.predecessor=o,c.decrease(e,u))};t.nodes().forEach((function(t){var e=t===n?0:Number.POSITIVE_INFINITY;s[t]={distance:e},c.add(t,e)}));for(;c.size()>0&&(o=c.removeMin(),(a=s[o]).distance!==Number.POSITIVE_INFINITY);)i(o).forEach(u);return s}(t,String(r),i||n,o||function(e){return t.outEdges(e)})};var n=t.constant(1);return ZT}function JP(){if(tk)return JT;tk=1;var t=QP(),e=qP();return JT=function(n,r,i){return e.transform(n.nodes(),(function(e,o){e[o]=t(n,o,r,i)}),{})}}function tA(){if(nk)return ek;nk=1;var t=qP();return ek=function(e){var n=0,r=[],i={},o=[];function a(s){var c=i[s]={onStack:!0,lowlink:n,index:n++};if(r.push(s),e.successors(s).forEach((function(e){t.has(i,e)?i[e].onStack&&(c.lowlink=Math.min(c.lowlink,i[e].index)):(a(e),c.lowlink=Math.min(c.lowlink,i[e].lowlink))})),c.lowlink===c.index){var u,l=[];do{u=r.pop(),i[u].onStack=!1,l.push(u)}while(s!==u);o.push(l)}}return e.nodes().forEach((function(e){t.has(i,e)||a(e)})),o},ek}function eA(){if(ik)return rk;ik=1;var t=qP(),e=tA();return rk=function(n){return t.filter(e(n),(function(t){return t.length>1||1===t.length&&n.hasEdge(t[0],t[0])}))}}function nA(){if(ak)return ok;ak=1;var t=qP();ok=function(t,n,r){return function(t,e,n){var r={},i=t.nodes();return i.forEach((function(t){r[t]={},r[t][t]={distance:0},i.forEach((function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})})),n(t).forEach((function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}}))})),i.forEach((function(t){var e=r[t];i.forEach((function(n){var o=r[n];i.forEach((function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s<a.distance&&(a.distance=s,a.predecessor=i.predecessor)}))}))})),r}(t,n||e,r||function(e){return t.outEdges(e)})};var e=t.constant(1);return ok}function rA(){if(ck)return sk;ck=1;var t=qP();function e(e){var r={},i={},o=[];if(t.each(e.sinks(),(function a(s){if(t.has(i,s))throw new n;t.has(r,s)||(i[s]=!0,r[s]=!0,t.each(e.predecessors(s),a),delete i[s],o.push(s))})),t.size(r)!==e.nodeCount())throw new n;return o}function n(){}return sk=e,e.CycleException=n,n.prototype=new Error,sk}function iA(){if(lk)return uk;lk=1;var t=rA();return uk=function(e){try{t(e)}catch(e){if(e instanceof t.CycleException)return!1;throw e}return!0}}function oA(){if(dk)return hk;dk=1;var t=qP();function e(n,r,i,o,a,s){t.has(o,r)||(o[r]=!0,i||s.push(r),t.each(a(r),(function(t){e(n,t,i,o,a,s)})),i&&s.push(r))}return hk=function(n,r,i){t.isArray(r)||(r=[r]);var o=(n.isDirected()?n.successors:n.neighbors).bind(n),a=[],s={};return t.each(r,(function(t){if(!n.hasNode(t))throw new Error("Graph does not have node: "+t);e(n,t,"post"===i,s,o,a)})),a},hk}function aA(){if(pk)return fk;pk=1;var t=oA();return fk=function(e,n){return t(e,n,"post")}}function sA(){if(mk)return gk;mk=1;var t=oA();return gk=function(e,n){return t(e,n,"pre")}}function cA(){if(yk)return vk;yk=1;var t=qP(),e=$P(),n=ZP();return vk=function(r,i){var o,a=new e,s={},c=new n;function u(t){var e=t.v===o?t.w:t.v,n=c.priority(e);if(void 0!==n){var r=i(t);r<n&&(s[e]=o,c.decrease(e,r))}}if(0===r.nodeCount())return a;t.each(r.nodes(),(function(t){c.add(t,Number.POSITIVE_INFINITY),a.setNode(t)})),c.decrease(r.nodes()[0],0);var l=!1;for(;c.size()>0;){if(o=c.removeMin(),t.has(s,o))a.setEdge(o,s[o]);else{if(l)throw new Error("Input graph is not connected: "+r);l=!0}r.nodeEdges(o).forEach(u)}return a}}Nk.exports;try{Mk=function(){if(wk)return Ek;wk=1;var t=YP();return Ek={Graph:t.Graph,json:KP(),alg:xk?bk:(xk=1,bk={components:XP(),dijkstra:QP(),dijkstraAll:JP(),findCycles:eA(),floydWarshall:nA(),isAcyclic:iA(),postorder:aA(),preorder:sA(),prim:cA(),tarjan:tA(),topsort:rA()}),version:t.version}}()}catch(t){}Mk||(Mk=window.graphlib);var uA,lA,hA,dA,fA,pA,gA,mA,vA,yA,bA,xA,EA,wA,MA,NA,SA,CA,TA,kA,PA,AA,OA,_A,RA,DA,IA,LA,jA,zA,BA,FA,GA,VA,WA,UA,HA,qA,$A,YA,KA,XA,ZA,QA,JA,tO,eO,nO,rO,iO,oO,aO,sO,cO,uO,lO,hO,dO,fO,pO,gO,mO,vO,yO,bO,xO,EO,wO,MO,NO,SO,CO,TO,kO,PO,AO,OO,_O,RO,DO,IO,LO,jO,zO,BO,FO,GO,VO,WO,UO,HO,qO,$O,YO=Mk;function KO(){if(dA)return hA;dA=1;var t=VE(),e=lM(),n=Tw(),r=KE();return hA=function(i,o,a){if(!r(a))return!1;var s=typeof o;return!!("number"==s?e(a)&&n(o,a.length):"string"==s&&o in a)&&t(a[o],i)},hA}function XO(){if(xA)return bA;xA=1;var t=function(){if(yA)return vA;yA=1;var t=/\s/;return vA=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n},vA}(),e=/^\s+/;return bA=function(n){return n?n.slice(0,t(n)+1).replace(e,""):n}}function ZO(){if(NA)return MA;NA=1;var t=function(){if(wA)return EA;wA=1;var t=XO(),e=KE(),n=hP(),r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;return EA=function(s){if("number"==typeof s)return s;if(n(s))return NaN;if(e(s)){var c="function"==typeof s.valueOf?s.valueOf():s;s=e(c)?c+"":c}if("string"!=typeof s)return 0===s?s:+s;s=t(s);var u=i.test(s);return u||o.test(s)?a(s.slice(2),u?2:8):r.test(s)?NaN:+s}}(),e=1/0;return MA=function(n){return n?(n=t(n))===e||n===-1/0?17976931348623157e292*(n<0?-1:1):n==n?n:0:0===n?n:0}}function QO(){if(kA)return TA;kA=1;var t=BP(),e=NP(),n=function(){if(CA)return SA;CA=1;var t=ZO();return SA=function(e){var n=t(e),r=n%1;return n==n?r?n-r:n:0}}(),r=Math.max;return TA=function(i,o,a){var s=null==i?0:i.length;if(!s)return-1;var c=null==a?0:n(a);return c<0&&(c=r(s+c,0)),t(i,e(o,3),c)},TA}function JO(){if(_A)return OA;_A=1;var t=IP();return OA=function(e){return(null==e?0:e.length)?t(e,1):[]}}function t_(){if(FA)return BA;FA=1;var t=hP();return BA=function(e,n,r){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=n(a);if(null!=s&&(void 0===c?s==s&&!t(s):r(s,c)))var c=s,u=a}return u},BA}function e_(){if(qA)return HA;qA=1;var t=cw(),e=VE();return HA=function(n,r,i){(void 0!==i&&!e(n[r],i)||void 0===i&&!(r in n))&&t(n,r,i)}}function n_(){if(XA)return KA;return XA=1,KA=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}}function r_(){if(tO)return JA;tO=1;var t=e_(),e=Sk(),n=Bk(),r=Ck(),i=Vk(),o=dw(),a=fw(),s=WP(),c=Cw(),u=XE(),l=KE(),h=function(){if(YA)return $A;YA=1;var t=YE(),e=Ok(),n=hw(),r=Function.prototype,i=Object.prototype,o=r.toString,a=i.hasOwnProperty,s=o.call(Object);return $A=function(r){if(!n(r)||"[object Object]"!=t(r))return!1;var i=e(r);if(null===i)return!0;var c=a.call(i,"constructor")&&i.constructor;return"function"==typeof c&&c instanceof c&&o.call(c)==s}}(),d=oM(),f=n_(),p=function(){if(QA)return ZA;QA=1;var t=lw(),e=fM();return ZA=function(n){return t(n,e(n))}}();return JA=function(g,m,v,y,b,x,E){var w=f(g,v),M=f(m,v),N=E.get(M);if(N)t(g,v,N);else{var S=x?x(w,M,v+"",g,m,E):void 0,C=void 0===S;if(C){var T=a(M),k=!T&&c(M),P=!T&&!k&&d(M);S=M,T||k||P?a(w)?S=w:s(w)?S=r(w):k?(C=!1,S=e(M,!0)):P?(C=!1,S=n(M,!0)):S=[]:h(M)||o(M)?(S=w,o(w)?S=p(w):l(w)&&!u(w)||(S=i(M))):C=!1}C&&(E.set(M,S),b(S,M,y,x,E),E.delete(M)),t(g,v,S)}}}function i_(){if(cO)return sO;return cO=1,sO=function(t,e){return t<e}}function o_(){if(yO)return vO;yO=1;var t=yP(),e=function(){if(mO)return gO;mO=1;var t=uw(),e=mP(),n=Tw(),r=KE(),i=vP();return gO=function(o,a,s,c){if(!r(o))return o;for(var u=-1,l=(a=e(a,o)).length,h=l-1,d=o;null!=d&&++u<l;){var f=i(a[u]),p=s;if("__proto__"===f||"constructor"===f||"prototype"===f)return o;if(u!=h){var g=d[f];void 0===(p=c?c(g,f,d):void 0)&&(p=r(g)?g:n(a[u+1])?[]:{})}t(d,f,p),d=d[f]}return o},gO}(),n=mP();return vO=function(r,i,o){for(var a=-1,s=i.length,c={};++a<s;){var u=i[a],l=t(r,u);o(l,u)&&e(c,n(u,r),l)}return c},vO}function a_(){if(kO)return TO;kO=1;var t=function(){if(CO)return SO;CO=1;var t=Math.ceil,e=Math.max;return SO=function(n,r,i,o){for(var a=-1,s=e(t((r-n)/(i||1)),0),c=Array(s);s--;)c[o?s:++a]=n,n+=i;return c},SO}(),e=KO(),n=ZO();return TO=function(r){return function(i,o,a){return a&&"number"!=typeof a&&e(i,o,a)&&(o=a=void 0),i=n(i),void 0===o?(o=i,i=0):o=n(o),a=void 0===a?i<o?1:-1:n(a),t(i,o,a,r)}},TO}function s_(){if(LO)return IO;LO=1;var t=function(){if(DO)return RO;DO=1;var t=hP();return RO=function(e,n){if(e!==n){var r=void 0!==e,i=null===e,o=e==e,a=t(e),s=void 0!==n,c=null===n,u=n==n,l=t(n);if(!c&&!l&&!a&&e>n||a&&s&&u&&!c&&!l||i&&s&&u||!r&&u||!o)return 1;if(!i&&!a&&!l&&e<n||l&&r&&o&&!i&&!a||c&&r&&o||!s&&o||!u)return-1}return 0}}();return IO=function(e,n,r){for(var i=-1,o=e.criteria,a=n.criteria,s=o.length,c=r.length;++i<s;){var u=t(o[i],a[i]);if(u)return i>=c?u:u*("desc"==r[i]?-1:1)}return e.index-n.index},IO}function c_(){if(zO)return jO;zO=1;var t=pP(),e=yP(),n=NP(),r=PP(),i=(_O||(_O=1,OO=function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}),OO),o=Pw(),a=s_(),s=Zk(),c=fw();return jO=function(u,l,h){l=l.length?t(l,(function(t){return c(t)?function(n){return e(n,1===t.length?t[0]:t)}:t})):[s];var d=-1;l=t(l,o(n));var f=r(u,(function(e,n,r){return{criteria:t(l,(function(t){return t(e)})),index:++d,value:e}}));return i(f,(function(t,e){return a(t,e,h)}))},jO}try{$O={cloneDeep:function(){if(lA)return uA;lA=1;var t=Hk();return uA=function(e){return t(e,5)}}(),constant:$k(),defaults:function(){if(pA)return fA;pA=1;var t=zP(),e=VE(),n=KO(),r=fM(),i=Object.prototype,o=i.hasOwnProperty,a=t((function(t,a){t=Object(t);var s=-1,c=a.length,u=c>2?a[2]:void 0;for(u&&n(a[0],a[1],u)&&(c=1);++s<c;)for(var l=a[s],h=r(l),d=-1,f=h.length;++d<f;){var p=h[d],g=t[p];(void 0===g||e(g,i[p])&&!o.call(t,p))&&(t[p]=l[p])}return t}));return fA=a}(),each:tP(),filter:SP(),find:function(){if(AA)return PA;AA=1;var t=function(){if(mA)return gA;mA=1;var t=NP(),e=lM(),n=hM();return gA=function(r){return function(i,o,a){var s=Object(i);if(!e(i)){var c=t(o,3);i=n(i),o=function(t){return c(s[t],t,s)}}var u=r(i,o,a);return u>-1?s[c?i[u]:u]:void 0}},gA}(),e=t(QO());return PA=e}(),flatten:JO(),forEach:Jk(),forIn:function(){if(DA)return RA;DA=1;var t=Yk(),e=Qk(),n=fM();return RA=function(r,i){return null==r?r:t(r,e(i),n)}}(),has:CP(),isUndefined:kP(),last:(LA||(LA=1,IA=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}),IA),map:AP(),mapValues:function(){if(zA)return jA;zA=1;var t=cw(),e=Kk(),n=NP();return jA=function(r,i){var o={};return i=n(i,3),e(r,(function(e,n,r){t(o,n,i(e,n,r))})),o}}(),max:function(){if(UA)return WA;UA=1;var t=t_(),e=VA?GA:(VA=1,GA=function(t,e){return t>e}),n=Zk();return WA=function(r){return r&&r.length?t(r,n,e):void 0}}(),merge:function(){if(aO)return oO;aO=1;var t=function(){if(nO)return eO;nO=1;var t=ow(),e=e_(),n=Yk(),r=r_(),i=KE(),o=fM(),a=n_();return eO=function s(c,u,l,h,d){c!==u&&n(u,(function(n,o){if(d||(d=new t),i(n))r(c,u,o,l,s,h,d);else{var f=h?h(a(c,o),n,o+"",c,u,d):void 0;void 0===f&&(f=n),e(c,o,f)}}),o)},eO}(),e=function(){if(iO)return rO;iO=1;var t=zP(),e=KO();return rO=function(n){return t((function(t,r){var i=-1,o=r.length,a=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(a=n.length>3&&"function"==typeof a?(o--,a):void 0,s&&e(r[0],r[1],s)&&(a=o<3?void 0:a,o=1),t=Object(t);++i<o;){var c=r[i];c&&n(t,c,i,a)}return t}))},rO}(),n=e((function(e,n,r){t(e,n,r)}));return oO=n}(),min:function(){if(lO)return uO;lO=1;var t=t_(),e=i_(),n=Zk();return uO=function(r){return r&&r.length?t(r,n,e):void 0}}(),minBy:function(){if(dO)return hO;dO=1;var t=t_(),e=NP(),n=i_();return hO=function(r,i){return r&&r.length?t(r,e(i,2),n):void 0}}(),now:function(){if(pO)return fO;pO=1;var t=qE();return fO=function(){return t.Date.now()}}(),pick:function(){if(NO)return MO;NO=1;var t=function(){if(xO)return bO;xO=1;var t=o_(),e=xP();return bO=function(n,r){return t(n,r,(function(t,r){return e(n,r)}))}}(),e=function(){if(wO)return EO;wO=1;var t=JO(),e=LP(),n=jP();return EO=function(r){return n(e(r,void 0,t),r+"")}}(),n=e((function(e,n){return null==e?{}:t(e,n)}));return MO=n}(),range:function(){if(AO)return PO;AO=1;var t=a_()();return PO=t}(),reduce:OP(),sortBy:function(){if(FO)return BO;FO=1;var t=IP(),e=c_(),n=zP(),r=KO(),i=n((function(n,i){if(null==n)return[];var o=i.length;return o>1&&r(n,i[0],i[1])?i=[]:o>2&&r(i[0],i[1],i[2])&&(i=[i[0]]),e(n,t(i,1),[])}));return BO=i}(),uniqueId:function(){if(VO)return GO;VO=1;var t=gP(),e=0;return GO=function(n){var r=++e;return t(n)+r},GO}(),values:HP(),zipObject:function(){if(qO)return HO;qO=1;var t=uw(),e=(UO||(UO=1,WO=function(t,e,n){for(var r=-1,i=t.length,o=e.length,a={};++r<i;){var s=r<o?e[r]:void 0;n(a,t[r],s)}return a}),WO);return HO=function(n,r){return e(n||[],r||[],t)},HO}()}}catch(t){}$O||($O=window._);var u_=$O,l_=h_;function h_(){var t={};t._next=t._prev=t,this._sentinel=t}function d_(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function f_(t,e){if("_next"!==t&&"_prev"!==t)return e}h_.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return d_(e),e},h_.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&d_(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},h_.prototype.toString=function(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,f_)),n=n._prev;return"["+t.join(", ")+"]"};var p_=u_,g_=YO.Graph,m_=l_,v_=function(t,e){if(t.nodeCount()<=1)return[];var n=function(t,e){var n=new g_,r=0,i=0;p_.forEach(t.nodes(),(function(t){n.setNode(t,{v:t,in:0,out:0})})),p_.forEach(t.edges(),(function(t){var o=n.edge(t.v,t.w)||0,a=e(t),s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)}));var o=p_.range(i+r+3).map((function(){return new m_})),a=r+1;return p_.forEach(n.nodes(),(function(t){x_(o,a,n.node(t))})),{graph:n,buckets:o,zeroIdx:a}}(t,e||y_),r=function(t,e,n){var r,i=[],o=e[e.length-1],a=e[0];for(;t.nodeCount();){for(;r=a.dequeue();)b_(t,e,n,r);for(;r=o.dequeue();)b_(t,e,n,r);if(t.nodeCount())for(var s=e.length-2;s>0;--s)if(r=e[s].dequeue()){i=i.concat(b_(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return p_.flatten(p_.map(r,(function(e){return t.outEdges(e.v,e.w)})),!0)},y_=p_.constant(1);function b_(t,e,n,r,i){var o=i?[]:void 0;return p_.forEach(t.inEdges(r.v),(function(r){var a=t.edge(r),s=t.node(r.v);i&&o.push({v:r.v,w:r.w}),s.out-=a,x_(e,n,s)})),p_.forEach(t.outEdges(r.v),(function(r){var i=t.edge(r),o=r.w,a=t.node(o);a.in-=i,x_(e,n,a)})),t.removeNode(r.v),o}function x_(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}var E_=u_,w_=v_,M_={run:function(t){var e="greedy"===t.graph().acyclicer?w_(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},r={};function i(o){E_.has(r,o)||(r[o]=!0,n[o]=!0,E_.forEach(t.outEdges(o),(function(t){E_.has(n,t.w)?e.push(t):i(t.w)})),delete n[o])}return E_.forEach(t.nodes(),i),e}(t);E_.forEach(e,(function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,E_.uniqueId("rev"))}))},undo:function(t){E_.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}};var N_=u_,S_=YO.Graph,C_={addDummyNode:T_,simplify:function(t){var e=(new S_).setGraph(t.graph());return N_.forEach(t.nodes(),(function(n){e.setNode(n,t.node(n))})),N_.forEach(t.edges(),(function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e},asNonCompoundGraph:function(t){var e=new S_({multigraph:t.isMultigraph()}).setGraph(t.graph());return N_.forEach(t.nodes(),(function(n){t.children(n).length||e.setNode(n,t.node(n))})),N_.forEach(t.edges(),(function(n){e.setEdge(n,t.edge(n))})),e},successorWeights:function(t){var e=N_.map(t.nodes(),(function(e){var n={};return N_.forEach(t.outEdges(e),(function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight})),n}));return N_.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=N_.map(t.nodes(),(function(e){var n={};return N_.forEach(t.inEdges(e),(function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight})),n}));return N_.zipObject(t.nodes(),e)},intersectRect:function(t,e){var n,r,i=t.x,o=t.y,a=e.x-i,s=e.y-o,c=t.width/2,u=t.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*c>Math.abs(a)*u?(s<0&&(u=-u),n=u*a/s,r=u):(a<0&&(c=-c),n=c,r=c*s/a);return{x:i+n,y:o+r}},buildLayerMatrix:function(t){var e=N_.map(N_.range(k_(t)+1),(function(){return[]}));return N_.forEach(t.nodes(),(function(n){var r=t.node(n),i=r.rank;N_.isUndefined(i)||(e[i][r.order]=n)})),e},normalizeRanks:function(t){var e=N_.min(N_.map(t.nodes(),(function(e){return t.node(e).rank})));N_.forEach(t.nodes(),(function(n){var r=t.node(n);N_.has(r,"rank")&&(r.rank-=e)}))},removeEmptyRanks:function(t){var e=N_.min(N_.map(t.nodes(),(function(e){return t.node(e).rank}))),n=[];N_.forEach(t.nodes(),(function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)}));var r=0,i=t.graph().nodeRankFactor;N_.forEach(n,(function(e,n){N_.isUndefined(e)&&n%i!=0?--r:r&&N_.forEach(e,(function(e){t.node(e).rank+=r}))}))},addBorderNode:function(t,e,n,r){var i={width:0,height:0};arguments.length>=4&&(i.rank=n,i.order=r);return T_(t,"border",i,e)},maxRank:k_,partition:function(t,e){var n={lhs:[],rhs:[]};return N_.forEach(t,(function(t){e(t)?n.lhs.push(t):n.rhs.push(t)})),n},time:function(t,e){var n=N_.now();try{return e()}finally{console.log(t+" time: "+(N_.now()-n)+"ms")}},notime:function(t,e){return e()}};function T_(t,e,n,r){var i;do{i=N_.uniqueId(r)}while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i}function k_(t){return N_.max(N_.map(t.nodes(),(function(e){var n=t.node(e).rank;if(!N_.isUndefined(n))return n})))}var P_=u_,A_=C_,O_={run:function(t){t.graph().dummyChains=[],P_.forEach(t.edges(),(function(e){!function(t,e){var n,r,i,o=e.v,a=t.node(o).rank,s=e.w,c=t.node(s).rank,u=e.name,l=t.edge(e),h=l.labelRank;if(c===a+1)return;for(t.removeEdge(e),i=0,++a;a<c;++i,++a)l.points=[],r={width:0,height:0,edgeLabel:l,edgeObj:e,rank:a},n=A_.addDummyNode(t,"edge",r,"_d"),a===h&&(r.width=l.width,r.height=l.height,r.dummy="edge-label",r.labelpos=l.labelpos),t.setEdge(o,n,{weight:l.weight},u),0===i&&t.graph().dummyChains.push(n),o=n;t.setEdge(o,s,{weight:l.weight},u)}(t,e)}))},undo:function(t){P_.forEach(t.graph().dummyChains,(function(e){var n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)}))}};var __=u_,R_={longestPath:function(t){var e={};__.forEach(t.sources(),(function n(r){var i=t.node(r);if(__.has(e,r))return i.rank;e[r]=!0;var o=__.min(__.map(t.outEdges(r),(function(e){return n(e.w)-t.edge(e).minlen})));return o!==Number.POSITIVE_INFINITY&&null!=o||(o=0),i.rank=o}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}};var D_=u_,I_=YO.Graph,L_=R_.slack,j_=function(t){var e,n,r=new I_({directed:!1}),i=t.nodes()[0],o=t.nodeCount();r.setNode(i,{});for(;z_(r,t)<o;)e=B_(r,t),n=r.hasNode(e.v)?L_(t,e):-L_(t,e),F_(r,t,n);return r};function z_(t,e){return D_.forEach(t.nodes(),(function n(r){D_.forEach(e.nodeEdges(r),(function(i){var o=i.v,a=r===o?i.w:o;t.hasNode(a)||L_(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))}))})),t.nodeCount()}function B_(t,e){return D_.minBy(e.edges(),(function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return L_(e,n)}))}function F_(t,e,n){D_.forEach(t.nodes(),(function(t){e.node(t).rank+=n}))}var G_=u_,V_=j_,W_=R_.slack,U_=R_.longestPath,H_=YO.alg.preorder,q_=YO.alg.postorder,$_=C_.simplify,Y_=K_;function K_(t){t=$_(t),U_(t);var e,n=V_(t);for(Q_(n),X_(n,t);e=tR(n);)nR(n,t,e,eR(n,t,e))}function X_(t,e){var n=q_(t,t.nodes());n=n.slice(0,n.length-1),G_.forEach(n,(function(n){!function(t,e,n){var r=t.node(n),i=r.parent;t.edge(n,i).cutvalue=Z_(t,e,n)}(t,e,n)}))}function Z_(t,e,n){var r=t.node(n).parent,i=!0,o=e.edge(n,r),a=0;return o||(i=!1,o=e.edge(r,n)),a=o.weight,G_.forEach(e.nodeEdges(n),(function(o){var s,c,u=o.v===n,l=u?o.w:o.v;if(l!==r){var h=u===i,d=e.edge(o).weight;if(a+=h?d:-d,s=n,c=l,t.hasEdge(s,c)){var f=t.edge(n,l).cutvalue;a+=h?-f:f}}})),a}function Q_(t,e){arguments.length<2&&(e=t.nodes()[0]),J_(t,{},1,e)}function J_(t,e,n,r,i){var o=n,a=t.node(r);return e[r]=!0,G_.forEach(t.neighbors(r),(function(i){G_.has(e,i)||(n=J_(t,e,n,i,r))})),a.low=o,a.lim=n++,i?a.parent=i:delete a.parent,n}function tR(t){return G_.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function eR(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var o=t.node(r),a=t.node(i),s=o,c=!1;o.lim>a.lim&&(s=a,c=!0);var u=G_.filter(e.edges(),(function(e){return c===rR(t,t.node(e.v),s)&&c!==rR(t,t.node(e.w),s)}));return G_.minBy(u,(function(t){return W_(e,t)}))}function nR(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),Q_(t),X_(t,e),function(t,e){var n=G_.find(t.nodes(),(function(t){return!e.node(t).parent})),r=H_(t,n);r=r.slice(1),G_.forEach(r,(function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)}))}(t,e)}function rR(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}K_.initLowLimValues=Q_,K_.initCutValues=X_,K_.calcCutValue=Z_,K_.leaveEdge=tR,K_.enterEdge=eR,K_.exchangeEdges=nR;var iR=R_.longestPath,oR=j_,aR=Y_,sR=function(t){switch(t.graph().ranker){case"network-simplex":default:uR(t);break;case"tight-tree":!function(t){iR(t),oR(t)}(t);break;case"longest-path":cR(t)}};var cR=iR;function uR(t){aR(t)}var lR=u_,hR=function(t){var e=function(t){var e={},n=0;function r(i){var o=n;lR.forEach(t.children(i),r),e[i]={low:o,lim:n++}}return lR.forEach(t.children(),r),e}(t);lR.forEach(t.graph().dummyChains,(function(n){for(var r=t.node(n),i=r.edgeObj,o=function(t,e,n,r){var i,o,a=[],s=[],c=Math.min(e[n].low,e[r].low),u=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>c||u>e[i].lim));o=i,i=r;for(;(i=t.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}(t,e,i.v,i.w),a=o.path,s=o.lca,c=0,u=a[c],l=!0;n!==i.w;){if(r=t.node(n),l){for(;(u=a[c])!==s&&t.node(u).maxRank<r.rank;)c++;u===s&&(l=!1)}if(!l){for(;c<a.length-1&&t.node(u=a[c+1]).minRank<=r.rank;)c++;u=a[c]}t.setParent(n,u),n=t.successors(n)[0]}}))};var dR=u_,fR=C_,pR={run:function(t){var e=fR.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var o=t.children(r);o&&o.length&&dR.forEach(o,(function(t){n(t,i+1)})),e[r]=i}return dR.forEach(t.children(),(function(t){n(t,1)})),e}(t),r=dR.max(dR.values(n))-1,i=2*r+1;t.graph().nestingRoot=e,dR.forEach(t.edges(),(function(e){t.edge(e).minlen*=i}));var o=function(t){return dR.reduce(t.edges(),(function(e,n){return e+t.edge(n).weight}),0)}(t)+1;dR.forEach(t.children(),(function(a){gR(t,e,i,o,r,n,a)})),t.graph().nodeRankFactor=i},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,dR.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}};function gR(t,e,n,r,i,o,a){var s=t.children(a);if(s.length){var c=fR.addBorderNode(t,"_bt"),u=fR.addBorderNode(t,"_bb"),l=t.node(a);t.setParent(c,a),l.borderTop=c,t.setParent(u,a),l.borderBottom=u,dR.forEach(s,(function(s){gR(t,e,n,r,i,o,s);var l=t.node(s),h=l.borderTop?l.borderTop:s,d=l.borderBottom?l.borderBottom:s,f=l.borderTop?r:2*r,p=h!==d?1:i-o[a]+1;t.setEdge(c,h,{weight:f,minlen:p,nestingEdge:!0}),t.setEdge(d,u,{weight:f,minlen:p,nestingEdge:!0})})),t.parent(a)||t.setEdge(e,c,{weight:0,minlen:i+o[a]})}else a!==e&&t.setEdge(e,a,{weight:0,minlen:n})}var mR=u_,vR=C_,yR=function(t){mR.forEach(t.children(),(function e(n){var r=t.children(n),i=t.node(n);if(r.length&&mR.forEach(r,e),mR.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;++o)bR(t,"borderLeft","_bl",n,i,o),bR(t,"borderRight","_br",n,i,o)}}))};function bR(t,e,n,r,i,o){var a={width:0,height:0,rank:o,borderType:e},s=i[e][o-1],c=vR.addDummyNode(t,"border",a,n);i[e][o]=c,t.setParent(c,r),s&&t.setEdge(s,c,{weight:1})}var xR=u_,ER={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||wR(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){xR.forEach(t.nodes(),(function(e){NR(t.node(e))})),xR.forEach(t.edges(),(function(e){var n=t.edge(e);xR.forEach(n.points,NR),xR.has(n,"y")&&NR(n)}))}(t);"lr"!==e&&"rl"!==e||(!function(t){xR.forEach(t.nodes(),(function(e){SR(t.node(e))})),xR.forEach(t.edges(),(function(e){var n=t.edge(e);xR.forEach(n.points,SR),xR.has(n,"x")&&SR(n)}))}(t),wR(t))}};function wR(t){xR.forEach(t.nodes(),(function(e){MR(t.node(e))})),xR.forEach(t.edges(),(function(e){MR(t.edge(e))}))}function MR(t){var e=t.width;t.width=t.height,t.height=e}function NR(t){t.y=-t.y}function SR(t){var e=t.x;t.x=t.y,t.y=e}var CR=u_,TR=function(t){var e={},n=CR.filter(t.nodes(),(function(e){return!t.children(e).length})),r=CR.max(CR.map(n,(function(e){return t.node(e).rank}))),i=CR.map(CR.range(r+1),(function(){return[]}));function o(n){if(!CR.has(e,n)){e[n]=!0;var r=t.node(n);i[r.rank].push(n),CR.forEach(t.successors(n),o)}}var a=CR.sortBy(n,(function(e){return t.node(e).rank}));return CR.forEach(a,o),i};var kR=u_,PR=function(t,e){for(var n=0,r=1;r<e.length;++r)n+=AR(t,e[r-1],e[r]);return n};function AR(t,e,n){for(var r=kR.zipObject(n,kR.map(n,(function(t,e){return e}))),i=kR.flatten(kR.map(e,(function(e){return kR.sortBy(kR.map(t.outEdges(e),(function(e){return{pos:r[e.w],weight:t.edge(e).weight}})),"pos")})),!0),o=1;o<n.length;)o<<=1;var a=2*o-1;o-=1;var s=kR.map(new Array(a),(function(){return 0})),c=0;return kR.forEach(i.forEach((function(t){var e=t.pos+o;s[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=s[e+1]),s[e=e-1>>1]+=t.weight;c+=t.weight*n}))),c}var OR=u_;var _R=u_,RR=function(t,e){var n={};return _R.forEach(t,(function(t,e){var r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};_R.isUndefined(t.barycenter)||(r.barycenter=t.barycenter,r.weight=t.weight)})),_R.forEach(e.edges(),(function(t){var e=n[t.v],r=n[t.w];_R.isUndefined(e)||_R.isUndefined(r)||(r.indegree++,e.out.push(n[t.w]))})),function(t){var e=[];function n(t){return function(e){e.merged||(_R.isUndefined(e.barycenter)||_R.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&function(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return function(n){n.in.push(e),0==--n.indegree&&t.push(n)}}for(;t.length;){var i=t.pop();e.push(i),_R.forEach(i.in.reverse(),n(i)),_R.forEach(i.out,r(i))}return _R.map(_R.filter(e,(function(t){return!t.merged})),(function(t){return _R.pick(t,["vs","i","barycenter","weight"])}))}(_R.filter(n,(function(t){return!t.indegree})))};var DR=u_,IR=C_;function LR(t,e,n){for(var r;e.length&&(r=DR.last(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}var jR=u_,zR=function(t,e){return OR.map(e,(function(e){var n=t.inEdges(e);if(n.length){var r=OR.reduce(n,(function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}}))},BR=RR,FR=function(t,e){var n=IR.partition(t,(function(t){return DR.has(t,"barycenter")})),r=n.lhs,i=DR.sortBy(n.rhs,(function(t){return-t.i})),o=[],a=0,s=0,c=0;r.sort((u=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:u?e.i-t.i:t.i-e.i})),c=LR(o,i,c),DR.forEach(r,(function(t){c+=t.vs.length,o.push(t.vs),a+=t.barycenter*t.weight,s+=t.weight,c=LR(o,i,c)}));var u;var l={vs:DR.flatten(o,!0)};s&&(l.barycenter=a/s,l.weight=s);return l},GR=function t(e,n,r,i){var o=e.children(n),a=e.node(n),s=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,u={};s&&(o=jR.filter(o,(function(t){return t!==s&&t!==c})));var l=zR(e,o);jR.forEach(l,(function(n){if(e.children(n.v).length){var o=t(e,n.v,r,i);u[n.v]=o,jR.has(o,"barycenter")&&(a=n,s=o,jR.isUndefined(a.barycenter)?(a.barycenter=s.barycenter,a.weight=s.weight):(a.barycenter=(a.barycenter*a.weight+s.barycenter*s.weight)/(a.weight+s.weight),a.weight+=s.weight))}var a,s}));var h=BR(l,r);!function(t,e){jR.forEach(t,(function(t){t.vs=jR.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(h,u);var d=FR(h,i);if(s&&(d.vs=jR.flatten([s,d.vs,c],!0),e.predecessors(s).length)){var f=e.node(e.predecessors(s)[0]),p=e.node(e.predecessors(c)[0]);jR.has(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d};var VR=u_,WR=YO.Graph,UR=function(t,e,n){var r=function(t){var e;for(;t.hasNode(e=VR.uniqueId("_root")););return e}(t),i=new WR({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(e){return t.node(e)}));return VR.forEach(t.nodes(),(function(o){var a=t.node(o),s=t.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(i.setNode(o),i.setParent(o,s||r),VR.forEach(t[n](o),(function(e){var n=e.v===o?e.w:e.v,r=i.edge(n,o),a=VR.isUndefined(r)?0:r.weight;i.setEdge(n,o,{weight:t.edge(e).weight+a})})),VR.has(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))})),i};var HR=u_;var qR=u_,$R=TR,YR=PR,KR=GR,XR=UR,ZR=function(t,e,n){var r,i={};HR.forEach(n,(function(n){for(var o,a,s=t.parent(n);s;){if((o=t.parent(s))?(a=i[o],i[o]=s):(a=r,r=s),a&&a!==s)return void e.setEdge(a,s);s=o}}))},QR=YO.Graph,JR=C_,tD=function(t){var e=JR.maxRank(t),n=eD(t,qR.range(1,e+1),"inEdges"),r=eD(t,qR.range(e-1,-1,-1),"outEdges"),i=$R(t);rD(t,i);for(var o,a=Number.POSITIVE_INFINITY,s=0,c=0;c<4;++s,++c){nD(s%2?n:r,s%4>=2),i=JR.buildLayerMatrix(t);var u=YR(t,i);u<a&&(c=0,o=qR.cloneDeep(i),a=u)}rD(t,o)};function eD(t,e,n){return qR.map(e,(function(e){return XR(t,e,n)}))}function nD(t,e){var n=new QR;qR.forEach(t,(function(t){var r=t.graph().root,i=KR(t,r,n,e);qR.forEach(i.vs,(function(e,n){t.node(e).order=n})),ZR(t,n,i.vs)}))}function rD(t,e){qR.forEach(e,(function(e){qR.forEach(e,(function(e,n){t.node(e).order=n}))}))}var iD=u_,oD=YO.Graph,aD=C_,sD=function(t){var e,n=aD.buildLayerMatrix(t),r=iD.merge(cD(t,n),uD(t,n)),i={};iD.forEach(["u","d"],(function(o){e="u"===o?n:iD.values(n).reverse(),iD.forEach(["l","r"],(function(n){"r"===n&&(e=iD.map(e,(function(t){return iD.values(t).reverse()})));var a=("u"===o?t.predecessors:t.successors).bind(t),s=dD(t,e,r,a),c=fD(t,e,s.root,s.align,"r"===n);"r"===n&&(c=iD.mapValues(c,(function(t){return-t}))),i[o+n]=c}))}));var o=pD(t,i);return gD(i,o),mD(i,t.graph().align)};function cD(t,e){var n={};return iD.reduce(e,(function(e,r){var i=0,o=0,a=e.length,s=iD.last(r);return iD.forEach(r,(function(e,c){var u=function(t,e){if(t.node(e).dummy)return iD.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),l=u?t.node(u).order:a;(u||e===s)&&(iD.forEach(r.slice(o,c+1),(function(e){iD.forEach(t.predecessors(e),(function(r){var o=t.node(r),a=o.order;!(a<i||l<a)||o.dummy&&t.node(e).dummy||lD(n,r,e)}))})),o=c+1,i=l)})),r})),n}function uD(t,e){var n={};function r(e,r,i,o,a){var s;iD.forEach(iD.range(r,i),(function(r){s=e[r],t.node(s).dummy&&iD.forEach(t.predecessors(s),(function(e){var r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&lD(n,e,s)}))}))}return iD.reduce(e,(function(e,n){var i,o=-1,a=0;return iD.forEach(n,(function(s,c){if("border"===t.node(s).dummy){var u=t.predecessors(s);u.length&&(i=t.node(u[0]).order,r(n,a,c,o,i),a=c,o=i)}r(n,a,n.length,i,e.length)})),n})),n}function lD(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function hD(t,e,n){if(e>n){var r=e;e=n,n=r}return iD.has(t[e],n)}function dD(t,e,n,r){var i={},o={},a={};return iD.forEach(e,(function(t){iD.forEach(t,(function(t,e){i[t]=t,o[t]=t,a[t]=e}))})),iD.forEach(e,(function(t){var e=-1;iD.forEach(t,(function(t){var s=r(t);if(s.length){s=iD.sortBy(s,(function(t){return a[t]}));for(var c=(s.length-1)/2,u=Math.floor(c),l=Math.ceil(c);u<=l;++u){var h=s[u];o[t]===t&&e<a[h]&&!hD(n,t,h)&&(o[h]=t,o[t]=i[t]=i[h],e=a[h])}}}))})),{root:i,align:o}}function fD(t,e,n,r,i){var o={},a=function(t,e,n,r){var i=new oD,o=t.graph(),a=function(t,e,n){return function(r,i,o){var a,s=r.node(i),c=r.node(o),u=0;if(u+=s.width/2,iD.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2}if(a&&(u+=n?a:-a),a=0,u+=(s.dummy?e:t)/2,u+=(c.dummy?e:t)/2,u+=c.width/2,iD.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(u+=n?a:-a),a=0,u}}(o.nodesep,o.edgesep,r);return iD.forEach(e,(function(e){var r;iD.forEach(e,(function(e){var o=n[e];if(i.setNode(o),r){var s=n[r],c=i.edge(s,o);i.setEdge(s,o,Math.max(a(t,e,r),c||0))}r=e}))})),i}(t,e,n,i),s=i?"borderLeft":"borderRight";function c(t,e){for(var n=a.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}return c((function(t){o[t]=a.inEdges(t).reduce((function(t,e){return Math.max(t,o[e.v]+a.edge(e))}),0)}),a.predecessors.bind(a)),c((function(e){var n=a.outEdges(e).reduce((function(t,e){return Math.min(t,o[e.w]-a.edge(e))}),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==s&&(o[e]=Math.max(o[e],n))}),a.successors.bind(a)),iD.forEach(r,(function(t){o[t]=o[n[t]]})),o}function pD(t,e){return iD.minBy(iD.values(e),(function(e){var n=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return iD.forIn(e,(function(e,i){var o=function(t,e){return t.node(e).width}(t,i)/2;n=Math.max(e+o,n),r=Math.min(e-o,r)})),n-r}))}function gD(t,e){var n=iD.values(e),r=iD.min(n),i=iD.max(n);iD.forEach(["u","d"],(function(n){iD.forEach(["l","r"],(function(o){var a,s=n+o,c=t[s];if(c!==e){var u=iD.values(c);(a="l"===o?r-iD.min(u):i-iD.max(u))&&(t[s]=iD.mapValues(c,(function(t){return t+a})))}}))}))}function mD(t,e){return iD.mapValues(t.ul,(function(n,r){if(e)return t[e.toLowerCase()][r];var i=iD.sortBy(iD.map(t,r));return(i[1]+i[2])/2}))}var vD=u_,yD=C_,bD=sD,xD=function(t){(function(t){var e=yD.buildLayerMatrix(t),n=t.graph().ranksep,r=0;vD.forEach(e,(function(e){var i=vD.max(vD.map(e,(function(e){return t.node(e).height})));vD.forEach(e,(function(e){t.node(e).y=r+i/2})),r+=i+n}))})(t=yD.asNonCompoundGraph(t)),vD.forEach(bD(t),(function(e,n){t.node(n).x=e}))};var ED=u_,wD=M_,MD=O_,ND=sR,SD=C_.normalizeRanks,CD=hR,TD=C_.removeEmptyRanks,kD=pR,PD=yR,AD=ER,OD=tD,_D=xD,RD=C_,DD=YO.Graph,ID=function(t,e){var n=e&&e.debugTiming?RD.time:RD.notime;n("layout",(function(){var e=n(" buildLayoutGraph",(function(){return function(t){var e=new DD({multigraph:!0,compound:!0}),n=HD(t.graph());return e.setGraph(ED.merge({},jD,UD(n,LD),ED.pick(n,zD))),ED.forEach(t.nodes(),(function(n){var r=HD(t.node(n));e.setNode(n,ED.defaults(UD(r,BD),FD)),e.setParent(n,t.parent(n))})),ED.forEach(t.edges(),(function(n){var r=HD(t.edge(n));e.setEdge(n,ED.merge({},VD,UD(r,GD),ED.pick(r,WD)))})),e}(t)}));n(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,ED.forEach(t.edges(),(function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){ED.forEach(t.edges(),(function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){wD.run(t)})),e(" nestingGraph.run",(function(){kD.run(t)})),e(" rank",(function(){ND(RD.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){ED.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e:e};RD.addDummyNode(t,"edge-proxy",i,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){TD(t)})),e(" nestingGraph.cleanup",(function(){kD.cleanup(t)})),e(" normalizeRanks",(function(){SD(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;ED.forEach(t.nodes(),(function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=ED.max(e,r.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){ED.forEach(t.nodes(),(function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){MD.run(t)})),e(" parentDummyChains",(function(){CD(t)})),e(" addBorderSegments",(function(){PD(t)})),e(" order",(function(){OD(t)})),e(" insertSelfEdges",(function(){!function(t){var e=RD.buildLayerMatrix(t);ED.forEach(e,(function(e){var n=0;ED.forEach(e,(function(e,r){var i=t.node(e);i.order=r+n,ED.forEach(i.selfEdges,(function(e){RD.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){AD.adjust(t)})),e(" position",(function(){_D(t)})),e(" positionSelfEdges",(function(){!function(t){ED.forEach(t.nodes(),(function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){ED.forEach(t.nodes(),(function(e){if(t.children(e).length){var n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(ED.last(n.borderLeft)),a=t.node(ED.last(n.borderRight));n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}})),ED.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){MD.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){ED.forEach(t.edges(),(function(e){var n=t.edge(e);if(ED.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){AD.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=t.graph(),a=o.marginx||0,s=o.marginy||0;function c(t){var o=t.x,a=t.y,s=t.width,c=t.height;e=Math.min(e,o-s/2),n=Math.max(n,o+s/2),r=Math.min(r,a-c/2),i=Math.max(i,a+c/2)}ED.forEach(t.nodes(),(function(e){c(t.node(e))})),ED.forEach(t.edges(),(function(e){var n=t.edge(e);ED.has(n,"x")&&c(n)})),e-=a,r-=s,ED.forEach(t.nodes(),(function(n){var i=t.node(n);i.x-=e,i.y-=r})),ED.forEach(t.edges(),(function(n){var i=t.edge(n);ED.forEach(i.points,(function(t){t.x-=e,t.y-=r})),ED.has(i,"x")&&(i.x-=e),ED.has(i,"y")&&(i.y-=r)})),o.width=n-e+a,o.height=i-r+s}(t)})),e(" assignNodeIntersects",(function(){!function(t){ED.forEach(t.edges(),(function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(RD.intersectRect(o,n)),i.points.push(RD.intersectRect(a,r))}))}(t)})),e(" reversePoints",(function(){!function(t){ED.forEach(t.edges(),(function(e){var n=t.edge(e);n.reversed&&n.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){wD.undo(t)}))}(e,n)})),n(" updateInputGraph",(function(){!function(t,e){ED.forEach(t.nodes(),(function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))})),ED.forEach(t.edges(),(function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,ED.has(i,"x")&&(r.x=i.x,r.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var LD=["nodesep","edgesep","ranksep","marginx","marginy"],jD={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},zD=["acyclicer","ranker","rankdir","align"],BD=["width","height"],FD={width:0,height:0},GD=["minlen","weight","width","height","labeloffset"],VD={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},WD=["labelpos"];function UD(t,e){return ED.mapValues(ED.pick(t,e),Number)}function HD(t){var e={};return ED.forEach(t,(function(t,n){e[n.toLowerCase()]=t})),e}var qD=u_,$D=C_,YD=YO.Graph,KD={debugOrdering:function(t){var e=$D.buildLayerMatrix(t),n=new YD({compound:!0,multigraph:!0}).setGraph({});return qD.forEach(t.nodes(),(function(e){n.setNode(e,{label:e}),n.setParent(e,"layer"+t.node(e).rank)})),qD.forEach(t.edges(),(function(t){n.setEdge(t.v,t.w,{},t.name)})),qD.forEach(e,(function(t,e){var r="layer"+e;n.setNode(r,{rank:"same"}),qD.reduce(t,(function(t,e){return n.setEdge(t,e,{style:"invis"}),e}))})),n}};var XD={graphlib:YO,layout:ID,debug:KD,util:{time:C_.time,notime:C_.notime},version:"0.8.5"},ZD=f(XD);class QD{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,QD.defaultOptions,t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))}))}assign(t,e){return a(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))}))}genericDagreLayout(t,e,n){return a(this,void 0,void 0,(function*(){const{nodeSize:r}=n,i=new XD.graphlib.Graph;i.setGraph(n),i.setDefaultEdgeLabel((()=>({})));[...e.getAllNodes(),...e.getAllEdges()].some((({id:t})=>Wt(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach((t=>{const{id:e}=t,n=Object.assign({},t.data);if(void 0!==r){const[e,i]=function(t){if(!t)return[0,0,0];if(Wt(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,n=e,r=e]=t;return[e,n,r]}(kt(r)?r(t):r);Object.assign(n,{width:e,height:i})}i.setNode(e.toString(),n)})),e.getAllEdges().forEach((({id:t,source:e,target:n})=>{i.setEdge(e.toString(),n.toString(),{id:t})})),ZD.layout(i);const a={nodes:[],edges:[]};return i.nodes().forEach((n=>{const r=i.node(n);a.nodes.push({id:n,data:r}),t&&e.mergeNodeData(n,r)})),i.edges().forEach((n=>{const r=i.edge(n),{id:s}=r,c=o(r,["id"]),{v:u,w:l}=n;a.edges.push({id:s,source:u,target:l,data:c}),t&&e.mergeEdgeData(s,c)})),a}))}}QD.defaultOptions={};class JD{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,n=t.ry-this.ry;let r=Math.hypot(e,n);r=r<1e-4?1e-4:r;const i=this.g*(this.degree+1)*(t.degree+1)/r;this.fx+=i*e/r,this.fy+=i*n/r}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,n=(this.rx*this.mass+t.rx*t.mass)/e,r=(this.ry*this.mass+t.ry*t.mass)/e,i=this.degree+t.degree;return new JD({rx:n,ry:r,mass:e,degree:i})}}class tI{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,n=this.length/2;return new tI({xmid:t,ymid:e,length:n})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,n=this.length/2;return new tI({xmid:t,ymid:e,length:n})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,n=this.length/2;return new tI({xmid:t,ymid:e,length:n})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,n=this.length/2;return new tI({xmid:t,ymid:e,length:n})}}class eI{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new eI(this.quad.NW()),this.NE=new eI(this.quad.NE()),this.SW=new eI(this.quad.SW()),this.SE=new eI(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){if(null!=this.body&&t!==this.body)if(this._isExternal())t.addForce(this.body);else{(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t))}}}const nI={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};const rI={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"};const iI={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};const oI=(t,e)=>{let n;const r=t.rows||5,i=t.cols||5;if(null==e)n=Math.min(r,i);else{Math.min(r,i)===t.rows?t.rows=e:t.cols=e}return n},aI=(t,e)=>{let n;const r=t.rows||5,i=t.cols||5;if(null==e)n=Math.max(r,i);else{Math.max(r,i)===t.rows?t.rows=e:t.cols=e}return n},sI=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,cI=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,uI=(t,e)=>{const n=t.cols||5;e.col++,e.col>=n&&(e.col=0,e.row++)},lI=(t,e,n,r,i,o,a,s)=>{let c,u;const l=i[t.id];if(l)c=l.col*n+n/2+e[0],u=l.row*r+r/2+e[1];else{for(;sI(s,a);)uI(o,a);c=a.col*n+n/2+e[0],u=a.row*r+r/2+e[1],cI(s,a),uI(o,a)}t.data.x=c,t.data.y=u},hI={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},dI=(t,e,n,r,i,o)=>{e.forEach(((a,s)=>{n[s]={x:0,y:0},e.forEach(((e,c)=>{if(s===c)return;if(i[s]!==i[c])return;let u=a.x-e.x,l=a.y-e.y,h=Math.sqrt(u*u+l*l);if(0===h){h=1;const t=s>c?1:-1;u=.01*t,l=.01*t}if(h<o(t[s])/2+o(t[c])/2){const t=r*r/h;n[s].x+=u/h*t,n[s].y+=l/h*t}}))}))},fI=(t,e,n,r,i,o,a,s)=>{const c=o||a/10;return r&&e.forEach(((e,n)=>{const r=t[n].x-t[i].x,o=t[n].y-t[i].y,a=Math.sqrt(r*r+o*o);let s=o/a,c=-r/a;const u=Math.sqrt(e.x*e.x+e.y*e.y);let l=Math.acos((s*e.x+c*e.y)/u);l>Math.PI/2&&(l-=Math.PI/2,s*=-1,c*=-1);const h=Math.cos(l)*u;e.x=s*h,e.y=c*h})),t.forEach(((o,a)=>{if(a===i)return;const u=Math.sqrt(e[a].x*e[a].x+e[a].y*e[a].y);if(u>0&&a!==i){const l=Math.min(c*(n/800),u);if(o.x+=e[a].x/u*l,o.y+=e[a].y/u*l,r){let e=o.x-t[i].x,n=o.y-t[i].y;const r=Math.sqrt(e*e+n*n);e=e/r*s[a],n=n/r*s[a],o.x=t[i].x+e,o.y=t[i].y+n}}})),t},pI={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};const gI=(t,e,n,r,i,o,a)=>{if(!t)return[];const s=[];if(e){const c={};e.forEach(((e,u)=>{const l=[];e.forEach(((e,s)=>{var h,d;if(u===s)l.push(0);else if(r[u]===r[s])if("data"===o)l.push(e*(Math.abs(u-s)*a)/(r[u]/i));else if(o){let n,f;if(c[t[u].id])n=c[t[u].id];else{const e=("id"===o?t[u].id:null===(h=t[u].data)||void 0===h?void 0:h[o])||0;n=Bt(e)?e.charCodeAt(0):e,c[t[u].id]=n}if(c[t[s].id])f=c[t[s].id];else{const e=("id"===o?t[s].id:null===(d=t[s].data)||void 0===d?void 0:d[o])||0;f=Bt(e)?e.charCodeAt(0):e,c[t[s].id]=f}l.push(e*(Math.abs(n-f)*a)/(r[u]/i))}else l.push(e*n/(r[u]/i));else{const t=(n+i)/2;l.push(e*t)}})),s.push(l)}))}return s},mI=t=>{const e=t.length,n=t[0].length,r=[];for(let i=0;i<e;i++){const e=[];for(let r=0;r<n;r++)0!==t[i][r]?e.push(1/(t[i][r]*t[i][r])):e.push(0);r.push(e)}return r},vI=(t,e)=>{let n=-1;return t.forEach(((t,r)=>{t.id===e&&(n=r)})),Math.max(n,0)},yI=(t,e,n)=>{const r=t.length;for(let i=0;i<r;i++)if(t[e][i]===1/0){t[e][i]=n,t[i][e]=n;for(let o=0;o<r;o++)t[i][o]!==1/0&&t[e][o]===1/0&&(t[e][o]=n+t[i][o],t[o][e]=n+t[i][o])}for(let n=0;n<r;n++)if(n!==e)for(let i=0;i<r;i++)if(t[n][i]===1/0){let r=Math.abs(t[e][n]-t[e][i]);r=0===r?1:r,t[n][i]=r}},bI=(t,e)=>{let n=0;for(let r=0;r<t[e].length;r++)t[e][r]!==1/0&&(n=t[e][r]>n?t[e][r]:n);return n},xI={center:[0,0],width:300,height:300};function EI(t){return!!t.tick&&!!t.stop}
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2019 Google LLC
5
5
  * SPDX-License-Identifier: Apache-2.0
6
- */const wL=Symbol("Comlink.proxy"),xL=Symbol("Comlink.endpoint"),ML=Symbol("Comlink.releaseProxy"),NL=Symbol("Comlink.finalizer"),SL=Symbol("Comlink.thrown"),CL=t=>"object"==typeof t&&null!==t||"function"==typeof t,kL=new Map([["proxy",{canHandle:t=>CL(t)&&t[wL],serialize(t){const{port1:e,port2:n}=new MessageChannel;return TL(t,e),[n,[n]]},deserialize:t=>(t.start(),AL(t))}],["throw",{canHandle:t=>CL(t)&&SL in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function TL(t,e=globalThis,n=["*"]){e.addEventListener("message",(function r(i){if(!i||!i.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:o,type:a,path:s}=Object.assign({path:[]},i.data),u=(i.data.argumentList||[]).map(BL);let c;try{const e=s.slice(0,-1).reduce(((t,e)=>t[e]),t),n=s.reduce(((t,e)=>t[e]),t);switch(a){case"GET":c=n;break;case"SET":e[s.slice(-1)[0]]=BL(i.data.value),c=!0;break;case"APPLY":c=n.apply(e,u);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[wL]:!0})}(new n(...u));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;TL(t,n),c=function(t,e){return jL.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(t){c={value:t,[SL]:0}}Promise.resolve(c).catch((t=>({value:t,[SL]:0}))).then((n=>{const[i,s]=zL(n);e.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===a&&(e.removeEventListener("message",r),PL(e),NL in t&&"function"==typeof t[NL]&&t[NL]())})).catch((t=>{const[n,r]=zL({value:new TypeError("Unserializable return value"),[SL]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),e.start&&e.start()}function PL(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function AL(t,e){return DL(t,[],e)}function OL(t){if(t)throw new Error("Proxy has been released and is not useable")}function _L(t){return FL(t,{type:"RELEASE"}).then((()=>{PL(t)}))}const RL=new WeakMap,LL="FinalizationRegistry"in globalThis&&new FinalizationRegistry((t=>{const e=(RL.get(t)||0)-1;RL.set(t,e),0===e&&_L(t)}));function DL(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(n,o){if(OL(r),o===ML)return()=>{!function(t){LL&&LL.unregister(t)}(i),_L(t),r=!0};if("then"===o){if(0===e.length)return{then:()=>i};const n=FL(t,{type:"GET",path:e.map((t=>t.toString()))}).then(BL);return n.then.bind(n)}return DL(t,[...e,o])},set(n,i,o){OL(r);const[a,s]=zL(o);return FL(t,{type:"SET",path:[...e,i].map((t=>t.toString())),value:a},s).then(BL)},apply(n,i,o){OL(r);const a=e[e.length-1];if(a===xL)return FL(t,{type:"ENDPOINT"}).then(BL);if("bind"===a)return DL(t,e.slice(0,-1));const[s,u]=IL(o);return FL(t,{type:"APPLY",path:e.map((t=>t.toString())),argumentList:s},u).then(BL)},construct(n,i){OL(r);const[o,a]=IL(i);return FL(t,{type:"CONSTRUCT",path:e.map((t=>t.toString())),argumentList:o},a).then(BL)}});return function(t,e){const n=(RL.get(e)||0)+1;RL.set(e,n),LL&&LL.register(t,e,t)}(i,t),i}function IL(t){const e=t.map(zL);return[e.map((t=>t[0])),(n=e.map((t=>t[1])),Array.prototype.concat.apply([],n))];var n}const jL=new WeakMap;function zL(t){for(const[e,n]of kL)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},jL.get(t)||[]]}function BL(t){switch(t.type){case"HANDLER":return kL.get(t.name).deserialize(t.value);case"RAW":return t.value}}function FL(t,e,n){return new Promise((r=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.addEventListener("message",(function e(n){n.data&&n.data.id&&n.data.id===i&&(t.removeEventListener("message",e),r(n.data))})),t.start&&t.start(),t.postMessage(Object.assign({id:i},e),n)}))}class GL extends ap{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=AL(new Worker(new URL("./worker.js","undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&e.src||new URL("g6.min.js",document.baseURI).href),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return a(this,void 0,void 0,(function*(){if(this.running)return this;this.running=!0;const e=o(this.layout.options,["onTick"]),n={};Object.keys(e).forEach((t=>{Tt(e[t])||(n[t]=e[t])}));const r={layout:{id:this.layout.id,options:n,iterations:null===(t=this.options)||void 0===t?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},i=new Float32Array([0]),[a]=yield this.proxy.calculateLayout(r,[i]);return a}))}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[ML]()}isRunning(){return this.running}}class VL extends Ih{}const WL=t=>t?parseInt(t):0;function UL(t){let e=640,n=480;const[r,i]=function(t){const e=getComputedStyle(t),n=t.clientWidth||WL(e.width),r=t.clientHeight||WL(e.height);return[n-(WL(e.paddingLeft)+WL(e.paddingRight)),r-(WL(e.paddingTop)+WL(e.paddingBottom))]}(t);e=r||e,n=i||n;return[Math.max(Wt(e)?e:1,1),Math.max(Wt(n)?n:1,1)]}function HL(t,e=!0){const n=document.createElement("div");return n.setAttribute("class",`g6-${t}`),n.style.position="absolute",n.style.display="block",e&&(n.style.top="0px",n.style.left="0px",n.style.height="100%",n.style.width="100%",n.style.overflow="hidden",n.style.pointerEvents="none"),n}function qL(t,e="div",n={},r="",i=document.body){const o=document.getElementById(t);o&&o.remove();const a=document.createElement(e);return a.innerHTML=r,a.id=t,Object.assign(a.style,n),i.appendChild(a),a}class $L extends VL{static defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};$element=HL("contextmenu",!1);constructor(t,e){super(t,Object.assign({},$L.defaultOptions,e));this.context.canvas.getContainer().appendChild(this.$element),qL("g6-contextmenu-css","style",{},"\n .g6-contextmenu {\n font-size: 12px;\n background-color: rgba(255, 255, 255, 0.96);\n border-radius: 4px;\n overflow: hidden;\n box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;\n transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s;\n }\n\n .g6-contextmenu-ul {\n max-width: 256px;\n min-width: 96px;\n list-style: none;\n padding: 0;\n margin: 0;\n }\n\n .g6-contextmenu-li {\n padding: 8px 12px;\n cursor: pointer;\n user-select: none;\n }\n\n .g6-contextmenu-li:hover {\n background-color: #f5f5f5;\n cursor: pointer;\n }\n",document.head),this.update(e)}async showContextmenu(t){const{enable:e,offset:n}=this.options;if("function"==typeof e&&!e(t)||!e)return void this.hideContextmenu();const r=await this.getDOMContent(t);r instanceof HTMLElement?this.$element.appendChild(r):this.$element.innerHTML=r;const i=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-i.left+n[0]}px`,this.$element.style.top=`${t.client.y-i.top+n[1]}px`,this.$element.style.display="block"}hideContextmenu(){this.$element.style.display="none"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}async getDOMContent(t){const{getContent:e,getItems:n}=this.options;return n?`\n <ul class="g6-contextmenu-ul">\n ${(await n(t)).map((t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`)).join("")}\n </ul>\n `:await e(t)}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick)}onTriggerEvent=t=>{t.preventDefault?.(),this.showContextmenu(t)};onMenuItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof HTMLElement){if(t.target.className.includes("g6-contextmenu-li")){const n=t.target.getAttribute("value");e&&e(n,t.target),this.hideContextmenu()}this.context.graph.getCanvas().getContainer().contains(t.target)||this.hideContextmenu()}}}class YL extends VL{static defaultOptions={lineWidth:1,border:!0,borderLineWidth:1,borderStroke:"#0001",borderStyle:"solid",stroke:"#0001",size:20,tickCount:4,tickStrokeOpacity:.5};$element=HL("grid-line");offset=[0,0];constructor(t,e){super(t,Object.assign({},YL.defaultOptions,e));this.context.canvas.getContainer().appendChild(this.$element),this.updateStyle(),this.bindEvents()}update(t){super.update(t),this.updateStyle()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{size:t,stroke:e,lineWidth:n,border:r,borderLineWidth:i,borderStroke:o,borderStyle:a}=this.options;Object.assign(this.$element.style,{border:r?`${i}px ${a} ${o}`:"none",backgroundImage:`linear-gradient(${e} ${n}px, transparent ${n}px), linear-gradient(90deg, ${e} ${n}px, transparent ${n}px)`,backgroundSize:`${t}px ${t}px`})}updateOffset(t){this.offset=function(t,e){return t.map((t=>t%e))}($c(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}onTransform=t=>{if(!this.options.follow)return;const{data:{translate:e}}=t;e&&this.updateOffset(e)};destroy(){this.context.graph.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}function KL(t,e){e(t),t.children&&t.children.forEach((function(t){t&&KL(t,e)}))}function XL(t){ZL(t,!1)}function ZL(t,e){var n=e?"visible":"hidden";KL(t,(function(t){t.attr("visibility",n)}))}var QL=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=t.apply(this,l([],c(e),!1))||this;return r.addEventListener(Xa.INSERTED,(function(){XL(r)})),r}return r(e,t),e}(_s);function JL(t){var e=t.appendChild(new QL({class:"offscreen"}));return XL(e),e}var tD=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({style:i({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},r))||this}return r(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=JL(this)),this._offscreen},enumerable:!1,configurable:!0}),e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e}(Fs),eD=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=r}return Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},t.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},t}();var nD,rD=function(t,e){var n=function(t){return"".concat(e,"-").concat(t)},r=Object.fromEntries(Object.entries(t).map((function(t){var e=c(t,2),r=e[0],i=e[1],o=n(i);return[r,{name:o,class:".".concat(o),id:"#".concat(o),toString:function(){return o}}]})));return Object.assign(r,{prefix:n}),r},iD=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=5),Object.entries(e).forEach((function(i){var o=c(i,2),a=o[0],s=o[1],u=t;Object.prototype.hasOwnProperty.call(e,a)&&(s?It(s)?(It(t[a])||(u[a]={}),n<r?iD(t[a],s,n+1,r):u[a]=e[a]):_t(s)?(u[a]=[],u[a]=u[a].concat(s)):u[a]=s:u[a]=s)}))},oD=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)iD(t,e[r]);return t};!function(t,e,n){if(void 0===n&&(n=128),!Tt(t))throw new TypeError("Expected a function");var r=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=t.apply(this,n);return a.set(o,s),s};r.cache=function(t){var e,n,r,i=t||1;function o(t,o){++e>i&&(r=n,a(1),++e),n[t]=o}function a(t){e=0,n=Object.create(null),t||(r=Object.create(null))}return a(),{clear:a,has:function(t){return void 0!==n[t]||void 0!==r[t]},get:function(t){var e=n[t];return void 0!==e?e:void 0!==(e=r[t])?(o(t,e),e):void 0},set:function(t,e){void 0!==n[t]?n[t]=e:o(t,e)}}}(n)}((function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return nD||(nD=ds.offscreenCanvasCreator.getOrCreateContext(void 0)),nD.font=[o,a,i,"".concat(n,"px"),r].join(" "),nD.measureText(t).width}),(function(t,e){return[t,Object.values(e||aD(t)).join()].join("")}),4096);var aD=function(t){var e=t.style.fontFamily||"sans-serif",n=t.style.fontWeight||"normal",r=t.style.fontStyle||"normal",i=t.style.fontVariant,o=t.style.fontSize;return{fontSize:o="object"==typeof o?o.value:o,fontFamily:e,fontWeight:n,fontStyle:r,fontVariant:i}};function sD(t,e,n){void 0===n&&(n="..."),function(t,e){var n=function(t){return"text"===t.nodeName?t:"g"===t.nodeName&&1===t.children.length&&"text"===t.children[0].nodeName?t.children[0]:null}(t);n&&n.attr(e)}(t,{wordWrap:!0,wordWrapWidth:e,maxLines:1,textOverflow:n})}function uD(t){return"function"==typeof t?t():Bt(t)||Wt(t)?new tD({style:{text:String(t)}}):t}function cD(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=function(t){t.node().removeChildren()}),t?n(e):(r&&i(e),null)}function lD(t){for(var e=1/0,n=1/0,r=-1/0,i=-1/0,o=0;o<t.length;o++){var a=t[o],s=a.x,u=a.y,l=c([s+a.width,u+a.height],2),h=l[0],d=l[1];s<e&&(e=s),u<n&&(n=u),h>r&&(r=h),d>i&&(i=d)}return new eD(e,n,r-e,i-n)}var hD=function(t,e,n){var r=t.width,i=t.height,o=n.flexDirection,a=void 0===o?"row":o;n.flexWrap;var s=n.justifyContent,u=void 0===s?"flex-start":s;n.alignContent;var l=n.alignItems,h=void 0===l?"flex-start":l,d="row"===a,f="row"===a||"column"===a,p=d?f?[1,0]:[-1,0]:f?[0,1]:[0,-1],g=c([0,0],2),m=g[0],v=g[1],y=e.map((function(t){var e,n=t.width,r=t.height,i=c([m,v],2),o=i[0],a=i[1];return e=c([m+n*p[0],v+r*p[1]],2),m=e[0],v=e[1],new eD(o,a,n,r)})),b=lD(y),E={"flex-start":0,"flex-end":d?r-b.width:i-b.height,center:d?(r-b.width)/2:(i-b.height)/2},w=y.map((function(t){var e=t.x,n=t.y,r=eD.fromRect(t);return r.x=d?e+E[u]:e,r.y=d?n:n+E[u],r}));lD(w);var x=function(t){var e=c(d?["height",i]:["width",r],2),n=e[0],o=e[1];switch(h){case"flex-start":default:return 0;case"flex-end":return o-t[n];case"center":return o/2-t[n]/2}},M=w.map((function(t){var e=t.x,n=t.y,r=eD.fromRect(t);return r.x=d?e:e+x(r),r.y=d?n+x(r):n,r})),N=M.map((function(e){var n,r,i=eD.fromRect(e);return i.x+=null!==(n=t.x)&&void 0!==n?n:0,i.y+=null!==(r=t.y)&&void 0!==r?r:0,i}));return N},dD=function(t,e,n){return[]};function fD(t,e,n){void 0===n&&(n=!1);var r=t.getBBox(),i=r.width,o=r.height,a=e/Math.max(i,o);return n&&t.scale(a),a}var pD=function(){function t(t,n,r,i,o,a,s){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===i&&(i=null),void 0===o&&(o=[null,null,null,null,null]),void 0===a&&(a=[]),void 0===s&&(s=[]),e.add(this),this._elements=Array.from(t),this._data=n,this._parent=r,this._document=i,this._enter=o[0],this._update=o[1],this._exit=o[2],this._merge=o[3],this._split=o[4],this._transitions=a,this._facetElements=s}var e,n,r;return t.prototype.selectAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(e,null,this._elements[0],this._document)},t.prototype.selectFacetAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(this._elements,null,this._parent,this._document,void 0,void 0,e)},t.prototype.select=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t)[0]||null:t;return new n([e],null,e,this._document)},t.prototype.append=function(t){var e=this,r="function"==typeof t?t:function(){return e.createElement(t)},i=[];if(null!==this._data){for(var o=0;o<this._data.length;o++){var a=this._data[o],s=c(Array.isArray(a)?a:[a,null],2),u=s[0],l=s[1];(d=r(u,o)).__data__=u,null!==l&&(d.__fromElements__=l),this._parent.appendChild(d),i.push(d)}return new n(i,null,this._parent,this._document)}for(o=0;o<this._elements.length;o++){var h=this._elements[o],d=r(u=h.__data__,o);h.appendChild(d),i.push(d)}return new n(i,null,i[0],this._document)},t.prototype.maybeAppend=function(t,n){var i=h(this,e,"m",r).call(this,"#"===t[0]?t:"#".concat(t),n);return i.attr("id",t),i},t.prototype.maybeAppendByClassName=function(t,n){var i=t.toString(),o=h(this,e,"m",r).call(this,"."===i[0]?i:".".concat(i),n);return o.attr("className",i),o},t.prototype.maybeAppendByName=function(t,n){var i=h(this,e,"m",r).call(this,'[name="'.concat(t,'"]'),n);return i.attr("name",t),i},t.prototype.data=function(t,e,r){var i,o;void 0===e&&(e=function(t){return t}),void 0===r&&(r=function(){return null});for(var a,s,c,l=[],h=[],d=new Set(this._elements),f=[],p=new Set,g=new Map(this._elements.map((function(t,n){return[e(t.__data__,n),t]}))),m=new Map(this._facetElements.map((function(t,n){return[e(t.__data__,n),t]}))),v=(a=this._elements,s=function(t){return r(t.__data__)},c=new Map,a.forEach((function(t){var e=s(t);c.has(e)||c.set(e,[]),c.get(e).push(t)})),c),y=0;y<t.length;y++){var b=t[y],E=e(b,y),w=r(b,y);if(g.has(E))(S=g.get(E)).__data__=b,S.__facet__=!1,h.push(S),d.delete(S),g.delete(E);else if(m.has(E)){(S=m.get(E)).__data__=b,S.__facet__=!0,h.push(S),m.delete(E)}else if(v.has(E)){var x=v.get(E);f.push([b,x]);try{for(var M=(i=void 0,u(x)),N=M.next();!N.done;N=M.next()){var S=N.value;d.delete(S)}}catch(t){i={error:t}}finally{try{N&&!N.done&&(o=M.return)&&o.call(M)}finally{if(i)throw i.error}}v.delete(E)}else if(g.has(w)){(S=g.get(w)).__toData__?S.__toData__.push(b):S.__toData__=[b],p.add(S),d.delete(S)}else l.push(b)}var C=[new n([],l,this._parent,this._document),new n(h,null,this._parent,this._document),new n(d,null,this._parent,this._document),new n([],f,this._parent,this._document),new n(p,null,this._parent,this._document)];return new n(this._elements,null,this._parent,this._document,C)},t.prototype.merge=function(t){var e=l(l([],c(this._elements),!1),c(t._elements),!1),r=l(l([],c(this._transitions),!1),c(t._transitions),!1);return new n(e,null,this._parent,this._document,void 0,r)},t.prototype.createElement=function(t){if(this._document)return this._document.createElement(t,{});var e=n.registry[t];return e?new e:function(t){throw new Error(t)}("Unknown node type: ".concat(t))},t.prototype.join=function(t,e,n,r,i){void 0===t&&(t=function(t){return t}),void 0===e&&(e=function(t){return t}),void 0===n&&(n=function(t){return t.remove()}),void 0===r&&(r=function(t){return t}),void 0===i&&(i=function(t){return t.remove()});var o=t(this._enter),a=e(this._update),s=n(this._exit),u=r(this._merge),c=i(this._split);return a.merge(o).merge(s).merge(u).merge(c)},t.prototype.remove=function(){for(var t=function(t){var n=e._elements[t],r=e._transitions[t];r?r.then((function(){return n.remove()})):n.remove()},e=this,r=0;r<this._elements.length;r++)t(r);return new n([],null,this._parent,this._document,void 0,this._transitions)},t.prototype.each=function(t){for(var e=0;e<this._elements.length;e++){var n=this._elements[e],r=n.__data__;t.call(n,r,e)}return this},t.prototype.attr=function(t,e){var n="function"!=typeof e?function(){return e}:e;return this.each((function(r,i){void 0!==e&&(this[t]=n.call(this,r,i))}))},t.prototype.style=function(t,e,n){void 0===n&&(n=!0);var r="function"==typeof e&&n?e:function(){return e};return this.each((function(n,i){void 0!==e&&(this.style[t]=r.call(this,n,i))}))},t.prototype.styles=function(t,e){return void 0===t&&(t={}),void 0===e&&(e=!0),this.each((function(n,r){var i=this;Object.entries(t).forEach((function(t){var o=c(t,2),a=o[0],s=o[1],u="function"==typeof s&&e?s:function(){return s};void 0!==s&&i.attr(a,u.call(i,n,r))}))}))},t.prototype.update=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.maybeUpdate=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.transition=function(t){var e=this._transitions;return this.each((function(n,r){e[r]=t.call(this,n,r)}))},t.prototype.on=function(t,e){return this.each((function(){this.addEventListener(t,e)})),this},t.prototype.call=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.call.apply(t,l([this._parent,this],c(e),!1)),this},t.prototype.node=function(){return this._elements[0]},t.prototype.nodes=function(){return this._elements},t.prototype.transitions=function(){return this._transitions.filter((function(t){return!!t}))},t.prototype.parent=function(){return this._parent},n=t,e=new WeakSet,r=function(t,e){var r=this._elements[0],i=r.querySelector(t);if(i)return new n([i],null,this._parent,this._document);var o="string"==typeof e?this.createElement(e):e();return r.appendChild(o),new n([o],null,this._parent,this._document)},t.registry={g:_s,rect:Bs,circle:Ps,path:Is,text:tD,ellipse:Os,image:Ls,line:Ds,polygon:js,polyline:zs,html:Rs},t}();function gD(t){return new pD([t],null,t,t.ownerDocument)}function mD(t){if(Wt(t))return[t,t,t,t];if(_t(t)){var e=t.length;if(1===e)return[t[0],t[0],t[0],t[0]];if(2===e)return[t[0],t[1],t[0],t[1]];if(3===e)return[t[0],t[1],t[2],t[1]];if(4===e)return t}return[0,0,0,0]}function vD(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function yD(t,e,n){var r;void 0===n&&(n=!0);var i=e||(null===(r=t.match(/^([a-z][a-z0-9]+)/))||void 0===r?void 0:r[0])||"",o=t.replace(new RegExp("^(".concat(i,")")),"");return n?function(t){return t.toString().charAt(0).toLowerCase()+t.toString().slice(1)}(o):o}var bD=function(t,e){if(!(null==t?void 0:t.startsWith(e)))return!1;var n=t[e.length];return n>="A"&&n<="Z"};function ED(t,e,n){void 0===n&&(n=!1);var r={};return Object.entries(t).forEach((function(t){var i=c(t,2),o=i[0],a=i[1];if("className"===o||"class"===o);else if(bD(o,"show")&&bD(yD(o,"show"),e)!==n)o===function(t,e){return"".concat(e).concat(vD(t))}(e,"show")?r[o]=a:r[o.replace(new RegExp(vD(e)),"")]=a;else if(!bD(o,"show")&&bD(o,e)!==n){var s=yD(o,e);"filter"===s&&"function"==typeof a||(r[s]=a)}})),r}function wD(t,e){void 0===e&&(e=["x","y","class","className"]);var n=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],r={},i={};return Object.entries(t).forEach((function(t){var o=c(t,2),a=o[0],s=o[1];e.includes(a)||(-1!==n.indexOf(a)?i[a]=s:r[a]=s)})),[r,i]}function xD(){ZL(this,"hidden"!==this.attributes.visibility)}var MD=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this,oD({},{style:n},e))||this;return r.initialized=!1,r._defaultOptions=n,r}return r(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=JL(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),e.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e.prototype.attributeChangedCallback=function(t){"visibility"===t&&xD.call(this)},e.prototype.update=function(t,e){var n;return this.attr(oD({},this.attributes,t||{})),null===(n=this.render)||void 0===n?void 0:n.call(this,this.attributes,this,e)},e.prototype.clear=function(){this.removeChildren()},e.prototype.bindEvents=function(t,e){},e.prototype.getSubShapeStyle=function(t){return t.x,t.y,t.transform,t.transformOrigin,t.class,t.className,t.zIndex,o(t,["x","y","transform","transformOrigin","class","className","zIndex"])},e}(As),ND=function(t,e,n){return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e],["Z"]]},SD=ND,CD=function(t,e,n){return[["M",t,e+n],["L",t,e-n]]},kD=function(t,e,n){return[["M",t-n,e],["L",t+n,e]]},TD=kD;var PD=function(t,e,n){return[["M",t-n,e-n],["L",t+n,e],["L",t-n,e+n],["Z"]]};function AD(t){var e=function(t){var e="default";if(Rt(t)&&t instanceof Image)e="image";else if(Tt(t))e="symbol";else if(Bt(t)){var n=new RegExp("data:(image|text)");e=t.match(n)?"base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(t)?"url":"symbol"}return e}(t);return["base64","url","image"].includes(e)?"image":t&&"symbol"===e?"path":null}var OD=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(t,n){var r=this.getSubShapeStyle(t),a=r.symbol,s=r.size,u=void 0===s?16:s,c=o(r,["symbol","size"]),l=AD(a);cD(!!l,gD(n),(function(t){t.maybeAppendByClassName("marker",l).attr("className","marker ".concat(l,"-marker")).call((function(t){if("image"===l){var n=2*u;t.styles({img:a,width:n,height:n,x:-u,y:-u})}else{n=u/2;var r=Tt(a)?a:e.getSymbol(a);t.styles(i({path:null==r?void 0:r(0,0,n)},c))}}))}))},e.MARKER_SYMBOL_MAP=new Map,e.registerSymbol=function(t,n){e.MARKER_SYMBOL_MAP.set(t,n)},e.getSymbol=function(t){return e.MARKER_SYMBOL_MAP.get(t)},e.getSymbols=function(){return Array.from(e.MARKER_SYMBOL_MAP.keys())},e}(MD);OD.registerSymbol("cross",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e+n],["M",t+n,e-n],["L",t-n,e+n]]})),OD.registerSymbol("hyphen",(function(t,e,n){return[["M",t-n,e],["L",t+n,e]]})),OD.registerSymbol("line",CD),OD.registerSymbol("plus",(function(t,e,n){return[["M",t-n,e],["L",t+n,e],["M",t,e-n],["L",t,e+n]]})),OD.registerSymbol("tick",(function(t,e,n){return[["M",t-n/2,e-n],["L",t+n/2,e-n],["M",t,e-n],["L",t,e+n],["M",t-n/2,e+n],["L",t+n/2,e+n]]})),OD.registerSymbol("circle",ND),OD.registerSymbol("point",SD),OD.registerSymbol("bowtie",(function(t,e,n){var r=n-1.5;return[["M",t-n,e-r],["L",t+n,e+r],["L",t+n,e-r],["L",t-n,e+r],["Z"]]})),OD.registerSymbol("hexagon",(function(t,e,n){var r=n/2*Math.sqrt(3);return[["M",t,e-n],["L",t+r,e-n/2],["L",t+r,e+n/2],["L",t,e+n],["L",t-r,e+n/2],["L",t-r,e-n/2],["Z"]]})),OD.registerSymbol("square",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]})),OD.registerSymbol("diamond",(function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]})),OD.registerSymbol("triangle",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["Z"]]})),OD.registerSymbol("triangle-down",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]})),OD.registerSymbol("line",CD),OD.registerSymbol("dot",kD),OD.registerSymbol("dash",TD),OD.registerSymbol("smooth",(function(t,e,n){return[["M",t-n,e],["A",n/2,n/2,0,1,1,t,e],["A",n/2,n/2,0,1,0,t+n,e]]})),OD.registerSymbol("hv",(function(t,e,n){return[["M",t-n-1,e-2.5],["L",t,e-2.5],["L",t,e+2.5],["L",t+n+1,e+2.5]]})),OD.registerSymbol("vh",(function(t,e,n){return[["M",t-n-1,e+2.5],["L",t,e+2.5],["L",t,e-2.5],["L",t+n+1,e-2.5]]})),OD.registerSymbol("hvh",(function(t,e,n){return[["M",t-(n+1),e+2.5],["L",t-n/2,e+2.5],["L",t-n/2,e-2.5],["L",t+n/2,e-2.5],["L",t+n/2,e+2.5],["L",t+n+1,e+2.5]]})),OD.registerSymbol("vhv",(function(t,e){return[["M",t-5,e+2.5],["L",t-5,e],["L",t,e],["L",t,e-3],["L",t,e+3],["L",t+6.5,e+3]]}));var _D=rD({text:"text"},"title");function RD(t){return/\S+-\S+/g.test(t)?t.split("-").map((function(t){return t[0]})):t.length>2?[t[0]]:t.split("")}function LD(t,e){var n=Object.entries(e).reduce((function(e,n){var r=c(n,2),i=r[0],o=r[1];return t.node().attr(i)||(e[i]=o),e}),{});t.styles(n)}var DD=function(t){function e(e){return t.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return r(e,t),e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=t.position,i=t.spacing,o=t.inset,a=this.querySelector(_D.text.class);if(!a)return new eD(0,0,+e,+n);var s=a.getBBox(),u=s.width,l=s.height,h=c(mD(i),4),d=h[0],f=h[1],p=h[2],g=h[3],m=c([0,0,+e,+n],4),v=m[0],y=m[1],b=m[2],E=m[3],w=RD(r);if(w.includes("i"))return new eD(v,y,b,E);w.forEach((function(t,r){var i,o,a,s;"t"===t&&(i=c(0===r?[l+p,+n-l-p]:[0,+n],2),y=i[0],E=i[1]),"r"===t&&(o=c([+e-u-g],1),b=o[0]),"b"===t&&(a=c([+n-l-d],1),E=a[0]),"l"===t&&(s=c(0===r?[u+f,+e-u-f]:[0,+e],2),v=s[0],b=s[1])}));var x=c(mD(o),4),M=x[0],N=x[1],S=x[2],C=x[3],k=c([C+N,M+S],2),T=k[0],P=k[1];return new eD(v+C,y+M,b-T,E-P)},e.prototype.getBBox=function(){return this.title?this.title.getBBox():new eD(0,0,0,0)},e.prototype.render=function(t,e){var n=this;t.width,t.height,t.position,t.spacing;var r=o(t,["width","height","position","spacing"]),i=c(wD(r),1)[0],a=function(t){var e,n,r,i,o=t,a=o.width,s=o.height,u=o.position,l=c([+a/2,+s/2],2),h=c([+l[0],+l[1],"center","middle"],4),d=h[0],f=h[1],p=h[2],g=h[3],m=RD(u);return m.includes("l")&&(d=(e=c([0,"start"],2))[0],p=e[1]),m.includes("r")&&(d=(n=c([+a,"end"],2))[0],p=n[1]),m.includes("t")&&(f=(r=c([0,"top"],2))[0],g=r[1]),m.includes("b")&&(f=(i=c([+s,"bottom"],2))[0],g=i[1]),{x:d,y:f,textAlign:p,textBaseline:g}}(t),s=a.x,u=a.y,l=a.textAlign,h=a.textBaseline;cD(!!r.text,gD(e),(function(t){n.title=t.maybeAppendByClassName(_D.text,"text").styles(i).call(LD,{x:s,y:u,textAlign:l,textBaseline:h}).node()}))},e}(MD),ID=rD({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),jD=function(t){function e(e){var n=t.call(this,e,{animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonPath:PD(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(t,e){return"".concat(t,"/").concat(e)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new _s({class:ID.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new _s({class:ID.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return r(e,t),Object.defineProperty(e.prototype,"defaultPage",{get:function(){var t=this.attributes.defaultPage;return Vt(t,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageShape",{get:function(){var t=c(function(t){var e;return(null===(e=t[0])||void 0===e?void 0:e.map((function(e,n){return t.map((function(t){return t[n]}))})))||[]}(this.pageViews.map((function(t){var e=t.getBBox();return[e.width,e.height]}))).map((function(t){return Math.max.apply(Math,l([],c(t),!1))})),2),e=t[0],n=t[1],r=this.attributes,i=r.pageWidth,o=void 0===i?e:i,a=r.pageHeight;return{pageWidth:o,pageHeight:void 0===a?n:a}},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(e.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e=t.prototype.getBBox.call(this),n=e.x,r=e.y,i=this.controllerShape,o=this.pageShape,a=o.pageWidth,s=o.pageHeight;return new eD(n,r,a+i.width,s)},e.prototype.goTo=function(t){var e=this,n=this.attributes.animate,r=this,i=r.currPage,o=r.playState,a=r.playWindow,s=r.pageViews;if("idle"!==o||t<0||s.length<=0||t>=s.length)return null;s[i].setLocalPosition(0,0),this.prepareFollowingPage(t);var u=c(this.getFollowingPageDiff(t),2),l=u[0],h=u[1];this.playState="running";var d,f,p,g=(d=a,f=[{transform:"translate(0, 0)"},{transform:"translate(".concat(-l,", ").concat(-h,")")}],p=n,0===f.length?null:p?d.animate(f,p):(function(t,e){"update"in t?t.update(e):t.attr(e)}(d,{style:f.slice(-1)[0]}),null));return function(t,e){t?t.finished.then(e):e()}(g,(function(){e.innerCurrPage=t,e.playState="idle",e.setVisiblePages([t]),e.updatePageInfo()})),g},e.prototype.prev=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n<=0)return null;var r=t?(n-1+e)%e:Vt(n-1,0,e);return this.goTo(r)},e.prototype.next=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n>=e-1)return null;var r=t?(n+1)%e:Vt(n+1,0,e);return this.goTo(r)},e.prototype.renderClipPath=function(t){var e=this.pageShape,n=e.pageWidth,r=e.pageHeight;n&&r?(this.clipPath=t.maybeAppendByClassName(ID.clipPath,"rect").styles({width:n,height:r}),this.contentGroup.attr("clipPath",this.clipPath.node())):this.contentGroup.style.clipPath=void 0},e.prototype.setVisiblePages=function(t){this.playWindow.children.forEach((function(e,n){t.includes(n)?ZL(e,!0):XL(e)}))},e.prototype.adjustControllerLayout=function(){var t=this,e=t.prevBtnGroup,n=t.nextBtnGroup,r=t.pageInfoGroup,i=this.attributes,o=i.orientation,a=i.controllerPadding,s=r.getBBox(),u=s.width;s.height;var l=c("horizontal"===o?[-180,0]:[-90,90],2),h=l[0],d=l[1];e.setLocalEulerAngles(h),n.setLocalEulerAngles(d);var f=e.getBBox(),p=f.width,g=f.height,m=n.getBBox(),v=m.width,y=m.height,b=Math.max(p,u,v),E="horizontal"===o?{offset:[[0,0],[p/2+a,0],[p+u+2*a,0]],textAlign:"start"}:{offset:[[b/2,-g-a],[b/2,0],[b/2,y+a]],textAlign:"center"},w=c(E.offset,3),x=c(w[0],2),M=x[0],N=x[1],S=c(w[1],2),C=S[0],k=S[1],T=c(w[2],2),P=T[0],A=T[1],O=E.textAlign,_=r.querySelector("text");_&&(_.style.textAlign=O),e.setLocalPosition(M,N),r.setLocalPosition(C,k),n.setLocalPosition(P,A)},e.prototype.updatePageInfo=function(){var t,e=this,n=e.currPage,r=e.pageViews,i=e.attributes.formatter;r.length<2||(null===(t=this.pageInfoGroup.querySelector(ID.pageInfo.class))||void 0===t||t.attr("text",i(n+1,r.length)),this.adjustControllerLayout())},e.prototype.getFollowingPageDiff=function(t){var e=this.currPage;if(e===t)return[0,0];var n=this.attributes.orientation,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,a=t<e?-1:1;return"horizontal"===n?[a*i,0]:[0,a*o]},e.prototype.prepareFollowingPage=function(t){var e=this.currPage,n=this.pageViews;if(this.setVisiblePages([t,e]),t!==e){var r=c(this.getFollowingPageDiff(t),2),i=r[0],o=r[1];n[t].setLocalPosition(i,o)}},e.prototype.renderController=function(t){var e=this,n=this.attributes.controllerSpacing,r=this.pageShape,a=r.pageWidth,s=r.pageHeight,u=this.pageViews.length>=2,l=t.maybeAppendByClassName(ID.controller,"g");if(ZL(l.node(),u),u){var h=ED(this.attributes,"button"),d=ED(this.attributes,"pageNum"),f=c(wD(h),2),p=f[0],g=f[1],m=p.size,v=o(p,["size"]),y=!l.select(ID.prevBtnGroup.class).node(),b=l.maybeAppendByClassName(ID.prevBtnGroup,"g").styles(g);this.prevBtnGroup=b.node();var E=b.maybeAppendByClassName(ID.prevBtn,"path"),w=l.maybeAppendByClassName(ID.nextBtnGroup,"g").styles(g);this.nextBtnGroup=w.node(),[E,w.maybeAppendByClassName(ID.nextBtn,"path")].forEach((function(t){t.styles(i(i({},v),{transformOrigin:"center"})),fD(t.node(),m,!0)}));var x=l.maybeAppendByClassName(ID.pageInfoGroup,"g");this.pageInfoGroup=x.node(),x.maybeAppendByClassName(ID.pageInfo,"text").styles(d),this.updatePageInfo(),l.node().setLocalPosition(a+n,s/2),y&&(this.prevBtnGroup.addEventListener("click",(function(){e.prev()})),this.nextBtnGroup.addEventListener("click",(function(){e.next()})))}},e.prototype.render=function(t,e){var n=gD(e);this.renderClipPath(n),this.renderController(n),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},e.prototype.bindEvents=function(){var t=this,e=te((function(){return t.render(t.attributes,t)}),50);this.playWindow.addEventListener(Xa.INSERTED,e),this.playWindow.addEventListener(Xa.REMOVED,e)},e}(MD);function zD(t,e,n){return void 0===t&&(t="horizontal"),"horizontal"===t?e:n}OD.registerSymbol("hiddenHandle",(function(t,e,n){var r=1.4*n;return[["M",t-n,e-r],["L",t+n,e-r],["L",t+n,e+r],["L",t-n,e+r],["Z"]]})),OD.registerSymbol("verticalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=t+.4*r;return[["M",t,e],["L",a,e+i],["L",t+r,e+i],["L",t+r,e-i],["L",a,e-i],["Z"],["M",a,e+o],["L",t+r-2,e+o],["M",a,e-o],["L",t+r-2,e-o]]})),OD.registerSymbol("horizontalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=e+.4*r;return[["M",t,e],["L",t-i,a],["L",t-i,e+r],["L",t+i,e+r],["L",t+i,a],["Z"],["M",t-o,a],["L",t-o,e+r-2],["M",t+o,a],["L",t+o,e+r-2]]}));var BD=rD({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item");var FD=function(t){function e(e){return t.call(this,e,{span:[1,1],marker:function(){return new Ps({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return r(e,t),Object.defineProperty(e.prototype,"showValue",{get:function(){var t=this.attributes.valueText;return!!t&&("string"==typeof t||"number"==typeof t?""!==t:"function"==typeof t||""!==t.attr("text"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"actualSpace",{get:function(){var t=this.labelGroup,e=this.valueGroup,n=this.attributes.markerSize,r=t.node().getBBox(),i=r.width,o=r.height,a=e.node().getBBox(),s=a.width,u=a.height;return{markerWidth:n,labelWidth:i,valueWidth:s,height:Math.max(n,o,u)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"span",{get:function(){var t=this.attributes.span;if(!t)return[1,1];var e=c(mD(t),2),n=e[0],r=e[1],i=this.showValue?r:0,o=n+i;return[n/o,i/o]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t,e=this.attributes,n=e.markerSize,r=e.width,i=this.actualSpace,o=i.markerWidth,a=i.height,s=this.actualSpace,u=s.labelWidth,l=s.valueWidth,h=c(this.spacing,2),d=h[0],f=h[1];if(r){var p=r-n-d-f,g=c(this.span,2);u=(t=c([g[0]*p,g[1]*p],2))[0],l=t[1]}return{width:o+u+l+d+f,height:a,markerWidth:o,labelWidth:u,valueWidth:l}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){var t=this.attributes.spacing;if(!t)return[0,0];var e=c(mD(t),2),n=e[0],r=e[1];return this.showValue?[n,r]:[n,0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layout",{get:function(){var t=this.shape,e=t.markerWidth,n=t.labelWidth,r=t.valueWidth,i=t.width,o=t.height,a=c(this.spacing,2),s=a[0];return{height:o,width:i,markerWidth:e,labelWidth:n,valueWidth:r,position:[e/2,e+s,e+n+s+a[1]]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleSize",{get:function(){var t=function(t){var e=t.querySelector(BD.marker.class);return e?e.style:{}}(this.markerGroup.node()),e=this.attributes,n=e.markerSize,r=e.markerStrokeWidth,i=void 0===r?t.strokeWidth:r,o=e.markerLineWidth,a=void 0===o?t.lineWidth:o,s=e.markerStroke,u=void 0===s?t.stroke:s,c=+(i||a||(u?1:0))*Math.sqrt(2),l=this.markerGroup.node().getBBox(),h=l.width,d=l.height;return(1-c/Math.max(h,d))*n},enumerable:!1,configurable:!0}),e.prototype.renderMarker=function(t){var e=this,n=this.attributes.marker,r=ED(this.attributes,"marker");this.markerGroup=t.maybeAppendByClassName(BD.markerGroup,"g").style("zIndex",0),cD(!!n,this.markerGroup,(function(){var t,o=e.markerGroup.node(),a=null===(t=o.childNodes)||void 0===t?void 0:t[0],s="string"==typeof n?new OD({style:{symbol:n},className:BD.marker.name}):n();a?s.nodeName===a.nodeName?a instanceof OD?a.update(i(i({},r),{symbol:n})):(!function(t,e){var n,r,i=e.attributes;try{for(var o=u(Object.entries(i)),a=o.next();!a.done;a=o.next()){var s=c(a.value,2),l=s[0],h=s[1];"id"!==l&&"className"!==l&&t.attr(l,h)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(a,s),gD(a).styles(r)):(a.remove(),gD(s).attr("className",BD.marker.name).styles(r),o.appendChild(s)):(s instanceof OD||gD(s).attr("className",BD.marker.name).styles(r),o.appendChild(s)),e.markerGroup.node().scale(1/e.markerGroup.node().getScale()[0]),fD(e.markerGroup.node(),e.scaleSize,!0)}))},e.prototype.renderLabel=function(t){var e=ED(this.attributes,"label"),n=e.text,r=o(e,["text"]);this.labelGroup=t.maybeAppendByClassName(BD.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(BD.label,(function(){return uD(n)})).styles(r)},e.prototype.renderValue=function(t){var e=this,n=ED(this.attributes,"value"),r=n.text,i=o(n,["text"]);this.valueGroup=t.maybeAppendByClassName(BD.valueGroup,"g").style("zIndex",0),cD(this.showValue,this.valueGroup,(function(){e.valueGroup.maybeAppendByClassName(BD.value,(function(){return uD(r)})).styles(i)}))},e.prototype.renderBackground=function(t){var e=this.shape,n=e.width,r=e.height,o=ED(this.attributes,"background");this.background=t.maybeAppendByClassName(BD.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(BD.background,"rect").styles(i({width:n,height:r},o))},e.prototype.adjustLayout=function(){var t=this.layout,e=t.labelWidth,n=t.valueWidth,r=t.height,i=c(t.position,3),o=i[0],a=i[1],s=i[2],u=r/2;this.markerGroup.styles({x:o,y:u}),this.labelGroup.styles({x:a,y:u}),sD(this.labelGroup.select(BD.label.class).node(),Math.ceil(e)),this.showValue&&(this.valueGroup.styles({x:s,y:u}),sD(this.valueGroup.select(BD.value.class).node(),Math.ceil(n)))},e.prototype.render=function(t,e){var n=gD(e);this.renderMarker(n),this.renderLabel(n),this.renderValue(n),this.renderBackground(n),this.adjustLayout()},e}(MD),GD=rD({page:"item-page",navigator:"navigator",item:"item"},"items"),VD=function(t,e,n){return void 0===n&&(n=!0),t?e(t):n},WD=function(t){function e(e){var n=t.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:de,mouseenter:de,mouseleave:de})||this;return n.navigatorShape=[0,0],n}return r(e,t),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"grid",{get:function(){var t=this.attributes,e=t.gridRow,n=t.gridCol,r=t.data;if(!e&&!n)throw new Error("gridRow and gridCol can not be set null at the same time");return e&&n?[e,n]:e?[e,r.length]:[r.length,n]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderData",{get:function(){var t=this.attributes,e=t.data,n=t.layout,r=ED(this.attributes,"item"),o=e.map((function(t,o){var a=t.id,s=void 0===a?o:a,u=t.label,h=t.value;return{id:"".concat(s),index:o,style:i({layout:n,labelText:u,valueText:h},Object.fromEntries(Object.entries(r).map((function(n){var r,i,a=c(n,2),s=a[0],u=a[1];return[s,(r=u,i=[t,o,e],Tt(r)?r.apply(void 0,l([],c(i),!1)):r)]}))))}}));return o},enumerable:!1,configurable:!0}),e.prototype.getGridLayout=function(){var t=this,e=this.attributes,n=e.orientation,r=e.width,i=e.rowPadding,o=e.colPadding,a=c(this.navigatorShape,1)[0],s=c(this.grid,2),u=s[0],l=s[1],h=l*u,d=0;return this.pageViews.children.map((function(e,s){var f,p,g=Math.floor(s/h),m=s%h,v=t.ifHorizontal(l,u),y=[Math.floor(m/v),m%v];"vertical"===n&&y.reverse();var b=c(y,2),E=b[0],w=b[1],x=(r-a-(l-1)*o)/l,M=e.getBBox().height,N=c([0,0],2),S=N[0],C=N[1];return"horizontal"===n?(S=(f=c([d,E*(M+i)],2))[0],C=f[1],d=w===l-1?0:d+x+o):(S=(p=c([w*(x+o),d],2))[0],C=p[1],d=E===u-1?0:d+M+i),{page:g,index:s,row:E,col:w,pageIndex:m,width:x,height:M,x:S,y:C}}))},e.prototype.getFlexLayout=function(){var t=this.attributes,e=t.width,n=t.height,r=t.rowPadding,i=t.colPadding,o=c(this.navigatorShape,1)[0],a=c(this.grid,2),s=a[0],u=a[1],l=c([e-o,n],2),h=l[0],d=l[1],f=c([0,0,0,0,0,0,0,0],8),p=f[0],g=f[1],m=f[2],v=f[3],y=f[4],b=f[5],E=f[6],w=f[7];return this.pageViews.children.map((function(t,e){var n,o,a,l,f=t.getBBox(),x=f.width,M=f.height,N=0===E?0:i,S=E+N+x;return S<=h&&VD(y,(function(t){return t<u}))?(n=c([E+N,w,S],3),p=n[0],g=n[1],E=n[2],{width:x,height:M,x:p,y:g,page:m,index:e,pageIndex:v++,row:b,col:y++}):(o=c([b+1,0,0,w+M+r],4),b=o[0],y=o[1],E=o[2],(w=o[3])+M<=d&&VD(b,(function(t){return t<s}))?(a=c([E,w,x],3),p=a[0],g=a[1],E=a[2],{width:x,height:M,x:p,y:g,page:m,index:e,pageIndex:v++,row:b,col:y++}):(l=c([0,0,x,0,m+1,0,0,0],8),p=l[0],g=l[1],E=l[2],w=l[3],m=l[4],v=l[5],b=l[6],y=l[7],{width:x,height:M,x:p,y:g,page:m,index:e,pageIndex:v++,row:b,col:y++}))}))},Object.defineProperty(e.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var t="grid"===this.attributes.layout?this.getGridLayout:this.getFlexLayout,e=t.call(this);return e.slice(-1)[0].page>0?(this.navigatorShape=[55,0],t.call(this)):e},enumerable:!1,configurable:!0}),e.prototype.ifHorizontal=function(t,e){return zD(this.attributes.orientation,t,e)},e.prototype.flattenPage=function(t){t.querySelectorAll(GD.item.class).forEach((function(e){t.appendChild(e)})),t.querySelectorAll(GD.page.class).forEach((function(e){t.removeChild(e).destroy()}))},e.prototype.renderItems=function(t){var e=this.attributes,n=e.click,r=e.mouseenter,i=e.mouseleave;this.flattenPage(t);var o=this.dispatchCustomEvent.bind(this);gD(t).selectAll(GD.item.class).data(this.renderData,(function(t){return t.id})).join((function(t){return t.append((function(t){var e=t.style;return new FD({style:e})})).attr("className",GD.item.name).on("click",(function(){null==n||n(this),o("itemClick",{item:this})})).on("pointerenter",(function(){null==r||r(this),o("itemMouseenter",{item:this})})).on("pointerleave",(function(){null==i||i(this),o("itemMouseleave",{item:this})}))}),(function(t){return t.each((function(t){var e=t.style;this.update(e)}))}),(function(t){return t.remove()}))},e.prototype.relayoutNavigator=function(){var t,e=this.attributes,n=e.layout,r=e.width,i=(null===(t=this.pageViews.children[0])||void 0===t?void 0:t.getBBox().height)||0,o=c(this.navigatorShape,2),a=o[0],s=o[1];this.navigator.update("grid"===n?{pageWidth:r-a,pageHeight:i-s}:{})},e.prototype.adjustLayout=function(){var t,e,n=this,r=Object.entries((t=this.itemsLayout,e="page",t.reduce((function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t}),{}))).map((function(t){var e=c(t,2);return{page:e[0],layouts:e[1]}})),i=l([],c(this.navigator.getContainer().children),!1);r.forEach((function(t){var e=t.layouts,r=n.pageViews.appendChild(new _s({className:GD.page.name}));e.forEach((function(t){var e=t.x,n=t.y,o=t.index,a=t.width,s=t.height,u=i[o];r.appendChild(u),ue(u,"__layout__",t),u.update({x:e,y:n,width:a,height:s})}))})),this.relayoutNavigator()},e.prototype.renderNavigator=function(t){var e=this.attributes.orientation,n=ED(this.attributes,"nav"),r=oD({orientation:e},n),i=this;return t.selectAll(GD.navigator.class).data(["nav"]).join((function(t){return t.append((function(){return new jD({style:r})})).attr("className",GD.navigator.name).each((function(){i.navigator=this}))}),(function(t){return t.each((function(){this.update(r)}))}),(function(t){return t.remove()})),this.navigator},e.prototype.getBBox=function(){return this.navigator.getBBox()},e.prototype.render=function(t,e){var n=this.attributes.data;if(n&&0!==n.length){var r=this.renderNavigator(gD(e));this.renderItems(r.getContainer()),this.adjustLayout()}},e.prototype.dispatchCustomEvent=function(t,e){var n=new Ha(t,{detail:e});this.dispatchEvent(n)},e}(MD),UD=rD({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),HD={showLabel:!0,formatter:function(t){return t.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};!function(t){function e(e){return t.call(this,e,HD)||this}r(e,t),e.prototype.render=function(t,e){var n=gD(e).maybeAppendByClassName(UD.markerGroup,"g");this.renderMarker(n);var r=gD(e).maybeAppendByClassName(UD.labelGroup,"g");this.renderLabel(r)},e.prototype.renderMarker=function(t){var e=this,n=this.attributes,r=n.orientation,o=n.markerSymbol,a=void 0===o?zD(r,"horizontalHandle","verticalHandle"):o;cD(!!a,t,(function(t){var n=ED(e.attributes,"marker"),r=i({symbol:a},n);e.marker=t.maybeAppendByClassName(UD.marker,(function(){return new OD({style:r})})).update(r)}))},e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.showLabel,a=n.orientation,s=n.spacing,u=void 0===s?0:s,l=n.formatter;cD(r,t,(function(t){var n,r=ED(e.attributes,"label"),s=r.text,h=o(r,["text"]),d=(null===(n=t.select(UD.marker.class))||void 0===n?void 0:n.node().getBBox())||{},f=d.width,p=void 0===f?0:f,g=d.height,m=c(zD(a,[0,(void 0===g?0:g)+u,"center","top"],[p+u,0,"start","middle"]),4),v=m[0],y=m[1],b=m[2],E=m[3];t.maybeAppendByClassName(UD.label,"text").styles(i(i({},h),{x:v,y:y,text:l(s).toString(),textAlign:b,textBaseline:E}))}))}}(MD);var qD,$D,YD={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},KD=oD({},YD,{});oD({},YD,(qD=HD,$D="handle",Object.entries(qD).reduce((function(t,e){var n=c(e,2),r=n[0],i=n[1];return r.startsWith("show")?t["show".concat($D).concat(r.slice(4))]=i:t["".concat($D).concat(vD(r))]=i,t}),{})),{color:["#d0e3fa","#acc7f6","#8daaf2","#6d8eea","#4d73cd","#325bb1","#5a3e75","#8c3c79","#e23455","#e7655b"],indicatorBackgroundFill:"#262626",indicatorLabelFill:"white",indicatorLabelFontSize:12,indicatorVisibility:"hidden",labelAlign:"value",labelDirection:"positive",labelSpacing:5,showHandle:!0,showIndicator:!0,showLabel:!0,slidable:!0,titleText:"",type:"continuous"});var XD=rD({title:"title",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),ZD=function(t){function e(e){return t.call(this,e,KD)||this}return r(e,t),e.prototype.renderTitle=function(t,e,n){var r=this.attributes,o=r.showTitle,a=r.titleText,s=c(wD(ED(this.attributes,"title")),2),u=s[0],l=s[1];this.titleGroup=t.maybeAppendByClassName(XD.titleGroup,"g").styles(l);var h=i(i({width:e,height:n},u),{text:o?a:""});this.title=this.titleGroup.maybeAppendByClassName(XD.title,(function(){return new DD({style:h})})).update(h)},e.prototype.renderItems=function(t,e){var n=e.x,r=e.y,o=e.width,a=e.height,s=c(wD(ED(this.attributes,"title",!0)),2),u=s[0],l=s[1],h=i(i({},u),{width:o,height:a,x:0,y:0});this.itemsGroup=t.maybeAppendByClassName(XD.itemsGroup,"g").styles(i({x:n,y:r},l));var d=this;this.itemsGroup.selectAll(XD.items.class).data(["items"]).join((function(t){return t.append((function(){return new WD({style:h})})).attr("className",XD.items.name).each((function(){d.items=gD(this)}))}),(function(t){return t.update(h)}),(function(t){return t.remove()}))},e.prototype.adjustLayout=function(){if(this.attributes.showTitle){var t=this.title.node().getAvailableSpace(),e=t.x,n=t.y;this.itemsGroup.node().setLocalPosition(e,n)}},Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes,e=t.showTitle,n=t.width,r=t.height;return e?this.title.node().getAvailableSpace():new eD(0,0,n,r)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e,n,r=null===(e=this.title)||void 0===e?void 0:e.node(),i=null===(n=this.items)||void 0===n?void 0:n.node();return r&&i?function(t,e){var n=t.attributes,r=n.position,i=n.spacing,o=n.inset,a=n.text,s=t.getBBox(),u=e.getBBox(),l=RD(r),h=c(mD(a?i:0),4),d=h[0],f=h[1],p=h[2],g=h[3],m=c(mD(o),4),v=m[0],y=m[1],b=m[2],E=m[3],w=c([g+f,d+p],2),x=w[0],M=w[1],N=c([E+y,v+b],2),S=N[0],C=N[1];if("l"===l[0])return new eD(s.x,s.y,u.width+s.width+x+S,Math.max(u.height+C,s.height));if("t"===l[0])return new eD(s.x,s.y,Math.max(u.width+S,s.width),u.height+s.height+M+C);var k=c([e.attributes.width||u.width,e.attributes.height||u.height],2),T=k[0],P=k[1];return new eD(u.x,u.y,T+s.width+x+S,P+s.height+M+C)}(r,i):t.prototype.getBBox.call(this)},e.prototype.render=function(t,e){var n=t.width,r=t.height,i=gD(e);this.renderTitle(i,n,r),this.renderItems(i,this.availableSpace),this.adjustLayout()},e}(MD);function QD(t){return void 0===t&&(t=""),{CONTAINER:"".concat(t,"tooltip"),TITLE:"".concat(t,"tooltip-title"),LIST:"".concat(t,"tooltip-list"),LIST_ITEM:"".concat(t,"tooltip-list-item"),NAME:"".concat(t,"tooltip-list-item-name"),MARKER:"".concat(t,"tooltip-list-item-marker"),NAME_LABEL:"".concat(t,"tooltip-list-item-name-label"),VALUE:"".concat(t,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(t,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(t,"tooltip-crosshair-y")}}var JD={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function tI(t){var e;void 0===t&&(t="");var n=QD(t);return(e={})[".".concat(n.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},e[".".concat(n.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},e[".".concat(n.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},e[".".concat(n.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},e[".".concat(n.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},e[".".concat(n.NAME)]={display:"flex","align-items":"center","max-width":"216px"},e[".".concat(n.NAME_LABEL)]=i({flex:1},JD),e[".".concat(n.VALUE)]=i({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},JD),e[".".concat(n.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e[".".concat(n.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e}var eI=function(t){function e(e){var n,r,i=this,o=null===(r=null===(n=e.style)||void 0===n?void 0:n.template)||void 0===r?void 0:r.prefixCls,a=QD(o);return(i=t.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(a.CONTAINER,'"></div>'),title:'<div class="'.concat(a.TITLE,'"></div>'),item:'<li class="'.concat(a.LIST_ITEM,'" data-index={index}>\n <span class="').concat(a.NAME,'">\n <span class="').concat(a.MARKER,'" style="background:{color}"></span>\n <span class="').concat(a.NAME_LABEL,'" title="{name}">{name}</span>\n </span>\n <span class="').concat(a.VALUE,'" title="{value}">{value}</span>\n </li>')},style:tI(o)})||this).timestamp=-1,i.prevCustomContentKey=i.attributes.contentKey,i.initShape(),i.render(i.attributes,i),i}return r(e,t),Object.defineProperty(e.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.element},Object.defineProperty(e.prototype,"elementSize",{get:function(){return{width:this.element.offsetWidth,height:this.element.offsetHeight}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HTMLTooltipItemsElements",{get:function(){var t=this.attributes,e=t.data,n=t.template;return e.map((function(t,e){var r=t.name,a=void 0===r?"":r,s=t.color,u=void 0===s?"black":s,c=t.index,l=o(t,["name","color","index"]),h=i({name:a,color:u,index:null!=c?c:e},l);return Xe(function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]})):t}(n.item,h))}))},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){this.renderHTMLTooltipElement(),this.updatePosition()},e.prototype.destroy=function(){var e;null===(e=this.element)||void 0===e||e.remove(),t.prototype.destroy.call(this)},e.prototype.show=function(t,e){var n=this;if(void 0!==t&&void 0!==e){var r=function(){n.attributes.x=null!=t?t:n.attributes.x,n.attributes.y=null!=e?e:n.attributes.y,n.updatePosition()};"hidden"===this.element.style.visibility?this.closeTransition(r):r()}this.element.style.visibility="visible"},e.prototype.hide=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.attributes.enterable&&this.isCursorEntered(t,e)||(this.element.style.visibility="hidden")},e.prototype.initShape=function(){var t=this.attributes.template;this.element=Xe(t.container),this.id&&this.element.setAttribute("id",this.id)},e.prototype.renderCustomContent=function(){if(void 0===this.prevCustomContentKey||this.prevCustomContentKey!==this.attributes.contentKey){this.prevCustomContentKey=this.attributes.contentKey;var t=this.attributes.content;t&&("string"==typeof t?this.element.innerHTML=t:this.element.replaceChildren(t))}},e.prototype.renderHTMLTooltipElement=function(){var t,e,n=this.attributes,r=n.template,i=n.title,o=n.enterable,a=n.style,s=n.content,u=QD(r.prefixCls),h=this.element;if(this.element.style.pointerEvents=o?"auto":"none",s)this.renderCustomContent();else{i?(h.innerHTML=r.title,h.getElementsByClassName(u.TITLE)[0].innerHTML=i):null===(e=null===(t=h.getElementsByClassName(u.TITLE))||void 0===t?void 0:t[0])||void 0===e||e.remove();var d=this.HTMLTooltipItemsElements,f=document.createElement("ul");f.className=u.LIST,f.replaceChildren.apply(f,l([],c(d),!1));var p=this.element.querySelector(".".concat(u.LIST));p?p.replaceWith(f):h.appendChild(f)}!function(t,e){Object.entries(e).forEach((function(e){var n=c(e,2),r=n[0],i=n[1];l([t],c(t.querySelectorAll(r)),!1).filter((function(t){return t.matches(r)})).forEach((function(t){t&&(t.style.cssText+=Object.entries(i).reduce((function(t,e){return"".concat(t).concat(e.join(":"),";")}),""))}))}))}(h,a)},e.prototype.getRelativeOffsetFromCursor=function(t){var e=this.attributes,n=e.position,r=e.offset,i=(t||n).split("-"),o={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},a=this.elementSize,s=a.width,u=a.height,l=[-s/2,-u/2];return i.forEach((function(t){var e=c(l,2),n=e[0],i=e[1],a=c(o[t],2),h=a[0],d=a[1];l=[n+(s/2+r[0])*h,i+(u/2+r[1])*d]})),l},e.prototype.setOffsetPosition=function(t){var e=c(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=void 0===o?0:o,s=i.y,u=void 0===s?0:s,l=i.container,h=l.x,d=l.y;this.element.style.left="".concat(+a+h+n,"px"),this.element.style.top="".concat(+u+d+r,"px")},e.prototype.updatePosition=function(){var t=this.attributes.showDelay,e=void 0===t?60:t,n=Date.now();this.timestamp>0&&n-this.timestamp<e||(this.timestamp=n,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},e.prototype.autoPosition=function(t){var e=c(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=i.y,s=i.bounding,u=i.position;if(!s)return[n,r];var l=this.element,h=l.offsetWidth,d=l.offsetHeight,f=c([+o+n,+a+r],2),p=f[0],g=f[1],m={left:"right",right:"left",top:"bottom",bottom:"top"},v=s.x,y=s.y,b={left:p<v,right:p+h>v+s.width,top:g<y,bottom:g+d>y+s.height},E=[];u.split("-").forEach((function(t){b[t]?E.push(m[t]):E.push(t)}));var w=E.join("-");return this.getRelativeOffsetFromCursor(w)},e.prototype.isCursorEntered=function(t,e){if(this.element){var n=this.element.getBoundingClientRect(),r=n.x,i=n.y,o=n.width,a=n.height;return new eD(r,i,o,a).isPointIn(t,e)}return!1},e.prototype.closeTransition=function(t){var e=this,n=this.element.style.transition;this.element.style.transition="none",t(),setTimeout((function(){e.element.style.transition=n}),10)},e.tag="tooltip",e}(MD),nI=function(t){function e(e){var n=t.call(this,e)||this;n.layoutEvents=[Xa.BOUNDS_CHANGED,Xa.INSERTED,Xa.REMOVED],n.$margin=mD(0),n.$padding=mD(0);var r=e.style||{},i=r.margin,o=void 0===i?0:i,a=r.padding,s=void 0===a?0:a;return n.margin=o,n.padding=s,n.isMutationObserved=!0,n.bindEvents(),n}return r(e,t),Object.defineProperty(e.prototype,"margin",{get:function(){return this.$margin},set:function(t){this.$margin=mD(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"padding",{get:function(){return this.$padding},set:function(t){this.$padding=mD(t)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var t=this.attributes,e=t.x,n=void 0===e?0:e,r=t.y,i=void 0===r?0:r,o=t.width,a=t.height,s=c(this.$margin,4),u=s[0],l=s[1],h=s[2],d=s[3];return new eD(n-d,i-u,o+d+l,a+u+h)},e.prototype.appendChild=function(e,n){return e.isMutationObserved=!0,t.prototype.appendChild.call(this,e,n),e},e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=c(this.$padding,4),i=r[0],o=r[1],a=r[2],s=r[3],u=c(this.$margin,4),l=u[0],h=u[3];return new eD(s+h,i+l,e-s-o,n-i-a)},e.prototype.layout=function(){if(this.attributes.display&&this.isConnected&&!this.children.some((function(t){return!t.isConnected})))try{var t=function(t,e,n){if(0===e.length)return[];var r={flex:hD,grid:dD},i=n.display in r?r[n.display]:null;return(null==i?void 0:i.call(null,t,e,n))||[]}(this.getAvailableSpace(),this.children.map((function(t){return t.getBBox()})),this.attributes);this.children.forEach((function(e,n){var r=t[n],i=r.x,o=r.y;e.attr({x:i,y:o})}))}catch(t){}},e.prototype.bindEvents=function(){var t=this;this.layoutEvents.forEach((function(e){t.addEventListener(e,(function(e){e.target.isMutationObserved=!0,t.layout()}))}))},e.prototype.attributeChangedCallback=function(t,e,n){"margin"===t?this.margin=n:"padding"===t&&(this.padding=n),this.layout()},e}(_s);class rI extends VL{static defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16};typePrefix="__data__";element=null;draw=!1;fieldMap={node:new Map,edge:new Map,combo:new Map};selectedItems=[];constructor(t,e){super(t,Object.assign({},rI.defaultOptions,e)),this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){this.element?.destroy(),this.element=null,this.draw=!1}bindEvents=()=>{const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.createElement)};changeState=(t,e)=>{const{graph:n}=this.context,{typePrefix:r}=this,i=se(t,[r,"id"]),o=se(t,[r,"style","labelText"]),[a]=i.split("__"),s=this.fieldMap[a].get(o)||[];n.setElementState(Object.fromEntries(s?.map((t=>[t,e]))))};click=t=>{if("hover"===this.options.trigger)return;const e=se(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?(this.selectedItems=this.selectedItems.filter((t=>t!==e)),this.changeState(t,[])):(this.selectedItems.push(e),this.changeState(t,"selected"))};mouseleave=t=>{"click"!==this.options.trigger&&(this.selectedItems=[],this.changeState(t,[]))};mouseenter=t=>{if("click"===this.options.trigger)return;const e=se(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?this.selectedItems=this.selectedItems.filter((t=>t!==e)):(this.selectedItems.push(e),this.changeState(t,"active"))};updateElement(){if(!this.element)return;this.element.getChildByIndex(0).update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}setFieldMap=(t,e,n)=>{if(!t)return;const r=this.fieldMap[n];if(r)if(r.has(t)){const n=r.get(t);n&&(n.push(e),r.set(t,n))}else r.set(t,[e])};getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click});getMarkerData=(t,e)=>{if(!t)return[];const{model:n,element:r,graph:i}=this.context,{nodes:o,edges:a,combos:s}=n.getData(),u={},c=e=>Tt(t)?t(e):t,l={node:"circle",edge:"line",combo:"rect"},h={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},d=(t,e)=>{t.forEach((t=>{const{id:n}=t,i=se(t,["data",c(t)]),{color:o="#1783ff",type:a="circle"}=((t,e)=>{const n=r?.getElementComputedStyle(t,e);return n})(e,t);(n||0===n)&&i&&i.replace(/\s+/g,"")&&(this.setFieldMap(i,n,e),u[i]||(u[i]={id:`${e}__${n}`,label:i,marker:h[a]||l[e],elementType:e,lineWidth:1,stroke:o,fill:o}))}))};switch(e){case"node":d(o,"node");break;case"edge":d(a,"edge");break;case"combo":d(s,"combo");break;default:return[]}return Object.values(u)};layout=t=>{let{flexDirection:e,alignItems:n,justifyContent:r}={flexDirection:"row",alignItems:"flex-end",justifyContent:"center"};const i={top:["row","flex-start","center"],bottom:["row","flex-end","center"],left:["column","flex-start","center"],right:["column","flex-end","center"]};return t in i&&([e,n,r]=i[t]),{display:"flex",flexDirection:e,justifyContent:r,alignItems:n}};createElement=()=>{if(this.draw)return void this.updateElement();const{canvas:t}=this.context,[e,n]=t.getSize(),{width:r=e,height:i=n,nodeField:o,edgeField:a,comboField:s,trigger:u,position:c,...l}=this.options,h=this.getMarkerData(o,"node"),d=this.getMarkerData(a,"edge"),f=this.getMarkerData(s,"combo"),p=[...h,...f,...d],g=this.layout(c),m=new nI({style:{width:r,height:i,...g}}),v={width:r,height:i,data:p,itemMarkerLineWidth:({lineWidth:t})=>t,itemMarker:({marker:t})=>t,itemMarkerStroke:({stroke:t})=>t,itemMarkerFill:({fill:t})=>t,gridCol:h.length,...l,...this.getEvents()},y=new ZD({className:"legend",style:v});m.appendChild(y),t.appendChild(m),this.element=m,this.draw=!0};destroy(){this.clear(),this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.createElement),super.destroy()}}class iI extends VL{static defaultOptions={position:"top-left",enable:!0};$element=HL("toolbar",!1);constructor(t,e){super(t,Object.assign({},iI.defaultOptions,e));const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),qL("g6-toolbar-css","style",{},"\n .g6-toolbar {\n position: absolute;\n z-index: 100;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);\n opacity: 0.65;\n } \n .g6-toolbar .g6-toolbar-item {\n display: inline-block;\n width: 16px;\n height: 16px;\n padding: 4px;\n cursor: pointer;\n box-sizing: content-box;\n }\n\n .g6-toolbar .g6-toolbar-item:hover {\n background-color: #f0f0f0;\n }\n\n .g6-toolbar .g6-toolbar-item svg {\n display: inline-block;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n",document.head),qL("g6-toolbar-svgicon","div",{display:"none"},'\n <svg>\n <symbol id="zoom-in" viewBox="64 64 896 896">\n <path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="zoom-out" viewBox="64 64 896 896">\n <path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="edit" viewBox="64 64 896 896">\n <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path>\n </symbol>\n <symbol id="delete" viewBox="64 64 896 896">\n <path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path>\n </symbol>\n <symbol id="redo" viewBox="64 64 896 896">\n <path d="M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"></path>\n </symbol>\n <symbol id="undo" viewBox="64 64 896 896">\n <path d="M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"></path>\n </symbol>\n <symbol id="export" viewBox="64 64 896 896">\n <path d="M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"></path>\n </symbol>\n <symbol id="auto-fit" viewBox="64 64 896 896">\n <path d="M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"></path>\n <path d="M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"></path>\n </symbol>\n <symbol id="reset" viewBox="64 64 896 896">\n <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path>\n </symbol>\n </svg>\n'),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}async update(t){super.update(t);const{className:e,position:n,style:r}=this.options;this.$element.className=`g6-toolbar ${e||""}`,Object.assign(this.$element.style,r,function(t){const e={top:"unset",right:"unset",bottom:"unset",left:"unset"};return t.split("-").forEach((t=>{e[t]="8px"})),e.flexDirection=t.startsWith("top")||t.startsWith("bottom")?"row":"column",e}(n)),this.$element.innerHTML=await this.getDOMContent()}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}async getDOMContent(){return(await this.options.getItems()).map((t=>`\n <div class="g6-toolbar-item" value="${t.value}">\n <svg aria-hidden="true" focusable="false">\n <use xlink:href="#${t.id}"></use>\n </svg>\n </div>`)).join("")}onToolbarItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof Element&&t.target.className.includes("g6-toolbar-item")){const n=t.target.getAttribute("value");e?.(n,t.target)}}}class oI extends VL{static defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,style:{".tooltip":{visibility:"hidden"}}};currentTarget=null;tooltipElement=null;container=null;constructor(t,e){super(t,Object.assign({},oI.defaultOptions,e)),this.render(),this.bindEvents()}getEvents(){return"click"===this.options.trigger?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerenter":this.onPointerEnter,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerenter":this.onPointerEnter,"edge:pointermove":this.onPointerMove,"combo:pointerenter":this.onPointerEnter,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){this.unbindEvents(),super.update(t),this.tooltipElement&&this.container?.removeChild(this.tooltipElement.HTMLTooltipElement),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.off(n,e[n])}))}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.on(n,e[n])}))}isEnable=t=>{const{enable:e}=this.options;return"function"==typeof e?e(t):e};onClick=t=>{const{target:{id:e}}=t;this.currentTarget===e?(this.currentTarget=null,this.hideTooltip(t)):(this.currentTarget=e,this.showTooltip(t))};onPointerMove=t=>{const{target:e}=t;this.currentTarget&&e.id!==this.currentTarget&&this.showTooltip(t)};onPointerLeave=t=>{this.hideTooltip(t),this.currentTarget=null};onCanvasMove=t=>{this.hideTooltip(t),this.currentTarget=null};onPointerEnter=t=>{this.showTooltip(t)};showTooltipById=(t,e="node")=>{const n={targetType:e,target:{id:t}};this.showTooltip(n)};getItems=(t,e)=>{const{model:n}=this.context;switch(e){case"node":return n.getNodeData([t]);case"edge":return n.getEdgeData([t]);case"combo":return n.getComboData([t]);default:return[]}};showTooltip=t=>{const{targetType:e,client:n,target:{id:r,attributes:i={color:"#1883FF"}}}=t;if(!this.tooltipElement||!this.isEnable(t))return;const{getContent:o}=this.options,{color:a,stroke:s}=i;this.currentTarget=r;const u=this.getItems(r,e);let c,l;if(n)c=n.x,l=n.y;else{const t=se(u,"0.style",{x:0,y:0});c=t.x,l=t.y}let h={};o?h.content=o(t,u):h={title:e,data:u.map((t=>({name:"ID",value:t.id||`${t.source} -> ${t.target}`,color:a||s})))},this.tooltipElement.update({x:c,y:l,style:{".tooltip":{visibility:"visible"}},...h})};hideTooltip=t=>{if(!t)return void this.tooltipElement?.hide();if(!this.tooltipElement||!this.isEnable(t))return;const{client:{x:e,y:n}}=t;this.tooltipElement.hide(e,n)};initTooltip=()=>{const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:r,left:i}=n.getBoundingClientRect(),{style:o,position:a,enterable:s,container:u={x:-i,y:-r}}=this.options,[c,l]=e,[h,d]=t.getSize(),f=new eI({className:"tooltip",style:{x:c,y:l,container:u,bounding:{x:0,y:0,width:h,height:d},position:a,enterable:s,title:"",offset:[10,10],style:o}});return this.container?.appendChild(f.HTMLTooltipElement),f};destroy(){this.unbindEvents(),this.tooltipElement&&this.container?.removeChild(this.tooltipElement.HTMLTooltipElement),super.destroy()}}let aI;function sI(t,e){aI||(aI=document.createElement("canvas")),aI.width=t,aI.height=e;return aI.getContext("2d").clearRect(0,0,t,e),aI}class uI extends VL{static defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};$element=HL("watermark");constructor(t,e){super(t,Object.assign({},uI.defaultOptions,e));this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}async update(t){super.update(t);const{width:e,height:n,text:r,imageURL:i,...o}=this.options;Object.keys(o).forEach((e=>{e.startsWith("background")&&(this.$element.style[e]=t[e])}));const a=i?await async function(t,e,n,r){const i=sI(t,e),o=i.getContext("2d"),{rotate:a,opacity:s}=r;a&&o.rotate(a),s&&(o.globalAlpha=s);const u=new Image;return u.crossOrigin="anonymous",u.src=n,new Promise((n=>{u.onload=function(){const r=t>u.width?(t-u.width)/2:0,a=e>u.height?(e-u.height)/2:0;o.drawImage(u,0,0,u.width,u.height,r,a,t-2*r,e-2*a),n(i.toDataURL())}}))}(e,n,i,o):await async function(t,e,n,r){const i=sI(t,e),o=i.getContext("2d"),{rotate:a,opacity:s,textFill:u,textFontSize:c,textFontFamily:l,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:p}=r;return o.textAlign=f,o.textBaseline=p,o.translate(t/2,e/2),o.font=`${c}px ${l} ${h} ${d}`,a&&o.rotate(a),s&&(o.globalAlpha=s),u&&(o.fillStyle=u,o.fillText(`${n}`,0,0)),i.toDataURL()}(e,n,r,o);this.$element.style.backgroundImage=`url(${a})`}destroy(){super.destroy(),this.$element.remove()}}const cI=["#7E92B5","#f5222d","#faad14"],lI={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},hI={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function dI(t){const{bgColor:e,textColor:n,nodeColor:r,nodeColorDisabled:i,nodeStroke:o,nodeBadgePalette:a=cI,nodePaletteOptions:s=lI,edgeColor:u,edgeColorDisabled:c,edgePaletteOptions:l=hI,comboColor:h,comboColorDisabled:d,comboStroke:f,comboStrokeDisabled:p}=t;return{background:e,node:{palette:s,style:{badgeFill:e,badgeFontSize:8,badgePadding:[1,4],badgePalette:a,color:r,halo:!1,haloLineWidth:12,haloStrokeOpacity:.25,iconFill:e,iconFontSize:16,iconOpacity:1,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.5,labelBackgroundPadding:[0,2],labelFill:n,labelFontSize:12,labelOpacity:1,opacity:1,portFill:r,portLineWidth:1,portStroke:o,portStrokeOpacity:.65},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:3,stroke:o},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:3,stroke:o,strokeOpacity:.85},inactive:{iconOpacity:.25,labelOpacity:.25,opacity:.25},disabled:{color:i,labelOpacity:.25}},animation:{enter:"fade",exit:"fade",visibility:"fade",update:[{fields:["x","y","color","stroke"]}]}},edge:{palette:l,style:{color:u,halo:!1,haloLineWidth:12,haloStrokeOpacity:.25,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:n,labelFontSize:12,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,opacity:1},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:2},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:2},inactive:{labelOpacity:.25,opacity:.25},disabled:{labelOpacity:.25,color:c}},animation:{enter:"fade",exit:"fade",visibility:"fade",update:[{fields:["color"]},{fields:["path"],shape:"key"}]}},combo:{style:{collapsedMaskFill:h,collapsedMaskFontSize:12,collapsedSize:32,color:h,haloLineWidth:12,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:n,labelFontSize:12,labelOpacity:1,lineDash:0,lineWidth:1,opacity:1,padding:10,stroke:f},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{labelOpacity:.25,opacity:.65},disabled:{color:d,labelOpacity:.25,opacity:.25,stroke:p}},animation:{enter:"fade",exit:"fade",visibility:"fade",expand:"combo-collapse-expand",collapse:"combo-collapse-expand",update:[{fields:["x","y"]},{fields:["size","color","stroke"],shape:"key"}]}}}}const fI=dI({bgColor:"#000000",textColor:"#ffffffd9",nodeColor:"#1783ff",nodeColorDisabled:"#d0e4ff",nodeStroke:"#d0e4ff",edgeColor:"#99add1",edgeColorDisabled:"#969696",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696"}),pI=dI({bgColor:"#fff",textColor:"#000000d9",nodeColor:"#1783ff",nodeColorDisabled:"#f0f0f0",nodeStroke:"#000000",edgeColor:"#99add1",edgeColorDisabled:"#d9d9d9",comboColor:"#fdfdfd",comboColorDisabled:"#f0f0f0",comboStroke:"#99add1",comboStrokeDisabled:"#d9d9d9"}),gI={animation:{fade:[{fields:["opacity"]}],translate:[{fields:["x","y"]}],"combo-collapse-expand":[{fields:["x","y"]},{fields:["r","width","height"],shape:"key"}]},behavior:{"zoom-canvas":Kh,"drag-canvas":Vh,"drag-element":Wh,"collapse-expand":zh,"hover-element":Yh,"focus-element":Hh,"create-edge":Fh},combo:{circle:jl,rect:zl},edge:{cubic:sh,line:lh,polyline:hh,quadratic:dh,"cubic-horizontal":uh,"cubic-vertical":ch},layout:{"antv-dagre":class{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},pm),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,e)}))}genericDagreLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{nodeSize:i,align:o,rankdir:a="TB",ranksep:s,nodesep:u,ranksepFunc:c,nodesepFunc:l,edgeLabelSpace:h,ranker:d,nodeOrder:f,begin:p,controlPoints:g,radial:m,sortByCombo:v,preset:y}=r,b=new hp({tree:[]}),E=hm(s||50,c),w=hm(u||50,l);let x=w,M=E;"LR"!==a&&"RL"!==a||(x=E,M=w);const N=fm(i,void 0),S=e.getAllNodes(),C=e.getAllEdges();let k;S.forEach((t=>{const e=N(t),n=M(t),r=e+2*x(t),i=e+2*n,o=t.data.layer;Wt(o)?b.addNode({id:t.id,data:{width:r,height:i,layer:o}}):b.addNode({id:t.id,data:{width:r,height:i}})})),v&&(b.attachTreeStructure("combo"),S.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),C.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==y?void 0:y.length)&&(k=new hp({nodes:y})),((t,e)=>{const{edgeLabelSpace:n,keepNodeOrder:r,prevGraph:i,rankdir:o,ranksep:a}=e;!r&&i&&Ig(t,i);const s=Wg(t);let u;n&&(e.ranksep=Ug(s,{rankdir:o,ranksep:a}));try{u=Dg(s,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}jg(t,s)})(b,{prevGraph:k,edgeLabelSpace:h,keepNodeOrder:!!f,nodeOrder:f||[],acyclicer:"greedy",ranker:d,rankdir:a,nodesep:u,align:o});const T=[0,0];if(p){let t=1/0,e=1/0;b.getAllNodes().forEach((n=>{t>n.data.x&&(t=n.data.x),e>n.data.y&&(e=n.data.y)})),b.getAllEdges().forEach((n=>{var r;null===(r=n.data.points)||void 0===r||r.forEach((n=>{t>n.x&&(t=n.x),e>n.y&&(e=n.y)}))})),T[0]=p[0]-t,T[1]=p[1]-e}const P="LR"===a||"RL"===a;if(m);else{const t=new Set,e="BT"===a||"RL"===a?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+T[0],e.data.y=e.data.y+T[1],t.add(P?e.data.x:e.data.y)}));const n=Array.from(t).sort(e),r=P?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,i=P?(t,e,n)=>{const r=Math.max(e.y,n.y),i=Math.min(e.y,n.y);return t.filter((t=>t.y<=r&&t.y>=i))}:(t,e,n)=>{const r=Math.max(e.x,n.x),i=Math.min(e.x,n.x);return t.filter((t=>t.x<=r&&t.x>=i))};b.getAllEdges().forEach(((t,e)=>{var o;h&&g&&"loop"!==t.data.type&&(t.data.controlPoints=gm(null===(o=t.data.points)||void 0===o?void 0:o.map((({x:t,y:e})=>({x:t+T[0],y:e+T[1]}))),b.getNode(t.source),b.getNode(t.target),n,P,r,i))}))}let A=[];A=b.getAllNodes().map((t=>lm(t)));const O=b.getAllEdges();t&&(A.forEach((t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),O.forEach((t=>{e.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})})));return{nodes:A,edges:O}}))}},"combo-combined":class{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},Yv),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,t,e)}))}genericComboCombinedLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:i,treeKey:o,outerLayout:a}=r,s=e.getAllNodes().filter((t=>!t.data._isCombo)),u=e.getAllNodes().filter((t=>t.data._isCombo)),c=e.getAllEdges(),l=null==s?void 0:s.length;if(!l||1===l)return mm(e,t,i);const h=[],d=new Map;s.forEach((t=>{d.set(t.id,t)}));const f=new Map;u.forEach((t=>{f.set(t.id,t)}));const p=new Map,g=this.getInnerGraphs(e,o,d,f,c,r,p);yield Promise.all(g);const m=new Map,v=[],y=new Map;let b=!0;e.getRoots(o).forEach((t=>{const n=p.get(t.id),r=f.get(t.id)||d.get(t.id),i={id:t.id,data:Object.assign(Object.assign({},t.data),{x:n.data.x||r.data.x,y:n.data.y||r.data.y,fx:n.data.fx||r.data.fx,fy:n.data.fy||r.data.fy,mass:n.data.mass||r.data.mass,size:n.data.size})};v.push(i),m.set(t.id,!0),isNaN(i.data.x)||0===i.data.x||isNaN(i.data.y)||0===i.data.y?(i.data.x=100*Math.random(),i.data.y=100*Math.random()):b=!1,um(e,[t],(e=>{e.id!==t.id&&y.set(e.id,t.id)}),"TB",o)}));const E=[];let w;if(c.forEach((t=>{const e=y.get(t.source)||t.source,n=y.get(t.target)||t.target;e!==n&&m.has(e)&&m.has(n)&&E.push({id:t.id,source:e,target:n,data:{}})})),null==v?void 0:v.length){if(1===v.length)v[0].data.x=i[0],v[0].data.y=i[1];else{const t=new hp({nodes:v,edges:E}),e=a||new Wm;if(b&&$v[e.id]){const e=v.length<100?new Uv:new wm;yield e.assign(t)}w=yield e.execute(t,Object.assign({center:i,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,n)=>(Math.max(...e.data.size)||32)/2+(Math.max(...n.data.size)||32)/2+200}:{}))}p.forEach((t=>{var e;const n=w.nodes.find((e=>e.id===t.id));if(n){const{x:e,y:r}=n.data;t.data.visited=!0,t.data.x=e,t.data.y=r,h.push({id:t.id,data:{x:e,y:r}})}const{x:r,y:i}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{h.push({id:t.id,data:{x:t.data.x+r,y:t.data.y+i}})}))})),p.forEach((({data:t})=>{const{x:e,y:n,visited:r,nodes:i}=t;null==i||i.forEach((t=>{if(!r){const r=h.find((e=>e.id===t.id));r.data.x+=e||0,r.data.y+=n||0}}))}))}t&&h.forEach((t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}));return{nodes:h,edges:c}}))}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:r,comboPadding:i}=t;let o,a,s;if(a=Wt(r)?()=>r:Tt(r)?r:()=>0,e.spacing=a,n)if(Tt(n))o=t=>{const e=n(t),r=a(t);if(im(t.size)){return((t.size[0]>t.size[1]?t.size[0]:t.size[1])+r)/2}return((e||32)+r)/2};else if(im(n)){const t=(n[0]>n[1]?n[0]:n[1])/2;o=e=>t+a(e)/2}else{const t=n/2;o=e=>t+a(e)/2}else o=t=>{const e=a(t);if(t.size){if(im(t.size)){return((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2}if(Rt(t.size)){return((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2}return(t.size+e)/2}return 32+e/2};return e.nodeSize=o,s=Wt(i)?()=>i:im(i)?()=>Math.max.apply(null,i):Tt(i)?i:()=>0,e.comboPadding=s,e}getInnerGraphs(t,e,n,r,i,o,s){const{nodeSize:u,comboPadding:c,spacing:l,innerLayout:h}=o,d=h||new wm({}),f={center:[0,0],preventOverlap:!0,nodeSpacing:l},p=[],g=t=>{let e=(null==c?void 0:c(t))||10;return im(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return t.getRoots(e).forEach((o=>{s.set(o.id,{id:o.id,data:{nodes:[],size:g(o).size}});let c=Promise.resolve();um(t,[o],(o=>{var l;if(!o.data._isCombo)return;const{size:h,padding:p}=g(o);if(null===(l=t.getChildren(o.id,e))||void 0===l?void 0:l.length){const l=s.get(o.id);s.set(o.id,{id:o.id,data:Object.assign({nodes:[]},null==l?void 0:l.data)});const h=new Map,g=t.getChildren(o.id,e).map((t=>{if(t.data._isCombo)return s.has(t.id)||s.set(t.id,{id:t.id,data:Object.assign({},t.data)}),h.set(t.id,!0),s.get(t.id);const e=n.get(t.id)||r.get(t.id);return h.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),m={nodes:g,edges:i.filter((t=>h.has(t.source)&&h.has(t.target)))};let v=1/0;g.forEach((t=>{var e;let{size:n}=t.data;n||(n=(null===(e=s.get(t.id))||void 0===e?void 0:e.data.size)||(null==u?void 0:u(t))||[30,30]),Wt(n)&&(n=[n,n]);const[r,i]=n;v>r&&(v=r),v>i&&(v=i),t.data.size=n})),c=c.then((()=>a(this,void 0,void 0,(function*(){const t=new hp(m),e=yield d.assign(t,f),{minX:n,minY:r,maxX:i,maxY:a}=(t=>{let e=1/0,n=1/0,r=-1/0,i=-1/0;return t.forEach((t=>{let o=t.data.size;im(o)?1===o.length&&(o=[o[0],o[0]]):Wt(o)?o=[o,o]:(void 0===o||isNaN(o))&&(o=[30,30]);const a=[o[0]/2,o[1]/2],s=t.data.x-a[0],u=t.data.x+a[0],c=t.data.y-a[1],l=t.data.y+a[1];e>s&&(e=s),n>c&&(n=c),r<u&&(r=u),i<l&&(i=l)})),{minX:e,minY:n,maxX:r,maxY:i}})(g),u=(i+n)/2,c=(a+r)/2;m.nodes.forEach((t=>{t.data.x-=u,t.data.y-=c}));const l=[Math.max(i-n,v)+2*p,Math.max(a-r,v)+2*p];return s.get(o.id).data.size=l,s.get(o.id).data.nodes=g,e}))))}else s.set(o.id,{id:o.id,data:Object.assign(Object.assign({},o.data),{size:h})});return!0}),"BT",e),p.push(c)})),p}},"compact-box":op.compactBox,"force-atlas2":class{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},eL),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericForceAtlas2Layout(!0,t,e)}))}genericForceAtlas2Layout(t,e,n){return a(this,void 0,void 0,(function*(){const r=e.getAllEdges(),i=e.getAllNodes(),o=this.formatOptions(n,i.length),{width:a,height:s,prune:u,maxIteration:c,nodeSize:l,center:h}=o;if(!(null==i?void 0:i.length)||1===i.length)return mm(e,t,h);const d=i.map((t=>lm(t,[a,s]))),f=r.filter((t=>{const{source:e,target:n}=t;return e!==n})),p=new hp({nodes:d,edges:f}),g=this.getSizes(p,e,l);if(this.run(p,e,c,g,t,o),u){for(let t=0;t<f.length;t+=1){const{source:e,target:n}=f[t],r=p.getDegree(e),i=p.getDegree(e);if(r<=1){const t=p.getNode(n);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(i<=1){const t=p.getNode(e);p.mergeNodeData(n,{x:t.data.x,y:t.data.y})}}const n=Object.assign(Object.assign({},o),{prune:!1,barnesHut:!1});this.run(p,e,100,g,t,n)}return{nodes:d,edges:r}}))}getSizes(t,e,n){const r=t.getAllNodes(),i={};for(let t=0;t<r.length;t+=1){const{id:o,data:a}=r[t];if(i[o]=10,Wt(a.size))i[o]=a.size;else if(im(a.size))isNaN(a.size[0])||(i[o]=Math.max(a.size[0])),isNaN(a.size[1])||(i[o]=Math.max(a.size[1]));else if(Rt(a.size))i[o]=Math.max(a.size.width,a.size.height);else if(Tt(n)){const t=n(e.getNode(o));im(t)?i[o]=Math.max(...t):i[o]=t}else im(n)?i[o]=Math.max(...n):Wt(n)&&(i[o]=n)}return i}formatOptions(t={},e){const n=Object.assign(Object.assign({},this.options),t),{center:r,width:i,height:o,barnesHut:a,prune:s,maxIteration:u,kr:c,kg:l}=n;return n.width=i||"undefined"==typeof window?i:window.innerWidth,n.height=o||"undefined"==typeof window?o:window.innerHeight,n.center=r||[n.width/2,n.height/2],void 0===a&&e>250&&(n.barnesHut=!0),void 0===s&&e>100&&(n.prune=!0),0!==u||s?0===u&&s&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)):(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)),c||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),l||(n.kg=20,e>100&&e<=500?n.kg=10:e>500&&(n.kg=1)),n}run(t,e,n,r,i,o){const{kr:a,barnesHut:s,onTick:u}=o,c=t.getAllNodes();let l=0,h=n;const d={},f={},p={};for(let e=0;e<c.length;e+=1){const{data:n,id:r}=c[e];if(d[r]=[0,0],s){const i={id:e,rx:n.x,ry:n.y,mass:1,g:a,degree:t.getDegree(r)};p[r]=new QR(i)}}for(;h>0;)l=this.oneStep(t,{iter:h,preventOverlapIters:50,krPrime:100,sg:l,forces:d,preForces:f,bodies:p,sizes:r},o),h--,null==u||u({nodes:c,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:r,preventOverlapIters:i,krPrime:o,sg:a,preForces:s,bodies:u,sizes:c}=e;let{forces:l}=e;const{preventOverlap:h,barnesHut:d}=n,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];s[e]=[...l[e]],l[e]=[0,0]}return l=this.getAttrForces(t,r,i,c,l,n),l=d&&(h&&r>i||!h)?this.getOptRepGraForces(t,l,u,n):this.getRepGraForces(t,r,i,l,o,c,n),this.updatePos(t,l,s,a,n)}getAttrForces(t,e,n,r,i,o){const{preventOverlap:a,dissuadeHubs:s,mode:u,prune:c}=o,l=t.getAllEdges();for(let o=0;o<l.length;o+=1){const{source:h,target:d}=l[o],f=t.getNode(h),p=t.getNode(d),g=t.getDegree(h),m=t.getDegree(d);if(c&&(g<=1||m<=1))continue;const v=[p.data.x-f.data.x,p.data.y-f.data.y];let y=Math.hypot(v[0],v[1]);y=y<1e-4?1e-4:y,v[0]=v[0]/y,v[1]=v[1]/y,a&&e<n&&(y=y-r[h]-r[d]);let b=y,E=b;"linlog"===u&&(b=Math.log(1+y),E=b),s&&(b=y/g,E=y/m),a&&e<n&&y<=0?(b=0,E=0):a&&e<n&&y>0&&(b=y,E=y),i[h][0]+=b*v[0],i[d][0]-=E*v[0],i[h][1]+=b*v[1],i[d][1]-=E*v[1]}return i}getOptRepGraForces(t,e,n,r){const{kg:i,center:o,prune:a}=r,s=t.getAllNodes(),u=s.length;let c=9e10,l=-9e10,h=9e10,d=-9e10;for(let e=0;e<u;e+=1){const{id:r,data:i}=s[e];a&&t.getDegree(r)<=1||(n[r].setPos(i.x,i.y),i.x>=l&&(l=i.x),i.x<=c&&(c=i.x),i.y>=d&&(d=i.y),i.y<=h&&(h=i.y))}const f=Math.max(l-c,d-h),p=new JR({xmid:(l+c)/2,ymid:(d+h)/2,length:f,massCenter:o,mass:u}),g=new tL(p);for(let e=0;e<u;e+=1){const{id:r}=s[e];a&&t.getDegree(r)<=1||n[r].in(p)&&g.insert(n[r])}for(let r=0;r<u;r+=1){const{id:u,data:c}=s[r],l=t.getDegree(u);if(a&&l<=1)continue;n[u].resetForce(),g.updateForce(n[u]),e[u][0]-=n[u].fx,e[u][1]-=n[u].fy;const h=[c.x-o[0],c.y-o[1]];let d=Math.hypot(h[0],h[1]);d=d<1e-4?1e-4:d,h[0]=h[0]/d,h[1]=h[1]/d;const f=i*(l+1);e[u][0]-=f*h[0],e[u][1]-=f*h[1]}return e}getRepGraForces(t,e,n,r,i,o,a){const{preventOverlap:s,kr:u,kg:c,center:l,prune:h}=a,d=t.getAllNodes(),f=d.length;for(let a=0;a<f;a+=1){const p=d[a],g=t.getDegree(p.id);for(let c=a+1;c<f;c+=1){const a=d[c],l=t.getDegree(a.id);if(h&&(g<=1||l<=1))continue;const f=[a.data.x-p.data.x,a.data.y-p.data.y];let m=Math.hypot(f[0],f[1]);m=m<1e-4?1e-4:m,f[0]=f[0]/m,f[1]=f[1]/m,s&&e<n&&(m=m-o[p.id]-o[a.id]);let v=u*(g+1)*(l+1)/m;s&&e<n&&m<0?v=i*(g+1)*(l+1):s&&e<n&&0===m?v=0:s&&e<n&&m>0&&(v=u*(g+1)*(l+1)/m),r[p.id][0]-=v*f[0],r[a.id][0]+=v*f[0],r[p.id][1]-=v*f[1],r[a.id][1]+=v*f[1]}const m=[p.data.x-l[0],p.data.y-l[1]],v=Math.hypot(m[0],m[1]);m[0]=m[0]/v,m[1]=m[1]/v;const y=c*(g+1);r[p.id][0]-=y*m[0],r[p.id][1]-=y*m[1]}return r}updatePos(t,e,n,r,i){const{ks:o,tao:a,prune:s,ksmax:u}=i,c=t.getAllNodes(),l=c.length,h=[],d=[];let f=0,p=0,g=r;for(let r=0;r<l;r+=1){const{id:i}=c[r],o=t.getDegree(i);if(s&&o<=1)continue;const a=[e[i][0]-n[i][0],e[i][1]-n[i][1]],u=Math.hypot(a[0],a[1]),l=[e[i][0]+n[i][0],e[i][1]+n[i][1]],g=Math.hypot(l[0],l[1]);h[r]=u,d[r]=g/2,f+=(o+1)*h[r],p+=(o+1)*d[r]}const m=g;g=a*p/f,0!==m&&(g=g>1.5*m?1.5*m:g);for(let n=0;n<l;n+=1){const{id:r,data:i}=c[n],a=t.getDegree(r);if(s&&a<=1)continue;if(Wt(i.fx)&&Wt(i.fy))continue;let l=o*g/(1+g*Math.sqrt(h[n])),d=Math.hypot(e[r][0],e[r][1]);d=d<1e-4?1e-4:d;const f=u/d;l=l>f?f:l;const p=l*e[r][0],m=l*e[r][1];t.mergeNodeData(r,{x:i.x+p,y:i.y+m})}return g}},circular:class{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},vm),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,t,e)}))}genericCircularLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{width:i,height:o,center:a,divisions:s,startAngle:u=0,endAngle:c=2*Math.PI,angleRatio:l,ordering:h,clockwise:d,nodeSpacing:f,nodeSize:p}=r,g=e.getAllNodes(),m=e.getAllEdges(),[v,y,b]=bm(i,o,a),E=null==g?void 0:g.length;if(!E||1===E)return mm(e,t,b);const w=(c-u)/E;let{radius:x,startRadius:M,endRadius:N}=r;if(f){const t=hm(10,f),e=dm(10,p);let n=-1/0;g.forEach((t=>{const r=e(t);n<r&&(n=r)}));let r=0;g.forEach(((e,i)=>{r+=0===i?n||10:(t(e)||0)+(n||10)})),x=r/(2*Math.PI)}else x||M||N?!M&&N?M=N:M&&!N&&(N=M):x=Math.min(y,v)/2;const S=w*l;let C=[];C="topology"===h?ym(e,g):"topology-directed"===h?ym(e,g,!0):"degree"===h?function(t,e){const n=[];return e.forEach(((t,e)=>{n.push(lm(t))})),n.sort(((e,n)=>t.getDegree(e.id,"both")-t.getDegree(n.id,"both"))),n}(e,g):g.map((t=>lm(t)));const k=Math.ceil(E/s);for(let t=0;t<E;++t){let e=x;e||null===M||null===N||(e=M+t*(N-M)/(E-1)),e||(e=10+100*t/(E-1));let n=u+t%k*S+2*Math.PI/s*Math.floor(t/k);d||(n=c-t%k*S-2*Math.PI/s*Math.floor(t/k)),C[t].data.x=b[0]+Math.cos(n)*e,C[t].data.y=b[1]+Math.sin(n)*e}t&&C.forEach((t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}));return{nodes:C,edges:m}}))}},concentric:wm,d3force:class{constructor(t={}){this.options=t,this.id="d3force",this.options=Object.assign(Object.assign({},zy),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericForceLayout(!0,t,e)}))}stop(){var t;null===(t=this.forceSimulation)||void 0===t||t.stop()}tick(t=1){this.forceSimulation.tick(t);const e={nodes:By(this.lastLayoutNodes),edges:Fy(this.lastLayoutEdges)};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),e}genericForceLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),i=e.getAllNodes(),o=e.getAllEdges(),a=i.map((t=>{var e,n;return Object.assign(Object.assign({},lm(t)),{x:null===(e=t.data)||void 0===e?void 0:e.x,y:null===(n=t.data)||void 0===n?void 0:n.y})})),s=o.map((t=>lm(t)));this.lastLayoutNodes=a,this.lastLayoutEdges=s,this.lastAssign=t,this.lastGraph=e;const{alphaMin:u,alphaDecay:c,alpha:l,nodeStrength:h,edgeStrength:d,linkDistance:f,clustering:p,clusterFociStrength:g,clusterEdgeDistance:m,clusterEdgeStrength:v,clusterNodeStrength:y,clusterNodeSize:b,collideStrength:E=1,center:w=[0,0],preventOverlap:x,nodeSize:M,nodeSpacing:N,onTick:S}=r;let{forceSimulation:C}=r;return new Promise((n=>{if(C){if(p){const t=jy();t.nodes(a),t.links(s)}if(C.nodes(a),s){const t=ny().id((t=>t.id)).links(s);d&&t.strength(d),f&&t.distance(f),C.force("link",t)}x&&this.overlapProcess(C,{nodeSize:M,nodeSpacing:N,collideStrength:E}),C.alpha(l).restart();const r=By(a),i=Fy(s);t&&r.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),n({nodes:r,edges:i})}else try{const r=Ly();if(h&&r.strength(h),C=Ry().nodes(a),p){const t=jy();t.centerX(w[0]).centerY(w[1]).template("force").strength(g),s&&t.links(s),a&&t.nodes(a),t.forceLinkDistance(m).forceLinkStrength(v).forceCharge(y).forceNodeSize(b),C.force("group",t)}if(C.force("center",function(t,e){var n,r=1;function i(){var i,o,a=n.length,s=0,u=0;for(i=0;i<a;++i)s+=(o=n[i]).x,u+=o.y;for(s=(s/a-t)*r,u=(u/a-e)*r,i=0;i<a;++i)(o=n[i]).x-=s,o.y-=u}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i}(w[0],w[1])).force("charge",r).alpha(l).alphaDecay(c).alphaMin(u),x&&this.overlapProcess(C,{nodeSize:M,nodeSpacing:N,collideStrength:E}),s){const t=ny().id((t=>t.id)).links(s);d&&t.strength(d),f&&t.distance(f),C.force("link",t)}C.on("tick",(()=>{const n=By(a);null==S||S({nodes:n,edges:Fy(s)}),t&&n.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})))})).on("end",(()=>{const r=By(a);t&&r.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y}))),n({nodes:r,edges:Fy(s)})}))}catch(t){console.warn(t)}this.forceSimulation=C}))}))}overlapProcess(t,e){const{nodeSize:n,nodeSpacing:r,collideStrength:i}=e;let o,a;if(a=Wt(r)?()=>r:Tt(r)?r:()=>0,n)if(Tt(n))o=t=>n(t)+a(t);else if(im(n)){const t=(n[0]>n[1]?n[0]:n[1])/2;o=e=>t+a(e)}else if(Wt(n)){const t=n/2;o=e=>t+a(e)}else o=()=>10;else o=t=>{if(t.size){if(im(t.size)){return(t.size[0]>t.size[1]?t.size[0]:t.size[1])/2+a(t)}if(Rt(t.size)){return(t.size.width>t.size.height?t.size.width:t.size.height)/2+a(t)}return t.size/2+a(t)}return 10+a(t)};t.force("collisionForce",Jv(o).strength(i))}},dagre:ZR,dendrogram:op.dendrogram,force:Wm,fruchterman:class{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},nL),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericFruchtermanLayout(!0,t,e)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(t,e,n){return a(this,void 0,void 0,(function*(){if(this.running)return;const r=this.formatOptions(n),{dimensions:i,width:o,height:a,center:s,clustering:u,nodeClusterBy:c,maxIteration:l,onTick:h}=r,d=e.getAllNodes(),f=e.getAllEdges();if(!(null==d?void 0:d.length)){const t={nodes:[],edges:f};return this.lastResult=t,t}if(1===d.length){t&&e.mergeNodeData(d[0].id,{x:s[0],y:s[1],z:3===i?s[2]:void 0});const n={nodes:[Object.assign(Object.assign({},d[0]),{data:Object.assign(Object.assign({},d[0].data),{x:s[0],y:s[1],z:3===i?s[2]:void 0})})],edges:f};return this.lastResult=n,n}const p=d.map((t=>lm(t,[o,a]))),g=new hp({nodes:p,edges:f}),m={};if(u&&p.forEach((t=>{const e=t.data[c];m[e]||(m[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=f,this.lastAssign=t,this.lastGraph=g,this.lastOptions=r,this.lastClusterMap=m,"undefined"==typeof window)return;let v=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(g,m,r),t&&p.forEach((({id:t,data:n})=>e.mergeNodeData(t,{x:n.x,y:n.y,z:3===i?n.z:void 0}))),null==h||h({nodes:p,edges:f}),v++,v>=l&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:f}))):n({nodes:p,edges:f})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:n,nodeClusterBy:r}=e,{center:i,width:o,height:a}=e;return e.width=o||"undefined"==typeof window?o:window.innerWidth,e.height=a||"undefined"==typeof window?a:window.innerHeight,e.center=i||[e.width/2,e.height/2],e.clustering=n&&!!r,e}runOneStep(t,e,n){const{dimensions:r,height:i,width:o,gravity:a,center:s,speed:u,clustering:c,nodeClusterBy:l,clusterGravity:h}=n,d=i*o,f=Math.sqrt(d)/10,p=t.getAllNodes(),g=d/(p.length+1),m=Math.sqrt(g),v={};if(this.applyCalculate(t,v,m,g),c){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;p.forEach((t=>{const{data:n}=t,r=e[n[l]];Wt(n.x)&&(r.cx+=n.x),Wt(n.y)&&(r.cy+=n.y),r.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=h||a;p.forEach(((n,r)=>{const{id:i,data:o}=n;if(!Wt(o.x)||!Wt(o.y))return;const a=e[o[l]],s=Math.sqrt((o.x-a.cx)*(o.x-a.cx)+(o.y-a.cy)*(o.y-a.cy)),u=m*t;v[i].x-=u*(o.x-a.cx)/s,v[i].y-=u*(o.y-a.cy)/s}))}p.forEach(((t,e)=>{const{id:n,data:i}=t;if(!Wt(i.x)||!Wt(i.y))return;const o=.01*m*a;v[n].x-=o*(i.x-s[0]),v[n].y-=o*(i.y-s[1]),3===r&&(v[n].z-=o*(i.z-s[2]))})),p.forEach(((e,n)=>{const{id:i,data:o}=e;if(Wt(o.fx)&&Wt(o.fy))return o.x=o.fx,o.y=o.fy,void(3===r&&(o.z=o.fz));if(!Wt(o.x)||!Wt(o.y))return;const a=Math.sqrt(v[i].x*v[i].x+v[i].y*v[i].y+(3===r?v[i].z*v[i].z:0));if(a>0){const e=Math.min(f*(u/800),a);t.mergeNodeData(i,{x:o.x+v[i].x/a*e,y:o.y+v[i].y/a*e,z:3===r?o.z+v[i].z/a*e:void 0})}}))}applyCalculate(t,e,n,r){this.calRepulsive(t,e,r),this.calAttractive(t,e,n)}calRepulsive(t,e,n){const r=t.getAllNodes();r.forEach((({data:t,id:i},o)=>{e[i]={x:0,y:0,z:0},r.forEach((({data:r,id:a},s)=>{if(o<=s||!Wt(t.x)||!Wt(r.x)||!Wt(t.y)||!Wt(r.y))return;let u=t.x-r.x,c=t.y-r.y,l=3===this.options.dimensions?t.z-r.z:0,h=u*u+c*c+l*l;0===h&&(h=1,u=.01,c=.01,l=.01);const d=n/h,f=u*d,p=c*d,g=l*d;e[i].x+=f,e[i].y+=p,e[a].x-=f,e[a].y-=p,3===this.options.dimensions&&(e[i].z+=g,e[a].z-=g)}))}))}calAttractive(t,e,n){t.getAllEdges().forEach((r=>{const{source:i,target:o}=r;if(!i||!o||i===o)return;const{data:a}=t.getNode(i),{data:s}=t.getNode(o);if(!(Wt(s.x)&&Wt(a.x)&&Wt(s.y)&&Wt(a.y)))return;const u=s.x-a.x,c=s.y-a.y,l=3===this.options.dimensions?s.z-a.z:0,h=Math.sqrt(u*u+c*c+l*l)/n,d=u*h,f=c*h,p=l*h;e[i].x+=d,e[i].y+=f,e[o].x-=d,e[o].y-=f,3===this.options.dimensions&&(e[i].z+=p,e[o].z-=p)}))}},grid:class{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},rL),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericGridLayout(!0,t,e)}))}genericGridLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{begin:i=[0,0],condense:o,preventOverlapPadding:a,preventOverlap:s,rows:u,cols:c,nodeSpacing:l,nodeSize:h,width:d,height:f,position:p}=r;let{sortBy:g}=r;const m=e.getAllNodes(),v=e.getAllEdges(),y=null==m?void 0:m.length;if(!y||1===y)return mm(e,t,i);const b=m.map((t=>lm(t)));"id"===g||Bt(g)&&void 0!==b[0].data[g]||(g="degree"),"degree"===g?b.sort(((t,n)=>e.getDegree(n.id,"both")-e.getDegree(t.id,"both"))):"id"===g?b.sort(((t,e)=>Wt(e.id)&&Wt(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):b.sort(((t,e)=>e.data[g]-t.data[g]));const E=d||"undefined"==typeof window?d:window.innerWidth,w=f||"undefined"==typeof window?f:window.innerHeight,x=y,M={rows:u,cols:c};if(null!=u&&null!=c)M.rows=u,M.cols=c;else if(null!=u&&null==c)M.rows=u,M.cols=Math.ceil(x/M.rows);else if(null==u&&null!=c)M.cols=c,M.rows=Math.ceil(x/M.cols);else{const t=Math.sqrt(x*w/E);M.rows=Math.round(t),M.cols=Math.round(E/w*t)}if(M.rows=Math.max(M.rows,1),M.cols=Math.max(M.cols,1),M.cols*M.rows>x){const t=iL(M),e=oL(M);(t-1)*e>=x?iL(M,t-1):(e-1)*t>=x&&oL(M,e-1)}else for(;M.cols*M.rows<x;){const t=iL(M),e=oL(M);(e+1)*t>=x?oL(M,e+1):iL(M,t+1)}let N=o?0:E/M.cols,S=o?0:w/M.rows;if(s||l){const t=hm(10,l),n=dm(30,h,!1);b.forEach((r=>{r.data.x&&r.data.y||(r.data.x=0,r.data.y=0);const i=e.getNode(r.id),o=n(i)||30;let s,u;im(o)?(s=o[0],u=o[1]):(s=o,u=o);const c=void 0!==t?t(r):a,l=s+c,h=u+c;N=Math.max(N,l),S=Math.max(S,h)}))}const C={},k={row:0,col:0},T={};for(let t=0;t<b.length;t++){const n=b[t];let r;if(p&&(r=p(e.getNode(n.id))),r&&(void 0!==r.row||void 0!==r.col)){const t={row:r.row,col:r.col};if(void 0===t.col)for(t.col=0;aL(C,t);)t.col++;else if(void 0===t.row)for(t.row=0;aL(C,t);)t.row++;T[n.id]=t,sL(C,t)}cL(n,i,N,S,T,M,k,C)}const P={nodes:b,edges:v};return t&&b.forEach((t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),P}))}},indented:op.indented,mds:Uv,mindmap:op.mindmap,radial:class{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},fL),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericRadialLayout(!0,t,e)}))}genericRadialLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{width:i,height:o,center:a,focusNode:s,unitRadius:u,nodeSize:c,nodeSpacing:l,strictRadial:h,preventOverlap:d,maxPreventOverlapIteration:f,sortBy:p,linkDistance:g=50,sortStrength:m=10,maxIteration:v=1e3}=r,y=e.getAllNodes(),b=e.getAllEdges(),E=i||"undefined"==typeof window?i:window.innerWidth,w=o||"undefined"==typeof window?o:window.innerHeight,x=a||[E/2,w/2];if(!(null==y?void 0:y.length)||1===y.length)return mm(e,t,x);let M=y[0];if(Bt(s)){for(let t=0;t<y.length;t++)if(y[t].id===s){M=y[t];break}}else M=s||y[0];const N=mL(y,M.id),S=am({nodes:y,edges:b},!1),C=om(S),k=yL(C,N);vL(C,N,k+1);const T=C[N];let P=E-x[0]>x[0]?x[0]:E-x[0],A=w-x[1]>x[1]?x[1]:w-x[1];0===P&&(P=E/2),0===A&&(A=w/2);const O=Math.min(P,A),_=Math.max(...T),R=[],L=u||O/_;T.forEach(((t,e)=>{R[e]=t*L}));const D=pL(y,C,g,R,L,p,m),I=gL(D),j=((t,e,n)=>{try{const n=Gv.mul(Gv.pow(e,2),-.5),r=n.mean("row"),i=n.mean("column"),o=n.mean();n.add(o).subRowVector(r).subColumnVector(i);const a=new Vv(n),s=Gv.sqrt(a.diagonalMatrix).diagonal();return a.leftSingularVectors.toJSON().map((e=>Gv.mul([e],[s]).toJSON()[0].splice(0,t)))}catch(t){const r=[];for(let t=0;t<e.length;t++){const t=Math.random()*n,e=Math.random()*n;r.push([t,e])}return r}})(g,D,g);let z,B=j.map((([t,e])=>({x:(isNaN(t)?Math.random()*g:t)-j[N][0],y:(isNaN(e)?Math.random()*g:e)-j[N][1]})));if(this.run(v,B,I,D,R,N),d){z=fm(c,l);const t={nodes:y,nodeSizeFunc:z,positions:B,radii:R,height:w,width:E,strictRadial:Boolean(h),focusIdx:N,iterations:f||200,k:B.length/4.5};B=((t,e)=>{const n=Object.assign(Object.assign({},lL),e),{positions:r,iterations:i,width:o,k:a,speed:s=100,strictRadial:u,focusIdx:c,radii:l=[],nodeSizeFunc:h}=n,d=t.getAllNodes(),f=[],p=o/10;for(let t=0;t<i;t++)r.forEach(((t,e)=>{f[e]={x:0,y:0}})),hL(d,r,f,a,l,h),dL(r,f,s,u,c,p,o,l);return r})(e,t)}const F=[];B.forEach(((t,e)=>{const n=lm(y[e]);n.data.x=t.x+x[0],n.data.y=t.y+x[1],F.push(n)})),t&&F.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:F,edges:b}}))}run(t,e,n,r,i,o){for(let a=0;a<=t;a++){const s=a/t;this.oneIteration(s,e,i,r,n,o)}}oneIteration(t,e,n,r,i,o){const a=1-t;e.forEach(((s,u)=>{const c=sm(s,{x:0,y:0}),l=0===c?0:1/c;if(u===o)return;let h=0,d=0,f=0;e.forEach(((t,e)=>{if(u===e)return;const n=sm(s,t),o=0===n?0:1/n,a=r[e][u];f+=i[u][e],h+=i[u][e]*(t.x+a*(s.x-t.x)*o),d+=i[u][e]*(t.y+a*(s.y-t.y)*o)}));const p=0===n[u]?0:1/n[u];f*=a,f+=t*p*p,h*=a,h+=t*p*s.x*l,s.x=h/f,d*=a,d+=t*p*s.y*l,s.y=d/f}))}},random:class{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},bL),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericRandomLayout(!0,t,e)}))}genericRandomLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{center:i,width:o,height:a}=r,s=e.getAllNodes(),u=o||"undefined"==typeof window?o:window.innerWidth,c=a||"undefined"==typeof window?a:window.innerHeight,l=i||[u/2,c/2],h=[];s&&s.forEach((t=>{h.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+l[0],y:.9*(Math.random()-.5)*c+l[1]}})})),t&&h.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:h,edges:e.getAllEdges()}}))}}},node:{circle:kl,ellipse:Al,image:_l,rect:Rl,star:Ll,triangle:Dl,diamond:Pl,hexagon:Ol},palette:{spectral:["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],oranges:["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],greens:["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],blues:["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"]},theme:{dark:fI,light:pI},plugin:{"grid-line":YL,watermark:uI,tooltip:oI,contextmenu:$L,toolbar:iI,legend:rI}},mI={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{}};function vI(t,e,n){mI[t][e]?console.error(`The extension ${e} of ${t} has been registered before.`):Object.assign(mI[t],{[e]:n})}function yI(t,e){const n=mI[t]?.[e];if(n)return n}ds.enableCSSParsing=!1,Object.entries(gI).forEach((([t,e])=>{Object.entries(e).forEach((([e,n])=>{vI(t,e,n)}))}));class bI{type;constructor(t){this.type=t}}class EI extends bI{data;constructor(t,e){super(t),this.data=e}}class wI extends bI{animationType;animation;data;constructor(t,e,n,r){super(t),this.animationType=e,this.animation=n,this.data=r}}class xI extends bI{elementType;data;constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class MI extends bI{data;constructor(t,e){super(t),this.data=e}}function NI(t,e){t.emit(e.type,e)}function SI(t,e){const{datum:n,index:r,elementData:i}=e;return Tt(t)?t(n,r,i):Object.fromEntries(Object.entries(t).map((([t,e])=>Tt(e)?[t,e(n,r,i)]:[t,e])))}function CI(t){return t.style?.zIndex??Ah("zIndex")??0}class kI extends Dh{currentTarget=null;category="behavior";constructor(t){super(t),this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.addEventListener(t,this.forwardContainerEvents)}));const n=this.context.canvas.document;n&&[t.CanvasEvent.CLICK,t.CanvasEvent.DBLCLICK,t.CanvasEvent.POINTER_OVER,t.CanvasEvent.POINTER_LEAVE,t.CanvasEvent.POINTER_ENTER,t.CanvasEvent.POINTER_MOVE,t.CanvasEvent.POINTER_OUT,t.CanvasEvent.POINTER_DOWN,t.CanvasEvent.POINTER_UP,t.CanvasEvent.CONTEXT_MENU,t.CanvasEvent.DRAG_START,t.CanvasEvent.DRAG,t.CanvasEvent.DRAG_END,t.CanvasEvent.DRAG_ENTER,t.CanvasEvent.DRAG_OVER,t.CanvasEvent.DRAG_LEAVE,t.CanvasEvent.DROP,t.CanvasEvent.WHEEL].forEach((t=>{n.addEventListener(t,this.forwardCanvasEvents)}))}forwardCanvasEvents=e=>{const{target:n}=e,r=function(t){if(!t)return null;if(t instanceof Vs)return{type:"canvas",element:t};let e=t;for(;e;){if(fh(e))return{type:"node",element:e};if(ph(e))return{type:"edge",element:e};if(gh(e))return{type:"combo",element:e};e=e.parentElement}return null}(n);if(!r)return;const{graph:i,canvas:o}=this.context,{type:a,element:s}=r,{type:u,detail:c,button:l}=e,h={...e,target:s,targetType:a,originalTarget:n};if(u===t.CanvasEvent.POINTER_MOVE&&(this.currentTarget!==s&&(this.currentTarget&&i.emit(`${a}:${t.CanvasEvent.POINTER_LEAVE}`,{...h,target:this.currentTarget}),s&&i.emit(`${a}:${t.CanvasEvent.POINTER_ENTER}`,h)),this.currentTarget=s),u===t.CanvasEvent.CLICK&&2===l||(i.emit(`${a}:${u}`,h),i.emit(u,h)),u===t.CanvasEvent.CLICK&&2===c&&(i.emit(`${a}:${t.CanvasEvent.DBLCLICK}`,h),i.emit(t.CanvasEvent.DBLCLICK,h)),u===t.CanvasEvent.POINTER_DOWN&&2===l){const e={...h,preventDefault:()=>{o.getContainer()?.addEventListener(t.CanvasEvent.CONTEXT_MENU,(t=>t.preventDefault()),{once:!0})}};i.emit(`${a}:${t.CanvasEvent.CONTEXT_MENU}`,e),i.emit(t.CanvasEvent.CONTEXT_MENU,e)}};forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)};destroy(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.removeEventListener(t,this.forwardContainerEvents)})),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}function TI(t,e){var n=e.r;t.arc(n,n,n,0,2*Math.PI,!1)}function PI(t,e){var n=e.rx,r=e.ry;if(t.ellipse)t.ellipse(n,r,n,r,0,0,2*Math.PI,!1);else{var i=n>r?n:r,o=n>r?1:n/r,a=n>r?r/n:1;t.save(),t.scale(o,a),t.arc(i,i,i,0,2*Math.PI)}}function AI(t,e){var n,r,i=e.x1,o=e.y1,a=e.x2,s=e.y2,u=e.defX,c=void 0===u?0:u,l=e.defY,h=void 0===l?0:l,d=e.markerStart,f=e.markerEnd,p=e.markerStartOffset,g=e.markerEndOffset,m=0,v=0,y=0,b=0,E=0;d&&Es(d)&&p&&(n=a-i,r=s-o,E=Math.atan2(r,n),m=Math.cos(E)*(p||0),v=Math.sin(E)*(p||0)),f&&Es(f)&&g&&(n=i-a,r=o-s,E=Math.atan2(r,n),y=Math.cos(E)*(g||0),b=Math.sin(E)*(g||0)),t.moveTo(i-c+m,o-h+v),t.lineTo(a-c+y,s-h+b)}function OI(t,e){var n,r,i=e.defX,o=void 0===i?0:i,a=e.defY,s=void 0===a?0:a,u=e.markerStart,l=e.markerEnd,h=e.markerStartOffset,d=e.markerEndOffset,f=e.path,p=f.absolutePath,g=f.segments,m=0,v=0,y=0,b=0,E=0;if(u&&Es(u)&&h){var w=c(u.parentNode.getStartTangent(),2),x=w[0],M=w[1];n=x[0]-M[0],r=x[1]-M[1],E=Math.atan2(r,n),m=Math.cos(E)*(h||0),v=Math.sin(E)*(h||0)}if(l&&Es(l)&&d){var N=c(l.parentNode.getEndTangent(),2);x=N[0],M=N[1];n=x[0]-M[0],r=x[1]-M[1],E=Math.atan2(r,n),y=Math.cos(E)*(d||0),b=Math.sin(E)*(d||0)}for(var S=0;S<p.length;S++){var C=p[S],k=C[0],T=p[S+1],P=0===S&&(0!==m||0!==v),A=(S===p.length-1||T&&("M"===T[0]||"Z"===T[0]))&&0!==y&&0!==b;switch(k){case"M":P?(t.moveTo(C[1]-o+m,C[2]-s+v),t.lineTo(C[1]-o,C[2]-s)):t.moveTo(C[1]-o,C[2]-s);break;case"L":A?t.lineTo(C[1]-o+y,C[2]-s+b):t.lineTo(C[1]-o,C[2]-s);break;case"Q":t.quadraticCurveTo(C[1]-o,C[2]-s,C[3]-o,C[4]-s),A&&t.lineTo(C[3]-o+y,C[4]-s+b);break;case"C":t.bezierCurveTo(C[1]-o,C[2]-s,C[3]-o,C[4]-s,C[5]-o,C[6]-s),A&&t.lineTo(C[5]-o+y,C[6]-s+b);break;case"A":var O=g[S].arcParams,_=O.cx,R=O.cy,L=O.rx,D=O.ry,I=O.startAngle,j=O.endAngle,z=O.xRotation,B=O.sweepFlag;if(t.ellipse)t.ellipse(_-o,R-s,L,D,z,I,j,!!(1-B));else{var F=L>D?L:D,G=L>D?1:L/D,V=L>D?D/L:1;t.translate(_-o,R-s),t.rotate(z),t.scale(G,V),t.arc(0,0,F,I,j,!!(1-B)),t.scale(1/G,1/V),t.rotate(-z),t.translate(-(_-o),-(R-s))}A&&t.lineTo(C[6]-o+y,C[7]-s+b);break;case"Z":t.closePath()}}}function _I(t,e){var n,r,i=e.defX,o=void 0===i?0:i,a=e.defY,s=void 0===a?0:a,u=e.markerStart,c=e.markerEnd,l=e.markerStartOffset,h=e.markerEndOffset,d=e.points.points,f=d.length,p=d[0][0]-o,g=d[0][1]-s,m=d[f-1][0]-o,v=d[f-1][1]-s,y=0,b=0,E=0,w=0,x=0;u&&Es(u)&&l&&(n=d[1][0]-d[0][0],r=d[1][1]-d[0][1],x=Math.atan2(r,n),y=Math.cos(x)*(l||0),b=Math.sin(x)*(l||0)),c&&Es(c)&&h&&(n=d[f-1][0]-d[0][0],r=d[f-1][1]-d[0][1],x=Math.atan2(r,n),E=Math.cos(x)*(h||0),w=Math.sin(x)*(h||0)),t.moveTo(p+(y||E),g+(b||w));for(var M=1;M<f-1;M++){var N=d[M];t.lineTo(N[0]-o,N[1]-s)}t.lineTo(m,v)}function RI(t,e){var n,r,i=e.defX,o=void 0===i?0:i,a=e.defY,s=void 0===a?0:a,u=e.markerStart,c=e.markerEnd,l=e.markerStartOffset,h=e.markerEndOffset,d=e.points.points,f=d.length,p=d[0][0]-o,g=d[0][1]-s,m=d[f-1][0]-o,v=d[f-1][1]-s,y=0,b=0,E=0,w=0,x=0;u&&Es(u)&&l&&(n=d[1][0]-d[0][0],r=d[1][1]-d[0][1],x=Math.atan2(r,n),y=Math.cos(x)*(l||0),b=Math.sin(x)*(l||0)),c&&Es(c)&&h&&(n=d[f-2][0]-d[f-1][0],r=d[f-2][1]-d[f-1][1],x=Math.atan2(r,n),E=Math.cos(x)*(h||0),w=Math.sin(x)*(h||0)),t.moveTo(p+y,g+b);for(var M=1;M<f-1;M++){var N=d[M];t.lineTo(N[0]-o,N[1]-s)}t.lineTo(m+E,v+w)}function LI(t,e){var n=e.radius,r=e.width,i=e.height,o=r,a=i;if(n&&n.some((function(t){return 0!==t}))){var s=r>0?1:-1,u=i>0?1:-1,l=s+u===0,h=c(n.map((function(t){return Vt(t,0,Math.min(Math.abs(o)/2,Math.abs(a)/2))})),4),d=h[0],f=h[1],p=h[2],g=h[3];t.moveTo(s*d,0),t.lineTo(o-s*f,0),0!==f&&t.arc(o-s*f,u*f,f,-u*Math.PI/2,s>0?0:Math.PI,l),t.lineTo(o,a-u*p),0!==p&&t.arc(o-s*p,a-u*p,p,s>0?0:Math.PI,u>0?Math.PI/2:1.5*Math.PI,l),t.lineTo(s*g,a),0!==g&&t.arc(s*g,a-u*g,g,u>0?Math.PI/2:-Math.PI/2,s>0?Math.PI:0,l),t.lineTo(0,u*d),0!==d&&t.arc(s*d,u*d,d,s>0?Math.PI:0,u>0?1.5*Math.PI:Math.PI/2,l)}else t.rect(0,0,o,a)}var DI=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.name="canvas-path-generator",e}return r(e,t),e.prototype.init=function(){var t,e=((t={})[$n.CIRCLE]=TI,t[$n.ELLIPSE]=PI,t[$n.RECT]=LI,t[$n.LINE]=AI,t[$n.POLYLINE]=RI,t[$n.POLYGON]=_I,t[$n.PATH]=OI,t[$n.TEXT]=void 0,t[$n.GROUP]=void 0,t[$n.IMAGE]=void 0,t[$n.HTML]=void 0,t[$n.MESH]=void 0,t);this.context.pathGeneratorFactory=e},e.prototype.destroy=function(){delete this.context.pathGeneratorFactory},e}(Xn),II=Z(),jI=Z(),zI=Z(),BI=E(),FI=function(){function t(){var t=this;this.isHit=function(e,n,r,i){var o=t.context.pointInPathPickerFactory[e.nodeName];if(o){var a=C(BI,r),s=lt(jI,nt(zI,n[0],n[1],0),a),u=e.getGeometryBounds().halfExtents,c=e.parsedStyle.anchor;if(s[0]+=(c&&c[0]||0)*u[0]*2,s[1]+=(c&&c[1]||0)*u[1]*2,o(e,new xr(s[0],s[1]),i,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var r=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),i=t.context.pathGeneratorFactory[e.nodeName];return i&&(r.beginPath(),i(r,e.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return t.prototype.apply=function(e,n){var r,i=this,o=e.renderingService,u=e.renderingContext;this.context=e,this.runtime=n;var c=null===(r=u.root)||void 0===r?void 0:r.ownerDocument;o.hooks.pick.tapPromise(t.tag,(function(t){return a(i,void 0,void 0,(function(){return s(this,(function(e){return[2,this.pick(c,t)]}))}))})),o.hooks.pickSync.tap(t.tag,(function(t){return i.pick(c,t)}))},t.prototype.pick=function(t,e){var n,r,i=e.topmost,o=e.position,a=o.x,s=o.y,c=nt(II,a,s,0),l=t.elementsFromBBox(c[0],c[1],c[0],c[1]),h=[];try{for(var d=u(l),f=d.next();!f.done;f=d.next()){var p=f.value,g=p.getWorldTransform();if(this.isHit(p,c,g,!1)){var m=ua(p);if(m){var v=m.parsedStyle.clipPath;if(this.isHit(v,c,v.getWorldTransform(),!0)){if(i)return e.picked=[p],e;h.push(p)}}else{if(i)return e.picked=[p],e;h.push(p)}}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return e.picked=h,e},t.tag="CanvasPicker",t}();function GI(t,e,n){var r=t.parsedStyle,i=r.r,o=r.fill,a=r.stroke,s=r.lineWidth,u=r.increasedLineWidthForHitTesting,l=r.pointerEvents,h=((s||0)+(u||0))/2,d=kn(i,i,e.x,e.y),f=c(da(l,o,a),2),p=f[0],g=f[1];return p&&g||n?d<=i+h:p?d<=i:!!g&&(d>=i-h&&d<=i+h)}function VI(t,e,n,r){return t/(n*n)+e/(r*r)}function WI(t,e,n){var r=t.parsedStyle,i=r.rx,o=r.ry,a=r.fill,s=r.stroke,u=r.lineWidth,l=r.increasedLineWidthForHitTesting,h=r.pointerEvents,d=e.x,f=e.y,p=c(da(h,a,s),2),g=p[0],m=p[1],v=((u||0)+(l||0))/2,y=(d-i)*(d-i),b=(f-o)*(f-o);return g&&m||n?VI(y,b,i+v,o+v)<=1:g?VI(y,b,i,o)<=1:!!m&&(VI(y,b,i-v,o-v)>=1&&VI(y,b,i+v,o+v)<=1)}function UI(t,e,n,r,i,o){return i>=t&&i<=t+n&&o>=e&&o<=e+r}function HI(t,e,n,r,i,o,a,s){var u=(Math.atan2(s-e,a-t)+2*Math.PI)%(2*Math.PI),c={x:t+n*Math.cos(u),y:e+n*Math.sin(u)};return kn(c.x,c.y,a,s)<=o/2}function qI(t,e,n,r,i,o,a){var s=Math.min(t,n),u=Math.max(t,n),c=Math.min(e,r),l=Math.max(e,r),h=i/2;return o>=s-h&&o<=u+h&&a>=c-h&&a<=l+h&&In(t,e,n,r,o,a)<=i/2}function $I(t,e,n,r,i){var o=t.length;if(o<2)return!1;for(var a=0;a<o-1;a++){if(qI(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,n,r))return!0}if(i){var s=t[0],u=t[o-1];if(qI(s[0],s[1],u[0],u[1],e,n,r))return!0}return!1}var YI=1e-6;function KI(t){return Math.abs(t)<YI?0:t<0?-1:1}function XI(t,e,n){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}function ZI(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o=0;o<i;o++){var a=t[o],s=t[(o+1)%i];if(XI(a,s,[e,n]))return!0;KI(a[1]-n)>0!=KI(s[1]-n)>0&&KI(e-(n-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])<0&&(r=!r)}return r}function QI(t,e,n){for(var r=!1,i=0;i<t.length;i++){if(r=ZI(t[i],e,n))break}return r}function JI(t,e,n){var r=t.parsedStyle,i=r.x1,o=r.y1,a=r.x2,s=r.y2,u=r.lineWidth,l=r.increasedLineWidthForHitTesting,h=r.defX,d=void 0===h?0:h,f=r.defY,p=void 0===f?0:f;return!(!c(da(r.pointerEvents,r.fill,r.stroke),2)[1]&&!n||!u)&&qI(i,o,a,s,(u||0)+(l||0),e.x+d,e.y+p)}function tj(t,e,n,r,i,o){var a=t.parsedStyle,s=a.lineWidth,u=a.increasedLineWidthForHitTesting,l=a.stroke,h=a.fill,d=a.defX,f=void 0===d?0:d,p=a.defY,g=void 0===p?0:p,m=a.path,v=a.pointerEvents,y=m.segments,b=m.hasArc,E=m.polylines,w=m.polygons,x=c(da(v,(null==w?void 0:w.length)&&h,l),2),M=x[0],N=x[1],S=Xi(t),C=!1;return M||n?C=b?r(t,e):QI(w,e.x+f,e.y+g)||QI(E,e.x+f,e.y+g):((N||n)&&(C=function(t,e,n,r,i){for(var o=!1,a=e/2,s=0;s<t.length;s++){var u=t[s],c=u.currentPoint,l=u.params,h=u.prePoint,d=u.box;if(!d||UI(d.x-a,d.y-a,d.width+e,d.height+e,n,r))switch(u.command){case"L":case"Z":if(o=qI(h[0],h[1],c[0],c[1],e,n,r))return!0;break;case"Q":if(o=Hn(h[0],h[1],l[1],l[2],l[3],l[4],n,r)<=e/2)return!0;break;case"C":if(o=Fn(h[0],h[1],l[1],l[2],l[3],l[4],l[5],l[6],n,r,i)<=e/2)return!0;break;case"A":u.cubicParams||(u.cubicParams=Oe(h[0],h[1],l[1],l[2],l[3],l[4],l[5],l[6],l[7],void 0));for(var f=u.cubicParams,p=h,g=0;g<f.length;g+=6){var m=Fn(p[0],p[1],f[g],f[g+1],f[g+2],f[g+3],f[g+4],f[g+5],n,r,i);if(p=[f[g+4],f[g+5]],o=m<=e/2)return!0}}}return o}(y,(s||0)+(u||0),e.x+f,e.y+g,S)),C)}function ej(t,e,n){var r=t.parsedStyle,i=r.stroke,o=r.fill,a=r.lineWidth,s=r.increasedLineWidthForHitTesting,u=r.points,l=r.defX,h=void 0===l?0:l,d=r.defY,f=void 0===d?0:d,p=c(da(r.pointerEvents,o,i),2),g=p[0],m=!1;return(p[1]||n)&&(m=$I(u.points,(a||0)+(s||0),e.x+h,e.y+f,!0)),m||!g&&!n||(m=ZI(u.points,e.x+h,e.y+f)),m}function nj(t,e,n){var r=t.parsedStyle,i=r.lineWidth,o=r.increasedLineWidthForHitTesting,a=r.points,s=r.defX,u=void 0===s?0:s,l=r.defY,h=void 0===l?0:l;return!(!c(da(r.pointerEvents,r.fill,r.stroke),2)[1]&&!n||!i)&&$I(a.points,(i||0)+(o||0),e.x+u,e.y+h,!1)}function rj(t,e,n,r,i){var o=t.parsedStyle,a=o.radius,s=o.fill,u=o.stroke,l=o.lineWidth,h=o.increasedLineWidthForHitTesting,d=o.width,f=o.height,p=c(da(o.pointerEvents,s,u),2),g=p[0],m=p[1],v=(l||0)+(h||0);if(a&&a.some((function(t){return 0!==t}))){var y=!1;return(m||n)&&(y=function(t,e,n,r,i,o,a,s){var u=c(i,4),l=u[0],h=u[1],d=u[2],f=u[3];return qI(t+l,e,t+n-h,e,o,a,s)||qI(t+n,e+h,t+n,e+r-d,o,a,s)||qI(t+n-d,e+r,t+f,e+r,o,a,s)||qI(t,e+r-f,t,e+l,o,a,s)||HI(t+n-h,e+h,h,Math.PI,Math.PI,o,a,s)||HI(t+n-d,e+r-d,d,0,Math.PI,o,a,s)||HI(t+f,e+r-f,f,Math.PI,Math.PI,o,a,s)||HI(t+l,e+l,l,Math.PI,Math.PI,o,a,s)}(0,0,d,f,a.map((function(t){return Vt(t,0,Math.min(Math.abs(d)/2,Math.abs(f)/2))})),v,e.x,e.y)),y||!g&&!n||(y=r(t,e)),y}var b=v/2;return g&&m||n?UI(0-b,0-b,d+b,f+b,e.x,e.y):g?UI(0,0,d,f,e.x,e.y):!!m&&function(t,e,n,r,i,o,a){var s=i/2;return UI(t-s,e-s,n,i,o,a)||UI(t+n-s,e-s,i,r,o,a)||UI(t+s,e+r-s,n,i,o,a)||UI(t-s,e+s,i,r,o,a)}(0,0,d,f,v,e.x,e.y)}function ij(t,e,n,r,i,o){var a=t.parsedStyle,s=a.pointerEvents,u=a.width,c=a.height;if("non-transparent-pixel"===s){var l=i.config.offscreenCanvas,h=o.offscreenCanvasCreator.getOrCreateCanvas(l),d=o.offscreenCanvasCreator.getOrCreateContext(l,{willReadFrequently:!0});return h.width=u,h.height=c,i.defaultStyleRendererFactory[$n.IMAGE].render(d,t.parsedStyle,t,void 0,void 0,void 0),d.getImageData(e.x,e.y,1,1).data.every((function(t){return 0!==t}))}return!0}var oj=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.name="canvas-picker",e}return r(e,t),e.prototype.init=function(){var t,e=((t={})[$n.CIRCLE]=GI,t[$n.ELLIPSE]=WI,t[$n.RECT]=rj,t[$n.LINE]=JI,t[$n.POLYLINE]=nj,t[$n.POLYGON]=ej,t[$n.PATH]=tj,t[$n.TEXT]=function(){return!0},t[$n.GROUP]=null,t[$n.IMAGE]=ij,t[$n.HTML]=null,t[$n.MESH]=null,t);this.context.pointInPathPickerFactory=e,this.addRenderingPlugin(new FI)},e.prototype.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},e}(Xn),aj=function(){function t(t){this.canvasRendererPluginOptions=t,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=E(),this.dprMatrix=E(),this.tmpMat4=E(),this.vec3a=Z(),this.vec3b=Z(),this.vec3c=Z(),this.vec3d=Z()}return t.prototype.apply=function(e,n){var r=this;this.context=e;var i=e.config,o=e.camera,a=e.renderingService,s=e.renderingContext,u=e.rBushRoot,h=e.pathGeneratorFactory;this.rBush=u,this.pathGeneratorFactory=h;var d=e.contextService,f=s.root.ownerDocument.defaultView,p=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)},g=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)};a.hooks.init.tap(t.tag,(function(){f.addEventListener(Xa.UNMOUNTED,p),f.addEventListener(Xa.CULLED,g);var t=d.getDPR(),e=i.width,n=i.height,o=d.getContext();r.clearRect(o,0,0,e*t,n*t,i.background)})),a.hooks.destroy.tap(t.tag,(function(){f.removeEventListener(Xa.UNMOUNTED,p),f.removeEventListener(Xa.CULLED,g),r.renderQueue=[],r.removedRBushNodeAABBs=[],r.restoreStack=[]})),a.hooks.beginFrame.tap(t.tag,(function(){var t=d.getContext(),e=d.getDPR(),n=i.width,o=i.height,s=r.canvasRendererPluginOptions,u=s.dirtyObjectNumThreshold,c=s.dirtyObjectRatioThreshold,l=a.getStats(),h=l.total,f=l.rendered,p=f/h;r.clearFullScreen=a.disableDirtyRectangleRendering()||f>u&&p>c,t&&(t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),r.clearFullScreen&&r.clearRect(t,0,0,n*e,o*e,i.background))}));var m=function(t,e){t.isVisible()&&!t.isCulled()&&(r.renderDisplayObject(t,e,r.context,r.restoreStack,n),r.saveDirtyAABB(t)),(t.sortable.sorted||t.childNodes).forEach((function(t){m(t,e)}))};a.hooks.endFrame.tap(t.tag,(function(){var t=d.getContext(),e=d.getDPR();if(L(r.dprMatrix,[e,e,1]),T(r.vpMatrix,r.dprMatrix,o.getOrthoMatrix()),r.clearFullScreen)m(s.root,t);else{var a=r.safeMergeAABB.apply(r,l([r.mergeDirtyAABBs(r.renderQueue)],c(r.removedRBushNodeAABBs.map((function(t){var e=t.minX,n=t.minY,r=t.maxX,i=t.maxY,o=new mr;return o.setMinMax([e,n,0],[r,i,0]),o}))),!1));if(r.removedRBushNodeAABBs=[],mr.isEmpty(a))return void(r.renderQueue=[]);var u=r.convertAABB2Rect(a),h=u.x,p=u.y,g=u.width,v=u.height,y=lt(r.vec3a,[h,p,0],r.vpMatrix),b=lt(r.vec3b,[h+g,p,0],r.vpMatrix),E=lt(r.vec3c,[h,p+v,0],r.vpMatrix),w=lt(r.vec3d,[h+g,p+v,0],r.vpMatrix),x=Math.min(y[0],b[0],w[0],E[0]),M=Math.min(y[1],b[1],w[1],E[1]),N=Math.max(y[0],b[0],w[0],E[0]),S=Math.max(y[1],b[1],w[1],E[1]),C=Math.floor(x),k=Math.floor(M),P=Math.ceil(N-x),A=Math.ceil(S-M);t.save(),r.clearRect(t,C,k,P,A,i.background),t.beginPath(),t.rect(C,k,P,A),t.clip(),t.setTransform(r.vpMatrix[0],r.vpMatrix[1],r.vpMatrix[4],r.vpMatrix[5],r.vpMatrix[12],r.vpMatrix[13]),i.renderer.getConfig().enableDirtyRectangleRenderingDebug&&f.dispatchEvent(new Ha(ws.DIRTY_RECTANGLE,{dirtyRect:{x:C,y:k,width:P,height:A}})),r.searchDirtyObjects(a).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&r.renderDisplayObject(e,t,r.context,r.restoreStack,n)})),t.restore(),r.renderQueue.forEach((function(t){r.saveDirtyAABB(t)})),r.renderQueue=[]}r.restoreStack.forEach((function(){t.restore()})),r.restoreStack=[]})),a.hooks.render.tap(t.tag,(function(t){r.clearFullScreen||r.renderQueue.push(t)}))},t.prototype.clearRect=function(t,e,n,r,i,o){t.clearRect(e,n,r,i),o&&(t.fillStyle=o,t.fillRect(e,n,r,i))},t.prototype.renderDisplayObject=function(t,e,n,r,i){var o=t.nodeName,a=r[r.length-1];!a||t.compareDocumentPosition(a)&$a.DOCUMENT_POSITION_CONTAINS||(e.restore(),r.pop());var s=this.context.styleRendererFactory[o],u=this.pathGeneratorFactory[o],c=t.parsedStyle.clipPath;if(c){this.applyWorldTransform(e,c);var l=this.pathGeneratorFactory[c.nodeName];l&&(e.save(),r.push(t),e.beginPath(),l(e,c.parsedStyle),e.closePath(),e.clip())}s&&(this.applyWorldTransform(e,t),e.save(),this.applyAttributesToContext(e,t)),u&&(e.beginPath(),u(e,t.parsedStyle),t.nodeName!==$n.LINE&&t.nodeName!==$n.PATH&&t.nodeName!==$n.POLYLINE&&e.closePath()),s&&(s.render(e,t.parsedStyle,t,n,this,i),e.restore()),t.renderable.dirty=!1},t.prototype.convertAABB2Rect=function(t){var e=t.getMin(),n=t.getMax(),r=Math.floor(e[0]),i=Math.floor(e[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}},t.prototype.mergeDirtyAABBs=function(t){var e=new mr;return t.forEach((function(t){var n=t.getRenderBounds();e.add(n);var r=t.renderable.dirtyRenderBounds;r&&e.add(r)})),e},t.prototype.searchDirtyObjects=function(t){var e=c(t.getMin(),2),n=e[0],r=e[1],i=c(t.getMax(),2),o=i[0],a=i[1];return this.rBush.search({minX:n,minY:r,maxX:o,maxY:a}).map((function(t){return t.displayObject}))},t.prototype.saveDirtyAABB=function(t){var e=t.renderable;e.dirtyRenderBounds||(e.dirtyRenderBounds=new mr);var n=t.getRenderBounds();n&&e.dirtyRenderBounds.update(n.center,n.halfExtents)},t.prototype.applyAttributesToContext=function(t,e){var n=e.parsedStyle,r=n.stroke,i=n.fill,o=n.opacity,a=n.lineDash,s=n.lineDashOffset;a&&t.setLineDash(a),Pt(s)||(t.lineDashOffset=s),Pt(o)||(t.globalAlpha*=o),Pt(r)||Array.isArray(r)||r.isNone||(t.strokeStyle=e.attributes.stroke),Pt(i)||Array.isArray(i)||i.isNone||(t.fillStyle=e.attributes.fill)},t.prototype.applyWorldTransform=function(t,e,n){var r=0,i=0,o=(e.parsedStyle||{}).anchor,a=o&&o[0]||0,s=o&&o[1]||0;if(0!==a||0!==s){var u=e.geometry.contentBounds;r=-a*(u&&2*u.halfExtents[0]||0),i=-s*(u&&2*u.halfExtents[1]||0)}n?(x(this.tmpMat4,e.getLocalTransform()),this.vec3a[0]=r,this.vec3a[1]=i,this.vec3a[2]=0,P(this.tmpMat4,this.tmpMat4,this.vec3a),T(this.tmpMat4,n,this.tmpMat4),T(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(x(this.tmpMat4,e.getWorldTransform()),this.vec3a[0]=r,this.vec3a[1]=i,this.vec3a[2]=0,P(this.tmpMat4,this.tmpMat4,this.vec3a),T(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},t.prototype.safeMergeAABB=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=new mr;return t.forEach((function(t){n.add(t)})),n},t.tag="CanvasRenderer",t}(),sj=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n,r,i,o){var a=e.fill,s=e.fillRule,u=e.opacity,c=e.fillOpacity,l=e.stroke,h=e.strokeOpacity,d=e.lineWidth,f=e.lineCap,p=e.lineJoin,g=e.shadowType,m=e.shadowColor,v=e.shadowBlur,y=e.filter,b=e.miterLimit,E=!Pt(a)&&!a.isNone,w=!Pt(l)&&!l.isNone&&d>0,x=0===a.alpha,M=!(!y||!y.length),N=!Pt(m)&&v>0,S=n.nodeName,C="inner"===g,k=w&&N&&(S===$n.PATH||S===$n.LINE||S===$n.POLYLINE||x||C);E&&(t.globalAlpha=u*c,k||uj(n,t,N),this.fill(t,n,a,s,r,i,o),k||this.clearShadowAndFilter(t,M,N)),w&&(t.globalAlpha=u*h,t.lineWidth=d,Pt(b)||(t.miterLimit=b),Pt(f)||(t.lineCap=f),Pt(p)||(t.lineJoin=p),k&&(C&&(t.globalCompositeOperation="source-atop"),uj(n,t,!0),C&&(this.stroke(t,n,l,r,i,o),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,M,!0))),this.stroke(t,n,l,r,i,o))},t.prototype.clearShadowAndFilter=function(t,e,n){if(n&&(t.shadowColor="transparent",t.shadowBlur=0),e){var r=t.filter;!Pt(r)&&r.indexOf("drop-shadow")>-1&&(t.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},t.prototype.fill=function(t,e,n,r,i,o,a){var s=this;Array.isArray(n)?n.forEach((function(n){t.fillStyle=s.getColor(n,e,t),r?t.fill(r):t.fill()})):(Ci(n)&&(t.fillStyle=this.getPattern(n,e,t,i,o,a)),r?t.fill(r):t.fill())},t.prototype.stroke=function(t,e,n,r,i,o){var a=this;Array.isArray(n)?n.forEach((function(n){t.strokeStyle=a.getColor(n,e,t),t.stroke()})):(Ci(n)&&(t.strokeStyle=this.getPattern(n,e,t,r,i,o)),t.stroke())},t.prototype.getPattern=function(t,e,n,r,i,o){var a,s;if("rect"===t.image.nodeName){var u=t.image.parsedStyle,c=u.width,l=u.height;s=r.contextService.getDPR();var h=r.config.offscreenCanvas;(a=o.offscreenCanvasCreator.getOrCreateCanvas(h)).width=c*s,a.height=l*s;var d=o.offscreenCanvasCreator.getOrCreateContext(h),f=[];t.image.forEach((function(t){i.renderDisplayObject(t,d,r,f,o)})),f.forEach((function(){d.restore()}))}return this.imagePool.getOrCreatePatternSync(t,n,a,s,(function(){e.renderable.dirty=!0,r.renderingService.dirtify()}))},t.prototype.getColor=function(t,e,n){var r;if(t.type===jr.LinearGradient||t.type===jr.RadialGradient){var o=e.getGeometryBounds(),a=o&&2*o.halfExtents[0]||1,s=o&&2*o.halfExtents[1]||1;r=this.imagePool.getOrCreateGradient(i(i({type:t.type},t.value),{width:a,height:s}),n)}return r},t}();function uj(t,e,n){var r=t.parsedStyle,i=r.filter,o=r.shadowColor,a=r.shadowBlur,s=r.shadowOffsetX,u=r.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),n&&(e.shadowColor=o.toString(),e.shadowBlur=a||0,e.shadowOffsetX=s||0,e.shadowOffsetY=u||0)}var cj=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n){var r,i=e.width,o=e.height,a=e.img,s=e.shadowColor,u=e.shadowBlur,c=i,l=o;if(Bt(a)?r=this.imagePool.getImageSync(a):(c||(c=a.width),l||(l=a.height),r=a),r){uj(n,t,!Pt(s)&&u>0);try{t.drawImage(r,0,0,c,l)}catch(t){}}},t}(),lj=function(){function t(){}return t.prototype.render=function(t,e,n,r,i,o){var a=e,s=a.lineWidth,u=a.textAlign,c=a.textBaseline,l=a.lineJoin,h=a.miterLimit,d=a.letterSpacing,f=a.stroke,p=a.fill,g=a.fillOpacity,m=a.strokeOpacity,v=a.opacity,y=a.metrics,b=a.dx,E=a.dy,w=a.shadowColor,x=a.shadowBlur,M=y.font,N=y.lines,S=y.height,C=y.lineHeight,k=y.lineMetrics;t.font=M,t.lineWidth=s,t.textAlign="middle"===u?"center":u;var T=c;o.enableCSSParsing||"alphabetic"!==T||(T="bottom"),t.lineJoin=l,Pt(h)||(t.miterLimit=h);var P=0;"middle"===c?P=-S/2-C/2:"bottom"===c||"alphabetic"===c||"ideographic"===c?P=-S:"top"!==c&&"hanging"!==c||(P=-C);var A=b||0;P+=E||0,1===N.length&&("bottom"===T?(T="middle",P-=.5*S):"top"===T&&(T="middle",P+=.5*S)),t.textBaseline=T,uj(n,t,!Pt(w)&&x>0);for(var O=0;O<N.length;O++){var _=s/2+A;P+=C,Pt(f)||f.isNone||!s||this.drawLetterSpacing(t,N[O],k[O],u,_,P,d,g,m,v,!0),Pt(p)||this.drawLetterSpacing(t,N[O],k[O],u,_,P,d,g,m,v)}},t.prototype.drawLetterSpacing=function(t,e,n,r,i,o,a,s,u,c,l){if(void 0===l&&(l=!1),0!==a){var h=t.textAlign;t.textAlign="left";var d=i;"center"===r||"middle"===r?d=i-n.width/2:"right"!==r&&"end"!==r||(d=i-n.width);for(var f=Array.from(e),p=t.measureText(e).width,g=0,m=0;m<f.length;++m){var v=f[m];l?this.strokeText(t,v,d,o,u):this.fillText(t,v,d,o,s,c),d+=p-(g=t.measureText(e.substring(m+1)).width)+a,p=g}t.textAlign=h}else l?this.strokeText(t,e,i,o,u):this.fillText(t,e,i,o,s,c)},t.prototype.fillText=function(t,e,n,r,i,o){var a,s=!Pt(i)&&1!==i;s&&(a=t.globalAlpha,t.globalAlpha=i*o),t.fillText(e,n,r),s&&(t.globalAlpha=a)},t.prototype.strokeText=function(t,e,n,r,i){var o,a=!Pt(i)&&1!==i;a&&(o=t.globalAlpha,t.globalAlpha=i),t.strokeText(e,n,r),a&&(t.globalAlpha=o)},t}();!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(sj),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(sj),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(sj),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(sj),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(sj),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(sj),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(sj);var hj=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="canvas-renderer",n}return r(e,t),e.prototype.init=function(){var t,e=i({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,r=new sj(n),o=((t={})[$n.CIRCLE]=r,t[$n.ELLIPSE]=r,t[$n.RECT]=r,t[$n.IMAGE]=new cj(n),t[$n.TEXT]=new lj,t[$n.LINE]=r,t[$n.POLYLINE]=r,t[$n.POLYGON]=r,t[$n.PATH]=r,t[$n.GROUP]=void 0,t[$n.HTML]=void 0,t[$n.MESH]=void 0,t);this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new aj(e))},e.prototype.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},e}(Xn),dj=function(){function t(){}return t.prototype.apply=function(e,n){var r=this,i=e.renderingService,o=e.renderingContext,a=e.config;this.context=e;var s=o.root.ownerDocument.defaultView,u=function(t){i.hooks.pointerMove.call(t)},c=function(t){i.hooks.pointerUp.call(t)},l=function(t){i.hooks.pointerDown.call(t)},h=function(t){i.hooks.pointerOver.call(t)},d=function(t){i.hooks.pointerOut.call(t)},f=function(t){i.hooks.pointerCancel.call(t)},p=function(t){i.hooks.pointerWheel.call(t)},g=function(t){i.hooks.click.call(t)};i.hooks.init.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="none",t.style.msTouchAction="none"):s.supportsPointerEvents&&(t.style.touchAction="none"),s.supportsPointerEvents?function(t){n.globalThis.document.addEventListener("pointermove",u,!0),t.addEventListener("pointerdown",l,!0),t.addEventListener("pointerleave",d,!0),t.addEventListener("pointerover",h,!0),n.globalThis.addEventListener("pointerup",c,!0),n.globalThis.addEventListener("pointercancel",f,!0)}(t):function(t){n.globalThis.document.addEventListener("mousemove",u,!0),t.addEventListener("mousedown",l,!0),t.addEventListener("mouseout",d,!0),t.addEventListener("mouseover",h,!0),n.globalThis.addEventListener("mouseup",c,!0)}(t),s.supportsTouchEvents&&function(t){t.addEventListener("touchstart",l,!0),t.addEventListener("touchend",c,!0),t.addEventListener("touchmove",u,!0),t.addEventListener("touchcancel",f,!0)}(t),a.useNativeClickEvent&&t.addEventListener("click",g,!0),t.addEventListener("wheel",p,{passive:!0,capture:!0})})),i.hooks.destroy.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="",t.style.msTouchAction=""):s.supportsPointerEvents&&(t.style.touchAction=""),s.supportsPointerEvents?function(t){n.globalThis.document.removeEventListener("pointermove",u,!0),t.removeEventListener("pointerdown",l,!0),t.removeEventListener("pointerleave",d,!0),t.removeEventListener("pointerover",h,!0),n.globalThis.removeEventListener("pointerup",c,!0)}(t):function(t){n.globalThis.document.removeEventListener("mousemove",u,!0),t.removeEventListener("mousedown",l,!0),t.removeEventListener("mouseout",d,!0),t.removeEventListener("mouseover",h,!0),n.globalThis.removeEventListener("mouseup",c,!0)}(t),s.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",l,!0),t.removeEventListener("touchend",c,!0),t.removeEventListener("touchmove",u,!0),t.removeEventListener("touchcancel",f,!0)}(t),a.useNativeClickEvent&&t.removeEventListener("click",g,!0),t.removeEventListener("wheel",p,!0)}))},t.tag="DOMInteraction",t}(),fj=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.name="dom-interaction",e}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new dj)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(Xn),pj=function(){function t(){this.displayObjectHTMLElementMap=new WeakMap}return t.prototype.joinTransformMatrix=function(t){return"matrix(".concat([t[0],t[1],t[4],t[5],t[12],t[13]].join(","),")")},t.prototype.apply=function(e,n){var r=this,i=e.camera,o=e.renderingContext,a=e.renderingService;this.context=e;var s=o.root.ownerDocument.defaultView,u=s.context.eventService.nativeHTMLMap,c=function(t,e){e.style.transform=r.joinTransformMatrix(t.getWorldTransform())},l=function(t){var e=t.target;if(e.nodeName===$n.HTML){r.$camera||(r.$camera=r.createCamera(i));var o=r.getOrCreateEl(e);if(r.$camera.appendChild(o),n.enableCSSParsing){var a=e.ownerDocument.documentElement.attributes;Object.keys(a).forEach((function(t){o.style[t]=a[t]}))}Object.keys(e.attributes).forEach((function(t){r.updateAttribute(t,e)})),c(e,o),u.set(o,e)}},h=function(t){var e=t.target;if(e.nodeName===$n.HTML&&r.$camera){var n=r.getOrCreateEl(e);n&&(n.remove(),u.delete(n))}},d=function(t){var e=t.target;if(e.nodeName===$n.HTML){var n=t.attrName;r.updateAttribute(n,e)}},f=function(t){var e=t.target;if(e.nodeName===$n.HTML){var n=r.getOrCreateEl(e);c(e,n)}},p=function(){if(r.$camera){var t=r.context.config,e=t.width,n=t.height;r.$camera.style.width="".concat(e||0,"px"),r.$camera.style.height="".concat(n||0,"px")}};a.hooks.init.tap(t.tag,(function(){s.addEventListener(ws.RESIZE,p),s.addEventListener(Xa.MOUNTED,l),s.addEventListener(Xa.UNMOUNTED,h),s.addEventListener(Xa.ATTR_MODIFIED,d),s.addEventListener(Xa.BOUNDS_CHANGED,f)})),a.hooks.endFrame.tap(t.tag,(function(){r.$camera&&o.renderReasons.has(Fa.CAMERA_CHANGED)&&(r.$camera.style.transform=r.joinTransformMatrix(i.getOrthoMatrix()))})),a.hooks.destroy.tap(t.tag,(function(){r.$camera&&r.$camera.remove(),s.removeEventListener(ws.RESIZE,p),s.removeEventListener(Xa.MOUNTED,l),s.removeEventListener(Xa.UNMOUNTED,h),s.removeEventListener(Xa.ATTR_MODIFIED,d),s.removeEventListener(Xa.BOUNDS_CHANGED,f)}))},t.prototype.createCamera=function(t){var e=this.context.config,n=e.document,r=e.width,i=e.height,o=this.context.contextService.getDomElement(),a=o.parentNode;if(a){var s="g-canvas-camera",u=a.querySelector("#"+s);if(!u){var c=(n||document).createElement("div");u=c,c.id=s,c.style.position="absolute",c.style.left="".concat(o.offsetLeft||0,"px"),c.style.top="".concat(o.offsetTop||0,"px"),c.style.transformOrigin="left top",c.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),c.style.overflow="hidden",c.style.pointerEvents="none",c.style.width="".concat(r||0,"px"),c.style.height="".concat(i||0,"px"),a.appendChild(c)}return u}return null},t.prototype.getOrCreateEl=function(t){var e=this.context.config.document,n=this.displayObjectHTMLElementMap.get(t);return n||(n=(e||document).createElement("div"),t.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(t,n),t.id&&(n.id=t.id),t.name&&n.setAttribute("name",t.name),t.className&&(n.className=t.className),n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(t.getWorldTransform())),n},t.prototype.updateAttribute=function(t,e){var n=this.getOrCreateEl(e);switch(t){case"innerHTML":var r=e.parsedStyle.innerHTML;Bt(r)?n.innerHTML=r:(n.innerHTML="",n.appendChild(r));break;case"transformOrigin":var i=e.parsedStyle.transformOrigin;n.style["transform-origin"]="".concat(i[0].value," ").concat(i[1].value);break;case"width":if(this.context.enableCSSParsing){var o=e.computedStyleMap().get("width");n.style.width=o.toString()}else{o=e.parsedStyle.width;n.style.width=Wt(o)?"".concat(o,"px"):o.toString()}break;case"height":if(this.context.enableCSSParsing){var a=e.computedStyleMap().get("height");n.style.height=a.toString()}else{a=e.parsedStyle.height;n.style.height=Wt(a)?"".concat(a,"px"):a.toString()}break;case"zIndex":var s=e.parsedStyle.zIndex;n.style["z-index"]="".concat(s);break;case"visibility":var u=e.parsedStyle.visibility;n.style.visibility=u;break;case"pointerEvents":var c=e.parsedStyle.pointerEvents;n.style.pointerEvents=c;break;case"opacity":var l=e.parsedStyle.opacity;n.style.opacity="".concat(l);break;case"fill":var h=e.parsedStyle.fill,d="";ki(h)?d=h.isNone?"transparent":e.getAttribute("fill"):Array.isArray(h)?d=e.getAttribute("fill"):Ci(h),n.style.background=d;break;case"stroke":var f=e.parsedStyle.stroke,p="";ki(f)?p=f.isNone?"transparent":e.getAttribute("stroke"):Array.isArray(f)?p=e.getAttribute("stroke"):Ci(f),n.style["border-color"]=p,n.style["border-style"]="solid";break;case"lineWidth":var g=e.parsedStyle.lineWidth;n.style["border-width"]="".concat(g||0,"px");break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":var m=e.style.filter;n.style.filter=m;break;default:"x"!==t&&"y"!==t&&(Pt(e.style[t])||""===e.style[t]||(n.style[t]=e.style[t]))}},t.tag="HTMLRendering",t}(),gj=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.name="html-renderer",e}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new pj)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(Xn),mj=function(){function t(t){this.canvasConfig=t,this.imageCache={},this.gradientCache={},this.patternCache={}}return t.prototype.getImageSync=function(t,e){return this.imageCache[t]?e&&e(this.imageCache[t]):this.getOrCreateImage(t).then((function(t){e&&e(t)})),this.imageCache[t]},t.prototype.getOrCreateImage=function(t){var e=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var n=this.canvasConfig.createImage;return new Promise((function(r,i){var o;n?o=n(t):oa&&(o=new window.Image),o&&(o.onload=function(){e.imageCache[t]=o,r(o)},o.onerror=function(t){i(t)},o.crossOrigin="Anonymous",o.src=t)}))},t.prototype.getOrCreatePatternSync=function(t,e,n,r,i){var o=this.generatePatternKey(t);if(o&&this.patternCache[o])return this.patternCache[o];var a,s=t.image,u=t.repetition,c=t.transform,l=!1;Bt(s)?a=this.getImageSync(s,i):n?(a=n,l=!0):a=s;var h=a&&e.createPattern(a,u);if(h){var d=void 0;d=c?qo(yo(c),new Ts({})):N(E()),l&&A(d,d,[1/r,1/r,1]),h.setTransform({a:d[0],b:d[1],c:d[4],d:d[5],e:d[12],f:d[13]})}return o&&h&&(this.patternCache[o]=h),h},t.prototype.getOrCreateGradient=function(t,e){var n=this.generateGradientKey(t),r=t.type,i=t.steps,o=t.width,a=t.height,s=t.angle,u=t.cx,c=t.cy,l=t.size;if(this.gradientCache[n])return this.gradientCache[n];var h=null;if(r===jr.LinearGradient){var d=function(t,e,n){var r=ir(n.value),i=0+t/2,o=0+e/2,a=Math.abs(t*Math.cos(r))+Math.abs(e*Math.sin(r));return{x1:i-Math.cos(r)*a/2,y1:o-Math.sin(r)*a/2,x2:i+Math.cos(r)*a/2,y2:o+Math.sin(r)*a/2}}(o,a,s),f=d.x1,p=d.y1,g=d.x2,m=d.y2;h=e.createLinearGradient(f,p,g,m)}else if(r===jr.RadialGradient){var v=function(t,e,n,r,i){var o=n.value,a=r.value;n.unit===Cr.kPercentage&&(o=n.value/100*t),r.unit===Cr.kPercentage&&(a=r.value/100*e);var s=Math.max(Ie([0,0],[o,a]),Ie([0,e],[o,a]),Ie([t,e],[o,a]),Ie([t,0],[o,a]));return i&&(i instanceof Qr?s=i.value:i instanceof Ur&&("closest-side"===i.value?s=Math.min(o,t-o,a,e-a):"farthest-side"===i.value?s=Math.max(o,t-o,a,e-a):"closest-corner"===i.value&&(s=Math.min(Ie([0,0],[o,a]),Ie([0,e],[o,a]),Ie([t,e],[o,a]),Ie([t,0],[o,a]))))),{x:o,y:a,r:s}}(o,a,u,c,l),y=v.x,b=v.y,E=v.r;h=e.createRadialGradient(y,b,0,y,b,E)}return h&&(i.forEach((function(t){var e=t.offset,n=t.color;e.unit===Cr.kPercentage&&(null==h||h.addColorStop(e.value/100,n.toString()))})),this.gradientCache[n]=h),this.gradientCache[n]},t.prototype.generateGradientKey=function(t){var e=t.type,n=t.width,r=t.height,i=t.steps,o=t.angle,a=t.cx,s=t.cy,u=t.size;return"gradient-".concat(e,"-").concat((null==o?void 0:o.toString())||0,"-").concat((null==a?void 0:a.toString())||0,"-").concat((null==s?void 0:s.toString())||0,"-").concat((null==u?void 0:u.toString())||0,"-").concat(n,"-").concat(r,"-").concat(i.map((function(t){var e=t.offset,n=t.color;return"".concat(e).concat(n)})).join("-"))},t.prototype.generatePatternKey=function(t){var e=t.image,n=t.repetition;return Bt(e)?"pattern-".concat(e,"-").concat(n):"rect"===e.nodeName?"pattern-".concat(e.entity,"-").concat(n):void 0},t}(),vj=function(){function t(){}return t.prototype.apply=function(e){var n=e.renderingService,r=e.renderingContext,i=e.imagePool,o=r.root.ownerDocument.defaultView,a=function(t,e,n){var r=t.parsedStyle,i=r.width,o=r.height;i&&!o?t.setAttribute("height",n/e*i):!i&&o&&t.setAttribute("width",e/n*o)},s=function(t){var e=t.target,r=e.nodeName,o=e.attributes;if(r===$n.IMAGE){var s=o.img,u=o.keepAspectRatio;Bt(s)&&i.getImageSync(s,(function(t){var r=t.width,i=t.height;u&&a(e,r,i),e.renderable.dirty=!0,n.dirtify()}))}},u=function(t){var e=t.target,r=t.attrName,o=t.newValue;e.nodeName===$n.IMAGE&&"img"===r&&Bt(o)&&i.getOrCreateImage(o).then((function(t){var r=t.width,i=t.height;e.attributes.keepAspectRatio&&a(e,r,i),e.renderable.dirty=!0,n.dirtify()}))};n.hooks.init.tap(t.tag,(function(){o.addEventListener(Xa.MOUNTED,s),o.addEventListener(Xa.ATTR_MODIFIED,u)})),n.hooks.destroy.tap(t.tag,(function(){o.removeEventListener(Xa.MOUNTED,s),o.removeEventListener(Xa.ATTR_MODIFIED,u)}))},t.tag="LoadImage",t}(),yj=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.name="image-loader",e}return r(e,t),e.prototype.init=function(){this.context.imagePool=new mj(this.context.config),this.addRenderingPlugin(new vj)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(Xn),bj=function(){function t(t){this.renderingContext=t.renderingContext,this.canvasConfig=t.config}return t.prototype.init=function(){var t=this.canvasConfig,e=t.container,n=t.canvas;if(n)this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container;else if(e&&(this.$container=Bt(e)?document.getElementById(e):e,this.$container)){var r=document.createElement("canvas");this.$container.appendChild(r),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=r}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)},t.prototype.getContext=function(){return this.context},t.prototype.getDomElement=function(){return this.$canvas},t.prototype.getDPR=function(){return this.dpr},t.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},t.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},t.prototype.resize=function(t,e){var n=this.canvasConfig.devicePixelRatio||oa&&window.devicePixelRatio||1;n=n>=1?Math.ceil(n):1,this.dpr=n,this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*e,function(t,e,n){oa&&t.style&&(t.style.width=e+"px",t.style.height=n+"px")}(this.$canvas,t,e)),this.renderingContext.renderReasons.add(Fa.CAMERA_CHANGED)},t.prototype.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},t.prototype.toDataURL=function(t){return void 0===t&&(t={}),a(this,void 0,void 0,(function(){var e,n;return s(this,(function(r){return e=t.type,n=t.encoderOptions,[2,this.context.canvas.toDataURL(e,n)]}))}))},t}(),Ej=function(t){function e(){var e=t.apply(this,l([],c(arguments),!1))||this;return e.name="canvas-context-register",e}return r(e,t),e.prototype.init=function(){this.context.ContextService=bj},e.prototype.destroy=function(){delete this.context.ContextService},e}(Xn),wj=function(t){function e(e){var n=t.call(this,e)||this;return n.registerPlugin(new Ej),n.registerPlugin(new yj),n.registerPlugin(new DI),n.registerPlugin(new hj),n.registerPlugin(new fj),n.registerPlugin(new oj),n.registerPlugin(new gj),n}return r(e,t),e}(Zn),xj=function(){function t(t){this.dragndropPluginOptions=t}return t.prototype.apply=function(e){var n=this,r=e.renderingService,i=e.renderingContext.root.ownerDocument,o=i.defaultView,u=function(t){var e=t.target,r=e===i,u=r&&n.dragndropPluginOptions.isDocumentDraggable?i:e.closest&&e.closest("[draggable=true]");if(u){var c=!1,l=t.timeStamp,h=[t.clientX,t.clientY],d=null,f=[t.clientX,t.clientY],p=function(t){return a(n,void 0,void 0,(function(){var n,o,a,p,g,m;return s(this,(function(s){switch(s.label){case 0:if(!c){if(n=t.timeStamp-l,o=Ie([t.clientX,t.clientY],h),n<=this.dragndropPluginOptions.dragstartTimeThreshold||o<=this.dragndropPluginOptions.dragstartDistanceThreshold)return[2];t.type="dragstart",u.dispatchEvent(t),c=!0}return t.type="drag",t.dx=t.clientX-f[0],t.dy=t.clientY-f[1],u.dispatchEvent(t),f=[t.clientX,t.clientY],r?[3,2]:(a="pointer"===this.dragndropPluginOptions.overlap?[t.canvasX,t.canvasY]:e.getBounds().center,[4,i.elementsFromPoint(a[0],a[1])]);case 1:p=s.sent(),g=p[p.indexOf(e)+1],m=(null==g?void 0:g.closest("[droppable=true]"))||(this.dragndropPluginOptions.isDocumentDroppable?i:null),d!==m&&(d&&(t.type="dragleave",t.target=d,d.dispatchEvent(t)),m&&(t.type="dragenter",t.target=m,m.dispatchEvent(t)),(d=m)&&(t.type="dragover",t.target=d,d.dispatchEvent(t))),s.label=2;case 2:return[2]}}))}))};o.addEventListener("pointermove",p);var g=function(t){if(c){t.detail={preventClick:!0};var e=t.clone();d&&(e.type="drop",e.target=d,d.dispatchEvent(e)),e.type="dragend",u.dispatchEvent(e),c=!1}o.removeEventListener("pointermove",p)};e.addEventListener("pointerup",g,{once:!0}),e.addEventListener("pointerupoutside",g,{once:!0})}};r.hooks.init.tap(t.tag,(function(){o.addEventListener("pointerdown",u)})),r.hooks.destroy.tap(t.tag,(function(){o.removeEventListener("pointerdown",u)}))},t.tag="Dragndrop",t}(),Mj=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="dragndrop",n}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new xj(i({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e.prototype.setOptions=function(t){Object.assign(this.plugins[0].dragndropPluginOptions,t)},e}(Xn);class Nj{config;background;main;label;transient;transientLabel;get canvas(){return{main:this.main,label:this.label,transient:this.transient,transientLabel:this.transientLabel,background:this.background}}get document(){return this.main.document}renderers;initialized=!1;constructor(t){this.config=t}async init(){if(this.initialized)return;const{renderer:t,background:e,...n}=this.config,{renderers:r,canvas:i}=["main","label","transient","transientLabel","background"].reduce(((e,r)=>{const i=Tt(t)?t?.(r):new wj;"main"===r?i.registerPlugin(new Mj({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):i.unregisterPlugin(i.getPlugin("dom-interaction"));const o=new Js({renderer:i,supportsMutipleCanvasesInOneContainer:!0,...n});return e.renderers[r]=i,e.canvas[r]=o,this[r]=o,e}),{renderers:{},canvas:{}});this.renderers=r,Object.entries(i).forEach((([t,e])=>{const n=e.getContextService().getDomElement();n.style.position="absolute",n.style.outline="none",n.tabIndex=1,"main"!==t&&(n.style.pointerEvents="none")})),this.setBackground(),await Promise.all(Object.values(this.canvas).map((t=>t.ready))),this.initialized=!0}getRendererType(t="main"){const e=this.renderers[t].getPlugins();for(const t of e){if("canvas-renderer"===t.name)return"canvas";if("svg-renderer"===t.name)return"svg";if("device-renderer"===t.name)return"gpu"}return"unknown"}get context(){return this.main.context}getDevice(){return this.main.context?.deviceRendererPlugin?.getDevice()}getConfig(){return this.config}setBackground(t=this.config.background){const e=this.getContainer();e&&t&&(e.style.background=t,e.style.transition="background 0.5s")}setCursor(t){Object.values(this.canvas).forEach((e=>{e.setCursor(t)}))}getSize(){return[this.config.width||0,this.config.height||0]}resize(t,e){this.config.width=t,this.config.height=e,Object.values(this.canvas).forEach((n=>{n.resize(t,e)}))}getCamera(){return this.main.getCamera()}getBounds(){return Tc(Object.values(this.canvas).map((t=>t.document.documentElement)).filter((t=>t.childNodes.length>0)).map((t=>t.getBounds())))}getContainer(){const t=this.config.container;return Bt(t)?document.getElementById(t):t}appendChild(t){return this[t.style?.$layer||"main"].appendChild(t)}getContextService(){return this.main.getContextService()}viewport2Client(t){return this.main.viewport2Client(t)}viewport2Canvas(t){return this.main.viewport2Canvas(t)}client2Viewport(t){return this.main.client2Viewport(t)}canvas2Viewport(t){return this.main.canvas2Viewport(t)}async toDataURL(t={}){const e=window.devicePixelRatio||1,{width:n,height:r,renderer:i}=this.config,o=Xe('<div id="virtual-image"></div>'),a=new Js({width:n,height:r,renderer:i?.("main")||new wj,devicePixelRatio:e,container:o,background:this.background.getConfig().background});await a.ready,a.appendChild(this.background.getRoot().cloneNode(!0)),a.appendChild(this.main.getRoot().cloneNode(!0));const s=this.label.getRoot().cloneNode(!0),u=a.viewport2Canvas({x:0,y:0}),c=this.main.viewport2Canvas({x:0,y:0});s.translate([c.x-u.x,c.y-u.y]),s.scale(1/this.main.getCamera().getZoom()),a.appendChild(s),a.appendChild(this.transient.getRoot().cloneNode(!0));const l=this.main.getCamera(),h=a.getCamera();h.setZoom(l.getZoom()),h.setPosition(l.getPosition()),h.setFocalPoint(l.getFocalPoint());return a.getContextService().toDataURL(t)}destroy(){this.config={},this.renderers={},Object.entries(this.canvas).forEach((([t,e])=>{const n=e.getCamera();n.landmarks?.length&&n.cancelLandmarkAnimation(),function(t){t.destroy();const e=t.getCamera();e.eventEmitter.removeAllListeners(),t.document.timeline.destroy();const{animationsWithPromises:n}=t.document.timeline;n.forEach((t=>{t.effect.target&&(t.effect.target=null),t.effect.computedTiming&&(t.effect.computedTiming=null)})),t.document.timeline.animationsWithPromises=[],t.document.timeline.rafCallbacks=[],t.document.timeline=null}(e),this[t]=void 0}))}}function Sj(t,e){const{data:n,style:r,...i}=t,{data:o,style:a,...s}=e,u={...i,...s};return(n||o)&&Object.assign(u,{data:{...n,...o}}),(r||a)&&Object.assign(u,{style:{...r,...a}}),u}function Cj(t){const{data:e,style:n,...r}=t,i=r;return e&&(i.data={...e}),n&&(i.style={...n}),i}function kj(t){const{id:e=Fc(t),style:n,data:r,...i}=t,o={...t,style:{...n},data:{...r}};return bc(t)?{id:e,data:o,...i}:{id:e,data:o}}function Tj(t){return t.data}class Pj{model;latestRemovedComboIds=new Set;comboIds=new Set;changes=[];batchCount=0;isTraceless=!1;constructor(){this.model=new hp}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===uc.NodeUpdated||e===uc.EdgeUpdated||e===uc.ComboUpdated){const{value:n,original:r}=t;this.changes.push({value:Cj(n),original:Cj(r),type:e})}else this.changes.push({value:Cj(t.value),type:e})}getChanges(){const t=this.changes;return this.changes=[],t}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=Tj(n);return this.isCombo(Fc(r))||(void 0===t||t.includes(Fc(r)))&&e.push(r),e}),[])}getEdgeData(t){return this.model.getAllEdges().reduce(((e,n)=>{const r=Tj(n);return(void 0===t||t.includes(Fc(r)))&&e.push(r),e}),[])}getComboData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=Tj(n);return this.isCombo(Fc(r))?((void 0===t||t.includes(Fc(r)))&&e.push(r),e):e}),[])}getAncestorsData(t,e){const{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getAncestors(t,e).map(Tj):[]}getDescendantsData(t){const e=this.getElementsData([t])[0],n=[];return qh(e,(t=>{t!==e&&n.push(t)}),(t=>this.getChildrenData(Fc(t))),"TB"),n}getParentData(t,e=this.inferStructureKey(t)){const{model:n}=this;if(!e)return void console.error("The hierarchy structure key is not specified");if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const r=n.getParent(t,e);return r?Tj(r):void 0}getChildrenData(t){const e="node"===this.getElementType(t)?vc:mc,{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getChildren(t,e).map(Tj):[]}inferStructureKey(t){if(this.isCombo(t))return mc}getElementData(t){return"node"===t?this.getNodeData():"edge"===t?this.getEdgeData():"combo"===t?this.getComboData():[]}getElementsData(t){return t.map((t=>{const e=this.getElementType(t);return"node"===e?this.getNodeData([t])[0]:"edge"===e?this.getEdgeData([t])[0]:this.getComboData([t])[0]}))}getNodeLikeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=Tj(n);return t?t.includes(Fc(r))&&e.push(r):e.push(r),e}),[])}getElementDataByState(t,e){return this.getElementData(t).filter((t=>t.style?.states?.includes(e)))}getElementState(t){return this.getElementsData([t])?.[0]?.style?.states||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(Tj)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(Tj)}setData(t){const{nodes:e=[],edges:n=[],combos:r=[]}=t,{nodes:i=[],edges:o=[],combos:a=[]}=this.getData(),s=Lh(i,e,(t=>Fc(t))),u=Lh(o,n,(t=>Fc(t))),c=Lh(a,r,(t=>Fc(t)));this.batch((()=>{this.addData({nodes:s.enter,edges:u.enter,combos:c.enter}),this.updateData({nodes:s.update,edges:u.update,combos:c.update}),this.removeData({nodes:s.exit.map(Fc),edges:u.exit.map(Fc),combos:c.exit.map(Fc)})}))}addData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.addComboData(r),this.addNodeData(e),this.addEdgeData(n)}))}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map((t=>(this.pushChange({value:t,type:uc.NodeAdded}),kj(t))))),this.updateNodeLikeHierarchy(t))}addEdgeData(t=[]){t.length&&this.model.addEdges(t.map((t=>(this.pushChange({value:t,type:uc.EdgeAdded}),kj(t)))))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(mc)||e.attachTreeStructure(mc),e.addNodes(t.map((t=>(this.comboIds.add(Fc(t)),this.pushChange({value:t,type:uc.ComboAdded}),kj(t))))),this.updateNodeLikeHierarchy(t)}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach((t=>{const n=Fc(t);e.attachTreeStructure(mc),this.setParent(n,Gc(t),mc);const r=t?.style?.children;void 0!==r&&(e.attachTreeStructure(vc),r.forEach((t=>{this.setParent(t,n,vc)})))}))}enableUpdateNodeLikeHierarchy=!0;preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.updateNodeData(e),this.updateComboData(r),this.updateEdgeData(n)}))}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{const n=[];t.forEach((t=>{const r=Fc(t),i=Tj(e.getNode(r));if(ae(i,t))return;const o=Sj(i,t);this.pushChange({value:o,original:i,type:uc.NodeUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)}))}syncNodeDatum(t){const{model:e}=this,n=Fc(t),r=Sj(Tj(e.getNode(n)),t);e.mergeNodeData(n,r)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{t.forEach((t=>{const n=Fc(t),r=Tj(e.getEdge(n));if(ae(r,t))return;t.source&&r.source!==t.source&&e.updateEdgeSource(n,t.source),t.target&&r.target!==t.target&&e.updateEdgeTarget(n,t.target);const i=Sj(r,t);e.mergeEdgeData(n,i),this.pushChange({value:i,original:r,type:uc.EdgeUpdated})}))}))}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch((()=>{const n=[];t.forEach((t=>{const r=Fc(t),i=Tj(e.getNode(r));if(ae(i,t))return;const o=Sj(i,t);this.pushChange({value:o,original:i,type:uc.ComboUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)}))}setParent(t,e,n,r=!0){if(t===e)return;const i=Gc(this.getNodeLikeData([t])[0]);if(i!==e){const n={id:t,style:{parentId:e}};this.isCombo(t)?this.syncComboDatum(n):this.syncNodeDatum(n)}this.model.setParent(t,e,n),r&&new Set([i,e]).forEach((t=>{void 0!==t&&this.refreshComboData(t)}))}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,mc);e&&this.pushChange({value:e,original:e,type:uc.ComboUpdated}),n.forEach((t=>{this.pushChange({value:t,original:t,type:uc.ComboUpdated})}))}syncComboDatum(t){const{model:e}=this,n=Fc(t),r=Sj(Tj(e.getNode(n)),t);e.mergeNodeData(n,r)}getElementPosition(t){return _c(this.getElementsData([t])[0])}translateNodeBy(t,e){const n=$c(this.getElementPosition(t),[...e,0].slice(0,3));this.translateNodeTo(t,n)}translateNodeTo(t,e){const[n=0,r=0,i=0]=e;this.preventUpdateNodeLikeHierarchy((()=>{this.updateNodeData([{id:t,style:{x:n,y:r,z:i}}])}))}translateComboBy(t,e){const[n=0,r=0,i=0]=e;if([n,r,i].some(isNaN)||[n,r,i].every((t=>0===t)))return;const o=this.getComboData([t])[0];o&&qh(o,(t=>{const e=Fc(t),[o,a,s]=_c(t),u=Sj(t,{style:{x:o+n,y:a+r,z:s+i}});this.pushChange({value:u,original:t,type:this.isCombo(e)?uc.ComboUpdated:uc.NodeUpdated}),this.model.mergeNodeData(e,u)}),(t=>this.getChildrenData(Fc(t))),"BT")}translateComboTo(t,e){if(e.some(isNaN))return;const[n=0,r=0,i=0]=e,o=this.getComboData([t])?.[0];if(!o)return;const[a,s,u]=_c(o),c=n-a,l=r-s,h=i-u;qh(o,(t=>{const e=Fc(t),[n,r,i]=_c(t),o=Sj(t,{style:{x:n+c,y:r+l,z:i+h}});this.pushChange({value:o,original:t,type:this.isCombo(e)?uc.ComboUpdated:uc.NodeUpdated}),this.model.mergeNodeData(e,o)}),(t=>this.getChildrenData(Fc(t))),"BT")}removeData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(r),this.latestRemovedComboIds=new Set(r)}))}removeNodeData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(Fc)),this.pushChange({value:this.getNodeData([t])[0],type:uc.NodeRemoved}),this.removeNodeLikeHierarchy(t)})),this.model.removeNodes(t)}))}removeEdgeData(t=[]){t.length&&(t.forEach((t=>this.pushChange({value:this.getEdgeData([t])[0],type:uc.EdgeRemoved}))),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.pushChange({value:this.getComboData([t])[0],type:uc.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)})),this.model.removeNodes(t)}))}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(mc)){const e=Gc(this.getNodeLikeData([t])[0]);this.setParent(t,void 0,mc,!1),this.model.getChildren(t,mc).forEach((t=>{const n=Tj(t),r=Fc(n);this.setParent(Fc(n),e,mc,!1);const i=Sj(n,{id:Fc(n),style:{parentId:e}});this.pushChange({value:i,original:n,type:this.isCombo(r)?uc.ComboUpdated:uc.NodeUpdated}),this.model.mergeNodeData(Fc(n),i)})),Qt(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error(`Unknown element type of id: ${t}`)}getFrontZIndex(t){let e=[];if("combo"===this.getElementType(t)){const n=[t,...this.getAncestorsData(t,mc).map(Fc)];e=this.getComboData().filter((t=>{const e=Fc(t),r=this.getAncestorsData(e,mc),i=r.map(Fc);return!r.some((t=>!!t.style?.collapsed))&&!n.includes(e)&&!i.includes(e)}))}else e=this.getNodeData().filter((e=>Fc(e)!==t));return Math.max(0,...e.map(CI))+1}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map((t=>t.id))),t.removeNodes(e.map((t=>t.id))),this.context={}}}class Aj{context;container;elementMap={};shapeTypeMap={};constructor(t){this.context=t}init(){if(!this.container){const{canvas:t}=this.context;this.container={node:t.appendChild(new _s({style:{zIndex:2}})),edge:t.appendChild(new _s({style:{zIndex:1}})),combo:t.appendChild(new _s({style:{zIndex:0}}))}}}emit(t){NI(this.context.graph,t)}forEachElementData(t){Cl.forEach((e=>{const n=this.context.model.getElementData(e);t(e,n)}))}getTheme(t){const{theme:e}=this.context.options;if(!e)return{};const n=yI("theme",e);return n?.[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map((t=>n[t]||{})))}paletteStyle={};computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData(((e,n)=>{const r=Object.assign({},el(this.getTheme(e)?.palette),el(t[e]?.palette));!oe(r)&&r?.field&&Object.assign(this.paletteStyle,function(t,e){if(!e)return{};const{type:n,color:r,field:i,invert:o}=e,a=t=>{const e=Bt(r)?yI("palette",r):r;if(Tt(e))return Object.fromEntries(t.map((([t,n])=>[t,e(o?1-n:n)])));if(Array.isArray(e)){const n=o?[...e].reverse():e;return Object.fromEntries(t.map((([t,r])=>[t,n[r%e.length]])))}return{}},s=(t,e)=>Bt(t)?e.data?.[t]:t?.(e);if("group"===n){const e=Gt(t,(t=>{if(!i)return"default";const e=s(i,t);return e?String(e):"default"})),n=a(Object.keys(e).map(((t,e)=>[t,e]))),r={};return Object.entries(e).forEach((([t,e])=>{e.forEach((e=>{r[Fc(e)]=n[t]}))})),r}if("value"===n){const[e,n]=t.reduce((([t,e],n)=>{const r=s(i,n);if(!Wt(r))throw new Error(`Palette field ${i} is not a number`);return[Math.min(t,r),Math.max(e,r)]}),[1/0,-1/0]),r=n-e;return a(t.map((t=>[t.id,(s(i,t)-e)/r])))}}(n,r))}))}getPaletteStyle(t){const e=this.paletteStyle[t];return e?{color:e}:{}}defaultStyle={};computedElementDefaultStyle(t,e){const{options:n}=this.context,r=n[t]?.style||{};this.defaultStyle[Fc(e.datum)]=SI(r,e)}computeElementsDefaultStyle(t){this.forEachElementData(((e,n)=>{n.filter((e=>void 0===t||t.includes(Fc(e)))).forEach(((t,r)=>{this.computedElementDefaultStyle(e,{datum:t,index:r,elementData:n})}))}))}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch{return[]}}stateStyle={};getElementStateStyle(t,e,n){const{options:r}=this.context;return SI(r[t]?.state?.[e]||{},n)}computeElementStatesStyle(t,e,n){this.stateStyle[Fc(n.datum)]=Object.assign({},...e.map((e=>this.getElementStateStyle(t,e,n))))}computeElementsStatesStyle(t){this.forEachElementData(((e,n)=>{n.filter((e=>void 0===t||t.includes(Fc(e)))).forEach(((t,r)=>{const i=this.getElementState(Fc(t));this.computeElementStatesStyle(e,i,{datum:t,index:r,elementData:n})}))}))}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t){this.computePaletteStyle(),this.computeElementsDefaultStyle(t),this.computeElementsStatesStyle(t)}getElement(t){return this.elementMap[t]}getNodes(){return this.container.node.children}getEdges(){return this.container.edge.children}getCombos(){return this.container.combo.children}getAnimation(t,e){const{options:n}=this.context,r=n?.[t]?.animation;if(!1===r)return!1;const i=r?.[e];if(i)return i;const o=this.getTheme(t)?.animation;if(!1===o)return!1;const a=o?.[e];return a??!1}getAnimationExecutor(t,e,n=!0,r){const{options:i}=this.context;return!1!==i.animation&&n?(n,i,o,a)=>Rh(i,this.getAnimation(t,e),{},{originalStyle:o,modifiedStyle:a,states:this.getElementState(n),...r}):()=>null}getEdgeEndsContext(t){const{source:e,target:n}=t;return{sourceNode:this.getElement(e),targetNode:this.getElement(n)}}getElementComputedStyle(t,e){const n=Fc(e),r=this.getThemeStyle(t),i=this.getPaletteStyle(n),o=e.style||{},a=this.getDefaultStyle(n),s=this.getThemeStateStyle(t,this.getElementState(n)),u=this.getStateStyle(n),c=Object.assign({},r,i,o,a,s,u);if("edge"===t)Object.assign(c,this.getEdgeEndsContext(e));else if("combo"===t){const t=this.context.model.getChildrenData(n),e=!!c.collapsed?[]:t.map((t=>this.getElement(Fc(t)))).filter(Boolean);Object.assign(c,{childrenNode:e,childrenData:t})}return c.type||(c.type={node:"circle",edge:"line",combo:"circle"}[t]),c}async draw(e={animation:!0}){this.init();const n=this.computeDrawData();if(!n)return;this.computeStyle();const{add:r,update:i,remove:o}=n,a=this.getDestroyTasks(o,e),s=this.getCreateTasks(r,e),u=this.getUpdateTasks(i,e);await(function(t,e={}){if(0===t.length)return null;const{before:n,...r}=e;e.before?.();const i=Th(t.map((t=>t())).map((t=>t())).flat().filter(Boolean));return Oh(i,r),i}([...a,...s,...u],e.silence?{}:{before:()=>this.emit(new EI(t.GraphEvent.BEFORE_DRAW)),beforeAnimate:e=>this.emit(new wI(t.GraphEvent.BEFORE_ANIMATE,cc.DRAW,e,n)),afterAnimate:e=>this.emit(new wI(t.GraphEvent.AFTER_ANIMATE,cc.DRAW,e,n)),after:()=>this.emit(new EI(t.GraphEvent.AFTER_DRAW))})?.finished)}computeDrawData(){const{model:t}=this.context,e=function(t){const e={Added:new Map,Updated:new Map,Removed:new Map};return t.forEach((t=>{const{type:n,value:r}=t,i=Fc(r);if("NodeAdded"===n||"EdgeAdded"===n||"ComboAdded"===n)e.Added.set(i,t);else if("NodeUpdated"===n||"EdgeUpdated"===n||"ComboUpdated"===n)if(e.Added.has(i))e.Added.set(i,{type:n.replace("Updated","Added"),value:r});else if(e.Updated.has(i)){const{original:t}=e.Updated.get(i);e.Updated.set(i,{type:n,value:r,original:t})}else e.Updated.set(i,t);else"NodeRemoved"!==n&&"EdgeRemoved"!==n&&"ComboRemoved"!==n||(e.Added.has(i)||e.Updated.has(i)?(e.Added.delete(i),e.Updated.delete(i)):e.Removed.set(i,t))})),[...Array.from(e.Added.values()),...Array.from(e.Updated.values()),...Array.from(e.Removed.values())]}(t.getChanges());if(0===e.length)return null;const{NodeAdded:n=[],NodeUpdated:r=[],NodeRemoved:i=[],EdgeAdded:o=[],EdgeUpdated:a=[],EdgeRemoved:s=[],ComboAdded:u=[],ComboUpdated:c=[],ComboRemoved:l=[]}=Gt(e,(t=>t.type)),h=t=>new Map(t.map((t=>{const e=t.value;return[Fc(e),e]}))),d={add:{nodes:h(n),edges:h(o),combos:h(u)},update:{nodes:h(r),edges:h(a),combos:h(c)},remove:{nodes:h(i),edges:h(s),combos:h(l)}},f=[this.updateRelatedEdgeFlow,this.arrangeDrawOrderFlow,this.collapseExpandFlow].reduce(((t,e)=>e(t)),d);return f}updateRelatedEdgeFlow=t=>{const{model:e}=this.context,{update:{nodes:n,edges:r,combos:i}}=t,o=(t,n)=>{e.getRelatedEdgesData(n).forEach((t=>r.set(Fc(t),t)))};return n.forEach(o),i.forEach(o),t};arrangeDrawOrderFlow=t=>{const{model:e}=this.context,n=t.add.combos,r=[];return n.forEach(((t,n)=>{const i=e.getAncestorsData(n,"combo").map((t=>Fc(t))).reverse();r.push([n,t,i.length])})),t.add.combos=new Map(r.sort((([,,t],[,,e])=>e-t)).map((([t,e])=>[t,e]))),t};collapseExpandFlow=t=>{const{model:e}=this.context,{add:n,update:r}=t,i=(e,n,r)=>{const i=`${n}s`;Object.entries(t).forEach((([t,n])=>{e===t?n[i].set(Fc(r),r):n[i].delete(Fc(r))}))},o=[...t.update.combos.entries(),...t.add.combos.entries()];for(;o.length;){const[t,a]=o.pop();if(!!a.style?.collapsed){const s=e.getDescendantsData(t),u=s.map(Fc),{internal:c,external:l}=rh(u,(t=>e.getRelatedEdgesData(t)));s.forEach((t=>{const n=Fc(t),r=o.findIndex((([t])=>t===n));-1!==r&&o.splice(r,1);const a=e.getElementType(n);i("remove",a,t)})),c.forEach((t=>i("remove","edge",t))),l.forEach((t=>{const e=Fc(t),i=u.includes(t.source)?"source":"target",o={...t,[i]:Fc(a)};n.edges.has(e)&&n.edges.set(e,o),r.edges.has(e)&&r.edges.set(e,o)}))}else{const n=e.getChildrenData(t),r=n.map(Fc),{edges:a}=rh(r,(t=>e.getRelatedEdgesData(t)));[...n,...a].forEach((t=>{const n=Fc(t),r=e.getElementType(n),a=this.getElement(n);i(a?"update":"add",r,t),"combo"===r&&o.push([n,t])}))}}return t};createElement(e,n,r){const{animator:i}=r,o=Fc(n);if(this.getElement(o))return()=>null;const{type:a,...s}=this.getElementComputedStyle(e,n),u=yI(e,a);if(!u)return()=>null;this.emit(new xI(t.GraphEvent.BEFORE_ELEMENT_CREATE,e,n));const c=this.container[e].appendChild(new u({id:o,style:{context:this.context,...s}}));return this.shapeTypeMap[o]=a,this.elementMap[o]=c,()=>Oh(i?.(o,c,{...c.attributes,opacity:0})||null,{after:()=>{this.emit(new xI(t.GraphEvent.AFTER_ELEMENT_CREATE,e,n)),c.onCreate()}})}getCreateTasks(t,e){const{nodes:n,edges:r,combos:i}=t,o=[];return[["node",n],["combo",i],["edge",r]].forEach((([t,n])=>{if(0===n.size)return;const r=this.getAnimationExecutor(t,"enter",e.animation);n.forEach((n=>o.push((()=>this.createElement(t,n,{...e,animator:r})))))})),o}latestElementVisibilityMap=new WeakMap;updateElement(e,n,r){const{animator:i}=r,o=Fc(n),a=this.getElement(o);if(!a)return()=>null;this.emit(new xI(t.GraphEvent.BEFORE_ELEMENT_UPDATE,e,n));const s=()=>{this.emit(new xI(t.GraphEvent.AFTER_ELEMENT_UPDATE,e,n)),a.onUpdate()},{type:u,...c}=this.getElementComputedStyle(e,n);if(this.shapeTypeMap[o]!==u)return()=>(this.destroyElement(e,n,{...r,animation:!1})(),this.createElement(e,n,{...r,animation:!1})(),s(),null);if("visibility"===r.stage&&"visibility"in c){vl(a,"opacity")||gl(a,"opacity");const t=ml(a,"opacity")??Ah("opacity");if(this.latestElementVisibilityMap.set(a,c.visibility),"hidden"!==c.visibility)return kh(a,{visibility:"visible"}),()=>Oh(i?.(o,a,{...a.attributes,opacity:0},{opacity:t})||null,{after:s});if("hidden"===c.visibility)return()=>Oh(i?.(o,a,{...a.attributes,opacity:t},{opacity:0})||null,{after:()=>{kh(a,{visibility:this.latestElementVisibilityMap.get(a)}),s()}})}const l={...a.attributes};return kh(a,c),()=>Oh(i?.(o,a,l)||null,{after:s})}getUpdateTasks(t,e){const{nodes:n,edges:r,combos:i}=t,o=[["node",n],["combo",i],["edge",r]],{animation:a,stage:s}=e,u=[];return o.forEach((([t,n])=>{if(0===n.size)return[];const r=this.getAnimationExecutor(t,s||"update",a);n.forEach((n=>u.push((()=>this.updateElement(t,n,{...e,animator:r})))))})),u}destroyElement(e,n,r){const{animator:i}=r,o=Fc(n),a=this.elementMap[o];return a?(this.emit(new xI(t.GraphEvent.BEFORE_ELEMENT_DESTROY,e,n)),()=>{const r=i?.(o,a,{...a.attributes},{opacity:0})||null;return Oh(r,{after:()=>{this.clearElement(o),a.destroy(),a.onDestroy(),this.emit(new xI(t.GraphEvent.AFTER_ELEMENT_DESTROY,e,n))}}),r}):()=>null}getDestroyTasks(t,e){const{nodes:n,edges:r,combos:i}=t,o=[["combo",i],["edge",r],["node",n]],{animation:a,stage:s}=e,u=[];return o.forEach((([t,n])=>{if(0===n.size)return[];const r=this.getAnimationExecutor(t,s||"exit",a);n.forEach((n=>u.push((()=>this.destroyElement(t,n,{...e,animator:r})))))})),u}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}destroy(){Object.values(this.elementMap).forEach((t=>t.destroy())),Object.values(this.container).forEach((t=>t.destroy())),this.container={},this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={},this.context={},this.latestElementVisibilityMap=void 0}}function Oj(t){return Wt(t.x)&&Wt(t.y)}class _j{context;supervisor;instance;animationResult;get presetOptions(){return{animation:!!_h(this.context.options,!0)}}get options(){const{options:t}=this.context;return t.layout}constructor(t){this.context=t}async presetLayout(t,e){if(!e)return;if(e.type)return this.stepLayout(t,e);const n=t.getAllNodes().reduce(((e,n)=>{if(!Oj(n.data)){let r=[0,0,0],i=0;t.getNeighbors(n.id).forEach((t=>{if(Oj(t.data)){const{x:e,y:n,z:o=0}=t.data;r=$c(r,[e,n,o]),i++}})),i&&e.push({id:n.id,data:{x:r[0]/i,y:r[1]/i,z:r[2]/i}})}return e}),[]);this.updateElementPosition({nodes:n,edges:[]},!1)}async layout(){if(!this.options)return;const e=Array.isArray(this.options)?this.options:[this.options],{graph:n}=this.context;NI(n,new EI(t.GraphEvent.BEFORE_LAYOUT));for(const t of e){const{presetLayout:e}=t,n=this.getLayoutDataModel(t);await this.presetLayout(n,e);const r=await this.stepLayout(n,{...this.presetOptions,...t});t.animation||this.updateElementPosition(r,!1)}NI(n,new EI(t.GraphEvent.AFTER_LAYOUT))}async stepLayout(t,e){return function(t){const{type:e}=t;return["compact-box","mindmap","dendrogram","indented"].includes(e)}(e)?await this.treeLayout(t,e):await this.graphLayout(t,e)}async graphLayout(t,e){const{animation:n,enableWorker:r,iterations:i=300}=e,o=this.initGraphLayout(t,e);if(this.instance=o,r)return this.supervisor=new GL(t,o,{iterations:i}),await this.supervisor.execute();if(EL(o))return n?await o.execute(t,{onTick:t=>{this.updateElementPosition(t,!1)}}):(o.execute(t),o.stop(),o.tick(i));const a=await o.execute(t);return n&&this.updateElementPosition(a,n),a}async treeLayout(t,e){const{type:n,animation:r}=e,i=yI("layout",n);if(!i)throw new Error(`The layout type ${n} is not found`);!function(t){if(t.hasTreeStructure(vc))return;t.attachTreeStructure(vc);const e=t.getAllEdges();for(const n of e){const{source:e,target:r}=n;t.setParent(r,e,vc)}}(t);const o={nodes:[],edges:[]};return t.getRoots(vc).forEach((n=>{qh(n,(e=>{e.children=t.getSuccessors(e.id)}),(e=>t.getSuccessors(e.id)),"TB");qh(i(n,e),(t=>{const{id:e,x:n,y:r}=t;o.nodes.push({id:e,data:{x:n,y:r}})}),(t=>t.children),"TB")})),r&&this.updateElementPosition(o,r),o}stopLayout(){this.instance&&EL(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutDataModel(t){const{model:e,element:n}=this.context;if(!n)return new hp;const{nodesFilter:r=(()=>!0)}=t,i=Object.fromEntries(n.getNodes().map((t=>[t.id,t]))),o=Object.fromEntries(n.getCombos().map((t=>[t.id,t]))),a=Object.fromEntries(n.getEdges().map((t=>[t.id,t]))),s=e.model.getAllNodes().filter((t=>r(t.data))),u=e.model.getAllEdges(),c=(function(t){const{type:e}=t;return!!["comboCombined","comboForce"].includes(e)||!("antv-dagre"!==e||!t.sortByCombo)}(t)?s:s.filter((t=>!o[t.id]&&function(t){return"hidden"!==se(t,["style","visibility"])}(i[t.id])))).map((t=>{const{id:e}=t,n={id:e};return!!o[e]?Object.assign(n,{data:{...Rj(o[e].attributes),_isCombo:!0}}):Object.assign(n,{data:Rj(i[e]?.attributes||{})}),n})),l=new Map(c.map((t=>[t.id,t]))),h=u.filter((t=>{const e=l.get(t.source),n=l.get(t.target);return e&&n})).map((t=>{const{id:e,source:n,target:r}=t;return{id:e,source:n,target:r,data:Rj(a[e].attributes)}})),d=new hp({nodes:c,edges:h});return e.model.hasTreeStructure(mc)&&(d.attachTreeStructure(mc),c.forEach((t=>{const n=e.model.getParent(t.id,mc);n&&d.hasNode(n.id)&&d.setParent(t.id,n.id,mc)}))),d}initGraphLayout(t,e){const{element:n,viewport:r}=this.context,{type:i,enableWorker:o,animation:a,iterations:s,...u}=e,[c,l]=r.getCanvasSize(),h=[c/2,l/2],d=e?.nodeSize??(t=>{const e=n?.getElement(t.id),{size:r}=e?.attributes||{};return Math.max(...Ic(r))}),f=yI("layout",i);if(!f)throw new Error(`The layout type ${i} is not found`);const p={nodeSize:d,width:c,height:l,center:h,...u};return"force"===i?Object.assign(p,{getMass:n=>{const{id:r}=n,{getMass:i}=e;if(i)return i(n);const{mass:o}=n.data;return Wt(o)?o:Oj(t.getNode(r).data)||Oj(n.data)?10:1}}):"dagre"===i&&Object.assign(p,{preset:[]}),new f(p)}updateElementPosition(t,e){const{model:n,element:r}=this.context;if(!r)return null;const{nodes:i,edges:o}=t,a={nodes:[],edges:[],combos:[]};return i.forEach((({id:t,data:{x:e,y:n,z:r=0}})=>{a.nodes.push({id:t,style:{x:e,y:n,z:r}})})),o.forEach((({id:t,data:{points:e=[],controlPoints:n=e.slice(1,e.length-1)}})=>{n?.length&&a.edges.push({id:t,style:{controlPoints:n.map(nl)}})})),n.updateData(a),r.draw({animation:e,silence:!0})}destroy(){this.stopLayout(),this.context={},this.supervisor?.kill(),this.supervisor=void 0,this.instance=void 0,this.animationResult=void 0}}const Rj=t=>Object.entries(t).reduce(((t,[e,n])=>(["function","object"].includes(typeof n)||["x","y","z"].includes(e)||(t[e]=n),t)),{});class Lj extends Dh{category="plugin";constructor(t){super(t),this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){return this.extensionMap[t]}}class Dj{context;get padding(){return xc(this.context.options.padding)}get paddingOffset(){const[t,e,n,r]=this.padding,[i,o,a]=[(r-e)/2,(t-n)/2,0];return[i,o,a]}constructor(t){this.context=t;const[e,n]=this.paddingOffset,{zoom:r,rotation:i,x:o=e,y:a=n}=t.options;this.transform({mode:"absolute",scale:r,translate:[o,a],rotate:i},!1)}get camera(){return this.context.canvas.getCamera()}landmarkCounter=0;createLandmark(t){return this.camera.createLandmark("landmark-"+this.landmarkCounter++,t)}getAnimation(t){const e=_h(this.context.options,t);return!!e&&function(t,e){if(null===t||!It(t))return{};var n={};return Lt(e,(function(e){ce.call(t,e)&&(n[e]=t[e])})),n}({...e},["easing","duration"])}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateArgs(t){const e=this.getZoom(),{camera:n}=this,{mode:r,translate:i=[]}=t,[o=0,a=0]=i,[s=0,u=0]=this.getCanvasCenter(),[c,l]=n.getPosition(),h=Xc([-o,-a],e);return"relative"===r?h:$c([s-c,u-l],h)}getAnimationTranslateArgs(t){const{camera:e}=this,{mode:n,translate:r=[]}=t,i=this.getZoom(),o=e.getPosition(),a=e.getFocalPoint(),s=this.getCanvasCenter(),[u=0,c=0,l=0]=r,h=Xc([-u,-c,-l],i);return"relative"===n?{position:$c(o,h),focalPoint:$c(a,h)}:{position:$c(s,h),focalPoint:$c(a,h)}}getRotateArgs(t){const{mode:e,rotate:n=0}=t;return"relative"===e?n:n-this.camera.getRoll()}getAnimationRotateArgs(t){const{mode:e,rotate:n=0}=t;return{roll:"relative"===e?this.camera.getRoll()+n:n}}getZoomArgs(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:r,scale:i=1}=t;return Vt("relative"===r?n*i:i,...e)}async transform(e,n){const{camera:r}=this,{graph:i}=this.context,{translate:o,rotate:a,scale:s,origin:u=this.getGraphCenter()}=e;this.cancelAnimation(),NI(i,new MI(t.GraphEvent.BEFORE_TRANSFORM,e));const c=this.getAnimation(n);if(c){const n={};return o&&Object.assign(n,this.getAnimationTranslateArgs(e)),Wt(a)&&Object.assign(n,this.getAnimationRotateArgs(e)),Wt(s)&&Object.assign(n,{zoom:this.getZoomArgs(e)}),NI(i,new wI(t.GraphEvent.BEFORE_ANIMATE,cc.TRANSFORM,null,e)),new Promise((r=>{this.camera.gotoLandmark(this.createLandmark(n),{...c,onfinish:()=>{NI(i,new wI(t.GraphEvent.AFTER_ANIMATE,cc.TRANSFORM,null,e)),NI(i,new MI(t.GraphEvent.AFTER_TRANSFORM,e)),r()}})}))}if(o&&r.pan(...this.getTranslateArgs(e)),Wt(a)){const[t,n]=r.getFocalPoint();u&&r.pan(u[0]-t,u[1]-n);const i=this.getRotateArgs(e);r.rotate(0,0,i),u&&r.pan(t-u[0],n-u[1])}if(Wt(s)){const t=this.getZoomArgs(e);r.setZoomByViewportPoint(t,u)}NI(i,new MI(t.GraphEvent.AFTER_TRANSFORM,e))}async fitView(t,e){const[n,r,i,o]=this.padding,{when:a="always",direction:s="both"}=t||{},[u,c]=this.context.canvas.getSize(),l=u-o-r,h=c-n-i,d=this.context.canvas.getBounds(),f=this.getBBoxInViewport(d),[p,g]=Sc(f);if("overflow"===a&&!("x"===s&&p>=l||"y"===s&&g>=h||"both"===s&&p>=l&&g>=h))return await this.fitCenter(e);const m=l/p,v=h/g,y="x"===s?m:"y"===s?v:Math.min(m,v),b=this.getAnimation(e);await this.transform({mode:"relative",scale:y,translate:$c(Yc(this.getCanvasCenter(),this.getBBoxInViewport(d).center),b?Xc(this.paddingOffset,y):this.paddingOffset)},b)}async fitCenter(t){const e=this.context.canvas.getBounds();await this.focus(e,t)}async focusElements(t,e){const{element:n}=this.context;if(!n)return;const r=Tc(t.map((t=>n.getElement(t).getRenderBounds())));await this.focus(r,e)}async focus(t,e){const{center:n}=this.getBBoxInViewport(t),r=Yc(this.getCanvasCenter(),n);await this.transform({mode:"relative",translate:$c(r,this.paddingOffset)},e)}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:r}=this.context,[i,o]=r.getViewportByCanvas(e),[a,s]=r.getViewportByCanvas(n),u=new mr;return u.setMinMax([i,o,0],[a,s,0]),u}cancelAnimation(){this.camera.landmarks?.length&&this.camera.cancelLandmarkAnimation()}}class Ij extends ap{options;static defaultOptions={autoResize:!1,width:800,height:600,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};destroyed=!1;context={model:new Pj};constructor(t){super(),this.options=Object.assign({},Ij.defaultOptions,t),this.setOptions(this.options),this.context.graph=this,this.options.autoResize&&window.addEventListener("resize",this.onResize)}getOptions(){return this.options}setOptions(t){const{animation:e,background:n,behaviors:r,combo:i,container:o,data:a,edge:s,height:u,layout:c,node:l,padding:h,theme:d,plugins:f,width:p,zoomRange:g,zoom:m}=t;n&&this.setBackground(n),r&&this.setBehaviors(r),i&&this.setCombo(i),a&&this.setData(a),s&&this.setEdge(s),c&&this.setLayout(c),l&&this.setNode(l),d&&this.setTheme(d),f&&this.setPlugins(f),(Wt(p)||Wt(u))&&this.setSize(p??this.options.width??0,u??this.options.height??0),g&&(this.options.zoomRange=g),Wt(m)&&(this.options.zoom=m),Wt(h)&&(this.options.padding=h)}setBackground(t){this.options.background=t,this.context.canvas?.setBackground(t)}getBackground(){return this.options.background}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){this.options.width=t,this.options.height=e}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t}setEdge(t){this.options.edge=t}setCombo(t){this.options.combo=t}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Tt(t)?t(this.getTheme()):t;const{background:e}=yI("theme",this.options.theme)||{};e&&!this.options.background&&this.setBackground(e)}setLayout(t){this.options.layout=Tt(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){this.options.behaviors=Tt(t)?t(this.getBehaviors()):t,this.context.behavior?.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors((e=>e.map((e=>Rt(e)&&e.key===t.key?{...e,...t}:e))))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){this.options.plugins=Tt(t)?t(this.getPlugins()):t,this.context.plugin?.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins((e=>e.map((e=>Rt(e)&&e.key===t.key?{...e,...t}:e))))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}getData(){return this.context.model.getData()}getNodeData(t){return void 0===t?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):this.context.model.getNodeData([t])?.[0]}getEdgeData(t){return void 0===t?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):this.context.model.getEdgeData([t])?.[0]}getComboData(t){return void 0===t?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):this.context.model.getComboData([t])?.[0]}setData(t){this.context.model.setData(Tt(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Tt(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Tt(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Tt(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Tt(t)?t(this.getComboData()):t)}updateData(t){this.context.model.updateData(Tt(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Tt(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Tt(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Tt(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Tt(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Tt(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Tt(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Tt(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}async initCanvas(){if(this.context.canvas)return await this.context.canvas.init();const{container:e="container",width:n,height:r,renderer:i,background:o}=this.options;if(e instanceof Nj)this.context.canvas=e,e.setBackground(o),await e.init();else{const o=Bt(e)?document.getElementById(e):e;this.emit(t.GraphEvent.BEFORE_CANVAS_INIT,{container:o,width:n,height:r});const a=new Nj({container:o,width:n,height:r,renderer:i});this.context.canvas=a,await a.init(),this.emit(t.GraphEvent.AFTER_CANVAS_INIT,{canvas:a})}}createRuntime(){this.context.options=this.options,this.context.plugin||(this.context.plugin=new Lj(this.context)),this.context.viewport||(this.context.viewport=new Dj(this.context)),this.context.element||(this.context.element=new Aj(this.context)),this.context.layout||(this.context.layout=new _j(this.context)),this.context.behavior||(this.context.behavior=new kI(this.context))}async prepare(){if(this.destroyed)throw new Error("Graph has been destroyed");await this.initCanvas(),this.createRuntime()}async render(){NI(this,new EI(t.GraphEvent.BEFORE_RENDER)),await this.prepare(),await Promise.all([this.context.element?.draw(),this.context.layout?.layout()]),await this.autoFit(),NI(this,new EI(t.GraphEvent.AFTER_RENDER))}async draw(){return await this.prepare(),this.context.element.draw()}layout(){return this.context.layout.layout()}stopLayout(){return this.context.layout.stopLayout()}async clear(){this.context.model.setData({}),await this.draw()}destroy(){const{layout:t,element:e,model:n,canvas:r,behavior:i,plugin:o}=this.context;o?.destroy(),i?.destroy(),t?.destroy(),e?.destroy(),n.destroy(),r?.destroy(),this.options={},this.context={},this.off(),window.removeEventListener("resize",this.onResize),this.destroyed=!0}getCanvas(){return this.context.canvas}resize(e,n){const r=e&&n?[e,n]:UL(this.context.canvas.getContainer());ae(r,this.getSize())||(NI(this,new EI(t.GraphEvent.BEFORE_SIZE_CHANGE,{size:r})),this.context.canvas.resize(...r),NI(this,new EI(t.GraphEvent.AFTER_SIZE_CHANGE,{size:r})))}async fitView(t,e){await(this.context.viewport?.fitView(t,e))}async fitCenter(t){await(this.context.viewport?.fitCenter(t))}async autoFit(){const{autoFit:t}=this.context.options;if(t)if(Bt(t))"view"===t?await this.fitView():"center"===t&&await this.fitCenter();else{const{type:e,animation:n}=t;"view"===e?await this.fitView(t.options,n):"center"===e&&await this.fitCenter(n)}}async focusElement(t,e){await(this.context.viewport?.focusElements(Array.isArray(t)?t:[t],e))}async zoomBy(t,e,n){await this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)}async zoomTo(t,e,n){this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)}getZoom(){return this.context.viewport.getZoom()}async rotateBy(t,e,n){await this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)}async rotateTo(t,e,n){await this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)}getRotation(){return this.context.viewport.getRotation()}async translateBy(t,e){await this.context.viewport.transform({mode:"relative",translate:t},e)}async translateTo(t,e){await this.context.viewport.transform({mode:"absolute",translate:t},e)}getPosition(){return Yc([0,0],this.getCanvasByViewport([0,0]))}async translateElementBy(t,e,n=!0){const[r,i]=Rt(t)?[t,e??!0]:[{[t]:e},n];Object.entries(r).forEach((([t,e])=>this.context.model.translateNodeBy(t,e))),await this.context.element.draw({animation:i})}async translateElementTo(t,e,n=!0){const[r,i]=Rt(t)?[t,e??!0]:[{[t]:e},n];Object.entries(r).forEach((([t,e])=>this.context.model.translateNodeTo(t,e))),await this.context.element.draw({animation:i})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return le(this.context.element.getElement(t).attributes,["context"])}async setElementVisibility(t,e,n=!0){const[r,i]=Rt(t)?[t,e??!0]:[{[t]:e},n],o={nodes:[],edges:[],combos:[]};Object.entries(r).forEach((([t,e])=>{const n=this.getElementType(t);o[`${n}s`].push({id:t,style:{visibility:e}})})),this.updateData(o),await this.context.element.draw({animation:i,stage:"visibility"})}async showElement(t,e){const n=Array.isArray(t)?t:[t];await this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"visible"]))),e)}async hideElement(t,e){const n=Array.isArray(t)?t:[t];await this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"hidden"]))),e)}getElementVisibility(t){const e=this.context.element.getElement(t);return e?.style?.visibility??"visible"}async setElementZIndex(t,e){const n={nodes:[],edges:[],combos:[]},r=Rt(t)?t:{[t]:e};Object.entries(r).forEach((([t,e])=>{const r=this.getElementType(t);n[`${r}s`].push({id:t,style:{zIndex:e}})}));const{model:i,element:o}=this.context;i.preventUpdateNodeLikeHierarchy((()=>i.updateData(n))),await o.draw({animation:!1})}async frontElement(t){const e=Array.isArray(t)?t:[t],{model:n}=this.context,r={};e.map((t=>{const e=n.getFrontZIndex(t);if("combo"===n.getElementType(t)){const i=n.getAncestorsData(t,mc).at(-1)||this.getComboData(t),o=[i,...n.getDescendantsData(Fc(i))].filter((t=>n.isCombo(Fc(t)))),a=e-CI(i);o.forEach((t=>{r[Fc(t)]=CI(t)+a}))}else r[t]=e})),await this.setElementZIndex(r)}getElementZIndex(t){return CI(this.context.model.getElementsData([t])[0])}async setElementState(t,e,n=!0){const[r,i]=Rt(t)?[t,e??!0]:[{[t]:e},n],o={nodes:[],edges:[],combos:[]};Object.entries(r).forEach((([t,e])=>{const n=this.getElementType(t);var r;o[`${n}s`].push({id:t,style:{states:(r=e,r?Array.isArray(r)?r:[r]:[])}})})),this.updateData(o),await this.context.element.draw({animation:i})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}async collapse(t,e=!0){this.setElementCollapsibility(t,!0),await this.context.element.draw({animation:e,stage:"collapse"})}async expand(t,e=!0){this.setElementCollapsibility(t,!1),await this.context.element.draw({animation:e,stage:"expand"})}setElementCollapsibility(t,e){const n=this.getElementType(t);"node"===n?this.updateNodeData([{id:t,style:{collapsed:e}}]):"combo"===n&&this.updateComboData([{id:t,style:{collapsed:e}}])}async toDataURL(t={}){return this.context.canvas.toDataURL(t)}getCanvasByViewport(t){return nl(this.context.canvas.viewport2Canvas(rl(t)))}getViewportByCanvas(t){return nl(this.context.canvas.canvas2Viewport(rl(t)))}getClientByCanvas(t){const e=this.context.canvas.canvas2Viewport(rl(t));return nl(this.context.canvas.viewport2Canvas(e))}getCanvasByClient(t){const e=this.context.canvas.client2Viewport(rl(t));return nl(this.context.canvas.viewport2Canvas(e))}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}onResize=te((()=>{this.resize()}),300);on(t,e){return super.on(t,e)}once(t,e){return super.once(t,e)}}const jj={idOf:Fc,treeToGraphData:function(t,e){const{getNodeData:n=(t=>{if(!t.children)return t;const{children:e,style:n={},...r}=t;return{style:{...n,children:e.map((t=>t.id))},...r}}),getEdgeData:r=((t,e)=>({source:t.id,target:e.id})),getChildren:i=(t=>t.children||[])}=e||{},o=[],a=[];return qh(t,(t=>{o.push(n(t));const e=i(t);for(const n of e)a.push(r(t,n))}),(t=>i(t)),"TB"),{nodes:o,edges:a}},subStyleProps:Wc,omitStyleProps:Hc},zj={dark:fI,light:pI};t.BaseBehavior=jh,t.BaseCombo=Il,t.BaseEdge=ah,t.BaseNode=Nl,t.BasePlugin=VL,t.BaseShape=El,t.CameraSetting=class extends VL{constructor(t,e){super(t,e),this.bindEvents()}update(t){this.setOptions(t),super.update(t)}bindEvents(){this.context.graph.once(t.GraphEvent.BEFORE_DRAW,(()=>this.setOptions(this.options)))}setOptions=t=>{const e=(t,e)=>{switch(t){case"projectionMode":return"perspective"===e?1:0;case"cameraType":return{orbiting:0,exploring:1,tracking:2}[e];case"aspect":return"number"==typeof e?e:this.getCanvasAspect();default:return e}};Object.entries({cameraType:"setType",near:"setNear",far:"setFar",fov:"setFov",aspect:"setAspect",projectionMode:"setProjectionMode",distance:"setDistance",minDistance:"setMinDistance",maxDistance:"setMaxDistance",roll:"setRoll",elevation:"setElevation",azimuth:"setAzimuth"}).forEach((([n,r])=>{const i=t[n];if(void 0!==i){const t=e(n,i);this.context.canvas.getCamera()[r](t)}}))};getCanvasAspect(){const[t,e]=this.context.viewport.getCanvasSize();return t/e}},t.Circle=kl,t.CircleCombo=jl,t.ComboEvent=t.NodeEvent,t.Cubic=sh,t.CubicHorizontal=uh,t.CubicVertical=ch,t.Diamond=Pl,t.DragCanvas=Vh,t.Ellipse=Al,t.Graph=Ij,t.Hexagon=Ol,t.Image=_l,t.Line=lh,t.Polyline=hh,t.Quadratic=dh,t.Rect=Rl,t.RectCombo=zl,t.Shortcut=Gh,t.Star=Ll,t.Theme=zj,t.Triangle=Dl,t.Utils=jj,t.ZoomCanvas=Kh,t.getExtension=yI,t.getExtensions=function(t){return mI[t]},t.register=vI,t.version="5.0.0"}));
6
+ */const wI=Symbol("Comlink.proxy"),MI=Symbol("Comlink.endpoint"),NI=Symbol("Comlink.releaseProxy"),SI=Symbol("Comlink.finalizer"),CI=Symbol("Comlink.thrown"),TI=t=>"object"==typeof t&&null!==t||"function"==typeof t,kI=new Map([["proxy",{canHandle:t=>TI(t)&&t[wI],serialize(t){const{port1:e,port2:n}=new MessageChannel;return PI(t,e),[n,[n]]},deserialize:t=>(t.start(),OI(t))}],["throw",{canHandle:t=>TI(t)&&CI in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function PI(t,e=globalThis,n=["*"]){e.addEventListener("message",(function r(i){if(!i||!i.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:o,type:a,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(FI);let u;try{const e=s.slice(0,-1).reduce(((t,e)=>t[e]),t),n=s.reduce(((t,e)=>t[e]),t);switch(a){case"GET":u=n;break;case"SET":e[s.slice(-1)[0]]=FI(i.data.value),u=!0;break;case"APPLY":u=n.apply(e,c);break;case"CONSTRUCT":u=function(t){return Object.assign(t,{[wI]:!0})}(new n(...c));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;PI(t,n),u=function(t,e){return zI.set(t,e),t}(e,[e])}break;case"RELEASE":u=void 0;break;default:return}}catch(t){u={value:t,[CI]:0}}Promise.resolve(u).catch((t=>({value:t,[CI]:0}))).then((n=>{const[i,s]=BI(n);e.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===a&&(e.removeEventListener("message",r),AI(e),SI in t&&"function"==typeof t[SI]&&t[SI]())})).catch((t=>{const[n,r]=BI({value:new TypeError("Unserializable return value"),[CI]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)}))})),e.start&&e.start()}function AI(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function OI(t,e){return LI(t,[],e)}function _I(t){if(t)throw new Error("Proxy has been released and is not useable")}function RI(t){return GI(t,{type:"RELEASE"}).then((()=>{AI(t)}))}const DI=new WeakMap,II="FinalizationRegistry"in globalThis&&new FinalizationRegistry((t=>{const e=(DI.get(t)||0)-1;DI.set(t,e),0===e&&RI(t)}));function LI(t,e=[],n=function(){}){let r=!1;const i=new Proxy(n,{get(n,o){if(_I(r),o===NI)return()=>{!function(t){II&&II.unregister(t)}(i),RI(t),r=!0};if("then"===o){if(0===e.length)return{then:()=>i};const n=GI(t,{type:"GET",path:e.map((t=>t.toString()))}).then(FI);return n.then.bind(n)}return LI(t,[...e,o])},set(n,i,o){_I(r);const[a,s]=BI(o);return GI(t,{type:"SET",path:[...e,i].map((t=>t.toString())),value:a},s).then(FI)},apply(n,i,o){_I(r);const a=e[e.length-1];if(a===MI)return GI(t,{type:"ENDPOINT"}).then(FI);if("bind"===a)return LI(t,e.slice(0,-1));const[s,c]=jI(o);return GI(t,{type:"APPLY",path:e.map((t=>t.toString())),argumentList:s},c).then(FI)},construct(n,i){_I(r);const[o,a]=jI(i);return GI(t,{type:"CONSTRUCT",path:e.map((t=>t.toString())),argumentList:o},a).then(FI)}});return function(t,e){const n=(DI.get(e)||0)+1;DI.set(e,n),II&&II.register(t,e,t)}(i,t),i}function jI(t){const e=t.map(BI);return[e.map((t=>t[0])),(n=e.map((t=>t[1])),Array.prototype.concat.apply([],n))];var n}const zI=new WeakMap;function BI(t){for(const[e,n]of kI)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},zI.get(t)||[]]}function FI(t){switch(t.type){case"HANDLER":return kI.get(t.name).deserialize(t.value);case"RAW":return t.value}}function GI(t,e,n){return new Promise((r=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.addEventListener("message",(function e(n){n.data&&n.data.id&&n.data.id===i&&(t.removeEventListener("message",e),r(n.data))})),t.start&&t.start(),t.postMessage(Object.assign({id:i},e),n)}))}class VI extends Op{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=OI(new Worker(new URL("./worker.js","undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:e&&e.src||new URL("g6.min.js",document.baseURI).href),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return a(this,void 0,void 0,(function*(){if(this.running)return this;this.running=!0;const e=o(this.layout.options,["onTick"]),n={};Object.keys(e).forEach((t=>{kt(e[t])||(n[t]=e[t])}));const r={layout:{id:this.layout.id,options:n,iterations:null===(t=this.options)||void 0===t?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},i=new Float32Array([0]),[a]=yield this.proxy.calculateLayout(r,[i]);return a}))}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[NI]()}isRunning(){return this.running}}class WI extends qh{}const UI=t=>t?parseInt(t):0;function HI(t){let e=640,n=480;const[r,i]=function(t){const e=getComputedStyle(t),n=t.clientWidth||UI(e.width),r=t.clientHeight||UI(e.height);return[n-(UI(e.paddingLeft)+UI(e.paddingRight)),r-(UI(e.paddingTop)+UI(e.paddingBottom))]}(t);e=r||e,n=i||n;return[Math.max(Wt(e)?e:1,1),Math.max(Wt(n)?n:1,1)]}function qI(t,e=!0){const n=document.createElement("div");return n.setAttribute("class",`g6-${t}`),n.style.position="absolute",n.style.display="block",e&&(n.style.top="0px",n.style.left="0px",n.style.height="100%",n.style.width="100%",n.style.overflow="hidden",n.style.pointerEvents="none"),n}function $I(t,e="div",n={},r="",i=document.body){const o=document.getElementById(t);o&&o.remove();const a=document.createElement(e);return a.innerHTML=r,a.id=t,Object.assign(a.style,n),i.appendChild(a),a}class YI extends WI{static defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};$element=qI("contextmenu",!1);constructor(t,e){super(t,Object.assign({},YI.defaultOptions,e));this.context.canvas.getContainer().appendChild(this.$element),$I("g6-contextmenu-css","style",{},"\n .g6-contextmenu {\n font-size: 12px;\n background-color: rgba(255, 255, 255, 0.96);\n border-radius: 4px;\n overflow: hidden;\n box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;\n transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s;\n }\n\n .g6-contextmenu-ul {\n max-width: 256px;\n min-width: 96px;\n list-style: none;\n padding: 0;\n margin: 0;\n }\n\n .g6-contextmenu-li {\n padding: 8px 12px;\n cursor: pointer;\n user-select: none;\n }\n\n .g6-contextmenu-li:hover {\n background-color: #f5f5f5;\n cursor: pointer;\n }\n",document.head),this.update(e)}async showContextmenu(t){const{enable:e,offset:n}=this.options;if("function"==typeof e&&!e(t)||!e)return void this.hideContextmenu();const r=await this.getDOMContent(t);r instanceof HTMLElement?this.$element.appendChild(r):this.$element.innerHTML=r;const i=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-i.left+n[0]}px`,this.$element.style.top=`${t.client.y-i.top+n[1]}px`,this.$element.style.display="block"}hideContextmenu(){this.$element.style.display="none"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}async getDOMContent(t){const{getContent:e,getItems:n}=this.options;return n?`\n <ul class="g6-contextmenu-ul">\n ${(await n(t)).map((t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`)).join("")}\n </ul>\n `:await e(t)}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick)}onTriggerEvent=t=>{t.preventDefault?.(),this.showContextmenu(t)};onMenuItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof HTMLElement){if(t.target.className.includes("g6-contextmenu-li")){const n=t.target.getAttribute("value");e&&e(n,t.target),this.hideContextmenu()}this.context.graph.getCanvas().getContainer().contains(t.target)||this.hideContextmenu()}}}class KI extends WI{static defaultOptions={lineWidth:1,border:!0,borderLineWidth:1,borderStroke:"#0001",borderStyle:"solid",stroke:"#0001",size:20,tickCount:4,tickStrokeOpacity:.5};$element=qI("grid-line");offset=[0,0];constructor(t,e){super(t,Object.assign({},KI.defaultOptions,e));this.context.canvas.getContainer().appendChild(this.$element),this.updateStyle(),this.bindEvents()}update(t){super.update(t),this.updateStyle()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{size:t,stroke:e,lineWidth:n,border:r,borderLineWidth:i,borderStroke:o,borderStyle:a}=this.options;Object.assign(this.$element.style,{border:r?`${i}px ${a} ${o}`:"none",backgroundImage:`linear-gradient(${e} ${n}px, transparent ${n}px), linear-gradient(90deg, ${e} ${n}px, transparent ${n}px)`,backgroundSize:`${t}px ${t}px`})}updateOffset(t){this.offset=function(t,e){return t.map((t=>t%e))}(Yu(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}onTransform=t=>{if(!this.options.follow)return;const{data:{translate:e}}=t;e&&this.updateOffset(e)};destroy(){this.context.graph.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}var XI;function ZI(t){const e={Added:new Map,Updated:new Map,Removed:new Map};return t.forEach((t=>{const{type:n,value:r}=t,i=Fu(r);if("NodeAdded"===n||"EdgeAdded"===n||"ComboAdded"===n)e.Added.set(i,t);else if("NodeUpdated"===n||"EdgeUpdated"===n||"ComboUpdated"===n)if(e.Added.has(i))e.Added.set(i,{type:n.replace("Updated","Added"),value:r});else if(e.Updated.has(i)){const{original:t}=e.Updated.get(i);e.Updated.set(i,{type:n,value:r,original:t})}else e.Updated.set(i,t);else"NodeRemoved"!==n&&"EdgeRemoved"!==n&&"ComboRemoved"!==n||(e.Added.has(i)||e.Updated.has(i)?(e.Added.delete(i),e.Updated.delete(i)):e.Removed.set(i,t))})),[...Array.from(e.Added.values()),...Array.from(e.Updated.values()),...Array.from(e.Removed.values())]}function QI(t){const{NodeAdded:e=[],NodeUpdated:n=[],NodeRemoved:r=[],EdgeAdded:i=[],EdgeUpdated:o=[],EdgeRemoved:a=[],ComboAdded:s=[],ComboUpdated:c=[],ComboRemoved:u=[]}=Gt(t,(t=>t.type));return{add:{nodes:e,edges:i,combos:s},update:{nodes:n,edges:o,combos:c},remove:{nodes:r,edges:a,combos:u}}}function JI(t,e){for(const n in t)Rt(t[n])&&!Array.isArray(t[n])&&null!==t[n]?(e[n]||(e[n]={}),JI(t[n],e[n])):e[n]||(e[n]=Fh(n))}function tL(t,e=!1,n){const r={animation:e,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:o,remove:a}=QI(ZI(t));return["nodes","edges","combos"].forEach((t=>{o[t]&&o[t].forEach((e=>{const i={...e.value};let o={...e.original};if(n){const t=n.graph.getElementType(Fu(e.original)),{color:r}=n.element.getElementComputedStyle(t,e.original);o={...e.original,style:{color:r,...e.original.style}}}JI(i,o),r.current.update[t]||=[],r.current.update[t].push(i),r.original.update[t]||=[],r.original.update[t].push(o)})),i[t]&&i[t].forEach((e=>{const n={...e.value};r.current.add[t]||=[],r.current.add[t].push(n),r.original.remove[t]||=[],r.original.remove[t].push(n)})),a[t]&&a[t].forEach((e=>{const n={...e.value};r.current.remove[t]||=[],r.current.remove[t].push(n),r.original.add[t]||=[],r.original.add[t].push(n)}))})),r}!function(t){t.UNDO="undo",t.REDO="redo",t.CANCEL="cancel",t.ADD="add",t.CLEAR="clear",t.CHANGE="change"}(XI||(XI={}));class eL extends WI{static defaultOptions={stackSize:0};emitter;batchChanges=null;batchAnimation=!1;undoStack=[];redoStack=[];isFirstDraw=!0;freezed=!1;constructor(e,n){super(e,Object.assign({},eL.defaultOptions,n)),this.emitter=new Op;const{graph:r}=this.context;r.on(t.GraphEvent.AFTER_DRAW,this.addCommand),r.on(t.GraphEvent.BATCH_START,this.initBatchCommand),r.on(t.GraphEvent.BATCH_END,this.addCommand)}canUndo=()=>this.undoStack.length>0;canRedo=()=>this.redoStack.length>0;undo=()=>{const t=this.undoStack.pop();return t&&(this.executeCommand(t),this.options.beforeAddCommand?.(t,!1),this.redoStack.push(t),this.options.afterAddCommand?.(t,!1),this.notify(XI.UNDO,t)),this};redo=()=>{const t=this.redoStack.pop();return t&&(this.executeCommand(t,!1),this.undoStackPush(t),this.notify(XI.REDO,t)),this};undoAndCancel=()=>{const t=this.undoStack.pop();return t&&(this.executeCommand(t,!1),this.redoStack=[],this.notify(XI.CANCEL,t)),this};executeCommand=(t,e=!0)=>{this.freezed=!0,this.options.executeCommand?.(t);const n=e?t.original:t.current;this.context.graph.addData(n.add),this.context.graph.updateData(n.update),this.context.graph.removeData(Vu(n.remove,!1)),this.context.element?.draw({silence:!0,animation:t.animation}),this.freezed=!1};addCommand=e=>{if(this.isFirstDraw)this.isFirstDraw=!1;else if(!this.freezed){if(e.type===t.GraphEvent.AFTER_DRAW){const{dataChanges:t=[],animation:n=!0}=e.data;if(this.context.batch?.isBatching){if(!this.batchChanges)return;return this.batchChanges.push(t),void(this.batchAnimation&&=n)}this.batchChanges=[t],this.batchAnimation=n}this.undoStackPush(tL(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(XI.ADD,this.undoStack[this.undoStack.length-1])}};initBatchCommand=t=>{const{initiate:e}=t.data;if(this.batchAnimation=!1,e)this.batchChanges=[];else{this.undoStack.pop()||(this.batchChanges=null)}};undoStackPush(t){const{stackSize:e}=this.options;0!==e&&this.undoStack.length>=e&&this.undoStack.shift(),this.options.beforeAddCommand?.(t,!0),this.undoStack.push(t),this.options.afterAddCommand?.(t,!0)}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(XI.CLEAR,null)}notify(t,e){this.emitter.emit(t,{cmd:e}),this.emitter.emit(XI.CHANGE,{cmd:e})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.addCommand),e.off(t.GraphEvent.BATCH_START,this.initBatchCommand),e.off(t.GraphEvent.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}function nL(t,e,n,r,i,o){const a=(o-e)*(n-t)-(r-e)*(i-t);return a>0||!(a<0)}var rL=function(t,e){const n=t[0][0],r=t[0][1],i=t[1][0],o=t[1][1],a=e[0][0],s=e[0][1],c=e[1][0],u=e[1][1];return nL(n,r,a,s,c,u)!==nL(i,o,a,s,c,u)&&nL(n,r,i,o,a,s)!==nL(n,r,i,o,c,u)};function iL(t,e){this._cells=[],this._cellSize=e,this._reverseCellSize=1/e;for(let e=0;e<t.length;e++){const n=t[e],r=this.coordToCellNum(n[0]),i=this.coordToCellNum(n[1]);if(this._cells[r])this._cells[r][i]?this._cells[r][i].push(n):this._cells[r][i]=[n];else{const t=[];t[i]=[n],this._cells[r]=t}}}function oL(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}iL.prototype={cellPoints:function(t,e){return void 0!==this._cells[t]&&void 0!==this._cells[t][e]?this._cells[t][e]:[]},rangePoints:function(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this.coordToCellNum(t[2]),i=this.coordToCellNum(t[3]),o=[];for(let t=e;t<=r;t++)for(let e=n;e<=i;e++)for(let n=0;n<this.cellPoints(t,e).length;n++)o.push(this.cellPoints(t,e)[n]);return o},removePoint:function(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this._cells[e][n];let i;for(let e=0;e<r.length;e++)if(r[e][0]===t[0]&&r[e][1]===t[1]){i=e;break}return r.splice(i,1),r},trunc:Math.trunc||function(t){return t-t%1},coordToCellNum:function(t){return this.trunc(t*this._reverseCellSize)},extendBbox:function(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}};var aL=function(t){const e=function(t){const e=[];for(let n=0;n<t.length;n++){for(;e.length>=2&&oL(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}return e.pop(),e}(t),n=function(t){const e=t.reverse(),n=[];for(let t=0;t<e.length;t++){for(;n.length>=2&&oL(n[n.length-2],n[n.length-1],e[t])<=0;)n.pop();n.push(e[t])}return n.pop(),n}(t).concat(e);return n.push(t[0]),n};const sL=rL,cL=function(t,e){return new iL(t,e)},uL={toXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","return [pt"+e[0]+",pt"+e[1]+"];")(t)}))},fromXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","const o = {}; o"+e[0]+"= pt[0]; o"+e[1]+"= pt[1]; return o;")(t)}))}},lL=aL;function hL(t,e){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function dL(t,e,n){const r=[e[0]-t[0],e[1]-t[1]],i=[n[0]-t[0],n[1]-t[1]],o=hL(t,e),a=hL(t,n);return(r[0]*i[0]+r[1]*i[1])/Math.sqrt(o*a)}function fL(t,e){for(let n=0;n<e.length-1;n++){const r=[e[n],e[n+1]];if(!(t[0][0]===r[0][0]&&t[0][1]===r[0][1]||t[0][0]===r[1][0]&&t[0][1]===r[1][1])&&sL(t,r))return!0}return!1}function pL(t){return[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]}function gL(t,e,n){let r,i,o=null,a=vL,s=vL;for(let c=0;c<e.length;c++)r=dL(t[0],t[1],e[c]),i=dL(t[1],t[0],e[c]),r>a&&i>s&&!fL([t[0],e[c]],n)&&!fL([t[1],e[c]],n)&&(a=r,s=i,o=e[c]);return o}function mL(t,e,n,r,i){let o=!1;for(let a=0;a<t.length-1;a++){const s=[t[a],t[a+1]],c=s[0][0]+","+s[0][1]+","+s[1][0]+","+s[1][1];if(hL(s[0],s[1])<e||i.has(c))continue;let u,l,h,d=0,f=pL(s);do{f=r.extendBbox(f,d),u=f[2]-f[0],l=f[3]-f[1],h=gL(s,r.rangePoints(f),t),d++}while(null===h&&(n[0]>u||n[1]>l));u>=n[0]&&l>=n[1]&&i.add(c),null!==h&&(t.splice(a+1,0,h),r.removePoint(h),o=!0)}return o?mL(t,e,n,r,i):t}const vL=Math.cos(90/(180/Math.PI)),yL=.6;var bL=function(t,e,n){let r=e||20;const i=function(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++){const i=t[r];n[0]===i[0]&&n[1]===i[1]||e.push(i),n=i}return e}(function(t){return t.sort((function(t,e){return t[0]-e[0]||t[1]-e[1]}))}(uL.toXy(t,n)));if(i.length<4){const t=i.concat([i[0]]);return n?uL.fromXy(t,n):t}const o=function(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let o=t.length-1;o>=0;o--)t[o][0]<e&&(e=t[o][0]),t[o][1]<n&&(n=t[o][1]),t[o][0]>r&&(r=t[o][0]),t[o][1]>i&&(i=t[o][1]);return[r-e,i-n]}(i),a=[o[0]*yL,o[1]*yL],s=lL(i),c=i.filter((function(t){return s.indexOf(t)<0})),u=Math.ceil(1/(i.length/(o[0]*o[1]))),l=mL(s,Math.pow(r,2),a,cL(c,u),new Set);return n?uL.fromXy(l,n):l},xL=f(bL);function EL(t,e,n,r,i,o,a){const[s,c]=Du(t,e),u={x:s+n,y:c+r,textAlign:"left"===e?"right":"right"===e?"left":"center",textBaseline:"top"===e?"bottom":"bottom"===e?"top":"middle",transform:"none"};if("center"===e||!i)return u;const l=yd(o);if(!l||l.length<=3)return u;const h=l.map(((t,e)=>{const n=t,r=l[(e+1)%l.length];return ae(n,r)?null:[n,r]})).filter(Boolean),d=function(t,e){let n=1/0,r=[[0,0],[0,0]];return e.forEach((e=>{const i=yl(t,e);i<n&&(n=i,r=e)})),r}([s,c],h),f=bl([s,c],d);if(f&&d&&(u.x=f[0]+n,u.y=f[1]+r,a)){const t=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));u.transform=`rotate(${t/Math.PI*180}deg)`,u.textAlign="center","right"!==e&&"left"!==e||(u.textBaseline=t>0?"right"===e?"bottom":"top":"right"===e?"top":"bottom")}return u}let wL=class t extends Al{static defaultStyleProps={label:!0,labelPlacement:"bottom",labelCloseToHull:!0,labelAutoRotate:!0,labelOffsetX:0,labelOffsetY:0};constructor(e){super(re({},{style:t.defaultStyleProps},e))}getLabelStyle(t){if(!t.label||!t.path||0===t.path.length)return!1;const{maxWidth:e,offsetX:n,offsetY:r,autoRotate:i,placement:o,closeToHull:a,...s}=Uu(this.getGraphicStyle(t),"label"),c=this.shapeMap.contour,u=c?.getRenderBounds();return Object.assign(EL(u,o,n,r,a,t.path,i),{wordWrapWidth:wl(u,e)},s)}getContourStyle(t){return this.getGraphicStyle(t)}render(t,e){this.upsert("contour",js,this.getContourStyle(t),e),this.upsert("label",Ol,this.getLabelStyle(t),e)}};const ML=(t,e,n)=>{if("sharp"===n)return[["M",t[0]-e,t[1]-e],["L",t[0]+e,t[1]-e],["L",t[0]+e,t[1]+e],["L",t[0]-e,t[1]+e],["Z"]];const r=[e,e,0,0,0];return[["M",t[0],t[1]-e],["A",...r,t[0],t[1]+e],["A",...r,t[0],t[1]-e]]},NL=(t,e,n)=>{const r=[e,e,0,0,0],i="sharp"===n?Yu(t[0],Qu(el(Ku(t[0],t[1])),e)):t[0],o="sharp"===n?Yu(t[1],Qu(el(Ku(t[1],t[0])),e)):t[1],a=Qu(el(rl(Ku(i,o),!1)),e),s=Qu(a,-1),c=Yu(i,a),u=Yu(o,a),l=Yu(o,s),h=Yu(i,s);return"sharp"===n?[["M",c[0],c[1]],["L",u[0],u[1]],["L",l[0],l[1]],["L",h[0],h[1]],["Z"]]:[["M",c[0],c[1]],["L",u[0],u[1]],["A",...r,l[0],l[1]],["L",h[0],h[1]],["A",...r,c[0],c[1]]]},SL=(t,e)=>{const n=xl(t).map(((n,r)=>{const i=(r-2+t.length)%t.length,o=(r-1+t.length)%t.length,a=(r+1)%t.length,s=t[i],c=t[o],u=t[a],l=Ku(s,c),h=Ku(c,n),d=Ku(n,u),f=(t,e)=>nl(t,e,!0)<Math.PI,p=f(l,h),g=f(h,d),m=t=>Qu(el(rl(t,!1)),e),v=m(h);return[{p:il(Yu(c,p?m(l):v)),concave:p&&c},{p:il(Yu(n,g?m(d):v)),concave:g&&n}]})),r=[e,e,0,0,0],i=n.findIndex(((t,e)=>!(n[(e-1+n.length)%n.length][0].concave||n[(e-1+n.length)%n.length][1].concave||t[0].concave||t[0].concave||t[1].concave))),o=n.slice(i).concat(n.slice(0,i));let a=[];return o.flatMap(((t,e)=>{const i=[],s=o[n.length-1];return 0===e&&i.push(["M",...s[1].p]),t[0].concave?a.push(t[0].p,t[1].p):i.push(["A",...r,...t[0].p]),t[1].concave?a.unshift(t[1].p):i.push(["L",...t[1].p]),3===a.length&&(i.pop(),i.push(["C",...a.flat()]),a=[]),i}))},CL=(t,e)=>{const n=xl(t).map(((e,n)=>({p:e,v:el(Ku(t[(n+1)%t.length],e))})));return n.forEach(((r,i)=>{const o=i>0?i-1:t.length-1,a=n[o].v,s=el(Yu(a,Qu(r.v,nl(a,r.v,!0)<Math.PI?1:-1)));r.p=Yu(r.p,Qu(s,e))})),(t=>{if(t.length<2)return[["M",0,0],["L",0,0]];const e=t[0],n=t[1],r=t[t.length-1],i=t[t.length-2];t.unshift(i,r),t.push(e,n);const o=[["M",r[0],r[1]]];for(let e=1;e<t.length-2;e+=1){const[n,r]=t[e-1],[i,a]=t[e],[s,c]=t[e+1],[u,l]=e!==t.length-2?t[e+2]:[s,c],h=i+(s-n)/6,d=a+(c-r)/6,f=s-(u-i)/6,p=c-(l-a)/6;o.push(["C",h,d,f,p,s,c])}return o})(n.map((t=>t.p)))},TL=(t,e)=>{const n=t.map(((n,r)=>{const i=t[0===r?t.length-1:r-1],o=ol(Qu(el(rl(Ku(i,n),!1)),e));return[Yu(i,o),Yu(n,o)]})).flat();return n.map(((t,e)=>{if(e%2==0)return null;return cl([n[(e-1)%n.length],n[e%n.length]],[n[(e+1)%n.length],n[(e+2)%n.length]],!0)})).filter(Boolean).map(((t,e)=>[0===e?"M":"L",t[0],t[1]])).concat([["Z"]])};class kL extends WI{shape;hullMemberIds=[];path;firstRender=!1;static defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",stroke:"blue",opacity:.2};constructor(t,e){super(t,Object.assign({},kL.defaultOptions,e)),this.bindEvents()}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawHull),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const{members:e,padding:n,corner:r,...i}=this.options;return{...i,path:this.getHullPath(t)}}drawHull=()=>{this.shape=new wL({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape),this.firstRender=!0};updateHullPath=t=>{this.firstRender&&this.options.members.includes(Fu(t.data))&&this.shape.update({path:this.getHullPath(!0)})};getHullPath=(t=!1)=>{const{graph:e}=this.context,n=this.options.members.map((t=>e.getNodeData(t))),r=xL(n.map(_u),this.options.concavity).slice(1).reverse(),i=r.flatMap((t=>n.filter((e=>ae(_u(e),t))).map(Fu)));return ae(i,this.hullMemberIds)&&!t||(this.hullMemberIds=i,this.path=function(t,e,n){if(1===t.length)return ML(t[0],e,n);if(2===t.length)return NL(t,e,n);switch(n){case"smooth":return CL(t,e);case"sharp":return TL(t,e);default:return SL(t,e)}}(r,this.getPadding(),this.options.corner)),this.path};getPadding(){const{graph:t}=this.context,e=this.hullMemberIds.reduce(((e,n)=>{const{halfExtents:r}=t.getElementRenderBounds(n),i=Math.max(r[0],r[1]);return Math.max(e,i)}),0);return e+this.options.padding}addMembers(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({path:this.getHullPath()})}removeMembers(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter((t=>!e.includes(t))),e.some((t=>this.hullMemberIds.includes(t)))&&this.shape.update({path:this.getHullPath()})}updateMembers(t){this.options.members=kt(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}updateOptions(t){this.options=kt(t)?t(this.options):t,this.shape.update({...this.options,path:this.getHullPath(!0)})}destroy(){this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}function PL(t,e){e(t),t.children&&t.children.forEach((function(t){t&&PL(t,e)}))}function AL(t){OL(t,!1)}function OL(t,e){var n=e?"visible":"hidden";PL(t,(function(t){t.attr("visibility",n)}))}var _L=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=t.apply(this,l([],u(e),!1))||this;return r.addEventListener(Za.INSERTED,(function(){AL(r)})),r}return r(e,t),e}(Rs);function RL(t){var e=t.appendChild(new _L({class:"offscreen"}));return AL(e),e}var DL=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=o(e,["style"]);return t.call(this,i({style:i({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},r))||this}return r(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=RL(this)),this._offscreen},enumerable:!1,configurable:!0}),e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e}(Gs),IL=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=r}return Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},t.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},t}();var LL,jL=function(t,e){var n=function(t){return"".concat(e,"-").concat(t)},r=Object.fromEntries(Object.entries(t).map((function(t){var e=u(t,2),r=e[0],i=e[1],o=n(i);return[r,{name:o,class:".".concat(o),id:"#".concat(o),toString:function(){return o}}]})));return Object.assign(r,{prefix:n}),r},zL=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=5),Object.entries(e).forEach((function(i){var o=u(i,2),a=o[0],s=o[1],c=t;Object.prototype.hasOwnProperty.call(e,a)&&(s?Lt(s)?(Lt(t[a])||(c[a]={}),n<r?zL(t[a],s,n+1,r):c[a]=e[a]):_t(s)?(c[a]=[],c[a]=c[a].concat(s)):c[a]=s:c[a]=s)}))},BL=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)zL(t,e[r]);return t};!function(t,e,n){if(void 0===n&&(n=128),!kt(t))throw new TypeError("Expected a function");var r=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e?e.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var s=t.apply(this,n);return a.set(o,s),s};r.cache=function(t){var e,n,r,i=t||1;function o(t,o){++e>i&&(r=n,a(1),++e),n[t]=o}function a(t){e=0,n=Object.create(null),t||(r=Object.create(null))}return a(),{clear:a,has:function(t){return void 0!==n[t]||void 0!==r[t]},get:function(t){var e=n[t];return void 0!==e?e:void 0!==(e=r[t])?(o(t,e),e):void 0},set:function(t,e){void 0!==n[t]?n[t]=e:o(t,e)}}}(n)}((function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,a=e.fontVariant;return LL||(LL=fs.offscreenCanvasCreator.getOrCreateContext(void 0)),LL.font=[o,a,i,"".concat(n,"px"),r].join(" "),LL.measureText(t).width}),(function(t,e){return[t,Object.values(e||FL(t)).join()].join("")}),4096);var FL=function(t){var e=t.style.fontFamily||"sans-serif",n=t.style.fontWeight||"normal",r=t.style.fontStyle||"normal",i=t.style.fontVariant,o=t.style.fontSize;return{fontSize:o="object"==typeof o?o.value:o,fontFamily:e,fontWeight:n,fontStyle:r,fontVariant:i}};function GL(t,e,n){void 0===n&&(n="..."),function(t,e){var n=function(t){return"text"===t.nodeName?t:"g"===t.nodeName&&1===t.children.length&&"text"===t.children[0].nodeName?t.children[0]:null}(t);n&&n.attr(e)}(t,{wordWrap:!0,wordWrapWidth:e,maxLines:1,textOverflow:n})}function VL(t){return"function"==typeof t?t():Bt(t)||Wt(t)?new DL({style:{text:String(t)}}):t}function WL(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=function(t){t.node().removeChildren()}),t?n(e):(r&&i(e),null)}function UL(t){for(var e=1/0,n=1/0,r=-1/0,i=-1/0,o=0;o<t.length;o++){var a=t[o],s=a.x,c=a.y,l=u([s+a.width,c+a.height],2),h=l[0],d=l[1];s<e&&(e=s),c<n&&(n=c),h>r&&(r=h),d>i&&(i=d)}return new IL(e,n,r-e,i-n)}var HL=function(t,e,n){var r=t.width,i=t.height,o=n.flexDirection,a=void 0===o?"row":o;n.flexWrap;var s=n.justifyContent,c=void 0===s?"flex-start":s;n.alignContent;var l=n.alignItems,h=void 0===l?"flex-start":l,d="row"===a,f="row"===a||"column"===a,p=d?f?[1,0]:[-1,0]:f?[0,1]:[0,-1],g=u([0,0],2),m=g[0],v=g[1],y=e.map((function(t){var e,n=t.width,r=t.height,i=u([m,v],2),o=i[0],a=i[1];return e=u([m+n*p[0],v+r*p[1]],2),m=e[0],v=e[1],new IL(o,a,n,r)})),b=UL(y),x={"flex-start":0,"flex-end":d?r-b.width:i-b.height,center:d?(r-b.width)/2:(i-b.height)/2},E=y.map((function(t){var e=t.x,n=t.y,r=IL.fromRect(t);return r.x=d?e+x[c]:e,r.y=d?n:n+x[c],r}));UL(E);var w=function(t){var e=u(d?["height",i]:["width",r],2),n=e[0],o=e[1];switch(h){case"flex-start":default:return 0;case"flex-end":return o-t[n];case"center":return o/2-t[n]/2}},M=E.map((function(t){var e=t.x,n=t.y,r=IL.fromRect(t);return r.x=d?e:e+w(r),r.y=d?n+w(r):n,r})),N=M.map((function(e){var n,r,i=IL.fromRect(e);return i.x+=null!==(n=t.x)&&void 0!==n?n:0,i.y+=null!==(r=t.y)&&void 0!==r?r:0,i}));return N},qL=function(t,e,n){return[]};function $L(t,e,n){void 0===n&&(n=!1);var r=t.getBBox(),i=r.width,o=r.height,a=e/Math.max(i,o);return n&&t.scale(a),a}var YL=function(){function t(t,n,r,i,o,a,s){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===i&&(i=null),void 0===o&&(o=[null,null,null,null,null]),void 0===a&&(a=[]),void 0===s&&(s=[]),e.add(this),this._elements=Array.from(t),this._data=n,this._parent=r,this._document=i,this._enter=o[0],this._update=o[1],this._exit=o[2],this._merge=o[3],this._split=o[4],this._transitions=a,this._facetElements=s}var e,n,r;return t.prototype.selectAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(e,null,this._elements[0],this._document)},t.prototype.selectFacetAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(this._elements,null,this._parent,this._document,void 0,void 0,e)},t.prototype.select=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t)[0]||null:t;return new n([e],null,e,this._document)},t.prototype.append=function(t){var e=this,r="function"==typeof t?t:function(){return e.createElement(t)},i=[];if(null!==this._data){for(var o=0;o<this._data.length;o++){var a=this._data[o],s=u(Array.isArray(a)?a:[a,null],2),c=s[0],l=s[1];(d=r(c,o)).__data__=c,null!==l&&(d.__fromElements__=l),this._parent.appendChild(d),i.push(d)}return new n(i,null,this._parent,this._document)}for(o=0;o<this._elements.length;o++){var h=this._elements[o],d=r(c=h.__data__,o);h.appendChild(d),i.push(d)}return new n(i,null,i[0],this._document)},t.prototype.maybeAppend=function(t,n){var i=h(this,e,"m",r).call(this,"#"===t[0]?t:"#".concat(t),n);return i.attr("id",t),i},t.prototype.maybeAppendByClassName=function(t,n){var i=t.toString(),o=h(this,e,"m",r).call(this,"."===i[0]?i:".".concat(i),n);return o.attr("className",i),o},t.prototype.maybeAppendByName=function(t,n){var i=h(this,e,"m",r).call(this,'[name="'.concat(t,'"]'),n);return i.attr("name",t),i},t.prototype.data=function(t,e,r){var i,o;void 0===e&&(e=function(t){return t}),void 0===r&&(r=function(){return null});for(var a,s,u,l=[],h=[],d=new Set(this._elements),f=[],p=new Set,g=new Map(this._elements.map((function(t,n){return[e(t.__data__,n),t]}))),m=new Map(this._facetElements.map((function(t,n){return[e(t.__data__,n),t]}))),v=(a=this._elements,s=function(t){return r(t.__data__)},u=new Map,a.forEach((function(t){var e=s(t);u.has(e)||u.set(e,[]),u.get(e).push(t)})),u),y=0;y<t.length;y++){var b=t[y],x=e(b,y),E=r(b,y);if(g.has(x))(S=g.get(x)).__data__=b,S.__facet__=!1,h.push(S),d.delete(S),g.delete(x);else if(m.has(x)){(S=m.get(x)).__data__=b,S.__facet__=!0,h.push(S),m.delete(x)}else if(v.has(x)){var w=v.get(x);f.push([b,w]);try{for(var M=(i=void 0,c(w)),N=M.next();!N.done;N=M.next()){var S=N.value;d.delete(S)}}catch(t){i={error:t}}finally{try{N&&!N.done&&(o=M.return)&&o.call(M)}finally{if(i)throw i.error}}v.delete(x)}else if(g.has(E)){(S=g.get(E)).__toData__?S.__toData__.push(b):S.__toData__=[b],p.add(S),d.delete(S)}else l.push(b)}var C=[new n([],l,this._parent,this._document),new n(h,null,this._parent,this._document),new n(d,null,this._parent,this._document),new n([],f,this._parent,this._document),new n(p,null,this._parent,this._document)];return new n(this._elements,null,this._parent,this._document,C)},t.prototype.merge=function(t){var e=l(l([],u(this._elements),!1),u(t._elements),!1),r=l(l([],u(this._transitions),!1),u(t._transitions),!1);return new n(e,null,this._parent,this._document,void 0,r)},t.prototype.createElement=function(t){if(this._document)return this._document.createElement(t,{});var e=n.registry[t];return e?new e:function(t){throw new Error(t)}("Unknown node type: ".concat(t))},t.prototype.join=function(t,e,n,r,i){void 0===t&&(t=function(t){return t}),void 0===e&&(e=function(t){return t}),void 0===n&&(n=function(t){return t.remove()}),void 0===r&&(r=function(t){return t}),void 0===i&&(i=function(t){return t.remove()});var o=t(this._enter),a=e(this._update),s=n(this._exit),c=r(this._merge),u=i(this._split);return a.merge(o).merge(s).merge(c).merge(u)},t.prototype.remove=function(){for(var t=function(t){var n=e._elements[t],r=e._transitions[t];r?r.then((function(){return n.remove()})):n.remove()},e=this,r=0;r<this._elements.length;r++)t(r);return new n([],null,this._parent,this._document,void 0,this._transitions)},t.prototype.each=function(t){for(var e=0;e<this._elements.length;e++){var n=this._elements[e],r=n.__data__;t.call(n,r,e)}return this},t.prototype.attr=function(t,e){var n="function"!=typeof e?function(){return e}:e;return this.each((function(r,i){void 0!==e&&(this[t]=n.call(this,r,i))}))},t.prototype.style=function(t,e,n){void 0===n&&(n=!0);var r="function"==typeof e&&n?e:function(){return e};return this.each((function(n,i){void 0!==e&&(this.style[t]=r.call(this,n,i))}))},t.prototype.styles=function(t,e){return void 0===t&&(t={}),void 0===e&&(e=!0),this.each((function(n,r){var i=this;Object.entries(t).forEach((function(t){var o=u(t,2),a=o[0],s=o[1],c="function"==typeof s&&e?s:function(){return s};void 0!==s&&i.attr(a,c.call(i,n,r))}))}))},t.prototype.update=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.maybeUpdate=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each((function(e,r){t&&this.update&&this.update(n.call(this,e,r))}))},t.prototype.transition=function(t){var e=this._transitions;return this.each((function(n,r){e[r]=t.call(this,n,r)}))},t.prototype.on=function(t,e){return this.each((function(){this.addEventListener(t,e)})),this},t.prototype.call=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.call.apply(t,l([this._parent,this],u(e),!1)),this},t.prototype.node=function(){return this._elements[0]},t.prototype.nodes=function(){return this._elements},t.prototype.transitions=function(){return this._transitions.filter((function(t){return!!t}))},t.prototype.parent=function(){return this._parent},n=t,e=new WeakSet,r=function(t,e){var r=this._elements[0],i=r.querySelector(t);if(i)return new n([i],null,this._parent,this._document);var o="string"==typeof e?this.createElement(e):e();return r.appendChild(o),new n([o],null,this._parent,this._document)},t.registry={g:Rs,rect:Fs,circle:As,path:js,text:DL,ellipse:_s,image:Is,line:Ls,polygon:zs,polyline:Bs,html:Ds},t}();function KL(t){return new YL([t],null,t,t.ownerDocument)}function XL(t){if(Wt(t))return[t,t,t,t];if(_t(t)){var e=t.length;if(1===e)return[t[0],t[0],t[0],t[0]];if(2===e)return[t[0],t[1],t[0],t[1]];if(3===e)return[t[0],t[1],t[2],t[1]];if(4===e)return t}return[0,0,0,0]}function ZL(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function QL(t,e,n){var r;void 0===n&&(n=!0);var i=e||(null===(r=t.match(/^([a-z][a-z0-9]+)/))||void 0===r?void 0:r[0])||"",o=t.replace(new RegExp("^(".concat(i,")")),"");return n?function(t){return t.toString().charAt(0).toLowerCase()+t.toString().slice(1)}(o):o}var JL=function(t,e){if(!(null==t?void 0:t.startsWith(e)))return!1;var n=t[e.length];return n>="A"&&n<="Z"};function tj(t,e,n){void 0===n&&(n=!1);var r={};return Object.entries(t).forEach((function(t){var i=u(t,2),o=i[0],a=i[1];if("className"===o||"class"===o);else if(JL(o,"show")&&JL(QL(o,"show"),e)!==n)o===function(t,e){return"".concat(e).concat(ZL(t))}(e,"show")?r[o]=a:r[o.replace(new RegExp(ZL(e)),"")]=a;else if(!JL(o,"show")&&JL(o,e)!==n){var s=QL(o,e);"filter"===s&&"function"==typeof a||(r[s]=a)}})),r}function ej(t,e){void 0===e&&(e=["x","y","class","className"]);var n=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],r={},i={};return Object.entries(t).forEach((function(t){var o=u(t,2),a=o[0],s=o[1];e.includes(a)||(-1!==n.indexOf(a)?i[a]=s:r[a]=s)})),[r,i]}function nj(){OL(this,"hidden"!==this.attributes.visibility)}var rj=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this,BL({},{style:n},e))||this;return r.initialized=!1,r._defaultOptions=n,r}return r(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=RL(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),e.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e.prototype.attributeChangedCallback=function(t){"visibility"===t&&nj.call(this)},e.prototype.update=function(t,e){var n;return this.attr(BL({},this.attributes,t||{})),null===(n=this.render)||void 0===n?void 0:n.call(this,this.attributes,this,e)},e.prototype.clear=function(){this.removeChildren()},e.prototype.bindEvents=function(t,e){},e.prototype.getSubShapeStyle=function(t){return t.x,t.y,t.transform,t.transformOrigin,t.class,t.className,t.zIndex,o(t,["x","y","transform","transformOrigin","class","className","zIndex"])},e}(Os),ij=function(t,e,n){return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e],["Z"]]},oj=ij,aj=function(t,e,n){return[["M",t,e+n],["L",t,e-n]]},sj=function(t,e,n){return[["M",t-n,e],["L",t+n,e]]},cj=sj;var uj=function(t,e,n){return[["M",t-n,e-n],["L",t+n,e],["L",t-n,e+n],["Z"]]};function lj(t){var e=function(t){var e="default";if(Rt(t)&&t instanceof Image)e="image";else if(kt(t))e="symbol";else if(Bt(t)){var n=new RegExp("data:(image|text)");e=t.match(n)?"base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(t)?"url":"symbol"}return e}(t);return["base64","url","image"].includes(e)?"image":t&&"symbol"===e?"path":null}var hj=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.render=function(t,n){var r=this.getSubShapeStyle(t),a=r.symbol,s=r.size,c=void 0===s?16:s,u=o(r,["symbol","size"]),l=lj(a);WL(!!l,KL(n),(function(t){t.maybeAppendByClassName("marker",l).attr("className","marker ".concat(l,"-marker")).call((function(t){if("image"===l){var n=2*c;t.styles({img:a,width:n,height:n,x:-c,y:-c})}else{n=c/2;var r=kt(a)?a:e.getSymbol(a);t.styles(i({path:null==r?void 0:r(0,0,n)},u))}}))}))},e.MARKER_SYMBOL_MAP=new Map,e.registerSymbol=function(t,n){e.MARKER_SYMBOL_MAP.set(t,n)},e.getSymbol=function(t){return e.MARKER_SYMBOL_MAP.get(t)},e.getSymbols=function(){return Array.from(e.MARKER_SYMBOL_MAP.keys())},e}(rj);hj.registerSymbol("cross",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e+n],["M",t+n,e-n],["L",t-n,e+n]]})),hj.registerSymbol("hyphen",(function(t,e,n){return[["M",t-n,e],["L",t+n,e]]})),hj.registerSymbol("line",aj),hj.registerSymbol("plus",(function(t,e,n){return[["M",t-n,e],["L",t+n,e],["M",t,e-n],["L",t,e+n]]})),hj.registerSymbol("tick",(function(t,e,n){return[["M",t-n/2,e-n],["L",t+n/2,e-n],["M",t,e-n],["L",t,e+n],["M",t-n/2,e+n],["L",t+n/2,e+n]]})),hj.registerSymbol("circle",ij),hj.registerSymbol("point",oj),hj.registerSymbol("bowtie",(function(t,e,n){var r=n-1.5;return[["M",t-n,e-r],["L",t+n,e+r],["L",t+n,e-r],["L",t-n,e+r],["Z"]]})),hj.registerSymbol("hexagon",(function(t,e,n){var r=n/2*Math.sqrt(3);return[["M",t,e-n],["L",t+r,e-n/2],["L",t+r,e+n/2],["L",t,e+n],["L",t-r,e+n/2],["L",t-r,e-n/2],["Z"]]})),hj.registerSymbol("square",(function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]})),hj.registerSymbol("diamond",(function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]})),hj.registerSymbol("triangle",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["Z"]]})),hj.registerSymbol("triangle-down",(function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]})),hj.registerSymbol("line",aj),hj.registerSymbol("dot",sj),hj.registerSymbol("dash",cj),hj.registerSymbol("smooth",(function(t,e,n){return[["M",t-n,e],["A",n/2,n/2,0,1,1,t,e],["A",n/2,n/2,0,1,0,t+n,e]]})),hj.registerSymbol("hv",(function(t,e,n){return[["M",t-n-1,e-2.5],["L",t,e-2.5],["L",t,e+2.5],["L",t+n+1,e+2.5]]})),hj.registerSymbol("vh",(function(t,e,n){return[["M",t-n-1,e+2.5],["L",t,e+2.5],["L",t,e-2.5],["L",t+n+1,e-2.5]]})),hj.registerSymbol("hvh",(function(t,e,n){return[["M",t-(n+1),e+2.5],["L",t-n/2,e+2.5],["L",t-n/2,e-2.5],["L",t+n/2,e-2.5],["L",t+n/2,e+2.5],["L",t+n+1,e+2.5]]})),hj.registerSymbol("vhv",(function(t,e){return[["M",t-5,e+2.5],["L",t-5,e],["L",t,e],["L",t,e-3],["L",t,e+3],["L",t+6.5,e+3]]}));var dj=jL({text:"text"},"title");function fj(t){return/\S+-\S+/g.test(t)?t.split("-").map((function(t){return t[0]})):t.length>2?[t[0]]:t.split("")}function pj(t,e){var n=Object.entries(e).reduce((function(e,n){var r=u(n,2),i=r[0],o=r[1];return t.node().attr(i)||(e[i]=o),e}),{});t.styles(n)}var gj=function(t){function e(e){return t.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return r(e,t),e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=t.position,i=t.spacing,o=t.inset,a=this.querySelector(dj.text.class);if(!a)return new IL(0,0,+e,+n);var s=a.getBBox(),c=s.width,l=s.height,h=u(XL(i),4),d=h[0],f=h[1],p=h[2],g=h[3],m=u([0,0,+e,+n],4),v=m[0],y=m[1],b=m[2],x=m[3],E=fj(r);if(E.includes("i"))return new IL(v,y,b,x);E.forEach((function(t,r){var i,o,a,s;"t"===t&&(i=u(0===r?[l+p,+n-l-p]:[0,+n],2),y=i[0],x=i[1]),"r"===t&&(o=u([+e-c-g],1),b=o[0]),"b"===t&&(a=u([+n-l-d],1),x=a[0]),"l"===t&&(s=u(0===r?[c+f,+e-c-f]:[0,+e],2),v=s[0],b=s[1])}));var w=u(XL(o),4),M=w[0],N=w[1],S=w[2],C=w[3],T=u([C+N,M+S],2),k=T[0],P=T[1];return new IL(v+C,y+M,b-k,x-P)},e.prototype.getBBox=function(){return this.title?this.title.getBBox():new IL(0,0,0,0)},e.prototype.render=function(t,e){var n=this;t.width,t.height,t.position,t.spacing;var r=o(t,["width","height","position","spacing"]),i=u(ej(r),1)[0],a=function(t){var e,n,r,i,o=t,a=o.width,s=o.height,c=o.position,l=u([+a/2,+s/2],2),h=u([+l[0],+l[1],"center","middle"],4),d=h[0],f=h[1],p=h[2],g=h[3],m=fj(c);return m.includes("l")&&(d=(e=u([0,"start"],2))[0],p=e[1]),m.includes("r")&&(d=(n=u([+a,"end"],2))[0],p=n[1]),m.includes("t")&&(f=(r=u([0,"top"],2))[0],g=r[1]),m.includes("b")&&(f=(i=u([+s,"bottom"],2))[0],g=i[1]),{x:d,y:f,textAlign:p,textBaseline:g}}(t),s=a.x,c=a.y,l=a.textAlign,h=a.textBaseline;WL(!!r.text,KL(e),(function(t){n.title=t.maybeAppendByClassName(dj.text,"text").styles(i).call(pj,{x:s,y:c,textAlign:l,textBaseline:h}).node()}))},e}(rj),mj=jL({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),vj=function(t){function e(e){var n=t.call(this,e,{animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonPath:uj(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(t,e){return"".concat(t,"/").concat(e)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new Rs({class:mj.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new Rs({class:mj.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return r(e,t),Object.defineProperty(e.prototype,"defaultPage",{get:function(){var t=this.attributes.defaultPage;return Vt(t,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageShape",{get:function(){var t=u(function(t){var e;return(null===(e=t[0])||void 0===e?void 0:e.map((function(e,n){return t.map((function(t){return t[n]}))})))||[]}(this.pageViews.map((function(t){var e=t.getBBox();return[e.width,e.height]}))).map((function(t){return Math.max.apply(Math,l([],u(t),!1))})),2),e=t[0],n=t[1],r=this.attributes,i=r.pageWidth,o=void 0===i?e:i,a=r.pageHeight;return{pageWidth:o,pageHeight:void 0===a?n:a}},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(e.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e=t.prototype.getBBox.call(this),n=e.x,r=e.y,i=this.controllerShape,o=this.pageShape,a=o.pageWidth,s=o.pageHeight;return new IL(n,r,a+i.width,s)},e.prototype.goTo=function(t){var e=this,n=this.attributes.animate,r=this,i=r.currPage,o=r.playState,a=r.playWindow,s=r.pageViews;if("idle"!==o||t<0||s.length<=0||t>=s.length)return null;s[i].setLocalPosition(0,0),this.prepareFollowingPage(t);var c=u(this.getFollowingPageDiff(t),2),l=c[0],h=c[1];this.playState="running";var d,f,p,g=(d=a,f=[{transform:"translate(0, 0)"},{transform:"translate(".concat(-l,", ").concat(-h,")")}],p=n,0===f.length?null:p?d.animate(f,p):(function(t,e){"update"in t?t.update(e):t.attr(e)}(d,{style:f.slice(-1)[0]}),null));return function(t,e){t?t.finished.then(e):e()}(g,(function(){e.innerCurrPage=t,e.playState="idle",e.setVisiblePages([t]),e.updatePageInfo()})),g},e.prototype.prev=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n<=0)return null;var r=t?(n-1+e)%e:Vt(n-1,0,e);return this.goTo(r)},e.prototype.next=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n>=e-1)return null;var r=t?(n+1)%e:Vt(n+1,0,e);return this.goTo(r)},e.prototype.renderClipPath=function(t){var e=this.pageShape,n=e.pageWidth,r=e.pageHeight;n&&r?(this.clipPath=t.maybeAppendByClassName(mj.clipPath,"rect").styles({width:n,height:r}),this.contentGroup.attr("clipPath",this.clipPath.node())):this.contentGroup.style.clipPath=void 0},e.prototype.setVisiblePages=function(t){this.playWindow.children.forEach((function(e,n){t.includes(n)?OL(e,!0):AL(e)}))},e.prototype.adjustControllerLayout=function(){var t=this,e=t.prevBtnGroup,n=t.nextBtnGroup,r=t.pageInfoGroup,i=this.attributes,o=i.orientation,a=i.controllerPadding,s=r.getBBox(),c=s.width;s.height;var l=u("horizontal"===o?[-180,0]:[-90,90],2),h=l[0],d=l[1];e.setLocalEulerAngles(h),n.setLocalEulerAngles(d);var f=e.getBBox(),p=f.width,g=f.height,m=n.getBBox(),v=m.width,y=m.height,b=Math.max(p,c,v),x="horizontal"===o?{offset:[[0,0],[p/2+a,0],[p+c+2*a,0]],textAlign:"start"}:{offset:[[b/2,-g-a],[b/2,0],[b/2,y+a]],textAlign:"center"},E=u(x.offset,3),w=u(E[0],2),M=w[0],N=w[1],S=u(E[1],2),C=S[0],T=S[1],k=u(E[2],2),P=k[0],A=k[1],O=x.textAlign,_=r.querySelector("text");_&&(_.style.textAlign=O),e.setLocalPosition(M,N),r.setLocalPosition(C,T),n.setLocalPosition(P,A)},e.prototype.updatePageInfo=function(){var t,e=this,n=e.currPage,r=e.pageViews,i=e.attributes.formatter;r.length<2||(null===(t=this.pageInfoGroup.querySelector(mj.pageInfo.class))||void 0===t||t.attr("text",i(n+1,r.length)),this.adjustControllerLayout())},e.prototype.getFollowingPageDiff=function(t){var e=this.currPage;if(e===t)return[0,0];var n=this.attributes.orientation,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,a=t<e?-1:1;return"horizontal"===n?[a*i,0]:[0,a*o]},e.prototype.prepareFollowingPage=function(t){var e=this.currPage,n=this.pageViews;if(this.setVisiblePages([t,e]),t!==e){var r=u(this.getFollowingPageDiff(t),2),i=r[0],o=r[1];n[t].setLocalPosition(i,o)}},e.prototype.renderController=function(t){var e=this,n=this.attributes.controllerSpacing,r=this.pageShape,a=r.pageWidth,s=r.pageHeight,c=this.pageViews.length>=2,l=t.maybeAppendByClassName(mj.controller,"g");if(OL(l.node(),c),c){var h=tj(this.attributes,"button"),d=tj(this.attributes,"pageNum"),f=u(ej(h),2),p=f[0],g=f[1],m=p.size,v=o(p,["size"]),y=!l.select(mj.prevBtnGroup.class).node(),b=l.maybeAppendByClassName(mj.prevBtnGroup,"g").styles(g);this.prevBtnGroup=b.node();var x=b.maybeAppendByClassName(mj.prevBtn,"path"),E=l.maybeAppendByClassName(mj.nextBtnGroup,"g").styles(g);this.nextBtnGroup=E.node(),[x,E.maybeAppendByClassName(mj.nextBtn,"path")].forEach((function(t){t.styles(i(i({},v),{transformOrigin:"center"})),$L(t.node(),m,!0)}));var w=l.maybeAppendByClassName(mj.pageInfoGroup,"g");this.pageInfoGroup=w.node(),w.maybeAppendByClassName(mj.pageInfo,"text").styles(d),this.updatePageInfo(),l.node().setLocalPosition(a+n,s/2),y&&(this.prevBtnGroup.addEventListener("click",(function(){e.prev()})),this.nextBtnGroup.addEventListener("click",(function(){e.next()})))}},e.prototype.render=function(t,e){var n=KL(e);this.renderClipPath(n),this.renderController(n),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},e.prototype.bindEvents=function(){var t=this,e=te((function(){return t.render(t.attributes,t)}),50);this.playWindow.addEventListener(Za.INSERTED,e),this.playWindow.addEventListener(Za.REMOVED,e)},e}(rj);function yj(t,e,n){return void 0===t&&(t="horizontal"),"horizontal"===t?e:n}hj.registerSymbol("hiddenHandle",(function(t,e,n){var r=1.4*n;return[["M",t-n,e-r],["L",t+n,e-r],["L",t+n,e+r],["L",t-n,e+r],["Z"]]})),hj.registerSymbol("verticalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=t+.4*r;return[["M",t,e],["L",a,e+i],["L",t+r,e+i],["L",t+r,e-i],["L",a,e-i],["Z"],["M",a,e+o],["L",t+r-2,e+o],["M",a,e-o],["L",t+r-2,e-o]]})),hj.registerSymbol("horizontalHandle",(function(t,e,n){var r=1.4*n,i=n/2,o=n/6,a=e+.4*r;return[["M",t,e],["L",t-i,a],["L",t-i,e+r],["L",t+i,e+r],["L",t+i,a],["Z"],["M",t-o,a],["L",t-o,e+r-2],["M",t+o,a],["L",t+o,e+r-2]]}));var bj=jL({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item");var xj=function(t){function e(e){return t.call(this,e,{span:[1,1],marker:function(){return new As({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return r(e,t),Object.defineProperty(e.prototype,"showValue",{get:function(){var t=this.attributes.valueText;return!!t&&("string"==typeof t||"number"==typeof t?""!==t:"function"==typeof t||""!==t.attr("text"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"actualSpace",{get:function(){var t=this.labelGroup,e=this.valueGroup,n=this.attributes.markerSize,r=t.node().getBBox(),i=r.width,o=r.height,a=e.node().getBBox(),s=a.width,c=a.height;return{markerWidth:n,labelWidth:i,valueWidth:s,height:Math.max(n,o,c)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"span",{get:function(){var t=this.attributes.span;if(!t)return[1,1];var e=u(XL(t),2),n=e[0],r=e[1],i=this.showValue?r:0,o=n+i;return[n/o,i/o]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t,e=this.attributes,n=e.markerSize,r=e.width,i=this.actualSpace,o=i.markerWidth,a=i.height,s=this.actualSpace,c=s.labelWidth,l=s.valueWidth,h=u(this.spacing,2),d=h[0],f=h[1];if(r){var p=r-n-d-f,g=u(this.span,2);c=(t=u([g[0]*p,g[1]*p],2))[0],l=t[1]}return{width:o+c+l+d+f,height:a,markerWidth:o,labelWidth:c,valueWidth:l}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){var t=this.attributes.spacing;if(!t)return[0,0];var e=u(XL(t),2),n=e[0],r=e[1];return this.showValue?[n,r]:[n,0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layout",{get:function(){var t=this.shape,e=t.markerWidth,n=t.labelWidth,r=t.valueWidth,i=t.width,o=t.height,a=u(this.spacing,2),s=a[0];return{height:o,width:i,markerWidth:e,labelWidth:n,valueWidth:r,position:[e/2,e+s,e+n+s+a[1]]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleSize",{get:function(){var t=function(t){var e=t.querySelector(bj.marker.class);return e?e.style:{}}(this.markerGroup.node()),e=this.attributes,n=e.markerSize,r=e.markerStrokeWidth,i=void 0===r?t.strokeWidth:r,o=e.markerLineWidth,a=void 0===o?t.lineWidth:o,s=e.markerStroke,c=void 0===s?t.stroke:s,u=+(i||a||(c?1:0))*Math.sqrt(2),l=this.markerGroup.node().getBBox(),h=l.width,d=l.height;return(1-u/Math.max(h,d))*n},enumerable:!1,configurable:!0}),e.prototype.renderMarker=function(t){var e=this,n=this.attributes.marker,r=tj(this.attributes,"marker");this.markerGroup=t.maybeAppendByClassName(bj.markerGroup,"g").style("zIndex",0),WL(!!n,this.markerGroup,(function(){var t,o=e.markerGroup.node(),a=null===(t=o.childNodes)||void 0===t?void 0:t[0],s="string"==typeof n?new hj({style:{symbol:n},className:bj.marker.name}):n();a?s.nodeName===a.nodeName?a instanceof hj?a.update(i(i({},r),{symbol:n})):(!function(t,e){var n,r,i=e.attributes;try{for(var o=c(Object.entries(i)),a=o.next();!a.done;a=o.next()){var s=u(a.value,2),l=s[0],h=s[1];"id"!==l&&"className"!==l&&t.attr(l,h)}}catch(t){n={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(a,s),KL(a).styles(r)):(a.remove(),KL(s).attr("className",bj.marker.name).styles(r),o.appendChild(s)):(s instanceof hj||KL(s).attr("className",bj.marker.name).styles(r),o.appendChild(s)),e.markerGroup.node().scale(1/e.markerGroup.node().getScale()[0]),$L(e.markerGroup.node(),e.scaleSize,!0)}))},e.prototype.renderLabel=function(t){var e=tj(this.attributes,"label"),n=e.text,r=o(e,["text"]);this.labelGroup=t.maybeAppendByClassName(bj.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(bj.label,(function(){return VL(n)})).styles(r)},e.prototype.renderValue=function(t){var e=this,n=tj(this.attributes,"value"),r=n.text,i=o(n,["text"]);this.valueGroup=t.maybeAppendByClassName(bj.valueGroup,"g").style("zIndex",0),WL(this.showValue,this.valueGroup,(function(){e.valueGroup.maybeAppendByClassName(bj.value,(function(){return VL(r)})).styles(i)}))},e.prototype.renderBackground=function(t){var e=this.shape,n=e.width,r=e.height,o=tj(this.attributes,"background");this.background=t.maybeAppendByClassName(bj.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(bj.background,"rect").styles(i({width:n,height:r},o))},e.prototype.adjustLayout=function(){var t=this.layout,e=t.labelWidth,n=t.valueWidth,r=t.height,i=u(t.position,3),o=i[0],a=i[1],s=i[2],c=r/2;this.markerGroup.styles({x:o,y:c}),this.labelGroup.styles({x:a,y:c}),GL(this.labelGroup.select(bj.label.class).node(),Math.ceil(e)),this.showValue&&(this.valueGroup.styles({x:s,y:c}),GL(this.valueGroup.select(bj.value.class).node(),Math.ceil(n)))},e.prototype.render=function(t,e){var n=KL(e);this.renderMarker(n),this.renderLabel(n),this.renderValue(n),this.renderBackground(n),this.adjustLayout()},e}(rj),Ej=jL({page:"item-page",navigator:"navigator",item:"item"},"items"),wj=function(t,e,n){return void 0===n&&(n=!0),t?e(t):n},Mj=function(t){function e(e){var n=t.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:fe,mouseenter:fe,mouseleave:fe})||this;return n.navigatorShape=[0,0],n}return r(e,t),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"grid",{get:function(){var t=this.attributes,e=t.gridRow,n=t.gridCol,r=t.data;if(!e&&!n)throw new Error("gridRow and gridCol can not be set null at the same time");return e&&n?[e,n]:e?[e,r.length]:[r.length,n]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderData",{get:function(){var t=this.attributes,e=t.data,n=t.layout,r=tj(this.attributes,"item"),o=e.map((function(t,o){var a=t.id,s=void 0===a?o:a,c=t.label,h=t.value;return{id:"".concat(s),index:o,style:i({layout:n,labelText:c,valueText:h},Object.fromEntries(Object.entries(r).map((function(n){var r,i,a=u(n,2),s=a[0],c=a[1];return[s,(r=c,i=[t,o,e],kt(r)?r.apply(void 0,l([],u(i),!1)):r)]}))))}}));return o},enumerable:!1,configurable:!0}),e.prototype.getGridLayout=function(){var t=this,e=this.attributes,n=e.orientation,r=e.width,i=e.rowPadding,o=e.colPadding,a=u(this.navigatorShape,1)[0],s=u(this.grid,2),c=s[0],l=s[1],h=l*c,d=0;return this.pageViews.children.map((function(e,s){var f,p,g=Math.floor(s/h),m=s%h,v=t.ifHorizontal(l,c),y=[Math.floor(m/v),m%v];"vertical"===n&&y.reverse();var b=u(y,2),x=b[0],E=b[1],w=(r-a-(l-1)*o)/l,M=e.getBBox().height,N=u([0,0],2),S=N[0],C=N[1];return"horizontal"===n?(S=(f=u([d,x*(M+i)],2))[0],C=f[1],d=E===l-1?0:d+w+o):(S=(p=u([E*(w+o),d],2))[0],C=p[1],d=x===c-1?0:d+M+i),{page:g,index:s,row:x,col:E,pageIndex:m,width:w,height:M,x:S,y:C}}))},e.prototype.getFlexLayout=function(){var t=this.attributes,e=t.width,n=t.height,r=t.rowPadding,i=t.colPadding,o=u(this.navigatorShape,1)[0],a=u(this.grid,2),s=a[0],c=a[1],l=u([e-o,n],2),h=l[0],d=l[1],f=u([0,0,0,0,0,0,0,0],8),p=f[0],g=f[1],m=f[2],v=f[3],y=f[4],b=f[5],x=f[6],E=f[7];return this.pageViews.children.map((function(t,e){var n,o,a,l,f=t.getBBox(),w=f.width,M=f.height,N=0===x?0:i,S=x+N+w;return S<=h&&wj(y,(function(t){return t<c}))?(n=u([x+N,E,S],3),p=n[0],g=n[1],x=n[2],{width:w,height:M,x:p,y:g,page:m,index:e,pageIndex:v++,row:b,col:y++}):(o=u([b+1,0,0,E+M+r],4),b=o[0],y=o[1],x=o[2],(E=o[3])+M<=d&&wj(b,(function(t){return t<s}))?(a=u([x,E,w],3),p=a[0],g=a[1],x=a[2],{width:w,height:M,x:p,y:g,page:m,index:e,pageIndex:v++,row:b,col:y++}):(l=u([0,0,w,0,m+1,0,0,0],8),p=l[0],g=l[1],x=l[2],E=l[3],m=l[4],v=l[5],b=l[6],y=l[7],{width:w,height:M,x:p,y:g,page:m,index:e,pageIndex:v++,row:b,col:y++}))}))},Object.defineProperty(e.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var t="grid"===this.attributes.layout?this.getGridLayout:this.getFlexLayout,e=t.call(this);return e.slice(-1)[0].page>0?(this.navigatorShape=[55,0],t.call(this)):e},enumerable:!1,configurable:!0}),e.prototype.ifHorizontal=function(t,e){return yj(this.attributes.orientation,t,e)},e.prototype.flattenPage=function(t){t.querySelectorAll(Ej.item.class).forEach((function(e){t.appendChild(e)})),t.querySelectorAll(Ej.page.class).forEach((function(e){t.removeChild(e).destroy()}))},e.prototype.renderItems=function(t){var e=this.attributes,n=e.click,r=e.mouseenter,i=e.mouseleave;this.flattenPage(t);var o=this.dispatchCustomEvent.bind(this);KL(t).selectAll(Ej.item.class).data(this.renderData,(function(t){return t.id})).join((function(t){return t.append((function(t){var e=t.style;return new xj({style:e})})).attr("className",Ej.item.name).on("click",(function(){null==n||n(this),o("itemClick",{item:this})})).on("pointerenter",(function(){null==r||r(this),o("itemMouseenter",{item:this})})).on("pointerleave",(function(){null==i||i(this),o("itemMouseleave",{item:this})}))}),(function(t){return t.each((function(t){var e=t.style;this.update(e)}))}),(function(t){return t.remove()}))},e.prototype.relayoutNavigator=function(){var t,e=this.attributes,n=e.layout,r=e.width,i=(null===(t=this.pageViews.children[0])||void 0===t?void 0:t.getBBox().height)||0,o=u(this.navigatorShape,2),a=o[0],s=o[1];this.navigator.update("grid"===n?{pageWidth:r-a,pageHeight:i-s}:{})},e.prototype.adjustLayout=function(){var t,e,n=this,r=Object.entries((t=this.itemsLayout,e="page",t.reduce((function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t}),{}))).map((function(t){var e=u(t,2);return{page:e[0],layouts:e[1]}})),i=l([],u(this.navigator.getContainer().children),!1);r.forEach((function(t){var e=t.layouts,r=n.pageViews.appendChild(new Rs({className:Ej.page.name}));e.forEach((function(t){var e=t.x,n=t.y,o=t.index,a=t.width,s=t.height,c=i[o];r.appendChild(c),ce(c,"__layout__",t),c.update({x:e,y:n,width:a,height:s})}))})),this.relayoutNavigator()},e.prototype.renderNavigator=function(t){var e=this.attributes.orientation,n=tj(this.attributes,"nav"),r=BL({orientation:e},n),i=this;return t.selectAll(Ej.navigator.class).data(["nav"]).join((function(t){return t.append((function(){return new vj({style:r})})).attr("className",Ej.navigator.name).each((function(){i.navigator=this}))}),(function(t){return t.each((function(){this.update(r)}))}),(function(t){return t.remove()})),this.navigator},e.prototype.getBBox=function(){return this.navigator.getBBox()},e.prototype.render=function(t,e){var n=this.attributes.data;if(n&&0!==n.length){var r=this.renderNavigator(KL(e));this.renderItems(r.getContainer()),this.adjustLayout()}},e.prototype.dispatchCustomEvent=function(t,e){var n=new qa(t,{detail:e});this.dispatchEvent(n)},e}(rj),Nj=jL({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),Sj={showLabel:!0,formatter:function(t){return t.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};!function(t){function e(e){return t.call(this,e,Sj)||this}r(e,t),e.prototype.render=function(t,e){var n=KL(e).maybeAppendByClassName(Nj.markerGroup,"g");this.renderMarker(n);var r=KL(e).maybeAppendByClassName(Nj.labelGroup,"g");this.renderLabel(r)},e.prototype.renderMarker=function(t){var e=this,n=this.attributes,r=n.orientation,o=n.markerSymbol,a=void 0===o?yj(r,"horizontalHandle","verticalHandle"):o;WL(!!a,t,(function(t){var n=tj(e.attributes,"marker"),r=i({symbol:a},n);e.marker=t.maybeAppendByClassName(Nj.marker,(function(){return new hj({style:r})})).update(r)}))},e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.showLabel,a=n.orientation,s=n.spacing,c=void 0===s?0:s,l=n.formatter;WL(r,t,(function(t){var n,r=tj(e.attributes,"label"),s=r.text,h=o(r,["text"]),d=(null===(n=t.select(Nj.marker.class))||void 0===n?void 0:n.node().getBBox())||{},f=d.width,p=void 0===f?0:f,g=d.height,m=u(yj(a,[0,(void 0===g?0:g)+c,"center","top"],[p+c,0,"start","middle"]),4),v=m[0],y=m[1],b=m[2],x=m[3];t.maybeAppendByClassName(Nj.label,"text").styles(i(i({},h),{x:v,y:y,text:l(s).toString(),textAlign:b,textBaseline:x}))}))}}(rj);var Cj,Tj,kj={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},Pj=BL({},kj,{});BL({},kj,(Cj=Sj,Tj="handle",Object.entries(Cj).reduce((function(t,e){var n=u(e,2),r=n[0],i=n[1];return r.startsWith("show")?t["show".concat(Tj).concat(r.slice(4))]=i:t["".concat(Tj).concat(ZL(r))]=i,t}),{})),{color:["#d0e3fa","#acc7f6","#8daaf2","#6d8eea","#4d73cd","#325bb1","#5a3e75","#8c3c79","#e23455","#e7655b"],indicatorBackgroundFill:"#262626",indicatorLabelFill:"white",indicatorLabelFontSize:12,indicatorVisibility:"hidden",labelAlign:"value",labelDirection:"positive",labelSpacing:5,showHandle:!0,showIndicator:!0,showLabel:!0,slidable:!0,titleText:"",type:"continuous"});var Aj=jL({title:"title",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),Oj=function(t){function e(e){return t.call(this,e,Pj)||this}return r(e,t),e.prototype.renderTitle=function(t,e,n){var r=this.attributes,o=r.showTitle,a=r.titleText,s=u(ej(tj(this.attributes,"title")),2),c=s[0],l=s[1];this.titleGroup=t.maybeAppendByClassName(Aj.titleGroup,"g").styles(l);var h=i(i({width:e,height:n},c),{text:o?a:""});this.title=this.titleGroup.maybeAppendByClassName(Aj.title,(function(){return new gj({style:h})})).update(h)},e.prototype.renderItems=function(t,e){var n=e.x,r=e.y,o=e.width,a=e.height,s=u(ej(tj(this.attributes,"title",!0)),2),c=s[0],l=s[1],h=i(i({},c),{width:o,height:a,x:0,y:0});this.itemsGroup=t.maybeAppendByClassName(Aj.itemsGroup,"g").styles(i({x:n,y:r},l));var d=this;this.itemsGroup.selectAll(Aj.items.class).data(["items"]).join((function(t){return t.append((function(){return new Mj({style:h})})).attr("className",Aj.items.name).each((function(){d.items=KL(this)}))}),(function(t){return t.update(h)}),(function(t){return t.remove()}))},e.prototype.adjustLayout=function(){if(this.attributes.showTitle){var t=this.title.node().getAvailableSpace(),e=t.x,n=t.y;this.itemsGroup.node().setLocalPosition(e,n)}},Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes,e=t.showTitle,n=t.width,r=t.height;return e?this.title.node().getAvailableSpace():new IL(0,0,n,r)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e,n,r=null===(e=this.title)||void 0===e?void 0:e.node(),i=null===(n=this.items)||void 0===n?void 0:n.node();return r&&i?function(t,e){var n=t.attributes,r=n.position,i=n.spacing,o=n.inset,a=n.text,s=t.getBBox(),c=e.getBBox(),l=fj(r),h=u(XL(a?i:0),4),d=h[0],f=h[1],p=h[2],g=h[3],m=u(XL(o),4),v=m[0],y=m[1],b=m[2],x=m[3],E=u([g+f,d+p],2),w=E[0],M=E[1],N=u([x+y,v+b],2),S=N[0],C=N[1];if("l"===l[0])return new IL(s.x,s.y,c.width+s.width+w+S,Math.max(c.height+C,s.height));if("t"===l[0])return new IL(s.x,s.y,Math.max(c.width+S,s.width),c.height+s.height+M+C);var T=u([e.attributes.width||c.width,e.attributes.height||c.height],2),k=T[0],P=T[1];return new IL(c.x,c.y,k+s.width+w+S,P+s.height+M+C)}(r,i):t.prototype.getBBox.call(this)},e.prototype.render=function(t,e){var n=t.width,r=t.height,i=KL(e);this.renderTitle(i,n,r),this.renderItems(i,this.availableSpace),this.adjustLayout()},e}(rj);function _j(t){return void 0===t&&(t=""),{CONTAINER:"".concat(t,"tooltip"),TITLE:"".concat(t,"tooltip-title"),LIST:"".concat(t,"tooltip-list"),LIST_ITEM:"".concat(t,"tooltip-list-item"),NAME:"".concat(t,"tooltip-list-item-name"),MARKER:"".concat(t,"tooltip-list-item-marker"),NAME_LABEL:"".concat(t,"tooltip-list-item-name-label"),VALUE:"".concat(t,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(t,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(t,"tooltip-crosshair-y")}}var Rj={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function Dj(t){var e;void 0===t&&(t="");var n=_j(t);return(e={})[".".concat(n.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},e[".".concat(n.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},e[".".concat(n.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},e[".".concat(n.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},e[".".concat(n.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},e[".".concat(n.NAME)]={display:"flex","align-items":"center","max-width":"216px"},e[".".concat(n.NAME_LABEL)]=i({flex:1},Rj),e[".".concat(n.VALUE)]=i({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},Rj),e[".".concat(n.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e[".".concat(n.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e}var Ij=function(t){function e(e){var n,r,i=this,o=null===(r=null===(n=e.style)||void 0===n?void 0:n.template)||void 0===r?void 0:r.prefixCls,a=_j(o);return(i=t.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(a.CONTAINER,'"></div>'),title:'<div class="'.concat(a.TITLE,'"></div>'),item:'<li class="'.concat(a.LIST_ITEM,'" data-index={index}>\n <span class="').concat(a.NAME,'">\n <span class="').concat(a.MARKER,'" style="background:{color}"></span>\n <span class="').concat(a.NAME_LABEL,'" title="{name}">{name}</span>\n </span>\n <span class="').concat(a.VALUE,'" title="{value}">{value}</span>\n </li>')},style:Dj(o)})||this).timestamp=-1,i.prevCustomContentKey=i.attributes.contentKey,i.initShape(),i.render(i.attributes,i),i}return r(e,t),Object.defineProperty(e.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.element},Object.defineProperty(e.prototype,"elementSize",{get:function(){return{width:this.element.offsetWidth,height:this.element.offsetHeight}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HTMLTooltipItemsElements",{get:function(){var t=this.attributes,e=t.data,n=t.template;return e.map((function(t,e){var r=t.name,a=void 0===r?"":r,s=t.color,c=void 0===s?"black":s,u=t.index,l=o(t,["name","color","index"]),h=i({name:a,color:c,index:null!=u?u:e},l);return Ze(function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,(function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]})):t}(n.item,h))}))},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){this.renderHTMLTooltipElement(),this.updatePosition()},e.prototype.destroy=function(){var e;null===(e=this.element)||void 0===e||e.remove(),t.prototype.destroy.call(this)},e.prototype.show=function(t,e){var n=this;if(void 0!==t&&void 0!==e){var r=function(){n.attributes.x=null!=t?t:n.attributes.x,n.attributes.y=null!=e?e:n.attributes.y,n.updatePosition()};"hidden"===this.element.style.visibility?this.closeTransition(r):r()}this.element.style.visibility="visible"},e.prototype.hide=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.attributes.enterable&&this.isCursorEntered(t,e)||(this.element.style.visibility="hidden")},e.prototype.initShape=function(){var t=this.attributes.template;this.element=Ze(t.container),this.id&&this.element.setAttribute("id",this.id)},e.prototype.renderCustomContent=function(){if(void 0===this.prevCustomContentKey||this.prevCustomContentKey!==this.attributes.contentKey){this.prevCustomContentKey=this.attributes.contentKey;var t=this.attributes.content;t&&("string"==typeof t?this.element.innerHTML=t:this.element.replaceChildren(t))}},e.prototype.renderHTMLTooltipElement=function(){var t,e,n=this.attributes,r=n.template,i=n.title,o=n.enterable,a=n.style,s=n.content,c=_j(r.prefixCls),h=this.element;if(this.element.style.pointerEvents=o?"auto":"none",s)this.renderCustomContent();else{i?(h.innerHTML=r.title,h.getElementsByClassName(c.TITLE)[0].innerHTML=i):null===(e=null===(t=h.getElementsByClassName(c.TITLE))||void 0===t?void 0:t[0])||void 0===e||e.remove();var d=this.HTMLTooltipItemsElements,f=document.createElement("ul");f.className=c.LIST,f.replaceChildren.apply(f,l([],u(d),!1));var p=this.element.querySelector(".".concat(c.LIST));p?p.replaceWith(f):h.appendChild(f)}!function(t,e){Object.entries(e).forEach((function(e){var n=u(e,2),r=n[0],i=n[1];l([t],u(t.querySelectorAll(r)),!1).filter((function(t){return t.matches(r)})).forEach((function(t){t&&(t.style.cssText+=Object.entries(i).reduce((function(t,e){return"".concat(t).concat(e.join(":"),";")}),""))}))}))}(h,a)},e.prototype.getRelativeOffsetFromCursor=function(t){var e=this.attributes,n=e.position,r=e.offset,i=(t||n).split("-"),o={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},a=this.elementSize,s=a.width,c=a.height,l=[-s/2,-c/2];return i.forEach((function(t){var e=u(l,2),n=e[0],i=e[1],a=u(o[t],2),h=a[0],d=a[1];l=[n+(s/2+r[0])*h,i+(c/2+r[1])*d]})),l},e.prototype.setOffsetPosition=function(t){var e=u(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=void 0===o?0:o,s=i.y,c=void 0===s?0:s,l=i.container,h=l.x,d=l.y;this.element.style.left="".concat(+a+h+n,"px"),this.element.style.top="".concat(+c+d+r,"px")},e.prototype.updatePosition=function(){var t=this.attributes.showDelay,e=void 0===t?60:t,n=Date.now();this.timestamp>0&&n-this.timestamp<e||(this.timestamp=n,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},e.prototype.autoPosition=function(t){var e=u(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,a=i.y,s=i.bounding,c=i.position;if(!s)return[n,r];var l=this.element,h=l.offsetWidth,d=l.offsetHeight,f=u([+o+n,+a+r],2),p=f[0],g=f[1],m={left:"right",right:"left",top:"bottom",bottom:"top"},v=s.x,y=s.y,b={left:p<v,right:p+h>v+s.width,top:g<y,bottom:g+d>y+s.height},x=[];c.split("-").forEach((function(t){b[t]?x.push(m[t]):x.push(t)}));var E=x.join("-");return this.getRelativeOffsetFromCursor(E)},e.prototype.isCursorEntered=function(t,e){if(this.element){var n=this.element.getBoundingClientRect(),r=n.x,i=n.y,o=n.width,a=n.height;return new IL(r,i,o,a).isPointIn(t,e)}return!1},e.prototype.closeTransition=function(t){var e=this,n=this.element.style.transition;this.element.style.transition="none",t(),setTimeout((function(){e.element.style.transition=n}),10)},e.tag="tooltip",e}(rj),Lj=function(t){function e(e){var n=t.call(this,e)||this;n.layoutEvents=[Za.BOUNDS_CHANGED,Za.INSERTED,Za.REMOVED],n.$margin=XL(0),n.$padding=XL(0);var r=e.style||{},i=r.margin,o=void 0===i?0:i,a=r.padding,s=void 0===a?0:a;return n.margin=o,n.padding=s,n.isMutationObserved=!0,n.bindEvents(),n}return r(e,t),Object.defineProperty(e.prototype,"margin",{get:function(){return this.$margin},set:function(t){this.$margin=XL(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"padding",{get:function(){return this.$padding},set:function(t){this.$padding=XL(t)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var t=this.attributes,e=t.x,n=void 0===e?0:e,r=t.y,i=void 0===r?0:r,o=t.width,a=t.height,s=u(this.$margin,4),c=s[0],l=s[1],h=s[2],d=s[3];return new IL(n-d,i-c,o+d+l,a+c+h)},e.prototype.appendChild=function(e,n){return e.isMutationObserved=!0,t.prototype.appendChild.call(this,e,n),e},e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=u(this.$padding,4),i=r[0],o=r[1],a=r[2],s=r[3],c=u(this.$margin,4),l=c[0],h=c[3];return new IL(s+h,i+l,e-s-o,n-i-a)},e.prototype.layout=function(){if(this.attributes.display&&this.isConnected&&!this.children.some((function(t){return!t.isConnected})))try{var t=function(t,e,n){if(0===e.length)return[];var r={flex:HL,grid:qL},i=n.display in r?r[n.display]:null;return(null==i?void 0:i.call(null,t,e,n))||[]}(this.getAvailableSpace(),this.children.map((function(t){return t.getBBox()})),this.attributes);this.children.forEach((function(e,n){var r=t[n],i=r.x,o=r.y;e.attr({x:i,y:o})}))}catch(t){}},e.prototype.bindEvents=function(){var t=this;this.layoutEvents.forEach((function(e){t.addEventListener(e,(function(e){e.target.isMutationObserved=!0,t.layout()}))}))},e.prototype.attributeChangedCallback=function(t,e,n){"margin"===t?this.margin=n:"padding"===t&&(this.padding=n),this.layout()},e}(Rs);class jj extends WI{static defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16};typePrefix="__data__";element=null;draw=!1;fieldMap={node:new Map,edge:new Map,combo:new Map};selectedItems=[];constructor(t,e){super(t,Object.assign({},jj.defaultOptions,e)),this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){this.element?.destroy(),this.element=null,this.draw=!1}bindEvents=()=>{const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.createElement)};changeState=(t,e)=>{const{graph:n}=this.context,{typePrefix:r}=this,i=se(t,[r,"id"]),o=se(t,[r,"style","labelText"]),[a]=i.split("__"),s=this.fieldMap[a].get(o)||[];n.setElementState(Object.fromEntries(s?.map((t=>[t,e]))))};click=t=>{if("hover"===this.options.trigger)return;const e=se(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?(this.selectedItems=this.selectedItems.filter((t=>t!==e)),this.changeState(t,[])):(this.selectedItems.push(e),this.changeState(t,"selected"))};mouseleave=t=>{"click"!==this.options.trigger&&(this.selectedItems=[],this.changeState(t,[]))};mouseenter=t=>{if("click"===this.options.trigger)return;const e=se(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?this.selectedItems=this.selectedItems.filter((t=>t!==e)):(this.selectedItems.push(e),this.changeState(t,"active"))};updateElement(){if(!this.element)return;this.element.getChildByIndex(0).update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}setFieldMap=(t,e,n)=>{if(!t)return;const r=this.fieldMap[n];if(r)if(r.has(t)){const n=r.get(t);n&&(n.push(e),r.set(t,n))}else r.set(t,[e])};getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click});getMarkerData=(t,e)=>{if(!t)return[];const{model:n,element:r,graph:i}=this.context,{nodes:o,edges:a,combos:s}=n.getData(),c={},u=e=>kt(t)?t(e):t,l={node:"circle",edge:"line",combo:"rect"},h={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},d=(t,e)=>{t.forEach((t=>{const{id:n}=t,i=se(t,["data",u(t)]),{color:o="#1783ff",type:a="circle"}=((t,e)=>{const n=r?.getElementComputedStyle(t,e);return n})(e,t);(n||0===n)&&i&&i.replace(/\s+/g,"")&&(this.setFieldMap(i,n,e),c[i]||(c[i]={id:`${e}__${n}`,label:i,marker:h[a]||l[e],elementType:e,lineWidth:1,stroke:o,fill:o}))}))};switch(e){case"node":d(o,"node");break;case"edge":d(a,"edge");break;case"combo":d(s,"combo");break;default:return[]}return Object.values(c)};layout=t=>{let{flexDirection:e,alignItems:n,justifyContent:r}={flexDirection:"row",alignItems:"flex-end",justifyContent:"center"};const i={top:["row","flex-start","center"],bottom:["row","flex-end","center"],left:["column","flex-start","center"],right:["column","flex-end","center"]};return t in i&&([e,n,r]=i[t]),{display:"flex",flexDirection:e,justifyContent:r,alignItems:n}};createElement=()=>{if(this.draw)return void this.updateElement();const{canvas:t}=this.context,[e,n]=t.getSize(),{width:r=e,height:i=n,nodeField:o,edgeField:a,comboField:s,trigger:c,position:u,...l}=this.options,h=this.getMarkerData(o,"node"),d=this.getMarkerData(a,"edge"),f=this.getMarkerData(s,"combo"),p=[...h,...f,...d],g=this.layout(u),m=new Lj({style:{width:r,height:i,...g}}),v={width:r,height:i,data:p,itemMarkerLineWidth:({lineWidth:t})=>t,itemMarker:({marker:t})=>t,itemMarkerStroke:({stroke:t})=>t,itemMarkerFill:({fill:t})=>t,gridCol:h.length,...l,...this.getEvents()},y=new Oj({className:"legend",style:v});m.appendChild(y),t.appendChild(m),this.element=m,this.draw=!0};destroy(){this.clear(),this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.createElement),super.destroy()}}class zj extends WI{static defaultOptions={position:"top-left",enable:!0};$element=qI("toolbar",!1);constructor(t,e){super(t,Object.assign({},zj.defaultOptions,e));const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),$I("g6-toolbar-css","style",{},"\n .g6-toolbar {\n position: absolute;\n z-index: 100;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);\n opacity: 0.65;\n } \n .g6-toolbar .g6-toolbar-item {\n display: inline-block;\n width: 16px;\n height: 16px;\n padding: 4px;\n cursor: pointer;\n box-sizing: content-box;\n }\n\n .g6-toolbar .g6-toolbar-item:hover {\n background-color: #f0f0f0;\n }\n\n .g6-toolbar .g6-toolbar-item svg {\n display: inline-block;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n",document.head),$I("g6-toolbar-svgicon","div",{display:"none"},'\n <svg>\n <symbol id="zoom-in" viewBox="64 64 896 896">\n <path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="zoom-out" viewBox="64 64 896 896">\n <path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="edit" viewBox="64 64 896 896">\n <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path>\n </symbol>\n <symbol id="delete" viewBox="64 64 896 896">\n <path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path>\n </symbol>\n <symbol id="redo" viewBox="64 64 896 896">\n <path d="M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"></path>\n </symbol>\n <symbol id="undo" viewBox="64 64 896 896">\n <path d="M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"></path>\n </symbol>\n <symbol id="export" viewBox="64 64 896 896">\n <path d="M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"></path>\n </symbol>\n <symbol id="auto-fit" viewBox="64 64 896 896">\n <path d="M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"></path>\n <path d="M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"></path>\n </symbol>\n <symbol id="reset" viewBox="64 64 896 896">\n <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path>\n </symbol>\n </svg>\n'),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}async update(t){super.update(t);const{className:e,position:n,style:r}=this.options;this.$element.className=`g6-toolbar ${e||""}`,Object.assign(this.$element.style,r,function(t){const e={top:"unset",right:"unset",bottom:"unset",left:"unset"};return t.split("-").forEach((t=>{e[t]="8px"})),e.flexDirection=t.startsWith("top")||t.startsWith("bottom")?"row":"column",e}(n)),this.$element.innerHTML=await this.getDOMContent()}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}async getDOMContent(){return(await this.options.getItems()).map((t=>`\n <div class="g6-toolbar-item" value="${t.value}">\n <svg aria-hidden="true" focusable="false">\n <use xlink:href="#${t.id}"></use>\n </svg>\n </div>`)).join("")}onToolbarItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof Element&&t.target.className.includes("g6-toolbar-item")){const n=t.target.getAttribute("value");e?.(n,t.target)}}}class Bj extends WI{static defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,style:{".tooltip":{visibility:"hidden"}}};currentTarget=null;tooltipElement=null;container=null;constructor(t,e){super(t,Object.assign({},Bj.defaultOptions,e)),this.render(),this.bindEvents()}getEvents(){return"click"===this.options.trigger?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerenter":this.onPointerEnter,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerenter":this.onPointerEnter,"edge:pointermove":this.onPointerMove,"combo:pointerenter":this.onPointerEnter,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){this.unbindEvents(),super.update(t),this.tooltipElement&&this.container?.removeChild(this.tooltipElement.HTMLTooltipElement),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.off(n,e[n])}))}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach((n=>{t.on(n,e[n])}))}isEnable=t=>{const{enable:e}=this.options;return"function"==typeof e?e(t):e};onClick=t=>{const{target:{id:e}}=t;this.currentTarget===e?(this.currentTarget=null,this.hideTooltip(t)):(this.currentTarget=e,this.showTooltip(t))};onPointerMove=t=>{const{target:e}=t;this.currentTarget&&e.id!==this.currentTarget&&this.showTooltip(t)};onPointerLeave=t=>{this.hideTooltip(t),this.currentTarget=null};onCanvasMove=t=>{this.hideTooltip(t),this.currentTarget=null};onPointerEnter=t=>{this.showTooltip(t)};showTooltipById=(t,e="node")=>{const n={targetType:e,target:{id:t}};this.showTooltip(n)};getItems=(t,e)=>{const{model:n}=this.context;switch(e){case"node":return n.getNodeData([t]);case"edge":return n.getEdgeData([t]);case"combo":return n.getComboData([t]);default:return[]}};showTooltip=t=>{const{targetType:e,client:n,target:{id:r,attributes:i={color:"#1883FF"}}}=t;if(!this.tooltipElement||!this.isEnable(t))return;const{getContent:o}=this.options,{color:a,stroke:s}=i;this.currentTarget=r;const c=this.getItems(r,e);let u,l;if(n)u=n.x,l=n.y;else{const t=se(c,"0.style",{x:0,y:0});u=t.x,l=t.y}let h={};o?h.content=o(t,c):h={title:e,data:c.map((t=>({name:"ID",value:t.id||`${t.source} -> ${t.target}`,color:a||s})))},this.tooltipElement.update({x:u,y:l,style:{".tooltip":{visibility:"visible"}},...h})};hideTooltip=t=>{if(!t)return void this.tooltipElement?.hide();if(!this.tooltipElement||!this.isEnable(t))return;const{client:{x:e,y:n}}=t;this.tooltipElement.hide(e,n)};initTooltip=()=>{const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:r,left:i}=n.getBoundingClientRect(),{style:o,position:a,enterable:s,container:c={x:-i,y:-r}}=this.options,[u,l]=e,[h,d]=t.getSize(),f=new Ij({className:"tooltip",style:{x:u,y:l,container:c,bounding:{x:0,y:0,width:h,height:d},position:a,enterable:s,title:"",offset:[10,10],style:o}});return this.container?.appendChild(f.HTMLTooltipElement),f};destroy(){this.unbindEvents(),this.tooltipElement&&this.container?.removeChild(this.tooltipElement.HTMLTooltipElement),super.destroy()}}let Fj;function Gj(t,e){Fj||(Fj=document.createElement("canvas")),Fj.width=t,Fj.height=e;return Fj.getContext("2d").clearRect(0,0,t,e),Fj}class Vj extends WI{static defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};$element=qI("watermark");constructor(t,e){super(t,Object.assign({},Vj.defaultOptions,e));this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}async update(t){super.update(t);const{width:e,height:n,text:r,imageURL:i,...o}=this.options;Object.keys(o).forEach((e=>{e.startsWith("background")&&(this.$element.style[e]=t[e])}));const a=i?await async function(t,e,n,r){const i=Gj(t,e),o=i.getContext("2d"),{rotate:a,opacity:s}=r;a&&o.rotate(a),s&&(o.globalAlpha=s);const c=new Image;return c.crossOrigin="anonymous",c.src=n,new Promise((n=>{c.onload=function(){const r=t>c.width?(t-c.width)/2:0,a=e>c.height?(e-c.height)/2:0;o.drawImage(c,0,0,c.width,c.height,r,a,t-2*r,e-2*a),n(i.toDataURL())}}))}(e,n,i,o):await async function(t,e,n,r){const i=Gj(t,e),o=i.getContext("2d"),{rotate:a,opacity:s,textFill:c,textFontSize:u,textFontFamily:l,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:p}=r;return o.textAlign=f,o.textBaseline=p,o.translate(t/2,e/2),o.font=`${u}px ${l} ${h} ${d}`,a&&o.rotate(a),s&&(o.globalAlpha=s),c&&(o.fillStyle=c,o.fillText(`${n}`,0,0)),i.toDataURL()}(e,n,r,o);this.$element.style.backgroundImage=`url(${a})`}destroy(){super.destroy(),this.$element.remove()}}const Wj=["#7E92B5","#f5222d","#faad14"],Uj={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},Hj={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function qj(t){const{bgColor:e,textColor:n,nodeColor:r,nodeColorDisabled:i,nodeStroke:o,nodeBadgePalette:a=Wj,nodePaletteOptions:s=Uj,edgeColor:c,edgeColorDisabled:u,edgePaletteOptions:l=Hj,comboColor:h,comboColorDisabled:d,comboStroke:f,comboStrokeDisabled:p}=t;return{background:e,node:{palette:s,style:{badgeFill:e,badgeFontSize:8,badgePadding:[1,4],badgePalette:a,color:r,halo:!1,haloLineWidth:12,haloStrokeOpacity:.25,iconFill:e,iconFontSize:16,iconOpacity:1,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.5,labelBackgroundPadding:[0,2],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineWidth:0,opacity:1,portFill:r,portLineWidth:1,portStroke:o,portStrokeOpacity:.65,stroke:o,strokeOpacity:1},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:3,stroke:o},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:3,stroke:o,strokeOpacity:.85},inactive:{iconOpacity:.25,labelOpacity:.25,opacity:.25},disabled:{color:i,labelOpacity:.25}},animation:{enter:"fade",exit:"fade",visibility:"fade",update:[{fields:["x","y","color","stroke"]}]}},edge:{palette:l,style:{color:c,halo:!1,haloLineWidth:12,haloStrokeOpacity:.25,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,opacity:1},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:2},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:2},inactive:{labelOpacity:.25,opacity:.25},disabled:{color:u,labelOpacity:.25}},animation:{enter:"fade",exit:"fade",visibility:"fade",update:[{fields:["color"]},{fields:["path"],shape:"key"}]}},combo:{style:{collapsedMaskFill:h,collapsedMaskFontSize:12,collapsedSize:32,color:h,halo:!1,haloLineWidth:12,haloStroke:f,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,opacity:1,padding:10,stroke:f},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{labelOpacity:.25,opacity:.65},disabled:{color:d,labelOpacity:.25,opacity:.25,stroke:p}},animation:{enter:"fade",exit:"fade",visibility:"fade",expand:"combo-collapse-expand",collapse:"combo-collapse-expand",update:[{fields:["x","y"]},{fields:["size","color","stroke"],shape:"key"}]}}}}const $j=qj({bgColor:"#000000",textColor:"#ffffffd9",nodeColor:"#1783ff",nodeColorDisabled:"#d0e4ff",nodeStroke:"#d0e4ff",edgeColor:"#99add1",edgeColorDisabled:"#969696",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696"}),Yj=qj({bgColor:"#fff",textColor:"#000000d9",nodeColor:"#1783ff",nodeColorDisabled:"#f0f0f0",nodeStroke:"#000000",edgeColor:"#99add1",edgeColorDisabled:"#d9d9d9",comboColor:"#fdfdfd",comboColorDisabled:"#f0f0f0",comboStroke:"#99add1",comboStrokeDisabled:"#d9d9d9"});class Kj extends qh{beforeDraw(t){return t}}const Xj=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class Zj extends Kj{static defaultOptions={mode:"bundle",edges:void 0,distance:15};constructor(t,e){super(t,Object.assign({},Zj.defaultOptions,e))}beforeDraw(t){const e=this.getAffectedParallelEdges(t);if(0===e.size)return t;const n=(e,n,r)=>{const i=`${n}s`;Object.entries(t).forEach((([t,n])=>{e===t?n[i].set(Fu(r),r):n[i].delete(Fu(r))}))};return"bundle"===this.options.mode?this.applyBundlingStyle(n,e,this.options.distance):this.applyMergingStyle(n,e),t}getAffectedParallelEdges=t=>{const{add:{edges:e},update:{nodes:n,edges:r,combos:i},remove:{edges:o}}=t,{model:a}=this.context,s=new Map,c=(t,e)=>{a.getRelatedEdgesData(e).forEach((t=>!s.has(Fu(t))&&s.set(Fu(t),t)))};n.forEach(c),i.forEach(c);const u=t=>{Jj(t,a.getEdgeData(),!0).forEach((t=>!s.has(Fu(t))&&s.set(Fu(t),t)))};if(o.size&&o.forEach(u),e.size&&e.forEach(u),r.size){const t=QI(ZI(a.getChanges())).update.edges;r.forEach((e=>{u(e);const n=t.find((t=>Fu(t.value)===Fu(e)))?.original;n&&!tz(e,n)&&u(n)}))}oe(this.options.edges)||s.forEach(((t,e)=>!this.options.edges.includes(e)&&s.delete(e)));const l=a.getEdgeData().map(Fu);return new Map([...s].sort(((t,e)=>l.indexOf(t[0])-l.indexOf(e[0]))))};applyBundlingStyle=(t,e,n)=>{const{edgeMap:r,reverses:i}=Qj(e);r.forEach((e=>{e.forEach(((e,r,o)=>{const a=re(e,{style:(()=>{const t=o.length,a={type:"quadratic"};if(e.source===e.target){const t=Xj.length;a.loopPlacement=Xj[r%t],a.loopDist=Math.floor(r/t)*n+50}else if(1===t)a.curveOffset=0;else{const o=(r%2==0?1:-1)*(i[`${e.source}|${e.target}|${r}`]?-1:1);a.curveOffset=t%2==1?o*Math.ceil(r/2)*n*2:o*(Math.floor(r/2)*n*2+n)}return a})()}),s=this.context.element?.getElement(Fu(e));t(s?"update":"add","edge",a)}))}))};applyMergingStyle=(t,e)=>{const{edgeMap:n,reverses:r}=Qj(e);n.forEach((e=>{if(1===e.length){const n=e[0],r=this.context.element?.getElement(Fu(n));return void t(r?"update":"add","edge",n)}const n=e.map((({source:t,target:e,style:n={}},i)=>{const{startArrow:o,endArrow:a}=n,s={},[c,u]=r[`${t}|${e}|${i}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return Xt(o)&&(s[c]=o),Xt(a)&&(s[u]=a),s})).reduce(((t,e)=>({...t,...e})),{});e.forEach(((e,r)=>{if(0===r){const r={...e,style:{...n,...this.options.style}},i=this.context.element?.getElement(Fu(e));t(i?"update":"add","edge",r)}else t("remove","edge",e)}))}))}}const Qj=t=>{const e=new Map,n=new Set,r={};for(const[i,o]of t){if(n.has(i))continue;const{source:a,target:s}=o,c=`${a}-${s}`;e.has(c)||e.set(c,[]),e.get(c).push(o),n.add(i);for(const[i,u]of t)n.has(i)||tz(o,u)&&(e.get(c).push(u),n.add(i),a===u.target&&s===u.source&&(r[`${u.source}|${u.target}|${e.get(c).length-1}`]=!0))}return{edgeMap:e,reverses:r}},Jj=(t,e,n)=>e.filter((e=>(n||Fu(e)!==Fu(t))&&tz(e,t))),tz=(t,e)=>{const{source:n,target:r}=t,{source:i,target:o}=e;return n===i&&r===o||n===o&&r===i};const ez={animation:{fade:[{fields:["opacity"]}],translate:[{fields:["x","y"]}],"combo-collapse-expand":[{fields:["x","y"]},{fields:["r","width","height"],shape:"key"}]},behavior:{"zoom-canvas":xd,"drag-canvas":cd,"drag-element":ud,"drag-element-force":class extends ud{get forceLayoutInstance(){return this.context.layout.getLayoutInstance().find((t=>["d3-force","d3-force-3d"].includes(t?.id)))}validate(t){return!!this.context.layout&&(this.forceLayoutInstance?super.validate(t):(console.warn("DragElementForce only works with d3-force or d3-force-3d layout"),!1))}async moveElement(t,e){const n=this.forceLayoutInstance;this.context.graph.getNodeData(t).forEach(((r,i)=>{const{x:o=0,y:a=0}=r.style||{};n.setFixedPosition(t[i],[...Yu([+o,+a],e)])}))}onDragStart(t){if(this.enable=this.validate(t),!this.enable)return;this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target);const e=this.forceLayoutInstance;e.simulation.alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach((t=>{const{x:n=0,y:r=0}=t.style||{};e.setFixedPosition(Fu(t),[+n,+r])}))}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.moveElement(this.target,e)}onDragEnd(){const t=this.forceLayoutInstance;t.simulation.alphaTarget(0),this.context.graph.getNodeData(this.target).forEach((e=>{t.setFixedPosition(Fu(e),[null,null,null])}))}},"collapse-expand":od,"click-element":id,"hover-element":dd,"focus-element":hd,"create-edge":sd,"brush-select":td,"lasso-select":bd},combo:{circle:$l,rect:Yl},edge:{cubic:vh,line:xh,polyline:Eh,quadratic:wh,"cubic-horizontal":yh,"cubic-vertical":bh},layout:{"antv-dagre":class{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},Bm),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,e)}))}genericDagreLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{nodeSize:i,align:o,rankdir:a="TB",ranksep:s,nodesep:c,ranksepFunc:u,nodesepFunc:l,edgeLabelSpace:h,ranker:d,nodeOrder:f,begin:p,controlPoints:g,radial:m,sortByCombo:v,preset:y}=r,b=new Lp({tree:[]}),x=Lm(s||50,u),E=Lm(c||50,l);let w=E,M=x;"LR"!==a&&"RL"!==a||(w=x,M=E);const N=zm(i,void 0),S=e.getAllNodes(),C=e.getAllEdges();let T;S.forEach((t=>{const e=N(t),n=M(t),r=e+2*w(t),i=e+2*n,o=t.data.layer;Wt(o)?b.addNode({id:t.id,data:{width:r,height:i,layer:o}}):b.addNode({id:t.id,data:{width:r,height:i}})})),v&&(b.attachTreeStructure("combo"),S.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}))),C.forEach((t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==y?void 0:y.length)&&(T=new Lp({nodes:y})),((t,e)=>{const{edgeLabelSpace:n,keepNodeOrder:r,prevGraph:i,rankdir:o,ranksep:a}=e;!r&&i&&sm(t,i);const s=pm(t);let c;n&&(e.ranksep=gm(s,{rankdir:o,ranksep:a}));try{c=am(s,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}cm(t,s)})(b,{prevGraph:T,edgeLabelSpace:h,keepNodeOrder:!!f,nodeOrder:f||[],acyclicer:"greedy",ranker:d,rankdir:a,nodesep:c,align:o});const k=[0,0];if(p){let t=1/0,e=1/0;b.getAllNodes().forEach((n=>{t>n.data.x&&(t=n.data.x),e>n.data.y&&(e=n.data.y)})),b.getAllEdges().forEach((n=>{var r;null===(r=n.data.points)||void 0===r||r.forEach((n=>{t>n.x&&(t=n.x),e>n.y&&(e=n.y)}))})),k[0]=p[0]-t,k[1]=p[1]-e}const P="LR"===a||"RL"===a;if(m);else{const t=new Set,e="BT"===a||"RL"===a?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach((e=>{e.data.x=e.data.x+k[0],e.data.y=e.data.y+k[1],t.add(P?e.data.x:e.data.y)}));const n=Array.from(t).sort(e),r=P?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,i=P?(t,e,n)=>{const r=Math.max(e.y,n.y),i=Math.min(e.y,n.y);return t.filter((t=>t.y<=r&&t.y>=i))}:(t,e,n)=>{const r=Math.max(e.x,n.x),i=Math.min(e.x,n.x);return t.filter((t=>t.x<=r&&t.x>=i))};b.getAllEdges().forEach(((t,e)=>{var o;h&&g&&"loop"!==t.data.type&&(t.data.controlPoints=Fm(null===(o=t.data.points)||void 0===o?void 0:o.map((({x:t,y:e})=>({x:t+k[0],y:e+k[1]}))),b.getNode(t.source),b.getNode(t.target),n,P,r,i))}))}let A=[];A=b.getAllNodes().map((t=>Im(t)));const O=b.getAllEdges();t&&(A.forEach((t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),O.forEach((t=>{e.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})})));return{nodes:A,edges:O}}))}},"combo-combined":class{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},by),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,t,e)}))}genericComboCombinedLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:i,treeKey:o,outerLayout:a}=r,s=e.getAllNodes().filter((t=>!t.data._isCombo)),c=e.getAllNodes().filter((t=>t.data._isCombo)),u=e.getAllEdges(),l=null==s?void 0:s.length;if(!l||1===l)return Gm(e,t,i);const h=[],d=new Map;s.forEach((t=>{d.set(t.id,t)}));const f=new Map;c.forEach((t=>{f.set(t.id,t)}));const p=new Map,g=this.getInnerGraphs(e,o,d,f,u,r,p);yield Promise.all(g);const m=new Map,v=[],y=new Map;let b=!0;e.getRoots(o).forEach((t=>{const n=p.get(t.id),r=f.get(t.id)||d.get(t.id),i={id:t.id,data:Object.assign(Object.assign({},t.data),{x:n.data.x||r.data.x,y:n.data.y||r.data.y,fx:n.data.fx||r.data.fx,fy:n.data.fy||r.data.fy,mass:n.data.mass||r.data.mass,size:n.data.size})};v.push(i),m.set(t.id,!0),isNaN(i.data.x)||0===i.data.x||isNaN(i.data.y)||0===i.data.y?(i.data.x=100*Math.random(),i.data.y=100*Math.random()):b=!1,Rm(e,[t],(e=>{e.id!==t.id&&y.set(e.id,t.id)}),"TB",o)}));const x=[];let E;if(u.forEach((t=>{const e=y.get(t.source)||t.source,n=y.get(t.target)||t.target;e!==n&&m.has(e)&&m.has(n)&&x.push({id:t.id,source:e,target:n,data:{}})})),null==v?void 0:v.length){if(1===v.length)v[0].data.x=i[0],v[0].data.y=i[1];else{const t=new Lp({nodes:v,edges:x}),e=a||new pv;if(b&&yy[e.id]){const e=v.length<100?new gy:new qm;yield e.assign(t)}E=yield e.execute(t,Object.assign({center:i,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,n)=>(Math.max(...e.data.size)||32)/2+(Math.max(...n.data.size)||32)/2+200}:{}))}p.forEach((t=>{var e;const n=E.nodes.find((e=>e.id===t.id));if(n){const{x:e,y:r}=n.data;t.data.visited=!0,t.data.x=e,t.data.y=r,h.push({id:t.id,data:{x:e,y:r}})}const{x:r,y:i}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{h.push({id:t.id,data:{x:t.data.x+r,y:t.data.y+i}})}))})),p.forEach((({data:t})=>{const{x:e,y:n,visited:r,nodes:i}=t;null==i||i.forEach((t=>{if(!r){const r=h.find((e=>e.id===t.id));r.data.x+=e||0,r.data.y+=n||0}}))}))}t&&h.forEach((t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}));return{nodes:h,edges:u}}))}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:r,comboPadding:i}=t;let o,a,s;if(a=Wt(r)?()=>r:kt(r)?r:()=>0,e.spacing=a,n)if(kt(n))o=t=>{const e=n(t),r=a(t);if(Pm(t.size)){return((t.size[0]>t.size[1]?t.size[0]:t.size[1])+r)/2}return((e||32)+r)/2};else if(Pm(n)){const t=(n[0]>n[1]?n[0]:n[1])/2;o=e=>t+a(e)/2}else{const t=n/2;o=e=>t+a(e)/2}else o=t=>{const e=a(t);if(t.size){if(Pm(t.size)){return((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2}if(Rt(t.size)){return((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2}return(t.size+e)/2}return 32+e/2};return e.nodeSize=o,s=Wt(i)?()=>i:Pm(i)?()=>Math.max.apply(null,i):kt(i)?i:()=>0,e.comboPadding=s,e}getInnerGraphs(t,e,n,r,i,o,s){const{nodeSize:c,comboPadding:u,spacing:l,innerLayout:h}=o,d=h||new qm({}),f={center:[0,0],preventOverlap:!0,nodeSpacing:l},p=[],g=t=>{let e=(null==u?void 0:u(t))||10;return Pm(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return t.getRoots(e).forEach((o=>{s.set(o.id,{id:o.id,data:{nodes:[],size:g(o).size}});let u=Promise.resolve();Rm(t,[o],(o=>{var l;if(!o.data._isCombo)return;const{size:h,padding:p}=g(o);if(null===(l=t.getChildren(o.id,e))||void 0===l?void 0:l.length){const l=s.get(o.id);s.set(o.id,{id:o.id,data:Object.assign({nodes:[]},null==l?void 0:l.data)});const h=new Map,g=t.getChildren(o.id,e).map((t=>{if(t.data._isCombo)return s.has(t.id)||s.set(t.id,{id:t.id,data:Object.assign({},t.data)}),h.set(t.id,!0),s.get(t.id);const e=n.get(t.id)||r.get(t.id);return h.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),m={nodes:g,edges:i.filter((t=>h.has(t.source)&&h.has(t.target)))};let v=1/0;g.forEach((t=>{var e;let{size:n}=t.data;n||(n=(null===(e=s.get(t.id))||void 0===e?void 0:e.data.size)||(null==c?void 0:c(t))||[30,30]),Wt(n)&&(n=[n,n]);const[r,i]=n;v>r&&(v=r),v>i&&(v=i),t.data.size=n})),u=u.then((()=>a(this,void 0,void 0,(function*(){const t=new Lp(m),e=yield d.assign(t,f),{minX:n,minY:r,maxX:i,maxY:a}=(t=>{let e=1/0,n=1/0,r=-1/0,i=-1/0;return t.forEach((t=>{let o=t.data.size;Pm(o)?1===o.length&&(o=[o[0],o[0]]):Wt(o)?o=[o,o]:(void 0===o||isNaN(o))&&(o=[30,30]);const a=[o[0]/2,o[1]/2],s=t.data.x-a[0],c=t.data.x+a[0],u=t.data.y-a[1],l=t.data.y+a[1];e>s&&(e=s),n>u&&(n=u),r<c&&(r=c),i<l&&(i=l)})),{minX:e,minY:n,maxX:r,maxY:i}})(g),c=(i+n)/2,u=(a+r)/2;m.nodes.forEach((t=>{t.data.x-=c,t.data.y-=u}));const l=[Math.max(i-n,v)+2*p,Math.max(a-r,v)+2*p];return s.get(o.id).data.size=l,s.get(o.id).data.nodes=g,e}))))}else s.set(o.id,{id:o.id,data:Object.assign(Object.assign({},o.data),{size:h})});return!0}),"BT",e),p.push(u)})),p}},"compact-box":Ap.compactBox,"force-atlas2":class{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},nI),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericForceAtlas2Layout(!0,t,e)}))}genericForceAtlas2Layout(t,e,n){return a(this,void 0,void 0,(function*(){const r=e.getAllEdges(),i=e.getAllNodes(),o=this.formatOptions(n,i.length),{width:a,height:s,prune:c,maxIteration:u,nodeSize:l,center:h}=o;if(!(null==i?void 0:i.length)||1===i.length)return Gm(e,t,h);const d=i.map((t=>Im(t,[a,s]))),f=r.filter((t=>{const{source:e,target:n}=t;return e!==n})),p=new Lp({nodes:d,edges:f}),g=this.getSizes(p,e,l);if(this.run(p,e,u,g,t,o),c){for(let t=0;t<f.length;t+=1){const{source:e,target:n}=f[t],r=p.getDegree(e),i=p.getDegree(e);if(r<=1){const t=p.getNode(n);p.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(i<=1){const t=p.getNode(e);p.mergeNodeData(n,{x:t.data.x,y:t.data.y})}}const n=Object.assign(Object.assign({},o),{prune:!1,barnesHut:!1});this.run(p,e,100,g,t,n)}return{nodes:d,edges:r}}))}getSizes(t,e,n){const r=t.getAllNodes(),i={};for(let t=0;t<r.length;t+=1){const{id:o,data:a}=r[t];if(i[o]=10,Wt(a.size))i[o]=a.size;else if(Pm(a.size))isNaN(a.size[0])||(i[o]=Math.max(a.size[0])),isNaN(a.size[1])||(i[o]=Math.max(a.size[1]));else if(Rt(a.size))i[o]=Math.max(a.size.width,a.size.height);else if(kt(n)){const t=n(e.getNode(o));Pm(t)?i[o]=Math.max(...t):i[o]=t}else Pm(n)?i[o]=Math.max(...n):Wt(n)&&(i[o]=n)}return i}formatOptions(t={},e){const n=Object.assign(Object.assign({},this.options),t),{center:r,width:i,height:o,barnesHut:a,prune:s,maxIteration:c,kr:u,kg:l}=n;return n.width=i||"undefined"==typeof window?i:window.innerWidth,n.height=o||"undefined"==typeof window?o:window.innerHeight,n.center=r||[n.width/2,n.height/2],void 0===a&&e>250&&(n.barnesHut=!0),void 0===s&&e>100&&(n.prune=!0),0!==c||s?0===c&&s&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)):(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)),u||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),l||(n.kg=20,e>100&&e<=500?n.kg=10:e>500&&(n.kg=1)),n}run(t,e,n,r,i,o){const{kr:a,barnesHut:s,onTick:c}=o,u=t.getAllNodes();let l=0,h=n;const d={},f={},p={};for(let e=0;e<u.length;e+=1){const{data:n,id:r}=u[e];if(d[r]=[0,0],s){const i={id:e,rx:n.x,ry:n.y,mass:1,g:a,degree:t.getDegree(r)};p[r]=new JD(i)}}for(;h>0;)l=this.oneStep(t,{iter:h,preventOverlapIters:50,krPrime:100,sg:l,forces:d,preForces:f,bodies:p,sizes:r},o),h--,null==c||c({nodes:u,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:r,preventOverlapIters:i,krPrime:o,sg:a,preForces:s,bodies:c,sizes:u}=e;let{forces:l}=e;const{preventOverlap:h,barnesHut:d}=n,f=t.getAllNodes();for(let t=0;t<f.length;t+=1){const{id:e}=f[t];s[e]=[...l[e]],l[e]=[0,0]}return l=this.getAttrForces(t,r,i,u,l,n),l=d&&(h&&r>i||!h)?this.getOptRepGraForces(t,l,c,n):this.getRepGraForces(t,r,i,l,o,u,n),this.updatePos(t,l,s,a,n)}getAttrForces(t,e,n,r,i,o){const{preventOverlap:a,dissuadeHubs:s,mode:c,prune:u}=o,l=t.getAllEdges();for(let o=0;o<l.length;o+=1){const{source:h,target:d}=l[o],f=t.getNode(h),p=t.getNode(d),g=t.getDegree(h),m=t.getDegree(d);if(u&&(g<=1||m<=1))continue;const v=[p.data.x-f.data.x,p.data.y-f.data.y];let y=Math.hypot(v[0],v[1]);y=y<1e-4?1e-4:y,v[0]=v[0]/y,v[1]=v[1]/y,a&&e<n&&(y=y-r[h]-r[d]);let b=y,x=b;"linlog"===c&&(b=Math.log(1+y),x=b),s&&(b=y/g,x=y/m),a&&e<n&&y<=0?(b=0,x=0):a&&e<n&&y>0&&(b=y,x=y),i[h][0]+=b*v[0],i[d][0]-=x*v[0],i[h][1]+=b*v[1],i[d][1]-=x*v[1]}return i}getOptRepGraForces(t,e,n,r){const{kg:i,center:o,prune:a}=r,s=t.getAllNodes(),c=s.length;let u=9e10,l=-9e10,h=9e10,d=-9e10;for(let e=0;e<c;e+=1){const{id:r,data:i}=s[e];a&&t.getDegree(r)<=1||(n[r].setPos(i.x,i.y),i.x>=l&&(l=i.x),i.x<=u&&(u=i.x),i.y>=d&&(d=i.y),i.y<=h&&(h=i.y))}const f=Math.max(l-u,d-h),p=new tI({xmid:(l+u)/2,ymid:(d+h)/2,length:f,massCenter:o,mass:c}),g=new eI(p);for(let e=0;e<c;e+=1){const{id:r}=s[e];a&&t.getDegree(r)<=1||n[r].in(p)&&g.insert(n[r])}for(let r=0;r<c;r+=1){const{id:c,data:u}=s[r],l=t.getDegree(c);if(a&&l<=1)continue;n[c].resetForce(),g.updateForce(n[c]),e[c][0]-=n[c].fx,e[c][1]-=n[c].fy;const h=[u.x-o[0],u.y-o[1]];let d=Math.hypot(h[0],h[1]);d=d<1e-4?1e-4:d,h[0]=h[0]/d,h[1]=h[1]/d;const f=i*(l+1);e[c][0]-=f*h[0],e[c][1]-=f*h[1]}return e}getRepGraForces(t,e,n,r,i,o,a){const{preventOverlap:s,kr:c,kg:u,center:l,prune:h}=a,d=t.getAllNodes(),f=d.length;for(let a=0;a<f;a+=1){const p=d[a],g=t.getDegree(p.id);for(let u=a+1;u<f;u+=1){const a=d[u],l=t.getDegree(a.id);if(h&&(g<=1||l<=1))continue;const f=[a.data.x-p.data.x,a.data.y-p.data.y];let m=Math.hypot(f[0],f[1]);m=m<1e-4?1e-4:m,f[0]=f[0]/m,f[1]=f[1]/m,s&&e<n&&(m=m-o[p.id]-o[a.id]);let v=c*(g+1)*(l+1)/m;s&&e<n&&m<0?v=i*(g+1)*(l+1):s&&e<n&&0===m?v=0:s&&e<n&&m>0&&(v=c*(g+1)*(l+1)/m),r[p.id][0]-=v*f[0],r[a.id][0]+=v*f[0],r[p.id][1]-=v*f[1],r[a.id][1]+=v*f[1]}const m=[p.data.x-l[0],p.data.y-l[1]],v=Math.hypot(m[0],m[1]);m[0]=m[0]/v,m[1]=m[1]/v;const y=u*(g+1);r[p.id][0]-=y*m[0],r[p.id][1]-=y*m[1]}return r}updatePos(t,e,n,r,i){const{ks:o,tao:a,prune:s,ksmax:c}=i,u=t.getAllNodes(),l=u.length,h=[],d=[];let f=0,p=0,g=r;for(let r=0;r<l;r+=1){const{id:i}=u[r],o=t.getDegree(i);if(s&&o<=1)continue;const a=[e[i][0]-n[i][0],e[i][1]-n[i][1]],c=Math.hypot(a[0],a[1]),l=[e[i][0]+n[i][0],e[i][1]+n[i][1]],g=Math.hypot(l[0],l[1]);h[r]=c,d[r]=g/2,f+=(o+1)*h[r],p+=(o+1)*d[r]}const m=g;g=a*p/f,0!==m&&(g=g>1.5*m?1.5*m:g);for(let n=0;n<l;n+=1){const{id:r,data:i}=u[n],a=t.getDegree(r);if(s&&a<=1)continue;if(Wt(i.fx)&&Wt(i.fy))continue;let l=o*g/(1+g*Math.sqrt(h[n])),d=Math.hypot(e[r][0],e[r][1]);d=d<1e-4?1e-4:d;const f=c/d;l=l>f?f:l;const p=l*e[r][0],m=l*e[r][1];t.mergeNodeData(r,{x:i.x+p,y:i.y+m})}return g}},circular:class{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},Vm),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,t,e)}))}genericCircularLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{width:i,height:o,center:a,divisions:s,startAngle:c=0,endAngle:u=2*Math.PI,angleRatio:l,ordering:h,clockwise:d,nodeSpacing:f,nodeSize:p}=r,g=e.getAllNodes(),m=e.getAllEdges(),[v,y,b]=Um(i,o,a),x=null==g?void 0:g.length;if(!x||1===x)return Gm(e,t,b);const E=(u-c)/x;let{radius:w,startRadius:M,endRadius:N}=r;if(f){const t=Lm(10,f),e=jm(10,p);let n=-1/0;g.forEach((t=>{const r=e(t);n<r&&(n=r)}));let r=0;g.forEach(((e,i)=>{r+=0===i?n||10:(t(e)||0)+(n||10)})),w=r/(2*Math.PI)}else w||M||N?!M&&N?M=N:M&&!N&&(N=M):w=Math.min(y,v)/2;const S=E*l;let C=[];C="topology"===h?Wm(e,g):"topology-directed"===h?Wm(e,g,!0):"degree"===h?function(t,e){const n=[];return e.forEach(((t,e)=>{n.push(Im(t))})),n.sort(((e,n)=>t.getDegree(e.id,"both")-t.getDegree(n.id,"both"))),n}(e,g):g.map((t=>Im(t)));const T=Math.ceil(x/s);for(let t=0;t<x;++t){let e=w;e||null===M||null===N||(e=M+t*(N-M)/(x-1)),e||(e=10+100*t/(x-1));let n=c+t%T*S+2*Math.PI/s*Math.floor(t/T);d||(n=u-t%T*S-2*Math.PI/s*Math.floor(t/T)),C[t].data.x=b[0]+Math.cos(n)*e,C[t].data.y=b[1]+Math.sin(n)*e}t&&C.forEach((t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}));return{nodes:C,edges:m}}))}},concentric:qm,d3force:ub,"d3-force-3d":class extends ub{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:Tb,manyBody:jE,center:hb,collide:Nb,radial:zE,x:BE,y:FE,z:GE},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return LE()}},dagre:QD,dendrogram:Ap.dendrogram,force:pv,fruchterman:class{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},rI),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericFruchtermanLayout(!0,t,e)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(t,e,n){return a(this,void 0,void 0,(function*(){if(this.running)return;const r=this.formatOptions(n),{dimensions:i,width:o,height:a,center:s,clustering:c,nodeClusterBy:u,maxIteration:l,onTick:h}=r,d=e.getAllNodes(),f=e.getAllEdges();if(!(null==d?void 0:d.length)){const t={nodes:[],edges:f};return this.lastResult=t,t}if(1===d.length){t&&e.mergeNodeData(d[0].id,{x:s[0],y:s[1],z:3===i?s[2]:void 0});const n={nodes:[Object.assign(Object.assign({},d[0]),{data:Object.assign(Object.assign({},d[0].data),{x:s[0],y:s[1],z:3===i?s[2]:void 0})})],edges:f};return this.lastResult=n,n}const p=d.map((t=>Im(t,[o,a]))),g=new Lp({nodes:p,edges:f}),m={};if(c&&p.forEach((t=>{const e=t.data[u];m[e]||(m[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=p,this.lastLayoutEdges=f,this.lastAssign=t,this.lastGraph=g,this.lastOptions=r,this.lastClusterMap=m,"undefined"==typeof window)return;let v=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(g,m,r),t&&p.forEach((({id:t,data:n})=>e.mergeNodeData(t,{x:n.x,y:n.y,z:3===i?n.z:void 0}))),null==h||h({nodes:p,edges:f}),v++,v>=l&&(window.clearInterval(this.timeInterval),n({nodes:p,edges:f}))):n({nodes:p,edges:f})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:n,nodeClusterBy:r}=e,{center:i,width:o,height:a}=e;return e.width=o||"undefined"==typeof window?o:window.innerWidth,e.height=a||"undefined"==typeof window?a:window.innerHeight,e.center=i||[e.width/2,e.height/2],e.clustering=n&&!!r,e}runOneStep(t,e,n){const{dimensions:r,height:i,width:o,gravity:a,center:s,speed:c,clustering:u,nodeClusterBy:l,clusterGravity:h}=n,d=i*o,f=Math.sqrt(d)/10,p=t.getAllNodes(),g=d/(p.length+1),m=Math.sqrt(g),v={};if(this.applyCalculate(t,v,m,g),u){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;p.forEach((t=>{const{data:n}=t,r=e[n[l]];Wt(n.x)&&(r.cx+=n.x),Wt(n.y)&&(r.cy+=n.y),r.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=h||a;p.forEach(((n,r)=>{const{id:i,data:o}=n;if(!Wt(o.x)||!Wt(o.y))return;const a=e[o[l]],s=Math.sqrt((o.x-a.cx)*(o.x-a.cx)+(o.y-a.cy)*(o.y-a.cy)),c=m*t;v[i].x-=c*(o.x-a.cx)/s,v[i].y-=c*(o.y-a.cy)/s}))}p.forEach(((t,e)=>{const{id:n,data:i}=t;if(!Wt(i.x)||!Wt(i.y))return;const o=.01*m*a;v[n].x-=o*(i.x-s[0]),v[n].y-=o*(i.y-s[1]),3===r&&(v[n].z-=o*(i.z-s[2]))})),p.forEach(((e,n)=>{const{id:i,data:o}=e;if(Wt(o.fx)&&Wt(o.fy))return o.x=o.fx,o.y=o.fy,void(3===r&&(o.z=o.fz));if(!Wt(o.x)||!Wt(o.y))return;const a=Math.sqrt(v[i].x*v[i].x+v[i].y*v[i].y+(3===r?v[i].z*v[i].z:0));if(a>0){const e=Math.min(f*(c/800),a);t.mergeNodeData(i,{x:o.x+v[i].x/a*e,y:o.y+v[i].y/a*e,z:3===r?o.z+v[i].z/a*e:void 0})}}))}applyCalculate(t,e,n,r){this.calRepulsive(t,e,r),this.calAttractive(t,e,n)}calRepulsive(t,e,n){const r=t.getAllNodes();r.forEach((({data:t,id:i},o)=>{e[i]={x:0,y:0,z:0},r.forEach((({data:r,id:a},s)=>{if(o<=s||!Wt(t.x)||!Wt(r.x)||!Wt(t.y)||!Wt(r.y))return;let c=t.x-r.x,u=t.y-r.y,l=3===this.options.dimensions?t.z-r.z:0,h=c*c+u*u+l*l;0===h&&(h=1,c=.01,u=.01,l=.01);const d=n/h,f=c*d,p=u*d,g=l*d;e[i].x+=f,e[i].y+=p,e[a].x-=f,e[a].y-=p,3===this.options.dimensions&&(e[i].z+=g,e[a].z-=g)}))}))}calAttractive(t,e,n){t.getAllEdges().forEach((r=>{const{source:i,target:o}=r;if(!i||!o||i===o)return;const{data:a}=t.getNode(i),{data:s}=t.getNode(o);if(!(Wt(s.x)&&Wt(a.x)&&Wt(s.y)&&Wt(a.y)))return;const c=s.x-a.x,u=s.y-a.y,l=3===this.options.dimensions?s.z-a.z:0,h=Math.sqrt(c*c+u*u+l*l)/n,d=c*h,f=u*h,p=l*h;e[i].x+=d,e[i].y+=f,e[o].x-=d,e[o].y-=f,3===this.options.dimensions&&(e[i].z+=p,e[o].z-=p)}))}},grid:class{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},iI),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericGridLayout(!0,t,e)}))}genericGridLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{begin:i=[0,0],condense:o,preventOverlapPadding:a,preventOverlap:s,rows:c,cols:u,nodeSpacing:l,nodeSize:h,width:d,height:f,position:p}=r;let{sortBy:g}=r;const m=e.getAllNodes(),v=e.getAllEdges(),y=null==m?void 0:m.length;if(!y||1===y)return Gm(e,t,i);const b=m.map((t=>Im(t)));"id"===g||Bt(g)&&void 0!==b[0].data[g]||(g="degree"),"degree"===g?b.sort(((t,n)=>e.getDegree(n.id,"both")-e.getDegree(t.id,"both"))):"id"===g?b.sort(((t,e)=>Wt(e.id)&&Wt(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):b.sort(((t,e)=>e.data[g]-t.data[g]));const x=d||"undefined"==typeof window?d:window.innerWidth,E=f||"undefined"==typeof window?f:window.innerHeight,w=y,M={rows:c,cols:u};if(null!=c&&null!=u)M.rows=c,M.cols=u;else if(null!=c&&null==u)M.rows=c,M.cols=Math.ceil(w/M.rows);else if(null==c&&null!=u)M.cols=u,M.rows=Math.ceil(w/M.cols);else{const t=Math.sqrt(w*E/x);M.rows=Math.round(t),M.cols=Math.round(x/E*t)}if(M.rows=Math.max(M.rows,1),M.cols=Math.max(M.cols,1),M.cols*M.rows>w){const t=oI(M),e=aI(M);(t-1)*e>=w?oI(M,t-1):(e-1)*t>=w&&aI(M,e-1)}else for(;M.cols*M.rows<w;){const t=oI(M),e=aI(M);(e+1)*t>=w?aI(M,e+1):oI(M,t+1)}let N=o?0:x/M.cols,S=o?0:E/M.rows;if(s||l){const t=Lm(10,l),n=jm(30,h,!1);b.forEach((r=>{r.data.x&&r.data.y||(r.data.x=0,r.data.y=0);const i=e.getNode(r.id),o=n(i)||30;let s,c;Pm(o)?(s=o[0],c=o[1]):(s=o,c=o);const u=void 0!==t?t(r):a,l=s+u,h=c+u;N=Math.max(N,l),S=Math.max(S,h)}))}const C={},T={row:0,col:0},k={};for(let t=0;t<b.length;t++){const n=b[t];let r;if(p&&(r=p(e.getNode(n.id))),r&&(void 0!==r.row||void 0!==r.col)){const t={row:r.row,col:r.col};if(void 0===t.col)for(t.col=0;sI(C,t);)t.col++;else if(void 0===t.row)for(t.row=0;sI(C,t);)t.row++;k[n.id]=t,cI(C,t)}lI(n,i,N,S,k,M,T,C)}const P={nodes:b,edges:v};return t&&b.forEach((t=>{e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),P}))}},indented:Ap.indented,mds:gy,mindmap:Ap.mindmap,radial:class{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},pI),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericRadialLayout(!0,t,e)}))}genericRadialLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{width:i,height:o,center:a,focusNode:s,unitRadius:c,nodeSize:u,nodeSpacing:l,strictRadial:h,preventOverlap:d,maxPreventOverlapIteration:f,sortBy:p,linkDistance:g=50,sortStrength:m=10,maxIteration:v=1e3}=r,y=e.getAllNodes(),b=e.getAllEdges(),x=i||"undefined"==typeof window?i:window.innerWidth,E=o||"undefined"==typeof window?o:window.innerHeight,w=a||[x/2,E/2];if(!(null==y?void 0:y.length)||1===y.length)return Gm(e,t,w);let M=y[0];if(Bt(s)){for(let t=0;t<y.length;t++)if(y[t].id===s){M=y[t];break}}else M=s||y[0];const N=vI(y,M.id),S=Om({nodes:y,edges:b},!1),C=Am(S),T=bI(C,N);yI(C,N,T+1);const k=C[N];let P=x-w[0]>w[0]?w[0]:x-w[0],A=E-w[1]>w[1]?w[1]:E-w[1];0===P&&(P=x/2),0===A&&(A=E/2);const O=Math.min(P,A),_=Math.max(...k),R=[],D=c||O/_;k.forEach(((t,e)=>{R[e]=t*D}));const I=gI(y,C,g,R,D,p,m),L=mI(I),j=((t,e,n)=>{try{const n=dy.mul(dy.pow(e,2),-.5),r=n.mean("row"),i=n.mean("column"),o=n.mean();n.add(o).subRowVector(r).subColumnVector(i);const a=new fy(n),s=dy.sqrt(a.diagonalMatrix).diagonal();return a.leftSingularVectors.toJSON().map((e=>dy.mul([e],[s]).toJSON()[0].splice(0,t)))}catch(t){const r=[];for(let t=0;t<e.length;t++){const t=Math.random()*n,e=Math.random()*n;r.push([t,e])}return r}})(g,I,g);let z,B=j.map((([t,e])=>({x:(isNaN(t)?Math.random()*g:t)-j[N][0],y:(isNaN(e)?Math.random()*g:e)-j[N][1]})));if(this.run(v,B,L,I,R,N),d){z=zm(u,l);const t={nodes:y,nodeSizeFunc:z,positions:B,radii:R,height:E,width:x,strictRadial:Boolean(h),focusIdx:N,iterations:f||200,k:B.length/4.5};B=((t,e)=>{const n=Object.assign(Object.assign({},hI),e),{positions:r,iterations:i,width:o,k:a,speed:s=100,strictRadial:c,focusIdx:u,radii:l=[],nodeSizeFunc:h}=n,d=t.getAllNodes(),f=[],p=o/10;for(let t=0;t<i;t++)r.forEach(((t,e)=>{f[e]={x:0,y:0}})),dI(d,r,f,a,l,h),fI(r,f,s,c,u,p,o,l);return r})(e,t)}const F=[];B.forEach(((t,e)=>{const n=Im(y[e]);n.data.x=t.x+w[0],n.data.y=t.y+w[1],F.push(n)})),t&&F.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:F,edges:b}}))}run(t,e,n,r,i,o){for(let a=0;a<=t;a++){const s=a/t;this.oneIteration(s,e,i,r,n,o)}}oneIteration(t,e,n,r,i,o){const a=1-t;e.forEach(((s,c)=>{const u=_m(s,{x:0,y:0}),l=0===u?0:1/u;if(c===o)return;let h=0,d=0,f=0;e.forEach(((t,e)=>{if(c===e)return;const n=_m(s,t),o=0===n?0:1/n,a=r[e][c];f+=i[c][e],h+=i[c][e]*(t.x+a*(s.x-t.x)*o),d+=i[c][e]*(t.y+a*(s.y-t.y)*o)}));const p=0===n[c]?0:1/n[c];f*=a,f+=t*p*p,h*=a,h+=t*p*s.x*l,s.x=h/f,d*=a,d+=t*p*s.y*l,s.y=d/f}))}},random:class{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},xI),t)}execute(t,e){return a(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,t,e)}))}assign(t,e){return a(this,void 0,void 0,(function*(){this.genericRandomLayout(!0,t,e)}))}genericRandomLayout(t,e,n){return a(this,void 0,void 0,(function*(){const r=Object.assign(Object.assign({},this.options),n),{center:i,width:o,height:a}=r,s=e.getAllNodes(),c=o||"undefined"==typeof window?o:window.innerWidth,u=a||"undefined"==typeof window?a:window.innerHeight,l=i||[c/2,u/2],h=[];s&&s.forEach((t=>{h.push({id:t.id,data:{x:.9*(Math.random()-.5)*c+l[0],y:.9*(Math.random()-.5)*u+l[1]}})})),t&&h.forEach((t=>e.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:h,edges:e.getAllEdges()}}))}}},node:{circle:jl,ellipse:Fl,image:Vl,rect:Wl,star:Ul,triangle:Hl,diamond:Bl,hexagon:Gl},palette:{spectral:["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],tableau:["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],oranges:["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],greens:["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],blues:["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"]},theme:{dark:$j,light:Yj},plugin:{hull:kL,"grid-line":KI,watermark:Vj,tooltip:Bj,contextmenu:YI,toolbar:zj,legend:jj,history:eL},transform:{"update-related-edges":class extends Kj{beforeDraw(t){const{model:e}=this.context,{update:{nodes:n,edges:r,combos:i}}=t,o=(t,n)=>{e.getRelatedEdgesData(n).forEach((t=>!r.has(Fu(t))&&r.set(Fu(t),t)))};return n.forEach(o),i.forEach(o),t}},"arrange-draw-order":class extends Kj{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,r=[];return n.forEach(((t,n)=>{const i=e.getAncestorsData(n,"combo").map((t=>Fu(t))).reverse();r.push([n,t,i.length])})),t.add.combos=new Map(r.sort((([,,t],[,,e])=>e-t)).map((([t,e])=>[t,e]))),t}},"collapse-expand-combo":class extends Kj{beforeDraw(t){const{model:e}=this.context,{add:n,update:r}=t,i=(e,n,r)=>{const i=`${n}s`;Object.entries(t).forEach((([t,n])=>{e===t?n[i].set(Fu(r),r):n[i].delete(Fu(r))}))},o=[...t.update.combos.entries(),...t.add.combos.entries()];for(;o.length;){const[t,a]=o.pop();if(!!a.style?.collapsed){const s=e.getDescendantsData(t),c=s.map(Fu),{internal:u,external:l}=fh(c,(t=>e.getRelatedEdgesData(t)));s.forEach((t=>{const n=Fu(t),r=o.findIndex((([t])=>t===n));-1!==r&&o.splice(r,1);const a=e.getElementType(n);i("remove",a,t)})),u.forEach((t=>i("remove","edge",t))),l.forEach((t=>{const e=Fu(t),i=c.includes(t.source)?"source":"target",o={...t,[i]:Fu(a)};n.edges.has(e)&&n.edges.set(e,o),r.edges.has(e)&&r.edges.set(e,o)}))}else{const n=e.getChildrenData(t),r=n.map(Fu),{edges:a}=fh(r,(t=>e.getRelatedEdgesData(t)));[...n,...a].forEach((t=>{const n=Fu(t),r=e.getElementType(n),a=this.context.element?.getElement(n);i(a?"update":"add",r,t),"combo"===r&&o.push([n,t])}))}}return t}},"process-parallel-edges":Zj}},nz={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{}};function rz(t,e,n){nz[t][e]?console.error(`The extension ${e} of ${t} has been registered before.`):Object.assign(nz[t],{[e]:n})}function iz(t,e){const n=nz[t]?.[e];if(n)return n}fs.enableCSSParsing=!1,Object.entries(ez).forEach((([t,e])=>{Object.entries(e).forEach((([e,n])=>{rz(t,e,n)}))}));class oz{type;constructor(t){this.type=t}}class az extends oz{data;constructor(t,e){super(t),this.data=e}}class sz extends oz{animationType;animation;data;constructor(t,e,n,r){super(t),this.animationType=e,this.animation=n,this.data=r}}class cz extends oz{elementType;data;constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class uz extends oz{data;constructor(t,e){super(t),this.data=e}}function lz(t,e){t.emit(e.type,e)}function hz(t,e){const{datum:n,index:r,elementData:i}=e;return kt(t)?t(n,r,i):Object.fromEntries(Object.entries(t).map((([t,e])=>kt(e)?[t,e(n,r,i)]:[t,e])))}function dz(t){return t.style?.zIndex??Fh("zIndex")??0}class fz{context;batchCount=0;constructor(t){this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(e=!0){this.batchCount++,1===this.batchCount&&this.emit(new az(t.GraphEvent.BATCH_START,{initiate:e}))}endBatch(){this.batchCount--,0===this.batchCount&&this.emit(new az(t.GraphEvent.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class pz extends Hh{currentTarget=null;category="behavior";constructor(t){super(t),this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.addEventListener(t,this.forwardContainerEvents)}));const n=this.context.canvas.document;n&&[t.CanvasEvent.CLICK,t.CanvasEvent.DBLCLICK,t.CanvasEvent.POINTER_OVER,t.CanvasEvent.POINTER_LEAVE,t.CanvasEvent.POINTER_ENTER,t.CanvasEvent.POINTER_MOVE,t.CanvasEvent.POINTER_OUT,t.CanvasEvent.POINTER_DOWN,t.CanvasEvent.POINTER_UP,t.CanvasEvent.CONTEXT_MENU,t.CanvasEvent.DRAG_START,t.CanvasEvent.DRAG,t.CanvasEvent.DRAG_END,t.CanvasEvent.DRAG_ENTER,t.CanvasEvent.DRAG_OVER,t.CanvasEvent.DRAG_LEAVE,t.CanvasEvent.DROP,t.CanvasEvent.WHEEL].forEach((t=>{n.addEventListener(t,this.forwardCanvasEvents)}))}forwardCanvasEvents=e=>{const{target:n}=e,r=function(t){if(!t)return null;if(t instanceof Ws)return{type:"canvas",element:t};let e=t;for(;e;){if(Mh(e))return{type:"node",element:e};if(Nh(e))return{type:"edge",element:e};if(Sh(e))return{type:"combo",element:e};e=e.parentElement}return null}(n);if(!r)return;const{graph:i,canvas:o}=this.context,{type:a,element:s}=r,{type:c,detail:u,button:l}=e,h={...e,target:s,targetType:a,originalTarget:n};if(c===t.CanvasEvent.POINTER_MOVE&&(this.currentTarget!==s&&(this.currentTarget&&i.emit(`${a}:${t.CanvasEvent.POINTER_LEAVE}`,{...h,target:this.currentTarget}),s&&i.emit(`${a}:${t.CanvasEvent.POINTER_ENTER}`,h)),this.currentTarget=s),c===t.CanvasEvent.CLICK&&2===l||(i.emit(`${a}:${c}`,h),i.emit(c,h)),c===t.CanvasEvent.CLICK&&2===u&&(i.emit(`${a}:${t.CanvasEvent.DBLCLICK}`,h),i.emit(t.CanvasEvent.DBLCLICK,h)),c===t.CanvasEvent.POINTER_DOWN&&2===l){const e={...h,preventDefault:()=>{o.getContainer()?.addEventListener(t.CanvasEvent.CONTEXT_MENU,(t=>t.preventDefault()),{once:!0})}};i.emit(`${a}:${t.CanvasEvent.CONTEXT_MENU}`,e),i.emit(t.CanvasEvent.CONTEXT_MENU,e)}};forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)};destroy(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach((t=>{e.removeEventListener(t,this.forwardContainerEvents)})),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}function gz(t,e){var n=e.r;t.arc(n,n,n,0,2*Math.PI,!1)}function mz(t,e){var n=e.rx,r=e.ry;if(t.ellipse)t.ellipse(n,r,n,r,0,0,2*Math.PI,!1);else{var i=n>r?n:r,o=n>r?1:n/r,a=n>r?r/n:1;t.save(),t.scale(o,a),t.arc(i,i,i,0,2*Math.PI)}}function vz(t,e){var n,r,i=e.x1,o=e.y1,a=e.x2,s=e.y2,c=e.defX,u=void 0===c?0:c,l=e.defY,h=void 0===l?0:l,d=e.markerStart,f=e.markerEnd,p=e.markerStartOffset,g=e.markerEndOffset,m=0,v=0,y=0,b=0,x=0;d&&Es(d)&&p&&(n=a-i,r=s-o,x=Math.atan2(r,n),m=Math.cos(x)*(p||0),v=Math.sin(x)*(p||0)),f&&Es(f)&&g&&(n=i-a,r=o-s,x=Math.atan2(r,n),y=Math.cos(x)*(g||0),b=Math.sin(x)*(g||0)),t.moveTo(i-u+m,o-h+v),t.lineTo(a-u+y,s-h+b)}function yz(t,e){var n,r,i=e.defX,o=void 0===i?0:i,a=e.defY,s=void 0===a?0:a,c=e.markerStart,l=e.markerEnd,h=e.markerStartOffset,d=e.markerEndOffset,f=e.path,p=f.absolutePath,g=f.segments,m=0,v=0,y=0,b=0,x=0;if(c&&Es(c)&&h){var E=u(c.parentNode.getStartTangent(),2),w=E[0],M=E[1];n=w[0]-M[0],r=w[1]-M[1],x=Math.atan2(r,n),m=Math.cos(x)*(h||0),v=Math.sin(x)*(h||0)}if(l&&Es(l)&&d){var N=u(l.parentNode.getEndTangent(),2);w=N[0],M=N[1];n=w[0]-M[0],r=w[1]-M[1],x=Math.atan2(r,n),y=Math.cos(x)*(d||0),b=Math.sin(x)*(d||0)}for(var S=0;S<p.length;S++){var C=p[S],T=C[0],k=p[S+1],P=0===S&&(0!==m||0!==v),A=(S===p.length-1||k&&("M"===k[0]||"Z"===k[0]))&&0!==y&&0!==b;switch(T){case"M":P?(t.moveTo(C[1]-o+m,C[2]-s+v),t.lineTo(C[1]-o,C[2]-s)):t.moveTo(C[1]-o,C[2]-s);break;case"L":A?t.lineTo(C[1]-o+y,C[2]-s+b):t.lineTo(C[1]-o,C[2]-s);break;case"Q":t.quadraticCurveTo(C[1]-o,C[2]-s,C[3]-o,C[4]-s),A&&t.lineTo(C[3]-o+y,C[4]-s+b);break;case"C":t.bezierCurveTo(C[1]-o,C[2]-s,C[3]-o,C[4]-s,C[5]-o,C[6]-s),A&&t.lineTo(C[5]-o+y,C[6]-s+b);break;case"A":var O=g[S].arcParams,_=O.cx,R=O.cy,D=O.rx,I=O.ry,L=O.startAngle,j=O.endAngle,z=O.xRotation,B=O.sweepFlag;if(t.ellipse)t.ellipse(_-o,R-s,D,I,z,L,j,!!(1-B));else{var F=D>I?D:I,G=D>I?1:D/I,V=D>I?I/D:1;t.translate(_-o,R-s),t.rotate(z),t.scale(G,V),t.arc(0,0,F,L,j,!!(1-B)),t.scale(1/G,1/V),t.rotate(-z),t.translate(-(_-o),-(R-s))}A&&t.lineTo(C[6]-o+y,C[7]-s+b);break;case"Z":t.closePath()}}}function bz(t,e){var n,r,i=e.defX,o=void 0===i?0:i,a=e.defY,s=void 0===a?0:a,c=e.markerStart,u=e.markerEnd,l=e.markerStartOffset,h=e.markerEndOffset,d=e.points.points,f=d.length,p=d[0][0]-o,g=d[0][1]-s,m=d[f-1][0]-o,v=d[f-1][1]-s,y=0,b=0,x=0,E=0,w=0;c&&Es(c)&&l&&(n=d[1][0]-d[0][0],r=d[1][1]-d[0][1],w=Math.atan2(r,n),y=Math.cos(w)*(l||0),b=Math.sin(w)*(l||0)),u&&Es(u)&&h&&(n=d[f-1][0]-d[0][0],r=d[f-1][1]-d[0][1],w=Math.atan2(r,n),x=Math.cos(w)*(h||0),E=Math.sin(w)*(h||0)),t.moveTo(p+(y||x),g+(b||E));for(var M=1;M<f-1;M++){var N=d[M];t.lineTo(N[0]-o,N[1]-s)}t.lineTo(m,v)}function xz(t,e){var n,r,i=e.defX,o=void 0===i?0:i,a=e.defY,s=void 0===a?0:a,c=e.markerStart,u=e.markerEnd,l=e.markerStartOffset,h=e.markerEndOffset,d=e.points.points,f=d.length,p=d[0][0]-o,g=d[0][1]-s,m=d[f-1][0]-o,v=d[f-1][1]-s,y=0,b=0,x=0,E=0,w=0;c&&Es(c)&&l&&(n=d[1][0]-d[0][0],r=d[1][1]-d[0][1],w=Math.atan2(r,n),y=Math.cos(w)*(l||0),b=Math.sin(w)*(l||0)),u&&Es(u)&&h&&(n=d[f-2][0]-d[f-1][0],r=d[f-2][1]-d[f-1][1],w=Math.atan2(r,n),x=Math.cos(w)*(h||0),E=Math.sin(w)*(h||0)),t.moveTo(p+y,g+b);for(var M=1;M<f-1;M++){var N=d[M];t.lineTo(N[0]-o,N[1]-s)}t.lineTo(m+x,v+E)}function Ez(t,e){var n=e.radius,r=e.width,i=e.height,o=r,a=i;if(n&&n.some((function(t){return 0!==t}))){var s=r>0?1:-1,c=i>0?1:-1,l=s+c===0,h=u(n.map((function(t){return Vt(t,0,Math.min(Math.abs(o)/2,Math.abs(a)/2))})),4),d=h[0],f=h[1],p=h[2],g=h[3];t.moveTo(s*d,0),t.lineTo(o-s*f,0),0!==f&&t.arc(o-s*f,c*f,f,-c*Math.PI/2,s>0?0:Math.PI,l),t.lineTo(o,a-c*p),0!==p&&t.arc(o-s*p,a-c*p,p,s>0?0:Math.PI,c>0?Math.PI/2:1.5*Math.PI,l),t.lineTo(s*g,a),0!==g&&t.arc(s*g,a-c*g,g,c>0?Math.PI/2:-Math.PI/2,s>0?Math.PI:0,l),t.lineTo(0,c*d),0!==d&&t.arc(s*d,c*d,d,s>0?Math.PI:0,c>0?1.5*Math.PI:Math.PI/2,l)}else t.rect(0,0,o,a)}var wz=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.name="canvas-path-generator",e}return r(e,t),e.prototype.init=function(){var t,e=((t={})[Yn.CIRCLE]=gz,t[Yn.ELLIPSE]=mz,t[Yn.RECT]=Ez,t[Yn.LINE]=vz,t[Yn.POLYLINE]=xz,t[Yn.POLYGON]=bz,t[Yn.PATH]=yz,t[Yn.TEXT]=void 0,t[Yn.GROUP]=void 0,t[Yn.IMAGE]=void 0,t[Yn.HTML]=void 0,t[Yn.MESH]=void 0,t);this.context.pathGeneratorFactory=e},e.prototype.destroy=function(){delete this.context.pathGeneratorFactory},e}(Zn),Mz=Z(),Nz=Z(),Sz=Z(),Cz=x(),Tz=function(){function t(){var t=this;this.isHit=function(e,n,r,i){var o=t.context.pointInPathPickerFactory[e.nodeName];if(o){var a=C(Cz,r),s=lt(Nz,nt(Sz,n[0],n[1],0),a),c=e.getGeometryBounds().halfExtents,u=e.parsedStyle.anchor;if(s[0]+=(u&&u[0]||0)*c[0]*2,s[1]+=(u&&u[1]||0)*c[1]*2,o(e,new Mr(s[0],s[1]),i,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var r=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),i=t.context.pathGeneratorFactory[e.nodeName];return i&&(r.beginPath(),i(r,e.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return t.prototype.apply=function(e,n){var r,i=this,o=e.renderingService,c=e.renderingContext;this.context=e,this.runtime=n;var u=null===(r=c.root)||void 0===r?void 0:r.ownerDocument;o.hooks.pick.tapPromise(t.tag,(function(t){return a(i,void 0,void 0,(function(){return s(this,(function(e){return[2,this.pick(u,t)]}))}))})),o.hooks.pickSync.tap(t.tag,(function(t){return i.pick(u,t)}))},t.prototype.pick=function(t,e){var n,r,i=e.topmost,o=e.position,a=o.x,s=o.y,u=nt(Mz,a,s,0),l=t.elementsFromBBox(u[0],u[1],u[0],u[1]),h=[];try{for(var d=c(l),f=d.next();!f.done;f=d.next()){var p=f.value,g=p.getWorldTransform();if(this.isHit(p,u,g,!1)){var m=ua(p);if(m){var v=m.parsedStyle.clipPath;if(this.isHit(v,u,v.getWorldTransform(),!0)){if(i)return e.picked=[p],e;h.push(p)}}else{if(i)return e.picked=[p],e;h.push(p)}}}}catch(t){n={error:t}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return e.picked=h,e},t.tag="CanvasPicker",t}();function kz(t,e,n){var r=t.parsedStyle,i=r.r,o=r.fill,a=r.stroke,s=r.lineWidth,c=r.increasedLineWidthForHitTesting,l=r.pointerEvents,h=((s||0)+(c||0))/2,d=kn(i,i,e.x,e.y),f=u(fa(l,o,a),2),p=f[0],g=f[1];return p&&g||n?d<=i+h:p?d<=i:!!g&&(d>=i-h&&d<=i+h)}function Pz(t,e,n,r){return t/(n*n)+e/(r*r)}function Az(t,e,n){var r=t.parsedStyle,i=r.rx,o=r.ry,a=r.fill,s=r.stroke,c=r.lineWidth,l=r.increasedLineWidthForHitTesting,h=r.pointerEvents,d=e.x,f=e.y,p=u(fa(h,a,s),2),g=p[0],m=p[1],v=((c||0)+(l||0))/2,y=(d-i)*(d-i),b=(f-o)*(f-o);return g&&m||n?Pz(y,b,i+v,o+v)<=1:g?Pz(y,b,i,o)<=1:!!m&&(Pz(y,b,i-v,o-v)>=1&&Pz(y,b,i+v,o+v)<=1)}function Oz(t,e,n,r,i,o){return i>=t&&i<=t+n&&o>=e&&o<=e+r}function _z(t,e,n,r,i,o,a,s){var c=(Math.atan2(s-e,a-t)+2*Math.PI)%(2*Math.PI),u={x:t+n*Math.cos(c),y:e+n*Math.sin(c)};return kn(u.x,u.y,a,s)<=o/2}function Rz(t,e,n,r,i,o,a){var s=Math.min(t,n),c=Math.max(t,n),u=Math.min(e,r),l=Math.max(e,r),h=i/2;return o>=s-h&&o<=c+h&&a>=u-h&&a<=l+h&&jn(t,e,n,r,o,a)<=i/2}function Dz(t,e,n,r,i){var o=t.length;if(o<2)return!1;for(var a=0;a<o-1;a++){if(Rz(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,n,r))return!0}if(i){var s=t[0],c=t[o-1];if(Rz(s[0],s[1],c[0],c[1],e,n,r))return!0}return!1}var Iz=1e-6;function Lz(t){return Math.abs(t)<Iz?0:t<0?-1:1}function jz(t,e,n){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}function zz(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o=0;o<i;o++){var a=t[o],s=t[(o+1)%i];if(jz(a,s,[e,n]))return!0;Lz(a[1]-n)>0!=Lz(s[1]-n)>0&&Lz(e-(n-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])<0&&(r=!r)}return r}function Bz(t,e,n){for(var r=!1,i=0;i<t.length;i++){if(r=zz(t[i],e,n))break}return r}function Fz(t,e,n){var r=t.parsedStyle,i=r.x1,o=r.y1,a=r.x2,s=r.y2,c=r.lineWidth,l=r.increasedLineWidthForHitTesting,h=r.defX,d=void 0===h?0:h,f=r.defY,p=void 0===f?0:f;return!(!u(fa(r.pointerEvents,r.fill,r.stroke),2)[1]&&!n||!c)&&Rz(i,o,a,s,(c||0)+(l||0),e.x+d,e.y+p)}function Gz(t,e,n,r,i,o){var a=t.parsedStyle,s=a.lineWidth,c=a.increasedLineWidthForHitTesting,l=a.stroke,h=a.fill,d=a.defX,f=void 0===d?0:d,p=a.defY,g=void 0===p?0:p,m=a.path,v=a.pointerEvents,y=m.segments,b=m.hasArc,x=m.polylines,E=m.polygons,w=u(fa(v,(null==E?void 0:E.length)&&h,l),2),M=w[0],N=w[1],S=Zi(t),C=!1;return M||n?C=b?r(t,e):Bz(E,e.x+f,e.y+g)||Bz(x,e.x+f,e.y+g):((N||n)&&(C=function(t,e,n,r,i){for(var o=!1,a=e/2,s=0;s<t.length;s++){var c=t[s],u=c.currentPoint,l=c.params,h=c.prePoint,d=c.box;if(!d||Oz(d.x-a,d.y-a,d.width+e,d.height+e,n,r))switch(c.command){case"L":case"Z":if(o=Rz(h[0],h[1],u[0],u[1],e,n,r))return!0;break;case"Q":if(o=qn(h[0],h[1],l[1],l[2],l[3],l[4],n,r)<=e/2)return!0;break;case"C":if(o=Gn(h[0],h[1],l[1],l[2],l[3],l[4],l[5],l[6],n,r,i)<=e/2)return!0;break;case"A":c.cubicParams||(c.cubicParams=_e(h[0],h[1],l[1],l[2],l[3],l[4],l[5],l[6],l[7],void 0));for(var f=c.cubicParams,p=h,g=0;g<f.length;g+=6){var m=Gn(p[0],p[1],f[g],f[g+1],f[g+2],f[g+3],f[g+4],f[g+5],n,r,i);if(p=[f[g+4],f[g+5]],o=m<=e/2)return!0}}}return o}(y,(s||0)+(c||0),e.x+f,e.y+g,S)),C)}function Vz(t,e,n){var r=t.parsedStyle,i=r.stroke,o=r.fill,a=r.lineWidth,s=r.increasedLineWidthForHitTesting,c=r.points,l=r.defX,h=void 0===l?0:l,d=r.defY,f=void 0===d?0:d,p=u(fa(r.pointerEvents,o,i),2),g=p[0],m=!1;return(p[1]||n)&&(m=Dz(c.points,(a||0)+(s||0),e.x+h,e.y+f,!0)),m||!g&&!n||(m=zz(c.points,e.x+h,e.y+f)),m}function Wz(t,e,n){var r=t.parsedStyle,i=r.lineWidth,o=r.increasedLineWidthForHitTesting,a=r.points,s=r.defX,c=void 0===s?0:s,l=r.defY,h=void 0===l?0:l;return!(!u(fa(r.pointerEvents,r.fill,r.stroke),2)[1]&&!n||!i)&&Dz(a.points,(i||0)+(o||0),e.x+c,e.y+h,!1)}function Uz(t,e,n,r,i){var o=t.parsedStyle,a=o.radius,s=o.fill,c=o.stroke,l=o.lineWidth,h=o.increasedLineWidthForHitTesting,d=o.width,f=o.height,p=u(fa(o.pointerEvents,s,c),2),g=p[0],m=p[1],v=(l||0)+(h||0);if(a&&a.some((function(t){return 0!==t}))){var y=!1;return(m||n)&&(y=function(t,e,n,r,i,o,a,s){var c=u(i,4),l=c[0],h=c[1],d=c[2],f=c[3];return Rz(t+l,e,t+n-h,e,o,a,s)||Rz(t+n,e+h,t+n,e+r-d,o,a,s)||Rz(t+n-d,e+r,t+f,e+r,o,a,s)||Rz(t,e+r-f,t,e+l,o,a,s)||_z(t+n-h,e+h,h,Math.PI,Math.PI,o,a,s)||_z(t+n-d,e+r-d,d,0,Math.PI,o,a,s)||_z(t+f,e+r-f,f,Math.PI,Math.PI,o,a,s)||_z(t+l,e+l,l,Math.PI,Math.PI,o,a,s)}(0,0,d,f,a.map((function(t){return Vt(t,0,Math.min(Math.abs(d)/2,Math.abs(f)/2))})),v,e.x,e.y)),y||!g&&!n||(y=r(t,e)),y}var b=v/2;return g&&m||n?Oz(0-b,0-b,d+b,f+b,e.x,e.y):g?Oz(0,0,d,f,e.x,e.y):!!m&&function(t,e,n,r,i,o,a){var s=i/2;return Oz(t-s,e-s,n,i,o,a)||Oz(t+n-s,e-s,i,r,o,a)||Oz(t+s,e+r-s,n,i,o,a)||Oz(t-s,e+s,i,r,o,a)}(0,0,d,f,v,e.x,e.y)}function Hz(t,e,n,r,i,o){var a=t.parsedStyle,s=a.pointerEvents,c=a.width,u=a.height;if("non-transparent-pixel"===s){var l=i.config.offscreenCanvas,h=o.offscreenCanvasCreator.getOrCreateCanvas(l),d=o.offscreenCanvasCreator.getOrCreateContext(l,{willReadFrequently:!0});return h.width=c,h.height=u,i.defaultStyleRendererFactory[Yn.IMAGE].render(d,t.parsedStyle,t,void 0,void 0,void 0),d.getImageData(e.x,e.y,1,1).data.every((function(t){return 0!==t}))}return!0}var qz=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.name="canvas-picker",e}return r(e,t),e.prototype.init=function(){var t,e=((t={})[Yn.CIRCLE]=kz,t[Yn.ELLIPSE]=Az,t[Yn.RECT]=Uz,t[Yn.LINE]=Fz,t[Yn.POLYLINE]=Wz,t[Yn.POLYGON]=Vz,t[Yn.PATH]=Gz,t[Yn.TEXT]=function(){return!0},t[Yn.GROUP]=null,t[Yn.IMAGE]=Hz,t[Yn.HTML]=null,t[Yn.MESH]=null,t);this.context.pointInPathPickerFactory=e,this.addRenderingPlugin(new Tz)},e.prototype.destroy=function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()},e}(Zn),$z=function(){function t(t){this.canvasRendererPluginOptions=t,this.removedRBushNodeAABBs=[],this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.vpMatrix=x(),this.dprMatrix=x(),this.tmpMat4=x(),this.vec3a=Z(),this.vec3b=Z(),this.vec3c=Z(),this.vec3d=Z()}return t.prototype.apply=function(e,n){var r=this;this.context=e;var i=e.config,o=e.camera,a=e.renderingService,s=e.renderingContext,c=e.rBushRoot,h=e.pathGeneratorFactory;this.rBush=c,this.pathGeneratorFactory=h;var d=e.contextService,f=s.root.ownerDocument.defaultView,p=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)},g=function(t){var e=t.target.rBushNode;e.aabb&&r.removedRBushNodeAABBs.push(e.aabb)};a.hooks.init.tap(t.tag,(function(){f.addEventListener(Za.UNMOUNTED,p),f.addEventListener(Za.CULLED,g);var t=d.getDPR(),e=i.width,n=i.height,o=d.getContext();r.clearRect(o,0,0,e*t,n*t,i.background)})),a.hooks.destroy.tap(t.tag,(function(){f.removeEventListener(Za.UNMOUNTED,p),f.removeEventListener(Za.CULLED,g),r.renderQueue=[],r.removedRBushNodeAABBs=[],r.restoreStack=[]})),a.hooks.beginFrame.tap(t.tag,(function(){var t=d.getContext(),e=d.getDPR(),n=i.width,o=i.height,s=r.canvasRendererPluginOptions,c=s.dirtyObjectNumThreshold,u=s.dirtyObjectRatioThreshold,l=a.getStats(),h=l.total,f=l.rendered,p=f/h;r.clearFullScreen=a.disableDirtyRectangleRendering()||f>c&&p>u,t&&(t.resetTransform?t.resetTransform():t.setTransform(1,0,0,1,0,0),r.clearFullScreen&&r.clearRect(t,0,0,n*e,o*e,i.background))}));var m=function(t,e){t.isVisible()&&!t.isCulled()&&(r.renderDisplayObject(t,e,r.context,r.restoreStack,n),r.saveDirtyAABB(t)),(t.sortable.sorted||t.childNodes).forEach((function(t){m(t,e)}))};a.hooks.endFrame.tap(t.tag,(function(){var t=d.getContext(),e=d.getDPR();if(D(r.dprMatrix,[e,e,1]),k(r.vpMatrix,r.dprMatrix,o.getOrthoMatrix()),r.clearFullScreen)m(s.root,t);else{var a=r.safeMergeAABB.apply(r,l([r.mergeDirtyAABBs(r.renderQueue)],u(r.removedRBushNodeAABBs.map((function(t){var e=t.minX,n=t.minY,r=t.maxX,i=t.maxY,o=new vr;return o.setMinMax([e,n,0],[r,i,0]),o}))),!1));if(r.removedRBushNodeAABBs=[],vr.isEmpty(a))return void(r.renderQueue=[]);var c=r.convertAABB2Rect(a),h=c.x,p=c.y,g=c.width,v=c.height,y=lt(r.vec3a,[h,p,0],r.vpMatrix),b=lt(r.vec3b,[h+g,p,0],r.vpMatrix),x=lt(r.vec3c,[h,p+v,0],r.vpMatrix),E=lt(r.vec3d,[h+g,p+v,0],r.vpMatrix),w=Math.min(y[0],b[0],E[0],x[0]),M=Math.min(y[1],b[1],E[1],x[1]),N=Math.max(y[0],b[0],E[0],x[0]),S=Math.max(y[1],b[1],E[1],x[1]),C=Math.floor(w),T=Math.floor(M),P=Math.ceil(N-w),A=Math.ceil(S-M);t.save(),r.clearRect(t,C,T,P,A,i.background),t.beginPath(),t.rect(C,T,P,A),t.clip(),t.setTransform(r.vpMatrix[0],r.vpMatrix[1],r.vpMatrix[4],r.vpMatrix[5],r.vpMatrix[12],r.vpMatrix[13]),i.renderer.getConfig().enableDirtyRectangleRenderingDebug&&f.dispatchEvent(new qa(ws.DIRTY_RECTANGLE,{dirtyRect:{x:C,y:T,width:P,height:A}})),r.searchDirtyObjects(a).sort((function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder})).forEach((function(e){e&&e.isVisible()&&!e.isCulled()&&r.renderDisplayObject(e,t,r.context,r.restoreStack,n)})),t.restore(),r.renderQueue.forEach((function(t){r.saveDirtyAABB(t)})),r.renderQueue=[]}r.restoreStack.forEach((function(){t.restore()})),r.restoreStack=[]})),a.hooks.render.tap(t.tag,(function(t){r.clearFullScreen||r.renderQueue.push(t)}))},t.prototype.clearRect=function(t,e,n,r,i,o){t.clearRect(e,n,r,i),o&&(t.fillStyle=o,t.fillRect(e,n,r,i))},t.prototype.renderDisplayObject=function(t,e,n,r,i){var o=t.nodeName,a=r[r.length-1];!a||t.compareDocumentPosition(a)&Ya.DOCUMENT_POSITION_CONTAINS||(e.restore(),r.pop());var s=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],u=t.parsedStyle.clipPath;if(u){this.applyWorldTransform(e,u);var l=this.pathGeneratorFactory[u.nodeName];l&&(e.save(),r.push(t),e.beginPath(),l(e,u.parsedStyle),e.closePath(),e.clip())}s&&(this.applyWorldTransform(e,t),e.save(),this.applyAttributesToContext(e,t)),c&&(e.beginPath(),c(e,t.parsedStyle),t.nodeName!==Yn.LINE&&t.nodeName!==Yn.PATH&&t.nodeName!==Yn.POLYLINE&&e.closePath()),s&&(s.render(e,t.parsedStyle,t,n,this,i),e.restore()),t.renderable.dirty=!1},t.prototype.convertAABB2Rect=function(t){var e=t.getMin(),n=t.getMax(),r=Math.floor(e[0]),i=Math.floor(e[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}},t.prototype.mergeDirtyAABBs=function(t){var e=new vr;return t.forEach((function(t){var n=t.getRenderBounds();e.add(n);var r=t.renderable.dirtyRenderBounds;r&&e.add(r)})),e},t.prototype.searchDirtyObjects=function(t){var e=u(t.getMin(),2),n=e[0],r=e[1],i=u(t.getMax(),2),o=i[0],a=i[1];return this.rBush.search({minX:n,minY:r,maxX:o,maxY:a}).map((function(t){return t.displayObject}))},t.prototype.saveDirtyAABB=function(t){var e=t.renderable;e.dirtyRenderBounds||(e.dirtyRenderBounds=new vr);var n=t.getRenderBounds();n&&e.dirtyRenderBounds.update(n.center,n.halfExtents)},t.prototype.applyAttributesToContext=function(t,e){var n=e.parsedStyle,r=n.stroke,i=n.fill,o=n.opacity,a=n.lineDash,s=n.lineDashOffset;a&&t.setLineDash(a),Pt(s)||(t.lineDashOffset=s),Pt(o)||(t.globalAlpha*=o),Pt(r)||Array.isArray(r)||r.isNone||(t.strokeStyle=e.attributes.stroke),Pt(i)||Array.isArray(i)||i.isNone||(t.fillStyle=e.attributes.fill)},t.prototype.applyWorldTransform=function(t,e,n){var r=0,i=0,o=(e.parsedStyle||{}).anchor,a=o&&o[0]||0,s=o&&o[1]||0;if(0!==a||0!==s){var c=e.geometry.contentBounds;r=-a*(c&&2*c.halfExtents[0]||0),i=-s*(c&&2*c.halfExtents[1]||0)}n?(w(this.tmpMat4,e.getLocalTransform()),this.vec3a[0]=r,this.vec3a[1]=i,this.vec3a[2]=0,P(this.tmpMat4,this.tmpMat4,this.vec3a),k(this.tmpMat4,n,this.tmpMat4),k(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(w(this.tmpMat4,e.getWorldTransform()),this.vec3a[0]=r,this.vec3a[1]=i,this.vec3a[2]=0,P(this.tmpMat4,this.tmpMat4,this.vec3a),k(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])},t.prototype.safeMergeAABB=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=new vr;return t.forEach((function(t){n.add(t)})),n},t.tag="CanvasRenderer",t}(),Yz=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n,r,i,o){var a=e.fill,s=e.fillRule,c=e.opacity,u=e.fillOpacity,l=e.stroke,h=e.strokeOpacity,d=e.lineWidth,f=e.lineCap,p=e.lineJoin,g=e.shadowType,m=e.shadowColor,v=e.shadowBlur,y=e.filter,b=e.miterLimit,x=!Pt(a)&&!a.isNone,E=!Pt(l)&&!l.isNone&&d>0,w=0===a.alpha,M=!(!y||!y.length),N=!Pt(m)&&v>0,S=n.nodeName,C="inner"===g,T=E&&N&&(S===Yn.PATH||S===Yn.LINE||S===Yn.POLYLINE||w||C);x&&(t.globalAlpha=c*u,T||Kz(n,t,N),this.fill(t,n,a,s,r,i,o),T||this.clearShadowAndFilter(t,M,N)),E&&(t.globalAlpha=c*h,t.lineWidth=d,Pt(b)||(t.miterLimit=b),Pt(f)||(t.lineCap=f),Pt(p)||(t.lineJoin=p),T&&(C&&(t.globalCompositeOperation="source-atop"),Kz(n,t,!0),C&&(this.stroke(t,n,l,r,i,o),t.globalCompositeOperation="source-over",this.clearShadowAndFilter(t,M,!0))),this.stroke(t,n,l,r,i,o))},t.prototype.clearShadowAndFilter=function(t,e,n){if(n&&(t.shadowColor="transparent",t.shadowBlur=0),e){var r=t.filter;!Pt(r)&&r.indexOf("drop-shadow")>-1&&(t.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}},t.prototype.fill=function(t,e,n,r,i,o,a){var s=this;Array.isArray(n)?n.forEach((function(n){t.fillStyle=s.getColor(n,e,t),r?t.fill(r):t.fill()})):(Ti(n)&&(t.fillStyle=this.getPattern(n,e,t,i,o,a)),r?t.fill(r):t.fill())},t.prototype.stroke=function(t,e,n,r,i,o){var a=this;Array.isArray(n)?n.forEach((function(n){t.strokeStyle=a.getColor(n,e,t),t.stroke()})):(Ti(n)&&(t.strokeStyle=this.getPattern(n,e,t,r,i,o)),t.stroke())},t.prototype.getPattern=function(t,e,n,r,i,o){var a,s;if("rect"===t.image.nodeName){var c=t.image.parsedStyle,u=c.width,l=c.height;s=r.contextService.getDPR();var h=r.config.offscreenCanvas;(a=o.offscreenCanvasCreator.getOrCreateCanvas(h)).width=u*s,a.height=l*s;var d=o.offscreenCanvasCreator.getOrCreateContext(h),f=[];t.image.forEach((function(t){i.renderDisplayObject(t,d,r,f,o)})),f.forEach((function(){d.restore()}))}return this.imagePool.getOrCreatePatternSync(t,n,a,s,(function(){e.renderable.dirty=!0,r.renderingService.dirtify()}))},t.prototype.getColor=function(t,e,n){var r;if(t.type===zr.LinearGradient||t.type===zr.RadialGradient){var o=e.getGeometryBounds(),a=o&&2*o.halfExtents[0]||1,s=o&&2*o.halfExtents[1]||1;r=this.imagePool.getOrCreateGradient(i(i({type:t.type},t.value),{width:a,height:s}),n)}return r},t}();function Kz(t,e,n){var r=t.parsedStyle,i=r.filter,o=r.shadowColor,a=r.shadowBlur,s=r.shadowOffsetX,c=r.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),n&&(e.shadowColor=o.toString(),e.shadowBlur=a||0,e.shadowOffsetX=s||0,e.shadowOffsetY=c||0)}var Xz=function(){function t(t){this.imagePool=t}return t.prototype.render=function(t,e,n){var r,i=e.width,o=e.height,a=e.img,s=e.shadowColor,c=e.shadowBlur,u=i,l=o;if(Bt(a)?r=this.imagePool.getImageSync(a):(u||(u=a.width),l||(l=a.height),r=a),r){Kz(n,t,!Pt(s)&&c>0);try{t.drawImage(r,0,0,u,l)}catch(t){}}},t}(),Zz=function(){function t(){}return t.prototype.render=function(t,e,n,r,i,o){var a=e,s=a.lineWidth,c=a.textAlign,u=a.textBaseline,l=a.lineJoin,h=a.miterLimit,d=a.letterSpacing,f=a.stroke,p=a.fill,g=a.fillOpacity,m=a.strokeOpacity,v=a.opacity,y=a.metrics,b=a.dx,x=a.dy,E=a.shadowColor,w=a.shadowBlur,M=y.font,N=y.lines,S=y.height,C=y.lineHeight,T=y.lineMetrics;t.font=M,t.lineWidth=s,t.textAlign="middle"===c?"center":c;var k=u;o.enableCSSParsing||"alphabetic"!==k||(k="bottom"),t.lineJoin=l,Pt(h)||(t.miterLimit=h);var P=0;"middle"===u?P=-S/2-C/2:"bottom"===u||"alphabetic"===u||"ideographic"===u?P=-S:"top"!==u&&"hanging"!==u||(P=-C);var A=b||0;P+=x||0,1===N.length&&("bottom"===k?(k="middle",P-=.5*S):"top"===k&&(k="middle",P+=.5*S)),t.textBaseline=k,Kz(n,t,!Pt(E)&&w>0);for(var O=0;O<N.length;O++){var _=s/2+A;P+=C,Pt(f)||f.isNone||!s||this.drawLetterSpacing(t,N[O],T[O],c,_,P,d,g,m,v,!0),Pt(p)||this.drawLetterSpacing(t,N[O],T[O],c,_,P,d,g,m,v)}},t.prototype.drawLetterSpacing=function(t,e,n,r,i,o,a,s,c,u,l){if(void 0===l&&(l=!1),0!==a){var h=t.textAlign;t.textAlign="left";var d=i;"center"===r||"middle"===r?d=i-n.width/2:"right"!==r&&"end"!==r||(d=i-n.width);for(var f=Array.from(e),p=t.measureText(e).width,g=0,m=0;m<f.length;++m){var v=f[m];l?this.strokeText(t,v,d,o,c):this.fillText(t,v,d,o,s,u),d+=p-(g=t.measureText(e.substring(m+1)).width)+a,p=g}t.textAlign=h}else l?this.strokeText(t,e,i,o,c):this.fillText(t,e,i,o,s,u)},t.prototype.fillText=function(t,e,n,r,i,o){var a,s=!Pt(i)&&1!==i;s&&(a=t.globalAlpha,t.globalAlpha=i*o),t.fillText(e,n,r),s&&(t.globalAlpha=a)},t.prototype.strokeText=function(t,e,n,r,i){var o,a=!Pt(i)&&1!==i;a&&(o=t.globalAlpha,t.globalAlpha=i),t.strokeText(e,n,r),a&&(t.globalAlpha=o)},t}();!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(Yz),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(Yz),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(Yz),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(Yz),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(Yz),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(Yz),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}r(e,t)}(Yz);var Qz=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="canvas-renderer",n}return r(e,t),e.prototype.init=function(){var t,e=i({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,r=new Yz(n),o=((t={})[Yn.CIRCLE]=r,t[Yn.ELLIPSE]=r,t[Yn.RECT]=r,t[Yn.IMAGE]=new Xz(n),t[Yn.TEXT]=new Zz,t[Yn.LINE]=r,t[Yn.POLYLINE]=r,t[Yn.POLYGON]=r,t[Yn.PATH]=r,t[Yn.GROUP]=void 0,t[Yn.HTML]=void 0,t[Yn.MESH]=void 0,t);this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new $z(e))},e.prototype.destroy=function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory},e}(Zn),Jz=function(){function t(){}return t.prototype.apply=function(e,n){var r=this,i=e.renderingService,o=e.renderingContext,a=e.config;this.context=e;var s=o.root.ownerDocument.defaultView,c=function(t){i.hooks.pointerMove.call(t)},u=function(t){i.hooks.pointerUp.call(t)},l=function(t){i.hooks.pointerDown.call(t)},h=function(t){i.hooks.pointerOver.call(t)},d=function(t){i.hooks.pointerOut.call(t)},f=function(t){i.hooks.pointerCancel.call(t)},p=function(t){i.hooks.pointerWheel.call(t)},g=function(t){i.hooks.click.call(t)};i.hooks.init.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="none",t.style.msTouchAction="none"):s.supportsPointerEvents&&(t.style.touchAction="none"),s.supportsPointerEvents?function(t){n.globalThis.document.addEventListener("pointermove",c,!0),t.addEventListener("pointerdown",l,!0),t.addEventListener("pointerleave",d,!0),t.addEventListener("pointerover",h,!0),n.globalThis.addEventListener("pointerup",u,!0),n.globalThis.addEventListener("pointercancel",f,!0)}(t):function(t){n.globalThis.document.addEventListener("mousemove",c,!0),t.addEventListener("mousedown",l,!0),t.addEventListener("mouseout",d,!0),t.addEventListener("mouseover",h,!0),n.globalThis.addEventListener("mouseup",u,!0)}(t),s.supportsTouchEvents&&function(t){t.addEventListener("touchstart",l,!0),t.addEventListener("touchend",u,!0),t.addEventListener("touchmove",c,!0),t.addEventListener("touchcancel",f,!0)}(t),a.useNativeClickEvent&&t.addEventListener("click",g,!0),t.addEventListener("wheel",p,{passive:!0,capture:!0})})),i.hooks.destroy.tap(t.tag,(function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="",t.style.msTouchAction=""):s.supportsPointerEvents&&(t.style.touchAction=""),s.supportsPointerEvents?function(t){n.globalThis.document.removeEventListener("pointermove",c,!0),t.removeEventListener("pointerdown",l,!0),t.removeEventListener("pointerleave",d,!0),t.removeEventListener("pointerover",h,!0),n.globalThis.removeEventListener("pointerup",u,!0)}(t):function(t){n.globalThis.document.removeEventListener("mousemove",c,!0),t.removeEventListener("mousedown",l,!0),t.removeEventListener("mouseout",d,!0),t.removeEventListener("mouseover",h,!0),n.globalThis.removeEventListener("mouseup",u,!0)}(t),s.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",l,!0),t.removeEventListener("touchend",u,!0),t.removeEventListener("touchmove",c,!0),t.removeEventListener("touchcancel",f,!0)}(t),a.useNativeClickEvent&&t.removeEventListener("click",g,!0),t.removeEventListener("wheel",p,!0)}))},t.tag="DOMInteraction",t}(),tB=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.name="dom-interaction",e}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new Jz)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(Zn),eB=function(){function t(){this.displayObjectHTMLElementMap=new WeakMap}return t.prototype.joinTransformMatrix=function(t){return"matrix(".concat([t[0],t[1],t[4],t[5],t[12],t[13]].join(","),")")},t.prototype.apply=function(e,n){var r=this,i=e.camera,o=e.renderingContext,a=e.renderingService;this.context=e;var s=o.root.ownerDocument.defaultView,c=s.context.eventService.nativeHTMLMap,u=function(t,e){e.style.transform=r.joinTransformMatrix(t.getWorldTransform())},l=function(t){var e=t.target;if(e.nodeName===Yn.HTML){r.$camera||(r.$camera=r.createCamera(i));var o=r.getOrCreateEl(e);if(r.$camera.appendChild(o),n.enableCSSParsing){var a=e.ownerDocument.documentElement.attributes;Object.keys(a).forEach((function(t){o.style[t]=a[t]}))}Object.keys(e.attributes).forEach((function(t){r.updateAttribute(t,e)})),u(e,o),c.set(o,e)}},h=function(t){var e=t.target;if(e.nodeName===Yn.HTML&&r.$camera){var n=r.getOrCreateEl(e);n&&(n.remove(),c.delete(n))}},d=function(t){var e=t.target;if(e.nodeName===Yn.HTML){var n=t.attrName;r.updateAttribute(n,e)}},f=function(t){var e=t.target;if(e.nodeName===Yn.HTML){var n=r.getOrCreateEl(e);u(e,n)}},p=function(){if(r.$camera){var t=r.context.config,e=t.width,n=t.height;r.$camera.style.width="".concat(e||0,"px"),r.$camera.style.height="".concat(n||0,"px")}};a.hooks.init.tap(t.tag,(function(){s.addEventListener(ws.RESIZE,p),s.addEventListener(Za.MOUNTED,l),s.addEventListener(Za.UNMOUNTED,h),s.addEventListener(Za.ATTR_MODIFIED,d),s.addEventListener(Za.BOUNDS_CHANGED,f)})),a.hooks.endFrame.tap(t.tag,(function(){r.$camera&&o.renderReasons.has(Ga.CAMERA_CHANGED)&&(r.$camera.style.transform=r.joinTransformMatrix(i.getOrthoMatrix()))})),a.hooks.destroy.tap(t.tag,(function(){r.$camera&&r.$camera.remove(),s.removeEventListener(ws.RESIZE,p),s.removeEventListener(Za.MOUNTED,l),s.removeEventListener(Za.UNMOUNTED,h),s.removeEventListener(Za.ATTR_MODIFIED,d),s.removeEventListener(Za.BOUNDS_CHANGED,f)}))},t.prototype.createCamera=function(t){var e=this.context.config,n=e.document,r=e.width,i=e.height,o=this.context.contextService.getDomElement(),a=o.parentNode;if(a){var s="g-canvas-camera",c=a.querySelector("#"+s);if(!c){var u=(n||document).createElement("div");c=u,u.id=s,u.style.position="absolute",u.style.left="".concat(o.offsetLeft||0,"px"),u.style.top="".concat(o.offsetTop||0,"px"),u.style.transformOrigin="left top",u.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),u.style.overflow="hidden",u.style.pointerEvents="none",u.style.width="".concat(r||0,"px"),u.style.height="".concat(i||0,"px"),a.appendChild(u)}return c}return null},t.prototype.getOrCreateEl=function(t){var e=this.context.config.document,n=this.displayObjectHTMLElementMap.get(t);return n||(n=(e||document).createElement("div"),t.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(t,n),t.id&&(n.id=t.id),t.name&&n.setAttribute("name",t.name),t.className&&(n.className=t.className),n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(t.getWorldTransform())),n},t.prototype.updateAttribute=function(t,e){var n=this.getOrCreateEl(e);switch(t){case"innerHTML":var r=e.parsedStyle.innerHTML;Bt(r)?n.innerHTML=r:(n.innerHTML="",n.appendChild(r));break;case"transformOrigin":var i=e.parsedStyle.transformOrigin;n.style["transform-origin"]="".concat(i[0].value," ").concat(i[1].value);break;case"width":if(this.context.enableCSSParsing){var o=e.computedStyleMap().get("width");n.style.width=o.toString()}else{o=e.parsedStyle.width;n.style.width=Wt(o)?"".concat(o,"px"):o.toString()}break;case"height":if(this.context.enableCSSParsing){var a=e.computedStyleMap().get("height");n.style.height=a.toString()}else{a=e.parsedStyle.height;n.style.height=Wt(a)?"".concat(a,"px"):a.toString()}break;case"zIndex":var s=e.parsedStyle.zIndex;n.style["z-index"]="".concat(s);break;case"visibility":var c=e.parsedStyle.visibility;n.style.visibility=c;break;case"pointerEvents":var u=e.parsedStyle.pointerEvents;n.style.pointerEvents=u;break;case"opacity":var l=e.parsedStyle.opacity;n.style.opacity="".concat(l);break;case"fill":var h=e.parsedStyle.fill,d="";ki(h)?d=h.isNone?"transparent":e.getAttribute("fill"):Array.isArray(h)?d=e.getAttribute("fill"):Ti(h),n.style.background=d;break;case"stroke":var f=e.parsedStyle.stroke,p="";ki(f)?p=f.isNone?"transparent":e.getAttribute("stroke"):Array.isArray(f)?p=e.getAttribute("stroke"):Ti(f),n.style["border-color"]=p,n.style["border-style"]="solid";break;case"lineWidth":var g=e.parsedStyle.lineWidth;n.style["border-width"]="".concat(g||0,"px");break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":var m=e.style.filter;n.style.filter=m;break;default:"x"!==t&&"y"!==t&&(Pt(e.style[t])||""===e.style[t]||(n.style[t]=e.style[t]))}},t.tag="HTMLRendering",t}(),nB=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.name="html-renderer",e}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new eB)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(Zn),rB=function(){function t(t){this.canvasConfig=t,this.imageCache={},this.gradientCache={},this.patternCache={}}return t.prototype.getImageSync=function(t,e){return this.imageCache[t]?e&&e(this.imageCache[t]):this.getOrCreateImage(t).then((function(t){e&&e(t)})),this.imageCache[t]},t.prototype.getOrCreateImage=function(t){var e=this;if(this.imageCache[t])return Promise.resolve(this.imageCache[t]);var n=this.canvasConfig.createImage;return new Promise((function(r,i){var o;n?o=n(t):aa&&(o=new window.Image),o&&(o.onload=function(){e.imageCache[t]=o,r(o)},o.onerror=function(t){i(t)},o.crossOrigin="Anonymous",o.src=t)}))},t.prototype.getOrCreatePatternSync=function(t,e,n,r,i){var o=this.generatePatternKey(t);if(o&&this.patternCache[o])return this.patternCache[o];var a,s=t.image,c=t.repetition,u=t.transform,l=!1;Bt(s)?a=this.getImageSync(s,i):n?(a=n,l=!0):a=s;var h=a&&e.createPattern(a,c);if(h){var d=void 0;d=u?$o(bo(u),new Ps({})):N(x()),l&&A(d,d,[1/r,1/r,1]),h.setTransform({a:d[0],b:d[1],c:d[4],d:d[5],e:d[12],f:d[13]})}return o&&h&&(this.patternCache[o]=h),h},t.prototype.getOrCreateGradient=function(t,e){var n=this.generateGradientKey(t),r=t.type,i=t.steps,o=t.width,a=t.height,s=t.angle,c=t.cx,u=t.cy,l=t.size;if(this.gradientCache[n])return this.gradientCache[n];var h=null;if(r===zr.LinearGradient){var d=function(t,e,n){var r=or(n.value),i=0+t/2,o=0+e/2,a=Math.abs(t*Math.cos(r))+Math.abs(e*Math.sin(r));return{x1:i-Math.cos(r)*a/2,y1:o-Math.sin(r)*a/2,x2:i+Math.cos(r)*a/2,y2:o+Math.sin(r)*a/2}}(o,a,s),f=d.x1,p=d.y1,g=d.x2,m=d.y2;h=e.createLinearGradient(f,p,g,m)}else if(r===zr.RadialGradient){var v=function(t,e,n,r,i){var o=n.value,a=r.value;n.unit===Tr.kPercentage&&(o=n.value/100*t),r.unit===Tr.kPercentage&&(a=r.value/100*e);var s=Math.max(je([0,0],[o,a]),je([0,e],[o,a]),je([t,e],[o,a]),je([t,0],[o,a]));return i&&(i instanceof Jr?s=i.value:i instanceof Hr&&("closest-side"===i.value?s=Math.min(o,t-o,a,e-a):"farthest-side"===i.value?s=Math.max(o,t-o,a,e-a):"closest-corner"===i.value&&(s=Math.min(je([0,0],[o,a]),je([0,e],[o,a]),je([t,e],[o,a]),je([t,0],[o,a]))))),{x:o,y:a,r:s}}(o,a,c,u,l),y=v.x,b=v.y,x=v.r;h=e.createRadialGradient(y,b,0,y,b,x)}return h&&(i.forEach((function(t){var e=t.offset,n=t.color;e.unit===Tr.kPercentage&&(null==h||h.addColorStop(e.value/100,n.toString()))})),this.gradientCache[n]=h),this.gradientCache[n]},t.prototype.generateGradientKey=function(t){var e=t.type,n=t.width,r=t.height,i=t.steps,o=t.angle,a=t.cx,s=t.cy,c=t.size;return"gradient-".concat(e,"-").concat((null==o?void 0:o.toString())||0,"-").concat((null==a?void 0:a.toString())||0,"-").concat((null==s?void 0:s.toString())||0,"-").concat((null==c?void 0:c.toString())||0,"-").concat(n,"-").concat(r,"-").concat(i.map((function(t){var e=t.offset,n=t.color;return"".concat(e).concat(n)})).join("-"))},t.prototype.generatePatternKey=function(t){var e=t.image,n=t.repetition;return Bt(e)?"pattern-".concat(e,"-").concat(n):"rect"===e.nodeName?"pattern-".concat(e.entity,"-").concat(n):void 0},t}(),iB=function(){function t(){}return t.prototype.apply=function(e){var n=e.renderingService,r=e.renderingContext,i=e.imagePool,o=r.root.ownerDocument.defaultView,a=function(t,e,n){var r=t.parsedStyle,i=r.width,o=r.height;i&&!o?t.setAttribute("height",n/e*i):!i&&o&&t.setAttribute("width",e/n*o)},s=function(t){var e=t.target,r=e.nodeName,o=e.attributes;if(r===Yn.IMAGE){var s=o.img,c=o.keepAspectRatio;Bt(s)&&i.getImageSync(s,(function(t){var r=t.width,i=t.height;c&&a(e,r,i),e.renderable.dirty=!0,n.dirtify()}))}},c=function(t){var e=t.target,r=t.attrName,o=t.newValue;e.nodeName===Yn.IMAGE&&"img"===r&&Bt(o)&&i.getOrCreateImage(o).then((function(t){var r=t.width,i=t.height;e.attributes.keepAspectRatio&&a(e,r,i),e.renderable.dirty=!0,n.dirtify()}))};n.hooks.init.tap(t.tag,(function(){o.addEventListener(Za.MOUNTED,s),o.addEventListener(Za.ATTR_MODIFIED,c)})),n.hooks.destroy.tap(t.tag,(function(){o.removeEventListener(Za.MOUNTED,s),o.removeEventListener(Za.ATTR_MODIFIED,c)}))},t.tag="LoadImage",t}(),oB=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.name="image-loader",e}return r(e,t),e.prototype.init=function(){this.context.imagePool=new rB(this.context.config),this.addRenderingPlugin(new iB)},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e}(Zn),aB=function(){function t(t){this.renderingContext=t.renderingContext,this.canvasConfig=t.config}return t.prototype.init=function(){var t=this.canvasConfig,e=t.container,n=t.canvas;if(n)this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container;else if(e&&(this.$container=Bt(e)?document.getElementById(e):e,this.$container)){var r=document.createElement("canvas");this.$container.appendChild(r),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=r}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)},t.prototype.getContext=function(){return this.context},t.prototype.getDomElement=function(){return this.$canvas},t.prototype.getDPR=function(){return this.dpr},t.prototype.getBoundingClientRect=function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()},t.prototype.destroy=function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)},t.prototype.resize=function(t,e){var n=this.canvasConfig.devicePixelRatio||aa&&window.devicePixelRatio||1;n=n>=1?Math.ceil(n):1,this.dpr=n,this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*e,function(t,e,n){aa&&t.style&&(t.style.width=e+"px",t.style.height=n+"px")}(this.$canvas,t,e)),this.renderingContext.renderReasons.add(Ga.CAMERA_CHANGED)},t.prototype.applyCursorStyle=function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)},t.prototype.toDataURL=function(t){return void 0===t&&(t={}),a(this,void 0,void 0,(function(){var e,n;return s(this,(function(r){return e=t.type,n=t.encoderOptions,[2,this.context.canvas.toDataURL(e,n)]}))}))},t}(),sB=function(t){function e(){var e=t.apply(this,l([],u(arguments),!1))||this;return e.name="canvas-context-register",e}return r(e,t),e.prototype.init=function(){this.context.ContextService=aB},e.prototype.destroy=function(){delete this.context.ContextService},e}(Zn),cB=function(t){function e(e){var n=t.call(this,e)||this;return n.registerPlugin(new sB),n.registerPlugin(new oB),n.registerPlugin(new wz),n.registerPlugin(new Qz),n.registerPlugin(new tB),n.registerPlugin(new qz),n.registerPlugin(new nB),n}return r(e,t),e}(Qn),uB=function(){function t(t){this.dragndropPluginOptions=t}return t.prototype.apply=function(e){var n=this,r=e.renderingService,i=e.renderingContext.root.ownerDocument,o=i.defaultView,c=function(t){var e=t.target,r=e===i,c=r&&n.dragndropPluginOptions.isDocumentDraggable?i:e.closest&&e.closest("[draggable=true]");if(c){var u=!1,l=t.timeStamp,h=[t.clientX,t.clientY],d=null,f=[t.clientX,t.clientY],p=function(t){return a(n,void 0,void 0,(function(){var n,o,a,p,g,m;return s(this,(function(s){switch(s.label){case 0:if(!u){if(n=t.timeStamp-l,o=je([t.clientX,t.clientY],h),n<=this.dragndropPluginOptions.dragstartTimeThreshold||o<=this.dragndropPluginOptions.dragstartDistanceThreshold)return[2];t.type="dragstart",c.dispatchEvent(t),u=!0}return t.type="drag",t.dx=t.clientX-f[0],t.dy=t.clientY-f[1],c.dispatchEvent(t),f=[t.clientX,t.clientY],r?[3,2]:(a="pointer"===this.dragndropPluginOptions.overlap?[t.canvasX,t.canvasY]:e.getBounds().center,[4,i.elementsFromPoint(a[0],a[1])]);case 1:p=s.sent(),g=p[p.indexOf(e)+1],m=(null==g?void 0:g.closest("[droppable=true]"))||(this.dragndropPluginOptions.isDocumentDroppable?i:null),d!==m&&(d&&(t.type="dragleave",t.target=d,d.dispatchEvent(t)),m&&(t.type="dragenter",t.target=m,m.dispatchEvent(t)),(d=m)&&(t.type="dragover",t.target=d,d.dispatchEvent(t))),s.label=2;case 2:return[2]}}))}))};o.addEventListener("pointermove",p);var g=function(t){if(u){t.detail={preventClick:!0};var e=t.clone();d&&(e.type="drop",e.target=d,d.dispatchEvent(e)),e.type="dragend",c.dispatchEvent(e),u=!1}o.removeEventListener("pointermove",p)};e.addEventListener("pointerup",g,{once:!0}),e.addEventListener("pointerupoutside",g,{once:!0})}};r.hooks.init.tap(t.tag,(function(){o.addEventListener("pointerdown",c)})),r.hooks.destroy.tap(t.tag,(function(){o.removeEventListener("pointerdown",c)}))},t.tag="Dragndrop",t}(),lB=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.options=e,n.name="dragndrop",n}return r(e,t),e.prototype.init=function(){this.addRenderingPlugin(new uB(i({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))},e.prototype.destroy=function(){this.removeAllRenderingPlugins()},e.prototype.setOptions=function(t){Object.assign(this.plugins[0].dragndropPluginOptions,t)},e}(Zn);class hB{config;background;main;label;transient;get canvas(){return{main:this.main,label:this.label,transient:this.transient,background:this.background}}get document(){return this.main.document}renderers;initialized=!1;constructor(t){this.config=t}async init(){if(this.initialized)return;const{renderer:t,background:e,...n}=this.config,{renderers:r,canvas:i}=["main","label","transient","background"].reduce(((e,r)=>{const i=kt(t)?t?.(r):new cB;"main"===r?i.registerPlugin(new lB({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):i.unregisterPlugin(i.getPlugin("dom-interaction"));const o=new tc({renderer:i,supportsMutipleCanvasesInOneContainer:!0,...n});return e.renderers[r]=i,e.canvas[r]=o,this[r]=o,e}),{renderers:{},canvas:{}});this.renderers=r,Object.entries(i).forEach((([t,e])=>{const n=e.getContextService().getDomElement();n.style.position="absolute",n.style.outline="none",n.tabIndex=1,"main"!==t&&(n.style.pointerEvents="none")})),this.setBackground(),await Promise.all(Object.values(this.canvas).map((t=>t.ready))),this.initialized=!0}getRendererType(t="main"){const e=this.renderers[t].getPlugins();for(const t of e){if("canvas-renderer"===t.name)return"canvas";if("svg-renderer"===t.name)return"svg";if("device-renderer"===t.name)return"gpu"}return"unknown"}get context(){return this.main.context}getDevice(){return this.main.context?.deviceRendererPlugin?.getDevice()}getConfig(){return this.config}setBackground(t=this.config.background){const e=this.getContainer();e&&t&&(e.style.background=t,e.style.transition="background 0.5s")}setCursor(t){Object.values(this.canvas).forEach((e=>{e.setCursor(t)}))}getSize(){return[this.config.width||0,this.config.height||0]}resize(t,e){this.config.width=t,this.config.height=e,Object.values(this.canvas).forEach((n=>{n.resize(t,e)}))}getCamera(){return this.main.getCamera()}getBounds(){return ku(Object.values(this.canvas).map((t=>t.document.documentElement)).filter((t=>t.childNodes.length>0)).map((t=>t.getRenderBounds())))}getContainer(){const t=this.config.container;return Bt(t)?document.getElementById(t):t}appendChild(t){return this[t.style?.$layer||"main"].appendChild(t)}getContextService(){return this.main.getContextService()}viewport2Client(t){return this.main.viewport2Client(t)}viewport2Canvas(t){return this.main.viewport2Canvas(t)}client2Viewport(t){return this.main.client2Viewport(t)}canvas2Viewport(t){return this.main.canvas2Viewport(t)}async toDataURL(t={}){const e=window.devicePixelRatio||1,{mode:n="viewport",...r}=t;let i=0,o=0,a=0,s=0;if("viewport"===n)[a,s]=[this.config.width||0,this.config.height||0];else if("overall"===n){const t=this.getBounds(),e=Su(t);[i,o]=t.min,[a,s]=e}const c=Ze('<div id="virtual-image"></div>'),u=new tc({width:a,height:s,renderer:new cB,devicePixelRatio:e,container:c,background:this.background.getConfig().background});await u.ready,u.appendChild(this.background.getRoot().cloneNode(!0)),u.appendChild(this.main.getRoot().cloneNode(!0));const l=this.label.getRoot().cloneNode(!0),h=u.viewport2Canvas({x:0,y:0}),d=this.main.viewport2Canvas({x:0,y:0});l.translate([d.x-h.x,d.y-h.y]),l.scale(1/this.main.getCamera().getZoom()),u.appendChild(l),u.appendChild(this.transient.getRoot().cloneNode(!0));const f=this.main.getCamera(),p=u.getCamera();if("viewport"===n)p.setZoom(f.getZoom()),p.setPosition(f.getPosition()),p.setFocalPoint(f.getFocalPoint());else if("overall"===n){const[t,e,n]=p.getPosition(),[r,a,s]=p.getFocalPoint();p.setPosition([t+i,e+o,n]),p.setFocalPoint([r+i,a+o,s])}const g=u.getContextService();return new Promise((t=>{u.on(ws.AFTER_RENDER,(async()=>{const e=await g.toDataURL(r);t(e)}))}))}destroy(){this.config={},this.renderers={},Object.entries(this.canvas).forEach((([t,e])=>{const n=e.getCamera();n.landmarks?.length&&n.cancelLandmarkAnimation(),function(t){t.destroy();const e=t.getCamera();e.eventEmitter.removeAllListeners(),t.document.timeline.destroy();const{animationsWithPromises:n}=t.document.timeline;n.forEach((t=>{t.effect.target&&(t.effect.target=null),t.effect.computedTiming&&(t.effect.computedTiming=null)})),t.document.timeline.animationsWithPromises=[],t.document.timeline.rafCallbacks=[],t.document.timeline=null}(e),this[t]=void 0}))}}function dB(t,e){const{data:n,style:r,...i}=t,{data:o,style:a,...s}=e,c={...i,...s};return(n||o)&&Object.assign(c,{data:{...n,...o}}),(r||a)&&Object.assign(c,{style:{...r,...a}}),c}function fB(t){const{data:e,style:n,...r}=t,i=r;return e&&(i.data={...e}),n&&(i.style={...n}),i}function pB(t){const{id:e=Fu(t),style:n,data:r,...i}=t,o={...t,style:{...n},data:{...r}};return bu(t)?{id:e,data:o,...i}:{id:e,data:o}}function gB(t){return t.data}class mB{model;latestRemovedComboIds=new Set;comboIds=new Set;changes=[];batchCount=0;isTraceless=!1;constructor(){this.model=new Lp}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===uu.NodeUpdated||e===uu.EdgeUpdated||e===uu.ComboUpdated){const{value:n,original:r}=t;this.changes.push({value:fB(n),original:fB(r),type:e})}else this.changes.push({value:fB(t.value),type:e})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=gB(n);return this.isCombo(Fu(r))||(void 0===t||t.includes(Fu(r)))&&e.push(r),e}),[])}getEdgeData(t){return this.model.getAllEdges().reduce(((e,n)=>{const r=gB(n);return(void 0===t||t.includes(Fu(r)))&&e.push(r),e}),[])}getComboData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=gB(n);return this.isCombo(Fu(r))?((void 0===t||t.includes(Fu(r)))&&e.push(r),e):e}),[])}getAncestorsData(t,e){const{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getAncestors(t,e).map(gB):[]}getDescendantsData(t){const e=this.getElementsData([t])[0],n=[];return ed(e,(t=>{t!==e&&n.push(t)}),(t=>this.getChildrenData(Fu(t))),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e)return void console.error("The hierarchy structure key is not specified");if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const r=n.getParent(t,e);return r?gB(r):void 0}getChildrenData(t){const e="node"===this.getElementType(t)?vu:mu,{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getChildren(t,e).map(gB):[]}getElementData(t){return"node"===t?this.getNodeData():"edge"===t?this.getEdgeData():"combo"===t?this.getComboData():[]}getElementsData(t){return t.map((t=>{const e=this.getElementType(t);return"node"===e?this.getNodeData([t])[0]:"edge"===e?this.getEdgeData([t])[0]:this.getComboData([t])[0]}))}getNodeLikeData(t){return this.model.getAllNodes().reduce(((e,n)=>{const r=gB(n);return t?t.includes(Fu(r))&&e.push(r):e.push(r),e}),[])}getElementDataByState(t,e){return this.getElementData(t).filter((t=>t.style?.states?.includes(e)))}getElementState(t){return this.getElementsData([t])?.[0]?.style?.states||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(gB)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(gB)}setData(t){const{nodes:e=[],edges:n=[],combos:r=[]}=t,{nodes:i=[],edges:o=[],combos:a=[]}=this.getData(),s=Uh(i,e,(t=>Fu(t))),c=Uh(o,n,(t=>Fu(t))),u=Uh(a,r,(t=>Fu(t)));this.batch((()=>{this.addData({nodes:s.enter,edges:c.enter,combos:u.enter}),this.updateData({nodes:s.update,edges:c.update,combos:u.update}),this.removeData({nodes:s.exit.map(Fu),edges:c.exit.map(Fu),combos:u.exit.map(Fu)})}))}addData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.addComboData(r),this.addNodeData(e),this.addEdgeData(n)}))}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map((t=>(this.pushChange({value:t,type:uu.NodeAdded}),pB(t))))),this.updateNodeLikeHierarchy(t))}addEdgeData(t=[]){t.length&&this.model.addEdges(t.map((t=>(this.pushChange({value:t,type:uu.EdgeAdded}),pB(t)))))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(mu)||e.attachTreeStructure(mu),e.addNodes(t.map((t=>(this.comboIds.add(Fu(t)),this.pushChange({value:t,type:uu.ComboAdded}),pB(t))))),this.updateNodeLikeHierarchy(t)}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach((t=>{const n=Fu(t);e.attachTreeStructure(mu),this.setParent(n,Gu(t),mu);const r=t?.style?.children;void 0!==r&&(e.attachTreeStructure(vu),r.forEach((t=>{this.setParent(t,n,vu)})))}))}enableUpdateNodeLikeHierarchy=!0;preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.updateNodeData(e),this.updateComboData(r),this.updateEdgeData(n)}))}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{const n=[];t.forEach((t=>{const r=Fu(t),i=gB(e.getNode(r));if(ae(i,t))return;const o=dB(i,t);this.pushChange({value:o,original:i,type:uu.NodeUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)}))}syncNodeDatum(t){const{model:e}=this,n=Fu(t),r=dB(gB(e.getNode(n)),t);e.mergeNodeData(n,r)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch((()=>{t.forEach((t=>{const n=Fu(t),r=gB(e.getEdge(n));if(ae(r,t))return;t.source&&r.source!==t.source&&e.updateEdgeSource(n,t.source),t.target&&r.target!==t.target&&e.updateEdgeTarget(n,t.target);const i=dB(r,t);this.pushChange({value:i,original:r,type:uu.EdgeUpdated}),e.mergeEdgeData(n,i)}))}))}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch((()=>{const n=[];t.forEach((t=>{const r=Fu(t),i=gB(e.getNode(r));if(ae(i,t))return;const o=dB(i,t);this.pushChange({value:o,original:i,type:uu.ComboUpdated}),e.mergeNodeData(r,o),n.push(o)})),this.updateNodeLikeHierarchy(n)}))}setParent(t,e,n,r=!0){if(t===e)return;const i=Gu(this.getNodeLikeData([t])[0]);if(i!==e){const n={id:t,style:{parentId:e}};this.isCombo(t)?this.syncComboDatum(n):this.syncNodeDatum(n)}this.model.setParent(t,e,n),r&&new Set([i,e]).forEach((t=>{void 0!==t&&this.refreshComboData(t)}))}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,mu);e&&this.pushChange({value:e,original:e,type:uu.ComboUpdated}),n.forEach((t=>{this.pushChange({value:t,original:t,type:uu.ComboUpdated})}))}syncComboDatum(t){const{model:e}=this,n=Fu(t),r=dB(gB(e.getNode(n)),t);e.mergeNodeData(n,r)}getElementPosition(t){return _u(this.getElementsData([t])[0])}translateNodeBy(t,e){const n=Yu(this.getElementPosition(t),[...e,0].slice(0,3));this.translateNodeTo(t,n)}translateNodeTo(t,e){const[n=0,r=0,i=0]=e;this.preventUpdateNodeLikeHierarchy((()=>{this.updateNodeData([{id:t,style:{x:n,y:r,z:i}}])}))}translateComboBy(t,e){const[n=0,r=0,i=0]=e;if([n,r,i].some(isNaN)||[n,r,i].every((t=>0===t)))return;const o=this.getComboData([t])[0];o&&ed(o,(t=>{const e=Fu(t),[o,a,s]=_u(t),c=dB(t,{style:{x:o+n,y:a+r,z:s+i}});this.pushChange({value:c,original:t,type:this.isCombo(e)?uu.ComboUpdated:uu.NodeUpdated}),this.model.mergeNodeData(e,c)}),(t=>this.getChildrenData(Fu(t))),"BT")}translateComboTo(t,e){if(e.some(isNaN))return;const[n=0,r=0,i=0]=e,o=this.getComboData([t])?.[0];if(!o)return;const[a,s,c]=_u(o),u=n-a,l=r-s,h=i-c;ed(o,(t=>{const e=Fu(t),[n,r,i]=_u(t),o=dB(t,{style:{x:n+u,y:r+l,z:i+h}});this.pushChange({value:o,original:t,type:this.isCombo(e)?uu.ComboUpdated:uu.NodeUpdated}),this.model.mergeNodeData(e,o)}),(t=>this.getChildrenData(Fu(t))),"BT")}removeData(t){const{nodes:e,edges:n,combos:r}=t;this.batch((()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(r),this.latestRemovedComboIds=new Set(r)}))}removeNodeData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(Fu)),this.pushChange({value:this.getNodeData([t])[0],type:uu.NodeRemoved}),this.removeNodeLikeHierarchy(t)})),this.model.removeNodes(t)}))}removeEdgeData(t=[]){t.length&&(t.forEach((t=>this.pushChange({value:this.getEdgeData([t])[0],type:uu.EdgeRemoved}))),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch((()=>{t.forEach((t=>{this.pushChange({value:this.getComboData([t])[0],type:uu.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)})),this.model.removeNodes(t)}))}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(mu)){const e=Gu(this.getNodeLikeData([t])[0]);this.setParent(t,void 0,mu,!1),this.model.getChildren(t,mu).forEach((t=>{const n=gB(t),r=Fu(n);this.setParent(Fu(n),e,mu,!1);const i=dB(n,{id:Fu(n),style:{parentId:e}});this.pushChange({value:i,original:n,type:this.isCombo(r)?uu.ComboUpdated:uu.NodeUpdated}),this.model.mergeNodeData(Fu(n),i)})),Qt(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error(`Unknown element type of id: ${t}`)}getFrontZIndex(t){let e=[];if("combo"===this.getElementType(t)){const n=[t,...this.getAncestorsData(t,mu).map(Fu)];e=this.getComboData().filter((t=>{const e=Fu(t),r=this.getAncestorsData(e,mu),i=r.map(Fu);return!r.some((t=>!!t.style?.collapsed))&&!n.includes(e)&&!i.includes(e)}))}else e=this.getNodeData().filter((e=>Fu(e)!==t));return Math.max(0,...e.map(dz))+1}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map((t=>t.id))),t.removeNodes(e.map((t=>t.id))),this.context={}}}class vB{context;container;elementMap={};shapeTypeMap={};constructor(t){this.context=t}init(){if(!this.container){const{canvas:t}=this.context;this.container={node:t.appendChild(new Rs({style:{zIndex:2}})),edge:t.appendChild(new Rs({style:{zIndex:1}})),combo:t.appendChild(new Rs({style:{zIndex:0}}))}}}emit(t){lz(this.context.graph,t)}forEachElementData(t){Ll.forEach((e=>{const n=this.context.model.getElementData(e);t(e,n)}))}getTheme(t){const{theme:e}=this.context.options;if(!e)return{};const n=iz("theme",e);return n?.[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map((t=>n[t]||{})))}paletteStyle={};computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData(((e,n)=>{const r=Object.assign({},al(this.getTheme(e)?.palette),al(t[e]?.palette));!oe(r)&&r?.field&&Object.assign(this.paletteStyle,function(t,e){if(!e)return{};const{type:n,color:r,field:i,invert:o}=e,a=t=>{const e=Bt(r)?iz("palette",r):r;if(kt(e))return Object.fromEntries(t.map((([t,n])=>[t,e(o?1-n:n)])));if(Array.isArray(e)){const n=o?[...e].reverse():e;return Object.fromEntries(t.map((([t,r])=>[t,n[r%e.length]])))}return{}},s=(t,e)=>Bt(t)?e.data?.[t]:t?.(e);if("group"===n){const e=Gt(t,(t=>{if(!i)return"default";const e=s(i,t);return e?String(e):"default"})),n=a(Object.keys(e).map(((t,e)=>[t,e]))),r={};return Object.entries(e).forEach((([t,e])=>{e.forEach((e=>{r[Fu(e)]=n[t]}))})),r}if("value"===n){const[e,n]=t.reduce((([t,e],n)=>{const r=s(i,n);if(!Wt(r))throw new Error(`Palette field ${i} is not a number`);return[Math.min(t,r),Math.max(e,r)]}),[1/0,-1/0]),r=n-e;return a(t.map((t=>[t.id,(s(i,t)-e)/r])))}}(n,r))}))}getPaletteStyle(t){const e=this.paletteStyle[t];return e?{color:e}:{}}defaultStyle={};computedElementDefaultStyle(t,e){const{options:n}=this.context,r=n[t]?.style||{};this.defaultStyle[Fu(e.datum)]=hz(r,e)}computeElementsDefaultStyle(t){this.forEachElementData(((e,n)=>{n.filter((e=>void 0===t||t.includes(Fu(e)))).forEach(((t,r)=>{this.computedElementDefaultStyle(e,{datum:t,index:r,elementData:n})}))}))}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch{return[]}}stateStyle={};getElementStateStyle(t,e,n){const{options:r}=this.context;return hz(r[t]?.state?.[e]||{},n)}computeElementStatesStyle(t,e,n){this.stateStyle[Fu(n.datum)]=Object.assign({},...e.map((e=>this.getElementStateStyle(t,e,n))))}computeElementsStatesStyle(t){this.forEachElementData(((e,n)=>{n.filter((e=>void 0===t||t.includes(Fu(e)))).forEach(((t,r)=>{const i=this.getElementState(Fu(t));this.computeElementStatesStyle(e,i,{datum:t,index:r,elementData:n})}))}))}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t){this.computePaletteStyle(),this.computeElementsDefaultStyle(t),this.computeElementsStatesStyle(t)}getElement(t){return this.elementMap[t]}getNodes(){return this.container.node.children}getEdges(){return this.container.edge.children}getCombos(){return this.container.combo.children}getAnimation(t,e){const{options:n}=this.context,r=n?.[t]?.animation;if(!1===r)return!1;const i=r?.[e];if(i)return i;const o=this.getTheme(t)?.animation;if(!1===o)return!1;const a=o?.[e];return a??!1}getAnimationExecutor(t,e,n=!0,r){const{options:i}=this.context;return!1!==i.animation&&n?(n,i,o,a)=>Wh(i,this.getAnimation(t,e),{},{originalStyle:o,modifiedStyle:a,states:this.getElementState(n),...r}):()=>null}getEdgeEndsContext(t){const{source:e,target:n}=t;return{sourceNode:this.getElement(e),targetNode:this.getElement(n)}}getElementComputedStyle(t,e){const n=Fu(e),r=this.getThemeStyle(t),i=this.getPaletteStyle(n),o=e.style||{},a=this.getDefaultStyle(n),s=this.getThemeStateStyle(t,this.getElementState(n)),c=this.getStateStyle(n),u=Object.assign({},r,i,o,a,s,c);if("edge"===t)Object.assign(u,this.getEdgeEndsContext(e));else if("combo"===t){const t=this.context.model.getChildrenData(n),e=!!u.collapsed?[]:t.map((t=>this.getElement(Fu(t)))).filter(Boolean);Object.assign(u,{childrenNode:e,childrenData:t})}return u.type||(u.type={node:"circle",edge:"line",combo:"circle"}[t]),u}async draw(e={animation:!0}){this.init();const n=this.computeChangesAndDrawData();if(!n)return;const{dataChanges:r,drawData:i}=n;this.computeStyle();const{add:o,update:a,remove:s}=i,c=this.getDestroyTasks(s,e),u=this.getCreateTasks(o,e),l=this.getUpdateTasks(a,e);await(function(t,e={}){if(0===t.length)return null;const{before:n,...r}=e;e.before?.();const i=zh(t.map((t=>t())).map((t=>t())).flat().filter(Boolean));return Gh(i,r),i}([...c,...u,...l],e.silence?{}:{before:()=>this.emit(new az(t.GraphEvent.BEFORE_DRAW,{dataChanges:r,animation:e.animation})),beforeAnimate:e=>this.emit(new sz(t.GraphEvent.BEFORE_ANIMATE,lu.DRAW,e,i)),afterAnimate:e=>this.emit(new sz(t.GraphEvent.AFTER_ANIMATE,lu.DRAW,e,i)),after:()=>this.emit(new az(t.GraphEvent.AFTER_DRAW,{dataChanges:r,animation:e.animation}))})?.finished)}computeChangesAndDrawData(){const{model:t}=this.context,e=t.getChanges(),n=ZI(e);if(0===n.length)return null;const{NodeAdded:r=[],NodeUpdated:i=[],NodeRemoved:o=[],EdgeAdded:a=[],EdgeUpdated:s=[],EdgeRemoved:c=[],ComboAdded:u=[],ComboUpdated:l=[],ComboRemoved:h=[]}=Gt(n,(t=>t.type)),d=t=>new Map(t.map((t=>{const e=t.value;return[Fu(e),e]}))),f={add:{nodes:d(r),edges:d(a),combos:d(u)},update:{nodes:d(i),edges:d(s),combos:d(l)},remove:{nodes:d(o),edges:d(c),combos:d(h)}},p=this.transformData(f);return t.clearChanges(),{dataChanges:e,drawData:p}}transformData(t){const e=this.context.transform.getTransformInstance();return Object.values(e).reduce(((t,e)=>e.beforeDraw(t)),t)}createElement(e,n,r){const{animator:i}=r,o=Fu(n);if(this.getElement(o))return()=>null;const{type:a,...s}=this.getElementComputedStyle(e,n),c=iz(e,a);if(!c)return()=>null;this.emit(new cz(t.GraphEvent.BEFORE_ELEMENT_CREATE,e,n));const u=this.container[e].appendChild(new c({id:o,style:{context:this.context,...s}}));return this.shapeTypeMap[o]=a,this.elementMap[o]=u,()=>Gh(i?.(o,u,{...u.attributes,opacity:0})||null,{after:()=>{this.emit(new cz(t.GraphEvent.AFTER_ELEMENT_CREATE,e,n)),u.onCreate()}})}getCreateTasks(t,e){const{nodes:n,edges:r,combos:i}=t,o=[];return[["node",n],["combo",i],["edge",r]].forEach((([t,n])=>{if(0===n.size)return;const r=this.getAnimationExecutor(t,"enter",e.animation);n.forEach((n=>o.push((()=>this.createElement(t,n,{...e,animator:r})))))})),o}latestElementVisibilityMap=new WeakMap;updateElement(e,n,r){const{animator:i}=r,o=Fu(n),a=this.getElement(o);if(!a)return()=>null;this.emit(new cz(t.GraphEvent.BEFORE_ELEMENT_UPDATE,e,n));const s=()=>{this.emit(new cz(t.GraphEvent.AFTER_ELEMENT_UPDATE,e,n)),a.onUpdate()},{type:c,...u}=this.getElementComputedStyle(e,n);if(this.shapeTypeMap[o]!==c)return()=>(this.destroyElement(e,n,{...r,animation:!1})(),this.createElement(e,n,{...r,animation:!1})(),s(),null);if("visibility"===r.stage&&"visibility"in u){Tl(a,"opacity")||Sl(a,"opacity");const t=Cl(a,"opacity")??Fh("opacity");if(this.latestElementVisibilityMap.set(a,u.visibility),"hidden"!==u.visibility)return jh(a,{visibility:"visible"}),()=>Gh(i?.(o,a,{...a.attributes,opacity:0},{opacity:t})||null,{after:s});if("hidden"===u.visibility)return()=>Gh(i?.(o,a,{...a.attributes,opacity:t},{opacity:0})||null,{after:()=>{jh(a,{visibility:this.latestElementVisibilityMap.get(a)}),s()}})}const l={...a.attributes};return jh(a,u),()=>Gh(i?.(o,a,l)||null,{after:s})}getUpdateTasks(t,e){const{nodes:n,edges:r,combos:i}=t,o=[["node",n],["combo",i],["edge",r]],{animation:a,stage:s}=e,c=[];return o.forEach((([t,n])=>{if(0===n.size)return[];const r=this.getAnimationExecutor(t,s||"update",a);n.forEach((n=>c.push((()=>this.updateElement(t,n,{...e,animator:r})))))})),c}destroyElement(e,n,r){const{animator:i}=r,o=Fu(n),a=this.elementMap[o];return a?(this.emit(new cz(t.GraphEvent.BEFORE_ELEMENT_DESTROY,e,n)),()=>{const r=i?.(o,a,{...a.attributes},{opacity:0})||null;return Gh(r,{after:()=>{this.clearElement(o),a.destroy(),a.onDestroy(),this.emit(new cz(t.GraphEvent.AFTER_ELEMENT_DESTROY,e,n))}}),r}):()=>null}getDestroyTasks(t,e){const{nodes:n,edges:r,combos:i}=t,o=[["combo",i],["edge",r],["node",n]],{animation:a,stage:s}=e,c=[];return o.forEach((([t,n])=>{if(0===n.size)return[];const r=this.getAnimationExecutor(t,s||"exit",a);n.forEach((n=>c.push((()=>this.destroyElement(t,n,{...e,animator:r})))))})),c}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}destroy(){Object.values(this.elementMap).forEach((t=>t.destroy())),Object.values(this.container).forEach((t=>t.destroy())),this.container={},this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={},this.context={},this.latestElementVisibilityMap=void 0}}class yB{context;supervisor;instance;instances=[];animationResult;get presetOptions(){return{animation:!!Vh(this.context.options,!0)}}get options(){const{options:t}=this.context;return t.layout}constructor(t){this.context=t}getLayoutInstance(t){return void 0===t?this.instances:this.instance}async layout(){if(!this.options)return;const e=Array.isArray(this.options)?this.options:[this.options],{graph:n}=this.context;lz(n,new az(t.GraphEvent.BEFORE_LAYOUT));for(const t of e){const n=e.indexOf(t),r=this.getLayoutDataModel(t),i=await this.stepLayout(r,{...this.presetOptions,...t},n);t.animation||this.updateElementPosition(i,!1)}lz(n,new az(t.GraphEvent.AFTER_LAYOUT))}async stepLayout(t,e,n){return function(t){const{type:e}=t;return["compact-box","mindmap","dendrogram","indented"].includes(e)}(e)?await this.treeLayout(t,e,n):await this.graphLayout(t,e,n)}async graphLayout(t,e,n){const{animation:r,enableWorker:i,iterations:o=300}=e,a=this.initGraphLayout(t,e);if(this.instances[n]=a,this.instance=a,i)return this.supervisor=new VI(t,a,{iterations:o}),await this.supervisor.execute();if(EI(a))return r?await a.execute(t,{onTick:t=>{this.updateElementPosition(t,!1)}}):(a.execute(t),a.stop(),a.tick(o));const s=await a.execute(t);return r&&this.updateElementPosition(s,r),s}async treeLayout(t,e,n){const{type:r,animation:i}=e,o=iz("layout",r);if(!o)throw new Error(`The layout type ${r} is not found`);!function(t){if(t.hasTreeStructure(vu))return;t.attachTreeStructure(vu);const e=t.getAllEdges();for(const n of e){const{source:e,target:r}=n;t.setParent(r,e,vu)}}(t);const a={nodes:[],edges:[]};return t.getRoots(vu).forEach((n=>{ed(n,(e=>{e.children=t.getSuccessors(e.id)}),(e=>t.getSuccessors(e.id)),"TB");ed(o(n,e),(t=>{const{id:e,x:n,y:r}=t;a.nodes.push({id:e,data:{x:n,y:r}})}),(t=>t.children),"TB")})),i&&this.updateElementPosition(a,i),a}stopLayout(){this.instance&&EI(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutDataModel(t){const{model:e,element:n}=this.context;if(!n)return new Lp;const{nodesFilter:r=(()=>!0)}=t,i=Object.fromEntries(n.getNodes().map((t=>[t.id,t]))),o=Object.fromEntries(n.getCombos().map((t=>[t.id,t]))),a=Object.fromEntries(n.getEdges().map((t=>[t.id,t]))),s=e.model.getAllNodes().filter((t=>r(t.data))),c=e.model.getAllEdges(),u=(function(t){const{type:e}=t;return!!["comboCombined","comboForce"].includes(e)||!("antv-dagre"!==e||!t.sortByCombo)}(t)?s:s.filter((t=>!o[t.id]&&function(t){return"hidden"!==se(t,["style","visibility"])}(i[t.id])))).map((t=>{const{id:e}=t,n={id:e};return!!o[e]?Object.assign(n,{data:{...bB(o[e].attributes),_isCombo:!0}}):Object.assign(n,{data:bB(i[e]?.attributes||{})}),n})),l=new Map(u.map((t=>[t.id,t]))),h=c.filter((t=>{const e=l.get(t.source),n=l.get(t.target);return e&&n})).map((t=>{const{id:e,source:n,target:r}=t;return{id:e,source:n,target:r,data:bB(a[e].attributes)}})),d=new Lp({nodes:u,edges:h});return e.model.hasTreeStructure(mu)&&(d.attachTreeStructure(mu),u.forEach((t=>{const n=e.model.getParent(t.id,mu);n&&d.hasNode(n.id)&&d.setParent(t.id,n.id,mu)}))),d}initGraphLayout(t,e){const{element:n,viewport:r}=this.context,{type:i,enableWorker:o,animation:a,iterations:s,...c}=e,[u,l]=r.getCanvasSize(),h=[u/2,l/2],d=e?.nodeSize??(t=>{const e=n?.getElement(t.id),{size:r}=e?.attributes||{};return Math.max(...Lu(r))}),f=iz("layout",i);if(!f)throw new Error(`The layout type ${i} is not found`);const p=new f,g={nodeSize:d,width:u,height:l,center:h};switch(p.id){case"d3-force":case"d3-force-3d":Object.assign(g,{center:{x:u/2,y:l/2,z:0}})}return re(p.options,g,c),p}updateElementPosition(t,e){const{model:n,element:r}=this.context;if(!r)return null;const{nodes:i,edges:o}=t,a={nodes:[],edges:[],combos:[]};return i.forEach((({id:t,data:{x:e,y:n,z:r=0}})=>{a.nodes.push({id:t,style:{x:e,y:n,z:r}})})),o.forEach((({id:t,data:{points:e=[],controlPoints:n=e.slice(1,e.length-1)}})=>{n?.length&&a.edges.push({id:t,style:{controlPoints:n.map(ul)}})})),n.updateData(a),r.draw({animation:e,silence:!0})}destroy(){this.stopLayout(),this.context={},this.supervisor?.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const bB=t=>Object.entries(t).reduce(((t,[e,n])=>(["function","object"].includes(typeof n)||["x","y","z"].includes(e)||(t[e]=n),t)),{});class xB extends Hh{category="plugin";constructor(t){super(t),this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){return this.extensionMap[t]}}const EB=["update-related-edges","arrange-draw-order","collapse-expand-combo"];class wB extends Hh{category="transform";constructor(t){super(t),this.setTransforms(this.context.options.transforms||[])}setTransforms(t){this.setExtensions([...t,...EB])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}class MB{context;get padding(){return wu(this.context.options.padding)}get paddingOffset(){const[t,e,n,r]=this.padding,[i,o,a]=[(r-e)/2,(t-n)/2,0];return[i,o,a]}constructor(t){this.context=t;const[e,n]=this.paddingOffset,{zoom:r,rotation:i,x:o=e,y:a=n}=t.options;this.transform({mode:"absolute",scale:r,translate:[o,a],rotate:i},!1)}get camera(){return this.context.canvas.getCamera()}landmarkCounter=0;createLandmark(t){return this.camera.createLandmark("landmark-"+this.landmarkCounter++,t)}getAnimation(t){const e=Vh(this.context.options,t);return!!e&&le({...e},["easing","duration"])}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateArgs(t){const e=this.getZoom(),{camera:n}=this,{mode:r,translate:i=[]}=t,[o=0,a=0]=i,[s=0,c=0]=this.getCanvasCenter(),[u,l]=n.getPosition(),h=Zu([-o,-a],e);return"relative"===r?h:Yu([s-u,c-l],h)}getAnimationTranslateArgs(t){const{camera:e}=this,{mode:n,translate:r=[]}=t,i=this.getZoom(),o=e.getPosition(),a=e.getFocalPoint(),s=this.getCanvasCenter(),[c=0,u=0,l=0]=r,h=Zu([-c,-u,-l],i);return"relative"===n?{position:Yu(o,h),focalPoint:Yu(a,h)}:{position:Yu(s,h),focalPoint:Yu(a,h)}}getRotateArgs(t){const{mode:e,rotate:n=0}=t;return"relative"===e?n:n-this.camera.getRoll()}getAnimationRotateArgs(t){const{mode:e,rotate:n=0}=t;return{roll:"relative"===e?this.camera.getRoll()+n:n}}getZoomArgs(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:r,scale:i=1}=t;return Vt("relative"===r?n*i:i,...e)}async transform(e,n){const{camera:r}=this,{graph:i}=this.context,{translate:o,rotate:a,scale:s,origin:c=this.getGraphCenter()}=e;this.cancelAnimation(),lz(i,new uz(t.GraphEvent.BEFORE_TRANSFORM,e));const u=this.getAnimation(n);if(u){const n={};return o&&Object.assign(n,this.getAnimationTranslateArgs(e)),Wt(a)&&Object.assign(n,this.getAnimationRotateArgs(e)),Wt(s)&&Object.assign(n,{zoom:this.getZoomArgs(e)}),lz(i,new sz(t.GraphEvent.BEFORE_ANIMATE,lu.TRANSFORM,null,e)),new Promise((r=>{this.camera.gotoLandmark(this.createLandmark(n),{...u,onfinish:()=>{lz(i,new sz(t.GraphEvent.AFTER_ANIMATE,lu.TRANSFORM,null,e)),lz(i,new uz(t.GraphEvent.AFTER_TRANSFORM,e)),r()}})}))}if(o&&r.pan(...this.getTranslateArgs(e)),Wt(a)){const[t,n]=r.getFocalPoint();c&&r.pan(c[0]-t,c[1]-n);const i=this.getRotateArgs(e);r.rotate(0,0,i),c&&r.pan(t-c[0],n-c[1])}if(Wt(s)){const t=this.getZoomArgs(e);r.setZoomByViewportPoint(t,c)}lz(i,new uz(t.GraphEvent.AFTER_TRANSFORM,e))}async fitView(t,e){const[n,r,i,o]=this.padding,{when:a="always",direction:s="both"}=t||{},[c,u]=this.context.canvas.getSize(),l=c-o-r,h=u-n-i,d=this.context.canvas.getBounds(),f=this.getBBoxInViewport(d),[p,g]=Su(f);if("overflow"===a&&!("x"===s&&p>=l||"y"===s&&g>=h||"both"===s&&p>=l&&g>=h))return await this.fitCenter(e);const m=l/p,v=h/g,y="x"===s?m:"y"===s?v:Math.min(m,v),b=this.getAnimation(e);await this.transform({mode:"relative",scale:y,translate:Yu(Ku(this.getCanvasCenter(),this.getBBoxInViewport(d).center),b?Zu(this.paddingOffset,y):this.paddingOffset)},b)}async fitCenter(t){const e=this.context.canvas.getBounds();await this.focus(e,t)}async focusElements(t,e){const{element:n}=this.context;if(!n)return;const r=ku(t.map((t=>n.getElement(t).getRenderBounds())));await this.focus(r,e)}async focus(t,e){const{center:n}=this.getBBoxInViewport(t),r=Ku(this.getCanvasCenter(),n);await this.transform({mode:"relative",translate:Yu(r,this.paddingOffset)},e)}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:r}=this.context,[i,o]=r.getViewportByCanvas(e),[a,s]=r.getViewportByCanvas(n),c=new vr;return c.setMinMax([i,o,0],[a,s,0]),c}cancelAnimation(){this.camera.landmarks?.length&&this.camera.cancelLandmarkAnimation()}}class NB extends Op{options;static defaultOptions={autoResize:!1,width:800,height:600,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};destroyed=!1;context={model:new mB};constructor(t){super(),this.options=Object.assign({},NB.defaultOptions,t),this.setOptions(this.options),this.context.graph=this,this.options.autoResize&&window.addEventListener("resize",this.onResize)}getOptions(){return this.options}setOptions(t){const{animation:e,background:n,behaviors:r,combo:i,container:o,data:a,edge:s,height:c,layout:u,node:l,padding:h,plugins:d,theme:f,transforms:p,width:g,zoom:m,zoomRange:v}=t;n&&this.setBackground(n),r&&this.setBehaviors(r),i&&this.setCombo(i),a&&this.setData(a),s&&this.setEdge(s),u&&this.setLayout(u),l&&this.setNode(l),f&&this.setTheme(f),d&&this.setPlugins(d),p&&this.setTransforms(p),(Wt(g)||Wt(c))&&this.setSize(g??this.options.width??0,c??this.options.height??0),v&&(this.options.zoomRange=v),Wt(m)&&(this.options.zoom=m),Wt(h)&&(this.options.padding=h)}setBackground(t){this.options.background=t,this.context.canvas?.setBackground(t)}getBackground(){return this.options.background}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){this.options.width=t,this.options.height=e}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t}setEdge(t){this.options.edge=t}setCombo(t){this.options.combo=t}getTheme(){return this.options.theme}setTheme(t){this.options.theme=kt(t)?t(this.getTheme()):t;const{background:e}=iz("theme",this.options.theme)||{};e&&!this.options.background&&this.setBackground(e)}setLayout(t){this.options.layout=kt(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){this.options.behaviors=kt(t)?t(this.getBehaviors()):t,this.context.behavior?.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors((e=>e.map((e=>Rt(e)&&e.key===t.key?{...e,...t}:e))))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){this.options.plugins=kt(t)?t(this.getPlugins()):t,this.context.plugin?.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins((e=>e.map((e=>Rt(e)&&e.key===t.key?{...e,...t}:e))))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){this.options.transforms=kt(t)?t(this.getTransforms()):t,this.context.transform?.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms((e=>e.map((e=>Rt(e)&&e.key===t.key?{...e,...t}:e))))}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getNodeData(t){return void 0===t?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):this.context.model.getNodeData([t])?.[0]}getEdgeData(t){return void 0===t?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):this.context.model.getEdgeData([t])?.[0]}getComboData(t){return void 0===t?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):this.context.model.getComboData([t])?.[0]}setData(t){this.context.model.setData(kt(t)?t(this.getData()):t)}addData(t){this.context.model.addData(kt(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(kt(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(kt(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(kt(t)?t(this.getComboData()):t)}updateData(t){this.context.model.updateData(kt(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(kt(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(kt(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(kt(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(kt(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(kt(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(kt(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(kt(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}async initCanvas(){if(this.context.canvas)return await this.context.canvas.init();const{container:e="container",width:n,height:r,renderer:i,background:o}=this.options;if(e instanceof hB)this.context.canvas=e,e.setBackground(o),await e.init();else{const o=Bt(e)?document.getElementById(e):e;this.emit(t.GraphEvent.BEFORE_CANVAS_INIT,{container:o,width:n,height:r});const a=new hB({container:o,width:n,height:r,renderer:i});this.context.canvas=a,await a.init(),this.emit(t.GraphEvent.AFTER_CANVAS_INIT,{canvas:a})}}createRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new fz(this.context)),this.context.plugin||(this.context.plugin=new xB(this.context)),this.context.viewport||(this.context.viewport=new MB(this.context)),this.context.transform||(this.context.transform=new wB(this.context)),this.context.element||(this.context.element=new vB(this.context)),this.context.layout||(this.context.layout=new yB(this.context)),this.context.behavior||(this.context.behavior=new pz(this.context))}async prepare(){if(this.destroyed)throw new Error("Graph has been destroyed");await this.initCanvas(),this.createRuntime()}async render(){lz(this,new az(t.GraphEvent.BEFORE_RENDER)),await this.prepare(),await Promise.all([this.context.element?.draw(),this.context.layout?.layout()]),await this.autoFit(),lz(this,new az(t.GraphEvent.AFTER_RENDER))}async draw(){return await this.prepare(),this.context.element.draw()}layout(){return this.context.layout.layout()}stopLayout(){return this.context.layout.stopLayout()}async clear(){this.context.model.setData({}),await this.draw()}destroy(){const{layout:t,element:e,model:n,canvas:r,behavior:i,plugin:o}=this.context;o?.destroy(),i?.destroy(),t?.destroy(),e?.destroy(),n.destroy(),r?.destroy(),this.options={},this.context={},this.off(),window.removeEventListener("resize",this.onResize),this.destroyed=!0}getCanvas(){return this.context.canvas}resize(e,n){const r=e&&n?[e,n]:HI(this.context.canvas.getContainer());ae(r,this.getSize())||(lz(this,new az(t.GraphEvent.BEFORE_SIZE_CHANGE,{size:r})),this.context.canvas.resize(...r),lz(this,new az(t.GraphEvent.AFTER_SIZE_CHANGE,{size:r})))}async fitView(t,e){await(this.context.viewport?.fitView(t,e))}async fitCenter(t){await(this.context.viewport?.fitCenter(t))}async autoFit(){const{autoFit:t}=this.context.options;if(t)if(Bt(t))"view"===t?await this.fitView():"center"===t&&await this.fitCenter();else{const{type:e,animation:n}=t;"view"===e?await this.fitView(t.options,n):"center"===e&&await this.fitCenter(n)}}async focusElement(t,e){await(this.context.viewport?.focusElements(Array.isArray(t)?t:[t],e))}async zoomBy(t,e,n){await this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)}async zoomTo(t,e,n){this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)}getZoom(){return this.context.viewport.getZoom()}async rotateBy(t,e,n){await this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)}async rotateTo(t,e,n){await this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)}getRotation(){return this.context.viewport.getRotation()}async translateBy(t,e){await this.context.viewport.transform({mode:"relative",translate:t},e)}async translateTo(t,e){await this.context.viewport.transform({mode:"absolute",translate:t},e)}getPosition(){return Ku([0,0],this.getCanvasByViewport([0,0]))}async translateElementBy(t,e,n=!0){const[r,i]=Rt(t)?[t,e??!0]:[{[t]:e},n];Object.entries(r).forEach((([t,e])=>this.context.model.translateNodeBy(t,e))),await this.context.element.draw({animation:i})}async translateElementTo(t,e,n=!0){const[r,i]=Rt(t)?[t,e??!0]:[{[t]:e},n];Object.entries(r).forEach((([t,e])=>this.context.model.translateNodeTo(t,e))),await this.context.element.draw({animation:i})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return he(this.context.element.getElement(t).attributes,["context"])}async setElementVisibility(t,e,n=!0){const[r,i]=Rt(t)?[t,e??!0]:[{[t]:e},n],o={nodes:[],edges:[],combos:[]};Object.entries(r).forEach((([t,e])=>{const n=this.getElementType(t);o[`${n}s`].push({id:t,style:{visibility:e}})})),this.updateData(o),await this.context.element.draw({animation:i,stage:"visibility"})}async showElement(t,e){const n=Array.isArray(t)?t:[t];await this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"visible"]))),e)}async hideElement(t,e){const n=Array.isArray(t)?t:[t];await this.setElementVisibility(Object.fromEntries(n.map((t=>[t,"hidden"]))),e)}getElementVisibility(t){const e=this.context.element.getElement(t);return e?.style?.visibility??"visible"}async setElementZIndex(t,e){const n={nodes:[],edges:[],combos:[]},r=Rt(t)?t:{[t]:e};Object.entries(r).forEach((([t,e])=>{const r=this.getElementType(t);n[`${r}s`].push({id:t,style:{zIndex:e}})}));const{model:i,element:o}=this.context;i.preventUpdateNodeLikeHierarchy((()=>i.updateData(n))),await o.draw({animation:!1})}async frontElement(t){const e=Array.isArray(t)?t:[t],{model:n}=this.context,r={};e.map((t=>{const e=n.getFrontZIndex(t);if("combo"===n.getElementType(t)){const i=n.getAncestorsData(t,mu).at(-1)||this.getComboData(t),o=[i,...n.getDescendantsData(Fu(i))].filter((t=>n.isCombo(Fu(t)))),a=e-dz(i);o.forEach((t=>{r[Fu(t)]=dz(t)+a}))}else r[t]=e})),await this.setElementZIndex(r)}getElementZIndex(t){return dz(this.context.model.getElementsData([t])[0])}async setElementState(t,e,n=!0){const[r,i]=Rt(t)?[t,e??!0]:[{[t]:e},n],o={nodes:[],edges:[],combos:[]};Object.entries(r).forEach((([t,e])=>{const n=this.getElementType(t);var r;o[`${n}s`].push({id:t,style:{states:(r=e,r?Array.isArray(r)?r:[r]:[])}})})),this.updateData(o),await this.context.element.draw({animation:i})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}async collapse(t,e=!0){this.setElementCollapsibility(t,!0),await this.context.element.draw({animation:e,stage:"collapse"})}async expand(t,e=!0){this.setElementCollapsibility(t,!1),await this.context.element.draw({animation:e,stage:"expand"})}setElementCollapsibility(t,e){const n=this.getElementType(t);"node"===n?this.updateNodeData([{id:t,style:{collapsed:e}}]):"combo"===n&&this.updateComboData([{id:t,style:{collapsed:e}}])}async toDataURL(t={}){return this.context.canvas.toDataURL(t)}getCanvasByViewport(t){return ul(this.context.canvas.viewport2Canvas(ll(t)))}getViewportByCanvas(t){return ul(this.context.canvas.canvas2Viewport(ll(t)))}getClientByCanvas(t){const e=this.context.canvas.canvas2Viewport(ll(t));return ul(this.context.canvas.viewport2Canvas(e))}getCanvasByClient(t){const e=this.context.canvas.client2Viewport(ll(t));return ul(this.context.canvas.viewport2Canvas(e))}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}onResize=te((()=>{this.resize()}),300);on(t,e){return super.on(t,e)}once(t,e){return super.once(t,e)}}const SB={idOf:Fu,treeToGraphData:function(t,e){const{getNodeData:n=(t=>{if(!t.children)return t;const{children:e,style:n={},...r}=t;return{style:{...n,children:e.map((t=>t.id))},...r}}),getEdgeData:r=((t,e)=>({source:t.id,target:e.id})),getChildren:i=(t=>t.children||[])}=e||{},o=[],a=[];return ed(t,(t=>{o.push(n(t));const e=i(t);for(const n of e)a.push(r(t,n))}),(t=>i(t)),"TB"),{nodes:o,edges:a}},subStyleProps:Uu,omitStyleProps:qu},CB={dark:$j,light:Yj};t.BaseBehavior=$h,t.BaseCombo=ql,t.BaseEdge=mh,t.BaseNode=Dl,t.BasePlugin=WI,t.BaseShape=Al,t.BaseTransform=Kj,t.CameraSetting=class extends WI{constructor(t,e){super(t,e),this.bindEvents()}update(t){this.setOptions(t),super.update(t)}bindEvents(){this.context.graph.once(t.GraphEvent.BEFORE_DRAW,(()=>this.setOptions(this.options)))}setOptions=t=>{const e=(t,e)=>{switch(t){case"projectionMode":return"perspective"===e?1:0;case"cameraType":return{orbiting:0,exploring:1,tracking:2}[e];case"aspect":return"number"==typeof e?e:this.getCanvasAspect();default:return e}};Object.entries({cameraType:"setType",near:"setNear",far:"setFar",fov:"setFov",aspect:"setAspect",projectionMode:"setProjectionMode",distance:"setDistance",minDistance:"setMinDistance",maxDistance:"setMaxDistance",roll:"setRoll",elevation:"setElevation",azimuth:"setAzimuth"}).forEach((([n,r])=>{const i=t[n];if(void 0!==i){const t=e(n,i);this.context.canvas.getCamera()[r](t)}}))};getCanvasAspect(){const[t,e]=this.context.viewport.getCanvasSize();return t/e}},t.Circle=jl,t.CircleCombo=$l,t.ComboEvent=t.NodeEvent,t.Cubic=vh,t.CubicHorizontal=yh,t.CubicVertical=bh,t.Diamond=Bl,t.DragCanvas=cd,t.Ellipse=Fl,t.Graph=NB,t.Hexagon=Gl,t.History=eL,t.Image=Vl,t.Line=xh,t.Polyline=Eh,t.Quadratic=wh,t.Rect=Wl,t.RectCombo=Yl,t.Shortcut=Qh,t.Star=Ul,t.Theme=CB,t.Triangle=Hl,t.Utils=SB,t.ZoomCanvas=xd,t.getExtension=iz,t.getExtensions=function(t){return nz[t]},t.register=rz,t.version="5.0.0"}));