@mcp-graph-workflow/mcp-graph 5.5.1 → 5.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/dist/api/routes/integrations.d.ts.map +1 -1
  2. package/dist/api/routes/integrations.js +2 -1
  3. package/dist/api/routes/integrations.js.map +1 -1
  4. package/dist/api/routes/knowledge.js +1 -1
  5. package/dist/api/routes/knowledge.js.map +1 -1
  6. package/dist/api/routes/nodes.js +3 -3
  7. package/dist/api/routes/nodes.js.map +1 -1
  8. package/dist/cli/commands/doctor.d.ts.map +1 -1
  9. package/dist/cli/commands/doctor.js +2 -1
  10. package/dist/cli/commands/doctor.js.map +1 -1
  11. package/dist/cli/commands/import-cmd.d.ts.map +1 -1
  12. package/dist/cli/commands/import-cmd.js +2 -1
  13. package/dist/cli/commands/import-cmd.js.map +1 -1
  14. package/dist/cli/commands/index-cmd.d.ts.map +1 -1
  15. package/dist/cli/commands/index-cmd.js +2 -1
  16. package/dist/cli/commands/index-cmd.js.map +1 -1
  17. package/dist/cli/commands/init.d.ts.map +1 -1
  18. package/dist/cli/commands/init.js +2 -1
  19. package/dist/cli/commands/init.js.map +1 -1
  20. package/dist/cli/commands/stats.d.ts.map +1 -1
  21. package/dist/cli/commands/stats.js +2 -1
  22. package/dist/cli/commands/stats.js.map +1 -1
  23. package/dist/cli/commands/update.d.ts.map +1 -1
  24. package/dist/cli/commands/update.js +3 -2
  25. package/dist/cli/commands/update.js.map +1 -1
  26. package/dist/core/analyzer/ac-validator.d.ts.map +1 -1
  27. package/dist/core/analyzer/ac-validator.js +8 -2
  28. package/dist/core/analyzer/ac-validator.js.map +1 -1
  29. package/dist/core/analyzer/prd-quality.d.ts.map +1 -1
  30. package/dist/core/analyzer/prd-quality.js +9 -13
  31. package/dist/core/analyzer/prd-quality.js.map +1 -1
  32. package/dist/core/analyzer/scope-analyzer.d.ts.map +1 -1
  33. package/dist/core/analyzer/scope-analyzer.js +1 -2
  34. package/dist/core/analyzer/scope-analyzer.js.map +1 -1
  35. package/dist/core/code/code-types.d.ts +4 -4
  36. package/dist/core/context/compact-context.d.ts.map +1 -1
  37. package/dist/core/context/compact-context.js +14 -26
  38. package/dist/core/context/compact-context.js.map +1 -1
  39. package/dist/core/context/context-assembler.d.ts.map +1 -1
  40. package/dist/core/context/context-assembler.js +22 -3
  41. package/dist/core/context/context-assembler.js.map +1 -1
  42. package/dist/core/context/rag-context.d.ts.map +1 -1
  43. package/dist/core/context/rag-context.js +36 -3
  44. package/dist/core/context/rag-context.js.map +1 -1
  45. package/dist/core/designer/coupling-analyzer.d.ts.map +1 -1
  46. package/dist/core/designer/coupling-analyzer.js +3 -0
  47. package/dist/core/designer/coupling-analyzer.js.map +1 -1
  48. package/dist/core/designer/definition-of-ready.d.ts.map +1 -1
  49. package/dist/core/designer/definition-of-ready.js +1 -11
  50. package/dist/core/designer/definition-of-ready.js.map +1 -1
  51. package/dist/core/designer/interface-checker.d.ts.map +1 -1
  52. package/dist/core/designer/interface-checker.js +2 -1
  53. package/dist/core/designer/interface-checker.js.map +1 -1
  54. package/dist/core/designer/traceability-matrix.d.ts.map +1 -1
  55. package/dist/core/designer/traceability-matrix.js +7 -3
  56. package/dist/core/designer/traceability-matrix.js.map +1 -1
  57. package/dist/core/graph/mermaid-export.d.ts +1 -0
  58. package/dist/core/graph/mermaid-export.d.ts.map +1 -1
  59. package/dist/core/graph/mermaid-export.js +11 -8
  60. package/dist/core/graph/mermaid-export.js.map +1 -1
  61. package/dist/core/handoff/delivery-checklist.d.ts.map +1 -1
  62. package/dist/core/handoff/delivery-checklist.js +5 -14
  63. package/dist/core/handoff/delivery-checklist.js.map +1 -1
  64. package/dist/core/implementer/definition-of-done.d.ts.map +1 -1
  65. package/dist/core/implementer/definition-of-done.js +8 -18
  66. package/dist/core/implementer/definition-of-done.js.map +1 -1
  67. package/dist/core/implementer/sprint-progress.d.ts.map +1 -1
  68. package/dist/core/implementer/sprint-progress.js +1 -1
  69. package/dist/core/implementer/sprint-progress.js.map +1 -1
  70. package/dist/core/implementer/tdd-checker.d.ts +5 -1
  71. package/dist/core/implementer/tdd-checker.d.ts.map +1 -1
  72. package/dist/core/implementer/tdd-checker.js +20 -5
  73. package/dist/core/implementer/tdd-checker.js.map +1 -1
  74. package/dist/core/importer/prd-to-graph.d.ts.map +1 -1
  75. package/dist/core/importer/prd-to-graph.js +96 -1
  76. package/dist/core/importer/prd-to-graph.js.map +1 -1
  77. package/dist/core/listener/backlog-health.d.ts.map +1 -1
  78. package/dist/core/listener/backlog-health.js +22 -3
  79. package/dist/core/listener/backlog-health.js.map +1 -1
  80. package/dist/core/listener/feedback-readiness.d.ts.map +1 -1
  81. package/dist/core/listener/feedback-readiness.js +5 -14
  82. package/dist/core/listener/feedback-readiness.js.map +1 -1
  83. package/dist/core/parser/classify.d.ts +1 -0
  84. package/dist/core/parser/classify.d.ts.map +1 -1
  85. package/dist/core/parser/classify.js +23 -1
  86. package/dist/core/parser/classify.js.map +1 -1
  87. package/dist/core/parser/extract.d.ts.map +1 -1
  88. package/dist/core/parser/extract.js +35 -0
  89. package/dist/core/parser/extract.js.map +1 -1
  90. package/dist/core/planner/decompose.d.ts.map +1 -1
  91. package/dist/core/planner/decompose.js +6 -7
  92. package/dist/core/planner/decompose.js.map +1 -1
  93. package/dist/core/planner/dependency-chain.d.ts.map +1 -1
  94. package/dist/core/planner/dependency-chain.js +3 -0
  95. package/dist/core/planner/dependency-chain.js.map +1 -1
  96. package/dist/core/planner/lifecycle-phase.d.ts.map +1 -1
  97. package/dist/core/planner/lifecycle-phase.js +25 -16
  98. package/dist/core/planner/lifecycle-phase.js.map +1 -1
  99. package/dist/core/planner/next-task.d.ts.map +1 -1
  100. package/dist/core/planner/next-task.js +15 -5
  101. package/dist/core/planner/next-task.js.map +1 -1
  102. package/dist/core/planner/planning-report.d.ts.map +1 -1
  103. package/dist/core/planner/planning-report.js +2 -2
  104. package/dist/core/planner/planning-report.js.map +1 -1
  105. package/dist/core/planner/velocity.d.ts.map +1 -1
  106. package/dist/core/planner/velocity.js +1 -3
  107. package/dist/core/planner/velocity.js.map +1 -1
  108. package/dist/core/rag/phase-metadata.d.ts +2 -2
  109. package/dist/core/rag/phase-metadata.d.ts.map +1 -1
  110. package/dist/core/rag/phase-metadata.js +3 -4
  111. package/dist/core/rag/phase-metadata.js.map +1 -1
  112. package/dist/core/rag/phase-summary.d.ts.map +1 -1
  113. package/dist/core/rag/phase-summary.js +3 -3
  114. package/dist/core/rag/phase-summary.js.map +1 -1
  115. package/dist/core/reviewer/review-readiness.d.ts.map +1 -1
  116. package/dist/core/reviewer/review-readiness.js +5 -14
  117. package/dist/core/reviewer/review-readiness.js.map +1 -1
  118. package/dist/core/store/knowledge-store.js +2 -2
  119. package/dist/core/store/knowledge-store.js.map +1 -1
  120. package/dist/core/store/migrations.d.ts.map +1 -1
  121. package/dist/core/store/migrations.js +11 -0
  122. package/dist/core/store/migrations.js.map +1 -1
  123. package/dist/core/store/sqlite-store.d.ts.map +1 -1
  124. package/dist/core/store/sqlite-store.js +11 -7
  125. package/dist/core/store/sqlite-store.js.map +1 -1
  126. package/dist/core/utils/ac-helpers.d.ts +14 -0
  127. package/dist/core/utils/ac-helpers.d.ts.map +1 -0
  128. package/dist/core/utils/ac-helpers.js +26 -0
  129. package/dist/core/utils/ac-helpers.js.map +1 -0
  130. package/dist/core/utils/blocked-helpers.d.ts +14 -0
  131. package/dist/core/utils/blocked-helpers.d.ts.map +1 -0
  132. package/dist/core/utils/blocked-helpers.js +19 -0
  133. package/dist/core/utils/blocked-helpers.js.map +1 -0
  134. package/dist/core/utils/constants.d.ts +10 -0
  135. package/dist/core/utils/constants.d.ts.map +1 -1
  136. package/dist/core/utils/constants.js +12 -0
  137. package/dist/core/utils/constants.js.map +1 -1
  138. package/dist/core/utils/errors.d.ts +2 -0
  139. package/dist/core/utils/errors.d.ts.map +1 -1
  140. package/dist/core/utils/errors.js +4 -0
  141. package/dist/core/utils/errors.js.map +1 -1
  142. package/dist/core/utils/grading.d.ts +8 -0
  143. package/dist/core/utils/grading.d.ts.map +1 -0
  144. package/dist/core/utils/grading.js +17 -0
  145. package/dist/core/utils/grading.js.map +1 -0
  146. package/dist/core/utils/node-type-sets.d.ts +17 -0
  147. package/dist/core/utils/node-type-sets.d.ts.map +1 -0
  148. package/dist/core/utils/node-type-sets.js +23 -0
  149. package/dist/core/utils/node-type-sets.js.map +1 -0
  150. package/dist/core/utils/text.d.ts +9 -0
  151. package/dist/core/utils/text.d.ts.map +1 -0
  152. package/dist/core/utils/text.js +13 -0
  153. package/dist/core/utils/text.js.map +1 -0
  154. package/dist/core/utils/xp-sizing.d.ts +16 -0
  155. package/dist/core/utils/xp-sizing.d.ts.map +1 -0
  156. package/dist/core/utils/xp-sizing.js +20 -0
  157. package/dist/core/utils/xp-sizing.js.map +1 -0
  158. package/dist/core/validator/definition-of-ready.d.ts.map +1 -1
  159. package/dist/core/validator/definition-of-ready.js +2 -12
  160. package/dist/core/validator/definition-of-ready.js.map +1 -1
  161. package/dist/core/validator/done-integrity-checker.d.ts.map +1 -1
  162. package/dist/core/validator/done-integrity-checker.js +1 -1
  163. package/dist/core/validator/done-integrity-checker.js.map +1 -1
  164. package/dist/core/validator/status-flow-checker.d.ts.map +1 -1
  165. package/dist/core/validator/status-flow-checker.js +1 -1
  166. package/dist/core/validator/status-flow-checker.js.map +1 -1
  167. package/dist/mcp/lifecycle-wrapper.d.ts +0 -4
  168. package/dist/mcp/lifecycle-wrapper.d.ts.map +1 -1
  169. package/dist/mcp/lifecycle-wrapper.js +6 -1
  170. package/dist/mcp/lifecycle-wrapper.js.map +1 -1
  171. package/dist/mcp/response-helpers.d.ts +20 -0
  172. package/dist/mcp/response-helpers.d.ts.map +1 -0
  173. package/dist/mcp/response-helpers.js +26 -0
  174. package/dist/mcp/response-helpers.js.map +1 -0
  175. package/dist/mcp/tools/add-node.d.ts.map +1 -1
  176. package/dist/mcp/tools/add-node.js +6 -16
  177. package/dist/mcp/tools/add-node.js.map +1 -1
  178. package/dist/mcp/tools/analyze.d.ts.map +1 -1
  179. package/dist/mcp/tools/analyze.js +29 -39
  180. package/dist/mcp/tools/analyze.js.map +1 -1
  181. package/dist/mcp/tools/clone-node.d.ts.map +1 -1
  182. package/dist/mcp/tools/clone-node.js +5 -28
  183. package/dist/mcp/tools/clone-node.js.map +1 -1
  184. package/dist/mcp/tools/context.d.ts.map +1 -1
  185. package/dist/mcp/tools/context.js +3 -14
  186. package/dist/mcp/tools/context.js.map +1 -1
  187. package/dist/mcp/tools/delete-node.d.ts.map +1 -1
  188. package/dist/mcp/tools/delete-node.js +3 -14
  189. package/dist/mcp/tools/delete-node.js.map +1 -1
  190. package/dist/mcp/tools/edge.d.ts.map +1 -1
  191. package/dist/mcp/tools/edge.js +18 -60
  192. package/dist/mcp/tools/edge.js.map +1 -1
  193. package/dist/mcp/tools/export.d.ts.map +1 -1
  194. package/dist/mcp/tools/export.js +14 -7
  195. package/dist/mcp/tools/export.js.map +1 -1
  196. package/dist/mcp/tools/import-prd.d.ts.map +1 -1
  197. package/dist/mcp/tools/import-prd.js +16 -34
  198. package/dist/mcp/tools/import-prd.js.map +1 -1
  199. package/dist/mcp/tools/init.d.ts.map +1 -1
  200. package/dist/mcp/tools/init.js +2 -8
  201. package/dist/mcp/tools/init.js.map +1 -1
  202. package/dist/mcp/tools/list-skills.d.ts.map +1 -1
  203. package/dist/mcp/tools/list-skills.js +16 -31
  204. package/dist/mcp/tools/list-skills.js.map +1 -1
  205. package/dist/mcp/tools/list.d.ts.map +1 -1
  206. package/dist/mcp/tools/list.js +12 -12
  207. package/dist/mcp/tools/list.js.map +1 -1
  208. package/dist/mcp/tools/manage-skill.d.ts.map +1 -1
  209. package/dist/mcp/tools/manage-skill.js +29 -86
  210. package/dist/mcp/tools/manage-skill.js.map +1 -1
  211. package/dist/mcp/tools/memory.d.ts.map +1 -1
  212. package/dist/mcp/tools/memory.js +17 -47
  213. package/dist/mcp/tools/memory.js.map +1 -1
  214. package/dist/mcp/tools/metrics.d.ts.map +1 -1
  215. package/dist/mcp/tools/metrics.js +9 -22
  216. package/dist/mcp/tools/metrics.js.map +1 -1
  217. package/dist/mcp/tools/move-node.d.ts.map +1 -1
  218. package/dist/mcp/tools/move-node.js +10 -36
  219. package/dist/mcp/tools/move-node.js.map +1 -1
  220. package/dist/mcp/tools/next.d.ts.map +1 -1
  221. package/dist/mcp/tools/next.js +22 -27
  222. package/dist/mcp/tools/next.js.map +1 -1
  223. package/dist/mcp/tools/node.d.ts.map +1 -1
  224. package/dist/mcp/tools/node.js +15 -37
  225. package/dist/mcp/tools/node.js.map +1 -1
  226. package/dist/mcp/tools/plan-sprint.d.ts.map +1 -1
  227. package/dist/mcp/tools/plan-sprint.js +15 -29
  228. package/dist/mcp/tools/plan-sprint.js.map +1 -1
  229. package/dist/mcp/tools/rag-context.d.ts.map +1 -1
  230. package/dist/mcp/tools/rag-context.js +5 -17
  231. package/dist/mcp/tools/rag-context.js.map +1 -1
  232. package/dist/mcp/tools/reindex-knowledge.d.ts.map +1 -1
  233. package/dist/mcp/tools/reindex-knowledge.js +2 -8
  234. package/dist/mcp/tools/reindex-knowledge.js.map +1 -1
  235. package/dist/mcp/tools/search.d.ts.map +1 -1
  236. package/dist/mcp/tools/search.js +2 -8
  237. package/dist/mcp/tools/search.js.map +1 -1
  238. package/dist/mcp/tools/set-phase.d.ts.map +1 -1
  239. package/dist/mcp/tools/set-phase.js +17 -46
  240. package/dist/mcp/tools/set-phase.js.map +1 -1
  241. package/dist/mcp/tools/show.d.ts.map +1 -1
  242. package/dist/mcp/tools/show.js +13 -24
  243. package/dist/mcp/tools/show.js.map +1 -1
  244. package/dist/mcp/tools/snapshot.d.ts.map +1 -1
  245. package/dist/mcp/tools/snapshot.js +5 -21
  246. package/dist/mcp/tools/snapshot.js.map +1 -1
  247. package/dist/mcp/tools/sync-stack-docs.d.ts.map +1 -1
  248. package/dist/mcp/tools/sync-stack-docs.js +8 -17
  249. package/dist/mcp/tools/sync-stack-docs.js.map +1 -1
  250. package/dist/mcp/tools/update-node.d.ts.map +1 -1
  251. package/dist/mcp/tools/update-node.js +3 -14
  252. package/dist/mcp/tools/update-node.js.map +1 -1
  253. package/dist/mcp/tools/update-status.d.ts.map +1 -1
  254. package/dist/mcp/tools/update-status.js +44 -24
  255. package/dist/mcp/tools/update-status.js.map +1 -1
  256. package/dist/mcp/tools/validate-ac.d.ts.map +1 -1
  257. package/dist/mcp/tools/validate-ac.js +2 -8
  258. package/dist/mcp/tools/validate-ac.js.map +1 -1
  259. package/dist/mcp/tools/validate-task.d.ts.map +1 -1
  260. package/dist/mcp/tools/validate-task.js +2 -6
  261. package/dist/mcp/tools/validate-task.js.map +1 -1
  262. package/dist/mcp/tools/validate.d.ts.map +1 -1
  263. package/dist/mcp/tools/validate.js +4 -10
  264. package/dist/mcp/tools/validate.js.map +1 -1
  265. package/dist/schemas/analyzer-schema.d.ts +7 -6
  266. package/dist/schemas/analyzer-schema.d.ts.map +1 -1
  267. package/dist/schemas/analyzer-schema.js +3 -1
  268. package/dist/schemas/analyzer-schema.js.map +1 -1
  269. package/dist/schemas/designer-schema.d.ts +19 -17
  270. package/dist/schemas/designer-schema.d.ts.map +1 -1
  271. package/dist/schemas/designer-schema.js +8 -15
  272. package/dist/schemas/designer-schema.js.map +1 -1
  273. package/dist/schemas/grade-schema.d.ts +13 -0
  274. package/dist/schemas/grade-schema.d.ts.map +1 -0
  275. package/dist/schemas/grade-schema.js +6 -0
  276. package/dist/schemas/grade-schema.js.map +1 -0
  277. package/dist/schemas/implementer-schema.d.ts +2 -0
  278. package/dist/schemas/implementer-schema.d.ts.map +1 -1
  279. package/dist/schemas/implementer-schema.js +6 -2
  280. package/dist/schemas/implementer-schema.js.map +1 -1
  281. package/dist/schemas/listener-schema.d.ts +11 -0
  282. package/dist/schemas/listener-schema.d.ts.map +1 -1
  283. package/dist/schemas/listener-schema.js +7 -0
  284. package/dist/schemas/listener-schema.js.map +1 -1
  285. package/dist/schemas/readiness-schema.d.ts +44 -0
  286. package/dist/schemas/readiness-schema.d.ts.map +1 -0
  287. package/dist/schemas/readiness-schema.js +22 -0
  288. package/dist/schemas/readiness-schema.js.map +1 -0
  289. package/dist/web/dashboard/dist/assets/{benchmark-tab-BW4QxI49.js → benchmark-tab-C5fwIqgM.js} +1 -1
  290. package/dist/web/dashboard/dist/assets/{constants-kpH_c6vY.js → constants-z0QkAiYv.js} +1 -1
  291. package/dist/web/dashboard/dist/assets/{context-tab-C5RAlXNW.js → context-tab-ChCyrRlr.js} +1 -1
  292. package/dist/web/dashboard/dist/assets/{gitnexus-tab-BnxxYl2F.js → gitnexus-tab-DnlGT63w.js} +1 -1
  293. package/dist/web/dashboard/dist/assets/{graph-tab-Cv_wQ6Az.js → graph-tab-DjV9RD41.js} +1 -1
  294. package/dist/web/dashboard/dist/assets/{graph-utils-Ds1zJyD1.js → graph-utils-C6bvcT4d.js} +1 -1
  295. package/dist/web/dashboard/dist/assets/{index-Bic_URMs.js → index-DlZhNCGR.js} +1 -1
  296. package/dist/web/dashboard/dist/assets/{index-BAeZDWWy.js → index-dCyMex_p.js} +2 -2
  297. package/dist/web/dashboard/dist/assets/{insights-tab-U_ATOqPu.js → insights-tab-Cj4f85vS.js} +1 -1
  298. package/dist/web/dashboard/dist/assets/{logs-tab-B8psCXuB.js → logs-tab-C4C2Vn8-.js} +1 -1
  299. package/dist/web/dashboard/dist/assets/{memories-tab-DcWok2by.js → memories-tab-NtNwoxbT.js} +1 -1
  300. package/dist/web/dashboard/dist/assets/{prd-backlog-tab-CjftveTc.js → prd-backlog-tab-Bxt7qiVG.js} +1 -1
  301. package/dist/web/dashboard/dist/assets/skills-tab-CIj4z1Ol.js +1 -0
  302. package/dist/web/dashboard/dist/index.html +1 -1
  303. package/package.json +1 -1
  304. package/dist/web/dashboard/dist/assets/skills-tab-Ddp1w4vS.js +0 -1
