@decocms/mesh 2.17.0 → 2.17.1

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 (160) hide show
  1. package/dist/client/assets/{AlertCircle-DOBZDZTf.js → AlertCircle-rclbzics.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-CiX5attk.js → ArrowLeft-ClViT7Hc.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-Cb5IgbXf.js → ArrowUp-BsQNKzS-.js} +1 -1
  4. package/dist/client/assets/{Check-D_y2LGJG.js → Check-C2R_Lcai.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-CK8tBMwt.js → ChevronDown-CGAmRXVd.js} +1 -1
  6. package/dist/client/assets/{Code01-CHaKquD7.js → Code01-CVOtW_Yi.js} +1 -1
  7. package/dist/client/assets/{Copy01-DEYUyyKa.js → Copy01-BvrgG3_u.js} +1 -1
  8. package/dist/client/assets/{DotsHorizontal-CJj2K5Fj.js → DotsHorizontal-D-_ECokQ.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-DBgin8Gd.js → DotsVertical-BeOWu8ww.js} +1 -1
  10. package/dist/client/assets/{Download01-D480FrAl.js → Download01-C4VXJ4rj.js} +1 -1
  11. package/dist/client/assets/{Edit01-C2wyoLl_.js → Edit01-CkDEl3XN.js} +1 -1
  12. package/dist/client/assets/{File06-Dss_qxDP.js → File06-DcfM98WM.js} +1 -1
  13. package/dist/client/assets/{FilterLines-BIIc2m5u.js → FilterLines-BFhYlm1G.js} +1 -1
  14. package/dist/client/assets/{FlipBackward-C6tD49bS.js → FlipBackward-Bz0fRANc.js} +1 -1
  15. package/dist/client/assets/{GitBranch01-CCs9Y7UL.js → GitBranch01-Bc0tKWvO.js} +1 -1
  16. package/dist/client/assets/{Grid01-CPcgzk-j.js → Grid01-SL4tYH2-.js} +1 -1
  17. package/dist/client/assets/{Home02-B2DfszMd.js → Home02-C2IjHPBI.js} +1 -1
  18. package/dist/client/assets/{Image01-CWiMChMV.js → Image01-BQtv4av4.js} +1 -1
  19. package/dist/client/assets/{Inbox01-E54Xv1AH.js → Inbox01-Dq00_28Z.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-C1Hk7qxK.js → InfoCircle-Cr1Ezl_g.js} +1 -1
  21. package/dist/client/assets/{Key01-D3jgPHnl.js → Key01-nM2KN2wI.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-DXt_okRr.js → LinkExternal01-Cek4l5LT.js} +1 -1
  23. package/dist/client/assets/{List-vJTsFkGC.js → List-DhHX60HN.js} +1 -1
  24. package/dist/client/assets/{Loading01-CXxLrMyp.js → Loading01-CpEccvEO.js} +1 -1
  25. package/dist/client/assets/{Lock01-C0IcfwAr.js → Lock01-DkAqto6l.js} +1 -1
  26. package/dist/client/assets/{MessageChatSquare-BAK3msQ9.js → MessageChatSquare-B8VNN8W_.js} +1 -1
  27. package/dist/client/assets/{Play-D5UR01Yp.js → Play-gy0OXoTQ.js} +1 -1
  28. package/dist/client/assets/{Plus-BwqRnIpw.js → Plus-DjzFfDDP.js} +1 -1
  29. package/dist/client/assets/{SearchMd-B72GLhSo.js → SearchMd-Cg2el-z8.js} +1 -1
  30. package/dist/client/assets/{Terminal-C6oII67o.js → Terminal-Kg8grfTZ.js} +1 -1
  31. package/dist/client/assets/{Trash01-pQsQJfD7.js → Trash01-BnAfsqRe.js} +1 -1
  32. package/dist/client/assets/{Upload01-CPXoheIk.js → Upload01-DRgz8NgE.js} +1 -1
  33. package/dist/client/assets/{X-Ta7e64fd.js → X-CBga9b95.js} +1 -1
  34. package/dist/client/assets/{XClose-COWRVEvP.js → XClose-DEljIF8n.js} +1 -1
  35. package/dist/client/assets/{alert-dialog-CwDNNTWs.js → alert-dialog-BNxiLvEc.js} +1 -1
  36. package/dist/client/assets/{auth-catchall-DOIkjlbS.js → auth-catchall-DeehfEMz.js} +1 -1
  37. package/dist/client/assets/{avatar-Bbu1o6br.js → avatar-BXyXgGjh.js} +1 -1
  38. package/dist/client/assets/{badge-BF26aj7r.js → badge-Ctdv4gxt.js} +1 -1
  39. package/dist/client/assets/{binder-CZMsXyzM.js → binder-BxrAqFdA.js} +1 -1
  40. package/dist/client/assets/{button-CKEM3eQL.js → button-C0pnkZlC.js} +1 -1
  41. package/dist/client/assets/{card-2L27xRvH.js → card-DUUk5B6T.js} +1 -1
  42. package/dist/client/assets/{checkbox-D-u8zfFA.js → checkbox-DSzJrlMA.js} +1 -1
  43. package/dist/client/assets/{collection-detail-DRvlQkfI.js → collection-detail-iIrZ-zZ-.js} +1 -1
  44. package/dist/client/assets/{collection-display-button-BRmjKmXA.js → collection-display-button-DDxBelrQ.js} +1 -1
  45. package/dist/client/assets/{collection-header-DxthRGYV.js → collection-header-d89fPnWN.js} +1 -1
  46. package/dist/client/assets/{collection-page-D_yHhDuI.js → collection-page-DvY1awQQ.js} +1 -1
  47. package/dist/client/assets/{collection-search-B1XW3AZu.js → collection-search-DFSn4A42.js} +1 -1
  48. package/dist/client/assets/{collection-tab-tjhO7Mrn.js → collection-tab-J4NMpB8P.js} +1 -1
  49. package/dist/client/assets/{collection-table-wrapper-D0Ju0-U8.js → collection-table-wrapper-CB1f1HNV.js} +1 -1
  50. package/dist/client/assets/{connection-iGG9vveH.js → connection-CMutAR-q.js} +1 -1
  51. package/dist/client/assets/{connection-card-DtL0ugHI.js → connection-card-DJA7LSPP.js} +1 -1
  52. package/dist/client/assets/connection-detail-AyiveTST.js +1 -0
  53. package/dist/client/assets/{connections-D3zmX0Z9.js → connections-B5sVjhUZ.js} +1 -1
  54. package/dist/client/assets/constants-Bx2xP4ra.js +1 -0
  55. package/dist/client/assets/{create-organization-dialog-eRNW8Qxh.js → create-organization-dialog-FpknJphA.js} +1 -1
  56. package/dist/client/assets/{dialog-CDtau8Kt.js → dialog-DGipxHKv.js} +1 -1
  57. package/dist/client/assets/{dropdown-menu-wWS-zaMN.js → dropdown-menu-DXIsFCVQ.js} +1 -1
  58. package/dist/client/assets/{dynamic-plugin-layout-DputRlYb.js → dynamic-plugin-layout-p6uYyMI7.js} +1 -1
  59. package/dist/client/assets/{empty-state-CVNEuxZY.js → empty-state-BOQ8a8rM.js} +1 -1
  60. package/dist/client/assets/{empty-state-BHbK0lgC.js → empty-state-CsVvxFp9.js} +1 -1
  61. package/dist/client/assets/{env-vars-editor-C51mNjyA.js → env-vars-editor-DsDwdS2I.js} +1 -1
  62. package/dist/client/assets/{error-boundary-Bcxx4rfP.js → error-boundary-CiihS5J_.js} +1 -1
  63. package/dist/client/assets/{extract-connection-data-Dpmksiuo.js → extract-connection-data-CZNqSTSO.js} +1 -1
  64. package/dist/client/assets/{file-browser-BGJT68ml.js → file-browser-DtPxgmLq.js} +2 -2
  65. package/dist/client/assets/{form-V7XQlTI9.js → form-Cq3oH5p8.js} +1 -1
  66. package/dist/client/assets/{gateway-detail-Dwo3tRMv.js → gateway-detail-Ds9jNsAy.js} +1 -1
  67. package/dist/client/assets/{gateways-zERSWoJy.js → gateways--0F8usoj.js} +1 -1
  68. package/dist/client/assets/{grid-view-D8luahOM.js → grid-view-DCCLpGyL.js} +1 -1
  69. package/dist/client/assets/{home-BzIxKv5R.js → home-C6YGDrtN.js} +1 -1
  70. package/dist/client/assets/{index-Dm3KUy-5.js → index-BEGxRCwV.js} +4 -4
  71. package/dist/client/assets/{index-D93bwXlh.js → index-BPAz_Wmi.js} +1 -1
  72. package/dist/client/assets/{index-BuhwJgoT.js → index-Ct-XKtSm.js} +1 -1
  73. package/dist/client/assets/{index-H8waGLZX.js → index-lLPOJwFP.js} +19 -19
  74. package/dist/client/assets/index-sjg7ALLH.js +25 -0
  75. package/dist/client/assets/{infiniteQueryObserver-CorNdPTl.js → infiniteQueryObserver-Cg5Uwm-m.js} +1 -1
  76. package/dist/client/assets/{input-B_S0H_Hl.js → input-BtvEWyY7.js} +1 -1
  77. package/dist/client/assets/{layout-CSDcjZIC.js → layout-D_5LiG9u.js} +1 -1
  78. package/dist/client/assets/{lazy-highlighter-C9yEt-oj.js → lazy-highlighter-D262jDd3.js} +1 -1
  79. package/dist/client/assets/{localstorage-keys-bcceq1xC.js → localstorage-keys-CrsmSVIa.js} +1 -1
  80. package/dist/client/assets/{login-BYnVwbER.js → login-D-eNDgSJ.js} +1 -1
  81. package/dist/client/assets/mcp-oauth-BlRDBNPG.js +1 -0
  82. package/dist/client/assets/{mcp-server-card-_ATNoXTX.js → mcp-server-card-h4-acR5C.js} +1 -1
  83. package/dist/client/assets/{mcp-server-detail-DObA9nLB.js → mcp-server-detail-BIJFOf-1.js} +1 -1
  84. package/dist/client/assets/{members-BebBEAXI.js → members-JDeSn8de.js} +1 -1
  85. package/dist/client/assets/{monaco-editor-DKdQnknl.js → monaco-editor-h8_XpHnI.js} +1 -1
  86. package/dist/client/assets/{monitoring-CDDlEqUx.js → monitoring-B5veKGER.js} +12 -12
  87. package/dist/client/assets/{oauth-callback-gzfkrrQW.js → oauth-callback-B7GGjmT2.js} +1 -1
  88. package/dist/client/assets/{page-Do6tc7Ak.js → page-DRfRpAk9.js} +1 -1
  89. package/dist/client/assets/{page-CLLgwmPE.js → page-JPTyFV98.js} +1 -1
  90. package/dist/client/assets/{pin-to-sidebar-button-NqMT4AF7.js → pin-to-sidebar-button-DNtnmSb8.js} +1 -1
  91. package/dist/client/assets/{plugin-empty-state-CsEwK0UI.js → plugin-empty-state-DrcgOOcq.js} +1 -1
  92. package/dist/client/assets/{plugin-header-DMvUkTVw.js → plugin-header-riFgGbiI.js} +1 -1
  93. package/dist/client/assets/{plugins-femIOaN7.js → plugins-DoB7Ko8p.js} +1 -1
  94. package/dist/client/assets/{popover-CUHksX3w.js → popover-pNwa1deQ.js} +1 -1
  95. package/dist/client/assets/{project-context-provider-DTbOrAFq.js → project-context-provider-BMHXD39x.js} +1 -1
  96. package/dist/client/assets/{registry-utils-C5W-BZ_1.js → registry-utils-BkBVcE6w.js} +1 -1
  97. package/dist/client/assets/{resizable-BEUt05S8.js → resizable-jz1SBMEc.js} +1 -1
  98. package/dist/client/assets/{resource-tabs-kfeiBQEL.js → resource-tabs-DqRWX41r.js} +1 -1
  99. package/dist/client/assets/{select-H2esePZI.js → select-COJ5S7Rq.js} +1 -1
  100. package/dist/client/assets/{settings-DO0PkWA0.js → settings-CmNkIvY0.js} +1 -1
  101. package/dist/client/assets/{shell-layout-Bx8F46Gf.js → shell-layout-B43W-k9I.js} +1 -1
  102. package/dist/client/assets/{spinner-BZhaf6l_.js → spinner-Deoz6N0J.js} +1 -1
  103. package/dist/client/assets/{switch-CIfCfD81.js → switch-Z2NGTQao.js} +1 -1
  104. package/dist/client/assets/{textarea-CC9KHQpw.js → textarea-fD103gtG.js} +1 -1
  105. package/dist/client/assets/{tool-set-selector-Cty6fXdH.js → tool-set-selector-SxQbDynN.js} +1 -1
  106. package/dist/client/assets/{tools-list-rrG-PiCB.js → tools-list-9lgpWeKJ.js} +1 -1
  107. package/dist/client/assets/{tooltip-DixY1Sbc.js → tooltip-D0yN_jPS.js} +1 -1
  108. package/dist/client/assets/{use-binding-CPqdk4GE.js → use-binding-bdIG4ysm.js} +1 -1
  109. package/dist/client/assets/{use-collections-S6OVeMx0.js → use-collections-DiH8BH96.js} +1 -1
  110. package/dist/client/assets/{use-connection-C_QQYkok.js → use-connection-BvgGy_ae.js} +1 -1
  111. package/dist/client/assets/{use-connection-resources-h_CY6VEc.js → use-connection-resources-CazBLQYp.js} +1 -1
  112. package/dist/client/assets/{use-create-gateway-eDGGqEOS.js → use-create-gateway-DWTCcW8J.js} +1 -1
  113. package/dist/client/assets/{use-gateway-DMJjVwlU.js → use-gateway-Blme6XE1.js} +1 -1
  114. package/dist/client/assets/{use-gateway-system-prompt-CfIIyZId.js → use-gateway-system-prompt-DfRYNjlK.js} +1 -1
  115. package/dist/client/assets/{use-list-state-Bt6QEhtR.js → use-list-state-C9VeGRXh.js} +1 -1
  116. package/dist/client/assets/{use-mcp-DuKh-Xf7.js → use-mcp-ByUu9rNa.js} +1 -1
  117. package/dist/client/assets/{use-members-Hsme2FMs.js → use-members-A4eH5Mug.js} +1 -1
  118. package/dist/client/assets/{use-mobile-Bh6onNnL.js → use-mobile-DQFSnNx5.js} +1 -1
  119. package/dist/client/assets/{use-organization-settings-C4u9V1Gg.js → use-organization-settings-CFfwAQvt.js} +1 -1
  120. package/dist/client/assets/{use-tool-call-BSVniqlJ.js → use-tool-call-q6DaczOv.js} +1 -1
  121. package/dist/client/assets/useInfiniteQuery-c0A7IUcG.js +1 -0
  122. package/dist/client/assets/{useMutation-DXyBs08e.js → useMutation-8xrpFP-l.js} +1 -1
  123. package/dist/client/assets/useQuery-CLJFoOtO.js +1 -0
  124. package/dist/client/assets/{value-EQeDZr5M.js → value-_3bvT1Yq.js} +1 -1
  125. package/dist/client/assets/{view-mode-toggle-CoxeG-5F.js → view-mode-toggle-C7lGZNG7.js} +1 -1
  126. package/dist/client/assets/{workflow-CdkAFtfl.js → workflow-DBXd52Rn.js} +1 -1
  127. package/dist/client/index.html +1 -1
  128. package/dist/server/cli.js +208 -208
  129. package/dist/server/migrate.js +186 -186
  130. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/LICENSE +47 -0
  131. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/README.md +82 -0
  132. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.browser.d.ts +11 -0
  133. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.browser.mjs +43 -0
  134. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.cjs +45 -0
  135. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.cloudflare.cjs +46 -0
  136. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.cloudflare.d.ts +11 -0
  137. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.d.ts +11 -0
  138. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.mjs +46 -0
  139. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/emscripten-module.wasm +0 -0
  140. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.d.mts +83 -0
  141. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.d.ts +83 -0
  142. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.js +2 -0
  143. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.js.map +1 -0
  144. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.mjs +2 -0
  145. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/ffi.mjs.map +1 -0
  146. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.d.mts +20 -0
  147. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.d.ts +20 -0
  148. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.js +2 -0
  149. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.js.map +1 -0
  150. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.mjs +2 -0
  151. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/dist/index.mjs.map +1 -0
  152. package/dist/server/node_modules/@jitl/quickjs-wasmfile-release-sync/package.json +61 -0
  153. package/dist/server/server.js +202 -202
  154. package/package.json +1 -1
  155. package/dist/client/assets/connection-detail-CfQ3feir.js +0 -1
  156. package/dist/client/assets/constants-rLrKmanL.js +0 -1
  157. package/dist/client/assets/index-COEG5bG9.js +0 -25
  158. package/dist/client/assets/mcp-oauth-BQzIgGw8.js +0 -1
  159. package/dist/client/assets/useInfiniteQuery-BYo7uk8S.js +0 -1
  160. package/dist/client/assets/useQuery-9rHAo5k0.js +0 -1
