@decocms/mesh 2.3.1 → 2.3.2
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.
- package/dist/client/assets/{AlertCircle-Brh-yKPx.js → AlertCircle-BZ4bvRfi.js} +1 -1
- package/dist/client/assets/{ArrowLeft-DLy5eesJ.js → ArrowLeft-CoE0Hi8I.js} +1 -1
- package/dist/client/assets/{ChevronDown-77-Jg4-y.js → ChevronDown-Bd6n8txO.js} +1 -1
- package/dist/client/assets/{ChevronRight-BVWHjcSp.js → ChevronRight-Bc43l_p6.js} +1 -1
- package/dist/client/assets/{Copy01-DJ7lHmI2.js → Copy01-BTTTCefb.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-C5EmQ1-g.js → DotsHorizontal-Dh410BM1.js} +1 -1
- package/dist/client/assets/{DotsVertical-Dk9DroDL.js → DotsVertical-C-Nfqo18.js} +1 -1
- package/dist/client/assets/{File06-TZA8fSkX.js → File06-td5gmARz.js} +1 -1
- package/dist/client/assets/{FilterLines-C4XoJFRO.js → FilterLines-nczF4lnr.js} +1 -1
- package/dist/client/assets/{FlipBackward-BKeWY-3r.js → FlipBackward-BLl0wh4k.js} +1 -1
- package/dist/client/assets/{GitBranch01-3HJInUHY.js → GitBranch01-38L6KUpt.js} +1 -1
- package/dist/client/assets/{Grid01-DUKXyDJ6.js → Grid01-Dl_1kAd5.js} +1 -1
- package/dist/client/assets/{Inbox01-CPvjoqAt.js → Inbox01-CDma1les.js} +1 -1
- package/dist/client/assets/{InfoCircle-CvLlA4o1.js → InfoCircle-D8z5_ZlN.js} +1 -1
- package/dist/client/assets/{Key01-Cvtr2Mbf.js → Key01-Cn9byqjY.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DtzG1eyn.js → LinkExternal01-BP_6WzCI.js} +1 -1
- package/dist/client/assets/{Loading01-BMArgy4F.js → Loading01-5lHx4rM1.js} +1 -1
- package/dist/client/assets/{Lock01-CRDsJEBe.js → Lock01-S5DjMaRE.js} +1 -1
- package/dist/client/assets/{Play-Bg3J16Jw.js → Play-DIUg73qU.js} +1 -1
- package/dist/client/assets/{Plus-DkX4o3R-.js → Plus-wptRVGuY.js} +1 -1
- package/dist/client/assets/{Terminal-CBGjWxsq.js → Terminal-BC7AwEkQ.js} +1 -1
- package/dist/client/assets/{Trash01-JSowRzva.js → Trash01-DMq1QD3Y.js} +1 -1
- package/dist/client/assets/{X-DMyD3rE1.js → X-C6XvUpZP.js} +1 -1
- package/dist/client/assets/{XClose-DWC-Xik-.js → XClose-Cb-zeLTZ.js} +1 -1
- package/dist/client/assets/{alert-dialog-DF8fWvYz.js → alert-dialog-BJHrUd_j.js} +2 -2
- package/dist/client/assets/{auth-CpQmcPr-.js → auth-BIu7r9Ac.js} +1 -1
- package/dist/client/assets/{auth-catchall-DMvzLenV.js → auth-catchall-DC241-OB.js} +1 -1
- package/dist/client/assets/{avatar-Df_labzV.js → avatar-CLQivMfK.js} +1 -1
- package/dist/client/assets/{badge-zemEhfrQ.js → badge-DQeqBGBY.js} +1 -1
- package/dist/client/assets/{card-BwjoyLt3.js → card-DCkJD1G_.js} +1 -1
- package/dist/client/assets/{checkbox-DtBYfUuo.js → checkbox-BPcJKnx2.js} +1 -1
- package/dist/client/assets/{collection-detail-Cz4b0Nw6.js → collection-detail-BUFgqbfO.js} +1 -1
- package/dist/client/assets/{collection-display-button-BmJ1hZz9.js → collection-display-button-BT-sOTV4.js} +1 -1
- package/dist/client/assets/{collection-header-CncKiuWL.js → collection-header-Bf2EdT32.js} +1 -1
- package/dist/client/assets/{collection-page-CO2SiFKF.js → collection-page-C8XZ4WVW.js} +1 -1
- package/dist/client/assets/{collection-search-D_O-TWdu.js → collection-search-UsqkgDWW.js} +1 -1
- package/dist/client/assets/{collection-tab-BQak-0X7.js → collection-tab-BOGtz91v.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-gq4mhGLN.js → collection-table-wrapper-DXxcxGiG.js} +1 -1
- package/dist/client/assets/{connection-card-DX5JgRU8.js → connection-card-uFFVVLla.js} +1 -1
- package/dist/client/assets/{connection-detail-D7ZrDuV4.js → connection-detail-C1_qwCFU.js} +1 -1
- package/dist/client/assets/{connections-C-XSPCDb.js → connections-DK3N1G3E.js} +1 -1
- package/dist/client/assets/constants-Bx_FLkPa.js +1 -0
- package/dist/client/assets/{create-organization-dialog-L_KUuy0G.js → create-organization-dialog-D5-XNsnx.js} +1 -1
- package/dist/client/assets/{dialog-CBU3q1sw.js → dialog-Ib7U8pHy.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BGjyowGU.js → dropdown-menu-BiS4AW--.js} +1 -1
- package/dist/client/assets/{empty-state-BeeIZLVB.js → empty-state-DClJbSUV.js} +1 -1
- package/dist/client/assets/{env-vars-editor-Bx242OrB.js → env-vars-editor-BoJcH29X.js} +1 -1
- package/dist/client/assets/{error-boundary-dcv22WoH.js → error-boundary-C3biDnWK.js} +1 -1
- package/dist/client/assets/{extract-connection-data-x6RaCJ24.js → extract-connection-data-jQgimjIZ.js} +1 -1
- package/dist/client/assets/{form-CaDm-pz3.js → form-BuxbGg5N.js} +1 -1
- package/dist/client/assets/{gateway-detail-BRdnPFT_.js → gateway-detail-Dc2FefpC.js} +1 -1
- package/dist/client/assets/{gateway-selector-BpD-ZO1v.js → gateway-selector-D3Qx1Iib.js} +1 -1
- package/dist/client/assets/{gateways-CmJ1zexq.js → gateways-DpUjszQm.js} +1 -1
- package/dist/client/assets/{home-eyNL5oZ9.js → home-DNXIjorG.js} +1 -1
- package/dist/client/assets/{index-Dbu0HtDI.js → index-B8j3yBaa.js} +1 -1
- package/dist/client/assets/{index-DW0Kql1C.js → index-Ci11bImk.js} +1 -1
- package/dist/client/assets/{index-B7xPOHZX.js → index-DZBFXaT_.js} +2 -2
- package/dist/client/assets/{input-BZyvU69_.js → input-KWjuSjzn.js} +1 -1
- package/dist/client/assets/{layout-Cwe_E2_M.js → layout-B02TxUA9.js} +1 -1
- package/dist/client/assets/{lazy-highlighter-DxhZXekt.js → lazy-highlighter-BVbwM6hf.js} +1 -1
- package/dist/client/assets/{localstorage-keys-DEWV_TuT.js → localstorage-keys-ziXXhpvN.js} +1 -1
- package/dist/client/assets/{login-BfZYYDpw.js → login-B5NkbJv_.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CJib8A0J.js → mcp-oauth-C-LpRTvB.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-Dxa4qT5d.js → mcp-server-detail-CFf8gW0D.js} +1 -1
- package/dist/client/assets/{members-gdgMOdfq.js → members-ZCeYH7ZZ.js} +1 -1
- package/dist/client/assets/{monaco-editor-DkuOKh8m.js → monaco-editor-BmgaGs_i.js} +1 -1
- package/dist/client/assets/{monitoring-pr1Hd2Ip.js → monitoring-Ct3-0i82.js} +1 -1
- package/dist/client/assets/{oauth-callback-COTxHELh.js → oauth-callback-BvCvOyK1.js} +1 -1
- package/dist/client/assets/{page-CYawXvvb.js → page-C9ZDngiM.js} +1 -1
- package/dist/client/assets/{page-DZJTUl1S.js → page-CLwNDLuV.js} +1 -1
- package/dist/client/assets/{pin-to-sidebar-button-BQGOkhfu.js → pin-to-sidebar-button-CeunWdra.js} +1 -1
- package/dist/client/assets/{popover-BxGi3FBh.js → popover-CYHZWxlr.js} +1 -1
- package/dist/client/assets/{project-context-provider-C8YSSha5.js → project-context-provider-6vMfUBpq.js} +1 -1
- package/dist/client/assets/{resizable-CUGNhT_i.js → resizable-DSb7rXgM.js} +1 -1
- package/dist/client/assets/{resource-tabs-BhEPcHR7.js → resource-tabs-ChCUbmUR.js} +1 -1
- package/dist/client/assets/{select-DCIkNppp.js → select-bHRpmvzh.js} +1 -1
- package/dist/client/assets/{settings-CfOgaN5Q.js → settings-Czh6I7v0.js} +1 -1
- package/dist/client/assets/{shell-layout-CMSqz-pO.js → shell-layout-DYtHZc0q.js} +1 -1
- package/dist/client/assets/{spinner-BkwfCOMt.js → spinner-A1jsF1CN.js} +1 -1
- package/dist/client/assets/{switch-CfKANI_b.js → switch-RYFLASzA.js} +1 -1
- package/dist/client/assets/{textarea-JhFEp9SR.js → textarea-_Mx18lUV.js} +1 -1
- package/dist/client/assets/{thread-history-popover-DNVmqcvV.js → thread-history-popover-CbjIrBTu.js} +3 -3
- package/dist/client/assets/{tools-list-dyixPpPB.js → tools-list-DqY4kR2l.js} +1 -1
- package/dist/client/assets/{use-binding-DkvIP05I.js → use-binding-Dh7eSguQ.js} +1 -1
- package/dist/client/assets/{use-connection-Cey8PkZD.js → use-connection-BVMsW9fR.js} +1 -1
- package/dist/client/assets/{use-connection-resources-C94ak7It.js → use-connection-resources-Cp6HGagD.js} +1 -1
- package/dist/client/assets/{use-gateway-CdFwGiTC.js → use-gateway-DJ2wz6GD.js} +1 -1
- package/dist/client/assets/{use-gateway-system-prompt-C5RKTDBi.js → use-gateway-system-prompt-FrFSJufL.js} +1 -1
- package/dist/client/assets/{use-list-state-D6jGLwKw.js → use-list-state-2Noltein.js} +1 -1
- package/dist/client/assets/{use-mcp-BSe0O4VC.js → use-mcp-DbxIdwzm.js} +1 -1
- package/dist/client/assets/{use-members-D9E8O6fV.js → use-members-CvEmo-Qp.js} +1 -1
- package/dist/client/assets/{use-mobile-CSwTZQpg.js → use-mobile-Cj5IONVM.js} +1 -1
- package/dist/client/assets/{use-organization-settings-Bs8BD0As.js → use-organization-settings-Bz3g4Zpi.js} +1 -1
- package/dist/client/assets/{use-tool-call-CoovfkTE.js → use-tool-call-VY44CqK6.js} +1 -1
- package/dist/client/assets/{useQueries-CrGhd7Ps.js → useQueries-BiKtsYpJ.js} +1 -1
- package/dist/client/assets/useQuery-DW8RlKsd.js +1 -0
- package/dist/client/assets/{value-DdZ96u_D.js → value-BXXW8rnd.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-B_DhDoOC.js → view-mode-toggle-CYuFxr7p.js} +1 -1
- package/dist/client/assets/{workflow-DxrjOb_8.js → workflow-RTyKsxRT.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +2 -2
- package/dist/server/migrate.js +2 -2
- package/package.json +1 -1
- package/dist/client/assets/constants-Cz6qtjPW.js +0 -1
- package/dist/client/assets/useQuery-BhPOCnwC.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as z,y as Ys,z as Zs,j as _,c as ge,h as Rt,i as Ws,a as Gs,t as qn}from"./index-B7xPOHZX.js";import{f as qs,D as Ks,u as Kn,a as Us,b as Qs,d as Js,c as ea,e as ta,N as na,C as pe,M as Un,U as oa,G as ra,g as ia,T as sa}from"./thread-history-popover-DNVmqcvV.js";import{E as Qn}from"./error-boundary-dcv22WoH.js";import{u as Jo,c as aa,I as er,n as ca}from"./use-connection-Cey8PkZD.js";import{u as tr,i as la}from"./use-gateway-CdFwGiTC.js";import{u as ua}from"./use-binding-DkvIP05I.js";import{u as nr,L as da}from"./localstorage-keys-DEWV_TuT.js";import{u as bn}from"./project-context-provider-C8YSSha5.js";import{c as or,B as fa}from"./input-BZyvU69_.js";import{V as ha}from"./view-mode-toggle-B_DhDoOC.js";import{i as ga}from"./GitBranch01-3HJInUHY.js";import{i as pa}from"./Loading01-BMArgy4F.js";import{s as ma}from"./Plus-DkX4o3R-.js";import{u as ya}from"./use-tool-call-CoovfkTE.js";import{i as Te,a as Jn,b as xa,c as eo,d as en,T as tn,e as wa}from"./value-DdZ96u_D.js";import{G as to}from"./gateway-selector-BpD-ZO1v.js";import"./use-gateway-system-prompt-C5RKTDBi.js";import"./popover-BxGi3FBh.js";import"./AlertCircle-Brh-yKPx.js";import"./X-DMyD3rE1.js";import"./Grid01-DUKXyDJ6.js";import"./textarea-JhFEp9SR.js";import"./ChevronRight-BVWHjcSp.js";import"./Copy01-DJ7lHmI2.js";import"./Terminal-CBGjWxsq.js";import"./monaco-editor-DkuOKh8m.js";import"./spinner-BkwfCOMt.js";import"./alert-dialog-DF8fWvYz.js";import"./File06-TZA8fSkX.js";import"./InfoCircle-CvLlA4o1.js";import"./well-known-mcp-D13f-8h2.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-JSowRzva.js";import"./auth-CpQmcPr-.js";import"./useQuery-BhPOCnwC.js";import"./select-DCIkNppp.js";import"./ChevronDown-77-Jg4-y.js";import"./use-mobile-CSwTZQpg.js";const rr=({size:e=24,color:t="currentColor",...n})=>z.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},z.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));rr.displayName="MessageChatSquare";function ae(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=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var va={value:()=>{}};function jt(){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 Et(n)}function Et(e){this._=e}function _a(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}})}Et.prototype=jt.prototype={constructor:Et,on:function(e,t){var n=this._,o=_a(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=ba(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=no(n[r],e.name,t);else if(t==null)for(r in n)n[r]=no(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 Et(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function ba(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function no(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=va,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var un="http://www.w3.org/1999/xhtml";const oo={svg:"http://www.w3.org/2000/svg",xhtml:un,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),oo.hasOwnProperty(t)?{space:oo[t],local:e}:e}function Sa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===un&&t.documentElement.namespaceURI===un?t.createElement(e):t.createElementNS(n,e)}}function Ea(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ir(e){var t=Vt(e);return(t.local?Ea:Sa)(t)}function Ca(){}function Sn(e){return e==null?Ca:function(){return this.querySelector(e)}}function Na(e){typeof e!="function"&&(e=Sn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new fe(o,this._parents)}function Ma(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ia(){return[]}function sr(e){return e==null?Ia:function(){return this.querySelectorAll(e)}}function ka(e){return function(){return Ma(e.apply(this,arguments))}}function Aa(e){typeof e=="function"?e=ka(e):e=sr(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new fe(o,r)}function ar(e){return function(){return this.matches(e)}}function cr(e){return function(t){return t.matches(e)}}var Pa=Array.prototype.find;function Ta(e){return function(){return Pa.call(this.children,e)}}function Da(){return this.firstElementChild}function $a(e){return this.select(e==null?Da:Ta(typeof e=="function"?e:cr(e)))}var za=Array.prototype.filter;function La(){return Array.from(this.children)}function Ha(e){return function(){return za.call(this.children,e)}}function Ra(e){return this.selectAll(e==null?La:Ha(typeof e=="function"?e:cr(e)))}function ja(e){typeof e!="function"&&(e=ar(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new fe(o,this._parents)}function lr(e){return new Array(e.length)}function Va(){return new fe(this._enter||this._groups.map(lr),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 Oa(e){return function(){return e}}function Ba(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new kt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function Fa(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,f=s.length,d=new Array(u),p;for(a=0;a<u;++a)(l=t[a])&&(d[a]=p=i.call(l,l.__data__,a,t)+"",c.has(p)?r[a]=l:c.set(p,l));for(a=0;a<f;++a)p=i.call(e,s[a],a,s)+"",(l=c.get(p))?(o[a]=l,l.__data__=s[a],c.delete(p)):n[a]=new kt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(d[a])===l&&(r[a]=l)}function Xa(e){return e.__data__}function Ya(e,t){if(!arguments.length)return Array.from(this,Xa);var n=t?Fa:Ba,o=this._parents,r=this._groups;typeof e!="function"&&(e=Oa(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],f=r[c],d=f.length,p=Za(e.call(u,u&&u.__data__,c,o)),h=p.length,w=a[c]=new Array(h),v=i[c]=new Array(h),m=l[c]=new Array(d);n(u,f,w,v,m,p,t);for(var b=0,g=0,x,N;b<h;++b)if(x=w[b]){for(b>=g&&(g=b+1);!(N=v[g])&&++g<h;);x._next=N||null}}return i=new fe(i,o),i._enter=a,i._exit=l,i}function Za(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Wa(){return new fe(this._exit||this._groups.map(lr),this._parents)}function Ga(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function qa(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],f=c.length,d=a[l]=new Array(f),p,h=0;h<f;++h)(p=c[h]||u[h])&&(d[h]=p);for(;l<r;++l)a[l]=n[l];return new fe(a,this._parents)}function Ka(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Ua(e){e||(e=Qa);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new fe(r,this._parents).order()}function Qa(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 ec(){return Array.from(this)}function tc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function nc(){let e=0;for(const t of this)++e;return e}function oc(){return!this.node()}function rc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function ic(e){return function(){this.removeAttribute(e)}}function sc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ac(e,t){return function(){this.setAttribute(e,t)}}function cc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function lc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function uc(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 dc(e,t){var n=Vt(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?sc:ic:typeof t=="function"?n.local?uc:lc:n.local?cc:ac)(n,t))}function ur(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fc(e){return function(){this.style.removeProperty(e)}}function hc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function gc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function pc(e,t,n){return arguments.length>1?this.each((t==null?fc:typeof t=="function"?gc:hc)(e,t,n??"")):Fe(this.node(),e)}function Fe(e,t){return e.style.getPropertyValue(t)||ur(e).getComputedStyle(e,null).getPropertyValue(t)}function mc(e){return function(){delete this[e]}}function yc(e,t){return function(){this[e]=t}}function xc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function wc(e,t){return arguments.length>1?this.each((t==null?mc:typeof t=="function"?xc:yc)(e,t)):this.node()[e]}function dr(e){return e.trim().split(/^|\s+/)}function En(e){return e.classList||new fr(e)}function fr(e){this._node=e,this._names=dr(e.getAttribute("class")||"")}fr.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 hr(e,t){for(var n=En(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function gr(e,t){for(var n=En(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function vc(e){return function(){hr(this,e)}}function _c(e){return function(){gr(this,e)}}function bc(e,t){return function(){(t.apply(this,arguments)?hr:gr)(this,e)}}function Sc(e,t){var n=dr(e+"");if(arguments.length<2){for(var o=En(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?bc:t?vc:_c)(n,t))}function Ec(){this.textContent=""}function Cc(e){return function(){this.textContent=e}}function Nc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Mc(e){return arguments.length?this.each(e==null?Ec:(typeof e=="function"?Nc:Cc)(e)):this.node().textContent}function Ic(){this.innerHTML=""}function kc(e){return function(){this.innerHTML=e}}function Ac(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Pc(e){return arguments.length?this.each(e==null?Ic:(typeof e=="function"?Ac:kc)(e)):this.node().innerHTML}function Tc(){this.nextSibling&&this.parentNode.appendChild(this)}function Dc(){return this.each(Tc)}function $c(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zc(){return this.each($c)}function Lc(e){var t=typeof e=="function"?e:ir(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Hc(){return null}function Rc(e,t){var n=typeof e=="function"?e:ir(e),o=t==null?Hc:typeof t=="function"?t:Sn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function jc(){var e=this.parentNode;e&&e.removeChild(this)}function Vc(){return this.each(jc)}function Oc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Fc(e){return this.select(e?Bc:Oc)}function Xc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Yc(e){return function(t){e.call(this,t,this.__data__)}}function Zc(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 Wc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function Gc(e,t,n){return function(){var o=this.__on,r,s=Yc(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function qc(e,t,n){var o=Zc(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?Gc:Wc,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function pr(e,t,n){var o=ur(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 Kc(e,t){return function(){return pr(this,e,t)}}function Uc(e,t){return function(){return pr(this,e,t.apply(this,arguments))}}function Qc(e,t){return this.each((typeof t=="function"?Uc:Kc)(e,t))}function*Jc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var mr=[null];function fe(e,t){this._groups=e,this._parents=t}function ut(){return new fe([[document.documentElement]],mr)}function el(){return this}fe.prototype=ut.prototype={constructor:fe,select:Na,selectAll:Aa,selectChild:$a,selectChildren:Ra,filter:ja,data:Ya,enter:Va,exit:Wa,join:Ga,merge:qa,selection:el,order:Ka,sort:Ua,call:Ja,nodes:ec,node:tc,size:nc,empty:oc,each:rc,attr:dc,style:pc,property:wc,classed:Sc,text:Mc,html:Pc,raise:Dc,lower:zc,append:Lc,insert:Rc,remove:Vc,clone:Fc,datum:Xc,on:qc,dispatch:Qc,[Symbol.iterator]:Jc};function de(e){return typeof e=="string"?new fe([[document.querySelector(e)]],[document.documentElement]):new fe([[e]],mr)}function tl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function me(e,t){if(e=tl(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 nl={passive:!1},ot={capture:!0,passive:!1};function nn(e){e.stopImmediatePropagation()}function Be(e){e.preventDefault(),e.stopImmediatePropagation()}function yr(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",Be,ot);"onselectstart"in t?n.on("selectstart.drag",Be,ot):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xr(e,t){var n=e.document.documentElement,o=de(e).on("dragstart.drag",null);t&&(o.on("click.drag",Be,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 dn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ol(e){return!e.ctrlKey&&!e.button}function rl(){return this.parentNode}function il(e,t){return t??{x:e.x,y:e.y}}function sl(){return navigator.maxTouchPoints||"ontouchstart"in this}function wr(){var e=ol,t=rl,n=il,o=sl,r={},s=jt("start","drag","end"),i=0,a,l,c,u,f=0;function d(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",v).on("touchmove.drag",m,nl).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,N){if(!(u||!e.call(this,x,N))){var S=g(this,t.call(this,x,N),x,N,"mouse");S&&(de(x.view).on("mousemove.drag",h,ot).on("mouseup.drag",w,ot),yr(x.view),nn(x),c=!1,a=x.clientX,l=x.clientY,S("start",x))}}function h(x){if(Be(x),!c){var N=x.clientX-a,S=x.clientY-l;c=N*N+S*S>f}r.mouse("drag",x)}function w(x){de(x.view).on("mousemove.drag mouseup.drag",null),xr(x.view,c),Be(x),r.mouse("end",x)}function v(x,N){if(e.call(this,x,N)){var S=x.changedTouches,E=t.call(this,x,N),D=S.length,k,V;for(k=0;k<D;++k)(V=g(this,E,x,N,S[k].identifier,S[k]))&&(nn(x),V("start",x,S[k]))}}function m(x){var N=x.changedTouches,S=N.length,E,D;for(E=0;E<S;++E)(D=r[N[E].identifier])&&(Be(x),D("drag",x,N[E]))}function b(x){var N=x.changedTouches,S=N.length,E,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),E=0;E<S;++E)(D=r[N[E].identifier])&&(nn(x),D("end",x,N[E]))}function g(x,N,S,E,D,k){var V=s.copy(),A=me(k||S,N),$,L,y;if((y=n.call(x,new dn("beforestart",{sourceEvent:S,target:d,identifier:D,active:i,x:A[0],y:A[1],dx:0,dy:0,dispatch:V}),E))!=null)return $=y.x-A[0]||0,L=y.y-A[1]||0,function M(C,P,T){var I=A,H;switch(C){case"start":r[D]=M,H=i++;break;case"end":delete r[D],--i;case"drag":A=me(T||P,N),H=i;break}V.call(C,x,new dn(C,{sourceEvent:P,subject:y,target:d,identifier:D,active:H,x:A[0]+$,y:A[1]+L,dx:A[0]-I[0],dy:A[1]-I[1],dispatch:V}),E)}}return d.filter=function(x){return arguments.length?(e=typeof x=="function"?x:mt(!!x),d):e},d.container=function(x){return arguments.length?(t=typeof x=="function"?x:mt(x),d):t},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:mt(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:mt(!!x),d):o},d.on=function(){var x=s.on.apply(s,arguments);return x===s?d:x},d.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,d):Math.sqrt(f)},d}var ro=180/Math.PI,fn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vr(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(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,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*ro,skewX:Math.atan(l)*ro,scaleX:i,scaleY:a}}var yt;function al(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?fn:vr(t.a,t.b,t.c,t.d,t.e,t.f)}function cl(e){return e==null||(yt||(yt=document.createElementNS("http://www.w3.org/2000/svg","g")),yt.setAttribute("transform",e),!(e=yt.transform.baseVal.consolidate()))?fn:(e=e.matrix,vr(e.a,e.b,e.c,e.d,e.e,e.f))}function _r(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,f,d,p,h){if(c!==f||u!==d){var w=p.push("translate(",null,t,null,n);h.push({i:w-4,x:Te(c,f)},{i:w-2,x:Te(u,d)})}else(f||d)&&p.push("translate("+f+t+d+n)}function i(c,u,f,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:Te(c,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(c,u,f,d){c!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:Te(c,u)}):u&&f.push(r(f)+"skewX("+u+o)}function l(c,u,f,d,p,h){if(c!==f||u!==d){var w=p.push(r(p)+"scale(",null,",",null,")");h.push({i:w-4,x:Te(c,f)},{i:w-2,x:Te(u,d)})}else(f!==1||d!==1)&&p.push(r(p)+"scale("+f+","+d+")")}return function(c,u){var f=[],d=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,f,d),i(c.rotate,u.rotate,f,d),a(c.skewX,u.skewX,f,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,d),c=u=null,function(p){for(var h=-1,w=d.length,v;++h<w;)f[(v=d[h]).i]=v.x(p);return f.join("")}}}var ll=_r(al,"px, ","px)","deg)"),ul=_r(cl,", ",")",")"),dl=1e-12;function io(e){return((e=Math.exp(e))+1/e)/2}function fl(e){return((e=Math.exp(e))-1/e)/2}function hl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ct=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],f=i[1],d=i[2],p=u-a,h=f-l,w=p*p+h*h,v,m;if(w<dl)m=Math.log(d/c)/t,v=function(E){return[a+E*p,l+E*h,c*Math.exp(t*E*m)]};else{var b=Math.sqrt(w),g=(d*d-c*c+o*w)/(2*c*n*b),x=(d*d-c*c-o*w)/(2*d*n*b),N=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(x*x+1)-x);m=(S-N)/t,v=function(E){var D=E*m,k=io(N),V=c/(n*b)*(k*hl(t*D+N)-fl(N));return[a+V*p,l+V*h,c*k/io(t*D+N)]}}return v.duration=m*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Xe=0,Je=0,Ue=0,br=1e3,At,et,Pt=0,ze=0,Ot=0,rt=typeof performance=="object"&&performance.now?performance:Date,Sr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Cn(){return ze||(Sr(gl),ze=rt.now()+Ot)}function gl(){ze=0}function Tt(){this._call=this._time=this._next=null}Tt.prototype=Er.prototype={constructor:Tt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Cn():+n)+(t==null?0:+t),!this._next&&et!==this&&(et?et._next=this:At=this,et=this),this._call=e,this._time=n,hn()},stop:function(){this._call&&(this._call=null,this._time=1/0,hn())}};function Er(e,t,n){var o=new Tt;return o.restart(e,t,n),o}function pl(){Cn(),++Xe;for(var e=At,t;e;)(t=ze-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Xe}function so(){ze=(Pt=rt.now())+Ot,Xe=Je=0;try{pl()}finally{Xe=0,yl(),ze=0}}function ml(){var e=rt.now(),t=e-Pt;t>br&&(Ot-=t,Pt=e)}function yl(){for(var e,t=At,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:At=n);et=e,hn(o)}function hn(e){if(!Xe){Je&&(Je=clearTimeout(Je));var t=e-ze;t>24?(e<1/0&&(Je=setTimeout(so,e-rt.now()-Ot)),Ue&&(Ue=clearInterval(Ue))):(Ue||(Pt=rt.now(),Ue=setInterval(ml,br)),Xe=1,Sr(so))}}function ao(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 xl=jt("start","end","cancel","interrupt"),wl=[],Cr=0,co=1,gn=2,Nt=3,lo=4,pn=5,Mt=6;function Bt(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;vl(e,n,{name:t,index:o,group:r,on:xl,tween:wl,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Cr})}function Nn(e,t){var n=we(e,t);if(n.state>Cr)throw new Error("too late; already scheduled");return n}function be(e,t){var n=we(e,t);if(n.state>Nt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function vl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Er(s,0,n.time);function s(c){n.state=co,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,f,d,p;if(n.state!==co)return l();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Nt)return ao(i);p.state===lo?(p.state=Mt,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=Mt,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if(ao(function(){n.state===Nt&&(n.state=lo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=gn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===gn){for(n.state=Nt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=p);r.length=f+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=pn,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===pn&&(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,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>gn&&o.state<pn,o.state=Mt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function _l(e){return this.each(function(){It(this,e)})}function bl(e,t){var n,o;return function(){var r=be(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function Sl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=be(this,e),i=s.tween;if(i!==o){r=(o=i).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)}s.tween=r}}function El(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?bl:Sl)(n,e,t))}function Mn(e,t,n){var o=e._id;return e.each(function(){var r=be(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return we(r,o).value[t]}}function Nr(e,t){var n;return(typeof t=="number"?Te:t instanceof eo?Jn:(n=eo(t))?(t=n,Jn):xa)(e,t)}function Cl(e){return function(){this.removeAttribute(e)}}function Nl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ml(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function Il(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function kl(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function Al(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function Pl(e,t){var n=Vt(e),o=n==="transform"?ul:Nr;return this.attrTween(e,typeof t=="function"?(n.local?Al:kl)(n,o,Mn(this,"attr."+e,t)):t==null?(n.local?Nl:Cl)(n):(n.local?Il:Ml)(n,o,t))}function Tl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Dl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function $l(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Dl(e,s)),n}return r._value=t,r}function zl(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Tl(e,s)),n}return r._value=t,r}function Ll(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=Vt(e);return this.tween(n,(o.local?$l:zl)(o,t))}function Hl(e,t){return function(){Nn(this,e).delay=+t.apply(this,arguments)}}function Rl(e,t){return t=+t,function(){Nn(this,e).delay=t}}function jl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Hl:Rl)(t,e)):we(this.node(),t).delay}function Vl(e,t){return function(){be(this,e).duration=+t.apply(this,arguments)}}function Ol(e,t){return t=+t,function(){be(this,e).duration=t}}function Bl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Vl:Ol)(t,e)):we(this.node(),t).duration}function Fl(e,t){if(typeof t!="function")throw new Error;return function(){be(this,e).ease=t}}function Xl(e){var t=this._id;return arguments.length?this.each(Fl(t,e)):we(this.node(),t).ease}function Yl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;be(this,e).ease=n}}function Zl(e){if(typeof e!="function")throw new Error;return this.each(Yl(this._id,e))}function Wl(e){typeof e!="function"&&(e=ar(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new Ce(o,this._parents,this._name,this._id)}function Gl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,f=i[a]=new Array(u),d,p=0;p<u;++p)(d=l[p]||c[p])&&(f[p]=d);for(;a<o;++a)i[a]=t[a];return new Ce(i,this._parents,this._name,this._id)}function ql(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 Kl(e,t,n){var o,r,s=ql(t)?Nn:be;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Ul(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Kl(n,e,t))}function Ql(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",Ql(this._id))}function eu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Sn(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,f,d=0;d<l;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),c[d]=f,Bt(c[d],t,n,d,c,we(u,n)));return new Ce(s,this._parents,t,n)}function tu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=sr(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,f=0;f<c;++f)if(u=l[f]){for(var d=e.call(u,u.__data__,f,l),p,h=we(u,n),w=0,v=d.length;w<v;++w)(p=d[w])&&Bt(p,t,n,w,d,h);s.push(d),i.push(u)}return new Ce(s,i,t,n)}var nu=ut.prototype.constructor;function ou(){return new nu(this._groups,this._parents)}function ru(e,t){var n,o,r;return function(){var s=Fe(this,e),i=(this.style.removeProperty(e),Fe(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Mr(e){return function(){this.style.removeProperty(e)}}function iu(e,t,n){var o,r=n+"",s;return function(){var i=Fe(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function su(e,t,n){var o,r,s;return function(){var i=Fe(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Fe(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function au(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=be(this,e),c=l.on,u=l.value[s]==null?a||(a=Mr(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function cu(e,t,n){var o=(e+="")=="transform"?ll:Nr;return t==null?this.styleTween(e,ru(e,o)).on("end.style."+e,Mr(e)):typeof t=="function"?this.styleTween(e,su(e,o,Mn(this,"style."+e,t))).each(au(this._id,e)):this.styleTween(e,iu(e,o,t),n).on("end.style."+e,null)}function lu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function uu(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&lu(e,i,n)),o}return s._value=t,s}function du(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,uu(e,t,n??""))}function fu(e){return function(){this.textContent=e}}function hu(e){return function(){var t=e(this);this.textContent=t??""}}function gu(e){return this.tween("text",typeof e=="function"?hu(Mn(this,"text",e)):fu(e==null?"":e+""))}function pu(e){return function(t){this.textContent=e.call(this,t)}}function mu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&pu(r)),t}return o._value=e,o}function yu(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,mu(e))}function xu(){for(var e=this._name,t=this._id,n=Ir(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=we(l,t);Bt(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ce(o,this._parents,e,n)}function wu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=be(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var vu=0;function Ce(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ir(){return++vu}var Se=ut.prototype;Ce.prototype={constructor:Ce,select:eu,selectAll:tu,selectChild:Se.selectChild,selectChildren:Se.selectChildren,filter:Wl,merge:Gl,selection:ou,transition:xu,call:Se.call,nodes:Se.nodes,node:Se.node,size:Se.size,empty:Se.empty,each:Se.each,on:Ul,attr:Pl,attrTween:Ll,style:cu,styleTween:du,text:gu,textTween:yu,remove:Jl,tween:El,delay:jl,duration:Bl,ease:Xl,easeVarying:Zl,end:wu,[Symbol.iterator]:Se[Symbol.iterator]};function _u(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var bu={time:null,delay:0,duration:250,ease:_u};function Su(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 Eu(e){var t,n;e instanceof Ce?(t=e._id,e=e._name):(t=Ir(),(n=bu).time=Cn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&Bt(l,e,t,c,i,n||Su(l,t));return new Ce(o,this._parents,e,t)}ut.prototype.interrupt=_l;ut.prototype.transition=Eu;const xt=e=>()=>e;function Cu(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 Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(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 Ft=new Ee(1,0,0);kr.prototype=Ee.prototype;function kr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ft;return e.__zoom}function on(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Nu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Mu(){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 uo(){return this.__zoom||Ft}function Iu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ku(){return navigator.maxTouchPoints||"ontouchstart"in this}function Au(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Ar(){var e=Nu,t=Mu,n=Au,o=Iu,r=ku,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ct,c=jt("start","zoom","end"),u,f,d,p=500,h=150,w=0,v=10;function m(y){y.property("__zoom",uo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",A).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,M,C,P){var T=y.selection?y.selection():y;T.property("__zoom",uo),y!==T?N(y,M,C,P):T.interrupt().each(function(){S(this,arguments).event(P).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},m.scaleBy=function(y,M,C,P){m.scaleTo(y,function(){var T=this.__zoom.k,I=typeof M=="function"?M.apply(this,arguments):M;return T*I},C,P)},m.scaleTo=function(y,M,C,P){m.transform(y,function(){var T=t.apply(this,arguments),I=this.__zoom,H=C==null?x(T):typeof C=="function"?C.apply(this,arguments):C,j=I.invert(H),R=typeof M=="function"?M.apply(this,arguments):M;return n(g(b(I,R),H,j),T,i)},C,P)},m.translateBy=function(y,M,C,P){m.transform(y,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),i)},null,P)},m.translateTo=function(y,M,C,P,T){m.transform(y,function(){var I=t.apply(this,arguments),H=this.__zoom,j=P==null?x(I):typeof P=="function"?P.apply(this,arguments):P;return n(Ft.translate(j[0],j[1]).scale(H.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof C=="function"?-C.apply(this,arguments):-C),I,i)},P,T)};function b(y,M){return M=Math.max(s[0],Math.min(s[1],M)),M===y.k?y:new Ee(M,y.x,y.y)}function g(y,M,C){var P=M[0]-C[0]*y.k,T=M[1]-C[1]*y.k;return P===y.x&&T===y.y?y:new Ee(y.k,P,T)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,M,C,P){y.on("start.zoom",function(){S(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(P).end()}).tween("zoom",function(){var T=this,I=arguments,H=S(T,I).event(P),j=t.apply(T,I),R=C==null?x(j):typeof C=="function"?C.apply(T,I):C,F=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),B=T.__zoom,G=typeof M=="function"?M.apply(T,I):M,K=l(B.invert(R).concat(F/B.k),G.invert(R).concat(F/G.k));return function(W){if(W===1)W=G;else{var O=K(W),X=F/O[2];W=new Ee(X,R[0]-O[0]*X,R[1]-O[1]*X)}H.zoom(null,W)}})}function S(y,M,C){return!C&&y.__zooming||new E(y,M)}function E(y,M){this.that=y,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,M),this.taps=0}E.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,M){return this.mouse&&y!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var M=de(this.that).datum();c.call(y,this.that,new Cu(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),M)}};function D(y,...M){if(!e.apply(this,arguments))return;var C=S(this,M).event(y),P=this.__zoom,T=Math.max(s[0],Math.min(s[1],P.k*Math.pow(2,o.apply(this,arguments)))),I=me(y);if(C.wheel)(C.mouse[0][0]!==I[0]||C.mouse[0][1]!==I[1])&&(C.mouse[1]=P.invert(C.mouse[0]=I)),clearTimeout(C.wheel);else{if(P.k===T)return;C.mouse=[I,P.invert(I)],It(this),C.start()}Qe(y),C.wheel=setTimeout(H,h),C.zoom("mouse",n(g(b(P,T),C.mouse[0],C.mouse[1]),C.extent,i));function H(){C.wheel=null,C.end()}}function k(y,...M){if(d||!e.apply(this,arguments))return;var C=y.currentTarget,P=S(this,M,!0).event(y),T=de(y.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),I=me(y,C),H=y.clientX,j=y.clientY;yr(y.view),on(y),P.mouse=[I,this.__zoom.invert(I)],It(this),P.start();function R(B){if(Qe(B),!P.moved){var G=B.clientX-H,K=B.clientY-j;P.moved=G*G+K*K>w}P.event(B).zoom("mouse",n(g(P.that.__zoom,P.mouse[0]=me(B,C),P.mouse[1]),P.extent,i))}function F(B){T.on("mousemove.zoom mouseup.zoom",null),xr(B.view,P.moved),Qe(B),P.event(B).end()}}function V(y,...M){if(e.apply(this,arguments)){var C=this.__zoom,P=me(y.changedTouches?y.changedTouches[0]:y,this),T=C.invert(P),I=C.k*(y.shiftKey?.5:2),H=n(g(b(C,I),P,T),t.apply(this,M),i);Qe(y),a>0?de(this).transition().duration(a).call(N,H,P,y):de(this).call(m.transform,H,P,y)}}function A(y,...M){if(e.apply(this,arguments)){var C=y.touches,P=C.length,T=S(this,M,y.changedTouches.length===P).event(y),I,H,j,R;for(on(y),H=0;H<P;++H)j=C[H],R=me(j,this),R=[R,this.__zoom.invert(R),j.identifier],T.touch0?!T.touch1&&T.touch0[2]!==R[2]&&(T.touch1=R,T.taps=0):(T.touch0=R,I=!0,T.taps=1+!!u);u&&(u=clearTimeout(u)),I&&(T.taps<2&&(f=R[0],u=setTimeout(function(){u=null},p)),It(this),T.start())}}function $(y,...M){if(this.__zooming){var C=S(this,M).event(y),P=y.changedTouches,T=P.length,I,H,j,R;for(Qe(y),I=0;I<T;++I)H=P[I],j=me(H,this),C.touch0&&C.touch0[2]===H.identifier?C.touch0[0]=j:C.touch1&&C.touch1[2]===H.identifier&&(C.touch1[0]=j);if(H=C.that.__zoom,C.touch1){var F=C.touch0[0],B=C.touch0[1],G=C.touch1[0],K=C.touch1[1],W=(W=G[0]-F[0])*W+(W=G[1]-F[1])*W,O=(O=K[0]-B[0])*O+(O=K[1]-B[1])*O;H=b(H,Math.sqrt(W/O)),j=[(F[0]+G[0])/2,(F[1]+G[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(C.touch0)j=C.touch0[0],R=C.touch0[1];else return;C.zoom("touch",n(g(H,j,R),C.extent,i))}}function L(y,...M){if(this.__zooming){var C=S(this,M).event(y),P=y.changedTouches,T=P.length,I,H;for(on(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),I=0;I<T;++I)H=P[I],C.touch0&&C.touch0[2]===H.identifier?delete C.touch0:C.touch1&&C.touch1[2]===H.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(H=me(H,this),Math.hypot(f[0]-H[0],f[1]-H[1])<v)){var j=de(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:xt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:xt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:xt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:xt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(s[0]=+y[0],s[1]=+y[1],m):[s[0],s[1]]},m.translateExtent=function(y){return arguments.length?(i[0][0]=+y[0][0],i[1][0]=+y[1][0],i[0][1]=+y[0][1],i[1][1]=+y[1][1],m):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(l=y,m):l},m.on=function(){var y=c.on.apply(c,arguments);return y===c?m:y},m.clickDistance=function(y){return arguments.length?(w=(y=+y)*y,m):Math.sqrt(w)},m.tapDistance=function(y){return arguments.length?(v=+y,m):v},m}const _e={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]],Pr=["Enter"," ","Escape"],Tr={"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 Ye;(function(e){e.Strict="strict",e.Loose="loose"})(Ye||(Ye={}));var $e;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})($e||($e={}));var st;(function(e){e.Partial="partial",e.Full="full"})(st||(st={}));const Dr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ke;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ke||(ke={}));var Dt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Dt||(Dt={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const fo={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function $r(e){return e===null?null:e?"valid":"invalid"}const zr=e=>"id"in e&&"source"in e&&"target"in e,Pu=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}=Ne(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},Tu=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):In(r)?r:t.nodeLookup.get(r.id));const a=i?$t(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Xt(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Yt(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=Xt(n,$t(r)),o=!0)}),o?Yt(n):{x:0,y:0,width:0,height:0}},kn=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...gt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:f=!0,hidden:d=!1}=c;if(i&&!f||d)continue;const p=u.width??c.width??c.initialWidth??null,h=u.height??c.height??c.initialHeight??null,w=at(a,We(c)),v=(p??0)*(h??0),m=s&&w>0;(!c.internals.handleBounds||m||w>=v||c.dragging)&&l.push(c)}return l},Du=(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 $u(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 zu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=$u(e,i),l=ft(a),c=An(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Lr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let f=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",_e.error005());else{const p=a.measured.width,h=a.measured.height;p&&h&&(f=[[l,c],[l+p,c+h]])}else a&&Ge(i.extent)&&(f=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const d=Ge(f)?Le(t,f,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",_e.error015()),{position:{x:d.x-l+(i.measured.width??0)*u[0],y:d.y-c+(i.measured.height??0)*u[1]},positionAbsolute:d}}async function Lu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(d=>d.id)),i=[];for(const d of n){if(d.deletable===!1)continue;const p=s.has(d.id),h=!p&&d.parentId&&i.find(w=>w.id===d.parentId);(p||h)&&i.push(d)}const a=new Set(t.map(d=>d.id)),l=o.filter(d=>d.deletable!==!1),u=Du(i,l);for(const d of l)a.has(d.id)&&!u.find(h=>h.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:i};const f=await r({nodes:i,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:i}:{edges:[],nodes:[]}:f}const Ze=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Le=(e={x:0,y:0},t,n)=>({x:Ze(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Ze(e.y,t[0][1],t[1][1]-(n?.height??0))});function Hr(e,t,n){const{width:o,height:r}=Ne(n),{x:s,y:i}=n.internals.positionAbsolute;return Le(e,[[s,i],[s+o,i+r]],t)}const ho=(e,t,n)=>e<t?Ze(Math.abs(e-t),1,t)/t:e>n?-Ze(Math.abs(e-n),1,t)/t:0,Rr=(e,t,n=15,o=40)=>{const r=ho(e.x,o,t.width-o)*n,s=ho(e.y,o,t.height-o)*n;return[r,s]},Xt=(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)}),mn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Yt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),We=(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}},$t=(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)}},jr=(e,t)=>Yt(Xt(mn(e),mn(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)},go=e=>ye(e.width)&&ye(e.height)&&ye(e.x)&&ye(e.y),ye=e=>!isNaN(e)&&isFinite(e),Hu=(e,t)=>{},ht=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),gt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?ht(a,i):a},zt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function je(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 Ru(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=je(e,n),r=je(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=je(e.top??e.y??0,n),r=je(e.bottom??e.y??0,n),s=je(e.left??e.x??0,t),i=je(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ju(e,t,n,o,r,s){const{x:i,y:a}=zt(e,[t,n,o]),{x:l,y:c}=zt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,f=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const An=(e,t,n,o,r,s)=>{const i=Ru(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=Ze(c,o,r),f=e.x+e.width/2,d=e.y+e.height/2,p=t/2-f*u,h=n/2-d*u,w=ju(e,p,h,u,t,n),v={left:Math.min(w.left-i.left,0),top:Math.min(w.top-i.top,0),right:Math.min(w.right-i.right,0),bottom:Math.min(w.bottom-i.bottom,0)};return{x:p-v.left+v.right,y:h-v.top+v.bottom,zoom:u}},ct=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ge(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Vr(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Or(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function po(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Vu(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Ou(e){return{...Tr,...e||{}}}function tt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=xe(e),a=gt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:l,y:c}=n?ht(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const Pn=e=>({width:e.offsetWidth,height:e.offsetHeight}),Br=e=>e?.getRootNode?.()||window?.document,Bu=["INPUT","SELECT","TEXTAREA"];function Fr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Bu.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Xr=e=>"clientX"in e,xe=(e,t)=>{const n=Xr(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)}},mo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Pn(i)}})};function Yr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),f=Math.abs(c-t);return[l,c,u,f]}function wt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function yo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case Y.Left:return[t-wt(t-o,s),n];case Y.Right:return[t+wt(o-t,s),n];case Y.Top:return[t,n-wt(n-r,s)];case Y.Bottom:return[t,n+wt(r-n,s)]}}function Zr({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:s=Y.Top,curvature:i=.25}){const[a,l]=yo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=yo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[f,d,p,h]=Yr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,f,d,p,h]}function Wr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Fu({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Xu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=Xt($t(e),$t(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return at(i,Yt(s))>0}const Yu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Zu=(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)),Wu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Yu;let r;return zr(e)?r={...e}:r={...e,id:o(e)},Zu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=Wr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const xo={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},Gu=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.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},wo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function qu({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:s,stepPosition:i}){const a=xo[t],l=xo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},f=Gu({source:c,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",p=f[d];let h=[],w,v;const m={x:0,y:0},b={x:0,y:0},[,,g,x]=Wr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(w=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(w=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const S=[{x:w,y:c.y},{x:w,y:u.y}],E=[{x:c.x,y:v},{x:u.x,y:v}];a[d]===p?h=d==="x"?S:E:h=d==="x"?E:S}else{const S=[{x:c.x,y:u.y}],E=[{x:u.x,y:c.y}];if(d==="x"?h=a.x===p?E:S:h=a.y===p?S:E,t===o){const $=Math.abs(e[d]-n[d]);if($<=s){const L=Math.min(s-1,s-$);a[d]===p?m[d]=(c[d]>e[d]?-1:1)*L:b[d]=(u[d]>n[d]?-1:1)*L}}if(t!==o){const $=d==="x"?"y":"x",L=a[d]===l[$],y=c[$]>u[$],M=c[$]<u[$];(a[d]===1&&(!L&&y||L&&M)||a[d]!==1&&(!L&&M||L&&y))&&(h=d==="x"?S:E)}const D={x:c.x+m.x,y:c.y+m.y},k={x:u.x+b.x,y:u.y+b.y},V=Math.max(Math.abs(D.x-h[0].x),Math.abs(k.x-h[0].x)),A=Math.max(Math.abs(D.y-h[0].y),Math.abs(k.y-h[0].y));V>=A?(w=(D.x+k.x)/2,v=h[0].y):(w=h[0].x,v=(D.y+k.y)/2)}return[[e,{x:c.x+m.x,y:c.y+m.y},...h,{x:u.x+b.x,y:u.y+b.y},n],w,v,g,x]}function Ku(e,t,n,o){const r=Math.min(wo(e,t)/2,wo(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function yn({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:s=Y.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[f,d,p,h,w]=qu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[f.reduce((m,b,g)=>{let x="";return g>0&&g<f.length-1?x=Ku(f[g-1],b,f[g+1],i):x=`${g===0?"M":"L"}${b.x} ${b.y}`,m+=x,m},""),d,p,h,w]}function vo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Uu(e){const{sourceNode:t,targetNode:n}=e;if(!vo(t)||!vo(n))return null;const o=t.internals.handleBounds||_o(t.handles),r=n.internals.handleBounds||_o(n.handles),s=bo(o?.source??[],e.sourceHandle),i=bo(e.connectionMode===Ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",_e.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||Y.Bottom,l=i?.position||Y.Top,c=He(t,s,a),u=He(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function _o(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 He(e,t,n=Y.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ne(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case Y.Top:return{x:r+i/2,y:s};case Y.Right:return{x:r+i,y:s+a/2};case Y.Bottom:return{x:r+i/2,y:s+a};case Y.Left:return{x:r,y:s+a/2}}}function bo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function xn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Qu(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=xn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const qr=1e3,Ju=10,Tn={nodeOrigin:[0,0],nodeExtent:it,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ed={...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 td(e,t,n){const o=Dn(Tn,n);for(const r of e.values())if(r.parentId)zn(r,e,t,o);else{const s=dt(r,o.nodeOrigin),i=Ge(r.extent)?r.extent:o.nodeExtent,a=Le(s,i,Ne(r));r.internals.positionAbsolute=a}}function nd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function $n(e){return e==="manual"}function wn(e,t,n,o={}){const r=Dn(ed,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!$n(r.zIndexMode)?qr:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const f=dt(c,r.nodeOrigin),d=Ge(c.extent)?c.extent:r.nodeExtent,p=Le(f,d,Ne(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:p,handleBounds:nd(c,u),z:Kr(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&zn(u,t,n,o,s)}return l}function od(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 zn(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=Dn(Tn,o),c=e.parentId,u=t.get(c);if(!u){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}od(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Ju),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=s&&!$n(l)?qr:0,{x:d,y:p,z:h}=rd(e,u,i,a,f,l),{positionAbsolute:w}=e.internals,v=d!==w.x||p!==w.y;(v||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:d,y:p}:w,z:h}})}function Kr(e,t,n){const o=ye(e.zIndex)?e.zIndex:0;return $n(n)?o:o+(e.selected?t:0)}function rd(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ne(e),c=dt(e,n),u=Ge(e.extent)?Le(c,e.extent,l):c;let f=Le({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(f=Hr(f,l,t));const d=Kr(e,r,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=d?p+1:d}}function Ln(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??We(a),c=jr(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),f=a.origin??o,d=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,p=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,h=Math.max(u.width,Math.round(i.width)),w=Math.max(u.height,Math.round(i.height)),v=(h-u.width)*f[0],m=(w-u.height)*f[1];(d>0||p>0||v||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-d+v,y:a.position.y-p+m}}),n.get(l)?.forEach(b=>{e.some(g=>g.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+p}})})),(u.width<i.width||u.height<i.height||d||p)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?f[0]*d-v:0),height:w+(p?f[1]*p-m:0)}})}),r}function id(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const p of e.values()){const h=t.get(p.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),l=!0;continue}const w=Pn(p.nodeElement),v=h.measured.width!==w.width||h.measured.height!==w.height;if(!!(w.width&&w.height&&(v||!h.internals.handleBounds||p.force))){const b=p.nodeElement.getBoundingClientRect(),g=Ge(h.extent)?h.extent:s;let{positionAbsolute:x}=h.internals;h.parentId&&h.extent==="parent"?x=Hr(x,w,t.get(h.parentId)):g&&(x=Le(x,g,w));const N={...h,measured:w,internals:{...h.internals,positionAbsolute:x,handleBounds:{source:mo("source",p.nodeElement,b,f,h.id),target:mo("target",p.nodeElement,b,f,h.id)}}};t.set(h.id,N),h.parentId&&zn(N,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:h.id,type:"dimensions",dimensions:w}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:We(N,r)}))}}if(d.length>0){const p=Ln(d,t,n,r);c.push(...p)}return{changes:c,updatedInternals:l}}async function sd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function So(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function Ur(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;So("source",l,u,e,r,i),So("target",l,c,e,s,a),t.set(o.id,o)}}function Qr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Qr(n,t):!1}function Eo(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 ad(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!Qr(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function rn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function cd({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=ht(s,t);return{x:i.x-s.x,y:i.y-s.y}}function ld({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,f=!1,d=null,p=!1,h=!1,w=null;function v({noDragClassName:b,handleSelector:g,domNode:x,isSelectable:N,nodeId:S,nodeClickDistance:E=0}){d=de(x);function D({x:$,y:L}){const{nodeLookup:y,nodeExtent:M,snapGrid:C,snapToGrid:P,nodeOrigin:T,onNodeDrag:I,onSelectionDrag:H,onError:j,updateNodePositions:R}=t();s={x:$,y:L};let F=!1;const B=a.size>1,G=B&&M?mn(ft(a)):null,K=B&&P?cd({dragItems:a,snapGrid:C,x:$,y:L}):null;for(const[W,O]of a){if(!y.has(W))continue;let X={x:$-O.distance.x,y:L-O.distance.y};P&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:ht(X,C));let Q=null;if(B&&M&&!O.extent&&G){const{positionAbsolute:q}=O.internals,ee=q.x-G.x+M[0][0],ne=q.x+O.measured.width-G.x2+M[1][0],te=q.y-G.y+M[0][1],se=q.y+O.measured.height-G.y2+M[1][1];Q=[[ee,te],[ne,se]]}const{position:U,positionAbsolute:Z}=Lr({nodeId:W,nextPosition:X,nodeLookup:y,nodeExtent:Q||M,nodeOrigin:T,onError:j});F=F||O.position.x!==U.x||O.position.y!==U.y,O.position=U,O.internals.positionAbsolute=Z}if(h=h||F,!!F&&(R(a,!0),w&&(o||I||!S&&H))){const[W,O]=rn({nodeId:S,dragItems:a,nodeLookup:y});o?.(w,a,W,O),I?.(w,W,O),S||H?.(w,O)}}async function k(){if(!u)return;const{transform:$,panBy:L,autoPanSpeed:y,autoPanOnNodeDrag:M}=t();if(!M){l=!1,cancelAnimationFrame(i);return}const[C,P]=Rr(c,u,y);(C!==0||P!==0)&&(s.x=(s.x??0)-C/$[2],s.y=(s.y??0)-P/$[2],await L({x:C,y:P})&&D(s)),i=requestAnimationFrame(k)}function V($){const{nodeLookup:L,multiSelectionActive:y,nodesDraggable:M,transform:C,snapGrid:P,snapToGrid:T,selectNodesOnDrag:I,onNodeDragStart:H,onSelectionDragStart:j,unselectNodesAndEdges:R}=t();f=!0,(!I||!N)&&!y&&S&&(L.get(S)?.selected||R()),N&&I&&S&&e?.(S);const F=tt($.sourceEvent,{transform:C,snapGrid:P,snapToGrid:T,containerBounds:u});if(s=F,a=ad(L,M,F,S),a.size>0&&(n||H||!S&&j)){const[B,G]=rn({nodeId:S,dragItems:a,nodeLookup:L});n?.($.sourceEvent,a,B,G),H?.($.sourceEvent,B,G),S||j?.($.sourceEvent,G)}}const A=wr().clickDistance(E).on("start",$=>{const{domNode:L,nodeDragThreshold:y,transform:M,snapGrid:C,snapToGrid:P}=t();u=L?.getBoundingClientRect()||null,p=!1,h=!1,w=$.sourceEvent,y===0&&V($),s=tt($.sourceEvent,{transform:M,snapGrid:C,snapToGrid:P,containerBounds:u}),c=xe($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:L,transform:y,snapGrid:M,snapToGrid:C,nodeDragThreshold:P,nodeLookup:T}=t(),I=tt($.sourceEvent,{transform:y,snapGrid:M,snapToGrid:C,containerBounds:u});if(w=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||S&&!T.has(S))&&(p=!0),!p){if(!l&&L&&f&&(l=!0,k()),!f){const H=xe($.sourceEvent,u),j=H.x-c.x,R=H.y-c.y;Math.sqrt(j*j+R*R)>P&&V($)}(s.x!==I.xSnapped||s.y!==I.ySnapped)&&a&&f&&(c=xe($.sourceEvent,u),D(I))}}).on("end",$=>{if(!(!f||p)&&(l=!1,f=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:L,updateNodePositions:y,onNodeDragStop:M,onSelectionDragStop:C}=t();if(h&&(y(a,!1),h=!1),r||M||!S&&C){const[P,T]=rn({nodeId:S,dragItems:a,nodeLookup:L,dragging:!1});r?.($.sourceEvent,a,P,T),M?.($.sourceEvent,P,T),S||C?.($.sourceEvent,T)}}}).filter($=>{const L=$.target;return!$.button&&(!b||!Eo(L,`.${b}`,x))&&(!g||Eo(L,g,x))});d.call(A)}function m(){d?.on(".drag",null)}return{update:v,destroy:m}}function ud(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())at(r,We(s))>0&&o.push(s);return o}const dd=250;function fd(e,t,n,o){let r=[],s=1/0;const i=ud(e,n,t+dd);for(const a of i){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:u,y:f}=He(a,c,c.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<s?(r=[{...c,x:u,y:f}],s=d):d===s&&r.push({...c,x:u,y:f}))}}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 Jr(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...He(i,l,l.position,!0)}:l}function ei(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function hd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ti=()=>!0;function gd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:p,onConnectStart:h,onConnect:w,onConnectEnd:v,isValidConnection:m=ti,onReconnectEnd:b,updateConnection:g,getTransform:x,getFromHandle:N,autoPanSpeed:S,dragThreshold:E=1,handleDomNode:D}){const k=Br(e.target);let V=0,A;const{x:$,y:L}=xe(e),y=ei(s,D),M=a?.getBoundingClientRect();let C=!1;if(!M||!y)return;const P=Jr(r,y,o,l,t);if(!P)return;let T=xe(e,M),I=!1,H=null,j=!1,R=null;function F(){if(!u||!M)return;const[U,Z]=Rr(T,M,S);d({x:U,y:Z}),V=requestAnimationFrame(F)}const B={...P,nodeId:r,type:y,position:P.position},G=l.get(r);let W={inProgress:!0,isValid:null,from:He(G,B,Y.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:G,to:T,toHandle:null,toPosition:fo[B.position],toNode:null,pointer:T};function O(){C=!0,g(W),h?.(e,{nodeId:r,handleId:o,handleType:y})}E===0&&O();function X(U){if(!C){const{x:se,y:ce}=xe(U),le=se-$,oe=ce-L;if(!(le*le+oe*oe>E*E))return;O()}if(!N()||!B){Q(U);return}const Z=x();T=xe(U,M),A=fd(gt(T,Z,!1,[1,1]),n,l,B),I||(F(),I=!0);const q=ni(U,{handle:A,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:m,doc:k,lib:c,flowId:f,nodeLookup:l});R=q.handleDomNode,H=q.connection,j=hd(!!A,q.isValid);const ee=l.get(r),ne=ee?He(ee,B,Y.Left,!0):W.from,te={...W,from:ne,isValid:j,to:q.toHandle&&j?zt({x:q.toHandle.x,y:q.toHandle.y},Z):T,toHandle:q.toHandle,toPosition:j&&q.toHandle?q.toHandle.position:fo[B.position],toNode:q.toHandle?l.get(q.toHandle.nodeId):null,pointer:T};g(te),W=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(C){(A||R)&&H&&j&&w?.(H);const{inProgress:Z,...q}=W,ee={...q,toPosition:W.toHandle?W.toPosition:null};v?.(U,ee),s&&b?.(U,ee)}p(),cancelAnimationFrame(V),I=!1,j=!1,H=null,R=null,k.removeEventListener("mousemove",X),k.removeEventListener("mouseup",Q),k.removeEventListener("touchmove",X),k.removeEventListener("touchend",Q)}}k.addEventListener("mousemove",X),k.addEventListener("mouseup",Q),k.addEventListener("touchmove",X),k.addEventListener("touchend",Q)}function ni(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ti,nodeLookup:u}){const f=s==="target",d=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:h}=xe(e),w=i.elementFromPoint(p,h),v=w?.classList.contains(`${a}-flow__handle`)?w:d,m={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=ei(void 0,v),g=v.getAttribute("data-nodeid"),x=v.getAttribute("data-handleid"),N=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!g||!b)return m;const E={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};m.connection=E;const k=N&&S&&(n===Ye.Strict?f&&b==="source"||!f&&b==="target":g!==o||x!==r);m.isValid=k&&c(E),m.toHandle=Jr(g,b,x,u,n,!0)}return m}const vn={onPointerDown:gd,isValid:ni};function pd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=de(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:p=!1}){const h=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const x=n(),N=g.sourceEvent.ctrlKey&&ct()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,E=x[2]*Math.pow(2,S*N);t.scaleTo(E)};let w=[0,0];const v=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[N[0]-w[0],N[1]-w[1]];w=N;const E=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),D={x:x[0]-S[0]*E,y:x[1]-S[1]*E},k=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:x[2]},k,a)},b=Ar().on("start",v).on("zoom",f?m:null).on("zoom.wheel",d?h:null);r.call(b,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:me}}const Zt=e=>({x:e.x,y:e.y,zoom:e.k}),sn=({x:e,y:t,zoom:n})=>Ft.translate(e,t).scale(n),Ve=(e,t)=>e.target.closest(`.${t}`),oi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),md=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,an=(e,t=0,n=md,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ri=e=>{const t=e.ctrlKey&&ct()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function yd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Ve(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=me(u),m=ri(u),b=f*Math.pow(2,m);o.scaleTo(n,b,v,u);return}const d=u.deltaMode===1?20:1;let p=r===$e.Vertical?0:u.deltaX*d,h=r===$e.Horizontal?0:u.deltaY*d;!ct()&&u.shiftKey&&r!==$e.Vertical&&(p=u.deltaY*d,h=0),o.translateBy(n,-(p/f)*s,-(h/f)*s,{internal:!0});const w=Zt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,w),e.panScrollTimeout=setTimeout(()=>{c?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,w))}}function xd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=Ve(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function wd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Zt(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 vd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&oi(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,Zt(s.transform))}}function _d({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&oi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Zt(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function bd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return f=>{const d=e||t,p=n&&f.ctrlKey,h=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Ve(f,`${c}-flow__node`)||Ve(f,`${c}-flow__edge`)))return!0;if(!o&&!d&&!r&&!s&&!n||i||u&&!h||Ve(f,a)&&h||Ve(f,l)&&(!h||r&&h&&!e)||!n&&f.ctrlKey&&h)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!p&&h||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h)&&w}}function Sd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=Ar().scaleExtent([t,n]).translateExtent(o),d=de(e).call(f);b({x:r.x,y:r.y,zoom:Ze(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const p=d.on("wheel.zoom"),h=d.on("dblclick.zoom");f.wheelDelta(ri);function w(A,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).transform(an(d,$?.duration,$?.ease,()=>L(!0)),A)}):Promise.resolve(!1)}function v({noWheelClassName:A,noPanClassName:$,onPaneContextMenu:L,userSelectionActive:y,panOnScroll:M,panOnDrag:C,panOnScrollMode:P,panOnScrollSpeed:T,preventScrolling:I,zoomOnPinch:H,zoomOnScroll:j,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:G,connectionInProgress:K,paneClickDistance:W,selectionOnDrag:O}){y&&!c.isZoomingOrPanning&&m();const X=M&&!F&&!y;f.clickDistance(O?1/0:!ye(W)||W<0?0:W);const Q=X?yd({zoomPanValues:c,noWheelClassName:A,d3Selection:d,d3Zoom:f,panOnScrollMode:P,panOnScrollSpeed:T,zoomOnPinch:H,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):xd({noWheelClassName:A,preventScrolling:I,d3ZoomHandler:p});if(d.on("wheel.zoom",Q,{passive:!1}),!y){const Z=wd({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});f.on("start",Z);const q=vd({zoomPanValues:c,panOnDrag:C,onPaneContextMenu:!!L,onPanZoom:s,onTransformChange:G});f.on("zoom",q);const ee=_d({zoomPanValues:c,panOnDrag:C,panOnScroll:M,onPaneContextMenu:L,onPanZoomEnd:a,onDraggingChange:l});f.on("end",ee)}const U=bd({zoomActivationKeyPressed:F,panOnDrag:C,zoomOnScroll:j,panOnScroll:M,zoomOnDoubleClick:R,zoomOnPinch:H,userSelectionActive:y,noPanClassName:$,noWheelClassName:A,lib:B,connectionInProgress:K});f.filter(U),R?d.on("dblclick.zoom",h):d.on("dblclick.zoom",null)}function m(){f.on("zoom",null)}async function b(A,$,L){const y=sn(A),M=f?.constrain()(y,$,L);return M&&await w(M),new Promise(C=>C(M))}async function g(A,$){const L=sn(A);return await w(L,$),new Promise(y=>y(L))}function x(A){if(d){const $=sn(A),L=d.property("__zoom");(L.k!==A.zoom||L.x!==A.x||L.y!==A.y)&&f?.transform(d,$,null,{sync:!0})}}function N(){const A=d?kr(d.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function S(A,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).scaleTo(an(d,$?.duration,$?.ease,()=>L(!0)),A)}):Promise.resolve(!1)}function E(A,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).scaleBy(an(d,$?.duration,$?.ease,()=>L(!0)),A)}):Promise.resolve(!1)}function D(A){f?.scaleExtent(A)}function k(A){f?.translateExtent(A)}function V(A){const $=!ye(A)||A<0?0:A;f?.clickDistance($)}return{update:v,destroy:m,setViewport:g,setViewportConstrained:b,getViewport:N,scaleTo:S,scaleBy:E,setScaleExtent:D,setTranslateExtent:k,syncViewport:x,setClickDistance:V}}var qe;(function(e){e.Line="line",e.Handle="handle"})(qe||(qe={}));function Ed({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function Co(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 Me(e,t){return Math.max(0,t-e)}function Ie(e,t){return Math.max(0,e-t)}function vt(e,t,n){return Math.max(0,t-e,e-n)}function No(e,t){return e?!t:t}function Cd(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:p,ySnapped:h}=n,{minWidth:w,maxWidth:v,minHeight:m,maxHeight:b}=o,{x:g,y:x,width:N,height:S,aspectRatio:E}=e;let D=Math.floor(u?p-e.pointerX:0),k=Math.floor(f?h-e.pointerY:0);const V=N+(l?-D:D),A=S+(c?-k:k),$=-s[0]*N,L=-s[1]*S;let y=vt(V,w,v),M=vt(A,m,b);if(i){let T=0,I=0;l&&D<0?T=Me(g+D+$,i[0][0]):!l&&D>0&&(T=Ie(g+V+$,i[1][0])),c&&k<0?I=Me(x+k+L,i[0][1]):!c&&k>0&&(I=Ie(x+A+L,i[1][1])),y=Math.max(y,T),M=Math.max(M,I)}if(a){let T=0,I=0;l&&D>0?T=Ie(g+D,a[0][0]):!l&&D<0&&(T=Me(g+V,a[1][0])),c&&k>0?I=Ie(x+k,a[0][1]):!c&&k<0&&(I=Me(x+A,a[1][1])),y=Math.max(y,T),M=Math.max(M,I)}if(r){if(u){const T=vt(V/E,m,b)*E;if(y=Math.max(y,T),i){let I=0;!l&&!c||l&&!c&&d?I=Ie(x+L+V/E,i[1][1])*E:I=Me(x+L+(l?D:-D)/E,i[0][1])*E,y=Math.max(y,I)}if(a){let I=0;!l&&!c||l&&!c&&d?I=Me(x+V/E,a[1][1])*E:I=Ie(x+(l?D:-D)/E,a[0][1])*E,y=Math.max(y,I)}}if(f){const T=vt(A*E,w,v)/E;if(M=Math.max(M,T),i){let I=0;!l&&!c||c&&!l&&d?I=Ie(g+A*E+$,i[1][0])/E:I=Me(g+(c?k:-k)*E+$,i[0][0])/E,M=Math.max(M,I)}if(a){let I=0;!l&&!c||c&&!l&&d?I=Me(g+A*E,a[1][0])/E:I=Ie(g+(c?k:-k)*E,a[0][0])/E,M=Math.max(M,I)}}}k=k+(k<0?M:-M),D=D+(D<0?y:-y),r&&(d?V>A*E?k=(No(l,c)?-D:D)/E:D=(No(l,c)?-k:k)*E:u?(k=D/E,c=l):(D=k*E,l=c));const C=l?g+D:g,P=c?x+k:x;return{width:N+(l?-D:D),height:S+(c?-k:k),x:s[0]*D*(l?-1:1)+C,y:s[1]*k*(c?-1:1)+P}}const ii={width:0,height:0,x:0,y:0},Nd={...ii,pointerX:0,pointerY:0,aspectRatio:1};function Md(e){return[[0,0],[e.measured.width,e.measured.height]]}function Id(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function kd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=de(e);let i={controlDirection:Co("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:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:p,onResize:h,onResizeEnd:w,shouldResize:v}){let m={...ii},b={...Nd};i={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Co(c)};let g,x=null,N=[],S,E,D,k=!1;const V=wr().on("start",A=>{const{nodeLookup:$,transform:L,snapGrid:y,snapToGrid:M,nodeOrigin:C,paneDomNode:P}=n();if(g=$.get(t),!g)return;x=P?.getBoundingClientRect()??null;const{xSnapped:T,ySnapped:I}=tt(A.sourceEvent,{transform:L,snapGrid:y,snapToGrid:M,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},b={...m,pointerX:T,pointerY:I,aspectRatio:m.width/m.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=$.get(g.parentId),E=S&&g.extent==="parent"?Md(S):void 0),N=[],D=void 0;for(const[H,j]of $)if(j.parentId===t&&(N.push({id:H,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const R=Id(j,g,j.origin??C);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}p?.(A,{...m})}).on("drag",A=>{const{transform:$,snapGrid:L,snapToGrid:y,nodeOrigin:M}=n(),C=tt(A.sourceEvent,{transform:$,snapGrid:L,snapToGrid:y,containerBounds:x}),P=[];if(!g)return;const{x:T,y:I,width:H,height:j}=m,R={},F=g.origin??M,{width:B,height:G,x:K,y:W}=Cd(b,i.controlDirection,C,i.boundaries,i.keepAspectRatio,F,E,D),O=B!==H,X=G!==j,Q=K!==T&&O,U=W!==I&&X;if(!Q&&!U&&!O&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:m.x,R.y=U?W:m.y,m.x=R.x,m.y=R.y,N.length>0)){const ne=K-T,te=W-I;for(const se of N)se.position={x:se.position.x-ne+F[0]*(B-H),y:se.position.y-te+F[1]*(G-j)},P.push(se)}if((O||X)&&(R.width=O&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:m.width,R.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?G:m.height,m.width=R.width,m.height=R.height),S&&g.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 Z=Ed({width:m.width,prevWidth:H,height:m.height,prevHeight:j,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),q={...m,direction:Z};v?.(A,q)!==!1&&(k=!0,h?.(A,q),o(R,P))}).on("end",A=>{k&&(w?.(A,{...m}),r?.({...m}),k=!1)});s.call(V)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const Ad={},Mo=e=>{let t;const n=new Set,o=(u,f)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const p=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,p))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Ad?"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},Pd=e=>e?Mo(e):Mo,{useDebugValue:Td}=Zs,{useSyncExternalStoreWithSelector:Dd}=Ys,$d=e=>e;function si(e,t=$d,n){const o=Dd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Td(o),o}const Io=(e,t)=>{const n=Pd(e),o=(r,s=t)=>si(n,r,s);return Object.assign(o,n),o},zd=(e,t)=>e?Io(e,t):Io;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[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 Wt=z.createContext(null),Ld=Wt.Provider,ai=_e.error001();function J(e,t){const n=z.useContext(Wt);if(n===null)throw new Error(ai);return si(n,e,t)}function ie(){const e=z.useContext(Wt);if(e===null)throw new Error(ai);return z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ko={display:"none"},Hd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ci="react-flow__node-desc",li="react-flow__edge-desc",Rd="react-flow__aria-live",jd=e=>e.ariaLiveMessage,Vd=e=>e.ariaLabelConfig;function Od({rfId:e}){const t=J(jd);return _.jsx("div",{id:`${Rd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Hd,children:t})}function Bd({rfId:e,disableKeyboardA11y:t}){const n=J(Vd);return _.jsxs(_.Fragment,{children:[_.jsx("div",{id:`${ci}-${e}`,style:ko,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),_.jsx("div",{id:`${li}-${e}`,style:ko,children:n["edge.a11yDescription.default"]}),!t&&_.jsx(Od,{rfId:e})]})}const Gt=z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return _.jsx("div",{className:ae(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Gt.displayName="Panel";function Fd({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:_.jsx(Gt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:_.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Xd=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 Yd(e,t){return re(e.selectedNodes.map(_t),t.selectedNodes.map(_t))&&re(e.selectedEdges.map(_t),t.selectedEdges.map(_t))}function Zd({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=J(Xd,Yd);return z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Wd=e=>!!e.onSelectionChangeHandlers;function Gd({onSelectionChange:e}){const t=J(Wd);return e||t?_.jsx(Zd,{onSelectionChange:e}):null}const ui=[0,0],qd={x:0,y:0,zoom:1},Kd=["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"],Ao=[...Kd,"rfId"],Ud=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}),Po={translateExtent:it,nodeOrigin:ui,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Qd(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=J(Ud,re),c=ie();z.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=Po,a()}),[]);const u=z.useRef(Po);return z.useEffect(()=>{for(const f of Ao){const d=e[f],p=u.current[f];d!==p&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?s(d):f==="nodeExtent"?i(d):f==="ariaLabelConfig"?c.setState({ariaLabelConfig:Ou(d)}):f==="fitView"?c.setState({fitViewQueued:d}):f==="fitViewOptions"?c.setState({fitViewOptions:d}):c.setState({[f]:d})))}u.current=e},Ao.map(f=>e[f])),null}function To(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Jd(e){const[t,n]=z.useState(e==="system"?null:e);return z.useEffect(()=>{if(e!=="system"){n(e);return}const o=To(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:To()?.matches?"dark":"light"}const Do=typeof document<"u"?document:null;function lt(e=null,t={target:Do,actInsideInputWithModifier:!0}){const[n,o]=z.useState(!1),r=z.useRef(!1),s=z.useRef(new Set([])),[i,a]=z.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
1
|
+
import{r as z,y as Ys,z as Zs,j as _,c as ge,h as Rt,i as Ws,a as Gs,t as qn}from"./index-DZBFXaT_.js";import{f as qs,D as Ks,u as Kn,a as Us,b as Qs,d as Js,c as ea,e as ta,N as na,C as pe,M as Un,U as oa,G as ra,g as ia,T as sa}from"./thread-history-popover-CbjIrBTu.js";import{E as Qn}from"./error-boundary-C3biDnWK.js";import{u as Jo,c as aa,I as er,n as ca}from"./use-connection-BVMsW9fR.js";import{u as tr,i as la}from"./use-gateway-DJ2wz6GD.js";import{u as ua}from"./use-binding-Dh7eSguQ.js";import{u as nr,L as da}from"./localstorage-keys-ziXXhpvN.js";import{u as bn}from"./project-context-provider-6vMfUBpq.js";import{c as or,B as fa}from"./input-KWjuSjzn.js";import{V as ha}from"./view-mode-toggle-CYuFxr7p.js";import{i as ga}from"./GitBranch01-38L6KUpt.js";import{i as pa}from"./Loading01-5lHx4rM1.js";import{s as ma}from"./Plus-wptRVGuY.js";import{u as ya}from"./use-tool-call-VY44CqK6.js";import{i as Te,a as Jn,b as xa,c as eo,d as en,T as tn,e as wa}from"./value-BXXW8rnd.js";import{G as to}from"./gateway-selector-D3Qx1Iib.js";import"./use-gateway-system-prompt-FrFSJufL.js";import"./popover-CYHZWxlr.js";import"./AlertCircle-BZ4bvRfi.js";import"./X-C6XvUpZP.js";import"./Grid01-Dl_1kAd5.js";import"./textarea-_Mx18lUV.js";import"./ChevronRight-Bc43l_p6.js";import"./Copy01-BTTTCefb.js";import"./Terminal-BC7AwEkQ.js";import"./monaco-editor-BmgaGs_i.js";import"./spinner-A1jsF1CN.js";import"./alert-dialog-BJHrUd_j.js";import"./File06-td5gmARz.js";import"./InfoCircle-D8z5_ZlN.js";import"./well-known-mcp-D13f-8h2.js";import"./generate-id-Dyweu44Y.js";import"./Trash01-DMq1QD3Y.js";import"./auth-BIu7r9Ac.js";import"./useQuery-DW8RlKsd.js";import"./select-bHRpmvzh.js";import"./ChevronDown-Bd6n8txO.js";import"./use-mobile-Cj5IONVM.js";const rr=({size:e=24,color:t="currentColor",...n})=>z.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},z.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));rr.displayName="MessageChatSquare";function ae(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=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var va={value:()=>{}};function jt(){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 Et(n)}function Et(e){this._=e}function _a(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}})}Et.prototype=jt.prototype={constructor:Et,on:function(e,t){var n=this._,o=_a(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=ba(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(r=(e=o[s]).type)n[r]=no(n[r],e.name,t);else if(t==null)for(r in n)n[r]=no(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 Et(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,s;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],o=0,r=s.length;o<r;++o)s[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,s=o.length;r<s;++r)o[r].value.apply(t,n)}};function ba(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function no(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=va,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var un="http://www.w3.org/1999/xhtml";const oo={svg:"http://www.w3.org/2000/svg",xhtml:un,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),oo.hasOwnProperty(t)?{space:oo[t],local:e}:e}function Sa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===un&&t.documentElement.namespaceURI===un?t.createElement(e):t.createElementNS(n,e)}}function Ea(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ir(e){var t=Vt(e);return(t.local?Ea:Sa)(t)}function Ca(){}function Sn(e){return e==null?Ca:function(){return this.querySelector(e)}}function Na(e){typeof e!="function"&&(e=Sn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=new Array(i),l,c,u=0;u<i;++u)(l=s[u])&&(c=e.call(l,l.__data__,u,s))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new fe(o,this._parents)}function Ma(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ia(){return[]}function sr(e){return e==null?Ia:function(){return this.querySelectorAll(e)}}function ka(e){return function(){return Ma(e.apply(this,arguments))}}function Aa(e){typeof e=="function"?e=ka(e):e=sr(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&(o.push(e.call(l,l.__data__,c,i)),r.push(l));return new fe(o,r)}function ar(e){return function(){return this.matches(e)}}function cr(e){return function(t){return t.matches(e)}}var Pa=Array.prototype.find;function Ta(e){return function(){return Pa.call(this.children,e)}}function Da(){return this.firstElementChild}function $a(e){return this.select(e==null?Da:Ta(typeof e=="function"?e:cr(e)))}var za=Array.prototype.filter;function La(){return Array.from(this.children)}function Ha(e){return function(){return za.call(this.children,e)}}function Ra(e){return this.selectAll(e==null?La:Ha(typeof e=="function"?e:cr(e)))}function ja(e){typeof e!="function"&&(e=ar(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new fe(o,this._parents)}function lr(e){return new Array(e.length)}function Va(){return new fe(this._enter||this._groups.map(lr),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 Oa(e){return function(){return e}}function Ba(e,t,n,o,r,s){for(var i=0,a,l=t.length,c=s.length;i<c;++i)(a=t[i])?(a.__data__=s[i],o[i]=a):n[i]=new kt(e,s[i]);for(;i<l;++i)(a=t[i])&&(r[i]=a)}function Fa(e,t,n,o,r,s,i){var a,l,c=new Map,u=t.length,f=s.length,d=new Array(u),p;for(a=0;a<u;++a)(l=t[a])&&(d[a]=p=i.call(l,l.__data__,a,t)+"",c.has(p)?r[a]=l:c.set(p,l));for(a=0;a<f;++a)p=i.call(e,s[a],a,s)+"",(l=c.get(p))?(o[a]=l,l.__data__=s[a],c.delete(p)):n[a]=new kt(e,s[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(d[a])===l&&(r[a]=l)}function Xa(e){return e.__data__}function Ya(e,t){if(!arguments.length)return Array.from(this,Xa);var n=t?Fa:Ba,o=this._parents,r=this._groups;typeof e!="function"&&(e=Oa(e));for(var s=r.length,i=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=o[c],f=r[c],d=f.length,p=Za(e.call(u,u&&u.__data__,c,o)),h=p.length,w=a[c]=new Array(h),v=i[c]=new Array(h),m=l[c]=new Array(d);n(u,f,w,v,m,p,t);for(var b=0,g=0,x,N;b<h;++b)if(x=w[b]){for(b>=g&&(g=b+1);!(N=v[g])&&++g<h;);x._next=N||null}}return i=new fe(i,o),i._enter=a,i._exit=l,i}function Za(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Wa(){return new fe(this._exit||this._groups.map(lr),this._parents)}function Ga(e,t,n){var o=this.enter(),r=this,s=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?s.remove():n(s),o&&r?o.merge(r).order():r}function qa(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,s=o.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=n[l],u=o[l],f=c.length,d=a[l]=new Array(f),p,h=0;h<f;++h)(p=c[h]||u[h])&&(d[h]=p);for(;l<r;++l)a[l]=n[l];return new fe(a,this._parents)}function Ka(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,s=o[r],i;--r>=0;)(i=o[r])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function Ua(e){e||(e=Qa);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],a=i.length,l=r[s]=new Array(a),c,u=0;u<a;++u)(c=i[u])&&(l[u]=c);l.sort(t)}return new fe(r,this._parents).order()}function Qa(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 ec(){return Array.from(this)}function tc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length;r<s;++r){var i=o[r];if(i)return i}return null}function nc(){let e=0;for(const t of this)++e;return e}function oc(){return!this.node()}function rc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,a;s<i;++s)(a=r[s])&&e.call(a,a.__data__,s,r);return this}function ic(e){return function(){this.removeAttribute(e)}}function sc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ac(e,t){return function(){this.setAttribute(e,t)}}function cc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function lc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function uc(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 dc(e,t){var n=Vt(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?sc:ic:typeof t=="function"?n.local?uc:lc:n.local?cc:ac)(n,t))}function ur(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function fc(e){return function(){this.style.removeProperty(e)}}function hc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function gc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function pc(e,t,n){return arguments.length>1?this.each((t==null?fc:typeof t=="function"?gc:hc)(e,t,n??"")):Fe(this.node(),e)}function Fe(e,t){return e.style.getPropertyValue(t)||ur(e).getComputedStyle(e,null).getPropertyValue(t)}function mc(e){return function(){delete this[e]}}function yc(e,t){return function(){this[e]=t}}function xc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function wc(e,t){return arguments.length>1?this.each((t==null?mc:typeof t=="function"?xc:yc)(e,t)):this.node()[e]}function dr(e){return e.trim().split(/^|\s+/)}function En(e){return e.classList||new fr(e)}function fr(e){this._node=e,this._names=dr(e.getAttribute("class")||"")}fr.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 hr(e,t){for(var n=En(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function gr(e,t){for(var n=En(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function vc(e){return function(){hr(this,e)}}function _c(e){return function(){gr(this,e)}}function bc(e,t){return function(){(t.apply(this,arguments)?hr:gr)(this,e)}}function Sc(e,t){var n=dr(e+"");if(arguments.length<2){for(var o=En(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?bc:t?vc:_c)(n,t))}function Ec(){this.textContent=""}function Cc(e){return function(){this.textContent=e}}function Nc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Mc(e){return arguments.length?this.each(e==null?Ec:(typeof e=="function"?Nc:Cc)(e)):this.node().textContent}function Ic(){this.innerHTML=""}function kc(e){return function(){this.innerHTML=e}}function Ac(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Pc(e){return arguments.length?this.each(e==null?Ic:(typeof e=="function"?Ac:kc)(e)):this.node().innerHTML}function Tc(){this.nextSibling&&this.parentNode.appendChild(this)}function Dc(){return this.each(Tc)}function $c(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zc(){return this.each($c)}function Lc(e){var t=typeof e=="function"?e:ir(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Hc(){return null}function Rc(e,t){var n=typeof e=="function"?e:ir(e),o=t==null?Hc:typeof t=="function"?t:Sn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function jc(){var e=this.parentNode;e&&e.removeChild(this)}function Vc(){return this.each(jc)}function Oc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Fc(e){return this.select(e?Bc:Oc)}function Xc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Yc(e){return function(t){e.call(this,t,this.__data__)}}function Zc(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 Wc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,s;n<r;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++o]=s;++o?t.length=o:delete this.__on}}}function Gc(e,t,n){return function(){var o=this.__on,r,s=Yc(t);if(o){for(var i=0,a=o.length;i<a;++i)if((r=o[i]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=t;return}}this.addEventListener(e.type,s,n),r={type:e.type,name:e.name,value:t,listener:s,options:n},o?o.push(r):this.__on=[r]}}function qc(e,t,n){var o=Zc(e+""),r,s=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<s;++r)if((i=o[r]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?Gc:Wc,r=0;r<s;++r)this.each(a(o[r],t,n));return this}function pr(e,t,n){var o=ur(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 Kc(e,t){return function(){return pr(this,e,t)}}function Uc(e,t){return function(){return pr(this,e,t.apply(this,arguments))}}function Qc(e,t){return this.each((typeof t=="function"?Uc:Kc)(e,t))}function*Jc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,s=o.length,i;r<s;++r)(i=o[r])&&(yield i)}var mr=[null];function fe(e,t){this._groups=e,this._parents=t}function ut(){return new fe([[document.documentElement]],mr)}function el(){return this}fe.prototype=ut.prototype={constructor:fe,select:Na,selectAll:Aa,selectChild:$a,selectChildren:Ra,filter:ja,data:Ya,enter:Va,exit:Wa,join:Ga,merge:qa,selection:el,order:Ka,sort:Ua,call:Ja,nodes:ec,node:tc,size:nc,empty:oc,each:rc,attr:dc,style:pc,property:wc,classed:Sc,text:Mc,html:Pc,raise:Dc,lower:zc,append:Lc,insert:Rc,remove:Vc,clone:Fc,datum:Xc,on:qc,dispatch:Qc,[Symbol.iterator]:Jc};function de(e){return typeof e=="string"?new fe([[document.querySelector(e)]],[document.documentElement]):new fe([[e]],mr)}function tl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function me(e,t){if(e=tl(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 nl={passive:!1},ot={capture:!0,passive:!1};function nn(e){e.stopImmediatePropagation()}function Be(e){e.preventDefault(),e.stopImmediatePropagation()}function yr(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",Be,ot);"onselectstart"in t?n.on("selectstart.drag",Be,ot):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xr(e,t){var n=e.document.documentElement,o=de(e).on("dragstart.drag",null);t&&(o.on("click.drag",Be,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 dn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ol(e){return!e.ctrlKey&&!e.button}function rl(){return this.parentNode}function il(e,t){return t??{x:e.x,y:e.y}}function sl(){return navigator.maxTouchPoints||"ontouchstart"in this}function wr(){var e=ol,t=rl,n=il,o=sl,r={},s=jt("start","drag","end"),i=0,a,l,c,u,f=0;function d(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",v).on("touchmove.drag",m,nl).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,N){if(!(u||!e.call(this,x,N))){var S=g(this,t.call(this,x,N),x,N,"mouse");S&&(de(x.view).on("mousemove.drag",h,ot).on("mouseup.drag",w,ot),yr(x.view),nn(x),c=!1,a=x.clientX,l=x.clientY,S("start",x))}}function h(x){if(Be(x),!c){var N=x.clientX-a,S=x.clientY-l;c=N*N+S*S>f}r.mouse("drag",x)}function w(x){de(x.view).on("mousemove.drag mouseup.drag",null),xr(x.view,c),Be(x),r.mouse("end",x)}function v(x,N){if(e.call(this,x,N)){var S=x.changedTouches,E=t.call(this,x,N),D=S.length,k,V;for(k=0;k<D;++k)(V=g(this,E,x,N,S[k].identifier,S[k]))&&(nn(x),V("start",x,S[k]))}}function m(x){var N=x.changedTouches,S=N.length,E,D;for(E=0;E<S;++E)(D=r[N[E].identifier])&&(Be(x),D("drag",x,N[E]))}function b(x){var N=x.changedTouches,S=N.length,E,D;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),E=0;E<S;++E)(D=r[N[E].identifier])&&(nn(x),D("end",x,N[E]))}function g(x,N,S,E,D,k){var V=s.copy(),A=me(k||S,N),$,L,y;if((y=n.call(x,new dn("beforestart",{sourceEvent:S,target:d,identifier:D,active:i,x:A[0],y:A[1],dx:0,dy:0,dispatch:V}),E))!=null)return $=y.x-A[0]||0,L=y.y-A[1]||0,function M(C,P,T){var I=A,H;switch(C){case"start":r[D]=M,H=i++;break;case"end":delete r[D],--i;case"drag":A=me(T||P,N),H=i;break}V.call(C,x,new dn(C,{sourceEvent:P,subject:y,target:d,identifier:D,active:H,x:A[0]+$,y:A[1]+L,dx:A[0]-I[0],dy:A[1]-I[1],dispatch:V}),E)}}return d.filter=function(x){return arguments.length?(e=typeof x=="function"?x:mt(!!x),d):e},d.container=function(x){return arguments.length?(t=typeof x=="function"?x:mt(x),d):t},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:mt(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:mt(!!x),d):o},d.on=function(){var x=s.on.apply(s,arguments);return x===s?d:x},d.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,d):Math.sqrt(f)},d}var ro=180/Math.PI,fn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vr(e,t,n,o,r,s){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(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,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*ro,skewX:Math.atan(l)*ro,scaleX:i,scaleY:a}}var yt;function al(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?fn:vr(t.a,t.b,t.c,t.d,t.e,t.f)}function cl(e){return e==null||(yt||(yt=document.createElementNS("http://www.w3.org/2000/svg","g")),yt.setAttribute("transform",e),!(e=yt.transform.baseVal.consolidate()))?fn:(e=e.matrix,vr(e.a,e.b,e.c,e.d,e.e,e.f))}function _r(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function s(c,u,f,d,p,h){if(c!==f||u!==d){var w=p.push("translate(",null,t,null,n);h.push({i:w-4,x:Te(c,f)},{i:w-2,x:Te(u,d)})}else(f||d)&&p.push("translate("+f+t+d+n)}function i(c,u,f,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:Te(c,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(c,u,f,d){c!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:Te(c,u)}):u&&f.push(r(f)+"skewX("+u+o)}function l(c,u,f,d,p,h){if(c!==f||u!==d){var w=p.push(r(p)+"scale(",null,",",null,")");h.push({i:w-4,x:Te(c,f)},{i:w-2,x:Te(u,d)})}else(f!==1||d!==1)&&p.push(r(p)+"scale("+f+","+d+")")}return function(c,u){var f=[],d=[];return c=e(c),u=e(u),s(c.translateX,c.translateY,u.translateX,u.translateY,f,d),i(c.rotate,u.rotate,f,d),a(c.skewX,u.skewX,f,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,d),c=u=null,function(p){for(var h=-1,w=d.length,v;++h<w;)f[(v=d[h]).i]=v.x(p);return f.join("")}}}var ll=_r(al,"px, ","px)","deg)"),ul=_r(cl,", ",")",")"),dl=1e-12;function io(e){return((e=Math.exp(e))+1/e)/2}function fl(e){return((e=Math.exp(e))-1/e)/2}function hl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ct=(function e(t,n,o){function r(s,i){var a=s[0],l=s[1],c=s[2],u=i[0],f=i[1],d=i[2],p=u-a,h=f-l,w=p*p+h*h,v,m;if(w<dl)m=Math.log(d/c)/t,v=function(E){return[a+E*p,l+E*h,c*Math.exp(t*E*m)]};else{var b=Math.sqrt(w),g=(d*d-c*c+o*w)/(2*c*n*b),x=(d*d-c*c-o*w)/(2*d*n*b),N=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(x*x+1)-x);m=(S-N)/t,v=function(E){var D=E*m,k=io(N),V=c/(n*b)*(k*hl(t*D+N)-fl(N));return[a+V*p,l+V*h,c*k/io(t*D+N)]}}return v.duration=m*1e3*t/Math.SQRT2,v}return r.rho=function(s){var i=Math.max(.001,+s),a=i*i,l=a*a;return e(i,a,l)},r})(Math.SQRT2,2,4);var Xe=0,Je=0,Ue=0,br=1e3,At,et,Pt=0,ze=0,Ot=0,rt=typeof performance=="object"&&performance.now?performance:Date,Sr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Cn(){return ze||(Sr(gl),ze=rt.now()+Ot)}function gl(){ze=0}function Tt(){this._call=this._time=this._next=null}Tt.prototype=Er.prototype={constructor:Tt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Cn():+n)+(t==null?0:+t),!this._next&&et!==this&&(et?et._next=this:At=this,et=this),this._call=e,this._time=n,hn()},stop:function(){this._call&&(this._call=null,this._time=1/0,hn())}};function Er(e,t,n){var o=new Tt;return o.restart(e,t,n),o}function pl(){Cn(),++Xe;for(var e=At,t;e;)(t=ze-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Xe}function so(){ze=(Pt=rt.now())+Ot,Xe=Je=0;try{pl()}finally{Xe=0,yl(),ze=0}}function ml(){var e=rt.now(),t=e-Pt;t>br&&(Ot-=t,Pt=e)}function yl(){for(var e,t=At,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:At=n);et=e,hn(o)}function hn(e){if(!Xe){Je&&(Je=clearTimeout(Je));var t=e-ze;t>24?(e<1/0&&(Je=setTimeout(so,e-rt.now()-Ot)),Ue&&(Ue=clearInterval(Ue))):(Ue||(Pt=rt.now(),Ue=setInterval(ml,br)),Xe=1,Sr(so))}}function ao(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 xl=jt("start","end","cancel","interrupt"),wl=[],Cr=0,co=1,gn=2,Nt=3,lo=4,pn=5,Mt=6;function Bt(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;vl(e,n,{name:t,index:o,group:r,on:xl,tween:wl,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Cr})}function Nn(e,t){var n=we(e,t);if(n.state>Cr)throw new Error("too late; already scheduled");return n}function be(e,t){var n=we(e,t);if(n.state>Nt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function vl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Er(s,0,n.time);function s(c){n.state=co,n.timer.restart(i,n.delay,n.time),n.delay<=c&&i(c-n.delay)}function i(c){var u,f,d,p;if(n.state!==co)return l();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Nt)return ao(i);p.state===lo?(p.state=Mt,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=Mt,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if(ao(function(){n.state===Nt&&(n.state=lo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=gn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===gn){for(n.state=Nt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=p);r.length=f+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=pn,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===pn&&(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,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){s=!1;continue}r=o.state>gn&&o.state<pn,o.state=Mt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function _l(e){return this.each(function(){It(this,e)})}function bl(e,t){var n,o;return function(){var r=be(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function Sl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=be(this,e),i=s.tween;if(i!==o){r=(o=i).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)}s.tween=r}}function El(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,r=0,s=o.length,i;r<s;++r)if((i=o[r]).name===e)return i.value;return null}return this.each((t==null?bl:Sl)(n,e,t))}function Mn(e,t,n){var o=e._id;return e.each(function(){var r=be(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return we(r,o).value[t]}}function Nr(e,t){var n;return(typeof t=="number"?Te:t instanceof eo?Jn:(n=eo(t))?(t=n,Jn):xa)(e,t)}function Cl(e){return function(){this.removeAttribute(e)}}function Nl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ml(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttribute(e);return i===r?null:i===o?s:s=t(o=i,n)}}function Il(e,t,n){var o,r=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===r?null:i===o?s:s=t(o=i,n)}}function kl(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function Al(e,t,n){var o,r,s;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a)))}}function Pl(e,t){var n=Vt(e),o=n==="transform"?ul:Nr;return this.attrTween(e,typeof t=="function"?(n.local?Al:kl)(n,o,Mn(this,"attr."+e,t)):t==null?(n.local?Nl:Cl)(n):(n.local?Il:Ml)(n,o,t))}function Tl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Dl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function $l(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Dl(e,s)),n}return r._value=t,r}function zl(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Tl(e,s)),n}return r._value=t,r}function Ll(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=Vt(e);return this.tween(n,(o.local?$l:zl)(o,t))}function Hl(e,t){return function(){Nn(this,e).delay=+t.apply(this,arguments)}}function Rl(e,t){return t=+t,function(){Nn(this,e).delay=t}}function jl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Hl:Rl)(t,e)):we(this.node(),t).delay}function Vl(e,t){return function(){be(this,e).duration=+t.apply(this,arguments)}}function Ol(e,t){return t=+t,function(){be(this,e).duration=t}}function Bl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Vl:Ol)(t,e)):we(this.node(),t).duration}function Fl(e,t){if(typeof t!="function")throw new Error;return function(){be(this,e).ease=t}}function Xl(e){var t=this._id;return arguments.length?this.each(Fl(t,e)):we(this.node(),t).ease}function Yl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;be(this,e).ease=n}}function Zl(e){if(typeof e!="function")throw new Error;return this.each(Yl(this._id,e))}function Wl(e){typeof e!="function"&&(e=ar(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var s=t[r],i=s.length,a=o[r]=[],l,c=0;c<i;++c)(l=s[c])&&e.call(l,l.__data__,c,s)&&a.push(l);return new Ce(o,this._parents,this._name,this._id)}function Gl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,s=Math.min(o,r),i=new Array(o),a=0;a<s;++a)for(var l=t[a],c=n[a],u=l.length,f=i[a]=new Array(u),d,p=0;p<u;++p)(d=l[p]||c[p])&&(f[p]=d);for(;a<o;++a)i[a]=t[a];return new Ce(i,this._parents,this._name,this._id)}function ql(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 Kl(e,t,n){var o,r,s=ql(t)?Nn:be;return function(){var i=s(this,e),a=i.on;a!==o&&(r=(o=a).copy()).on(t,n),i.on=r}}function Ul(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Kl(n,e,t))}function Ql(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",Ql(this._id))}function eu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Sn(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var a=o[i],l=a.length,c=s[i]=new Array(l),u,f,d=0;d<l;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),c[d]=f,Bt(c[d],t,n,d,c,we(u,n)));return new Ce(s,this._parents,t,n)}function tu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=sr(e));for(var o=this._groups,r=o.length,s=[],i=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,f=0;f<c;++f)if(u=l[f]){for(var d=e.call(u,u.__data__,f,l),p,h=we(u,n),w=0,v=d.length;w<v;++w)(p=d[w])&&Bt(p,t,n,w,d,h);s.push(d),i.push(u)}return new Ce(s,i,t,n)}var nu=ut.prototype.constructor;function ou(){return new nu(this._groups,this._parents)}function ru(e,t){var n,o,r;return function(){var s=Fe(this,e),i=(this.style.removeProperty(e),Fe(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function Mr(e){return function(){this.style.removeProperty(e)}}function iu(e,t,n){var o,r=n+"",s;return function(){var i=Fe(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function su(e,t,n){var o,r,s;return function(){var i=Fe(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Fe(this,e))),i===l?null:i===o&&l===r?s:(r=l,s=t(o=i,a))}}function au(e,t){var n,o,r,s="style."+t,i="end."+s,a;return function(){var l=be(this,e),c=l.on,u=l.value[s]==null?a||(a=Mr(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(i,r=u),l.on=o}}function cu(e,t,n){var o=(e+="")=="transform"?ll:Nr;return t==null?this.styleTween(e,ru(e,o)).on("end.style."+e,Mr(e)):typeof t=="function"?this.styleTween(e,su(e,o,Mn(this,"style."+e,t))).each(au(this._id,e)):this.styleTween(e,iu(e,o,t),n).on("end.style."+e,null)}function lu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function uu(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&lu(e,i,n)),o}return s._value=t,s}function du(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,uu(e,t,n??""))}function fu(e){return function(){this.textContent=e}}function hu(e){return function(){var t=e(this);this.textContent=t??""}}function gu(e){return this.tween("text",typeof e=="function"?hu(Mn(this,"text",e)):fu(e==null?"":e+""))}function pu(e){return function(t){this.textContent=e.call(this,t)}}function mu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&pu(r)),t}return o._value=e,o}function yu(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,mu(e))}function xu(){for(var e=this._name,t=this._id,n=Ir(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)if(l=i[c]){var u=we(l,t);Bt(l,e,n,c,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ce(o,this._parents,e,n)}function wu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var a={value:i},l={value:function(){--r===0&&s()}};n.each(function(){var c=be(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&s()})}var vu=0;function Ce(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ir(){return++vu}var Se=ut.prototype;Ce.prototype={constructor:Ce,select:eu,selectAll:tu,selectChild:Se.selectChild,selectChildren:Se.selectChildren,filter:Wl,merge:Gl,selection:ou,transition:xu,call:Se.call,nodes:Se.nodes,node:Se.node,size:Se.size,empty:Se.empty,each:Se.each,on:Ul,attr:Pl,attrTween:Ll,style:cu,styleTween:du,text:gu,textTween:yu,remove:Jl,tween:El,delay:jl,duration:Bl,ease:Xl,easeVarying:Zl,end:wu,[Symbol.iterator]:Se[Symbol.iterator]};function _u(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var bu={time:null,delay:0,duration:250,ease:_u};function Su(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 Eu(e){var t,n;e instanceof Ce?(t=e._id,e=e._name):(t=Ir(),(n=bu).time=Cn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],a=i.length,l,c=0;c<a;++c)(l=i[c])&&Bt(l,e,t,c,i,n||Su(l,t));return new Ce(o,this._parents,e,t)}ut.prototype.interrupt=_l;ut.prototype.transition=Eu;const xt=e=>()=>e;function Cu(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 Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(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 Ft=new Ee(1,0,0);kr.prototype=Ee.prototype;function kr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ft;return e.__zoom}function on(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Nu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Mu(){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 uo(){return this.__zoom||Ft}function Iu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ku(){return navigator.maxTouchPoints||"ontouchstart"in this}function Au(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function Ar(){var e=Nu,t=Mu,n=Au,o=Iu,r=ku,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ct,c=jt("start","zoom","end"),u,f,d,p=500,h=150,w=0,v=10;function m(y){y.property("__zoom",uo).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",A).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,M,C,P){var T=y.selection?y.selection():y;T.property("__zoom",uo),y!==T?N(y,M,C,P):T.interrupt().each(function(){S(this,arguments).event(P).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},m.scaleBy=function(y,M,C,P){m.scaleTo(y,function(){var T=this.__zoom.k,I=typeof M=="function"?M.apply(this,arguments):M;return T*I},C,P)},m.scaleTo=function(y,M,C,P){m.transform(y,function(){var T=t.apply(this,arguments),I=this.__zoom,H=C==null?x(T):typeof C=="function"?C.apply(this,arguments):C,j=I.invert(H),R=typeof M=="function"?M.apply(this,arguments):M;return n(g(b(I,R),H,j),T,i)},C,P)},m.translateBy=function(y,M,C,P){m.transform(y,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),i)},null,P)},m.translateTo=function(y,M,C,P,T){m.transform(y,function(){var I=t.apply(this,arguments),H=this.__zoom,j=P==null?x(I):typeof P=="function"?P.apply(this,arguments):P;return n(Ft.translate(j[0],j[1]).scale(H.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof C=="function"?-C.apply(this,arguments):-C),I,i)},P,T)};function b(y,M){return M=Math.max(s[0],Math.min(s[1],M)),M===y.k?y:new Ee(M,y.x,y.y)}function g(y,M,C){var P=M[0]-C[0]*y.k,T=M[1]-C[1]*y.k;return P===y.x&&T===y.y?y:new Ee(y.k,P,T)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,M,C,P){y.on("start.zoom",function(){S(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(P).end()}).tween("zoom",function(){var T=this,I=arguments,H=S(T,I).event(P),j=t.apply(T,I),R=C==null?x(j):typeof C=="function"?C.apply(T,I):C,F=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),B=T.__zoom,G=typeof M=="function"?M.apply(T,I):M,K=l(B.invert(R).concat(F/B.k),G.invert(R).concat(F/G.k));return function(W){if(W===1)W=G;else{var O=K(W),X=F/O[2];W=new Ee(X,R[0]-O[0]*X,R[1]-O[1]*X)}H.zoom(null,W)}})}function S(y,M,C){return!C&&y.__zooming||new E(y,M)}function E(y,M){this.that=y,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,M),this.taps=0}E.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,M){return this.mouse&&y!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var M=de(this.that).datum();c.call(y,this.that,new Cu(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),M)}};function D(y,...M){if(!e.apply(this,arguments))return;var C=S(this,M).event(y),P=this.__zoom,T=Math.max(s[0],Math.min(s[1],P.k*Math.pow(2,o.apply(this,arguments)))),I=me(y);if(C.wheel)(C.mouse[0][0]!==I[0]||C.mouse[0][1]!==I[1])&&(C.mouse[1]=P.invert(C.mouse[0]=I)),clearTimeout(C.wheel);else{if(P.k===T)return;C.mouse=[I,P.invert(I)],It(this),C.start()}Qe(y),C.wheel=setTimeout(H,h),C.zoom("mouse",n(g(b(P,T),C.mouse[0],C.mouse[1]),C.extent,i));function H(){C.wheel=null,C.end()}}function k(y,...M){if(d||!e.apply(this,arguments))return;var C=y.currentTarget,P=S(this,M,!0).event(y),T=de(y.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),I=me(y,C),H=y.clientX,j=y.clientY;yr(y.view),on(y),P.mouse=[I,this.__zoom.invert(I)],It(this),P.start();function R(B){if(Qe(B),!P.moved){var G=B.clientX-H,K=B.clientY-j;P.moved=G*G+K*K>w}P.event(B).zoom("mouse",n(g(P.that.__zoom,P.mouse[0]=me(B,C),P.mouse[1]),P.extent,i))}function F(B){T.on("mousemove.zoom mouseup.zoom",null),xr(B.view,P.moved),Qe(B),P.event(B).end()}}function V(y,...M){if(e.apply(this,arguments)){var C=this.__zoom,P=me(y.changedTouches?y.changedTouches[0]:y,this),T=C.invert(P),I=C.k*(y.shiftKey?.5:2),H=n(g(b(C,I),P,T),t.apply(this,M),i);Qe(y),a>0?de(this).transition().duration(a).call(N,H,P,y):de(this).call(m.transform,H,P,y)}}function A(y,...M){if(e.apply(this,arguments)){var C=y.touches,P=C.length,T=S(this,M,y.changedTouches.length===P).event(y),I,H,j,R;for(on(y),H=0;H<P;++H)j=C[H],R=me(j,this),R=[R,this.__zoom.invert(R),j.identifier],T.touch0?!T.touch1&&T.touch0[2]!==R[2]&&(T.touch1=R,T.taps=0):(T.touch0=R,I=!0,T.taps=1+!!u);u&&(u=clearTimeout(u)),I&&(T.taps<2&&(f=R[0],u=setTimeout(function(){u=null},p)),It(this),T.start())}}function $(y,...M){if(this.__zooming){var C=S(this,M).event(y),P=y.changedTouches,T=P.length,I,H,j,R;for(Qe(y),I=0;I<T;++I)H=P[I],j=me(H,this),C.touch0&&C.touch0[2]===H.identifier?C.touch0[0]=j:C.touch1&&C.touch1[2]===H.identifier&&(C.touch1[0]=j);if(H=C.that.__zoom,C.touch1){var F=C.touch0[0],B=C.touch0[1],G=C.touch1[0],K=C.touch1[1],W=(W=G[0]-F[0])*W+(W=G[1]-F[1])*W,O=(O=K[0]-B[0])*O+(O=K[1]-B[1])*O;H=b(H,Math.sqrt(W/O)),j=[(F[0]+G[0])/2,(F[1]+G[1])/2],R=[(B[0]+K[0])/2,(B[1]+K[1])/2]}else if(C.touch0)j=C.touch0[0],R=C.touch0[1];else return;C.zoom("touch",n(g(H,j,R),C.extent,i))}}function L(y,...M){if(this.__zooming){var C=S(this,M).event(y),P=y.changedTouches,T=P.length,I,H;for(on(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),I=0;I<T;++I)H=P[I],C.touch0&&C.touch0[2]===H.identifier?delete C.touch0:C.touch1&&C.touch1[2]===H.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(H=me(H,this),Math.hypot(f[0]-H[0],f[1]-H[1])<v)){var j=de(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:xt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:xt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:xt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:xt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(s[0]=+y[0],s[1]=+y[1],m):[s[0],s[1]]},m.translateExtent=function(y){return arguments.length?(i[0][0]=+y[0][0],i[1][0]=+y[1][0],i[0][1]=+y[0][1],i[1][1]=+y[1][1],m):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(l=y,m):l},m.on=function(){var y=c.on.apply(c,arguments);return y===c?m:y},m.clickDistance=function(y){return arguments.length?(w=(y=+y)*y,m):Math.sqrt(w)},m.tapDistance=function(y){return arguments.length?(v=+y,m):v},m}const _e={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]],Pr=["Enter"," ","Escape"],Tr={"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 Ye;(function(e){e.Strict="strict",e.Loose="loose"})(Ye||(Ye={}));var $e;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})($e||($e={}));var st;(function(e){e.Partial="partial",e.Full="full"})(st||(st={}));const Dr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ke;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ke||(ke={}));var Dt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Dt||(Dt={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const fo={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function $r(e){return e===null?null:e?"valid":"invalid"}const zr=e=>"id"in e&&"source"in e&&"target"in e,Pu=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}=Ne(e),r=e.origin??t,s=n*r[0],i=o*r[1];return{x:e.position.x-s,y:e.position.y-i}},Tu=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const s=typeof r=="string";let i=!t.nodeLookup&&!s?r:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(r):In(r)?r:t.nodeLookup.get(r.id));const a=i?$t(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Xt(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Yt(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=Xt(n,$t(r)),o=!0)}),o?Yt(n):{x:0,y:0,width:0,height:0}},kn=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1)=>{const a={...gt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:f=!0,hidden:d=!1}=c;if(i&&!f||d)continue;const p=u.width??c.width??c.initialWidth??null,h=u.height??c.height??c.initialHeight??null,w=at(a,We(c)),v=(p??0)*(h??0),m=s&&w>0;(!c.internals.handleBounds||m||w>=v||c.dragging)&&l.push(c)}return l},Du=(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 $u(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 zu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=$u(e,i),l=ft(a),c=An(l,t,n,i?.minZoom??r,i?.maxZoom??s,i?.padding??.1);return await o.setViewport(c,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Lr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??o;let f=i.extent||r;if(i.extent==="parent"&&!i.expandParent)if(!a)s?.("005",_e.error005());else{const p=a.measured.width,h=a.measured.height;p&&h&&(f=[[l,c],[l+p,c+h]])}else a&&Ge(i.extent)&&(f=[[i.extent[0][0]+l,i.extent[0][1]+c],[i.extent[1][0]+l,i.extent[1][1]+c]]);const d=Ge(f)?Le(t,f,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&s?.("015",_e.error015()),{position:{x:d.x-l+(i.measured.width??0)*u[0],y:d.y-c+(i.measured.height??0)*u[1]},positionAbsolute:d}}async function Lu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const s=new Set(e.map(d=>d.id)),i=[];for(const d of n){if(d.deletable===!1)continue;const p=s.has(d.id),h=!p&&d.parentId&&i.find(w=>w.id===d.parentId);(p||h)&&i.push(d)}const a=new Set(t.map(d=>d.id)),l=o.filter(d=>d.deletable!==!1),u=Du(i,l);for(const d of l)a.has(d.id)&&!u.find(h=>h.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:i};const f=await r({nodes:i,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:i}:{edges:[],nodes:[]}:f}const Ze=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Le=(e={x:0,y:0},t,n)=>({x:Ze(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Ze(e.y,t[0][1],t[1][1]-(n?.height??0))});function Hr(e,t,n){const{width:o,height:r}=Ne(n),{x:s,y:i}=n.internals.positionAbsolute;return Le(e,[[s,i],[s+o,i+r]],t)}const ho=(e,t,n)=>e<t?Ze(Math.abs(e-t),1,t)/t:e>n?-Ze(Math.abs(e-n),1,t)/t:0,Rr=(e,t,n=15,o=40)=>{const r=ho(e.x,o,t.width-o)*n,s=ho(e.y,o,t.height-o)*n;return[r,s]},Xt=(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)}),mn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Yt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),We=(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}},$t=(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)}},jr=(e,t)=>Yt(Xt(mn(e),mn(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)},go=e=>ye(e.width)&&ye(e.height)&&ye(e.x)&&ye(e.y),ye=e=>!isNaN(e)&&isFinite(e),Hu=(e,t)=>{},ht=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),gt=({x:e,y:t},[n,o,r],s=!1,i=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?ht(a,i):a},zt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function je(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 Ru(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=je(e,n),r=je(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=je(e.top??e.y??0,n),r=je(e.bottom??e.y??0,n),s=je(e.left??e.x??0,t),i=je(e.right??e.x??0,t);return{top:o,right:i,bottom:r,left:s,x:s+i,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ju(e,t,n,o,r,s){const{x:i,y:a}=zt(e,[t,n,o]),{x:l,y:c}=zt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,f=s-c;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const An=(e,t,n,o,r,s)=>{const i=Ru(s,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,c=Math.min(a,l),u=Ze(c,o,r),f=e.x+e.width/2,d=e.y+e.height/2,p=t/2-f*u,h=n/2-d*u,w=ju(e,p,h,u,t,n),v={left:Math.min(w.left-i.left,0),top:Math.min(w.top-i.top,0),right:Math.min(w.right-i.right,0),bottom:Math.min(w.bottom-i.bottom,0)};return{x:p-v.left+v.right,y:h-v.top+v.bottom,zoom:u}},ct=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ge(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Vr(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Or(e,t={width:0,height:0},n,o,r){const s={...e},i=o.get(n);if(i){const a=i.origin||r;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function po(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Vu(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Ou(e){return{...Tr,...e||{}}}function tt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:s,y:i}=xe(e),a=gt({x:s-(r?.left??0),y:i-(r?.top??0)},o),{x:l,y:c}=n?ht(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const Pn=e=>({width:e.offsetWidth,height:e.offsetHeight}),Br=e=>e?.getRootNode?.()||window?.document,Bu=["INPUT","SELECT","TEXTAREA"];function Fr(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Bu.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Xr=e=>"clientX"in e,xe=(e,t)=>{const n=Xr(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)}},mo=(e,t,n,o,r)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:r,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Pn(i)}})};function Yr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:a}){const l=e*.125+r*.375+i*.375+n*.125,c=t*.125+s*.375+a*.375+o*.125,u=Math.abs(l-e),f=Math.abs(c-t);return[l,c,u,f]}function wt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function yo({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case Y.Left:return[t-wt(t-o,s),n];case Y.Right:return[t+wt(o-t,s),n];case Y.Top:return[t,n-wt(n-r,s)];case Y.Bottom:return[t,n+wt(r-n,s)]}}function Zr({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:s=Y.Top,curvature:i=.25}){const[a,l]=yo({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[c,u]=yo({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[f,d,p,h]=Yr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,f,d,p,h]}function Wr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,s=n<e?n+r:n-r,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[s,a,r,i]}function Fu({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:s="basic"}){if(s==="manual")return o;const i=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return i+a}function Xu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const s=Xt($t(e),$t(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return at(i,Yt(s))>0}const Yu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Zu=(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)),Wu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||Yu;let r;return zr(e)?r={...e}:r={...e,id:o(e)},Zu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Gr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,a]=Wr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,a]}const xo={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},Gu=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.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},wo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function qu({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:s,stepPosition:i}){const a=xo[t],l=xo[o],c={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+l.x*s,y:n.y+l.y*s},f=Gu({source:c,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",p=f[d];let h=[],w,v;const m={x:0,y:0},b={x:0,y:0},[,,g,x]=Wr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(w=r.x??c.x+(u.x-c.x)*i,v=r.y??(c.y+u.y)/2):(w=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*i);const S=[{x:w,y:c.y},{x:w,y:u.y}],E=[{x:c.x,y:v},{x:u.x,y:v}];a[d]===p?h=d==="x"?S:E:h=d==="x"?E:S}else{const S=[{x:c.x,y:u.y}],E=[{x:u.x,y:c.y}];if(d==="x"?h=a.x===p?E:S:h=a.y===p?S:E,t===o){const $=Math.abs(e[d]-n[d]);if($<=s){const L=Math.min(s-1,s-$);a[d]===p?m[d]=(c[d]>e[d]?-1:1)*L:b[d]=(u[d]>n[d]?-1:1)*L}}if(t!==o){const $=d==="x"?"y":"x",L=a[d]===l[$],y=c[$]>u[$],M=c[$]<u[$];(a[d]===1&&(!L&&y||L&&M)||a[d]!==1&&(!L&&M||L&&y))&&(h=d==="x"?S:E)}const D={x:c.x+m.x,y:c.y+m.y},k={x:u.x+b.x,y:u.y+b.y},V=Math.max(Math.abs(D.x-h[0].x),Math.abs(k.x-h[0].x)),A=Math.max(Math.abs(D.y-h[0].y),Math.abs(k.y-h[0].y));V>=A?(w=(D.x+k.x)/2,v=h[0].y):(w=h[0].x,v=(D.y+k.y)/2)}return[[e,{x:c.x+m.x,y:c.y+m.y},...h,{x:u.x+b.x,y:u.y+b.y},n],w,v,g,x]}function Ku(e,t,n,o){const r=Math.min(wo(e,t)/2,wo(t,n)/2,o),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+r*c},${i}Q ${s},${i} ${s},${i+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${i+r*l}Q ${s},${i} ${s+r*a},${i}`}function yn({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:s=Y.Top,borderRadius:i=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[f,d,p,h,w]=qu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:a,y:l},offset:c,stepPosition:u});return[f.reduce((m,b,g)=>{let x="";return g>0&&g<f.length-1?x=Ku(f[g-1],b,f[g+1],i):x=`${g===0?"M":"L"}${b.x} ${b.y}`,m+=x,m},""),d,p,h,w]}function vo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Uu(e){const{sourceNode:t,targetNode:n}=e;if(!vo(t)||!vo(n))return null;const o=t.internals.handleBounds||_o(t.handles),r=n.internals.handleBounds||_o(n.handles),s=bo(o?.source??[],e.sourceHandle),i=bo(e.connectionMode===Ye.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!s||!i)return e.onError?.("008",_e.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=s?.position||Y.Bottom,l=i?.position||Y.Top,c=He(t,s,a),u=He(n,i,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function _o(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 He(e,t,n=Y.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??Ne(e);if(o)return{x:r+i/2,y:s+a/2};switch(t?.position??n){case Y.Top:return{x:r+i/2,y:s};case Y.Right:return{x:r+i,y:s+a/2};case Y.Bottom:return{x:r+i/2,y:s+a};case Y.Left:return{x:r,y:s+a/2}}}function bo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function xn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Qu(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=xn(l,t);s.has(c)||(i.push({id:c,color:l.color||n,...l}),s.add(c))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const qr=1e3,Ju=10,Tn={nodeOrigin:[0,0],nodeExtent:it,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ed={...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 td(e,t,n){const o=Dn(Tn,n);for(const r of e.values())if(r.parentId)zn(r,e,t,o);else{const s=dt(r,o.nodeOrigin),i=Ge(r.extent)?r.extent:o.nodeExtent,a=Le(s,i,Ne(r));r.internals.positionAbsolute=a}}function nd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const s={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(s):r.type==="target"&&o.push(s)}return{source:n,target:o}}function $n(e){return e==="manual"}function wn(e,t,n,o={}){const r=Dn(ed,o),s={i:0},i=new Map(t),a=r?.elevateNodesOnSelect&&!$n(r.zIndexMode)?qr:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=i.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const f=dt(c,r.nodeOrigin),d=Ge(c.extent)?c.extent:r.nodeExtent,p=Le(f,d,Ne(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:p,handleBounds:nd(c,u),z:Kr(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&zn(u,t,n,o,s)}return l}function od(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 zn(e,t,n,o,r){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:l}=Dn(Tn,o),c=e.parentId,u=t.get(c);if(!u){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}od(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Ju),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=s&&!$n(l)?qr:0,{x:d,y:p,z:h}=rd(e,u,i,a,f,l),{positionAbsolute:w}=e.internals,v=d!==w.x||p!==w.y;(v||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:d,y:p}:w,z:h}})}function Kr(e,t,n){const o=ye(e.zIndex)?e.zIndex:0;return $n(n)?o:o+(e.selected?t:0)}function rd(e,t,n,o,r,s){const{x:i,y:a}=t.internals.positionAbsolute,l=Ne(e),c=dt(e,n),u=Ge(e.extent)?Le(c,e.extent,l):c;let f=Le({x:i+u.x,y:a+u.y},o,l);e.extent==="parent"&&(f=Hr(f,l,t));const d=Kr(e,r,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=d?p+1:d}}function Ln(e,t,n,o=[0,0]){const r=[],s=new Map;for(const i of e){const a=t.get(i.parentId);if(!a)continue;const l=s.get(i.parentId)?.expandedRect??We(a),c=jr(l,i.rect);s.set(i.parentId,{expandedRect:c,parent:a})}return s.size>0&&s.forEach(({expandedRect:i,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),f=a.origin??o,d=i.x<c.x?Math.round(Math.abs(c.x-i.x)):0,p=i.y<c.y?Math.round(Math.abs(c.y-i.y)):0,h=Math.max(u.width,Math.round(i.width)),w=Math.max(u.height,Math.round(i.height)),v=(h-u.width)*f[0],m=(w-u.height)*f[1];(d>0||p>0||v||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-d+v,y:a.position.y-p+m}}),n.get(l)?.forEach(b=>{e.some(g=>g.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+p}})})),(u.width<i.width||u.height<i.height||d||p)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?f[0]*d-v:0),height:w+(p?f[1]*p-m:0)}})}),r}function id(e,t,n,o,r,s,i){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const p of e.values()){const h=t.get(p.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),l=!0;continue}const w=Pn(p.nodeElement),v=h.measured.width!==w.width||h.measured.height!==w.height;if(!!(w.width&&w.height&&(v||!h.internals.handleBounds||p.force))){const b=p.nodeElement.getBoundingClientRect(),g=Ge(h.extent)?h.extent:s;let{positionAbsolute:x}=h.internals;h.parentId&&h.extent==="parent"?x=Hr(x,w,t.get(h.parentId)):g&&(x=Le(x,g,w));const N={...h,measured:w,internals:{...h.internals,positionAbsolute:x,handleBounds:{source:mo("source",p.nodeElement,b,f,h.id),target:mo("target",p.nodeElement,b,f,h.id)}}};t.set(h.id,N),h.parentId&&zn(N,t,n,{nodeOrigin:r,zIndexMode:i}),l=!0,v&&(c.push({id:h.id,type:"dimensions",dimensions:w}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:We(N,r)}))}}if(d.length>0){const p=Ln(d,t,n,r);c.push(...p)}return{changes:c,updatedInternals:l}}async function sd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,s]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function So(e,t,n,o,r,s){let i=r;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${r}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),s){i=`${r}-${e}-${s}`;const c=o.get(i)||new Map;o.set(i,c.set(n,t))}}function Ur(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:s,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:s,sourceHandle:i,targetHandle:a},c=`${r}-${i}--${s}-${a}`,u=`${s}-${a}--${r}-${i}`;So("source",l,u,e,r,i),So("target",l,c,e,s,a),t.set(o.id,o)}}function Qr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Qr(n,t):!1}function Eo(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 ad(e,t,n,o){const r=new Map;for(const[s,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!Qr(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&r.set(s,{id:s,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function rn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[i,a]of t){const l=n.get(i)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:o}:r[0],r]}function cd({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const s={x:n-r.distance.x,y:o-r.distance.y},i=ht(s,t);return{x:i.x-s.x,y:i.y-s.y}}function ld({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let s={x:null,y:null},i=0,a=new Map,l=!1,c={x:0,y:0},u=null,f=!1,d=null,p=!1,h=!1,w=null;function v({noDragClassName:b,handleSelector:g,domNode:x,isSelectable:N,nodeId:S,nodeClickDistance:E=0}){d=de(x);function D({x:$,y:L}){const{nodeLookup:y,nodeExtent:M,snapGrid:C,snapToGrid:P,nodeOrigin:T,onNodeDrag:I,onSelectionDrag:H,onError:j,updateNodePositions:R}=t();s={x:$,y:L};let F=!1;const B=a.size>1,G=B&&M?mn(ft(a)):null,K=B&&P?cd({dragItems:a,snapGrid:C,x:$,y:L}):null;for(const[W,O]of a){if(!y.has(W))continue;let X={x:$-O.distance.x,y:L-O.distance.y};P&&(X=K?{x:Math.round(X.x+K.x),y:Math.round(X.y+K.y)}:ht(X,C));let Q=null;if(B&&M&&!O.extent&&G){const{positionAbsolute:q}=O.internals,ee=q.x-G.x+M[0][0],ne=q.x+O.measured.width-G.x2+M[1][0],te=q.y-G.y+M[0][1],se=q.y+O.measured.height-G.y2+M[1][1];Q=[[ee,te],[ne,se]]}const{position:U,positionAbsolute:Z}=Lr({nodeId:W,nextPosition:X,nodeLookup:y,nodeExtent:Q||M,nodeOrigin:T,onError:j});F=F||O.position.x!==U.x||O.position.y!==U.y,O.position=U,O.internals.positionAbsolute=Z}if(h=h||F,!!F&&(R(a,!0),w&&(o||I||!S&&H))){const[W,O]=rn({nodeId:S,dragItems:a,nodeLookup:y});o?.(w,a,W,O),I?.(w,W,O),S||H?.(w,O)}}async function k(){if(!u)return;const{transform:$,panBy:L,autoPanSpeed:y,autoPanOnNodeDrag:M}=t();if(!M){l=!1,cancelAnimationFrame(i);return}const[C,P]=Rr(c,u,y);(C!==0||P!==0)&&(s.x=(s.x??0)-C/$[2],s.y=(s.y??0)-P/$[2],await L({x:C,y:P})&&D(s)),i=requestAnimationFrame(k)}function V($){const{nodeLookup:L,multiSelectionActive:y,nodesDraggable:M,transform:C,snapGrid:P,snapToGrid:T,selectNodesOnDrag:I,onNodeDragStart:H,onSelectionDragStart:j,unselectNodesAndEdges:R}=t();f=!0,(!I||!N)&&!y&&S&&(L.get(S)?.selected||R()),N&&I&&S&&e?.(S);const F=tt($.sourceEvent,{transform:C,snapGrid:P,snapToGrid:T,containerBounds:u});if(s=F,a=ad(L,M,F,S),a.size>0&&(n||H||!S&&j)){const[B,G]=rn({nodeId:S,dragItems:a,nodeLookup:L});n?.($.sourceEvent,a,B,G),H?.($.sourceEvent,B,G),S||j?.($.sourceEvent,G)}}const A=wr().clickDistance(E).on("start",$=>{const{domNode:L,nodeDragThreshold:y,transform:M,snapGrid:C,snapToGrid:P}=t();u=L?.getBoundingClientRect()||null,p=!1,h=!1,w=$.sourceEvent,y===0&&V($),s=tt($.sourceEvent,{transform:M,snapGrid:C,snapToGrid:P,containerBounds:u}),c=xe($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:L,transform:y,snapGrid:M,snapToGrid:C,nodeDragThreshold:P,nodeLookup:T}=t(),I=tt($.sourceEvent,{transform:y,snapGrid:M,snapToGrid:C,containerBounds:u});if(w=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||S&&!T.has(S))&&(p=!0),!p){if(!l&&L&&f&&(l=!0,k()),!f){const H=xe($.sourceEvent,u),j=H.x-c.x,R=H.y-c.y;Math.sqrt(j*j+R*R)>P&&V($)}(s.x!==I.xSnapped||s.y!==I.ySnapped)&&a&&f&&(c=xe($.sourceEvent,u),D(I))}}).on("end",$=>{if(!(!f||p)&&(l=!1,f=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:L,updateNodePositions:y,onNodeDragStop:M,onSelectionDragStop:C}=t();if(h&&(y(a,!1),h=!1),r||M||!S&&C){const[P,T]=rn({nodeId:S,dragItems:a,nodeLookup:L,dragging:!1});r?.($.sourceEvent,a,P,T),M?.($.sourceEvent,P,T),S||C?.($.sourceEvent,T)}}}).filter($=>{const L=$.target;return!$.button&&(!b||!Eo(L,`.${b}`,x))&&(!g||Eo(L,g,x))});d.call(A)}function m(){d?.on(".drag",null)}return{update:v,destroy:m}}function ud(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())at(r,We(s))>0&&o.push(s);return o}const dd=250;function fd(e,t,n,o){let r=[],s=1/0;const i=ud(e,n,t+dd);for(const a of i){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:u,y:f}=He(a,c,c.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<s?(r=[{...c,x:u,y:f}],s=d):d===s&&r.push({...c,x:u,y:f}))}}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 Jr(e,t,n,o,r,s=!1){const i=o.get(e);if(!i)return null;const a=r==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&s?{...l,...He(i,l,l.position,!0)}:l}function ei(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function hd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ti=()=>!0;function gd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:p,onConnectStart:h,onConnect:w,onConnectEnd:v,isValidConnection:m=ti,onReconnectEnd:b,updateConnection:g,getTransform:x,getFromHandle:N,autoPanSpeed:S,dragThreshold:E=1,handleDomNode:D}){const k=Br(e.target);let V=0,A;const{x:$,y:L}=xe(e),y=ei(s,D),M=a?.getBoundingClientRect();let C=!1;if(!M||!y)return;const P=Jr(r,y,o,l,t);if(!P)return;let T=xe(e,M),I=!1,H=null,j=!1,R=null;function F(){if(!u||!M)return;const[U,Z]=Rr(T,M,S);d({x:U,y:Z}),V=requestAnimationFrame(F)}const B={...P,nodeId:r,type:y,position:P.position},G=l.get(r);let W={inProgress:!0,isValid:null,from:He(G,B,Y.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:G,to:T,toHandle:null,toPosition:fo[B.position],toNode:null,pointer:T};function O(){C=!0,g(W),h?.(e,{nodeId:r,handleId:o,handleType:y})}E===0&&O();function X(U){if(!C){const{x:se,y:ce}=xe(U),le=se-$,oe=ce-L;if(!(le*le+oe*oe>E*E))return;O()}if(!N()||!B){Q(U);return}const Z=x();T=xe(U,M),A=fd(gt(T,Z,!1,[1,1]),n,l,B),I||(F(),I=!0);const q=ni(U,{handle:A,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:i?"target":"source",isValidConnection:m,doc:k,lib:c,flowId:f,nodeLookup:l});R=q.handleDomNode,H=q.connection,j=hd(!!A,q.isValid);const ee=l.get(r),ne=ee?He(ee,B,Y.Left,!0):W.from,te={...W,from:ne,isValid:j,to:q.toHandle&&j?zt({x:q.toHandle.x,y:q.toHandle.y},Z):T,toHandle:q.toHandle,toPosition:j&&q.toHandle?q.toHandle.position:fo[B.position],toNode:q.toHandle?l.get(q.toHandle.nodeId):null,pointer:T};g(te),W=te}function Q(U){if(!("touches"in U&&U.touches.length>0)){if(C){(A||R)&&H&&j&&w?.(H);const{inProgress:Z,...q}=W,ee={...q,toPosition:W.toHandle?W.toPosition:null};v?.(U,ee),s&&b?.(U,ee)}p(),cancelAnimationFrame(V),I=!1,j=!1,H=null,R=null,k.removeEventListener("mousemove",X),k.removeEventListener("mouseup",Q),k.removeEventListener("touchmove",X),k.removeEventListener("touchend",Q)}}k.addEventListener("mousemove",X),k.addEventListener("mouseup",Q),k.addEventListener("touchmove",X),k.addEventListener("touchend",Q)}function ni(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:s,doc:i,lib:a,flowId:l,isValidConnection:c=ti,nodeLookup:u}){const f=s==="target",d=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:h}=xe(e),w=i.elementFromPoint(p,h),v=w?.classList.contains(`${a}-flow__handle`)?w:d,m={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=ei(void 0,v),g=v.getAttribute("data-nodeid"),x=v.getAttribute("data-handleid"),N=v.classList.contains("connectable"),S=v.classList.contains("connectableend");if(!g||!b)return m;const E={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};m.connection=E;const k=N&&S&&(n===Ye.Strict?f&&b==="source"||!f&&b==="target":g!==o||x!==r);m.isValid=k&&c(E),m.toHandle=Jr(g,b,x,u,n,!0)}return m}const vn={onPointerDown:gd,isValid:ni};function pd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=de(e);function s({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:p=!1}){const h=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const x=n(),N=g.sourceEvent.ctrlKey&&ct()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,E=x[2]*Math.pow(2,S*N);t.scaleTo(E)};let w=[0,0];const v=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const N=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[N[0]-w[0],N[1]-w[1]];w=N;const E=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),D={x:x[0]-S[0]*E,y:x[1]-S[1]*E},k=[[0,0],[l,c]];t.setViewportConstrained({x:D.x,y:D.y,zoom:x[2]},k,a)},b=Ar().on("start",v).on("zoom",f?m:null).on("zoom.wheel",d?h:null);r.call(b,{})}function i(){r.on("zoom",null)}return{update:s,destroy:i,pointer:me}}const Zt=e=>({x:e.x,y:e.y,zoom:e.k}),sn=({x:e,y:t,zoom:n})=>Ft.translate(e,t).scale(n),Ve=(e,t)=>e.target.closest(`.${t}`),oi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),md=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,an=(e,t=0,n=md,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ri=e=>{const t=e.ctrlKey&&ct()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function yd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Ve(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&i){const v=me(u),m=ri(u),b=f*Math.pow(2,m);o.scaleTo(n,b,v,u);return}const d=u.deltaMode===1?20:1;let p=r===$e.Vertical?0:u.deltaX*d,h=r===$e.Horizontal?0:u.deltaY*d;!ct()&&u.shiftKey&&r!==$e.Vertical&&(p=u.deltaY*d,h=0),o.translateBy(n,-(p/f)*s,-(h/f)*s,{internal:!0});const w=Zt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,w),e.panScrollTimeout=setTimeout(()=>{c?.(u,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,w))}}function xd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const s=o.type==="wheel",i=!t&&s&&!o.ctrlKey,a=Ve(o,e);if(o.ctrlKey&&s&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,r)}}function wd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Zt(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 vd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return s=>{e.usedRightMouseButton=!!(n&&oi(t,e.mouseButton??0)),s.sourceEvent?.sync||o([s.transform.x,s.transform.y,s.transform.k]),r&&!s.sourceEvent?.internal&&r?.(s.sourceEvent,Zt(s.transform))}}function _d({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:s}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&oi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=Zt(i.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(i.sourceEvent,a)},n?150:0)}}}function bd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return f=>{const d=e||t,p=n&&f.ctrlKey,h=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Ve(f,`${c}-flow__node`)||Ve(f,`${c}-flow__edge`)))return!0;if(!o&&!d&&!r&&!s&&!n||i||u&&!h||Ve(f,a)&&h||Ve(f,l)&&(!h||r&&h&&!e)||!n&&f.ctrlKey&&h)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!p&&h||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||h)&&w}}function Sd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=Ar().scaleExtent([t,n]).translateExtent(o),d=de(e).call(f);b({x:r.x,y:r.y,zoom:Ze(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const p=d.on("wheel.zoom"),h=d.on("dblclick.zoom");f.wheelDelta(ri);function w(A,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).transform(an(d,$?.duration,$?.ease,()=>L(!0)),A)}):Promise.resolve(!1)}function v({noWheelClassName:A,noPanClassName:$,onPaneContextMenu:L,userSelectionActive:y,panOnScroll:M,panOnDrag:C,panOnScrollMode:P,panOnScrollSpeed:T,preventScrolling:I,zoomOnPinch:H,zoomOnScroll:j,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:G,connectionInProgress:K,paneClickDistance:W,selectionOnDrag:O}){y&&!c.isZoomingOrPanning&&m();const X=M&&!F&&!y;f.clickDistance(O?1/0:!ye(W)||W<0?0:W);const Q=X?yd({zoomPanValues:c,noWheelClassName:A,d3Selection:d,d3Zoom:f,panOnScrollMode:P,panOnScrollSpeed:T,zoomOnPinch:H,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):xd({noWheelClassName:A,preventScrolling:I,d3ZoomHandler:p});if(d.on("wheel.zoom",Q,{passive:!1}),!y){const Z=wd({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:i});f.on("start",Z);const q=vd({zoomPanValues:c,panOnDrag:C,onPaneContextMenu:!!L,onPanZoom:s,onTransformChange:G});f.on("zoom",q);const ee=_d({zoomPanValues:c,panOnDrag:C,panOnScroll:M,onPaneContextMenu:L,onPanZoomEnd:a,onDraggingChange:l});f.on("end",ee)}const U=bd({zoomActivationKeyPressed:F,panOnDrag:C,zoomOnScroll:j,panOnScroll:M,zoomOnDoubleClick:R,zoomOnPinch:H,userSelectionActive:y,noPanClassName:$,noWheelClassName:A,lib:B,connectionInProgress:K});f.filter(U),R?d.on("dblclick.zoom",h):d.on("dblclick.zoom",null)}function m(){f.on("zoom",null)}async function b(A,$,L){const y=sn(A),M=f?.constrain()(y,$,L);return M&&await w(M),new Promise(C=>C(M))}async function g(A,$){const L=sn(A);return await w(L,$),new Promise(y=>y(L))}function x(A){if(d){const $=sn(A),L=d.property("__zoom");(L.k!==A.zoom||L.x!==A.x||L.y!==A.y)&&f?.transform(d,$,null,{sync:!0})}}function N(){const A=d?kr(d.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}function S(A,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).scaleTo(an(d,$?.duration,$?.ease,()=>L(!0)),A)}):Promise.resolve(!1)}function E(A,$){return d?new Promise(L=>{f?.interpolate($?.interpolate==="linear"?en:Ct).scaleBy(an(d,$?.duration,$?.ease,()=>L(!0)),A)}):Promise.resolve(!1)}function D(A){f?.scaleExtent(A)}function k(A){f?.translateExtent(A)}function V(A){const $=!ye(A)||A<0?0:A;f?.clickDistance($)}return{update:v,destroy:m,setViewport:g,setViewportConstrained:b,getViewport:N,scaleTo:S,scaleBy:E,setScaleExtent:D,setTranslateExtent:k,syncViewport:x,setClickDistance:V}}var qe;(function(e){e.Line="line",e.Handle="handle"})(qe||(qe={}));function Ed({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:s}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&r&&(l[0]=l[0]*-1),a&&s&&(l[1]=l[1]*-1),l}function Co(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 Me(e,t){return Math.max(0,t-e)}function Ie(e,t){return Math.max(0,e-t)}function vt(e,t,n){return Math.max(0,t-e,e-n)}function No(e,t){return e?!t:t}function Cd(e,t,n,o,r,s,i,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:p,ySnapped:h}=n,{minWidth:w,maxWidth:v,minHeight:m,maxHeight:b}=o,{x:g,y:x,width:N,height:S,aspectRatio:E}=e;let D=Math.floor(u?p-e.pointerX:0),k=Math.floor(f?h-e.pointerY:0);const V=N+(l?-D:D),A=S+(c?-k:k),$=-s[0]*N,L=-s[1]*S;let y=vt(V,w,v),M=vt(A,m,b);if(i){let T=0,I=0;l&&D<0?T=Me(g+D+$,i[0][0]):!l&&D>0&&(T=Ie(g+V+$,i[1][0])),c&&k<0?I=Me(x+k+L,i[0][1]):!c&&k>0&&(I=Ie(x+A+L,i[1][1])),y=Math.max(y,T),M=Math.max(M,I)}if(a){let T=0,I=0;l&&D>0?T=Ie(g+D,a[0][0]):!l&&D<0&&(T=Me(g+V,a[1][0])),c&&k>0?I=Ie(x+k,a[0][1]):!c&&k<0&&(I=Me(x+A,a[1][1])),y=Math.max(y,T),M=Math.max(M,I)}if(r){if(u){const T=vt(V/E,m,b)*E;if(y=Math.max(y,T),i){let I=0;!l&&!c||l&&!c&&d?I=Ie(x+L+V/E,i[1][1])*E:I=Me(x+L+(l?D:-D)/E,i[0][1])*E,y=Math.max(y,I)}if(a){let I=0;!l&&!c||l&&!c&&d?I=Me(x+V/E,a[1][1])*E:I=Ie(x+(l?D:-D)/E,a[0][1])*E,y=Math.max(y,I)}}if(f){const T=vt(A*E,w,v)/E;if(M=Math.max(M,T),i){let I=0;!l&&!c||c&&!l&&d?I=Ie(g+A*E+$,i[1][0])/E:I=Me(g+(c?k:-k)*E+$,i[0][0])/E,M=Math.max(M,I)}if(a){let I=0;!l&&!c||c&&!l&&d?I=Me(g+A*E,a[1][0])/E:I=Ie(g+(c?k:-k)*E,a[0][0])/E,M=Math.max(M,I)}}}k=k+(k<0?M:-M),D=D+(D<0?y:-y),r&&(d?V>A*E?k=(No(l,c)?-D:D)/E:D=(No(l,c)?-k:k)*E:u?(k=D/E,c=l):(D=k*E,l=c));const C=l?g+D:g,P=c?x+k:x;return{width:N+(l?-D:D),height:S+(c?-k:k),x:s[0]*D*(l?-1:1)+C,y:s[1]*k*(c?-1:1)+P}}const ii={width:0,height:0,x:0,y:0},Nd={...ii,pointerX:0,pointerY:0,aspectRatio:1};function Md(e){return[[0,0],[e.measured.width,e.measured.height]]}function Id(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,l=n[1]*i;return[[o-a,r-l],[o+s-a,r+i-l]]}function kd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const s=de(e);let i={controlDirection:Co("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:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:p,onResize:h,onResizeEnd:w,shouldResize:v}){let m={...ii},b={...Nd};i={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Co(c)};let g,x=null,N=[],S,E,D,k=!1;const V=wr().on("start",A=>{const{nodeLookup:$,transform:L,snapGrid:y,snapToGrid:M,nodeOrigin:C,paneDomNode:P}=n();if(g=$.get(t),!g)return;x=P?.getBoundingClientRect()??null;const{xSnapped:T,ySnapped:I}=tt(A.sourceEvent,{transform:L,snapGrid:y,snapToGrid:M,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},b={...m,pointerX:T,pointerY:I,aspectRatio:m.width/m.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=$.get(g.parentId),E=S&&g.extent==="parent"?Md(S):void 0),N=[],D=void 0;for(const[H,j]of $)if(j.parentId===t&&(N.push({id:H,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const R=Id(j,g,j.origin??C);D?D=[[Math.min(R[0][0],D[0][0]),Math.min(R[0][1],D[0][1])],[Math.max(R[1][0],D[1][0]),Math.max(R[1][1],D[1][1])]]:D=R}p?.(A,{...m})}).on("drag",A=>{const{transform:$,snapGrid:L,snapToGrid:y,nodeOrigin:M}=n(),C=tt(A.sourceEvent,{transform:$,snapGrid:L,snapToGrid:y,containerBounds:x}),P=[];if(!g)return;const{x:T,y:I,width:H,height:j}=m,R={},F=g.origin??M,{width:B,height:G,x:K,y:W}=Cd(b,i.controlDirection,C,i.boundaries,i.keepAspectRatio,F,E,D),O=B!==H,X=G!==j,Q=K!==T&&O,U=W!==I&&X;if(!Q&&!U&&!O&&!X)return;if((Q||U||F[0]===1||F[1]===1)&&(R.x=Q?K:m.x,R.y=U?W:m.y,m.x=R.x,m.y=R.y,N.length>0)){const ne=K-T,te=W-I;for(const se of N)se.position={x:se.position.x-ne+F[0]*(B-H),y:se.position.y-te+F[1]*(G-j)},P.push(se)}if((O||X)&&(R.width=O&&(!i.resizeDirection||i.resizeDirection==="horizontal")?B:m.width,R.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?G:m.height,m.width=R.width,m.height=R.height),S&&g.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 Z=Ed({width:m.width,prevWidth:H,height:m.height,prevHeight:j,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),q={...m,direction:Z};v?.(A,q)!==!1&&(k=!0,h?.(A,q),o(R,P))}).on("end",A=>{k&&(w?.(A,{...m}),r?.({...m}),k=!1)});s.call(V)}function l(){s.on(".drag",null)}return{update:a,destroy:l}}const Ad={},Mo=e=>{let t;const n=new Set,o=(u,f)=>{const d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){const p=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,p))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Ad?"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},Pd=e=>e?Mo(e):Mo,{useDebugValue:Td}=Zs,{useSyncExternalStoreWithSelector:Dd}=Ys,$d=e=>e;function si(e,t=$d,n){const o=Dd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Td(o),o}const Io=(e,t)=>{const n=Pd(e),o=(r,s=t)=>si(n,r,s);return Object.assign(o,n),o},zd=(e,t)=>e?Io(e,t):Io;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[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 Wt=z.createContext(null),Ld=Wt.Provider,ai=_e.error001();function J(e,t){const n=z.useContext(Wt);if(n===null)throw new Error(ai);return si(n,e,t)}function ie(){const e=z.useContext(Wt);if(e===null)throw new Error(ai);return z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ko={display:"none"},Hd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ci="react-flow__node-desc",li="react-flow__edge-desc",Rd="react-flow__aria-live",jd=e=>e.ariaLiveMessage,Vd=e=>e.ariaLabelConfig;function Od({rfId:e}){const t=J(jd);return _.jsx("div",{id:`${Rd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Hd,children:t})}function Bd({rfId:e,disableKeyboardA11y:t}){const n=J(Vd);return _.jsxs(_.Fragment,{children:[_.jsx("div",{id:`${ci}-${e}`,style:ko,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),_.jsx("div",{id:`${li}-${e}`,style:ko,children:n["edge.a11yDescription.default"]}),!t&&_.jsx(Od,{rfId:e})]})}const Gt=z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},s)=>{const i=`${e}`.split("-");return _.jsx("div",{className:ae(["react-flow__panel",n,...i]),style:o,ref:s,...r,children:t})});Gt.displayName="Panel";function Fd({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:_.jsx(Gt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:_.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Xd=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 Yd(e,t){return re(e.selectedNodes.map(_t),t.selectedNodes.map(_t))&&re(e.selectedEdges.map(_t),t.selectedEdges.map(_t))}function Zd({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=J(Xd,Yd);return z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(s=>s(r))},[n,o,e]),null}const Wd=e=>!!e.onSelectionChangeHandlers;function Gd({onSelectionChange:e}){const t=J(Wd);return e||t?_.jsx(Zd,{onSelectionChange:e}):null}const ui=[0,0],qd={x:0,y:0,zoom:1},Kd=["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"],Ao=[...Kd,"rfId"],Ud=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}),Po={translateExtent:it,nodeOrigin:ui,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Qd(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l}=J(Ud,re),c=ie();z.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=Po,a()}),[]);const u=z.useRef(Po);return z.useEffect(()=>{for(const f of Ao){const d=e[f],p=u.current[f];d!==p&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?s(d):f==="nodeExtent"?i(d):f==="ariaLabelConfig"?c.setState({ariaLabelConfig:Ou(d)}):f==="fitView"?c.setState({fitViewQueued:d}):f==="fitViewOptions"?c.setState({fitViewOptions:d}):c.setState({[f]:d})))}u.current=e},Ao.map(f=>e[f])),null}function To(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Jd(e){const[t,n]=z.useState(e==="system"?null:e);return z.useEffect(()=>{if(e!=="system"){n(e);return}const o=To(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:To()?.matches?"dark":"light"}const Do=typeof document<"u"?document:null;function lt(e=null,t={target:Do,actInsideInputWithModifier:!0}){const[n,o]=z.useState(!1),r=z.useRef(!1),s=z.useRef(new Set([])),[i,a]=z.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|