@decocms/mesh 2.33.0 → 2.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/client/assets/{AlertCircle-BUJ8IT58.js → AlertCircle-BRWDZx_r.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-Cgf-RjME.js → ArrowLeft-hhVT4Kgt.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-6Vw9g-kK.js → ArrowUp-07dwm1MA.js} +1 -1
  4. package/dist/client/assets/{Check-CSwEsqta.js → Check-n_KiNdp_.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-DFQ7Wwuf.js → ChevronDown-BDe2LrLc.js} +1 -1
  6. package/dist/client/assets/{Code01-BO10Af7Z.js → Code01-DPGq6TT6.js} +1 -1
  7. package/dist/client/assets/{Copy01-D3IzDjkZ.js → Copy01-dSgWMnr9.js} +1 -1
  8. package/dist/client/assets/{CpuChip02-BhwN5rbm.js → CpuChip02-D4-bIMj_.js} +1 -1
  9. package/dist/client/assets/{DotsHorizontal-BDXVd4Qq.js → DotsHorizontal-C5FFxgpO.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-D9Rul5KS.js → DotsVertical-_ZO_fNF7.js} +1 -1
  11. package/dist/client/assets/{Download01-BeKBUqUu.js → Download01-H-0ecpIj.js} +1 -1
  12. package/dist/client/assets/{Edit01-lX0maYnd.js → Edit01-nGCAvXPD.js} +1 -1
  13. package/dist/client/assets/{File06-BUqTeSo9.js → File06-CbLEGD6l.js} +1 -1
  14. package/dist/client/assets/{FilterLines-9uzI1ZUk.js → FilterLines-CRZrobVY.js} +1 -1
  15. package/dist/client/assets/{FlipBackward-CKjrTjy2.js → FlipBackward-DEk7agK1.js} +1 -1
  16. package/dist/client/assets/{GitBranch01-DwH1AkJQ.js → GitBranch01-8cUKFct3.js} +1 -1
  17. package/dist/client/assets/{Grid01-B6p7u4lV.js → Grid01-D_y10H_F.js} +1 -1
  18. package/dist/client/assets/{Home02-BghpVzd2.js → Home02-CcZBoBXH.js} +1 -1
  19. package/dist/client/assets/{Image01-UhJxiWhu.js → Image01-DAeUMBHm.js} +1 -1
  20. package/dist/client/assets/{Inbox01-D2KzPm9_.js → Inbox01-DYU61nmV.js} +1 -1
  21. package/dist/client/assets/{InfoCircle-476KnZLd.js → InfoCircle-B5w8XDv3.js} +1 -1
  22. package/dist/client/assets/{Key01-iLYu5J4i.js → Key01-BMvQCi5l.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-hRmOt3fQ.js → LinkExternal01-Bi1B9G37.js} +1 -1
  24. package/dist/client/assets/{List-BNtbfVCR.js → List-AGMu6Jg9.js} +1 -1
  25. package/dist/client/assets/{Loading01-Bm4yV2Kc.js → Loading01-mNUVI85L.js} +1 -1
  26. package/dist/client/assets/{Lock01-DW5Dv4uq.js → Lock01-B3WHG0KG.js} +1 -1
  27. package/dist/client/assets/{Play-Bb62L2ZA.js → Play-Cf7Any1j.js} +1 -1
  28. package/dist/client/assets/{Plus-DXX1AA4n.js → Plus-BBofXpHO.js} +1 -1
  29. package/dist/client/assets/{SearchMd-BHAg8E82.js → SearchMd-BCAxnQkD.js} +1 -1
  30. package/dist/client/assets/{Terminal-j-v4faZp.js → Terminal-rmcOb2qR.js} +1 -1
  31. package/dist/client/assets/{Trash01-CdrSpG7k.js → Trash01-r91jWYrx.js} +1 -1
  32. package/dist/client/assets/{Upload01-BIrdmP3b.js → Upload01-CHkKcKN6.js} +1 -1
  33. package/dist/client/assets/{X-B3J65QND.js → X-C-LXD8Fs.js} +1 -1
  34. package/dist/client/assets/{XClose-IcohyJgY.js → XClose-Cuyiwbqc.js} +1 -1
  35. package/dist/client/assets/{agent-detail-CYjCyd9d.js → agent-detail-Cgt9QWk4.js} +1 -1
  36. package/dist/client/assets/{agents-CxMTqONq.js → agents-fnv41ET7.js} +1 -1
  37. package/dist/client/assets/{alert-dialog-DS_IdQX7.js → alert-dialog-b2qaVWQf.js} +1 -1
  38. package/dist/client/assets/{auth-catchall-UglB1DuM.js → auth-catchall-CT8C3FiC.js} +1 -1
  39. package/dist/client/assets/{avatar-D8MYCeCO.js → avatar-CJ18d1Yr.js} +1 -1
  40. package/dist/client/assets/{badge-CKkYvVPh.js → badge-BLC7Dsve.js} +1 -1
  41. package/dist/client/assets/{binder-DmV70Mg6.js → binder-BG1MkJXb.js} +1 -1
  42. package/dist/client/assets/{button-CX9BcGIk.js → button-CWaK1hUN.js} +1 -1
  43. package/dist/client/assets/{card-BDtQbN4Z.js → card-7SgaoQef.js} +1 -1
  44. package/dist/client/assets/{checkbox-DyCTDo5B.js → checkbox-BWBpAWkB.js} +1 -1
  45. package/dist/client/assets/{collection-detail-BzGnhxXG.js → collection-detail-DUhOfUr0.js} +1 -1
  46. package/dist/client/assets/{collection-display-button-BqEBXGbV.js → collection-display-button-DKWP6xRi.js} +1 -1
  47. package/dist/client/assets/{collection-header-DdM-1rXZ.js → collection-header-I0z7H0ZC.js} +1 -1
  48. package/dist/client/assets/{collection-page-Bhf_fPlN.js → collection-page-EuoaVB95.js} +1 -1
  49. package/dist/client/assets/{collection-search-D2zepp45.js → collection-search-CP09UmnI.js} +1 -1
  50. package/dist/client/assets/{collection-tab-Dx4a2de4.js → collection-tab-Cyh1pe9u.js} +1 -1
  51. package/dist/client/assets/{collection-table-wrapper-BRx1U1h_.js → collection-table-wrapper--qQDqi3a.js} +1 -1
  52. package/dist/client/assets/{connection-card-7axd0v5e.js → connection-card-dyAZPnBc.js} +1 -1
  53. package/dist/client/assets/{connection-detail-DiXv5jt2.js → connection-detail-BmS-s06n.js} +1 -1
  54. package/dist/client/assets/{connections-CmqWCHTI.js → connections-DBGBr_4l.js} +1 -1
  55. package/dist/client/assets/{constants-DZTKSPb5.js → constants-D7TSocv6.js} +1 -1
  56. package/dist/client/assets/constants-DSSgefWZ.js +1 -0
  57. package/dist/client/assets/{create-organization-dialog-WqVFUH5x.js → create-organization-dialog-DrmGwR9J.js} +1 -1
  58. package/dist/client/assets/{dialog-CtieLp9D.js → dialog-CkzeDWMv.js} +1 -1
  59. package/dist/client/assets/{dropdown-menu-BOgD5B6g.js → dropdown-menu-eADXqdeC.js} +1 -1
  60. package/dist/client/assets/{dynamic-plugin-layout-Cir7_703.js → dynamic-plugin-layout-ObC7Ud51.js} +1 -1
  61. package/dist/client/assets/{empty-state-K3SjQCVt.js → empty-state-CfCSwnz1.js} +1 -1
  62. package/dist/client/assets/{empty-state-DUPw1fh0.js → empty-state-zP-KbGlv.js} +1 -1
  63. package/dist/client/assets/{env-vars-editor-DgBscrAL.js → env-vars-editor-BI1TwkmM.js} +1 -1
  64. package/dist/client/assets/{error-boundary-DDz4G03r.js → error-boundary-CG0YZ4B8.js} +1 -1
  65. package/dist/client/assets/{extract-connection-data-5AHzxrfF.js → extract-connection-data-DjJgYZHM.js} +1 -1
  66. package/dist/client/assets/{file-browser-oT6ix4zp.js → file-browser-FetvDlId.js} +2 -2
  67. package/dist/client/assets/{form-lMcrl-dM.js → form-BJcgMy55.js} +1 -1
  68. package/dist/client/assets/{grid-view-CpwRqIn-.js → grid-view-DAtPq1rk.js} +1 -1
  69. package/dist/client/assets/{home-B7Dgc3GO.js → home-563KzJx_.js} +1 -1
  70. package/dist/client/assets/{index-BC_LUGnz.js → index--CSmLs4y.js} +1 -1
  71. package/dist/client/assets/{index-lzARP5Pm.js → index-BMtR19Aw.js} +1 -1
  72. package/dist/client/assets/{index-B9g3IU58.js → index-BipFUdjC.js} +2 -2
  73. package/dist/client/assets/{index-P3kNP-Ue.js → index-CJvrv3U6.js} +1 -1
  74. package/dist/client/assets/{index-DRDMCJOo.js → index-D8uhOq5u.js} +1 -1
  75. package/dist/client/assets/{index-CtjqtW4J.js → index-q_aACm4R.js} +1 -1
  76. package/dist/client/assets/{infiniteQueryObserver-CKJG_0Nf.js → infiniteQueryObserver-FEDpWaxK.js} +1 -1
  77. package/dist/client/assets/{input-D7AeKLG6.js → input-CJlzp_V5.js} +1 -1
  78. package/dist/client/assets/{layout-CXeFBy5y.js → layout-BHCzoCFv.js} +1 -1
  79. package/dist/client/assets/{localstorage-keys-D1ttI_kB.js → localstorage-keys-CqdQQHDa.js} +1 -1
  80. package/dist/client/assets/{login-aHF5mxsS.js → login-DdZmNh4a.js} +1 -1
  81. package/dist/client/assets/{mcp-oauth-DEkeQYdq.js → mcp-oauth-Da5yE9aW.js} +1 -1
  82. package/dist/client/assets/{mcp-server-card-B8_ilRqj.js → mcp-server-card-CYYL-dXF.js} +1 -1
  83. package/dist/client/assets/{mcp-server-detail-2KEeU4st.js → mcp-server-detail-C2G-xpe0.js} +2 -2
  84. package/dist/client/assets/{members-0oxL59m2.js → members-FKAvc6la.js} +1 -1
  85. package/dist/client/assets/{monaco-editor-D26cmj67.js → monaco-editor-DkDnm6Tx.js} +1 -1
  86. package/dist/client/assets/{monitoring-BguR26SJ.js → monitoring-6KAEGPPJ.js} +1 -1
  87. package/dist/client/assets/{oauth-callback-CoFJFyY2.js → oauth-callback-IuYTWMST.js} +1 -1
  88. package/dist/client/assets/{page-CRtItJfu.js → page-C36S8a5W.js} +1 -1
  89. package/dist/client/assets/page-C9G8C61g.js +21 -0
  90. package/dist/client/assets/{pin-to-sidebar-button-C6dzy2Sp.js → pin-to-sidebar-button-WVVRk2lw.js} +1 -1
  91. package/dist/client/assets/{plugin-empty-state-DC-Bc-Hq.js → plugin-empty-state-ByA0OkEn.js} +1 -1
  92. package/dist/client/assets/{plugin-header-ChOrvFfE.js → plugin-header-D5yHZtXf.js} +1 -1
  93. package/dist/client/assets/{plugins-BgTbwOTC.js → plugins-OwUnN1ka.js} +1 -1
  94. package/dist/client/assets/{popover-D5eKc-lR.js → popover-CshCl6w-.js} +1 -1
  95. package/dist/client/assets/{registry-utils-ButNyWVv.js → registry-utils-D7Dqr6wv.js} +1 -1
  96. package/dist/client/assets/{resizable-DXIy41ZI.js → resizable-B1zLCIJb.js} +1 -1
  97. package/dist/client/assets/{resource-tabs-D9U7wwIj.js → resource-tabs-CRbf__IW.js} +1 -1
  98. package/dist/client/assets/{select-DypP_ctF.js → select-4bCSDmWU.js} +1 -1
  99. package/dist/client/assets/{settings-mRHoZXOZ.js → settings-CR5PvLr2.js} +1 -1
  100. package/dist/client/assets/{shell-layout-DOTt2kmG.js → shell-layout-FpAzDkjt.js} +1 -1
  101. package/dist/client/assets/{spinner-y-sEdyFB.js → spinner-BipWRp7l.js} +1 -1
  102. package/dist/client/assets/{switch-SVkH95AH.js → switch-C_F_zeuN.js} +1 -1
  103. package/dist/client/assets/{textarea-bmWEiN7l.js → textarea-BZmzcANs.js} +1 -1
  104. package/dist/client/assets/{tool-set-selector-DhQ3jxep.js → tool-set-selector-DMyguAVM.js} +1 -1
  105. package/dist/client/assets/{tools-list-Ds7Jsail.js → tools-list-CM9pIRwn.js} +1 -1
  106. package/dist/client/assets/{tooltip-BQbbKnxv.js → tooltip-D3Kw0HUb.js} +1 -1
  107. package/dist/client/assets/{typewriter-title-BiqUerVd.js → typewriter-title-zajICLfm.js} +1 -1
  108. package/dist/client/assets/{use-binding-C219fPLm.js → use-binding-Ba3v4zMi.js} +1 -1
  109. package/dist/client/assets/{use-collections-CvkTm_6U.js → use-collections-BQHGs5iU.js} +1 -1
  110. package/dist/client/assets/{use-connection-D8u2E4QD.js → use-connection-D03dTvtG.js} +1 -1
  111. package/dist/client/assets/{use-create-virtual-mcp-hwvm94Q5.js → use-create-virtual-mcp-Cpzz-1zf.js} +1 -1
  112. package/dist/client/assets/{use-list-state-B9azqHgQ.js → use-list-state-B0KtA_q9.js} +1 -1
  113. package/dist/client/assets/{use-members-BfTFBzTl.js → use-members-CHh5MLEe.js} +1 -1
  114. package/dist/client/assets/{use-mobile-RHn4NyjN.js → use-mobile-Q27OeJ4I.js} +1 -1
  115. package/dist/client/assets/{use-organization-settings-AWdRXyNF.js → use-organization-settings-CRV4VKdj.js} +1 -1
  116. package/dist/client/assets/{use-virtual-mcp-D17yOOVF.js → use-virtual-mcp-CJ7FNu85.js} +1 -1
  117. package/dist/client/assets/{use-virtual-mcp-system-prompt-CC3fRmBB.js → use-virtual-mcp-system-prompt-BfXjv37Y.js} +1 -1
  118. package/dist/client/assets/useInfiniteQuery-shmHdaex.js +1 -0
  119. package/dist/client/assets/{useMutation-ByLbENlF.js → useMutation-BJoWTtTW.js} +1 -1
  120. package/dist/client/assets/useQuery-CcFgJIAV.js +1 -0
  121. package/dist/client/assets/{value-Bupbegsn.js → value-C0VGfi9E.js} +1 -1
  122. package/dist/client/assets/{view-mode-toggle-DgsbED3E.js → view-mode-toggle-BkNnvYv5.js} +1 -1
  123. package/dist/client/assets/{virtual-mcp-Mmz1T7Sl.js → virtual-mcp-BBuKM0Zd.js} +1 -1
  124. package/dist/client/assets/{workflow-BnYCXhHP.js → workflow-CxGNxRFo.js} +1 -1
  125. package/dist/client/index.html +1 -1
  126. package/dist/server/cli.js +174 -154
  127. package/dist/server/migrate.js +146 -126
  128. package/dist/server/server.js +189 -189
  129. package/package.json +1 -1
  130. package/dist/client/assets/constants-B4VvhBhE.js +0 -1
  131. package/dist/client/assets/page-BjhbwMHp.js +0 -21
  132. package/dist/client/assets/useInfiniteQuery-xJm-Bx7q.js +0 -1
  133. package/dist/client/assets/useQuery-DoX2gsGK.js +0 -1
