@lobu/runtime-server 22.0.0 → 23.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/dist/catalogs/connectors.json +1353 -181
  2. package/dist/catalogs/skills.json +1 -1
  3. package/dist/component.json +1 -1
  4. package/dist/connectors/README.md +14 -1
  5. package/dist/connectors/google_gmail.ts +1 -0
  6. package/dist/connectors/jira-helpers.ts +313 -0
  7. package/dist/connectors/jira.ts +29 -221
  8. package/dist/connectors/linkedin-browser-script.ts +13 -0
  9. package/dist/connectors/linkedin-draft-page.js +104 -0
  10. package/dist/connectors/linkedin-drafts.ts +73 -0
  11. package/dist/connectors/linkedin-identity.ts +32 -0
  12. package/dist/connectors/linkedin-inbox-adapter.js +1185 -0
  13. package/dist/connectors/linkedin-inbox.ts +156 -0
  14. package/dist/connectors/linkedin-like.ts +114 -0
  15. package/dist/connectors/linkedin-takeout.ts +577 -0
  16. package/dist/connectors/linkedin.ts +3998 -0
  17. package/dist/connectors/takeout-utils.ts +240 -0
  18. package/dist/connectors/tiktok-inbox-page.js +9 -9
  19. package/dist/connectors/tiktok-web-page.js +21 -15
  20. package/dist/connectors/tiktok_web.ts +63 -30
  21. package/dist/connectors/whatsapp-web-adapter.js +64 -564
  22. package/dist/connectors/whatsapp-web-helpers.ts +30 -444
  23. package/dist/connectors/whatsapp-web-identity.ts +20 -6
  24. package/dist/connectors/whatsapp_web.ts +45 -645
  25. package/dist/connectors/x-dm-adapter.js +556 -0
  26. package/dist/connectors/x-identity.ts +31 -2
  27. package/dist/connectors/x.ts +266 -120
  28. package/dist/db/migrations/20261017120000_drop_feeds_kind_virtual.sql +26 -0
  29. package/dist/db/migrations/20261017130000_drop_retired_dead_code_columns.sql +46 -0
  30. package/dist/dependencies.bun.lock +41 -41
  31. package/dist/guest.bundle.js +288 -148
  32. package/dist/owletto/dist/assets/_-3J-IrxWk.js +2 -0
  33. package/dist/owletto/dist/assets/{_-CEPl6gU4.js → _-DYUE3ix4.js} +3 -3
  34. package/dist/owletto/dist/assets/_agentId-Bn2IAjIy.js +2 -0
  35. package/dist/owletto/dist/assets/{_agentId-CBC_SadO.js → _agentId-Cam7Z0N7.js} +2 -2
  36. package/dist/owletto/dist/assets/{_automationId-YTTNksw6.js → _automationId-CXEiKVZJ.js} +2 -2
  37. package/dist/owletto/dist/assets/{_connectorKey._connectionId-fK0h7RAp.js → _connectorKey._connectionId-CS85l61t.js} +2 -2
  38. package/dist/owletto/dist/assets/{_connectorKey.index-C7TPS598.js → _connectorKey.index-clVDIyW0.js} +2 -2
  39. package/dist/owletto/dist/assets/{_conversationId-CEhxlTIo.js → _conversationId-Ci2k-BuN.js} +2 -2
  40. package/dist/owletto/dist/assets/{_deploymentId-BQfYN1U2.js → _deploymentId-BuUzGtVL.js} +2 -2
  41. package/dist/owletto/dist/assets/{_eventId-Cl8GSdjg.js → _eventId-B0662F8h.js} +2 -2
  42. package/dist/owletto/dist/assets/_name-CwWePlOl.js +2 -0
  43. package/dist/owletto/dist/assets/{_owner-cUtGHqSw.js → _owner-dTWkrKsK.js} +3 -3
  44. package/dist/owletto/dist/assets/_shape-BtS3y4M9.js +2 -0
  45. package/dist/owletto/dist/assets/_skillKey-Dc9m-nlR.js +2 -0
  46. package/dist/owletto/dist/assets/{_slug-CU1PuHB9.js → _slug-DQHutM41.js} +2 -2
  47. package/dist/owletto/dist/assets/_viewKey-B30ik8ma.js +2 -0
  48. package/dist/owletto/dist/assets/_viewKey-CUHypQnF.js +2 -0
  49. package/dist/owletto/dist/assets/{accept-invitation-D3OgJG4i.js → accept-invitation-w17IFTtf.js} +2 -2
  50. package/dist/owletto/dist/assets/{activity-route-view-DQglkhXU.js → activity-route-view-CMqYiiKM.js} +2 -2
  51. package/dist/owletto/dist/assets/{agent-card-controls-DzRs4Ix9.js → agent-card-controls-mnTN2AZt.js} +2 -2
  52. package/dist/owletto/dist/assets/{agent-client-setup-list-B2SvH7xD.js → agent-client-setup-list-Bg3hBfUV.js} +2 -2
  53. package/dist/owletto/dist/assets/{agent-connect-pages-B6uKvT_X.js → agent-connect-pages-B_vrqLVc.js} +2 -2
  54. package/dist/owletto/dist/assets/{agent-editor-form-oUnIYHd7.js → agent-editor-form-hTs7eO_U.js} +2 -2
  55. package/dist/owletto/dist/assets/{agent-guardrails-route-BaV1VpDh.js → agent-guardrails-route-BOrCXcAl.js} +2 -2
  56. package/dist/owletto/dist/assets/{agent-loading-shells-CtZJM2Gc.js → agent-loading-shells-Dqcvky-k.js} +2 -2
  57. package/dist/owletto/dist/assets/{agent-permissions-matrix-Ds48KFK9.js → agent-permissions-matrix-BOo_4r_4.js} +2 -2
  58. package/dist/owletto/dist/assets/{agent-skill-context-DPk5r08w.js → agent-skill-context-CCdvtlmH.js} +2 -2
  59. package/dist/owletto/dist/assets/{agent-skills-route-DYpB5H1J.js → agent-skills-route-BUxIswuq.js} +2 -2
  60. package/dist/owletto/dist/assets/{agent-subpage-shell-B3K_jPYR.js → agent-subpage-shell-D92imvSt.js} +2 -2
  61. package/dist/owletto/dist/assets/agent-thread-BJOijbT0.js +6 -0
  62. package/dist/owletto/dist/assets/agents-9XjpDj_S.js +2 -0
  63. package/dist/owletto/dist/assets/{agents-workbench-CMyk4PI7.js → agents-workbench-Bt5QCYQ7.js} +2 -2
  64. package/dist/owletto/dist/assets/{app._appId-DH1Qutz6.js → app._appId-CKv7_squ.js} +2 -2
  65. package/dist/owletto/dist/assets/{automation-detail-content-CEDNboId.js → automation-detail-content-vUwVumXf.js} +2 -2
  66. package/dist/owletto/dist/assets/automations-9XjpDj_S.js +2 -0
  67. package/dist/owletto/dist/assets/{callback-CU-hb8JB.js → callback-BRgcL8gz.js} +2 -2
  68. package/dist/owletto/dist/assets/{card-DIF8SF9b.js → card-Djgp00r_.js} +2 -2
  69. package/dist/owletto/dist/assets/{claim-DELEa-gH.js → claim-BYUZnyMp.js} +2 -2
  70. package/dist/owletto/dist/assets/{clients-CpG676mg.js → clients-D3Zbjxin.js} +2 -2
  71. package/dist/owletto/dist/assets/{code-editor-V27Z4o3P.js → code-editor-DHeyRGZI.js} +2 -2
  72. package/dist/owletto/dist/assets/connect-CfsFsy9P.js +2 -0
  73. package/dist/owletto/dist/assets/connect._clientId-DkiC8xos.js +2 -0
  74. package/dist/owletto/dist/assets/connected._clientId-CIXrGOsT.js +2 -0
  75. package/dist/owletto/dist/assets/{connected._clientId.activity-DQWcUqKM.js → connected._clientId.activity-Ckdz6I0y.js} +2 -2
  76. package/dist/owletto/dist/assets/{connected._clientId.index-BC3R303A.js → connected._clientId.index-CNxafNeo.js} +2 -2
  77. package/dist/owletto/dist/assets/{connection-DySpRE9x.js → connection-C3XXFEqh.js} +2 -2
  78. package/dist/owletto/dist/assets/{connection-feed-detail-C_D68j6d.js → connection-feed-detail-CIJJLDP8.js} +2 -2
  79. package/dist/owletto/dist/assets/{connections-browser-Cnv2iBbZ.js → connections-browser-CKZjzRz6.js} +2 -2
  80. package/dist/owletto/dist/assets/{connector-provenance-CNXtzYg5.js → connector-provenance-8-d8hl10.js} +2 -2
  81. package/dist/owletto/dist/assets/{connector-scope-lists-BKDetNDc.js → connector-scope-lists-CadPVsI3.js} +2 -2
  82. package/dist/owletto/dist/assets/{connectors-BJnk1z_2.js → connectors-lvLJ30lo.js} +2 -2
  83. package/dist/owletto/dist/assets/{consent-BVzxrAO9.js → consent-CdSvVCgx.js} +2 -2
  84. package/dist/owletto/dist/assets/{conversations-table-DfZGICl7.js → conversations-table-BdXoZAfc.js} +2 -2
  85. package/dist/owletto/dist/assets/{core.esm-DiTpULFl.js → core.esm-CYvgWCuv.js} +2 -2
  86. package/dist/owletto/dist/assets/create-0xW9eXxG.js +2 -0
  87. package/dist/owletto/dist/assets/{create-JRFM8mMf.js → create-B0qhrrX4.js} +2 -2
  88. package/dist/owletto/dist/assets/create-CAfF-yI1.js +2 -0
  89. package/dist/owletto/dist/assets/create-automation-form-CtSSeYj3.js +3 -0
  90. package/dist/owletto/dist/assets/create._connectorKey-i6xxkWKV.js +2 -0
  91. package/dist/owletto/dist/assets/{cronstrue-DPXl0qA2.js → cronstrue-n4qGUraE.js} +2 -2
  92. package/dist/owletto/dist/assets/deployments-4Itm35Xc.js +2 -0
  93. package/dist/owletto/dist/assets/{deployments-DCQdFdwG.js → deployments-RvUdVkj3.js} +2 -2
  94. package/dist/owletto/dist/assets/{deployments-body-D6TAWs_6.js → deployments-body-BMp7UsMo.js} +2 -2
  95. package/dist/owletto/dist/assets/{device-CntqYW65.js → device-CPU6CjkJ.js} +2 -2
  96. package/dist/owletto/dist/assets/{device-pin-tombstone-Bz4JHHMK.js → device-pin-tombstone-CrjG7gPo.js} +2 -2
  97. package/dist/owletto/dist/assets/{device._deviceId-D4plO3GM.js → device._deviceId-Cs3ZmXWo.js} +2 -2
  98. package/dist/owletto/dist/assets/{entity-options-UJs64GdQ.js → entity-options-uXjgT7y9.js} +2 -2
  99. package/dist/owletto/dist/assets/{entity-page-Djz6T50J.js → entity-page-Dc0LGr5U.js} +2 -2
  100. package/dist/owletto/dist/assets/{entity-type-page-OznRag6A.js → entity-type-page-CwZxa0BR.js} +2 -2
  101. package/dist/owletto/dist/assets/{event-detail-04qOUGIP.js → event-detail-ve2d6Gbb.js} +2 -2
  102. package/dist/owletto/dist/assets/{events-feed-fucGZSJR.js → events-feed-BtvhZF1f.js} +2 -2
  103. package/dist/owletto/dist/assets/{filter-editors-DCQgGLyR.js → filter-editors-Cj-v6NtH.js} +2 -2
  104. package/dist/owletto/dist/assets/{full-page-spinner-KpV2FS2u.js → full-page-spinner-DqpH99np.js} +2 -2
  105. package/dist/owletto/dist/assets/guardrails-HFo2Ut8B.js +2 -0
  106. package/dist/owletto/dist/assets/identity-BigVSBCl.js +2 -0
  107. package/dist/owletto/dist/assets/{index-BEvyBdOU.js → index-B9uPN6FC.js} +2 -2
  108. package/dist/owletto/dist/assets/{index-BNh2cidi.js → index-BQVliQW1.js} +2 -2
  109. package/dist/owletto/dist/assets/index-BfedB4Rc.js +2 -0
  110. package/dist/owletto/dist/assets/index-CUw3aKBI.js +2 -0
  111. package/dist/owletto/dist/assets/index-CXhxUkv3.js +2 -0
  112. package/dist/owletto/dist/assets/{index-_oPeVpL_.js → index-Cr5hwh-C.js} +66 -66
  113. package/dist/owletto/dist/assets/index-CzkTV4ZQ.js +2 -0
  114. package/dist/owletto/dist/assets/index-DKSx8JN_.js +2 -0
  115. package/dist/owletto/dist/assets/{index-D3s8rhG9.js → index-DVk7Ug0d.js} +2 -2
  116. package/dist/owletto/dist/assets/index-DmZuKGf8.js +2 -0
  117. package/dist/owletto/dist/assets/{index-DCdkwg9H.js → index-Hio-HRfo.js} +2 -2
  118. package/dist/owletto/dist/assets/{index-BJXkc60S.js → index-ICgKp3YK.js} +2 -2
  119. package/dist/owletto/dist/assets/index-cPcroOH0.js +2 -0
  120. package/dist/owletto/dist/assets/{index-BOzuAbvi.js → index-n7sTbNv4.js} +2 -2
  121. package/dist/owletto/dist/assets/index-xiFpcWKv.js +2 -0
  122. package/dist/owletto/dist/assets/{json-diff-D_Ym3Uku.js → json-diff-DBoag_OS.js} +2 -2
  123. package/dist/owletto/dist/assets/{list-skeleton-Bl0OS39L.js → list-skeleton-C_GuoxAH.js} +2 -2
  124. package/dist/owletto/dist/assets/{login-QHdxqX-4.js → login-Ci6ixHuL.js} +2 -2
  125. package/dist/owletto/dist/assets/{logout-DUccApuZ.js → logout-CLGgeZB7.js} +2 -2
  126. package/dist/owletto/dist/assets/{member-scope-gate-CFbrq1by.js → member-scope-gate-B44INDPY.js} +2 -2
  127. package/dist/owletto/dist/assets/{memory-browse-page-IrIXuZTF.js → memory-browse-page-DyQiRvzl.js} +2 -2
  128. package/dist/owletto/dist/assets/{model-selector-CB1BDvlW.js → model-selector-dAbDgJvx.js} +2 -2
  129. package/dist/owletto/dist/assets/models-DpVP7ZwX.js +2 -0
  130. package/dist/owletto/dist/assets/{new-BWo8_Pms.js → new-BUb7AnEW.js} +2 -2
  131. package/dist/owletto/dist/assets/{new-B5UsLiy6.js → new-BkdULx2r.js} +2 -2
  132. package/dist/owletto/dist/assets/{new-DpmDXmFI.js → new-CHOr-EcI.js} +2 -2
  133. package/dist/owletto/dist/assets/{oauth-workspace-access-PGyTnW2K.js → oauth-workspace-access-BxsjwgdH.js} +2 -2
  134. package/dist/owletto/dist/assets/{organization-BH8PYlVu.js → organization-gxGeDjIV.js} +2 -2
  135. package/dist/owletto/dist/assets/{peek-pane-content-B2AFNTzP.js → peek-pane-content-CHoQHe2H.js} +2 -2
  136. package/dist/owletto/dist/assets/{permissions-CwN_YP3u.js → permissions-aPHaKLec.js} +2 -2
  137. package/dist/owletto/dist/assets/{proposal-review-shell-DKKGu4Ww.js → proposal-review-shell-UcZr87_Q.js} +2 -2
  138. package/dist/owletto/dist/assets/public-shell-ready-DcnlADmj.js +2 -0
  139. package/dist/owletto/dist/assets/{recent-DqdZE_TI.js → recent-D-65Pgu-.js} +2 -2
  140. package/dist/owletto/dist/assets/{record-activity-CvgZyCmw.js → record-activity-CBXH6v1d.js} +2 -2
  141. package/dist/owletto/dist/assets/{renderer-BL6VcwQH.js → renderer-mEDnVW0O.js} +2 -2
  142. package/dist/owletto/dist/assets/{reset-password-DAvBYkiI.js → reset-password-uX_V6bip.js} +2 -2
  143. package/dist/owletto/dist/assets/{runs-BWtc5rmc.js → runs-C0rCgGwX.js} +2 -2
  144. package/dist/owletto/dist/assets/runs-panel-Du1JMjg5.js +2 -0
  145. package/dist/owletto/dist/assets/{runs-table-DxIiqrSk.js → runs-table-syPJ6r6T.js} +2 -2
  146. package/dist/owletto/dist/assets/{settings-Crxlwps-.js → settings-9NkNA1G1.js} +2 -2
  147. package/dist/owletto/dist/assets/settings-E-10sLQX.js +2 -0
  148. package/dist/owletto/dist/assets/skills-D2Ri9b4f.js +2 -0
  149. package/dist/owletto/dist/assets/{source-record-panels-CRIPMWfN.js → source-record-panels-CPyzlfD1.js} +2 -2
  150. package/dist/owletto/dist/assets/{status-dot-C5KDvvm9.js → status-dot-B-EWMgq6.js} +2 -2
  151. package/dist/owletto/dist/assets/{tabs-B4Er9hJj.js → tabs-DqIIkCX-.js} +2 -2
  152. package/dist/owletto/dist/assets/{use-mention-search-DqEykWl_.js → use-mention-search-By8RZyKW.js} +2 -2
  153. package/dist/owletto/dist/assets/{view-param-filters-Cylutoy1.js → view-param-filters-CqLZQrnO.js} +2 -2
  154. package/dist/owletto/dist/index.html +1 -1
  155. package/dist/server-main.bundle.mjs +11447 -10762
  156. package/npm-shrinkwrap.json +160 -160
  157. package/package.json +1 -1
  158. package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
  159. package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
  160. package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
  161. package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
  162. package/vendor/connector-sdk/dist/connector-types.d.ts +10 -0
  163. package/vendor/connector-sdk/dist/index.d.ts +3 -0
  164. package/vendor/connector-sdk/dist/index.js +2 -0
  165. package/vendor/connector-sdk/package.json +9 -1
  166. package/vendor/core/dist/capabilities.d.ts +1 -1
  167. package/vendor/core/dist/capabilities.js +0 -1
  168. package/vendor/core/dist/connector-query-errors.d.ts +32 -0
  169. package/vendor/core/dist/connector-query-errors.js +41 -1
  170. package/vendor/core/dist/contracts/tools/manage-conversations.js +2 -2
  171. package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
  172. package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
  173. package/vendor/core/dist/contracts/worker/protocol.d.ts +8 -131
  174. package/vendor/core/dist/contracts/worker/protocol.js +9 -61
  175. package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
  176. package/vendor/core/dist/device-pin-tombstones.js +57 -0
  177. package/vendor/core/dist/index.d.ts +2 -1
  178. package/vendor/core/dist/index.js +1 -0
  179. package/vendor/core/dist/logger.js +10 -25
  180. package/vendor/core/dist/utils/diagnostic-scrubber.js +258 -21
  181. package/vendor/core/dist/worker/wire.d.ts +0 -10
  182. package/vendor/core/package.json +6 -6
  183. package/vendor/views/package.json +1 -1
  184. package/dist/owletto/dist/assets/_-C_zNZben.js +0 -2
  185. package/dist/owletto/dist/assets/_agentId-QQW91cHX.js +0 -2
  186. package/dist/owletto/dist/assets/_name-t3oBJ6Zf.js +0 -2
  187. package/dist/owletto/dist/assets/_shape-bo2lMVCu.js +0 -2
  188. package/dist/owletto/dist/assets/_skillKey-Dwm4Q4wI.js +0 -2
  189. package/dist/owletto/dist/assets/_viewKey-Bh6E_NxA.js +0 -2
  190. package/dist/owletto/dist/assets/_viewKey-D4jKl-Zf.js +0 -2
  191. package/dist/owletto/dist/assets/agent-thread-C8UaUTWc.js +0 -6
  192. package/dist/owletto/dist/assets/agents-F4mGI2oF.js +0 -2
  193. package/dist/owletto/dist/assets/automations-F4mGI2oF.js +0 -2
  194. package/dist/owletto/dist/assets/connect-B2YL6qIK.js +0 -2
  195. package/dist/owletto/dist/assets/connect._clientId-B6LDmDRV.js +0 -2
  196. package/dist/owletto/dist/assets/connected._clientId-D_HaKoI1.js +0 -2
  197. package/dist/owletto/dist/assets/create-CUqO6Kfk.js +0 -2
  198. package/dist/owletto/dist/assets/create-automation-form-_4vUkrls.js +0 -3
  199. package/dist/owletto/dist/assets/create-iHcxV0xd.js +0 -2
  200. package/dist/owletto/dist/assets/create._connectorKey-CCYLEicg.js +0 -2
  201. package/dist/owletto/dist/assets/deployments-ihkhK1zV.js +0 -2
  202. package/dist/owletto/dist/assets/guardrails-molekzAF.js +0 -2
  203. package/dist/owletto/dist/assets/identity-BJcaG66g.js +0 -2
  204. package/dist/owletto/dist/assets/index-B04ON9Jv.js +0 -2
  205. package/dist/owletto/dist/assets/index-BOsK-K-2.js +0 -2
  206. package/dist/owletto/dist/assets/index-Bk1x7A67.js +0 -2
  207. package/dist/owletto/dist/assets/index-CFnx5huL.js +0 -2
  208. package/dist/owletto/dist/assets/index-Dbd1jusf.js +0 -2
  209. package/dist/owletto/dist/assets/index-DqZuqC08.js +0 -2
  210. package/dist/owletto/dist/assets/index-Dr-Xg_xO.js +0 -2
  211. package/dist/owletto/dist/assets/index-KPOvMVa-.js +0 -2
  212. package/dist/owletto/dist/assets/models-DnMb3n-Z.js +0 -2
  213. package/dist/owletto/dist/assets/public-shell-ready-7KYnww6e.js +0 -2
  214. package/dist/owletto/dist/assets/runs-panel-BO3h5RkS.js +0 -2
  215. package/dist/owletto/dist/assets/settings-4Ev-0iNL.js +0 -2
  216. package/dist/owletto/dist/assets/skills-D0X430X8.js +0 -2
  217. package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
  218. package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
@@ -1,4 +1,4 @@
1
- import{eb as JBn,e5 as HBn,r as Ue,j as q,ec as GBn,k as n7,ed as $1n,ee as qBn,ef as zBn,eg as UBn,y as y6,bn as gpe,bo as ppe,bp as mpe,bq as vpe,br as cX,eh as KBn,I as BS,ei as XBn,by as D1n,B as Vf,ej as WBn,ek as VBn,el as QBn,em as YBn,bx as ZBn,bK as L1n,ch as _1n,en as ban,eo as eJn,cg as nJn,dm as tJn,ep as iJn,m as JX,eq as F1n,P as T1,er as R1n,S as OS,aQ as B1n,c9 as J1n,cz as rJn,es as cJn,d5 as Zpe,d7 as e2e,d6 as n2e,cx as H1n,b8 as uJn,et as oJn,eu as G1n,bO as sJn,bP as fJn,ev as lJn,ew as hJn,ex as aJn,bS as dJn,bH as q1n,ey as z1n,ez as LS,eA as jX,eB as bJn,eC as wJn,eD as t2e,eE as gJn,eF as $pe,eG as Dpe,eH as pJn,eI as mJn,cc as U1n,cd as Lpe,cB as vJn,eJ as yJn,eK as K1n,dY as U8,cf as _S,L as k6,eL as kJn,M as v$,dk as EJn,dZ as jJn,d_ as xJn,d$ as ype,e0 as SJn,e3 as CJn,e4 as wan,dx as AJn,eM as MJn,ae as TJn,an as IJn,eN as PJn,v as X1n,eO as NJn,eP as OJn,eQ as $Jn,b_ as q8,eR as kpe,eS as DJn,eT as LJn,cq as gan,eU as W1n,dv as _Jn,eV as FJn,cy as RJn,eW as BJn,eX as JJn,bl as HJn,eY as GJn,eZ as qJn,ah as zJn}from"./index-_oPeVpL_.js";import{P as UJn}from"./public-shell-ready-7KYnww6e.js";import{E as _pe}from"./entity-type-page-OznRag6A.js";import{S as KJn,D as XJn,c as WJn,n as VJn,E as i2e,T as QJn,a as YJn,b as pan}from"./tabs-B4Er9hJj.js";import{F as ZJn}from"./filter-editors-DCQgGLyR.js";import{i as eHn,b as nHn,g as tHn,f as man,c as iHn,d as rHn,S as cHn,a as V1n,J as uHn}from"./renderer-BL6VcwQH.js";import{u as oHn,a as sHn,D as fHn,P as lHn,b as Q1n,c as hHn,C as aHn}from"./core.esm-DiTpULFl.js";import{v as dHn,V as Y1n,M as Z1n,a as edn,w as bHn,b as wHn}from"./view-param-filters-Cylutoy1.js";import{M as gHn}from"./member-scope-gate-CFbrq1by.js";function vl(d){if(typeof d=="string"||typeof d=="number")return""+d;let v="";if(Array.isArray(d))for(let k=0,x;k<d.length;k++)(x=vl(d[k]))!==""&&(v+=(v&&" ")+x);else for(let k in d)d[k]&&(v+=(v&&" ")+k);return v}var pHn={value:()=>{}};function HX(){for(var d=0,v=arguments.length,k={},x;d<v;++d){if(!(x=arguments[d]+"")||x in k||/[\s.]/.test(x))throw new Error("illegal type: "+x);k[x]=[]}return new pX(k)}function pX(d){this._=d}function mHn(d,v){return d.trim().split(/^|\s+/).map(function(k){var x="",C=k.indexOf(".");if(C>=0&&(x=k.slice(C+1),k=k.slice(0,C)),k&&!v.hasOwnProperty(k))throw new Error("unknown type: "+k);return{type:k,name:x}})}pX.prototype=HX.prototype={constructor:pX,on:function(d,v){var k=this._,x=mHn(d+"",k),C,I=-1,m=x.length;if(arguments.length<2){for(;++I<m;)if((C=(d=x[I]).type)&&(C=vHn(k[C],d.name)))return C;return}if(v!=null&&typeof v!="function")throw new Error("invalid callback: "+v);for(;++I<m;)if(C=(d=x[I]).type)k[C]=van(k[C],d.name,v);else if(v==null)for(C in k)k[C]=van(k[C],d.name,null);return this},copy:function(){var d={},v=this._;for(var k in v)d[k]=v[k].slice();return new pX(d)},call:function(d,v){if((C=arguments.length-2)>0)for(var k=new Array(C),x=0,C,I;x<C;++x)k[x]=arguments[x+2];if(!this._.hasOwnProperty(d))throw new Error("unknown type: "+d);for(I=this._[d],x=0,C=I.length;x<C;++x)I[x].value.apply(v,k)},apply:function(d,v,k){if(!this._.hasOwnProperty(d))throw new Error("unknown type: "+d);for(var x=this._[d],C=0,I=x.length;C<I;++C)x[C].value.apply(v,k)}};function vHn(d,v){for(var k=0,x=d.length,C;k<x;++k)if((C=d[k]).name===v)return C.value}function van(d,v,k){for(var x=0,C=d.length;x<C;++x)if(d[x].name===v){d[x]=pHn,d=d.slice(0,x).concat(d.slice(x+1));break}return k!=null&&d.push({name:v,value:k}),d}var Fpe="http://www.w3.org/1999/xhtml";const yan={svg:"http://www.w3.org/2000/svg",xhtml:Fpe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function GX(d){var v=d+="",k=v.indexOf(":");return k>=0&&(v=d.slice(0,k))!=="xmlns"&&(d=d.slice(k+1)),yan.hasOwnProperty(v)?{space:yan[v],local:d}:d}function yHn(d){return function(){var v=this.ownerDocument,k=this.namespaceURI;return k===Fpe&&v.documentElement.namespaceURI===Fpe?v.createElement(d):v.createElementNS(k,d)}}function kHn(d){return function(){return this.ownerDocument.createElementNS(d.space,d.local)}}function ndn(d){var v=GX(d);return(v.local?kHn:yHn)(v)}function EHn(){}function r2e(d){return d==null?EHn:function(){return this.querySelector(d)}}function jHn(d){typeof d!="function"&&(d=r2e(d));for(var v=this._groups,k=v.length,x=new Array(k),C=0;C<k;++C)for(var I=v[C],m=I.length,L=x[C]=new Array(m),G,F,z=0;z<m;++z)(G=I[z])&&(F=d.call(G,G.__data__,z,I))&&("__data__"in G&&(F.__data__=G.__data__),L[z]=F);return new W0(x,this._parents)}function xHn(d){return d==null?[]:Array.isArray(d)?d:Array.from(d)}function SHn(){return[]}function tdn(d){return d==null?SHn:function(){return this.querySelectorAll(d)}}function CHn(d){return function(){return xHn(d.apply(this,arguments))}}function AHn(d){typeof d=="function"?d=CHn(d):d=tdn(d);for(var v=this._groups,k=v.length,x=[],C=[],I=0;I<k;++I)for(var m=v[I],L=m.length,G,F=0;F<L;++F)(G=m[F])&&(x.push(d.call(G,G.__data__,F,m)),C.push(G));return new W0(x,C)}function idn(d){return function(){return this.matches(d)}}function rdn(d){return function(v){return v.matches(d)}}var MHn=Array.prototype.find;function THn(d){return function(){return MHn.call(this.children,d)}}function IHn(){return this.firstElementChild}function PHn(d){return this.select(d==null?IHn:THn(typeof d=="function"?d:rdn(d)))}var NHn=Array.prototype.filter;function OHn(){return Array.from(this.children)}function $Hn(d){return function(){return NHn.call(this.children,d)}}function DHn(d){return this.selectAll(d==null?OHn:$Hn(typeof d=="function"?d:rdn(d)))}function LHn(d){typeof d!="function"&&(d=idn(d));for(var v=this._groups,k=v.length,x=new Array(k),C=0;C<k;++C)for(var I=v[C],m=I.length,L=x[C]=[],G,F=0;F<m;++F)(G=I[F])&&d.call(G,G.__data__,F,I)&&L.push(G);return new W0(x,this._parents)}function cdn(d){return new Array(d.length)}function _Hn(){return new W0(this._enter||this._groups.map(cdn),this._parents)}function xX(d,v){this.ownerDocument=d.ownerDocument,this.namespaceURI=d.namespaceURI,this._next=null,this._parent=d,this.__data__=v}xX.prototype={constructor:xX,appendChild:function(d){return this._parent.insertBefore(d,this._next)},insertBefore:function(d,v){return this._parent.insertBefore(d,v)},querySelector:function(d){return this._parent.querySelector(d)},querySelectorAll:function(d){return this._parent.querySelectorAll(d)}};function FHn(d){return function(){return d}}function RHn(d,v,k,x,C,I){for(var m=0,L,G=v.length,F=I.length;m<F;++m)(L=v[m])?(L.__data__=I[m],x[m]=L):k[m]=new xX(d,I[m]);for(;m<G;++m)(L=v[m])&&(C[m]=L)}function BHn(d,v,k,x,C,I,m){var L,G,F=new Map,z=v.length,X=I.length,K=new Array(z),Y;for(L=0;L<z;++L)(G=v[L])&&(K[L]=Y=m.call(G,G.__data__,L,v)+"",F.has(Y)?C[L]=G:F.set(Y,G));for(L=0;L<X;++L)Y=m.call(d,I[L],L,I)+"",(G=F.get(Y))?(x[L]=G,G.__data__=I[L],F.delete(Y)):k[L]=new xX(d,I[L]);for(L=0;L<z;++L)(G=v[L])&&F.get(K[L])===G&&(C[L]=G)}function JHn(d){return d.__data__}function HHn(d,v){if(!arguments.length)return Array.from(this,JHn);var k=v?BHn:RHn,x=this._parents,C=this._groups;typeof d!="function"&&(d=FHn(d));for(var I=C.length,m=new Array(I),L=new Array(I),G=new Array(I),F=0;F<I;++F){var z=x[F],X=C[F],K=X.length,Y=GHn(d.call(z,z&&z.__data__,F,x)),ie=Y.length,W=L[F]=new Array(ie),pe=m[F]=new Array(ie),fe=G[F]=new Array(K);k(z,X,W,pe,fe,Y,v);for(var je=0,te=0,he,qe;je<ie;++je)if(he=W[je]){for(je>=te&&(te=je+1);!(qe=pe[te])&&++te<ie;);he._next=qe||null}}return m=new W0(m,x),m._enter=L,m._exit=G,m}function GHn(d){return typeof d=="object"&&"length"in d?d:Array.from(d)}function qHn(){return new W0(this._exit||this._groups.map(cdn),this._parents)}function zHn(d,v,k){var x=this.enter(),C=this,I=this.exit();return typeof d=="function"?(x=d(x),x&&(x=x.selection())):x=x.append(d+""),v!=null&&(C=v(C),C&&(C=C.selection())),k==null?I.remove():k(I),x&&C?x.merge(C).order():C}function UHn(d){for(var v=d.selection?d.selection():d,k=this._groups,x=v._groups,C=k.length,I=x.length,m=Math.min(C,I),L=new Array(C),G=0;G<m;++G)for(var F=k[G],z=x[G],X=F.length,K=L[G]=new Array(X),Y,ie=0;ie<X;++ie)(Y=F[ie]||z[ie])&&(K[ie]=Y);for(;G<C;++G)L[G]=k[G];return new W0(L,this._parents)}function KHn(){for(var d=this._groups,v=-1,k=d.length;++v<k;)for(var x=d[v],C=x.length-1,I=x[C],m;--C>=0;)(m=x[C])&&(I&&m.compareDocumentPosition(I)^4&&I.parentNode.insertBefore(m,I),I=m);return this}function XHn(d){d||(d=WHn);function v(X,K){return X&&K?d(X.__data__,K.__data__):!X-!K}for(var k=this._groups,x=k.length,C=new Array(x),I=0;I<x;++I){for(var m=k[I],L=m.length,G=C[I]=new Array(L),F,z=0;z<L;++z)(F=m[z])&&(G[z]=F);G.sort(v)}return new W0(C,this._parents).order()}function WHn(d,v){return d<v?-1:d>v?1:d>=v?0:NaN}function VHn(){var d=arguments[0];return arguments[0]=this,d.apply(null,arguments),this}function QHn(){return Array.from(this)}function YHn(){for(var d=this._groups,v=0,k=d.length;v<k;++v)for(var x=d[v],C=0,I=x.length;C<I;++C){var m=x[C];if(m)return m}return null}function ZHn(){let d=0;for(const v of this)++d;return d}function eGn(){return!this.node()}function nGn(d){for(var v=this._groups,k=0,x=v.length;k<x;++k)for(var C=v[k],I=0,m=C.length,L;I<m;++I)(L=C[I])&&d.call(L,L.__data__,I,C);return this}function tGn(d){return function(){this.removeAttribute(d)}}function iGn(d){return function(){this.removeAttributeNS(d.space,d.local)}}function rGn(d,v){return function(){this.setAttribute(d,v)}}function cGn(d,v){return function(){this.setAttributeNS(d.space,d.local,v)}}function uGn(d,v){return function(){var k=v.apply(this,arguments);k==null?this.removeAttribute(d):this.setAttribute(d,k)}}function oGn(d,v){return function(){var k=v.apply(this,arguments);k==null?this.removeAttributeNS(d.space,d.local):this.setAttributeNS(d.space,d.local,k)}}function sGn(d,v){var k=GX(d);if(arguments.length<2){var x=this.node();return k.local?x.getAttributeNS(k.space,k.local):x.getAttribute(k)}return this.each((v==null?k.local?iGn:tGn:typeof v=="function"?k.local?oGn:uGn:k.local?cGn:rGn)(k,v))}function udn(d){return d.ownerDocument&&d.ownerDocument.defaultView||d.document&&d||d.defaultView}function fGn(d){return function(){this.style.removeProperty(d)}}function lGn(d,v,k){return function(){this.style.setProperty(d,v,k)}}function hGn(d,v,k){return function(){var x=v.apply(this,arguments);x==null?this.style.removeProperty(d):this.style.setProperty(d,x,k)}}function aGn(d,v,k){return arguments.length>1?this.each((v==null?fGn:typeof v=="function"?hGn:lGn)(d,v,k??"")):JS(this.node(),d)}function JS(d,v){return d.style.getPropertyValue(v)||udn(d).getComputedStyle(d,null).getPropertyValue(v)}function dGn(d){return function(){delete this[d]}}function bGn(d,v){return function(){this[d]=v}}function wGn(d,v){return function(){var k=v.apply(this,arguments);k==null?delete this[d]:this[d]=k}}function gGn(d,v){return arguments.length>1?this.each((v==null?dGn:typeof v=="function"?wGn:bGn)(d,v)):this.node()[d]}function odn(d){return d.trim().split(/^|\s+/)}function c2e(d){return d.classList||new sdn(d)}function sdn(d){this._node=d,this._names=odn(d.getAttribute("class")||"")}sdn.prototype={add:function(d){var v=this._names.indexOf(d);v<0&&(this._names.push(d),this._node.setAttribute("class",this._names.join(" ")))},remove:function(d){var v=this._names.indexOf(d);v>=0&&(this._names.splice(v,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(d){return this._names.indexOf(d)>=0}};function fdn(d,v){for(var k=c2e(d),x=-1,C=v.length;++x<C;)k.add(v[x])}function ldn(d,v){for(var k=c2e(d),x=-1,C=v.length;++x<C;)k.remove(v[x])}function pGn(d){return function(){fdn(this,d)}}function mGn(d){return function(){ldn(this,d)}}function vGn(d,v){return function(){(v.apply(this,arguments)?fdn:ldn)(this,d)}}function yGn(d,v){var k=odn(d+"");if(arguments.length<2){for(var x=c2e(this.node()),C=-1,I=k.length;++C<I;)if(!x.contains(k[C]))return!1;return!0}return this.each((typeof v=="function"?vGn:v?pGn:mGn)(k,v))}function kGn(){this.textContent=""}function EGn(d){return function(){this.textContent=d}}function jGn(d){return function(){var v=d.apply(this,arguments);this.textContent=v??""}}function xGn(d){return arguments.length?this.each(d==null?kGn:(typeof d=="function"?jGn:EGn)(d)):this.node().textContent}function SGn(){this.innerHTML=""}function CGn(d){return function(){this.innerHTML=d}}function AGn(d){return function(){var v=d.apply(this,arguments);this.innerHTML=v??""}}function MGn(d){return arguments.length?this.each(d==null?SGn:(typeof d=="function"?AGn:CGn)(d)):this.node().innerHTML}function TGn(){this.nextSibling&&this.parentNode.appendChild(this)}function IGn(){return this.each(TGn)}function PGn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function NGn(){return this.each(PGn)}function OGn(d){var v=typeof d=="function"?d:ndn(d);return this.select(function(){return this.appendChild(v.apply(this,arguments))})}function $Gn(){return null}function DGn(d,v){var k=typeof d=="function"?d:ndn(d),x=v==null?$Gn:typeof v=="function"?v:r2e(v);return this.select(function(){return this.insertBefore(k.apply(this,arguments),x.apply(this,arguments)||null)})}function LGn(){var d=this.parentNode;d&&d.removeChild(this)}function _Gn(){return this.each(LGn)}function FGn(){var d=this.cloneNode(!1),v=this.parentNode;return v?v.insertBefore(d,this.nextSibling):d}function RGn(){var d=this.cloneNode(!0),v=this.parentNode;return v?v.insertBefore(d,this.nextSibling):d}function BGn(d){return this.select(d?RGn:FGn)}function JGn(d){return arguments.length?this.property("__data__",d):this.node().__data__}function HGn(d){return function(v){d.call(this,v,this.__data__)}}function GGn(d){return d.trim().split(/^|\s+/).map(function(v){var k="",x=v.indexOf(".");return x>=0&&(k=v.slice(x+1),v=v.slice(0,x)),{type:v,name:k}})}function qGn(d){return function(){var v=this.__on;if(v){for(var k=0,x=-1,C=v.length,I;k<C;++k)I=v[k],(!d.type||I.type===d.type)&&I.name===d.name?this.removeEventListener(I.type,I.listener,I.options):v[++x]=I;++x?v.length=x:delete this.__on}}}function zGn(d,v,k){return function(){var x=this.__on,C,I=HGn(v);if(x){for(var m=0,L=x.length;m<L;++m)if((C=x[m]).type===d.type&&C.name===d.name){this.removeEventListener(C.type,C.listener,C.options),this.addEventListener(C.type,C.listener=I,C.options=k),C.value=v;return}}this.addEventListener(d.type,I,k),C={type:d.type,name:d.name,value:v,listener:I,options:k},x?x.push(C):this.__on=[C]}}function UGn(d,v,k){var x=GGn(d+""),C,I=x.length,m;if(arguments.length<2){var L=this.node().__on;if(L){for(var G=0,F=L.length,z;G<F;++G)for(C=0,z=L[G];C<I;++C)if((m=x[C]).type===z.type&&m.name===z.name)return z.value}return}for(L=v?zGn:qGn,C=0;C<I;++C)this.each(L(x[C],v,k));return this}function hdn(d,v,k){var x=udn(d),C=x.CustomEvent;typeof C=="function"?C=new C(v,k):(C=x.document.createEvent("Event"),k?(C.initEvent(v,k.bubbles,k.cancelable),C.detail=k.detail):C.initEvent(v,!1,!1)),d.dispatchEvent(C)}function KGn(d,v){return function(){return hdn(this,d,v)}}function XGn(d,v){return function(){return hdn(this,d,v.apply(this,arguments))}}function WGn(d,v){return this.each((typeof v=="function"?XGn:KGn)(d,v))}function*VGn(){for(var d=this._groups,v=0,k=d.length;v<k;++v)for(var x=d[v],C=0,I=x.length,m;C<I;++C)(m=x[C])&&(yield m)}var adn=[null];function W0(d,v){this._groups=d,this._parents=v}function I$(){return new W0([[document.documentElement]],adn)}function QGn(){return this}W0.prototype=I$.prototype={constructor:W0,select:jHn,selectAll:AHn,selectChild:PHn,selectChildren:DHn,filter:LHn,data:HHn,enter:_Hn,exit:qHn,join:zHn,merge:UHn,selection:QGn,order:KHn,sort:XHn,call:VHn,nodes:QHn,node:YHn,size:ZHn,empty:eGn,each:nGn,attr:sGn,style:aGn,property:gGn,classed:yGn,text:xGn,html:MGn,raise:IGn,lower:NGn,append:OGn,insert:DGn,remove:_Gn,clone:BGn,datum:JGn,on:UGn,dispatch:WGn,[Symbol.iterator]:VGn};function X0(d){return typeof d=="string"?new W0([[document.querySelector(d)]],[document.documentElement]):new W0([[d]],adn)}function YGn(d){let v;for(;v=d.sourceEvent;)d=v;return d}function hp(d,v){if(d=YGn(d),v===void 0&&(v=d.currentTarget),v){var k=v.ownerSVGElement||v;if(k.createSVGPoint){var x=k.createSVGPoint();return x.x=d.clientX,x.y=d.clientY,x=x.matrixTransform(v.getScreenCTM().inverse()),[x.x,x.y]}if(v.getBoundingClientRect){var C=v.getBoundingClientRect();return[d.clientX-C.left-v.clientLeft,d.clientY-C.top-v.clientTop]}}return[d.pageX,d.pageY]}const ZGn={passive:!1},y$={capture:!0,passive:!1};function Epe(d){d.stopImmediatePropagation()}function FS(d){d.preventDefault(),d.stopImmediatePropagation()}function ddn(d){var v=d.document.documentElement,k=X0(d).on("dragstart.drag",FS,y$);"onselectstart"in v?k.on("selectstart.drag",FS,y$):(v.__noselect=v.style.MozUserSelect,v.style.MozUserSelect="none")}function bdn(d,v){var k=d.document.documentElement,x=X0(d).on("dragstart.drag",null);v&&(x.on("click.drag",FS,y$),setTimeout(function(){x.on("click.drag",null)},0)),"onselectstart"in k?x.on("selectstart.drag",null):(k.style.MozUserSelect=k.__noselect,delete k.__noselect)}const uX=d=>()=>d;function Rpe(d,{sourceEvent:v,subject:k,target:x,identifier:C,active:I,x:m,y:L,dx:G,dy:F,dispatch:z}){Object.defineProperties(this,{type:{value:d,enumerable:!0,configurable:!0},sourceEvent:{value:v,enumerable:!0,configurable:!0},subject:{value:k,enumerable:!0,configurable:!0},target:{value:x,enumerable:!0,configurable:!0},identifier:{value:C,enumerable:!0,configurable:!0},active:{value:I,enumerable:!0,configurable:!0},x:{value:m,enumerable:!0,configurable:!0},y:{value:L,enumerable:!0,configurable:!0},dx:{value:G,enumerable:!0,configurable:!0},dy:{value:F,enumerable:!0,configurable:!0},_:{value:z}})}Rpe.prototype.on=function(){var d=this._.on.apply(this._,arguments);return d===this._?this:d};function eqn(d){return!d.ctrlKey&&!d.button}function nqn(){return this.parentNode}function tqn(d,v){return v??{x:d.x,y:d.y}}function iqn(){return navigator.maxTouchPoints||"ontouchstart"in this}function wdn(){var d=eqn,v=nqn,k=tqn,x=iqn,C={},I=HX("start","drag","end"),m=0,L,G,F,z,X=0;function K(he){he.on("mousedown.drag",Y).filter(x).on("touchstart.drag",pe).on("touchmove.drag",fe,ZGn).on("touchend.drag touchcancel.drag",je).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Y(he,qe){if(!(z||!d.call(this,he,qe))){var Ne=te(this,v.call(this,he,qe),he,qe,"mouse");Ne&&(X0(he.view).on("mousemove.drag",ie,y$).on("mouseup.drag",W,y$),ddn(he.view),Epe(he),F=!1,L=he.clientX,G=he.clientY,Ne("start",he))}}function ie(he){if(FS(he),!F){var qe=he.clientX-L,Ne=he.clientY-G;F=qe*qe+Ne*Ne>X}C.mouse("drag",he)}function W(he){X0(he.view).on("mousemove.drag mouseup.drag",null),bdn(he.view,F),FS(he),C.mouse("end",he)}function pe(he,qe){if(d.call(this,he,qe)){var Ne=he.changedTouches,Me=v.call(this,he,qe),Ze=Ne.length,rn,Bn;for(rn=0;rn<Ze;++rn)(Bn=te(this,Me,he,qe,Ne[rn].identifier,Ne[rn]))&&(Epe(he),Bn("start",he,Ne[rn]))}}function fe(he){var qe=he.changedTouches,Ne=qe.length,Me,Ze;for(Me=0;Me<Ne;++Me)(Ze=C[qe[Me].identifier])&&(FS(he),Ze("drag",he,qe[Me]))}function je(he){var qe=he.changedTouches,Ne=qe.length,Me,Ze;for(z&&clearTimeout(z),z=setTimeout(function(){z=null},500),Me=0;Me<Ne;++Me)(Ze=C[qe[Me].identifier])&&(Epe(he),Ze("end",he,qe[Me]))}function te(he,qe,Ne,Me,Ze,rn){var Bn=I.copy(),Ln=hp(rn||Ne,qe),mn,B,ye;if((ye=k.call(he,new Rpe("beforestart",{sourceEvent:Ne,target:K,identifier:Ze,active:m,x:Ln[0],y:Ln[1],dx:0,dy:0,dispatch:Bn}),Me))!=null)return mn=ye.x-Ln[0]||0,B=ye.y-Ln[1]||0,function Oe(Qe,fn,gn){var On=Ln,Vn;switch(Qe){case"start":C[Ze]=Oe,Vn=m++;break;case"end":delete C[Ze],--m;case"drag":Ln=hp(gn||fn,qe),Vn=m;break}Bn.call(Qe,he,new Rpe(Qe,{sourceEvent:fn,subject:ye,target:K,identifier:Ze,active:Vn,x:Ln[0]+mn,y:Ln[1]+B,dx:Ln[0]-On[0],dy:Ln[1]-On[1],dispatch:Bn}),Me)}}return K.filter=function(he){return arguments.length?(d=typeof he=="function"?he:uX(!!he),K):d},K.container=function(he){return arguments.length?(v=typeof he=="function"?he:uX(he),K):v},K.subject=function(he){return arguments.length?(k=typeof he=="function"?he:uX(he),K):k},K.touchable=function(he){return arguments.length?(x=typeof he=="function"?he:uX(!!he),K):x},K.on=function(){var he=I.on.apply(I,arguments);return he===I?K:he},K.clickDistance=function(he){return arguments.length?(X=(he=+he)*he,K):Math.sqrt(X)},K}function u2e(d,v,k){d.prototype=v.prototype=k,k.constructor=d}function gdn(d,v){var k=Object.create(d.prototype);for(var x in v)k[x]=v[x];return k}function P$(){}var k$=.7,SX=1/k$,RS="\\s*([+-]?\\d+)\\s*",E$="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",im="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",rqn=/^#([0-9a-f]{3,8})$/,cqn=new RegExp(`^rgb\\(${RS},${RS},${RS}\\)$`),uqn=new RegExp(`^rgb\\(${im},${im},${im}\\)$`),oqn=new RegExp(`^rgba\\(${RS},${RS},${RS},${E$}\\)$`),sqn=new RegExp(`^rgba\\(${im},${im},${im},${E$}\\)$`),fqn=new RegExp(`^hsl\\(${E$},${im},${im}\\)$`),lqn=new RegExp(`^hsla\\(${E$},${im},${im},${E$}\\)$`),kan={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};u2e(P$,V8,{copy(d){return Object.assign(new this.constructor,this,d)},displayable(){return this.rgb().displayable()},hex:Ean,formatHex:Ean,formatHex8:hqn,formatHsl:aqn,formatRgb:jan,toString:jan});function Ean(){return this.rgb().formatHex()}function hqn(){return this.rgb().formatHex8()}function aqn(){return pdn(this).formatHsl()}function jan(){return this.rgb().formatRgb()}function V8(d){var v,k;return d=(d+"").trim().toLowerCase(),(v=rqn.exec(d))?(k=v[1].length,v=parseInt(v[1],16),k===6?xan(v):k===3?new Rd(v>>8&15|v>>4&240,v>>4&15|v&240,(v&15)<<4|v&15,1):k===8?oX(v>>24&255,v>>16&255,v>>8&255,(v&255)/255):k===4?oX(v>>12&15|v>>8&240,v>>8&15|v>>4&240,v>>4&15|v&240,((v&15)<<4|v&15)/255):null):(v=cqn.exec(d))?new Rd(v[1],v[2],v[3],1):(v=uqn.exec(d))?new Rd(v[1]*255/100,v[2]*255/100,v[3]*255/100,1):(v=oqn.exec(d))?oX(v[1],v[2],v[3],v[4]):(v=sqn.exec(d))?oX(v[1]*255/100,v[2]*255/100,v[3]*255/100,v[4]):(v=fqn.exec(d))?Aan(v[1],v[2]/100,v[3]/100,1):(v=lqn.exec(d))?Aan(v[1],v[2]/100,v[3]/100,v[4]):kan.hasOwnProperty(d)?xan(kan[d]):d==="transparent"?new Rd(NaN,NaN,NaN,0):null}function xan(d){return new Rd(d>>16&255,d>>8&255,d&255,1)}function oX(d,v,k,x){return x<=0&&(d=v=k=NaN),new Rd(d,v,k,x)}function dqn(d){return d instanceof P$||(d=V8(d)),d?(d=d.rgb(),new Rd(d.r,d.g,d.b,d.opacity)):new Rd}function Bpe(d,v,k,x){return arguments.length===1?dqn(d):new Rd(d,v,k,x??1)}function Rd(d,v,k,x){this.r=+d,this.g=+v,this.b=+k,this.opacity=+x}u2e(Rd,Bpe,gdn(P$,{brighter(d){return d=d==null?SX:Math.pow(SX,d),new Rd(this.r*d,this.g*d,this.b*d,this.opacity)},darker(d){return d=d==null?k$:Math.pow(k$,d),new Rd(this.r*d,this.g*d,this.b*d,this.opacity)},rgb(){return this},clamp(){return new Rd(K8(this.r),K8(this.g),K8(this.b),CX(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:San,formatHex:San,formatHex8:bqn,formatRgb:Can,toString:Can}));function San(){return`#${z8(this.r)}${z8(this.g)}${z8(this.b)}`}function bqn(){return`#${z8(this.r)}${z8(this.g)}${z8(this.b)}${z8((isNaN(this.opacity)?1:this.opacity)*255)}`}function Can(){const d=CX(this.opacity);return`${d===1?"rgb(":"rgba("}${K8(this.r)}, ${K8(this.g)}, ${K8(this.b)}${d===1?")":`, ${d})`}`}function CX(d){return isNaN(d)?1:Math.max(0,Math.min(1,d))}function K8(d){return Math.max(0,Math.min(255,Math.round(d)||0))}function z8(d){return d=K8(d),(d<16?"0":"")+d.toString(16)}function Aan(d,v,k,x){return x<=0?d=v=k=NaN:k<=0||k>=1?d=v=NaN:v<=0&&(d=NaN),new ap(d,v,k,x)}function pdn(d){if(d instanceof ap)return new ap(d.h,d.s,d.l,d.opacity);if(d instanceof P$||(d=V8(d)),!d)return new ap;if(d instanceof ap)return d;d=d.rgb();var v=d.r/255,k=d.g/255,x=d.b/255,C=Math.min(v,k,x),I=Math.max(v,k,x),m=NaN,L=I-C,G=(I+C)/2;return L?(v===I?m=(k-x)/L+(k<x)*6:k===I?m=(x-v)/L+2:m=(v-k)/L+4,L/=G<.5?I+C:2-I-C,m*=60):L=G>0&&G<1?0:m,new ap(m,L,G,d.opacity)}function wqn(d,v,k,x){return arguments.length===1?pdn(d):new ap(d,v,k,x??1)}function ap(d,v,k,x){this.h=+d,this.s=+v,this.l=+k,this.opacity=+x}u2e(ap,wqn,gdn(P$,{brighter(d){return d=d==null?SX:Math.pow(SX,d),new ap(this.h,this.s,this.l*d,this.opacity)},darker(d){return d=d==null?k$:Math.pow(k$,d),new ap(this.h,this.s,this.l*d,this.opacity)},rgb(){var d=this.h%360+(this.h<0)*360,v=isNaN(d)||isNaN(this.s)?0:this.s,k=this.l,x=k+(k<.5?k:1-k)*v,C=2*k-x;return new Rd(jpe(d>=240?d-240:d+120,C,x),jpe(d,C,x),jpe(d<120?d+240:d-120,C,x),this.opacity)},clamp(){return new ap(Man(this.h),sX(this.s),sX(this.l),CX(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 d=CX(this.opacity);return`${d===1?"hsl(":"hsla("}${Man(this.h)}, ${sX(this.s)*100}%, ${sX(this.l)*100}%${d===1?")":`, ${d})`}`}}));function Man(d){return d=(d||0)%360,d<0?d+360:d}function sX(d){return Math.max(0,Math.min(1,d||0))}function jpe(d,v,k){return(d<60?v+(k-v)*d/60:d<180?k:d<240?v+(k-v)*(240-d)/60:v)*255}const o2e=d=>()=>d;function gqn(d,v){return function(k){return d+k*v}}function pqn(d,v,k){return d=Math.pow(d,k),v=Math.pow(v,k)-d,k=1/k,function(x){return Math.pow(d+x*v,k)}}function mqn(d){return(d=+d)==1?mdn:function(v,k){return k-v?pqn(v,k,d):o2e(isNaN(v)?k:v)}}function mdn(d,v){var k=v-d;return k?gqn(d,k):o2e(isNaN(d)?v:d)}const AX=(function d(v){var k=mqn(v);function x(C,I){var m=k((C=Bpe(C)).r,(I=Bpe(I)).r),L=k(C.g,I.g),G=k(C.b,I.b),F=mdn(C.opacity,I.opacity);return function(z){return C.r=m(z),C.g=L(z),C.b=G(z),C.opacity=F(z),C+""}}return x.gamma=d,x})(1);function vqn(d,v){v||(v=[]);var k=d?Math.min(v.length,d.length):0,x=v.slice(),C;return function(I){for(C=0;C<k;++C)x[C]=d[C]*(1-I)+v[C]*I;return x}}function yqn(d){return ArrayBuffer.isView(d)&&!(d instanceof DataView)}function kqn(d,v){var k=v?v.length:0,x=d?Math.min(k,d.length):0,C=new Array(x),I=new Array(k),m;for(m=0;m<x;++m)C[m]=p$(d[m],v[m]);for(;m<k;++m)I[m]=v[m];return function(L){for(m=0;m<x;++m)I[m]=C[m](L);return I}}function Eqn(d,v){var k=new Date;return d=+d,v=+v,function(x){return k.setTime(d*(1-x)+v*x),k}}function tm(d,v){return d=+d,v=+v,function(k){return d*(1-k)+v*k}}function jqn(d,v){var k={},x={},C;(d===null||typeof d!="object")&&(d={}),(v===null||typeof v!="object")&&(v={});for(C in v)C in d?k[C]=p$(d[C],v[C]):x[C]=v[C];return function(I){for(C in k)x[C]=k[C](I);return x}}var Jpe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xpe=new RegExp(Jpe.source,"g");function xqn(d){return function(){return d}}function Sqn(d){return function(v){return d(v)+""}}function vdn(d,v){var k=Jpe.lastIndex=xpe.lastIndex=0,x,C,I,m=-1,L=[],G=[];for(d=d+"",v=v+"";(x=Jpe.exec(d))&&(C=xpe.exec(v));)(I=C.index)>k&&(I=v.slice(k,I),L[m]?L[m]+=I:L[++m]=I),(x=x[0])===(C=C[0])?L[m]?L[m]+=C:L[++m]=C:(L[++m]=null,G.push({i:m,x:tm(x,C)})),k=xpe.lastIndex;return k<v.length&&(I=v.slice(k),L[m]?L[m]+=I:L[++m]=I),L.length<2?G[0]?Sqn(G[0].x):xqn(v):(v=G.length,function(F){for(var z=0,X;z<v;++z)L[(X=G[z]).i]=X.x(F);return L.join("")})}function p$(d,v){var k=typeof v,x;return v==null||k==="boolean"?o2e(v):(k==="number"?tm:k==="string"?(x=V8(v))?(v=x,AX):vdn:v instanceof V8?AX:v instanceof Date?Eqn:yqn(v)?vqn:Array.isArray(v)?kqn:typeof v.valueOf!="function"&&typeof v.toString!="function"||isNaN(v)?jqn:tm)(d,v)}var Tan=180/Math.PI,Hpe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ydn(d,v,k,x,C,I){var m,L,G;return(m=Math.sqrt(d*d+v*v))&&(d/=m,v/=m),(G=d*k+v*x)&&(k-=d*G,x-=v*G),(L=Math.sqrt(k*k+x*x))&&(k/=L,x/=L,G/=L),d*x<v*k&&(d=-d,v=-v,G=-G,m=-m),{translateX:C,translateY:I,rotate:Math.atan2(v,d)*Tan,skewX:Math.atan(G)*Tan,scaleX:m,scaleY:L}}var fX;function Cqn(d){const v=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(d+"");return v.isIdentity?Hpe:ydn(v.a,v.b,v.c,v.d,v.e,v.f)}function Aqn(d){return d==null||(fX||(fX=document.createElementNS("http://www.w3.org/2000/svg","g")),fX.setAttribute("transform",d),!(d=fX.transform.baseVal.consolidate()))?Hpe:(d=d.matrix,ydn(d.a,d.b,d.c,d.d,d.e,d.f))}function kdn(d,v,k,x){function C(F){return F.length?F.pop()+" ":""}function I(F,z,X,K,Y,ie){if(F!==X||z!==K){var W=Y.push("translate(",null,v,null,k);ie.push({i:W-4,x:tm(F,X)},{i:W-2,x:tm(z,K)})}else(X||K)&&Y.push("translate("+X+v+K+k)}function m(F,z,X,K){F!==z?(F-z>180?z+=360:z-F>180&&(F+=360),K.push({i:X.push(C(X)+"rotate(",null,x)-2,x:tm(F,z)})):z&&X.push(C(X)+"rotate("+z+x)}function L(F,z,X,K){F!==z?K.push({i:X.push(C(X)+"skewX(",null,x)-2,x:tm(F,z)}):z&&X.push(C(X)+"skewX("+z+x)}function G(F,z,X,K,Y,ie){if(F!==X||z!==K){var W=Y.push(C(Y)+"scale(",null,",",null,")");ie.push({i:W-4,x:tm(F,X)},{i:W-2,x:tm(z,K)})}else(X!==1||K!==1)&&Y.push(C(Y)+"scale("+X+","+K+")")}return function(F,z){var X=[],K=[];return F=d(F),z=d(z),I(F.translateX,F.translateY,z.translateX,z.translateY,X,K),m(F.rotate,z.rotate,X,K),L(F.skewX,z.skewX,X,K),G(F.scaleX,F.scaleY,z.scaleX,z.scaleY,X,K),F=z=null,function(Y){for(var ie=-1,W=K.length,pe;++ie<W;)X[(pe=K[ie]).i]=pe.x(Y);return X.join("")}}}var Mqn=kdn(Cqn,"px, ","px)","deg)"),Tqn=kdn(Aqn,", ",")",")"),Iqn=1e-12;function Ian(d){return((d=Math.exp(d))+1/d)/2}function Pqn(d){return((d=Math.exp(d))-1/d)/2}function Nqn(d){return((d=Math.exp(2*d))-1)/(d+1)}const mX=(function d(v,k,x){function C(I,m){var L=I[0],G=I[1],F=I[2],z=m[0],X=m[1],K=m[2],Y=z-L,ie=X-G,W=Y*Y+ie*ie,pe,fe;if(W<Iqn)fe=Math.log(K/F)/v,pe=function(Me){return[L+Me*Y,G+Me*ie,F*Math.exp(v*Me*fe)]};else{var je=Math.sqrt(W),te=(K*K-F*F+x*W)/(2*F*k*je),he=(K*K-F*F-x*W)/(2*K*k*je),qe=Math.log(Math.sqrt(te*te+1)-te),Ne=Math.log(Math.sqrt(he*he+1)-he);fe=(Ne-qe)/v,pe=function(Me){var Ze=Me*fe,rn=Ian(qe),Bn=F/(k*je)*(rn*Nqn(v*Ze+qe)-Pqn(qe));return[L+Bn*Y,G+Bn*ie,F*rn/Ian(v*Ze+qe)]}}return pe.duration=fe*1e3*v/Math.SQRT2,pe}return C.rho=function(I){var m=Math.max(.001,+I),L=m*m,G=L*L;return d(m,L,G)},C})(Math.SQRT2,2,4);var HS=0,w$=0,d$=0,Edn=1e3,MX,g$,TX=0,Q8=0,qX=0,j$=typeof performance=="object"&&performance.now?performance:Date,jdn=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(d){setTimeout(d,17)};function s2e(){return Q8||(jdn(Oqn),Q8=j$.now()+qX)}function Oqn(){Q8=0}function IX(){this._call=this._time=this._next=null}IX.prototype=xdn.prototype={constructor:IX,restart:function(d,v,k){if(typeof d!="function")throw new TypeError("callback is not a function");k=(k==null?s2e():+k)+(v==null?0:+v),!this._next&&g$!==this&&(g$?g$._next=this:MX=this,g$=this),this._call=d,this._time=k,Gpe()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gpe())}};function xdn(d,v,k){var x=new IX;return x.restart(d,v,k),x}function $qn(){s2e(),++HS;for(var d=MX,v;d;)(v=Q8-d._time)>=0&&d._call.call(void 0,v),d=d._next;--HS}function Pan(){Q8=(TX=j$.now())+qX,HS=w$=0;try{$qn()}finally{HS=0,Lqn(),Q8=0}}function Dqn(){var d=j$.now(),v=d-TX;v>Edn&&(qX-=v,TX=d)}function Lqn(){for(var d,v=MX,k,x=1/0;v;)v._call?(x>v._time&&(x=v._time),d=v,v=v._next):(k=v._next,v._next=null,v=d?d._next=k:MX=k);g$=d,Gpe(x)}function Gpe(d){if(!HS){w$&&(w$=clearTimeout(w$));var v=d-Q8;v>24?(d<1/0&&(w$=setTimeout(Pan,d-j$.now()-qX)),d$&&(d$=clearInterval(d$))):(d$||(TX=j$.now(),d$=setInterval(Dqn,Edn)),HS=1,jdn(Pan))}}function Nan(d,v,k){var x=new IX;return v=v==null?0:+v,x.restart(C=>{x.stop(),d(C+v)},v,k),x}var _qn=HX("start","end","cancel","interrupt"),Fqn=[],Sdn=0,Oan=1,qpe=2,vX=3,$an=4,zpe=5,yX=6;function zX(d,v,k,x,C,I){var m=d.__transition;if(!m)d.__transition={};else if(k in m)return;Rqn(d,k,{name:v,index:x,group:C,on:_qn,tween:Fqn,time:I.time,delay:I.delay,duration:I.duration,ease:I.ease,timer:null,state:Sdn})}function f2e(d,v){var k=gp(d,v);if(k.state>Sdn)throw new Error("too late; already scheduled");return k}function cm(d,v){var k=gp(d,v);if(k.state>vX)throw new Error("too late; already running");return k}function gp(d,v){var k=d.__transition;if(!k||!(k=k[v]))throw new Error("transition not found");return k}function Rqn(d,v,k){var x=d.__transition,C;x[v]=k,k.timer=xdn(I,0,k.time);function I(F){k.state=Oan,k.timer.restart(m,k.delay,k.time),k.delay<=F&&m(F-k.delay)}function m(F){var z,X,K,Y;if(k.state!==Oan)return G();for(z in x)if(Y=x[z],Y.name===k.name){if(Y.state===vX)return Nan(m);Y.state===$an?(Y.state=yX,Y.timer.stop(),Y.on.call("interrupt",d,d.__data__,Y.index,Y.group),delete x[z]):+z<v&&(Y.state=yX,Y.timer.stop(),Y.on.call("cancel",d,d.__data__,Y.index,Y.group),delete x[z])}if(Nan(function(){k.state===vX&&(k.state=$an,k.timer.restart(L,k.delay,k.time),L(F))}),k.state=qpe,k.on.call("start",d,d.__data__,k.index,k.group),k.state===qpe){for(k.state=vX,C=new Array(K=k.tween.length),z=0,X=-1;z<K;++z)(Y=k.tween[z].value.call(d,d.__data__,k.index,k.group))&&(C[++X]=Y);C.length=X+1}}function L(F){for(var z=F<k.duration?k.ease.call(null,F/k.duration):(k.timer.restart(G),k.state=zpe,1),X=-1,K=C.length;++X<K;)C[X].call(d,z);k.state===zpe&&(k.on.call("end",d,d.__data__,k.index,k.group),G())}function G(){k.state=yX,k.timer.stop(),delete x[v];for(var F in x)return;delete d.__transition}}function kX(d,v){var k=d.__transition,x,C,I=!0,m;if(k){v=v==null?null:v+"";for(m in k){if((x=k[m]).name!==v){I=!1;continue}C=x.state>qpe&&x.state<zpe,x.state=yX,x.timer.stop(),x.on.call(C?"interrupt":"cancel",d,d.__data__,x.index,x.group),delete k[m]}I&&delete d.__transition}}function Bqn(d){return this.each(function(){kX(this,d)})}function Jqn(d,v){var k,x;return function(){var C=cm(this,d),I=C.tween;if(I!==k){x=k=I;for(var m=0,L=x.length;m<L;++m)if(x[m].name===v){x=x.slice(),x.splice(m,1);break}}C.tween=x}}function Hqn(d,v,k){var x,C;if(typeof k!="function")throw new Error;return function(){var I=cm(this,d),m=I.tween;if(m!==x){C=(x=m).slice();for(var L={name:v,value:k},G=0,F=C.length;G<F;++G)if(C[G].name===v){C[G]=L;break}G===F&&C.push(L)}I.tween=C}}function Gqn(d,v){var k=this._id;if(d+="",arguments.length<2){for(var x=gp(this.node(),k).tween,C=0,I=x.length,m;C<I;++C)if((m=x[C]).name===d)return m.value;return null}return this.each((v==null?Jqn:Hqn)(k,d,v))}function l2e(d,v,k){var x=d._id;return d.each(function(){var C=cm(this,x);(C.value||(C.value={}))[v]=k.apply(this,arguments)}),function(C){return gp(C,x).value[v]}}function Cdn(d,v){var k;return(typeof v=="number"?tm:v instanceof V8?AX:(k=V8(v))?(v=k,AX):vdn)(d,v)}function qqn(d){return function(){this.removeAttribute(d)}}function zqn(d){return function(){this.removeAttributeNS(d.space,d.local)}}function Uqn(d,v,k){var x,C=k+"",I;return function(){var m=this.getAttribute(d);return m===C?null:m===x?I:I=v(x=m,k)}}function Kqn(d,v,k){var x,C=k+"",I;return function(){var m=this.getAttributeNS(d.space,d.local);return m===C?null:m===x?I:I=v(x=m,k)}}function Xqn(d,v,k){var x,C,I;return function(){var m,L=k(this),G;return L==null?void this.removeAttribute(d):(m=this.getAttribute(d),G=L+"",m===G?null:m===x&&G===C?I:(C=G,I=v(x=m,L)))}}function Wqn(d,v,k){var x,C,I;return function(){var m,L=k(this),G;return L==null?void this.removeAttributeNS(d.space,d.local):(m=this.getAttributeNS(d.space,d.local),G=L+"",m===G?null:m===x&&G===C?I:(C=G,I=v(x=m,L)))}}function Vqn(d,v){var k=GX(d),x=k==="transform"?Tqn:Cdn;return this.attrTween(d,typeof v=="function"?(k.local?Wqn:Xqn)(k,x,l2e(this,"attr."+d,v)):v==null?(k.local?zqn:qqn)(k):(k.local?Kqn:Uqn)(k,x,v))}function Qqn(d,v){return function(k){this.setAttribute(d,v.call(this,k))}}function Yqn(d,v){return function(k){this.setAttributeNS(d.space,d.local,v.call(this,k))}}function Zqn(d,v){var k,x;function C(){var I=v.apply(this,arguments);return I!==x&&(k=(x=I)&&Yqn(d,I)),k}return C._value=v,C}function ezn(d,v){var k,x;function C(){var I=v.apply(this,arguments);return I!==x&&(k=(x=I)&&Qqn(d,I)),k}return C._value=v,C}function nzn(d,v){var k="attr."+d;if(arguments.length<2)return(k=this.tween(k))&&k._value;if(v==null)return this.tween(k,null);if(typeof v!="function")throw new Error;var x=GX(d);return this.tween(k,(x.local?Zqn:ezn)(x,v))}function tzn(d,v){return function(){f2e(this,d).delay=+v.apply(this,arguments)}}function izn(d,v){return v=+v,function(){f2e(this,d).delay=v}}function rzn(d){var v=this._id;return arguments.length?this.each((typeof d=="function"?tzn:izn)(v,d)):gp(this.node(),v).delay}function czn(d,v){return function(){cm(this,d).duration=+v.apply(this,arguments)}}function uzn(d,v){return v=+v,function(){cm(this,d).duration=v}}function ozn(d){var v=this._id;return arguments.length?this.each((typeof d=="function"?czn:uzn)(v,d)):gp(this.node(),v).duration}function szn(d,v){if(typeof v!="function")throw new Error;return function(){cm(this,d).ease=v}}function fzn(d){var v=this._id;return arguments.length?this.each(szn(v,d)):gp(this.node(),v).ease}function lzn(d,v){return function(){var k=v.apply(this,arguments);if(typeof k!="function")throw new Error;cm(this,d).ease=k}}function hzn(d){if(typeof d!="function")throw new Error;return this.each(lzn(this._id,d))}function azn(d){typeof d!="function"&&(d=idn(d));for(var v=this._groups,k=v.length,x=new Array(k),C=0;C<k;++C)for(var I=v[C],m=I.length,L=x[C]=[],G,F=0;F<m;++F)(G=I[F])&&d.call(G,G.__data__,F,I)&&L.push(G);return new mv(x,this._parents,this._name,this._id)}function dzn(d){if(d._id!==this._id)throw new Error;for(var v=this._groups,k=d._groups,x=v.length,C=k.length,I=Math.min(x,C),m=new Array(x),L=0;L<I;++L)for(var G=v[L],F=k[L],z=G.length,X=m[L]=new Array(z),K,Y=0;Y<z;++Y)(K=G[Y]||F[Y])&&(X[Y]=K);for(;L<x;++L)m[L]=v[L];return new mv(m,this._parents,this._name,this._id)}function bzn(d){return(d+"").trim().split(/^|\s+/).every(function(v){var k=v.indexOf(".");return k>=0&&(v=v.slice(0,k)),!v||v==="start"})}function wzn(d,v,k){var x,C,I=bzn(v)?f2e:cm;return function(){var m=I(this,d),L=m.on;L!==x&&(C=(x=L).copy()).on(v,k),m.on=C}}function gzn(d,v){var k=this._id;return arguments.length<2?gp(this.node(),k).on.on(d):this.each(wzn(k,d,v))}function pzn(d){return function(){var v=this.parentNode;for(var k in this.__transition)if(+k!==d)return;v&&v.removeChild(this)}}function mzn(){return this.on("end.remove",pzn(this._id))}function vzn(d){var v=this._name,k=this._id;typeof d!="function"&&(d=r2e(d));for(var x=this._groups,C=x.length,I=new Array(C),m=0;m<C;++m)for(var L=x[m],G=L.length,F=I[m]=new Array(G),z,X,K=0;K<G;++K)(z=L[K])&&(X=d.call(z,z.__data__,K,L))&&("__data__"in z&&(X.__data__=z.__data__),F[K]=X,zX(F[K],v,k,K,F,gp(z,k)));return new mv(I,this._parents,v,k)}function yzn(d){var v=this._name,k=this._id;typeof d!="function"&&(d=tdn(d));for(var x=this._groups,C=x.length,I=[],m=[],L=0;L<C;++L)for(var G=x[L],F=G.length,z,X=0;X<F;++X)if(z=G[X]){for(var K=d.call(z,z.__data__,X,G),Y,ie=gp(z,k),W=0,pe=K.length;W<pe;++W)(Y=K[W])&&zX(Y,v,k,W,K,ie);I.push(K),m.push(z)}return new mv(I,m,v,k)}var kzn=I$.prototype.constructor;function Ezn(){return new kzn(this._groups,this._parents)}function jzn(d,v){var k,x,C;return function(){var I=JS(this,d),m=(this.style.removeProperty(d),JS(this,d));return I===m?null:I===k&&m===x?C:C=v(k=I,x=m)}}function Adn(d){return function(){this.style.removeProperty(d)}}function xzn(d,v,k){var x,C=k+"",I;return function(){var m=JS(this,d);return m===C?null:m===x?I:I=v(x=m,k)}}function Szn(d,v,k){var x,C,I;return function(){var m=JS(this,d),L=k(this),G=L+"";return L==null&&(G=L=(this.style.removeProperty(d),JS(this,d))),m===G?null:m===x&&G===C?I:(C=G,I=v(x=m,L))}}function Czn(d,v){var k,x,C,I="style."+v,m="end."+I,L;return function(){var G=cm(this,d),F=G.on,z=G.value[I]==null?L||(L=Adn(v)):void 0;(F!==k||C!==z)&&(x=(k=F).copy()).on(m,C=z),G.on=x}}function Azn(d,v,k){var x=(d+="")=="transform"?Mqn:Cdn;return v==null?this.styleTween(d,jzn(d,x)).on("end.style."+d,Adn(d)):typeof v=="function"?this.styleTween(d,Szn(d,x,l2e(this,"style."+d,v))).each(Czn(this._id,d)):this.styleTween(d,xzn(d,x,v),k).on("end.style."+d,null)}function Mzn(d,v,k){return function(x){this.style.setProperty(d,v.call(this,x),k)}}function Tzn(d,v,k){var x,C;function I(){var m=v.apply(this,arguments);return m!==C&&(x=(C=m)&&Mzn(d,m,k)),x}return I._value=v,I}function Izn(d,v,k){var x="style."+(d+="");if(arguments.length<2)return(x=this.tween(x))&&x._value;if(v==null)return this.tween(x,null);if(typeof v!="function")throw new Error;return this.tween(x,Tzn(d,v,k??""))}function Pzn(d){return function(){this.textContent=d}}function Nzn(d){return function(){var v=d(this);this.textContent=v??""}}function Ozn(d){return this.tween("text",typeof d=="function"?Nzn(l2e(this,"text",d)):Pzn(d==null?"":d+""))}function $zn(d){return function(v){this.textContent=d.call(this,v)}}function Dzn(d){var v,k;function x(){var C=d.apply(this,arguments);return C!==k&&(v=(k=C)&&$zn(C)),v}return x._value=d,x}function Lzn(d){var v="text";if(arguments.length<1)return(v=this.tween(v))&&v._value;if(d==null)return this.tween(v,null);if(typeof d!="function")throw new Error;return this.tween(v,Dzn(d))}function _zn(){for(var d=this._name,v=this._id,k=Mdn(),x=this._groups,C=x.length,I=0;I<C;++I)for(var m=x[I],L=m.length,G,F=0;F<L;++F)if(G=m[F]){var z=gp(G,v);zX(G,d,k,F,m,{time:z.time+z.delay+z.duration,delay:0,duration:z.duration,ease:z.ease})}return new mv(x,this._parents,d,k)}function Fzn(){var d,v,k=this,x=k._id,C=k.size();return new Promise(function(I,m){var L={value:m},G={value:function(){--C===0&&I()}};k.each(function(){var F=cm(this,x),z=F.on;z!==d&&(v=(d=z).copy(),v._.cancel.push(L),v._.interrupt.push(L),v._.end.push(G)),F.on=v}),C===0&&I()})}var Rzn=0;function mv(d,v,k,x){this._groups=d,this._parents=v,this._name=k,this._id=x}function Mdn(){return++Rzn}var wv=I$.prototype;mv.prototype={constructor:mv,select:vzn,selectAll:yzn,selectChild:wv.selectChild,selectChildren:wv.selectChildren,filter:azn,merge:dzn,selection:Ezn,transition:_zn,call:wv.call,nodes:wv.nodes,node:wv.node,size:wv.size,empty:wv.empty,each:wv.each,on:gzn,attr:Vqn,attrTween:nzn,style:Azn,styleTween:Izn,text:Ozn,textTween:Lzn,remove:mzn,tween:Gqn,delay:rzn,duration:ozn,ease:fzn,easeVarying:hzn,end:Fzn,[Symbol.iterator]:wv[Symbol.iterator]};function Bzn(d){return((d*=2)<=1?d*d*d:(d-=2)*d*d+2)/2}var Jzn={time:null,delay:0,duration:250,ease:Bzn};function Hzn(d,v){for(var k;!(k=d.__transition)||!(k=k[v]);)if(!(d=d.parentNode))throw new Error(`transition ${v} not found`);return k}function Gzn(d){var v,k;d instanceof mv?(v=d._id,d=d._name):(v=Mdn(),(k=Jzn).time=s2e(),d=d==null?null:d+"");for(var x=this._groups,C=x.length,I=0;I<C;++I)for(var m=x[I],L=m.length,G,F=0;F<L;++F)(G=m[F])&&zX(G,d,v,F,m,k||Hzn(G,v));return new mv(x,this._parents,d,v)}I$.prototype.interrupt=Bqn;I$.prototype.transition=Gzn;const lX=d=>()=>d;function qzn(d,{sourceEvent:v,target:k,transform:x,dispatch:C}){Object.defineProperties(this,{type:{value:d,enumerable:!0,configurable:!0},sourceEvent:{value:v,enumerable:!0,configurable:!0},target:{value:k,enumerable:!0,configurable:!0},transform:{value:x,enumerable:!0,configurable:!0},_:{value:C}})}function gv(d,v,k){this.k=d,this.x=v,this.y=k}gv.prototype={constructor:gv,scale:function(d){return d===1?this:new gv(this.k*d,this.x,this.y)},translate:function(d,v){return d===0&v===0?this:new gv(this.k,this.x+this.k*d,this.y+this.k*v)},apply:function(d){return[d[0]*this.k+this.x,d[1]*this.k+this.y]},applyX:function(d){return d*this.k+this.x},applyY:function(d){return d*this.k+this.y},invert:function(d){return[(d[0]-this.x)/this.k,(d[1]-this.y)/this.k]},invertX:function(d){return(d-this.x)/this.k},invertY:function(d){return(d-this.y)/this.k},rescaleX:function(d){return d.copy().domain(d.range().map(this.invertX,this).map(d.invert,d))},rescaleY:function(d){return d.copy().domain(d.range().map(this.invertY,this).map(d.invert,d))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var UX=new gv(1,0,0);Tdn.prototype=gv.prototype;function Tdn(d){for(;!d.__zoom;)if(!(d=d.parentNode))return UX;return d.__zoom}function Spe(d){d.stopImmediatePropagation()}function b$(d){d.preventDefault(),d.stopImmediatePropagation()}function zzn(d){return(!d.ctrlKey||d.type==="wheel")&&!d.button}function Uzn(){var d=this;return d instanceof SVGElement?(d=d.ownerSVGElement||d,d.hasAttribute("viewBox")?(d=d.viewBox.baseVal,[[d.x,d.y],[d.x+d.width,d.y+d.height]]):[[0,0],[d.width.baseVal.value,d.height.baseVal.value]]):[[0,0],[d.clientWidth,d.clientHeight]]}function Dan(){return this.__zoom||UX}function Kzn(d){return-d.deltaY*(d.deltaMode===1?.05:d.deltaMode?1:.002)*(d.ctrlKey?10:1)}function Xzn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wzn(d,v,k){var x=d.invertX(v[0][0])-k[0][0],C=d.invertX(v[1][0])-k[1][0],I=d.invertY(v[0][1])-k[0][1],m=d.invertY(v[1][1])-k[1][1];return d.translate(C>x?(x+C)/2:Math.min(0,x)||Math.max(0,C),m>I?(I+m)/2:Math.min(0,I)||Math.max(0,m))}function Idn(){var d=zzn,v=Uzn,k=Wzn,x=Kzn,C=Xzn,I=[0,1/0],m=[[-1/0,-1/0],[1/0,1/0]],L=250,G=mX,F=HX("start","zoom","end"),z,X,K,Y=500,ie=150,W=0,pe=10;function fe(ye){ye.property("__zoom",Dan).on("wheel.zoom",Ze,{passive:!1}).on("mousedown.zoom",rn).on("dblclick.zoom",Bn).filter(C).on("touchstart.zoom",Ln).on("touchmove.zoom",mn).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}fe.transform=function(ye,Oe,Qe,fn){var gn=ye.selection?ye.selection():ye;gn.property("__zoom",Dan),ye!==gn?qe(ye,Oe,Qe,fn):gn.interrupt().each(function(){Ne(this,arguments).event(fn).start().zoom(null,typeof Oe=="function"?Oe.apply(this,arguments):Oe).end()})},fe.scaleBy=function(ye,Oe,Qe,fn){fe.scaleTo(ye,function(){var gn=this.__zoom.k,On=typeof Oe=="function"?Oe.apply(this,arguments):Oe;return gn*On},Qe,fn)},fe.scaleTo=function(ye,Oe,Qe,fn){fe.transform(ye,function(){var gn=v.apply(this,arguments),On=this.__zoom,Vn=Qe==null?he(gn):typeof Qe=="function"?Qe.apply(this,arguments):Qe,Zn=On.invert(Vn),nt=typeof Oe=="function"?Oe.apply(this,arguments):Oe;return k(te(je(On,nt),Vn,Zn),gn,m)},Qe,fn)},fe.translateBy=function(ye,Oe,Qe,fn){fe.transform(ye,function(){return k(this.__zoom.translate(typeof Oe=="function"?Oe.apply(this,arguments):Oe,typeof Qe=="function"?Qe.apply(this,arguments):Qe),v.apply(this,arguments),m)},null,fn)},fe.translateTo=function(ye,Oe,Qe,fn,gn){fe.transform(ye,function(){var On=v.apply(this,arguments),Vn=this.__zoom,Zn=fn==null?he(On):typeof fn=="function"?fn.apply(this,arguments):fn;return k(UX.translate(Zn[0],Zn[1]).scale(Vn.k).translate(typeof Oe=="function"?-Oe.apply(this,arguments):-Oe,typeof Qe=="function"?-Qe.apply(this,arguments):-Qe),On,m)},fn,gn)};function je(ye,Oe){return Oe=Math.max(I[0],Math.min(I[1],Oe)),Oe===ye.k?ye:new gv(Oe,ye.x,ye.y)}function te(ye,Oe,Qe){var fn=Oe[0]-Qe[0]*ye.k,gn=Oe[1]-Qe[1]*ye.k;return fn===ye.x&&gn===ye.y?ye:new gv(ye.k,fn,gn)}function he(ye){return[(+ye[0][0]+ +ye[1][0])/2,(+ye[0][1]+ +ye[1][1])/2]}function qe(ye,Oe,Qe,fn){ye.on("start.zoom",function(){Ne(this,arguments).event(fn).start()}).on("interrupt.zoom end.zoom",function(){Ne(this,arguments).event(fn).end()}).tween("zoom",function(){var gn=this,On=arguments,Vn=Ne(gn,On).event(fn),Zn=v.apply(gn,On),nt=Qe==null?he(Zn):typeof Qe=="function"?Qe.apply(gn,On):Qe,ai=Math.max(Zn[1][0]-Zn[0][0],Zn[1][1]-Zn[0][1]),ti=gn.__zoom,vi=typeof Oe=="function"?Oe.apply(gn,On):Oe,fr=G(ti.invert(nt).concat(ai/ti.k),vi.invert(nt).concat(ai/vi.k));return function(wi){if(wi===1)wi=vi;else{var Un=fr(wi),Xt=ai/Un[2];wi=new gv(Xt,nt[0]-Un[0]*Xt,nt[1]-Un[1]*Xt)}Vn.zoom(null,wi)}})}function Ne(ye,Oe,Qe){return!Qe&&ye.__zooming||new Me(ye,Oe)}function Me(ye,Oe){this.that=ye,this.args=Oe,this.active=0,this.sourceEvent=null,this.extent=v.apply(ye,Oe),this.taps=0}Me.prototype={event:function(ye){return ye&&(this.sourceEvent=ye),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(ye,Oe){return this.mouse&&ye!=="mouse"&&(this.mouse[1]=Oe.invert(this.mouse[0])),this.touch0&&ye!=="touch"&&(this.touch0[1]=Oe.invert(this.touch0[0])),this.touch1&&ye!=="touch"&&(this.touch1[1]=Oe.invert(this.touch1[0])),this.that.__zoom=Oe,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(ye){var Oe=X0(this.that).datum();F.call(ye,this.that,new qzn(ye,{sourceEvent:this.sourceEvent,target:fe,transform:this.that.__zoom,dispatch:F}),Oe)}};function Ze(ye,...Oe){if(!d.apply(this,arguments))return;var Qe=Ne(this,Oe).event(ye),fn=this.__zoom,gn=Math.max(I[0],Math.min(I[1],fn.k*Math.pow(2,x.apply(this,arguments)))),On=hp(ye);if(Qe.wheel)(Qe.mouse[0][0]!==On[0]||Qe.mouse[0][1]!==On[1])&&(Qe.mouse[1]=fn.invert(Qe.mouse[0]=On)),clearTimeout(Qe.wheel);else{if(fn.k===gn)return;Qe.mouse=[On,fn.invert(On)],kX(this),Qe.start()}b$(ye),Qe.wheel=setTimeout(Vn,ie),Qe.zoom("mouse",k(te(je(fn,gn),Qe.mouse[0],Qe.mouse[1]),Qe.extent,m));function Vn(){Qe.wheel=null,Qe.end()}}function rn(ye,...Oe){if(K||!d.apply(this,arguments))return;var Qe=ye.currentTarget,fn=Ne(this,Oe,!0).event(ye),gn=X0(ye.view).on("mousemove.zoom",nt,!0).on("mouseup.zoom",ai,!0),On=hp(ye,Qe),Vn=ye.clientX,Zn=ye.clientY;ddn(ye.view),Spe(ye),fn.mouse=[On,this.__zoom.invert(On)],kX(this),fn.start();function nt(ti){if(b$(ti),!fn.moved){var vi=ti.clientX-Vn,fr=ti.clientY-Zn;fn.moved=vi*vi+fr*fr>W}fn.event(ti).zoom("mouse",k(te(fn.that.__zoom,fn.mouse[0]=hp(ti,Qe),fn.mouse[1]),fn.extent,m))}function ai(ti){gn.on("mousemove.zoom mouseup.zoom",null),bdn(ti.view,fn.moved),b$(ti),fn.event(ti).end()}}function Bn(ye,...Oe){if(d.apply(this,arguments)){var Qe=this.__zoom,fn=hp(ye.changedTouches?ye.changedTouches[0]:ye,this),gn=Qe.invert(fn),On=Qe.k*(ye.shiftKey?.5:2),Vn=k(te(je(Qe,On),fn,gn),v.apply(this,Oe),m);b$(ye),L>0?X0(this).transition().duration(L).call(qe,Vn,fn,ye):X0(this).call(fe.transform,Vn,fn,ye)}}function Ln(ye,...Oe){if(d.apply(this,arguments)){var Qe=ye.touches,fn=Qe.length,gn=Ne(this,Oe,ye.changedTouches.length===fn).event(ye),On,Vn,Zn,nt;for(Spe(ye),Vn=0;Vn<fn;++Vn)Zn=Qe[Vn],nt=hp(Zn,this),nt=[nt,this.__zoom.invert(nt),Zn.identifier],gn.touch0?!gn.touch1&&gn.touch0[2]!==nt[2]&&(gn.touch1=nt,gn.taps=0):(gn.touch0=nt,On=!0,gn.taps=1+!!z);z&&(z=clearTimeout(z)),On&&(gn.taps<2&&(X=nt[0],z=setTimeout(function(){z=null},Y)),kX(this),gn.start())}}function mn(ye,...Oe){if(this.__zooming){var Qe=Ne(this,Oe).event(ye),fn=ye.changedTouches,gn=fn.length,On,Vn,Zn,nt;for(b$(ye),On=0;On<gn;++On)Vn=fn[On],Zn=hp(Vn,this),Qe.touch0&&Qe.touch0[2]===Vn.identifier?Qe.touch0[0]=Zn:Qe.touch1&&Qe.touch1[2]===Vn.identifier&&(Qe.touch1[0]=Zn);if(Vn=Qe.that.__zoom,Qe.touch1){var ai=Qe.touch0[0],ti=Qe.touch0[1],vi=Qe.touch1[0],fr=Qe.touch1[1],wi=(wi=vi[0]-ai[0])*wi+(wi=vi[1]-ai[1])*wi,Un=(Un=fr[0]-ti[0])*Un+(Un=fr[1]-ti[1])*Un;Vn=je(Vn,Math.sqrt(wi/Un)),Zn=[(ai[0]+vi[0])/2,(ai[1]+vi[1])/2],nt=[(ti[0]+fr[0])/2,(ti[1]+fr[1])/2]}else if(Qe.touch0)Zn=Qe.touch0[0],nt=Qe.touch0[1];else return;Qe.zoom("touch",k(te(Vn,Zn,nt),Qe.extent,m))}}function B(ye,...Oe){if(this.__zooming){var Qe=Ne(this,Oe).event(ye),fn=ye.changedTouches,gn=fn.length,On,Vn;for(Spe(ye),K&&clearTimeout(K),K=setTimeout(function(){K=null},Y),On=0;On<gn;++On)Vn=fn[On],Qe.touch0&&Qe.touch0[2]===Vn.identifier?delete Qe.touch0:Qe.touch1&&Qe.touch1[2]===Vn.identifier&&delete Qe.touch1;if(Qe.touch1&&!Qe.touch0&&(Qe.touch0=Qe.touch1,delete Qe.touch1),Qe.touch0)Qe.touch0[1]=this.__zoom.invert(Qe.touch0[0]);else if(Qe.end(),Qe.taps===2&&(Vn=hp(Vn,this),Math.hypot(X[0]-Vn[0],X[1]-Vn[1])<pe)){var Zn=X0(this).on("dblclick.zoom");Zn&&Zn.apply(this,arguments)}}}return fe.wheelDelta=function(ye){return arguments.length?(x=typeof ye=="function"?ye:lX(+ye),fe):x},fe.filter=function(ye){return arguments.length?(d=typeof ye=="function"?ye:lX(!!ye),fe):d},fe.touchable=function(ye){return arguments.length?(C=typeof ye=="function"?ye:lX(!!ye),fe):C},fe.extent=function(ye){return arguments.length?(v=typeof ye=="function"?ye:lX([[+ye[0][0],+ye[0][1]],[+ye[1][0],+ye[1][1]]]),fe):v},fe.scaleExtent=function(ye){return arguments.length?(I[0]=+ye[0],I[1]=+ye[1],fe):[I[0],I[1]]},fe.translateExtent=function(ye){return arguments.length?(m[0][0]=+ye[0][0],m[1][0]=+ye[1][0],m[0][1]=+ye[0][1],m[1][1]=+ye[1][1],fe):[[m[0][0],m[0][1]],[m[1][0],m[1][1]]]},fe.constrain=function(ye){return arguments.length?(k=ye,fe):k},fe.duration=function(ye){return arguments.length?(L=+ye,fe):L},fe.interpolate=function(ye){return arguments.length?(G=ye,fe):G},fe.on=function(){var ye=F.on.apply(F,arguments);return ye===F?fe:ye},fe.clickDistance=function(ye){return arguments.length?(W=(ye=+ye)*ye,fe):Math.sqrt(W)},fe.tapDistance=function(ye){return arguments.length?(pe=+ye,fe):pe},fe}const wp={error001:(d="react")=>`Seems like you have not used ${d==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${d}flow.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:d=>`Node type "${d}" not found. Using fallback type "default".`,error004:()=>"The 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:d=>`The old edge with id=${d} does not exist.`,error009:d=>`Marker type "${d}" doesn't exist.`,error008:(d,{id:v,sourceHandle:k,targetHandle:x})=>`Couldn't create edge for ${d} handle id: "${d==="source"?k:x}", edge id: ${v}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:d=>`Edge type "${d}" not found. Using fallback type "default".`,error012:d=>`Node with id "${d}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(d="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${d}/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.",error016:d=>`Edge with id "${d}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},x$=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Pdn=["Enter"," ","Escape"],Ndn={"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:d,x:v,y:k})=>`Moved selected node ${d}. New position, x: ${v}, y: ${k}`,"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 GS;(function(d){d.Strict="strict",d.Loose="loose"})(GS||(GS={}));var X8;(function(d){d.Free="free",d.Vertical="vertical",d.Horizontal="horizontal"})(X8||(X8={}));var S$;(function(d){d.Partial="partial",d.Full="full"})(S$||(S$={}));const Odn={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var E6;(function(d){d.Bezier="default",d.Straight="straight",d.Step="step",d.SmoothStep="smoothstep",d.SimpleBezier="simplebezier"})(E6||(E6={}));var C$;(function(d){d.Arrow="arrow",d.ArrowClosed="arrowclosed"})(C$||(C$={}));var tr;(function(d){d.Left="left",d.Top="top",d.Right="right",d.Bottom="bottom"})(tr||(tr={}));const Lan={[tr.Left]:tr.Right,[tr.Right]:tr.Left,[tr.Top]:tr.Bottom,[tr.Bottom]:tr.Top};function $dn(d){return d===null?null:d?"valid":"invalid"}const Ddn=d=>!!d&&typeof d=="object"&&"id"in d&&"source"in d&&"target"in d,Vzn=d=>!!d&&typeof d=="object"&&"id"in d&&"position"in d&&!("source"in d)&&!("target"in d),h2e=d=>!!d&&typeof d=="object"&&"id"in d&&"internals"in d&&!("source"in d)&&!("target"in d),N$=(d,v=[0,0])=>{const{width:k,height:x}=um(d),C=d.origin??v,I=k*C[0],m=x*C[1];return{x:d.position.x-I,y:d.position.y-m}},Qzn=(d,v={nodeOrigin:[0,0]})=>{if(d.length===0)return{x:0,y:0,width:0,height:0};const k=d.reduce((x,C)=>{const I=typeof C=="string";let m=!v.nodeLookup&&!I?C:void 0;v.nodeLookup&&(m=I?v.nodeLookup.get(C):h2e(C)?C:v.nodeLookup.get(C.id));const L=m?PX(m,v.nodeOrigin):{x:0,y:0,x2:0,y2:0};return KX(x,L)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return XX(k)},O$=(d,v={})=>{let k={x:1/0,y:1/0,x2:-1/0,y2:-1/0},x=!1;return d.forEach(C=>{(v.filter===void 0||v.filter(C))&&(k=KX(k,PX(C)),x=!0)}),x?XX(k):{x:0,y:0,width:0,height:0}},a2e=(d,v,[k,x,C]=[0,0,1],I=!1,m=!1)=>{const L=(v.x-k)/C,G=(v.y-x)/C,F=v.width/C,z=v.height/C,X=[];for(const K of d.values()){const{measured:Y,selectable:ie=!0,hidden:W=!1}=K;if(m&&!ie||W)continue;const pe=Y.width??K.width??K.initialWidth??0,fe=Y.height??K.height??K.initialHeight??0,{x:je,y:te}=K.internals.positionAbsolute,he=Rdn(L,G,F,z,je,te,pe,fe),qe=pe*fe,Ne=I&&he>0;(!K.internals.handleBounds||Ne||he>=qe||K.dragging)&&X.push(K)}return X},Yzn=(d,v)=>{const k=new Set;return d.forEach(x=>{k.add(x.id)}),v.filter(x=>k.has(x.source)||k.has(x.target))};function Zzn(d,v){const k=new Map,x=v?.nodes?new Set(v.nodes.map(C=>C.id)):null;return d.forEach(C=>{let I;if(v?.includeHiddenNodes){const{width:m,height:L}=um(C);I=m>0&&L>0}else I=!!(C.measured.width&&C.measured.height&&!C.hidden);I&&(!x||x.has(C.id))&&k.set(C.id,C)}),k}async function eUn({nodes:d,width:v,height:k,panZoom:x,minZoom:C,maxZoom:I},m){if(d.size===0)return!0;const L=Zzn(d,m),G=O$(L),F=b2e(G,v,k,m?.minZoom??C,m?.maxZoom??I,m?.padding??.1);return await x.setViewport(F,{duration:m?.duration,ease:m?.ease,interpolate:m?.interpolate}),!0}function Ldn({nodeId:d,nextPosition:v,nodeLookup:k,nodeOrigin:x=[0,0],nodeExtent:C,onError:I}){const m=k.get(d),L=m.parentId?k.get(m.parentId):void 0,{x:G,y:F}=L?L.internals.positionAbsolute:{x:0,y:0},z=m.origin??x;let X=m.extent||C;if(m.extent==="parent"&&!m.expandParent)if(!L)I?.("005",wp.error005());else{const Y=L.measured.width,ie=L.measured.height;Y&&ie&&(X=[[G,F],[G+Y,F+ie]])}else L&&Z8(m.extent)&&(X=[[m.extent[0][0]+G,m.extent[0][1]+F],[m.extent[1][0]+G,m.extent[1][1]+F]]);const K=Z8(X)?Y8(v,X,m.measured):v;return(m.measured.width===void 0||m.measured.height===void 0)&&I?.("015",wp.error015()),{position:{x:K.x-G+(m.measured.width??0)*z[0],y:K.y-F+(m.measured.height??0)*z[1]},positionAbsolute:K}}async function nUn({nodesToRemove:d=[],edgesToRemove:v=[],nodes:k,edges:x,onBeforeDelete:C}){const I=new Set(d.map(K=>K.id)),m=[];for(const K of k){if(K.deletable===!1)continue;const Y=I.has(K.id),ie=!Y&&K.parentId&&m.find(W=>W.id===K.parentId);(Y||ie)&&m.push(K)}const L=new Set(v.map(K=>K.id)),G=x.filter(K=>K.deletable!==!1),z=Yzn(m,G);for(const K of G)L.has(K.id)&&!z.find(ie=>ie.id===K.id)&&z.push(K);if(!C)return{edges:z,nodes:m};const X=await C({nodes:m,edges:z});return typeof X=="boolean"?X?{edges:z,nodes:m}:{edges:[],nodes:[]}:X}const qS=(d,v=0,k=1)=>Math.min(Math.max(d,v),k),Y8=(d={x:0,y:0},v,k)=>({x:qS(d.x,v[0][0],v[1][0]-(k?.width??0)),y:qS(d.y,v[0][1],v[1][1]-(k?.height??0))});function _dn(d,v,k){const{width:x,height:C}=um(k),{x:I,y:m}=k.internals.positionAbsolute;return Y8(d,[[I,m],[I+x,m+C]],v)}const _an=(d,v,k)=>d<v?qS(Math.abs(d-v),1,v)/v:d>k?-qS(Math.abs(d-k),1,v)/v:0,d2e=(d,v,k=15,x=40)=>{const C=_an(d.x,x,v.width-x)*k,I=_an(d.y,x,v.height-x)*k;return[C,I]},KX=(d,v)=>({x:Math.min(d.x,v.x),y:Math.min(d.y,v.y),x2:Math.max(d.x2,v.x2),y2:Math.max(d.y2,v.y2)}),Upe=({x:d,y:v,width:k,height:x})=>({x:d,y:v,x2:d+k,y2:v+x}),XX=({x:d,y:v,x2:k,y2:x})=>({x:d,y:v,width:k-d,height:x-v}),A$=(d,v=[0,0])=>{const{x:k,y:x}=h2e(d)?d.internals.positionAbsolute:N$(d,v);return{x:k,y:x,width:d.measured?.width??d.width??d.initialWidth??0,height:d.measured?.height??d.height??d.initialHeight??0}},PX=(d,v=[0,0])=>{const{x:k,y:x}=h2e(d)?d.internals.positionAbsolute:N$(d,v);return{x:k,y:x,x2:k+(d.measured?.width??d.width??d.initialWidth??0),y2:x+(d.measured?.height??d.height??d.initialHeight??0)}},Fdn=(d,v)=>XX(KX(Upe(d),Upe(v))),Rdn=(d,v,k,x,C,I,m,L)=>{const G=Math.max(0,Math.min(d+k,C+m)-Math.max(d,C)),F=Math.max(0,Math.min(v+x,I+L)-Math.max(v,I));return Math.ceil(G*F)},NX=(d,v)=>Rdn(d.x,d.y,d.width,d.height,v.x,v.y,v.width,v.height),Fan=d=>dp(d.width)&&dp(d.height)&&dp(d.x)&&dp(d.y),dp=d=>!isNaN(d)&&isFinite(d),Bdn=(d,v)=>(k,x)=>{},$$=(d,v=[1,1])=>({x:v[0]*Math.round(d.x/v[0]),y:v[1]*Math.round(d.y/v[1])}),D$=({x:d,y:v},[k,x,C],I=!1,m=[1,1])=>{const L={x:(d-k)/C,y:(v-x)/C};return I?$$(L,m):L},zS=({x:d,y:v},[k,x,C])=>({x:d*C+k,y:v*C+x});function PS(d,v){if(typeof d=="number")return Math.floor((v-v/(1+d))*.5);if(typeof d=="string"&&d.endsWith("px")){const k=parseFloat(d);if(!Number.isNaN(k))return Math.floor(k)}if(typeof d=="string"&&d.endsWith("%")){const k=parseFloat(d);if(!Number.isNaN(k))return Math.floor(v*k*.01)}return console.error(`The padding value "${d}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function tUn(d,v,k){if(typeof d=="string"||typeof d=="number"){const x=PS(d,k),C=PS(d,v);return{top:x,right:C,bottom:x,left:C,x:C*2,y:x*2}}if(typeof d=="object"){const x=PS(d.top??d.y??0,k),C=PS(d.bottom??d.y??0,k),I=PS(d.left??d.x??0,v),m=PS(d.right??d.x??0,v);return{top:x,right:m,bottom:C,left:I,x:I+m,y:x+C}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function iUn(d,v,k,x,C,I){const{x:m,y:L}=zS(d,[v,k,x]),{x:G,y:F}=zS({x:d.x+d.width,y:d.y+d.height},[v,k,x]),z=C-G,X=I-F;return{left:Math.floor(m),top:Math.floor(L),right:Math.floor(z),bottom:Math.floor(X)}}const b2e=(d,v,k,x,C,I)=>{const m=tUn(I,v,k),L=(v-m.x)/d.width,G=(k-m.y)/d.height,F=Math.min(L,G),z=qS(F,x,C),X=d.x+d.width/2,K=d.y+d.height/2,Y=v/2-X*z,ie=k/2-K*z,W=iUn(d,Y,ie,z,v,k),pe={left:Math.min(W.left-m.left,0),top:Math.min(W.top-m.top,0),right:Math.min(W.right-m.right,0),bottom:Math.min(W.bottom-m.bottom,0)};return{x:Y-pe.left+pe.right,y:ie-pe.top+pe.bottom,zoom:z}},M$=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Z8(d){return d!=null&&d!=="parent"}function um(d){return{width:d.measured?.width??d.width??d.initialWidth??0,height:d.measured?.height??d.height??d.initialHeight??0}}function Jdn(d){return(d.measured?.width??d.width??d.initialWidth)!==void 0&&(d.measured?.height??d.height??d.initialHeight)!==void 0}function Hdn(d,v={width:0,height:0},k,x,C){const I={...d},m=x.get(k);if(m){const L=m.origin||C;I.x+=m.internals.positionAbsolute.x-(v.width??0)*L[0],I.y+=m.internals.positionAbsolute.y-(v.height??0)*L[1]}return I}function Ran(d,v){if(d.size!==v.size)return!1;for(const k of d)if(!v.has(k))return!1;return!0}function rUn(){let d,v;return{promise:new Promise((x,C)=>{d=x,v=C}),resolve:d,reject:v}}function cUn(d){return{...Ndn,...d||{}}}function m$(d,{snapGrid:v=[0,0],snapToGrid:k=!1,transform:x,containerBounds:C}){const{x:I,y:m}=bp(d),L=D$({x:I-(C?.left??0),y:m-(C?.top??0)},x),{x:G,y:F}=k?$$(L,v):L;return{xSnapped:G,ySnapped:F,...L}}const w2e=d=>({width:d.offsetWidth,height:d.offsetHeight}),Gdn=d=>d?.getRootNode?.()||window?.document,uUn=["INPUT","SELECT","TEXTAREA"];function qdn(d){const v=d.composedPath?.()?.[0]||d.target;return v?.nodeType!==1?!1:uUn.includes(v.nodeName)||v.hasAttribute("contenteditable")||!!v.closest(".nokey")}const zdn=d=>"clientX"in d,bp=(d,v)=>{const k=zdn(d),x=k?d.clientX:d.touches?.[0].clientX,C=k?d.clientY:d.touches?.[0].clientY;return{x:x-(v?.left??0),y:C-(v?.top??0)}},Ban=(d,v,k,x,C)=>{const I=v.querySelectorAll(`.${d}`);return!I||!I.length?null:Array.from(I).map(m=>{const L=m.getBoundingClientRect();return{id:m.getAttribute("data-handleid"),type:d,nodeId:C,position:m.getAttribute("data-handlepos"),x:(L.left-k.left)/x,y:(L.top-k.top)/x,...w2e(m)}})};function Udn({sourceX:d,sourceY:v,targetX:k,targetY:x,sourceControlX:C,sourceControlY:I,targetControlX:m,targetControlY:L}){const G=d*.125+C*.375+m*.375+k*.125,F=v*.125+I*.375+L*.375+x*.125,z=Math.abs(G-d),X=Math.abs(F-v);return[G,F,z,X]}function hX(d,v){return d>=0?.5*d:v*25*Math.sqrt(-d)}function Jan({pos:d,x1:v,y1:k,x2:x,y2:C,c:I}){switch(d){case tr.Left:return[v-hX(v-x,I),k];case tr.Right:return[v+hX(x-v,I),k];case tr.Top:return[v,k-hX(k-C,I)];case tr.Bottom:return[v,k+hX(C-k,I)]}}function Kdn({sourceX:d,sourceY:v,sourcePosition:k=tr.Bottom,targetX:x,targetY:C,targetPosition:I=tr.Top,curvature:m=.25}){const[L,G]=Jan({pos:k,x1:d,y1:v,x2:x,y2:C,c:m}),[F,z]=Jan({pos:I,x1:x,y1:C,x2:d,y2:v,c:m}),[X,K,Y,ie]=Udn({sourceX:d,sourceY:v,targetX:x,targetY:C,sourceControlX:L,sourceControlY:G,targetControlX:F,targetControlY:z});return[`M${d},${v} C${L},${G} ${F},${z} ${x},${C}`,X,K,Y,ie]}function Xdn({sourceX:d,sourceY:v,targetX:k,targetY:x}){const C=Math.abs(k-d)/2,I=k<d?k+C:k-C,m=Math.abs(x-v)/2,L=x<v?x+m:x-m;return[I,L,C,m]}function oUn({sourceNode:d,targetNode:v,selected:k=!1,zIndex:x=0,elevateOnSelect:C=!1,zIndexMode:I="basic"}){if(I==="manual")return x;const m=C&&k?x+1e3:x,L=Math.max(d.parentId||C&&d.selected?d.internals.z:0,v.parentId||C&&v.selected?v.internals.z:0);return m+L}function sUn({sourceNode:d,targetNode:v,width:k,height:x,transform:C}){const I=KX(PX(d),PX(v));I.x===I.x2&&(I.x2+=1),I.y===I.y2&&(I.y2+=1);const m={x:-C[0]/C[2],y:-C[1]/C[2],width:k/C[2],height:x/C[2]};return NX(m,XX(I))>0}const fUn=({source:d,sourceHandle:v,target:k,targetHandle:x})=>`xy-edge__${d}${v||""}-${k}${x||""}`,lUn=(d,v)=>v.some(k=>k.source===d.source&&k.target===d.target&&(k.sourceHandle===d.sourceHandle||!k.sourceHandle&&!d.sourceHandle)&&(k.targetHandle===d.targetHandle||!k.targetHandle&&!d.targetHandle)),hUn=(d,v,k={})=>{if(!d.source||!d.target)return k.onError?.("006",wp.error006()),v;const x=k.getEdgeId||fUn;let C;return Ddn(d)?C={...d}:C={...d,id:x(d)},lUn(C,v)?v:(C.sourceHandle===null&&delete C.sourceHandle,C.targetHandle===null&&delete C.targetHandle,v.concat(C))};function Wdn({sourceX:d,sourceY:v,targetX:k,targetY:x}){const[C,I,m,L]=Xdn({sourceX:d,sourceY:v,targetX:k,targetY:x});return[`M ${d},${v}L ${k},${x}`,C,I,m,L]}const Han={[tr.Left]:{x:-1,y:0},[tr.Right]:{x:1,y:0},[tr.Top]:{x:0,y:-1},[tr.Bottom]:{x:0,y:1}},aUn=({source:d,sourcePosition:v=tr.Bottom,target:k})=>v===tr.Left||v===tr.Right?d.x<k.x?{x:1,y:0}:{x:-1,y:0}:d.y<k.y?{x:0,y:1}:{x:0,y:-1},Gan=(d,v)=>Math.sqrt(Math.pow(v.x-d.x,2)+Math.pow(v.y-d.y,2));function dUn({source:d,sourcePosition:v=tr.Bottom,target:k,targetPosition:x=tr.Top,center:C,offset:I,stepPosition:m}){const L=Han[v],G=Han[x],F={x:d.x+L.x*I,y:d.y+L.y*I},z={x:k.x+G.x*I,y:k.y+G.y*I},X=aUn({source:F,sourcePosition:v,target:z}),K=X.x!==0?"x":"y",Y=X[K];let ie=[],W,pe;const fe={x:0,y:0},je={x:0,y:0},[,,te,he]=Xdn({sourceX:d.x,sourceY:d.y,targetX:k.x,targetY:k.y});if(L[K]*G[K]===-1){K==="x"?(W=C.x??F.x+(z.x-F.x)*m,pe=C.y??(F.y+z.y)/2):(W=C.x??(F.x+z.x)/2,pe=C.y??F.y+(z.y-F.y)*m);const Ze=[{x:W,y:F.y},{x:W,y:z.y}],rn=[{x:F.x,y:pe},{x:z.x,y:pe}];L[K]===Y?ie=K==="x"?Ze:rn:ie=K==="x"?rn:Ze}else{const Ze=[{x:F.x,y:z.y}],rn=[{x:z.x,y:F.y}];if(K==="x"?ie=L.x===Y?rn:Ze:ie=L.y===Y?Ze:rn,v===x){const ye=Math.abs(d[K]-k[K]);if(ye<=I){const Oe=Math.min(I-1,I-ye);L[K]===Y?fe[K]=(F[K]>d[K]?-1:1)*Oe:je[K]=(z[K]>k[K]?-1:1)*Oe}}if(v!==x){const ye=K==="x"?"y":"x",Oe=L[K]===G[ye],Qe=F[ye]>z[ye],fn=F[ye]<z[ye];(L[K]===1&&(!Oe&&Qe||Oe&&fn)||L[K]!==1&&(!Oe&&fn||Oe&&Qe))&&(ie=K==="x"?Ze:rn)}const Bn={x:F.x+fe.x,y:F.y+fe.y},Ln={x:z.x+je.x,y:z.y+je.y},mn=Math.max(Math.abs(Bn.x-ie[0].x),Math.abs(Ln.x-ie[0].x)),B=Math.max(Math.abs(Bn.y-ie[0].y),Math.abs(Ln.y-ie[0].y));mn>=B?(W=(Bn.x+Ln.x)/2,pe=ie[0].y):(W=ie[0].x,pe=(Bn.y+Ln.y)/2)}const qe={x:F.x+fe.x,y:F.y+fe.y},Ne={x:z.x+je.x,y:z.y+je.y};return[[d,...qe.x!==ie[0].x||qe.y!==ie[0].y?[qe]:[],...ie,...Ne.x!==ie[ie.length-1].x||Ne.y!==ie[ie.length-1].y?[Ne]:[],k],W,pe,te,he]}function bUn(d,v,k,x){const C=Math.min(Gan(d,v)/2,Gan(v,k)/2,x),{x:I,y:m}=v;if(d.x===I&&I===k.x||d.y===m&&m===k.y)return`L${I} ${m}`;if(d.y===m){const F=d.x<k.x?-1:1,z=d.y<k.y?1:-1;return`L ${I+C*F},${m}Q ${I},${m} ${I},${m+C*z}`}const L=d.x<k.x?1:-1,G=d.y<k.y?-1:1;return`L ${I},${m+C*G}Q ${I},${m} ${I+C*L},${m}`}function OX({sourceX:d,sourceY:v,sourcePosition:k=tr.Bottom,targetX:x,targetY:C,targetPosition:I=tr.Top,borderRadius:m=5,centerX:L,centerY:G,offset:F=20,stepPosition:z=.5}){const[X,K,Y,ie,W]=dUn({source:{x:d,y:v},sourcePosition:k,target:{x,y:C},targetPosition:I,center:{x:L,y:G},offset:F,stepPosition:z});let pe=`M${X[0].x} ${X[0].y}`;for(let fe=1;fe<X.length-1;fe++)pe+=bUn(X[fe-1],X[fe],X[fe+1],m);return pe+=`L${X[X.length-1].x} ${X[X.length-1].y}`,[pe,K,Y,ie,W]}function qan(d){return d&&!!(d.internals.handleBounds||d.handles?.length)&&!!(d.measured.width||d.width||d.initialWidth)}function wUn(d){const{sourceNode:v,targetNode:k}=d;if(!qan(v)||!qan(k))return null;const x=v.internals.handleBounds||zan(v.handles),C=k.internals.handleBounds||zan(k.handles),I=Uan(x?.source??[],d.sourceHandle),m=Uan(d.connectionMode===GS.Strict?C?.target??[]:(C?.target??[]).concat(C?.source??[]),d.targetHandle);if(!I||!m)return d.onError?.("008",wp.error008(I?"target":"source",{id:d.id,sourceHandle:d.sourceHandle,targetHandle:d.targetHandle})),null;const L=I?.position||tr.Bottom,G=m?.position||tr.Top,F=e7(v,I,L),z=e7(k,m,G);return{sourceX:F.x,sourceY:F.y,targetX:z.x,targetY:z.y,sourcePosition:L,targetPosition:G}}function zan(d){if(!d)return null;const v=[],k=[];for(const x of d)x.width=x.width??1,x.height=x.height??1,x.type==="source"?v.push(x):x.type==="target"&&k.push(x);return{source:v,target:k}}function e7(d,v,k=tr.Left,x=!1){const C=(v?.x??0)+d.internals.positionAbsolute.x,I=(v?.y??0)+d.internals.positionAbsolute.y,{width:m,height:L}=v??um(d);if(x)return{x:C+m/2,y:I+L/2};switch(v?.position??k){case tr.Top:return{x:C+m/2,y:I};case tr.Right:return{x:C+m,y:I+L/2};case tr.Bottom:return{x:C+m/2,y:I+L};case tr.Left:return{x:C,y:I+L/2}}}function Uan(d,v){return d&&(v?d.find(k=>k.id===v):d[0])||null}function Kpe(d,v){return d?typeof d=="string"?d:`${v?`${v}__`:""}${Object.keys(d).sort().map(x=>`${x}=${d[x]}`).join("&")}`:""}function gUn(d,{id:v,defaultColor:k,defaultMarkerStart:x,defaultMarkerEnd:C}){const I=new Set;return d.reduce((m,L)=>([L.markerStart||x,L.markerEnd||C].forEach(G=>{if(G&&typeof G=="object"){const F=Kpe(G,v);I.has(F)||(m.push({id:F,color:G.color||k,...G}),I.add(F))}}),m),[]).sort((m,L)=>m.id.localeCompare(L.id))}const Vdn=1e3,pUn=10,g2e={nodeOrigin:[0,0],nodeExtent:x$,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},mUn={...g2e,checkEquality:!0};function p2e(d,v){const k={...d};for(const x in v)v[x]!==void 0&&(k[x]=v[x]);return k}function vUn(d,v,k){const x=p2e(g2e,k);for(const C of d.values())if(C.parentId)v2e(C,d,v,x);else{const I=N$(C,x.nodeOrigin),m=Z8(C.extent)?C.extent:x.nodeExtent,L=Y8(I,m,um(C));C.internals.positionAbsolute=L}}function yUn(d,v){if(!d.handles)return d.measured?v?.internals.handleBounds:void 0;const k=[],x=[];for(const C of d.handles){const I={id:C.id,width:C.width??1,height:C.height??1,nodeId:d.id,x:C.x,y:C.y,position:C.position,type:C.type};C.type==="source"?k.push(I):C.type==="target"&&x.push(I)}return{source:k,target:x}}function m2e(d){return d==="manual"}function Xpe(d,v,k,x={}){const C=p2e(mUn,x),I={i:0},m=new Map(v),L=C?.elevateNodesOnSelect&&!m2e(C.zIndexMode)?Vdn:0;let G=d.length>0,F=!1;v.clear(),k.clear();for(const z of d){let X=m.get(z.id);if(C.checkEquality&&z===X?.internals.userNode)v.set(z.id,X);else{const K=N$(z,C.nodeOrigin),Y=Z8(z.extent)?z.extent:C.nodeExtent,ie=Y8(K,Y,um(z));X={...C.defaults,...z,measured:{width:z.measured?.width,height:z.measured?.height},internals:{positionAbsolute:ie,handleBounds:yUn(z,X),z:Qdn(z,L,C.zIndexMode),userNode:z}},v.set(z.id,X)}(X.measured===void 0||X.measured.width===void 0||X.measured.height===void 0)&&!X.hidden&&(G=!1),z.parentId&&v2e(X,v,k,x,I),F||=z.selected??!1}return{nodesInitialized:G,hasSelectedNodes:F}}function kUn(d,v){if(!d.parentId)return;const k=v.get(d.parentId);k?k.set(d.id,d):v.set(d.parentId,new Map([[d.id,d]]))}function v2e(d,v,k,x,C){const{elevateNodesOnSelect:I,nodeOrigin:m,nodeExtent:L,zIndexMode:G}=p2e(g2e,x),F=d.parentId,z=v.get(F);if(!z){console.warn(`Parent node ${F} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}kUn(d,k),C&&!z.parentId&&z.internals.rootParentIndex===void 0&&G==="auto"&&(z.internals.rootParentIndex=++C.i,z.internals.z=z.internals.z+C.i*pUn),C&&z.internals.rootParentIndex!==void 0&&(C.i=z.internals.rootParentIndex);const X=I&&!m2e(G)?Vdn:0,{x:K,y:Y,z:ie}=EUn(d,z,m,L,X,G),{positionAbsolute:W}=d.internals,pe=K!==W.x||Y!==W.y;(pe||ie!==d.internals.z)&&v.set(d.id,{...d,internals:{...d.internals,positionAbsolute:pe?{x:K,y:Y}:W,z:ie}})}function Qdn(d,v,k){const x=dp(d.zIndex)?d.zIndex:0;return m2e(k)?x:x+(d.selected?v:0)}function EUn(d,v,k,x,C,I){const{x:m,y:L}=v.internals.positionAbsolute,G=um(d),F=N$(d,k),z=Z8(d.extent)?Y8(F,d.extent,G):F;let X=Y8({x:m+z.x,y:L+z.y},x,G);d.extent==="parent"&&(X=_dn(X,G,v));const K=Qdn(d,C,I),Y=v.internals.z??0;return{x:X.x,y:X.y,z:Y>=K?Y+1:K}}function y2e(d,v,k,x=[0,0]){const C=[],I=new Map;for(const m of d){const L=v.get(m.parentId);if(!L)continue;const G=I.get(m.parentId)?.expandedRect??A$(L),F=Fdn(G,m.rect);I.set(m.parentId,{expandedRect:F,parent:L})}return I.size>0&&I.forEach(({expandedRect:m,parent:L},G)=>{const F=L.internals.positionAbsolute,z=um(L),X=L.origin??x,K=m.x<F.x?Math.round(Math.abs(F.x-m.x)):0,Y=m.y<F.y?Math.round(Math.abs(F.y-m.y)):0,ie=Math.max(z.width,Math.round(m.width)),W=Math.max(z.height,Math.round(m.height)),pe=(ie-z.width)*X[0],fe=(W-z.height)*X[1];(K>0||Y>0||pe||fe)&&(C.push({id:G,type:"position",position:{x:L.position.x-K+pe,y:L.position.y-Y+fe}}),k.get(G)?.forEach(je=>{d.some(te=>te.id===je.id)||C.push({id:je.id,type:"position",position:{x:je.position.x+K,y:je.position.y+Y}})})),(z.width<m.width||z.height<m.height||K||Y)&&C.push({id:G,type:"dimensions",setAttributes:!0,dimensions:{width:ie+(K?X[0]*K-pe:0),height:W+(Y?X[1]*Y-fe:0)}})}),C}function jUn(d,v,k,x,C,I,m){const L=x?.querySelector(".xyflow__viewport");let G=!1;if(!L)return{changes:[],updatedInternals:G};const F=[],z=window.getComputedStyle(L),{m22:X}=new window.DOMMatrixReadOnly(z.transform),K=[];for(const Y of d.values()){const ie=v.get(Y.id);if(!ie)continue;if(ie.hidden){v.set(ie.id,{...ie,internals:{...ie.internals,handleBounds:void 0}}),G=!0;continue}const W=w2e(Y.nodeElement),pe=ie.measured.width!==W.width||ie.measured.height!==W.height;if(!!(W.width&&W.height&&(pe||!ie.internals.handleBounds||Y.force))){const je=Y.nodeElement.getBoundingClientRect(),te=Z8(ie.extent)?ie.extent:I;let{positionAbsolute:he}=ie.internals;if(ie.parentId&&ie.extent==="parent"){const Ne=v.get(ie.parentId);Ne&&(he=_dn(he,W,Ne))}else te&&(he=Y8(he,te,W));const qe={...ie,measured:W,internals:{...ie.internals,positionAbsolute:he,handleBounds:{source:Ban("source",Y.nodeElement,je,X,ie.id),target:Ban("target",Y.nodeElement,je,X,ie.id)}}};v.set(ie.id,qe),ie.parentId&&v2e(qe,v,k,{nodeOrigin:C,zIndexMode:m}),G=!0,pe&&(F.push({id:ie.id,type:"dimensions",dimensions:W}),ie.expandParent&&ie.parentId&&K.push({id:ie.id,parentId:ie.parentId,rect:A$(qe,C)}))}}if(K.length>0){const Y=y2e(K,v,k,C);F.push(...Y)}return{changes:F,updatedInternals:G}}async function xUn({delta:d,panZoom:v,transform:k,translateExtent:x,width:C,height:I}){if(!v||!d.x&&!d.y)return!1;const m=await v.setViewportConstrained({x:k[0]+d.x,y:k[1]+d.y,zoom:k[2]},[[0,0],[C,I]],x);return!!m&&(m.x!==k[0]||m.y!==k[1]||m.k!==k[2])}function Kan(d,v,k,x,C,I){let m=C;const L=x.get(m)||new Map;x.set(m,L.set(k,v)),m=`${C}-${d}`;const G=x.get(m)||new Map;if(x.set(m,G.set(k,v)),I){m=`${C}-${d}-${I}`;const F=x.get(m)||new Map;x.set(m,F.set(k,v))}}function Ydn(d,v,k){d.clear(),v.clear();for(const x of k){const{source:C,target:I,sourceHandle:m=null,targetHandle:L=null}=x,G={edgeId:x.id,source:C,target:I,sourceHandle:m,targetHandle:L},F=`${C}-${m}--${I}-${L}`,z=`${I}-${L}--${C}-${m}`;Kan("source",G,z,d,C,m),Kan("target",G,F,d,I,L),v.set(x.id,x)}}function Zdn(d,v){if(!d.parentId)return!1;const k=v.get(d.parentId);return k?k.selected?!0:Zdn(k,v):!1}function Xan(d,v,k){let x=d;do{if(x?.matches?.(v))return!0;if(x===k)return!1;x=x?.parentElement}while(x);return!1}function SUn(d,v,k,x){const C=new Map;for(const[I,m]of d)if((m.selected||m.id===x)&&(!m.parentId||!Zdn(m,d))&&(m.draggable||v&&typeof m.draggable>"u")){const L=d.get(I);L&&C.set(I,{id:I,position:L.position||{x:0,y:0},distance:{x:k.x-L.internals.positionAbsolute.x,y:k.y-L.internals.positionAbsolute.y},extent:L.extent,parentId:L.parentId,origin:L.origin,expandParent:L.expandParent,internals:{positionAbsolute:L.internals.positionAbsolute||{x:0,y:0}},measured:{width:L.measured.width??0,height:L.measured.height??0}})}return C}function Cpe({nodeId:d,dragItems:v,nodeLookup:k,dragging:x=!0}){const C=[];for(const[m,L]of v){const G=k.get(m)?.internals.userNode;G&&C.push({...G,position:L.position,dragging:x})}if(!d)return[C[0],C];const I=k.get(d)?.internals.userNode;return[I?{...I,position:v.get(d)?.position||I.position,dragging:x}:C[0],C]}function CUn({dragItems:d,snapGrid:v,x:k,y:x}){const C=d.values().next().value;if(!C)return null;const I={x:k-C.distance.x,y:x-C.distance.y},m=$$(I,v);return{x:m.x-I.x,y:m.y-I.y}}function AUn({onNodeMouseDown:d,getStoreItems:v,onDragStart:k,onDrag:x,onDragStop:C}){let I={x:null,y:null},m=0,L=new Map,G=!1,F={x:0,y:0},z=null,X=!1,K=null,Y=!1,ie=!1,W=null;function pe({noDragClassName:je,handleSelector:te,domNode:he,isSelectable:qe,nodeId:Ne,nodeClickDistance:Me=0}){K=X0(he);function Ze({x:mn,y:B}){const{nodeLookup:ye,nodeExtent:Oe,snapGrid:Qe,snapToGrid:fn,nodeOrigin:gn,onNodeDrag:On,onSelectionDrag:Vn,onError:Zn,updateNodePositions:nt}=v();I={x:mn,y:B};let ai=!1;const ti=L.size>1,vi=ti&&Oe?Upe(O$(L)):null,fr=ti&&fn?CUn({dragItems:L,snapGrid:Qe,x:mn,y:B}):null;for(const[wi,Un]of L){if(!ye.has(wi))continue;let Xt={x:mn-Un.distance.x,y:B-Un.distance.y};fn&&(Xt=fr?{x:Math.round(Xt.x+fr.x),y:Math.round(Xt.y+fr.y)}:$$(Xt,Qe));let br=null;if(ti&&Oe&&!Un.extent&&vi){const{positionAbsolute:ir}=Un.internals,ji=ir.x-vi.x+Oe[0][0],xi=ir.x+Un.measured.width-vi.x2+Oe[1][0],yi=ir.y-vi.y+Oe[0][1],Mi=ir.y+Un.measured.height-vi.y2+Oe[1][1];br=[[ji,yi],[xi,Mi]]}const{position:yr,positionAbsolute:Oi}=Ldn({nodeId:wi,nextPosition:Xt,nodeLookup:ye,nodeExtent:br||Oe,nodeOrigin:gn,onError:Zn});ai=ai||Un.position.x!==yr.x||Un.position.y!==yr.y,Un.position=yr,Un.internals.positionAbsolute=Oi}if(ie=ie||ai,!!ai&&(nt(L,!0),W&&(x||On||!Ne&&Vn))){const[wi,Un]=Cpe({nodeId:Ne,dragItems:L,nodeLookup:ye});x?.(W,L,wi,Un),On?.(W,wi,Un),Ne||Vn?.(W,Un)}}async function rn(){if(!z)return;const{transform:mn,panBy:B,autoPanSpeed:ye,autoPanOnNodeDrag:Oe}=v();if(!Oe){G=!1,cancelAnimationFrame(m);return}const[Qe,fn]=d2e(F,z,ye);(Qe!==0||fn!==0)&&(I.x=(I.x??0)-Qe/mn[2],I.y=(I.y??0)-fn/mn[2],await B({x:Qe,y:fn})&&Ze(I)),m=requestAnimationFrame(rn)}function Bn(mn){const{nodeLookup:B,multiSelectionActive:ye,nodesDraggable:Oe,transform:Qe,snapGrid:fn,snapToGrid:gn,selectNodesOnDrag:On,onNodeDragStart:Vn,onSelectionDragStart:Zn,unselectNodesAndEdges:nt}=v();X=!0,(!On||!qe)&&!ye&&Ne&&(B.get(Ne)?.selected||nt()),qe&&On&&Ne&&d?.(Ne);const ai=m$(mn.sourceEvent,{transform:Qe,snapGrid:fn,snapToGrid:gn,containerBounds:z});if(I=ai,L=SUn(B,Oe,ai,Ne),L.size>0&&(k||Vn||!Ne&&Zn)){const[ti,vi]=Cpe({nodeId:Ne,dragItems:L,nodeLookup:B});k?.(mn.sourceEvent,L,ti,vi),Vn?.(mn.sourceEvent,ti,vi),Ne||Zn?.(mn.sourceEvent,vi)}}const Ln=wdn().clickDistance(Me).on("start",mn=>{const{domNode:B,nodeDragThreshold:ye,transform:Oe,snapGrid:Qe,snapToGrid:fn}=v();z=B?.getBoundingClientRect()||null,Y=!1,ie=!1,W=mn.sourceEvent,ye===0&&Bn(mn),I=m$(mn.sourceEvent,{transform:Oe,snapGrid:Qe,snapToGrid:fn,containerBounds:z}),F=bp(mn.sourceEvent,z)}).on("drag",mn=>{const{autoPanOnNodeDrag:B,transform:ye,snapGrid:Oe,snapToGrid:Qe,nodeDragThreshold:fn,nodeLookup:gn}=v(),On=m$(mn.sourceEvent,{transform:ye,snapGrid:Oe,snapToGrid:Qe,containerBounds:z});if(W=mn.sourceEvent,(mn.sourceEvent.type==="touchmove"&&mn.sourceEvent.touches.length>1||Ne&&!gn.has(Ne))&&(Y=!0),!Y){if(!G&&B&&X&&(G=!0,rn()),!X){const Vn=bp(mn.sourceEvent,z),Zn=Vn.x-F.x,nt=Vn.y-F.y;Math.sqrt(Zn*Zn+nt*nt)>fn&&Bn(mn)}(I.x!==On.xSnapped||I.y!==On.ySnapped)&&L&&X&&(F=bp(mn.sourceEvent,z),Ze(On))}}).on("end",mn=>{if(!X||Y){Y&&L.size>0&&v().updateNodePositions(L,!1);return}if(G=!1,X=!1,cancelAnimationFrame(m),L.size>0){const{nodeLookup:B,updateNodePositions:ye,onNodeDragStop:Oe,onSelectionDragStop:Qe}=v();if(ie&&(ye(L,!1),ie=!1),C||Oe||!Ne&&Qe){const[fn,gn]=Cpe({nodeId:Ne,dragItems:L,nodeLookup:B,dragging:!1});C?.(mn.sourceEvent,L,fn,gn),Oe?.(mn.sourceEvent,fn,gn),Ne||Qe?.(mn.sourceEvent,gn)}}}).filter(mn=>{const B=mn.target;return!mn.button&&(!je||!Xan(B,`.${je}`,he))&&(!te||Xan(B,te,he))});K.call(Ln)}function fe(){K?.on(".drag",null)}return{update:pe,destroy:fe}}function MUn(d,v,k){const x=[],C={x:d.x-k,y:d.y-k,width:k*2,height:k*2};for(const I of v.values())NX(C,A$(I))>0&&x.push(I);return x}const TUn=250;function IUn(d,v,k,x){let C=[],I=1/0;const m=MUn(d,k,v+TUn);for(const L of m){const G=[...L.internals.handleBounds?.source??[],...L.internals.handleBounds?.target??[]];for(const F of G){if(x.nodeId===F.nodeId&&x.type===F.type&&x.id===F.id)continue;const{x:z,y:X}=e7(L,F,F.position,!0),K=Math.sqrt(Math.pow(z-d.x,2)+Math.pow(X-d.y,2));K>v||(K<I?(C=[{...F,x:z,y:X}],I=K):K===I&&C.push({...F,x:z,y:X}))}}if(!C.length)return null;if(C.length>1){const L=x.type==="source"?"target":"source";return C.find(G=>G.type===L)??C[0]}return C[0]}function e0n(d,v,k,x,C,I=!1){const m=x.get(d);if(!m)return null;const L=C==="strict"?m.internals.handleBounds?.[v]:[...m.internals.handleBounds?.source??[],...m.internals.handleBounds?.target??[]],G=(k?L?.find(F=>F.id===k):L?.[0])??null;return G&&I?{...G,...e7(m,G,G.position,!0)}:G}function n0n(d,v){return d||(v?.classList.contains("target")?"target":v?.classList.contains("source")?"source":null)}function PUn(d,v){let k=null;return v?k=!0:d&&!v&&(k=!1),k}const t0n=()=>!0;function NUn(d,{connectionMode:v,connectionRadius:k,handleId:x,nodeId:C,edgeUpdaterType:I,isTarget:m,domNode:L,nodeLookup:G,lib:F,autoPanOnConnect:z,flowId:X,panBy:K,cancelConnection:Y,onConnectStart:ie,onConnect:W,onConnectEnd:pe,isValidConnection:fe=t0n,onReconnectEnd:je,updateConnection:te,getTransform:he,getFromHandle:qe,autoPanSpeed:Ne,dragThreshold:Me=1,handleDomNode:Ze}){const rn=Gdn(d.target);let Bn=0,Ln;const{x:mn,y:B}=bp(d),ye=n0n(I,Ze),Oe=L?.getBoundingClientRect();let Qe=!1;if(!Oe||!ye)return;const fn=e0n(C,ye,x,G,v);if(!fn)return;let gn=bp(d,Oe),On=!1,Vn=null,Zn=!1,nt=null;function ai(){if(!z||!Oe)return;const[yr,Oi]=d2e(gn,Oe,Ne);K({x:yr,y:Oi}),Bn=requestAnimationFrame(ai)}const ti={...fn,nodeId:C,type:ye,position:fn.position},vi=G.get(C);let wi={inProgress:!0,isValid:null,from:e7(vi,ti,tr.Left,!0),fromHandle:ti,fromPosition:ti.position,fromNode:vi,to:gn,toHandle:null,toPosition:Lan[ti.position],toNode:null,pointer:gn};function Un(){Qe=!0,te(wi),ie?.(d,{nodeId:C,handleId:x,handleType:ye})}Me===0&&Un();function Xt(yr){if(!Qe){const{x:Mi,y:rr}=bp(yr),Ys=Mi-mn,Co=rr-B;if(!(Ys*Ys+Co*Co>Me*Me))return;Un()}if(!qe()||!ti){br(yr);return}const Oi=he();gn=bp(yr,Oe),Ln=IUn(D$(gn,Oi,!1,[1,1]),k,G,ti),On||(ai(),On=!0);const ir=i0n(yr,{handle:Ln,connectionMode:v,fromNodeId:C,fromHandleId:x,fromType:m?"target":"source",isValidConnection:fe,doc:rn,lib:F,flowId:X,nodeLookup:G});nt=ir.handleDomNode,Vn=ir.connection,Zn=PUn(!!Ln,ir.isValid);const ji=G.get(C),xi=ji?e7(ji,ti,tr.Left,!0):wi.from,yi={...wi,from:xi,isValid:Zn,to:ir.toHandle&&Zn?zS({x:ir.toHandle.x,y:ir.toHandle.y},Oi):gn,toHandle:ir.toHandle,toPosition:Zn&&ir.toHandle?ir.toHandle.position:Lan[ti.position],toNode:ir.toHandle?G.get(ir.toHandle.nodeId):null,pointer:gn};te(yi),wi=yi}function br(yr){if(!("touches"in yr&&yr.touches.length>0)){if(Qe){(Ln||nt)&&Vn&&Zn&&W?.(Vn);const{inProgress:Oi,...ir}=wi,ji={...ir,toPosition:wi.toHandle?wi.toPosition:null};pe?.(yr,ji),I&&je?.(yr,ji)}Y(),cancelAnimationFrame(Bn),On=!1,Zn=!1,Vn=null,nt=null,rn.removeEventListener("mousemove",Xt),rn.removeEventListener("mouseup",br),rn.removeEventListener("touchmove",Xt),rn.removeEventListener("touchend",br)}}rn.addEventListener("mousemove",Xt),rn.addEventListener("mouseup",br),rn.addEventListener("touchmove",Xt),rn.addEventListener("touchend",br)}function i0n(d,{handle:v,connectionMode:k,fromNodeId:x,fromHandleId:C,fromType:I,doc:m,lib:L,flowId:G,isValidConnection:F=t0n,nodeLookup:z}){const X=I==="target",K=v?m.querySelector(`.${L}-flow__handle[data-id="${G}-${v?.nodeId}-${v?.id}-${v?.type}"]`):null,{x:Y,y:ie}=bp(d),W=m.elementFromPoint(Y,ie),pe=W?.classList.contains(`${L}-flow__handle`)?W:K,fe={handleDomNode:pe,isValid:!1,connection:null,toHandle:null};if(pe){const je=n0n(void 0,pe),te=pe.getAttribute("data-nodeid"),he=pe.getAttribute("data-handleid"),qe=pe.classList.contains("connectable"),Ne=pe.classList.contains("connectableend");if(!te||!je)return fe;const Me={source:X?te:x,sourceHandle:X?he:C,target:X?x:te,targetHandle:X?C:he};fe.connection=Me;const rn=qe&&Ne&&(k===GS.Strict?X&&je==="source"||!X&&je==="target":te!==x||he!==C);fe.isValid=rn&&F(Me),fe.toHandle=e0n(te,je,he,z,k,!0)}return fe}const Wpe={onPointerDown:NUn,isValid:i0n};function OUn({domNode:d,panZoom:v,getTransform:k,getViewScale:x}){const C=X0(d);function I({translateExtent:L,width:G,height:F,zoomStep:z=1,pannable:X=!0,zoomable:K=!0,inversePan:Y=!1}){const ie=te=>{if(te.sourceEvent.type!=="wheel"||!v)return;const he=k(),qe=te.sourceEvent.ctrlKey&&M$()?10:1,Ne=-te.sourceEvent.deltaY*(te.sourceEvent.deltaMode===1?.05:te.sourceEvent.deltaMode?1:.002)*z,Me=he[2]*Math.pow(2,Ne*qe);v.scaleTo(Me)};let W=[0,0];const pe=te=>{(te.sourceEvent.type==="mousedown"||te.sourceEvent.type==="touchstart")&&(W=[te.sourceEvent.clientX??te.sourceEvent.touches[0].clientX,te.sourceEvent.clientY??te.sourceEvent.touches[0].clientY])},fe=te=>{const he=k();if(te.sourceEvent.type!=="mousemove"&&te.sourceEvent.type!=="touchmove"||!v)return;const qe=[te.sourceEvent.clientX??te.sourceEvent.touches[0].clientX,te.sourceEvent.clientY??te.sourceEvent.touches[0].clientY],Ne=[qe[0]-W[0],qe[1]-W[1]];W=qe;const Me=x()*Math.max(he[2],Math.log(he[2]))*(Y?-1:1),Ze={x:he[0]-Ne[0]*Me,y:he[1]-Ne[1]*Me},rn=[[0,0],[G,F]];v.setViewportConstrained({x:Ze.x,y:Ze.y,zoom:he[2]},rn,L)},je=Idn().on("start",pe).on("zoom",X?fe:null).on("zoom.wheel",K?ie:null);C.call(je,{})}function m(){C.on("zoom",null)}return{update:I,destroy:m,pointer:hp}}const WX=d=>({x:d.x,y:d.y,zoom:d.k}),Ape=({x:d,y:v,zoom:k})=>UX.translate(d,v).scale(k),$S=(d,v)=>d.target.closest(`.${v}`),r0n=(d,v)=>v===2&&Array.isArray(d)&&d.includes(2),$Un=d=>((d*=2)<=1?d*d*d:(d-=2)*d*d+2)/2,Mpe=(d,v=0,k=$Un,x=()=>{})=>{const C=typeof v=="number"&&v>0;return C||x(),C?d.transition().duration(v).ease(k).on("end",x):d},c0n=d=>{const v=d.ctrlKey&&M$()?10:1;return-d.deltaY*(d.deltaMode===1?.05:d.deltaMode?1:.002)*v};function DUn({zoomPanValues:d,noWheelClassName:v,d3Selection:k,d3Zoom:x,panOnScrollMode:C,panOnScrollSpeed:I,zoomOnPinch:m,onPanZoomStart:L,onPanZoom:G,onPanZoomEnd:F}){return z=>{if($S(z,v))return z.ctrlKey&&z.preventDefault(),!1;z.preventDefault(),z.stopImmediatePropagation();const X=k.property("__zoom").k||1;if(z.ctrlKey&&m){const pe=hp(z),fe=c0n(z),je=X*Math.pow(2,fe);x.scaleTo(k,je,pe,z);return}const K=z.deltaMode===1?20:1;let Y=C===X8.Vertical?0:z.deltaX*K,ie=C===X8.Horizontal?0:z.deltaY*K;!M$()&&z.shiftKey&&C!==X8.Vertical&&(Y=z.deltaY*K,ie=0),x.translateBy(k,-(Y/X)*I,-(ie/X)*I,{internal:!0});const W=WX(k.property("__zoom"));clearTimeout(d.panScrollTimeout),d.isPanScrolling?G?.(z,W):(d.isPanScrolling=!0,L?.(z,W)),d.panScrollTimeout=setTimeout(()=>{F?.(z,W),d.isPanScrolling=!1},150)}}function LUn({noWheelClassName:d,preventScrolling:v,d3ZoomHandler:k}){return function(x,C){const I=x.type==="wheel",m=!v&&I&&!x.ctrlKey,L=$S(x,d);if(x.ctrlKey&&I&&L&&x.preventDefault(),m||L)return null;x.preventDefault(),k.call(this,x,C)}}function _Un({zoomPanValues:d,onDraggingChange:v,onPanZoomStart:k}){return x=>{if(x.sourceEvent?.internal)return;const C=WX(x.transform);d.mouseButton=x.sourceEvent?.button||0,d.isZoomingOrPanning=!0,d.prevViewport=C,x.sourceEvent?.type==="mousedown"&&v(!0),k&&k?.(x.sourceEvent,C)}}function FUn({zoomPanValues:d,panOnDrag:v,onPaneContextMenu:k,onTransformChange:x,onPanZoom:C}){return I=>{d.usedRightMouseButton=!!(k&&r0n(v,d.mouseButton??0)),I.sourceEvent?.sync||x([I.transform.x,I.transform.y,I.transform.k]),C&&!I.sourceEvent?.internal&&C?.(I.sourceEvent,WX(I.transform))}}function RUn({zoomPanValues:d,panOnDrag:v,panOnScroll:k,onDraggingChange:x,onPanZoomEnd:C,onPaneContextMenu:I}){return m=>{if(!m.sourceEvent?.internal&&(d.isZoomingOrPanning=!1,I&&r0n(v,d.mouseButton??0)&&!d.usedRightMouseButton&&m.sourceEvent&&I(m.sourceEvent),d.usedRightMouseButton=!1,x(!1),C)){const L=WX(m.transform);d.prevViewport=L,clearTimeout(d.timerId),d.timerId=setTimeout(()=>{C?.(m.sourceEvent,L)},k?150:0)}}}function BUn({zoomActivationKeyPressed:d,zoomOnScroll:v,zoomOnPinch:k,panOnDrag:x,panOnScroll:C,zoomOnDoubleClick:I,userSelectionActive:m,noWheelClassName:L,noPanClassName:G,lib:F,connectionInProgress:z}){return X=>{const K=d||v,Y=k&&X.ctrlKey,ie=X.type==="wheel";if(X.button===1&&X.type==="mousedown"&&($S(X,`${F}-flow__node`)||$S(X,`${F}-flow__edge`)))return!0;if(!x&&!K&&!C&&!I&&!k||m||z&&!ie||$S(X,L)&&ie||$S(X,G)&&(!ie||C&&ie&&!d)||!k&&X.ctrlKey&&ie)return!1;if(!k&&X.type==="touchstart"&&X.touches?.length>1)return X.preventDefault(),!1;if(!K&&!C&&!Y&&ie||!x&&(X.type==="mousedown"||X.type==="touchstart")||Array.isArray(x)&&!x.includes(X.button)&&X.type==="mousedown")return!1;const W=Array.isArray(x)&&x.includes(X.button)||!X.button||X.button<=1;return(!X.ctrlKey||ie)&&W}}function JUn({domNode:d,minZoom:v,maxZoom:k,translateExtent:x,viewport:C,onPanZoom:I,onPanZoomStart:m,onPanZoomEnd:L,onDraggingChange:G}){const F={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},z=d.getBoundingClientRect();let X=[[0,0],[z.width,z.height]];(typeof ResizeObserver<"u"?new ResizeObserver(B=>{const ye=B[0];ye&&(X=[[0,0],[ye.contentRect.width,ye.contentRect.height]])}):null)?.observe(d);const Y=Idn().extent(()=>X).scaleExtent([v,k]).translateExtent(x),ie=X0(d).call(Y);he({x:C.x,y:C.y,zoom:qS(C.zoom,v,k)},[[0,0],[z.width,z.height]],x);const W=ie.on("wheel.zoom"),pe=ie.on("dblclick.zoom");Y.wheelDelta(c0n);async function fe(B,ye){return ie?new Promise(Oe=>{Y?.interpolate(ye?.interpolate==="linear"?p$:mX).transform(Mpe(ie,ye?.duration,ye?.ease,()=>Oe(!0)),B)}):!1}function je({noWheelClassName:B,noPanClassName:ye,onPaneContextMenu:Oe,userSelectionActive:Qe,panOnScroll:fn,panOnDrag:gn,panOnScrollMode:On,panOnScrollSpeed:Vn,preventScrolling:Zn,zoomOnPinch:nt,zoomOnScroll:ai,zoomOnDoubleClick:ti,zoomActivationKeyPressed:vi,lib:fr,onTransformChange:wi,connectionInProgress:Un,paneClickDistance:Xt,selectionOnDrag:br}){Qe&&!F.isZoomingOrPanning&&te();const yr=fn&&!vi&&!Qe;Y.clickDistance(br?1/0:!dp(Xt)||Xt<0?0:Xt);const Oi=yr?DUn({zoomPanValues:F,noWheelClassName:B,d3Selection:ie,d3Zoom:Y,panOnScrollMode:On,panOnScrollSpeed:Vn,zoomOnPinch:nt,onPanZoomStart:m,onPanZoom:I,onPanZoomEnd:L}):LUn({noWheelClassName:B,preventScrolling:Zn,d3ZoomHandler:W});ie.on("wheel.zoom",Oi,{passive:!1});const ir=_Un({zoomPanValues:F,onDraggingChange:G,onPanZoomStart:m});Y.on("start",ir);const ji=FUn({zoomPanValues:F,panOnDrag:gn,onPaneContextMenu:!!Oe,onPanZoom:I,onTransformChange:wi});Y.on("zoom",ji);const xi=RUn({zoomPanValues:F,panOnDrag:gn,panOnScroll:fn,onPaneContextMenu:Oe,onPanZoomEnd:L,onDraggingChange:G});Y.on("end",xi);const yi=BUn({zoomActivationKeyPressed:vi,panOnDrag:gn,zoomOnScroll:ai,panOnScroll:fn,zoomOnDoubleClick:ti,zoomOnPinch:nt,userSelectionActive:Qe,noPanClassName:ye,noWheelClassName:B,lib:fr,connectionInProgress:Un});Y.filter(yi),ti?ie.on("dblclick.zoom",pe):ie.on("dblclick.zoom",null)}function te(){Y.on("zoom",null)}async function he(B,ye,Oe){const Qe=Ape(B),fn=Y?.constrain()(Qe,ye,Oe);return fn&&await fe(fn),fn}async function qe(B,ye){const Oe=Ape(B);return await fe(Oe,ye),Oe}function Ne(B){if(ie){const ye=Ape(B),Oe=ie.property("__zoom");(Oe.k!==B.zoom||Oe.x!==B.x||Oe.y!==B.y)&&Y?.transform(ie,ye,null,{sync:!0})}}function Me(){const B=ie?Tdn(ie.node()):{x:0,y:0,k:1};return{x:B.x,y:B.y,zoom:B.k}}async function Ze(B,ye){return ie?new Promise(Oe=>{Y?.interpolate(ye?.interpolate==="linear"?p$:mX).scaleTo(Mpe(ie,ye?.duration,ye?.ease,()=>Oe(!0)),B)}):!1}async function rn(B,ye){return ie?new Promise(Oe=>{Y?.interpolate(ye?.interpolate==="linear"?p$:mX).scaleBy(Mpe(ie,ye?.duration,ye?.ease,()=>Oe(!0)),B)}):!1}function Bn(B){Y?.scaleExtent(B)}function Ln(B){Y?.translateExtent(B)}function mn(B){const ye=!dp(B)||B<0?0:B;Y?.clickDistance(ye)}return{update:je,destroy:te,setViewport:qe,setViewportConstrained:he,getViewport:Me,scaleTo:Ze,scaleBy:rn,setScaleExtent:Bn,setTranslateExtent:Ln,syncViewport:Ne,setClickDistance:mn}}var US;(function(d){d.Line="line",d.Handle="handle"})(US||(US={}));function HUn({width:d,prevWidth:v,height:k,prevHeight:x,affectsX:C,affectsY:I}){const m=d-v,L=k-x,G=[m>0?1:m<0?-1:0,L>0?1:L<0?-1:0];return m&&C&&(G[0]=G[0]*-1),L&&I&&(G[1]=G[1]*-1),G}function Wan(d){const v=d.includes("right")||d.includes("left"),k=d.includes("bottom")||d.includes("top"),x=d.includes("left"),C=d.includes("top");return{isHorizontal:v,isVertical:k,affectsX:x,affectsY:C}}function m6(d,v){return Math.max(0,v-d)}function v6(d,v){return Math.max(0,d-v)}function aX(d,v,k){return Math.max(0,v-d,d-k)}function Van(d,v){return d?!v:v}function GUn(d,v,k,x,C,I,m,L){let{affectsX:G,affectsY:F}=v;const{isHorizontal:z,isVertical:X}=v,K=z&&X,{xSnapped:Y,ySnapped:ie}=k,{minWidth:W,maxWidth:pe,minHeight:fe,maxHeight:je}=x,{x:te,y:he,width:qe,height:Ne,aspectRatio:Me}=d;let Ze=Math.floor(z?Y-d.pointerX:0),rn=Math.floor(X?ie-d.pointerY:0);const Bn=qe+(G?-Ze:Ze),Ln=Ne+(F?-rn:rn),mn=-I[0]*qe,B=-I[1]*Ne;let ye=aX(Bn,W,pe),Oe=aX(Ln,fe,je);if(m){let gn=0,On=0;G&&Ze<0?gn=m6(te+Ze+mn,m[0][0]):!G&&Ze>0&&(gn=v6(te+Bn+mn,m[1][0])),F&&rn<0?On=m6(he+rn+B,m[0][1]):!F&&rn>0&&(On=v6(he+Ln+B,m[1][1])),ye=Math.max(ye,gn),Oe=Math.max(Oe,On)}if(L){let gn=0,On=0;G&&Ze>0?gn=v6(te+Ze,L[0][0]):!G&&Ze<0&&(gn=m6(te+Bn,L[1][0])),F&&rn>0?On=v6(he+rn,L[0][1]):!F&&rn<0&&(On=m6(he+Ln,L[1][1])),ye=Math.max(ye,gn),Oe=Math.max(Oe,On)}if(C){if(z){const gn=aX(Bn/Me,fe,je)*Me;if(ye=Math.max(ye,gn),m){let On=0;!G&&!F||G&&!F&&K?On=v6(he+B+Bn/Me,m[1][1])*Me:On=m6(he+B+(G?Ze:-Ze)/Me,m[0][1])*Me,ye=Math.max(ye,On)}if(L){let On=0;!G&&!F||G&&!F&&K?On=m6(he+Bn/Me,L[1][1])*Me:On=v6(he+(G?Ze:-Ze)/Me,L[0][1])*Me,ye=Math.max(ye,On)}}if(X){const gn=aX(Ln*Me,W,pe)/Me;if(Oe=Math.max(Oe,gn),m){let On=0;!G&&!F||F&&!G&&K?On=v6(te+Ln*Me+mn,m[1][0])/Me:On=m6(te+(F?rn:-rn)*Me+mn,m[0][0])/Me,Oe=Math.max(Oe,On)}if(L){let On=0;!G&&!F||F&&!G&&K?On=m6(te+Ln*Me,L[1][0])/Me:On=v6(te+(F?rn:-rn)*Me,L[0][0])/Me,Oe=Math.max(Oe,On)}}}rn=rn+(rn<0?Oe:-Oe),Ze=Ze+(Ze<0?ye:-ye),C&&(K?Bn>Ln*Me?rn=(Van(G,F)?-Ze:Ze)/Me:Ze=(Van(G,F)?-rn:rn)*Me:z?(rn=Ze/Me,F=G):(Ze=rn*Me,G=F));const Qe=G?te+Ze:te,fn=F?he+rn:he;return{width:qe+(G?-Ze:Ze),height:Ne+(F?-rn:rn),x:I[0]*Ze*(G?-1:1)+Qe,y:I[1]*rn*(F?-1:1)+fn}}const u0n={width:0,height:0,x:0,y:0},qUn={...u0n,pointerX:0,pointerY:0,aspectRatio:1};function zUn(d,v,k){const x=v.position.x+d.position.x,C=v.position.y+d.position.y,I=d.measured.width??0,m=d.measured.height??0,L=k[0]*I,G=k[1]*m;return[[x-L,C-G],[x+I-L,C+m-G]]}function UUn({domNode:d,nodeId:v,getStoreItems:k,onChange:x,onEnd:C}){const I=X0(d);let m={controlDirection:Wan("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function L({controlPosition:F,boundaries:z,keepAspectRatio:X,resizeDirection:K,onResizeStart:Y,onResize:ie,onResizeEnd:W,shouldResize:pe}){let fe={...u0n},je={...qUn};m={boundaries:z,resizeDirection:K,keepAspectRatio:X,controlDirection:Wan(F)};let te,he=null,qe=[],Ne,Me,Ze,rn=!1;const Bn=wdn().on("start",Ln=>{const{nodeLookup:mn,transform:B,snapGrid:ye,snapToGrid:Oe,nodeOrigin:Qe,paneDomNode:fn}=k();if(te=mn.get(v),!te)return;he=fn?.getBoundingClientRect()??null;const{xSnapped:gn,ySnapped:On}=m$(Ln.sourceEvent,{transform:B,snapGrid:ye,snapToGrid:Oe,containerBounds:he});fe={width:te.measured.width??0,height:te.measured.height??0,x:te.position.x??0,y:te.position.y??0},je={...fe,pointerX:gn,pointerY:On,aspectRatio:fe.width/fe.height},Ne=void 0,Me=Z8(te.extent)?te.extent:void 0,te.parentId&&(te.extent==="parent"||te.expandParent)&&(Ne=mn.get(te.parentId)),Ne&&te.extent==="parent"&&(Me=[[0,0],[Ne.measured.width,Ne.measured.height]]),qe=[],Ze=void 0;for(const[Vn,Zn]of mn)if(Zn.parentId===v&&(qe.push({id:Vn,position:{...Zn.position},extent:Zn.extent}),Zn.extent==="parent"||Zn.expandParent)){const nt=zUn(Zn,te,Zn.origin??Qe);Ze?Ze=[[Math.min(nt[0][0],Ze[0][0]),Math.min(nt[0][1],Ze[0][1])],[Math.max(nt[1][0],Ze[1][0]),Math.max(nt[1][1],Ze[1][1])]]:Ze=nt}Y?.(Ln,{...fe})}).on("drag",Ln=>{const{transform:mn,snapGrid:B,snapToGrid:ye,nodeOrigin:Oe}=k(),Qe=m$(Ln.sourceEvent,{transform:mn,snapGrid:B,snapToGrid:ye,containerBounds:he}),fn=[];if(!te)return;const{x:gn,y:On,width:Vn,height:Zn}=fe,nt={},ai=te.origin??Oe,{width:ti,height:vi,x:fr,y:wi}=GUn(je,m.controlDirection,Qe,m.boundaries,m.keepAspectRatio,ai,Me,Ze),Un=ti!==Vn,Xt=vi!==Zn,br=fr!==gn&&Un,yr=wi!==On&&Xt;if(!br&&!yr&&!Un&&!Xt)return;if((br||yr||ai[0]===1||ai[1]===1)&&(nt.x=br?fr:fe.x,nt.y=yr?wi:fe.y,fe.x=nt.x,fe.y=nt.y,qe.length>0)){const xi=fr-gn,yi=wi-On;for(const Mi of qe)Mi.position={x:Mi.position.x-xi+ai[0]*(ti-Vn),y:Mi.position.y-yi+ai[1]*(vi-Zn)},fn.push(Mi)}if((Un||Xt)&&(nt.width=Un&&(!m.resizeDirection||m.resizeDirection==="horizontal")?ti:fe.width,nt.height=Xt&&(!m.resizeDirection||m.resizeDirection==="vertical")?vi:fe.height,fe.width=nt.width,fe.height=nt.height),Ne&&te.expandParent){const xi=ai[0]*(nt.width??0);nt.x&&nt.x<xi&&(fe.x=xi,je.x=je.x-(nt.x-xi));const yi=ai[1]*(nt.height??0);nt.y&&nt.y<yi&&(fe.y=yi,je.y=je.y-(nt.y-yi))}const Oi=HUn({width:fe.width,prevWidth:Vn,height:fe.height,prevHeight:Zn,affectsX:m.controlDirection.affectsX,affectsY:m.controlDirection.affectsY}),ir={...fe,direction:Oi};pe?.(Ln,ir)!==!1&&(rn=!0,ie?.(Ln,ir),x(nt,fn))}).on("end",Ln=>{rn&&(W?.(Ln,{...fe}),C?.({...fe}),rn=!1)});I.call(Bn)}function G(){I.on(".drag",null)}return{update:L,destroy:G}}const KUn={},Qan=d=>{let v;const k=new Set,x=(z,X)=>{const K=typeof z=="function"?z(v):z;if(!Object.is(K,v)){const Y=v;v=X??(typeof K!="object"||K===null)?K:Object.assign({},v,K),k.forEach(ie=>ie(v,Y))}},C=()=>v,G={setState:x,getState:C,getInitialState:()=>F,subscribe:z=>(k.add(z),()=>k.delete(z)),destroy:()=>{(KUn?"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."),k.clear()}},F=v=d(x,C,G);return G},XUn=d=>d?Qan(d):Qan,{useDebugValue:WUn}=HBn,{useSyncExternalStoreWithSelector:VUn}=JBn,QUn=d=>d;function o0n(d,v=QUn,k){const x=VUn(d.subscribe,d.getState,d.getServerState||d.getInitialState,v,k);return WUn(x),x}const Yan=(d,v)=>{const k=XUn(d),x=(C,I=v)=>o0n(k,C,I);return Object.assign(x,k),x},YUn=(d,v)=>d?Yan(d,v):Yan;function Qs(d,v){if(Object.is(d,v))return!0;if(typeof d!="object"||d===null||typeof v!="object"||v===null)return!1;if(d instanceof Map&&v instanceof Map){if(d.size!==v.size)return!1;for(const[x,C]of d)if(!Object.is(C,v.get(x)))return!1;return!0}if(d instanceof Set&&v instanceof Set){if(d.size!==v.size)return!1;for(const x of d)if(!v.has(x))return!1;return!0}const k=Object.keys(d);if(k.length!==Object.keys(v).length)return!1;for(const x of k)if(!Object.prototype.hasOwnProperty.call(v,x)||!Object.is(d[x],v[x]))return!1;return!0}const VX=Ue.createContext(null),ZUn=VX.Provider,s0n=wp.error001("react");function au(d,v){const k=Ue.useContext(VX);if(k===null)throw new Error(s0n);return o0n(k,d,v)}function os(){const d=Ue.useContext(VX);if(d===null)throw new Error(s0n);return Ue.useMemo(()=>({getState:d.getState,setState:d.setState,subscribe:d.subscribe}),[d])}const Zan={display:"none"},eKn={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},f0n="react-flow__node-desc",l0n="react-flow__edge-desc",nKn="react-flow__aria-live",tKn=d=>d.ariaLiveMessage,iKn=d=>d.ariaLabelConfig;function rKn({rfId:d}){const v=au(tKn);return q.jsx("div",{id:`${nKn}-${d}`,"aria-live":"assertive","aria-atomic":"true",style:eKn,children:v})}function cKn({rfId:d,disableKeyboardA11y:v}){const k=au(iKn);return q.jsxs(q.Fragment,{children:[q.jsx("div",{id:`${f0n}-${d}`,style:Zan,children:v?k["node.a11yDescription.default"]:k["node.a11yDescription.keyboardDisabled"]}),q.jsx("div",{id:`${l0n}-${d}`,style:Zan,children:k["edge.a11yDescription.default"]}),!v&&q.jsx(rKn,{rfId:d})]})}const QX=Ue.forwardRef(({position:d="top-left",children:v,className:k,style:x,...C},I)=>{const m=`${d}`.split("-");return q.jsx("div",{className:vl(["react-flow__panel",k,...m]),style:x,ref:I,...C,children:v})});QX.displayName="Panel";const e1n="https://reactflow.dev?utm_source=attribution";function uKn({proOptions:d,position:v="bottom-right"}){return d?.hideAttribution?null:q.jsx(QX,{position:v,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${e1n}`,children:q.jsx("a",{href:e1n,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const oKn=d=>{const v=[],k=[];for(const[,x]of d.nodeLookup)x.selected&&v.push(x.internals.userNode);for(const[,x]of d.edgeLookup)x.selected&&k.push(x);return{selectedNodes:v,selectedEdges:k}},dX=d=>d.id;function sKn(d,v){return Qs(d.selectedNodes.map(dX),v.selectedNodes.map(dX))&&Qs(d.selectedEdges.map(dX),v.selectedEdges.map(dX))}function fKn({onSelectionChange:d}){const v=os(),{selectedNodes:k,selectedEdges:x}=au(oKn,sKn);return Ue.useEffect(()=>{const C={nodes:k,edges:x};d?.(C),v.getState().onSelectionChangeHandlers.forEach(I=>I(C))},[k,x,d]),null}const lKn=d=>!!d.onSelectionChangeHandlers;function hKn({onSelectionChange:d}){const v=au(lKn);return d||v?q.jsx(fKn,{onSelectionChange:d}):null}const h0n=[0,0],aKn={x:0,y:0,zoom:1},dKn=["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"],n1n=[...dKn,"rfId"],bKn=d=>({setNodes:d.setNodes,setEdges:d.setEdges,setMinZoom:d.setMinZoom,setMaxZoom:d.setMaxZoom,setTranslateExtent:d.setTranslateExtent,setNodeExtent:d.setNodeExtent,reset:d.reset,setDefaultNodesAndEdges:d.setDefaultNodesAndEdges}),t1n={translateExtent:x$,nodeOrigin:h0n,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function wKn(d){const{setNodes:v,setEdges:k,setMinZoom:x,setMaxZoom:C,setTranslateExtent:I,setNodeExtent:m,reset:L,setDefaultNodesAndEdges:G}=au(bKn,Qs),F=os();Ue.useEffect(()=>(G(d.defaultNodes,d.defaultEdges),()=>{z.current=t1n,L()}),[]);const z=Ue.useRef(t1n);return Ue.useEffect(()=>{for(const X of n1n){const K=d[X],Y=z.current[X];K!==Y&&(typeof d[X]>"u"||(X==="nodes"?v(K):X==="edges"?k(K):X==="minZoom"?x(K):X==="maxZoom"?C(K):X==="translateExtent"?I(K):X==="nodeExtent"?m(K):X==="ariaLabelConfig"?F.setState({ariaLabelConfig:cUn(K)}):X==="fitView"?F.setState({fitViewQueued:K}):X==="fitViewOptions"?F.setState({fitViewOptions:K}):F.setState({[X]:K})))}z.current=d},n1n.map(X=>d[X])),null}function i1n(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function gKn(d){const[v,k]=Ue.useState(d==="system"?null:d);return Ue.useEffect(()=>{if(d!=="system"){k(d);return}const x=i1n(),C=()=>k(x?.matches?"dark":"light");return C(),x?.addEventListener("change",C),()=>{x?.removeEventListener("change",C)}},[d]),v!==null?v:i1n()?.matches?"dark":"light"}const r1n=typeof document<"u"?document:null;function T$(d=null,v={target:r1n,actInsideInputWithModifier:!0}){const[k,x]=Ue.useState(!1),C=Ue.useRef(!1),I=Ue.useRef(new Set([])),[m,L]=Ue.useMemo(()=>{if(d!==null){const F=(Array.isArray(d)?d:[d]).filter(X=>typeof X=="string").map(X=>X.replace("+",`
1
+ import{eb as JBn,e5 as HBn,r as Ue,j as q,ec as GBn,k as n7,ed as $1n,ee as qBn,ef as zBn,eg as UBn,y as y6,bn as gpe,bo as ppe,bp as mpe,bq as vpe,br as cX,eh as KBn,I as BS,ei as XBn,by as D1n,B as Vf,ej as WBn,ek as VBn,el as QBn,em as YBn,bx as ZBn,bK as L1n,ch as _1n,en as ban,eo as eJn,cg as nJn,dm as tJn,ep as iJn,m as JX,eq as F1n,P as T1,er as R1n,S as OS,aQ as B1n,c9 as J1n,cz as rJn,es as cJn,d5 as Zpe,d7 as e2e,d6 as n2e,cx as H1n,b8 as uJn,et as oJn,eu as G1n,bO as sJn,bP as fJn,ev as lJn,ew as hJn,ex as aJn,bS as dJn,bH as q1n,ey as z1n,ez as LS,eA as jX,eB as bJn,eC as wJn,eD as t2e,eE as gJn,eF as $pe,eG as Dpe,eH as pJn,eI as mJn,cc as U1n,cd as Lpe,cB as vJn,eJ as yJn,eK as K1n,dY as U8,cf as _S,L as k6,eL as kJn,M as v$,dk as EJn,dZ as jJn,d_ as xJn,d$ as ype,e0 as SJn,e3 as CJn,e4 as wan,dx as AJn,eM as MJn,ae as TJn,an as IJn,eN as PJn,v as X1n,eO as NJn,eP as OJn,eQ as $Jn,b_ as q8,eR as kpe,eS as DJn,eT as LJn,cq as gan,eU as W1n,dv as _Jn,eV as FJn,cy as RJn,eW as BJn,eX as JJn,bl as HJn,eY as GJn,eZ as qJn,ah as zJn}from"./index-Cr5hwh-C.js";import{P as UJn}from"./public-shell-ready-DcnlADmj.js";import{E as _pe}from"./entity-type-page-CwZxa0BR.js";import{S as KJn,D as XJn,c as WJn,n as VJn,E as i2e,T as QJn,a as YJn,b as pan}from"./tabs-DqIIkCX-.js";import{F as ZJn}from"./filter-editors-Cj-v6NtH.js";import{i as eHn,b as nHn,g as tHn,f as man,c as iHn,d as rHn,S as cHn,a as V1n,J as uHn}from"./renderer-mEDnVW0O.js";import{u as oHn,a as sHn,D as fHn,P as lHn,b as Q1n,c as hHn,C as aHn}from"./core.esm-CYvgWCuv.js";import{v as dHn,V as Y1n,M as Z1n,a as edn,w as bHn,b as wHn}from"./view-param-filters-CqLZQrnO.js";import{M as gHn}from"./member-scope-gate-B44INDPY.js";function vl(d){if(typeof d=="string"||typeof d=="number")return""+d;let v="";if(Array.isArray(d))for(let k=0,x;k<d.length;k++)(x=vl(d[k]))!==""&&(v+=(v&&" ")+x);else for(let k in d)d[k]&&(v+=(v&&" ")+k);return v}var pHn={value:()=>{}};function HX(){for(var d=0,v=arguments.length,k={},x;d<v;++d){if(!(x=arguments[d]+"")||x in k||/[\s.]/.test(x))throw new Error("illegal type: "+x);k[x]=[]}return new pX(k)}function pX(d){this._=d}function mHn(d,v){return d.trim().split(/^|\s+/).map(function(k){var x="",C=k.indexOf(".");if(C>=0&&(x=k.slice(C+1),k=k.slice(0,C)),k&&!v.hasOwnProperty(k))throw new Error("unknown type: "+k);return{type:k,name:x}})}pX.prototype=HX.prototype={constructor:pX,on:function(d,v){var k=this._,x=mHn(d+"",k),C,I=-1,m=x.length;if(arguments.length<2){for(;++I<m;)if((C=(d=x[I]).type)&&(C=vHn(k[C],d.name)))return C;return}if(v!=null&&typeof v!="function")throw new Error("invalid callback: "+v);for(;++I<m;)if(C=(d=x[I]).type)k[C]=van(k[C],d.name,v);else if(v==null)for(C in k)k[C]=van(k[C],d.name,null);return this},copy:function(){var d={},v=this._;for(var k in v)d[k]=v[k].slice();return new pX(d)},call:function(d,v){if((C=arguments.length-2)>0)for(var k=new Array(C),x=0,C,I;x<C;++x)k[x]=arguments[x+2];if(!this._.hasOwnProperty(d))throw new Error("unknown type: "+d);for(I=this._[d],x=0,C=I.length;x<C;++x)I[x].value.apply(v,k)},apply:function(d,v,k){if(!this._.hasOwnProperty(d))throw new Error("unknown type: "+d);for(var x=this._[d],C=0,I=x.length;C<I;++C)x[C].value.apply(v,k)}};function vHn(d,v){for(var k=0,x=d.length,C;k<x;++k)if((C=d[k]).name===v)return C.value}function van(d,v,k){for(var x=0,C=d.length;x<C;++x)if(d[x].name===v){d[x]=pHn,d=d.slice(0,x).concat(d.slice(x+1));break}return k!=null&&d.push({name:v,value:k}),d}var Fpe="http://www.w3.org/1999/xhtml";const yan={svg:"http://www.w3.org/2000/svg",xhtml:Fpe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function GX(d){var v=d+="",k=v.indexOf(":");return k>=0&&(v=d.slice(0,k))!=="xmlns"&&(d=d.slice(k+1)),yan.hasOwnProperty(v)?{space:yan[v],local:d}:d}function yHn(d){return function(){var v=this.ownerDocument,k=this.namespaceURI;return k===Fpe&&v.documentElement.namespaceURI===Fpe?v.createElement(d):v.createElementNS(k,d)}}function kHn(d){return function(){return this.ownerDocument.createElementNS(d.space,d.local)}}function ndn(d){var v=GX(d);return(v.local?kHn:yHn)(v)}function EHn(){}function r2e(d){return d==null?EHn:function(){return this.querySelector(d)}}function jHn(d){typeof d!="function"&&(d=r2e(d));for(var v=this._groups,k=v.length,x=new Array(k),C=0;C<k;++C)for(var I=v[C],m=I.length,L=x[C]=new Array(m),G,F,z=0;z<m;++z)(G=I[z])&&(F=d.call(G,G.__data__,z,I))&&("__data__"in G&&(F.__data__=G.__data__),L[z]=F);return new W0(x,this._parents)}function xHn(d){return d==null?[]:Array.isArray(d)?d:Array.from(d)}function SHn(){return[]}function tdn(d){return d==null?SHn:function(){return this.querySelectorAll(d)}}function CHn(d){return function(){return xHn(d.apply(this,arguments))}}function AHn(d){typeof d=="function"?d=CHn(d):d=tdn(d);for(var v=this._groups,k=v.length,x=[],C=[],I=0;I<k;++I)for(var m=v[I],L=m.length,G,F=0;F<L;++F)(G=m[F])&&(x.push(d.call(G,G.__data__,F,m)),C.push(G));return new W0(x,C)}function idn(d){return function(){return this.matches(d)}}function rdn(d){return function(v){return v.matches(d)}}var MHn=Array.prototype.find;function THn(d){return function(){return MHn.call(this.children,d)}}function IHn(){return this.firstElementChild}function PHn(d){return this.select(d==null?IHn:THn(typeof d=="function"?d:rdn(d)))}var NHn=Array.prototype.filter;function OHn(){return Array.from(this.children)}function $Hn(d){return function(){return NHn.call(this.children,d)}}function DHn(d){return this.selectAll(d==null?OHn:$Hn(typeof d=="function"?d:rdn(d)))}function LHn(d){typeof d!="function"&&(d=idn(d));for(var v=this._groups,k=v.length,x=new Array(k),C=0;C<k;++C)for(var I=v[C],m=I.length,L=x[C]=[],G,F=0;F<m;++F)(G=I[F])&&d.call(G,G.__data__,F,I)&&L.push(G);return new W0(x,this._parents)}function cdn(d){return new Array(d.length)}function _Hn(){return new W0(this._enter||this._groups.map(cdn),this._parents)}function xX(d,v){this.ownerDocument=d.ownerDocument,this.namespaceURI=d.namespaceURI,this._next=null,this._parent=d,this.__data__=v}xX.prototype={constructor:xX,appendChild:function(d){return this._parent.insertBefore(d,this._next)},insertBefore:function(d,v){return this._parent.insertBefore(d,v)},querySelector:function(d){return this._parent.querySelector(d)},querySelectorAll:function(d){return this._parent.querySelectorAll(d)}};function FHn(d){return function(){return d}}function RHn(d,v,k,x,C,I){for(var m=0,L,G=v.length,F=I.length;m<F;++m)(L=v[m])?(L.__data__=I[m],x[m]=L):k[m]=new xX(d,I[m]);for(;m<G;++m)(L=v[m])&&(C[m]=L)}function BHn(d,v,k,x,C,I,m){var L,G,F=new Map,z=v.length,X=I.length,K=new Array(z),Y;for(L=0;L<z;++L)(G=v[L])&&(K[L]=Y=m.call(G,G.__data__,L,v)+"",F.has(Y)?C[L]=G:F.set(Y,G));for(L=0;L<X;++L)Y=m.call(d,I[L],L,I)+"",(G=F.get(Y))?(x[L]=G,G.__data__=I[L],F.delete(Y)):k[L]=new xX(d,I[L]);for(L=0;L<z;++L)(G=v[L])&&F.get(K[L])===G&&(C[L]=G)}function JHn(d){return d.__data__}function HHn(d,v){if(!arguments.length)return Array.from(this,JHn);var k=v?BHn:RHn,x=this._parents,C=this._groups;typeof d!="function"&&(d=FHn(d));for(var I=C.length,m=new Array(I),L=new Array(I),G=new Array(I),F=0;F<I;++F){var z=x[F],X=C[F],K=X.length,Y=GHn(d.call(z,z&&z.__data__,F,x)),ie=Y.length,W=L[F]=new Array(ie),pe=m[F]=new Array(ie),fe=G[F]=new Array(K);k(z,X,W,pe,fe,Y,v);for(var je=0,te=0,he,qe;je<ie;++je)if(he=W[je]){for(je>=te&&(te=je+1);!(qe=pe[te])&&++te<ie;);he._next=qe||null}}return m=new W0(m,x),m._enter=L,m._exit=G,m}function GHn(d){return typeof d=="object"&&"length"in d?d:Array.from(d)}function qHn(){return new W0(this._exit||this._groups.map(cdn),this._parents)}function zHn(d,v,k){var x=this.enter(),C=this,I=this.exit();return typeof d=="function"?(x=d(x),x&&(x=x.selection())):x=x.append(d+""),v!=null&&(C=v(C),C&&(C=C.selection())),k==null?I.remove():k(I),x&&C?x.merge(C).order():C}function UHn(d){for(var v=d.selection?d.selection():d,k=this._groups,x=v._groups,C=k.length,I=x.length,m=Math.min(C,I),L=new Array(C),G=0;G<m;++G)for(var F=k[G],z=x[G],X=F.length,K=L[G]=new Array(X),Y,ie=0;ie<X;++ie)(Y=F[ie]||z[ie])&&(K[ie]=Y);for(;G<C;++G)L[G]=k[G];return new W0(L,this._parents)}function KHn(){for(var d=this._groups,v=-1,k=d.length;++v<k;)for(var x=d[v],C=x.length-1,I=x[C],m;--C>=0;)(m=x[C])&&(I&&m.compareDocumentPosition(I)^4&&I.parentNode.insertBefore(m,I),I=m);return this}function XHn(d){d||(d=WHn);function v(X,K){return X&&K?d(X.__data__,K.__data__):!X-!K}for(var k=this._groups,x=k.length,C=new Array(x),I=0;I<x;++I){for(var m=k[I],L=m.length,G=C[I]=new Array(L),F,z=0;z<L;++z)(F=m[z])&&(G[z]=F);G.sort(v)}return new W0(C,this._parents).order()}function WHn(d,v){return d<v?-1:d>v?1:d>=v?0:NaN}function VHn(){var d=arguments[0];return arguments[0]=this,d.apply(null,arguments),this}function QHn(){return Array.from(this)}function YHn(){for(var d=this._groups,v=0,k=d.length;v<k;++v)for(var x=d[v],C=0,I=x.length;C<I;++C){var m=x[C];if(m)return m}return null}function ZHn(){let d=0;for(const v of this)++d;return d}function eGn(){return!this.node()}function nGn(d){for(var v=this._groups,k=0,x=v.length;k<x;++k)for(var C=v[k],I=0,m=C.length,L;I<m;++I)(L=C[I])&&d.call(L,L.__data__,I,C);return this}function tGn(d){return function(){this.removeAttribute(d)}}function iGn(d){return function(){this.removeAttributeNS(d.space,d.local)}}function rGn(d,v){return function(){this.setAttribute(d,v)}}function cGn(d,v){return function(){this.setAttributeNS(d.space,d.local,v)}}function uGn(d,v){return function(){var k=v.apply(this,arguments);k==null?this.removeAttribute(d):this.setAttribute(d,k)}}function oGn(d,v){return function(){var k=v.apply(this,arguments);k==null?this.removeAttributeNS(d.space,d.local):this.setAttributeNS(d.space,d.local,k)}}function sGn(d,v){var k=GX(d);if(arguments.length<2){var x=this.node();return k.local?x.getAttributeNS(k.space,k.local):x.getAttribute(k)}return this.each((v==null?k.local?iGn:tGn:typeof v=="function"?k.local?oGn:uGn:k.local?cGn:rGn)(k,v))}function udn(d){return d.ownerDocument&&d.ownerDocument.defaultView||d.document&&d||d.defaultView}function fGn(d){return function(){this.style.removeProperty(d)}}function lGn(d,v,k){return function(){this.style.setProperty(d,v,k)}}function hGn(d,v,k){return function(){var x=v.apply(this,arguments);x==null?this.style.removeProperty(d):this.style.setProperty(d,x,k)}}function aGn(d,v,k){return arguments.length>1?this.each((v==null?fGn:typeof v=="function"?hGn:lGn)(d,v,k??"")):JS(this.node(),d)}function JS(d,v){return d.style.getPropertyValue(v)||udn(d).getComputedStyle(d,null).getPropertyValue(v)}function dGn(d){return function(){delete this[d]}}function bGn(d,v){return function(){this[d]=v}}function wGn(d,v){return function(){var k=v.apply(this,arguments);k==null?delete this[d]:this[d]=k}}function gGn(d,v){return arguments.length>1?this.each((v==null?dGn:typeof v=="function"?wGn:bGn)(d,v)):this.node()[d]}function odn(d){return d.trim().split(/^|\s+/)}function c2e(d){return d.classList||new sdn(d)}function sdn(d){this._node=d,this._names=odn(d.getAttribute("class")||"")}sdn.prototype={add:function(d){var v=this._names.indexOf(d);v<0&&(this._names.push(d),this._node.setAttribute("class",this._names.join(" ")))},remove:function(d){var v=this._names.indexOf(d);v>=0&&(this._names.splice(v,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(d){return this._names.indexOf(d)>=0}};function fdn(d,v){for(var k=c2e(d),x=-1,C=v.length;++x<C;)k.add(v[x])}function ldn(d,v){for(var k=c2e(d),x=-1,C=v.length;++x<C;)k.remove(v[x])}function pGn(d){return function(){fdn(this,d)}}function mGn(d){return function(){ldn(this,d)}}function vGn(d,v){return function(){(v.apply(this,arguments)?fdn:ldn)(this,d)}}function yGn(d,v){var k=odn(d+"");if(arguments.length<2){for(var x=c2e(this.node()),C=-1,I=k.length;++C<I;)if(!x.contains(k[C]))return!1;return!0}return this.each((typeof v=="function"?vGn:v?pGn:mGn)(k,v))}function kGn(){this.textContent=""}function EGn(d){return function(){this.textContent=d}}function jGn(d){return function(){var v=d.apply(this,arguments);this.textContent=v??""}}function xGn(d){return arguments.length?this.each(d==null?kGn:(typeof d=="function"?jGn:EGn)(d)):this.node().textContent}function SGn(){this.innerHTML=""}function CGn(d){return function(){this.innerHTML=d}}function AGn(d){return function(){var v=d.apply(this,arguments);this.innerHTML=v??""}}function MGn(d){return arguments.length?this.each(d==null?SGn:(typeof d=="function"?AGn:CGn)(d)):this.node().innerHTML}function TGn(){this.nextSibling&&this.parentNode.appendChild(this)}function IGn(){return this.each(TGn)}function PGn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function NGn(){return this.each(PGn)}function OGn(d){var v=typeof d=="function"?d:ndn(d);return this.select(function(){return this.appendChild(v.apply(this,arguments))})}function $Gn(){return null}function DGn(d,v){var k=typeof d=="function"?d:ndn(d),x=v==null?$Gn:typeof v=="function"?v:r2e(v);return this.select(function(){return this.insertBefore(k.apply(this,arguments),x.apply(this,arguments)||null)})}function LGn(){var d=this.parentNode;d&&d.removeChild(this)}function _Gn(){return this.each(LGn)}function FGn(){var d=this.cloneNode(!1),v=this.parentNode;return v?v.insertBefore(d,this.nextSibling):d}function RGn(){var d=this.cloneNode(!0),v=this.parentNode;return v?v.insertBefore(d,this.nextSibling):d}function BGn(d){return this.select(d?RGn:FGn)}function JGn(d){return arguments.length?this.property("__data__",d):this.node().__data__}function HGn(d){return function(v){d.call(this,v,this.__data__)}}function GGn(d){return d.trim().split(/^|\s+/).map(function(v){var k="",x=v.indexOf(".");return x>=0&&(k=v.slice(x+1),v=v.slice(0,x)),{type:v,name:k}})}function qGn(d){return function(){var v=this.__on;if(v){for(var k=0,x=-1,C=v.length,I;k<C;++k)I=v[k],(!d.type||I.type===d.type)&&I.name===d.name?this.removeEventListener(I.type,I.listener,I.options):v[++x]=I;++x?v.length=x:delete this.__on}}}function zGn(d,v,k){return function(){var x=this.__on,C,I=HGn(v);if(x){for(var m=0,L=x.length;m<L;++m)if((C=x[m]).type===d.type&&C.name===d.name){this.removeEventListener(C.type,C.listener,C.options),this.addEventListener(C.type,C.listener=I,C.options=k),C.value=v;return}}this.addEventListener(d.type,I,k),C={type:d.type,name:d.name,value:v,listener:I,options:k},x?x.push(C):this.__on=[C]}}function UGn(d,v,k){var x=GGn(d+""),C,I=x.length,m;if(arguments.length<2){var L=this.node().__on;if(L){for(var G=0,F=L.length,z;G<F;++G)for(C=0,z=L[G];C<I;++C)if((m=x[C]).type===z.type&&m.name===z.name)return z.value}return}for(L=v?zGn:qGn,C=0;C<I;++C)this.each(L(x[C],v,k));return this}function hdn(d,v,k){var x=udn(d),C=x.CustomEvent;typeof C=="function"?C=new C(v,k):(C=x.document.createEvent("Event"),k?(C.initEvent(v,k.bubbles,k.cancelable),C.detail=k.detail):C.initEvent(v,!1,!1)),d.dispatchEvent(C)}function KGn(d,v){return function(){return hdn(this,d,v)}}function XGn(d,v){return function(){return hdn(this,d,v.apply(this,arguments))}}function WGn(d,v){return this.each((typeof v=="function"?XGn:KGn)(d,v))}function*VGn(){for(var d=this._groups,v=0,k=d.length;v<k;++v)for(var x=d[v],C=0,I=x.length,m;C<I;++C)(m=x[C])&&(yield m)}var adn=[null];function W0(d,v){this._groups=d,this._parents=v}function I$(){return new W0([[document.documentElement]],adn)}function QGn(){return this}W0.prototype=I$.prototype={constructor:W0,select:jHn,selectAll:AHn,selectChild:PHn,selectChildren:DHn,filter:LHn,data:HHn,enter:_Hn,exit:qHn,join:zHn,merge:UHn,selection:QGn,order:KHn,sort:XHn,call:VHn,nodes:QHn,node:YHn,size:ZHn,empty:eGn,each:nGn,attr:sGn,style:aGn,property:gGn,classed:yGn,text:xGn,html:MGn,raise:IGn,lower:NGn,append:OGn,insert:DGn,remove:_Gn,clone:BGn,datum:JGn,on:UGn,dispatch:WGn,[Symbol.iterator]:VGn};function X0(d){return typeof d=="string"?new W0([[document.querySelector(d)]],[document.documentElement]):new W0([[d]],adn)}function YGn(d){let v;for(;v=d.sourceEvent;)d=v;return d}function hp(d,v){if(d=YGn(d),v===void 0&&(v=d.currentTarget),v){var k=v.ownerSVGElement||v;if(k.createSVGPoint){var x=k.createSVGPoint();return x.x=d.clientX,x.y=d.clientY,x=x.matrixTransform(v.getScreenCTM().inverse()),[x.x,x.y]}if(v.getBoundingClientRect){var C=v.getBoundingClientRect();return[d.clientX-C.left-v.clientLeft,d.clientY-C.top-v.clientTop]}}return[d.pageX,d.pageY]}const ZGn={passive:!1},y$={capture:!0,passive:!1};function Epe(d){d.stopImmediatePropagation()}function FS(d){d.preventDefault(),d.stopImmediatePropagation()}function ddn(d){var v=d.document.documentElement,k=X0(d).on("dragstart.drag",FS,y$);"onselectstart"in v?k.on("selectstart.drag",FS,y$):(v.__noselect=v.style.MozUserSelect,v.style.MozUserSelect="none")}function bdn(d,v){var k=d.document.documentElement,x=X0(d).on("dragstart.drag",null);v&&(x.on("click.drag",FS,y$),setTimeout(function(){x.on("click.drag",null)},0)),"onselectstart"in k?x.on("selectstart.drag",null):(k.style.MozUserSelect=k.__noselect,delete k.__noselect)}const uX=d=>()=>d;function Rpe(d,{sourceEvent:v,subject:k,target:x,identifier:C,active:I,x:m,y:L,dx:G,dy:F,dispatch:z}){Object.defineProperties(this,{type:{value:d,enumerable:!0,configurable:!0},sourceEvent:{value:v,enumerable:!0,configurable:!0},subject:{value:k,enumerable:!0,configurable:!0},target:{value:x,enumerable:!0,configurable:!0},identifier:{value:C,enumerable:!0,configurable:!0},active:{value:I,enumerable:!0,configurable:!0},x:{value:m,enumerable:!0,configurable:!0},y:{value:L,enumerable:!0,configurable:!0},dx:{value:G,enumerable:!0,configurable:!0},dy:{value:F,enumerable:!0,configurable:!0},_:{value:z}})}Rpe.prototype.on=function(){var d=this._.on.apply(this._,arguments);return d===this._?this:d};function eqn(d){return!d.ctrlKey&&!d.button}function nqn(){return this.parentNode}function tqn(d,v){return v??{x:d.x,y:d.y}}function iqn(){return navigator.maxTouchPoints||"ontouchstart"in this}function wdn(){var d=eqn,v=nqn,k=tqn,x=iqn,C={},I=HX("start","drag","end"),m=0,L,G,F,z,X=0;function K(he){he.on("mousedown.drag",Y).filter(x).on("touchstart.drag",pe).on("touchmove.drag",fe,ZGn).on("touchend.drag touchcancel.drag",je).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function Y(he,qe){if(!(z||!d.call(this,he,qe))){var Ne=te(this,v.call(this,he,qe),he,qe,"mouse");Ne&&(X0(he.view).on("mousemove.drag",ie,y$).on("mouseup.drag",W,y$),ddn(he.view),Epe(he),F=!1,L=he.clientX,G=he.clientY,Ne("start",he))}}function ie(he){if(FS(he),!F){var qe=he.clientX-L,Ne=he.clientY-G;F=qe*qe+Ne*Ne>X}C.mouse("drag",he)}function W(he){X0(he.view).on("mousemove.drag mouseup.drag",null),bdn(he.view,F),FS(he),C.mouse("end",he)}function pe(he,qe){if(d.call(this,he,qe)){var Ne=he.changedTouches,Me=v.call(this,he,qe),Ze=Ne.length,rn,Bn;for(rn=0;rn<Ze;++rn)(Bn=te(this,Me,he,qe,Ne[rn].identifier,Ne[rn]))&&(Epe(he),Bn("start",he,Ne[rn]))}}function fe(he){var qe=he.changedTouches,Ne=qe.length,Me,Ze;for(Me=0;Me<Ne;++Me)(Ze=C[qe[Me].identifier])&&(FS(he),Ze("drag",he,qe[Me]))}function je(he){var qe=he.changedTouches,Ne=qe.length,Me,Ze;for(z&&clearTimeout(z),z=setTimeout(function(){z=null},500),Me=0;Me<Ne;++Me)(Ze=C[qe[Me].identifier])&&(Epe(he),Ze("end",he,qe[Me]))}function te(he,qe,Ne,Me,Ze,rn){var Bn=I.copy(),Ln=hp(rn||Ne,qe),mn,B,ye;if((ye=k.call(he,new Rpe("beforestart",{sourceEvent:Ne,target:K,identifier:Ze,active:m,x:Ln[0],y:Ln[1],dx:0,dy:0,dispatch:Bn}),Me))!=null)return mn=ye.x-Ln[0]||0,B=ye.y-Ln[1]||0,function Oe(Qe,fn,gn){var On=Ln,Vn;switch(Qe){case"start":C[Ze]=Oe,Vn=m++;break;case"end":delete C[Ze],--m;case"drag":Ln=hp(gn||fn,qe),Vn=m;break}Bn.call(Qe,he,new Rpe(Qe,{sourceEvent:fn,subject:ye,target:K,identifier:Ze,active:Vn,x:Ln[0]+mn,y:Ln[1]+B,dx:Ln[0]-On[0],dy:Ln[1]-On[1],dispatch:Bn}),Me)}}return K.filter=function(he){return arguments.length?(d=typeof he=="function"?he:uX(!!he),K):d},K.container=function(he){return arguments.length?(v=typeof he=="function"?he:uX(he),K):v},K.subject=function(he){return arguments.length?(k=typeof he=="function"?he:uX(he),K):k},K.touchable=function(he){return arguments.length?(x=typeof he=="function"?he:uX(!!he),K):x},K.on=function(){var he=I.on.apply(I,arguments);return he===I?K:he},K.clickDistance=function(he){return arguments.length?(X=(he=+he)*he,K):Math.sqrt(X)},K}function u2e(d,v,k){d.prototype=v.prototype=k,k.constructor=d}function gdn(d,v){var k=Object.create(d.prototype);for(var x in v)k[x]=v[x];return k}function P$(){}var k$=.7,SX=1/k$,RS="\\s*([+-]?\\d+)\\s*",E$="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",im="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",rqn=/^#([0-9a-f]{3,8})$/,cqn=new RegExp(`^rgb\\(${RS},${RS},${RS}\\)$`),uqn=new RegExp(`^rgb\\(${im},${im},${im}\\)$`),oqn=new RegExp(`^rgba\\(${RS},${RS},${RS},${E$}\\)$`),sqn=new RegExp(`^rgba\\(${im},${im},${im},${E$}\\)$`),fqn=new RegExp(`^hsl\\(${E$},${im},${im}\\)$`),lqn=new RegExp(`^hsla\\(${E$},${im},${im},${E$}\\)$`),kan={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};u2e(P$,V8,{copy(d){return Object.assign(new this.constructor,this,d)},displayable(){return this.rgb().displayable()},hex:Ean,formatHex:Ean,formatHex8:hqn,formatHsl:aqn,formatRgb:jan,toString:jan});function Ean(){return this.rgb().formatHex()}function hqn(){return this.rgb().formatHex8()}function aqn(){return pdn(this).formatHsl()}function jan(){return this.rgb().formatRgb()}function V8(d){var v,k;return d=(d+"").trim().toLowerCase(),(v=rqn.exec(d))?(k=v[1].length,v=parseInt(v[1],16),k===6?xan(v):k===3?new Rd(v>>8&15|v>>4&240,v>>4&15|v&240,(v&15)<<4|v&15,1):k===8?oX(v>>24&255,v>>16&255,v>>8&255,(v&255)/255):k===4?oX(v>>12&15|v>>8&240,v>>8&15|v>>4&240,v>>4&15|v&240,((v&15)<<4|v&15)/255):null):(v=cqn.exec(d))?new Rd(v[1],v[2],v[3],1):(v=uqn.exec(d))?new Rd(v[1]*255/100,v[2]*255/100,v[3]*255/100,1):(v=oqn.exec(d))?oX(v[1],v[2],v[3],v[4]):(v=sqn.exec(d))?oX(v[1]*255/100,v[2]*255/100,v[3]*255/100,v[4]):(v=fqn.exec(d))?Aan(v[1],v[2]/100,v[3]/100,1):(v=lqn.exec(d))?Aan(v[1],v[2]/100,v[3]/100,v[4]):kan.hasOwnProperty(d)?xan(kan[d]):d==="transparent"?new Rd(NaN,NaN,NaN,0):null}function xan(d){return new Rd(d>>16&255,d>>8&255,d&255,1)}function oX(d,v,k,x){return x<=0&&(d=v=k=NaN),new Rd(d,v,k,x)}function dqn(d){return d instanceof P$||(d=V8(d)),d?(d=d.rgb(),new Rd(d.r,d.g,d.b,d.opacity)):new Rd}function Bpe(d,v,k,x){return arguments.length===1?dqn(d):new Rd(d,v,k,x??1)}function Rd(d,v,k,x){this.r=+d,this.g=+v,this.b=+k,this.opacity=+x}u2e(Rd,Bpe,gdn(P$,{brighter(d){return d=d==null?SX:Math.pow(SX,d),new Rd(this.r*d,this.g*d,this.b*d,this.opacity)},darker(d){return d=d==null?k$:Math.pow(k$,d),new Rd(this.r*d,this.g*d,this.b*d,this.opacity)},rgb(){return this},clamp(){return new Rd(K8(this.r),K8(this.g),K8(this.b),CX(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:San,formatHex:San,formatHex8:bqn,formatRgb:Can,toString:Can}));function San(){return`#${z8(this.r)}${z8(this.g)}${z8(this.b)}`}function bqn(){return`#${z8(this.r)}${z8(this.g)}${z8(this.b)}${z8((isNaN(this.opacity)?1:this.opacity)*255)}`}function Can(){const d=CX(this.opacity);return`${d===1?"rgb(":"rgba("}${K8(this.r)}, ${K8(this.g)}, ${K8(this.b)}${d===1?")":`, ${d})`}`}function CX(d){return isNaN(d)?1:Math.max(0,Math.min(1,d))}function K8(d){return Math.max(0,Math.min(255,Math.round(d)||0))}function z8(d){return d=K8(d),(d<16?"0":"")+d.toString(16)}function Aan(d,v,k,x){return x<=0?d=v=k=NaN:k<=0||k>=1?d=v=NaN:v<=0&&(d=NaN),new ap(d,v,k,x)}function pdn(d){if(d instanceof ap)return new ap(d.h,d.s,d.l,d.opacity);if(d instanceof P$||(d=V8(d)),!d)return new ap;if(d instanceof ap)return d;d=d.rgb();var v=d.r/255,k=d.g/255,x=d.b/255,C=Math.min(v,k,x),I=Math.max(v,k,x),m=NaN,L=I-C,G=(I+C)/2;return L?(v===I?m=(k-x)/L+(k<x)*6:k===I?m=(x-v)/L+2:m=(v-k)/L+4,L/=G<.5?I+C:2-I-C,m*=60):L=G>0&&G<1?0:m,new ap(m,L,G,d.opacity)}function wqn(d,v,k,x){return arguments.length===1?pdn(d):new ap(d,v,k,x??1)}function ap(d,v,k,x){this.h=+d,this.s=+v,this.l=+k,this.opacity=+x}u2e(ap,wqn,gdn(P$,{brighter(d){return d=d==null?SX:Math.pow(SX,d),new ap(this.h,this.s,this.l*d,this.opacity)},darker(d){return d=d==null?k$:Math.pow(k$,d),new ap(this.h,this.s,this.l*d,this.opacity)},rgb(){var d=this.h%360+(this.h<0)*360,v=isNaN(d)||isNaN(this.s)?0:this.s,k=this.l,x=k+(k<.5?k:1-k)*v,C=2*k-x;return new Rd(jpe(d>=240?d-240:d+120,C,x),jpe(d,C,x),jpe(d<120?d+240:d-120,C,x),this.opacity)},clamp(){return new ap(Man(this.h),sX(this.s),sX(this.l),CX(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 d=CX(this.opacity);return`${d===1?"hsl(":"hsla("}${Man(this.h)}, ${sX(this.s)*100}%, ${sX(this.l)*100}%${d===1?")":`, ${d})`}`}}));function Man(d){return d=(d||0)%360,d<0?d+360:d}function sX(d){return Math.max(0,Math.min(1,d||0))}function jpe(d,v,k){return(d<60?v+(k-v)*d/60:d<180?k:d<240?v+(k-v)*(240-d)/60:v)*255}const o2e=d=>()=>d;function gqn(d,v){return function(k){return d+k*v}}function pqn(d,v,k){return d=Math.pow(d,k),v=Math.pow(v,k)-d,k=1/k,function(x){return Math.pow(d+x*v,k)}}function mqn(d){return(d=+d)==1?mdn:function(v,k){return k-v?pqn(v,k,d):o2e(isNaN(v)?k:v)}}function mdn(d,v){var k=v-d;return k?gqn(d,k):o2e(isNaN(d)?v:d)}const AX=(function d(v){var k=mqn(v);function x(C,I){var m=k((C=Bpe(C)).r,(I=Bpe(I)).r),L=k(C.g,I.g),G=k(C.b,I.b),F=mdn(C.opacity,I.opacity);return function(z){return C.r=m(z),C.g=L(z),C.b=G(z),C.opacity=F(z),C+""}}return x.gamma=d,x})(1);function vqn(d,v){v||(v=[]);var k=d?Math.min(v.length,d.length):0,x=v.slice(),C;return function(I){for(C=0;C<k;++C)x[C]=d[C]*(1-I)+v[C]*I;return x}}function yqn(d){return ArrayBuffer.isView(d)&&!(d instanceof DataView)}function kqn(d,v){var k=v?v.length:0,x=d?Math.min(k,d.length):0,C=new Array(x),I=new Array(k),m;for(m=0;m<x;++m)C[m]=p$(d[m],v[m]);for(;m<k;++m)I[m]=v[m];return function(L){for(m=0;m<x;++m)I[m]=C[m](L);return I}}function Eqn(d,v){var k=new Date;return d=+d,v=+v,function(x){return k.setTime(d*(1-x)+v*x),k}}function tm(d,v){return d=+d,v=+v,function(k){return d*(1-k)+v*k}}function jqn(d,v){var k={},x={},C;(d===null||typeof d!="object")&&(d={}),(v===null||typeof v!="object")&&(v={});for(C in v)C in d?k[C]=p$(d[C],v[C]):x[C]=v[C];return function(I){for(C in k)x[C]=k[C](I);return x}}var Jpe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xpe=new RegExp(Jpe.source,"g");function xqn(d){return function(){return d}}function Sqn(d){return function(v){return d(v)+""}}function vdn(d,v){var k=Jpe.lastIndex=xpe.lastIndex=0,x,C,I,m=-1,L=[],G=[];for(d=d+"",v=v+"";(x=Jpe.exec(d))&&(C=xpe.exec(v));)(I=C.index)>k&&(I=v.slice(k,I),L[m]?L[m]+=I:L[++m]=I),(x=x[0])===(C=C[0])?L[m]?L[m]+=C:L[++m]=C:(L[++m]=null,G.push({i:m,x:tm(x,C)})),k=xpe.lastIndex;return k<v.length&&(I=v.slice(k),L[m]?L[m]+=I:L[++m]=I),L.length<2?G[0]?Sqn(G[0].x):xqn(v):(v=G.length,function(F){for(var z=0,X;z<v;++z)L[(X=G[z]).i]=X.x(F);return L.join("")})}function p$(d,v){var k=typeof v,x;return v==null||k==="boolean"?o2e(v):(k==="number"?tm:k==="string"?(x=V8(v))?(v=x,AX):vdn:v instanceof V8?AX:v instanceof Date?Eqn:yqn(v)?vqn:Array.isArray(v)?kqn:typeof v.valueOf!="function"&&typeof v.toString!="function"||isNaN(v)?jqn:tm)(d,v)}var Tan=180/Math.PI,Hpe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ydn(d,v,k,x,C,I){var m,L,G;return(m=Math.sqrt(d*d+v*v))&&(d/=m,v/=m),(G=d*k+v*x)&&(k-=d*G,x-=v*G),(L=Math.sqrt(k*k+x*x))&&(k/=L,x/=L,G/=L),d*x<v*k&&(d=-d,v=-v,G=-G,m=-m),{translateX:C,translateY:I,rotate:Math.atan2(v,d)*Tan,skewX:Math.atan(G)*Tan,scaleX:m,scaleY:L}}var fX;function Cqn(d){const v=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(d+"");return v.isIdentity?Hpe:ydn(v.a,v.b,v.c,v.d,v.e,v.f)}function Aqn(d){return d==null||(fX||(fX=document.createElementNS("http://www.w3.org/2000/svg","g")),fX.setAttribute("transform",d),!(d=fX.transform.baseVal.consolidate()))?Hpe:(d=d.matrix,ydn(d.a,d.b,d.c,d.d,d.e,d.f))}function kdn(d,v,k,x){function C(F){return F.length?F.pop()+" ":""}function I(F,z,X,K,Y,ie){if(F!==X||z!==K){var W=Y.push("translate(",null,v,null,k);ie.push({i:W-4,x:tm(F,X)},{i:W-2,x:tm(z,K)})}else(X||K)&&Y.push("translate("+X+v+K+k)}function m(F,z,X,K){F!==z?(F-z>180?z+=360:z-F>180&&(F+=360),K.push({i:X.push(C(X)+"rotate(",null,x)-2,x:tm(F,z)})):z&&X.push(C(X)+"rotate("+z+x)}function L(F,z,X,K){F!==z?K.push({i:X.push(C(X)+"skewX(",null,x)-2,x:tm(F,z)}):z&&X.push(C(X)+"skewX("+z+x)}function G(F,z,X,K,Y,ie){if(F!==X||z!==K){var W=Y.push(C(Y)+"scale(",null,",",null,")");ie.push({i:W-4,x:tm(F,X)},{i:W-2,x:tm(z,K)})}else(X!==1||K!==1)&&Y.push(C(Y)+"scale("+X+","+K+")")}return function(F,z){var X=[],K=[];return F=d(F),z=d(z),I(F.translateX,F.translateY,z.translateX,z.translateY,X,K),m(F.rotate,z.rotate,X,K),L(F.skewX,z.skewX,X,K),G(F.scaleX,F.scaleY,z.scaleX,z.scaleY,X,K),F=z=null,function(Y){for(var ie=-1,W=K.length,pe;++ie<W;)X[(pe=K[ie]).i]=pe.x(Y);return X.join("")}}}var Mqn=kdn(Cqn,"px, ","px)","deg)"),Tqn=kdn(Aqn,", ",")",")"),Iqn=1e-12;function Ian(d){return((d=Math.exp(d))+1/d)/2}function Pqn(d){return((d=Math.exp(d))-1/d)/2}function Nqn(d){return((d=Math.exp(2*d))-1)/(d+1)}const mX=(function d(v,k,x){function C(I,m){var L=I[0],G=I[1],F=I[2],z=m[0],X=m[1],K=m[2],Y=z-L,ie=X-G,W=Y*Y+ie*ie,pe,fe;if(W<Iqn)fe=Math.log(K/F)/v,pe=function(Me){return[L+Me*Y,G+Me*ie,F*Math.exp(v*Me*fe)]};else{var je=Math.sqrt(W),te=(K*K-F*F+x*W)/(2*F*k*je),he=(K*K-F*F-x*W)/(2*K*k*je),qe=Math.log(Math.sqrt(te*te+1)-te),Ne=Math.log(Math.sqrt(he*he+1)-he);fe=(Ne-qe)/v,pe=function(Me){var Ze=Me*fe,rn=Ian(qe),Bn=F/(k*je)*(rn*Nqn(v*Ze+qe)-Pqn(qe));return[L+Bn*Y,G+Bn*ie,F*rn/Ian(v*Ze+qe)]}}return pe.duration=fe*1e3*v/Math.SQRT2,pe}return C.rho=function(I){var m=Math.max(.001,+I),L=m*m,G=L*L;return d(m,L,G)},C})(Math.SQRT2,2,4);var HS=0,w$=0,d$=0,Edn=1e3,MX,g$,TX=0,Q8=0,qX=0,j$=typeof performance=="object"&&performance.now?performance:Date,jdn=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(d){setTimeout(d,17)};function s2e(){return Q8||(jdn(Oqn),Q8=j$.now()+qX)}function Oqn(){Q8=0}function IX(){this._call=this._time=this._next=null}IX.prototype=xdn.prototype={constructor:IX,restart:function(d,v,k){if(typeof d!="function")throw new TypeError("callback is not a function");k=(k==null?s2e():+k)+(v==null?0:+v),!this._next&&g$!==this&&(g$?g$._next=this:MX=this,g$=this),this._call=d,this._time=k,Gpe()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gpe())}};function xdn(d,v,k){var x=new IX;return x.restart(d,v,k),x}function $qn(){s2e(),++HS;for(var d=MX,v;d;)(v=Q8-d._time)>=0&&d._call.call(void 0,v),d=d._next;--HS}function Pan(){Q8=(TX=j$.now())+qX,HS=w$=0;try{$qn()}finally{HS=0,Lqn(),Q8=0}}function Dqn(){var d=j$.now(),v=d-TX;v>Edn&&(qX-=v,TX=d)}function Lqn(){for(var d,v=MX,k,x=1/0;v;)v._call?(x>v._time&&(x=v._time),d=v,v=v._next):(k=v._next,v._next=null,v=d?d._next=k:MX=k);g$=d,Gpe(x)}function Gpe(d){if(!HS){w$&&(w$=clearTimeout(w$));var v=d-Q8;v>24?(d<1/0&&(w$=setTimeout(Pan,d-j$.now()-qX)),d$&&(d$=clearInterval(d$))):(d$||(TX=j$.now(),d$=setInterval(Dqn,Edn)),HS=1,jdn(Pan))}}function Nan(d,v,k){var x=new IX;return v=v==null?0:+v,x.restart(C=>{x.stop(),d(C+v)},v,k),x}var _qn=HX("start","end","cancel","interrupt"),Fqn=[],Sdn=0,Oan=1,qpe=2,vX=3,$an=4,zpe=5,yX=6;function zX(d,v,k,x,C,I){var m=d.__transition;if(!m)d.__transition={};else if(k in m)return;Rqn(d,k,{name:v,index:x,group:C,on:_qn,tween:Fqn,time:I.time,delay:I.delay,duration:I.duration,ease:I.ease,timer:null,state:Sdn})}function f2e(d,v){var k=gp(d,v);if(k.state>Sdn)throw new Error("too late; already scheduled");return k}function cm(d,v){var k=gp(d,v);if(k.state>vX)throw new Error("too late; already running");return k}function gp(d,v){var k=d.__transition;if(!k||!(k=k[v]))throw new Error("transition not found");return k}function Rqn(d,v,k){var x=d.__transition,C;x[v]=k,k.timer=xdn(I,0,k.time);function I(F){k.state=Oan,k.timer.restart(m,k.delay,k.time),k.delay<=F&&m(F-k.delay)}function m(F){var z,X,K,Y;if(k.state!==Oan)return G();for(z in x)if(Y=x[z],Y.name===k.name){if(Y.state===vX)return Nan(m);Y.state===$an?(Y.state=yX,Y.timer.stop(),Y.on.call("interrupt",d,d.__data__,Y.index,Y.group),delete x[z]):+z<v&&(Y.state=yX,Y.timer.stop(),Y.on.call("cancel",d,d.__data__,Y.index,Y.group),delete x[z])}if(Nan(function(){k.state===vX&&(k.state=$an,k.timer.restart(L,k.delay,k.time),L(F))}),k.state=qpe,k.on.call("start",d,d.__data__,k.index,k.group),k.state===qpe){for(k.state=vX,C=new Array(K=k.tween.length),z=0,X=-1;z<K;++z)(Y=k.tween[z].value.call(d,d.__data__,k.index,k.group))&&(C[++X]=Y);C.length=X+1}}function L(F){for(var z=F<k.duration?k.ease.call(null,F/k.duration):(k.timer.restart(G),k.state=zpe,1),X=-1,K=C.length;++X<K;)C[X].call(d,z);k.state===zpe&&(k.on.call("end",d,d.__data__,k.index,k.group),G())}function G(){k.state=yX,k.timer.stop(),delete x[v];for(var F in x)return;delete d.__transition}}function kX(d,v){var k=d.__transition,x,C,I=!0,m;if(k){v=v==null?null:v+"";for(m in k){if((x=k[m]).name!==v){I=!1;continue}C=x.state>qpe&&x.state<zpe,x.state=yX,x.timer.stop(),x.on.call(C?"interrupt":"cancel",d,d.__data__,x.index,x.group),delete k[m]}I&&delete d.__transition}}function Bqn(d){return this.each(function(){kX(this,d)})}function Jqn(d,v){var k,x;return function(){var C=cm(this,d),I=C.tween;if(I!==k){x=k=I;for(var m=0,L=x.length;m<L;++m)if(x[m].name===v){x=x.slice(),x.splice(m,1);break}}C.tween=x}}function Hqn(d,v,k){var x,C;if(typeof k!="function")throw new Error;return function(){var I=cm(this,d),m=I.tween;if(m!==x){C=(x=m).slice();for(var L={name:v,value:k},G=0,F=C.length;G<F;++G)if(C[G].name===v){C[G]=L;break}G===F&&C.push(L)}I.tween=C}}function Gqn(d,v){var k=this._id;if(d+="",arguments.length<2){for(var x=gp(this.node(),k).tween,C=0,I=x.length,m;C<I;++C)if((m=x[C]).name===d)return m.value;return null}return this.each((v==null?Jqn:Hqn)(k,d,v))}function l2e(d,v,k){var x=d._id;return d.each(function(){var C=cm(this,x);(C.value||(C.value={}))[v]=k.apply(this,arguments)}),function(C){return gp(C,x).value[v]}}function Cdn(d,v){var k;return(typeof v=="number"?tm:v instanceof V8?AX:(k=V8(v))?(v=k,AX):vdn)(d,v)}function qqn(d){return function(){this.removeAttribute(d)}}function zqn(d){return function(){this.removeAttributeNS(d.space,d.local)}}function Uqn(d,v,k){var x,C=k+"",I;return function(){var m=this.getAttribute(d);return m===C?null:m===x?I:I=v(x=m,k)}}function Kqn(d,v,k){var x,C=k+"",I;return function(){var m=this.getAttributeNS(d.space,d.local);return m===C?null:m===x?I:I=v(x=m,k)}}function Xqn(d,v,k){var x,C,I;return function(){var m,L=k(this),G;return L==null?void this.removeAttribute(d):(m=this.getAttribute(d),G=L+"",m===G?null:m===x&&G===C?I:(C=G,I=v(x=m,L)))}}function Wqn(d,v,k){var x,C,I;return function(){var m,L=k(this),G;return L==null?void this.removeAttributeNS(d.space,d.local):(m=this.getAttributeNS(d.space,d.local),G=L+"",m===G?null:m===x&&G===C?I:(C=G,I=v(x=m,L)))}}function Vqn(d,v){var k=GX(d),x=k==="transform"?Tqn:Cdn;return this.attrTween(d,typeof v=="function"?(k.local?Wqn:Xqn)(k,x,l2e(this,"attr."+d,v)):v==null?(k.local?zqn:qqn)(k):(k.local?Kqn:Uqn)(k,x,v))}function Qqn(d,v){return function(k){this.setAttribute(d,v.call(this,k))}}function Yqn(d,v){return function(k){this.setAttributeNS(d.space,d.local,v.call(this,k))}}function Zqn(d,v){var k,x;function C(){var I=v.apply(this,arguments);return I!==x&&(k=(x=I)&&Yqn(d,I)),k}return C._value=v,C}function ezn(d,v){var k,x;function C(){var I=v.apply(this,arguments);return I!==x&&(k=(x=I)&&Qqn(d,I)),k}return C._value=v,C}function nzn(d,v){var k="attr."+d;if(arguments.length<2)return(k=this.tween(k))&&k._value;if(v==null)return this.tween(k,null);if(typeof v!="function")throw new Error;var x=GX(d);return this.tween(k,(x.local?Zqn:ezn)(x,v))}function tzn(d,v){return function(){f2e(this,d).delay=+v.apply(this,arguments)}}function izn(d,v){return v=+v,function(){f2e(this,d).delay=v}}function rzn(d){var v=this._id;return arguments.length?this.each((typeof d=="function"?tzn:izn)(v,d)):gp(this.node(),v).delay}function czn(d,v){return function(){cm(this,d).duration=+v.apply(this,arguments)}}function uzn(d,v){return v=+v,function(){cm(this,d).duration=v}}function ozn(d){var v=this._id;return arguments.length?this.each((typeof d=="function"?czn:uzn)(v,d)):gp(this.node(),v).duration}function szn(d,v){if(typeof v!="function")throw new Error;return function(){cm(this,d).ease=v}}function fzn(d){var v=this._id;return arguments.length?this.each(szn(v,d)):gp(this.node(),v).ease}function lzn(d,v){return function(){var k=v.apply(this,arguments);if(typeof k!="function")throw new Error;cm(this,d).ease=k}}function hzn(d){if(typeof d!="function")throw new Error;return this.each(lzn(this._id,d))}function azn(d){typeof d!="function"&&(d=idn(d));for(var v=this._groups,k=v.length,x=new Array(k),C=0;C<k;++C)for(var I=v[C],m=I.length,L=x[C]=[],G,F=0;F<m;++F)(G=I[F])&&d.call(G,G.__data__,F,I)&&L.push(G);return new mv(x,this._parents,this._name,this._id)}function dzn(d){if(d._id!==this._id)throw new Error;for(var v=this._groups,k=d._groups,x=v.length,C=k.length,I=Math.min(x,C),m=new Array(x),L=0;L<I;++L)for(var G=v[L],F=k[L],z=G.length,X=m[L]=new Array(z),K,Y=0;Y<z;++Y)(K=G[Y]||F[Y])&&(X[Y]=K);for(;L<x;++L)m[L]=v[L];return new mv(m,this._parents,this._name,this._id)}function bzn(d){return(d+"").trim().split(/^|\s+/).every(function(v){var k=v.indexOf(".");return k>=0&&(v=v.slice(0,k)),!v||v==="start"})}function wzn(d,v,k){var x,C,I=bzn(v)?f2e:cm;return function(){var m=I(this,d),L=m.on;L!==x&&(C=(x=L).copy()).on(v,k),m.on=C}}function gzn(d,v){var k=this._id;return arguments.length<2?gp(this.node(),k).on.on(d):this.each(wzn(k,d,v))}function pzn(d){return function(){var v=this.parentNode;for(var k in this.__transition)if(+k!==d)return;v&&v.removeChild(this)}}function mzn(){return this.on("end.remove",pzn(this._id))}function vzn(d){var v=this._name,k=this._id;typeof d!="function"&&(d=r2e(d));for(var x=this._groups,C=x.length,I=new Array(C),m=0;m<C;++m)for(var L=x[m],G=L.length,F=I[m]=new Array(G),z,X,K=0;K<G;++K)(z=L[K])&&(X=d.call(z,z.__data__,K,L))&&("__data__"in z&&(X.__data__=z.__data__),F[K]=X,zX(F[K],v,k,K,F,gp(z,k)));return new mv(I,this._parents,v,k)}function yzn(d){var v=this._name,k=this._id;typeof d!="function"&&(d=tdn(d));for(var x=this._groups,C=x.length,I=[],m=[],L=0;L<C;++L)for(var G=x[L],F=G.length,z,X=0;X<F;++X)if(z=G[X]){for(var K=d.call(z,z.__data__,X,G),Y,ie=gp(z,k),W=0,pe=K.length;W<pe;++W)(Y=K[W])&&zX(Y,v,k,W,K,ie);I.push(K),m.push(z)}return new mv(I,m,v,k)}var kzn=I$.prototype.constructor;function Ezn(){return new kzn(this._groups,this._parents)}function jzn(d,v){var k,x,C;return function(){var I=JS(this,d),m=(this.style.removeProperty(d),JS(this,d));return I===m?null:I===k&&m===x?C:C=v(k=I,x=m)}}function Adn(d){return function(){this.style.removeProperty(d)}}function xzn(d,v,k){var x,C=k+"",I;return function(){var m=JS(this,d);return m===C?null:m===x?I:I=v(x=m,k)}}function Szn(d,v,k){var x,C,I;return function(){var m=JS(this,d),L=k(this),G=L+"";return L==null&&(G=L=(this.style.removeProperty(d),JS(this,d))),m===G?null:m===x&&G===C?I:(C=G,I=v(x=m,L))}}function Czn(d,v){var k,x,C,I="style."+v,m="end."+I,L;return function(){var G=cm(this,d),F=G.on,z=G.value[I]==null?L||(L=Adn(v)):void 0;(F!==k||C!==z)&&(x=(k=F).copy()).on(m,C=z),G.on=x}}function Azn(d,v,k){var x=(d+="")=="transform"?Mqn:Cdn;return v==null?this.styleTween(d,jzn(d,x)).on("end.style."+d,Adn(d)):typeof v=="function"?this.styleTween(d,Szn(d,x,l2e(this,"style."+d,v))).each(Czn(this._id,d)):this.styleTween(d,xzn(d,x,v),k).on("end.style."+d,null)}function Mzn(d,v,k){return function(x){this.style.setProperty(d,v.call(this,x),k)}}function Tzn(d,v,k){var x,C;function I(){var m=v.apply(this,arguments);return m!==C&&(x=(C=m)&&Mzn(d,m,k)),x}return I._value=v,I}function Izn(d,v,k){var x="style."+(d+="");if(arguments.length<2)return(x=this.tween(x))&&x._value;if(v==null)return this.tween(x,null);if(typeof v!="function")throw new Error;return this.tween(x,Tzn(d,v,k??""))}function Pzn(d){return function(){this.textContent=d}}function Nzn(d){return function(){var v=d(this);this.textContent=v??""}}function Ozn(d){return this.tween("text",typeof d=="function"?Nzn(l2e(this,"text",d)):Pzn(d==null?"":d+""))}function $zn(d){return function(v){this.textContent=d.call(this,v)}}function Dzn(d){var v,k;function x(){var C=d.apply(this,arguments);return C!==k&&(v=(k=C)&&$zn(C)),v}return x._value=d,x}function Lzn(d){var v="text";if(arguments.length<1)return(v=this.tween(v))&&v._value;if(d==null)return this.tween(v,null);if(typeof d!="function")throw new Error;return this.tween(v,Dzn(d))}function _zn(){for(var d=this._name,v=this._id,k=Mdn(),x=this._groups,C=x.length,I=0;I<C;++I)for(var m=x[I],L=m.length,G,F=0;F<L;++F)if(G=m[F]){var z=gp(G,v);zX(G,d,k,F,m,{time:z.time+z.delay+z.duration,delay:0,duration:z.duration,ease:z.ease})}return new mv(x,this._parents,d,k)}function Fzn(){var d,v,k=this,x=k._id,C=k.size();return new Promise(function(I,m){var L={value:m},G={value:function(){--C===0&&I()}};k.each(function(){var F=cm(this,x),z=F.on;z!==d&&(v=(d=z).copy(),v._.cancel.push(L),v._.interrupt.push(L),v._.end.push(G)),F.on=v}),C===0&&I()})}var Rzn=0;function mv(d,v,k,x){this._groups=d,this._parents=v,this._name=k,this._id=x}function Mdn(){return++Rzn}var wv=I$.prototype;mv.prototype={constructor:mv,select:vzn,selectAll:yzn,selectChild:wv.selectChild,selectChildren:wv.selectChildren,filter:azn,merge:dzn,selection:Ezn,transition:_zn,call:wv.call,nodes:wv.nodes,node:wv.node,size:wv.size,empty:wv.empty,each:wv.each,on:gzn,attr:Vqn,attrTween:nzn,style:Azn,styleTween:Izn,text:Ozn,textTween:Lzn,remove:mzn,tween:Gqn,delay:rzn,duration:ozn,ease:fzn,easeVarying:hzn,end:Fzn,[Symbol.iterator]:wv[Symbol.iterator]};function Bzn(d){return((d*=2)<=1?d*d*d:(d-=2)*d*d+2)/2}var Jzn={time:null,delay:0,duration:250,ease:Bzn};function Hzn(d,v){for(var k;!(k=d.__transition)||!(k=k[v]);)if(!(d=d.parentNode))throw new Error(`transition ${v} not found`);return k}function Gzn(d){var v,k;d instanceof mv?(v=d._id,d=d._name):(v=Mdn(),(k=Jzn).time=s2e(),d=d==null?null:d+"");for(var x=this._groups,C=x.length,I=0;I<C;++I)for(var m=x[I],L=m.length,G,F=0;F<L;++F)(G=m[F])&&zX(G,d,v,F,m,k||Hzn(G,v));return new mv(x,this._parents,d,v)}I$.prototype.interrupt=Bqn;I$.prototype.transition=Gzn;const lX=d=>()=>d;function qzn(d,{sourceEvent:v,target:k,transform:x,dispatch:C}){Object.defineProperties(this,{type:{value:d,enumerable:!0,configurable:!0},sourceEvent:{value:v,enumerable:!0,configurable:!0},target:{value:k,enumerable:!0,configurable:!0},transform:{value:x,enumerable:!0,configurable:!0},_:{value:C}})}function gv(d,v,k){this.k=d,this.x=v,this.y=k}gv.prototype={constructor:gv,scale:function(d){return d===1?this:new gv(this.k*d,this.x,this.y)},translate:function(d,v){return d===0&v===0?this:new gv(this.k,this.x+this.k*d,this.y+this.k*v)},apply:function(d){return[d[0]*this.k+this.x,d[1]*this.k+this.y]},applyX:function(d){return d*this.k+this.x},applyY:function(d){return d*this.k+this.y},invert:function(d){return[(d[0]-this.x)/this.k,(d[1]-this.y)/this.k]},invertX:function(d){return(d-this.x)/this.k},invertY:function(d){return(d-this.y)/this.k},rescaleX:function(d){return d.copy().domain(d.range().map(this.invertX,this).map(d.invert,d))},rescaleY:function(d){return d.copy().domain(d.range().map(this.invertY,this).map(d.invert,d))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var UX=new gv(1,0,0);Tdn.prototype=gv.prototype;function Tdn(d){for(;!d.__zoom;)if(!(d=d.parentNode))return UX;return d.__zoom}function Spe(d){d.stopImmediatePropagation()}function b$(d){d.preventDefault(),d.stopImmediatePropagation()}function zzn(d){return(!d.ctrlKey||d.type==="wheel")&&!d.button}function Uzn(){var d=this;return d instanceof SVGElement?(d=d.ownerSVGElement||d,d.hasAttribute("viewBox")?(d=d.viewBox.baseVal,[[d.x,d.y],[d.x+d.width,d.y+d.height]]):[[0,0],[d.width.baseVal.value,d.height.baseVal.value]]):[[0,0],[d.clientWidth,d.clientHeight]]}function Dan(){return this.__zoom||UX}function Kzn(d){return-d.deltaY*(d.deltaMode===1?.05:d.deltaMode?1:.002)*(d.ctrlKey?10:1)}function Xzn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wzn(d,v,k){var x=d.invertX(v[0][0])-k[0][0],C=d.invertX(v[1][0])-k[1][0],I=d.invertY(v[0][1])-k[0][1],m=d.invertY(v[1][1])-k[1][1];return d.translate(C>x?(x+C)/2:Math.min(0,x)||Math.max(0,C),m>I?(I+m)/2:Math.min(0,I)||Math.max(0,m))}function Idn(){var d=zzn,v=Uzn,k=Wzn,x=Kzn,C=Xzn,I=[0,1/0],m=[[-1/0,-1/0],[1/0,1/0]],L=250,G=mX,F=HX("start","zoom","end"),z,X,K,Y=500,ie=150,W=0,pe=10;function fe(ye){ye.property("__zoom",Dan).on("wheel.zoom",Ze,{passive:!1}).on("mousedown.zoom",rn).on("dblclick.zoom",Bn).filter(C).on("touchstart.zoom",Ln).on("touchmove.zoom",mn).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}fe.transform=function(ye,Oe,Qe,fn){var gn=ye.selection?ye.selection():ye;gn.property("__zoom",Dan),ye!==gn?qe(ye,Oe,Qe,fn):gn.interrupt().each(function(){Ne(this,arguments).event(fn).start().zoom(null,typeof Oe=="function"?Oe.apply(this,arguments):Oe).end()})},fe.scaleBy=function(ye,Oe,Qe,fn){fe.scaleTo(ye,function(){var gn=this.__zoom.k,On=typeof Oe=="function"?Oe.apply(this,arguments):Oe;return gn*On},Qe,fn)},fe.scaleTo=function(ye,Oe,Qe,fn){fe.transform(ye,function(){var gn=v.apply(this,arguments),On=this.__zoom,Vn=Qe==null?he(gn):typeof Qe=="function"?Qe.apply(this,arguments):Qe,Zn=On.invert(Vn),nt=typeof Oe=="function"?Oe.apply(this,arguments):Oe;return k(te(je(On,nt),Vn,Zn),gn,m)},Qe,fn)},fe.translateBy=function(ye,Oe,Qe,fn){fe.transform(ye,function(){return k(this.__zoom.translate(typeof Oe=="function"?Oe.apply(this,arguments):Oe,typeof Qe=="function"?Qe.apply(this,arguments):Qe),v.apply(this,arguments),m)},null,fn)},fe.translateTo=function(ye,Oe,Qe,fn,gn){fe.transform(ye,function(){var On=v.apply(this,arguments),Vn=this.__zoom,Zn=fn==null?he(On):typeof fn=="function"?fn.apply(this,arguments):fn;return k(UX.translate(Zn[0],Zn[1]).scale(Vn.k).translate(typeof Oe=="function"?-Oe.apply(this,arguments):-Oe,typeof Qe=="function"?-Qe.apply(this,arguments):-Qe),On,m)},fn,gn)};function je(ye,Oe){return Oe=Math.max(I[0],Math.min(I[1],Oe)),Oe===ye.k?ye:new gv(Oe,ye.x,ye.y)}function te(ye,Oe,Qe){var fn=Oe[0]-Qe[0]*ye.k,gn=Oe[1]-Qe[1]*ye.k;return fn===ye.x&&gn===ye.y?ye:new gv(ye.k,fn,gn)}function he(ye){return[(+ye[0][0]+ +ye[1][0])/2,(+ye[0][1]+ +ye[1][1])/2]}function qe(ye,Oe,Qe,fn){ye.on("start.zoom",function(){Ne(this,arguments).event(fn).start()}).on("interrupt.zoom end.zoom",function(){Ne(this,arguments).event(fn).end()}).tween("zoom",function(){var gn=this,On=arguments,Vn=Ne(gn,On).event(fn),Zn=v.apply(gn,On),nt=Qe==null?he(Zn):typeof Qe=="function"?Qe.apply(gn,On):Qe,ai=Math.max(Zn[1][0]-Zn[0][0],Zn[1][1]-Zn[0][1]),ti=gn.__zoom,vi=typeof Oe=="function"?Oe.apply(gn,On):Oe,fr=G(ti.invert(nt).concat(ai/ti.k),vi.invert(nt).concat(ai/vi.k));return function(wi){if(wi===1)wi=vi;else{var Un=fr(wi),Xt=ai/Un[2];wi=new gv(Xt,nt[0]-Un[0]*Xt,nt[1]-Un[1]*Xt)}Vn.zoom(null,wi)}})}function Ne(ye,Oe,Qe){return!Qe&&ye.__zooming||new Me(ye,Oe)}function Me(ye,Oe){this.that=ye,this.args=Oe,this.active=0,this.sourceEvent=null,this.extent=v.apply(ye,Oe),this.taps=0}Me.prototype={event:function(ye){return ye&&(this.sourceEvent=ye),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(ye,Oe){return this.mouse&&ye!=="mouse"&&(this.mouse[1]=Oe.invert(this.mouse[0])),this.touch0&&ye!=="touch"&&(this.touch0[1]=Oe.invert(this.touch0[0])),this.touch1&&ye!=="touch"&&(this.touch1[1]=Oe.invert(this.touch1[0])),this.that.__zoom=Oe,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(ye){var Oe=X0(this.that).datum();F.call(ye,this.that,new qzn(ye,{sourceEvent:this.sourceEvent,target:fe,transform:this.that.__zoom,dispatch:F}),Oe)}};function Ze(ye,...Oe){if(!d.apply(this,arguments))return;var Qe=Ne(this,Oe).event(ye),fn=this.__zoom,gn=Math.max(I[0],Math.min(I[1],fn.k*Math.pow(2,x.apply(this,arguments)))),On=hp(ye);if(Qe.wheel)(Qe.mouse[0][0]!==On[0]||Qe.mouse[0][1]!==On[1])&&(Qe.mouse[1]=fn.invert(Qe.mouse[0]=On)),clearTimeout(Qe.wheel);else{if(fn.k===gn)return;Qe.mouse=[On,fn.invert(On)],kX(this),Qe.start()}b$(ye),Qe.wheel=setTimeout(Vn,ie),Qe.zoom("mouse",k(te(je(fn,gn),Qe.mouse[0],Qe.mouse[1]),Qe.extent,m));function Vn(){Qe.wheel=null,Qe.end()}}function rn(ye,...Oe){if(K||!d.apply(this,arguments))return;var Qe=ye.currentTarget,fn=Ne(this,Oe,!0).event(ye),gn=X0(ye.view).on("mousemove.zoom",nt,!0).on("mouseup.zoom",ai,!0),On=hp(ye,Qe),Vn=ye.clientX,Zn=ye.clientY;ddn(ye.view),Spe(ye),fn.mouse=[On,this.__zoom.invert(On)],kX(this),fn.start();function nt(ti){if(b$(ti),!fn.moved){var vi=ti.clientX-Vn,fr=ti.clientY-Zn;fn.moved=vi*vi+fr*fr>W}fn.event(ti).zoom("mouse",k(te(fn.that.__zoom,fn.mouse[0]=hp(ti,Qe),fn.mouse[1]),fn.extent,m))}function ai(ti){gn.on("mousemove.zoom mouseup.zoom",null),bdn(ti.view,fn.moved),b$(ti),fn.event(ti).end()}}function Bn(ye,...Oe){if(d.apply(this,arguments)){var Qe=this.__zoom,fn=hp(ye.changedTouches?ye.changedTouches[0]:ye,this),gn=Qe.invert(fn),On=Qe.k*(ye.shiftKey?.5:2),Vn=k(te(je(Qe,On),fn,gn),v.apply(this,Oe),m);b$(ye),L>0?X0(this).transition().duration(L).call(qe,Vn,fn,ye):X0(this).call(fe.transform,Vn,fn,ye)}}function Ln(ye,...Oe){if(d.apply(this,arguments)){var Qe=ye.touches,fn=Qe.length,gn=Ne(this,Oe,ye.changedTouches.length===fn).event(ye),On,Vn,Zn,nt;for(Spe(ye),Vn=0;Vn<fn;++Vn)Zn=Qe[Vn],nt=hp(Zn,this),nt=[nt,this.__zoom.invert(nt),Zn.identifier],gn.touch0?!gn.touch1&&gn.touch0[2]!==nt[2]&&(gn.touch1=nt,gn.taps=0):(gn.touch0=nt,On=!0,gn.taps=1+!!z);z&&(z=clearTimeout(z)),On&&(gn.taps<2&&(X=nt[0],z=setTimeout(function(){z=null},Y)),kX(this),gn.start())}}function mn(ye,...Oe){if(this.__zooming){var Qe=Ne(this,Oe).event(ye),fn=ye.changedTouches,gn=fn.length,On,Vn,Zn,nt;for(b$(ye),On=0;On<gn;++On)Vn=fn[On],Zn=hp(Vn,this),Qe.touch0&&Qe.touch0[2]===Vn.identifier?Qe.touch0[0]=Zn:Qe.touch1&&Qe.touch1[2]===Vn.identifier&&(Qe.touch1[0]=Zn);if(Vn=Qe.that.__zoom,Qe.touch1){var ai=Qe.touch0[0],ti=Qe.touch0[1],vi=Qe.touch1[0],fr=Qe.touch1[1],wi=(wi=vi[0]-ai[0])*wi+(wi=vi[1]-ai[1])*wi,Un=(Un=fr[0]-ti[0])*Un+(Un=fr[1]-ti[1])*Un;Vn=je(Vn,Math.sqrt(wi/Un)),Zn=[(ai[0]+vi[0])/2,(ai[1]+vi[1])/2],nt=[(ti[0]+fr[0])/2,(ti[1]+fr[1])/2]}else if(Qe.touch0)Zn=Qe.touch0[0],nt=Qe.touch0[1];else return;Qe.zoom("touch",k(te(Vn,Zn,nt),Qe.extent,m))}}function B(ye,...Oe){if(this.__zooming){var Qe=Ne(this,Oe).event(ye),fn=ye.changedTouches,gn=fn.length,On,Vn;for(Spe(ye),K&&clearTimeout(K),K=setTimeout(function(){K=null},Y),On=0;On<gn;++On)Vn=fn[On],Qe.touch0&&Qe.touch0[2]===Vn.identifier?delete Qe.touch0:Qe.touch1&&Qe.touch1[2]===Vn.identifier&&delete Qe.touch1;if(Qe.touch1&&!Qe.touch0&&(Qe.touch0=Qe.touch1,delete Qe.touch1),Qe.touch0)Qe.touch0[1]=this.__zoom.invert(Qe.touch0[0]);else if(Qe.end(),Qe.taps===2&&(Vn=hp(Vn,this),Math.hypot(X[0]-Vn[0],X[1]-Vn[1])<pe)){var Zn=X0(this).on("dblclick.zoom");Zn&&Zn.apply(this,arguments)}}}return fe.wheelDelta=function(ye){return arguments.length?(x=typeof ye=="function"?ye:lX(+ye),fe):x},fe.filter=function(ye){return arguments.length?(d=typeof ye=="function"?ye:lX(!!ye),fe):d},fe.touchable=function(ye){return arguments.length?(C=typeof ye=="function"?ye:lX(!!ye),fe):C},fe.extent=function(ye){return arguments.length?(v=typeof ye=="function"?ye:lX([[+ye[0][0],+ye[0][1]],[+ye[1][0],+ye[1][1]]]),fe):v},fe.scaleExtent=function(ye){return arguments.length?(I[0]=+ye[0],I[1]=+ye[1],fe):[I[0],I[1]]},fe.translateExtent=function(ye){return arguments.length?(m[0][0]=+ye[0][0],m[1][0]=+ye[1][0],m[0][1]=+ye[0][1],m[1][1]=+ye[1][1],fe):[[m[0][0],m[0][1]],[m[1][0],m[1][1]]]},fe.constrain=function(ye){return arguments.length?(k=ye,fe):k},fe.duration=function(ye){return arguments.length?(L=+ye,fe):L},fe.interpolate=function(ye){return arguments.length?(G=ye,fe):G},fe.on=function(){var ye=F.on.apply(F,arguments);return ye===F?fe:ye},fe.clickDistance=function(ye){return arguments.length?(W=(ye=+ye)*ye,fe):Math.sqrt(W)},fe.tapDistance=function(ye){return arguments.length?(pe=+ye,fe):pe},fe}const wp={error001:(d="react")=>`Seems like you have not used ${d==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${d}flow.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:d=>`Node type "${d}" not found. Using fallback type "default".`,error004:()=>"The 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:d=>`The old edge with id=${d} does not exist.`,error009:d=>`Marker type "${d}" doesn't exist.`,error008:(d,{id:v,sourceHandle:k,targetHandle:x})=>`Couldn't create edge for ${d} handle id: "${d==="source"?k:x}", edge id: ${v}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:d=>`Edge type "${d}" not found. Using fallback type "default".`,error012:d=>`Node with id "${d}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(d="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${d}/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.",error016:d=>`Edge with id "${d}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},x$=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Pdn=["Enter"," ","Escape"],Ndn={"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:d,x:v,y:k})=>`Moved selected node ${d}. New position, x: ${v}, y: ${k}`,"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 GS;(function(d){d.Strict="strict",d.Loose="loose"})(GS||(GS={}));var X8;(function(d){d.Free="free",d.Vertical="vertical",d.Horizontal="horizontal"})(X8||(X8={}));var S$;(function(d){d.Partial="partial",d.Full="full"})(S$||(S$={}));const Odn={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var E6;(function(d){d.Bezier="default",d.Straight="straight",d.Step="step",d.SmoothStep="smoothstep",d.SimpleBezier="simplebezier"})(E6||(E6={}));var C$;(function(d){d.Arrow="arrow",d.ArrowClosed="arrowclosed"})(C$||(C$={}));var tr;(function(d){d.Left="left",d.Top="top",d.Right="right",d.Bottom="bottom"})(tr||(tr={}));const Lan={[tr.Left]:tr.Right,[tr.Right]:tr.Left,[tr.Top]:tr.Bottom,[tr.Bottom]:tr.Top};function $dn(d){return d===null?null:d?"valid":"invalid"}const Ddn=d=>!!d&&typeof d=="object"&&"id"in d&&"source"in d&&"target"in d,Vzn=d=>!!d&&typeof d=="object"&&"id"in d&&"position"in d&&!("source"in d)&&!("target"in d),h2e=d=>!!d&&typeof d=="object"&&"id"in d&&"internals"in d&&!("source"in d)&&!("target"in d),N$=(d,v=[0,0])=>{const{width:k,height:x}=um(d),C=d.origin??v,I=k*C[0],m=x*C[1];return{x:d.position.x-I,y:d.position.y-m}},Qzn=(d,v={nodeOrigin:[0,0]})=>{if(d.length===0)return{x:0,y:0,width:0,height:0};const k=d.reduce((x,C)=>{const I=typeof C=="string";let m=!v.nodeLookup&&!I?C:void 0;v.nodeLookup&&(m=I?v.nodeLookup.get(C):h2e(C)?C:v.nodeLookup.get(C.id));const L=m?PX(m,v.nodeOrigin):{x:0,y:0,x2:0,y2:0};return KX(x,L)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return XX(k)},O$=(d,v={})=>{let k={x:1/0,y:1/0,x2:-1/0,y2:-1/0},x=!1;return d.forEach(C=>{(v.filter===void 0||v.filter(C))&&(k=KX(k,PX(C)),x=!0)}),x?XX(k):{x:0,y:0,width:0,height:0}},a2e=(d,v,[k,x,C]=[0,0,1],I=!1,m=!1)=>{const L=(v.x-k)/C,G=(v.y-x)/C,F=v.width/C,z=v.height/C,X=[];for(const K of d.values()){const{measured:Y,selectable:ie=!0,hidden:W=!1}=K;if(m&&!ie||W)continue;const pe=Y.width??K.width??K.initialWidth??0,fe=Y.height??K.height??K.initialHeight??0,{x:je,y:te}=K.internals.positionAbsolute,he=Rdn(L,G,F,z,je,te,pe,fe),qe=pe*fe,Ne=I&&he>0;(!K.internals.handleBounds||Ne||he>=qe||K.dragging)&&X.push(K)}return X},Yzn=(d,v)=>{const k=new Set;return d.forEach(x=>{k.add(x.id)}),v.filter(x=>k.has(x.source)||k.has(x.target))};function Zzn(d,v){const k=new Map,x=v?.nodes?new Set(v.nodes.map(C=>C.id)):null;return d.forEach(C=>{let I;if(v?.includeHiddenNodes){const{width:m,height:L}=um(C);I=m>0&&L>0}else I=!!(C.measured.width&&C.measured.height&&!C.hidden);I&&(!x||x.has(C.id))&&k.set(C.id,C)}),k}async function eUn({nodes:d,width:v,height:k,panZoom:x,minZoom:C,maxZoom:I},m){if(d.size===0)return!0;const L=Zzn(d,m),G=O$(L),F=b2e(G,v,k,m?.minZoom??C,m?.maxZoom??I,m?.padding??.1);return await x.setViewport(F,{duration:m?.duration,ease:m?.ease,interpolate:m?.interpolate}),!0}function Ldn({nodeId:d,nextPosition:v,nodeLookup:k,nodeOrigin:x=[0,0],nodeExtent:C,onError:I}){const m=k.get(d),L=m.parentId?k.get(m.parentId):void 0,{x:G,y:F}=L?L.internals.positionAbsolute:{x:0,y:0},z=m.origin??x;let X=m.extent||C;if(m.extent==="parent"&&!m.expandParent)if(!L)I?.("005",wp.error005());else{const Y=L.measured.width,ie=L.measured.height;Y&&ie&&(X=[[G,F],[G+Y,F+ie]])}else L&&Z8(m.extent)&&(X=[[m.extent[0][0]+G,m.extent[0][1]+F],[m.extent[1][0]+G,m.extent[1][1]+F]]);const K=Z8(X)?Y8(v,X,m.measured):v;return(m.measured.width===void 0||m.measured.height===void 0)&&I?.("015",wp.error015()),{position:{x:K.x-G+(m.measured.width??0)*z[0],y:K.y-F+(m.measured.height??0)*z[1]},positionAbsolute:K}}async function nUn({nodesToRemove:d=[],edgesToRemove:v=[],nodes:k,edges:x,onBeforeDelete:C}){const I=new Set(d.map(K=>K.id)),m=[];for(const K of k){if(K.deletable===!1)continue;const Y=I.has(K.id),ie=!Y&&K.parentId&&m.find(W=>W.id===K.parentId);(Y||ie)&&m.push(K)}const L=new Set(v.map(K=>K.id)),G=x.filter(K=>K.deletable!==!1),z=Yzn(m,G);for(const K of G)L.has(K.id)&&!z.find(ie=>ie.id===K.id)&&z.push(K);if(!C)return{edges:z,nodes:m};const X=await C({nodes:m,edges:z});return typeof X=="boolean"?X?{edges:z,nodes:m}:{edges:[],nodes:[]}:X}const qS=(d,v=0,k=1)=>Math.min(Math.max(d,v),k),Y8=(d={x:0,y:0},v,k)=>({x:qS(d.x,v[0][0],v[1][0]-(k?.width??0)),y:qS(d.y,v[0][1],v[1][1]-(k?.height??0))});function _dn(d,v,k){const{width:x,height:C}=um(k),{x:I,y:m}=k.internals.positionAbsolute;return Y8(d,[[I,m],[I+x,m+C]],v)}const _an=(d,v,k)=>d<v?qS(Math.abs(d-v),1,v)/v:d>k?-qS(Math.abs(d-k),1,v)/v:0,d2e=(d,v,k=15,x=40)=>{const C=_an(d.x,x,v.width-x)*k,I=_an(d.y,x,v.height-x)*k;return[C,I]},KX=(d,v)=>({x:Math.min(d.x,v.x),y:Math.min(d.y,v.y),x2:Math.max(d.x2,v.x2),y2:Math.max(d.y2,v.y2)}),Upe=({x:d,y:v,width:k,height:x})=>({x:d,y:v,x2:d+k,y2:v+x}),XX=({x:d,y:v,x2:k,y2:x})=>({x:d,y:v,width:k-d,height:x-v}),A$=(d,v=[0,0])=>{const{x:k,y:x}=h2e(d)?d.internals.positionAbsolute:N$(d,v);return{x:k,y:x,width:d.measured?.width??d.width??d.initialWidth??0,height:d.measured?.height??d.height??d.initialHeight??0}},PX=(d,v=[0,0])=>{const{x:k,y:x}=h2e(d)?d.internals.positionAbsolute:N$(d,v);return{x:k,y:x,x2:k+(d.measured?.width??d.width??d.initialWidth??0),y2:x+(d.measured?.height??d.height??d.initialHeight??0)}},Fdn=(d,v)=>XX(KX(Upe(d),Upe(v))),Rdn=(d,v,k,x,C,I,m,L)=>{const G=Math.max(0,Math.min(d+k,C+m)-Math.max(d,C)),F=Math.max(0,Math.min(v+x,I+L)-Math.max(v,I));return Math.ceil(G*F)},NX=(d,v)=>Rdn(d.x,d.y,d.width,d.height,v.x,v.y,v.width,v.height),Fan=d=>dp(d.width)&&dp(d.height)&&dp(d.x)&&dp(d.y),dp=d=>!isNaN(d)&&isFinite(d),Bdn=(d,v)=>(k,x)=>{},$$=(d,v=[1,1])=>({x:v[0]*Math.round(d.x/v[0]),y:v[1]*Math.round(d.y/v[1])}),D$=({x:d,y:v},[k,x,C],I=!1,m=[1,1])=>{const L={x:(d-k)/C,y:(v-x)/C};return I?$$(L,m):L},zS=({x:d,y:v},[k,x,C])=>({x:d*C+k,y:v*C+x});function PS(d,v){if(typeof d=="number")return Math.floor((v-v/(1+d))*.5);if(typeof d=="string"&&d.endsWith("px")){const k=parseFloat(d);if(!Number.isNaN(k))return Math.floor(k)}if(typeof d=="string"&&d.endsWith("%")){const k=parseFloat(d);if(!Number.isNaN(k))return Math.floor(v*k*.01)}return console.error(`The padding value "${d}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function tUn(d,v,k){if(typeof d=="string"||typeof d=="number"){const x=PS(d,k),C=PS(d,v);return{top:x,right:C,bottom:x,left:C,x:C*2,y:x*2}}if(typeof d=="object"){const x=PS(d.top??d.y??0,k),C=PS(d.bottom??d.y??0,k),I=PS(d.left??d.x??0,v),m=PS(d.right??d.x??0,v);return{top:x,right:m,bottom:C,left:I,x:I+m,y:x+C}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function iUn(d,v,k,x,C,I){const{x:m,y:L}=zS(d,[v,k,x]),{x:G,y:F}=zS({x:d.x+d.width,y:d.y+d.height},[v,k,x]),z=C-G,X=I-F;return{left:Math.floor(m),top:Math.floor(L),right:Math.floor(z),bottom:Math.floor(X)}}const b2e=(d,v,k,x,C,I)=>{const m=tUn(I,v,k),L=(v-m.x)/d.width,G=(k-m.y)/d.height,F=Math.min(L,G),z=qS(F,x,C),X=d.x+d.width/2,K=d.y+d.height/2,Y=v/2-X*z,ie=k/2-K*z,W=iUn(d,Y,ie,z,v,k),pe={left:Math.min(W.left-m.left,0),top:Math.min(W.top-m.top,0),right:Math.min(W.right-m.right,0),bottom:Math.min(W.bottom-m.bottom,0)};return{x:Y-pe.left+pe.right,y:ie-pe.top+pe.bottom,zoom:z}},M$=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Z8(d){return d!=null&&d!=="parent"}function um(d){return{width:d.measured?.width??d.width??d.initialWidth??0,height:d.measured?.height??d.height??d.initialHeight??0}}function Jdn(d){return(d.measured?.width??d.width??d.initialWidth)!==void 0&&(d.measured?.height??d.height??d.initialHeight)!==void 0}function Hdn(d,v={width:0,height:0},k,x,C){const I={...d},m=x.get(k);if(m){const L=m.origin||C;I.x+=m.internals.positionAbsolute.x-(v.width??0)*L[0],I.y+=m.internals.positionAbsolute.y-(v.height??0)*L[1]}return I}function Ran(d,v){if(d.size!==v.size)return!1;for(const k of d)if(!v.has(k))return!1;return!0}function rUn(){let d,v;return{promise:new Promise((x,C)=>{d=x,v=C}),resolve:d,reject:v}}function cUn(d){return{...Ndn,...d||{}}}function m$(d,{snapGrid:v=[0,0],snapToGrid:k=!1,transform:x,containerBounds:C}){const{x:I,y:m}=bp(d),L=D$({x:I-(C?.left??0),y:m-(C?.top??0)},x),{x:G,y:F}=k?$$(L,v):L;return{xSnapped:G,ySnapped:F,...L}}const w2e=d=>({width:d.offsetWidth,height:d.offsetHeight}),Gdn=d=>d?.getRootNode?.()||window?.document,uUn=["INPUT","SELECT","TEXTAREA"];function qdn(d){const v=d.composedPath?.()?.[0]||d.target;return v?.nodeType!==1?!1:uUn.includes(v.nodeName)||v.hasAttribute("contenteditable")||!!v.closest(".nokey")}const zdn=d=>"clientX"in d,bp=(d,v)=>{const k=zdn(d),x=k?d.clientX:d.touches?.[0].clientX,C=k?d.clientY:d.touches?.[0].clientY;return{x:x-(v?.left??0),y:C-(v?.top??0)}},Ban=(d,v,k,x,C)=>{const I=v.querySelectorAll(`.${d}`);return!I||!I.length?null:Array.from(I).map(m=>{const L=m.getBoundingClientRect();return{id:m.getAttribute("data-handleid"),type:d,nodeId:C,position:m.getAttribute("data-handlepos"),x:(L.left-k.left)/x,y:(L.top-k.top)/x,...w2e(m)}})};function Udn({sourceX:d,sourceY:v,targetX:k,targetY:x,sourceControlX:C,sourceControlY:I,targetControlX:m,targetControlY:L}){const G=d*.125+C*.375+m*.375+k*.125,F=v*.125+I*.375+L*.375+x*.125,z=Math.abs(G-d),X=Math.abs(F-v);return[G,F,z,X]}function hX(d,v){return d>=0?.5*d:v*25*Math.sqrt(-d)}function Jan({pos:d,x1:v,y1:k,x2:x,y2:C,c:I}){switch(d){case tr.Left:return[v-hX(v-x,I),k];case tr.Right:return[v+hX(x-v,I),k];case tr.Top:return[v,k-hX(k-C,I)];case tr.Bottom:return[v,k+hX(C-k,I)]}}function Kdn({sourceX:d,sourceY:v,sourcePosition:k=tr.Bottom,targetX:x,targetY:C,targetPosition:I=tr.Top,curvature:m=.25}){const[L,G]=Jan({pos:k,x1:d,y1:v,x2:x,y2:C,c:m}),[F,z]=Jan({pos:I,x1:x,y1:C,x2:d,y2:v,c:m}),[X,K,Y,ie]=Udn({sourceX:d,sourceY:v,targetX:x,targetY:C,sourceControlX:L,sourceControlY:G,targetControlX:F,targetControlY:z});return[`M${d},${v} C${L},${G} ${F},${z} ${x},${C}`,X,K,Y,ie]}function Xdn({sourceX:d,sourceY:v,targetX:k,targetY:x}){const C=Math.abs(k-d)/2,I=k<d?k+C:k-C,m=Math.abs(x-v)/2,L=x<v?x+m:x-m;return[I,L,C,m]}function oUn({sourceNode:d,targetNode:v,selected:k=!1,zIndex:x=0,elevateOnSelect:C=!1,zIndexMode:I="basic"}){if(I==="manual")return x;const m=C&&k?x+1e3:x,L=Math.max(d.parentId||C&&d.selected?d.internals.z:0,v.parentId||C&&v.selected?v.internals.z:0);return m+L}function sUn({sourceNode:d,targetNode:v,width:k,height:x,transform:C}){const I=KX(PX(d),PX(v));I.x===I.x2&&(I.x2+=1),I.y===I.y2&&(I.y2+=1);const m={x:-C[0]/C[2],y:-C[1]/C[2],width:k/C[2],height:x/C[2]};return NX(m,XX(I))>0}const fUn=({source:d,sourceHandle:v,target:k,targetHandle:x})=>`xy-edge__${d}${v||""}-${k}${x||""}`,lUn=(d,v)=>v.some(k=>k.source===d.source&&k.target===d.target&&(k.sourceHandle===d.sourceHandle||!k.sourceHandle&&!d.sourceHandle)&&(k.targetHandle===d.targetHandle||!k.targetHandle&&!d.targetHandle)),hUn=(d,v,k={})=>{if(!d.source||!d.target)return k.onError?.("006",wp.error006()),v;const x=k.getEdgeId||fUn;let C;return Ddn(d)?C={...d}:C={...d,id:x(d)},lUn(C,v)?v:(C.sourceHandle===null&&delete C.sourceHandle,C.targetHandle===null&&delete C.targetHandle,v.concat(C))};function Wdn({sourceX:d,sourceY:v,targetX:k,targetY:x}){const[C,I,m,L]=Xdn({sourceX:d,sourceY:v,targetX:k,targetY:x});return[`M ${d},${v}L ${k},${x}`,C,I,m,L]}const Han={[tr.Left]:{x:-1,y:0},[tr.Right]:{x:1,y:0},[tr.Top]:{x:0,y:-1},[tr.Bottom]:{x:0,y:1}},aUn=({source:d,sourcePosition:v=tr.Bottom,target:k})=>v===tr.Left||v===tr.Right?d.x<k.x?{x:1,y:0}:{x:-1,y:0}:d.y<k.y?{x:0,y:1}:{x:0,y:-1},Gan=(d,v)=>Math.sqrt(Math.pow(v.x-d.x,2)+Math.pow(v.y-d.y,2));function dUn({source:d,sourcePosition:v=tr.Bottom,target:k,targetPosition:x=tr.Top,center:C,offset:I,stepPosition:m}){const L=Han[v],G=Han[x],F={x:d.x+L.x*I,y:d.y+L.y*I},z={x:k.x+G.x*I,y:k.y+G.y*I},X=aUn({source:F,sourcePosition:v,target:z}),K=X.x!==0?"x":"y",Y=X[K];let ie=[],W,pe;const fe={x:0,y:0},je={x:0,y:0},[,,te,he]=Xdn({sourceX:d.x,sourceY:d.y,targetX:k.x,targetY:k.y});if(L[K]*G[K]===-1){K==="x"?(W=C.x??F.x+(z.x-F.x)*m,pe=C.y??(F.y+z.y)/2):(W=C.x??(F.x+z.x)/2,pe=C.y??F.y+(z.y-F.y)*m);const Ze=[{x:W,y:F.y},{x:W,y:z.y}],rn=[{x:F.x,y:pe},{x:z.x,y:pe}];L[K]===Y?ie=K==="x"?Ze:rn:ie=K==="x"?rn:Ze}else{const Ze=[{x:F.x,y:z.y}],rn=[{x:z.x,y:F.y}];if(K==="x"?ie=L.x===Y?rn:Ze:ie=L.y===Y?Ze:rn,v===x){const ye=Math.abs(d[K]-k[K]);if(ye<=I){const Oe=Math.min(I-1,I-ye);L[K]===Y?fe[K]=(F[K]>d[K]?-1:1)*Oe:je[K]=(z[K]>k[K]?-1:1)*Oe}}if(v!==x){const ye=K==="x"?"y":"x",Oe=L[K]===G[ye],Qe=F[ye]>z[ye],fn=F[ye]<z[ye];(L[K]===1&&(!Oe&&Qe||Oe&&fn)||L[K]!==1&&(!Oe&&fn||Oe&&Qe))&&(ie=K==="x"?Ze:rn)}const Bn={x:F.x+fe.x,y:F.y+fe.y},Ln={x:z.x+je.x,y:z.y+je.y},mn=Math.max(Math.abs(Bn.x-ie[0].x),Math.abs(Ln.x-ie[0].x)),B=Math.max(Math.abs(Bn.y-ie[0].y),Math.abs(Ln.y-ie[0].y));mn>=B?(W=(Bn.x+Ln.x)/2,pe=ie[0].y):(W=ie[0].x,pe=(Bn.y+Ln.y)/2)}const qe={x:F.x+fe.x,y:F.y+fe.y},Ne={x:z.x+je.x,y:z.y+je.y};return[[d,...qe.x!==ie[0].x||qe.y!==ie[0].y?[qe]:[],...ie,...Ne.x!==ie[ie.length-1].x||Ne.y!==ie[ie.length-1].y?[Ne]:[],k],W,pe,te,he]}function bUn(d,v,k,x){const C=Math.min(Gan(d,v)/2,Gan(v,k)/2,x),{x:I,y:m}=v;if(d.x===I&&I===k.x||d.y===m&&m===k.y)return`L${I} ${m}`;if(d.y===m){const F=d.x<k.x?-1:1,z=d.y<k.y?1:-1;return`L ${I+C*F},${m}Q ${I},${m} ${I},${m+C*z}`}const L=d.x<k.x?1:-1,G=d.y<k.y?-1:1;return`L ${I},${m+C*G}Q ${I},${m} ${I+C*L},${m}`}function OX({sourceX:d,sourceY:v,sourcePosition:k=tr.Bottom,targetX:x,targetY:C,targetPosition:I=tr.Top,borderRadius:m=5,centerX:L,centerY:G,offset:F=20,stepPosition:z=.5}){const[X,K,Y,ie,W]=dUn({source:{x:d,y:v},sourcePosition:k,target:{x,y:C},targetPosition:I,center:{x:L,y:G},offset:F,stepPosition:z});let pe=`M${X[0].x} ${X[0].y}`;for(let fe=1;fe<X.length-1;fe++)pe+=bUn(X[fe-1],X[fe],X[fe+1],m);return pe+=`L${X[X.length-1].x} ${X[X.length-1].y}`,[pe,K,Y,ie,W]}function qan(d){return d&&!!(d.internals.handleBounds||d.handles?.length)&&!!(d.measured.width||d.width||d.initialWidth)}function wUn(d){const{sourceNode:v,targetNode:k}=d;if(!qan(v)||!qan(k))return null;const x=v.internals.handleBounds||zan(v.handles),C=k.internals.handleBounds||zan(k.handles),I=Uan(x?.source??[],d.sourceHandle),m=Uan(d.connectionMode===GS.Strict?C?.target??[]:(C?.target??[]).concat(C?.source??[]),d.targetHandle);if(!I||!m)return d.onError?.("008",wp.error008(I?"target":"source",{id:d.id,sourceHandle:d.sourceHandle,targetHandle:d.targetHandle})),null;const L=I?.position||tr.Bottom,G=m?.position||tr.Top,F=e7(v,I,L),z=e7(k,m,G);return{sourceX:F.x,sourceY:F.y,targetX:z.x,targetY:z.y,sourcePosition:L,targetPosition:G}}function zan(d){if(!d)return null;const v=[],k=[];for(const x of d)x.width=x.width??1,x.height=x.height??1,x.type==="source"?v.push(x):x.type==="target"&&k.push(x);return{source:v,target:k}}function e7(d,v,k=tr.Left,x=!1){const C=(v?.x??0)+d.internals.positionAbsolute.x,I=(v?.y??0)+d.internals.positionAbsolute.y,{width:m,height:L}=v??um(d);if(x)return{x:C+m/2,y:I+L/2};switch(v?.position??k){case tr.Top:return{x:C+m/2,y:I};case tr.Right:return{x:C+m,y:I+L/2};case tr.Bottom:return{x:C+m/2,y:I+L};case tr.Left:return{x:C,y:I+L/2}}}function Uan(d,v){return d&&(v?d.find(k=>k.id===v):d[0])||null}function Kpe(d,v){return d?typeof d=="string"?d:`${v?`${v}__`:""}${Object.keys(d).sort().map(x=>`${x}=${d[x]}`).join("&")}`:""}function gUn(d,{id:v,defaultColor:k,defaultMarkerStart:x,defaultMarkerEnd:C}){const I=new Set;return d.reduce((m,L)=>([L.markerStart||x,L.markerEnd||C].forEach(G=>{if(G&&typeof G=="object"){const F=Kpe(G,v);I.has(F)||(m.push({id:F,color:G.color||k,...G}),I.add(F))}}),m),[]).sort((m,L)=>m.id.localeCompare(L.id))}const Vdn=1e3,pUn=10,g2e={nodeOrigin:[0,0],nodeExtent:x$,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},mUn={...g2e,checkEquality:!0};function p2e(d,v){const k={...d};for(const x in v)v[x]!==void 0&&(k[x]=v[x]);return k}function vUn(d,v,k){const x=p2e(g2e,k);for(const C of d.values())if(C.parentId)v2e(C,d,v,x);else{const I=N$(C,x.nodeOrigin),m=Z8(C.extent)?C.extent:x.nodeExtent,L=Y8(I,m,um(C));C.internals.positionAbsolute=L}}function yUn(d,v){if(!d.handles)return d.measured?v?.internals.handleBounds:void 0;const k=[],x=[];for(const C of d.handles){const I={id:C.id,width:C.width??1,height:C.height??1,nodeId:d.id,x:C.x,y:C.y,position:C.position,type:C.type};C.type==="source"?k.push(I):C.type==="target"&&x.push(I)}return{source:k,target:x}}function m2e(d){return d==="manual"}function Xpe(d,v,k,x={}){const C=p2e(mUn,x),I={i:0},m=new Map(v),L=C?.elevateNodesOnSelect&&!m2e(C.zIndexMode)?Vdn:0;let G=d.length>0,F=!1;v.clear(),k.clear();for(const z of d){let X=m.get(z.id);if(C.checkEquality&&z===X?.internals.userNode)v.set(z.id,X);else{const K=N$(z,C.nodeOrigin),Y=Z8(z.extent)?z.extent:C.nodeExtent,ie=Y8(K,Y,um(z));X={...C.defaults,...z,measured:{width:z.measured?.width,height:z.measured?.height},internals:{positionAbsolute:ie,handleBounds:yUn(z,X),z:Qdn(z,L,C.zIndexMode),userNode:z}},v.set(z.id,X)}(X.measured===void 0||X.measured.width===void 0||X.measured.height===void 0)&&!X.hidden&&(G=!1),z.parentId&&v2e(X,v,k,x,I),F||=z.selected??!1}return{nodesInitialized:G,hasSelectedNodes:F}}function kUn(d,v){if(!d.parentId)return;const k=v.get(d.parentId);k?k.set(d.id,d):v.set(d.parentId,new Map([[d.id,d]]))}function v2e(d,v,k,x,C){const{elevateNodesOnSelect:I,nodeOrigin:m,nodeExtent:L,zIndexMode:G}=p2e(g2e,x),F=d.parentId,z=v.get(F);if(!z){console.warn(`Parent node ${F} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}kUn(d,k),C&&!z.parentId&&z.internals.rootParentIndex===void 0&&G==="auto"&&(z.internals.rootParentIndex=++C.i,z.internals.z=z.internals.z+C.i*pUn),C&&z.internals.rootParentIndex!==void 0&&(C.i=z.internals.rootParentIndex);const X=I&&!m2e(G)?Vdn:0,{x:K,y:Y,z:ie}=EUn(d,z,m,L,X,G),{positionAbsolute:W}=d.internals,pe=K!==W.x||Y!==W.y;(pe||ie!==d.internals.z)&&v.set(d.id,{...d,internals:{...d.internals,positionAbsolute:pe?{x:K,y:Y}:W,z:ie}})}function Qdn(d,v,k){const x=dp(d.zIndex)?d.zIndex:0;return m2e(k)?x:x+(d.selected?v:0)}function EUn(d,v,k,x,C,I){const{x:m,y:L}=v.internals.positionAbsolute,G=um(d),F=N$(d,k),z=Z8(d.extent)?Y8(F,d.extent,G):F;let X=Y8({x:m+z.x,y:L+z.y},x,G);d.extent==="parent"&&(X=_dn(X,G,v));const K=Qdn(d,C,I),Y=v.internals.z??0;return{x:X.x,y:X.y,z:Y>=K?Y+1:K}}function y2e(d,v,k,x=[0,0]){const C=[],I=new Map;for(const m of d){const L=v.get(m.parentId);if(!L)continue;const G=I.get(m.parentId)?.expandedRect??A$(L),F=Fdn(G,m.rect);I.set(m.parentId,{expandedRect:F,parent:L})}return I.size>0&&I.forEach(({expandedRect:m,parent:L},G)=>{const F=L.internals.positionAbsolute,z=um(L),X=L.origin??x,K=m.x<F.x?Math.round(Math.abs(F.x-m.x)):0,Y=m.y<F.y?Math.round(Math.abs(F.y-m.y)):0,ie=Math.max(z.width,Math.round(m.width)),W=Math.max(z.height,Math.round(m.height)),pe=(ie-z.width)*X[0],fe=(W-z.height)*X[1];(K>0||Y>0||pe||fe)&&(C.push({id:G,type:"position",position:{x:L.position.x-K+pe,y:L.position.y-Y+fe}}),k.get(G)?.forEach(je=>{d.some(te=>te.id===je.id)||C.push({id:je.id,type:"position",position:{x:je.position.x+K,y:je.position.y+Y}})})),(z.width<m.width||z.height<m.height||K||Y)&&C.push({id:G,type:"dimensions",setAttributes:!0,dimensions:{width:ie+(K?X[0]*K-pe:0),height:W+(Y?X[1]*Y-fe:0)}})}),C}function jUn(d,v,k,x,C,I,m){const L=x?.querySelector(".xyflow__viewport");let G=!1;if(!L)return{changes:[],updatedInternals:G};const F=[],z=window.getComputedStyle(L),{m22:X}=new window.DOMMatrixReadOnly(z.transform),K=[];for(const Y of d.values()){const ie=v.get(Y.id);if(!ie)continue;if(ie.hidden){v.set(ie.id,{...ie,internals:{...ie.internals,handleBounds:void 0}}),G=!0;continue}const W=w2e(Y.nodeElement),pe=ie.measured.width!==W.width||ie.measured.height!==W.height;if(!!(W.width&&W.height&&(pe||!ie.internals.handleBounds||Y.force))){const je=Y.nodeElement.getBoundingClientRect(),te=Z8(ie.extent)?ie.extent:I;let{positionAbsolute:he}=ie.internals;if(ie.parentId&&ie.extent==="parent"){const Ne=v.get(ie.parentId);Ne&&(he=_dn(he,W,Ne))}else te&&(he=Y8(he,te,W));const qe={...ie,measured:W,internals:{...ie.internals,positionAbsolute:he,handleBounds:{source:Ban("source",Y.nodeElement,je,X,ie.id),target:Ban("target",Y.nodeElement,je,X,ie.id)}}};v.set(ie.id,qe),ie.parentId&&v2e(qe,v,k,{nodeOrigin:C,zIndexMode:m}),G=!0,pe&&(F.push({id:ie.id,type:"dimensions",dimensions:W}),ie.expandParent&&ie.parentId&&K.push({id:ie.id,parentId:ie.parentId,rect:A$(qe,C)}))}}if(K.length>0){const Y=y2e(K,v,k,C);F.push(...Y)}return{changes:F,updatedInternals:G}}async function xUn({delta:d,panZoom:v,transform:k,translateExtent:x,width:C,height:I}){if(!v||!d.x&&!d.y)return!1;const m=await v.setViewportConstrained({x:k[0]+d.x,y:k[1]+d.y,zoom:k[2]},[[0,0],[C,I]],x);return!!m&&(m.x!==k[0]||m.y!==k[1]||m.k!==k[2])}function Kan(d,v,k,x,C,I){let m=C;const L=x.get(m)||new Map;x.set(m,L.set(k,v)),m=`${C}-${d}`;const G=x.get(m)||new Map;if(x.set(m,G.set(k,v)),I){m=`${C}-${d}-${I}`;const F=x.get(m)||new Map;x.set(m,F.set(k,v))}}function Ydn(d,v,k){d.clear(),v.clear();for(const x of k){const{source:C,target:I,sourceHandle:m=null,targetHandle:L=null}=x,G={edgeId:x.id,source:C,target:I,sourceHandle:m,targetHandle:L},F=`${C}-${m}--${I}-${L}`,z=`${I}-${L}--${C}-${m}`;Kan("source",G,z,d,C,m),Kan("target",G,F,d,I,L),v.set(x.id,x)}}function Zdn(d,v){if(!d.parentId)return!1;const k=v.get(d.parentId);return k?k.selected?!0:Zdn(k,v):!1}function Xan(d,v,k){let x=d;do{if(x?.matches?.(v))return!0;if(x===k)return!1;x=x?.parentElement}while(x);return!1}function SUn(d,v,k,x){const C=new Map;for(const[I,m]of d)if((m.selected||m.id===x)&&(!m.parentId||!Zdn(m,d))&&(m.draggable||v&&typeof m.draggable>"u")){const L=d.get(I);L&&C.set(I,{id:I,position:L.position||{x:0,y:0},distance:{x:k.x-L.internals.positionAbsolute.x,y:k.y-L.internals.positionAbsolute.y},extent:L.extent,parentId:L.parentId,origin:L.origin,expandParent:L.expandParent,internals:{positionAbsolute:L.internals.positionAbsolute||{x:0,y:0}},measured:{width:L.measured.width??0,height:L.measured.height??0}})}return C}function Cpe({nodeId:d,dragItems:v,nodeLookup:k,dragging:x=!0}){const C=[];for(const[m,L]of v){const G=k.get(m)?.internals.userNode;G&&C.push({...G,position:L.position,dragging:x})}if(!d)return[C[0],C];const I=k.get(d)?.internals.userNode;return[I?{...I,position:v.get(d)?.position||I.position,dragging:x}:C[0],C]}function CUn({dragItems:d,snapGrid:v,x:k,y:x}){const C=d.values().next().value;if(!C)return null;const I={x:k-C.distance.x,y:x-C.distance.y},m=$$(I,v);return{x:m.x-I.x,y:m.y-I.y}}function AUn({onNodeMouseDown:d,getStoreItems:v,onDragStart:k,onDrag:x,onDragStop:C}){let I={x:null,y:null},m=0,L=new Map,G=!1,F={x:0,y:0},z=null,X=!1,K=null,Y=!1,ie=!1,W=null;function pe({noDragClassName:je,handleSelector:te,domNode:he,isSelectable:qe,nodeId:Ne,nodeClickDistance:Me=0}){K=X0(he);function Ze({x:mn,y:B}){const{nodeLookup:ye,nodeExtent:Oe,snapGrid:Qe,snapToGrid:fn,nodeOrigin:gn,onNodeDrag:On,onSelectionDrag:Vn,onError:Zn,updateNodePositions:nt}=v();I={x:mn,y:B};let ai=!1;const ti=L.size>1,vi=ti&&Oe?Upe(O$(L)):null,fr=ti&&fn?CUn({dragItems:L,snapGrid:Qe,x:mn,y:B}):null;for(const[wi,Un]of L){if(!ye.has(wi))continue;let Xt={x:mn-Un.distance.x,y:B-Un.distance.y};fn&&(Xt=fr?{x:Math.round(Xt.x+fr.x),y:Math.round(Xt.y+fr.y)}:$$(Xt,Qe));let br=null;if(ti&&Oe&&!Un.extent&&vi){const{positionAbsolute:ir}=Un.internals,ji=ir.x-vi.x+Oe[0][0],xi=ir.x+Un.measured.width-vi.x2+Oe[1][0],yi=ir.y-vi.y+Oe[0][1],Mi=ir.y+Un.measured.height-vi.y2+Oe[1][1];br=[[ji,yi],[xi,Mi]]}const{position:yr,positionAbsolute:Oi}=Ldn({nodeId:wi,nextPosition:Xt,nodeLookup:ye,nodeExtent:br||Oe,nodeOrigin:gn,onError:Zn});ai=ai||Un.position.x!==yr.x||Un.position.y!==yr.y,Un.position=yr,Un.internals.positionAbsolute=Oi}if(ie=ie||ai,!!ai&&(nt(L,!0),W&&(x||On||!Ne&&Vn))){const[wi,Un]=Cpe({nodeId:Ne,dragItems:L,nodeLookup:ye});x?.(W,L,wi,Un),On?.(W,wi,Un),Ne||Vn?.(W,Un)}}async function rn(){if(!z)return;const{transform:mn,panBy:B,autoPanSpeed:ye,autoPanOnNodeDrag:Oe}=v();if(!Oe){G=!1,cancelAnimationFrame(m);return}const[Qe,fn]=d2e(F,z,ye);(Qe!==0||fn!==0)&&(I.x=(I.x??0)-Qe/mn[2],I.y=(I.y??0)-fn/mn[2],await B({x:Qe,y:fn})&&Ze(I)),m=requestAnimationFrame(rn)}function Bn(mn){const{nodeLookup:B,multiSelectionActive:ye,nodesDraggable:Oe,transform:Qe,snapGrid:fn,snapToGrid:gn,selectNodesOnDrag:On,onNodeDragStart:Vn,onSelectionDragStart:Zn,unselectNodesAndEdges:nt}=v();X=!0,(!On||!qe)&&!ye&&Ne&&(B.get(Ne)?.selected||nt()),qe&&On&&Ne&&d?.(Ne);const ai=m$(mn.sourceEvent,{transform:Qe,snapGrid:fn,snapToGrid:gn,containerBounds:z});if(I=ai,L=SUn(B,Oe,ai,Ne),L.size>0&&(k||Vn||!Ne&&Zn)){const[ti,vi]=Cpe({nodeId:Ne,dragItems:L,nodeLookup:B});k?.(mn.sourceEvent,L,ti,vi),Vn?.(mn.sourceEvent,ti,vi),Ne||Zn?.(mn.sourceEvent,vi)}}const Ln=wdn().clickDistance(Me).on("start",mn=>{const{domNode:B,nodeDragThreshold:ye,transform:Oe,snapGrid:Qe,snapToGrid:fn}=v();z=B?.getBoundingClientRect()||null,Y=!1,ie=!1,W=mn.sourceEvent,ye===0&&Bn(mn),I=m$(mn.sourceEvent,{transform:Oe,snapGrid:Qe,snapToGrid:fn,containerBounds:z}),F=bp(mn.sourceEvent,z)}).on("drag",mn=>{const{autoPanOnNodeDrag:B,transform:ye,snapGrid:Oe,snapToGrid:Qe,nodeDragThreshold:fn,nodeLookup:gn}=v(),On=m$(mn.sourceEvent,{transform:ye,snapGrid:Oe,snapToGrid:Qe,containerBounds:z});if(W=mn.sourceEvent,(mn.sourceEvent.type==="touchmove"&&mn.sourceEvent.touches.length>1||Ne&&!gn.has(Ne))&&(Y=!0),!Y){if(!G&&B&&X&&(G=!0,rn()),!X){const Vn=bp(mn.sourceEvent,z),Zn=Vn.x-F.x,nt=Vn.y-F.y;Math.sqrt(Zn*Zn+nt*nt)>fn&&Bn(mn)}(I.x!==On.xSnapped||I.y!==On.ySnapped)&&L&&X&&(F=bp(mn.sourceEvent,z),Ze(On))}}).on("end",mn=>{if(!X||Y){Y&&L.size>0&&v().updateNodePositions(L,!1);return}if(G=!1,X=!1,cancelAnimationFrame(m),L.size>0){const{nodeLookup:B,updateNodePositions:ye,onNodeDragStop:Oe,onSelectionDragStop:Qe}=v();if(ie&&(ye(L,!1),ie=!1),C||Oe||!Ne&&Qe){const[fn,gn]=Cpe({nodeId:Ne,dragItems:L,nodeLookup:B,dragging:!1});C?.(mn.sourceEvent,L,fn,gn),Oe?.(mn.sourceEvent,fn,gn),Ne||Qe?.(mn.sourceEvent,gn)}}}).filter(mn=>{const B=mn.target;return!mn.button&&(!je||!Xan(B,`.${je}`,he))&&(!te||Xan(B,te,he))});K.call(Ln)}function fe(){K?.on(".drag",null)}return{update:pe,destroy:fe}}function MUn(d,v,k){const x=[],C={x:d.x-k,y:d.y-k,width:k*2,height:k*2};for(const I of v.values())NX(C,A$(I))>0&&x.push(I);return x}const TUn=250;function IUn(d,v,k,x){let C=[],I=1/0;const m=MUn(d,k,v+TUn);for(const L of m){const G=[...L.internals.handleBounds?.source??[],...L.internals.handleBounds?.target??[]];for(const F of G){if(x.nodeId===F.nodeId&&x.type===F.type&&x.id===F.id)continue;const{x:z,y:X}=e7(L,F,F.position,!0),K=Math.sqrt(Math.pow(z-d.x,2)+Math.pow(X-d.y,2));K>v||(K<I?(C=[{...F,x:z,y:X}],I=K):K===I&&C.push({...F,x:z,y:X}))}}if(!C.length)return null;if(C.length>1){const L=x.type==="source"?"target":"source";return C.find(G=>G.type===L)??C[0]}return C[0]}function e0n(d,v,k,x,C,I=!1){const m=x.get(d);if(!m)return null;const L=C==="strict"?m.internals.handleBounds?.[v]:[...m.internals.handleBounds?.source??[],...m.internals.handleBounds?.target??[]],G=(k?L?.find(F=>F.id===k):L?.[0])??null;return G&&I?{...G,...e7(m,G,G.position,!0)}:G}function n0n(d,v){return d||(v?.classList.contains("target")?"target":v?.classList.contains("source")?"source":null)}function PUn(d,v){let k=null;return v?k=!0:d&&!v&&(k=!1),k}const t0n=()=>!0;function NUn(d,{connectionMode:v,connectionRadius:k,handleId:x,nodeId:C,edgeUpdaterType:I,isTarget:m,domNode:L,nodeLookup:G,lib:F,autoPanOnConnect:z,flowId:X,panBy:K,cancelConnection:Y,onConnectStart:ie,onConnect:W,onConnectEnd:pe,isValidConnection:fe=t0n,onReconnectEnd:je,updateConnection:te,getTransform:he,getFromHandle:qe,autoPanSpeed:Ne,dragThreshold:Me=1,handleDomNode:Ze}){const rn=Gdn(d.target);let Bn=0,Ln;const{x:mn,y:B}=bp(d),ye=n0n(I,Ze),Oe=L?.getBoundingClientRect();let Qe=!1;if(!Oe||!ye)return;const fn=e0n(C,ye,x,G,v);if(!fn)return;let gn=bp(d,Oe),On=!1,Vn=null,Zn=!1,nt=null;function ai(){if(!z||!Oe)return;const[yr,Oi]=d2e(gn,Oe,Ne);K({x:yr,y:Oi}),Bn=requestAnimationFrame(ai)}const ti={...fn,nodeId:C,type:ye,position:fn.position},vi=G.get(C);let wi={inProgress:!0,isValid:null,from:e7(vi,ti,tr.Left,!0),fromHandle:ti,fromPosition:ti.position,fromNode:vi,to:gn,toHandle:null,toPosition:Lan[ti.position],toNode:null,pointer:gn};function Un(){Qe=!0,te(wi),ie?.(d,{nodeId:C,handleId:x,handleType:ye})}Me===0&&Un();function Xt(yr){if(!Qe){const{x:Mi,y:rr}=bp(yr),Ys=Mi-mn,Co=rr-B;if(!(Ys*Ys+Co*Co>Me*Me))return;Un()}if(!qe()||!ti){br(yr);return}const Oi=he();gn=bp(yr,Oe),Ln=IUn(D$(gn,Oi,!1,[1,1]),k,G,ti),On||(ai(),On=!0);const ir=i0n(yr,{handle:Ln,connectionMode:v,fromNodeId:C,fromHandleId:x,fromType:m?"target":"source",isValidConnection:fe,doc:rn,lib:F,flowId:X,nodeLookup:G});nt=ir.handleDomNode,Vn=ir.connection,Zn=PUn(!!Ln,ir.isValid);const ji=G.get(C),xi=ji?e7(ji,ti,tr.Left,!0):wi.from,yi={...wi,from:xi,isValid:Zn,to:ir.toHandle&&Zn?zS({x:ir.toHandle.x,y:ir.toHandle.y},Oi):gn,toHandle:ir.toHandle,toPosition:Zn&&ir.toHandle?ir.toHandle.position:Lan[ti.position],toNode:ir.toHandle?G.get(ir.toHandle.nodeId):null,pointer:gn};te(yi),wi=yi}function br(yr){if(!("touches"in yr&&yr.touches.length>0)){if(Qe){(Ln||nt)&&Vn&&Zn&&W?.(Vn);const{inProgress:Oi,...ir}=wi,ji={...ir,toPosition:wi.toHandle?wi.toPosition:null};pe?.(yr,ji),I&&je?.(yr,ji)}Y(),cancelAnimationFrame(Bn),On=!1,Zn=!1,Vn=null,nt=null,rn.removeEventListener("mousemove",Xt),rn.removeEventListener("mouseup",br),rn.removeEventListener("touchmove",Xt),rn.removeEventListener("touchend",br)}}rn.addEventListener("mousemove",Xt),rn.addEventListener("mouseup",br),rn.addEventListener("touchmove",Xt),rn.addEventListener("touchend",br)}function i0n(d,{handle:v,connectionMode:k,fromNodeId:x,fromHandleId:C,fromType:I,doc:m,lib:L,flowId:G,isValidConnection:F=t0n,nodeLookup:z}){const X=I==="target",K=v?m.querySelector(`.${L}-flow__handle[data-id="${G}-${v?.nodeId}-${v?.id}-${v?.type}"]`):null,{x:Y,y:ie}=bp(d),W=m.elementFromPoint(Y,ie),pe=W?.classList.contains(`${L}-flow__handle`)?W:K,fe={handleDomNode:pe,isValid:!1,connection:null,toHandle:null};if(pe){const je=n0n(void 0,pe),te=pe.getAttribute("data-nodeid"),he=pe.getAttribute("data-handleid"),qe=pe.classList.contains("connectable"),Ne=pe.classList.contains("connectableend");if(!te||!je)return fe;const Me={source:X?te:x,sourceHandle:X?he:C,target:X?x:te,targetHandle:X?C:he};fe.connection=Me;const rn=qe&&Ne&&(k===GS.Strict?X&&je==="source"||!X&&je==="target":te!==x||he!==C);fe.isValid=rn&&F(Me),fe.toHandle=e0n(te,je,he,z,k,!0)}return fe}const Wpe={onPointerDown:NUn,isValid:i0n};function OUn({domNode:d,panZoom:v,getTransform:k,getViewScale:x}){const C=X0(d);function I({translateExtent:L,width:G,height:F,zoomStep:z=1,pannable:X=!0,zoomable:K=!0,inversePan:Y=!1}){const ie=te=>{if(te.sourceEvent.type!=="wheel"||!v)return;const he=k(),qe=te.sourceEvent.ctrlKey&&M$()?10:1,Ne=-te.sourceEvent.deltaY*(te.sourceEvent.deltaMode===1?.05:te.sourceEvent.deltaMode?1:.002)*z,Me=he[2]*Math.pow(2,Ne*qe);v.scaleTo(Me)};let W=[0,0];const pe=te=>{(te.sourceEvent.type==="mousedown"||te.sourceEvent.type==="touchstart")&&(W=[te.sourceEvent.clientX??te.sourceEvent.touches[0].clientX,te.sourceEvent.clientY??te.sourceEvent.touches[0].clientY])},fe=te=>{const he=k();if(te.sourceEvent.type!=="mousemove"&&te.sourceEvent.type!=="touchmove"||!v)return;const qe=[te.sourceEvent.clientX??te.sourceEvent.touches[0].clientX,te.sourceEvent.clientY??te.sourceEvent.touches[0].clientY],Ne=[qe[0]-W[0],qe[1]-W[1]];W=qe;const Me=x()*Math.max(he[2],Math.log(he[2]))*(Y?-1:1),Ze={x:he[0]-Ne[0]*Me,y:he[1]-Ne[1]*Me},rn=[[0,0],[G,F]];v.setViewportConstrained({x:Ze.x,y:Ze.y,zoom:he[2]},rn,L)},je=Idn().on("start",pe).on("zoom",X?fe:null).on("zoom.wheel",K?ie:null);C.call(je,{})}function m(){C.on("zoom",null)}return{update:I,destroy:m,pointer:hp}}const WX=d=>({x:d.x,y:d.y,zoom:d.k}),Ape=({x:d,y:v,zoom:k})=>UX.translate(d,v).scale(k),$S=(d,v)=>d.target.closest(`.${v}`),r0n=(d,v)=>v===2&&Array.isArray(d)&&d.includes(2),$Un=d=>((d*=2)<=1?d*d*d:(d-=2)*d*d+2)/2,Mpe=(d,v=0,k=$Un,x=()=>{})=>{const C=typeof v=="number"&&v>0;return C||x(),C?d.transition().duration(v).ease(k).on("end",x):d},c0n=d=>{const v=d.ctrlKey&&M$()?10:1;return-d.deltaY*(d.deltaMode===1?.05:d.deltaMode?1:.002)*v};function DUn({zoomPanValues:d,noWheelClassName:v,d3Selection:k,d3Zoom:x,panOnScrollMode:C,panOnScrollSpeed:I,zoomOnPinch:m,onPanZoomStart:L,onPanZoom:G,onPanZoomEnd:F}){return z=>{if($S(z,v))return z.ctrlKey&&z.preventDefault(),!1;z.preventDefault(),z.stopImmediatePropagation();const X=k.property("__zoom").k||1;if(z.ctrlKey&&m){const pe=hp(z),fe=c0n(z),je=X*Math.pow(2,fe);x.scaleTo(k,je,pe,z);return}const K=z.deltaMode===1?20:1;let Y=C===X8.Vertical?0:z.deltaX*K,ie=C===X8.Horizontal?0:z.deltaY*K;!M$()&&z.shiftKey&&C!==X8.Vertical&&(Y=z.deltaY*K,ie=0),x.translateBy(k,-(Y/X)*I,-(ie/X)*I,{internal:!0});const W=WX(k.property("__zoom"));clearTimeout(d.panScrollTimeout),d.isPanScrolling?G?.(z,W):(d.isPanScrolling=!0,L?.(z,W)),d.panScrollTimeout=setTimeout(()=>{F?.(z,W),d.isPanScrolling=!1},150)}}function LUn({noWheelClassName:d,preventScrolling:v,d3ZoomHandler:k}){return function(x,C){const I=x.type==="wheel",m=!v&&I&&!x.ctrlKey,L=$S(x,d);if(x.ctrlKey&&I&&L&&x.preventDefault(),m||L)return null;x.preventDefault(),k.call(this,x,C)}}function _Un({zoomPanValues:d,onDraggingChange:v,onPanZoomStart:k}){return x=>{if(x.sourceEvent?.internal)return;const C=WX(x.transform);d.mouseButton=x.sourceEvent?.button||0,d.isZoomingOrPanning=!0,d.prevViewport=C,x.sourceEvent?.type==="mousedown"&&v(!0),k&&k?.(x.sourceEvent,C)}}function FUn({zoomPanValues:d,panOnDrag:v,onPaneContextMenu:k,onTransformChange:x,onPanZoom:C}){return I=>{d.usedRightMouseButton=!!(k&&r0n(v,d.mouseButton??0)),I.sourceEvent?.sync||x([I.transform.x,I.transform.y,I.transform.k]),C&&!I.sourceEvent?.internal&&C?.(I.sourceEvent,WX(I.transform))}}function RUn({zoomPanValues:d,panOnDrag:v,panOnScroll:k,onDraggingChange:x,onPanZoomEnd:C,onPaneContextMenu:I}){return m=>{if(!m.sourceEvent?.internal&&(d.isZoomingOrPanning=!1,I&&r0n(v,d.mouseButton??0)&&!d.usedRightMouseButton&&m.sourceEvent&&I(m.sourceEvent),d.usedRightMouseButton=!1,x(!1),C)){const L=WX(m.transform);d.prevViewport=L,clearTimeout(d.timerId),d.timerId=setTimeout(()=>{C?.(m.sourceEvent,L)},k?150:0)}}}function BUn({zoomActivationKeyPressed:d,zoomOnScroll:v,zoomOnPinch:k,panOnDrag:x,panOnScroll:C,zoomOnDoubleClick:I,userSelectionActive:m,noWheelClassName:L,noPanClassName:G,lib:F,connectionInProgress:z}){return X=>{const K=d||v,Y=k&&X.ctrlKey,ie=X.type==="wheel";if(X.button===1&&X.type==="mousedown"&&($S(X,`${F}-flow__node`)||$S(X,`${F}-flow__edge`)))return!0;if(!x&&!K&&!C&&!I&&!k||m||z&&!ie||$S(X,L)&&ie||$S(X,G)&&(!ie||C&&ie&&!d)||!k&&X.ctrlKey&&ie)return!1;if(!k&&X.type==="touchstart"&&X.touches?.length>1)return X.preventDefault(),!1;if(!K&&!C&&!Y&&ie||!x&&(X.type==="mousedown"||X.type==="touchstart")||Array.isArray(x)&&!x.includes(X.button)&&X.type==="mousedown")return!1;const W=Array.isArray(x)&&x.includes(X.button)||!X.button||X.button<=1;return(!X.ctrlKey||ie)&&W}}function JUn({domNode:d,minZoom:v,maxZoom:k,translateExtent:x,viewport:C,onPanZoom:I,onPanZoomStart:m,onPanZoomEnd:L,onDraggingChange:G}){const F={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},z=d.getBoundingClientRect();let X=[[0,0],[z.width,z.height]];(typeof ResizeObserver<"u"?new ResizeObserver(B=>{const ye=B[0];ye&&(X=[[0,0],[ye.contentRect.width,ye.contentRect.height]])}):null)?.observe(d);const Y=Idn().extent(()=>X).scaleExtent([v,k]).translateExtent(x),ie=X0(d).call(Y);he({x:C.x,y:C.y,zoom:qS(C.zoom,v,k)},[[0,0],[z.width,z.height]],x);const W=ie.on("wheel.zoom"),pe=ie.on("dblclick.zoom");Y.wheelDelta(c0n);async function fe(B,ye){return ie?new Promise(Oe=>{Y?.interpolate(ye?.interpolate==="linear"?p$:mX).transform(Mpe(ie,ye?.duration,ye?.ease,()=>Oe(!0)),B)}):!1}function je({noWheelClassName:B,noPanClassName:ye,onPaneContextMenu:Oe,userSelectionActive:Qe,panOnScroll:fn,panOnDrag:gn,panOnScrollMode:On,panOnScrollSpeed:Vn,preventScrolling:Zn,zoomOnPinch:nt,zoomOnScroll:ai,zoomOnDoubleClick:ti,zoomActivationKeyPressed:vi,lib:fr,onTransformChange:wi,connectionInProgress:Un,paneClickDistance:Xt,selectionOnDrag:br}){Qe&&!F.isZoomingOrPanning&&te();const yr=fn&&!vi&&!Qe;Y.clickDistance(br?1/0:!dp(Xt)||Xt<0?0:Xt);const Oi=yr?DUn({zoomPanValues:F,noWheelClassName:B,d3Selection:ie,d3Zoom:Y,panOnScrollMode:On,panOnScrollSpeed:Vn,zoomOnPinch:nt,onPanZoomStart:m,onPanZoom:I,onPanZoomEnd:L}):LUn({noWheelClassName:B,preventScrolling:Zn,d3ZoomHandler:W});ie.on("wheel.zoom",Oi,{passive:!1});const ir=_Un({zoomPanValues:F,onDraggingChange:G,onPanZoomStart:m});Y.on("start",ir);const ji=FUn({zoomPanValues:F,panOnDrag:gn,onPaneContextMenu:!!Oe,onPanZoom:I,onTransformChange:wi});Y.on("zoom",ji);const xi=RUn({zoomPanValues:F,panOnDrag:gn,panOnScroll:fn,onPaneContextMenu:Oe,onPanZoomEnd:L,onDraggingChange:G});Y.on("end",xi);const yi=BUn({zoomActivationKeyPressed:vi,panOnDrag:gn,zoomOnScroll:ai,panOnScroll:fn,zoomOnDoubleClick:ti,zoomOnPinch:nt,userSelectionActive:Qe,noPanClassName:ye,noWheelClassName:B,lib:fr,connectionInProgress:Un});Y.filter(yi),ti?ie.on("dblclick.zoom",pe):ie.on("dblclick.zoom",null)}function te(){Y.on("zoom",null)}async function he(B,ye,Oe){const Qe=Ape(B),fn=Y?.constrain()(Qe,ye,Oe);return fn&&await fe(fn),fn}async function qe(B,ye){const Oe=Ape(B);return await fe(Oe,ye),Oe}function Ne(B){if(ie){const ye=Ape(B),Oe=ie.property("__zoom");(Oe.k!==B.zoom||Oe.x!==B.x||Oe.y!==B.y)&&Y?.transform(ie,ye,null,{sync:!0})}}function Me(){const B=ie?Tdn(ie.node()):{x:0,y:0,k:1};return{x:B.x,y:B.y,zoom:B.k}}async function Ze(B,ye){return ie?new Promise(Oe=>{Y?.interpolate(ye?.interpolate==="linear"?p$:mX).scaleTo(Mpe(ie,ye?.duration,ye?.ease,()=>Oe(!0)),B)}):!1}async function rn(B,ye){return ie?new Promise(Oe=>{Y?.interpolate(ye?.interpolate==="linear"?p$:mX).scaleBy(Mpe(ie,ye?.duration,ye?.ease,()=>Oe(!0)),B)}):!1}function Bn(B){Y?.scaleExtent(B)}function Ln(B){Y?.translateExtent(B)}function mn(B){const ye=!dp(B)||B<0?0:B;Y?.clickDistance(ye)}return{update:je,destroy:te,setViewport:qe,setViewportConstrained:he,getViewport:Me,scaleTo:Ze,scaleBy:rn,setScaleExtent:Bn,setTranslateExtent:Ln,syncViewport:Ne,setClickDistance:mn}}var US;(function(d){d.Line="line",d.Handle="handle"})(US||(US={}));function HUn({width:d,prevWidth:v,height:k,prevHeight:x,affectsX:C,affectsY:I}){const m=d-v,L=k-x,G=[m>0?1:m<0?-1:0,L>0?1:L<0?-1:0];return m&&C&&(G[0]=G[0]*-1),L&&I&&(G[1]=G[1]*-1),G}function Wan(d){const v=d.includes("right")||d.includes("left"),k=d.includes("bottom")||d.includes("top"),x=d.includes("left"),C=d.includes("top");return{isHorizontal:v,isVertical:k,affectsX:x,affectsY:C}}function m6(d,v){return Math.max(0,v-d)}function v6(d,v){return Math.max(0,d-v)}function aX(d,v,k){return Math.max(0,v-d,d-k)}function Van(d,v){return d?!v:v}function GUn(d,v,k,x,C,I,m,L){let{affectsX:G,affectsY:F}=v;const{isHorizontal:z,isVertical:X}=v,K=z&&X,{xSnapped:Y,ySnapped:ie}=k,{minWidth:W,maxWidth:pe,minHeight:fe,maxHeight:je}=x,{x:te,y:he,width:qe,height:Ne,aspectRatio:Me}=d;let Ze=Math.floor(z?Y-d.pointerX:0),rn=Math.floor(X?ie-d.pointerY:0);const Bn=qe+(G?-Ze:Ze),Ln=Ne+(F?-rn:rn),mn=-I[0]*qe,B=-I[1]*Ne;let ye=aX(Bn,W,pe),Oe=aX(Ln,fe,je);if(m){let gn=0,On=0;G&&Ze<0?gn=m6(te+Ze+mn,m[0][0]):!G&&Ze>0&&(gn=v6(te+Bn+mn,m[1][0])),F&&rn<0?On=m6(he+rn+B,m[0][1]):!F&&rn>0&&(On=v6(he+Ln+B,m[1][1])),ye=Math.max(ye,gn),Oe=Math.max(Oe,On)}if(L){let gn=0,On=0;G&&Ze>0?gn=v6(te+Ze,L[0][0]):!G&&Ze<0&&(gn=m6(te+Bn,L[1][0])),F&&rn>0?On=v6(he+rn,L[0][1]):!F&&rn<0&&(On=m6(he+Ln,L[1][1])),ye=Math.max(ye,gn),Oe=Math.max(Oe,On)}if(C){if(z){const gn=aX(Bn/Me,fe,je)*Me;if(ye=Math.max(ye,gn),m){let On=0;!G&&!F||G&&!F&&K?On=v6(he+B+Bn/Me,m[1][1])*Me:On=m6(he+B+(G?Ze:-Ze)/Me,m[0][1])*Me,ye=Math.max(ye,On)}if(L){let On=0;!G&&!F||G&&!F&&K?On=m6(he+Bn/Me,L[1][1])*Me:On=v6(he+(G?Ze:-Ze)/Me,L[0][1])*Me,ye=Math.max(ye,On)}}if(X){const gn=aX(Ln*Me,W,pe)/Me;if(Oe=Math.max(Oe,gn),m){let On=0;!G&&!F||F&&!G&&K?On=v6(te+Ln*Me+mn,m[1][0])/Me:On=m6(te+(F?rn:-rn)*Me+mn,m[0][0])/Me,Oe=Math.max(Oe,On)}if(L){let On=0;!G&&!F||F&&!G&&K?On=m6(te+Ln*Me,L[1][0])/Me:On=v6(te+(F?rn:-rn)*Me,L[0][0])/Me,Oe=Math.max(Oe,On)}}}rn=rn+(rn<0?Oe:-Oe),Ze=Ze+(Ze<0?ye:-ye),C&&(K?Bn>Ln*Me?rn=(Van(G,F)?-Ze:Ze)/Me:Ze=(Van(G,F)?-rn:rn)*Me:z?(rn=Ze/Me,F=G):(Ze=rn*Me,G=F));const Qe=G?te+Ze:te,fn=F?he+rn:he;return{width:qe+(G?-Ze:Ze),height:Ne+(F?-rn:rn),x:I[0]*Ze*(G?-1:1)+Qe,y:I[1]*rn*(F?-1:1)+fn}}const u0n={width:0,height:0,x:0,y:0},qUn={...u0n,pointerX:0,pointerY:0,aspectRatio:1};function zUn(d,v,k){const x=v.position.x+d.position.x,C=v.position.y+d.position.y,I=d.measured.width??0,m=d.measured.height??0,L=k[0]*I,G=k[1]*m;return[[x-L,C-G],[x+I-L,C+m-G]]}function UUn({domNode:d,nodeId:v,getStoreItems:k,onChange:x,onEnd:C}){const I=X0(d);let m={controlDirection:Wan("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function L({controlPosition:F,boundaries:z,keepAspectRatio:X,resizeDirection:K,onResizeStart:Y,onResize:ie,onResizeEnd:W,shouldResize:pe}){let fe={...u0n},je={...qUn};m={boundaries:z,resizeDirection:K,keepAspectRatio:X,controlDirection:Wan(F)};let te,he=null,qe=[],Ne,Me,Ze,rn=!1;const Bn=wdn().on("start",Ln=>{const{nodeLookup:mn,transform:B,snapGrid:ye,snapToGrid:Oe,nodeOrigin:Qe,paneDomNode:fn}=k();if(te=mn.get(v),!te)return;he=fn?.getBoundingClientRect()??null;const{xSnapped:gn,ySnapped:On}=m$(Ln.sourceEvent,{transform:B,snapGrid:ye,snapToGrid:Oe,containerBounds:he});fe={width:te.measured.width??0,height:te.measured.height??0,x:te.position.x??0,y:te.position.y??0},je={...fe,pointerX:gn,pointerY:On,aspectRatio:fe.width/fe.height},Ne=void 0,Me=Z8(te.extent)?te.extent:void 0,te.parentId&&(te.extent==="parent"||te.expandParent)&&(Ne=mn.get(te.parentId)),Ne&&te.extent==="parent"&&(Me=[[0,0],[Ne.measured.width,Ne.measured.height]]),qe=[],Ze=void 0;for(const[Vn,Zn]of mn)if(Zn.parentId===v&&(qe.push({id:Vn,position:{...Zn.position},extent:Zn.extent}),Zn.extent==="parent"||Zn.expandParent)){const nt=zUn(Zn,te,Zn.origin??Qe);Ze?Ze=[[Math.min(nt[0][0],Ze[0][0]),Math.min(nt[0][1],Ze[0][1])],[Math.max(nt[1][0],Ze[1][0]),Math.max(nt[1][1],Ze[1][1])]]:Ze=nt}Y?.(Ln,{...fe})}).on("drag",Ln=>{const{transform:mn,snapGrid:B,snapToGrid:ye,nodeOrigin:Oe}=k(),Qe=m$(Ln.sourceEvent,{transform:mn,snapGrid:B,snapToGrid:ye,containerBounds:he}),fn=[];if(!te)return;const{x:gn,y:On,width:Vn,height:Zn}=fe,nt={},ai=te.origin??Oe,{width:ti,height:vi,x:fr,y:wi}=GUn(je,m.controlDirection,Qe,m.boundaries,m.keepAspectRatio,ai,Me,Ze),Un=ti!==Vn,Xt=vi!==Zn,br=fr!==gn&&Un,yr=wi!==On&&Xt;if(!br&&!yr&&!Un&&!Xt)return;if((br||yr||ai[0]===1||ai[1]===1)&&(nt.x=br?fr:fe.x,nt.y=yr?wi:fe.y,fe.x=nt.x,fe.y=nt.y,qe.length>0)){const xi=fr-gn,yi=wi-On;for(const Mi of qe)Mi.position={x:Mi.position.x-xi+ai[0]*(ti-Vn),y:Mi.position.y-yi+ai[1]*(vi-Zn)},fn.push(Mi)}if((Un||Xt)&&(nt.width=Un&&(!m.resizeDirection||m.resizeDirection==="horizontal")?ti:fe.width,nt.height=Xt&&(!m.resizeDirection||m.resizeDirection==="vertical")?vi:fe.height,fe.width=nt.width,fe.height=nt.height),Ne&&te.expandParent){const xi=ai[0]*(nt.width??0);nt.x&&nt.x<xi&&(fe.x=xi,je.x=je.x-(nt.x-xi));const yi=ai[1]*(nt.height??0);nt.y&&nt.y<yi&&(fe.y=yi,je.y=je.y-(nt.y-yi))}const Oi=HUn({width:fe.width,prevWidth:Vn,height:fe.height,prevHeight:Zn,affectsX:m.controlDirection.affectsX,affectsY:m.controlDirection.affectsY}),ir={...fe,direction:Oi};pe?.(Ln,ir)!==!1&&(rn=!0,ie?.(Ln,ir),x(nt,fn))}).on("end",Ln=>{rn&&(W?.(Ln,{...fe}),C?.({...fe}),rn=!1)});I.call(Bn)}function G(){I.on(".drag",null)}return{update:L,destroy:G}}const KUn={},Qan=d=>{let v;const k=new Set,x=(z,X)=>{const K=typeof z=="function"?z(v):z;if(!Object.is(K,v)){const Y=v;v=X??(typeof K!="object"||K===null)?K:Object.assign({},v,K),k.forEach(ie=>ie(v,Y))}},C=()=>v,G={setState:x,getState:C,getInitialState:()=>F,subscribe:z=>(k.add(z),()=>k.delete(z)),destroy:()=>{(KUn?"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."),k.clear()}},F=v=d(x,C,G);return G},XUn=d=>d?Qan(d):Qan,{useDebugValue:WUn}=HBn,{useSyncExternalStoreWithSelector:VUn}=JBn,QUn=d=>d;function o0n(d,v=QUn,k){const x=VUn(d.subscribe,d.getState,d.getServerState||d.getInitialState,v,k);return WUn(x),x}const Yan=(d,v)=>{const k=XUn(d),x=(C,I=v)=>o0n(k,C,I);return Object.assign(x,k),x},YUn=(d,v)=>d?Yan(d,v):Yan;function Qs(d,v){if(Object.is(d,v))return!0;if(typeof d!="object"||d===null||typeof v!="object"||v===null)return!1;if(d instanceof Map&&v instanceof Map){if(d.size!==v.size)return!1;for(const[x,C]of d)if(!Object.is(C,v.get(x)))return!1;return!0}if(d instanceof Set&&v instanceof Set){if(d.size!==v.size)return!1;for(const x of d)if(!v.has(x))return!1;return!0}const k=Object.keys(d);if(k.length!==Object.keys(v).length)return!1;for(const x of k)if(!Object.prototype.hasOwnProperty.call(v,x)||!Object.is(d[x],v[x]))return!1;return!0}const VX=Ue.createContext(null),ZUn=VX.Provider,s0n=wp.error001("react");function au(d,v){const k=Ue.useContext(VX);if(k===null)throw new Error(s0n);return o0n(k,d,v)}function os(){const d=Ue.useContext(VX);if(d===null)throw new Error(s0n);return Ue.useMemo(()=>({getState:d.getState,setState:d.setState,subscribe:d.subscribe}),[d])}const Zan={display:"none"},eKn={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},f0n="react-flow__node-desc",l0n="react-flow__edge-desc",nKn="react-flow__aria-live",tKn=d=>d.ariaLiveMessage,iKn=d=>d.ariaLabelConfig;function rKn({rfId:d}){const v=au(tKn);return q.jsx("div",{id:`${nKn}-${d}`,"aria-live":"assertive","aria-atomic":"true",style:eKn,children:v})}function cKn({rfId:d,disableKeyboardA11y:v}){const k=au(iKn);return q.jsxs(q.Fragment,{children:[q.jsx("div",{id:`${f0n}-${d}`,style:Zan,children:v?k["node.a11yDescription.default"]:k["node.a11yDescription.keyboardDisabled"]}),q.jsx("div",{id:`${l0n}-${d}`,style:Zan,children:k["edge.a11yDescription.default"]}),!v&&q.jsx(rKn,{rfId:d})]})}const QX=Ue.forwardRef(({position:d="top-left",children:v,className:k,style:x,...C},I)=>{const m=`${d}`.split("-");return q.jsx("div",{className:vl(["react-flow__panel",k,...m]),style:x,ref:I,...C,children:v})});QX.displayName="Panel";const e1n="https://reactflow.dev?utm_source=attribution";function uKn({proOptions:d,position:v="bottom-right"}){return d?.hideAttribution?null:q.jsx(QX,{position:v,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${e1n}`,children:q.jsx("a",{href:e1n,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const oKn=d=>{const v=[],k=[];for(const[,x]of d.nodeLookup)x.selected&&v.push(x.internals.userNode);for(const[,x]of d.edgeLookup)x.selected&&k.push(x);return{selectedNodes:v,selectedEdges:k}},dX=d=>d.id;function sKn(d,v){return Qs(d.selectedNodes.map(dX),v.selectedNodes.map(dX))&&Qs(d.selectedEdges.map(dX),v.selectedEdges.map(dX))}function fKn({onSelectionChange:d}){const v=os(),{selectedNodes:k,selectedEdges:x}=au(oKn,sKn);return Ue.useEffect(()=>{const C={nodes:k,edges:x};d?.(C),v.getState().onSelectionChangeHandlers.forEach(I=>I(C))},[k,x,d]),null}const lKn=d=>!!d.onSelectionChangeHandlers;function hKn({onSelectionChange:d}){const v=au(lKn);return d||v?q.jsx(fKn,{onSelectionChange:d}):null}const h0n=[0,0],aKn={x:0,y:0,zoom:1},dKn=["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"],n1n=[...dKn,"rfId"],bKn=d=>({setNodes:d.setNodes,setEdges:d.setEdges,setMinZoom:d.setMinZoom,setMaxZoom:d.setMaxZoom,setTranslateExtent:d.setTranslateExtent,setNodeExtent:d.setNodeExtent,reset:d.reset,setDefaultNodesAndEdges:d.setDefaultNodesAndEdges}),t1n={translateExtent:x$,nodeOrigin:h0n,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function wKn(d){const{setNodes:v,setEdges:k,setMinZoom:x,setMaxZoom:C,setTranslateExtent:I,setNodeExtent:m,reset:L,setDefaultNodesAndEdges:G}=au(bKn,Qs),F=os();Ue.useEffect(()=>(G(d.defaultNodes,d.defaultEdges),()=>{z.current=t1n,L()}),[]);const z=Ue.useRef(t1n);return Ue.useEffect(()=>{for(const X of n1n){const K=d[X],Y=z.current[X];K!==Y&&(typeof d[X]>"u"||(X==="nodes"?v(K):X==="edges"?k(K):X==="minZoom"?x(K):X==="maxZoom"?C(K):X==="translateExtent"?I(K):X==="nodeExtent"?m(K):X==="ariaLabelConfig"?F.setState({ariaLabelConfig:cUn(K)}):X==="fitView"?F.setState({fitViewQueued:K}):X==="fitViewOptions"?F.setState({fitViewOptions:K}):F.setState({[X]:K})))}z.current=d},n1n.map(X=>d[X])),null}function i1n(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function gKn(d){const[v,k]=Ue.useState(d==="system"?null:d);return Ue.useEffect(()=>{if(d!=="system"){k(d);return}const x=i1n(),C=()=>k(x?.matches?"dark":"light");return C(),x?.addEventListener("change",C),()=>{x?.removeEventListener("change",C)}},[d]),v!==null?v:i1n()?.matches?"dark":"light"}const r1n=typeof document<"u"?document:null;function T$(d=null,v={target:r1n,actInsideInputWithModifier:!0}){const[k,x]=Ue.useState(!1),C=Ue.useRef(!1),I=Ue.useRef(new Set([])),[m,L]=Ue.useMemo(()=>{if(d!==null){const F=(Array.isArray(d)?d:[d]).filter(X=>typeof X=="string").map(X=>X.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -100,4 +100,4 @@ FROM days d
100
100
  LEFT JOIN buckets b ON b.bucket = d.bucket
101
101
  ORDER BY d.bucket
102
102
  `};function GVn(d){if(typeof d.sql=="string"&&d.sql.trim())return d.sql;if(d.lifecycle&&typeof d.lifecycle=="object"){const v=Object.fromEntries(Object.entries(d.lifecycle).map(([k,x])=>[k,String(x)]));if(Object.keys(v).length>0)try{return JVn(v)}catch{return null}}return typeof d.preset=="string"?HVn[d.preset]??null:null}function qVn({owner:d,sql:v,lifecycle:k,preset:x,column:C,chart:I,height:m,width:L,color:G,label:F,className:z}){const X=Ue.useMemo(()=>GVn({sql:v,lifecycle:k,preset:x}),[v,k,x]),K=typeof d=="string"&&d?d:null,{data:Y}=nbn(K,X),ie=String(C??""),W=Ue.useMemo(()=>BVn(Y,ie),[Y,ie]),pe=Ue.useMemo(()=>!Y?.columns?.length||!Y.rows?[]:Y.rows.map((je,te)=>({label:String(je[0]??"").slice(0,10),value:W[te]??0})),[Y,W]);if(!K||!X||!ie)return null;const fe=I==="line"?q.jsx(rHn,{data:pe,height:typeof m=="number"?m:void 0}):q.jsx(cHn,{data:W,height:typeof m=="number"?m:void 0,width:typeof L=="number"?L:void 0,color:typeof G=="string"?G:void 0});return F==null?q.jsx("div",{className:z,children:fe}):q.jsxs("div",{className:z,children:[q.jsx("p",{className:"text-sm text-muted-foreground",children:String(F)}),fe]})}function zVn({metadata:d,metadataSchema:v,name:k,typeIcon:x,initialsFallback:C,className:I}){return q.jsx(i2e,{metadata:d,metadataSchema:v,name:String(k??""),typeIcon:x,initialsFallback:!!C,className:I})}function UVn({entity:d,owner:v,className:k,onClick:x,children:C}){const I=d;if(!I)return q.jsx(q.Fragment,{children:C});const m=_S(String(v??""),ZX(I));return q.jsx(k6,{to:m,className:k,onClick:x,children:C})}function KVn({state:d}){return d?q.jsx(AVn,{...d}):null}function XVn({state:d,onUpdate:v}){return d?q.jsx(FVn,{...d,onUpdate:v}):null}const WVn={"entity-avatar":zVn,"entity-link":UVn,"entity-table":KVn,"entity-board":XVn,"metric-series":qVn},gX={table:{label:"Table",icon:W1n},board:{label:"Board",icon:K1n}},O1n=":records";function VVn({ownerSlug:d,entityTypeSlug:v,create:k,onCreateChange:x,viewKey:C,shape:I}){const{orgContext:m,hasOrgContext:L}=n7(),G=G1n(v,m),{data:F,isLoading:z,error:X}=G;IJn(`/${d}`,m);const K=PJn(),[Y,ie]=Ue.useState({key:"",page:0}),W=X1n({strict:!1}),pe=JX(),fe=`/${d}/${NJn(v)}`,je=!z&&F?.slug===v,{collection:te,error:he,presentation:qe,preset:Ne,edited:Me,table:Ze}=Ue.useMemo(()=>fVn(W,F?.metadata_schema,!!C),[W,F?.metadata_schema,C]),rn=je?he:void 0,Bn=Ue.useMemo(()=>bVn(W,te),[W,te]),[Ln,mn]=Ue.useState(!1),[B,ye]=Ue.useState(0),Oe=te.search??"",Qe=te.segment,fn=JSON.stringify(te),gn=Qe?OJn(F).find(Ti=>Ti.name===Qe)??{name:Qe,description:""}:null,On=Ti=>void pe({to:".",search:{...q8(Ti),...Bn},replace:!0}),Vn=`${v}?${fn}&sort=${JSON.stringify(Ze.sort)}`,Zn=Y.key===Vn?Y.page:0,nt=Ue.useCallback(Ti=>ie(Zu=>({key:Vn,page:Ti(Zu.key===Vn?Zu.page:0)})),[Vn]),ai=$Jn(G.data),ti=ai?Ze.sort:wVn(Ze),vi=ti?.field,fr=ti?.order,wi=Ue.useMemo(()=>vi?[{id:vi,desc:fr==="desc"}]:[],[vi,fr]),Un=Ue.useCallback(Ti=>void pe({to:".",search:{...C?q8(W):{},...Bn,$table:JSON.stringify(Ti)},replace:!0}),[pe,C,W,Bn]),Xt=Ue.useCallback(Ti=>{const Zu=typeof Ti=="function"?Ti(wi):Ti;Zu[0]&&Un({...Ze,sort:{field:Zu[0].id,order:Zu[0].desc?"desc":"asc"}})},[wi,Un,Ze]),br=k===!0,yr=()=>x(!0),Oi=()=>x(!1),ir=wi[0]?.id,ji=wi[0]?wi[0].desc?"desc":"asc":void 0,xi=G.data?.metadata_schema,yi=!!x2e(xi)&&!ai,Mi=IVn(xi,{isDerived:ai}),rr=V1n(m),Ys=kpe(rr.data??[],v,te),Co=(Ti,Zu=!1,Vh=q8(W))=>{const Eh=!C||!rr.data||kpe(rr.data,v,Ti).some(am=>am.key===C);pe({to:Eh?".":fe,search:{...Eh&&C?Vh:{},...lVn(Ti,Ne?.key),$table:JSON.stringify(Ze)},replace:Zu})},Qf=Ti=>{const Zu=Ti?jX(Ti):{},Vh=!C||kpe(rr.data??[],v,Zu).some(Eh=>Eh.key===C);mn(!1),ye(Eh=>Eh+1),pe({to:Vh?".":fe,search:Ti?{$preset:Ti.key}:{}})},{isAdmin:pp}=F1n(m.organizationId),I1=DJn(m),V0=pp&&!!F&&!G.isPlaceholderData,kh=Ue.useRef(W);kh.current=W;const P1=async()=>{if(!Ne)return;const Ti=JSON.stringify(W),{data:Zu}=await G.refetch(),Vh=Zu?.metadata_schema,Eh=Vh?t2e(Vh[Dpe]??{}):void 0,am=Eh?.presets?.find(dm=>dm.key===Ne.key);if(!Zu||!Vh||!Eh||!am){q1n.error("This saved filter changed. Reload and try again.");return}const yp=hVn(am,te,Ze,Eh);await I1.mutateAsync({slug:Zu.slug,metadata_schema:{...Vh,[Dpe]:{...Eh,presets:Eh.presets?.map(dm=>dm.key===yp.key?yp:dm)}}}).then(()=>!0,()=>!1)&&(await G.refetch(),JSON.stringify(kh.current)===Ti&&Qf(yp))},Zs=LJn(rr.data??[],v,{viewKey:C,shape:I},Mi,te),$a=Zs.kind==="builtin"?Zs.mode==="board"&&!yi?"table":Zs.mode:null,N1=Zs.kind==="view"?Zs.view:null,mp=Zs.kind==="missing"?Zs.key:null,om=Zs.kind==="inapplicable"?Zs:null,sm=$a==="table"?50:200,t7=gan(v,m,{limit:sm,offset:Zn*sm,search:Oe.trim()||void 0,sortBy:ir,sortOrder:ji,segment:Qe,filters:te.filters,enabled:je&&!C&&!rn}),j6=gan(v,m,{limit:1,offset:0,parentId:null,search:Oe.trim()||void 0,segment:Qe,filters:te.filters,enabled:je&&!C&&!rn&&!ai}),{data:fm,isLoading:i7,error:r7}=t7,x6=rn||X||(C?null:r7),c7=!!C&&rr.data===void 0&&rr.isError,Da=fm?.entities??[],S6=fm?.metadata?.has_more??!1,La=fm?.metadata?.total_count??0,C6=Da.length>0||Oe.trim().length>0||Zn>0||!!Qe||!!te.filters?.length,Wl=F?.name?.trim()||U8(v),hw=F?.icon||void 0,_a=ai,O1=xi,u7=!rn&&(!L||!je||(C?rr.data===void 0&&!rr.isError:i7||!ai&&j6.isLoading)),A6=fm?.linked_entities??{},M6=j6.data?.metadata?.total_count,vp=La>0&&typeof M6=="number"?M6<La:!1,vv=Ue.useMemo(()=>F?.measure_columns??[],[F?.measure_columns]),T6=Ue.useMemo(()=>({entities:Da,owner:d,schema:O1,entityTypeIcon:hw,isDerived:_a,measureColumns:vv,linkedEntityLookups:A6,hasAnyParents:vp,sorting:wi,onSortingChange:Xt,visibleColumns:Ze.columns,page:Zn,pageSize:sm,totalCount:La,hasMore:S6,pageTitle:Wl,onPrevPage:()=>nt(Ti=>Math.max(0,Ti-1)),onNextPage:()=>nt(Ti=>Ti+1)}),[Da,d,O1,hw,_a,vv,A6,vp,wi,Ze.columns,Xt,nt,Zn,sm,La,S6,Wl]),lm=La>Da.length,I6=`showing first ${Da.length} of ${La} — narrow with search`,P6=Ue.useMemo(()=>({owner:d,entityType:F,entities:Da,totalCount:La,schema:O1,entityTypeIcon:hw}),[d,F,Da,La,O1,hw]),yv=Ue.useMemo(()=>({tableState:T6,boardState:P6,owner:d,schema:O1,entityType:F,entityTypeIcon:hw,totalCount:La,isTruncated:lm,truncationNotice:I6,canCreate:!_a,addLabel:`Add ${F?.name||U8(v)}`}),[T6,P6,d,O1,F,hw,La,lm,I6,_a,v]),N6=Ue.useMemo(()=>NVn({canShowBoard:yi,builtinData:yv,builtInLabels:{table:gX.table.label,board:gX.board.label}}),[yi,yv]),O6=$a?N6.find(Ti=>Ti.id===$a)??null:null,o7=O6?.template??Y0n,$6=O6?.data??yv,kv=Ti=>void pe({to:Ti===O1n?fe:`${fe}${JJn(Ti)}`,search:Bn}),hm=q8(W),s7=dHn(N1?.params,hm,Ti=>void pe({to:".",search:{...q8(Ti),...Bn}})),f7=()=>Co({...te,filters:[],segment:void 0},!1,bHn(N1?.params,hm)),D6=`Moved on ${F?.name||F?.slug||v} board`,L6=Ue.useMemo(()=>(Ti,Zu)=>K.mutateAsync({entityId:Ti,metadata:Zu,field_note:D6}),[K,D6]),l7=Ue.useMemo(()=>({updateEntity:L6,openCreate:()=>x(!0)}),[L6,x]);return q.jsxs("div",{className:"space-y-4",children:[q.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:Wl}),q.jsxs("div",{children:[br?q.jsx("div",{className:"max-w-3xl",children:q.jsx(uVn,{onClose:Oi,entityTypeSlug:v,orgContext:m})}):null,!br&&je&&q.jsxs("nav",{className:"mb-4 flex flex-wrap items-center gap-x-3 gap-y-2 border-b pb-3","aria-label":`${Wl} views`,children:[q.jsxs("div",{className:T1("mr-2 inline-flex rounded-md border",Me&&"border-dashed border-primary"),"data-edited":Me||void 0,children:[q.jsxs(Vf,{variant:C?"ghost":"secondary",className:"rounded-r-none border-r",onClick:()=>kv(O1n),children:[q.jsx(W1n,{className:"mr-2 h-4 w-4"}),Ne?.label??(te.filters?.length||te.search?"Custom filter":`All ${Wl.toLowerCase()}`),Me?q.jsx("span",{className:"ml-1.5 text-xs font-normal text-primary",children:"Edited"}):null]}),q.jsxs(Zpe,{open:Ln,onOpenChange:mn,children:[q.jsx(e2e,{asChild:!0,children:q.jsx(Vf,{variant:"ghost",size:"icon",className:"rounded-l-none","aria-label":"Choose saved filter",children:q.jsx(_Jn,{className:"h-4 w-4"})})}),q.jsxs(n2e,{align:"start",className:"w-60 p-1",children:[q.jsxs(Vf,{variant:"ghost",className:"w-full justify-start",onClick:()=>Qf(),children:["All ",Wl.toLowerCase()]}),qe.presets?.map(Ti=>q.jsx(Vf,{variant:Ne?.key===Ti.key?"secondary":"ghost",className:"w-full justify-start",onClick:()=>Qf(Ti),children:Ti.label},Ti.key))]})]})]}),Ne&&Me?q.jsxs("div",{className:"-ml-2 mr-2 inline-flex items-center gap-1",children:[q.jsx(Vf,{variant:"ghost",size:"sm",onClick:()=>Qf(Ne),children:"Reset"}),V0?q.jsx(Vf,{size:"sm",disabled:I1.isPending,onClick:()=>void P1(),children:I1.isPending?"Saving…":"Save"}):null]}):null,Ys.map(Ti=>q.jsx(Vf,{"data-testid":`tab-${Ti.key}`,variant:C===Ti.key?"secondary":"ghost","aria-pressed":C===Ti.key,onClick:()=>kv(Ti.key),children:Ti.name},Ti.key)),q.jsx(W0n,{label:Wl,search:te.search,onSearch:(Ti,Zu)=>Co({...te,search:Ti},Zu),className:"ml-auto w-full sm:w-64"},`${v}:${B}`)]}),!br&&!rn&&q.jsx(yVn,{collection:te,schema:O1,label:Wl,hideSearch:!0,org:m??"",facetQuery:qe.facetQuery,table:C?void 0:{...Ze,sort:ti},tableFields:RX(O1,_a,Da),sortFields:_a?[...V0n(Da)||Ze.sort?.field==="name"?[{field:"name",label:"Name"}]:[],...RX(O1,!0,Da).filter(Ti=>Ti.field!=="name")]:X0n,onTableChange:Un,onChange:Co,viewFilters:s7,onClearAll:f7,segmentChip:gn?{id:"segment",label:"Segment",op:"is",value:U8(gn.name),title:gn.description||void 0,editor:gn.description?{kind:"custom",render:()=>q.jsx("p",{className:"p-3 text-sm text-muted-foreground",children:gn.description})}:void 0,onRemove:()=>Co({...te,segment:void 0})}:void 0},`${v}:${B}`),!br&&!N1&&!mp&&!om&&C6&&q.jsx("div",{className:"flex items-center justify-between gap-3 mb-4",children:q.jsxs("div",{className:"flex items-center gap-2",children:[yi&&q.jsx("fieldset",{className:"flex items-center rounded-md border p-0.5","aria-label":"Record layout",children:["table","board"].map(Ti=>{const Zu=gX[Ti].icon,Vh=$a===Ti;return q.jsx(Vf,{type:"button",variant:"ghost",size:"sm","aria-pressed":Vh,title:gX[Ti].label,"data-testid":`shape-${Ti}`,className:T1("h-7 px-2",Vh&&"bg-accent text-accent-foreground"),onClick:()=>void pe({to:`${fe}/${FJn}/${Ti}`,search:Bn,replace:!0}),children:q.jsx(Zu,{className:"h-4 w-4"})},Ti)})}),!_a&&q.jsxs(Vf,{size:"sm",onClick:()=>yr(),children:[q.jsx(RJn,{className:"mr-2 h-4 w-4"}),"Add ",Wl||"Entity"]})]})}),br?null:u7?q.jsx(QVn,{}):x6?q.jsxs("div",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/5 px-4 py-6 text-sm text-destructive",children:[x6.message||`Failed to load ${Wl.toLowerCase()}.`,rn&&q.jsx(Vf,{variant:"outline",size:"sm",className:"ml-3",onClick:()=>Co({}),children:"Clear filters"})]}):c7?q.jsx(Y1n,{onRetry:()=>void rr.refetch()}):om?q.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center","data-testid":"inapplicable-view",children:[q.jsxs("h2",{className:"text-lg font-semibold",children:["“",om.view.name,"” doesn’t apply to the current filters"]}),q.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:["It appears when the selection includes"," ",Object.entries(om.when).map(([Ti,Zu])=>`${Ti} is ${Zu===null?"not supplied":String(Zu)}`).join(" and "),"."]}),q.jsx(k6,{to:fe,search:Bn,className:"mt-4 text-sm font-medium underline underline-offset-4",children:`Back to ${Wl}`})]}):mp?q.jsx(Z1n,{viewKey:mp,backTo:fe,backLabel:`Back to ${Wl}`}):N1?q.jsx(edn,{orgSlug:d,viewKey:N1.key,scope:{type:v,collection:te},params:hm,onParamsChange:On,contentHash:N1.content_hash,title:N1.name,minHeight:320}):C6?q.jsx(uHn,{template:o7,data:$6,actions:l7,components:WVn}):q.jsx(B1n,{icon:BJn,iconElement:q.jsx(H1n,{icon:F?.icon,className:"mb-4 h-12 w-12 opacity-50"}),title:`No ${Wl.toLowerCase()} yet`,description:_a?"This view has no rows yet. They appear as the underlying data arrives.":`Get started by creating your first ${F?.name?.toLowerCase()||"entity"}.`,actionLabel:_a?void 0:`Add ${F?.name||"Entity"}`,onAction:_a?void 0:()=>yr()})]})]})}function QVn(){return q.jsxs("div",{className:"space-y-4","aria-label":"Loading entities",role:"status",children:[q.jsxs("div",{className:"flex items-center justify-between gap-3",children:[q.jsx(OS,{className:"h-9 max-w-sm flex-1"}),q.jsx(OS,{className:"h-9 w-28"})]}),q.jsxs("div",{className:"overflow-hidden rounded-lg border",children:[q.jsx("div",{className:"border-b px-4 py-3",children:q.jsx(OS,{className:"h-3 w-1/3"})}),q.jsx("div",{className:"divide-y",children:Array.from({length:5}).map((d,v)=>q.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[q.jsx(OS,{className:"h-3 flex-1"}),q.jsx(OS,{className:"h-3 w-16 shrink-0"})]},v))})]})]})}const Ope=":schema";function YVn({ownerSlug:d,typeScope:v,create:k,createType:x=!1,viewKey:C,shape:I}){const m=JX(),{orgContext:L}=n7(),G=X1n({strict:!1}),F=v?HJn(v):void 0,z=F==="$member",X=()=>{m({to:"/$owner/data",params:{owner:d},search:{}})},K=ie=>{if(!F)return;const W=R1n(d,F);m({to:W.to,params:W.params,search:ie?{create:!0}:{},replace:!0})},Y=x?q.jsx("div",{className:"mx-auto w-full max-w-3xl",children:q.jsx(_pe,{entityType:null,orgContext:L,onClose:X})}):F?q.jsx(VVn,{ownerSlug:d,entityTypeSlug:F,create:k,onCreateChange:K,viewKey:C,shape:I}):q.jsx(ZVn,{ownerSlug:d,viewKey:C,search:G});return q.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4",children:z?q.jsx(gHn,{children:Y}):Y})}function ZVn({ownerSlug:d,viewKey:v,search:k}){const x=JX(),{orgContext:C}=n7(),{data:I,isError:m,refetch:L}=V1n(C),G=GJn(I??[]),F=qJn(I??[],v);return v&&I===void 0?m?q.jsx(Y1n,{onRetry:()=>void L()}):null:F.kind==="missing"?q.jsx(Z1n,{viewKey:F.key,backTo:`/${d}/data`,backLabel:"Back to Data"}):q.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4",children:[G.length>0&&q.jsx(QJn,{value:F.kind==="view"?F.view.key:Ope,onValueChange:z=>void x(z===Ope?{to:"/$owner/data",params:{owner:d}}:{to:"/$owner/data/-/views/$viewKey",params:{owner:d,viewKey:z}}),children:q.jsxs(YJn,{children:[q.jsx(pan,{value:Ope,"data-testid":"tab-schema",children:"Schema"}),G.map(z=>q.jsx(pan,{value:z.key,"data-testid":`tab-${z.key}`,children:z.name},z.key))]})}),F.kind==="view"?q.jsxs(q.Fragment,{children:[q.jsx(wHn,{decls:F.view.params,params:q8(k),onParamsChange:z=>void x({to:".",search:z})}),q.jsx(edn,{orgSlug:d,viewKey:F.view.key,scope:{},params:q8(k),onParamsChange:z=>void x({to:".",search:z,replace:!0}),contentHash:F.view.content_hash,title:F.view.name,minHeight:400})]}):q.jsx(cVn,{ownerSlug:d})]})}function fQn({ownerSlug:d,typeScope:v,create:k,createType:x=!1,viewKey:C,shape:I}){return q.jsxs("div",{className:"flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:[q.jsx(UJn,{}),q.jsx(zJn,{owner:d,children:m=>q.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:q.jsx(YVn,{ownerSlug:m.ownerSlug,typeScope:v,create:k,createType:x,viewKey:C,shape:I})})})]})}export{fQn as M};
103
- //# sourceMappingURL=memory-browse-page-IrIXuZTF.js.map
103
+ //# sourceMappingURL=memory-browse-page-DyQiRvzl.js.map