@@ -1,4 +1,4 @@
1
- var Mc=Object.defineProperty;var Ic=(e,t,n)=>t in e?Mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ie=(e,t,n)=>Ic(e,typeof t!="symbol"?t+"":t,n);import{t as Ac,r as V,j as M,g as Tc}from"./index-BAeZDWWy.js";import{N as Pt,S as ir,E as ke}from"./constants-kpH_c6vY.js";import{i as Te,c as Yr,a as Gr,b as Lc,d as rn,u as Pc,r as jc}from"./index-Bic_URMs.js";function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ae(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Oc={value:()=>{}};function Bt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Mt(n)}function Mt(e){this._=e}function Rc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Mt.prototype=Bt.prototype={constructor:Mt,on:function(e,t){var n=this._,r=Rc(e+"",n),o,s=-1,i=r.length;if(arguments.length<2){for(;++s<i;)if((o=(e=r[s]).type)&&(o=Dc(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(o=(e=r[s]).type)n[o]=Xr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Xr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Mt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,s;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,o=s.length;r<o;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,s=r.length;o<s;++o)r[o].value.apply(t,n)}};function Dc(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Xr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=Oc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var sr="http://www.w3.org/1999/xhtml";const Wr={svg:"http://www.w3.org/2000/svg",xhtml:sr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Wr.hasOwnProperty(t)?{space:Wr[t],local:e}:e}function $c(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===sr&&t.documentElement.namespaceURI===sr?t.createElement(e):t.createElementNS(n,e)}}function zc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $i(e){var t=qt(e);return(t.local?zc:$c)(t)}function Vc(){}function xr(e){return e==null?Vc:function(){return this.querySelector(e)}}function Fc(e){typeof e!="function"&&(e=xr(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=new Array(i),c,d,u=0;u<i;++u)(c=s[u])&&(d=e.call(c,c.__data__,u,s))&&("__data__"in c&&(d.__data__=c.__data__),a[u]=d);return new ue(r,this._parents)}function Hc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Bc(){return[]}function zi(e){return e==null?Bc:function(){return this.querySelectorAll(e)}}function qc(e){return function(){return Hc(e.apply(this,arguments))}}function Yc(e){typeof e=="function"?e=qc(e):e=zi(e);for(var t=this._groups,n=t.length,r=[],o=[],s=0;s<n;++s)for(var i=t[s],a=i.length,c,d=0;d<a;++d)(c=i[d])&&(r.push(e.call(c,c.__data__,d,i)),o.push(c));return new ue(r,o)}function Vi(e){return function(){return this.matches(e)}}function Fi(e){return function(t){return t.matches(e)}}var Gc=Array.prototype.find;function Xc(e){return function(){return Gc.call(this.children,e)}}function Wc(){return this.firstElementChild}function Uc(e){return this.select(e==null?Wc:Xc(typeof e=="function"?e:Fi(e)))}var Kc=Array.prototype.filter;function Zc(){return Array.from(this.children)}function Qc(e){return function(){return Kc.call(this.children,e)}}function Jc(e){return this.selectAll(e==null?Zc:Qc(typeof e=="function"?e:Fi(e)))}function el(e){typeof e!="function"&&(e=Vi(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=[],c,d=0;d<i;++d)(c=s[d])&&e.call(c,c.__data__,d,s)&&a.push(c);return new ue(r,this._parents)}function Hi(e){return new Array(e.length)}function tl(){return new ue(this._enter||this._groups.map(Hi),this._parents)}function jt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}jt.prototype={constructor:jt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function nl(e){return function(){return e}}function rl(e,t,n,r,o,s){for(var i=0,a,c=t.length,d=s.length;i<d;++i)(a=t[i])?(a.__data__=s[i],r[i]=a):n[i]=new jt(e,s[i]);for(;i<c;++i)(a=t[i])&&(o[i]=a)}function ol(e,t,n,r,o,s,i){var a,c,d=new Map,u=t.length,l=s.length,f=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(f[a]=h=i.call(c,c.__data__,a,t)+"",d.has(h)?o[a]=c:d.set(h,c));for(a=0;a<l;++a)h=i.call(e,s[a],a,s)+"",(c=d.get(h))?(r[a]=c,c.__data__=s[a],d.delete(h)):n[a]=new jt(e,s[a]);for(a=0;a<u;++a)(c=t[a])&&d.get(f[a])===c&&(o[a]=c)}function il(e){return e.__data__}function sl(e,t){if(!arguments.length)return Array.from(this,il);var n=t?ol:rl,r=this._parents,o=this._groups;typeof e!="function"&&(e=nl(e));for(var s=o.length,i=new Array(s),a=new Array(s),c=new Array(s),d=0;d<s;++d){var u=r[d],l=o[d],f=l.length,h=al(e.call(u,u&&u.__data__,d,r)),p=h.length,x=a[d]=new Array(p),m=i[d]=new Array(p),y=c[d]=new Array(f);n(u,l,x,m,y,h,t);for(var v=0,g=0,w,C;v<p;++v)if(w=x[v]){for(v>=g&&(g=v+1);!(C=m[g])&&++g<p;);w._next=C||null}}return i=new ue(i,r),i._enter=a,i._exit=c,i}function al(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function cl(){return new ue(this._exit||this._groups.map(Hi),this._parents)}function ll(e,t,n){var r=this.enter(),o=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?s.remove():n(s),r&&o?r.merge(o).order():o}function ul(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,s=r.length,i=Math.min(o,s),a=new Array(o),c=0;c<i;++c)for(var d=n[c],u=r[c],l=d.length,f=a[c]=new Array(l),h,p=0;p<l;++p)(h=d[p]||u[p])&&(f[p]=h);for(;c<o;++c)a[c]=n[c];return new ue(a,this._parents)}function dl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,s=r[o],i;--o>=0;)(i=r[o])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function fl(e){e||(e=hl);function t(l,f){return l&&f?e(l.__data__,f.__data__):!l-!f}for(var n=this._groups,r=n.length,o=new Array(r),s=0;s<r;++s){for(var i=n[s],a=i.length,c=o[s]=new Array(a),d,u=0;u<a;++u)(d=i[u])&&(c[u]=d);c.sort(t)}return new ue(o,this._parents).order()}function hl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function gl(){return Array.from(this)}function ml(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,s=r.length;o<s;++o){var i=r[o];if(i)return i}return null}function yl(){let e=0;for(const t of this)++e;return e}function wl(){return!this.node()}function xl(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],s=0,i=o.length,a;s<i;++s)(a=o[s])&&e.call(a,a.__data__,s,o);return this}function vl(e){return function(){this.removeAttribute(e)}}function bl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _l(e,t){return function(){this.setAttribute(e,t)}}function El(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Nl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Sl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Cl(e,t){var n=qt(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?bl:vl:typeof t=="function"?n.local?Sl:Nl:n.local?El:_l)(n,t))}function Bi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function kl(e){return function(){this.style.removeProperty(e)}}function Ml(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Il(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Al(e,t,n){return arguments.length>1?this.each((t==null?kl:typeof t=="function"?Il:Ml)(e,t,n??"")):He(this.node(),e)}function He(e,t){return e.style.getPropertyValue(t)||Bi(e).getComputedStyle(e,null).getPropertyValue(t)}function Tl(e){return function(){delete this[e]}}function Ll(e,t){return function(){this[e]=t}}function Pl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function jl(e,t){return arguments.length>1?this.each((t==null?Tl:typeof t=="function"?Pl:Ll)(e,t)):this.node()[e]}function qi(e){return e.trim().split(/^|\s+/)}function vr(e){return e.classList||new Yi(e)}function Yi(e){this._node=e,this._names=qi(e.getAttribute("class")||"")}Yi.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Gi(e,t){for(var n=vr(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Xi(e,t){for(var n=vr(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Ol(e){return function(){Gi(this,e)}}function Rl(e){return function(){Xi(this,e)}}function Dl(e,t){return function(){(t.apply(this,arguments)?Gi:Xi)(this,e)}}function $l(e,t){var n=qi(e+"");if(arguments.length<2){for(var r=vr(this.node()),o=-1,s=n.length;++o<s;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?Dl:t?Ol:Rl)(n,t))}function zl(){this.textContent=""}function Vl(e){return function(){this.textContent=e}}function Fl(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Hl(e){return arguments.length?this.each(e==null?zl:(typeof e=="function"?Fl:Vl)(e)):this.node().textContent}function Bl(){this.innerHTML=""}function ql(e){return function(){this.innerHTML=e}}function Yl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Gl(e){return arguments.length?this.each(e==null?Bl:(typeof e=="function"?Yl:ql)(e)):this.node().innerHTML}function Xl(){this.nextSibling&&this.parentNode.appendChild(this)}function Wl(){return this.each(Xl)}function Ul(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Kl(){return this.each(Ul)}function Zl(e){var t=typeof e=="function"?e:$i(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ql(){return null}function Jl(e,t){var n=typeof e=="function"?e:$i(e),r=t==null?Ql:typeof t=="function"?t:xr(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function eu(){var e=this.parentNode;e&&e.removeChild(this)}function tu(){return this.each(eu)}function nu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ru(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ou(e){return this.select(e?ru:nu)}function iu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function su(e){return function(t){e.call(this,t,this.__data__)}}function au(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function cu(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,s;n<o;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function lu(e,t,n){return function(){var r=this.__on,o,s=su(t);if(r){for(var i=0,a=r.length;i<a;++i)if((o=r[i]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=s,o.options=n),o.value=t;return}}this.addEventListener(e.type,s,n),o={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(o):this.__on=[o]}}function uu(e,t,n){var r=au(e+""),o,s=r.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,d=a.length,u;c<d;++c)for(o=0,u=a[c];o<s;++o)if((i=r[o]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?lu:cu,o=0;o<s;++o)this.each(a(r[o],t,n));return this}function Wi(e,t,n){var r=Bi(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function du(e,t){return function(){return Wi(this,e,t)}}function fu(e,t){return function(){return Wi(this,e,t.apply(this,arguments))}}function hu(e,t){return this.each((typeof t=="function"?fu:du)(e,t))}function*pu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,s=r.length,i;o<s;++o)(i=r[o])&&(yield i)}var Ui=[null];function ue(e,t){this._groups=e,this._parents=t}function ft(){return new ue([[document.documentElement]],Ui)}function gu(){return this}ue.prototype=ft.prototype={constructor:ue,select:Fc,selectAll:Yc,selectChild:Uc,selectChildren:Jc,filter:el,data:sl,enter:tl,exit:cl,join:ll,merge:ul,selection:gu,order:dl,sort:fl,call:pl,nodes:gl,node:ml,size:yl,empty:wl,each:xl,attr:Cl,style:Al,property:jl,classed:$l,text:Hl,html:Gl,raise:Wl,lower:Kl,append:Zl,insert:Jl,remove:tu,clone:ou,datum:iu,on:uu,dispatch:hu,[Symbol.iterator]:pu};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Ui)}function mu(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=mu(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const yu={passive:!1},it={capture:!0,passive:!1};function on(e){e.stopImmediatePropagation()}function Fe(e){e.preventDefault(),e.stopImmediatePropagation()}function Ki(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Fe,it);"onselectstart"in t?n.on("selectstart.drag",Fe,it):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Zi(e,t){var n=e.document.documentElement,r=le(e).on("dragstart.drag",null);t&&(r.on("click.drag",Fe,it),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const vt=e=>()=>e;function ar(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:s,x:i,y:a,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}ar.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function wu(e){return!e.ctrlKey&&!e.button}function xu(){return this.parentNode}function vu(e,t){return t??{x:e.x,y:e.y}}function bu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qi(){var e=wu,t=xu,n=vu,r=bu,o={},s=Bt("start","drag","end"),i=0,a,c,d,u,l=0;function f(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",m).on("touchmove.drag",y,yu).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,C){if(!(u||!e.call(this,w,C))){var S=g(this,t.call(this,w,C),w,C,"mouse");S&&(le(w.view).on("mousemove.drag",p,it).on("mouseup.drag",x,it),Ki(w.view),on(w),d=!1,a=w.clientX,c=w.clientY,S("start",w))}}function p(w){if(Fe(w),!d){var C=w.clientX-a,S=w.clientY-c;d=C*C+S*S>l}o.mouse("drag",w)}function x(w){le(w.view).on("mousemove.drag mouseup.drag",null),Zi(w.view,d),Fe(w),o.mouse("end",w)}function m(w,C){if(e.call(this,w,C)){var S=w.changedTouches,I=t.call(this,w,C),b=S.length,E,A;for(E=0;E<b;++E)(A=g(this,I,w,C,S[E].identifier,S[E]))&&(on(w),A("start",w,S[E]))}}function y(w){var C=w.changedTouches,S=C.length,I,b;for(I=0;I<S;++I)(b=o[C[I].identifier])&&(Fe(w),b("drag",w,C[I]))}function v(w){var C=w.changedTouches,S=C.length,I,b;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),I=0;I<S;++I)(b=o[C[I].identifier])&&(on(w),b("end",w,C[I]))}function g(w,C,S,I,b,E){var A=s.copy(),N=de(E||S,C),k,D,_;if((_=n.call(w,new ar("beforestart",{sourceEvent:S,target:f,identifier:b,active:i,x:N[0],y:N[1],dx:0,dy:0,dispatch:A}),I))!=null)return k=_.x-N[0]||0,D=_.y-N[1]||0,function P(L,$,R){var j=N,F;switch(L){case"start":o[b]=P,F=i++;break;case"end":delete o[b],--i;case"drag":N=de(R||$,C),F=i;break}A.call(L,w,new ar(L,{sourceEvent:$,subject:_,target:f,identifier:b,active:F,x:N[0]+k,y:N[1]+D,dx:N[0]-j[0],dy:N[1]-j[1],dispatch:A}),I)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:vt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:vt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:vt(w),f):n},f.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:vt(!!w),f):r},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(l=(w=+w)*w,f):Math.sqrt(l)},f}var Ur=180/Math.PI,cr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ji(e,t,n,r,o,s){var i,a,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,i=-i),{translateX:o,translateY:s,rotate:Math.atan2(t,e)*Ur,skewX:Math.atan(c)*Ur,scaleX:i,scaleY:a}}var bt;function _u(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?cr:Ji(t.a,t.b,t.c,t.d,t.e,t.f)}function Eu(e){return e==null||(bt||(bt=document.createElementNS("http://www.w3.org/2000/svg","g")),bt.setAttribute("transform",e),!(e=bt.transform.baseVal.consolidate()))?cr:(e=e.matrix,Ji(e.a,e.b,e.c,e.d,e.e,e.f))}function es(e,t,n,r){function o(d){return d.length?d.pop()+" ":""}function s(d,u,l,f,h,p){if(d!==l||u!==f){var x=h.push("translate(",null,t,null,n);p.push({i:x-4,x:Te(d,l)},{i:x-2,x:Te(u,f)})}else(l||f)&&h.push("translate("+l+t+f+n)}function i(d,u,l,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:l.push(o(l)+"rotate(",null,r)-2,x:Te(d,u)})):u&&l.push(o(l)+"rotate("+u+r)}function a(d,u,l,f){d!==u?f.push({i:l.push(o(l)+"skewX(",null,r)-2,x:Te(d,u)}):u&&l.push(o(l)+"skewX("+u+r)}function c(d,u,l,f,h,p){if(d!==l||u!==f){var x=h.push(o(h)+"scale(",null,",",null,")");p.push({i:x-4,x:Te(d,l)},{i:x-2,x:Te(u,f)})}else(l!==1||f!==1)&&h.push(o(h)+"scale("+l+","+f+")")}return function(d,u){var l=[],f=[];return d=e(d),u=e(u),s(d.translateX,d.translateY,u.translateX,u.translateY,l,f),i(d.rotate,u.rotate,l,f),a(d.skewX,u.skewX,l,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,l,f),d=u=null,function(h){for(var p=-1,x=f.length,m;++p<x;)l[(m=f[p]).i]=m.x(h);return l.join("")}}}var Nu=es(_u,"px, ","px)","deg)"),Su=es(Eu,", ",")",")"),Cu=1e-12;function Kr(e){return((e=Math.exp(e))+1/e)/2}function ku(e){return((e=Math.exp(e))-1/e)/2}function Mu(e){return((e=Math.exp(2*e))-1)/(e+1)}const It=(function e(t,n,r){function o(s,i){var a=s[0],c=s[1],d=s[2],u=i[0],l=i[1],f=i[2],h=u-a,p=l-c,x=h*h+p*p,m,y;if(x<Cu)y=Math.log(f/d)/t,m=function(I){return[a+I*h,c+I*p,d*Math.exp(t*I*y)]};else{var v=Math.sqrt(x),g=(f*f-d*d+r*x)/(2*d*n*v),w=(f*f-d*d-r*x)/(2*f*n*v),C=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(w*w+1)-w);y=(S-C)/t,m=function(I){var b=I*y,E=Kr(C),A=d/(n*v)*(E*Mu(t*b+C)-ku(C));return[a+A*h,c+A*p,d*E/Kr(t*b+C)]}}return m.duration=y*1e3*t/Math.SQRT2,m}return o.rho=function(s){var i=Math.max(.001,+s),a=i*i,c=a*a;return e(i,a,c)},o})(Math.SQRT2,2,4);var Be=0,nt=0,et=0,ts=1e3,Ot,rt,Rt=0,je=0,Yt=0,st=typeof performance=="object"&&performance.now?performance:Date,ns=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function br(){return je||(ns(Iu),je=st.now()+Yt)}function Iu(){je=0}function Dt(){this._call=this._time=this._next=null}Dt.prototype=rs.prototype={constructor:Dt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?br():+n)+(t==null?0:+t),!this._next&&rt!==this&&(rt?rt._next=this:Ot=this,rt=this),this._call=e,this._time=n,lr()},stop:function(){this._call&&(this._call=null,this._time=1/0,lr())}};function rs(e,t,n){var r=new Dt;return r.restart(e,t,n),r}function Au(){br(),++Be;for(var e=Ot,t;e;)(t=je-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Be}function Zr(){je=(Rt=st.now())+Yt,Be=nt=0;try{Au()}finally{Be=0,Lu(),je=0}}function Tu(){var e=st.now(),t=e-Rt;t>ts&&(Yt-=t,Rt=e)}function Lu(){for(var e,t=Ot,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ot=n);rt=e,lr(r)}function lr(e){if(!Be){nt&&(nt=clearTimeout(nt));var t=e-je;t>24?(e<1/0&&(nt=setTimeout(Zr,e-st.now()-Yt)),et&&(et=clearInterval(et))):(et||(Rt=st.now(),et=setInterval(Tu,ts)),Be=1,ns(Zr))}}function Qr(e,t,n){var r=new Dt;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Pu=Bt("start","end","cancel","interrupt"),ju=[],os=0,Jr=1,ur=2,At=3,eo=4,dr=5,Tt=6;function Gt(e,t,n,r,o,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Ou(e,n,{name:t,index:r,group:o,on:Pu,tween:ju,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:os})}function _r(e,t){var n=ge(e,t);if(n.state>os)throw new Error("too late; already scheduled");return n}function ye(e,t){var n=ge(e,t);if(n.state>At)throw new Error("too late; already running");return n}function ge(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ou(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=rs(s,0,n.time);function s(d){n.state=Jr,n.timer.restart(i,n.delay,n.time),n.delay<=d&&i(d-n.delay)}function i(d){var u,l,f,h;if(n.state!==Jr)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===At)return Qr(i);h.state===eo?(h.state=Tt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Tt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Qr(function(){n.state===At&&(n.state=eo,n.timer.restart(a,n.delay,n.time),a(d))}),n.state=ur,n.on.call("start",e,e.__data__,n.index,n.group),n.state===ur){for(n.state=At,o=new Array(f=n.tween.length),u=0,l=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(o[++l]=h);o.length=l+1}}function a(d){for(var u=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=dr,1),l=-1,f=o.length;++l<f;)o[l].call(e,u);n.state===dr&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Tt,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function Lt(e,t){var n=e.__transition,r,o,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((r=n[i]).name!==t){s=!1;continue}o=r.state>ur&&r.state<dr,r.state=Tt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[i]}s&&delete e.__transition}}function Ru(e){return this.each(function(){Lt(this,e)})}function Du(e,t){var n,r;return function(){var o=ye(this,e),s=o.tween;if(s!==n){r=n=s;for(var i=0,a=r.length;i<a;++i)if(r[i].name===t){r=r.slice(),r.splice(i,1);break}}o.tween=r}}function $u(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var s=ye(this,e),i=s.tween;if(i!==r){o=(r=i).slice();for(var a={name:t,value:n},c=0,d=o.length;c<d;++c)if(o[c].name===t){o[c]=a;break}c===d&&o.push(a)}s.tween=o}}function zu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ge(this.node(),n).tween,o=0,s=r.length,i;o<s;++o)if((i=r[o]).name===e)return i.value;return null}return this.each((t==null?Du:$u)(n,e,t))}function Er(e,t,n){var r=e._id;return e.each(function(){var o=ye(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return ge(o,r).value[t]}}function is(e,t){var n;return(typeof t=="number"?Te:t instanceof Yr?Gr:(n=Yr(t))?(t=n,Gr):Lc)(e,t)}function Vu(e){return function(){this.removeAttribute(e)}}function Fu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hu(e,t,n){var r,o=n+"",s;return function(){var i=this.getAttribute(e);return i===o?null:i===r?s:s=t(r=i,n)}}function Bu(e,t,n){var r,o=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===o?null:i===r?s:s=t(r=i,n)}}function qu(e,t,n){var r,o,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=a+"",i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a)))}}function Yu(e,t,n){var r,o,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=a+"",i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a)))}}function Gu(e,t){var n=qt(e),r=n==="transform"?Su:is;return this.attrTween(e,typeof t=="function"?(n.local?Yu:qu)(n,r,Er(this,"attr."+e,t)):t==null?(n.local?Fu:Vu)(n):(n.local?Bu:Hu)(n,r,t))}function Xu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Wu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Uu(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Wu(e,s)),n}return o._value=t,o}function Ku(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Xu(e,s)),n}return o._value=t,o}function Zu(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=qt(e);return this.tween(n,(r.local?Uu:Ku)(r,t))}function Qu(e,t){return function(){_r(this,e).delay=+t.apply(this,arguments)}}function Ju(e,t){return t=+t,function(){_r(this,e).delay=t}}function ed(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Qu:Ju)(t,e)):ge(this.node(),t).delay}function td(e,t){return function(){ye(this,e).duration=+t.apply(this,arguments)}}function nd(e,t){return t=+t,function(){ye(this,e).duration=t}}function rd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?td:nd)(t,e)):ge(this.node(),t).duration}function od(e,t){if(typeof t!="function")throw new Error;return function(){ye(this,e).ease=t}}function id(e){var t=this._id;return arguments.length?this.each(od(t,e)):ge(this.node(),t).ease}function sd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ye(this,e).ease=n}}function ad(e){if(typeof e!="function")throw new Error;return this.each(sd(this._id,e))}function cd(e){typeof e!="function"&&(e=Vi(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=[],c,d=0;d<i;++d)(c=s[d])&&e.call(c,c.__data__,d,s)&&a.push(c);return new be(r,this._parents,this._name,this._id)}function ld(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,s=Math.min(r,o),i=new Array(r),a=0;a<s;++a)for(var c=t[a],d=n[a],u=c.length,l=i[a]=new Array(u),f,h=0;h<u;++h)(f=c[h]||d[h])&&(l[h]=f);for(;a<r;++a)i[a]=t[a];return new be(i,this._parents,this._name,this._id)}function ud(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function dd(e,t,n){var r,o,s=ud(t)?_r:ye;return function(){var i=s(this,e),a=i.on;a!==r&&(o=(r=a).copy()).on(t,n),i.on=o}}function fd(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(dd(n,e,t))}function hd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function pd(){return this.on("end.remove",hd(this._id))}function gd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=xr(e));for(var r=this._groups,o=r.length,s=new Array(o),i=0;i<o;++i)for(var a=r[i],c=a.length,d=s[i]=new Array(c),u,l,f=0;f<c;++f)(u=a[f])&&(l=e.call(u,u.__data__,f,a))&&("__data__"in u&&(l.__data__=u.__data__),d[f]=l,Gt(d[f],t,n,f,d,ge(u,n)));return new be(s,this._parents,t,n)}function md(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zi(e));for(var r=this._groups,o=r.length,s=[],i=[],a=0;a<o;++a)for(var c=r[a],d=c.length,u,l=0;l<d;++l)if(u=c[l]){for(var f=e.call(u,u.__data__,l,c),h,p=ge(u,n),x=0,m=f.length;x<m;++x)(h=f[x])&&Gt(h,t,n,x,f,p);s.push(f),i.push(u)}return new be(s,i,t,n)}var yd=ft.prototype.constructor;function wd(){return new yd(this._groups,this._parents)}function xd(e,t){var n,r,o;return function(){var s=He(this,e),i=(this.style.removeProperty(e),He(this,e));return s===i?null:s===n&&i===r?o:o=t(n=s,r=i)}}function ss(e){return function(){this.style.removeProperty(e)}}function vd(e,t,n){var r,o=n+"",s;return function(){var i=He(this,e);return i===o?null:i===r?s:s=t(r=i,n)}}function bd(e,t,n){var r,o,s;return function(){var i=He(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),He(this,e))),i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a))}}function _d(e,t){var n,r,o,s="style."+t,i="end."+s,a;return function(){var c=ye(this,e),d=c.on,u=c.value[s]==null?a||(a=ss(t)):void 0;(d!==n||o!==u)&&(r=(n=d).copy()).on(i,o=u),c.on=r}}function Ed(e,t,n){var r=(e+="")=="transform"?Nu:is;return t==null?this.styleTween(e,xd(e,r)).on("end.style."+e,ss(e)):typeof t=="function"?this.styleTween(e,bd(e,r,Er(this,"style."+e,t))).each(_d(this._id,e)):this.styleTween(e,vd(e,r,t),n).on("end.style."+e,null)}function Nd(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Sd(e,t,n){var r,o;function s(){var i=t.apply(this,arguments);return i!==o&&(r=(o=i)&&Nd(e,i,n)),r}return s._value=t,s}function Cd(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Sd(e,t,n??""))}function kd(e){return function(){this.textContent=e}}function Md(e){return function(){var t=e(this);this.textContent=t??""}}function Id(e){return this.tween("text",typeof e=="function"?Md(Er(this,"text",e)):kd(e==null?"":e+""))}function Ad(e){return function(t){this.textContent=e.call(this,t)}}function Td(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Ad(o)),t}return r._value=e,r}function Ld(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Td(e))}function Pd(){for(var e=this._name,t=this._id,n=as(),r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,d=0;d<a;++d)if(c=i[d]){var u=ge(c,t);Gt(c,e,n,d,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new be(r,this._parents,e,n)}function jd(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(s,i){var a={value:i},c={value:function(){--o===0&&s()}};n.each(function(){var d=ye(this,r),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),d.on=t}),o===0&&s()})}var Od=0;function be(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function as(){return++Od}var xe=ft.prototype;be.prototype={constructor:be,select:gd,selectAll:md,selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:cd,merge:ld,selection:wd,transition:Pd,call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:fd,attr:Gu,attrTween:Zu,style:Ed,styleTween:Cd,text:Id,textTween:Ld,remove:pd,tween:zu,delay:ed,duration:rd,ease:id,easeVarying:ad,end:jd,[Symbol.iterator]:xe[Symbol.iterator]};function Rd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Dd={time:null,delay:0,duration:250,ease:Rd};function $d(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function zd(e){var t,n;e instanceof be?(t=e._id,e=e._name):(t=as(),(n=Dd).time=br(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,d=0;d<a;++d)(c=i[d])&&Gt(c,e,t,d,i,n||$d(c,t));return new be(r,this._parents,e,t)}ft.prototype.interrupt=Ru;ft.prototype.transition=zd;const _t=e=>()=>e;function Vd(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function ve(e,t,n){this.k=e,this.x=t,this.y=n}ve.prototype={constructor:ve,scale:function(e){return e===1?this:new ve(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ve(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Xt=new ve(1,0,0);cs.prototype=ve.prototype;function cs(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Xt;return e.__zoom}function sn(e){e.stopImmediatePropagation()}function tt(e){e.preventDefault(),e.stopImmediatePropagation()}function Fd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Hd(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function to(){return this.__zoom||Xt}function Bd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function ls(){var e=Fd,t=Hd,n=Yd,r=Bd,o=qd,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,c=It,d=Bt("start","zoom","end"),u,l,f,h=500,p=150,x=0,m=10;function y(_){_.property("__zoom",to).on("wheel.zoom",b,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",A).filter(o).on("touchstart.zoom",N).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(_,P,L,$){var R=_.selection?_.selection():_;R.property("__zoom",to),_!==R?C(_,P,L,$):R.interrupt().each(function(){S(this,arguments).event($).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},y.scaleBy=function(_,P,L,$){y.scaleTo(_,function(){var R=this.__zoom.k,j=typeof P=="function"?P.apply(this,arguments):P;return R*j},L,$)},y.scaleTo=function(_,P,L,$){y.transform(_,function(){var R=t.apply(this,arguments),j=this.__zoom,F=L==null?w(R):typeof L=="function"?L.apply(this,arguments):L,q=j.invert(F),H=typeof P=="function"?P.apply(this,arguments):P;return n(g(v(j,H),F,q),R,i)},L,$)},y.translateBy=function(_,P,L,$){y.transform(_,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),i)},null,$)},y.translateTo=function(_,P,L,$,R){y.transform(_,function(){var j=t.apply(this,arguments),F=this.__zoom,q=$==null?w(j):typeof $=="function"?$.apply(this,arguments):$;return n(Xt.translate(q[0],q[1]).scale(F.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof L=="function"?-L.apply(this,arguments):-L),j,i)},$,R)};function v(_,P){return P=Math.max(s[0],Math.min(s[1],P)),P===_.k?_:new ve(P,_.x,_.y)}function g(_,P,L){var $=P[0]-L[0]*_.k,R=P[1]-L[1]*_.k;return $===_.x&&R===_.y?_:new ve(_.k,$,R)}function w(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function C(_,P,L,$){_.on("start.zoom",function(){S(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event($).end()}).tween("zoom",function(){var R=this,j=arguments,F=S(R,j).event($),q=t.apply(R,j),H=L==null?w(q):typeof L=="function"?L.apply(R,j):L,T=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),O=R.__zoom,z=typeof P=="function"?P.apply(R,j):P,B=c(O.invert(H).concat(T/O.k),z.invert(H).concat(T/z.k));return function(G){if(G===1)G=z;else{var Y=B(G),X=T/Y[2];G=new ve(X,H[0]-Y[0]*X,H[1]-Y[1]*X)}F.zoom(null,G)}})}function S(_,P,L){return!L&&_.__zooming||new I(_,P)}function I(_,P){this.that=_,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,P),this.taps=0}I.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,P){return this.mouse&&_!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var P=le(this.that).datum();d.call(_,this.that,new Vd(_,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:d}),P)}};function b(_,...P){if(!e.apply(this,arguments))return;var L=S(this,P).event(_),$=this.__zoom,R=Math.max(s[0],Math.min(s[1],$.k*Math.pow(2,r.apply(this,arguments)))),j=de(_);if(L.wheel)(L.mouse[0][0]!==j[0]||L.mouse[0][1]!==j[1])&&(L.mouse[1]=$.invert(L.mouse[0]=j)),clearTimeout(L.wheel);else{if($.k===R)return;L.mouse=[j,$.invert(j)],Lt(this),L.start()}tt(_),L.wheel=setTimeout(F,p),L.zoom("mouse",n(g(v($,R),L.mouse[0],L.mouse[1]),L.extent,i));function F(){L.wheel=null,L.end()}}function E(_,...P){if(f||!e.apply(this,arguments))return;var L=_.currentTarget,$=S(this,P,!0).event(_),R=le(_.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",T,!0),j=de(_,L),F=_.clientX,q=_.clientY;Ki(_.view),sn(_),$.mouse=[j,this.__zoom.invert(j)],Lt(this),$.start();function H(O){if(tt(O),!$.moved){var z=O.clientX-F,B=O.clientY-q;$.moved=z*z+B*B>x}$.event(O).zoom("mouse",n(g($.that.__zoom,$.mouse[0]=de(O,L),$.mouse[1]),$.extent,i))}function T(O){R.on("mousemove.zoom mouseup.zoom",null),Zi(O.view,$.moved),tt(O),$.event(O).end()}}function A(_,...P){if(e.apply(this,arguments)){var L=this.__zoom,$=de(_.changedTouches?_.changedTouches[0]:_,this),R=L.invert($),j=L.k*(_.shiftKey?.5:2),F=n(g(v(L,j),$,R),t.apply(this,P),i);tt(_),a>0?le(this).transition().duration(a).call(C,F,$,_):le(this).call(y.transform,F,$,_)}}function N(_,...P){if(e.apply(this,arguments)){var L=_.touches,$=L.length,R=S(this,P,_.changedTouches.length===$).event(_),j,F,q,H;for(sn(_),F=0;F<$;++F)q=L[F],H=de(q,this),H=[H,this.__zoom.invert(H),q.identifier],R.touch0?!R.touch1&&R.touch0[2]!==H[2]&&(R.touch1=H,R.taps=0):(R.touch0=H,j=!0,R.taps=1+!!u);u&&(u=clearTimeout(u)),j&&(R.taps<2&&(l=H[0],u=setTimeout(function(){u=null},h)),Lt(this),R.start())}}function k(_,...P){if(this.__zooming){var L=S(this,P).event(_),$=_.changedTouches,R=$.length,j,F,q,H;for(tt(_),j=0;j<R;++j)F=$[j],q=de(F,this),L.touch0&&L.touch0[2]===F.identifier?L.touch0[0]=q:L.touch1&&L.touch1[2]===F.identifier&&(L.touch1[0]=q);if(F=L.that.__zoom,L.touch1){var T=L.touch0[0],O=L.touch0[1],z=L.touch1[0],B=L.touch1[1],G=(G=z[0]-T[0])*G+(G=z[1]-T[1])*G,Y=(Y=B[0]-O[0])*Y+(Y=B[1]-O[1])*Y;F=v(F,Math.sqrt(G/Y)),q=[(T[0]+z[0])/2,(T[1]+z[1])/2],H=[(O[0]+B[0])/2,(O[1]+B[1])/2]}else if(L.touch0)q=L.touch0[0],H=L.touch0[1];else return;L.zoom("touch",n(g(F,q,H),L.extent,i))}}function D(_,...P){if(this.__zooming){var L=S(this,P).event(_),$=_.changedTouches,R=$.length,j,F;for(sn(_),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),j=0;j<R;++j)F=$[j],L.touch0&&L.touch0[2]===F.identifier?delete L.touch0:L.touch1&&L.touch1[2]===F.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(F=de(F,this),Math.hypot(l[0]-F[0],l[1]-F[1])<m)){var q=le(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return y.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:_t(+_),y):r},y.filter=function(_){return arguments.length?(e=typeof _=="function"?_:_t(!!_),y):e},y.touchable=function(_){return arguments.length?(o=typeof _=="function"?_:_t(!!_),y):o},y.extent=function(_){return arguments.length?(t=typeof _=="function"?_:_t([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),y):t},y.scaleExtent=function(_){return arguments.length?(s[0]=+_[0],s[1]=+_[1],y):[s[0],s[1]]},y.translateExtent=function(_){return arguments.length?(i[0][0]=+_[0][0],i[1][0]=+_[1][0],i[0][1]=+_[0][1],i[1][1]=+_[1][1],y):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},y.constrain=function(_){return arguments.length?(n=_,y):n},y.duration=function(_){return arguments.length?(a=+_,y):a},y.interpolate=function(_){return arguments.length?(c=_,y):c},y.on=function(){var _=d.on.apply(d,arguments);return _===d?y:_},y.clickDistance=function(_){return arguments.length?(x=(_=+_)*_,y):Math.sqrt(x)},y.tapDistance=function(_){return arguments.length?(m=+_,y):m},y}const me={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},at=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],us=["Enter"," ","Escape"],ds={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var qe;(function(e){e.Strict="strict",e.Loose="loose"})(qe||(qe={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var ct;(function(e){e.Partial="partial",e.Full="full"})(ct||(ct={}));const fs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ce;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ce||(Ce={}));var $t;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($t||($t={}));var K;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(K||(K={}));const no={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top};function hs(e){return e===null?null:e?"valid":"invalid"}const ps=e=>"id"in e&&"source"in e&&"target"in e,Gd=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Nr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ht=(e,t=[0,0])=>{const{width:n,height:r}=_e(e),o=e.origin??t,s=n*o[0],i=r*o[1];return{x:e.position.x-s,y:e.position.y-i}},Xd=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const s=typeof o=="string";let i=!t.nodeLookup&&!s?o:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(o):Nr(o)?o:t.nodeLookup.get(o.id));const a=i?zt(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Wt(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ut(n)},pt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=Wt(n,zt(o)),r=!0)}),r?Ut(n):{x:0,y:0,width:0,height:0}},Sr=(e,t,[n,r,o]=[0,0,1],s=!1,i=!1)=>{const a={...mt(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const d of e.values()){const{measured:u,selectable:l=!0,hidden:f=!1}=d;if(i&&!l||f)continue;const h=u.width??d.width??d.initialWidth??null,p=u.height??d.height??d.initialHeight??null,x=lt(a,Ge(d)),m=(h??0)*(p??0),y=s&&x>0;(!d.internals.handleBounds||y||x>=m||d.dragging)&&c.push(d)}return c},Wd=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Ud(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Kd({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=Ud(e,i),c=pt(a),d=Cr(c,t,n,(i==null?void 0:i.minZoom)??o,(i==null?void 0:i.maxZoom)??s,(i==null?void 0:i.padding)??.1);return await r.setViewport(d,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)}function gs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:c,y:d}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??r;let l=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!a)s==null||s("005",me.error005());else{const h=a.measured.width,p=a.measured.height;h&&p&&(l=[[c,d],[c+h,d+p]])}else a&&Xe(i.extent)&&(l=[[i.extent[0][0]+c,i.extent[0][1]+d],[i.extent[1][0]+c,i.extent[1][1]+d]]);const f=Xe(l)?Oe(t,l,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(s==null||s("015",me.error015())),{position:{x:f.x-c+(i.measured.width??0)*u[0],y:f.y-d+(i.measured.height??0)*u[1]},positionAbsolute:f}}async function Zd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const h=s.has(f.id),p=!h&&f.parentId&&i.find(x=>x.id===f.parentId);(h||p)&&i.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),u=Wd(i,c);for(const f of c)a.has(f.id)&&!u.find(p=>p.id===f.id)&&u.push(f);if(!o)return{edges:u,nodes:i};const l=await o({nodes:i,edges:u});return typeof l=="boolean"?l?{edges:u,nodes:i}:{edges:[],nodes:[]}:l}const Ye=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Oe=(e={x:0,y:0},t,n)=>({x:Ye(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ye(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ms(e,t,n){const{width:r,height:o}=_e(n),{x:s,y:i}=n.internals.positionAbsolute;return Oe(e,[[s,i],[s+r,i+o]],t)}const ro=(e,t,n)=>e<t?Ye(Math.abs(e-t),1,t)/t:e>n?-Ye(Math.abs(e-n),1,t)/t:0,ys=(e,t,n=15,r=40)=>{const o=ro(e.x,r,t.width-r)*n,s=ro(e.y,r,t.height-r)*n;return[o,s]},Wt=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),fr=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ut=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ge=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=Nr(e)?e.internals.positionAbsolute:ht(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},zt=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=Nr(e)?e.internals.positionAbsolute:ht(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},ws=(e,t)=>Ut(Wt(fr(e),fr(t))),lt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},oo=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),Qd=(e,t)=>{},gt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),mt=({x:e,y:t},[n,r,o],s=!1,i=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return s?gt(a,i):a},Vt=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function $e(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Jd(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=$e(e,n),o=$e(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=$e(e.top??e.y??0,n),o=$e(e.bottom??e.y??0,n),s=$e(e.left??e.x??0,t),i=$e(e.right??e.x??0,t);return{top:r,right:i,bottom:o,left:s,x:s+i,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ef(e,t,n,r,o,s){const{x:i,y:a}=Vt(e,[t,n,r]),{x:c,y:d}=Vt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=o-c,l=s-d;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(l)}}const Cr=(e,t,n,r,o,s)=>{const i=Jd(s,t,n),a=(t-i.x)/e.width,c=(n-i.y)/e.height,d=Math.min(a,c),u=Ye(d,r,o),l=e.x+e.width/2,f=e.y+e.height/2,h=t/2-l*u,p=n/2-f*u,x=ef(e,h,p,u,t,n),m={left:Math.min(x.left-i.left,0),top:Math.min(x.top-i.top,0),right:Math.min(x.right-i.right,0),bottom:Math.min(x.bottom-i.bottom,0)};return{x:h-m.left+m.right,y:p-m.top+m.bottom,zoom:u}},ut=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Xe(e){return e!=null&&e!=="parent"}function _e(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function xs(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function vs(e,t={width:0,height:0},n,r,o){const s={...e},i=r.get(n);if(i){const a=i.origin||o;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function io(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function tf(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function nf(e){return{...ds,...e||{}}}function ot(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:s,y:i}=he(e),a=mt({x:s-((o==null?void 0:o.left)??0),y:i-((o==null?void 0:o.top)??0)},r),{x:c,y:d}=n?gt(a,t):a;return{xSnapped:c,ySnapped:d,...a}}const kr=e=>({width:e.offsetWidth,height:e.offsetHeight}),bs=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},rf=["INPUT","SELECT","TEXTAREA"];function _s(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:rf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Es=e=>"clientX"in e,he=(e,t)=>{var s,i;const n=Es(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,o=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},so=(e,t,n,r,o)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:o,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...kr(i)}})};function Ns({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:s,targetControlX:i,targetControlY:a}){const c=e*.125+o*.375+i*.375+n*.125,d=t*.125+s*.375+a*.375+r*.125,u=Math.abs(c-e),l=Math.abs(d-t);return[c,d,u,l]}function Et(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ao({pos:e,x1:t,y1:n,x2:r,y2:o,c:s}){switch(e){case K.Left:return[t-Et(t-r,s),n];case K.Right:return[t+Et(r-t,s),n];case K.Top:return[t,n-Et(n-o,s)];case K.Bottom:return[t,n+Et(o-n,s)]}}function Mr({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:o,targetPosition:s=K.Top,curvature:i=.25}){const[a,c]=ao({pos:n,x1:e,y1:t,x2:r,y2:o,c:i}),[d,u]=ao({pos:s,x1:r,y1:o,x2:e,y2:t,c:i}),[l,f,h,p]=Ns({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${e},${t} C${a},${c} ${d},${u} ${r},${o}`,l,f,h,p]}function Ss({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,s=n<e?n+o:n-o,i=Math.abs(r-t)/2,a=r<t?r+i:r-i;return[s,a,o,i]}function of({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const i=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return i+a}function sf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const s=Wt(zt(e),zt(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return lt(i,Ut(s))>0}const af=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,cf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),lf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||af;let o;return ps(e)?o={...e}:o={...e,id:r(e)},cf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Cs({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,s,i,a]=Ss({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,s,i,a]}const co={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},uf=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},lo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function df({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:r=K.Top,center:o,offset:s,stepPosition:i}){const a=co[t],c=co[r],d={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+c.x*s,y:n.y+c.y*s},l=uf({source:d,sourcePosition:t,target:u}),f=l.x!==0?"x":"y",h=l[f];let p=[],x,m;const y={x:0,y:0},v={x:0,y:0},[,,g,w]=Ss({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(x=o.x??d.x+(u.x-d.x)*i,m=o.y??(d.y+u.y)/2):(x=o.x??(d.x+u.x)/2,m=o.y??d.y+(u.y-d.y)*i);const S=[{x,y:d.y},{x,y:u.y}],I=[{x:d.x,y:m},{x:u.x,y:m}];a[f]===h?p=f==="x"?S:I:p=f==="x"?I:S}else{const S=[{x:d.x,y:u.y}],I=[{x:u.x,y:d.y}];if(f==="x"?p=a.x===h?I:S:p=a.y===h?S:I,t===r){const k=Math.abs(e[f]-n[f]);if(k<=s){const D=Math.min(s-1,s-k);a[f]===h?y[f]=(d[f]>e[f]?-1:1)*D:v[f]=(u[f]>n[f]?-1:1)*D}}if(t!==r){const k=f==="x"?"y":"x",D=a[f]===c[k],_=d[k]>u[k],P=d[k]<u[k];(a[f]===1&&(!D&&_||D&&P)||a[f]!==1&&(!D&&P||D&&_))&&(p=f==="x"?S:I)}const b={x:d.x+y.x,y:d.y+y.y},E={x:u.x+v.x,y:u.y+v.y},A=Math.max(Math.abs(b.x-p[0].x),Math.abs(E.x-p[0].x)),N=Math.max(Math.abs(b.y-p[0].y),Math.abs(E.y-p[0].y));A>=N?(x=(b.x+E.x)/2,m=p[0].y):(x=p[0].x,m=(b.y+E.y)/2)}return[[e,{x:d.x+y.x,y:d.y+y.y},...p,{x:u.x+v.x,y:u.y+v.y},n],x,m,g,w]}function ff(e,t,n,r){const o=Math.min(lo(e,t)/2,lo(t,n)/2,r),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const d=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+o*d},${i}Q ${s},${i} ${s},${i+o*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${i+o*c}Q ${s},${i} ${s+o*a},${i}`}function hr({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:o,targetPosition:s=K.Top,borderRadius:i=5,centerX:a,centerY:c,offset:d=20,stepPosition:u=.5}){const[l,f,h,p,x]=df({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:s,center:{x:a,y:c},offset:d,stepPosition:u});return[l.reduce((y,v,g)=>{let w="";return g>0&&g<l.length-1?w=ff(l[g-1],v,l[g+1],i):w=`${g===0?"M":"L"}${v.x} ${v.y}`,y+=w,y},""),f,h,p,x]}function uo(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function hf(e){var l;const{sourceNode:t,targetNode:n}=e;if(!uo(t)||!uo(n))return null;const r=t.internals.handleBounds||fo(t.handles),o=n.internals.handleBounds||fo(n.handles),s=ho((r==null?void 0:r.source)??[],e.sourceHandle),i=ho(e.connectionMode===qe.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!s||!i)return(l=e.onError)==null||l.call(e,"008",me.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(s==null?void 0:s.position)||K.Bottom,c=(i==null?void 0:i.position)||K.Top,d=Re(t,s,a),u=Re(n,i,c);return{sourceX:d.x,sourceY:d.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function fo(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Re(e,t,n=K.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,s=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??_e(e);if(r)return{x:o+i/2,y:s+a/2};switch((t==null?void 0:t.position)??n){case K.Top:return{x:o+i/2,y:s};case K.Right:return{x:o+i,y:s+a/2};case K.Bottom:return{x:o+i/2,y:s+a};case K.Left:return{x:o,y:s+a/2}}}function ho(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function pr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function pf(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const d=pr(c,t);s.has(d)||(i.push({id:d,color:c.color||n,...c}),s.add(d))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const ks=1e3,gf=10,Ir={nodeOrigin:[0,0],nodeExtent:at,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},mf={...Ir,checkEquality:!0};function Ar(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function yf(e,t,n){const r=Ar(Ir,n);for(const o of e.values())if(o.parentId)Lr(o,e,t,r);else{const s=ht(o,r.nodeOrigin),i=Xe(o.extent)?o.extent:r.nodeExtent,a=Oe(s,i,_e(o));o.internals.positionAbsolute=a}}function wf(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const s={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(s):o.type==="target"&&r.push(s)}return{source:n,target:r}}function Tr(e){return e==="manual"}function gr(e,t,n,r={}){var d,u;const o=Ar(mf,r),s={i:0},i=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!Tr(o.zIndexMode)?ks:0;let c=e.length>0;t.clear(),n.clear();for(const l of e){let f=i.get(l.id);if(o.checkEquality&&l===(f==null?void 0:f.internals.userNode))t.set(l.id,f);else{const h=ht(l,o.nodeOrigin),p=Xe(l.extent)?l.extent:o.nodeExtent,x=Oe(h,p,_e(l));f={...o.defaults,...l,measured:{width:(d=l.measured)==null?void 0:d.width,height:(u=l.measured)==null?void 0:u.height},internals:{positionAbsolute:x,handleBounds:wf(l,f),z:Ms(l,a,o.zIndexMode),userNode:l}},t.set(l.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),l.parentId&&Lr(f,t,n,r,s)}return c}function xf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Lr(e,t,n,r,o){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:c}=Ar(Ir,r),d=e.parentId,u=t.get(d);if(!u){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xf(e,n),o&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++o.i,u.internals.z=u.internals.z+o.i*gf),o&&u.internals.rootParentIndex!==void 0&&(o.i=u.internals.rootParentIndex);const l=s&&!Tr(c)?ks:0,{x:f,y:h,z:p}=vf(e,u,i,a,l,c),{positionAbsolute:x}=e.internals,m=f!==x.x||h!==x.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:f,y:h}:x,z:p}})}function Ms(e,t,n){const r=fe(e.zIndex)?e.zIndex:0;return Tr(n)?r:r+(e.selected?t:0)}function vf(e,t,n,r,o,s){const{x:i,y:a}=t.internals.positionAbsolute,c=_e(e),d=ht(e,n),u=Xe(e.extent)?Oe(d,e.extent,c):d;let l=Oe({x:i+u.x,y:a+u.y},r,c);e.extent==="parent"&&(l=ms(l,c,t));const f=Ms(e,o,s),h=t.internals.z??0;return{x:l.x,y:l.y,z:h>=f?h+1:f}}function Pr(e,t,n,r=[0,0]){var i;const o=[],s=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const d=((i=s.get(a.parentId))==null?void 0:i.expandedRect)??Ge(c),u=ws(d,a.rect);s.set(a.parentId,{expandedRect:u,parent:c})}return s.size>0&&s.forEach(({expandedRect:a,parent:c},d)=>{var g;const u=c.internals.positionAbsolute,l=_e(c),f=c.origin??r,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,p=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,x=Math.max(l.width,Math.round(a.width)),m=Math.max(l.height,Math.round(a.height)),y=(x-l.width)*f[0],v=(m-l.height)*f[1];(h>0||p>0||y||v)&&(o.push({id:d,type:"position",position:{x:c.position.x-h+y,y:c.position.y-p+v}}),(g=n.get(d))==null||g.forEach(w=>{e.some(C=>C.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+p}})})),(l.width<a.width||l.height<a.height||h||p)&&o.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?f[0]*h-y:0),height:m+(p?f[1]*p-v:0)}})}),o}function bf(e,t,n,r,o,s,i){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const d=[],u=window.getComputedStyle(a),{m22:l}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const p=t.get(h.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),c=!0;continue}const x=kr(h.nodeElement),m=p.measured.width!==x.width||p.measured.height!==x.height;if(!!(x.width&&x.height&&(m||!p.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),g=Xe(p.extent)?p.extent:s;let{positionAbsolute:w}=p.internals;p.parentId&&p.extent==="parent"?w=ms(w,x,t.get(p.parentId)):g&&(w=Oe(w,g,x));const C={...p,measured:x,internals:{...p.internals,positionAbsolute:w,handleBounds:{source:so("source",h.nodeElement,v,l,p.id),target:so("target",h.nodeElement,v,l,p.id)}}};t.set(p.id,C),p.parentId&&Lr(C,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,m&&(d.push({id:p.id,type:"dimensions",dimensions:x}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:Ge(C,o)}))}}if(f.length>0){const h=Pr(f,t,n,o);d.push(...h)}return{changes:d,updatedInternals:c}}async function _f({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,s]],r),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function po(e,t,n,r,o,s){let i=o;const a=r.get(i)||new Map;r.set(i,a.set(n,t)),i=`${o}-${e}`;const c=r.get(i)||new Map;if(r.set(i,c.set(n,t)),s){i=`${o}-${e}-${s}`;const d=r.get(i)||new Map;r.set(i,d.set(n,t))}}function Is(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:s,sourceHandle:i=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:s,sourceHandle:i,targetHandle:a},d=`${o}-${i}--${s}-${a}`,u=`${s}-${a}--${o}-${i}`;po("source",c,u,e,o,i),po("target",c,d,e,s,a),t.set(r.id,r)}}function As(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:As(n,t):!1}function go(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Ef(e,t,n,r){const o=new Map;for(const[s,i]of e)if((i.selected||i.id===r)&&(!i.parentId||!As(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&o.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function an({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var i,a,c;const o=[];for(const[d,u]of t){const l=(i=n.get(d))==null?void 0:i.internals.userNode;l&&o.push({...l,position:u.position,dragging:r})}if(!e)return[o[0],o];const s=(a=n.get(e))==null?void 0:a.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:r}:o[0],o]}function Nf({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const s={x:n-o.distance.x,y:r-o.distance.y},i=gt(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Sf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let s={x:null,y:null},i=0,a=new Map,c=!1,d={x:0,y:0},u=null,l=!1,f=null,h=!1,p=!1,x=null;function m({noDragClassName:v,handleSelector:g,domNode:w,isSelectable:C,nodeId:S,nodeClickDistance:I=0}){f=le(w);function b({x:k,y:D}){const{nodeLookup:_,nodeExtent:P,snapGrid:L,snapToGrid:$,nodeOrigin:R,onNodeDrag:j,onSelectionDrag:F,onError:q,updateNodePositions:H}=t();s={x:k,y:D};let T=!1;const O=a.size>1,z=O&&P?fr(pt(a)):null,B=O&&$?Nf({dragItems:a,snapGrid:L,x:k,y:D}):null;for(const[G,Y]of a){if(!_.has(G))continue;let X={x:k-Y.distance.x,y:D-Y.distance.y};$&&(X=B?{x:Math.round(X.x+B.x),y:Math.round(X.y+B.y)}:gt(X,L));let Z=null;if(O&&P&&!Y.extent&&z){const{positionAbsolute:W}=Y.internals,J=W.x-z.x+P[0][0],ne=W.x+Y.measured.width-z.x2+P[1][0],ee=W.y-z.y+P[0][1],ce=W.y+Y.measured.height-z.y2+P[1][1];Z=[[J,ee],[ne,ce]]}const{position:Q,positionAbsolute:U}=gs({nodeId:G,nextPosition:X,nodeLookup:_,nodeExtent:Z||P,nodeOrigin:R,onError:q});T=T||Y.position.x!==Q.x||Y.position.y!==Q.y,Y.position=Q,Y.internals.positionAbsolute=U}if(p=p||T,!!T&&(H(a,!0),x&&(r||j||!S&&F))){const[G,Y]=an({nodeId:S,dragItems:a,nodeLookup:_});r==null||r(x,a,G,Y),j==null||j(x,G,Y),S||F==null||F(x,Y)}}async function E(){if(!u)return;const{transform:k,panBy:D,autoPanSpeed:_,autoPanOnNodeDrag:P}=t();if(!P){c=!1,cancelAnimationFrame(i);return}const[L,$]=ys(d,u,_);(L!==0||$!==0)&&(s.x=(s.x??0)-L/k[2],s.y=(s.y??0)-$/k[2],await D({x:L,y:$})&&b(s)),i=requestAnimationFrame(E)}function A(k){var O;const{nodeLookup:D,multiSelectionActive:_,nodesDraggable:P,transform:L,snapGrid:$,snapToGrid:R,selectNodesOnDrag:j,onNodeDragStart:F,onSelectionDragStart:q,unselectNodesAndEdges:H}=t();l=!0,(!j||!C)&&!_&&S&&((O=D.get(S))!=null&&O.selected||H()),C&&j&&S&&(e==null||e(S));const T=ot(k.sourceEvent,{transform:L,snapGrid:$,snapToGrid:R,containerBounds:u});if(s=T,a=Ef(D,P,T,S),a.size>0&&(n||F||!S&&q)){const[z,B]=an({nodeId:S,dragItems:a,nodeLookup:D});n==null||n(k.sourceEvent,a,z,B),F==null||F(k.sourceEvent,z,B),S||q==null||q(k.sourceEvent,B)}}const N=Qi().clickDistance(I).on("start",k=>{const{domNode:D,nodeDragThreshold:_,transform:P,snapGrid:L,snapToGrid:$}=t();u=(D==null?void 0:D.getBoundingClientRect())||null,h=!1,p=!1,x=k.sourceEvent,_===0&&A(k),s=ot(k.sourceEvent,{transform:P,snapGrid:L,snapToGrid:$,containerBounds:u}),d=he(k.sourceEvent,u)}).on("drag",k=>{const{autoPanOnNodeDrag:D,transform:_,snapGrid:P,snapToGrid:L,nodeDragThreshold:$,nodeLookup:R}=t(),j=ot(k.sourceEvent,{transform:_,snapGrid:P,snapToGrid:L,containerBounds:u});if(x=k.sourceEvent,(k.sourceEvent.type==="touchmove"&&k.sourceEvent.touches.length>1||S&&!R.has(S))&&(h=!0),!h){if(!c&&D&&l&&(c=!0,E()),!l){const F=he(k.sourceEvent,u),q=F.x-d.x,H=F.y-d.y;Math.sqrt(q*q+H*H)>$&&A(k)}(s.x!==j.xSnapped||s.y!==j.ySnapped)&&a&&l&&(d=he(k.sourceEvent,u),b(j))}}).on("end",k=>{if(!(!l||h)&&(c=!1,l=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:D,updateNodePositions:_,onNodeDragStop:P,onSelectionDragStop:L}=t();if(p&&(_(a,!1),p=!1),o||P||!S&&L){const[$,R]=an({nodeId:S,dragItems:a,nodeLookup:D,dragging:!1});o==null||o(k.sourceEvent,a,$,R),P==null||P(k.sourceEvent,$,R),S||L==null||L(k.sourceEvent,R)}}}).filter(k=>{const D=k.target;return!k.button&&(!v||!go(D,`.${v}`,w))&&(!g||go(D,g,w))});f.call(N)}function y(){f==null||f.on(".drag",null)}return{update:m,destroy:y}}function Cf(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())lt(o,Ge(s))>0&&r.push(s);return r}const kf=250;function Mf(e,t,n,r){var a,c;let o=[],s=1/0;const i=Cf(e,n,t+kf);for(const d of i){const u=[...((a=d.internals.handleBounds)==null?void 0:a.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const l of u){if(r.nodeId===l.nodeId&&r.type===l.type&&r.id===l.id)continue;const{x:f,y:h}=Re(d,l,l.position,!0),p=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));p>t||(p<s?(o=[{...l,x:f,y:h}],s=p):p===s&&o.push({...l,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const d=r.type==="source"?"target":"source";return o.find(u=>u.type===d)??o[0]}return o[0]}function Ts(e,t,n,r,o,s=!1){var d,u,l;const i=r.get(e);if(!i)return null;const a=o==="strict"?(d=i.internals.handleBounds)==null?void 0:d[t]:[...((u=i.internals.handleBounds)==null?void 0:u.source)??[],...((l=i.internals.handleBounds)==null?void 0:l.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&s?{...c,...Re(i,c,c.position,!0)}:c}function Ls(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function If(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ps=()=>!0;function Af(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:c,lib:d,autoPanOnConnect:u,flowId:l,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:x,onConnectEnd:m,isValidConnection:y=Ps,onReconnectEnd:v,updateConnection:g,getTransform:w,getFromHandle:C,autoPanSpeed:S,dragThreshold:I=1,handleDomNode:b}){const E=bs(e.target);let A=0,N;const{x:k,y:D}=he(e),_=Ls(s,b),P=a==null?void 0:a.getBoundingClientRect();let L=!1;if(!P||!_)return;const $=Ts(o,_,r,c,t);if(!$)return;let R=he(e,P),j=!1,F=null,q=!1,H=null;function T(){if(!u||!P)return;const[Q,U]=ys(R,P,S);f({x:Q,y:U}),A=requestAnimationFrame(T)}const O={...$,nodeId:o,type:_,position:$.position},z=c.get(o);let G={inProgress:!0,isValid:null,from:Re(z,O,K.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:z,to:R,toHandle:null,toPosition:no[O.position],toNode:null,pointer:R};function Y(){L=!0,g(G),p==null||p(e,{nodeId:o,handleId:r,handleType:_})}I===0&&Y();function X(Q){if(!L){const{x:ce,y:Ee}=he(Q),we=ce-k,Ie=Ee-D;if(!(we*we+Ie*Ie>I*I))return;Y()}if(!C()||!O){Z(Q);return}const U=w();R=he(Q,P),N=Mf(mt(R,U,!1,[1,1]),n,c,O),j||(T(),j=!0);const W=js(Q,{handle:N,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:i?"target":"source",isValidConnection:y,doc:E,lib:d,flowId:l,nodeLookup:c});H=W.handleDomNode,F=W.connection,q=If(!!N,W.isValid);const J=c.get(o),ne=J?Re(J,O,K.Left,!0):G.from,ee={...G,from:ne,isValid:q,to:W.toHandle&&q?Vt({x:W.toHandle.x,y:W.toHandle.y},U):R,toHandle:W.toHandle,toPosition:q&&W.toHandle?W.toHandle.position:no[O.position],toNode:W.toHandle?c.get(W.toHandle.nodeId):null,pointer:R};g(ee),G=ee}function Z(Q){if(!("touches"in Q&&Q.touches.length>0)){if(L){(N||H)&&F&&q&&(x==null||x(F));const{inProgress:U,...W}=G,J={...W,toPosition:G.toHandle?G.toPosition:null};m==null||m(Q,J),s&&(v==null||v(Q,J))}h(),cancelAnimationFrame(A),j=!1,q=!1,F=null,H=null,E.removeEventListener("mousemove",X),E.removeEventListener("mouseup",Z),E.removeEventListener("touchmove",X),E.removeEventListener("touchend",Z)}}E.addEventListener("mousemove",X),E.addEventListener("mouseup",Z),E.addEventListener("touchmove",X),E.addEventListener("touchend",Z)}function js(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:s,doc:i,lib:a,flowId:c,isValidConnection:d=Ps,nodeLookup:u}){const l=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:p}=he(e),x=i.elementFromPoint(h,p),m=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:f,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const v=Ls(void 0,m),g=m.getAttribute("data-nodeid"),w=m.getAttribute("data-handleid"),C=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!g||!v)return y;const I={source:l?g:r,sourceHandle:l?w:o,target:l?r:g,targetHandle:l?o:w};y.connection=I;const E=C&&S&&(n===qe.Strict?l&&v==="source"||!l&&v==="target":g!==r||w!==o);y.isValid=E&&d(I),y.toHandle=Ts(g,v,w,u,n,!0)}return y}const mr={onPointerDown:Af,isValid:js};function Tf({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=le(e);function s({translateExtent:a,width:c,height:d,zoomStep:u=1,pannable:l=!0,zoomable:f=!0,inversePan:h=!1}){const p=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const w=n(),C=g.sourceEvent.ctrlKey&&ut()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,I=w[2]*Math.pow(2,S*C);t.scaleTo(I)};let x=[0,0];const m=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(x=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},y=g=>{const w=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const C=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[C[0]-x[0],C[1]-x[1]];x=C;const I=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),b={x:w[0]-S[0]*I,y:w[1]-S[1]*I},E=[[0,0],[c,d]];t.setViewportConstrained({x:b.x,y:b.y,zoom:w[2]},E,a)},v=ls().on("start",m).on("zoom",l?y:null).on("zoom.wheel",f?p:null);o.call(v,{})}function i(){o.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const Kt=e=>({x:e.x,y:e.y,zoom:e.k}),cn=({x:e,y:t,zoom:n})=>Xt.translate(e,t).scale(n),ze=(e,t)=>e.target.closest(`.${t}`),Os=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Lf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ln=(e,t=0,n=Lf,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},Rs=e=>{const t=e.ctrlKey&&ut()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Pf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:d}){return u=>{if(ze(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const l=n.property("__zoom").k||1;if(u.ctrlKey&&i){const m=de(u),y=Rs(u),v=l*Math.pow(2,y);r.scaleTo(n,v,m,u);return}const f=u.deltaMode===1?20:1;let h=o===Pe.Vertical?0:u.deltaX*f,p=o===Pe.Horizontal?0:u.deltaY*f;!ut()&&u.shiftKey&&o!==Pe.Vertical&&(h=u.deltaY*f,p=0),r.translateBy(n,-(h/l)*s,-(p/l)*s,{internal:!0});const x=Kt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(u,x),e.panScrollTimeout=setTimeout(()=>{d==null||d(u,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(u,x))}}function jf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const s=r.type==="wheel",i=!t&&s&&!r.ctrlKey,a=ze(r,e);if(r.ctrlKey&&s&&a&&r.preventDefault(),i||a)return null;r.preventDefault(),n.call(this,r,o)}}function Of({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,i,a;if((s=r.sourceEvent)!=null&&s.internal)return;const o=Kt(r.transform);e.mouseButton=((i=r.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Rf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return s=>{var i,a;e.usedRightMouseButton=!!(n&&Os(t,e.mouseButton??0)),(i=s.sourceEvent)!=null&&i.sync||r([s.transform.x,s.transform.y,s.transform.k]),o&&!((a=s.sourceEvent)!=null&&a.internal)&&(o==null||o(s.sourceEvent,Kt(s.transform)))}}function Df({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:s}){return i=>{var a;if(!((a=i.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,s&&Os(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=Kt(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(i.sourceEvent,c)},n?150:0)}}}function $f({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:c,lib:d,connectionInProgress:u}){return l=>{var m;const f=e||t,h=n&&l.ctrlKey,p=l.type==="wheel";if(l.button===1&&l.type==="mousedown"&&(ze(l,`${d}-flow__node`)||ze(l,`${d}-flow__edge`)))return!0;if(!r&&!f&&!o&&!s&&!n||i||u&&!p||ze(l,a)&&p||ze(l,c)&&(!p||o&&p&&!e)||!n&&l.ctrlKey&&p)return!1;if(!n&&l.type==="touchstart"&&((m=l.touches)==null?void 0:m.length)>1)return l.preventDefault(),!1;if(!f&&!o&&!h&&p||!r&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(r)&&!r.includes(l.button)&&l.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||p)&&x}}function zf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),l=ls().scaleExtent([t,n]).translateExtent(r),f=le(e).call(l);v({x:o.x,y:o.y,zoom:Ye(o.zoom,t,n)},[[0,0],[u.width,u.height]],r);const h=f.on("wheel.zoom"),p=f.on("dblclick.zoom");l.wheelDelta(Rs);function x(N,k){return f?new Promise(D=>{l==null||l.interpolate((k==null?void 0:k.interpolate)==="linear"?rn:It).transform(ln(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>D(!0)),N)}):Promise.resolve(!1)}function m({noWheelClassName:N,noPanClassName:k,onPaneContextMenu:D,userSelectionActive:_,panOnScroll:P,panOnDrag:L,panOnScrollMode:$,panOnScrollSpeed:R,preventScrolling:j,zoomOnPinch:F,zoomOnScroll:q,zoomOnDoubleClick:H,zoomActivationKeyPressed:T,lib:O,onTransformChange:z,connectionInProgress:B,paneClickDistance:G,selectionOnDrag:Y}){_&&!d.isZoomingOrPanning&&y();const X=P&&!T&&!_;l.clickDistance(Y?1/0:!fe(G)||G<0?0:G);const Z=X?Pf({zoomPanValues:d,noWheelClassName:N,d3Selection:f,d3Zoom:l,panOnScrollMode:$,panOnScrollSpeed:R,zoomOnPinch:F,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):jf({noWheelClassName:N,preventScrolling:j,d3ZoomHandler:h});if(f.on("wheel.zoom",Z,{passive:!1}),!_){const U=Of({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:i});l.on("start",U);const W=Rf({zoomPanValues:d,panOnDrag:L,onPaneContextMenu:!!D,onPanZoom:s,onTransformChange:z});l.on("zoom",W);const J=Df({zoomPanValues:d,panOnDrag:L,panOnScroll:P,onPaneContextMenu:D,onPanZoomEnd:a,onDraggingChange:c});l.on("end",J)}const Q=$f({zoomActivationKeyPressed:T,panOnDrag:L,zoomOnScroll:q,panOnScroll:P,zoomOnDoubleClick:H,zoomOnPinch:F,userSelectionActive:_,noPanClassName:k,noWheelClassName:N,lib:O,connectionInProgress:B});l.filter(Q),H?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function y(){l.on("zoom",null)}async function v(N,k,D){const _=cn(N),P=l==null?void 0:l.constrain()(_,k,D);return P&&await x(P),new Promise(L=>L(P))}async function g(N,k){const D=cn(N);return await x(D,k),new Promise(_=>_(D))}function w(N){if(f){const k=cn(N),D=f.property("__zoom");(D.k!==N.zoom||D.x!==N.x||D.y!==N.y)&&(l==null||l.transform(f,k,null,{sync:!0}))}}function C(){const N=f?cs(f.node()):{x:0,y:0,k:1};return{x:N.x,y:N.y,zoom:N.k}}function S(N,k){return f?new Promise(D=>{l==null||l.interpolate((k==null?void 0:k.interpolate)==="linear"?rn:It).scaleTo(ln(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>D(!0)),N)}):Promise.resolve(!1)}function I(N,k){return f?new Promise(D=>{l==null||l.interpolate((k==null?void 0:k.interpolate)==="linear"?rn:It).scaleBy(ln(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>D(!0)),N)}):Promise.resolve(!1)}function b(N){l==null||l.scaleExtent(N)}function E(N){l==null||l.translateExtent(N)}function A(N){const k=!fe(N)||N<0?0:N;l==null||l.clickDistance(k)}return{update:m,destroy:y,setViewport:g,setViewportConstrained:v,getViewport:C,scaleTo:S,scaleBy:I,setScaleExtent:b,setTranslateExtent:E,syncViewport:w,setClickDistance:A}}var We;(function(e){e.Line="line",e.Handle="handle"})(We||(We={}));function Vf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:s}){const i=e-t,a=n-r,c=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&o&&(c[0]=c[0]*-1),a&&s&&(c[1]=c[1]*-1),c}function mo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Ne(e,t){return Math.max(0,t-e)}function Se(e,t){return Math.max(0,e-t)}function Nt(e,t,n){return Math.max(0,t-e,e-n)}function yo(e,t){return e?!t:t}function Ff(e,t,n,r,o,s,i,a){let{affectsX:c,affectsY:d}=t;const{isHorizontal:u,isVertical:l}=t,f=u&&l,{xSnapped:h,ySnapped:p}=n,{minWidth:x,maxWidth:m,minHeight:y,maxHeight:v}=r,{x:g,y:w,width:C,height:S,aspectRatio:I}=e;let b=Math.floor(u?h-e.pointerX:0),E=Math.floor(l?p-e.pointerY:0);const A=C+(c?-b:b),N=S+(d?-E:E),k=-s[0]*C,D=-s[1]*S;let _=Nt(A,x,m),P=Nt(N,y,v);if(i){let R=0,j=0;c&&b<0?R=Ne(g+b+k,i[0][0]):!c&&b>0&&(R=Se(g+A+k,i[1][0])),d&&E<0?j=Ne(w+E+D,i[0][1]):!d&&E>0&&(j=Se(w+N+D,i[1][1])),_=Math.max(_,R),P=Math.max(P,j)}if(a){let R=0,j=0;c&&b>0?R=Se(g+b,a[0][0]):!c&&b<0&&(R=Ne(g+A,a[1][0])),d&&E>0?j=Se(w+E,a[0][1]):!d&&E<0&&(j=Ne(w+N,a[1][1])),_=Math.max(_,R),P=Math.max(P,j)}if(o){if(u){const R=Nt(A/I,y,v)*I;if(_=Math.max(_,R),i){let j=0;!c&&!d||c&&!d&&f?j=Se(w+D+A/I,i[1][1])*I:j=Ne(w+D+(c?b:-b)/I,i[0][1])*I,_=Math.max(_,j)}if(a){let j=0;!c&&!d||c&&!d&&f?j=Ne(w+A/I,a[1][1])*I:j=Se(w+(c?b:-b)/I,a[0][1])*I,_=Math.max(_,j)}}if(l){const R=Nt(N*I,x,m)/I;if(P=Math.max(P,R),i){let j=0;!c&&!d||d&&!c&&f?j=Se(g+N*I+k,i[1][0])/I:j=Ne(g+(d?E:-E)*I+k,i[0][0])/I,P=Math.max(P,j)}if(a){let j=0;!c&&!d||d&&!c&&f?j=Ne(g+N*I,a[1][0])/I:j=Se(g+(d?E:-E)*I,a[0][0])/I,P=Math.max(P,j)}}}E=E+(E<0?P:-P),b=b+(b<0?_:-_),o&&(f?A>N*I?E=(yo(c,d)?-b:b)/I:b=(yo(c,d)?-E:E)*I:u?(E=b/I,d=c):(b=E*I,c=d));const L=c?g+b:g,$=d?w+E:w;return{width:C+(c?-b:b),height:S+(d?-E:E),x:s[0]*b*(c?-1:1)+L,y:s[1]*E*(d?-1:1)+$}}const Ds={width:0,height:0,x:0,y:0},Hf={...Ds,pointerX:0,pointerY:0,aspectRatio:1};function Bf(e){return[[0,0],[e.measured.width,e.measured.height]]}function qf(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,c=n[1]*i;return[[r-a,o-c],[r+s-a,o+i-c]]}function Yf({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const s=le(e);let i={controlDirection:mo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:d,boundaries:u,keepAspectRatio:l,resizeDirection:f,onResizeStart:h,onResize:p,onResizeEnd:x,shouldResize:m}){let y={...Ds},v={...Hf};i={boundaries:u,resizeDirection:f,keepAspectRatio:l,controlDirection:mo(d)};let g,w=null,C=[],S,I,b,E=!1;const A=Qi().on("start",N=>{const{nodeLookup:k,transform:D,snapGrid:_,snapToGrid:P,nodeOrigin:L,paneDomNode:$}=n();if(g=k.get(t),!g)return;w=($==null?void 0:$.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:j}=ot(N.sourceEvent,{transform:D,snapGrid:_,snapToGrid:P,containerBounds:w});y={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},v={...y,pointerX:R,pointerY:j,aspectRatio:y.width/y.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=k.get(g.parentId),I=S&&g.extent==="parent"?Bf(S):void 0),C=[],b=void 0;for(const[F,q]of k)if(q.parentId===t&&(C.push({id:F,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const H=qf(q,g,q.origin??L);b?b=[[Math.min(H[0][0],b[0][0]),Math.min(H[0][1],b[0][1])],[Math.max(H[1][0],b[1][0]),Math.max(H[1][1],b[1][1])]]:b=H}h==null||h(N,{...y})}).on("drag",N=>{const{transform:k,snapGrid:D,snapToGrid:_,nodeOrigin:P}=n(),L=ot(N.sourceEvent,{transform:k,snapGrid:D,snapToGrid:_,containerBounds:w}),$=[];if(!g)return;const{x:R,y:j,width:F,height:q}=y,H={},T=g.origin??P,{width:O,height:z,x:B,y:G}=Ff(v,i.controlDirection,L,i.boundaries,i.keepAspectRatio,T,I,b),Y=O!==F,X=z!==q,Z=B!==R&&Y,Q=G!==j&&X;if(!Z&&!Q&&!Y&&!X)return;if((Z||Q||T[0]===1||T[1]===1)&&(H.x=Z?B:y.x,H.y=Q?G:y.y,y.x=H.x,y.y=H.y,C.length>0)){const ne=B-R,ee=G-j;for(const ce of C)ce.position={x:ce.position.x-ne+T[0]*(O-F),y:ce.position.y-ee+T[1]*(z-q)},$.push(ce)}if((Y||X)&&(H.width=Y&&(!i.resizeDirection||i.resizeDirection==="horizontal")?O:y.width,H.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?z:y.height,y.width=H.width,y.height=H.height),S&&g.expandParent){const ne=T[0]*(H.width??0);H.x&&H.x<ne&&(y.x=ne,v.x=v.x-(H.x-ne));const ee=T[1]*(H.height??0);H.y&&H.y<ee&&(y.y=ee,v.y=v.y-(H.y-ee))}const U=Vf({width:y.width,prevWidth:F,height:y.height,prevHeight:q,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),W={...y,direction:U};(m==null?void 0:m(N,W))!==!1&&(E=!0,p==null||p(N,W),r(H,$))}).on("end",N=>{E&&(x==null||x(N,{...y}),o==null||o({...y}),E=!1)});s.call(A)}function c(){s.on(".drag",null)}return{update:a,destroy:c}}const Gf={},wo=e=>{let t;const n=new Set,r=(u,l)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=l??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,h))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Gf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,o,c);return c},Xf=e=>e?wo(e):wo,{useDebugValue:Wf}=Ac,{useSyncExternalStoreWithSelector:Uf}=Pc,Kf=e=>e;function $s(e,t=Kf,n){const r=Uf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Wf(r),r}const xo=(e,t)=>{const n=Xf(e),r=(o,s=t)=>$s(n,o,s);return Object.assign(r,n),r},Zf=(e,t)=>e?xo(e,t):xo;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Zt=V.createContext(null),Qf=Zt.Provider,zs=me.error001();function te(e,t){const n=V.useContext(Zt);if(n===null)throw new Error(zs);return $s(n,e,t)}function oe(){const e=V.useContext(Zt);if(e===null)throw new Error(zs);return V.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const vo={display:"none"},Jf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Vs="react-flow__node-desc",Fs="react-flow__edge-desc",eh="react-flow__aria-live",th=e=>e.ariaLiveMessage,nh=e=>e.ariaLabelConfig;function rh({rfId:e}){const t=te(th);return M.jsx("div",{id:`${eh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Jf,children:t})}function oh({rfId:e,disableKeyboardA11y:t}){const n=te(nh);return M.jsxs(M.Fragment,{children:[M.jsx("div",{id:`${Vs}-${e}`,style:vo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),M.jsx("div",{id:`${Fs}-${e}`,style:vo,children:n["edge.a11yDescription.default"]}),!t&&M.jsx(rh,{rfId:e})]})}const Qt=V.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},s)=>{const i=`${e}`.split("-");return M.jsx("div",{className:ae(["react-flow__panel",n,...i]),style:r,ref:s,...o,children:t})});Qt.displayName="Panel";function ih({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:M.jsx(Qt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:M.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const sh=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},St=e=>e.id;function ah(e,t){return re(e.selectedNodes.map(St),t.selectedNodes.map(St))&&re(e.selectedEdges.map(St),t.selectedEdges.map(St))}function ch({onSelectionChange:e}){const t=oe(),{selectedNodes:n,selectedEdges:r}=te(sh,ah);return V.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(s=>s(o))},[n,r,e]),null}const lh=e=>!!e.onSelectionChangeHandlers;function uh({onSelectionChange:e}){const t=te(lh);return e||t?M.jsx(ch,{onSelectionChange:e}):null}const Hs=[0,0],dh={x:0,y:0,zoom:1},fh=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],bo=[...fh,"rfId"],hh=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),_o={translateExtent:at,nodeOrigin:Hs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ph(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:c}=te(hh,re),d=oe();V.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=_o,a()}),[]);const u=V.useRef(_o);return V.useEffect(()=>{for(const l of bo){const f=e[l],h=u.current[l];f!==h&&(typeof e[l]>"u"||(l==="nodes"?t(f):l==="edges"?n(f):l==="minZoom"?r(f):l==="maxZoom"?o(f):l==="translateExtent"?s(f):l==="nodeExtent"?i(f):l==="ariaLabelConfig"?d.setState({ariaLabelConfig:nf(f)}):l==="fitView"?d.setState({fitViewQueued:f}):l==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[l]:f})))}u.current=e},bo.map(l=>e[l])),null}function Eo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function gh(e){var r;const[t,n]=V.useState(e==="system"?null:e);return V.useEffect(()=>{if(e!=="system"){n(e);return}const o=Eo(),s=()=>n(o!=null&&o.matches?"dark":"light");return s(),o==null||o.addEventListener("change",s),()=>{o==null||o.removeEventListener("change",s)}},[e]),t!==null?t:(r=Eo())!=null&&r.matches?"dark":"light"}const No=typeof document<"u"?document:null;function dt(e=null,t={target:No,actInsideInputWithModifier:!0}){const[n,r]=V.useState(!1),o=V.useRef(!1),s=V.useRef(new Set([])),[i,a]=V.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(l=>typeof l=="string").map(l=>l.replace("+",`
1
+ var Mc=Object.defineProperty;var Ic=(e,t,n)=>t in e?Mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ie=(e,t,n)=>Ic(e,typeof t!="symbol"?t+"":t,n);import{t as Ac,r as V,j as M,g as Tc}from"./index-dCyMex_p.js";import{N as Pt,S as ir,E as ke}from"./constants-z0QkAiYv.js";import{i as Te,c as Yr,a as Gr,b as Lc,d as rn,u as Pc,r as jc}from"./index-DlZhNCGR.js";function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ae(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Oc={value:()=>{}};function Bt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Mt(n)}function Mt(e){this._=e}function Rc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Mt.prototype=Bt.prototype={constructor:Mt,on:function(e,t){var n=this._,r=Rc(e+"",n),o,s=-1,i=r.length;if(arguments.length<2){for(;++s<i;)if((o=(e=r[s]).type)&&(o=Dc(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(o=(e=r[s]).type)n[o]=Xr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Xr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Mt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,s;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,o=s.length;r<o;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,s=r.length;o<s;++o)r[o].value.apply(t,n)}};function Dc(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Xr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=Oc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var sr="http://www.w3.org/1999/xhtml";const Wr={svg:"http://www.w3.org/2000/svg",xhtml:sr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Wr.hasOwnProperty(t)?{space:Wr[t],local:e}:e}function $c(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===sr&&t.documentElement.namespaceURI===sr?t.createElement(e):t.createElementNS(n,e)}}function zc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $i(e){var t=qt(e);return(t.local?zc:$c)(t)}function Vc(){}function xr(e){return e==null?Vc:function(){return this.querySelector(e)}}function Fc(e){typeof e!="function"&&(e=xr(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=new Array(i),c,d,u=0;u<i;++u)(c=s[u])&&(d=e.call(c,c.__data__,u,s))&&("__data__"in c&&(d.__data__=c.__data__),a[u]=d);return new ue(r,this._parents)}function Hc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Bc(){return[]}function zi(e){return e==null?Bc:function(){return this.querySelectorAll(e)}}function qc(e){return function(){return Hc(e.apply(this,arguments))}}function Yc(e){typeof e=="function"?e=qc(e):e=zi(e);for(var t=this._groups,n=t.length,r=[],o=[],s=0;s<n;++s)for(var i=t[s],a=i.length,c,d=0;d<a;++d)(c=i[d])&&(r.push(e.call(c,c.__data__,d,i)),o.push(c));return new ue(r,o)}function Vi(e){return function(){return this.matches(e)}}function Fi(e){return function(t){return t.matches(e)}}var Gc=Array.prototype.find;function Xc(e){return function(){return Gc.call(this.children,e)}}function Wc(){return this.firstElementChild}function Uc(e){return this.select(e==null?Wc:Xc(typeof e=="function"?e:Fi(e)))}var Kc=Array.prototype.filter;function Zc(){return Array.from(this.children)}function Qc(e){return function(){return Kc.call(this.children,e)}}function Jc(e){return this.selectAll(e==null?Zc:Qc(typeof e=="function"?e:Fi(e)))}function el(e){typeof e!="function"&&(e=Vi(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=[],c,d=0;d<i;++d)(c=s[d])&&e.call(c,c.__data__,d,s)&&a.push(c);return new ue(r,this._parents)}function Hi(e){return new Array(e.length)}function tl(){return new ue(this._enter||this._groups.map(Hi),this._parents)}function jt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}jt.prototype={constructor:jt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function nl(e){return function(){return e}}function rl(e,t,n,r,o,s){for(var i=0,a,c=t.length,d=s.length;i<d;++i)(a=t[i])?(a.__data__=s[i],r[i]=a):n[i]=new jt(e,s[i]);for(;i<c;++i)(a=t[i])&&(o[i]=a)}function ol(e,t,n,r,o,s,i){var a,c,d=new Map,u=t.length,l=s.length,f=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(f[a]=h=i.call(c,c.__data__,a,t)+"",d.has(h)?o[a]=c:d.set(h,c));for(a=0;a<l;++a)h=i.call(e,s[a],a,s)+"",(c=d.get(h))?(r[a]=c,c.__data__=s[a],d.delete(h)):n[a]=new jt(e,s[a]);for(a=0;a<u;++a)(c=t[a])&&d.get(f[a])===c&&(o[a]=c)}function il(e){return e.__data__}function sl(e,t){if(!arguments.length)return Array.from(this,il);var n=t?ol:rl,r=this._parents,o=this._groups;typeof e!="function"&&(e=nl(e));for(var s=o.length,i=new Array(s),a=new Array(s),c=new Array(s),d=0;d<s;++d){var u=r[d],l=o[d],f=l.length,h=al(e.call(u,u&&u.__data__,d,r)),p=h.length,x=a[d]=new Array(p),m=i[d]=new Array(p),y=c[d]=new Array(f);n(u,l,x,m,y,h,t);for(var v=0,g=0,w,C;v<p;++v)if(w=x[v]){for(v>=g&&(g=v+1);!(C=m[g])&&++g<p;);w._next=C||null}}return i=new ue(i,r),i._enter=a,i._exit=c,i}function al(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function cl(){return new ue(this._exit||this._groups.map(Hi),this._parents)}function ll(e,t,n){var r=this.enter(),o=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?s.remove():n(s),r&&o?r.merge(o).order():o}function ul(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,s=r.length,i=Math.min(o,s),a=new Array(o),c=0;c<i;++c)for(var d=n[c],u=r[c],l=d.length,f=a[c]=new Array(l),h,p=0;p<l;++p)(h=d[p]||u[p])&&(f[p]=h);for(;c<o;++c)a[c]=n[c];return new ue(a,this._parents)}function dl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,s=r[o],i;--o>=0;)(i=r[o])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function fl(e){e||(e=hl);function t(l,f){return l&&f?e(l.__data__,f.__data__):!l-!f}for(var n=this._groups,r=n.length,o=new Array(r),s=0;s<r;++s){for(var i=n[s],a=i.length,c=o[s]=new Array(a),d,u=0;u<a;++u)(d=i[u])&&(c[u]=d);c.sort(t)}return new ue(o,this._parents).order()}function hl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function gl(){return Array.from(this)}function ml(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,s=r.length;o<s;++o){var i=r[o];if(i)return i}return null}function yl(){let e=0;for(const t of this)++e;return e}function wl(){return!this.node()}function xl(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],s=0,i=o.length,a;s<i;++s)(a=o[s])&&e.call(a,a.__data__,s,o);return this}function vl(e){return function(){this.removeAttribute(e)}}function bl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _l(e,t){return function(){this.setAttribute(e,t)}}function El(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Nl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Sl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Cl(e,t){var n=qt(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?bl:vl:typeof t=="function"?n.local?Sl:Nl:n.local?El:_l)(n,t))}function Bi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function kl(e){return function(){this.style.removeProperty(e)}}function Ml(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Il(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Al(e,t,n){return arguments.length>1?this.each((t==null?kl:typeof t=="function"?Il:Ml)(e,t,n??"")):He(this.node(),e)}function He(e,t){return e.style.getPropertyValue(t)||Bi(e).getComputedStyle(e,null).getPropertyValue(t)}function Tl(e){return function(){delete this[e]}}function Ll(e,t){return function(){this[e]=t}}function Pl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function jl(e,t){return arguments.length>1?this.each((t==null?Tl:typeof t=="function"?Pl:Ll)(e,t)):this.node()[e]}function qi(e){return e.trim().split(/^|\s+/)}function vr(e){return e.classList||new Yi(e)}function Yi(e){this._node=e,this._names=qi(e.getAttribute("class")||"")}Yi.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Gi(e,t){for(var n=vr(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Xi(e,t){for(var n=vr(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Ol(e){return function(){Gi(this,e)}}function Rl(e){return function(){Xi(this,e)}}function Dl(e,t){return function(){(t.apply(this,arguments)?Gi:Xi)(this,e)}}function $l(e,t){var n=qi(e+"");if(arguments.length<2){for(var r=vr(this.node()),o=-1,s=n.length;++o<s;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?Dl:t?Ol:Rl)(n,t))}function zl(){this.textContent=""}function Vl(e){return function(){this.textContent=e}}function Fl(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Hl(e){return arguments.length?this.each(e==null?zl:(typeof e=="function"?Fl:Vl)(e)):this.node().textContent}function Bl(){this.innerHTML=""}function ql(e){return function(){this.innerHTML=e}}function Yl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Gl(e){return arguments.length?this.each(e==null?Bl:(typeof e=="function"?Yl:ql)(e)):this.node().innerHTML}function Xl(){this.nextSibling&&this.parentNode.appendChild(this)}function Wl(){return this.each(Xl)}function Ul(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Kl(){return this.each(Ul)}function Zl(e){var t=typeof e=="function"?e:$i(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ql(){return null}function Jl(e,t){var n=typeof e=="function"?e:$i(e),r=t==null?Ql:typeof t=="function"?t:xr(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function eu(){var e=this.parentNode;e&&e.removeChild(this)}function tu(){return this.each(eu)}function nu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ru(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ou(e){return this.select(e?ru:nu)}function iu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function su(e){return function(t){e.call(this,t,this.__data__)}}function au(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function cu(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,s;n<o;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function lu(e,t,n){return function(){var r=this.__on,o,s=su(t);if(r){for(var i=0,a=r.length;i<a;++i)if((o=r[i]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=s,o.options=n),o.value=t;return}}this.addEventListener(e.type,s,n),o={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(o):this.__on=[o]}}function uu(e,t,n){var r=au(e+""),o,s=r.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,d=a.length,u;c<d;++c)for(o=0,u=a[c];o<s;++o)if((i=r[o]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?lu:cu,o=0;o<s;++o)this.each(a(r[o],t,n));return this}function Wi(e,t,n){var r=Bi(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function du(e,t){return function(){return Wi(this,e,t)}}function fu(e,t){return function(){return Wi(this,e,t.apply(this,arguments))}}function hu(e,t){return this.each((typeof t=="function"?fu:du)(e,t))}function*pu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,s=r.length,i;o<s;++o)(i=r[o])&&(yield i)}var Ui=[null];function ue(e,t){this._groups=e,this._parents=t}function ft(){return new ue([[document.documentElement]],Ui)}function gu(){return this}ue.prototype=ft.prototype={constructor:ue,select:Fc,selectAll:Yc,selectChild:Uc,selectChildren:Jc,filter:el,data:sl,enter:tl,exit:cl,join:ll,merge:ul,selection:gu,order:dl,sort:fl,call:pl,nodes:gl,node:ml,size:yl,empty:wl,each:xl,attr:Cl,style:Al,property:jl,classed:$l,text:Hl,html:Gl,raise:Wl,lower:Kl,append:Zl,insert:Jl,remove:tu,clone:ou,datum:iu,on:uu,dispatch:hu,[Symbol.iterator]:pu};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Ui)}function mu(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=mu(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const yu={passive:!1},it={capture:!0,passive:!1};function on(e){e.stopImmediatePropagation()}function Fe(e){e.preventDefault(),e.stopImmediatePropagation()}function Ki(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Fe,it);"onselectstart"in t?n.on("selectstart.drag",Fe,it):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Zi(e,t){var n=e.document.documentElement,r=le(e).on("dragstart.drag",null);t&&(r.on("click.drag",Fe,it),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const vt=e=>()=>e;function ar(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:s,x:i,y:a,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}ar.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function wu(e){return!e.ctrlKey&&!e.button}function xu(){return this.parentNode}function vu(e,t){return t??{x:e.x,y:e.y}}function bu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qi(){var e=wu,t=xu,n=vu,r=bu,o={},s=Bt("start","drag","end"),i=0,a,c,d,u,l=0;function f(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",m).on("touchmove.drag",y,yu).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,C){if(!(u||!e.call(this,w,C))){var S=g(this,t.call(this,w,C),w,C,"mouse");S&&(le(w.view).on("mousemove.drag",p,it).on("mouseup.drag",x,it),Ki(w.view),on(w),d=!1,a=w.clientX,c=w.clientY,S("start",w))}}function p(w){if(Fe(w),!d){var C=w.clientX-a,S=w.clientY-c;d=C*C+S*S>l}o.mouse("drag",w)}function x(w){le(w.view).on("mousemove.drag mouseup.drag",null),Zi(w.view,d),Fe(w),o.mouse("end",w)}function m(w,C){if(e.call(this,w,C)){var S=w.changedTouches,I=t.call(this,w,C),b=S.length,E,A;for(E=0;E<b;++E)(A=g(this,I,w,C,S[E].identifier,S[E]))&&(on(w),A("start",w,S[E]))}}function y(w){var C=w.changedTouches,S=C.length,I,b;for(I=0;I<S;++I)(b=o[C[I].identifier])&&(Fe(w),b("drag",w,C[I]))}function v(w){var C=w.changedTouches,S=C.length,I,b;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),I=0;I<S;++I)(b=o[C[I].identifier])&&(on(w),b("end",w,C[I]))}function g(w,C,S,I,b,E){var A=s.copy(),N=de(E||S,C),k,D,_;if((_=n.call(w,new ar("beforestart",{sourceEvent:S,target:f,identifier:b,active:i,x:N[0],y:N[1],dx:0,dy:0,dispatch:A}),I))!=null)return k=_.x-N[0]||0,D=_.y-N[1]||0,function P(L,$,R){var j=N,F;switch(L){case"start":o[b]=P,F=i++;break;case"end":delete o[b],--i;case"drag":N=de(R||$,C),F=i;break}A.call(L,w,new ar(L,{sourceEvent:$,subject:_,target:f,identifier:b,active:F,x:N[0]+k,y:N[1]+D,dx:N[0]-j[0],dy:N[1]-j[1],dispatch:A}),I)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:vt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:vt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:vt(w),f):n},f.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:vt(!!w),f):r},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(l=(w=+w)*w,f):Math.sqrt(l)},f}var Ur=180/Math.PI,cr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ji(e,t,n,r,o,s){var i,a,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,i=-i),{translateX:o,translateY:s,rotate:Math.atan2(t,e)*Ur,skewX:Math.atan(c)*Ur,scaleX:i,scaleY:a}}var bt;function _u(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?cr:Ji(t.a,t.b,t.c,t.d,t.e,t.f)}function Eu(e){return e==null||(bt||(bt=document.createElementNS("http://www.w3.org/2000/svg","g")),bt.setAttribute("transform",e),!(e=bt.transform.baseVal.consolidate()))?cr:(e=e.matrix,Ji(e.a,e.b,e.c,e.d,e.e,e.f))}function es(e,t,n,r){function o(d){return d.length?d.pop()+" ":""}function s(d,u,l,f,h,p){if(d!==l||u!==f){var x=h.push("translate(",null,t,null,n);p.push({i:x-4,x:Te(d,l)},{i:x-2,x:Te(u,f)})}else(l||f)&&h.push("translate("+l+t+f+n)}function i(d,u,l,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:l.push(o(l)+"rotate(",null,r)-2,x:Te(d,u)})):u&&l.push(o(l)+"rotate("+u+r)}function a(d,u,l,f){d!==u?f.push({i:l.push(o(l)+"skewX(",null,r)-2,x:Te(d,u)}):u&&l.push(o(l)+"skewX("+u+r)}function c(d,u,l,f,h,p){if(d!==l||u!==f){var x=h.push(o(h)+"scale(",null,",",null,")");p.push({i:x-4,x:Te(d,l)},{i:x-2,x:Te(u,f)})}else(l!==1||f!==1)&&h.push(o(h)+"scale("+l+","+f+")")}return function(d,u){var l=[],f=[];return d=e(d),u=e(u),s(d.translateX,d.translateY,u.translateX,u.translateY,l,f),i(d.rotate,u.rotate,l,f),a(d.skewX,u.skewX,l,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,l,f),d=u=null,function(h){for(var p=-1,x=f.length,m;++p<x;)l[(m=f[p]).i]=m.x(h);return l.join("")}}}var Nu=es(_u,"px, ","px)","deg)"),Su=es(Eu,", ",")",")"),Cu=1e-12;function Kr(e){return((e=Math.exp(e))+1/e)/2}function ku(e){return((e=Math.exp(e))-1/e)/2}function Mu(e){return((e=Math.exp(2*e))-1)/(e+1)}const It=(function e(t,n,r){function o(s,i){var a=s[0],c=s[1],d=s[2],u=i[0],l=i[1],f=i[2],h=u-a,p=l-c,x=h*h+p*p,m,y;if(x<Cu)y=Math.log(f/d)/t,m=function(I){return[a+I*h,c+I*p,d*Math.exp(t*I*y)]};else{var v=Math.sqrt(x),g=(f*f-d*d+r*x)/(2*d*n*v),w=(f*f-d*d-r*x)/(2*f*n*v),C=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(w*w+1)-w);y=(S-C)/t,m=function(I){var b=I*y,E=Kr(C),A=d/(n*v)*(E*Mu(t*b+C)-ku(C));return[a+A*h,c+A*p,d*E/Kr(t*b+C)]}}return m.duration=y*1e3*t/Math.SQRT2,m}return o.rho=function(s){var i=Math.max(.001,+s),a=i*i,c=a*a;return e(i,a,c)},o})(Math.SQRT2,2,4);var Be=0,nt=0,et=0,ts=1e3,Ot,rt,Rt=0,je=0,Yt=0,st=typeof performance=="object"&&performance.now?performance:Date,ns=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function br(){return je||(ns(Iu),je=st.now()+Yt)}function Iu(){je=0}function Dt(){this._call=this._time=this._next=null}Dt.prototype=rs.prototype={constructor:Dt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?br():+n)+(t==null?0:+t),!this._next&&rt!==this&&(rt?rt._next=this:Ot=this,rt=this),this._call=e,this._time=n,lr()},stop:function(){this._call&&(this._call=null,this._time=1/0,lr())}};function rs(e,t,n){var r=new Dt;return r.restart(e,t,n),r}function Au(){br(),++Be;for(var e=Ot,t;e;)(t=je-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Be}function Zr(){je=(Rt=st.now())+Yt,Be=nt=0;try{Au()}finally{Be=0,Lu(),je=0}}function Tu(){var e=st.now(),t=e-Rt;t>ts&&(Yt-=t,Rt=e)}function Lu(){for(var e,t=Ot,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ot=n);rt=e,lr(r)}function lr(e){if(!Be){nt&&(nt=clearTimeout(nt));var t=e-je;t>24?(e<1/0&&(nt=setTimeout(Zr,e-st.now()-Yt)),et&&(et=clearInterval(et))):(et||(Rt=st.now(),et=setInterval(Tu,ts)),Be=1,ns(Zr))}}function Qr(e,t,n){var r=new Dt;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Pu=Bt("start","end","cancel","interrupt"),ju=[],os=0,Jr=1,ur=2,At=3,eo=4,dr=5,Tt=6;function Gt(e,t,n,r,o,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Ou(e,n,{name:t,index:r,group:o,on:Pu,tween:ju,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:os})}function _r(e,t){var n=ge(e,t);if(n.state>os)throw new Error("too late; already scheduled");return n}function ye(e,t){var n=ge(e,t);if(n.state>At)throw new Error("too late; already running");return n}function ge(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ou(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=rs(s,0,n.time);function s(d){n.state=Jr,n.timer.restart(i,n.delay,n.time),n.delay<=d&&i(d-n.delay)}function i(d){var u,l,f,h;if(n.state!==Jr)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===At)return Qr(i);h.state===eo?(h.state=Tt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Tt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Qr(function(){n.state===At&&(n.state=eo,n.timer.restart(a,n.delay,n.time),a(d))}),n.state=ur,n.on.call("start",e,e.__data__,n.index,n.group),n.state===ur){for(n.state=At,o=new Array(f=n.tween.length),u=0,l=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(o[++l]=h);o.length=l+1}}function a(d){for(var u=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=dr,1),l=-1,f=o.length;++l<f;)o[l].call(e,u);n.state===dr&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Tt,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function Lt(e,t){var n=e.__transition,r,o,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((r=n[i]).name!==t){s=!1;continue}o=r.state>ur&&r.state<dr,r.state=Tt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[i]}s&&delete e.__transition}}function Ru(e){return this.each(function(){Lt(this,e)})}function Du(e,t){var n,r;return function(){var o=ye(this,e),s=o.tween;if(s!==n){r=n=s;for(var i=0,a=r.length;i<a;++i)if(r[i].name===t){r=r.slice(),r.splice(i,1);break}}o.tween=r}}function $u(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var s=ye(this,e),i=s.tween;if(i!==r){o=(r=i).slice();for(var a={name:t,value:n},c=0,d=o.length;c<d;++c)if(o[c].name===t){o[c]=a;break}c===d&&o.push(a)}s.tween=o}}function zu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ge(this.node(),n).tween,o=0,s=r.length,i;o<s;++o)if((i=r[o]).name===e)return i.value;return null}return this.each((t==null?Du:$u)(n,e,t))}function Er(e,t,n){var r=e._id;return e.each(function(){var o=ye(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return ge(o,r).value[t]}}function is(e,t){var n;return(typeof t=="number"?Te:t instanceof Yr?Gr:(n=Yr(t))?(t=n,Gr):Lc)(e,t)}function Vu(e){return function(){this.removeAttribute(e)}}function Fu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hu(e,t,n){var r,o=n+"",s;return function(){var i=this.getAttribute(e);return i===o?null:i===r?s:s=t(r=i,n)}}function Bu(e,t,n){var r,o=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===o?null:i===r?s:s=t(r=i,n)}}function qu(e,t,n){var r,o,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=a+"",i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a)))}}function Yu(e,t,n){var r,o,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=a+"",i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a)))}}function Gu(e,t){var n=qt(e),r=n==="transform"?Su:is;return this.attrTween(e,typeof t=="function"?(n.local?Yu:qu)(n,r,Er(this,"attr."+e,t)):t==null?(n.local?Fu:Vu)(n):(n.local?Bu:Hu)(n,r,t))}function Xu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Wu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Uu(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Wu(e,s)),n}return o._value=t,o}function Ku(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Xu(e,s)),n}return o._value=t,o}function Zu(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=qt(e);return this.tween(n,(r.local?Uu:Ku)(r,t))}function Qu(e,t){return function(){_r(this,e).delay=+t.apply(this,arguments)}}function Ju(e,t){return t=+t,function(){_r(this,e).delay=t}}function ed(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Qu:Ju)(t,e)):ge(this.node(),t).delay}function td(e,t){return function(){ye(this,e).duration=+t.apply(this,arguments)}}function nd(e,t){return t=+t,function(){ye(this,e).duration=t}}function rd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?td:nd)(t,e)):ge(this.node(),t).duration}function od(e,t){if(typeof t!="function")throw new Error;return function(){ye(this,e).ease=t}}function id(e){var t=this._id;return arguments.length?this.each(od(t,e)):ge(this.node(),t).ease}function sd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ye(this,e).ease=n}}function ad(e){if(typeof e!="function")throw new Error;return this.each(sd(this._id,e))}function cd(e){typeof e!="function"&&(e=Vi(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=[],c,d=0;d<i;++d)(c=s[d])&&e.call(c,c.__data__,d,s)&&a.push(c);return new be(r,this._parents,this._name,this._id)}function ld(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,s=Math.min(r,o),i=new Array(r),a=0;a<s;++a)for(var c=t[a],d=n[a],u=c.length,l=i[a]=new Array(u),f,h=0;h<u;++h)(f=c[h]||d[h])&&(l[h]=f);for(;a<r;++a)i[a]=t[a];return new be(i,this._parents,this._name,this._id)}function ud(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function dd(e,t,n){var r,o,s=ud(t)?_r:ye;return function(){var i=s(this,e),a=i.on;a!==r&&(o=(r=a).copy()).on(t,n),i.on=o}}function fd(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(dd(n,e,t))}function hd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function pd(){return this.on("end.remove",hd(this._id))}function gd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=xr(e));for(var r=this._groups,o=r.length,s=new Array(o),i=0;i<o;++i)for(var a=r[i],c=a.length,d=s[i]=new Array(c),u,l,f=0;f<c;++f)(u=a[f])&&(l=e.call(u,u.__data__,f,a))&&("__data__"in u&&(l.__data__=u.__data__),d[f]=l,Gt(d[f],t,n,f,d,ge(u,n)));return new be(s,this._parents,t,n)}function md(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zi(e));for(var r=this._groups,o=r.length,s=[],i=[],a=0;a<o;++a)for(var c=r[a],d=c.length,u,l=0;l<d;++l)if(u=c[l]){for(var f=e.call(u,u.__data__,l,c),h,p=ge(u,n),x=0,m=f.length;x<m;++x)(h=f[x])&&Gt(h,t,n,x,f,p);s.push(f),i.push(u)}return new be(s,i,t,n)}var yd=ft.prototype.constructor;function wd(){return new yd(this._groups,this._parents)}function xd(e,t){var n,r,o;return function(){var s=He(this,e),i=(this.style.removeProperty(e),He(this,e));return s===i?null:s===n&&i===r?o:o=t(n=s,r=i)}}function ss(e){return function(){this.style.removeProperty(e)}}function vd(e,t,n){var r,o=n+"",s;return function(){var i=He(this,e);return i===o?null:i===r?s:s=t(r=i,n)}}function bd(e,t,n){var r,o,s;return function(){var i=He(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),He(this,e))),i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a))}}function _d(e,t){var n,r,o,s="style."+t,i="end."+s,a;return function(){var c=ye(this,e),d=c.on,u=c.value[s]==null?a||(a=ss(t)):void 0;(d!==n||o!==u)&&(r=(n=d).copy()).on(i,o=u),c.on=r}}function Ed(e,t,n){var r=(e+="")=="transform"?Nu:is;return t==null?this.styleTween(e,xd(e,r)).on("end.style."+e,ss(e)):typeof t=="function"?this.styleTween(e,bd(e,r,Er(this,"style."+e,t))).each(_d(this._id,e)):this.styleTween(e,vd(e,r,t),n).on("end.style."+e,null)}function Nd(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Sd(e,t,n){var r,o;function s(){var i=t.apply(this,arguments);return i!==o&&(r=(o=i)&&Nd(e,i,n)),r}return s._value=t,s}function Cd(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Sd(e,t,n??""))}function kd(e){return function(){this.textContent=e}}function Md(e){return function(){var t=e(this);this.textContent=t??""}}function Id(e){return this.tween("text",typeof e=="function"?Md(Er(this,"text",e)):kd(e==null?"":e+""))}function Ad(e){return function(t){this.textContent=e.call(this,t)}}function Td(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Ad(o)),t}return r._value=e,r}function Ld(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Td(e))}function Pd(){for(var e=this._name,t=this._id,n=as(),r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,d=0;d<a;++d)if(c=i[d]){var u=ge(c,t);Gt(c,e,n,d,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new be(r,this._parents,e,n)}function jd(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(s,i){var a={value:i},c={value:function(){--o===0&&s()}};n.each(function(){var d=ye(this,r),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),d.on=t}),o===0&&s()})}var Od=0;function be(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function as(){return++Od}var xe=ft.prototype;be.prototype={constructor:be,select:gd,selectAll:md,selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:cd,merge:ld,selection:wd,transition:Pd,call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:fd,attr:Gu,attrTween:Zu,style:Ed,styleTween:Cd,text:Id,textTween:Ld,remove:pd,tween:zu,delay:ed,duration:rd,ease:id,easeVarying:ad,end:jd,[Symbol.iterator]:xe[Symbol.iterator]};function Rd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Dd={time:null,delay:0,duration:250,ease:Rd};function $d(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function zd(e){var t,n;e instanceof be?(t=e._id,e=e._name):(t=as(),(n=Dd).time=br(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,d=0;d<a;++d)(c=i[d])&&Gt(c,e,t,d,i,n||$d(c,t));return new be(r,this._parents,e,t)}ft.prototype.interrupt=Ru;ft.prototype.transition=zd;const _t=e=>()=>e;function Vd(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function ve(e,t,n){this.k=e,this.x=t,this.y=n}ve.prototype={constructor:ve,scale:function(e){return e===1?this:new ve(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ve(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Xt=new ve(1,0,0);cs.prototype=ve.prototype;function cs(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Xt;return e.__zoom}function sn(e){e.stopImmediatePropagation()}function tt(e){e.preventDefault(),e.stopImmediatePropagation()}function Fd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Hd(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function to(){return this.__zoom||Xt}function Bd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function ls(){var e=Fd,t=Hd,n=Yd,r=Bd,o=qd,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,c=It,d=Bt("start","zoom","end"),u,l,f,h=500,p=150,x=0,m=10;function y(_){_.property("__zoom",to).on("wheel.zoom",b,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",A).filter(o).on("touchstart.zoom",N).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(_,P,L,$){var R=_.selection?_.selection():_;R.property("__zoom",to),_!==R?C(_,P,L,$):R.interrupt().each(function(){S(this,arguments).event($).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},y.scaleBy=function(_,P,L,$){y.scaleTo(_,function(){var R=this.__zoom.k,j=typeof P=="function"?P.apply(this,arguments):P;return R*j},L,$)},y.scaleTo=function(_,P,L,$){y.transform(_,function(){var R=t.apply(this,arguments),j=this.__zoom,F=L==null?w(R):typeof L=="function"?L.apply(this,arguments):L,q=j.invert(F),H=typeof P=="function"?P.apply(this,arguments):P;return n(g(v(j,H),F,q),R,i)},L,$)},y.translateBy=function(_,P,L,$){y.transform(_,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),i)},null,$)},y.translateTo=function(_,P,L,$,R){y.transform(_,function(){var j=t.apply(this,arguments),F=this.__zoom,q=$==null?w(j):typeof $=="function"?$.apply(this,arguments):$;return n(Xt.translate(q[0],q[1]).scale(F.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof L=="function"?-L.apply(this,arguments):-L),j,i)},$,R)};function v(_,P){return P=Math.max(s[0],Math.min(s[1],P)),P===_.k?_:new ve(P,_.x,_.y)}function g(_,P,L){var $=P[0]-L[0]*_.k,R=P[1]-L[1]*_.k;return $===_.x&&R===_.y?_:new ve(_.k,$,R)}function w(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function C(_,P,L,$){_.on("start.zoom",function(){S(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event($).end()}).tween("zoom",function(){var R=this,j=arguments,F=S(R,j).event($),q=t.apply(R,j),H=L==null?w(q):typeof L=="function"?L.apply(R,j):L,T=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),O=R.__zoom,z=typeof P=="function"?P.apply(R,j):P,B=c(O.invert(H).concat(T/O.k),z.invert(H).concat(T/z.k));return function(G){if(G===1)G=z;else{var Y=B(G),X=T/Y[2];G=new ve(X,H[0]-Y[0]*X,H[1]-Y[1]*X)}F.zoom(null,G)}})}function S(_,P,L){return!L&&_.__zooming||new I(_,P)}function I(_,P){this.that=_,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,P),this.taps=0}I.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,P){return this.mouse&&_!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var P=le(this.that).datum();d.call(_,this.that,new Vd(_,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:d}),P)}};function b(_,...P){if(!e.apply(this,arguments))return;var L=S(this,P).event(_),$=this.__zoom,R=Math.max(s[0],Math.min(s[1],$.k*Math.pow(2,r.apply(this,arguments)))),j=de(_);if(L.wheel)(L.mouse[0][0]!==j[0]||L.mouse[0][1]!==j[1])&&(L.mouse[1]=$.invert(L.mouse[0]=j)),clearTimeout(L.wheel);else{if($.k===R)return;L.mouse=[j,$.invert(j)],Lt(this),L.start()}tt(_),L.wheel=setTimeout(F,p),L.zoom("mouse",n(g(v($,R),L.mouse[0],L.mouse[1]),L.extent,i));function F(){L.wheel=null,L.end()}}function E(_,...P){if(f||!e.apply(this,arguments))return;var L=_.currentTarget,$=S(this,P,!0).event(_),R=le(_.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",T,!0),j=de(_,L),F=_.clientX,q=_.clientY;Ki(_.view),sn(_),$.mouse=[j,this.__zoom.invert(j)],Lt(this),$.start();function H(O){if(tt(O),!$.moved){var z=O.clientX-F,B=O.clientY-q;$.moved=z*z+B*B>x}$.event(O).zoom("mouse",n(g($.that.__zoom,$.mouse[0]=de(O,L),$.mouse[1]),$.extent,i))}function T(O){R.on("mousemove.zoom mouseup.zoom",null),Zi(O.view,$.moved),tt(O),$.event(O).end()}}function A(_,...P){if(e.apply(this,arguments)){var L=this.__zoom,$=de(_.changedTouches?_.changedTouches[0]:_,this),R=L.invert($),j=L.k*(_.shiftKey?.5:2),F=n(g(v(L,j),$,R),t.apply(this,P),i);tt(_),a>0?le(this).transition().duration(a).call(C,F,$,_):le(this).call(y.transform,F,$,_)}}function N(_,...P){if(e.apply(this,arguments)){var L=_.touches,$=L.length,R=S(this,P,_.changedTouches.length===$).event(_),j,F,q,H;for(sn(_),F=0;F<$;++F)q=L[F],H=de(q,this),H=[H,this.__zoom.invert(H),q.identifier],R.touch0?!R.touch1&&R.touch0[2]!==H[2]&&(R.touch1=H,R.taps=0):(R.touch0=H,j=!0,R.taps=1+!!u);u&&(u=clearTimeout(u)),j&&(R.taps<2&&(l=H[0],u=setTimeout(function(){u=null},h)),Lt(this),R.start())}}function k(_,...P){if(this.__zooming){var L=S(this,P).event(_),$=_.changedTouches,R=$.length,j,F,q,H;for(tt(_),j=0;j<R;++j)F=$[j],q=de(F,this),L.touch0&&L.touch0[2]===F.identifier?L.touch0[0]=q:L.touch1&&L.touch1[2]===F.identifier&&(L.touch1[0]=q);if(F=L.that.__zoom,L.touch1){var T=L.touch0[0],O=L.touch0[1],z=L.touch1[0],B=L.touch1[1],G=(G=z[0]-T[0])*G+(G=z[1]-T[1])*G,Y=(Y=B[0]-O[0])*Y+(Y=B[1]-O[1])*Y;F=v(F,Math.sqrt(G/Y)),q=[(T[0]+z[0])/2,(T[1]+z[1])/2],H=[(O[0]+B[0])/2,(O[1]+B[1])/2]}else if(L.touch0)q=L.touch0[0],H=L.touch0[1];else return;L.zoom("touch",n(g(F,q,H),L.extent,i))}}function D(_,...P){if(this.__zooming){var L=S(this,P).event(_),$=_.changedTouches,R=$.length,j,F;for(sn(_),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),j=0;j<R;++j)F=$[j],L.touch0&&L.touch0[2]===F.identifier?delete L.touch0:L.touch1&&L.touch1[2]===F.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(F=de(F,this),Math.hypot(l[0]-F[0],l[1]-F[1])<m)){var q=le(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return y.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:_t(+_),y):r},y.filter=function(_){return arguments.length?(e=typeof _=="function"?_:_t(!!_),y):e},y.touchable=function(_){return arguments.length?(o=typeof _=="function"?_:_t(!!_),y):o},y.extent=function(_){return arguments.length?(t=typeof _=="function"?_:_t([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),y):t},y.scaleExtent=function(_){return arguments.length?(s[0]=+_[0],s[1]=+_[1],y):[s[0],s[1]]},y.translateExtent=function(_){return arguments.length?(i[0][0]=+_[0][0],i[1][0]=+_[1][0],i[0][1]=+_[0][1],i[1][1]=+_[1][1],y):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},y.constrain=function(_){return arguments.length?(n=_,y):n},y.duration=function(_){return arguments.length?(a=+_,y):a},y.interpolate=function(_){return arguments.length?(c=_,y):c},y.on=function(){var _=d.on.apply(d,arguments);return _===d?y:_},y.clickDistance=function(_){return arguments.length?(x=(_=+_)*_,y):Math.sqrt(x)},y.tapDistance=function(_){return arguments.length?(m=+_,y):m},y}const me={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},at=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],us=["Enter"," ","Escape"],ds={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var qe;(function(e){e.Strict="strict",e.Loose="loose"})(qe||(qe={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var ct;(function(e){e.Partial="partial",e.Full="full"})(ct||(ct={}));const fs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ce;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ce||(Ce={}));var $t;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($t||($t={}));var K;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(K||(K={}));const no={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top};function hs(e){return e===null?null:e?"valid":"invalid"}const ps=e=>"id"in e&&"source"in e&&"target"in e,Gd=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Nr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ht=(e,t=[0,0])=>{const{width:n,height:r}=_e(e),o=e.origin??t,s=n*o[0],i=r*o[1];return{x:e.position.x-s,y:e.position.y-i}},Xd=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const s=typeof o=="string";let i=!t.nodeLookup&&!s?o:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(o):Nr(o)?o:t.nodeLookup.get(o.id));const a=i?zt(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Wt(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ut(n)},pt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=Wt(n,zt(o)),r=!0)}),r?Ut(n):{x:0,y:0,width:0,height:0}},Sr=(e,t,[n,r,o]=[0,0,1],s=!1,i=!1)=>{const a={...mt(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const d of e.values()){const{measured:u,selectable:l=!0,hidden:f=!1}=d;if(i&&!l||f)continue;const h=u.width??d.width??d.initialWidth??null,p=u.height??d.height??d.initialHeight??null,x=lt(a,Ge(d)),m=(h??0)*(p??0),y=s&&x>0;(!d.internals.handleBounds||y||x>=m||d.dragging)&&c.push(d)}return c},Wd=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Ud(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Kd({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=Ud(e,i),c=pt(a),d=Cr(c,t,n,(i==null?void 0:i.minZoom)??o,(i==null?void 0:i.maxZoom)??s,(i==null?void 0:i.padding)??.1);return await r.setViewport(d,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)}function gs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:c,y:d}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??r;let l=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!a)s==null||s("005",me.error005());else{const h=a.measured.width,p=a.measured.height;h&&p&&(l=[[c,d],[c+h,d+p]])}else a&&Xe(i.extent)&&(l=[[i.extent[0][0]+c,i.extent[0][1]+d],[i.extent[1][0]+c,i.extent[1][1]+d]]);const f=Xe(l)?Oe(t,l,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(s==null||s("015",me.error015())),{position:{x:f.x-c+(i.measured.width??0)*u[0],y:f.y-d+(i.measured.height??0)*u[1]},positionAbsolute:f}}async function Zd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const h=s.has(f.id),p=!h&&f.parentId&&i.find(x=>x.id===f.parentId);(h||p)&&i.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),u=Wd(i,c);for(const f of c)a.has(f.id)&&!u.find(p=>p.id===f.id)&&u.push(f);if(!o)return{edges:u,nodes:i};const l=await o({nodes:i,edges:u});return typeof l=="boolean"?l?{edges:u,nodes:i}:{edges:[],nodes:[]}:l}const Ye=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Oe=(e={x:0,y:0},t,n)=>({x:Ye(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ye(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ms(e,t,n){const{width:r,height:o}=_e(n),{x:s,y:i}=n.internals.positionAbsolute;return Oe(e,[[s,i],[s+r,i+o]],t)}const ro=(e,t,n)=>e<t?Ye(Math.abs(e-t),1,t)/t:e>n?-Ye(Math.abs(e-n),1,t)/t:0,ys=(e,t,n=15,r=40)=>{const o=ro(e.x,r,t.width-r)*n,s=ro(e.y,r,t.height-r)*n;return[o,s]},Wt=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),fr=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ut=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ge=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=Nr(e)?e.internals.positionAbsolute:ht(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},zt=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=Nr(e)?e.internals.positionAbsolute:ht(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},ws=(e,t)=>Ut(Wt(fr(e),fr(t))),lt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},oo=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),Qd=(e,t)=>{},gt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),mt=({x:e,y:t},[n,r,o],s=!1,i=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return s?gt(a,i):a},Vt=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function $e(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Jd(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=$e(e,n),o=$e(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=$e(e.top??e.y??0,n),o=$e(e.bottom??e.y??0,n),s=$e(e.left??e.x??0,t),i=$e(e.right??e.x??0,t);return{top:r,right:i,bottom:o,left:s,x:s+i,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ef(e,t,n,r,o,s){const{x:i,y:a}=Vt(e,[t,n,r]),{x:c,y:d}=Vt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=o-c,l=s-d;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(l)}}const Cr=(e,t,n,r,o,s)=>{const i=Jd(s,t,n),a=(t-i.x)/e.width,c=(n-i.y)/e.height,d=Math.min(a,c),u=Ye(d,r,o),l=e.x+e.width/2,f=e.y+e.height/2,h=t/2-l*u,p=n/2-f*u,x=ef(e,h,p,u,t,n),m={left:Math.min(x.left-i.left,0),top:Math.min(x.top-i.top,0),right:Math.min(x.right-i.right,0),bottom:Math.min(x.bottom-i.bottom,0)};return{x:h-m.left+m.right,y:p-m.top+m.bottom,zoom:u}},ut=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Xe(e){return e!=null&&e!=="parent"}function _e(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function xs(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function vs(e,t={width:0,height:0},n,r,o){const s={...e},i=r.get(n);if(i){const a=i.origin||o;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function io(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function tf(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function nf(e){return{...ds,...e||{}}}function ot(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:s,y:i}=he(e),a=mt({x:s-((o==null?void 0:o.left)??0),y:i-((o==null?void 0:o.top)??0)},r),{x:c,y:d}=n?gt(a,t):a;return{xSnapped:c,ySnapped:d,...a}}const kr=e=>({width:e.offsetWidth,height:e.offsetHeight}),bs=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},rf=["INPUT","SELECT","TEXTAREA"];function _s(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:rf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Es=e=>"clientX"in e,he=(e,t)=>{var s,i;const n=Es(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,o=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},so=(e,t,n,r,o)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:o,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...kr(i)}})};function Ns({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:s,targetControlX:i,targetControlY:a}){const c=e*.125+o*.375+i*.375+n*.125,d=t*.125+s*.375+a*.375+r*.125,u=Math.abs(c-e),l=Math.abs(d-t);return[c,d,u,l]}function Et(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ao({pos:e,x1:t,y1:n,x2:r,y2:o,c:s}){switch(e){case K.Left:return[t-Et(t-r,s),n];case K.Right:return[t+Et(r-t,s),n];case K.Top:return[t,n-Et(n-o,s)];case K.Bottom:return[t,n+Et(o-n,s)]}}function Mr({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:o,targetPosition:s=K.Top,curvature:i=.25}){const[a,c]=ao({pos:n,x1:e,y1:t,x2:r,y2:o,c:i}),[d,u]=ao({pos:s,x1:r,y1:o,x2:e,y2:t,c:i}),[l,f,h,p]=Ns({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${e},${t} C${a},${c} ${d},${u} ${r},${o}`,l,f,h,p]}function Ss({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,s=n<e?n+o:n-o,i=Math.abs(r-t)/2,a=r<t?r+i:r-i;return[s,a,o,i]}function of({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const i=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return i+a}function sf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const s=Wt(zt(e),zt(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return lt(i,Ut(s))>0}const af=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,cf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),lf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||af;let o;return ps(e)?o={...e}:o={...e,id:r(e)},cf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Cs({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,s,i,a]=Ss({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,s,i,a]}const co={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},uf=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},lo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function df({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:r=K.Top,center:o,offset:s,stepPosition:i}){const a=co[t],c=co[r],d={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+c.x*s,y:n.y+c.y*s},l=uf({source:d,sourcePosition:t,target:u}),f=l.x!==0?"x":"y",h=l[f];let p=[],x,m;const y={x:0,y:0},v={x:0,y:0},[,,g,w]=Ss({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(x=o.x??d.x+(u.x-d.x)*i,m=o.y??(d.y+u.y)/2):(x=o.x??(d.x+u.x)/2,m=o.y??d.y+(u.y-d.y)*i);const S=[{x,y:d.y},{x,y:u.y}],I=[{x:d.x,y:m},{x:u.x,y:m}];a[f]===h?p=f==="x"?S:I:p=f==="x"?I:S}else{const S=[{x:d.x,y:u.y}],I=[{x:u.x,y:d.y}];if(f==="x"?p=a.x===h?I:S:p=a.y===h?S:I,t===r){const k=Math.abs(e[f]-n[f]);if(k<=s){const D=Math.min(s-1,s-k);a[f]===h?y[f]=(d[f]>e[f]?-1:1)*D:v[f]=(u[f]>n[f]?-1:1)*D}}if(t!==r){const k=f==="x"?"y":"x",D=a[f]===c[k],_=d[k]>u[k],P=d[k]<u[k];(a[f]===1&&(!D&&_||D&&P)||a[f]!==1&&(!D&&P||D&&_))&&(p=f==="x"?S:I)}const b={x:d.x+y.x,y:d.y+y.y},E={x:u.x+v.x,y:u.y+v.y},A=Math.max(Math.abs(b.x-p[0].x),Math.abs(E.x-p[0].x)),N=Math.max(Math.abs(b.y-p[0].y),Math.abs(E.y-p[0].y));A>=N?(x=(b.x+E.x)/2,m=p[0].y):(x=p[0].x,m=(b.y+E.y)/2)}return[[e,{x:d.x+y.x,y:d.y+y.y},...p,{x:u.x+v.x,y:u.y+v.y},n],x,m,g,w]}function ff(e,t,n,r){const o=Math.min(lo(e,t)/2,lo(t,n)/2,r),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const d=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+o*d},${i}Q ${s},${i} ${s},${i+o*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${i+o*c}Q ${s},${i} ${s+o*a},${i}`}function hr({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:o,targetPosition:s=K.Top,borderRadius:i=5,centerX:a,centerY:c,offset:d=20,stepPosition:u=.5}){const[l,f,h,p,x]=df({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:s,center:{x:a,y:c},offset:d,stepPosition:u});return[l.reduce((y,v,g)=>{let w="";return g>0&&g<l.length-1?w=ff(l[g-1],v,l[g+1],i):w=`${g===0?"M":"L"}${v.x} ${v.y}`,y+=w,y},""),f,h,p,x]}function uo(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function hf(e){var l;const{sourceNode:t,targetNode:n}=e;if(!uo(t)||!uo(n))return null;const r=t.internals.handleBounds||fo(t.handles),o=n.internals.handleBounds||fo(n.handles),s=ho((r==null?void 0:r.source)??[],e.sourceHandle),i=ho(e.connectionMode===qe.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!s||!i)return(l=e.onError)==null||l.call(e,"008",me.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(s==null?void 0:s.position)||K.Bottom,c=(i==null?void 0:i.position)||K.Top,d=Re(t,s,a),u=Re(n,i,c);return{sourceX:d.x,sourceY:d.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function fo(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Re(e,t,n=K.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,s=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??_e(e);if(r)return{x:o+i/2,y:s+a/2};switch((t==null?void 0:t.position)??n){case K.Top:return{x:o+i/2,y:s};case K.Right:return{x:o+i,y:s+a/2};case K.Bottom:return{x:o+i/2,y:s+a};case K.Left:return{x:o,y:s+a/2}}}function ho(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function pr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function pf(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const d=pr(c,t);s.has(d)||(i.push({id:d,color:c.color||n,...c}),s.add(d))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const ks=1e3,gf=10,Ir={nodeOrigin:[0,0],nodeExtent:at,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},mf={...Ir,checkEquality:!0};function Ar(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function yf(e,t,n){const r=Ar(Ir,n);for(const o of e.values())if(o.parentId)Lr(o,e,t,r);else{const s=ht(o,r.nodeOrigin),i=Xe(o.extent)?o.extent:r.nodeExtent,a=Oe(s,i,_e(o));o.internals.positionAbsolute=a}}function wf(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const s={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(s):o.type==="target"&&r.push(s)}return{source:n,target:r}}function Tr(e){return e==="manual"}function gr(e,t,n,r={}){var d,u;const o=Ar(mf,r),s={i:0},i=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!Tr(o.zIndexMode)?ks:0;let c=e.length>0;t.clear(),n.clear();for(const l of e){let f=i.get(l.id);if(o.checkEquality&&l===(f==null?void 0:f.internals.userNode))t.set(l.id,f);else{const h=ht(l,o.nodeOrigin),p=Xe(l.extent)?l.extent:o.nodeExtent,x=Oe(h,p,_e(l));f={...o.defaults,...l,measured:{width:(d=l.measured)==null?void 0:d.width,height:(u=l.measured)==null?void 0:u.height},internals:{positionAbsolute:x,handleBounds:wf(l,f),z:Ms(l,a,o.zIndexMode),userNode:l}},t.set(l.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),l.parentId&&Lr(f,t,n,r,s)}return c}function xf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Lr(e,t,n,r,o){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:c}=Ar(Ir,r),d=e.parentId,u=t.get(d);if(!u){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xf(e,n),o&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++o.i,u.internals.z=u.internals.z+o.i*gf),o&&u.internals.rootParentIndex!==void 0&&(o.i=u.internals.rootParentIndex);const l=s&&!Tr(c)?ks:0,{x:f,y:h,z:p}=vf(e,u,i,a,l,c),{positionAbsolute:x}=e.internals,m=f!==x.x||h!==x.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:f,y:h}:x,z:p}})}function Ms(e,t,n){const r=fe(e.zIndex)?e.zIndex:0;return Tr(n)?r:r+(e.selected?t:0)}function vf(e,t,n,r,o,s){const{x:i,y:a}=t.internals.positionAbsolute,c=_e(e),d=ht(e,n),u=Xe(e.extent)?Oe(d,e.extent,c):d;let l=Oe({x:i+u.x,y:a+u.y},r,c);e.extent==="parent"&&(l=ms(l,c,t));const f=Ms(e,o,s),h=t.internals.z??0;return{x:l.x,y:l.y,z:h>=f?h+1:f}}function Pr(e,t,n,r=[0,0]){var i;const o=[],s=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const d=((i=s.get(a.parentId))==null?void 0:i.expandedRect)??Ge(c),u=ws(d,a.rect);s.set(a.parentId,{expandedRect:u,parent:c})}return s.size>0&&s.forEach(({expandedRect:a,parent:c},d)=>{var g;const u=c.internals.positionAbsolute,l=_e(c),f=c.origin??r,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,p=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,x=Math.max(l.width,Math.round(a.width)),m=Math.max(l.height,Math.round(a.height)),y=(x-l.width)*f[0],v=(m-l.height)*f[1];(h>0||p>0||y||v)&&(o.push({id:d,type:"position",position:{x:c.position.x-h+y,y:c.position.y-p+v}}),(g=n.get(d))==null||g.forEach(w=>{e.some(C=>C.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+p}})})),(l.width<a.width||l.height<a.height||h||p)&&o.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?f[0]*h-y:0),height:m+(p?f[1]*p-v:0)}})}),o}function bf(e,t,n,r,o,s,i){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const d=[],u=window.getComputedStyle(a),{m22:l}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const p=t.get(h.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),c=!0;continue}const x=kr(h.nodeElement),m=p.measured.width!==x.width||p.measured.height!==x.height;if(!!(x.width&&x.height&&(m||!p.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),g=Xe(p.extent)?p.extent:s;let{positionAbsolute:w}=p.internals;p.parentId&&p.extent==="parent"?w=ms(w,x,t.get(p.parentId)):g&&(w=Oe(w,g,x));const C={...p,measured:x,internals:{...p.internals,positionAbsolute:w,handleBounds:{source:so("source",h.nodeElement,v,l,p.id),target:so("target",h.nodeElement,v,l,p.id)}}};t.set(p.id,C),p.parentId&&Lr(C,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,m&&(d.push({id:p.id,type:"dimensions",dimensions:x}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:Ge(C,o)}))}}if(f.length>0){const h=Pr(f,t,n,o);d.push(...h)}return{changes:d,updatedInternals:c}}async function _f({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,s]],r),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function po(e,t,n,r,o,s){let i=o;const a=r.get(i)||new Map;r.set(i,a.set(n,t)),i=`${o}-${e}`;const c=r.get(i)||new Map;if(r.set(i,c.set(n,t)),s){i=`${o}-${e}-${s}`;const d=r.get(i)||new Map;r.set(i,d.set(n,t))}}function Is(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:s,sourceHandle:i=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:s,sourceHandle:i,targetHandle:a},d=`${o}-${i}--${s}-${a}`,u=`${s}-${a}--${o}-${i}`;po("source",c,u,e,o,i),po("target",c,d,e,s,a),t.set(r.id,r)}}function As(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:As(n,t):!1}function go(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Ef(e,t,n,r){const o=new Map;for(const[s,i]of e)if((i.selected||i.id===r)&&(!i.parentId||!As(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&o.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function an({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var i,a,c;const o=[];for(const[d,u]of t){const l=(i=n.get(d))==null?void 0:i.internals.userNode;l&&o.push({...l,position:u.position,dragging:r})}if(!e)return[o[0],o];const s=(a=n.get(e))==null?void 0:a.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:r}:o[0],o]}function Nf({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const s={x:n-o.distance.x,y:r-o.distance.y},i=gt(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Sf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let s={x:null,y:null},i=0,a=new Map,c=!1,d={x:0,y:0},u=null,l=!1,f=null,h=!1,p=!1,x=null;function m({noDragClassName:v,handleSelector:g,domNode:w,isSelectable:C,nodeId:S,nodeClickDistance:I=0}){f=le(w);function b({x:k,y:D}){const{nodeLookup:_,nodeExtent:P,snapGrid:L,snapToGrid:$,nodeOrigin:R,onNodeDrag:j,onSelectionDrag:F,onError:q,updateNodePositions:H}=t();s={x:k,y:D};let T=!1;const O=a.size>1,z=O&&P?fr(pt(a)):null,B=O&&$?Nf({dragItems:a,snapGrid:L,x:k,y:D}):null;for(const[G,Y]of a){if(!_.has(G))continue;let X={x:k-Y.distance.x,y:D-Y.distance.y};$&&(X=B?{x:Math.round(X.x+B.x),y:Math.round(X.y+B.y)}:gt(X,L));let Z=null;if(O&&P&&!Y.extent&&z){const{positionAbsolute:W}=Y.internals,J=W.x-z.x+P[0][0],ne=W.x+Y.measured.width-z.x2+P[1][0],ee=W.y-z.y+P[0][1],ce=W.y+Y.measured.height-z.y2+P[1][1];Z=[[J,ee],[ne,ce]]}const{position:Q,positionAbsolute:U}=gs({nodeId:G,nextPosition:X,nodeLookup:_,nodeExtent:Z||P,nodeOrigin:R,onError:q});T=T||Y.position.x!==Q.x||Y.position.y!==Q.y,Y.position=Q,Y.internals.positionAbsolute=U}if(p=p||T,!!T&&(H(a,!0),x&&(r||j||!S&&F))){const[G,Y]=an({nodeId:S,dragItems:a,nodeLookup:_});r==null||r(x,a,G,Y),j==null||j(x,G,Y),S||F==null||F(x,Y)}}async function E(){if(!u)return;const{transform:k,panBy:D,autoPanSpeed:_,autoPanOnNodeDrag:P}=t();if(!P){c=!1,cancelAnimationFrame(i);return}const[L,$]=ys(d,u,_);(L!==0||$!==0)&&(s.x=(s.x??0)-L/k[2],s.y=(s.y??0)-$/k[2],await D({x:L,y:$})&&b(s)),i=requestAnimationFrame(E)}function A(k){var O;const{nodeLookup:D,multiSelectionActive:_,nodesDraggable:P,transform:L,snapGrid:$,snapToGrid:R,selectNodesOnDrag:j,onNodeDragStart:F,onSelectionDragStart:q,unselectNodesAndEdges:H}=t();l=!0,(!j||!C)&&!_&&S&&((O=D.get(S))!=null&&O.selected||H()),C&&j&&S&&(e==null||e(S));const T=ot(k.sourceEvent,{transform:L,snapGrid:$,snapToGrid:R,containerBounds:u});if(s=T,a=Ef(D,P,T,S),a.size>0&&(n||F||!S&&q)){const[z,B]=an({nodeId:S,dragItems:a,nodeLookup:D});n==null||n(k.sourceEvent,a,z,B),F==null||F(k.sourceEvent,z,B),S||q==null||q(k.sourceEvent,B)}}const N=Qi().clickDistance(I).on("start",k=>{const{domNode:D,nodeDragThreshold:_,transform:P,snapGrid:L,snapToGrid:$}=t();u=(D==null?void 0:D.getBoundingClientRect())||null,h=!1,p=!1,x=k.sourceEvent,_===0&&A(k),s=ot(k.sourceEvent,{transform:P,snapGrid:L,snapToGrid:$,containerBounds:u}),d=he(k.sourceEvent,u)}).on("drag",k=>{const{autoPanOnNodeDrag:D,transform:_,snapGrid:P,snapToGrid:L,nodeDragThreshold:$,nodeLookup:R}=t(),j=ot(k.sourceEvent,{transform:_,snapGrid:P,snapToGrid:L,containerBounds:u});if(x=k.sourceEvent,(k.sourceEvent.type==="touchmove"&&k.sourceEvent.touches.length>1||S&&!R.has(S))&&(h=!0),!h){if(!c&&D&&l&&(c=!0,E()),!l){const F=he(k.sourceEvent,u),q=F.x-d.x,H=F.y-d.y;Math.sqrt(q*q+H*H)>$&&A(k)}(s.x!==j.xSnapped||s.y!==j.ySnapped)&&a&&l&&(d=he(k.sourceEvent,u),b(j))}}).on("end",k=>{if(!(!l||h)&&(c=!1,l=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:D,updateNodePositions:_,onNodeDragStop:P,onSelectionDragStop:L}=t();if(p&&(_(a,!1),p=!1),o||P||!S&&L){const[$,R]=an({nodeId:S,dragItems:a,nodeLookup:D,dragging:!1});o==null||o(k.sourceEvent,a,$,R),P==null||P(k.sourceEvent,$,R),S||L==null||L(k.sourceEvent,R)}}}).filter(k=>{const D=k.target;return!k.button&&(!v||!go(D,`.${v}`,w))&&(!g||go(D,g,w))});f.call(N)}function y(){f==null||f.on(".drag",null)}return{update:m,destroy:y}}function Cf(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())lt(o,Ge(s))>0&&r.push(s);return r}const kf=250;function Mf(e,t,n,r){var a,c;let o=[],s=1/0;const i=Cf(e,n,t+kf);for(const d of i){const u=[...((a=d.internals.handleBounds)==null?void 0:a.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const l of u){if(r.nodeId===l.nodeId&&r.type===l.type&&r.id===l.id)continue;const{x:f,y:h}=Re(d,l,l.position,!0),p=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));p>t||(p<s?(o=[{...l,x:f,y:h}],s=p):p===s&&o.push({...l,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const d=r.type==="source"?"target":"source";return o.find(u=>u.type===d)??o[0]}return o[0]}function Ts(e,t,n,r,o,s=!1){var d,u,l;const i=r.get(e);if(!i)return null;const a=o==="strict"?(d=i.internals.handleBounds)==null?void 0:d[t]:[...((u=i.internals.handleBounds)==null?void 0:u.source)??[],...((l=i.internals.handleBounds)==null?void 0:l.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&s?{...c,...Re(i,c,c.position,!0)}:c}function Ls(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function If(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ps=()=>!0;function Af(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:c,lib:d,autoPanOnConnect:u,flowId:l,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:x,onConnectEnd:m,isValidConnection:y=Ps,onReconnectEnd:v,updateConnection:g,getTransform:w,getFromHandle:C,autoPanSpeed:S,dragThreshold:I=1,handleDomNode:b}){const E=bs(e.target);let A=0,N;const{x:k,y:D}=he(e),_=Ls(s,b),P=a==null?void 0:a.getBoundingClientRect();let L=!1;if(!P||!_)return;const $=Ts(o,_,r,c,t);if(!$)return;let R=he(e,P),j=!1,F=null,q=!1,H=null;function T(){if(!u||!P)return;const[Q,U]=ys(R,P,S);f({x:Q,y:U}),A=requestAnimationFrame(T)}const O={...$,nodeId:o,type:_,position:$.position},z=c.get(o);let G={inProgress:!0,isValid:null,from:Re(z,O,K.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:z,to:R,toHandle:null,toPosition:no[O.position],toNode:null,pointer:R};function Y(){L=!0,g(G),p==null||p(e,{nodeId:o,handleId:r,handleType:_})}I===0&&Y();function X(Q){if(!L){const{x:ce,y:Ee}=he(Q),we=ce-k,Ie=Ee-D;if(!(we*we+Ie*Ie>I*I))return;Y()}if(!C()||!O){Z(Q);return}const U=w();R=he(Q,P),N=Mf(mt(R,U,!1,[1,1]),n,c,O),j||(T(),j=!0);const W=js(Q,{handle:N,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:i?"target":"source",isValidConnection:y,doc:E,lib:d,flowId:l,nodeLookup:c});H=W.handleDomNode,F=W.connection,q=If(!!N,W.isValid);const J=c.get(o),ne=J?Re(J,O,K.Left,!0):G.from,ee={...G,from:ne,isValid:q,to:W.toHandle&&q?Vt({x:W.toHandle.x,y:W.toHandle.y},U):R,toHandle:W.toHandle,toPosition:q&&W.toHandle?W.toHandle.position:no[O.position],toNode:W.toHandle?c.get(W.toHandle.nodeId):null,pointer:R};g(ee),G=ee}function Z(Q){if(!("touches"in Q&&Q.touches.length>0)){if(L){(N||H)&&F&&q&&(x==null||x(F));const{inProgress:U,...W}=G,J={...W,toPosition:G.toHandle?G.toPosition:null};m==null||m(Q,J),s&&(v==null||v(Q,J))}h(),cancelAnimationFrame(A),j=!1,q=!1,F=null,H=null,E.removeEventListener("mousemove",X),E.removeEventListener("mouseup",Z),E.removeEventListener("touchmove",X),E.removeEventListener("touchend",Z)}}E.addEventListener("mousemove",X),E.addEventListener("mouseup",Z),E.addEventListener("touchmove",X),E.addEventListener("touchend",Z)}function js(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:s,doc:i,lib:a,flowId:c,isValidConnection:d=Ps,nodeLookup:u}){const l=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:p}=he(e),x=i.elementFromPoint(h,p),m=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:f,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const v=Ls(void 0,m),g=m.getAttribute("data-nodeid"),w=m.getAttribute("data-handleid"),C=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!g||!v)return y;const I={source:l?g:r,sourceHandle:l?w:o,target:l?r:g,targetHandle:l?o:w};y.connection=I;const E=C&&S&&(n===qe.Strict?l&&v==="source"||!l&&v==="target":g!==r||w!==o);y.isValid=E&&d(I),y.toHandle=Ts(g,v,w,u,n,!0)}return y}const mr={onPointerDown:Af,isValid:js};function Tf({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=le(e);function s({translateExtent:a,width:c,height:d,zoomStep:u=1,pannable:l=!0,zoomable:f=!0,inversePan:h=!1}){const p=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const w=n(),C=g.sourceEvent.ctrlKey&&ut()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,I=w[2]*Math.pow(2,S*C);t.scaleTo(I)};let x=[0,0];const m=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(x=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},y=g=>{const w=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const C=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[C[0]-x[0],C[1]-x[1]];x=C;const I=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),b={x:w[0]-S[0]*I,y:w[1]-S[1]*I},E=[[0,0],[c,d]];t.setViewportConstrained({x:b.x,y:b.y,zoom:w[2]},E,a)},v=ls().on("start",m).on("zoom",l?y:null).on("zoom.wheel",f?p:null);o.call(v,{})}function i(){o.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const Kt=e=>({x:e.x,y:e.y,zoom:e.k}),cn=({x:e,y:t,zoom:n})=>Xt.translate(e,t).scale(n),ze=(e,t)=>e.target.closest(`.${t}`),Os=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Lf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ln=(e,t=0,n=Lf,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},Rs=e=>{const t=e.ctrlKey&&ut()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Pf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:d}){return u=>{if(ze(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const l=n.property("__zoom").k||1;if(u.ctrlKey&&i){const m=de(u),y=Rs(u),v=l*Math.pow(2,y);r.scaleTo(n,v,m,u);return}const f=u.deltaMode===1?20:1;let h=o===Pe.Vertical?0:u.deltaX*f,p=o===Pe.Horizontal?0:u.deltaY*f;!ut()&&u.shiftKey&&o!==Pe.Vertical&&(h=u.deltaY*f,p=0),r.translateBy(n,-(h/l)*s,-(p/l)*s,{internal:!0});const x=Kt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(u,x),e.panScrollTimeout=setTimeout(()=>{d==null||d(u,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(u,x))}}function jf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const s=r.type==="wheel",i=!t&&s&&!r.ctrlKey,a=ze(r,e);if(r.ctrlKey&&s&&a&&r.preventDefault(),i||a)return null;r.preventDefault(),n.call(this,r,o)}}function Of({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,i,a;if((s=r.sourceEvent)!=null&&s.internal)return;const o=Kt(r.transform);e.mouseButton=((i=r.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Rf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return s=>{var i,a;e.usedRightMouseButton=!!(n&&Os(t,e.mouseButton??0)),(i=s.sourceEvent)!=null&&i.sync||r([s.transform.x,s.transform.y,s.transform.k]),o&&!((a=s.sourceEvent)!=null&&a.internal)&&(o==null||o(s.sourceEvent,Kt(s.transform)))}}function Df({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:s}){return i=>{var a;if(!((a=i.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,s&&Os(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=Kt(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(i.sourceEvent,c)},n?150:0)}}}function $f({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:c,lib:d,connectionInProgress:u}){return l=>{var m;const f=e||t,h=n&&l.ctrlKey,p=l.type==="wheel";if(l.button===1&&l.type==="mousedown"&&(ze(l,`${d}-flow__node`)||ze(l,`${d}-flow__edge`)))return!0;if(!r&&!f&&!o&&!s&&!n||i||u&&!p||ze(l,a)&&p||ze(l,c)&&(!p||o&&p&&!e)||!n&&l.ctrlKey&&p)return!1;if(!n&&l.type==="touchstart"&&((m=l.touches)==null?void 0:m.length)>1)return l.preventDefault(),!1;if(!f&&!o&&!h&&p||!r&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(r)&&!r.includes(l.button)&&l.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||p)&&x}}function zf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),l=ls().scaleExtent([t,n]).translateExtent(r),f=le(e).call(l);v({x:o.x,y:o.y,zoom:Ye(o.zoom,t,n)},[[0,0],[u.width,u.height]],r);const h=f.on("wheel.zoom"),p=f.on("dblclick.zoom");l.wheelDelta(Rs);function x(N,k){return f?new Promise(D=>{l==null||l.interpolate((k==null?void 0:k.interpolate)==="linear"?rn:It).transform(ln(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>D(!0)),N)}):Promise.resolve(!1)}function m({noWheelClassName:N,noPanClassName:k,onPaneContextMenu:D,userSelectionActive:_,panOnScroll:P,panOnDrag:L,panOnScrollMode:$,panOnScrollSpeed:R,preventScrolling:j,zoomOnPinch:F,zoomOnScroll:q,zoomOnDoubleClick:H,zoomActivationKeyPressed:T,lib:O,onTransformChange:z,connectionInProgress:B,paneClickDistance:G,selectionOnDrag:Y}){_&&!d.isZoomingOrPanning&&y();const X=P&&!T&&!_;l.clickDistance(Y?1/0:!fe(G)||G<0?0:G);const Z=X?Pf({zoomPanValues:d,noWheelClassName:N,d3Selection:f,d3Zoom:l,panOnScrollMode:$,panOnScrollSpeed:R,zoomOnPinch:F,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):jf({noWheelClassName:N,preventScrolling:j,d3ZoomHandler:h});if(f.on("wheel.zoom",Z,{passive:!1}),!_){const U=Of({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:i});l.on("start",U);const W=Rf({zoomPanValues:d,panOnDrag:L,onPaneContextMenu:!!D,onPanZoom:s,onTransformChange:z});l.on("zoom",W);const J=Df({zoomPanValues:d,panOnDrag:L,panOnScroll:P,onPaneContextMenu:D,onPanZoomEnd:a,onDraggingChange:c});l.on("end",J)}const Q=$f({zoomActivationKeyPressed:T,panOnDrag:L,zoomOnScroll:q,panOnScroll:P,zoomOnDoubleClick:H,zoomOnPinch:F,userSelectionActive:_,noPanClassName:k,noWheelClassName:N,lib:O,connectionInProgress:B});l.filter(Q),H?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function y(){l.on("zoom",null)}async function v(N,k,D){const _=cn(N),P=l==null?void 0:l.constrain()(_,k,D);return P&&await x(P),new Promise(L=>L(P))}async function g(N,k){const D=cn(N);return await x(D,k),new Promise(_=>_(D))}function w(N){if(f){const k=cn(N),D=f.property("__zoom");(D.k!==N.zoom||D.x!==N.x||D.y!==N.y)&&(l==null||l.transform(f,k,null,{sync:!0}))}}function C(){const N=f?cs(f.node()):{x:0,y:0,k:1};return{x:N.x,y:N.y,zoom:N.k}}function S(N,k){return f?new Promise(D=>{l==null||l.interpolate((k==null?void 0:k.interpolate)==="linear"?rn:It).scaleTo(ln(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>D(!0)),N)}):Promise.resolve(!1)}function I(N,k){return f?new Promise(D=>{l==null||l.interpolate((k==null?void 0:k.interpolate)==="linear"?rn:It).scaleBy(ln(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>D(!0)),N)}):Promise.resolve(!1)}function b(N){l==null||l.scaleExtent(N)}function E(N){l==null||l.translateExtent(N)}function A(N){const k=!fe(N)||N<0?0:N;l==null||l.clickDistance(k)}return{update:m,destroy:y,setViewport:g,setViewportConstrained:v,getViewport:C,scaleTo:S,scaleBy:I,setScaleExtent:b,setTranslateExtent:E,syncViewport:w,setClickDistance:A}}var We;(function(e){e.Line="line",e.Handle="handle"})(We||(We={}));function Vf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:s}){const i=e-t,a=n-r,c=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&o&&(c[0]=c[0]*-1),a&&s&&(c[1]=c[1]*-1),c}function mo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Ne(e,t){return Math.max(0,t-e)}function Se(e,t){return Math.max(0,e-t)}function Nt(e,t,n){return Math.max(0,t-e,e-n)}function yo(e,t){return e?!t:t}function Ff(e,t,n,r,o,s,i,a){let{affectsX:c,affectsY:d}=t;const{isHorizontal:u,isVertical:l}=t,f=u&&l,{xSnapped:h,ySnapped:p}=n,{minWidth:x,maxWidth:m,minHeight:y,maxHeight:v}=r,{x:g,y:w,width:C,height:S,aspectRatio:I}=e;let b=Math.floor(u?h-e.pointerX:0),E=Math.floor(l?p-e.pointerY:0);const A=C+(c?-b:b),N=S+(d?-E:E),k=-s[0]*C,D=-s[1]*S;let _=Nt(A,x,m),P=Nt(N,y,v);if(i){let R=0,j=0;c&&b<0?R=Ne(g+b+k,i[0][0]):!c&&b>0&&(R=Se(g+A+k,i[1][0])),d&&E<0?j=Ne(w+E+D,i[0][1]):!d&&E>0&&(j=Se(w+N+D,i[1][1])),_=Math.max(_,R),P=Math.max(P,j)}if(a){let R=0,j=0;c&&b>0?R=Se(g+b,a[0][0]):!c&&b<0&&(R=Ne(g+A,a[1][0])),d&&E>0?j=Se(w+E,a[0][1]):!d&&E<0&&(j=Ne(w+N,a[1][1])),_=Math.max(_,R),P=Math.max(P,j)}if(o){if(u){const R=Nt(A/I,y,v)*I;if(_=Math.max(_,R),i){let j=0;!c&&!d||c&&!d&&f?j=Se(w+D+A/I,i[1][1])*I:j=Ne(w+D+(c?b:-b)/I,i[0][1])*I,_=Math.max(_,j)}if(a){let j=0;!c&&!d||c&&!d&&f?j=Ne(w+A/I,a[1][1])*I:j=Se(w+(c?b:-b)/I,a[0][1])*I,_=Math.max(_,j)}}if(l){const R=Nt(N*I,x,m)/I;if(P=Math.max(P,R),i){let j=0;!c&&!d||d&&!c&&f?j=Se(g+N*I+k,i[1][0])/I:j=Ne(g+(d?E:-E)*I+k,i[0][0])/I,P=Math.max(P,j)}if(a){let j=0;!c&&!d||d&&!c&&f?j=Ne(g+N*I,a[1][0])/I:j=Se(g+(d?E:-E)*I,a[0][0])/I,P=Math.max(P,j)}}}E=E+(E<0?P:-P),b=b+(b<0?_:-_),o&&(f?A>N*I?E=(yo(c,d)?-b:b)/I:b=(yo(c,d)?-E:E)*I:u?(E=b/I,d=c):(b=E*I,c=d));const L=c?g+b:g,$=d?w+E:w;return{width:C+(c?-b:b),height:S+(d?-E:E),x:s[0]*b*(c?-1:1)+L,y:s[1]*E*(d?-1:1)+$}}const Ds={width:0,height:0,x:0,y:0},Hf={...Ds,pointerX:0,pointerY:0,aspectRatio:1};function Bf(e){return[[0,0],[e.measured.width,e.measured.height]]}function qf(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,c=n[1]*i;return[[r-a,o-c],[r+s-a,o+i-c]]}function Yf({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const s=le(e);let i={controlDirection:mo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:d,boundaries:u,keepAspectRatio:l,resizeDirection:f,onResizeStart:h,onResize:p,onResizeEnd:x,shouldResize:m}){let y={...Ds},v={...Hf};i={boundaries:u,resizeDirection:f,keepAspectRatio:l,controlDirection:mo(d)};let g,w=null,C=[],S,I,b,E=!1;const A=Qi().on("start",N=>{const{nodeLookup:k,transform:D,snapGrid:_,snapToGrid:P,nodeOrigin:L,paneDomNode:$}=n();if(g=k.get(t),!g)return;w=($==null?void 0:$.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:j}=ot(N.sourceEvent,{transform:D,snapGrid:_,snapToGrid:P,containerBounds:w});y={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},v={...y,pointerX:R,pointerY:j,aspectRatio:y.width/y.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=k.get(g.parentId),I=S&&g.extent==="parent"?Bf(S):void 0),C=[],b=void 0;for(const[F,q]of k)if(q.parentId===t&&(C.push({id:F,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const H=qf(q,g,q.origin??L);b?b=[[Math.min(H[0][0],b[0][0]),Math.min(H[0][1],b[0][1])],[Math.max(H[1][0],b[1][0]),Math.max(H[1][1],b[1][1])]]:b=H}h==null||h(N,{...y})}).on("drag",N=>{const{transform:k,snapGrid:D,snapToGrid:_,nodeOrigin:P}=n(),L=ot(N.sourceEvent,{transform:k,snapGrid:D,snapToGrid:_,containerBounds:w}),$=[];if(!g)return;const{x:R,y:j,width:F,height:q}=y,H={},T=g.origin??P,{width:O,height:z,x:B,y:G}=Ff(v,i.controlDirection,L,i.boundaries,i.keepAspectRatio,T,I,b),Y=O!==F,X=z!==q,Z=B!==R&&Y,Q=G!==j&&X;if(!Z&&!Q&&!Y&&!X)return;if((Z||Q||T[0]===1||T[1]===1)&&(H.x=Z?B:y.x,H.y=Q?G:y.y,y.x=H.x,y.y=H.y,C.length>0)){const ne=B-R,ee=G-j;for(const ce of C)ce.position={x:ce.position.x-ne+T[0]*(O-F),y:ce.position.y-ee+T[1]*(z-q)},$.push(ce)}if((Y||X)&&(H.width=Y&&(!i.resizeDirection||i.resizeDirection==="horizontal")?O:y.width,H.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?z:y.height,y.width=H.width,y.height=H.height),S&&g.expandParent){const ne=T[0]*(H.width??0);H.x&&H.x<ne&&(y.x=ne,v.x=v.x-(H.x-ne));const ee=T[1]*(H.height??0);H.y&&H.y<ee&&(y.y=ee,v.y=v.y-(H.y-ee))}const U=Vf({width:y.width,prevWidth:F,height:y.height,prevHeight:q,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),W={...y,direction:U};(m==null?void 0:m(N,W))!==!1&&(E=!0,p==null||p(N,W),r(H,$))}).on("end",N=>{E&&(x==null||x(N,{...y}),o==null||o({...y}),E=!1)});s.call(A)}function c(){s.on(".drag",null)}return{update:a,destroy:c}}const Gf={},wo=e=>{let t;const n=new Set,r=(u,l)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=l??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,h))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Gf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,o,c);return c},Xf=e=>e?wo(e):wo,{useDebugValue:Wf}=Ac,{useSyncExternalStoreWithSelector:Uf}=Pc,Kf=e=>e;function $s(e,t=Kf,n){const r=Uf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Wf(r),r}const xo=(e,t)=>{const n=Xf(e),r=(o,s=t)=>$s(n,o,s);return Object.assign(r,n),r},Zf=(e,t)=>e?xo(e,t):xo;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Zt=V.createContext(null),Qf=Zt.Provider,zs=me.error001();function te(e,t){const n=V.useContext(Zt);if(n===null)throw new Error(zs);return $s(n,e,t)}function oe(){const e=V.useContext(Zt);if(e===null)throw new Error(zs);return V.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const vo={display:"none"},Jf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Vs="react-flow__node-desc",Fs="react-flow__edge-desc",eh="react-flow__aria-live",th=e=>e.ariaLiveMessage,nh=e=>e.ariaLabelConfig;function rh({rfId:e}){const t=te(th);return M.jsx("div",{id:`${eh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Jf,children:t})}function oh({rfId:e,disableKeyboardA11y:t}){const n=te(nh);return M.jsxs(M.Fragment,{children:[M.jsx("div",{id:`${Vs}-${e}`,style:vo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),M.jsx("div",{id:`${Fs}-${e}`,style:vo,children:n["edge.a11yDescription.default"]}),!t&&M.jsx(rh,{rfId:e})]})}const Qt=V.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},s)=>{const i=`${e}`.split("-");return M.jsx("div",{className:ae(["react-flow__panel",n,...i]),style:r,ref:s,...o,children:t})});Qt.displayName="Panel";function ih({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:M.jsx(Qt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:M.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const sh=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},St=e=>e.id;function ah(e,t){return re(e.selectedNodes.map(St),t.selectedNodes.map(St))&&re(e.selectedEdges.map(St),t.selectedEdges.map(St))}function ch({onSelectionChange:e}){const t=oe(),{selectedNodes:n,selectedEdges:r}=te(sh,ah);return V.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(s=>s(o))},[n,r,e]),null}const lh=e=>!!e.onSelectionChangeHandlers;function uh({onSelectionChange:e}){const t=te(lh);return e||t?M.jsx(ch,{onSelectionChange:e}):null}const Hs=[0,0],dh={x:0,y:0,zoom:1},fh=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],bo=[...fh,"rfId"],hh=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),_o={translateExtent:at,nodeOrigin:Hs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ph(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:c}=te(hh,re),d=oe();V.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=_o,a()}),[]);const u=V.useRef(_o);return V.useEffect(()=>{for(const l of bo){const f=e[l],h=u.current[l];f!==h&&(typeof e[l]>"u"||(l==="nodes"?t(f):l==="edges"?n(f):l==="minZoom"?r(f):l==="maxZoom"?o(f):l==="translateExtent"?s(f):l==="nodeExtent"?i(f):l==="ariaLabelConfig"?d.setState({ariaLabelConfig:nf(f)}):l==="fitView"?d.setState({fitViewQueued:f}):l==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[l]:f})))}u.current=e},bo.map(l=>e[l])),null}function Eo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function gh(e){var r;const[t,n]=V.useState(e==="system"?null:e);return V.useEffect(()=>{if(e!=="system"){n(e);return}const o=Eo(),s=()=>n(o!=null&&o.matches?"dark":"light");return s(),o==null||o.addEventListener("change",s),()=>{o==null||o.removeEventListener("change",s)}},[e]),t!==null?t:(r=Eo())!=null&&r.matches?"dark":"light"}const No=typeof document<"u"?document:null;function dt(e=null,t={target:No,actInsideInputWithModifier:!0}){const[n,r]=V.useState(!1),o=V.useRef(!1),s=V.useRef(new Set([])),[i,a]=V.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(l=>typeof l=="string").map(l=>l.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -1,4 +1,4 @@
1
- import{b as ce,g as de,c as ge}from"./index-BAeZDWWy.js";function U(e,r,t){e.prototype=r.prototype=t,t.constructor=e}function se(e,r){var t=Object.create(e.prototype);for(var n in r)t[n]=r[n];return t}function M(){}var E=.7,D=1/E,S="\\s*([+-]?\\d+)\\s*",R="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",m="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",be=/^#([0-9a-f]{3,8})$/,pe=new RegExp(`^rgb\\(${S},${S},${S}\\)$`),me=new RegExp(`^rgb\\(${m},${m},${m}\\)$`),ye=new RegExp(`^rgba\\(${S},${S},${S},${R}\\)$`),we=new RegExp(`^rgba\\(${m},${m},${m},${R}\\)$`),ve=new RegExp(`^hsl\\(${R},${m},${m}\\)$`),$e=new RegExp(`^hsla\\(${R},${m},${m},${R}\\)$`),Q={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};U(M,k,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:X,formatHex:X,formatHex8:Ne,formatHsl:Se,formatRgb:Y,toString:Y});function X(){return this.rgb().formatHex()}function Ne(){return this.rgb().formatHex8()}function Se(){return le(this).formatHsl()}function Y(){return this.rgb().formatRgb()}function k(e){var r,t;return e=(e+"").trim().toLowerCase(),(r=be.exec(e))?(t=r[1].length,r=parseInt(r[1],16),t===6?Z(r):t===3?new h(r>>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):t===8?j(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):t===4?j(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=pe.exec(e))?new h(r[1],r[2],r[3],1):(r=me.exec(e))?new h(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=ye.exec(e))?j(r[1],r[2],r[3],r[4]):(r=we.exec(e))?j(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=ve.exec(e))?te(r[1],r[2]/100,r[3]/100,1):(r=$e.exec(e))?te(r[1],r[2]/100,r[3]/100,r[4]):Q.hasOwnProperty(e)?Z(Q[e]):e==="transparent"?new h(NaN,NaN,NaN,0):null}function Z(e){return new h(e>>16&255,e>>8&255,e&255,1)}function j(e,r,t,n){return n<=0&&(e=r=t=NaN),new h(e,r,t,n)}function Ee(e){return e instanceof M||(e=k(e)),e?(e=e.rgb(),new h(e.r,e.g,e.b,e.opacity)):new h}function W(e,r,t,n){return arguments.length===1?Ee(e):new h(e,r,t,n??1)}function h(e,r,t,n){this.r=+e,this.g=+r,this.b=+t,this.opacity=+n}U(h,W,se(M,{brighter(e){return e=e==null?D:Math.pow(D,e),new h(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?E:Math.pow(E,e),new h(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new h($(this.r),$(this.g),$(this.b),I(this.opacity))},displayable(){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:ee,formatHex:ee,formatHex8:Re,formatRgb:re,toString:re}));function ee(){return`#${v(this.r)}${v(this.g)}${v(this.b)}`}function Re(){return`#${v(this.r)}${v(this.g)}${v(this.b)}${v((isNaN(this.opacity)?1:this.opacity)*255)}`}function re(){const e=I(this.opacity);return`${e===1?"rgb(":"rgba("}${$(this.r)}, ${$(this.g)}, ${$(this.b)}${e===1?")":`, ${e})`}`}function I(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function v(e){return e=$(e),(e<16?"0":"")+e.toString(16)}function te(e,r,t,n){return n<=0?e=r=t=NaN:t<=0||t>=1?e=r=NaN:r<=0&&(e=NaN),new b(e,r,t,n)}function le(e){if(e instanceof b)return new b(e.h,e.s,e.l,e.opacity);if(e instanceof M||(e=k(e)),!e)return new b;if(e instanceof b)return e;e=e.rgb();var r=e.r/255,t=e.g/255,n=e.b/255,i=Math.min(r,t,n),a=Math.max(r,t,n),f=NaN,u=a-i,c=(a+i)/2;return u?(r===a?f=(t-n)/u+(t<n)*6:t===a?f=(n-r)/u+2:f=(r-t)/u+4,u/=c<.5?a+i:2-a-i,f*=60):u=c>0&&c<1?0:f,new b(f,u,c,e.opacity)}function ke(e,r,t,n){return arguments.length===1?le(e):new b(e,r,t,n??1)}function b(e,r,t,n){this.h=+e,this.s=+r,this.l=+t,this.opacity=+n}U(b,ke,se(M,{brighter(e){return e=e==null?D:Math.pow(D,e),new b(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?E:Math.pow(E,e),new b(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,r=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*r,i=2*t-n;return new h(A(e>=240?e-240:e+120,i,n),A(e,i,n),A(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new b(ne(this.h),_(this.s),_(this.l),I(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=I(this.opacity);return`${e===1?"hsl(":"hsla("}${ne(this.h)}, ${_(this.s)*100}%, ${_(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ne(e){return e=(e||0)%360,e<0?e+360:e}function _(e){return Math.max(0,Math.min(1,e||0))}function A(e,r,t){return(e<60?r+(t-r)*e/60:e<180?t:e<240?r+(t-r)*(240-e)/60:r)*255}const B=e=>()=>e;function Me(e,r){return function(t){return e+t*r}}function He(e,r,t){return e=Math.pow(e,t),r=Math.pow(r,t)-e,t=1/t,function(n){return Math.pow(e+n*r,t)}}function qe(e){return(e=+e)==1?xe:function(r,t){return t-r?He(r,t,e):B(isNaN(r)?t:r)}}function xe(e,r){var t=r-e;return t?Me(e,t):B(isNaN(e)?r:e)}const ie=(function e(r){var t=qe(r);function n(i,a){var f=t((i=W(i)).r,(a=W(a)).r),u=t(i.g,a.g),c=t(i.b,a.b),d=xe(i.opacity,a.opacity);return function(s){return i.r=f(s),i.g=u(s),i.b=c(s),i.opacity=d(s),i+""}}return n.gamma=e,n})(1);function je(e,r){r||(r=[]);var t=e?Math.min(r.length,e.length):0,n=r.slice(),i;return function(a){for(i=0;i<t;++i)n[i]=e[i]*(1-a)+r[i]*a;return n}}function _e(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function De(e,r){var t=r?r.length:0,n=e?Math.min(t,e.length):0,i=new Array(n),a=new Array(t),f;for(f=0;f<n;++f)i[f]=he(e[f],r[f]);for(;f<t;++f)a[f]=r[f];return function(u){for(f=0;f<n;++f)a[f]=i[f](u);return a}}function Ie(e,r){var t=new Date;return e=+e,r=+r,function(n){return t.setTime(e*(1-n)+r*n),t}}function G(e,r){return e=+e,r=+r,function(t){return e*(1-t)+r*t}}function Ae(e,r){var t={},n={},i;(e===null||typeof e!="object")&&(e={}),(r===null||typeof r!="object")&&(r={});for(i in r)i in e?t[i]=he(e[i],r[i]):n[i]=r[i];return function(a){for(i in t)n[i]=t[i](a);return n}}var L=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,V=new RegExp(L.source,"g");function Ve(e){return function(){return e}}function Oe(e){return function(r){return e(r)+""}}function Ce(e,r){var t=L.lastIndex=V.lastIndex=0,n,i,a,f=-1,u=[],c=[];for(e=e+"",r=r+"";(n=L.exec(e))&&(i=V.exec(r));)(a=i.index)>t&&(a=r.slice(t,a),u[f]?u[f]+=a:u[++f]=a),(n=n[0])===(i=i[0])?u[f]?u[f]+=i:u[++f]=i:(u[++f]=null,c.push({i:f,x:G(n,i)})),t=V.lastIndex;return t<r.length&&(a=r.slice(t),u[f]?u[f]+=a:u[++f]=a),u.length<2?c[0]?Oe(c[0].x):Ve(r):(r=c.length,function(d){for(var s=0,o;s<r;++s)u[(o=c[s]).i]=o.x(d);return u.join("")})}function he(e,r){var t=typeof r,n;return r==null||t==="boolean"?B(r):(t==="number"?G:t==="string"?(n=k(r))?(r=n,ie):Ce:r instanceof k?ie:r instanceof Date?Ie:_e(r)?je:Array.isArray(r)?De:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?Ae:G)(e,r)}var O={exports:{}},C={},P={exports:{}},z={};/**
1
+ import{b as ce,g as de,c as ge}from"./index-dCyMex_p.js";function U(e,r,t){e.prototype=r.prototype=t,t.constructor=e}function se(e,r){var t=Object.create(e.prototype);for(var n in r)t[n]=r[n];return t}function M(){}var E=.7,D=1/E,S="\\s*([+-]?\\d+)\\s*",R="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",m="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",be=/^#([0-9a-f]{3,8})$/,pe=new RegExp(`^rgb\\(${S},${S},${S}\\)$`),me=new RegExp(`^rgb\\(${m},${m},${m}\\)$`),ye=new RegExp(`^rgba\\(${S},${S},${S},${R}\\)$`),we=new RegExp(`^rgba\\(${m},${m},${m},${R}\\)$`),ve=new RegExp(`^hsl\\(${R},${m},${m}\\)$`),$e=new RegExp(`^hsla\\(${R},${m},${m},${R}\\)$`),Q={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};U(M,k,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:X,formatHex:X,formatHex8:Ne,formatHsl:Se,formatRgb:Y,toString:Y});function X(){return this.rgb().formatHex()}function Ne(){return this.rgb().formatHex8()}function Se(){return le(this).formatHsl()}function Y(){return this.rgb().formatRgb()}function k(e){var r,t;return e=(e+"").trim().toLowerCase(),(r=be.exec(e))?(t=r[1].length,r=parseInt(r[1],16),t===6?Z(r):t===3?new h(r>>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):t===8?j(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):t===4?j(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=pe.exec(e))?new h(r[1],r[2],r[3],1):(r=me.exec(e))?new h(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=ye.exec(e))?j(r[1],r[2],r[3],r[4]):(r=we.exec(e))?j(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=ve.exec(e))?te(r[1],r[2]/100,r[3]/100,1):(r=$e.exec(e))?te(r[1],r[2]/100,r[3]/100,r[4]):Q.hasOwnProperty(e)?Z(Q[e]):e==="transparent"?new h(NaN,NaN,NaN,0):null}function Z(e){return new h(e>>16&255,e>>8&255,e&255,1)}function j(e,r,t,n){return n<=0&&(e=r=t=NaN),new h(e,r,t,n)}function Ee(e){return e instanceof M||(e=k(e)),e?(e=e.rgb(),new h(e.r,e.g,e.b,e.opacity)):new h}function W(e,r,t,n){return arguments.length===1?Ee(e):new h(e,r,t,n??1)}function h(e,r,t,n){this.r=+e,this.g=+r,this.b=+t,this.opacity=+n}U(h,W,se(M,{brighter(e){return e=e==null?D:Math.pow(D,e),new h(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?E:Math.pow(E,e),new h(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new h($(this.r),$(this.g),$(this.b),I(this.opacity))},displayable(){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:ee,formatHex:ee,formatHex8:Re,formatRgb:re,toString:re}));function ee(){return`#${v(this.r)}${v(this.g)}${v(this.b)}`}function Re(){return`#${v(this.r)}${v(this.g)}${v(this.b)}${v((isNaN(this.opacity)?1:this.opacity)*255)}`}function re(){const e=I(this.opacity);return`${e===1?"rgb(":"rgba("}${$(this.r)}, ${$(this.g)}, ${$(this.b)}${e===1?")":`, ${e})`}`}function I(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function v(e){return e=$(e),(e<16?"0":"")+e.toString(16)}function te(e,r,t,n){return n<=0?e=r=t=NaN:t<=0||t>=1?e=r=NaN:r<=0&&(e=NaN),new b(e,r,t,n)}function le(e){if(e instanceof b)return new b(e.h,e.s,e.l,e.opacity);if(e instanceof M||(e=k(e)),!e)return new b;if(e instanceof b)return e;e=e.rgb();var r=e.r/255,t=e.g/255,n=e.b/255,i=Math.min(r,t,n),a=Math.max(r,t,n),f=NaN,u=a-i,c=(a+i)/2;return u?(r===a?f=(t-n)/u+(t<n)*6:t===a?f=(n-r)/u+2:f=(r-t)/u+4,u/=c<.5?a+i:2-a-i,f*=60):u=c>0&&c<1?0:f,new b(f,u,c,e.opacity)}function ke(e,r,t,n){return arguments.length===1?le(e):new b(e,r,t,n??1)}function b(e,r,t,n){this.h=+e,this.s=+r,this.l=+t,this.opacity=+n}U(b,ke,se(M,{brighter(e){return e=e==null?D:Math.pow(D,e),new b(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?E:Math.pow(E,e),new b(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,r=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*r,i=2*t-n;return new h(A(e>=240?e-240:e+120,i,n),A(e,i,n),A(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new b(ne(this.h),_(this.s),_(this.l),I(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=I(this.opacity);return`${e===1?"hsl(":"hsla("}${ne(this.h)}, ${_(this.s)*100}%, ${_(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ne(e){return e=(e||0)%360,e<0?e+360:e}function _(e){return Math.max(0,Math.min(1,e||0))}function A(e,r,t){return(e<60?r+(t-r)*e/60:e<180?t:e<240?r+(t-r)*(240-e)/60:r)*255}const B=e=>()=>e;function Me(e,r){return function(t){return e+t*r}}function He(e,r,t){return e=Math.pow(e,t),r=Math.pow(r,t)-e,t=1/t,function(n){return Math.pow(e+n*r,t)}}function qe(e){return(e=+e)==1?xe:function(r,t){return t-r?He(r,t,e):B(isNaN(r)?t:r)}}function xe(e,r){var t=r-e;return t?Me(e,t):B(isNaN(e)?r:e)}const ie=(function e(r){var t=qe(r);function n(i,a){var f=t((i=W(i)).r,(a=W(a)).r),u=t(i.g,a.g),c=t(i.b,a.b),d=xe(i.opacity,a.opacity);return function(s){return i.r=f(s),i.g=u(s),i.b=c(s),i.opacity=d(s),i+""}}return n.gamma=e,n})(1);function je(e,r){r||(r=[]);var t=e?Math.min(r.length,e.length):0,n=r.slice(),i;return function(a){for(i=0;i<t;++i)n[i]=e[i]*(1-a)+r[i]*a;return n}}function _e(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function De(e,r){var t=r?r.length:0,n=e?Math.min(t,e.length):0,i=new Array(n),a=new Array(t),f;for(f=0;f<n;++f)i[f]=he(e[f],r[f]);for(;f<t;++f)a[f]=r[f];return function(u){for(f=0;f<n;++f)a[f]=i[f](u);return a}}function Ie(e,r){var t=new Date;return e=+e,r=+r,function(n){return t.setTime(e*(1-n)+r*n),t}}function G(e,r){return e=+e,r=+r,function(t){return e*(1-t)+r*t}}function Ae(e,r){var t={},n={},i;(e===null||typeof e!="object")&&(e={}),(r===null||typeof r!="object")&&(r={});for(i in r)i in e?t[i]=he(e[i],r[i]):n[i]=r[i];return function(a){for(i in t)n[i]=t[i](a);return n}}var L=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,V=new RegExp(L.source,"g");function Ve(e){return function(){return e}}function Oe(e){return function(r){return e(r)+""}}function Ce(e,r){var t=L.lastIndex=V.lastIndex=0,n,i,a,f=-1,u=[],c=[];for(e=e+"",r=r+"";(n=L.exec(e))&&(i=V.exec(r));)(a=i.index)>t&&(a=r.slice(t,a),u[f]?u[f]+=a:u[++f]=a),(n=n[0])===(i=i[0])?u[f]?u[f]+=i:u[++f]=i:(u[++f]=null,c.push({i:f,x:G(n,i)})),t=V.lastIndex;return t<r.length&&(a=r.slice(t),u[f]?u[f]+=a:u[++f]=a),u.length<2?c[0]?Oe(c[0].x):Ve(r):(r=c.length,function(d){for(var s=0,o;s<r;++s)u[(o=c[s]).i]=o.x(d);return u.join("")})}function he(e,r){var t=typeof r,n;return r==null||t==="boolean"?B(r):(t==="number"?G:t==="string"?(n=k(r))?(r=n,ie):Ce:r instanceof k?ie:r instanceof Date?Ie:_e(r)?je:Array.isArray(r)?De:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?Ae:G)(e,r)}var O={exports:{}},C={},P={exports:{}},z={};/**
2
2
  * @license React
3
3
  * use-sync-external-store-shim.production.js
4
4
  *