@@ -1,4 +1,4 @@
1
- import{F as Rs,H as js,r as $,j as _,c as ue,f as _n,k as Vs,a as Os}from"./index-H8waGLZX.js";import{C as se,a as Bs}from"./index-Dm3KUy-5.js";import{E as Wo}from"./error-boundary-Bcxx4rfP.js";import{u as Fs}from"./localstorage-keys-bcceq1xC.js";import{u as bn}from"./project-context-provider-DTbOrAFq.js";import{c as qo,B as Go}from"./button-CKEM3eQL.js";import{V as Xs}from"./view-mode-toggle-CoxeG-5F.js";import{i as Ys}from"./GitBranch01-CCs9Y7UL.js";import{t as Ko}from"./MessageChatSquare-BAK3msQ9.js";import{s as Zs}from"./Plus-BwqRnIpw.js";import{c as Ws}from"./connection-iGG9vveH.js";import{I as Uo,n as qs}from"./empty-state-CVNEuxZY.js";import{u as Gs,i as Ks}from"./use-gateway-DMJjVwlU.js";import{u as Us}from"./use-connection-C_QQYkok.js";import{u as Qs}from"./use-tool-call-BSVniqlJ.js";import{i as ke,a as Gn,b as Js,c as Kn,d as Jt,T as en,e as ea}from"./value-EQeDZr5M.js";import"./X-Ta7e64fd.js";import"./popover-CUHksX3w.js";import"./textarea-CC9KHQpw.js";import"./AlertCircle-DOBZDZTf.js";import"./ArrowUp-Cb5IgbXf.js";import"./ChevronDown-CK8tBMwt.js";import"./Edit01-C2wyoLl_.js";import"./use-collections-S6OVeMx0.js";import"./useMutation-DXyBs08e.js";import"./use-binding-CPqdk4GE.js";import"./binder-CZMsXyzM.js";import"./use-gateway-system-prompt-CfIIyZId.js";import"./input-B_S0H_Hl.js";import"./tooltip-DixY1Sbc.js";import"./Check-D_y2LGJG.js";import"./SearchMd-B72GLhSo.js";import"./use-create-gateway-eDGGqEOS.js";import"./select-H2esePZI.js";import"./File06-Dss_qxDP.js";import"./Grid01-CPcgzk-j.js";import"./Image01-CWiMChMV.js";import"./Copy01-DEYUyyKa.js";import"./Terminal-C6oII67o.js";import"./monaco-editor-DKdQnknl.js";import"./spinner-BZhaf6l_.js";import"./alert-dialog-CwDNNTWs.js";import"./well-known-mcp-DOEdYmKO.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-pQsQJfD7.js";import"./useQuery-9rHAo5k0.js";function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var ta={value:()=>{}};function Rt(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new St(n)}function St(e){this._=e}function na(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}St.prototype=Rt.prototype={constructor:St,on:function(e,t){var n=this._,o=na(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=oa(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=Un(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Un(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new St(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function oa(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Un(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ta,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var ln="http://www.w3.org/1999/xhtml";const Qn={svg:"http://www.w3.org/2000/svg",xhtml:ln,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function jt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Qn.hasOwnProperty(t)?{space:Qn[t],local:e}:e}function ra(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ln&&t.documentElement.namespaceURI===ln?t.createElement(e):t.createElementNS(n,e)}}function ia(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Qo(e){var t=jt(e);return(t.local?ia:ra)(t)}function sa(){}function En(e){return e==null?sa:function(){return this.querySelector(e)}}function aa(e){typeof e!="function"&&(e=En(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),c,l,u=0;u<i;++u)(c=s[u])&&(l=e.call(c,c.__data__,u,s))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(o,this._parents)}function ca(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function la(){return[]}function Jo(e){return e==null?la:function(){return this.querySelectorAll(e)}}function ua(e){return function(){return ca(e.apply(this,arguments))}}function da(e){typeof e=="function"?e=ua(e):e=Jo(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,c,l=0;l<a;++l)(c=i[l])&&(o.push(e.call(c,c.__data__,l,i)),r.push(c));return new le(o,r)}function er(e){return function(){return this.matches(e)}}function tr(e){return function(t){return t.matches(e)}}var fa=Array.prototype.find;function ha(e){return function(){return fa.call(this.children,e)}}function ga(){return this.firstElementChild}function pa(e){return this.select(e==null?ga:ha(typeof e=="function"?e:tr(e)))}var ma=Array.prototype.filter;function ya(){return Array.from(this.children)}function xa(e){return function(){return ma.call(this.children,e)}}function wa(e){return this.selectAll(e==null?ya:xa(typeof e=="function"?e:tr(e)))}function va(e){typeof e!="function"&&(e=er(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],c,l=0;l<i;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new le(o,this._parents)}function nr(e){return new Array(e.length)}function _a(){return new le(this._enter||this._groups.map(nr),this._parents)}function kt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}kt.prototype={constructor:kt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ba(e){return function(){return e}}function Ea(e,t,n,o,r,s){for(var i=0,a,c=t.length,l=s.length;i<l;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new kt(e,s[i]);for(;i<c;++i)(a=t[i])&&(r[i]=a)}function Sa(e,t,n,o,r,s,i){var a,c,l=new Map,u=t.length,f=s.length,d=new Array(u),g;for(a=0;a<u;++a)(c=t[a])&&(d[a]=g=i.call(c,c.__data__,a,t)+"",l.has(g)?r[a]=c:l.set(g,c));for(a=0;a<f;++a)g=i.call(e,s[a],a,s)+"",(c=l.get(g))?(o[a]=c,c.__data__=s[a],l.delete(g)):n[a]=new kt(e,s[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(r[a]=c)}function Na(e){return e.__data__}function Ca(e,t){if(!arguments.length)return Array.from(this,Na);var n=t?Sa:Ea,o=this._parents,r=this._groups;typeof e!="function"&&(e=ba(e));for(var s=r.length,i=new Array(s),a=new Array(s),c=new Array(s),l=0;l<s;++l){var u=o[l],f=r[l],d=f.length,g=Ma(e.call(u,u&&u.__data__,l,o)),p=g.length,x=a[l]=new Array(p),w=i[l]=new Array(p),m=c[l]=new Array(d);n(u,f,x,w,m,g,t);for(var b=0,h=0,y,S;b<p;++b)if(y=x[b]){for(b>=h&&(h=b+1);!(S=w[h])&&++h<p;);y._next=S||null}}return i=new le(i,o),i._enter=a,i._exit=c,i}function Ma(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ia(){return new le(this._exit||this._groups.map(nr),this._parents)}function ka(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function Aa(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),c=0;c<i;++c)for(var l=n[c],u=o[c],f=l.length,d=a[c]=new Array(f),g,p=0;p<f;++p)(g=l[p]||u[p])&&(d[p]=g);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function Pa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Da(e){e||(e=Ta);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,c=r[s]=new Array(a),l,u=0;u<a;++u)(l=i[u])&&(c[u]=l);c.sort(t)}return new le(r,this._parents).order()}function Ta(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function za(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function $a(){return Array.from(this)}function Ha(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function La(){let e=0;for(const t of this)++e;return e}function Ra(){return!this.node()}function ja(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Va(e){return function(){this.removeAttribute(e)}}function Oa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ba(e,t){return function(){this.setAttribute(e,t)}}function Fa(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Xa(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ya(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Za(e,t){var n=jt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Oa:Va:typeof t=="function"?n.local?Ya:Xa:n.local?Fa:Ba)(n,t))}function or(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Wa(e){return function(){this.style.removeProperty(e)}}function qa(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ga(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Ka(e,t,n){return arguments.length>1?this.each((t==null?Wa:typeof t=="function"?Ga:qa)(e,t,n??"")):Ve(this.node(),e)}function Ve(e,t){return e.style.getPropertyValue(t)||or(e).getComputedStyle(e,null).getPropertyValue(t)}function Ua(e){return function(){delete this[e]}}function Qa(e,t){return function(){this[e]=t}}function Ja(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ec(e,t){return arguments.length>1?this.each((t==null?Ua:typeof t=="function"?Ja:Qa)(e,t)):this.node()[e]}function rr(e){return e.trim().split(/^|\s+/)}function Sn(e){return e.classList||new ir(e)}function ir(e){this._node=e,this._names=rr(e.getAttribute("class")||"")}ir.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function sr(e,t){for(var n=Sn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function ar(e,t){for(var n=Sn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function tc(e){return function(){sr(this,e)}}function nc(e){return function(){ar(this,e)}}function oc(e,t){return function(){(t.apply(this,arguments)?sr:ar)(this,e)}}function rc(e,t){var n=rr(e+"");if(arguments.length<2){for(var o=Sn(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?oc:t?tc:nc)(n,t))}function ic(){this.textContent=""}function sc(e){return function(){this.textContent=e}}function ac(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function cc(e){return arguments.length?this.each(e==null?ic:(typeof e=="function"?ac:sc)(e)):this.node().textContent}function lc(){this.innerHTML=""}function uc(e){return function(){this.innerHTML=e}}function dc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function fc(e){return arguments.length?this.each(e==null?lc:(typeof e=="function"?dc:uc)(e)):this.node().innerHTML}function hc(){this.nextSibling&&this.parentNode.appendChild(this)}function gc(){return this.each(hc)}function pc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mc(){return this.each(pc)}function yc(e){var t=typeof e=="function"?e:Qo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function xc(){return null}function wc(e,t){var n=typeof e=="function"?e:Qo(e),o=t==null?xc:typeof t=="function"?t:En(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function vc(){var e=this.parentNode;e&&e.removeChild(this)}function _c(){return this.each(vc)}function bc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ec(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Sc(e){return this.select(e?Ec:bc)}function Nc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Cc(e){return function(t){e.call(this,t,this.__data__)}}function Mc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ic(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function kc(e,t,n){return function(){var o=this.__on,r,s=Cc(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Ac(e,t,n){var o=Mc(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?kc:Ic,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function cr(e,t,n){var o=or(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Pc(e,t){return function(){return cr(this,e,t)}}function Dc(e,t){return function(){return cr(this,e,t.apply(this,arguments))}}function Tc(e,t){return this.each((typeof t=="function"?Dc:Pc)(e,t))}function*zc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var lr=[null];function le(e,t){this._groups=e,this._parents=t}function ut(){return new le([[document.documentElement]],lr)}function $c(){return this}le.prototype=ut.prototype={constructor:le,select:aa,selectAll:da,selectChild:pa,selectChildren:wa,filter:va,data:Ca,enter:_a,exit:Ia,join:ka,merge:Aa,selection:$c,order:Pa,sort:Da,call:za,nodes:$a,node:Ha,size:La,empty:Ra,each:ja,attr:Za,style:Ka,property:ec,classed:rc,text:cc,html:fc,raise:gc,lower:mc,append:yc,insert:wc,remove:_c,clone:Sc,datum:Nc,on:Ac,dispatch:Tc,[Symbol.iterator]:zc};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],lr)}function Hc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Hc(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Lc={passive:!1},ot={capture:!0,passive:!1};function tn(e){e.stopImmediatePropagation()}function je(e){e.preventDefault(),e.stopImmediatePropagation()}function ur(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",je,ot);"onselectstart"in t?n.on("selectstart.drag",je,ot):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function dr(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",je,ot),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const mt=e=>()=>e;function un(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}un.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Rc(e){return!e.ctrlKey&&!e.button}function jc(){return this.parentNode}function Vc(e,t){return t??{x:e.x,y:e.y}}function Oc(){return navigator.maxTouchPoints||"ontouchstart"in this}function fr(){var e=Rc,t=jc,n=Vc,o=Oc,r={},s=Rt("start","drag","end"),i=0,a,c,l,u,f=0;function d(y){y.on("mousedown.drag",g).filter(o).on("touchstart.drag",w).on("touchmove.drag",m,Lc).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(y,S){if(!(u||!e.call(this,y,S))){var E=h(this,t.call(this,y,S),y,S,"mouse");E&&(ce(y.view).on("mousemove.drag",p,ot).on("mouseup.drag",x,ot),ur(y.view),tn(y),l=!1,a=y.clientX,c=y.clientY,E("start",y))}}function p(y){if(je(y),!l){var S=y.clientX-a,E=y.clientY-c;l=S*S+E*E>f}r.mouse("drag",y)}function x(y){ce(y.view).on("mousemove.drag mouseup.drag",null),dr(y.view,l),je(y),r.mouse("end",y)}function w(y,S){if(e.call(this,y,S)){var E=y.changedTouches,C=t.call(this,y,S),P=E.length,D,V;for(D=0;D<P;++D)(V=h(this,C,y,S,E[D].identifier,E[D]))&&(tn(y),V("start",y,E[D]))}}function m(y){var S=y.changedTouches,E=S.length,C,P;for(C=0;C<E;++C)(P=r[S[C].identifier])&&(je(y),P("drag",y,S[C]))}function b(y){var S=y.changedTouches,E=S.length,C,P;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<E;++C)(P=r[S[C].identifier])&&(tn(y),P("end",y,S[C]))}function h(y,S,E,C,P,D){var V=s.copy(),I=de(D||E,S),z,H,v;if((v=n.call(y,new un("beforestart",{sourceEvent:E,target:d,identifier:P,active:i,x:I[0],y:I[1],dx:0,dy:0,dispatch:V}),C))!=null)return z=v.x-I[0]||0,H=v.y-I[1]||0,function M(N,A,k){var T=I,L;switch(N){case"start":r[P]=M,L=i++;break;case"end":delete r[P],--i;case"drag":I=de(k||A,S),L=i;break}V.call(N,y,new un(N,{sourceEvent:A,subject:v,target:d,identifier:P,active:L,x:I[0]+z,y:I[1]+H,dx:I[0]-T[0],dy:I[1]-T[1],dispatch:V}),C)}}return d.filter=function(y){return arguments.length?(e=typeof y=="function"?y:mt(!!y),d):e},d.container=function(y){return arguments.length?(t=typeof y=="function"?y:mt(y),d):t},d.subject=function(y){return arguments.length?(n=typeof y=="function"?y:mt(y),d):n},d.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:mt(!!y),d):o},d.on=function(){var y=s.on.apply(s,arguments);return y===s?d:y},d.clickDistance=function(y){return arguments.length?(f=(y=+y)*y,d):Math.sqrt(f)},d}var Jn=180/Math.PI,dn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function hr(e,t,n,o,r,s){var i,a,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*Jn,skewX:Math.atan(c)*Jn,scaleX:i,scaleY:a}}var yt;function Bc(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?dn:hr(t.a,t.b,t.c,t.d,t.e,t.f)}function Fc(e){return e==null||(yt||(yt=document.createElementNS("http://www.w3.org/2000/svg","g")),yt.setAttribute("transform",e),!(e=yt.transform.baseVal.consolidate()))?dn:(e=e.matrix,hr(e.a,e.b,e.c,e.d,e.e,e.f))}function gr(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function s(l,u,f,d,g,p){if(l!==f||u!==d){var x=g.push("translate(",null,t,null,n);p.push({i:x-4,x:ke(l,f)},{i:x-2,x:ke(u,d)})}else(f||d)&&g.push("translate("+f+t+d+n)}function i(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:ke(l,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(l,u,f,d){l!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:ke(l,u)}):u&&f.push(r(f)+"skewX("+u+o)}function c(l,u,f,d,g,p){if(l!==f||u!==d){var x=g.push(r(g)+"scale(",null,",",null,")");p.push({i:x-4,x:ke(l,f)},{i:x-2,x:ke(u,d)})}else(f!==1||d!==1)&&g.push(r(g)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),s(l.translateX,l.translateY,u.translateX,u.translateY,f,d),i(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(g){for(var p=-1,x=d.length,w;++p<x;)f[(w=d[p]).i]=w.x(g);return f.join("")}}}var Xc=gr(Bc,"px, ","px)","deg)"),Yc=gr(Fc,", ",")",")"),Zc=1e-12;function eo(e){return((e=Math.exp(e))+1/e)/2}function Wc(e){return((e=Math.exp(e))-1/e)/2}function qc(e){return((e=Math.exp(2*e))-1)/(e+1)}const Nt=(function e(t,n,o){function r(s,i){var a=s[0],c=s[1],l=s[2],u=i[0],f=i[1],d=i[2],g=u-a,p=f-c,x=g*g+p*p,w,m;if(x<Zc)m=Math.log(d/l)/t,w=function(C){return[a+C*g,c+C*p,l*Math.exp(t*C*m)]};else{var b=Math.sqrt(x),h=(d*d-l*l+o*x)/(2*l*n*b),y=(d*d-l*l-o*x)/(2*d*n*b),S=Math.log(Math.sqrt(h*h+1)-h),E=Math.log(Math.sqrt(y*y+1)-y);m=(E-S)/t,w=function(C){var P=C*m,D=eo(S),V=l/(n*b)*(D*qc(t*P+S)-Wc(S));return[a+V*g,c+V*p,l*D/eo(t*P+S)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,c=a*a;return e(i,a,c)},r})(Math.SQRT2,2,4);var Oe=0,Je=0,Ue=0,pr=1e3,At,et,Pt=0,De=0,Vt=0,rt=typeof performance=="object"&&performance.now?performance:Date,mr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Nn(){return De||(mr(Gc),De=rt.now()+Vt)}function Gc(){De=0}function Dt(){this._call=this._time=this._next=null}Dt.prototype=yr.prototype={constructor:Dt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Nn():+n)+(t==null?0:+t),!this._next&&et!==this&&(et?et._next=this:At=this,et=this),this._call=e,this._time=n,fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,fn())}};function yr(e,t,n){var o=new Dt;return o.restart(e,t,n),o}function Kc(){Nn(),++Oe;for(var e=At,t;e;)(t=De-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Oe}function to(){De=(Pt=rt.now())+Vt,Oe=Je=0;try{Kc()}finally{Oe=0,Qc(),De=0}}function Uc(){var e=rt.now(),t=e-Pt;t>pr&&(Vt-=t,Pt=e)}function Qc(){for(var e,t=At,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:At=n);et=e,fn(o)}function fn(e){if(!Oe){Je&&(Je=clearTimeout(Je));var t=e-De;t>24?(e<1/0&&(Je=setTimeout(to,e-rt.now()-Vt)),Ue&&(Ue=clearInterval(Ue))):(Ue||(Pt=rt.now(),Ue=setInterval(Uc,pr)),Oe=1,mr(to))}}function no(e,t,n){var o=new Dt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Jc=Rt("start","end","cancel","interrupt"),el=[],xr=0,oo=1,hn=2,Ct=3,ro=4,gn=5,Mt=6;function Ot(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;tl(e,n,{name:t,index:o,group:r,on:Jc,tween:el,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:xr})}function Cn(e,t){var n=ge(e,t);if(n.state>xr)throw new Error("too late; already scheduled");return n}function me(e,t){var n=ge(e,t);if(n.state>Ct)throw new Error("too late; already running");return n}function ge(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function tl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=yr(s,0,n.time);function s(l){n.state=oo,n.timer.restart(i,n.delay,n.time),n.delay<=l&&i(l-n.delay)}function i(l){var u,f,d,g;if(n.state!==oo)return c();for(u in o)if(g=o[u],g.name===n.name){if(g.state===Ct)return no(i);g.state===ro?(g.state=Mt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Mt,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(no(function(){n.state===Ct&&(n.state=ro,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=hn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===hn){for(n.state=Ct,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=g);r.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=gn,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===gn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Mt,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function It(e,t){var n=e.__transition,o,r,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>hn&&o.state<gn,o.state=Mt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function nl(e){return this.each(function(){It(this,e)})}function ol(e,t){var n,o;return function(){var r=me(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function rl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=me(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}s.tween=r}}function il(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ge(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?ol:rl)(n,e,t))}function Mn(e,t,n){var o=e._id;return e.each(function(){var r=me(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ge(r,o).value[t]}}function wr(e,t){var n;return(typeof t=="number"?ke:t instanceof Kn?Gn:(n=Kn(t))?(t=n,Gn):Js)(e,t)}function sl(e){return function(){this.removeAttribute(e)}}function al(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cl(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function ll(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function ul(e,t,n){var o,r,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=a+"",i===c?null:i===o&&c===r?s:(r=c,s=t(o=i,a)))}}function dl(e,t,n){var o,r,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=a+"",i===c?null:i===o&&c===r?s:(r=c,s=t(o=i,a)))}}function fl(e,t){var n=jt(e),o=n==="transform"?Yc:wr;return this.attrTween(e,typeof t=="function"?(n.local?dl:ul)(n,o,Mn(this,"attr."+e,t)):t==null?(n.local?al:sl)(n):(n.local?ll:cl)(n,o,t))}function hl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function gl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function pl(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&gl(e,s)),n}return r._value=t,r}function ml(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&hl(e,s)),n}return r._value=t,r}function yl(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=jt(e);return this.tween(n,(o.local?pl:ml)(o,t))}function xl(e,t){return function(){Cn(this,e).delay=+t.apply(this,arguments)}}function wl(e,t){return t=+t,function(){Cn(this,e).delay=t}}function vl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xl:wl)(t,e)):ge(this.node(),t).delay}function _l(e,t){return function(){me(this,e).duration=+t.apply(this,arguments)}}function bl(e,t){return t=+t,function(){me(this,e).duration=t}}function El(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_l:bl)(t,e)):ge(this.node(),t).duration}function Sl(e,t){if(typeof t!="function")throw new Error;return function(){me(this,e).ease=t}}function Nl(e){var t=this._id;return arguments.length?this.each(Sl(t,e)):ge(this.node(),t).ease}function Cl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;me(this,e).ease=n}}function Ml(e){if(typeof e!="function")throw new Error;return this.each(Cl(this._id,e))}function Il(e){typeof e!="function"&&(e=er(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],c,l=0;l<i;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new ve(o,this._parents,this._name,this._id)}function kl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var c=t[a],l=n[a],u=c.length,f=i[a]=new Array(u),d,g=0;g<u;++g)(d=c[g]||l[g])&&(f[g]=d);for(;a<o;++a)i[a]=t[a];return new ve(i,this._parents,this._name,this._id)}function Al(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Pl(e,t,n){var o,r,s=Al(t)?Cn:me;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Dl(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(Pl(n,e,t))}function Tl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function zl(){return this.on("end.remove",Tl(this._id))}function $l(e){var t=this._name,n=this._id;typeof e!="function"&&(e=En(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],c=a.length,l=s[i]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Ot(l[d],t,n,d,l,ge(u,n)));return new ve(s,this._parents,t,n)}function Hl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jo(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var c=o[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),g,p=ge(u,n),x=0,w=d.length;x<w;++x)(g=d[x])&&Ot(g,t,n,x,d,p);s.push(d),i.push(u)}return new ve(s,i,t,n)}var Ll=ut.prototype.constructor;function Rl(){return new Ll(this._groups,this._parents)}function jl(e,t){var n,o,r;return function(){var s=Ve(this,e),i=(this.style.removeProperty(e),Ve(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function vr(e){return function(){this.style.removeProperty(e)}}function Vl(e,t,n){var o,r=n+"",s;return function(){var i=Ve(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function Ol(e,t,n){var o,r,s;return function(){var i=Ve(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ve(this,e))),i===c?null:i===o&&c===r?s:(r=c,s=t(o=i,a))}}function Bl(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var c=me(this,e),l=c.on,u=c.value[s]==null?a||(a=vr(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(i,r=u),c.on=o}}function Fl(e,t,n){var o=(e+="")=="transform"?Xc:wr;return t==null?this.styleTween(e,jl(e,o)).on("end.style."+e,vr(e)):typeof t=="function"?this.styleTween(e,Ol(e,o,Mn(this,"style."+e,t))).each(Bl(this._id,e)):this.styleTween(e,Vl(e,o,t),n).on("end.style."+e,null)}function Xl(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Yl(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&Xl(e,i,n)),o}return s._value=t,s}function Zl(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Yl(e,t,n??""))}function Wl(e){return function(){this.textContent=e}}function ql(e){return function(){var t=e(this);this.textContent=t??""}}function Gl(e){return this.tween("text",typeof e=="function"?ql(Mn(this,"text",e)):Wl(e==null?"":e+""))}function Kl(e){return function(t){this.textContent=e.call(this,t)}}function Ul(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Kl(r)),t}return o._value=e,o}function Ql(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Ul(e))}function Jl(){for(var e=this._name,t=this._id,n=_r(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,c,l=0;l<a;++l)if(c=i[l]){var u=ge(c,t);Ot(c,e,n,l,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ve(o,this._parents,e,n)}function eu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},c={value:function(){--r===0&&s()}};n.each(function(){var l=me(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&s()})}var tu=0;function ve(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function _r(){return++tu}var xe=ut.prototype;ve.prototype={constructor:ve,select:$l,selectAll:Hl,selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:Il,merge:kl,selection:Rl,transition:Jl,call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:Dl,attr:fl,attrTween:yl,style:Fl,styleTween:Zl,text:Gl,textTween:Ql,remove:zl,tween:il,delay:vl,duration:El,ease:Nl,easeVarying:Ml,end:eu,[Symbol.iterator]:xe[Symbol.iterator]};function nu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ou={time:null,delay:0,duration:250,ease:nu};function ru(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function iu(e){var t,n;e instanceof ve?(t=e._id,e=e._name):(t=_r(),(n=ou).time=Nn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,c,l=0;l<a;++l)(c=i[l])&&Ot(c,e,t,l,i,n||ru(c,t));return new ve(o,this._parents,e,t)}ut.prototype.interrupt=nl;ut.prototype.transition=iu;const xt=e=>()=>e;function su(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function we(e,t,n){this.k=e,this.x=t,this.y=n}we.prototype={constructor:we,scale:function(e){return e===1?this:new we(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new we(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Bt=new we(1,0,0);br.prototype=we.prototype;function br(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Bt;return e.__zoom}function nn(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function au(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function cu(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function io(){return this.__zoom||Bt}function lu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function uu(){return navigator.maxTouchPoints||"ontouchstart"in this}function du(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Er(){var e=au,t=cu,n=du,o=lu,r=uu,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Nt,l=Rt("start","zoom","end"),u,f,d,g=500,p=150,x=0,w=10;function m(v){v.property("__zoom",io).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,M,N,A){var k=v.selection?v.selection():v;k.property("__zoom",io),v!==k?S(v,M,N,A):k.interrupt().each(function(){E(this,arguments).event(A).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},m.scaleBy=function(v,M,N,A){m.scaleTo(v,function(){var k=this.__zoom.k,T=typeof M=="function"?M.apply(this,arguments):M;return k*T},N,A)},m.scaleTo=function(v,M,N,A){m.transform(v,function(){var k=t.apply(this,arguments),T=this.__zoom,L=N==null?y(k):typeof N=="function"?N.apply(this,arguments):N,j=T.invert(L),R=typeof M=="function"?M.apply(this,arguments):M;return n(h(b(T,R),L,j),k,i)},N,A)},m.translateBy=function(v,M,N,A){m.transform(v,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,A)},m.translateTo=function(v,M,N,A,k){m.transform(v,function(){var T=t.apply(this,arguments),L=this.__zoom,j=A==null?y(T):typeof A=="function"?A.apply(this,arguments):A;return n(Bt.translate(j[0],j[1]).scale(L.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof N=="function"?-N.apply(this,arguments):-N),T,i)},A,k)};function b(v,M){return M=Math.max(s[0],Math.min(s[1],M)),M===v.k?v:new we(M,v.x,v.y)}function h(v,M,N){var A=M[0]-N[0]*v.k,k=M[1]-N[1]*v.k;return A===v.x&&k===v.y?v:new we(v.k,A,k)}function y(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function S(v,M,N,A){v.on("start.zoom",function(){E(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(A).end()}).tween("zoom",function(){var k=this,T=arguments,L=E(k,T).event(A),j=t.apply(k,T),R=N==null?y(j):typeof N=="function"?N.apply(k,T):N,F=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),B=k.__zoom,W=typeof M=="function"?M.apply(k,T):M,K=c(B.invert(R).concat(F/B.k),W.invert(R).concat(F/W.k));return function(Z){if(Z===1)Z=W;else{var O=K(Z),Y=F/O[2];Z=new we(Y,R[0]-O[0]*Y,R[1]-O[1]*Y)}L.zoom(null,Z)}})}function E(v,M,N){return!N&&v.__zooming||new C(v,M)}function C(v,M){this.that=v,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,M),this.taps=0}C.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,M){return this.mouse&&v!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var M=ce(this.that).datum();l.call(v,this.that,new su(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),M)}};function P(v,...M){if(!e.apply(this,arguments))return;var N=E(this,M).event(v),A=this.__zoom,k=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),T=de(v);if(N.wheel)(N.mouse[0][0]!==T[0]||N.mouse[0][1]!==T[1])&&(N.mouse[1]=A.invert(N.mouse[0]=T)),clearTimeout(N.wheel);else{if(A.k===k)return;N.mouse=[T,A.invert(T)],It(this),N.start()}Qe(v),N.wheel=setTimeout(L,p),N.zoom("mouse",n(h(b(A,k),N.mouse[0],N.mouse[1]),N.extent,i));function L(){N.wheel=null,N.end()}}function D(v,...M){if(d||!e.apply(this,arguments))return;var N=v.currentTarget,A=E(this,M,!0).event(v),k=ce(v.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),T=de(v,N),L=v.clientX,j=v.clientY;ur(v.view),nn(v),A.mouse=[T,this.__zoom.invert(T)],It(this),A.start();function R(B){if(Qe(B),!A.moved){var W=B.clientX-L,K=B.clientY-j;A.moved=W*W+K*K>x}A.event(B).zoom("mouse",n(h(A.that.__zoom,A.mouse[0]=de(B,N),A.mouse[1]),A.extent,i))}function F(B){k.on("mousemove.zoom mouseup.zoom",null),dr(B.view,A.moved),Qe(B),A.event(B).end()}}function V(v,...M){if(e.apply(this,arguments)){var N=this.__zoom,A=de(v.changedTouches?v.changedTouches[0]:v,this),k=N.invert(A),T=N.k*(v.shiftKey?.5:2),L=n(h(b(N,T),A,k),t.apply(this,M),i);Qe(v),a>0?ce(this).transition().duration(a).call(S,L,A,v):ce(this).call(m.transform,L,A,v)}}function I(v,...M){if(e.apply(this,arguments)){var N=v.touches,A=N.length,k=E(this,M,v.changedTouches.length===A).event(v),T,L,j,R;for(nn(v),L=0;L<A;++L)j=N[L],R=de(j,this),R=[R,this.__zoom.invert(R),j.identifier],k.touch0?!k.touch1&&k.touch0[2]!==R[2]&&(k.touch1=R,k.taps=0):(k.touch0=R,T=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(k.taps<2&&(f=R[0],u=setTimeout(function(){u=null},g)),It(this),k.start())}}function z(v,...M){if(this.__zooming){var N=E(this,M).event(v),A=v.changedTouches,k=A.length,T,L,j,R;for(Qe(v),T=0;T<k;++T)L=A[T],j=de(L,this),N.touch0&&N.touch0[2]===L.identifier?N.touch0[0]=j:N.touch1&&N.touch1[2]===L.identifier&&(N.touch1[0]=j);if(L=N.that.__zoom,N.touch1){var F=N.touch0[0],B=N.touch0[1],W=N.touch1[0],K=N.touch1[1],Z=(Z=W[0]-F[0])*Z+(Z=W[1]-F[1])*Z,O=(O=K[0]-B[0])*O+(O=K[1]-B[1])*O;L=b(L,Math.sqrt(Z/O)),j=[(F[0]+W[0])/2,(F[1]+W[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(N.touch0)j=N.touch0[0],R=N.touch0[1];else return;N.zoom("touch",n(h(L,j,R),N.extent,i))}}function H(v,...M){if(this.__zooming){var N=E(this,M).event(v),A=v.changedTouches,k=A.length,T,L;for(nn(v),d&&clearTimeout(d),d=setTimeout(function(){d=null},g),T=0;T<k;++T)L=A[T],N.touch0&&N.touch0[2]===L.identifier?delete N.touch0:N.touch1&&N.touch1[2]===L.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(L=de(L,this),Math.hypot(f[0]-L[0],f[1]-L[1])<w)){var j=ce(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:xt(+v),m):o},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:xt(!!v),m):e},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:xt(!!v),m):r},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:xt([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):t},m.scaleExtent=function(v){return arguments.length?(s[0]=+v[0],s[1]=+v[1],m):[s[0],s[1]]},m.translateExtent=function(v){return arguments.length?(i[0][0]=+v[0][0],i[1][0]=+v[1][0],i[0][1]=+v[0][1],i[1][1]=+v[1][1],m):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(x=(v=+v)*v,m):Math.sqrt(x)},m.tapDistance=function(v){return arguments.length?(w=+v,m):w},m}const pe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},it=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Sr=["Enter"," ","Escape"],Nr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Be;(function(e){e.Strict="strict",e.Loose="loose"})(Be||(Be={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var st;(function(e){e.Partial="partial",e.Full="full"})(st||(st={}));const Cr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ne;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ne||(Ne={}));var Tt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Tt||(Tt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const so={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function Mr(e){return e===null?null:e?"valid":"invalid"}const Ir=e=>"id"in e&&"source"in e&&"target"in e,fu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),In=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),dt=(e,t=[0,0])=>{const{width:n,height:o}=_e(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},hu=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):In(r)?r:t.nodeLookup.get(r.id));const a=i?zt(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ft(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Xt(n)},ft=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Ft(n,zt(r)),o=!0)}),o?Xt(n):{x:0,y:0,width:0,height:0}},kn=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...gt(t,[n,o,r]),width:t.width/r,height:t.height/r},c=[];for(const l of e.values()){const{measured:u,selectable:f=!0,hidden:d=!1}=l;if(i&&!f||d)continue;const g=u.width??l.width??l.initialWidth??null,p=u.height??l.height??l.initialHeight??null,x=at(a,Xe(l)),w=(g??0)*(p??0),m=s&&x>0;(!l.internals.handleBounds||m||x>=w||l.dragging)&&c.push(l)}return c},gu=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function pu(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function mu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=pu(e,i),c=ft(a),l=An(c,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(l,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function kr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let f=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",pe.error005());else{const g=a.measured.width,p=a.measured.height;g&&p&&(f=[[c,l],[c+g,l+p]])}else a&&Ye(i.extent)&&(f=[[i.extent[0][0]+c,i.extent[0][1]+l],[i.extent[1][0]+c,i.extent[1][1]+l]]);const d=Ye(f)?Te(t,f,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pe.error015()),{position:{x:d.x-c+(i.measured.width??0)*u[0],y:d.y-l+(i.measured.height??0)*u[1]},positionAbsolute:d}}async function yu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(d=>d.id)),i=[];for(const d of n){if(d.deletable===!1)continue;const g=s.has(d.id),p=!g&&d.parentId&&i.find(x=>x.id===d.parentId);(g||p)&&i.push(d)}const a=new Set(t.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),u=gu(i,c);for(const d of c)a.has(d.id)&&!u.find(p=>p.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:i};const f=await r({nodes:i,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:i}:{edges:[],nodes:[]}:f}const Fe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Te=(e={x:0,y:0},t,n)=>({x:Fe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Fe(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ar(e,t,n){const{width:o,height:r}=_e(n),{x:s,y:i}=n.internals.positionAbsolute;return Te(e,[[s,i],[s+o,i+r]],t)}const ao=(e,t,n)=>e<t?Fe(Math.abs(e-t),1,t)/t:e>n?-Fe(Math.abs(e-n),1,t)/t:0,Pr=(e,t,n=15,o=40)=>{const r=ao(e.x,o,t.width-o)*n,s=ao(e.y,o,t.height-o)*n;return[r,s]},Ft=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),pn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Xt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Xe=(e,t=[0,0])=>{const{x:n,y:o}=In(e)?e.internals.positionAbsolute:dt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},zt=(e,t=[0,0])=>{const{x:n,y:o}=In(e)?e.internals.positionAbsolute:dt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Dr=(e,t)=>Xt(Ft(pn(e),pn(t))),at=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},co=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),xu=(e,t)=>{},ht=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),gt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?ht(a,i):a},$t=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function He(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wu(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=He(e,n),r=He(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=He(e.top??e.y??0,n),r=He(e.bottom??e.y??0,n),s=He(e.left??e.x??0,t),i=He(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vu(e,t,n,o,r,s){const{x:i,y:a}=$t(e,[t,n,o]),{x:c,y:l}=$t({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,f=s-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const An=(e,t,n,o,r,s)=>{const i=wu(s,t,n),a=(t-i.x)/e.width,c=(n-i.y)/e.height,l=Math.min(a,c),u=Fe(l,o,r),f=e.x+e.width/2,d=e.y+e.height/2,g=t/2-f*u,p=n/2-d*u,x=vu(e,g,p,u,t,n),w={left:Math.min(x.left-i.left,0),top:Math.min(x.top-i.top,0),right:Math.min(x.right-i.right,0),bottom:Math.min(x.bottom-i.bottom,0)};return{x:g-w.left+w.right,y:p-w.top+w.bottom,zoom:u}},ct=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function _e(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Tr(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function zr(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function lo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function _u(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function bu(e){return{...Nr,...e||{}}}function tt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=he(e),a=gt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:c,y:l}=n?ht(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Pn=e=>({width:e.offsetWidth,height:e.offsetHeight}),$r=e=>e?.getRootNode?.()||window?.document,Eu=["INPUT","SELECT","TEXTAREA"];function Hr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Eu.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Lr=e=>"clientX"in e,he=(e,t)=>{const n=Lr(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},uo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Pn(i)}})};function Rr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const c=e*.125+r*.375+i*.375+n*.125,l=t*.125+s*.375+a*.375+o*.125,u=Math.abs(c-e),f=Math.abs(l-t);return[c,l,u,f]}function wt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function fo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case X.Left:return[t-wt(t-o,s),n];case X.Right:return[t+wt(o-t,s),n];case X.Top:return[t,n-wt(n-r,s)];case X.Bottom:return[t,n+wt(r-n,s)]}}function jr({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:s=X.Top,curvature:i=.25}){const[a,c]=fo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[l,u]=fo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[f,d,g,p]=Rr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${o},${r}`,f,d,g,p]}function Vr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Su({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Nu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=Ft(zt(e),zt(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return at(i,Xt(s))>0}const Cu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Mu=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Iu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Cu;let r;return Ir(e)?r={...e}:r={...e,id:o(e)},Mu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Or({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=Vr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const ho={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},ku=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},go=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Au({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:s,stepPosition:i}){const a=ho[t],c=ho[o],l={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+c.x*s,y:n.y+c.y*s},f=ku({source:l,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",g=f[d];let p=[],x,w;const m={x:0,y:0},b={x:0,y:0},[,,h,y]=Vr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(x=r.x??l.x+(u.x-l.x)*i,w=r.y??(l.y+u.y)/2):(x=r.x??(l.x+u.x)/2,w=r.y??l.y+(u.y-l.y)*i);const E=[{x,y:l.y},{x,y:u.y}],C=[{x:l.x,y:w},{x:u.x,y:w}];a[d]===g?p=d==="x"?E:C:p=d==="x"?C:E}else{const E=[{x:l.x,y:u.y}],C=[{x:u.x,y:l.y}];if(d==="x"?p=a.x===g?C:E:p=a.y===g?E:C,t===o){const z=Math.abs(e[d]-n[d]);if(z<=s){const H=Math.min(s-1,s-z);a[d]===g?m[d]=(l[d]>e[d]?-1:1)*H:b[d]=(u[d]>n[d]?-1:1)*H}}if(t!==o){const z=d==="x"?"y":"x",H=a[d]===c[z],v=l[z]>u[z],M=l[z]<u[z];(a[d]===1&&(!H&&v||H&&M)||a[d]!==1&&(!H&&M||H&&v))&&(p=d==="x"?E:C)}const P={x:l.x+m.x,y:l.y+m.y},D={x:u.x+b.x,y:u.y+b.y},V=Math.max(Math.abs(P.x-p[0].x),Math.abs(D.x-p[0].x)),I=Math.max(Math.abs(P.y-p[0].y),Math.abs(D.y-p[0].y));V>=I?(x=(P.x+D.x)/2,w=p[0].y):(x=p[0].x,w=(P.y+D.y)/2)}return[[e,{x:l.x+m.x,y:l.y+m.y},...p,{x:u.x+b.x,y:u.y+b.y},n],x,w,h,y]}function Pu(e,t,n,o){const r=Math.min(go(e,t)/2,go(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*l},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${i+r*c}Q ${s},${i} ${s+r*a},${i}`}function mn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:s=X.Top,borderRadius:i=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){const[f,d,g,p,x]=Au({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:c},offset:l,stepPosition:u});return[f.reduce((m,b,h)=>{let y="";return h>0&&h<f.length-1?y=Pu(f[h-1],b,f[h+1],i):y=`${h===0?"M":"L"}${b.x} ${b.y}`,m+=y,m},""),d,g,p,x]}function po(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Du(e){const{sourceNode:t,targetNode:n}=e;if(!po(t)||!po(n))return null;const o=t.internals.handleBounds||mo(t.handles),r=n.internals.handleBounds||mo(n.handles),s=yo(o?.source??[],e.sourceHandle),i=yo(e.connectionMode===Be.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||X.Bottom,c=i?.position||X.Top,l=ze(t,s,a),u=ze(n,i,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function mo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function ze(e,t,n=X.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??_e(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case X.Top:return{x:r+i/2,y:s};case X.Right:return{x:r+i,y:s+a/2};case X.Bottom:return{x:r+i/2,y:s+a};case X.Left:return{x:r,y:s+a/2}}}function yo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function yn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Tu(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=yn(c,t);s.has(l)||(i.push({id:l,color:c.color||n,...c}),s.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const Br=1e3,zu=10,Dn={nodeOrigin:[0,0],nodeExtent:it,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},$u={...Dn,checkEquality:!0};function Tn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Hu(e,t,n){const o=Tn(Dn,n);for(const r of e.values())if(r.parentId)$n(r,e,t,o);else{const s=dt(r,o.nodeOrigin),i=Ye(r.extent)?r.extent:o.nodeExtent,a=Te(s,i,_e(r));r.internals.positionAbsolute=a}}function Lu(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function zn(e){return e==="manual"}function xn(e,t,n,o={}){const r=Tn($u,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!zn(r.zIndexMode)?Br:0;let c=e.length>0;t.clear(),n.clear();for(const l of e){let u=i.get(l.id);if(r.checkEquality&&l===u?.internals.userNode)t.set(l.id,u);else{const f=dt(l,r.nodeOrigin),d=Ye(l.extent)?l.extent:r.nodeExtent,g=Te(f,d,_e(l));u={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:g,handleBounds:Lu(l,u),z:Fr(l,a,r.zIndexMode),userNode:l}},t.set(l.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(c=!1),l.parentId&&$n(u,t,n,o,s)}return c}function Ru(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function $n(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:c}=Tn(Dn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ru(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*zu),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=s&&!zn(c)?Br:0,{x:d,y:g,z:p}=ju(e,u,i,a,f,c),{positionAbsolute:x}=e.internals,w=d!==x.x||g!==x.y;(w||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:d,y:g}:x,z:p}})}function Fr(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return zn(n)?o:o+(e.selected?t:0)}function ju(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,c=_e(e),l=dt(e,n),u=Ye(e.extent)?Te(l,e.extent,c):l;let f=Te({x:i+u.x,y:a+u.y},o,c);e.extent==="parent"&&(f=Ar(f,c,t));const d=Fr(e,r,s),g=t.internals.z??0;return{x:f.x,y:f.y,z:g>=d?g+1:d}}function Hn(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const c=s.get(i.parentId)?.expandedRect??Xe(a),l=Dr(c,i.rect);s.set(i.parentId,{expandedRect:l,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},c)=>{const l=a.internals.positionAbsolute,u=_e(a),f=a.origin??o,d=i.x<l.x?Math.round(Math.abs(l.x-i.x)):0,g=i.y<l.y?Math.round(Math.abs(l.y-i.y)):0,p=Math.max(u.width,Math.round(i.width)),x=Math.max(u.height,Math.round(i.height)),w=(p-u.width)*f[0],m=(x-u.height)*f[1];(d>0||g>0||w||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-d+w,y:a.position.y-g+m}}),n.get(c)?.forEach(b=>{e.some(h=>h.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+g}})})),(u.width<i.width||u.height<i.height||d||g)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:p+(d?f[0]*d-w:0),height:x+(g?f[1]*g-m:0)}})}),r}function Vu(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const g of e.values()){const p=t.get(g.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),c=!0;continue}const x=Pn(g.nodeElement),w=p.measured.width!==x.width||p.measured.height!==x.height;if(!!(x.width&&x.height&&(w||!p.internals.handleBounds||g.force))){const b=g.nodeElement.getBoundingClientRect(),h=Ye(p.extent)?p.extent:s;let{positionAbsolute:y}=p.internals;p.parentId&&p.extent==="parent"?y=Ar(y,x,t.get(p.parentId)):h&&(y=Te(y,h,x));const S={...p,measured:x,internals:{...p.internals,positionAbsolute:y,handleBounds:{source:uo("source",g.nodeElement,b,f,p.id),target:uo("target",g.nodeElement,b,f,p.id)}}};t.set(p.id,S),p.parentId&&$n(S,t,n,{nodeOrigin:r,zIndexMode:i}),c=!0,w&&(l.push({id:p.id,type:"dimensions",dimensions:x}),p.expandParent&&p.parentId&&d.push({id:p.id,parentId:p.parentId,rect:Xe(S,r)}))}}if(d.length>0){const g=Hn(d,t,n,r);l.push(...g)}return{changes:l,updatedInternals:c}}async function Ou({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function xo(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const c=o.get(i)||new Map;if(o.set(i,c.set(n,t)),s){i=`${r}-${e}-${s}`;const l=o.get(i)||new Map;o.set(i,l.set(n,t))}}function Xr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},l=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;xo("source",c,u,e,r,i),xo("target",c,l,e,s,a),t.set(o.id,o)}}function Yr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Yr(n,t):!1}function wo(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Bu(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!Yr(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function on({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const c=n.get(i)?.internals.userNode;c&&r.push({...c,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function Fu({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=ht(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Xu({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,c=!1,l={x:0,y:0},u=null,f=!1,d=null,g=!1,p=!1,x=null;function w({noDragClassName:b,handleSelector:h,domNode:y,isSelectable:S,nodeId:E,nodeClickDistance:C=0}){d=ce(y);function P({x:z,y:H}){const{nodeLookup:v,nodeExtent:M,snapGrid:N,snapToGrid:A,nodeOrigin:k,onNodeDrag:T,onSelectionDrag:L,onError:j,updateNodePositions:R}=t();s={x:z,y:H};let F=!1;const B=a.size>1,W=B&&M?pn(ft(a)):null,K=B&&A?Fu({dragItems:a,snapGrid:N,x:z,y:H}):null;for(const[Z,O]of a){if(!v.has(Z))continue;let Y={x:z-O.distance.x,y:H-O.distance.y};A&&(Y=K?{x:Math.round(Y.x+K.x),y:Math.round(Y.y+K.y)}:ht(Y,N));let Q=null;if(B&&M&&!O.extent&&W){const{positionAbsolute:G}=O.internals,ee=G.x-W.x+M[0][0],ne=G.x+O.measured.width-W.x2+M[1][0],te=G.y-W.y+M[0][1],ae=G.y+O.measured.height-W.y2+M[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:q}=kr({nodeId:Z,nextPosition:Y,nodeLookup:v,nodeExtent:Q||M,nodeOrigin:k,onError:j});F=F||O.position.x!==U.x||O.position.y!==U.y,O.position=U,O.internals.positionAbsolute=q}if(p=p||F,!!F&&(R(a,!0),x&&(o||T||!E&&L))){const[Z,O]=on({nodeId:E,dragItems:a,nodeLookup:v});o?.(x,a,Z,O),T?.(x,Z,O),E||L?.(x,O)}}async function D(){if(!u)return;const{transform:z,panBy:H,autoPanSpeed:v,autoPanOnNodeDrag:M}=t();if(!M){c=!1,cancelAnimationFrame(i);return}const[N,A]=Pr(l,u,v);(N!==0||A!==0)&&(s.x=(s.x??0)-N/z[2],s.y=(s.y??0)-A/z[2],await H({x:N,y:A})&&P(s)),i=requestAnimationFrame(D)}function V(z){const{nodeLookup:H,multiSelectionActive:v,nodesDraggable:M,transform:N,snapGrid:A,snapToGrid:k,selectNodesOnDrag:T,onNodeDragStart:L,onSelectionDragStart:j,unselectNodesAndEdges:R}=t();f=!0,(!T||!S)&&!v&&E&&(H.get(E)?.selected||R()),S&&T&&E&&e?.(E);const F=tt(z.sourceEvent,{transform:N,snapGrid:A,snapToGrid:k,containerBounds:u});if(s=F,a=Bu(H,M,F,E),a.size>0&&(n||L||!E&&j)){const[B,W]=on({nodeId:E,dragItems:a,nodeLookup:H});n?.(z.sourceEvent,a,B,W),L?.(z.sourceEvent,B,W),E||j?.(z.sourceEvent,W)}}const I=fr().clickDistance(C).on("start",z=>{const{domNode:H,nodeDragThreshold:v,transform:M,snapGrid:N,snapToGrid:A}=t();u=H?.getBoundingClientRect()||null,g=!1,p=!1,x=z.sourceEvent,v===0&&V(z),s=tt(z.sourceEvent,{transform:M,snapGrid:N,snapToGrid:A,containerBounds:u}),l=he(z.sourceEvent,u)}).on("drag",z=>{const{autoPanOnNodeDrag:H,transform:v,snapGrid:M,snapToGrid:N,nodeDragThreshold:A,nodeLookup:k}=t(),T=tt(z.sourceEvent,{transform:v,snapGrid:M,snapToGrid:N,containerBounds:u});if(x=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||E&&!k.has(E))&&(g=!0),!g){if(!c&&H&&f&&(c=!0,D()),!f){const L=he(z.sourceEvent,u),j=L.x-l.x,R=L.y-l.y;Math.sqrt(j*j+R*R)>A&&V(z)}(s.x!==T.xSnapped||s.y!==T.ySnapped)&&a&&f&&(l=he(z.sourceEvent,u),P(T))}}).on("end",z=>{if(!(!f||g)&&(c=!1,f=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:H,updateNodePositions:v,onNodeDragStop:M,onSelectionDragStop:N}=t();if(p&&(v(a,!1),p=!1),r||M||!E&&N){const[A,k]=on({nodeId:E,dragItems:a,nodeLookup:H,dragging:!1});r?.(z.sourceEvent,a,A,k),M?.(z.sourceEvent,A,k),E||N?.(z.sourceEvent,k)}}}).filter(z=>{const H=z.target;return!z.button&&(!b||!wo(H,`.${b}`,y))&&(!h||wo(H,h,y))});d.call(I)}function m(){d?.on(".drag",null)}return{update:w,destroy:m}}function Yu(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())at(r,Xe(s))>0&&o.push(s);return o}const Zu=250;function Wu(e,t,n,o){let r=[],s=1/0;const i=Yu(e,n,t+Zu);for(const a of i){const c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:f}=ze(a,l,l.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<s?(r=[{...l,x:u,y:f}],s=d):d===s&&r.push({...l,x:u,y:f}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function Zr(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&s?{...c,...ze(i,c,c.position,!0)}:c}function Wr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function qu(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const qr=()=>!0;function Gu(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:g,onConnectStart:p,onConnect:x,onConnectEnd:w,isValidConnection:m=qr,onReconnectEnd:b,updateConnection:h,getTransform:y,getFromHandle:S,autoPanSpeed:E,dragThreshold:C=1,handleDomNode:P}){const D=$r(e.target);let V=0,I;const{x:z,y:H}=he(e),v=Wr(s,P),M=a?.getBoundingClientRect();let N=!1;if(!M||!v)return;const A=Zr(r,v,o,c,t);if(!A)return;let k=he(e,M),T=!1,L=null,j=!1,R=null;function F(){if(!u||!M)return;const[U,q]=Pr(k,M,E);d({x:U,y:q}),V=requestAnimationFrame(F)}const B={...A,nodeId:r,type:v,position:A.position},W=c.get(r);let Z={inProgress:!0,isValid:null,from:ze(W,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:W,to:k,toHandle:null,toPosition:so[B.position],toNode:null,pointer:k};function O(){N=!0,h(Z),p?.(e,{nodeId:r,handleId:o,handleType:v})}C===0&&O();function Y(U){if(!N){const{x:ae,y:be}=he(U),ye=ae-z,Ie=be-H;if(!(ye*ye+Ie*Ie>C*C))return;O()}if(!S()||!B){Q(U);return}const q=y();k=he(U,M),I=Wu(gt(k,q,!1,[1,1]),n,c,B),T||(F(),T=!0);const G=Gr(U,{handle:I,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:m,doc:D,lib:l,flowId:f,nodeLookup:c});R=G.handleDomNode,L=G.connection,j=qu(!!I,G.isValid);const ee=c.get(r),ne=ee?ze(ee,B,X.Left,!0):Z.from,te={...Z,from:ne,isValid:j,to:G.toHandle&&j?$t({x:G.toHandle.x,y:G.toHandle.y},q):k,toHandle:G.toHandle,toPosition:j&&G.toHandle?G.toHandle.position:so[B.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:k};h(te),Z=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(N){(I||R)&&L&&j&&x?.(L);const{inProgress:q,...G}=Z,ee={...G,toPosition:Z.toHandle?Z.toPosition:null};w?.(U,ee),s&&b?.(U,ee)}g(),cancelAnimationFrame(V),T=!1,j=!1,L=null,R=null,D.removeEventListener("mousemove",Y),D.removeEventListener("mouseup",Q),D.removeEventListener("touchmove",Y),D.removeEventListener("touchend",Q)}}D.addEventListener("mousemove",Y),D.addEventListener("mouseup",Q),D.addEventListener("touchmove",Y),D.addEventListener("touchend",Q)}function Gr(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:c,isValidConnection:l=qr,nodeLookup:u}){const f=s==="target",d=t?i.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:p}=he(e),x=i.elementFromPoint(g,p),w=x?.classList.contains(`${a}-flow__handle`)?x:d,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const b=Wr(void 0,w),h=w.getAttribute("data-nodeid"),y=w.getAttribute("data-handleid"),S=w.classList.contains("connectable"),E=w.classList.contains("connectableend");if(!h||!b)return m;const C={source:f?h:o,sourceHandle:f?y:r,target:f?o:h,targetHandle:f?r:y};m.connection=C;const D=S&&E&&(n===Be.Strict?f&&b==="source"||!f&&b==="target":h!==o||y!==r);m.isValid=D&&l(C),m.toHandle=Zr(h,b,y,u,n,!0)}return m}const wn={onPointerDown:Gu,isValid:Gr};function Ku({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function s({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:g=!1}){const p=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const y=n(),S=h.sourceEvent.ctrlKey&&ct()?10:1,E=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*u,C=y[2]*Math.pow(2,E*S);t.scaleTo(C)};let x=[0,0];const w=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(x=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},m=h=>{const y=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const S=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],E=[S[0]-x[0],S[1]-x[1]];x=S;const C=o()*Math.max(y[2],Math.log(y[2]))*(g?-1:1),P={x:y[0]-E[0]*C,y:y[1]-E[1]*C},D=[[0,0],[c,l]];t.setViewportConstrained({x:P.x,y:P.y,zoom:y[2]},D,a)},b=Er().on("start",w).on("zoom",f?m:null).on("zoom.wheel",d?p:null);r.call(b,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const Yt=e=>({x:e.x,y:e.y,zoom:e.k}),rn=({x:e,y:t,zoom:n})=>Bt.translate(e,t).scale(n),Le=(e,t)=>e.target.closest(`.${t}`),Kr=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Uu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,sn=(e,t=0,n=Uu,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ur=e=>{const t=e.ctrlKey&&ct()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Qu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Le(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&i){const w=de(u),m=Ur(u),b=f*Math.pow(2,m);o.scaleTo(n,b,w,u);return}const d=u.deltaMode===1?20:1;let g=r===Pe.Vertical?0:u.deltaX*d,p=r===Pe.Horizontal?0:u.deltaY*d;!ct()&&u.shiftKey&&r!==Pe.Vertical&&(g=u.deltaY*d,p=0),o.translateBy(n,-(g/f)*s,-(p/f)*s,{internal:!0});const x=Yt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,x),e.panScrollTimeout=setTimeout(()=>{l?.(u,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,x))}}function Ju({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=Le(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function ed({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Yt(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function td({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&Kr(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,Yt(s.transform))}}function nd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Kr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Yt(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function od({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:u}){return f=>{const d=e||t,g=n&&f.ctrlKey,p=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Le(f,`${l}-flow__node`)||Le(f,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!s&&!n||i||u&&!p||Le(f,a)&&p||Le(f,c)&&(!p||r&&p&&!e)||!n&&f.ctrlKey&&p)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!g&&p||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||p)&&x}}function rd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=Er().scaleExtent([t,n]).translateExtent(o),d=ce(e).call(f);b({x:r.x,y:r.y,zoom:Fe(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=d.on("wheel.zoom"),p=d.on("dblclick.zoom");f.wheelDelta(Ur);function x(I,z){return d?new Promise(H=>{f?.interpolate(z?.interpolate==="linear"?Jt:Nt).transform(sn(d,z?.duration,z?.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function w({noWheelClassName:I,noPanClassName:z,onPaneContextMenu:H,userSelectionActive:v,panOnScroll:M,panOnDrag:N,panOnScrollMode:A,panOnScrollSpeed:k,preventScrolling:T,zoomOnPinch:L,zoomOnScroll:j,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:W,connectionInProgress:K,paneClickDistance:Z,selectionOnDrag:O}){v&&!l.isZoomingOrPanning&&m();const Y=M&&!F&&!v;f.clickDistance(O?1/0:!fe(Z)||Z<0?0:Z);const Q=Y?Qu({zoomPanValues:l,noWheelClassName:I,d3Selection:d,d3Zoom:f,panOnScrollMode:A,panOnScrollSpeed:k,zoomOnPinch:L,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):Ju({noWheelClassName:I,preventScrolling:T,d3ZoomHandler:g});if(d.on("wheel.zoom",Q,{passive:!1}),!v){const q=ed({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:i});f.on("start",q);const G=td({zoomPanValues:l,panOnDrag:N,onPaneContextMenu:!!H,onPanZoom:s,onTransformChange:W});f.on("zoom",G);const ee=nd({zoomPanValues:l,panOnDrag:N,panOnScroll:M,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:c});f.on("end",ee)}const U=od({zoomActivationKeyPressed:F,panOnDrag:N,zoomOnScroll:j,panOnScroll:M,zoomOnDoubleClick:R,zoomOnPinch:L,userSelectionActive:v,noPanClassName:z,noWheelClassName:I,lib:B,connectionInProgress:K});f.filter(U),R?d.on("dblclick.zoom",p):d.on("dblclick.zoom",null)}function m(){f.on("zoom",null)}async function b(I,z,H){const v=rn(I),M=f?.constrain()(v,z,H);return M&&await x(M),new Promise(N=>N(M))}async function h(I,z){const H=rn(I);return await x(H,z),new Promise(v=>v(H))}function y(I){if(d){const z=rn(I),H=d.property("__zoom");(H.k!==I.zoom||H.x!==I.x||H.y!==I.y)&&f?.transform(d,z,null,{sync:!0})}}function S(){const I=d?br(d.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function E(I,z){return d?new Promise(H=>{f?.interpolate(z?.interpolate==="linear"?Jt:Nt).scaleTo(sn(d,z?.duration,z?.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function C(I,z){return d?new Promise(H=>{f?.interpolate(z?.interpolate==="linear"?Jt:Nt).scaleBy(sn(d,z?.duration,z?.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function P(I){f?.scaleExtent(I)}function D(I){f?.translateExtent(I)}function V(I){const z=!fe(I)||I<0?0:I;f?.clickDistance(z)}return{update:w,destroy:m,setViewport:h,setViewportConstrained:b,getViewport:S,scaleTo:E,scaleBy:C,setScaleExtent:P,setTranslateExtent:D,syncViewport:y,setClickDistance:V}}var Ze;(function(e){e.Line="line",e.Handle="handle"})(Ze||(Ze={}));function id({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,c=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(c[0]=c[0]*-1),a&&s&&(c[1]=c[1]*-1),c}function vo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ee(e,t){return Math.max(0,t-e)}function Se(e,t){return Math.max(0,e-t)}function vt(e,t,n){return Math.max(0,t-e,e-n)}function _o(e,t){return e?!t:t}function sd(e,t,n,o,r,s,i,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:g,ySnapped:p}=n,{minWidth:x,maxWidth:w,minHeight:m,maxHeight:b}=o,{x:h,y,width:S,height:E,aspectRatio:C}=e;let P=Math.floor(u?g-e.pointerX:0),D=Math.floor(f?p-e.pointerY:0);const V=S+(c?-P:P),I=E+(l?-D:D),z=-s[0]*S,H=-s[1]*E;let v=vt(V,x,w),M=vt(I,m,b);if(i){let k=0,T=0;c&&P<0?k=Ee(h+P+z,i[0][0]):!c&&P>0&&(k=Se(h+V+z,i[1][0])),l&&D<0?T=Ee(y+D+H,i[0][1]):!l&&D>0&&(T=Se(y+I+H,i[1][1])),v=Math.max(v,k),M=Math.max(M,T)}if(a){let k=0,T=0;c&&P>0?k=Se(h+P,a[0][0]):!c&&P<0&&(k=Ee(h+V,a[1][0])),l&&D>0?T=Se(y+D,a[0][1]):!l&&D<0&&(T=Ee(y+I,a[1][1])),v=Math.max(v,k),M=Math.max(M,T)}if(r){if(u){const k=vt(V/C,m,b)*C;if(v=Math.max(v,k),i){let T=0;!c&&!l||c&&!l&&d?T=Se(y+H+V/C,i[1][1])*C:T=Ee(y+H+(c?P:-P)/C,i[0][1])*C,v=Math.max(v,T)}if(a){let T=0;!c&&!l||c&&!l&&d?T=Ee(y+V/C,a[1][1])*C:T=Se(y+(c?P:-P)/C,a[0][1])*C,v=Math.max(v,T)}}if(f){const k=vt(I*C,x,w)/C;if(M=Math.max(M,k),i){let T=0;!c&&!l||l&&!c&&d?T=Se(h+I*C+z,i[1][0])/C:T=Ee(h+(l?D:-D)*C+z,i[0][0])/C,M=Math.max(M,T)}if(a){let T=0;!c&&!l||l&&!c&&d?T=Ee(h+I*C,a[1][0])/C:T=Se(h+(l?D:-D)*C,a[0][0])/C,M=Math.max(M,T)}}}D=D+(D<0?M:-M),P=P+(P<0?v:-v),r&&(d?V>I*C?D=(_o(c,l)?-P:P)/C:P=(_o(c,l)?-D:D)*C:u?(D=P/C,l=c):(P=D*C,c=l));const N=c?h+P:h,A=l?y+D:y;return{width:S+(c?-P:P),height:E+(l?-D:D),x:s[0]*P*(c?-1:1)+N,y:s[1]*D*(l?-1:1)+A}}const Qr={width:0,height:0,x:0,y:0},ad={...Qr,pointerX:0,pointerY:0,aspectRatio:1};function cd(e){return[[0,0],[e.measured.width,e.measured.height]]}function ld(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,c=n[1]*i;return[[o-a,r-c],[o+s-a,r+i-c]]}function ud({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ce(e);let i={controlDirection:vo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:g,onResize:p,onResizeEnd:x,shouldResize:w}){let m={...Qr},b={...ad};i={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:vo(l)};let h,y=null,S=[],E,C,P,D=!1;const V=fr().on("start",I=>{const{nodeLookup:z,transform:H,snapGrid:v,snapToGrid:M,nodeOrigin:N,paneDomNode:A}=n();if(h=z.get(t),!h)return;y=A?.getBoundingClientRect()??null;const{xSnapped:k,ySnapped:T}=tt(I.sourceEvent,{transform:H,snapGrid:v,snapToGrid:M,containerBounds:y});m={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},b={...m,pointerX:k,pointerY:T,aspectRatio:m.width/m.height},E=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(E=z.get(h.parentId),C=E&&h.extent==="parent"?cd(E):void 0),S=[],P=void 0;for(const[L,j]of z)if(j.parentId===t&&(S.push({id:L,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const R=ld(j,h,j.origin??N);P?P=[[Math.min(R[0][0],P[0][0]),Math.min(R[0][1],P[0][1])],[Math.max(R[1][0],P[1][0]),Math.max(R[1][1],P[1][1])]]:P=R}g?.(I,{...m})}).on("drag",I=>{const{transform:z,snapGrid:H,snapToGrid:v,nodeOrigin:M}=n(),N=tt(I.sourceEvent,{transform:z,snapGrid:H,snapToGrid:v,containerBounds:y}),A=[];if(!h)return;const{x:k,y:T,width:L,height:j}=m,R={},F=h.origin??M,{width:B,height:W,x:K,y:Z}=sd(b,i.controlDirection,N,i.boundaries,i.keepAspectRatio,F,C,P),O=B!==L,Y=W!==j,Q=K!==k&&O,U=Z!==T&&Y;if(!Q&&!U&&!O&&!Y)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:m.x,R.y=U?Z:m.y,m.x=R.x,m.y=R.y,S.length>0)){const ne=K-k,te=Z-T;for(const ae of S)ae.position={x:ae.position.x-ne+F[0]*(B-L),y:ae.position.y-te+F[1]*(W-j)},A.push(ae)}if((O||Y)&&(R.width=O&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:m.width,R.height=Y&&(!i.resizeDirection||i.resizeDirection==="vertical")?W:m.height,m.width=R.width,m.height=R.height),E&&h.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(m.x=ne,b.x=b.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(m.y=te,b.y=b.y-(R.y-te))}const q=id({width:m.width,prevWidth:L,height:m.height,prevHeight:j,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),G={...m,direction:q};w?.(I,G)!==!1&&(D=!0,p?.(I,G),o(R,A))}).on("end",I=>{D&&(x?.(I,{...m}),r?.({...m}),D=!1)});s.call(V)}function c(){s.on(".drag",null)}return{update:a,destroy:c}}const dd={},bo=e=>{let t;const n=new Set,o=(u,f)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const g=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(p=>p(t,g))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(dd?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},fd=e=>e?bo(e):bo,{useDebugValue:hd}=js,{useSyncExternalStoreWithSelector:gd}=Rs,pd=e=>e;function Jr(e,t=pd,n){const o=gd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hd(o),o}const Eo=(e,t)=>{const n=fd(e),o=(r,s=t)=>Jr(n,r,s);return Object.assign(o,n),o},md=(e,t)=>e?Eo(e,t):Eo;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Zt=$.createContext(null),yd=Zt.Provider,ei=pe.error001();function J(e,t){const n=$.useContext(Zt);if(n===null)throw new Error(ei);return Jr(n,e,t)}function re(){const e=$.useContext(Zt);if(e===null)throw new Error(ei);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const So={display:"none"},xd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ti="react-flow__node-desc",ni="react-flow__edge-desc",wd="react-flow__aria-live",vd=e=>e.ariaLiveMessage,_d=e=>e.ariaLabelConfig;function bd({rfId:e}){const t=J(vd);return _.jsx("div",{id:`${wd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:xd,children:t})}function Ed({rfId:e,disableKeyboardA11y:t}){const n=J(_d);return _.jsxs(_.Fragment,{children:[_.jsx("div",{id:`${ti}-${e}`,style:So,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),_.jsx("div",{id:`${ni}-${e}`,style:So,children:n["edge.a11yDescription.default"]}),!t&&_.jsx(bd,{rfId:e})]})}const Wt=$.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return _.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Wt.displayName="Panel";function Sd({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:_.jsx(Wt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:_.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Nd=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},_t=e=>e.id;function Cd(e,t){return oe(e.selectedNodes.map(_t),t.selectedNodes.map(_t))&&oe(e.selectedEdges.map(_t),t.selectedEdges.map(_t))}function Md({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Nd,Cd);return $.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Id=e=>!!e.onSelectionChangeHandlers;function kd({onSelectionChange:e}){const t=J(Id);return e||t?_.jsx(Md,{onSelectionChange:e}):null}const oi=[0,0],Ad={x:0,y:0,zoom:1},Pd=["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"],No=[...Pd,"rfId"],Dd=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Co={translateExtent:it,nodeOrigin:oi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Td(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:c}=J(Dd,oe),l=re();$.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Co,a()}),[]);const u=$.useRef(Co);return $.useEffect(()=>{for(const f of No){const d=e[f],g=u.current[f];d!==g&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?s(d):f==="nodeExtent"?i(d):f==="ariaLabelConfig"?l.setState({ariaLabelConfig:bu(d)}):f==="fitView"?l.setState({fitViewQueued:d}):f==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[f]:d})))}u.current=e},No.map(f=>e[f])),null}function Mo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function zd(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const o=Mo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Mo()?.matches?"dark":"light"}const Io=typeof document<"u"?document:null;function lt(e=null,t={target:Io,actInsideInputWithModifier:!0}){const[n,o]=$.useState(!1),r=$.useRef(!1),s=$.useRef(new Set([])),[i,a]=$.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
1
+ import{F as Rs,H as js,r as $,j as _,c as ue,f as _n,k as Vs,a as Os}from"./index-lLPOJwFP.js";import{C as se,a as Bs}from"./index-BEGxRCwV.js";import{E as Wo}from"./error-boundary-CiihS5J_.js";import{u as Fs}from"./localstorage-keys-CrsmSVIa.js";import{u as bn}from"./project-context-provider-BMHXD39x.js";import{c as qo,B as Go}from"./button-C0pnkZlC.js";import{V as Xs}from"./view-mode-toggle-C7lGZNG7.js";import{i as Ys}from"./GitBranch01-Bc0tKWvO.js";import{t as Ko}from"./MessageChatSquare-B8VNN8W_.js";import{s as Zs}from"./Plus-DjzFfDDP.js";import{c as Ws}from"./connection-CMutAR-q.js";import{I as Uo,n as qs}from"./empty-state-BOQ8a8rM.js";import{u as Gs,i as Ks}from"./use-gateway-Blme6XE1.js";import{u as Us}from"./use-connection-BvgGy_ae.js";import{u as Qs}from"./use-tool-call-q6DaczOv.js";import{i as ke,a as Gn,b as Js,c as Kn,d as Jt,T as en,e as ea}from"./value-_3bvT1Yq.js";import"./X-CBga9b95.js";import"./popover-pNwa1deQ.js";import"./textarea-fD103gtG.js";import"./AlertCircle-rclbzics.js";import"./ArrowUp-BsQNKzS-.js";import"./ChevronDown-CGAmRXVd.js";import"./Edit01-CkDEl3XN.js";import"./use-collections-DiH8BH96.js";import"./useMutation-8xrpFP-l.js";import"./use-binding-bdIG4ysm.js";import"./binder-BxrAqFdA.js";import"./use-gateway-system-prompt-DfRYNjlK.js";import"./input-BtvEWyY7.js";import"./tooltip-D0yN_jPS.js";import"./Check-C2R_Lcai.js";import"./SearchMd-Cg2el-z8.js";import"./use-create-gateway-DWTCcW8J.js";import"./select-COJ5S7Rq.js";import"./File06-DcfM98WM.js";import"./Grid01-SL4tYH2-.js";import"./Image01-BQtv4av4.js";import"./Copy01-BvrgG3_u.js";import"./Terminal-Kg8grfTZ.js";import"./monaco-editor-h8_XpHnI.js";import"./spinner-Deoz6N0J.js";import"./alert-dialog-BNxiLvEc.js";import"./well-known-mcp-DOEdYmKO.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-BnAfsqRe.js";import"./useQuery-CLJFoOtO.js";function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var ta={value:()=>{}};function Rt(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new St(n)}function St(e){this._=e}function na(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}St.prototype=Rt.prototype={constructor:St,on:function(e,t){var n=this._,o=na(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=oa(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=Un(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Un(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new St(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function oa(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Un(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ta,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var ln="http://www.w3.org/1999/xhtml";const Qn={svg:"http://www.w3.org/2000/svg",xhtml:ln,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function jt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Qn.hasOwnProperty(t)?{space:Qn[t],local:e}:e}function ra(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ln&&t.documentElement.namespaceURI===ln?t.createElement(e):t.createElementNS(n,e)}}function ia(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Qo(e){var t=jt(e);return(t.local?ia:ra)(t)}function sa(){}function En(e){return e==null?sa:function(){return this.querySelector(e)}}function aa(e){typeof e!="function"&&(e=En(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),c,l,u=0;u<i;++u)(c=s[u])&&(l=e.call(c,c.__data__,u,s))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(o,this._parents)}function ca(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function la(){return[]}function Jo(e){return e==null?la:function(){return this.querySelectorAll(e)}}function ua(e){return function(){return ca(e.apply(this,arguments))}}function da(e){typeof e=="function"?e=ua(e):e=Jo(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,c,l=0;l<a;++l)(c=i[l])&&(o.push(e.call(c,c.__data__,l,i)),r.push(c));return new le(o,r)}function er(e){return function(){return this.matches(e)}}function tr(e){return function(t){return t.matches(e)}}var fa=Array.prototype.find;function ha(e){return function(){return fa.call(this.children,e)}}function ga(){return this.firstElementChild}function pa(e){return this.select(e==null?ga:ha(typeof e=="function"?e:tr(e)))}var ma=Array.prototype.filter;function ya(){return Array.from(this.children)}function xa(e){return function(){return ma.call(this.children,e)}}function wa(e){return this.selectAll(e==null?ya:xa(typeof e=="function"?e:tr(e)))}function va(e){typeof e!="function"&&(e=er(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],c,l=0;l<i;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new le(o,this._parents)}function nr(e){return new Array(e.length)}function _a(){return new le(this._enter||this._groups.map(nr),this._parents)}function kt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}kt.prototype={constructor:kt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ba(e){return function(){return e}}function Ea(e,t,n,o,r,s){for(var i=0,a,c=t.length,l=s.length;i<l;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new kt(e,s[i]);for(;i<c;++i)(a=t[i])&&(r[i]=a)}function Sa(e,t,n,o,r,s,i){var a,c,l=new Map,u=t.length,f=s.length,d=new Array(u),g;for(a=0;a<u;++a)(c=t[a])&&(d[a]=g=i.call(c,c.__data__,a,t)+"",l.has(g)?r[a]=c:l.set(g,c));for(a=0;a<f;++a)g=i.call(e,s[a],a,s)+"",(c=l.get(g))?(o[a]=c,c.__data__=s[a],l.delete(g)):n[a]=new kt(e,s[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(r[a]=c)}function Na(e){return e.__data__}function Ca(e,t){if(!arguments.length)return Array.from(this,Na);var n=t?Sa:Ea,o=this._parents,r=this._groups;typeof e!="function"&&(e=ba(e));for(var s=r.length,i=new Array(s),a=new Array(s),c=new Array(s),l=0;l<s;++l){var u=o[l],f=r[l],d=f.length,g=Ma(e.call(u,u&&u.__data__,l,o)),p=g.length,x=a[l]=new Array(p),w=i[l]=new Array(p),m=c[l]=new Array(d);n(u,f,x,w,m,g,t);for(var b=0,h=0,y,S;b<p;++b)if(y=x[b]){for(b>=h&&(h=b+1);!(S=w[h])&&++h<p;);y._next=S||null}}return i=new le(i,o),i._enter=a,i._exit=c,i}function Ma(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ia(){return new le(this._exit||this._groups.map(nr),this._parents)}function ka(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function Aa(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),c=0;c<i;++c)for(var l=n[c],u=o[c],f=l.length,d=a[c]=new Array(f),g,p=0;p<f;++p)(g=l[p]||u[p])&&(d[p]=g);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function Pa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Da(e){e||(e=Ta);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,c=r[s]=new Array(a),l,u=0;u<a;++u)(l=i[u])&&(c[u]=l);c.sort(t)}return new le(r,this._parents).order()}function Ta(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function za(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function $a(){return Array.from(this)}function Ha(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function La(){let e=0;for(const t of this)++e;return e}function Ra(){return!this.node()}function ja(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function Va(e){return function(){this.removeAttribute(e)}}function Oa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ba(e,t){return function(){this.setAttribute(e,t)}}function Fa(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Xa(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ya(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Za(e,t){var n=jt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Oa:Va:typeof t=="function"?n.local?Ya:Xa:n.local?Fa:Ba)(n,t))}function or(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Wa(e){return function(){this.style.removeProperty(e)}}function qa(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ga(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Ka(e,t,n){return arguments.length>1?this.each((t==null?Wa:typeof t=="function"?Ga:qa)(e,t,n??"")):Ve(this.node(),e)}function Ve(e,t){return e.style.getPropertyValue(t)||or(e).getComputedStyle(e,null).getPropertyValue(t)}function Ua(e){return function(){delete this[e]}}function Qa(e,t){return function(){this[e]=t}}function Ja(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ec(e,t){return arguments.length>1?this.each((t==null?Ua:typeof t=="function"?Ja:Qa)(e,t)):this.node()[e]}function rr(e){return e.trim().split(/^|\s+/)}function Sn(e){return e.classList||new ir(e)}function ir(e){this._node=e,this._names=rr(e.getAttribute("class")||"")}ir.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function sr(e,t){for(var n=Sn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function ar(e,t){for(var n=Sn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function tc(e){return function(){sr(this,e)}}function nc(e){return function(){ar(this,e)}}function oc(e,t){return function(){(t.apply(this,arguments)?sr:ar)(this,e)}}function rc(e,t){var n=rr(e+"");if(arguments.length<2){for(var o=Sn(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?oc:t?tc:nc)(n,t))}function ic(){this.textContent=""}function sc(e){return function(){this.textContent=e}}function ac(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function cc(e){return arguments.length?this.each(e==null?ic:(typeof e=="function"?ac:sc)(e)):this.node().textContent}function lc(){this.innerHTML=""}function uc(e){return function(){this.innerHTML=e}}function dc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function fc(e){return arguments.length?this.each(e==null?lc:(typeof e=="function"?dc:uc)(e)):this.node().innerHTML}function hc(){this.nextSibling&&this.parentNode.appendChild(this)}function gc(){return this.each(hc)}function pc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mc(){return this.each(pc)}function yc(e){var t=typeof e=="function"?e:Qo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function xc(){return null}function wc(e,t){var n=typeof e=="function"?e:Qo(e),o=t==null?xc:typeof t=="function"?t:En(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function vc(){var e=this.parentNode;e&&e.removeChild(this)}function _c(){return this.each(vc)}function bc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ec(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Sc(e){return this.select(e?Ec:bc)}function Nc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Cc(e){return function(t){e.call(this,t,this.__data__)}}function Mc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ic(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function kc(e,t,n){return function(){var o=this.__on,r,s=Cc(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function Ac(e,t,n){var o=Mc(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?kc:Ic,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function cr(e,t,n){var o=or(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Pc(e,t){return function(){return cr(this,e,t)}}function Dc(e,t){return function(){return cr(this,e,t.apply(this,arguments))}}function Tc(e,t){return this.each((typeof t=="function"?Dc:Pc)(e,t))}function*zc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var lr=[null];function le(e,t){this._groups=e,this._parents=t}function ut(){return new le([[document.documentElement]],lr)}function $c(){return this}le.prototype=ut.prototype={constructor:le,select:aa,selectAll:da,selectChild:pa,selectChildren:wa,filter:va,data:Ca,enter:_a,exit:Ia,join:ka,merge:Aa,selection:$c,order:Pa,sort:Da,call:za,nodes:$a,node:Ha,size:La,empty:Ra,each:ja,attr:Za,style:Ka,property:ec,classed:rc,text:cc,html:fc,raise:gc,lower:mc,append:yc,insert:wc,remove:_c,clone:Sc,datum:Nc,on:Ac,dispatch:Tc,[Symbol.iterator]:zc};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],lr)}function Hc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Hc(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Lc={passive:!1},ot={capture:!0,passive:!1};function tn(e){e.stopImmediatePropagation()}function je(e){e.preventDefault(),e.stopImmediatePropagation()}function ur(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",je,ot);"onselectstart"in t?n.on("selectstart.drag",je,ot):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function dr(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",je,ot),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const mt=e=>()=>e;function un(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}un.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Rc(e){return!e.ctrlKey&&!e.button}function jc(){return this.parentNode}function Vc(e,t){return t??{x:e.x,y:e.y}}function Oc(){return navigator.maxTouchPoints||"ontouchstart"in this}function fr(){var e=Rc,t=jc,n=Vc,o=Oc,r={},s=Rt("start","drag","end"),i=0,a,c,l,u,f=0;function d(y){y.on("mousedown.drag",g).filter(o).on("touchstart.drag",w).on("touchmove.drag",m,Lc).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(y,S){if(!(u||!e.call(this,y,S))){var E=h(this,t.call(this,y,S),y,S,"mouse");E&&(ce(y.view).on("mousemove.drag",p,ot).on("mouseup.drag",x,ot),ur(y.view),tn(y),l=!1,a=y.clientX,c=y.clientY,E("start",y))}}function p(y){if(je(y),!l){var S=y.clientX-a,E=y.clientY-c;l=S*S+E*E>f}r.mouse("drag",y)}function x(y){ce(y.view).on("mousemove.drag mouseup.drag",null),dr(y.view,l),je(y),r.mouse("end",y)}function w(y,S){if(e.call(this,y,S)){var E=y.changedTouches,C=t.call(this,y,S),P=E.length,D,V;for(D=0;D<P;++D)(V=h(this,C,y,S,E[D].identifier,E[D]))&&(tn(y),V("start",y,E[D]))}}function m(y){var S=y.changedTouches,E=S.length,C,P;for(C=0;C<E;++C)(P=r[S[C].identifier])&&(je(y),P("drag",y,S[C]))}function b(y){var S=y.changedTouches,E=S.length,C,P;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<E;++C)(P=r[S[C].identifier])&&(tn(y),P("end",y,S[C]))}function h(y,S,E,C,P,D){var V=s.copy(),I=de(D||E,S),z,H,v;if((v=n.call(y,new un("beforestart",{sourceEvent:E,target:d,identifier:P,active:i,x:I[0],y:I[1],dx:0,dy:0,dispatch:V}),C))!=null)return z=v.x-I[0]||0,H=v.y-I[1]||0,function M(N,A,k){var T=I,L;switch(N){case"start":r[P]=M,L=i++;break;case"end":delete r[P],--i;case"drag":I=de(k||A,S),L=i;break}V.call(N,y,new un(N,{sourceEvent:A,subject:v,target:d,identifier:P,active:L,x:I[0]+z,y:I[1]+H,dx:I[0]-T[0],dy:I[1]-T[1],dispatch:V}),C)}}return d.filter=function(y){return arguments.length?(e=typeof y=="function"?y:mt(!!y),d):e},d.container=function(y){return arguments.length?(t=typeof y=="function"?y:mt(y),d):t},d.subject=function(y){return arguments.length?(n=typeof y=="function"?y:mt(y),d):n},d.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:mt(!!y),d):o},d.on=function(){var y=s.on.apply(s,arguments);return y===s?d:y},d.clickDistance=function(y){return arguments.length?(f=(y=+y)*y,d):Math.sqrt(f)},d}var Jn=180/Math.PI,dn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function hr(e,t,n,o,r,s){var i,a,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*Jn,skewX:Math.atan(c)*Jn,scaleX:i,scaleY:a}}var yt;function Bc(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?dn:hr(t.a,t.b,t.c,t.d,t.e,t.f)}function Fc(e){return e==null||(yt||(yt=document.createElementNS("http://www.w3.org/2000/svg","g")),yt.setAttribute("transform",e),!(e=yt.transform.baseVal.consolidate()))?dn:(e=e.matrix,hr(e.a,e.b,e.c,e.d,e.e,e.f))}function gr(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function s(l,u,f,d,g,p){if(l!==f||u!==d){var x=g.push("translate(",null,t,null,n);p.push({i:x-4,x:ke(l,f)},{i:x-2,x:ke(u,d)})}else(f||d)&&g.push("translate("+f+t+d+n)}function i(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:ke(l,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(l,u,f,d){l!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:ke(l,u)}):u&&f.push(r(f)+"skewX("+u+o)}function c(l,u,f,d,g,p){if(l!==f||u!==d){var x=g.push(r(g)+"scale(",null,",",null,")");p.push({i:x-4,x:ke(l,f)},{i:x-2,x:ke(u,d)})}else(f!==1||d!==1)&&g.push(r(g)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),s(l.translateX,l.translateY,u.translateX,u.translateY,f,d),i(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(g){for(var p=-1,x=d.length,w;++p<x;)f[(w=d[p]).i]=w.x(g);return f.join("")}}}var Xc=gr(Bc,"px, ","px)","deg)"),Yc=gr(Fc,", ",")",")"),Zc=1e-12;function eo(e){return((e=Math.exp(e))+1/e)/2}function Wc(e){return((e=Math.exp(e))-1/e)/2}function qc(e){return((e=Math.exp(2*e))-1)/(e+1)}const Nt=(function e(t,n,o){function r(s,i){var a=s[0],c=s[1],l=s[2],u=i[0],f=i[1],d=i[2],g=u-a,p=f-c,x=g*g+p*p,w,m;if(x<Zc)m=Math.log(d/l)/t,w=function(C){return[a+C*g,c+C*p,l*Math.exp(t*C*m)]};else{var b=Math.sqrt(x),h=(d*d-l*l+o*x)/(2*l*n*b),y=(d*d-l*l-o*x)/(2*d*n*b),S=Math.log(Math.sqrt(h*h+1)-h),E=Math.log(Math.sqrt(y*y+1)-y);m=(E-S)/t,w=function(C){var P=C*m,D=eo(S),V=l/(n*b)*(D*qc(t*P+S)-Wc(S));return[a+V*g,c+V*p,l*D/eo(t*P+S)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,c=a*a;return e(i,a,c)},r})(Math.SQRT2,2,4);var Oe=0,Je=0,Ue=0,pr=1e3,At,et,Pt=0,De=0,Vt=0,rt=typeof performance=="object"&&performance.now?performance:Date,mr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Nn(){return De||(mr(Gc),De=rt.now()+Vt)}function Gc(){De=0}function Dt(){this._call=this._time=this._next=null}Dt.prototype=yr.prototype={constructor:Dt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Nn():+n)+(t==null?0:+t),!this._next&&et!==this&&(et?et._next=this:At=this,et=this),this._call=e,this._time=n,fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,fn())}};function yr(e,t,n){var o=new Dt;return o.restart(e,t,n),o}function Kc(){Nn(),++Oe;for(var e=At,t;e;)(t=De-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Oe}function to(){De=(Pt=rt.now())+Vt,Oe=Je=0;try{Kc()}finally{Oe=0,Qc(),De=0}}function Uc(){var e=rt.now(),t=e-Pt;t>pr&&(Vt-=t,Pt=e)}function Qc(){for(var e,t=At,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:At=n);et=e,fn(o)}function fn(e){if(!Oe){Je&&(Je=clearTimeout(Je));var t=e-De;t>24?(e<1/0&&(Je=setTimeout(to,e-rt.now()-Vt)),Ue&&(Ue=clearInterval(Ue))):(Ue||(Pt=rt.now(),Ue=setInterval(Uc,pr)),Oe=1,mr(to))}}function no(e,t,n){var o=new Dt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Jc=Rt("start","end","cancel","interrupt"),el=[],xr=0,oo=1,hn=2,Ct=3,ro=4,gn=5,Mt=6;function Ot(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;tl(e,n,{name:t,index:o,group:r,on:Jc,tween:el,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:xr})}function Cn(e,t){var n=ge(e,t);if(n.state>xr)throw new Error("too late; already scheduled");return n}function me(e,t){var n=ge(e,t);if(n.state>Ct)throw new Error("too late; already running");return n}function ge(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function tl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=yr(s,0,n.time);function s(l){n.state=oo,n.timer.restart(i,n.delay,n.time),n.delay<=l&&i(l-n.delay)}function i(l){var u,f,d,g;if(n.state!==oo)return c();for(u in o)if(g=o[u],g.name===n.name){if(g.state===Ct)return no(i);g.state===ro?(g.state=Mt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Mt,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(no(function(){n.state===Ct&&(n.state=ro,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=hn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===hn){for(n.state=Ct,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=g);r.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=gn,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===gn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Mt,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function It(e,t){var n=e.__transition,o,r,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>hn&&o.state<gn,o.state=Mt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function nl(e){return this.each(function(){It(this,e)})}function ol(e,t){var n,o;return function(){var r=me(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function rl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=me(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}s.tween=r}}function il(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ge(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?ol:rl)(n,e,t))}function Mn(e,t,n){var o=e._id;return e.each(function(){var r=me(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ge(r,o).value[t]}}function wr(e,t){var n;return(typeof t=="number"?ke:t instanceof Kn?Gn:(n=Kn(t))?(t=n,Gn):Js)(e,t)}function sl(e){return function(){this.removeAttribute(e)}}function al(e){return function(){this.removeAttributeNS(e.space,e.local)}}function cl(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function ll(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function ul(e,t,n){var o,r,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=a+"",i===c?null:i===o&&c===r?s:(r=c,s=t(o=i,a)))}}function dl(e,t,n){var o,r,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=a+"",i===c?null:i===o&&c===r?s:(r=c,s=t(o=i,a)))}}function fl(e,t){var n=jt(e),o=n==="transform"?Yc:wr;return this.attrTween(e,typeof t=="function"?(n.local?dl:ul)(n,o,Mn(this,"attr."+e,t)):t==null?(n.local?al:sl)(n):(n.local?ll:cl)(n,o,t))}function hl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function gl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function pl(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&gl(e,s)),n}return r._value=t,r}function ml(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&hl(e,s)),n}return r._value=t,r}function yl(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=jt(e);return this.tween(n,(o.local?pl:ml)(o,t))}function xl(e,t){return function(){Cn(this,e).delay=+t.apply(this,arguments)}}function wl(e,t){return t=+t,function(){Cn(this,e).delay=t}}function vl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xl:wl)(t,e)):ge(this.node(),t).delay}function _l(e,t){return function(){me(this,e).duration=+t.apply(this,arguments)}}function bl(e,t){return t=+t,function(){me(this,e).duration=t}}function El(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_l:bl)(t,e)):ge(this.node(),t).duration}function Sl(e,t){if(typeof t!="function")throw new Error;return function(){me(this,e).ease=t}}function Nl(e){var t=this._id;return arguments.length?this.each(Sl(t,e)):ge(this.node(),t).ease}function Cl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;me(this,e).ease=n}}function Ml(e){if(typeof e!="function")throw new Error;return this.each(Cl(this._id,e))}function Il(e){typeof e!="function"&&(e=er(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],c,l=0;l<i;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new ve(o,this._parents,this._name,this._id)}function kl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var c=t[a],l=n[a],u=c.length,f=i[a]=new Array(u),d,g=0;g<u;++g)(d=c[g]||l[g])&&(f[g]=d);for(;a<o;++a)i[a]=t[a];return new ve(i,this._parents,this._name,this._id)}function Al(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Pl(e,t,n){var o,r,s=Al(t)?Cn:me;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Dl(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(Pl(n,e,t))}function Tl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function zl(){return this.on("end.remove",Tl(this._id))}function $l(e){var t=this._name,n=this._id;typeof e!="function"&&(e=En(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],c=a.length,l=s[i]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Ot(l[d],t,n,d,l,ge(u,n)));return new ve(s,this._parents,t,n)}function Hl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jo(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var c=o[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),g,p=ge(u,n),x=0,w=d.length;x<w;++x)(g=d[x])&&Ot(g,t,n,x,d,p);s.push(d),i.push(u)}return new ve(s,i,t,n)}var Ll=ut.prototype.constructor;function Rl(){return new Ll(this._groups,this._parents)}function jl(e,t){var n,o,r;return function(){var s=Ve(this,e),i=(this.style.removeProperty(e),Ve(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function vr(e){return function(){this.style.removeProperty(e)}}function Vl(e,t,n){var o,r=n+"",s;return function(){var i=Ve(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function Ol(e,t,n){var o,r,s;return function(){var i=Ve(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ve(this,e))),i===c?null:i===o&&c===r?s:(r=c,s=t(o=i,a))}}function Bl(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var c=me(this,e),l=c.on,u=c.value[s]==null?a||(a=vr(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(i,r=u),c.on=o}}function Fl(e,t,n){var o=(e+="")=="transform"?Xc:wr;return t==null?this.styleTween(e,jl(e,o)).on("end.style."+e,vr(e)):typeof t=="function"?this.styleTween(e,Ol(e,o,Mn(this,"style."+e,t))).each(Bl(this._id,e)):this.styleTween(e,Vl(e,o,t),n).on("end.style."+e,null)}function Xl(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Yl(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&Xl(e,i,n)),o}return s._value=t,s}function Zl(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Yl(e,t,n??""))}function Wl(e){return function(){this.textContent=e}}function ql(e){return function(){var t=e(this);this.textContent=t??""}}function Gl(e){return this.tween("text",typeof e=="function"?ql(Mn(this,"text",e)):Wl(e==null?"":e+""))}function Kl(e){return function(t){this.textContent=e.call(this,t)}}function Ul(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Kl(r)),t}return o._value=e,o}function Ql(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Ul(e))}function Jl(){for(var e=this._name,t=this._id,n=_r(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,c,l=0;l<a;++l)if(c=i[l]){var u=ge(c,t);Ot(c,e,n,l,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ve(o,this._parents,e,n)}function eu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},c={value:function(){--r===0&&s()}};n.each(function(){var l=me(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&s()})}var tu=0;function ve(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function _r(){return++tu}var xe=ut.prototype;ve.prototype={constructor:ve,select:$l,selectAll:Hl,selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:Il,merge:kl,selection:Rl,transition:Jl,call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:Dl,attr:fl,attrTween:yl,style:Fl,styleTween:Zl,text:Gl,textTween:Ql,remove:zl,tween:il,delay:vl,duration:El,ease:Nl,easeVarying:Ml,end:eu,[Symbol.iterator]:xe[Symbol.iterator]};function nu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ou={time:null,delay:0,duration:250,ease:nu};function ru(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function iu(e){var t,n;e instanceof ve?(t=e._id,e=e._name):(t=_r(),(n=ou).time=Nn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,c,l=0;l<a;++l)(c=i[l])&&Ot(c,e,t,l,i,n||ru(c,t));return new ve(o,this._parents,e,t)}ut.prototype.interrupt=nl;ut.prototype.transition=iu;const xt=e=>()=>e;function su(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function we(e,t,n){this.k=e,this.x=t,this.y=n}we.prototype={constructor:we,scale:function(e){return e===1?this:new we(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new we(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Bt=new we(1,0,0);br.prototype=we.prototype;function br(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Bt;return e.__zoom}function nn(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function au(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function cu(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function io(){return this.__zoom||Bt}function lu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function uu(){return navigator.maxTouchPoints||"ontouchstart"in this}function du(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Er(){var e=au,t=cu,n=du,o=lu,r=uu,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Nt,l=Rt("start","zoom","end"),u,f,d,g=500,p=150,x=0,w=10;function m(v){v.property("__zoom",io).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,M,N,A){var k=v.selection?v.selection():v;k.property("__zoom",io),v!==k?S(v,M,N,A):k.interrupt().each(function(){E(this,arguments).event(A).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},m.scaleBy=function(v,M,N,A){m.scaleTo(v,function(){var k=this.__zoom.k,T=typeof M=="function"?M.apply(this,arguments):M;return k*T},N,A)},m.scaleTo=function(v,M,N,A){m.transform(v,function(){var k=t.apply(this,arguments),T=this.__zoom,L=N==null?y(k):typeof N=="function"?N.apply(this,arguments):N,j=T.invert(L),R=typeof M=="function"?M.apply(this,arguments):M;return n(h(b(T,R),L,j),k,i)},N,A)},m.translateBy=function(v,M,N,A){m.transform(v,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,A)},m.translateTo=function(v,M,N,A,k){m.transform(v,function(){var T=t.apply(this,arguments),L=this.__zoom,j=A==null?y(T):typeof A=="function"?A.apply(this,arguments):A;return n(Bt.translate(j[0],j[1]).scale(L.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof N=="function"?-N.apply(this,arguments):-N),T,i)},A,k)};function b(v,M){return M=Math.max(s[0],Math.min(s[1],M)),M===v.k?v:new we(M,v.x,v.y)}function h(v,M,N){var A=M[0]-N[0]*v.k,k=M[1]-N[1]*v.k;return A===v.x&&k===v.y?v:new we(v.k,A,k)}function y(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function S(v,M,N,A){v.on("start.zoom",function(){E(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(A).end()}).tween("zoom",function(){var k=this,T=arguments,L=E(k,T).event(A),j=t.apply(k,T),R=N==null?y(j):typeof N=="function"?N.apply(k,T):N,F=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),B=k.__zoom,W=typeof M=="function"?M.apply(k,T):M,K=c(B.invert(R).concat(F/B.k),W.invert(R).concat(F/W.k));return function(Z){if(Z===1)Z=W;else{var O=K(Z),Y=F/O[2];Z=new we(Y,R[0]-O[0]*Y,R[1]-O[1]*Y)}L.zoom(null,Z)}})}function E(v,M,N){return!N&&v.__zooming||new C(v,M)}function C(v,M){this.that=v,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,M),this.taps=0}C.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,M){return this.mouse&&v!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var M=ce(this.that).datum();l.call(v,this.that,new su(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),M)}};function P(v,...M){if(!e.apply(this,arguments))return;var N=E(this,M).event(v),A=this.__zoom,k=Math.max(s[0],Math.min(s[1],A.k*Math.pow(2,o.apply(this,arguments)))),T=de(v);if(N.wheel)(N.mouse[0][0]!==T[0]||N.mouse[0][1]!==T[1])&&(N.mouse[1]=A.invert(N.mouse[0]=T)),clearTimeout(N.wheel);else{if(A.k===k)return;N.mouse=[T,A.invert(T)],It(this),N.start()}Qe(v),N.wheel=setTimeout(L,p),N.zoom("mouse",n(h(b(A,k),N.mouse[0],N.mouse[1]),N.extent,i));function L(){N.wheel=null,N.end()}}function D(v,...M){if(d||!e.apply(this,arguments))return;var N=v.currentTarget,A=E(this,M,!0).event(v),k=ce(v.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),T=de(v,N),L=v.clientX,j=v.clientY;ur(v.view),nn(v),A.mouse=[T,this.__zoom.invert(T)],It(this),A.start();function R(B){if(Qe(B),!A.moved){var W=B.clientX-L,K=B.clientY-j;A.moved=W*W+K*K>x}A.event(B).zoom("mouse",n(h(A.that.__zoom,A.mouse[0]=de(B,N),A.mouse[1]),A.extent,i))}function F(B){k.on("mousemove.zoom mouseup.zoom",null),dr(B.view,A.moved),Qe(B),A.event(B).end()}}function V(v,...M){if(e.apply(this,arguments)){var N=this.__zoom,A=de(v.changedTouches?v.changedTouches[0]:v,this),k=N.invert(A),T=N.k*(v.shiftKey?.5:2),L=n(h(b(N,T),A,k),t.apply(this,M),i);Qe(v),a>0?ce(this).transition().duration(a).call(S,L,A,v):ce(this).call(m.transform,L,A,v)}}function I(v,...M){if(e.apply(this,arguments)){var N=v.touches,A=N.length,k=E(this,M,v.changedTouches.length===A).event(v),T,L,j,R;for(nn(v),L=0;L<A;++L)j=N[L],R=de(j,this),R=[R,this.__zoom.invert(R),j.identifier],k.touch0?!k.touch1&&k.touch0[2]!==R[2]&&(k.touch1=R,k.taps=0):(k.touch0=R,T=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(k.taps<2&&(f=R[0],u=setTimeout(function(){u=null},g)),It(this),k.start())}}function z(v,...M){if(this.__zooming){var N=E(this,M).event(v),A=v.changedTouches,k=A.length,T,L,j,R;for(Qe(v),T=0;T<k;++T)L=A[T],j=de(L,this),N.touch0&&N.touch0[2]===L.identifier?N.touch0[0]=j:N.touch1&&N.touch1[2]===L.identifier&&(N.touch1[0]=j);if(L=N.that.__zoom,N.touch1){var F=N.touch0[0],B=N.touch0[1],W=N.touch1[0],K=N.touch1[1],Z=(Z=W[0]-F[0])*Z+(Z=W[1]-F[1])*Z,O=(O=K[0]-B[0])*O+(O=K[1]-B[1])*O;L=b(L,Math.sqrt(Z/O)),j=[(F[0]+W[0])/2,(F[1]+W[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(N.touch0)j=N.touch0[0],R=N.touch0[1];else return;N.zoom("touch",n(h(L,j,R),N.extent,i))}}function H(v,...M){if(this.__zooming){var N=E(this,M).event(v),A=v.changedTouches,k=A.length,T,L;for(nn(v),d&&clearTimeout(d),d=setTimeout(function(){d=null},g),T=0;T<k;++T)L=A[T],N.touch0&&N.touch0[2]===L.identifier?delete N.touch0:N.touch1&&N.touch1[2]===L.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(L=de(L,this),Math.hypot(f[0]-L[0],f[1]-L[1])<w)){var j=ce(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:xt(+v),m):o},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:xt(!!v),m):e},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:xt(!!v),m):r},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:xt([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):t},m.scaleExtent=function(v){return arguments.length?(s[0]=+v[0],s[1]=+v[1],m):[s[0],s[1]]},m.translateExtent=function(v){return arguments.length?(i[0][0]=+v[0][0],i[1][0]=+v[1][0],i[0][1]=+v[0][1],i[1][1]=+v[1][1],m):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(x=(v=+v)*v,m):Math.sqrt(x)},m.tapDistance=function(v){return arguments.length?(w=+v,m):w},m}const pe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},it=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Sr=["Enter"," ","Escape"],Nr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Be;(function(e){e.Strict="strict",e.Loose="loose"})(Be||(Be={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var st;(function(e){e.Partial="partial",e.Full="full"})(st||(st={}));const Cr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ne;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ne||(Ne={}));var Tt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Tt||(Tt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const so={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function Mr(e){return e===null?null:e?"valid":"invalid"}const Ir=e=>"id"in e&&"source"in e&&"target"in e,fu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),In=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),dt=(e,t=[0,0])=>{const{width:n,height:o}=_e(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},hu=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):In(r)?r:t.nodeLookup.get(r.id));const a=i?zt(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ft(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Xt(n)},ft=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=Ft(n,zt(r)),o=!0)}),o?Xt(n):{x:0,y:0,width:0,height:0}},kn=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...gt(t,[n,o,r]),width:t.width/r,height:t.height/r},c=[];for(const l of e.values()){const{measured:u,selectable:f=!0,hidden:d=!1}=l;if(i&&!f||d)continue;const g=u.width??l.width??l.initialWidth??null,p=u.height??l.height??l.initialHeight??null,x=at(a,Xe(l)),w=(g??0)*(p??0),m=s&&x>0;(!l.internals.handleBounds||m||x>=w||l.dragging)&&c.push(l)}return c},gu=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function pu(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function mu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=pu(e,i),c=ft(a),l=An(c,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(l,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function kr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let f=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",pe.error005());else{const g=a.measured.width,p=a.measured.height;g&&p&&(f=[[c,l],[c+g,l+p]])}else a&&Ye(i.extent)&&(f=[[i.extent[0][0]+c,i.extent[0][1]+l],[i.extent[1][0]+c,i.extent[1][1]+l]]);const d=Ye(f)?Te(t,f,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",pe.error015()),{position:{x:d.x-c+(i.measured.width??0)*u[0],y:d.y-l+(i.measured.height??0)*u[1]},positionAbsolute:d}}async function yu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(d=>d.id)),i=[];for(const d of n){if(d.deletable===!1)continue;const g=s.has(d.id),p=!g&&d.parentId&&i.find(x=>x.id===d.parentId);(g||p)&&i.push(d)}const a=new Set(t.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),u=gu(i,c);for(const d of c)a.has(d.id)&&!u.find(p=>p.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:i};const f=await r({nodes:i,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:i}:{edges:[],nodes:[]}:f}const Fe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Te=(e={x:0,y:0},t,n)=>({x:Fe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Fe(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ar(e,t,n){const{width:o,height:r}=_e(n),{x:s,y:i}=n.internals.positionAbsolute;return Te(e,[[s,i],[s+o,i+r]],t)}const ao=(e,t,n)=>e<t?Fe(Math.abs(e-t),1,t)/t:e>n?-Fe(Math.abs(e-n),1,t)/t:0,Pr=(e,t,n=15,o=40)=>{const r=ao(e.x,o,t.width-o)*n,s=ao(e.y,o,t.height-o)*n;return[r,s]},Ft=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),pn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Xt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Xe=(e,t=[0,0])=>{const{x:n,y:o}=In(e)?e.internals.positionAbsolute:dt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},zt=(e,t=[0,0])=>{const{x:n,y:o}=In(e)?e.internals.positionAbsolute:dt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Dr=(e,t)=>Xt(Ft(pn(e),pn(t))),at=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},co=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),xu=(e,t)=>{},ht=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),gt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?ht(a,i):a},$t=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function He(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wu(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=He(e,n),r=He(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=He(e.top??e.y??0,n),r=He(e.bottom??e.y??0,n),s=He(e.left??e.x??0,t),i=He(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vu(e,t,n,o,r,s){const{x:i,y:a}=$t(e,[t,n,o]),{x:c,y:l}=$t({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,f=s-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const An=(e,t,n,o,r,s)=>{const i=wu(s,t,n),a=(t-i.x)/e.width,c=(n-i.y)/e.height,l=Math.min(a,c),u=Fe(l,o,r),f=e.x+e.width/2,d=e.y+e.height/2,g=t/2-f*u,p=n/2-d*u,x=vu(e,g,p,u,t,n),w={left:Math.min(x.left-i.left,0),top:Math.min(x.top-i.top,0),right:Math.min(x.right-i.right,0),bottom:Math.min(x.bottom-i.bottom,0)};return{x:g-w.left+w.right,y:p-w.top+w.bottom,zoom:u}},ct=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function _e(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Tr(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function zr(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function lo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function _u(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function bu(e){return{...Nr,...e||{}}}function tt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=he(e),a=gt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:c,y:l}=n?ht(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Pn=e=>({width:e.offsetWidth,height:e.offsetHeight}),$r=e=>e?.getRootNode?.()||window?.document,Eu=["INPUT","SELECT","TEXTAREA"];function Hr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Eu.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Lr=e=>"clientX"in e,he=(e,t)=>{const n=Lr(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},uo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Pn(i)}})};function Rr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const c=e*.125+r*.375+i*.375+n*.125,l=t*.125+s*.375+a*.375+o*.125,u=Math.abs(c-e),f=Math.abs(l-t);return[c,l,u,f]}function wt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function fo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case X.Left:return[t-wt(t-o,s),n];case X.Right:return[t+wt(o-t,s),n];case X.Top:return[t,n-wt(n-r,s)];case X.Bottom:return[t,n+wt(r-n,s)]}}function jr({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:s=X.Top,curvature:i=.25}){const[a,c]=fo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[l,u]=fo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[f,d,g,p]=Rr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${o},${r}`,f,d,g,p]}function Vr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Su({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Nu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=Ft(zt(e),zt(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return at(i,Xt(s))>0}const Cu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Mu=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Iu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Cu;let r;return Ir(e)?r={...e}:r={...e,id:o(e)},Mu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Or({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=Vr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const ho={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},ku=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},go=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Au({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:s,stepPosition:i}){const a=ho[t],c=ho[o],l={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+c.x*s,y:n.y+c.y*s},f=ku({source:l,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",g=f[d];let p=[],x,w;const m={x:0,y:0},b={x:0,y:0},[,,h,y]=Vr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(x=r.x??l.x+(u.x-l.x)*i,w=r.y??(l.y+u.y)/2):(x=r.x??(l.x+u.x)/2,w=r.y??l.y+(u.y-l.y)*i);const E=[{x,y:l.y},{x,y:u.y}],C=[{x:l.x,y:w},{x:u.x,y:w}];a[d]===g?p=d==="x"?E:C:p=d==="x"?C:E}else{const E=[{x:l.x,y:u.y}],C=[{x:u.x,y:l.y}];if(d==="x"?p=a.x===g?C:E:p=a.y===g?E:C,t===o){const z=Math.abs(e[d]-n[d]);if(z<=s){const H=Math.min(s-1,s-z);a[d]===g?m[d]=(l[d]>e[d]?-1:1)*H:b[d]=(u[d]>n[d]?-1:1)*H}}if(t!==o){const z=d==="x"?"y":"x",H=a[d]===c[z],v=l[z]>u[z],M=l[z]<u[z];(a[d]===1&&(!H&&v||H&&M)||a[d]!==1&&(!H&&M||H&&v))&&(p=d==="x"?E:C)}const P={x:l.x+m.x,y:l.y+m.y},D={x:u.x+b.x,y:u.y+b.y},V=Math.max(Math.abs(P.x-p[0].x),Math.abs(D.x-p[0].x)),I=Math.max(Math.abs(P.y-p[0].y),Math.abs(D.y-p[0].y));V>=I?(x=(P.x+D.x)/2,w=p[0].y):(x=p[0].x,w=(P.y+D.y)/2)}return[[e,{x:l.x+m.x,y:l.y+m.y},...p,{x:u.x+b.x,y:u.y+b.y},n],x,w,h,y]}function Pu(e,t,n,o){const r=Math.min(go(e,t)/2,go(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*l},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${i+r*c}Q ${s},${i} ${s+r*a},${i}`}function mn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:s=X.Top,borderRadius:i=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){const[f,d,g,p,x]=Au({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:c},offset:l,stepPosition:u});return[f.reduce((m,b,h)=>{let y="";return h>0&&h<f.length-1?y=Pu(f[h-1],b,f[h+1],i):y=`${h===0?"M":"L"}${b.x} ${b.y}`,m+=y,m},""),d,g,p,x]}function po(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Du(e){const{sourceNode:t,targetNode:n}=e;if(!po(t)||!po(n))return null;const o=t.internals.handleBounds||mo(t.handles),r=n.internals.handleBounds||mo(n.handles),s=yo(o?.source??[],e.sourceHandle),i=yo(e.connectionMode===Be.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",pe.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||X.Bottom,c=i?.position||X.Top,l=ze(t,s,a),u=ze(n,i,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function mo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function ze(e,t,n=X.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??_e(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case X.Top:return{x:r+i/2,y:s};case X.Right:return{x:r+i,y:s+a/2};case X.Bottom:return{x:r+i/2,y:s+a};case X.Left:return{x:r,y:s+a/2}}}function yo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function yn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Tu(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=yn(c,t);s.has(l)||(i.push({id:l,color:c.color||n,...c}),s.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const Br=1e3,zu=10,Dn={nodeOrigin:[0,0],nodeExtent:it,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},$u={...Dn,checkEquality:!0};function Tn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Hu(e,t,n){const o=Tn(Dn,n);for(const r of e.values())if(r.parentId)$n(r,e,t,o);else{const s=dt(r,o.nodeOrigin),i=Ye(r.extent)?r.extent:o.nodeExtent,a=Te(s,i,_e(r));r.internals.positionAbsolute=a}}function Lu(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function zn(e){return e==="manual"}function xn(e,t,n,o={}){const r=Tn($u,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!zn(r.zIndexMode)?Br:0;let c=e.length>0;t.clear(),n.clear();for(const l of e){let u=i.get(l.id);if(r.checkEquality&&l===u?.internals.userNode)t.set(l.id,u);else{const f=dt(l,r.nodeOrigin),d=Ye(l.extent)?l.extent:r.nodeExtent,g=Te(f,d,_e(l));u={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:g,handleBounds:Lu(l,u),z:Fr(l,a,r.zIndexMode),userNode:l}},t.set(l.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(c=!1),l.parentId&&$n(u,t,n,o,s)}return c}function Ru(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function $n(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:c}=Tn(Dn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Ru(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*zu),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=s&&!zn(c)?Br:0,{x:d,y:g,z:p}=ju(e,u,i,a,f,c),{positionAbsolute:x}=e.internals,w=d!==x.x||g!==x.y;(w||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:d,y:g}:x,z:p}})}function Fr(e,t,n){const o=fe(e.zIndex)?e.zIndex:0;return zn(n)?o:o+(e.selected?t:0)}function ju(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,c=_e(e),l=dt(e,n),u=Ye(e.extent)?Te(l,e.extent,c):l;let f=Te({x:i+u.x,y:a+u.y},o,c);e.extent==="parent"&&(f=Ar(f,c,t));const d=Fr(e,r,s),g=t.internals.z??0;return{x:f.x,y:f.y,z:g>=d?g+1:d}}function Hn(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const c=s.get(i.parentId)?.expandedRect??Xe(a),l=Dr(c,i.rect);s.set(i.parentId,{expandedRect:l,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},c)=>{const l=a.internals.positionAbsolute,u=_e(a),f=a.origin??o,d=i.x<l.x?Math.round(Math.abs(l.x-i.x)):0,g=i.y<l.y?Math.round(Math.abs(l.y-i.y)):0,p=Math.max(u.width,Math.round(i.width)),x=Math.max(u.height,Math.round(i.height)),w=(p-u.width)*f[0],m=(x-u.height)*f[1];(d>0||g>0||w||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-d+w,y:a.position.y-g+m}}),n.get(c)?.forEach(b=>{e.some(h=>h.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+g}})})),(u.width<i.width||u.height<i.height||d||g)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:p+(d?f[0]*d-w:0),height:x+(g?f[1]*g-m:0)}})}),r}function Vu(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const g of e.values()){const p=t.get(g.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),c=!0;continue}const x=Pn(g.nodeElement),w=p.measured.width!==x.width||p.measured.height!==x.height;if(!!(x.width&&x.height&&(w||!p.internals.handleBounds||g.force))){const b=g.nodeElement.getBoundingClientRect(),h=Ye(p.extent)?p.extent:s;let{positionAbsolute:y}=p.internals;p.parentId&&p.extent==="parent"?y=Ar(y,x,t.get(p.parentId)):h&&(y=Te(y,h,x));const S={...p,measured:x,internals:{...p.internals,positionAbsolute:y,handleBounds:{source:uo("source",g.nodeElement,b,f,p.id),target:uo("target",g.nodeElement,b,f,p.id)}}};t.set(p.id,S),p.parentId&&$n(S,t,n,{nodeOrigin:r,zIndexMode:i}),c=!0,w&&(l.push({id:p.id,type:"dimensions",dimensions:x}),p.expandParent&&p.parentId&&d.push({id:p.id,parentId:p.parentId,rect:Xe(S,r)}))}}if(d.length>0){const g=Hn(d,t,n,r);l.push(...g)}return{changes:l,updatedInternals:c}}async function Ou({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function xo(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const c=o.get(i)||new Map;if(o.set(i,c.set(n,t)),s){i=`${r}-${e}-${s}`;const l=o.get(i)||new Map;o.set(i,l.set(n,t))}}function Xr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},l=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;xo("source",c,u,e,r,i),xo("target",c,l,e,s,a),t.set(o.id,o)}}function Yr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Yr(n,t):!1}function wo(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Bu(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!Yr(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function on({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const c=n.get(i)?.internals.userNode;c&&r.push({...c,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function Fu({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=ht(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Xu({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,c=!1,l={x:0,y:0},u=null,f=!1,d=null,g=!1,p=!1,x=null;function w({noDragClassName:b,handleSelector:h,domNode:y,isSelectable:S,nodeId:E,nodeClickDistance:C=0}){d=ce(y);function P({x:z,y:H}){const{nodeLookup:v,nodeExtent:M,snapGrid:N,snapToGrid:A,nodeOrigin:k,onNodeDrag:T,onSelectionDrag:L,onError:j,updateNodePositions:R}=t();s={x:z,y:H};let F=!1;const B=a.size>1,W=B&&M?pn(ft(a)):null,K=B&&A?Fu({dragItems:a,snapGrid:N,x:z,y:H}):null;for(const[Z,O]of a){if(!v.has(Z))continue;let Y={x:z-O.distance.x,y:H-O.distance.y};A&&(Y=K?{x:Math.round(Y.x+K.x),y:Math.round(Y.y+K.y)}:ht(Y,N));let Q=null;if(B&&M&&!O.extent&&W){const{positionAbsolute:G}=O.internals,ee=G.x-W.x+M[0][0],ne=G.x+O.measured.width-W.x2+M[1][0],te=G.y-W.y+M[0][1],ae=G.y+O.measured.height-W.y2+M[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:q}=kr({nodeId:Z,nextPosition:Y,nodeLookup:v,nodeExtent:Q||M,nodeOrigin:k,onError:j});F=F||O.position.x!==U.x||O.position.y!==U.y,O.position=U,O.internals.positionAbsolute=q}if(p=p||F,!!F&&(R(a,!0),x&&(o||T||!E&&L))){const[Z,O]=on({nodeId:E,dragItems:a,nodeLookup:v});o?.(x,a,Z,O),T?.(x,Z,O),E||L?.(x,O)}}async function D(){if(!u)return;const{transform:z,panBy:H,autoPanSpeed:v,autoPanOnNodeDrag:M}=t();if(!M){c=!1,cancelAnimationFrame(i);return}const[N,A]=Pr(l,u,v);(N!==0||A!==0)&&(s.x=(s.x??0)-N/z[2],s.y=(s.y??0)-A/z[2],await H({x:N,y:A})&&P(s)),i=requestAnimationFrame(D)}function V(z){const{nodeLookup:H,multiSelectionActive:v,nodesDraggable:M,transform:N,snapGrid:A,snapToGrid:k,selectNodesOnDrag:T,onNodeDragStart:L,onSelectionDragStart:j,unselectNodesAndEdges:R}=t();f=!0,(!T||!S)&&!v&&E&&(H.get(E)?.selected||R()),S&&T&&E&&e?.(E);const F=tt(z.sourceEvent,{transform:N,snapGrid:A,snapToGrid:k,containerBounds:u});if(s=F,a=Bu(H,M,F,E),a.size>0&&(n||L||!E&&j)){const[B,W]=on({nodeId:E,dragItems:a,nodeLookup:H});n?.(z.sourceEvent,a,B,W),L?.(z.sourceEvent,B,W),E||j?.(z.sourceEvent,W)}}const I=fr().clickDistance(C).on("start",z=>{const{domNode:H,nodeDragThreshold:v,transform:M,snapGrid:N,snapToGrid:A}=t();u=H?.getBoundingClientRect()||null,g=!1,p=!1,x=z.sourceEvent,v===0&&V(z),s=tt(z.sourceEvent,{transform:M,snapGrid:N,snapToGrid:A,containerBounds:u}),l=he(z.sourceEvent,u)}).on("drag",z=>{const{autoPanOnNodeDrag:H,transform:v,snapGrid:M,snapToGrid:N,nodeDragThreshold:A,nodeLookup:k}=t(),T=tt(z.sourceEvent,{transform:v,snapGrid:M,snapToGrid:N,containerBounds:u});if(x=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||E&&!k.has(E))&&(g=!0),!g){if(!c&&H&&f&&(c=!0,D()),!f){const L=he(z.sourceEvent,u),j=L.x-l.x,R=L.y-l.y;Math.sqrt(j*j+R*R)>A&&V(z)}(s.x!==T.xSnapped||s.y!==T.ySnapped)&&a&&f&&(l=he(z.sourceEvent,u),P(T))}}).on("end",z=>{if(!(!f||g)&&(c=!1,f=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:H,updateNodePositions:v,onNodeDragStop:M,onSelectionDragStop:N}=t();if(p&&(v(a,!1),p=!1),r||M||!E&&N){const[A,k]=on({nodeId:E,dragItems:a,nodeLookup:H,dragging:!1});r?.(z.sourceEvent,a,A,k),M?.(z.sourceEvent,A,k),E||N?.(z.sourceEvent,k)}}}).filter(z=>{const H=z.target;return!z.button&&(!b||!wo(H,`.${b}`,y))&&(!h||wo(H,h,y))});d.call(I)}function m(){d?.on(".drag",null)}return{update:w,destroy:m}}function Yu(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())at(r,Xe(s))>0&&o.push(s);return o}const Zu=250;function Wu(e,t,n,o){let r=[],s=1/0;const i=Yu(e,n,t+Zu);for(const a of i){const c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:f}=ze(a,l,l.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<s?(r=[{...l,x:u,y:f}],s=d):d===s&&r.push({...l,x:u,y:f}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function Zr(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&s?{...c,...ze(i,c,c.position,!0)}:c}function Wr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function qu(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const qr=()=>!0;function Gu(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:g,onConnectStart:p,onConnect:x,onConnectEnd:w,isValidConnection:m=qr,onReconnectEnd:b,updateConnection:h,getTransform:y,getFromHandle:S,autoPanSpeed:E,dragThreshold:C=1,handleDomNode:P}){const D=$r(e.target);let V=0,I;const{x:z,y:H}=he(e),v=Wr(s,P),M=a?.getBoundingClientRect();let N=!1;if(!M||!v)return;const A=Zr(r,v,o,c,t);if(!A)return;let k=he(e,M),T=!1,L=null,j=!1,R=null;function F(){if(!u||!M)return;const[U,q]=Pr(k,M,E);d({x:U,y:q}),V=requestAnimationFrame(F)}const B={...A,nodeId:r,type:v,position:A.position},W=c.get(r);let Z={inProgress:!0,isValid:null,from:ze(W,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:W,to:k,toHandle:null,toPosition:so[B.position],toNode:null,pointer:k};function O(){N=!0,h(Z),p?.(e,{nodeId:r,handleId:o,handleType:v})}C===0&&O();function Y(U){if(!N){const{x:ae,y:be}=he(U),ye=ae-z,Ie=be-H;if(!(ye*ye+Ie*Ie>C*C))return;O()}if(!S()||!B){Q(U);return}const q=y();k=he(U,M),I=Wu(gt(k,q,!1,[1,1]),n,c,B),T||(F(),T=!0);const G=Gr(U,{handle:I,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:m,doc:D,lib:l,flowId:f,nodeLookup:c});R=G.handleDomNode,L=G.connection,j=qu(!!I,G.isValid);const ee=c.get(r),ne=ee?ze(ee,B,X.Left,!0):Z.from,te={...Z,from:ne,isValid:j,to:G.toHandle&&j?$t({x:G.toHandle.x,y:G.toHandle.y},q):k,toHandle:G.toHandle,toPosition:j&&G.toHandle?G.toHandle.position:so[B.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:k};h(te),Z=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(N){(I||R)&&L&&j&&x?.(L);const{inProgress:q,...G}=Z,ee={...G,toPosition:Z.toHandle?Z.toPosition:null};w?.(U,ee),s&&b?.(U,ee)}g(),cancelAnimationFrame(V),T=!1,j=!1,L=null,R=null,D.removeEventListener("mousemove",Y),D.removeEventListener("mouseup",Q),D.removeEventListener("touchmove",Y),D.removeEventListener("touchend",Q)}}D.addEventListener("mousemove",Y),D.addEventListener("mouseup",Q),D.addEventListener("touchmove",Y),D.addEventListener("touchend",Q)}function Gr(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:c,isValidConnection:l=qr,nodeLookup:u}){const f=s==="target",d=t?i.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:p}=he(e),x=i.elementFromPoint(g,p),w=x?.classList.contains(`${a}-flow__handle`)?x:d,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const b=Wr(void 0,w),h=w.getAttribute("data-nodeid"),y=w.getAttribute("data-handleid"),S=w.classList.contains("connectable"),E=w.classList.contains("connectableend");if(!h||!b)return m;const C={source:f?h:o,sourceHandle:f?y:r,target:f?o:h,targetHandle:f?r:y};m.connection=C;const D=S&&E&&(n===Be.Strict?f&&b==="source"||!f&&b==="target":h!==o||y!==r);m.isValid=D&&l(C),m.toHandle=Zr(h,b,y,u,n,!0)}return m}const wn={onPointerDown:Gu,isValid:Gr};function Ku({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function s({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:g=!1}){const p=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const y=n(),S=h.sourceEvent.ctrlKey&&ct()?10:1,E=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*u,C=y[2]*Math.pow(2,E*S);t.scaleTo(C)};let x=[0,0];const w=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(x=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},m=h=>{const y=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const S=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],E=[S[0]-x[0],S[1]-x[1]];x=S;const C=o()*Math.max(y[2],Math.log(y[2]))*(g?-1:1),P={x:y[0]-E[0]*C,y:y[1]-E[1]*C},D=[[0,0],[c,l]];t.setViewportConstrained({x:P.x,y:P.y,zoom:y[2]},D,a)},b=Er().on("start",w).on("zoom",f?m:null).on("zoom.wheel",d?p:null);r.call(b,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const Yt=e=>({x:e.x,y:e.y,zoom:e.k}),rn=({x:e,y:t,zoom:n})=>Bt.translate(e,t).scale(n),Le=(e,t)=>e.target.closest(`.${t}`),Kr=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Uu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,sn=(e,t=0,n=Uu,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ur=e=>{const t=e.ctrlKey&&ct()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Qu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Le(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&i){const w=de(u),m=Ur(u),b=f*Math.pow(2,m);o.scaleTo(n,b,w,u);return}const d=u.deltaMode===1?20:1;let g=r===Pe.Vertical?0:u.deltaX*d,p=r===Pe.Horizontal?0:u.deltaY*d;!ct()&&u.shiftKey&&r!==Pe.Vertical&&(g=u.deltaY*d,p=0),o.translateBy(n,-(g/f)*s,-(p/f)*s,{internal:!0});const x=Yt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(u,x),e.panScrollTimeout=setTimeout(()=>{l?.(u,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,x))}}function Ju({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=Le(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function ed({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Yt(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function td({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&Kr(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,Yt(s.transform))}}function nd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Kr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Yt(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function od({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:u}){return f=>{const d=e||t,g=n&&f.ctrlKey,p=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Le(f,`${l}-flow__node`)||Le(f,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!s&&!n||i||u&&!p||Le(f,a)&&p||Le(f,c)&&(!p||r&&p&&!e)||!n&&f.ctrlKey&&p)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!g&&p||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||p)&&x}}function rd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=Er().scaleExtent([t,n]).translateExtent(o),d=ce(e).call(f);b({x:r.x,y:r.y,zoom:Fe(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=d.on("wheel.zoom"),p=d.on("dblclick.zoom");f.wheelDelta(Ur);function x(I,z){return d?new Promise(H=>{f?.interpolate(z?.interpolate==="linear"?Jt:Nt).transform(sn(d,z?.duration,z?.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function w({noWheelClassName:I,noPanClassName:z,onPaneContextMenu:H,userSelectionActive:v,panOnScroll:M,panOnDrag:N,panOnScrollMode:A,panOnScrollSpeed:k,preventScrolling:T,zoomOnPinch:L,zoomOnScroll:j,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:W,connectionInProgress:K,paneClickDistance:Z,selectionOnDrag:O}){v&&!l.isZoomingOrPanning&&m();const Y=M&&!F&&!v;f.clickDistance(O?1/0:!fe(Z)||Z<0?0:Z);const Q=Y?Qu({zoomPanValues:l,noWheelClassName:I,d3Selection:d,d3Zoom:f,panOnScrollMode:A,panOnScrollSpeed:k,zoomOnPinch:L,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):Ju({noWheelClassName:I,preventScrolling:T,d3ZoomHandler:g});if(d.on("wheel.zoom",Q,{passive:!1}),!v){const q=ed({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:i});f.on("start",q);const G=td({zoomPanValues:l,panOnDrag:N,onPaneContextMenu:!!H,onPanZoom:s,onTransformChange:W});f.on("zoom",G);const ee=nd({zoomPanValues:l,panOnDrag:N,panOnScroll:M,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:c});f.on("end",ee)}const U=od({zoomActivationKeyPressed:F,panOnDrag:N,zoomOnScroll:j,panOnScroll:M,zoomOnDoubleClick:R,zoomOnPinch:L,userSelectionActive:v,noPanClassName:z,noWheelClassName:I,lib:B,connectionInProgress:K});f.filter(U),R?d.on("dblclick.zoom",p):d.on("dblclick.zoom",null)}function m(){f.on("zoom",null)}async function b(I,z,H){const v=rn(I),M=f?.constrain()(v,z,H);return M&&await x(M),new Promise(N=>N(M))}async function h(I,z){const H=rn(I);return await x(H,z),new Promise(v=>v(H))}function y(I){if(d){const z=rn(I),H=d.property("__zoom");(H.k!==I.zoom||H.x!==I.x||H.y!==I.y)&&f?.transform(d,z,null,{sync:!0})}}function S(){const I=d?br(d.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function E(I,z){return d?new Promise(H=>{f?.interpolate(z?.interpolate==="linear"?Jt:Nt).scaleTo(sn(d,z?.duration,z?.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function C(I,z){return d?new Promise(H=>{f?.interpolate(z?.interpolate==="linear"?Jt:Nt).scaleBy(sn(d,z?.duration,z?.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function P(I){f?.scaleExtent(I)}function D(I){f?.translateExtent(I)}function V(I){const z=!fe(I)||I<0?0:I;f?.clickDistance(z)}return{update:w,destroy:m,setViewport:h,setViewportConstrained:b,getViewport:S,scaleTo:E,scaleBy:C,setScaleExtent:P,setTranslateExtent:D,syncViewport:y,setClickDistance:V}}var Ze;(function(e){e.Line="line",e.Handle="handle"})(Ze||(Ze={}));function id({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,c=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(c[0]=c[0]*-1),a&&s&&(c[1]=c[1]*-1),c}function vo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ee(e,t){return Math.max(0,t-e)}function Se(e,t){return Math.max(0,e-t)}function vt(e,t,n){return Math.max(0,t-e,e-n)}function _o(e,t){return e?!t:t}function sd(e,t,n,o,r,s,i,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:g,ySnapped:p}=n,{minWidth:x,maxWidth:w,minHeight:m,maxHeight:b}=o,{x:h,y,width:S,height:E,aspectRatio:C}=e;let P=Math.floor(u?g-e.pointerX:0),D=Math.floor(f?p-e.pointerY:0);const V=S+(c?-P:P),I=E+(l?-D:D),z=-s[0]*S,H=-s[1]*E;let v=vt(V,x,w),M=vt(I,m,b);if(i){let k=0,T=0;c&&P<0?k=Ee(h+P+z,i[0][0]):!c&&P>0&&(k=Se(h+V+z,i[1][0])),l&&D<0?T=Ee(y+D+H,i[0][1]):!l&&D>0&&(T=Se(y+I+H,i[1][1])),v=Math.max(v,k),M=Math.max(M,T)}if(a){let k=0,T=0;c&&P>0?k=Se(h+P,a[0][0]):!c&&P<0&&(k=Ee(h+V,a[1][0])),l&&D>0?T=Se(y+D,a[0][1]):!l&&D<0&&(T=Ee(y+I,a[1][1])),v=Math.max(v,k),M=Math.max(M,T)}if(r){if(u){const k=vt(V/C,m,b)*C;if(v=Math.max(v,k),i){let T=0;!c&&!l||c&&!l&&d?T=Se(y+H+V/C,i[1][1])*C:T=Ee(y+H+(c?P:-P)/C,i[0][1])*C,v=Math.max(v,T)}if(a){let T=0;!c&&!l||c&&!l&&d?T=Ee(y+V/C,a[1][1])*C:T=Se(y+(c?P:-P)/C,a[0][1])*C,v=Math.max(v,T)}}if(f){const k=vt(I*C,x,w)/C;if(M=Math.max(M,k),i){let T=0;!c&&!l||l&&!c&&d?T=Se(h+I*C+z,i[1][0])/C:T=Ee(h+(l?D:-D)*C+z,i[0][0])/C,M=Math.max(M,T)}if(a){let T=0;!c&&!l||l&&!c&&d?T=Ee(h+I*C,a[1][0])/C:T=Se(h+(l?D:-D)*C,a[0][0])/C,M=Math.max(M,T)}}}D=D+(D<0?M:-M),P=P+(P<0?v:-v),r&&(d?V>I*C?D=(_o(c,l)?-P:P)/C:P=(_o(c,l)?-D:D)*C:u?(D=P/C,l=c):(P=D*C,c=l));const N=c?h+P:h,A=l?y+D:y;return{width:S+(c?-P:P),height:E+(l?-D:D),x:s[0]*P*(c?-1:1)+N,y:s[1]*D*(l?-1:1)+A}}const Qr={width:0,height:0,x:0,y:0},ad={...Qr,pointerX:0,pointerY:0,aspectRatio:1};function cd(e){return[[0,0],[e.measured.width,e.measured.height]]}function ld(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,c=n[1]*i;return[[o-a,r-c],[o+s-a,r+i-c]]}function ud({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=ce(e);let i={controlDirection:vo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:g,onResize:p,onResizeEnd:x,shouldResize:w}){let m={...Qr},b={...ad};i={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:vo(l)};let h,y=null,S=[],E,C,P,D=!1;const V=fr().on("start",I=>{const{nodeLookup:z,transform:H,snapGrid:v,snapToGrid:M,nodeOrigin:N,paneDomNode:A}=n();if(h=z.get(t),!h)return;y=A?.getBoundingClientRect()??null;const{xSnapped:k,ySnapped:T}=tt(I.sourceEvent,{transform:H,snapGrid:v,snapToGrid:M,containerBounds:y});m={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},b={...m,pointerX:k,pointerY:T,aspectRatio:m.width/m.height},E=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(E=z.get(h.parentId),C=E&&h.extent==="parent"?cd(E):void 0),S=[],P=void 0;for(const[L,j]of z)if(j.parentId===t&&(S.push({id:L,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const R=ld(j,h,j.origin??N);P?P=[[Math.min(R[0][0],P[0][0]),Math.min(R[0][1],P[0][1])],[Math.max(R[1][0],P[1][0]),Math.max(R[1][1],P[1][1])]]:P=R}g?.(I,{...m})}).on("drag",I=>{const{transform:z,snapGrid:H,snapToGrid:v,nodeOrigin:M}=n(),N=tt(I.sourceEvent,{transform:z,snapGrid:H,snapToGrid:v,containerBounds:y}),A=[];if(!h)return;const{x:k,y:T,width:L,height:j}=m,R={},F=h.origin??M,{width:B,height:W,x:K,y:Z}=sd(b,i.controlDirection,N,i.boundaries,i.keepAspectRatio,F,C,P),O=B!==L,Y=W!==j,Q=K!==k&&O,U=Z!==T&&Y;if(!Q&&!U&&!O&&!Y)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:m.x,R.y=U?Z:m.y,m.x=R.x,m.y=R.y,S.length>0)){const ne=K-k,te=Z-T;for(const ae of S)ae.position={x:ae.position.x-ne+F[0]*(B-L),y:ae.position.y-te+F[1]*(W-j)},A.push(ae)}if((O||Y)&&(R.width=O&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:m.width,R.height=Y&&(!i.resizeDirection||i.resizeDirection==="vertical")?W:m.height,m.width=R.width,m.height=R.height),E&&h.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(m.x=ne,b.x=b.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(m.y=te,b.y=b.y-(R.y-te))}const q=id({width:m.width,prevWidth:L,height:m.height,prevHeight:j,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),G={...m,direction:q};w?.(I,G)!==!1&&(D=!0,p?.(I,G),o(R,A))}).on("end",I=>{D&&(x?.(I,{...m}),r?.({...m}),D=!1)});s.call(V)}function c(){s.on(".drag",null)}return{update:a,destroy:c}}const dd={},bo=e=>{let t;const n=new Set,o=(u,f)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const g=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(p=>p(t,g))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(dd?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},fd=e=>e?bo(e):bo,{useDebugValue:hd}=js,{useSyncExternalStoreWithSelector:gd}=Rs,pd=e=>e;function Jr(e,t=pd,n){const o=gd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hd(o),o}const Eo=(e,t)=>{const n=fd(e),o=(r,s=t)=>Jr(n,r,s);return Object.assign(o,n),o},md=(e,t)=>e?Eo(e,t):Eo;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const Zt=$.createContext(null),yd=Zt.Provider,ei=pe.error001();function J(e,t){const n=$.useContext(Zt);if(n===null)throw new Error(ei);return Jr(n,e,t)}function re(){const e=$.useContext(Zt);if(e===null)throw new Error(ei);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const So={display:"none"},xd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ti="react-flow__node-desc",ni="react-flow__edge-desc",wd="react-flow__aria-live",vd=e=>e.ariaLiveMessage,_d=e=>e.ariaLabelConfig;function bd({rfId:e}){const t=J(vd);return _.jsx("div",{id:`${wd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:xd,children:t})}function Ed({rfId:e,disableKeyboardA11y:t}){const n=J(_d);return _.jsxs(_.Fragment,{children:[_.jsx("div",{id:`${ti}-${e}`,style:So,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),_.jsx("div",{id:`${ni}-${e}`,style:So,children:n["edge.a11yDescription.default"]}),!t&&_.jsx(bd,{rfId:e})]})}const Wt=$.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return _.jsx("div",{className:ie(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Wt.displayName="Panel";function Sd({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:_.jsx(Wt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:_.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Nd=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},_t=e=>e.id;function Cd(e,t){return oe(e.selectedNodes.map(_t),t.selectedNodes.map(_t))&&oe(e.selectedEdges.map(_t),t.selectedEdges.map(_t))}function Md({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Nd,Cd);return $.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Id=e=>!!e.onSelectionChangeHandlers;function kd({onSelectionChange:e}){const t=J(Id);return e||t?_.jsx(Md,{onSelectionChange:e}):null}const oi=[0,0],Ad={x:0,y:0,zoom:1},Pd=["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"],No=[...Pd,"rfId"],Dd=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Co={translateExtent:it,nodeOrigin:oi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Td(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:c}=J(Dd,oe),l=re();$.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Co,a()}),[]);const u=$.useRef(Co);return $.useEffect(()=>{for(const f of No){const d=e[f],g=u.current[f];d!==g&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?s(d):f==="nodeExtent"?i(d):f==="ariaLabelConfig"?l.setState({ariaLabelConfig:bu(d)}):f==="fitView"?l.setState({fitViewQueued:d}):f==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[f]:d})))}u.current=e},No.map(f=>e[f])),null}function Mo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function zd(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const o=Mo(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:Mo()?.matches?"dark":"light"}const Io=typeof document<"u"?document:null;function lt(e=null,t={target:Io,actInsideInputWithModifier:!0}){const[n,o]=$.useState(!1),r=$.useRef(!1),s=$.useRef(new Set([])),[i,a]=$.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -1 +1 @@
1
- import{r as _,c as v,j as r}from"./index-H8waGLZX.js";import{B as z}from"./button-CKEM3eQL.js";import{b as k,T as y,a as E,c as B}from"./tooltip-DixY1Sbc.js";import{u as S,a as w}from"./use-organization-settings-C4u9V1Gg.js";import{u as A}from"./project-context-provider-DTbOrAFq.js";const C=({size:c=24,color:e="currentColor",...n})=>_.createElement("svg",{viewBox:"0 0 24 24",width:c,height:c,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},_.createElement("path",{d:"M12 15v7M8 7.308v2.13c0 .209 0 .313-.02.412a1.001 1.001 0 0 1-.09.254c-.045.09-.11.172-.24.334L6.08 12.4c-.666.833-.999 1.249-.999 1.599a1 1 0 0 0 .376.782C5.731 15 6.264 15 7.33 15h9.342c1.066 0 1.599 0 1.873-.219A1 1 0 0 0 18.92 14c0-.35-.333-.766-1-1.599l-1.569-1.962c-.13-.162-.195-.243-.241-.334a1.004 1.004 0 0 1-.09-.254C16 9.75 16 9.647 16 9.44V7.31c0-.116 0-.174.007-.23.006-.05.015-.1.029-.15a2.02 2.02 0 0 1 .079-.215l1.008-2.52c.294-.735.44-1.102.38-1.397a1 1 0 0 0-.427-.63C16.825 2 16.429 2 15.637 2H8.364c-.792 0-1.188 0-1.44.167a1 1 0 0 0-.426.63c-.06.295.086.662.38 1.397l1.008 2.52c.043.107.064.16.08.215a1 1 0 0 1 .028.15c.006.056.006.114.006.23Z"}));C.displayName="Pin01";function R(c){const e=v.c(19),{title:n,url:t,icon:f}=c,{org:P}=A(),i=S(P.id),h=w(P.id);let l;e[0]!==i?.sidebar_items||e[1]!==t?(l=i?.sidebar_items?.some(p=>p.url===t),e[0]=i?.sidebar_items,e[1]=t,e[2]=l):l=e[2];const a=!!l;let d;e[3]!==h.update||e[4]!==f||e[5]!==a||e[6]!==i?.sidebar_items||e[7]!==n||e[8]!==t?(d=async()=>{const p=i?.sidebar_items||[];let j;a?j=p.filter(T=>T.url!==t):j=[...p,{title:n,url:t,icon:f}],await h.update.mutateAsync({sidebar_items:j})},e[3]=h.update,e[4]=f,e[5]=a,e[6]=i?.sidebar_items,e[7]=n,e[8]=t,e[9]=d):d=e[9];const b=d,x=a?"secondary":"outline";let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(C,{size:16}),e[10]=m):m=e[10];let s;e[11]!==b||e[12]!==x?(s=r.jsx(k,{asChild:!0,children:r.jsx(z,{onClick:b,size:"icon",variant:x,className:"size-7 border border-input",children:m})}),e[11]=b,e[12]=x,e[13]=s):s=e[13];const g=a?"Pinned":"Pin to sidebar";let o;e[14]!==g?(o=r.jsx(y,{children:g}),e[14]=g,e[15]=o):o=e[15];let u;return e[16]!==s||e[17]!==o?(u=r.jsx(E,{children:r.jsxs(B,{children:[s,o]})}),e[16]=s,e[17]=o,e[18]=u):u=e[18],u}export{R as P};
1
+ import{r as _,c as v,j as r}from"./index-lLPOJwFP.js";import{B as z}from"./button-C0pnkZlC.js";import{b as k,T as y,a as E,c as B}from"./tooltip-D0yN_jPS.js";import{u as S,a as w}from"./use-organization-settings-CFfwAQvt.js";import{u as A}from"./project-context-provider-BMHXD39x.js";const C=({size:c=24,color:e="currentColor",...n})=>_.createElement("svg",{viewBox:"0 0 24 24",width:c,height:c,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},_.createElement("path",{d:"M12 15v7M8 7.308v2.13c0 .209 0 .313-.02.412a1.001 1.001 0 0 1-.09.254c-.045.09-.11.172-.24.334L6.08 12.4c-.666.833-.999 1.249-.999 1.599a1 1 0 0 0 .376.782C5.731 15 6.264 15 7.33 15h9.342c1.066 0 1.599 0 1.873-.219A1 1 0 0 0 18.92 14c0-.35-.333-.766-1-1.599l-1.569-1.962c-.13-.162-.195-.243-.241-.334a1.004 1.004 0 0 1-.09-.254C16 9.75 16 9.647 16 9.44V7.31c0-.116 0-.174.007-.23.006-.05.015-.1.029-.15a2.02 2.02 0 0 1 .079-.215l1.008-2.52c.294-.735.44-1.102.38-1.397a1 1 0 0 0-.427-.63C16.825 2 16.429 2 15.637 2H8.364c-.792 0-1.188 0-1.44.167a1 1 0 0 0-.426.63c-.06.295.086.662.38 1.397l1.008 2.52c.043.107.064.16.08.215a1 1 0 0 1 .028.15c.006.056.006.114.006.23Z"}));C.displayName="Pin01";function R(c){const e=v.c(19),{title:n,url:t,icon:f}=c,{org:P}=A(),i=S(P.id),h=w(P.id);let l;e[0]!==i?.sidebar_items||e[1]!==t?(l=i?.sidebar_items?.some(p=>p.url===t),e[0]=i?.sidebar_items,e[1]=t,e[2]=l):l=e[2];const a=!!l;let d;e[3]!==h.update||e[4]!==f||e[5]!==a||e[6]!==i?.sidebar_items||e[7]!==n||e[8]!==t?(d=async()=>{const p=i?.sidebar_items||[];let j;a?j=p.filter(T=>T.url!==t):j=[...p,{title:n,url:t,icon:f}],await h.update.mutateAsync({sidebar_items:j})},e[3]=h.update,e[4]=f,e[5]=a,e[6]=i?.sidebar_items,e[7]=n,e[8]=t,e[9]=d):d=e[9];const b=d,x=a?"secondary":"outline";let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=r.jsx(C,{size:16}),e[10]=m):m=e[10];let s;e[11]!==b||e[12]!==x?(s=r.jsx(k,{asChild:!0,children:r.jsx(z,{onClick:b,size:"icon",variant:x,className:"size-7 border border-input",children:m})}),e[11]=b,e[12]=x,e[13]=s):s=e[13];const g=a?"Pinned":"Pin to sidebar";let o;e[14]!==g?(o=r.jsx(y,{children:g}),e[14]=g,e[15]=o):o=e[15];let u;return e[16]!==s||e[17]!==o?(u=r.jsx(E,{children:r.jsxs(B,{children:[s,o]})}),e[16]=s,e[17]=o,e[18]=u):u=e[18],u}export{R as P};
@@ -1 +1 @@
1
- import{c as n,j as t,bJ as o}from"./index-H8waGLZX.js";function c(){const s=n.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[t.jsx(o,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No storage connected"}),t.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"Connect an S3-compatible storage service to browse and manage files."})]}),s[0]=e):e=s[0],e}export{c as default};
1
+ import{c as n,j as t,bJ as o}from"./index-lLPOJwFP.js";function c(){const s=n.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-8",children:[t.jsx(o,{size:48,className:"text-muted-foreground mb-4"}),t.jsx("h3",{className:"text-lg font-medium mb-2",children:"No storage connected"}),t.jsx("p",{className:"text-muted-foreground text-center max-w-md",children:"Connect an S3-compatible storage service to browse and manage files."})]}),s[0]=e):e=s[0],e}export{c as default};
@@ -1 +1 @@
1
- import{c as w,j as s,r as S,bJ as v}from"./index-H8waGLZX.js";import{i as _}from"./Check-D_y2LGJG.js";import{t as k}from"./ChevronDown-CK8tBMwt.js";function E(x){const e=w.c(32),{connections:l,selectedConnectionId:r,onConnectionChange:N}=x,[n,y]=S.useState(!1),C=S.useRef(null);let p;if(e[0]!==l||e[1]!==r){let t;e[3]!==r?(t=u=>u.id===r,e[3]=r,e[4]=t):t=e[4],p=l.find(t),e[0]=l,e[1]=r,e[2]=p}else p=e[2];const i=p;let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=t=>{C.current?.contains(t.relatedTarget)||y(!1)},e[5]=b):b=e[5];const R=b;if(l.length===1){let t;e[6]!==i?(t=i?.icon?s.jsx("img",{src:i.icon,alt:"",className:"size-4 rounded"}):s.jsx(v,{size:16}),e[6]=i,e[7]=t):t=e[7];const u=i?.title||"Storage";let f;e[8]!==u?(f=s.jsx("span",{children:u}),e[8]=u,e[9]=f):f=e[9];let h;return e[10]!==t||e[11]!==f?(h=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t,f]}),e[10]=t,e[11]=f,e[12]=h):h=e[12],h}let o;e[13]!==n?(o=()=>y(!n),e[13]=n,e[14]=o):o=e[14];let c;e[15]!==i?(c=i?.icon?s.jsx("img",{src:i.icon,alt:"",className:"size-4 rounded"}):s.jsx(v,{size:16}),e[15]=i,e[16]=c):c=e[16];const z=i?.title||"Select storage";let a;e[17]!==z?(a=s.jsx("span",{children:z}),e[17]=z,e[18]=a):a=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(k,{size:14}),e[19]=j):j=e[19];let d;e[20]!==o||e[21]!==c||e[22]!==a?(d=s.jsxs("button",{type:"button",onClick:o,className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-md border border-border bg-background hover:bg-accent transition-colors",children:[c,a,j]}),e[20]=o,e[21]=c,e[22]=a,e[23]=d):d=e[23];let m;e[24]!==l||e[25]!==n||e[26]!==N||e[27]!==r?(m=n&&s.jsx("div",{className:"absolute left-0 top-full mt-1 z-50 min-w-48 rounded-md border border-border bg-popover p-1 shadow-md",children:l.map(t=>s.jsxs("button",{type:"button",onClick:()=>{N(t.id),y(!1)},className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent transition-colors",children:[t.icon?s.jsx("img",{src:t.icon,alt:"",className:"size-4 rounded"}):s.jsx(v,{size:16}),s.jsx("span",{className:"flex-1 text-left",children:t.title}),t.id===r&&s.jsx(_,{size:14,className:"text-primary"})]},t.id))}),e[24]=l,e[25]=n,e[26]=N,e[27]=r,e[28]=m):m=e[28];let g;return e[29]!==d||e[30]!==m?(g=s.jsxs("div",{className:"relative",ref:C,onBlur:R,children:[d,m]}),e[29]=d,e[30]=m,e[31]=g):g=e[31],g}function O(x){const e=w.c(2);let l;return e[0]!==x?(l=s.jsx("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:s.jsx(E,{...x})}),e[0]=x,e[1]=l):l=e[1],l}export{O as default};
1
+ import{c as w,j as s,r as S,bJ as v}from"./index-lLPOJwFP.js";import{i as _}from"./Check-C2R_Lcai.js";import{t as k}from"./ChevronDown-CGAmRXVd.js";function E(x){const e=w.c(32),{connections:l,selectedConnectionId:r,onConnectionChange:N}=x,[n,y]=S.useState(!1),C=S.useRef(null);let p;if(e[0]!==l||e[1]!==r){let t;e[3]!==r?(t=u=>u.id===r,e[3]=r,e[4]=t):t=e[4],p=l.find(t),e[0]=l,e[1]=r,e[2]=p}else p=e[2];const i=p;let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=t=>{C.current?.contains(t.relatedTarget)||y(!1)},e[5]=b):b=e[5];const R=b;if(l.length===1){let t;e[6]!==i?(t=i?.icon?s.jsx("img",{src:i.icon,alt:"",className:"size-4 rounded"}):s.jsx(v,{size:16}),e[6]=i,e[7]=t):t=e[7];const u=i?.title||"Storage";let f;e[8]!==u?(f=s.jsx("span",{children:u}),e[8]=u,e[9]=f):f=e[9];let h;return e[10]!==t||e[11]!==f?(h=s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[t,f]}),e[10]=t,e[11]=f,e[12]=h):h=e[12],h}let o;e[13]!==n?(o=()=>y(!n),e[13]=n,e[14]=o):o=e[14];let c;e[15]!==i?(c=i?.icon?s.jsx("img",{src:i.icon,alt:"",className:"size-4 rounded"}):s.jsx(v,{size:16}),e[15]=i,e[16]=c):c=e[16];const z=i?.title||"Select storage";let a;e[17]!==z?(a=s.jsx("span",{children:z}),e[17]=z,e[18]=a):a=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(k,{size:14}),e[19]=j):j=e[19];let d;e[20]!==o||e[21]!==c||e[22]!==a?(d=s.jsxs("button",{type:"button",onClick:o,className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm font-medium rounded-md border border-border bg-background hover:bg-accent transition-colors",children:[c,a,j]}),e[20]=o,e[21]=c,e[22]=a,e[23]=d):d=e[23];let m;e[24]!==l||e[25]!==n||e[26]!==N||e[27]!==r?(m=n&&s.jsx("div",{className:"absolute left-0 top-full mt-1 z-50 min-w-48 rounded-md border border-border bg-popover p-1 shadow-md",children:l.map(t=>s.jsxs("button",{type:"button",onClick:()=>{N(t.id),y(!1)},className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded-sm hover:bg-accent transition-colors",children:[t.icon?s.jsx("img",{src:t.icon,alt:"",className:"size-4 rounded"}):s.jsx(v,{size:16}),s.jsx("span",{className:"flex-1 text-left",children:t.title}),t.id===r&&s.jsx(_,{size:14,className:"text-primary"})]},t.id))}),e[24]=l,e[25]=n,e[26]=N,e[27]=r,e[28]=m):m=e[28];let g;return e[29]!==d||e[30]!==m?(g=s.jsxs("div",{className:"relative",ref:C,onBlur:R,children:[d,m]}),e[29]=d,e[30]=m,e[31]=g):g=e[31],g}function O(x){const e=w.c(2);let l;return e[0]!==x?(l=s.jsx("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:s.jsx(E,{...x})}),e[0]=x,e[1]=l):l=e[1],l}export{O as default};
@@ -1 +1 @@
1
- import{r as p,c as u,j as r,i as L,f as O,M as A,Q as h,t as N,p as M}from"./index-H8waGLZX.js";import{C as R}from"./collection-header-DxthRGYV.js";import{C as D}from"./collection-page-D_yHhDuI.js";import{u as I,a as F}from"./use-organization-settings-C4u9V1Gg.js";import{u as H}from"./project-context-provider-DTbOrAFq.js";import{c as f,B as j}from"./button-CKEM3eQL.js";import{S as Q}from"./switch-CIfCfD81.js";import{i as T}from"./ArrowLeft-CiX5attk.js";import"./collection-display-button-BRmjKmXA.js";import"./dropdown-menu-wWS-zaMN.js";import"./Grid01-CPcgzk-j.js";import"./ArrowUp-Cb5IgbXf.js";import"./Check-D_y2LGJG.js";import"./List-vJTsFkGC.js";import"./tooltip-DixY1Sbc.js";import"./view-mode-toggle-CoxeG-5F.js";import"./useMutation-DXyBs08e.js";import"./connection-iGG9vveH.js";const S=({size:n=24,color:e="currentColor",...s})=>p.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},p.createElement("path",{d:"M7 22 17 2"}));S.displayName="SlashDivider";function W(n){const e=u.c(4);let s;e[0]!==n?({...s}=n,e[0]=n,e[1]=s):s=e[1];let t;return e[2]!==s?(t=r.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...s}),e[2]=s,e[3]=t):t=e[3],t}function q(n){const e=u.c(8);let s,t;e[0]!==n?({className:s,...t}=n,e[0]=n,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2",s),e[3]=s,e[4]=i):i=e[4];let a;return e[5]!==t||e[6]!==i?(a=r.jsx("ol",{"data-slot":"breadcrumb-list",className:i,...t}),e[5]=t,e[6]=i,e[7]=a):a=e[7],a}function C(n){const e=u.c(8);let s,t;e[0]!==n?({className:s,...t}=n,e[0]=n,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("inline-flex items-center gap-1.5",s),e[3]=s,e[4]=i):i=e[4];let a;return e[5]!==t||e[6]!==i?(a=r.jsx("li",{"data-slot":"breadcrumb-item",className:i,...t}),e[5]=t,e[6]=i,e[7]=a):a=e[7],a}function G(n){const e=u.c(10);let s,t,i;e[0]!==n?({asChild:s,className:t,...i}=n,e[0]=n,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);const a=s?L:"a";let o;e[4]!==t?(o=f("hover:text-foreground transition-colors",t),e[4]=t,e[5]=o):o=e[5];let d;return e[6]!==a||e[7]!==i||e[8]!==o?(d=r.jsx(a,{"data-slot":"breadcrumb-link",className:o,...i}),e[6]=a,e[7]=i,e[8]=o,e[9]=d):d=e[9],d}function J(n){const e=u.c(8);let s,t;e[0]!==n?({className:s,...t}=n,e[0]=n,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("text-foreground font-normal",s),e[3]=s,e[4]=i):i=e[4];let a;return e[5]!==t||e[6]!==i?(a=r.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:i,...t}),e[5]=t,e[6]=i,e[7]=a):a=e[7],a}function K(n){const e=u.c(12);let s,t,i;e[0]!==n?({children:s,className:t,...i}=n,e[0]=n,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);let a;e[4]!==t?(a=f("[&>svg]:size-3.5 text-muted-foreground -rotate-12 opacity-50 list-none",t),e[4]=t,e[5]=a):a=e[5];let o;e[6]!==s?(o=s??r.jsx(S,{}),e[6]=s,e[7]=o):o=e[7];let d;return e[8]!==i||e[9]!==a||e[10]!==o?(d=r.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:a,...i,children:o}),e[8]=i,e[9]=a,e[10]=o,e[11]=d):d=e[11],d}function ue(){const{org:n}=H(),e=O(),s=I(n.id),{update:t}=F(n.id),[i,a]=p.useState({}),[o,d]=p.useState(!1),x=s?.enabled_plugins??[],k=l=>{const c=i[l];return c!==void 0?c:x.includes(l)},w=()=>{const l=new Set(x);for(const[c,m]of Object.entries(i))m?l.add(c):l.delete(c);return Array.from(l)},b=Object.keys(i).length>0,y=(l,c)=>{const m=x.includes(l);a(c===m?g=>{const{[l]:v,...$}=g;return $}:g=>({...g,[l]:c}))},P=async()=>{d(!0);try{await t.mutateAsync({enabled_plugins:w()}),a({}),N.success("Plugin settings saved")}catch{N.error("Failed to save plugin settings")}finally{d(!1)}},E=()=>{a({})},z=l=>M.find(c=>c.pluginId===l),B=l=>h.find(m=>m.id===l)?.description??null;return r.jsxs(D,{children:[r.jsx(R,{title:r.jsx(W,{children:r.jsxs(q,{children:[r.jsx(C,{children:r.jsx(G,{asChild:!0,children:r.jsx(A,{to:"/$org/settings",params:{org:n.slug},children:"Settings"})})}),r.jsx(K,{}),r.jsx(C,{children:r.jsx(J,{children:"Plugins"})})]})}),leftElement:r.jsx(j,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground",onClick:()=>e({to:"/$org/settings",params:{org:n.slug}}),children:r.jsx(T,{className:"size-4"})})}),r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx("div",{className:"flex h-full",children:r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx("div",{className:"p-5 max-w-2xl",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable or disable plugins for your organization."})}),r.jsx("div",{className:"divide-y divide-border border-y border-border",children:h.map(l=>{const c=z(l.id),m=B(l.id),g=k(l.id);return r.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[c?.icon&&r.jsx("div",{className:"flex-shrink-0 text-muted-foreground [&>svg]:size-4",children:c.icon}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:c?.label??l.id}),m&&r.jsx("p",{className:"text-xs text-muted-foreground",children:m})]})]}),r.jsx(Q,{checked:g,onCheckedChange:v=>y(l.id,v),disabled:o})]},l.id)})}),h.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}),r.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[r.jsx(j,{onClick:P,disabled:!b||o,className:"min-w-24",children:o?"Saving...":"Save Changes"}),b&&r.jsx(j,{variant:"outline",onClick:E,disabled:o,children:"Cancel"})]})]})})})})})]})}export{ue as default};
1
+ import{r as p,c as u,j as r,i as L,f as O,M as A,Q as h,t as N,p as M}from"./index-lLPOJwFP.js";import{C as R}from"./collection-header-d89fPnWN.js";import{C as D}from"./collection-page-DvY1awQQ.js";import{u as I,a as F}from"./use-organization-settings-CFfwAQvt.js";import{u as H}from"./project-context-provider-BMHXD39x.js";import{c as f,B as j}from"./button-C0pnkZlC.js";import{S as Q}from"./switch-Z2NGTQao.js";import{i as T}from"./ArrowLeft-ClViT7Hc.js";import"./collection-display-button-DDxBelrQ.js";import"./dropdown-menu-DXIsFCVQ.js";import"./Grid01-SL4tYH2-.js";import"./ArrowUp-BsQNKzS-.js";import"./Check-C2R_Lcai.js";import"./List-DhHX60HN.js";import"./tooltip-D0yN_jPS.js";import"./view-mode-toggle-C7lGZNG7.js";import"./useMutation-8xrpFP-l.js";import"./connection-CMutAR-q.js";const S=({size:n=24,color:e="currentColor",...s})=>p.createElement("svg",{viewBox:"0 0 24 24",width:n,height:n,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},p.createElement("path",{d:"M7 22 17 2"}));S.displayName="SlashDivider";function W(n){const e=u.c(4);let s;e[0]!==n?({...s}=n,e[0]=n,e[1]=s):s=e[1];let t;return e[2]!==s?(t=r.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...s}),e[2]=s,e[3]=t):t=e[3],t}function q(n){const e=u.c(8);let s,t;e[0]!==n?({className:s,...t}=n,e[0]=n,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2",s),e[3]=s,e[4]=i):i=e[4];let a;return e[5]!==t||e[6]!==i?(a=r.jsx("ol",{"data-slot":"breadcrumb-list",className:i,...t}),e[5]=t,e[6]=i,e[7]=a):a=e[7],a}function C(n){const e=u.c(8);let s,t;e[0]!==n?({className:s,...t}=n,e[0]=n,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("inline-flex items-center gap-1.5",s),e[3]=s,e[4]=i):i=e[4];let a;return e[5]!==t||e[6]!==i?(a=r.jsx("li",{"data-slot":"breadcrumb-item",className:i,...t}),e[5]=t,e[6]=i,e[7]=a):a=e[7],a}function G(n){const e=u.c(10);let s,t,i;e[0]!==n?({asChild:s,className:t,...i}=n,e[0]=n,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);const a=s?L:"a";let o;e[4]!==t?(o=f("hover:text-foreground transition-colors",t),e[4]=t,e[5]=o):o=e[5];let d;return e[6]!==a||e[7]!==i||e[8]!==o?(d=r.jsx(a,{"data-slot":"breadcrumb-link",className:o,...i}),e[6]=a,e[7]=i,e[8]=o,e[9]=d):d=e[9],d}function J(n){const e=u.c(8);let s,t;e[0]!==n?({className:s,...t}=n,e[0]=n,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let i;e[3]!==s?(i=f("text-foreground font-normal",s),e[3]=s,e[4]=i):i=e[4];let a;return e[5]!==t||e[6]!==i?(a=r.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:i,...t}),e[5]=t,e[6]=i,e[7]=a):a=e[7],a}function K(n){const e=u.c(12);let s,t,i;e[0]!==n?({children:s,className:t,...i}=n,e[0]=n,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);let a;e[4]!==t?(a=f("[&>svg]:size-3.5 text-muted-foreground -rotate-12 opacity-50 list-none",t),e[4]=t,e[5]=a):a=e[5];let o;e[6]!==s?(o=s??r.jsx(S,{}),e[6]=s,e[7]=o):o=e[7];let d;return e[8]!==i||e[9]!==a||e[10]!==o?(d=r.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:a,...i,children:o}),e[8]=i,e[9]=a,e[10]=o,e[11]=d):d=e[11],d}function ue(){const{org:n}=H(),e=O(),s=I(n.id),{update:t}=F(n.id),[i,a]=p.useState({}),[o,d]=p.useState(!1),x=s?.enabled_plugins??[],k=l=>{const c=i[l];return c!==void 0?c:x.includes(l)},w=()=>{const l=new Set(x);for(const[c,m]of Object.entries(i))m?l.add(c):l.delete(c);return Array.from(l)},b=Object.keys(i).length>0,y=(l,c)=>{const m=x.includes(l);a(c===m?g=>{const{[l]:v,...$}=g;return $}:g=>({...g,[l]:c}))},P=async()=>{d(!0);try{await t.mutateAsync({enabled_plugins:w()}),a({}),N.success("Plugin settings saved")}catch{N.error("Failed to save plugin settings")}finally{d(!1)}},E=()=>{a({})},z=l=>M.find(c=>c.pluginId===l),B=l=>h.find(m=>m.id===l)?.description??null;return r.jsxs(D,{children:[r.jsx(R,{title:r.jsx(W,{children:r.jsxs(q,{children:[r.jsx(C,{children:r.jsx(G,{asChild:!0,children:r.jsx(A,{to:"/$org/settings",params:{org:n.slug},children:"Settings"})})}),r.jsx(K,{}),r.jsx(C,{children:r.jsx(J,{children:"Plugins"})})]})}),leftElement:r.jsx(j,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground",onClick:()=>e({to:"/$org/settings",params:{org:n.slug}}),children:r.jsx(T,{className:"size-4"})})}),r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx("div",{className:"flex h-full",children:r.jsx("div",{className:"flex-1 overflow-auto",children:r.jsx("div",{className:"p-5 max-w-2xl",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable or disable plugins for your organization."})}),r.jsx("div",{className:"divide-y divide-border border-y border-border",children:h.map(l=>{const c=z(l.id),m=B(l.id),g=k(l.id);return r.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[c?.icon&&r.jsx("div",{className:"flex-shrink-0 text-muted-foreground [&>svg]:size-4",children:c.icon}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:c?.label??l.id}),m&&r.jsx("p",{className:"text-xs text-muted-foreground",children:m})]})]}),r.jsx(Q,{checked:g,onCheckedChange:v=>y(l.id,v),disabled:o})]},l.id)})}),h.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins available."}),r.jsxs("div",{className:"flex items-center gap-3 pt-4",children:[r.jsx(j,{onClick:P,disabled:!b||o,className:"min-w-24",children:o?"Saving...":"Save Changes"}),b&&r.jsx(j,{variant:"outline",onClick:E,disabled:o,children:"Cancel"})]})]})})})})})]})}export{ue as default};