@@ -0,0 +1,21 @@
1
+ import{bz as Rs,br as js,r as $,j as v,c as ue,e as _n,d as Vs}from"./index-BipFUdjC.js";import{C as se,a as Os,b as Bs}from"./index-BMtR19Aw.js";import{t as Wo,T as Fs}from"./typewriter-title-zajICLfm.js";import{E as qo}from"./error-boundary-CG0YZ4B8.js";import{u as Xs}from"./localstorage-keys-CqdQQHDa.js";import{u as bn}from"./virtual-mcp-BBuKM0Zd.js";import{c as Go,B as Ko}from"./button-CWaK1hUN.js";import{c as Ys,T as Zs,a as Ws}from"./tooltip-D3Kw0HUb.js";import{V as qs}from"./view-mode-toggle-BkNnvYv5.js";import{i as Gs}from"./GitBranch01-8cUKFct3.js";import{s as Ks}from"./Plus-BBofXpHO.js";import{I as Uo,n as Us}from"./empty-state-CfCSwnz1.js";import{i as Qs}from"./CpuChip02-D4-bIMj_.js";import{e as Js}from"./use-collections-BQHGs5iU.js";import{a as ea}from"./use-connection-D03dTvtG.js";import{W as ta,u as na}from"./constants-D7TSocv6.js";import{u as oa}from"./use-virtual-mcp-CJ7FNu85.js";import{i as ke,c as Gn,a as Kn,b as ra,d as Jt,T as en,e as ia}from"./value-C0VGfi9E.js";import"./X-C-LXD8Fs.js";import"./use-binding-Ba3v4zMi.js";import"./binder-BG1MkJXb.js";import"./monaco-editor-DkDnm6Tx.js";import"./infiniteQueryObserver-FEDpWaxK.js";import"./spinner-BipWRp7l.js";import"./use-virtual-mcp-system-prompt-BfXjv37Y.js";import"./input-CJlzp_V5.js";import"./popover-CshCl6w-.js";import"./select-4bCSDmWU.js";import"./Check-n_KiNdp_.js";import"./ChevronDown-BDe2LrLc.js";import"./File06-CbLEGD6l.js";import"./Grid01-D_y10H_F.js";import"./Image01-DAeUMBHm.js";import"./SearchMd-BCAxnQkD.js";import"./index-CJvrv3U6.js";import"./useQuery-CcFgJIAV.js";import"./dialog-CkzeDWMv.js";import"./form-BJcgMy55.js";import"./AlertCircle-BRWDZx_r.js";import"./ArrowUp-07dwm1MA.js";import"./Edit01-nGCAvXPD.js";import"./Copy01-dSgWMnr9.js";import"./Terminal-rmcOb2qR.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-r91jWYrx.js";import"./use-create-virtual-mcp-Cpzz-1zf.js";import"./useMutation-BJoWTtTW.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 sa={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 aa(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=aa(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=ca(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).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,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[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,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function ca(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]=sa,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 la(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 ua(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Qo(e){var t=jt(e);return(t.local?ua:la)(t)}function da(){}function En(e){return e==null?da:function(){return this.querySelector(e)}}function fa(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 i=t[r],s=i.length,a=o[r]=new Array(s),l,c,d=0;d<s;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new le(o,this._parents)}function ha(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ga(){return[]}function Jo(e){return e==null?ga:function(){return this.querySelectorAll(e)}}function pa(e){return function(){return ha(e.apply(this,arguments))}}function ma(e){typeof e=="function"?e=pa(e):e=Jo(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));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 ya=Array.prototype.find;function xa(e){return function(){return ya.call(this.children,e)}}function wa(){return this.firstElementChild}function va(e){return this.select(e==null?wa:xa(typeof e=="function"?e:tr(e)))}var _a=Array.prototype.filter;function ba(){return Array.from(this.children)}function Ea(e){return function(){return _a.call(this.children,e)}}function Sa(e){return this.selectAll(e==null?ba:Ea(typeof e=="function"?e:tr(e)))}function Na(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 i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new le(o,this._parents)}function nr(e){return new Array(e.length)}function Ca(){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 Ma(e){return function(){return e}}function Ia(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new kt(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function ka(e,t,n,o,r,i,s){var a,l,c=new Map,d=t.length,u=i.length,f=new Array(d),g;for(a=0;a<d;++a)(l=t[a])&&(f[a]=g=s.call(l,l.__data__,a,t)+"",c.has(g)?r[a]=l:c.set(g,l));for(a=0;a<u;++a)g=s.call(e,i[a],a,i)+"",(l=c.get(g))?(o[a]=l,l.__data__=i[a],c.delete(g)):n[a]=new kt(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Pa(e){return e.__data__}function Aa(e,t){if(!arguments.length)return Array.from(this,Pa);var n=t?ka:Ia,o=this._parents,r=this._groups;typeof e!="function"&&(e=Ma(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=o[c],u=r[c],f=u.length,g=Ta(e.call(d,d&&d.__data__,c,o)),p=g.length,w=a[c]=new Array(p),_=s[c]=new Array(p),m=l[c]=new Array(f);n(d,u,w,_,m,g,t);for(var b=0,h=0,y,S;b<p;++b)if(y=w[b]){for(b>=h&&(h=b+1);!(S=_[h])&&++h<p;);y._next=S||null}}return s=new le(s,o),s._enter=a,s._exit=l,s}function Ta(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Da(){return new le(this._exit||this._groups.map(nr),this._parents)}function za(e,t,n){var o=this.enter(),r=this,i=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?i.remove():n(i),o&&r?o.merge(r).order():r}function $a(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],d=o[l],u=c.length,f=a[l]=new Array(u),g,p=0;p<u;++p)(g=c[p]||d[p])&&(f[p]=g);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function Ha(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function La(e){e||(e=Ra);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,d=0;d<a;++d)(c=s[d])&&(l[d]=c);l.sort(t)}return new le(r,this._parents).order()}function Ra(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ja(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Va(){return Array.from(this)}function Oa(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Ba(){let e=0;for(const t of this)++e;return e}function Fa(){return!this.node()}function Xa(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Ya(e){return function(){this.removeAttribute(e)}}function Za(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Wa(e,t){return function(){this.setAttribute(e,t)}}function qa(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ga(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ka(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 Ua(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?Za:Ya:typeof t=="function"?n.local?Ka:Ga:n.local?qa:Wa)(n,t))}function or(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Qa(e){return function(){this.style.removeProperty(e)}}function Ja(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ec(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function tc(e,t,n){return arguments.length>1?this.each((t==null?Qa:typeof t=="function"?ec:Ja)(e,t,n??"")):Ve(this.node(),e)}function Ve(e,t){return e.style.getPropertyValue(t)||or(e).getComputedStyle(e,null).getPropertyValue(t)}function nc(e){return function(){delete this[e]}}function oc(e,t){return function(){this[e]=t}}function rc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ic(e,t){return arguments.length>1?this.each((t==null?nc:typeof t=="function"?rc:oc)(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 sc(e){return function(){sr(this,e)}}function ac(e){return function(){ar(this,e)}}function cc(e,t){return function(){(t.apply(this,arguments)?sr:ar)(this,e)}}function lc(e,t){var n=rr(e+"");if(arguments.length<2){for(var o=Sn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?cc:t?sc:ac)(n,t))}function uc(){this.textContent=""}function dc(e){return function(){this.textContent=e}}function fc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function hc(e){return arguments.length?this.each(e==null?uc:(typeof e=="function"?fc:dc)(e)):this.node().textContent}function gc(){this.innerHTML=""}function pc(e){return function(){this.innerHTML=e}}function mc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function yc(e){return arguments.length?this.each(e==null?gc:(typeof e=="function"?mc:pc)(e)):this.node().innerHTML}function xc(){this.nextSibling&&this.parentNode.appendChild(this)}function wc(){return this.each(xc)}function vc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _c(){return this.each(vc)}function bc(e){var t=typeof e=="function"?e:Qo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ec(){return null}function Sc(e,t){var n=typeof e=="function"?e:Qo(e),o=t==null?Ec:typeof t=="function"?t:En(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Nc(){var e=this.parentNode;e&&e.removeChild(this)}function Cc(){return this.each(Nc)}function Mc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ic(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function kc(e){return this.select(e?Ic:Mc)}function Pc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ac(e){return function(t){e.call(this,t,this.__data__)}}function Tc(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 Dc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function zc(e,t,n){return function(){var o=this.__on,r,i=Ac(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function $c(e,t,n){var o=Tc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,d;l<c;++l)for(r=0,d=a[l];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?zc:Dc,r=0;r<i;++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 Hc(e,t){return function(){return cr(this,e,t)}}function Lc(e,t){return function(){return cr(this,e,t.apply(this,arguments))}}function Rc(e,t){return this.each((typeof t=="function"?Lc:Hc)(e,t))}function*jc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var lr=[null];function le(e,t){this._groups=e,this._parents=t}function ut(){return new le([[document.documentElement]],lr)}function Vc(){return this}le.prototype=ut.prototype={constructor:le,select:fa,selectAll:ma,selectChild:va,selectChildren:Sa,filter:Na,data:Aa,enter:Ca,exit:Da,join:za,merge:$a,selection:Vc,order:Ha,sort:La,call:ja,nodes:Va,node:Oa,size:Ba,empty:Fa,each:Xa,attr:Ua,style:tc,property:ic,classed:lc,text:hc,html:yc,raise:wc,lower:_c,append:bc,insert:Sc,remove:Cc,clone:kc,datum:Pc,on:$c,dispatch:Rc,[Symbol.iterator]:jc};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],lr)}function Oc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Oc(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 Bc={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:i,x:s,y:a,dx:l,dy:c,dispatch:d}){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:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}un.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Fc(e){return!e.ctrlKey&&!e.button}function Xc(){return this.parentNode}function Yc(e,t){return t??{x:e.x,y:e.y}}function Zc(){return navigator.maxTouchPoints||"ontouchstart"in this}function fr(){var e=Fc,t=Xc,n=Yc,o=Zc,r={},i=Rt("start","drag","end"),s=0,a,l,c,d,u=0;function f(y){y.on("mousedown.drag",g).filter(o).on("touchstart.drag",_).on("touchmove.drag",m,Bc).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(!(d||!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",w,ot),ur(y.view),tn(y),c=!1,a=y.clientX,l=y.clientY,E("start",y))}}function p(y){if(je(y),!c){var S=y.clientX-a,E=y.clientY-l;c=S*S+E*E>u}r.mouse("drag",y)}function w(y){ce(y.view).on("mousemove.drag mouseup.drag",null),dr(y.view,c),je(y),r.mouse("end",y)}function _(y,S){if(e.call(this,y,S)){var E=y.changedTouches,C=t.call(this,y,S),T=E.length,A,j;for(A=0;A<T;++A)(j=h(this,C,y,S,E[A].identifier,E[A]))&&(tn(y),j("start",y,E[A]))}}function m(y){var S=y.changedTouches,E=S.length,C,T;for(C=0;C<E;++C)(T=r[S[C].identifier])&&(je(y),T("drag",y,S[C]))}function b(y){var S=y.changedTouches,E=S.length,C,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),C=0;C<E;++C)(T=r[S[C].identifier])&&(tn(y),T("end",y,S[C]))}function h(y,S,E,C,T,A){var j=i.copy(),M=de(A||E,S),z,H,x;if((x=n.call(y,new un("beforestart",{sourceEvent:E,target:f,identifier:T,active:s,x:M[0],y:M[1],dx:0,dy:0,dispatch:j}),C))!=null)return z=x.x-M[0]||0,H=x.y-M[1]||0,function I(N,P,k){var D=M,L;switch(N){case"start":r[T]=I,L=s++;break;case"end":delete r[T],--s;case"drag":M=de(k||P,S),L=s;break}j.call(N,y,new un(N,{sourceEvent:P,subject:x,target:f,identifier:T,active:L,x:M[0]+z,y:M[1]+H,dx:M[0]-D[0],dy:M[1]-D[1],dispatch:j}),C)}}return f.filter=function(y){return arguments.length?(e=typeof y=="function"?y:mt(!!y),f):e},f.container=function(y){return arguments.length?(t=typeof y=="function"?y:mt(y),f):t},f.subject=function(y){return arguments.length?(n=typeof y=="function"?y:mt(y),f):n},f.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:mt(!!y),f):o},f.on=function(){var y=i.on.apply(i,arguments);return y===i?f:y},f.clickDistance=function(y){return arguments.length?(u=(y=+y)*y,f):Math.sqrt(u)},f}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,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Jn,skewX:Math.atan(l)*Jn,scaleX:s,scaleY:a}}var yt;function Wc(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 qc(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(c){return c.length?c.pop()+" ":""}function i(c,d,u,f,g,p){if(c!==u||d!==f){var w=g.push("translate(",null,t,null,n);p.push({i:w-4,x:ke(c,u)},{i:w-2,x:ke(d,f)})}else(u||f)&&g.push("translate("+u+t+f+n)}function s(c,d,u,f){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),f.push({i:u.push(r(u)+"rotate(",null,o)-2,x:ke(c,d)})):d&&u.push(r(u)+"rotate("+d+o)}function a(c,d,u,f){c!==d?f.push({i:u.push(r(u)+"skewX(",null,o)-2,x:ke(c,d)}):d&&u.push(r(u)+"skewX("+d+o)}function l(c,d,u,f,g,p){if(c!==u||d!==f){var w=g.push(r(g)+"scale(",null,",",null,")");p.push({i:w-4,x:ke(c,u)},{i:w-2,x:ke(d,f)})}else(u!==1||f!==1)&&g.push(r(g)+"scale("+u+","+f+")")}return function(c,d){var u=[],f=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,u,f),s(c.rotate,d.rotate,u,f),a(c.skewX,d.skewX,u,f),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,f),c=d=null,function(g){for(var p=-1,w=f.length,_;++p<w;)u[(_=f[p]).i]=_.x(g);return u.join("")}}}var Gc=gr(Wc,"px, ","px)","deg)"),Kc=gr(qc,", ",")",")"),Uc=1e-12;function eo(e){return((e=Math.exp(e))+1/e)/2}function Qc(e){return((e=Math.exp(e))-1/e)/2}function Jc(e){return((e=Math.exp(2*e))-1)/(e+1)}const Nt=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],d=s[0],u=s[1],f=s[2],g=d-a,p=u-l,w=g*g+p*p,_,m;if(w<Uc)m=Math.log(f/c)/t,_=function(C){return[a+C*g,l+C*p,c*Math.exp(t*C*m)]};else{var b=Math.sqrt(w),h=(f*f-c*c+o*w)/(2*c*n*b),y=(f*f-c*c-o*w)/(2*f*n*b),S=Math.log(Math.sqrt(h*h+1)-h),E=Math.log(Math.sqrt(y*y+1)-y);m=(E-S)/t,_=function(C){var T=C*m,A=eo(S),j=c/(n*b)*(A*Jc(t*T+S)-Qc(S));return[a+j*g,l+j*p,c*A/eo(t*T+S)]}}return _.duration=m*1e3*t/Math.SQRT2,_}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Oe=0,Je=0,Ue=0,pr=1e3,Pt,et,At=0,Te=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 Te||(mr(el),Te=rt.now()+Vt)}function el(){Te=0}function Tt(){this._call=this._time=this._next=null}Tt.prototype=yr.prototype={constructor:Tt,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:Pt=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 Tt;return o.restart(e,t,n),o}function tl(){Nn(),++Oe;for(var e=Pt,t;e;)(t=Te-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Oe}function to(){Te=(At=rt.now())+Vt,Oe=Je=0;try{tl()}finally{Oe=0,ol(),Te=0}}function nl(){var e=rt.now(),t=e-At;t>pr&&(Vt-=t,At=e)}function ol(){for(var e,t=Pt,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:Pt=n);et=e,fn(o)}function fn(e){if(!Oe){Je&&(Je=clearTimeout(Je));var t=e-Te;t>24?(e<1/0&&(Je=setTimeout(to,e-rt.now()-Vt)),Ue&&(Ue=clearInterval(Ue))):(Ue||(At=rt.now(),Ue=setInterval(nl,pr)),Oe=1,mr(to))}}function no(e,t,n){var o=new Tt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var rl=Rt("start","end","cancel","interrupt"),il=[],xr=0,oo=1,hn=2,Ct=3,ro=4,gn=5,Mt=6;function Ot(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;sl(e,n,{name:t,index:o,group:r,on:rl,tween:il,time:i.time,delay:i.delay,duration:i.duration,ease:i.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 sl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=yr(i,0,n.time);function i(c){n.state=oo,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var d,u,f,g;if(n.state!==oo)return l();for(d in o)if(g=o[d],g.name===n.name){if(g.state===Ct)return no(s);g.state===ro?(g.state=Mt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[d]):+d<t&&(g.state=Mt,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[d])}if(no(function(){n.state===Ct&&(n.state=ro,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=hn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===hn){for(n.state=Ct,r=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(g=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=g);r.length=u+1}}function a(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=gn,1),u=-1,f=r.length;++u<f;)r[u].call(e,d);n.state===gn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Mt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function It(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!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[s]}i&&delete e.__transition}}function al(e){return this.each(function(){It(this,e)})}function cl(e,t){var n,o;return function(){var r=me(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function ll(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=me(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function ul(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ge(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?cl:ll)(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 Gn?Kn:(n=Gn(t))?(t=n,Kn):ra)(e,t)}function dl(e){return function(){this.removeAttribute(e)}}function fl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function hl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function gl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function pl(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function ml(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function yl(e,t){var n=jt(e),o=n==="transform"?Kc:wr;return this.attrTween(e,typeof t=="function"?(n.local?ml:pl)(n,o,Mn(this,"attr."+e,t)):t==null?(n.local?fl:dl)(n):(n.local?gl:hl)(n,o,t))}function xl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function wl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function vl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&wl(e,i)),n}return r._value=t,r}function _l(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&xl(e,i)),n}return r._value=t,r}function bl(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?vl:_l)(o,t))}function El(e,t){return function(){Cn(this,e).delay=+t.apply(this,arguments)}}function Sl(e,t){return t=+t,function(){Cn(this,e).delay=t}}function Nl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?El:Sl)(t,e)):ge(this.node(),t).delay}function Cl(e,t){return function(){me(this,e).duration=+t.apply(this,arguments)}}function Ml(e,t){return t=+t,function(){me(this,e).duration=t}}function Il(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Cl:Ml)(t,e)):ge(this.node(),t).duration}function kl(e,t){if(typeof t!="function")throw new Error;return function(){me(this,e).ease=t}}function Pl(e){var t=this._id;return arguments.length?this.each(kl(t,e)):ge(this.node(),t).ease}function Al(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;me(this,e).ease=n}}function Tl(e){if(typeof e!="function")throw new Error;return this.each(Al(this._id,e))}function Dl(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 i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new ve(o,this._parents,this._name,this._id)}function zl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],d=l.length,u=s[a]=new Array(d),f,g=0;g<d;++g)(f=l[g]||c[g])&&(u[g]=f);for(;a<o;++a)s[a]=t[a];return new ve(s,this._parents,this._name,this._id)}function $l(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 Hl(e,t,n){var o,r,i=$l(t)?Cn:me;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function Ll(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(Hl(n,e,t))}function Rl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function jl(){return this.on("end.remove",Rl(this._id))}function Vl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=En(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),d,u,f=0;f<l;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),c[f]=u,Ot(c[f],t,n,f,c,ge(d,n)));return new ve(i,this._parents,t,n)}function Ol(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jo(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,d,u=0;u<c;++u)if(d=l[u]){for(var f=e.call(d,d.__data__,u,l),g,p=ge(d,n),w=0,_=f.length;w<_;++w)(g=f[w])&&Ot(g,t,n,w,f,p);i.push(f),s.push(d)}return new ve(i,s,t,n)}var Bl=ut.prototype.constructor;function Fl(){return new Bl(this._groups,this._parents)}function Xl(e,t){var n,o,r;return function(){var i=Ve(this,e),s=(this.style.removeProperty(e),Ve(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function vr(e){return function(){this.style.removeProperty(e)}}function Yl(e,t,n){var o,r=n+"",i;return function(){var s=Ve(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Zl(e,t,n){var o,r,i;return function(){var s=Ve(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ve(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function Wl(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=me(this,e),c=l.on,d=l.value[i]==null?a||(a=vr(t)):void 0;(c!==n||r!==d)&&(o=(n=c).copy()).on(s,r=d),l.on=o}}function ql(e,t,n){var o=(e+="")=="transform"?Gc:wr;return t==null?this.styleTween(e,Xl(e,o)).on("end.style."+e,vr(e)):typeof t=="function"?this.styleTween(e,Zl(e,o,Mn(this,"style."+e,t))).each(Wl(this._id,e)):this.styleTween(e,Yl(e,o,t),n).on("end.style."+e,null)}function Gl(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Kl(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Gl(e,s,n)),o}return i._value=t,i}function Ul(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,Kl(e,t,n??""))}function Ql(e){return function(){this.textContent=e}}function Jl(e){return function(){var t=e(this);this.textContent=t??""}}function eu(e){return this.tween("text",typeof e=="function"?Jl(Mn(this,"text",e)):Ql(e==null?"":e+""))}function tu(e){return function(t){this.textContent=e.call(this,t)}}function nu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&tu(r)),t}return o._value=e,o}function ou(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,nu(e))}function ru(){for(var e=this._name,t=this._id,n=_r(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var d=ge(l,t);Ot(l,e,n,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new ve(o,this._parents,e,n)}function iu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=me(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var su=0;function ve(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function _r(){return++su}var xe=ut.prototype;ve.prototype={constructor:ve,select:Vl,selectAll:Ol,selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:Dl,merge:zl,selection:Fl,transition:ru,call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:Ll,attr:yl,attrTween:bl,style:ql,styleTween:Ul,text:eu,textTween:ou,remove:jl,tween:ul,delay:Nl,duration:Il,ease:Pl,easeVarying:Tl,end:iu,[Symbol.iterator]:xe[Symbol.iterator]};function au(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cu={time:null,delay:0,duration:250,ease:au};function lu(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 uu(e){var t,n;e instanceof ve?(t=e._id,e=e._name):(t=_r(),(n=cu).time=Nn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Ot(l,e,t,c,s,n||lu(l,t));return new ve(o,this._parents,e,t)}ut.prototype.interrupt=al;ut.prototype.transition=uu;const xt=e=>()=>e;function du(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 fu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function hu(){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 gu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function pu(){return navigator.maxTouchPoints||"ontouchstart"in this}function mu(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Er(){var e=fu,t=hu,n=mu,o=gu,r=pu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Nt,c=Rt("start","zoom","end"),d,u,f,g=500,p=150,w=0,_=10;function m(x){x.property("__zoom",io).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",j).filter(r).on("touchstart.zoom",M).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(x,I,N,P){var k=x.selection?x.selection():x;k.property("__zoom",io),x!==k?S(x,I,N,P):k.interrupt().each(function(){E(this,arguments).event(P).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},m.scaleBy=function(x,I,N,P){m.scaleTo(x,function(){var k=this.__zoom.k,D=typeof I=="function"?I.apply(this,arguments):I;return k*D},N,P)},m.scaleTo=function(x,I,N,P){m.transform(x,function(){var k=t.apply(this,arguments),D=this.__zoom,L=N==null?y(k):typeof N=="function"?N.apply(this,arguments):N,V=D.invert(L),R=typeof I=="function"?I.apply(this,arguments):I;return n(h(b(D,R),L,V),k,s)},N,P)},m.translateBy=function(x,I,N,P){m.transform(x,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,P)},m.translateTo=function(x,I,N,P,k){m.transform(x,function(){var D=t.apply(this,arguments),L=this.__zoom,V=P==null?y(D):typeof P=="function"?P.apply(this,arguments):P;return n(Bt.translate(V[0],V[1]).scale(L.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof N=="function"?-N.apply(this,arguments):-N),D,s)},P,k)};function b(x,I){return I=Math.max(i[0],Math.min(i[1],I)),I===x.k?x:new we(I,x.x,x.y)}function h(x,I,N){var P=I[0]-N[0]*x.k,k=I[1]-N[1]*x.k;return P===x.x&&k===x.y?x:new we(x.k,P,k)}function y(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}function S(x,I,N,P){x.on("start.zoom",function(){E(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(P).end()}).tween("zoom",function(){var k=this,D=arguments,L=E(k,D).event(P),V=t.apply(k,D),R=N==null?y(V):typeof N=="function"?N.apply(k,D):N,F=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),B=k.__zoom,W=typeof I=="function"?I.apply(k,D):I,K=l(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(x,I,N){return!N&&x.__zooming||new C(x,I)}function C(x,I){this.that=x,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,I),this.taps=0}C.prototype={event:function(x){return x&&(this.sourceEvent=x),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(x,I){return this.mouse&&x!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&x!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(x){var I=ce(this.that).datum();c.call(x,this.that,new du(x,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),I)}};function T(x,...I){if(!e.apply(this,arguments))return;var N=E(this,I).event(x),P=this.__zoom,k=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,o.apply(this,arguments)))),D=de(x);if(N.wheel)(N.mouse[0][0]!==D[0]||N.mouse[0][1]!==D[1])&&(N.mouse[1]=P.invert(N.mouse[0]=D)),clearTimeout(N.wheel);else{if(P.k===k)return;N.mouse=[D,P.invert(D)],It(this),N.start()}Qe(x),N.wheel=setTimeout(L,p),N.zoom("mouse",n(h(b(P,k),N.mouse[0],N.mouse[1]),N.extent,s));function L(){N.wheel=null,N.end()}}function A(x,...I){if(f||!e.apply(this,arguments))return;var N=x.currentTarget,P=E(this,I,!0).event(x),k=ce(x.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),D=de(x,N),L=x.clientX,V=x.clientY;ur(x.view),nn(x),P.mouse=[D,this.__zoom.invert(D)],It(this),P.start();function R(B){if(Qe(B),!P.moved){var W=B.clientX-L,K=B.clientY-V;P.moved=W*W+K*K>w}P.event(B).zoom("mouse",n(h(P.that.__zoom,P.mouse[0]=de(B,N),P.mouse[1]),P.extent,s))}function F(B){k.on("mousemove.zoom mouseup.zoom",null),dr(B.view,P.moved),Qe(B),P.event(B).end()}}function j(x,...I){if(e.apply(this,arguments)){var N=this.__zoom,P=de(x.changedTouches?x.changedTouches[0]:x,this),k=N.invert(P),D=N.k*(x.shiftKey?.5:2),L=n(h(b(N,D),P,k),t.apply(this,I),s);Qe(x),a>0?ce(this).transition().duration(a).call(S,L,P,x):ce(this).call(m.transform,L,P,x)}}function M(x,...I){if(e.apply(this,arguments)){var N=x.touches,P=N.length,k=E(this,I,x.changedTouches.length===P).event(x),D,L,V,R;for(nn(x),L=0;L<P;++L)V=N[L],R=de(V,this),R=[R,this.__zoom.invert(R),V.identifier],k.touch0?!k.touch1&&k.touch0[2]!==R[2]&&(k.touch1=R,k.taps=0):(k.touch0=R,D=!0,k.taps=1+!!d);d&&(d=clearTimeout(d)),D&&(k.taps<2&&(u=R[0],d=setTimeout(function(){d=null},g)),It(this),k.start())}}function z(x,...I){if(this.__zooming){var N=E(this,I).event(x),P=x.changedTouches,k=P.length,D,L,V,R;for(Qe(x),D=0;D<k;++D)L=P[D],V=de(L,this),N.touch0&&N.touch0[2]===L.identifier?N.touch0[0]=V:N.touch1&&N.touch1[2]===L.identifier&&(N.touch1[0]=V);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)),V=[(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)V=N.touch0[0],R=N.touch0[1];else return;N.zoom("touch",n(h(L,V,R),N.extent,s))}}function H(x,...I){if(this.__zooming){var N=E(this,I).event(x),P=x.changedTouches,k=P.length,D,L;for(nn(x),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),D=0;D<k;++D)L=P[D],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(u[0]-L[0],u[1]-L[1])<_)){var V=ce(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(x){return arguments.length?(o=typeof x=="function"?x:xt(+x),m):o},m.filter=function(x){return arguments.length?(e=typeof x=="function"?x:xt(!!x),m):e},m.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:xt(!!x),m):r},m.extent=function(x){return arguments.length?(t=typeof x=="function"?x:xt([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),m):t},m.scaleExtent=function(x){return arguments.length?(i[0]=+x[0],i[1]=+x[1],m):[i[0],i[1]]},m.translateExtent=function(x){return arguments.length?(s[0][0]=+x[0][0],s[1][0]=+x[1][0],s[0][1]=+x[0][1],s[1][1]=+x[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(x){return arguments.length?(n=x,m):n},m.duration=function(x){return arguments.length?(a=+x,m):a},m.interpolate=function(x){return arguments.length?(l=x,m):l},m.on=function(){var x=c.on.apply(c,arguments);return x===c?m:x},m.clickDistance=function(x){return arguments.length?(w=(x=+x)*x,m):Math.sqrt(w)},m.tapDistance=function(x){return arguments.length?(_=+x,m):_},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 Ae;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ae||(Ae={}));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 Dt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Dt||(Dt={}));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,yu=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,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},xu=(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 i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):In(r)?r:t.nodeLookup.get(r.id));const a=s?zt(s,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],i=!1,s=!1)=>{const a={...gt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=c;if(s&&!u||f)continue;const g=d.width??c.width??c.initialWidth??null,p=d.height??c.height??c.initialHeight??null,w=at(a,Xe(c)),_=(g??0)*(p??0),m=i&&w>0;(!c.internals.handleBounds||m||w>=_||c.dragging)&&l.push(c)}return l},wu=(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 vu(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 _u({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=vu(e,s),l=ft(a),c=Pn(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function kr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",pe.error005());else{const g=a.measured.width,p=a.measured.height;g&&p&&(u=[[l,c],[l+g,c+p]])}else a&&Ye(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const f=Ye(u)?De(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",pe.error015()),{position:{x:f.x-l+(s.measured.width??0)*d[0],y:f.y-c+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function bu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const g=i.has(f.id),p=!g&&f.parentId&&s.find(w=>w.id===f.parentId);(g||p)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),d=wu(s,l);for(const f of l)a.has(f.id)&&!d.find(p=>p.id===f.id)&&d.push(f);if(!r)return{edges:d,nodes:s};const u=await r({nodes:s,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}const Fe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),De=(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 Pr(e,t,n){const{width:o,height:r}=_e(n),{x:i,y:s}=n.internals.positionAbsolute;return De(e,[[i,s],[i+o,s+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,Ar=(e,t,n=15,o=40)=>{const r=ao(e.x,o,t.width-o)*n,i=ao(e.y,o,t.height-o)*n;return[r,i]},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)}},Tr=(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),Eu=(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],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?ht(a,s):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 Su(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),i=He(e.left??e.x??0,t),s=He(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Nu(e,t,n,o,r,i){const{x:s,y:a}=$t(e,[t,n,o]),{x:l,y:c}=$t({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-l,u=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Pn=(e,t,n,o,r,i)=>{const s=Su(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),d=Fe(c,o,r),u=e.x+e.width/2,f=e.y+e.height/2,g=t/2-u*d,p=n/2-f*d,w=Nu(e,g,p,d,t,n),_={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:g-_.left+_.right,y:p-_.top+_.bottom,zoom:d}},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 Dr(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 i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}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 Cu(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Mu(e){return{...Nr,...e||{}}}function tt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=he(e),a=gt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?ht(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const An=e=>({width:e.offsetWidth,height:e.offsetHeight}),$r=e=>e?.getRootNode?.()||window?.document,Iu=["INPUT","SELECT","TEXTAREA"];function Hr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Iu.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 i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...An(s)}})};function Rr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,d=Math.abs(l-e),u=Math.abs(c-t);return[l,c,d,u]}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:i}){switch(e){case X.Left:return[t-wt(t-o,i),n];case X.Right:return[t+wt(o-t,i),n];case X.Top:return[t,n-wt(n-r,i)];case X.Bottom:return[t,n+wt(r-n,i)]}}function jr({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,l]=fo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=fo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,f,g,p]=Rr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${o},${r}`,u,f,g,p]}function Vr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function ku({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=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 s+a}function Pu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Ft(zt(e),zt(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return at(s,Xt(i))>0}const Au=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Tu=(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)),Du=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Au;let r;return Ir(e)?r={...e}:r={...e,id:o(e)},Tu(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,i,s,a]=Vr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,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}},zu=({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 $u({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=ho[t],l=ho[o],c={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},u=zu({source:c,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",g=u[f];let p=[],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[f]*l[f]===-1){f==="x"?(w=r.x??c.x+(d.x-c.x)*s,_=r.y??(c.y+d.y)/2):(w=r.x??(c.x+d.x)/2,_=r.y??c.y+(d.y-c.y)*s);const E=[{x:w,y:c.y},{x:w,y:d.y}],C=[{x:c.x,y:_},{x:d.x,y:_}];a[f]===g?p=f==="x"?E:C:p=f==="x"?C:E}else{const E=[{x:c.x,y:d.y}],C=[{x:d.x,y:c.y}];if(f==="x"?p=a.x===g?C:E:p=a.y===g?E:C,t===o){const z=Math.abs(e[f]-n[f]);if(z<=i){const H=Math.min(i-1,i-z);a[f]===g?m[f]=(c[f]>e[f]?-1:1)*H:b[f]=(d[f]>n[f]?-1:1)*H}}if(t!==o){const z=f==="x"?"y":"x",H=a[f]===l[z],x=c[z]>d[z],I=c[z]<d[z];(a[f]===1&&(!H&&x||H&&I)||a[f]!==1&&(!H&&I||H&&x))&&(p=f==="x"?E:C)}const T={x:c.x+m.x,y:c.y+m.y},A={x:d.x+b.x,y:d.y+b.y},j=Math.max(Math.abs(T.x-p[0].x),Math.abs(A.x-p[0].x)),M=Math.max(Math.abs(T.y-p[0].y),Math.abs(A.y-p[0].y));j>=M?(w=(T.x+A.x)/2,_=p[0].y):(w=p[0].x,_=(T.y+A.y)/2)}return[[e,{x:c.x+m.x,y:c.y+m.y},...p,{x:d.x+b.x,y:d.y+b.y},n],w,_,h,y]}function Hu(e,t,n,o){const r=Math.min(go(e,t)/2,go(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*d}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function mn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:d=.5}){const[u,f,g,p,w]=$u({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:d});return[u.reduce((m,b,h)=>{let y="";return h>0&&h<u.length-1?y=Hu(u[h-1],b,u[h+1],s):y=`${h===0?"M":"L"}${b.x} ${b.y}`,m+=y,m},""),f,g,p,w]}function po(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Lu(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),i=yo(o?.source??[],e.sourceHandle),s=yo(e.connectionMode===Be.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",pe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||X.Bottom,l=s?.position||X.Top,c=ze(t,i,a),d=ze(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:l}}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,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??_e(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+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 Ru(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=yn(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Br=1e3,ju=10,Tn={nodeOrigin:[0,0],nodeExtent:it,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Vu={...Tn,checkEquality:!0};function Dn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Ou(e,t,n){const o=Dn(Tn,n);for(const r of e.values())if(r.parentId)$n(r,e,t,o);else{const i=dt(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,a=De(i,s,_e(r));r.internals.positionAbsolute=a}}function Bu(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={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(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function zn(e){return e==="manual"}function xn(e,t,n,o={}){const r=Dn(Vu,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!zn(r.zIndexMode)?Br:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let d=s.get(c.id);if(r.checkEquality&&c===d?.internals.userNode)t.set(c.id,d);else{const u=dt(c,r.nodeOrigin),f=Ye(c.extent)?c.extent:r.nodeExtent,g=De(u,f,_e(c));d={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:Bu(c,d),z:Fr(c,a,r.zIndexMode),userNode:c}},t.set(c.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(l=!1),c.parentId&&$n(d,t,n,o,i)}return l}function Fu(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:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Dn(Tn,o),c=e.parentId,d=t.get(c);if(!d){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Fu(e,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&l==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*ju),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const u=i&&!zn(l)?Br:0,{x:f,y:g,z:p}=Xu(e,d,s,a,u,l),{positionAbsolute:w}=e.internals,_=f!==w.x||g!==w.y;(_||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:f,y:g}:w,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 Xu(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=_e(e),c=dt(e,n),d=Ye(e.extent)?De(c,e.extent,l):c;let u=De({x:s+d.x,y:a+d.y},o,l);e.extent==="parent"&&(u=Pr(u,l,t));const f=Fr(e,r,i),g=t.internals.z??0;return{x:u.x,y:u.y,z:g>=f?g+1:f}}function Hn(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??Xe(a),c=Tr(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,d=_e(a),u=a.origin??o,f=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,g=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,p=Math.max(d.width,Math.round(s.width)),w=Math.max(d.height,Math.round(s.height)),_=(p-d.width)*u[0],m=(w-d.height)*u[1];(f>0||g>0||_||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+_,y:a.position.y-g+m}}),n.get(l)?.forEach(b=>{e.some(h=>h.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+f,y:b.position.y+g}})})),(d.width<s.width||d.height<s.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:p+(f?u[0]*f-_:0),height:w+(g?u[1]*g-m:0)}})}),r}function Yu(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];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}}),l=!0;continue}const w=An(g.nodeElement),_=p.measured.width!==w.width||p.measured.height!==w.height;if(!!(w.width&&w.height&&(_||!p.internals.handleBounds||g.force))){const b=g.nodeElement.getBoundingClientRect(),h=Ye(p.extent)?p.extent:i;let{positionAbsolute:y}=p.internals;p.parentId&&p.extent==="parent"?y=Pr(y,w,t.get(p.parentId)):h&&(y=De(y,h,w));const S={...p,measured:w,internals:{...p.internals,positionAbsolute:y,handleBounds:{source:uo("source",g.nodeElement,b,u,p.id),target:uo("target",g.nodeElement,b,u,p.id)}}};t.set(p.id,S),p.parentId&&$n(S,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,_&&(c.push({id:p.id,type:"dimensions",dimensions:w}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:Xe(S,r)}))}}if(f.length>0){const g=Hn(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function Zu({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function xo(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function Xr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,d=`${i}-${a}--${r}-${s}`;xo("source",l,d,e,r,s),xo("target",l,c,e,i,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 Wu(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Yr(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,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[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function qu({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ht(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Gu({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},d=null,u=!1,f=null,g=!1,p=!1,w=null;function _({noDragClassName:b,handleSelector:h,domNode:y,isSelectable:S,nodeId:E,nodeClickDistance:C=0}){f=ce(y);function T({x:z,y:H}){const{nodeLookup:x,nodeExtent:I,snapGrid:N,snapToGrid:P,nodeOrigin:k,onNodeDrag:D,onSelectionDrag:L,onError:V,updateNodePositions:R}=t();i={x:z,y:H};let F=!1;const B=a.size>1,W=B&&I?pn(ft(a)):null,K=B&&P?qu({dragItems:a,snapGrid:N,x:z,y:H}):null;for(const[Z,O]of a){if(!x.has(Z))continue;let Y={x:z-O.distance.x,y:H-O.distance.y};P&&(Y=K?{x:Math.round(Y.x+K.x),y:Math.round(Y.y+K.y)}:ht(Y,N));let Q=null;if(B&&I&&!O.extent&&W){const{positionAbsolute:G}=O.internals,ee=G.x-W.x+I[0][0],ne=G.x+O.measured.width-W.x2+I[1][0],te=G.y-W.y+I[0][1],ae=G.y+O.measured.height-W.y2+I[1][1];Q=[[ee,te],[ne,ae]]}const{position:U,positionAbsolute:q}=kr({nodeId:Z,nextPosition:Y,nodeLookup:x,nodeExtent:Q||I,nodeOrigin:k,onError:V});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),w&&(o||D||!E&&L))){const[Z,O]=on({nodeId:E,dragItems:a,nodeLookup:x});o?.(w,a,Z,O),D?.(w,Z,O),E||L?.(w,O)}}async function A(){if(!d)return;const{transform:z,panBy:H,autoPanSpeed:x,autoPanOnNodeDrag:I}=t();if(!I){l=!1,cancelAnimationFrame(s);return}const[N,P]=Ar(c,d,x);(N!==0||P!==0)&&(i.x=(i.x??0)-N/z[2],i.y=(i.y??0)-P/z[2],await H({x:N,y:P})&&T(i)),s=requestAnimationFrame(A)}function j(z){const{nodeLookup:H,multiSelectionActive:x,nodesDraggable:I,transform:N,snapGrid:P,snapToGrid:k,selectNodesOnDrag:D,onNodeDragStart:L,onSelectionDragStart:V,unselectNodesAndEdges:R}=t();u=!0,(!D||!S)&&!x&&E&&(H.get(E)?.selected||R()),S&&D&&E&&e?.(E);const F=tt(z.sourceEvent,{transform:N,snapGrid:P,snapToGrid:k,containerBounds:d});if(i=F,a=Wu(H,I,F,E),a.size>0&&(n||L||!E&&V)){const[B,W]=on({nodeId:E,dragItems:a,nodeLookup:H});n?.(z.sourceEvent,a,B,W),L?.(z.sourceEvent,B,W),E||V?.(z.sourceEvent,W)}}const M=fr().clickDistance(C).on("start",z=>{const{domNode:H,nodeDragThreshold:x,transform:I,snapGrid:N,snapToGrid:P}=t();d=H?.getBoundingClientRect()||null,g=!1,p=!1,w=z.sourceEvent,x===0&&j(z),i=tt(z.sourceEvent,{transform:I,snapGrid:N,snapToGrid:P,containerBounds:d}),c=he(z.sourceEvent,d)}).on("drag",z=>{const{autoPanOnNodeDrag:H,transform:x,snapGrid:I,snapToGrid:N,nodeDragThreshold:P,nodeLookup:k}=t(),D=tt(z.sourceEvent,{transform:x,snapGrid:I,snapToGrid:N,containerBounds:d});if(w=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||E&&!k.has(E))&&(g=!0),!g){if(!l&&H&&u&&(l=!0,A()),!u){const L=he(z.sourceEvent,d),V=L.x-c.x,R=L.y-c.y;Math.sqrt(V*V+R*R)>P&&j(z)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&u&&(c=he(z.sourceEvent,d),T(D))}}).on("end",z=>{if(!(!u||g)&&(l=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:x,onNodeDragStop:I,onSelectionDragStop:N}=t();if(p&&(x(a,!1),p=!1),r||I||!E&&N){const[P,k]=on({nodeId:E,dragItems:a,nodeLookup:H,dragging:!1});r?.(z.sourceEvent,a,P,k),I?.(z.sourceEvent,P,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))});f.call(M)}function m(){f?.on(".drag",null)}return{update:_,destroy:m}}function Ku(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())at(r,Xe(i))>0&&o.push(i);return o}const Uu=250;function Qu(e,t,n,o){let r=[],i=1/0;const s=Ku(e,n,t+Uu);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:d,y:u}=ze(a,c,c.position,!0),f=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(u-e.y,2));f>t||(f<i?(r=[{...c,x:d,y:u}],i=f):f===i&&r.push({...c,x:d,y:u}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function Zr(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...ze(s,l,l.position,!0)}:l}function Wr(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Ju(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const qr=()=>!0;function ed(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:g,onConnectStart:p,onConnect:w,onConnectEnd:_,isValidConnection:m=qr,onReconnectEnd:b,updateConnection:h,getTransform:y,getFromHandle:S,autoPanSpeed:E,dragThreshold:C=1,handleDomNode:T}){const A=$r(e.target);let j=0,M;const{x:z,y:H}=he(e),x=Wr(i,T),I=a?.getBoundingClientRect();let N=!1;if(!I||!x)return;const P=Zr(r,x,o,l,t);if(!P)return;let k=he(e,I),D=!1,L=null,V=!1,R=null;function F(){if(!d||!I)return;const[U,q]=Ar(k,I,E);f({x:U,y:q}),j=requestAnimationFrame(F)}const B={...P,nodeId:r,type:x,position:P.position},W=l.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:x})}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,I),M=Qu(gt(k,q,!1,[1,1]),n,l,B),D||(F(),D=!0);const G=Gr(U,{handle:M,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:A,lib:c,flowId:u,nodeLookup:l});R=G.handleDomNode,L=G.connection,V=Ju(!!M,G.isValid);const ee=l.get(r),ne=ee?ze(ee,B,X.Left,!0):Z.from,te={...Z,from:ne,isValid:V,to:G.toHandle&&V?$t({x:G.toHandle.x,y:G.toHandle.y},q):k,toHandle:G.toHandle,toPosition:V&&G.toHandle?G.toHandle.position:so[B.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:k};h(te),Z=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(N){(M||R)&&L&&V&&w?.(L);const{inProgress:q,...G}=Z,ee={...G,toPosition:Z.toHandle?Z.toPosition:null};_?.(U,ee),i&&b?.(U,ee)}g(),cancelAnimationFrame(j),D=!1,V=!1,L=null,R=null,A.removeEventListener("mousemove",Y),A.removeEventListener("mouseup",Q),A.removeEventListener("touchmove",Y),A.removeEventListener("touchend",Q)}}A.addEventListener("mousemove",Y),A.addEventListener("mouseup",Q),A.addEventListener("touchmove",Y),A.addEventListener("touchend",Q)}function Gr(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=qr,nodeLookup:d}){const u=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:p}=he(e),w=s.elementFromPoint(g,p),_=w?.classList.contains(`${a}-flow__handle`)?w:f,m={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const b=Wr(void 0,_),h=_.getAttribute("data-nodeid"),y=_.getAttribute("data-handleid"),S=_.classList.contains("connectable"),E=_.classList.contains("connectableend");if(!h||!b)return m;const C={source:u?h:o,sourceHandle:u?y:r,target:u?o:h,targetHandle:u?r:y};m.connection=C;const A=S&&E&&(n===Be.Strict?u&&b==="source"||!u&&b==="target":h!==o||y!==r);m.isValid=A&&c(C),m.toHandle=Zr(h,b,y,d,n,!0)}return m}const wn={onPointerDown:ed,isValid:Gr};function td({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:l,height:c,zoomStep:d=1,pannable:u=!0,zoomable:f=!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)*d,C=y[2]*Math.pow(2,E*S);t.scaleTo(C)};let w=[0,0];const _=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(w=[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]-w[0],S[1]-w[1]];w=S;const C=o()*Math.max(y[2],Math.log(y[2]))*(g?-1:1),T={x:y[0]-E[0]*C,y:y[1]-E[1]*C},A=[[0,0],[l,c]];t.setViewportConstrained({x:T.x,y:T.y,zoom:y[2]},A,a)},b=Er().on("start",_).on("zoom",u?m:null).on("zoom.wheel",f?p:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,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),nd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,sn=(e,t=0,n=nd,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 od({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(Le(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const _=de(d),m=Ur(d),b=u*Math.pow(2,m);o.scaleTo(n,b,_,d);return}const f=d.deltaMode===1?20:1;let g=r===Ae.Vertical?0:d.deltaX*f,p=r===Ae.Horizontal?0:d.deltaY*f;!ct()&&d.shiftKey&&r!==Ae.Vertical&&(g=d.deltaY*f,p=0),o.translateBy(n,-(g/u)*i,-(p/u)*i,{internal:!0});const w=Yt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(d,w),e.panScrollTimeout=setTimeout(()=>{c?.(d,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(d,w))}}function rd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Le(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function id({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 sd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Kr(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Yt(i.transform))}}function ad({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Kr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Yt(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function cd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:d}){return u=>{const f=e||t,g=n&&u.ctrlKey,p=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Le(u,`${c}-flow__node`)||Le(u,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||d&&!p||Le(u,a)&&p||Le(u,l)&&(!p||r&&p&&!e)||!n&&u.ctrlKey&&p)return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!f&&!r&&!g&&p||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||p)&&w}}function ld({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),u=Er().scaleExtent([t,n]).translateExtent(o),f=ce(e).call(u);b({x:r.x,y:r.y,zoom:Fe(r.zoom,t,n)},[[0,0],[d.width,d.height]],o);const g=f.on("wheel.zoom"),p=f.on("dblclick.zoom");u.wheelDelta(Ur);function w(M,z){return f?new Promise(H=>{u?.interpolate(z?.interpolate==="linear"?Jt:Nt).transform(sn(f,z?.duration,z?.ease,()=>H(!0)),M)}):Promise.resolve(!1)}function _({noWheelClassName:M,noPanClassName:z,onPaneContextMenu:H,userSelectionActive:x,panOnScroll:I,panOnDrag:N,panOnScrollMode:P,panOnScrollSpeed:k,preventScrolling:D,zoomOnPinch:L,zoomOnScroll:V,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:W,connectionInProgress:K,paneClickDistance:Z,selectionOnDrag:O}){x&&!c.isZoomingOrPanning&&m();const Y=I&&!F&&!x;u.clickDistance(O?1/0:!fe(Z)||Z<0?0:Z);const Q=Y?od({zoomPanValues:c,noWheelClassName:M,d3Selection:f,d3Zoom:u,panOnScrollMode:P,panOnScrollSpeed:k,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):rd({noWheelClassName:M,preventScrolling:D,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!x){const q=id({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});u.on("start",q);const G=sd({zoomPanValues:c,panOnDrag:N,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:W});u.on("zoom",G);const ee=ad({zoomPanValues:c,panOnDrag:N,panOnScroll:I,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:l});u.on("end",ee)}const U=cd({zoomActivationKeyPressed:F,panOnDrag:N,zoomOnScroll:V,panOnScroll:I,zoomOnDoubleClick:R,zoomOnPinch:L,userSelectionActive:x,noPanClassName:z,noWheelClassName:M,lib:B,connectionInProgress:K});u.filter(U),R?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function b(M,z,H){const x=rn(M),I=u?.constrain()(x,z,H);return I&&await w(I),new Promise(N=>N(I))}async function h(M,z){const H=rn(M);return await w(H,z),new Promise(x=>x(H))}function y(M){if(f){const z=rn(M),H=f.property("__zoom");(H.k!==M.zoom||H.x!==M.x||H.y!==M.y)&&u?.transform(f,z,null,{sync:!0})}}function S(){const M=f?br(f.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function E(M,z){return f?new Promise(H=>{u?.interpolate(z?.interpolate==="linear"?Jt:Nt).scaleTo(sn(f,z?.duration,z?.ease,()=>H(!0)),M)}):Promise.resolve(!1)}function C(M,z){return f?new Promise(H=>{u?.interpolate(z?.interpolate==="linear"?Jt:Nt).scaleBy(sn(f,z?.duration,z?.ease,()=>H(!0)),M)}):Promise.resolve(!1)}function T(M){u?.scaleExtent(M)}function A(M){u?.translateExtent(M)}function j(M){const z=!fe(M)||M<0?0:M;u?.clickDistance(z)}return{update:_,destroy:m,setViewport:h,setViewportConstrained:b,getViewport:S,scaleTo:E,scaleBy:C,setScaleExtent:T,setTranslateExtent:A,syncViewport:y,setClickDistance:j}}var Ze;(function(e){e.Line="line",e.Handle="handle"})(Ze||(Ze={}));function ud({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}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 dd(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:g,ySnapped:p}=n,{minWidth:w,maxWidth:_,minHeight:m,maxHeight:b}=o,{x:h,y,width:S,height:E,aspectRatio:C}=e;let T=Math.floor(d?g-e.pointerX:0),A=Math.floor(u?p-e.pointerY:0);const j=S+(l?-T:T),M=E+(c?-A:A),z=-i[0]*S,H=-i[1]*E;let x=vt(j,w,_),I=vt(M,m,b);if(s){let k=0,D=0;l&&T<0?k=Ee(h+T+z,s[0][0]):!l&&T>0&&(k=Se(h+j+z,s[1][0])),c&&A<0?D=Ee(y+A+H,s[0][1]):!c&&A>0&&(D=Se(y+M+H,s[1][1])),x=Math.max(x,k),I=Math.max(I,D)}if(a){let k=0,D=0;l&&T>0?k=Se(h+T,a[0][0]):!l&&T<0&&(k=Ee(h+j,a[1][0])),c&&A>0?D=Se(y+A,a[0][1]):!c&&A<0&&(D=Ee(y+M,a[1][1])),x=Math.max(x,k),I=Math.max(I,D)}if(r){if(d){const k=vt(j/C,m,b)*C;if(x=Math.max(x,k),s){let D=0;!l&&!c||l&&!c&&f?D=Se(y+H+j/C,s[1][1])*C:D=Ee(y+H+(l?T:-T)/C,s[0][1])*C,x=Math.max(x,D)}if(a){let D=0;!l&&!c||l&&!c&&f?D=Ee(y+j/C,a[1][1])*C:D=Se(y+(l?T:-T)/C,a[0][1])*C,x=Math.max(x,D)}}if(u){const k=vt(M*C,w,_)/C;if(I=Math.max(I,k),s){let D=0;!l&&!c||c&&!l&&f?D=Se(h+M*C+z,s[1][0])/C:D=Ee(h+(c?A:-A)*C+z,s[0][0])/C,I=Math.max(I,D)}if(a){let D=0;!l&&!c||c&&!l&&f?D=Ee(h+M*C,a[1][0])/C:D=Se(h+(c?A:-A)*C,a[0][0])/C,I=Math.max(I,D)}}}A=A+(A<0?I:-I),T=T+(T<0?x:-x),r&&(f?j>M*C?A=(_o(l,c)?-T:T)/C:T=(_o(l,c)?-A:A)*C:d?(A=T/C,c=l):(T=A*C,l=c));const N=l?h+T:h,P=c?y+A:y;return{width:S+(l?-T:T),height:E+(c?-A:A),x:i[0]*T*(l?-1:1)+N,y:i[1]*A*(c?-1:1)+P}}const Qr={width:0,height:0,x:0,y:0},fd={...Qr,pointerX:0,pointerY:0,aspectRatio:1};function hd(e){return[[0,0],[e.measured.width,e.measured.height]]}function gd(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function pd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);let s={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:c,boundaries:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:g,onResize:p,onResizeEnd:w,shouldResize:_}){let m={...Qr},b={...fd};s={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:vo(c)};let h,y=null,S=[],E,C,T,A=!1;const j=fr().on("start",M=>{const{nodeLookup:z,transform:H,snapGrid:x,snapToGrid:I,nodeOrigin:N,paneDomNode:P}=n();if(h=z.get(t),!h)return;y=P?.getBoundingClientRect()??null;const{xSnapped:k,ySnapped:D}=tt(M.sourceEvent,{transform:H,snapGrid:x,snapToGrid:I,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:D,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"?hd(E):void 0),S=[],T=void 0;for(const[L,V]of z)if(V.parentId===t&&(S.push({id:L,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=gd(V,h,V.origin??N);T?T=[[Math.min(R[0][0],T[0][0]),Math.min(R[0][1],T[0][1])],[Math.max(R[1][0],T[1][0]),Math.max(R[1][1],T[1][1])]]:T=R}g?.(M,{...m})}).on("drag",M=>{const{transform:z,snapGrid:H,snapToGrid:x,nodeOrigin:I}=n(),N=tt(M.sourceEvent,{transform:z,snapGrid:H,snapToGrid:x,containerBounds:y}),P=[];if(!h)return;const{x:k,y:D,width:L,height:V}=m,R={},F=h.origin??I,{width:B,height:W,x:K,y:Z}=dd(b,s.controlDirection,N,s.boundaries,s.keepAspectRatio,F,C,T),O=B!==L,Y=W!==V,Q=K!==k&&O,U=Z!==D&&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-D;for(const ae of S)ae.position={x:ae.position.x-ne+F[0]*(B-L),y:ae.position.y-te+F[1]*(W-V)},P.push(ae)}if((O||Y)&&(R.width=O&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:m.width,R.height=Y&&(!s.resizeDirection||s.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=ud({width:m.width,prevWidth:L,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:q};_?.(M,G)!==!1&&(A=!0,p?.(M,G),o(R,P))}).on("end",M=>{A&&(w?.(M,{...m}),r?.({...m}),A=!1)});i.call(j)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}const md={},bo=e=>{let t;const n=new Set,o=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const g=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,g))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(md?"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()}},c=t=e(o,r,l);return l},yd=e=>e?bo(e):bo,{useDebugValue:xd}=js,{useSyncExternalStoreWithSelector:wd}=Rs,vd=e=>e;function Jr(e,t=vd,n){const o=wd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return xd(o),o}const Eo=(e,t)=>{const n=yd(e),o=(r,i=t)=>Jr(n,r,i);return Object.assign(o,n),o},_d=(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),bd=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"},Ed={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",Sd="react-flow__aria-live",Nd=e=>e.ariaLiveMessage,Cd=e=>e.ariaLabelConfig;function Md({rfId:e}){const t=J(Nd);return v.jsx("div",{id:`${Sd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ed,children:t})}function Id({rfId:e,disableKeyboardA11y:t}){const n=J(Cd);return v.jsxs(v.Fragment,{children:[v.jsx("div",{id:`${ti}-${e}`,style:So,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),v.jsx("div",{id:`${ni}-${e}`,style:So,children:n["edge.a11yDescription.default"]}),!t&&v.jsx(Md,{rfId:e})]})}const Wt=$.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return v.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});Wt.displayName="Panel";function kd({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:v.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:v.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Pd=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 Ad(e,t){return oe(e.selectedNodes.map(_t),t.selectedNodes.map(_t))&&oe(e.selectedEdges.map(_t),t.selectedEdges.map(_t))}function Td({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(Pd,Ad);return $.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Dd=e=>!!e.onSelectionChangeHandlers;function zd({onSelectionChange:e}){const t=J(Dd);return e||t?v.jsx(Td,{onSelectionChange:e}):null}const oi=[0,0],$d={x:0,y:0,zoom:1},Hd=["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=[...Hd,"rfId"],Ld=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 Rd(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=J(Ld,oe),c=re();$.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=Co,a()}),[]);const d=$.useRef(Co);return $.useEffect(()=>{for(const u of No){const f=e[u],g=d.current[u];f!==g&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?o(f):u==="maxZoom"?r(f):u==="translateExtent"?i(f):u==="nodeExtent"?s(f):u==="ariaLabelConfig"?c.setState({ariaLabelConfig:Mu(f)}):u==="fitView"?c.setState({fitViewQueued:f}):u==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[u]:f})))}d.current=e},No.map(u=>e[u])),null}function Mo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function jd(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),i=$.useRef(new Set([])),[s,a]=$.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
2
+ `).replace(`
3
+
4
+ `,`
5
+ +`).split(`
6
+ `)),d=c.reduce((u,f)=>u.concat(...f),[]);return[c,d]}return[[],[]]},[e]);return $.useEffect(()=>{const l=t?.target??Io,c=t?.actInsideInputWithModifier??!0;if(e!==null){const d=g=>{if(r.current=g.ctrlKey||g.metaKey||g.shiftKey||g.altKey,(!r.current||r.current&&!c)&&Hr(g))return!1;const w=Po(g.code,a);if(i.current.add(g[w]),ko(s,i.current,!1)){const _=g.composedPath?.()?.[0]||g.target,m=_?.nodeName==="BUTTON"||_?.nodeName==="A";t.preventDefault!==!1&&(r.current||!m)&&g.preventDefault(),o(!0)}},u=g=>{const p=Po(g.code,a);ko(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(g[p]),g.key==="Meta"&&i.current.clear(),r.current=!1},f=()=>{i.current.clear(),o(!1)};return l?.addEventListener("keydown",d),l?.addEventListener("keyup",u),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{l?.removeEventListener("keydown",d),l?.removeEventListener("keyup",u),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,o]),n}function ko(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function Po(e,t){return t.includes(e)?"code":"key"}const Vd=()=>{const e=re();return $.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=Pn(t,o,r,i,s,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},d=n.snapGrid??r,u=n.snapToGrid??i;return gt(c,o,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=$t(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function ri(e,t){const n=[],o=new Map,r=[];for(const i of e)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{const s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(const i of t){const s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const l of s)Od(l,a);n.push(a)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Od(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Bd(e,t){return ri(e,t)}function Fd(e,t){return ri(e,t)}function Pe(e,t){return{id:e,type:"select",selected:t}}function Re(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(Pe(i.id,s)))}return o}function Ao({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,i]of e.entries()){const s=t.get(i.id),a=s?.internals?.userNode??s;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:"replace"}),a===void 0&&n.push({item:i,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function To(e){return{id:e.id,type:"remove"}}const Do=e=>yu(e),Xd=e=>Ir(e);function ii(e){return $.forwardRef(e)}const Yd=typeof window<"u"?$.useLayoutEffect:$.useEffect;function zo(e){const[t,n]=$.useState(BigInt(0)),[o]=$.useState(()=>Zd(()=>n(r=>r+BigInt(1))));return Yd(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function Zd(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const si=$.createContext(null);function Wd({children:e}){const t=re(),n=$.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:d,onNodesChange:u,nodeLookup:f,fitViewQueued:g,onNodesChangeMiddlewareMap:p}=t.getState();let w=l;for(const m of a)w=typeof m=="function"?m(w):m;let _=Ao({items:w,lookup:f});for(const m of p.values())_=m(_);d&&c(w),_.length>0?u?.(_):g&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:b,setNodes:h}=t.getState();m&&h(b)})},[]),o=zo(n),r=$.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:d,onEdgesChange:u,edgeLookup:f}=t.getState();let g=l;for(const p of a)g=typeof p=="function"?p(g):p;d?c(g):u&&u(Ao({items:g,lookup:f}))},[]),i=zo(r),s=$.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return v.jsx(si.Provider,{value:s,children:e})}function qd(){const e=$.useContext(si);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Gd=e=>!!e.panZoom;function Ln(){const e=Vd(),t=re(),n=qd(),o=J(Gd),r=$.useMemo(()=>{const i=u=>t.getState().nodeLookup.get(u),s=u=>{n.nodeQueue.push(u)},a=u=>{n.edgeQueue.push(u)},l=u=>{const{nodeLookup:f,nodeOrigin:g}=t.getState(),p=Do(u)?u:f.get(u.id),w=p.parentId?zr(p.position,p.measured,p.parentId,f,g):p.position,_={...p,position:w,width:p.measured?.width??p.width,height:p.measured?.height??p.height};return Xe(_)},c=(u,f,g={replace:!1})=>{s(p=>p.map(w=>{if(w.id===u){const _=typeof f=="function"?f(w):f;return g.replace&&Do(_)?_:{...w,..._}}return w}))},d=(u,f,g={replace:!1})=>{a(p=>p.map(w=>{if(w.id===u){const _=typeof f=="function"?f(w):f;return g.replace&&Xd(_)?_:{...w,..._}}return w}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>i(u)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:u=[]}=t.getState();return u.map(f=>({...f}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:s,setEdges:a,addNodes:u=>{const f=Array.isArray(u)?u:[u];n.nodeQueue.push(g=>[...g,...f])},addEdges:u=>{const f=Array.isArray(u)?u:[u];n.edgeQueue.push(g=>[...g,...f])},toObject:()=>{const{nodes:u=[],edges:f=[],transform:g}=t.getState(),[p,w,_]=g;return{nodes:u.map(m=>({...m})),edges:f.map(m=>({...m})),viewport:{x:p,y:w,zoom:_}}},deleteElements:async({nodes:u=[],edges:f=[]})=>{const{nodes:g,edges:p,onNodesDelete:w,onEdgesDelete:_,triggerNodeChanges:m,triggerEdgeChanges:b,onDelete:h,onBeforeDelete:y}=t.getState(),{nodes:S,edges:E}=await bu({nodesToRemove:u,edgesToRemove:f,nodes:g,edges:p,onBeforeDelete:y}),C=E.length>0,T=S.length>0;if(C){const A=E.map(To);_?.(E),b(A)}if(T){const A=S.map(To);w?.(S),m(A)}return(T||C)&&h?.({nodes:S,edges:E}),{deletedNodes:S,deletedEdges:E}},getIntersectingNodes:(u,f=!0,g)=>{const p=co(u),w=p?u:l(u),_=g!==void 0;return w?(g||t.getState().nodes).filter(m=>{const b=t.getState().nodeLookup.get(m.id);if(b&&!p&&(m.id===u.id||!b.internals.positionAbsolute))return!1;const h=Xe(_?m:b),y=at(h,w);return f&&y>0||y>=h.width*h.height||y>=w.width*w.height}):[]},isNodeIntersecting:(u,f,g=!0)=>{const w=co(u)?u:l(u);if(!w)return!1;const _=at(w,f);return g&&_>0||_>=f.width*f.height||_>=w.width*w.height},updateNode:c,updateNodeData:(u,f,g={replace:!1})=>{c(u,p=>{const w=typeof f=="function"?f(p):f;return g.replace?{...p,data:w}:{...p,data:{...p.data,...w}}},g)},updateEdge:d,updateEdgeData:(u,f,g={replace:!1})=>{d(u,p=>{const w=typeof f=="function"?f(p):f;return g.replace?{...p,data:w}:{...p,data:{...p.data,...w}}},g)},getNodesBounds:u=>{const{nodeLookup:f,nodeOrigin:g}=t.getState();return xu(u,{nodeLookup:f,nodeOrigin:g})},getHandleConnections:({type:u,id:f,nodeId:g})=>Array.from(t.getState().connectionLookup.get(`${g}-${u}${f?`-${f}`:""}`)?.values()??[]),getNodeConnections:({type:u,handleId:f,nodeId:g})=>Array.from(t.getState().connectionLookup.get(`${g}${u?f?`-${u}-${f}`:`-${u}`:""}`)?.values()??[]),fitView:async u=>{const f=t.getState().fitViewResolver??Cu();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:f}),n.nodeQueue.push(g=>[...g]),f.promise}}},[]);return $.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const $o=e=>e.selected,Kd=typeof window<"u"?window:void 0;function Ud({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=re(),{deleteElements:o}=Ln(),r=lt(e,{actInsideInputWithModifier:!1}),i=lt(t,{target:Kd});$.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter($o),edges:s.filter($o)}),n.setState({nodesSelectionActive:!1})}},[r]),$.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Qd(e){const t=re();$.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=An(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",pe.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const qt={position:"absolute",width:"100%",height:"100%",top:0,left:0},Jd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ef({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=Ae.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:d,maxZoom:u,zoomActivationKeyCode:f,preventScrolling:g=!0,children:p,noWheelClassName:w,noPanClassName:_,onViewportChange:m,isControlledViewport:b,paneClickDistance:h,selectionOnDrag:y}){const S=re(),E=$.useRef(null),{userSelectionActive:C,lib:T,connectionInProgress:A}=J(Jd,oe),j=lt(f),M=$.useRef();Qd(E);const z=$.useCallback(H=>{m?.({x:H[0],y:H[1],zoom:H[2]}),b||S.setState({transform:H})},[m,b]);return $.useEffect(()=>{if(E.current){M.current=ld({domNode:E.current,minZoom:d,maxZoom:u,translateExtent:c,viewport:l,onDraggingChange:N=>S.setState({paneDragging:N}),onPanZoomStart:(N,P)=>{const{onViewportChangeStart:k,onMoveStart:D}=S.getState();D?.(N,P),k?.(P)},onPanZoom:(N,P)=>{const{onViewportChange:k,onMove:D}=S.getState();D?.(N,P),k?.(P)},onPanZoomEnd:(N,P)=>{const{onViewportChangeEnd:k,onMoveEnd:D}=S.getState();D?.(N,P),k?.(P)}});const{x:H,y:x,zoom:I}=M.current.getViewport();return S.setState({panZoom:M.current,transform:[H,x,I],domNode:E.current.closest(".react-flow")}),()=>{M.current?.destroy()}}},[]),$.useEffect(()=>{M.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:j,preventScrolling:g,noPanClassName:_,userSelectionActive:C,noWheelClassName:w,lib:T,onTransformChange:z,connectionInProgress:A,selectionOnDrag:y,paneClickDistance:h})},[e,t,n,o,r,i,s,a,j,g,_,C,w,T,z,A,y,h]),v.jsx("div",{className:"react-flow__renderer",ref:E,style:qt,children:p})}const tf=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function nf(){const{userSelectionActive:e,userSelectionRect:t}=J(tf,oe);return e&&t?v.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const an=(e,t)=>n=>{n.target===t.current&&e?.(n)},of=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function rf({isSelecting:e,selectionKeyPressed:t,selectionMode:n=st.Full,panOnDrag:o,paneClickDistance:r,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:d,onPaneMouseEnter:u,onPaneMouseMove:f,onPaneMouseLeave:g,children:p}){const w=re(),{userSelectionActive:_,elementsSelectable:m,dragging:b,connectionInProgress:h}=J(of,oe),y=m&&(e||_),S=$.useRef(null),E=$.useRef(),C=$.useRef(new Set),T=$.useRef(new Set),A=$.useRef(!1),j=k=>{if(A.current||h){A.current=!1;return}l?.(k),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},M=k=>{if(Array.isArray(o)&&o?.includes(2)){k.preventDefault();return}c?.(k)},z=d?k=>d(k):void 0,H=k=>{A.current&&(k.stopPropagation(),A.current=!1)},x=k=>{const{domNode:D}=w.getState();if(E.current=D?.getBoundingClientRect(),!E.current)return;const L=k.target===S.current;if(!L&&!!k.target.closest(".nokey")||!e||!(i&&L||t)||k.button!==0||!k.isPrimary)return;k.target?.setPointerCapture?.(k.pointerId),A.current=!1;const{x:F,y:B}=he(k.nativeEvent,E.current);w.setState({userSelectionRect:{width:0,height:0,startX:F,startY:B,x:F,y:B}}),L||(k.stopPropagation(),k.preventDefault())},I=k=>{const{userSelectionRect:D,transform:L,nodeLookup:V,edgeLookup:R,connectionLookup:F,triggerNodeChanges:B,triggerEdgeChanges:W,defaultEdgeOptions:K,resetSelectedElements:Z}=w.getState();if(!E.current||!D)return;const{x:O,y:Y}=he(k.nativeEvent,E.current),{startX:Q,startY:U}=D;if(!A.current){const te=t?0:r;if(Math.hypot(O-Q,Y-U)<=te)return;Z(),s?.(k)}A.current=!0;const q={startX:Q,startY:U,x:O<Q?O:Q,y:Y<U?Y:U,width:Math.abs(O-Q),height:Math.abs(Y-U)},G=C.current,ee=T.current;C.current=new Set(kn(V,q,L,n===st.Partial,!0).map(te=>te.id)),T.current=new Set;const ne=K?.selectable??!0;for(const te of C.current){const ae=F.get(te);if(ae)for(const{edgeId:be}of ae.values()){const ye=R.get(be);ye&&(ye.selectable??ne)&&T.current.add(be)}}if(!lo(G,C.current)){const te=Re(V,C.current,!0);B(te)}if(!lo(ee,T.current)){const te=Re(R,T.current);W(te)}w.setState({userSelectionRect:q,userSelectionActive:!0,nodesSelectionActive:!1})},N=k=>{k.button===0&&(k.target?.releasePointerCapture?.(k.pointerId),!_&&k.target===S.current&&w.getState().userSelectionRect&&j?.(k),w.setState({userSelectionActive:!1,userSelectionRect:null}),A.current&&(a?.(k),w.setState({nodesSelectionActive:C.current.size>0})))},P=o===!0||Array.isArray(o)&&o.includes(0);return v.jsxs("div",{className:ie(["react-flow__pane",{draggable:P,dragging:b,selection:e}]),onClick:y?void 0:an(j,S),onContextMenu:an(M,S),onWheel:an(z,S),onPointerEnter:y?void 0:u,onPointerMove:y?I:f,onPointerUp:y?N:void 0,onPointerDownCapture:y?x:void 0,onClickCapture:y?H:void 0,onPointerLeave:g,ref:S,style:qt,children:[p,v.jsx(nf,{})]})}function vn({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",pe.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function ai({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=re(),[l,c]=$.useState(!1),d=$.useRef();return $.useEffect(()=>{d.current=Gu({getStoreItems:()=>a.getState(),onNodeMouseDown:u=>{vn({id:u,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),$.useEffect(()=>{if(t)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s}),()=>{d.current?.destroy()}},[n,o,t,i,e,r]),l}const sf=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function ci(){const e=re();return $.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:d}=e.getState(),u=new Map,f=sf(s),g=r?i[0]:5,p=r?i[1]:5,w=n.direction.x*g*n.factor,_=n.direction.y*p*n.factor;for(const[,m]of c){if(!f(m))continue;let b={x:m.internals.positionAbsolute.x+w,y:m.internals.positionAbsolute.y+_};r&&(b=ht(b,i));const{position:h,positionAbsolute:y}=kr({nodeId:m.id,nextPosition:b,nodeLookup:c,nodeExtent:o,nodeOrigin:d,onError:a});m.position=h,m.internals.positionAbsolute=y,u.set(m.id,m)}l(u)},[])}const Rn=$.createContext(null),af=Rn.Provider;Rn.Consumer;const li=()=>$.useContext(Rn),cf=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),lf=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s,d=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:d,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===Be.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:d&&c}};function uf({type:e="source",position:t=X.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:u,...f},g){const p=s||null,w=e==="target",_=re(),m=li(),{connectOnClick:b,noPanClassName:h,rfId:y}=J(cf,oe),{connectingFrom:S,connectingTo:E,clickConnecting:C,isPossibleEndHandle:T,connectionInProcess:A,clickConnectionInProcess:j,valid:M}=J(lf(m,p,e),oe);m||_.getState().onError?.("010",pe.error010());const z=I=>{const{defaultEdgeOptions:N,onConnect:P,hasDefaultEdges:k}=_.getState(),D={...N,...I};if(k){const{edges:L,setEdges:V}=_.getState();V(Du(D,L))}P?.(D),a?.(D)},H=I=>{if(!m)return;const N=Lr(I.nativeEvent);if(r&&(N&&I.button===0||!N)){const P=_.getState();wn.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:P.autoPanOnConnect,connectionMode:P.connectionMode,connectionRadius:P.connectionRadius,domNode:P.domNode,nodeLookup:P.nodeLookup,lib:P.lib,isTarget:w,handleId:p,nodeId:m,flowId:P.rfId,panBy:P.panBy,cancelConnection:P.cancelConnection,onConnectStart:P.onConnectStart,onConnectEnd:P.onConnectEnd,updateConnection:P.updateConnection,onConnect:z,isValidConnection:n||P.isValidConnection,getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:P.autoPanSpeed,dragThreshold:P.connectionDragThreshold})}N?d?.(I):u?.(I)},x=I=>{const{onClickConnectStart:N,onClickConnectEnd:P,connectionClickStartHandle:k,connectionMode:D,isValidConnection:L,lib:V,rfId:R,nodeLookup:F,connection:B}=_.getState();if(!m||!k&&!r)return;if(!k){N?.(I.nativeEvent,{nodeId:m,handleId:p,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:m,type:e,id:p}});return}const W=$r(I.target),K=n||L,{connection:Z,isValid:O}=wn.isValid(I.nativeEvent,{handle:{nodeId:m,id:p,type:e},connectionMode:D,fromNodeId:k.nodeId,fromHandleId:k.id||null,fromType:k.type,isValidConnection:K,flowId:R,doc:W,lib:V,nodeLookup:F});O&&Z&&z(Z);const Y=structuredClone(B);delete Y.inProgress,Y.toPosition=Y.toHandle?Y.toHandle.position:null,P?.(I,Y),_.setState({connectionClickStartHandle:null})};return v.jsx("div",{"data-handleid":p,"data-nodeid":m,"data-handlepos":t,"data-id":`${y}-${m}-${p}-${e}`,className:ie(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",h,c,{source:!w,target:w,connectable:o,connectablestart:r,connectableend:i,clickconnecting:C,connectingfrom:S,connectingto:E,valid:M,connectionindicator:o&&(!A||T)&&(A||j?i:r)}]),onMouseDown:H,onTouchStart:H,onClick:b?x:void 0,ref:g,...f,children:l})}const Me=$.memo(ii(uf));function df({data:e,isConnectable:t,sourcePosition:n=X.Bottom}){return v.jsxs(v.Fragment,{children:[e?.label,v.jsx(Me,{type:"source",position:n,isConnectable:t})]})}function ff({data:e,isConnectable:t,targetPosition:n=X.Top,sourcePosition:o=X.Bottom}){return v.jsxs(v.Fragment,{children:[v.jsx(Me,{type:"target",position:n,isConnectable:t}),e?.label,v.jsx(Me,{type:"source",position:o,isConnectable:t})]})}function hf(){return null}function gf({data:e,isConnectable:t,targetPosition:n=X.Top}){return v.jsxs(v.Fragment,{children:[v.jsx(Me,{type:"target",position:n,isConnectable:t}),e?.label]})}const Ht={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ho={input:df,default:ff,output:gf,group:hf};function pf(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const mf=e=>{const{width:t,height:n,x:o,y:r}=ft(e.nodeLookup,{filter:i=>!!i.selected});return{width:fe(t)?t:null,height:fe(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function yf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=re(),{width:r,height:i,transformString:s,userSelectionActive:a}=J(mf,oe),l=ci(),c=$.useRef(null);if($.useEffect(()=>{n||c.current?.focus({preventScroll:!0})},[n]),ai({nodeRef:c}),a||!r||!i)return null;const d=e?f=>{const g=o.getState().nodes.filter(p=>p.selected);e(f,g)}:void 0,u=f=>{Object.prototype.hasOwnProperty.call(Ht,f.key)&&(f.preventDefault(),l({direction:Ht[f.key],factor:f.shiftKey?4:1}))};return v.jsx("div",{className:ie(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:v.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:u,style:{width:r,height:i}})})}const Lo=typeof window<"u"?window:void 0,xf=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ui({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:d,selectionMode:u,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:w,zoomActivationKeyCode:_,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:h,panOnScroll:y,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:C,panOnDrag:T,defaultViewport:A,translateExtent:j,minZoom:M,maxZoom:z,preventScrolling:H,onSelectionContextMenu:x,noWheelClassName:I,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:k,isControlledViewport:D}){const{nodesSelectionActive:L,userSelectionActive:V}=J(xf,oe),R=lt(c,{target:Lo}),F=lt(w,{target:Lo}),B=F||T,W=F||y,K=d&&B!==!0,Z=R||V||K;return Ud({deleteKeyCode:l,multiSelectionKeyCode:p}),v.jsx(ef,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:h,panOnScroll:W,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:C,panOnDrag:!R&&B,defaultViewport:A,translateExtent:j,minZoom:M,maxZoom:z,zoomActivationKeyCode:_,preventScrolling:H,noWheelClassName:I,noPanClassName:N,onViewportChange:k,isControlledViewport:D,paneClickDistance:a,selectionOnDrag:K,children:v.jsxs(rf,{onSelectionStart:f,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:B,isSelecting:!!Z,selectionMode:u,selectionKeyPressed:R,paneClickDistance:a,selectionOnDrag:K,children:[e,L&&v.jsx(yf,{onSelectionContextMenu:x,noPanClassName:N,disableKeyboardA11y:P})]})})}ui.displayName="FlowRenderer";const wf=$.memo(ui),vf=e=>t=>e?kn(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function _f(e){return J($.useCallback(vf(e),[e]),oe)}const bf=e=>e.updateNodeInternals;function Ef(){const e=J(bf),[t]=$.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),e(o)}));return $.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Sf({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=re(),i=$.useRef(null),s=$.useRef(null),a=$.useRef(e.sourcePosition),l=$.useRef(e.targetPosition),c=$.useRef(t),d=n&&!!e.internals.handleBounds;return $.useEffect(()=>{i.current&&!e.hidden&&(!d||s.current!==i.current)&&(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[d,e.hidden]),$.useEffect(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),$.useEffect(()=>{if(i.current){const u=c.current!==t,f=a.current!==e.sourcePosition,g=l.current!==e.targetPosition;(u||f||g)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Nf({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:d,resizeObserver:u,noDragClassName:f,noPanClassName:g,disableKeyboardA11y:p,rfId:w,nodeTypes:_,nodeClickDistance:m,onError:b}){const{node:h,internals:y,isParent:S}=J(O=>{const Y=O.nodeLookup.get(e),Q=O.parentLookup.has(e);return{node:Y,internals:Y.internals,isParent:Q}},oe);let E=h.type||"default",C=_?.[E]||Ho[E];C===void 0&&(b?.("003",pe.error003(E)),E="default",C=_?.default||Ho.default);const T=!!(h.draggable||a&&typeof h.draggable>"u"),A=!!(h.selectable||l&&typeof h.selectable>"u"),j=!!(h.connectable||c&&typeof h.connectable>"u"),M=!!(h.focusable||d&&typeof h.focusable>"u"),z=re(),H=Dr(h),x=Sf({node:h,nodeType:E,hasDimensions:H,resizeObserver:u}),I=ai({nodeRef:x,disabled:h.hidden||!T,noDragClassName:f,handleSelector:h.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:m}),N=ci();if(h.hidden)return null;const P=_e(h),k=pf(h),D=A||T||t||n||o||r,L=n?O=>n(O,{...y.userNode}):void 0,V=o?O=>o(O,{...y.userNode}):void 0,R=r?O=>r(O,{...y.userNode}):void 0,F=i?O=>i(O,{...y.userNode}):void 0,B=s?O=>s(O,{...y.userNode}):void 0,W=O=>{const{selectNodesOnDrag:Y,nodeDragThreshold:Q}=z.getState();A&&(!Y||!T||Q>0)&&vn({id:e,store:z,nodeRef:x}),t&&t(O,{...y.userNode})},K=O=>{if(!(Hr(O.nativeEvent)||p)){if(Sr.includes(O.key)&&A){const Y=O.key==="Escape";vn({id:e,store:z,unselect:Y,nodeRef:x})}else if(T&&h.selected&&Object.prototype.hasOwnProperty.call(Ht,O.key)){O.preventDefault();const{ariaLabelConfig:Y}=z.getState();z.setState({ariaLiveMessage:Y["node.a11yDescription.ariaLiveMessage"]({direction:O.key.replace("Arrow","").toLowerCase(),x:~~y.positionAbsolute.x,y:~~y.positionAbsolute.y})}),N({direction:Ht[O.key],factor:O.shiftKey?4:1})}}},Z=()=>{if(p||!x.current?.matches(":focus-visible"))return;const{transform:O,width:Y,height:Q,autoPanOnNodeFocus:U,setCenter:q}=z.getState();if(!U)return;kn(new Map([[e,h]]),{x:0,y:0,width:Y,height:Q},O,!0).length>0||q(h.position.x+P.width/2,h.position.y+P.height/2,{zoom:O[2]})};return v.jsx("div",{className:ie(["react-flow__node",`react-flow__node-${E}`,{[g]:T},h.className,{selected:h.selected,selectable:A,parent:S,draggable:T,dragging:I}]),ref:x,style:{zIndex:y.z,transform:`translate(${y.positionAbsolute.x}px,${y.positionAbsolute.y}px)`,pointerEvents:D?"all":"none",visibility:H?"visible":"hidden",...h.style,...k},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:V,onMouseLeave:R,onContextMenu:F,onClick:W,onDoubleClick:B,onKeyDown:M?K:void 0,tabIndex:M?0:void 0,onFocus:M?Z:void 0,role:h.ariaRole??(M?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${ti}-${w}`,"aria-label":h.ariaLabel,...h.domAttributes,children:v.jsx(af,{value:e,children:v.jsx(C,{id:e,data:h.data,type:E,positionAbsoluteX:y.positionAbsolute.x,positionAbsoluteY:y.positionAbsolute.y,selected:h.selected??!1,selectable:A,draggable:T,deletable:h.deletable??!0,isConnectable:j,sourcePosition:h.sourcePosition,targetPosition:h.targetPosition,dragging:I,dragHandle:h.dragHandle,zIndex:y.z,parentId:h.parentId,...P})})})}var Cf=$.memo(Nf);const Mf=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function di(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:i}=J(Mf,oe),s=_f(e.onlyRenderVisibleElements),a=Ef();return v.jsx("div",{className:"react-flow__nodes",style:qt,children:s.map(l=>v.jsx(Cf,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},l))})}di.displayName="NodeRenderer";const If=$.memo(di);function kf(e){return J($.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&Pu({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),oe)}const Pf=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return v.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Af=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return v.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ro={[Dt.Arrow]:Pf,[Dt.ArrowClosed]:Af};function Tf(e){const t=re();return $.useMemo(()=>Object.prototype.hasOwnProperty.call(Ro,e)?Ro[e]:(t.getState().onError?.("009",pe.error009(e)),null),[e])}const Df=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=Tf(t);return l?v.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:v.jsx(l,{color:n,strokeWidth:s})}):null},fi=({defaultColor:e,rfId:t})=>{const n=J(i=>i.edges),o=J(i=>i.defaultEdgeOptions),r=$.useMemo(()=>Ru(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?v.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:v.jsx("defs",{children:r.map(i=>v.jsx(Df,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};fi.displayName="MarkerDefinitions";var zf=$.memo(fi);function hi({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d}){const[u,f]=$.useState({x:1,y:0,width:0,height:0}),g=ie(["react-flow__edge-textwrapper",c]),p=$.useRef(null);return $.useEffect(()=>{if(p.current){const w=p.current.getBBox();f({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?v.jsxs("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:g,visibility:u.width?"visible":"hidden",...d,children:[r&&v.jsx("rect",{width:u.width+2*s[0],x:-s[0],y:-s[1],height:u.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),v.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:p,style:o,children:n}),l]}):null}hi.displayName="EdgeText";const $f=$.memo(hi);function Gt({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...d}){return v.jsxs(v.Fragment,{children:[v.jsx("path",{...d,d:e,fill:"none",className:ie(["react-flow__edge-path",d.className])}),c?v.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&fe(t)&&fe(n)?v.jsx($f,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function jo({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===X.Left||e===X.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function gi({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top}){const[s,a]=jo({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=jo({pos:i,x1:o,y1:r,x2:e,y2:t}),[d,u,f,g]=Rr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,d,u,f,g]}function pi(e){return $.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:w,markerStart:_,interactionWidth:m})=>{const[b,h,y]=gi({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),S=e.isInternal?void 0:t;return v.jsx(Gt,{id:S,path:b,labelX:h,labelY:y,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:w,markerStart:_,interactionWidth:m})})}const Hf=pi({isInternal:!1}),mi=pi({isInternal:!0});Hf.displayName="SimpleBezierEdge";mi.displayName="SimpleBezierEdgeInternal";function yi(e){return $.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,sourcePosition:g=X.Bottom,targetPosition:p=X.Top,markerEnd:w,markerStart:_,pathOptions:m,interactionWidth:b})=>{const[h,y,S]=mn({sourceX:n,sourceY:o,sourcePosition:g,targetX:r,targetY:i,targetPosition:p,borderRadius:m?.borderRadius,offset:m?.offset,stepPosition:m?.stepPosition}),E=e.isInternal?void 0:t;return v.jsx(Gt,{id:E,path:h,labelX:y,labelY:S,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:w,markerStart:_,interactionWidth:b})})}const xi=yi({isInternal:!1}),wi=yi({isInternal:!0});xi.displayName="SmoothStepEdge";wi.displayName="SmoothStepEdgeInternal";function vi(e){return $.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return v.jsx(xi,{...n,id:o,pathOptions:$.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Lf=vi({isInternal:!1}),_i=vi({isInternal:!0});Lf.displayName="StepEdge";_i.displayName="StepEdgeInternal";function bi(e){return $.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:g,markerStart:p,interactionWidth:w})=>{const[_,m,b]=Or({sourceX:n,sourceY:o,targetX:r,targetY:i}),h=e.isInternal?void 0:t;return v.jsx(Gt,{id:h,path:_,labelX:m,labelY:b,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:g,markerStart:p,interactionWidth:w})})}const Rf=bi({isInternal:!1}),Ei=bi({isInternal:!0});Rf.displayName="StraightEdge";Ei.displayName="StraightEdgeInternal";function Si(e){return $.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=X.Bottom,targetPosition:a=X.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:w,markerStart:_,pathOptions:m,interactionWidth:b})=>{const[h,y,S]=jr({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:m?.curvature}),E=e.isInternal?void 0:t;return v.jsx(Gt,{id:E,path:h,labelX:y,labelY:S,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:w,markerStart:_,interactionWidth:b})})}const jf=Si({isInternal:!1}),Ni=Si({isInternal:!0});jf.displayName="BezierEdge";Ni.displayName="BezierEdgeInternal";const Vo={default:Ni,straight:Ei,step:_i,smoothstep:wi,simplebezier:mi},Oo={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Vf=(e,t,n)=>n===X.Left?e-t:n===X.Right?e+t:e,Of=(e,t,n)=>n===X.Top?e-t:n===X.Bottom?e+t:e,Bo="react-flow__edgeupdater";function Fo({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return v.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ie([Bo,`${Bo}-${a}`]),cx:Vf(t,o,e),cy:Of(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Bf({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:d,onReconnectEnd:u,setReconnecting:f,setUpdateHover:g}){const p=re(),w=(y,S)=>{if(y.button!==0)return;const{autoPanOnConnect:E,domNode:C,isValidConnection:T,connectionMode:A,connectionRadius:j,lib:M,onConnectStart:z,onConnectEnd:H,cancelConnection:x,nodeLookup:I,rfId:N,panBy:P,updateConnection:k}=p.getState(),D=S.type==="target",L=(F,B)=>{f(!1),u?.(F,n,S.type,B)},V=F=>c?.(n,F),R=(F,B)=>{f(!0),d?.(y,n,S.type),z?.(F,B)};wn.onPointerDown(y.nativeEvent,{autoPanOnConnect:E,connectionMode:A,connectionRadius:j,domNode:C,handleId:S.id,nodeId:S.nodeId,nodeLookup:I,isTarget:D,edgeUpdaterType:S.type,lib:M,flowId:N,cancelConnection:x,panBy:P,isValidConnection:T,onConnect:V,onConnectStart:R,onConnectEnd:H,onReconnectEnd:L,updateConnection:k,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:y.currentTarget})},_=y=>w(y,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=y=>w(y,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>g(!0),h=()=>g(!1);return v.jsxs(v.Fragment,{children:[(e===!0||e==="source")&&v.jsx(Fo,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:_,onMouseEnter:b,onMouseOut:h,type:"source"}),(e===!0||e==="target")&&v.jsx(Fo,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:m,onMouseEnter:b,onMouseOut:h,type:"target"})]})}function Ff({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:g,rfId:p,edgeTypes:w,noPanClassName:_,onError:m,disableKeyboardA11y:b}){let h=J(q=>q.edgeLookup.get(e));const y=J(q=>q.defaultEdgeOptions);h=y?{...y,...h}:h;let S=h.type||"default",E=w?.[S]||Vo[S];E===void 0&&(m?.("011",pe.error011(S)),S="default",E=w?.default||Vo.default);const C=!!(h.focusable||t&&typeof h.focusable>"u"),T=typeof u<"u"&&(h.reconnectable||n&&typeof h.reconnectable>"u"),A=!!(h.selectable||o&&typeof h.selectable>"u"),j=$.useRef(null),[M,z]=$.useState(!1),[H,x]=$.useState(!1),I=re(),{zIndex:N,sourceX:P,sourceY:k,targetX:D,targetY:L,sourcePosition:V,targetPosition:R}=J($.useCallback(q=>{const G=q.nodeLookup.get(h.source),ee=q.nodeLookup.get(h.target);if(!G||!ee)return{zIndex:h.zIndex,...Oo};const ne=Lu({id:e,sourceNode:G,targetNode:ee,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:q.connectionMode,onError:m});return{zIndex:ku({selected:h.selected,zIndex:h.zIndex,sourceNode:G,targetNode:ee,elevateOnSelect:q.elevateEdgesOnSelect,zIndexMode:q.zIndexMode}),...ne||Oo}},[h.source,h.target,h.sourceHandle,h.targetHandle,h.selected,h.zIndex]),oe),F=$.useMemo(()=>h.markerStart?`url('#${yn(h.markerStart,p)}')`:void 0,[h.markerStart,p]),B=$.useMemo(()=>h.markerEnd?`url('#${yn(h.markerEnd,p)}')`:void 0,[h.markerEnd,p]);if(h.hidden||P===null||k===null||D===null||L===null)return null;const W=q=>{const{addSelectedEdges:G,unselectNodesAndEdges:ee,multiSelectionActive:ne}=I.getState();A&&(I.setState({nodesSelectionActive:!1}),h.selected&&ne?(ee({nodes:[],edges:[h]}),j.current?.blur()):G([e])),r&&r(q,h)},K=i?q=>{i(q,{...h})}:void 0,Z=s?q=>{s(q,{...h})}:void 0,O=a?q=>{a(q,{...h})}:void 0,Y=l?q=>{l(q,{...h})}:void 0,Q=c?q=>{c(q,{...h})}:void 0,U=q=>{if(!b&&Sr.includes(q.key)&&A){const{unselectNodesAndEdges:G,addSelectedEdges:ee}=I.getState();q.key==="Escape"?(j.current?.blur(),G({edges:[h]})):ee([e])}};return v.jsx("svg",{style:{zIndex:N},children:v.jsxs("g",{className:ie(["react-flow__edge",`react-flow__edge-${S}`,h.className,_,{selected:h.selected,animated:h.animated,inactive:!A&&!r,updating:M,selectable:A}]),onClick:W,onDoubleClick:K,onContextMenu:Z,onMouseEnter:O,onMouseMove:Y,onMouseLeave:Q,onKeyDown:C?U:void 0,tabIndex:C?0:void 0,role:h.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":h.ariaLabel===null?void 0:h.ariaLabel||`Edge from ${h.source} to ${h.target}`,"aria-describedby":C?`${ni}-${p}`:void 0,ref:j,...h.domAttributes,children:[!H&&v.jsx(E,{id:e,source:h.source,target:h.target,type:h.type,selected:h.selected,animated:h.animated,selectable:A,deletable:h.deletable??!0,label:h.label,labelStyle:h.labelStyle,labelShowBg:h.labelShowBg,labelBgStyle:h.labelBgStyle,labelBgPadding:h.labelBgPadding,labelBgBorderRadius:h.labelBgBorderRadius,sourceX:P,sourceY:k,targetX:D,targetY:L,sourcePosition:V,targetPosition:R,data:h.data,style:h.style,sourceHandleId:h.sourceHandle,targetHandleId:h.targetHandle,markerStart:F,markerEnd:B,pathOptions:"pathOptions"in h?h.pathOptions:void 0,interactionWidth:h.interactionWidth}),T&&v.jsx(Bf,{edge:h,isReconnectable:T,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:g,sourceX:P,sourceY:k,targetX:D,targetY:L,sourcePosition:V,targetPosition:R,setUpdateHover:z,setReconnecting:x})]})})}var Xf=$.memo(Ff);const Yf=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ci({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,reconnectRadius:u,onEdgeDoubleClick:f,onReconnectStart:g,onReconnectEnd:p,disableKeyboardA11y:w}){const{edgesFocusable:_,edgesReconnectable:m,elementsSelectable:b,onError:h}=J(Yf,oe),y=kf(t);return v.jsxs("div",{className:"react-flow__edges",children:[v.jsx(zf,{defaultColor:e,rfId:n}),y.map(S=>v.jsx(Xf,{id:S,edgesFocusable:_,edgesReconnectable:m,elementsSelectable:b,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,reconnectRadius:u,onDoubleClick:f,onReconnectStart:g,onReconnectEnd:p,rfId:n,onError:h,edgeTypes:o,disableKeyboardA11y:w},S))]})}Ci.displayName="EdgeRenderer";const Zf=$.memo(Ci),Wf=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function qf({children:e}){const t=J(Wf);return v.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Gf(e){const t=Ln(),n=$.useRef(!1);$.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Kf=e=>e.panZoom?.syncViewport;function Uf(e){const t=J(Kf),n=re();return $.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Qf(e){return e.connection.inProgress?{...e.connection,to:gt(e.connection.to,e.transform)}:{...e.connection}}function Jf(e){return Qf}function eh(e){const t=Jf();return J(t,oe)}const th=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function nh({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=J(th,oe);return!(i&&r&&l)?null:v.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:v.jsx("g",{className:ie(["react-flow__connection",Mr(a)]),children:v.jsx(Mi,{style:t,type:n,CustomComponent:o,isValid:a})})})}const Mi=({style:e,type:t=Ne.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:c,toNode:d,toHandle:u,toPosition:f,pointer:g}=eh();if(!r)return;if(n)return v.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:f,connectionStatus:Mr(o),toNode:d,toHandle:u,pointer:g});let p="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:f};switch(t){case Ne.Bezier:[p]=jr(w);break;case Ne.SimpleBezier:[p]=gi(w);break;case Ne.Step:[p]=mn({...w,borderRadius:0});break;case Ne.SmoothStep:[p]=mn(w);break;default:[p]=Or(w)}return v.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:e})};Mi.displayName="ConnectionLine";const oh={};function Xo(e=oh){$.useRef(e),re(),$.useEffect(()=>{},[e])}function rh(){re(),$.useRef(!1),$.useEffect(()=>{},[])}function Ii({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,onSelectionContextMenu:u,onSelectionStart:f,onSelectionEnd:g,connectionLineType:p,connectionLineStyle:w,connectionLineComponent:_,connectionLineContainerStyle:m,selectionKeyCode:b,selectionOnDrag:h,selectionMode:y,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:C,deleteKeyCode:T,onlyRenderVisibleElements:A,elementsSelectable:j,defaultViewport:M,translateExtent:z,minZoom:H,maxZoom:x,preventScrolling:I,defaultMarkerColor:N,zoomOnScroll:P,zoomOnPinch:k,panOnScroll:D,panOnScrollSpeed:L,panOnScrollMode:V,zoomOnDoubleClick:R,panOnDrag:F,onPaneClick:B,onPaneMouseEnter:W,onPaneMouseMove:K,onPaneMouseLeave:Z,onPaneScroll:O,onPaneContextMenu:Y,paneClickDistance:Q,nodeClickDistance:U,onEdgeContextMenu:q,onEdgeMouseEnter:G,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,onReconnect:ae,onReconnectStart:be,onReconnectEnd:ye,noDragClassName:Ie,noWheelClassName:We,noPanClassName:qe,disableKeyboardA11y:Ge,nodeExtent:Kt,rfId:pt,viewport:$e,onViewportChange:Ke}){return Xo(e),Xo(t),rh(),Gf(n),Uf($e),v.jsx(wf,{onPaneClick:B,onPaneMouseEnter:W,onPaneMouseMove:K,onPaneMouseLeave:Z,onPaneContextMenu:Y,onPaneScroll:O,paneClickDistance:Q,deleteKeyCode:T,selectionKeyCode:b,selectionOnDrag:h,selectionMode:y,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:C,elementsSelectable:j,zoomOnScroll:P,zoomOnPinch:k,zoomOnDoubleClick:R,panOnScroll:D,panOnScrollSpeed:L,panOnScrollMode:V,panOnDrag:F,defaultViewport:M,translateExtent:z,minZoom:H,maxZoom:x,onSelectionContextMenu:u,preventScrolling:I,noDragClassName:Ie,noWheelClassName:We,noPanClassName:qe,disableKeyboardA11y:Ge,onViewportChange:Ke,isControlledViewport:!!$e,children:v.jsxs(qf,{children:[v.jsx(Zf,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:ae,onReconnectStart:be,onReconnectEnd:ye,onlyRenderVisibleElements:A,onEdgeContextMenu:q,onEdgeMouseEnter:G,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,defaultMarkerColor:N,noPanClassName:qe,disableKeyboardA11y:Ge,rfId:pt}),v.jsx(nh,{style:w,type:p,component:_,containerStyle:m}),v.jsx("div",{className:"react-flow__edgelabel-renderer"}),v.jsx(If,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,nodeClickDistance:U,onlyRenderVisibleElements:A,noPanClassName:qe,noDragClassName:Ie,disableKeyboardA11y:Ge,nodeExtent:Kt,rfId:pt}),v.jsx("div",{className:"react-flow__viewport-portal"})]})})}Ii.displayName="GraphView";const ih=$.memo(Ii),Yo=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:u,zIndexMode:f="basic"}={})=>{const g=new Map,p=new Map,w=new Map,_=new Map,m=o??t??[],b=n??e??[],h=d??[0,0],y=u??it;Xr(w,_,m);const S=xn(b,g,p,{nodeOrigin:h,nodeExtent:y,zIndexMode:f});let E=[0,0,1];if(s&&r&&i){const C=ft(g,{filter:M=>!!((M.width||M.initialWidth)&&(M.height||M.initialHeight))}),{x:T,y:A,zoom:j}=Pn(C,r,i,l,c,a?.padding??.1);E=[T,A,j]}return{rfId:"1",width:r??0,height:i??0,transform:E,nodes:b,nodesInitialized:S,nodeLookup:g,parentLookup:p,edges:m,edgeLookup:_,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:it,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Be.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:h,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Cr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Eu,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Nr,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},sh=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f})=>_d((g,p)=>{async function w(){const{nodeLookup:_,panZoom:m,fitViewOptions:b,fitViewResolver:h,width:y,height:S,minZoom:E,maxZoom:C}=p();m&&(await _u({nodes:_,width:y,height:S,panZoom:m,minZoom:E,maxZoom:C},b),h?.resolve(!0),g({fitViewResolver:null}))}return{...Yo({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:_=>{const{nodeLookup:m,parentLookup:b,nodeOrigin:h,elevateNodesOnSelect:y,fitViewQueued:S,zIndexMode:E}=p(),C=xn(_,m,b,{nodeOrigin:h,nodeExtent:u,elevateNodesOnSelect:y,checkEquality:!0,zIndexMode:E});S&&C?(w(),g({nodes:_,nodesInitialized:C,fitViewQueued:!1,fitViewOptions:void 0})):g({nodes:_,nodesInitialized:C})},setEdges:_=>{const{connectionLookup:m,edgeLookup:b}=p();Xr(m,b,_),g({edges:_})},setDefaultNodesAndEdges:(_,m)=>{if(_){const{setNodes:b}=p();b(_),g({hasDefaultNodes:!0})}if(m){const{setEdges:b}=p();b(m),g({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:m,nodeLookup:b,parentLookup:h,domNode:y,nodeOrigin:S,nodeExtent:E,debug:C,fitViewQueued:T,zIndexMode:A}=p(),{changes:j,updatedInternals:M}=Yu(_,b,h,y,S,E,A);M&&(Ou(b,h,{nodeOrigin:S,nodeExtent:E,zIndexMode:A}),T?(w(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),j?.length>0&&(C&&console.log("React Flow: trigger node changes",j),m?.(j)))},updateNodePositions:(_,m=!1)=>{const b=[];let h=[];const{nodeLookup:y,triggerNodeChanges:S,connection:E,updateConnection:C,onNodesChangeMiddlewareMap:T}=p();for(const[A,j]of _){const M=y.get(A),z=!!(M?.expandParent&&M?.parentId&&j?.position),H={id:A,type:"position",position:z?{x:Math.max(0,j.position.x),y:Math.max(0,j.position.y)}:j.position,dragging:m};if(M&&E.inProgress&&E.fromNode.id===M.id){const x=ze(M,E.fromHandle,X.Left,!0);C({...E,from:x})}z&&M.parentId&&b.push({id:A,parentId:M.parentId,rect:{...j.internals.positionAbsolute,width:j.measured.width??0,height:j.measured.height??0}}),h.push(H)}if(b.length>0){const{parentLookup:A,nodeOrigin:j}=p(),M=Hn(b,y,A,j);h.push(...M)}for(const A of T.values())h=A(h);S(h)},triggerNodeChanges:_=>{const{onNodesChange:m,setNodes:b,nodes:h,hasDefaultNodes:y,debug:S}=p();if(_?.length){if(y){const E=Bd(_,h);b(E)}S&&console.log("React Flow: trigger node changes",_),m?.(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:m,setEdges:b,edges:h,hasDefaultEdges:y,debug:S}=p();if(_?.length){if(y){const E=Fd(_,h);b(E)}S&&console.log("React Flow: trigger edge changes",_),m?.(_)}},addSelectedNodes:_=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:h,triggerNodeChanges:y,triggerEdgeChanges:S}=p();if(m){const E=_.map(C=>Pe(C,!0));y(E);return}y(Re(h,new Set([..._]),!0)),S(Re(b))},addSelectedEdges:_=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:h,triggerNodeChanges:y,triggerEdgeChanges:S}=p();if(m){const E=_.map(C=>Pe(C,!0));S(E);return}S(Re(b,new Set([..._]))),y(Re(h,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:m}={})=>{const{edges:b,nodes:h,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:E}=p(),C=_||h,T=m||b,A=C.map(M=>{const z=y.get(M.id);return z&&(z.selected=!1),Pe(M.id,!1)}),j=T.map(M=>Pe(M.id,!1));S(A),E(j)},setMinZoom:_=>{const{panZoom:m,maxZoom:b}=p();m?.setScaleExtent([_,b]),g({minZoom:_})},setMaxZoom:_=>{const{panZoom:m,minZoom:b}=p();m?.setScaleExtent([b,_]),g({maxZoom:_})},setTranslateExtent:_=>{p().panZoom?.setTranslateExtent(_),g({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:m,triggerNodeChanges:b,triggerEdgeChanges:h,elementsSelectable:y}=p();if(!y)return;const S=m.reduce((C,T)=>T.selected?[...C,Pe(T.id,!1)]:C,[]),E=_.reduce((C,T)=>T.selected?[...C,Pe(T.id,!1)]:C,[]);b(S),h(E)},setNodeExtent:_=>{const{nodes:m,nodeLookup:b,parentLookup:h,nodeOrigin:y,elevateNodesOnSelect:S,nodeExtent:E,zIndexMode:C}=p();_[0][0]===E[0][0]&&_[0][1]===E[0][1]&&_[1][0]===E[1][0]&&_[1][1]===E[1][1]||(xn(m,b,h,{nodeOrigin:y,nodeExtent:_,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:C}),g({nodeExtent:_}))},panBy:_=>{const{transform:m,width:b,height:h,panZoom:y,translateExtent:S}=p();return Zu({delta:_,panZoom:y,transform:m,translateExtent:S,width:b,height:h})},setCenter:async(_,m,b)=>{const{width:h,height:y,maxZoom:S,panZoom:E}=p();if(!E)return Promise.resolve(!1);const C=typeof b?.zoom<"u"?b.zoom:S;return await E.setViewport({x:h/2-_*C,y:y/2-m*C,zoom:C},{duration:b?.duration,ease:b?.ease,interpolate:b?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{g({connection:{...Cr}})},updateConnection:_=>{g({connection:_})},reset:()=>g({...Yo()})}},Object.is);function ah({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f,children:g}){const[p]=$.useState(()=>sh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:c,minZoom:s,maxZoom:a,fitViewOptions:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f}));return v.jsx(bd,{value:p,children:v.jsx(Wd,{children:g})})}function ch({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:g}){return $.useContext(Zt)?v.jsx(v.Fragment,{children:e}):v.jsx(ah,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:g,children:e})}const lh={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function uh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:g,onConnectStart:p,onConnectEnd:w,onClickConnectStart:_,onClickConnectEnd:m,onNodeMouseEnter:b,onNodeMouseMove:h,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:E,onNodeDragStart:C,onNodeDrag:T,onNodeDragStop:A,onNodesDelete:j,onEdgesDelete:M,onDelete:z,onSelectionChange:H,onSelectionDragStart:x,onSelectionDrag:I,onSelectionDragStop:N,onSelectionContextMenu:P,onSelectionStart:k,onSelectionEnd:D,onBeforeDelete:L,connectionMode:V,connectionLineType:R=Ne.Bezier,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:W,deleteKeyCode:K="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:O=!1,selectionMode:Y=st.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:U=ct()?"Meta":"Control",zoomActivationKeyCode:q=ct()?"Meta":"Control",snapToGrid:G,snapGrid:ee,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:te,nodesDraggable:ae,autoPanOnNodeFocus:be,nodesConnectable:ye,nodesFocusable:Ie,nodeOrigin:We=oi,edgesFocusable:qe,edgesReconnectable:Ge,elementsSelectable:Kt=!0,defaultViewport:pt=$d,minZoom:$e=.5,maxZoom:Ke=2,translateExtent:Vn=it,preventScrolling:$i=!0,nodeExtent:Ut,defaultMarkerColor:Hi="#b1b1b7",zoomOnScroll:Li=!0,zoomOnPinch:Ri=!0,panOnScroll:ji=!1,panOnScrollSpeed:Vi=.5,panOnScrollMode:Oi=Ae.Free,zoomOnDoubleClick:Bi=!0,panOnDrag:Fi=!0,onPaneClick:Xi,onPaneMouseEnter:Yi,onPaneMouseMove:Zi,onPaneMouseLeave:Wi,onPaneScroll:qi,onPaneContextMenu:Gi,paneClickDistance:Ki=1,nodeClickDistance:Ui=0,children:Qi,onReconnect:Ji,onReconnectStart:es,onReconnectEnd:ts,onEdgeContextMenu:ns,onEdgeDoubleClick:os,onEdgeMouseEnter:rs,onEdgeMouseMove:is,onEdgeMouseLeave:ss,reconnectRadius:as=10,onNodesChange:cs,onEdgesChange:ls,noDragClassName:us="nodrag",noWheelClassName:ds="nowheel",noPanClassName:On="nopan",fitView:Bn,fitViewOptions:Fn,connectOnClick:fs,attributionPosition:hs,proOptions:gs,defaultEdgeOptions:ps,elevateNodesOnSelect:ms=!0,elevateEdgesOnSelect:ys=!1,disableKeyboardA11y:Xn=!1,autoPanOnConnect:xs,autoPanOnNodeDrag:ws,autoPanSpeed:vs,connectionRadius:_s,isValidConnection:bs,onError:Es,style:Ss,id:Yn,nodeDragThreshold:Ns,connectionDragThreshold:Cs,viewport:Ms,onViewportChange:Is,width:ks,height:Ps,colorMode:As="light",debug:Ts,onScroll:Zn,ariaLabelConfig:Ds,zIndexMode:Wn="basic",...zs},$s){const Qt=Yn||"1",Hs=jd(As),Ls=$.useCallback(qn=>{qn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Zn?.(qn)},[Zn]);return v.jsx("div",{"data-testid":"rf__wrapper",...zs,onScroll:Ls,style:{...Ss,...lh},ref:$s,className:ie(["react-flow",r,Hs]),id:Yn,role:"application",children:v.jsxs(ch,{nodes:e,edges:t,width:ks,height:Ps,fitView:Bn,fitViewOptions:Fn,minZoom:$e,maxZoom:Ke,nodeOrigin:We,nodeExtent:Ut,zIndexMode:Wn,children:[v.jsx(ih,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:b,onNodeMouseMove:h,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:s,connectionLineType:R,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:W,selectionKeyCode:Z,selectionOnDrag:O,selectionMode:Y,deleteKeyCode:K,multiSelectionKeyCode:U,panActivationKeyCode:Q,zoomActivationKeyCode:q,onlyRenderVisibleElements:ne,defaultViewport:pt,translateExtent:Vn,minZoom:$e,maxZoom:Ke,preventScrolling:$i,zoomOnScroll:Li,zoomOnPinch:Ri,zoomOnDoubleClick:Bi,panOnScroll:ji,panOnScrollSpeed:Vi,panOnScrollMode:Oi,panOnDrag:Fi,onPaneClick:Xi,onPaneMouseEnter:Yi,onPaneMouseMove:Zi,onPaneMouseLeave:Wi,onPaneScroll:qi,onPaneContextMenu:Gi,paneClickDistance:Ki,nodeClickDistance:Ui,onSelectionContextMenu:P,onSelectionStart:k,onSelectionEnd:D,onReconnect:Ji,onReconnectStart:es,onReconnectEnd:ts,onEdgeContextMenu:ns,onEdgeDoubleClick:os,onEdgeMouseEnter:rs,onEdgeMouseMove:is,onEdgeMouseLeave:ss,reconnectRadius:as,defaultMarkerColor:Hi,noDragClassName:us,noWheelClassName:ds,noPanClassName:On,rfId:Qt,disableKeyboardA11y:Xn,nodeExtent:Ut,viewport:Ms,onViewportChange:Is}),v.jsx(Rd,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:g,onConnectStart:p,onConnectEnd:w,onClickConnectStart:_,onClickConnectEnd:m,nodesDraggable:ae,autoPanOnNodeFocus:be,nodesConnectable:ye,nodesFocusable:Ie,edgesFocusable:qe,edgesReconnectable:Ge,elementsSelectable:Kt,elevateNodesOnSelect:ms,elevateEdgesOnSelect:ys,minZoom:$e,maxZoom:Ke,nodeExtent:Ut,onNodesChange:cs,onEdgesChange:ls,snapToGrid:G,snapGrid:ee,connectionMode:V,translateExtent:Vn,connectOnClick:fs,defaultEdgeOptions:ps,fitView:Bn,fitViewOptions:Fn,onNodesDelete:j,onEdgesDelete:M,onDelete:z,onNodeDragStart:C,onNodeDrag:T,onNodeDragStop:A,onSelectionDrag:I,onSelectionDragStart:x,onSelectionDragStop:N,onMove:d,onMoveStart:u,onMoveEnd:f,noPanClassName:On,nodeOrigin:We,rfId:Qt,autoPanOnConnect:xs,autoPanOnNodeDrag:ws,autoPanSpeed:vs,onError:Es,connectionRadius:_s,isValidConnection:bs,selectNodesOnDrag:te,nodeDragThreshold:Ns,connectionDragThreshold:Cs,onBeforeDelete:L,debug:Ts,ariaLabelConfig:Ds,zIndexMode:Wn}),v.jsx(zd,{onSelectionChange:H}),Qi,v.jsx(kd,{proOptions:gs,position:hs}),v.jsx(Id,{rfId:Qt,disableKeyboardA11y:Xn})]})})}var dh=ii(uh);function fh({dimensions:e,lineWidth:t,variant:n,className:o}){return v.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ie(["react-flow__background-pattern",n,o])})}function hh({radius:e,className:t}){return v.jsx("circle",{cx:e,cy:e,r:e,className:ie(["react-flow__background-pattern","dots",t])})}var Ce;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ce||(Ce={}));const gh={[Ce.Dots]:1,[Ce.Lines]:1,[Ce.Cross]:6},ph=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ki({id:e,variant:t=Ce.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:l,className:c,patternClassName:d}){const u=$.useRef(null),{transform:f,patternId:g}=J(ph,oe),p=o||gh[t],w=t===Ce.Dots,_=t===Ce.Cross,m=Array.isArray(n)?n:[n,n],b=[m[0]*f[2]||1,m[1]*f[2]||1],h=p*f[2],y=Array.isArray(i)?i:[i,i],S=_?[h,h]:b,E=[y[0]*f[2]||1+S[0]/2,y[1]*f[2]||1+S[1]/2],C=`${g}${e||""}`;return v.jsxs("svg",{className:ie(["react-flow__background",c]),style:{...l,...qt,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:u,"data-testid":"rf__background",children:[v.jsx("pattern",{id:C,x:f[0]%b[0],y:f[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:w?v.jsx(hh,{radius:h/2,className:d}):v.jsx(fh,{dimensions:S,lineWidth:r,variant:t,className:d})}),v.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}ki.displayName="Background";$.memo(ki);function mh(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:v.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function yh(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:v.jsx("path",{d:"M0 0h32v4.2H0z"})})}function xh(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:v.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function wh(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function vh(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function bt({children:e,className:t,...n}){return v.jsx("button",{type:"button",className:ie(["react-flow__controls-button",t]),...n,children:e})}const _h=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Pi({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:c,children:d,position:u="bottom-left",orientation:f="vertical","aria-label":g}){const p=re(),{isInteractive:w,minZoomReached:_,maxZoomReached:m,ariaLabelConfig:b}=J(_h,oe),{zoomIn:h,zoomOut:y,fitView:S}=Ln(),E=()=>{h(),i?.()},C=()=>{y(),s?.()},T=()=>{S(r),a?.()},A=()=>{p.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),l?.(!w)},j=f==="horizontal"?"horizontal":"vertical";return v.jsxs(Wt,{className:ie(["react-flow__controls",j,c]),position:u,style:e,"data-testid":"rf__controls","aria-label":g??b["controls.ariaLabel"],children:[t&&v.jsxs(v.Fragment,{children:[v.jsx(bt,{onClick:E,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:m,children:v.jsx(mh,{})}),v.jsx(bt,{onClick:C,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:_,children:v.jsx(yh,{})})]}),n&&v.jsx(bt,{className:"react-flow__controls-fitview",onClick:T,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:v.jsx(xh,{})}),o&&v.jsx(bt,{className:"react-flow__controls-interactive",onClick:A,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:w?v.jsx(vh,{}):v.jsx(wh,{})}),d]})}Pi.displayName="Controls";$.memo(Pi);function bh({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:c,borderRadius:d,shapeRendering:u,selected:f,onClick:g}){const{background:p,backgroundColor:w}=i||{},_=s||p||w;return v.jsx("rect",{className:ie(["react-flow__minimap-node",{selected:f},c]),x:t,y:n,rx:d,ry:d,width:o,height:r,style:{fill:_,stroke:a,strokeWidth:l},shapeRendering:u,onClick:g?m=>g(m,e):void 0})}const Eh=$.memo(bh),Sh=e=>e.nodes.map(t=>t.id),cn=e=>e instanceof Function?e:()=>e;function Nh({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=Eh,onClick:s}){const a=J(Sh,oe),l=cn(t),c=cn(e),d=cn(n),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return v.jsx(v.Fragment,{children:a.map(f=>v.jsx(Mh,{id:f,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:d,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:u},f))})}function Ch({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:c,x:d,y:u,width:f,height:g}=J(p=>{const{internals:w}=p.nodeLookup.get(e),_=w.userNode,{x:m,y:b}=w.positionAbsolute,{width:h,height:y}=_e(_);return{node:_,x:m,y:b,width:h,height:y}},oe);return!c||c.hidden||!Dr(c)?null:v.jsx(a,{x:d,y:u,width:f,height:g,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:i,shapeRendering:s,onClick:l,id:c.id})}const Mh=$.memo(Ch);var Ih=$.memo(Nh);const kh=200,Ph=150,Ah=e=>!e.hidden,Th=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Tr(ft(e.nodeLookup,{filter:Ah}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Dh="react-flow__minimap-desc";function Ai({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:d,maskStrokeWidth:u,position:f="bottom-right",onClick:g,onNodeClick:p,pannable:w=!1,zoomable:_=!1,ariaLabel:m,inversePan:b,zoomStep:h=1,offsetScale:y=5}){const S=re(),E=$.useRef(null),{boundingRect:C,viewBB:T,rfId:A,panZoom:j,translateExtent:M,flowWidth:z,flowHeight:H,ariaLabelConfig:x}=J(Th,oe),I=e?.width??kh,N=e?.height??Ph,P=C.width/I,k=C.height/N,D=Math.max(P,k),L=D*I,V=D*N,R=y*D,F=C.x-(L-C.width)/2-R,B=C.y-(V-C.height)/2-R,W=L+R*2,K=V+R*2,Z=`${Dh}-${A}`,O=$.useRef(0),Y=$.useRef();O.current=D,$.useEffect(()=>{if(E.current&&j)return Y.current=td({domNode:E.current,panZoom:j,getTransform:()=>S.getState().transform,getViewScale:()=>O.current}),()=>{Y.current?.destroy()}},[j]),$.useEffect(()=>{Y.current?.update({translateExtent:M,width:z,height:H,inversePan:b,pannable:w,zoomStep:h,zoomable:_})},[w,_,b,h,M,z,H]);const Q=g?G=>{const[ee,ne]=Y.current?.pointer(G)||[0,0];g(G,{x:ee,y:ne})}:void 0,U=p?$.useCallback((G,ee)=>{const ne=S.getState().nodeLookup.get(ee).internals.userNode;p(G,ne)},[]):void 0,q=m??x["minimap.ariaLabel"];return v.jsx(Wt,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*D:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ie(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:v.jsxs("svg",{width:I,height:N,viewBox:`${F} ${B} ${W} ${K}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:E,onClick:Q,children:[q&&v.jsx("title",{id:Z,children:q}),v.jsx(Ih,{onClick:U,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),v.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-R},${B-R}h${W+R*2}v${K+R*2}h${-W-R*2}z
7
+ M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Ai.displayName="MiniMap";$.memo(Ai);const zh=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,$h={[Ze.Line]:"right",[Ze.Handle]:"bottom-right"};function Hh({nodeId:e,position:t,variant:n=Ze.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:f,autoScale:g=!0,shouldResize:p,onResizeStart:w,onResize:_,onResizeEnd:m}){const b=li(),h=typeof e=="string"?e:b,y=re(),S=$.useRef(null),E=n===Ze.Handle,C=J($.useCallback(zh(E&&g),[E,g]),oe),T=$.useRef(null),A=t??$h[n];$.useEffect(()=>{if(!(!S.current||!h))return T.current||(T.current=pd({domNode:S.current,nodeId:h,getStoreItems:()=>{const{nodeLookup:M,transform:z,snapGrid:H,snapToGrid:x,nodeOrigin:I,domNode:N}=y.getState();return{nodeLookup:M,transform:z,snapGrid:H,snapToGrid:x,nodeOrigin:I,paneDomNode:N}},onChange:(M,z)=>{const{triggerNodeChanges:H,nodeLookup:x,parentLookup:I,nodeOrigin:N}=y.getState(),P=[],k={x:M.x,y:M.y},D=x.get(h);if(D&&D.expandParent&&D.parentId){const L=D.origin??N,V=M.width??D.measured.width??0,R=M.height??D.measured.height??0,F={id:D.id,parentId:D.parentId,rect:{width:V,height:R,...zr({x:M.x??D.position.x,y:M.y??D.position.y},{width:V,height:R},D.parentId,x,L)}},B=Hn([F],x,I,N);P.push(...B),k.x=M.x?Math.max(L[0]*V,M.x):void 0,k.y=M.y?Math.max(L[1]*R,M.y):void 0}if(k.x!==void 0&&k.y!==void 0){const L={id:h,type:"position",position:{...k}};P.push(L)}if(M.width!==void 0&&M.height!==void 0){const V={id:h,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:M.width,height:M.height}};P.push(V)}for(const L of z){const V={...L,type:"position"};P.push(V)}H(P)},onEnd:({width:M,height:z})=>{const H={id:h,type:"dimensions",resizing:!1,dimensions:{width:M,height:z}};y.getState().triggerNodeChanges([H])}})),T.current.update({controlPosition:A,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:d},keepAspectRatio:u,resizeDirection:f,onResizeStart:w,onResize:_,onResizeEnd:m,shouldResize:p}),()=>{T.current?.destroy()}},[A,a,l,c,d,u,w,_,m,p]);const j=A.split("-");return v.jsx("div",{className:ie(["react-flow__resize-control","nodrag",...j,n,o]),ref:S,style:{...r,scale:C,...s&&{[E?"backgroundColor":"borderColor"]:s}},children:i})}$.memo(Hh);const Ti=$.createContext(void 0);function Di(){const e=$.useContext(Ti);if(!e)throw new Error("useMetricsMode must be used within MetricsModeProvider");return e}function Lh(e){const t=ue.c(5),{children:n}=e,[o,r]=$.useState("requests");let i;t[0]!==o?(i={metricsMode:o,setMetricsMode:r},t[0]=o,t[1]=i):i=t[1];let s;return t[2]!==n||t[3]!==i?(s=v.jsx(Ti.Provider,{value:i,children:n}),t[2]=n,t[3]=i,t[4]=s):s=t[4],s}const Zo=10,Lt=56,jn=220,nt=56,Rh={requests:{edgeColor:"var(--chart-1)",textClass:"text-chart-1"},errors:{edgeColor:"var(--chart-3)",textClass:"text-chart-3"},latency:{edgeColor:"var(--chart-4)",textClass:"text-chart-4"}};function jh(){const e=Date.now(),t=300*1e3,n=Math.floor(e/t)*t,o=new Date(n);return{startDate:new Date(n-1440*60*1e3).toISOString(),endDate:o.toISOString()}}function Vh(e){const t=new Map,n=new Map;for(const i of e){const s=i.connectionId;if(s){const l=n.get(s)??{requests:0,errors:0,totalLatency:0};n.set(s,{requests:l.requests+1,errors:l.errors+(i.isError?1:0),totalLatency:l.totalLatency+i.durationMs})}const a=i.virtualMcpId;if(a){const l=t.get(a)??{requests:0,errors:0,totalLatency:0};t.set(a,{requests:l.requests+1,errors:l.errors+(i.isError?1:0),totalLatency:l.totalLatency+i.durationMs})}}const o=new Map;for(const[i,s]of t)o.set(i,{requests:s.requests,errors:s.errors,errorRate:s.requests>0?s.errors/s.requests*100:0,avgLatencyMs:s.requests>0?s.totalLatency/s.requests:0});const r=new Map;for(const[i,s]of n)r.set(i,{requests:s.requests,errors:s.errors,errorRate:s.requests>0?s.errors/s.requests*100:0,avgLatencyMs:s.requests>0?s.totalLatency/s.requests:0});return{virtualMcps:o,connections:r}}function zi(e,t){if(!e)return"—";switch(t){case"requests":return e.requests===0?"—":e.requests.toLocaleString();case"errors":return e.errorRate===0?"—":`${e.errorRate.toFixed(1)}%`;case"latency":return e.avgLatencyMs===0?"—":`${Math.round(e.avgLatencyMs)}ms`}}function Et(e,t){if(!e)return 0;switch(t){case"requests":return e.requests;case"errors":return e.errorRate;case"latency":return e.avgLatencyMs}}function Oh(){const e=ue.c(13),{org:t}=bn();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=jh(),e[0]=n):n=e[0];const o=n;let r;e[1]!==t.id?(r=ta.SELF(t.id),e[1]=t.id,e[2]=r):r=e[2];let i;e[3]!==t.id||e[4]!==r?(i={connectionId:r,orgId:t.id},e[3]=t.id,e[4]=r,e[5]=i):i=e[5];const s=na(i);let a;e[6]===Symbol.for("react.memo_cache_sentinel")?(a={...o,limit:1e3,offset:0},e[6]=a):a=e[6];let l;e[7]!==s?(l={client:s,toolName:"MONITORING_LOGS_LIST",toolArguments:a,staleTime:3e4,select:Bh},e[7]=s,e[8]=l):l=e[8];const{data:c}=Js(l);let d;e[9]!==c?.logs?(d=c?.logs??[],e[9]=c?.logs,e[10]=d):d=e[10];const u=d;let f;return e[11]!==u?(f=Vh(u),e[11]=u,e[12]=f):f=e[12],f}function Bh(e){return e.structuredContent??e}function Fh(e){const t=ue.c(29),{data:n}=e,o=_n();let r;t[0]!==n.metric||t[1]!==n.metricsMode?(r=zi(n.metric,n.metricsMode),t[0]=n.metric,t[1]=n.metricsMode,t[2]=r):r=t[2];const i=r;let s;t[3]!==n.org||t[4]!==n.virtualMcp.id||t[5]!==o?(s=()=>{o({to:"/$org/agents/$agentId",params:{org:n.org,agentId:n.virtualMcp.id}})},t[3]=n.org,t[4]=n.virtualMcp.id,t[5]=o,t[6]=s):s=t[6];const a=s;let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l={height:Lt,width:jn},t[7]=l):l=t[7];let c;t[8]===Symbol.for("react.memo_cache_sentinel")?(c=v.jsx(Qs,{}),t[8]=c):c=t[8];let d;t[9]!==n.virtualMcp.icon||t[10]!==n.virtualMcp.title?(d=v.jsx(Uo,{icon:n.virtualMcp.icon,name:n.virtualMcp.title,size:"md",fallbackIcon:c,className:"relative z-10"}),t[9]=n.virtualMcp.icon,t[10]=n.virtualMcp.title,t[11]=d):d=t[11];let u;t[12]!==n.virtualMcp.title?(u=v.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.virtualMcp.title}),t[12]=n.virtualMcp.title,t[13]=u):u=t[13];let f;t[14]!==n.colorScheme.textClass?(f=Go("text-base leading-none font-semibold tabular-nums",n.colorScheme.textClass),t[14]=n.colorScheme.textClass,t[15]=f):f=t[15];let g;t[16]!==i||t[17]!==f?(g=v.jsx("span",{className:f,children:i}),t[16]=i,t[17]=f,t[18]=g):g=t[18];let p;t[19]!==u||t[20]!==g?(p=v.jsxs("div",{className:"relative z-10 flex flex-col min-w-0 flex-1",children:[u,g]}),t[19]=u,t[20]=g,t[21]=p):p=t[21];let w;t[22]!==n.colorScheme.edgeColor?(w=v.jsx(Me,{type:"source",position:X.Right,style:{width:"8px",height:"8px",background:n.colorScheme.edgeColor,border:"none"}}),t[22]=n.colorScheme.edgeColor,t[23]=w):w=t[23];let _;return t[24]!==a||t[25]!==w||t[26]!==d||t[27]!==p?(_=v.jsxs("div",{className:"relative flex shrink-0 items-center gap-2 pl-1.5 pr-3 bg-background rounded-lg border-shadow nodrag nopan cursor-pointer pointer-events-auto before:absolute before:inset-0 before:rounded-lg before:bg-accent/25 before:opacity-0 hover:before:opacity-100 before:transition-opacity before:duration-800 before:pointer-events-none",style:l,onClick:a,children:[d,p,w]}),t[24]=a,t[25]=w,t[26]=d,t[27]=p,t[28]=_):_=t[28],_}function Xh(e){const t=ue.c(29),{data:n}=e,o=_n();let r;t[0]!==n.metric||t[1]!==n.metricsMode?(r=zi(n.metric,n.metricsMode),t[0]=n.metric,t[1]=n.metricsMode,t[2]=r):r=t[2];const i=r;let s;t[3]!==n.connection.id||t[4]!==n.org||t[5]!==o?(s=()=>{o({to:"/$org/mcps/$connectionId",params:{org:n.org,connectionId:n.connection.id}})},t[3]=n.connection.id,t[4]=n.org,t[5]=o,t[6]=s):s=t[6];const a=s;let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l={height:Lt,width:jn},t[7]=l):l=t[7];const c=`1px solid ${n.colorScheme.edgeColor}`;let d;t[8]!==c?(d=v.jsx(Me,{type:"target",position:X.Left,style:{width:"8px",height:"8px",background:"var(--background)",border:c,pointerEvents:"none",cursor:"default"}}),t[8]=c,t[9]=d):d=t[9];let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u=v.jsx(Us,{}),t[10]=u):u=t[10];let f;t[11]!==n.connection.icon||t[12]!==n.connection.title?(f=v.jsx(Uo,{icon:n.connection.icon,name:n.connection.title,size:"md",fallbackIcon:u,className:"relative z-10"}),t[11]=n.connection.icon,t[12]=n.connection.title,t[13]=f):f=t[13];let g;t[14]!==n.connection.title?(g=v.jsx("span",{className:"text-sm text-muted-foreground truncate",children:n.connection.title}),t[14]=n.connection.title,t[15]=g):g=t[15];let p;t[16]!==n.colorScheme.textClass?(p=Go("text-base leading-[1.35] font-semibold tabular-nums",n.colorScheme.textClass),t[16]=n.colorScheme.textClass,t[17]=p):p=t[17];let w;t[18]!==i||t[19]!==p?(w=v.jsx("span",{className:p,children:i}),t[18]=i,t[19]=p,t[20]=w):w=t[20];let _;t[21]!==w||t[22]!==g?(_=v.jsxs("div",{className:"relative z-10 flex flex-col min-w-0 flex-1",children:[g,w]}),t[21]=w,t[22]=g,t[23]=_):_=t[23];let m;return t[24]!==a||t[25]!==_||t[26]!==d||t[27]!==f?(m=v.jsxs("div",{className:"relative flex shrink-0 items-center gap-2 pl-1.5 pr-3 bg-background rounded-lg border-shadow nodrag nopan cursor-pointer pointer-events-auto before:absolute before:inset-0 before:rounded-lg before:bg-accent/25 before:opacity-0 hover:before:opacity-100 before:transition-opacity before:duration-800 before:pointer-events-none",style:l,onClick:a,children:[d,f,_]}),t[24]=a,t[25]=_,t[26]=d,t[27]=f,t[28]=m):m=t[28],m}function Yh(e){const t=ue.c(9),{data:n}=e,o=_n();let r;t[0]!==n.org||t[1]!==o?(r=()=>{o({to:"/$org/store",params:{org:n.org}})},t[0]=n.org,t[1]=o,t[2]=r):r=t[2];const i=r;let s;t[3]===Symbol.for("react.memo_cache_sentinel")?(s={height:nt,width:nt},t[3]=s):s=t[3];let a,l;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=v.jsx(Me,{type:"target",position:X.Left,style:{opacity:0,pointerEvents:"none"}}),l=v.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-8 w-8"}),t[4]=a,t[5]=l):(a=t[4],l=t[5]);let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c=v.jsx(Me,{type:"source",position:X.Right,style:{opacity:0,pointerEvents:"none"}}),t[6]=c):c=t[6];let d;return t[7]!==i?(d=v.jsxs("div",{className:"flex items-center justify-center p-2 bg-primary border border-primary-foreground/50 rounded-lg shadow-sm cursor-pointer pointer-events-auto",style:s,onClick:i,children:[a,l,c]}),t[7]=i,t[8]=d):d=t[8],d}const Zh={agent:Fh,server:Xh,mesh:Yh};function Wh(){const e=ue.c(8),{metricsMode:t,setMetricsMode:n}=Di();let o;e[0]!==n?(o=l=>l&&n(l),e[0]=n,e[1]=o):o=e[1];let r,i,s;e[2]===Symbol.for("react.memo_cache_sentinel")?(r=v.jsx(en,{value:"requests",className:"text-xs px-3 cursor-pointer",children:"Tool Calls"}),i=v.jsx(en,{value:"errors",className:"text-xs px-3 cursor-pointer",children:"Errors"}),s=v.jsx(en,{value:"latency",className:"text-xs px-3 cursor-pointer",children:"Latency"}),e[2]=r,e[3]=i,e[4]=s):(r=e[2],i=e[3],s=e[4]);let a;return e[5]!==t||e[6]!==o?(a=v.jsxs(ia,{type:"single",value:t,onValueChange:o,variant:"outline",size:"sm",className:"bg-background/80 backdrop-blur-sm",children:[r,i,s]}),e[5]=t,e[6]=o,e[7]=a):a=e[7],a}function qh(){const e=ue.c(36),{metricsMode:t}=Di(),{org:n}=bn();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={pageSize:Zo},e[0]=o):o=e[0];const r=oa(o);let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i={pageSize:Zo},e[1]=i):i=e[1];const s=ea(i),a=Oh();let l,c,d,u,f;if(e[2]!==t||e[3]!==a||e[4]!==s||e[5]!==r){let M;e[11]!==t||e[12]!==a?(M=(H,x)=>Et(a.virtualMcps.get(x.id),t)-Et(a.virtualMcps.get(H.id),t),e[11]=t,e[12]=a,e[13]=M):M=e[13],u=[...r].sort(M);let z;e[14]!==t||e[15]!==a?(z=(H,x)=>Et(a.connections.get(x.id),t)-Et(a.connections.get(H.id),t),e[14]=t,e[15]=a,e[16]=z):z=e[16],d=[...s].sort(z),l=Rh[t],f=new Map,u.forEach((H,x)=>f.set(H.id,x)),c=new Map,d.forEach((H,x)=>c.set(H.id,x)),e[2]=t,e[3]=a,e[4]=s,e[5]=r,e[6]=l,e[7]=c,e[8]=d,e[9]=u,e[10]=f}else l=e[6],c=e[7],d=e[8],u=e[9],f=e[10];const g=-nt/2,p=nt/2,w=g-100-jn,_=p+100,m=u.length,b=d.length;let h,y;if(e[17]!==l||e[18]!==c||e[19]!==m||e[20]!==t||e[21]!==a||e[22]!==n.slug||e[23]!==s||e[24]!==r||e[25]!==b||e[26]!==f){const M={stroke:l.edgeColor,strokeWidth:1.25,strokeDasharray:"8 6",strokeLinecap:"square"};y=[],h=[],y.push({id:"mesh",type:"mesh",position:{x:g,y:-nt/2},data:{org:n.slug,colorScheme:l},draggable:!1,selectable:!1}),[...r].sort(Kh).forEach(x=>{const P=((f.get(x.id)??0)-(m-1)/2)*70-Lt/2;y.push({id:`agent-${x.id}`,type:"agent",position:{x:w,y:P},data:{virtualMcp:x,metricsMode:t,metric:a.virtualMcps.get(x.id),colorScheme:l,org:n.slug},draggable:!1,selectable:!1}),h.push({id:`e-agent-${x.id}`,source:`agent-${x.id}`,target:"mesh",type:"smoothstep",animated:!0,style:M})}),[...s].sort(Gh).forEach(x=>{const P=((c.get(x.id)??0)-(b-1)/2)*70-Lt/2;y.push({id:`server-${x.id}`,type:"server",position:{x:_,y:P},data:{connection:x,metricsMode:t,metric:a.connections.get(x.id),colorScheme:l,org:n.slug},draggable:!1,selectable:!1}),h.push({id:`e-srv-${x.id}`,source:"mesh",target:`server-${x.id}`,type:"smoothstep",animated:!0,style:M})}),e[17]=l,e[18]=c,e[19]=m,e[20]=t,e[21]=a,e[22]=n.slug,e[23]=s,e[24]=r,e[25]=b,e[26]=f,e[27]=h,e[28]=y}else h=e[27],y=e[28];let S;e[29]===Symbol.for("react.memo_cache_sentinel")?(S={backgroundImage:"radial-gradient(circle, var(--border) 1px, transparent 1.5px)",backgroundSize:"32px 32px"},e[29]=S):S=e[29];const E=S;let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=v.jsx("style",{children:`
8
+ .mesh-minimap .react-flow__node { transition: transform 300ms ease-out; }
9
+ .mesh-minimap .react-flow__edge path { transition: d 300ms ease-out; }
10
+ .mesh-minimap .react-flow__edge.animated path {
11
+ animation: dashdraw 0.8s linear infinite;
12
+ }
13
+ @keyframes dashdraw {
14
+ from {
15
+ stroke-dashoffset: 0;
16
+ }
17
+ to {
18
+ stroke-dashoffset: -14;
19
+ }
20
+ }
21
+ `}),e[30]=C):C=e[30];let T;e[31]===Symbol.for("react.memo_cache_sentinel")?(T={padding:.3},e[31]=T):T=e[31];let A;e[32]===Symbol.for("react.memo_cache_sentinel")?(A={hideAttribution:!0},e[32]=A):A=e[32];let j;return e[33]!==h||e[34]!==y?(j=v.jsxs("div",{className:"w-full h-full min-h-[420px] relative mesh-minimap bg-background",style:E,children:[C,v.jsx(dh,{nodes:y,edges:h,nodeTypes:Zh,fitView:!0,fitViewOptions:T,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnDrag:!0,preventScrolling:!0,proOptions:A,className:"bg-transparent"})]}),e[33]=h,e[34]=y,e[35]=j):j=e[35],j}function Gh(e,t){return e.id.localeCompare(t.id)}function Kh(e,t){return e.id.localeCompare(t.id)}function Uh(){const e=ue.c(3);let t,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=v.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(Jh)}),n=v.jsx("div",{className:"h-14 w-28 bg-muted animate-pulse rounded-xl"}),e[0]=t,e[1]=n):(t=e[0],n=e[1]);let o;return e[2]===Symbol.for("react.memo_cache_sentinel")?(o=v.jsx("div",{className:"bg-background p-5 h-full min-h-[420px] flex items-center justify-center",children:v.jsxs("div",{className:"flex items-center gap-16",children:[t,n,v.jsx("div",{className:"flex flex-col gap-3",children:[1,2,3,4,5].map(Qh)})]})}),e[2]=o):o=e[2],o}function Qh(e){return v.jsx("div",{className:"h-14 w-[220px] bg-muted animate-pulse rounded-lg"},e)}function Jh(e){return v.jsx("div",{className:"h-14 w-[220px] bg-muted animate-pulse rounded-lg"},e)}function eg(){const e=new Date().getHours();return e>=5&&e<12?"Morning":e>=12&&e<17?"Afternoon":e>=17&&e<22?"Evening":"Night"}function tg(){const e=ue.c(38),{org:t,locator:n}=bn(),{data:o}=Vs.useSession(),{modelsConnections:r,isChatEmpty:i,activeThreadId:s,setActiveThreadId:a,threads:l}=Bs();let c;if(e[0]!==s||e[1]!==l){let M;e[3]!==s?(M=z=>z.id===s,e[3]=s,e[4]=M):M=e[4],c=l.find(M),e[0]=s,e[1]=l,e[2]=c}else c=e[2];const d=c,[u,f]=Xs(`${n}:home-view-mode`,"chat");let g;e[5]!==o?.user?.name?(g=o?.user?.name?.split(" ")[0]||"there",e[5]=o?.user?.name,e[6]=g):g=e[6];const p=g;let w;e[7]===Symbol.for("react.memo_cache_sentinel")?(w=eg(),e[7]=w):w=e[7];const _=w;if(r.length===0){let M;return e[8]!==t?(M=v.jsx("div",{className:"flex flex-col size-full bg-background items-center justify-center",children:v.jsx(se.NoLlmBindingEmptyState,{org:t})}),e[8]=t,e[9]=M):M=e[9],M}let m;e[10]!==d||e[11]!==i||e[12]!==u?(m=v.jsx(se.Header.Left,{children:u==="graph"?v.jsx("span",{className:"text-sm font-medium text-foreground",children:"Summary"}):!i&&d?.title?v.jsx(Fs,{text:d.title,className:"text-sm font-medium text-foreground"}):v.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),e[10]=d,e[11]=i,e[12]=u,e[13]=m):m=e[13];let b;e[14]!==u?(b=u==="graph"&&v.jsx(Wh,{}),e[14]=u,e[15]=b):b=e[15];let h;e[16]!==a||e[17]!==u?(h=u!=="graph"&&v.jsxs(v.Fragment,{children:[v.jsxs(Ys,{children:[v.jsx(Zs,{asChild:!0,children:v.jsx(Ko,{type:"button",variant:"outline",size:"icon",className:"size-7 border border-input",onClick:()=>a(crypto.randomUUID()),"aria-label":"New chat",children:v.jsx(Ks,{size:16})})}),v.jsx(Ws,{children:"New chat"})]}),v.jsx($.Suspense,{fallback:v.jsx("div",{className:"size-7 rounded-full bg-muted text-muted-foreground hover:bg-muted hover:text-muted-foreground cursor-not-allowed"}),children:v.jsx(se.ThreadHistoryPopover,{variant:"outline"})})]}),e[16]=a,e[17]=u,e[18]=h):h=e[18];let y;e[19]===Symbol.for("react.memo_cache_sentinel")?(y={value:"chat",icon:v.jsx(Wo,{})},e[19]=y):y=e[19];let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=[y,{value:"graph",icon:v.jsx(Gs,{})}],e[20]=S):S=e[20];let E;e[21]!==f||e[22]!==u?(E=v.jsx(qs,{value:u,onValueChange:f,size:"sm",options:S}),e[21]=f,e[22]=u,e[23]=E):E=e[23];let C;e[24]!==b||e[25]!==h||e[26]!==E?(C=v.jsxs(se.Header.Right,{children:[b,h,E]}),e[24]=b,e[25]=h,e[26]=E,e[27]=C):C=e[27];let T;e[28]!==m||e[29]!==C?(T=v.jsxs(se.Header,{children:[m,C]}),e[28]=m,e[29]=C,e[30]=T):T=e[30];let A;e[31]!==i||e[32]!==p||e[33]!==u?(A=u==="graph"?v.jsx("div",{className:"flex-1 overflow-hidden relative",children:v.jsx(qo,{fallback:v.jsx("div",{className:"bg-background p-5 text-sm text-muted-foreground h-full flex items-center justify-center",children:"Failed to load mesh visualization"}),children:v.jsx($.Suspense,{fallback:v.jsx(Uh,{}),children:v.jsx(qh,{})})})}):i?v.jsx("div",{className:"flex-1 min-h-0 flex flex-col items-center justify-center px-10 pb-32 pt-10",children:v.jsxs("div",{className:"flex flex-col items-center gap-6 w-full max-w-[550px]",children:[v.jsxs("div",{className:"text-center",children:[v.jsxs("p",{className:"text-lg font-medium text-foreground",children:[_," ",p,","]}),v.jsx("p",{className:"text-base text-muted-foreground",children:"What are we building today?"})]}),v.jsx(se.Input,{}),v.jsx(se.IceBreakers,{className:"w-full"})]})}):v.jsxs(v.Fragment,{children:[v.jsx(se.Main,{children:v.jsx(se.Messages,{minHeightOffset:280})}),v.jsx(se.Footer,{children:v.jsx(se.Input,{})})]}),e[31]=i,e[32]=p,e[33]=u,e[34]=A):A=e[34];let j;return e[35]!==T||e[36]!==A?(j=v.jsx(Lh,{children:v.jsxs(se,{children:[T,A]})}),e[35]=T,e[36]=A,e[37]=j):j=e[37],j}function ng(e){const t=ue.c(14),{error:n,onRetry:o}=e,r=n?.message?.includes("401")||n?.message?.toLowerCase().includes("unauthorized");let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=v.jsxs(se.Header,{children:[v.jsx(se.Header.Left,{children:v.jsx("span",{className:"text-sm font-medium text-foreground",children:"Chat"})}),v.jsx(se.Header.Right,{})]}),t[0]=i):i=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=v.jsx("div",{className:"bg-destructive/10 p-3 rounded-full mx-auto w-fit",children:v.jsx(Wo,{className:"h-6 w-6 text-destructive"})}),t[1]=s):s=t[1];const a=r?"Unable to load models":"Something went wrong";let l;t[2]!==a?(l=v.jsx("h3",{className:"text-lg font-medium",children:a}),t[2]=a,t[3]=l):l=t[3];const c=r?"There was an authentication error while loading the models. This might be due to an expired session or invalid API key.":n?.message||"An unexpected error occurred";let d;t[4]!==c?(d=v.jsx("p",{className:"text-sm text-muted-foreground",children:c}),t[4]=c,t[5]=d):d=t[5];let u;t[6]!==l||t[7]!==d?(u=v.jsxs("div",{className:"space-y-2",children:[l,d]}),t[6]=l,t[7]=d,t[8]=u):u=t[8];let f;t[9]!==o?(f=v.jsx(Ko,{variant:"outline",onClick:o,children:"Try again"}),t[9]=o,t[10]=f):f=t[10];let g;return t[11]!==u||t[12]!==f?(g=v.jsxs(se,{children:[i,v.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:v.jsxs("div",{className:"max-w-sm space-y-4",children:[s,u,f]})})]}),t[11]=u,t[12]=f,t[13]=g):g=t[13],g}function og(){const e=ue.c(6),{threads:t,hasNextPage:n,isFetchingNextPage:o,fetchNextPage:r}=Os();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=v.jsx(tg,{}),e[0]=i):i=e[0];let s;return e[1]!==r||e[2]!==n||e[3]!==o||e[4]!==t?(s=v.jsx(se.Provider,{initialThreads:t,hasNextPage:n,isFetchingNextPage:o,fetchNextPage:r,children:i}),e[1]=r,e[2]=n,e[3]=o,e[4]=t,e[5]=s):s=e[5],s}function Qg(){const e=ue.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=v.jsx(qo,{fallback:rg,children:v.jsx($.Suspense,{fallback:v.jsx(se.Skeleton,{}),children:v.jsx(og,{})})}),e[0]=t):t=e[0],t}function rg(e){const{error:t,resetError:n}=e;return v.jsx(ng,{error:t,onRetry:n})}export{Qg as default};
@@ -1 +1 @@
1
- import{r as _,c as v,j as r}from"./index-B9g3IU58.js";import{B as z}from"./button-CX9BcGIk.js";import{T as k,a as y,b as E,c as B}from"./tooltip-BQbbKnxv.js";import{u as S,a as w}from"./use-organization-settings-AWdRXyNF.js";import{u as A}from"./virtual-mcp-Mmz1T7Sl.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-BipFUdjC.js";import{B as z}from"./button-CWaK1hUN.js";import{T as k,a as y,b as E,c as B}from"./tooltip-D3Kw0HUb.js";import{u as S,a as w}from"./use-organization-settings-CRV4VKdj.js";import{u as A}from"./virtual-mcp-BBuKM0Zd.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,M as o}from"./index-B9g3IU58.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,M as o}from"./index-BipFUdjC.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,M as v}from"./index-B9g3IU58.js";import{i as _}from"./Check-CSwEsqta.js";import{t as k}from"./ChevronDown-DFQ7Wwuf.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,M as v}from"./index-BipFUdjC.js";import{i as _}from"./Check-n_KiNdp_.js";import{t as k}from"./ChevronDown-BDe2LrLc.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 x,c as u,j as r,S as L,e as O,a1 as A,aE as h,a0 as N,aO as R}from"./index-B9g3IU58.js";import{C as D}from"./collection-header-DdM-1rXZ.js";import{C as I}from"./collection-page-Bhf_fPlN.js";import{u as M,a as F}from"./use-organization-settings-AWdRXyNF.js";import{u as H}from"./virtual-mcp-Mmz1T7Sl.js";import{c as f,B as j}from"./button-CX9BcGIk.js";import{S as T}from"./switch-SVkH95AH.js";import{i as W}from"./ArrowLeft-Cgf-RjME.js";import"./collection-display-button-BqEBXGbV.js";import"./dropdown-menu-BOgD5B6g.js";import"./Grid01-B6p7u4lV.js";import"./ArrowUp-6Vw9g-kK.js";import"./Check-CSwEsqta.js";import"./List-BNtbfVCR.js";import"./tooltip-BQbbKnxv.js";import"./view-mode-toggle-DgsbED3E.js";import"./useMutation-ByLbENlF.js";import"./constants-DZTKSPb5.js";const S=({size:a=24,color:e="currentColor",...s})=>x.createElement("svg",{viewBox:"0 0 24 24",width:a,height:a,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},x.createElement("path",{d:"M7 22 17 2"}));S.displayName="SlashDivider";function q(a){const e=u.c(4);let s;e[0]!==a?({...s}=a,e[0]=a,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 G(a){const e=u.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,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 n;return e[5]!==t||e[6]!==i?(n=r.jsx("ol",{"data-slot":"breadcrumb-list",className:i,...t}),e[5]=t,e[6]=i,e[7]=n):n=e[7],n}function C(a){const e=u.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,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 n;return e[5]!==t||e[6]!==i?(n=r.jsx("li",{"data-slot":"breadcrumb-item",className:i,...t}),e[5]=t,e[6]=i,e[7]=n):n=e[7],n}function J(a){const e=u.c(10);let s,t,i;e[0]!==a?({asChild:s,className:t,...i}=a,e[0]=a,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);const n=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]!==n||e[7]!==i||e[8]!==o?(d=r.jsx(n,{"data-slot":"breadcrumb-link",className:o,...i}),e[6]=n,e[7]=i,e[8]=o,e[9]=d):d=e[9],d}function K(a){const e=u.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,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 n;return e[5]!==t||e[6]!==i?(n=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]=n):n=e[7],n}function Q(a){const e=u.c(12);let s,t,i;e[0]!==a?({children:s,className:t,...i}=a,e[0]=a,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);let n;e[4]!==t?(n=f("[&>svg]:size-3.5 text-muted-foreground -rotate-12 opacity-50 list-none",t),e[4]=t,e[5]=n):n=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]!==n||e[10]!==o?(d=r.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:n,...i,children:o}),e[8]=i,e[9]=n,e[10]=o,e[11]=d):d=e[11],d}function ue(){const{org:a}=H(),e=O(),s=M(a.id),{update:t}=F(a.id),[i,n]=x.useState({}),[o,d]=x.useState(!1),p=s?.enabled_plugins??[],k=l=>{const c=i[l];return c!==void 0?c:p.includes(l)},w=()=>{const l=new Set(p);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=p.includes(l);n(c===m?g=>{const{[l]:v,...$}=g;return $}:g=>({...g,[l]:c}))},P=async()=>{d(!0);try{await t.mutateAsync({enabled_plugins:w()}),n({}),N.success("Plugin settings saved")}catch{N.error("Failed to save plugin settings")}finally{d(!1)}},E=()=>{n({})},z=l=>R.find(c=>c.pluginId===l),B=l=>h.find(m=>m.id===l)?.description??null;return r.jsxs(I,{children:[r.jsx(D,{title:r.jsx(q,{children:r.jsxs(G,{children:[r.jsx(C,{children:r.jsx(J,{asChild:!0,children:r.jsx(A,{to:"/$org/settings",params:{org:a.slug},children:"Settings"})})}),r.jsx(Q,{}),r.jsx(C,{children:r.jsx(K,{children:"Plugins"})})]})}),leftElement:r.jsx(j,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground",onClick:()=>e({to:"/$org/settings",params:{org:a.slug}}),children:r.jsx(W,{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(T,{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 x,c as u,j as r,S as L,e as O,a1 as A,aE as h,a0 as N,aO as R}from"./index-BipFUdjC.js";import{C as D}from"./collection-header-I0z7H0ZC.js";import{C as I}from"./collection-page-EuoaVB95.js";import{u as M,a as F}from"./use-organization-settings-CRV4VKdj.js";import{u as H}from"./virtual-mcp-BBuKM0Zd.js";import{c as f,B as j}from"./button-CWaK1hUN.js";import{S as T}from"./switch-C_F_zeuN.js";import{i as W}from"./ArrowLeft-hhVT4Kgt.js";import"./collection-display-button-DKWP6xRi.js";import"./dropdown-menu-eADXqdeC.js";import"./Grid01-D_y10H_F.js";import"./ArrowUp-07dwm1MA.js";import"./Check-n_KiNdp_.js";import"./List-AGMu6Jg9.js";import"./tooltip-D3Kw0HUb.js";import"./view-mode-toggle-BkNnvYv5.js";import"./useMutation-BJoWTtTW.js";import"./constants-D7TSocv6.js";const S=({size:a=24,color:e="currentColor",...s})=>x.createElement("svg",{viewBox:"0 0 24 24",width:a,height:a,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},x.createElement("path",{d:"M7 22 17 2"}));S.displayName="SlashDivider";function q(a){const e=u.c(4);let s;e[0]!==a?({...s}=a,e[0]=a,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 G(a){const e=u.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,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 n;return e[5]!==t||e[6]!==i?(n=r.jsx("ol",{"data-slot":"breadcrumb-list",className:i,...t}),e[5]=t,e[6]=i,e[7]=n):n=e[7],n}function C(a){const e=u.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,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 n;return e[5]!==t||e[6]!==i?(n=r.jsx("li",{"data-slot":"breadcrumb-item",className:i,...t}),e[5]=t,e[6]=i,e[7]=n):n=e[7],n}function J(a){const e=u.c(10);let s,t,i;e[0]!==a?({asChild:s,className:t,...i}=a,e[0]=a,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);const n=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]!==n||e[7]!==i||e[8]!==o?(d=r.jsx(n,{"data-slot":"breadcrumb-link",className:o,...i}),e[6]=n,e[7]=i,e[8]=o,e[9]=d):d=e[9],d}function K(a){const e=u.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,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 n;return e[5]!==t||e[6]!==i?(n=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]=n):n=e[7],n}function Q(a){const e=u.c(12);let s,t,i;e[0]!==a?({children:s,className:t,...i}=a,e[0]=a,e[1]=s,e[2]=t,e[3]=i):(s=e[1],t=e[2],i=e[3]);let n;e[4]!==t?(n=f("[&>svg]:size-3.5 text-muted-foreground -rotate-12 opacity-50 list-none",t),e[4]=t,e[5]=n):n=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]!==n||e[10]!==o?(d=r.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:n,...i,children:o}),e[8]=i,e[9]=n,e[10]=o,e[11]=d):d=e[11],d}function ue(){const{org:a}=H(),e=O(),s=M(a.id),{update:t}=F(a.id),[i,n]=x.useState({}),[o,d]=x.useState(!1),p=s?.enabled_plugins??[],k=l=>{const c=i[l];return c!==void 0?c:p.includes(l)},w=()=>{const l=new Set(p);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=p.includes(l);n(c===m?g=>{const{[l]:v,...$}=g;return $}:g=>({...g,[l]:c}))},P=async()=>{d(!0);try{await t.mutateAsync({enabled_plugins:w()}),n({}),N.success("Plugin settings saved")}catch{N.error("Failed to save plugin settings")}finally{d(!1)}},E=()=>{n({})},z=l=>R.find(c=>c.pluginId===l),B=l=>h.find(m=>m.id===l)?.description??null;return r.jsxs(I,{children:[r.jsx(D,{title:r.jsx(q,{children:r.jsxs(G,{children:[r.jsx(C,{children:r.jsx(J,{asChild:!0,children:r.jsx(A,{to:"/$org/settings",params:{org:a.slug},children:"Settings"})})}),r.jsx(Q,{}),r.jsx(C,{children:r.jsx(K,{children:"Plugins"})})]})}),leftElement:r.jsx(j,{variant:"ghost",size:"icon",className:"size-8 text-muted-foreground",onClick:()=>e({to:"/$org/settings",params:{org:a.slug}}),children:r.jsx(W,{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(T,{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};