@iqworksai/common-components 0.1.5 → 0.1.7
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/components/DbSchemaBrowser/index.d.ts.map +1 -1
- package/dist/components/DbSchemaBrowser/types.d.ts +1 -1
- package/dist/components/DbSchemaBrowser/types.d.ts.map +1 -1
- package/dist/components/FileBrowser/index.d.ts.map +1 -1
- package/dist/index-6n5-C3qh.js +159 -0
- package/dist/index-BT9NbQL6.mjs +5204 -0
- package/dist/index-DP52KpOS.mjs +28446 -0
- package/dist/index-DozkkyY_.js +34 -0
- package/dist/index.cjs +1 -240
- package/dist/index.mjs +93 -41055
- package/dist/jquery-Cg-ZYQCq.js +13 -0
- package/dist/jquery-PS7a9kWs.mjs +3641 -0
- package/dist/jstree-C7qSDVkF.mjs +4249 -0
- package/dist/jstree-KNvGgmMd.js +37 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),gt=require("./index-6n5-C3qh.js"),Xo=require("react-dom");function ze(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var yn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,on=new RegExp(yn.source,"g");function Gi(e){return function(){return e}}function Zi(e){return function(t){return e(t)+""}}function qi(e,t){var n=yn.lastIndex=on.lastIndex=0,o,r,s,i=-1,c=[],a=[];for(e=e+"",t=t+"";(o=yn.exec(e))&&(r=on.exec(t));)(s=r.index)>n&&(s=t.slice(n,s),c[i]?c[i]+=s:c[++i]=s),(o=o[0])===(r=r[0])?c[i]?c[i]+=r:c[++i]=r:(c[++i]=null,a.push({i,x:ze(o,r)})),n=on.lastIndex;return n<t.length&&(s=t.slice(n),c[i]?c[i]+=s:c[++i]=s),c.length<2?a[0]?Zi(a[0].x):Gi(t):(t=a.length,function(u){for(var l=0,d;l<t;++l)c[(d=a[l]).i]=d.x(u);return c.join("")})}var ro=180/Math.PI,wn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Yo(e,t,n,o,r,s){var i,c,a;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(a=e*n+t*o)&&(n-=e*a,o-=t*a),(c=Math.sqrt(n*n+o*o))&&(n/=c,o/=c,a/=c),e*o<t*n&&(e=-e,t=-t,a=-a,i=-i),{translateX:r,translateY:s,rotate:Math.atan2(t,e)*ro,skewX:Math.atan(a)*ro,scaleX:i,scaleY:c}}var xt;function Qi(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?wn:Yo(t.a,t.b,t.c,t.d,t.e,t.f)}function Ji(e){return e==null||(xt||(xt=document.createElementNS("http://www.w3.org/2000/svg","g")),xt.setAttribute("transform",e),!(e=xt.transform.baseVal.consolidate()))?wn:(e=e.matrix,Yo(e.a,e.b,e.c,e.d,e.e,e.f))}function Uo(e,t,n,o){function r(u){return u.length?u.pop()+" ":""}function s(u,l,d,g,h,w){if(u!==d||l!==g){var m=h.push("translate(",null,t,null,n);w.push({i:m-4,x:ze(u,d)},{i:m-2,x:ze(l,g)})}else(d||g)&&h.push("translate("+d+t+g+n)}function i(u,l,d,g){u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),g.push({i:d.push(r(d)+"rotate(",null,o)-2,x:ze(u,l)})):l&&d.push(r(d)+"rotate("+l+o)}function c(u,l,d,g){u!==l?g.push({i:d.push(r(d)+"skewX(",null,o)-2,x:ze(u,l)}):l&&d.push(r(d)+"skewX("+l+o)}function a(u,l,d,g,h,w){if(u!==d||l!==g){var m=h.push(r(h)+"scale(",null,",",null,")");w.push({i:m-4,x:ze(u,d)},{i:m-2,x:ze(l,g)})}else(d!==1||g!==1)&&h.push(r(h)+"scale("+d+","+g+")")}return function(u,l){var d=[],g=[];return u=e(u),l=e(l),s(u.translateX,u.translateY,l.translateX,l.translateY,d,g),i(u.rotate,l.rotate,d,g),c(u.skewX,l.skewX,d,g),a(u.scaleX,u.scaleY,l.scaleX,l.scaleY,d,g),u=l=null,function(h){for(var w=-1,m=g.length,_;++w<m;)d[(_=g[w]).i]=_.x(h);return d.join("")}}}var ji=Uo(Qi,"px, ","px)","deg)"),es=Uo(Ji,", ",")",")"),ts=1e-12;function io(e){return((e=Math.exp(e))+1/e)/2}function ns(e){return((e=Math.exp(e))-1/e)/2}function os(e){return((e=Math.exp(2*e))-1)/(e+1)}const rs=function e(t,n,o){function r(s,i){var c=s[0],a=s[1],u=s[2],l=i[0],d=i[1],g=i[2],h=l-c,w=d-a,m=h*h+w*w,_,y;if(m<ts)y=Math.log(g/u)/t,_=function(P){return[c+P*h,a+P*w,u*Math.exp(t*P*y)]};else{var x=Math.sqrt(m),N=(g*g-u*u+o*m)/(2*u*n*x),S=(g*g-u*u-o*m)/(2*g*n*x),C=Math.log(Math.sqrt(N*N+1)-N),M=Math.log(Math.sqrt(S*S+1)-S);y=(M-C)/t,_=function(P){var D=P*y,k=io(C),B=u/(n*x)*(k*os(t*D+C)-ns(C));return[c+B*h,a+B*w,u*k/io(t*D+C)]}}return _.duration=y*1e3*t/Math.SQRT2,_}return r.rho=function(s){var i=Math.max(.001,+s),c=i*i,a=c*c;return e(i,c,a)},r}(Math.SQRT2,2,4);function se(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=se(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var _n={exports:{}},rn={},bt={exports:{}},sn={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* use-sync-external-store-shim.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var so;function is(){if(so)return sn;so=1;var e=f;function t(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function c(d,g){var h=g(),w=o({inst:{value:h,getSnapshot:g}}),m=w[0].inst,_=w[1];return s(function(){m.value=h,m.getSnapshot=g,a(m)&&_({inst:m})},[d,h,g]),r(function(){return a(m)&&_({inst:m}),d(function(){a(m)&&_({inst:m})})},[d]),i(h),h}function a(d){var g=d.getSnapshot;d=d.value;try{var h=g();return!n(d,h)}catch{return!0}}function u(d,g){return g()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:c;return sn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,sn}var cn={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* use-sync-external-store-shim.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var co;function ss(){return co||(co=1,process.env.NODE_ENV!=="production"&&function(){function e(h,w){return h===w&&(h!==0||1/h===1/w)||h!==h&&w!==w}function t(h,w){l||r.startTransition===void 0||(l=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=w();if(!d){var _=w();s(m,_)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}_=i({inst:{value:m,getSnapshot:w}});var y=_[0].inst,x=_[1];return a(function(){y.value=m,y.getSnapshot=w,n(y)&&x({inst:y})},[h,m,w]),c(function(){return n(y)&&x({inst:y}),h(function(){n(y)&&x({inst:y})})},[h]),u(m),m}function n(h){var w=h.getSnapshot;h=h.value;try{var m=w();return!s(h,m)}catch{return!0}}function o(h,w){return w()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=f,s=typeof Object.is=="function"?Object.is:e,i=r.useState,c=r.useEffect,a=r.useLayoutEffect,u=r.useDebugValue,l=!1,d=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;cn.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),cn}var ao;function Ko(){return ao||(ao=1,process.env.NODE_ENV==="production"?bt.exports=is():bt.exports=ss()),bt.exports}/**
|
|
18
|
+
* @license React
|
|
19
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var lo;function cs(){if(lo)return rn;lo=1;var e=f,t=Ko();function n(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,c=e.useMemo,a=e.useDebugValue;return rn.useSyncExternalStoreWithSelector=function(u,l,d,g,h){var w=s(null);if(w.current===null){var m={hasValue:!1,value:null};w.current=m}else m=w.current;w=c(function(){function y(M){if(!x){if(x=!0,N=M,M=g(M),h!==void 0&&m.hasValue){var P=m.value;if(h(P,M))return S=P}return S=M}if(P=S,o(N,M))return P;var D=g(M);return h!==void 0&&h(P,D)?(N=M,P):(N=M,S=D)}var x=!1,N,S,C=d===void 0?null:d;return[function(){return y(l())},C===null?void 0:function(){return y(C())}]},[l,d,g,h]);var _=r(u,w[0],w[1]);return i(function(){m.hasValue=!0,m.value=_},[_]),a(_),_},rn}var an={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var uo;function as(){return uo||(uo=1,process.env.NODE_ENV!=="production"&&function(){function e(u,l){return u===l&&(u!==0||1/u===1/l)||u!==u&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=Ko(),o=typeof Object.is=="function"?Object.is:e,r=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,a=t.useDebugValue;an.useSyncExternalStoreWithSelector=function(u,l,d,g,h){var w=s(null);if(w.current===null){var m={hasValue:!1,value:null};w.current=m}else m=w.current;w=c(function(){function y(M){if(!x){if(x=!0,N=M,M=g(M),h!==void 0&&m.hasValue){var P=m.value;if(h(P,M))return S=P}return S=M}if(P=S,o(N,M))return P;var D=g(M);return h!==void 0&&h(P,D)?(N=M,P):(N=M,S=D)}var x=!1,N,S,C=d===void 0?null:d;return[function(){return y(l())},C===null?void 0:function(){return y(C())}]},[l,d,g,h]);var _=r(u,w[0],w[1]);return i(function(){m.hasValue=!0,m.value=_},[_]),a(_),_},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),an}process.env.NODE_ENV==="production"?_n.exports=cs():_n.exports=as();var ls=_n.exports;const us=gt.getDefaultExportFromCjs(ls),ds={},fo=e=>{let t;const n=new Set,o=(l,d)=>{const g=typeof l=="function"?l(t):l;if(!Object.is(g,t)){const h=t;t=d??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(w=>w(t,h))}},r=()=>t,a={setState:o,getState:r,getInitialState:()=>u,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{(ds?"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()}},u=t=e(o,r,a);return a},fs=e=>e?fo(e):fo,{useDebugValue:hs}=f,{useSyncExternalStoreWithSelector:gs}=us,ps=e=>e;function Wo(e,t=ps,n){const o=gs(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hs(o),o}const ho=(e,t)=>{const n=fs(e),o=(r,s=t)=>Wo(n,r,s);return Object.assign(o,n),o},ms=(e,t)=>e?ho(e,t):ho;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var ys={value:()=>{}};function Ft(){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 kt(n)}function kt(e){this._=e}function ws(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}})}kt.prototype=Ft.prototype={constructor:kt,on:function(e,t){var n=this._,o=ws(e+"",n),r,s=-1,i=o.length;if(arguments.length<2){for(;++s<i;)if((r=(e=o[s]).type)&&(r=_s(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]=go(n[r],e.name,t);else if(t==null)for(r in n)n[r]=go(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 kt(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 _s(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function go(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ys,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Sn="http://www.w3.org/1999/xhtml";const po={svg:"http://www.w3.org/2000/svg",xhtml:Sn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),po.hasOwnProperty(t)?{space:po[t],local:e}:e}function Ss(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Sn&&t.documentElement.namespaceURI===Sn?t.createElement(e):t.createElementNS(n,e)}}function vs(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Go(e){var t=Xt(e);return(t.local?vs:Ss)(t)}function Es(){}function Dn(e){return e==null?Es:function(){return this.querySelector(e)}}function xs(e){typeof e!="function"&&(e=Dn(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,c=o[r]=new Array(i),a,u,l=0;l<i;++l)(a=s[l])&&(u=e.call(a,a.__data__,l,s))&&("__data__"in a&&(u.__data__=a.__data__),c[l]=u);return new he(o,this._parents)}function bs(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ns(){return[]}function Zo(e){return e==null?Ns:function(){return this.querySelectorAll(e)}}function Cs(e){return function(){return bs(e.apply(this,arguments))}}function Ms(e){typeof e=="function"?e=Cs(e):e=Zo(e);for(var t=this._groups,n=t.length,o=[],r=[],s=0;s<n;++s)for(var i=t[s],c=i.length,a,u=0;u<c;++u)(a=i[u])&&(o.push(e.call(a,a.__data__,u,i)),r.push(a));return new he(o,r)}function qo(e){return function(){return this.matches(e)}}function Qo(e){return function(t){return t.matches(e)}}var As=Array.prototype.find;function Ps(e){return function(){return As.call(this.children,e)}}function Ts(){return this.firstElementChild}function ks(e){return this.select(e==null?Ts:Ps(typeof e=="function"?e:Qo(e)))}var $s=Array.prototype.filter;function Is(){return Array.from(this.children)}function Ds(e){return function(){return $s.call(this.children,e)}}function Rs(e){return this.selectAll(e==null?Is:Ds(typeof e=="function"?e:Qo(e)))}function zs(e){typeof e!="function"&&(e=qo(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,c=o[r]=[],a,u=0;u<i;++u)(a=s[u])&&e.call(a,a.__data__,u,s)&&c.push(a);return new he(o,this._parents)}function Jo(e){return new Array(e.length)}function Os(){return new he(this._enter||this._groups.map(Jo),this._parents)}function Rt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Rt.prototype={constructor:Rt,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 Bs(e){return function(){return e}}function Vs(e,t,n,o,r,s){for(var i=0,c,a=t.length,u=s.length;i<u;++i)(c=t[i])?(c.__data__=s[i],o[i]=c):n[i]=new Rt(e,s[i]);for(;i<a;++i)(c=t[i])&&(r[i]=c)}function Ls(e,t,n,o,r,s,i){var c,a,u=new Map,l=t.length,d=s.length,g=new Array(l),h;for(c=0;c<l;++c)(a=t[c])&&(g[c]=h=i.call(a,a.__data__,c,t)+"",u.has(h)?r[c]=a:u.set(h,a));for(c=0;c<d;++c)h=i.call(e,s[c],c,s)+"",(a=u.get(h))?(o[c]=a,a.__data__=s[c],u.delete(h)):n[c]=new Rt(e,s[c]);for(c=0;c<l;++c)(a=t[c])&&u.get(g[c])===a&&(r[c]=a)}function Hs(e){return e.__data__}function Fs(e,t){if(!arguments.length)return Array.from(this,Hs);var n=t?Ls:Vs,o=this._parents,r=this._groups;typeof e!="function"&&(e=Bs(e));for(var s=r.length,i=new Array(s),c=new Array(s),a=new Array(s),u=0;u<s;++u){var l=o[u],d=r[u],g=d.length,h=Xs(e.call(l,l&&l.__data__,u,o)),w=h.length,m=c[u]=new Array(w),_=i[u]=new Array(w),y=a[u]=new Array(g);n(l,d,m,_,y,h,t);for(var x=0,N=0,S,C;x<w;++x)if(S=m[x]){for(x>=N&&(N=x+1);!(C=_[N])&&++N<w;);S._next=C||null}}return i=new he(i,o),i._enter=c,i._exit=a,i}function Xs(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ys(){return new he(this._exit||this._groups.map(Jo),this._parents)}function Us(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 Ks(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),c=new Array(r),a=0;a<i;++a)for(var u=n[a],l=o[a],d=u.length,g=c[a]=new Array(d),h,w=0;w<d;++w)(h=u[w]||l[w])&&(g[w]=h);for(;a<r;++a)c[a]=n[a];return new he(c,this._parents)}function Ws(){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 Gs(e){e||(e=Zs);function t(d,g){return d&&g?e(d.__data__,g.__data__):!d-!g}for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s){for(var i=n[s],c=i.length,a=r[s]=new Array(c),u,l=0;l<c;++l)(u=i[l])&&(a[l]=u);a.sort(t)}return new he(r,this._parents).order()}function Zs(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function qs(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Qs(){return Array.from(this)}function Js(){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 js(){let e=0;for(const t of this)++e;return e}function ec(){return!this.node()}function tc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],s=0,i=r.length,c;s<i;++s)(c=r[s])&&e.call(c,c.__data__,s,r);return this}function nc(e){return function(){this.removeAttribute(e)}}function oc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rc(e,t){return function(){this.setAttribute(e,t)}}function ic(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function cc(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 ac(e,t){var n=Xt(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?oc:nc:typeof t=="function"?n.local?cc:sc:n.local?ic:rc)(n,t))}function jo(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function lc(e){return function(){this.style.removeProperty(e)}}function uc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function fc(e,t,n){return arguments.length>1?this.each((t==null?lc:typeof t=="function"?dc:uc)(e,t,n??"")):tt(this.node(),e)}function tt(e,t){return e.style.getPropertyValue(t)||jo(e).getComputedStyle(e,null).getPropertyValue(t)}function hc(e){return function(){delete this[e]}}function gc(e,t){return function(){this[e]=t}}function pc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mc(e,t){return arguments.length>1?this.each((t==null?hc:typeof t=="function"?pc:gc)(e,t)):this.node()[e]}function er(e){return e.trim().split(/^|\s+/)}function Rn(e){return e.classList||new tr(e)}function tr(e){this._node=e,this._names=er(e.getAttribute("class")||"")}tr.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 nr(e,t){for(var n=Rn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function or(e,t){for(var n=Rn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function yc(e){return function(){nr(this,e)}}function wc(e){return function(){or(this,e)}}function _c(e,t){return function(){(t.apply(this,arguments)?nr:or)(this,e)}}function Sc(e,t){var n=er(e+"");if(arguments.length<2){for(var o=Rn(this.node()),r=-1,s=n.length;++r<s;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?_c:t?yc:wc)(n,t))}function vc(){this.textContent=""}function Ec(e){return function(){this.textContent=e}}function xc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function bc(e){return arguments.length?this.each(e==null?vc:(typeof e=="function"?xc:Ec)(e)):this.node().textContent}function Nc(){this.innerHTML=""}function Cc(e){return function(){this.innerHTML=e}}function Mc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ac(e){return arguments.length?this.each(e==null?Nc:(typeof e=="function"?Mc:Cc)(e)):this.node().innerHTML}function Pc(){this.nextSibling&&this.parentNode.appendChild(this)}function Tc(){return this.each(Pc)}function kc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $c(){return this.each(kc)}function Ic(e){var t=typeof e=="function"?e:Go(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Dc(){return null}function Rc(e,t){var n=typeof e=="function"?e:Go(e),o=t==null?Dc:typeof t=="function"?t:Dn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function zc(){var e=this.parentNode;e&&e.removeChild(this)}function Oc(){return this.each(zc)}function Bc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Lc(e){return this.select(e?Vc:Bc)}function Hc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Fc(e){return function(t){e.call(this,t,this.__data__)}}function Xc(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 Yc(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 Uc(e,t,n){return function(){var o=this.__on,r,s=Fc(t);if(o){for(var i=0,c=o.length;i<c;++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 Kc(e,t,n){var o=Xc(e+""),r,s=o.length,i;if(arguments.length<2){var c=this.node().__on;if(c){for(var a=0,u=c.length,l;a<u;++a)for(r=0,l=c[a];r<s;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value}return}for(c=t?Uc:Yc,r=0;r<s;++r)this.each(c(o[r],t,n));return this}function rr(e,t,n){var o=jo(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 Wc(e,t){return function(){return rr(this,e,t)}}function Gc(e,t){return function(){return rr(this,e,t.apply(this,arguments))}}function Zc(e,t){return this.each((typeof t=="function"?Gc:Wc)(e,t))}function*qc(){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 ir=[null];function he(e,t){this._groups=e,this._parents=t}function vt(){return new he([[document.documentElement]],ir)}function Qc(){return this}he.prototype=vt.prototype={constructor:he,select:xs,selectAll:Ms,selectChild:ks,selectChildren:Rs,filter:zs,data:Fs,enter:Os,exit:Ys,join:Us,merge:Ks,selection:Qc,order:Ws,sort:Gs,call:qs,nodes:Qs,node:Js,size:js,empty:ec,each:tc,attr:ac,style:fc,property:mc,classed:Sc,text:bc,html:Ac,raise:Tc,lower:$c,append:Ic,insert:Rc,remove:Oc,clone:Lc,datum:Hc,on:Kc,dispatch:Zc,[Symbol.iterator]:qc};function fe(e){return typeof e=="string"?new he([[document.querySelector(e)]],[document.documentElement]):new he([[e]],ir)}function Jc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Se(e,t){if(e=Jc(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 jc={passive:!1},yt={capture:!0,passive:!1};function ln(e){e.stopImmediatePropagation()}function je(e){e.preventDefault(),e.stopImmediatePropagation()}function sr(e){var t=e.document.documentElement,n=fe(e).on("dragstart.drag",je,yt);"onselectstart"in t?n.on("selectstart.drag",je,yt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function cr(e,t){var n=e.document.documentElement,o=fe(e).on("dragstart.drag",null);t&&(o.on("click.drag",je,yt),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 Nt=e=>()=>e;function vn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:s,x:i,y:c,dx:a,dy:u,dispatch:l}){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:c,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:l}})}vn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ea(e){return!e.ctrlKey&&!e.button}function ta(){return this.parentNode}function na(e,t){return t??{x:e.x,y:e.y}}function oa(){return navigator.maxTouchPoints||"ontouchstart"in this}function ar(){var e=ea,t=ta,n=na,o=oa,r={},s=Ft("start","drag","end"),i=0,c,a,u,l,d=0;function g(S){S.on("mousedown.drag",h).filter(o).on("touchstart.drag",_).on("touchmove.drag",y,jc).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(S,C){if(!(l||!e.call(this,S,C))){var M=N(this,t.call(this,S,C),S,C,"mouse");M&&(fe(S.view).on("mousemove.drag",w,yt).on("mouseup.drag",m,yt),sr(S.view),ln(S),u=!1,c=S.clientX,a=S.clientY,M("start",S))}}function w(S){if(je(S),!u){var C=S.clientX-c,M=S.clientY-a;u=C*C+M*M>d}r.mouse("drag",S)}function m(S){fe(S.view).on("mousemove.drag mouseup.drag",null),cr(S.view,u),je(S),r.mouse("end",S)}function _(S,C){if(e.call(this,S,C)){var M=S.changedTouches,P=t.call(this,S,C),D=M.length,k,B;for(k=0;k<D;++k)(B=N(this,P,S,C,M[k].identifier,M[k]))&&(ln(S),B("start",S,M[k]))}}function y(S){var C=S.changedTouches,M=C.length,P,D;for(P=0;P<M;++P)(D=r[C[P].identifier])&&(je(S),D("drag",S,C[P]))}function x(S){var C=S.changedTouches,M=C.length,P,D;for(l&&clearTimeout(l),l=setTimeout(function(){l=null},500),P=0;P<M;++P)(D=r[C[P].identifier])&&(ln(S),D("end",S,C[P]))}function N(S,C,M,P,D,k){var B=s.copy(),O=Se(k||M,C),V,z,p;if((p=n.call(S,new vn("beforestart",{sourceEvent:M,target:g,identifier:D,active:i,x:O[0],y:O[1],dx:0,dy:0,dispatch:B}),P))!=null)return V=p.x-O[0]||0,z=p.y-O[1]||0,function b(E,T,$){var v=O,A;switch(E){case"start":r[D]=b,A=i++;break;case"end":delete r[D],--i;case"drag":O=Se($||T,C),A=i;break}B.call(E,S,new vn(E,{sourceEvent:T,subject:p,target:g,identifier:D,active:A,x:O[0]+V,y:O[1]+z,dx:O[0]-v[0],dy:O[1]-v[1],dispatch:B}),P)}}return g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Nt(!!S),g):e},g.container=function(S){return arguments.length?(t=typeof S=="function"?S:Nt(S),g):t},g.subject=function(S){return arguments.length?(n=typeof S=="function"?S:Nt(S),g):n},g.touchable=function(S){return arguments.length?(o=typeof S=="function"?S:Nt(!!S),g):o},g.on=function(){var S=s.on.apply(s,arguments);return S===s?g:S},g.clickDistance=function(S){return arguments.length?(d=(S=+S)*S,g):Math.sqrt(d)},g}var nt=0,pt=0,lt=0,lr=1e3,zt,mt,Ot=0,Ue=0,Yt=0,wt=typeof performance=="object"&&performance.now?performance:Date,ur=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function zn(){return Ue||(ur(ra),Ue=wt.now()+Yt)}function ra(){Ue=0}function Bt(){this._call=this._time=this._next=null}Bt.prototype=dr.prototype={constructor:Bt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?zn():+n)+(t==null?0:+t),!this._next&&mt!==this&&(mt?mt._next=this:zt=this,mt=this),this._call=e,this._time=n,En()},stop:function(){this._call&&(this._call=null,this._time=1/0,En())}};function dr(e,t,n){var o=new Bt;return o.restart(e,t,n),o}function ia(){zn(),++nt;for(var e=zt,t;e;)(t=Ue-e._time)>=0&&e._call.call(void 0,t),e=e._next;--nt}function mo(){Ue=(Ot=wt.now())+Yt,nt=pt=0;try{ia()}finally{nt=0,ca(),Ue=0}}function sa(){var e=wt.now(),t=e-Ot;t>lr&&(Yt-=t,Ot=e)}function ca(){for(var e,t=zt,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:zt=n);mt=e,En(o)}function En(e){if(!nt){pt&&(pt=clearTimeout(pt));var t=e-Ue;t>24?(e<1/0&&(pt=setTimeout(mo,e-wt.now()-Yt)),lt&&(lt=clearInterval(lt))):(lt||(Ot=wt.now(),lt=setInterval(sa,lr)),nt=1,ur(mo))}}function yo(e,t,n){var o=new Bt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var aa=Ft("start","end","cancel","interrupt"),la=[],fr=0,wo=1,xn=2,$t=3,_o=4,bn=5,It=6;function Ut(e,t,n,o,r,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;ua(e,n,{name:t,index:o,group:r,on:aa,tween:la,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:fr})}function On(e,t){var n=ve(e,t);if(n.state>fr)throw new Error("too late; already scheduled");return n}function Ne(e,t){var n=ve(e,t);if(n.state>$t)throw new Error("too late; already running");return n}function ve(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ua(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=dr(s,0,n.time);function s(u){n.state=wo,n.timer.restart(i,n.delay,n.time),n.delay<=u&&i(u-n.delay)}function i(u){var l,d,g,h;if(n.state!==wo)return a();for(l in o)if(h=o[l],h.name===n.name){if(h.state===$t)return yo(i);h.state===_o?(h.state=It,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[l]):+l<t&&(h.state=It,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[l])}if(yo(function(){n.state===$t&&(n.state=_o,n.timer.restart(c,n.delay,n.time),c(u))}),n.state=xn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===xn){for(n.state=$t,r=new Array(g=n.tween.length),l=0,d=-1;l<g;++l)(h=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function c(u){for(var l=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(a),n.state=bn,1),d=-1,g=r.length;++d<g;)r[d].call(e,l);n.state===bn&&(n.on.call("end",e,e.__data__,n.index,n.group),a())}function a(){n.state=It,n.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function Dt(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>xn&&o.state<bn,o.state=It,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}s&&delete e.__transition}}function da(e){return this.each(function(){Dt(this,e)})}function fa(e,t){var n,o;return function(){var r=Ne(this,e),s=r.tween;if(s!==n){o=n=s;for(var i=0,c=o.length;i<c;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}r.tween=o}}function ha(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var s=Ne(this,e),i=s.tween;if(i!==o){r=(o=i).slice();for(var c={name:t,value:n},a=0,u=r.length;a<u;++a)if(r[a].name===t){r[a]=c;break}a===u&&r.push(c)}s.tween=r}}function ga(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ve(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?fa:ha)(n,e,t))}function Bn(e,t,n){var o=e._id;return e.each(function(){var r=Ne(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ve(r,o).value[t]}}function hr(e,t){var n;return(typeof t=="number"?ze:t instanceof gt.color?gt.interpolateRgb:(n=gt.color(t))?(t=n,gt.interpolateRgb):qi)(e,t)}function pa(e){return function(){this.removeAttribute(e)}}function ma(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ya(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 wa(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 _a(e,t,n){var o,r,s;return function(){var i,c=n(this),a;return c==null?void this.removeAttribute(e):(i=this.getAttribute(e),a=c+"",i===a?null:i===o&&a===r?s:(r=a,s=t(o=i,c)))}}function Sa(e,t,n){var o,r,s;return function(){var i,c=n(this),a;return c==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),a=c+"",i===a?null:i===o&&a===r?s:(r=a,s=t(o=i,c)))}}function va(e,t){var n=Xt(e),o=n==="transform"?es:hr;return this.attrTween(e,typeof t=="function"?(n.local?Sa:_a)(n,o,Bn(this,"attr."+e,t)):t==null?(n.local?ma:pa)(n):(n.local?wa:ya)(n,o,t))}function Ea(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function xa(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ba(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&xa(e,s)),n}return r._value=t,r}function Na(e,t){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&Ea(e,s)),n}return r._value=t,r}function Ca(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=Xt(e);return this.tween(n,(o.local?ba:Na)(o,t))}function Ma(e,t){return function(){On(this,e).delay=+t.apply(this,arguments)}}function Aa(e,t){return t=+t,function(){On(this,e).delay=t}}function Pa(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ma:Aa)(t,e)):ve(this.node(),t).delay}function Ta(e,t){return function(){Ne(this,e).duration=+t.apply(this,arguments)}}function ka(e,t){return t=+t,function(){Ne(this,e).duration=t}}function $a(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ta:ka)(t,e)):ve(this.node(),t).duration}function Ia(e,t){if(typeof t!="function")throw new Error;return function(){Ne(this,e).ease=t}}function Da(e){var t=this._id;return arguments.length?this.each(Ia(t,e)):ve(this.node(),t).ease}function Ra(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ne(this,e).ease=n}}function za(e){if(typeof e!="function")throw new Error;return this.each(Ra(this._id,e))}function Oa(e){typeof e!="function"&&(e=qo(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,c=o[r]=[],a,u=0;u<i;++u)(a=s[u])&&e.call(a,a.__data__,u,s)&&c.push(a);return new ke(o,this._parents,this._name,this._id)}function Ba(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),c=0;c<s;++c)for(var a=t[c],u=n[c],l=a.length,d=i[c]=new Array(l),g,h=0;h<l;++h)(g=a[h]||u[h])&&(d[h]=g);for(;c<o;++c)i[c]=t[c];return new ke(i,this._parents,this._name,this._id)}function Va(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 La(e,t,n){var o,r,s=Va(t)?On:Ne;return function(){var i=s(this,e),c=i.on;c!==o&&(r=(o=c).copy()).on(t,n),i.on=r}}function Ha(e,t){var n=this._id;return arguments.length<2?ve(this.node(),n).on.on(e):this.each(La(n,e,t))}function Fa(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Xa(){return this.on("end.remove",Fa(this._id))}function Ya(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Dn(e));for(var o=this._groups,r=o.length,s=new Array(r),i=0;i<r;++i)for(var c=o[i],a=c.length,u=s[i]=new Array(a),l,d,g=0;g<a;++g)(l=c[g])&&(d=e.call(l,l.__data__,g,c))&&("__data__"in l&&(d.__data__=l.__data__),u[g]=d,Ut(u[g],t,n,g,u,ve(l,n)));return new ke(s,this._parents,t,n)}function Ua(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Zo(e));for(var o=this._groups,r=o.length,s=[],i=[],c=0;c<r;++c)for(var a=o[c],u=a.length,l,d=0;d<u;++d)if(l=a[d]){for(var g=e.call(l,l.__data__,d,a),h,w=ve(l,n),m=0,_=g.length;m<_;++m)(h=g[m])&&Ut(h,t,n,m,g,w);s.push(g),i.push(l)}return new ke(s,i,t,n)}var Ka=vt.prototype.constructor;function Wa(){return new Ka(this._groups,this._parents)}function Ga(e,t){var n,o,r;return function(){var s=tt(this,e),i=(this.style.removeProperty(e),tt(this,e));return s===i?null:s===n&&i===o?r:r=t(n=s,o=i)}}function gr(e){return function(){this.style.removeProperty(e)}}function Za(e,t,n){var o,r=n+"",s;return function(){var i=tt(this,e);return i===r?null:i===o?s:s=t(o=i,n)}}function qa(e,t,n){var o,r,s;return function(){var i=tt(this,e),c=n(this),a=c+"";return c==null&&(a=c=(this.style.removeProperty(e),tt(this,e))),i===a?null:i===o&&a===r?s:(r=a,s=t(o=i,c))}}function Qa(e,t){var n,o,r,s="style."+t,i="end."+s,c;return function(){var a=Ne(this,e),u=a.on,l=a.value[s]==null?c||(c=gr(t)):void 0;(u!==n||r!==l)&&(o=(n=u).copy()).on(i,r=l),a.on=o}}function Ja(e,t,n){var o=(e+="")=="transform"?ji:hr;return t==null?this.styleTween(e,Ga(e,o)).on("end.style."+e,gr(e)):typeof t=="function"?this.styleTween(e,qa(e,o,Bn(this,"style."+e,t))).each(Qa(this._id,e)):this.styleTween(e,Za(e,o,t),n).on("end.style."+e,null)}function ja(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function el(e,t,n){var o,r;function s(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&ja(e,i,n)),o}return s._value=t,s}function tl(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,el(e,t,n??""))}function nl(e){return function(){this.textContent=e}}function ol(e){return function(){var t=e(this);this.textContent=t??""}}function rl(e){return this.tween("text",typeof e=="function"?ol(Bn(this,"text",e)):nl(e==null?"":e+""))}function il(e){return function(t){this.textContent=e.call(this,t)}}function sl(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&il(r)),t}return o._value=e,o}function cl(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,sl(e))}function al(){for(var e=this._name,t=this._id,n=pr(),o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],c=i.length,a,u=0;u<c;++u)if(a=i[u]){var l=ve(a,t);Ut(a,e,n,u,i,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new ke(o,this._parents,e,n)}function ll(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(s,i){var c={value:i},a={value:function(){--r===0&&s()}};n.each(function(){var u=Ne(this,o),l=u.on;l!==e&&(t=(e=l).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(a)),u.on=t}),r===0&&s()})}var ul=0;function ke(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function pr(){return++ul}var Ae=vt.prototype;ke.prototype={constructor:ke,select:Ya,selectAll:Ua,selectChild:Ae.selectChild,selectChildren:Ae.selectChildren,filter:Oa,merge:Ba,selection:Wa,transition:al,call:Ae.call,nodes:Ae.nodes,node:Ae.node,size:Ae.size,empty:Ae.empty,each:Ae.each,on:Ha,attr:va,attrTween:Ca,style:Ja,styleTween:tl,text:rl,textTween:cl,remove:Xa,tween:ga,delay:Pa,duration:$a,ease:Da,easeVarying:za,end:ll,[Symbol.iterator]:Ae[Symbol.iterator]};function dl(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fl={time:null,delay:0,duration:250,ease:dl};function hl(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 gl(e){var t,n;e instanceof ke?(t=e._id,e=e._name):(t=pr(),(n=fl).time=zn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,s=0;s<r;++s)for(var i=o[s],c=i.length,a,u=0;u<c;++u)(a=i[u])&&Ut(a,e,t,u,i,n||hl(a,t));return new ke(o,this._parents,e,t)}vt.prototype.interrupt=da;vt.prototype.transition=gl;const Ct=e=>()=>e;function pl(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 Pe(e,t,n){this.k=e,this.x=t,this.y=n}Pe.prototype={constructor:Pe,scale:function(e){return e===1?this:new Pe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Pe(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 Te=new Pe(1,0,0);Pe.prototype;function un(e){e.stopImmediatePropagation()}function ut(e){e.preventDefault(),e.stopImmediatePropagation()}function ml(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function yl(){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 So(){return this.__zoom||Te}function wl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _l(){return navigator.maxTouchPoints||"ontouchstart"in this}function Sl(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 mr(){var e=ml,t=yl,n=Sl,o=wl,r=_l,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],c=250,a=rs,u=Ft("start","zoom","end"),l,d,g,h=500,w=150,m=0,_=10;function y(p){p.property("__zoom",So).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",O).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(p,b,E,T){var $=p.selection?p.selection():p;$.property("__zoom",So),p!==$?C(p,b,E,T):$.interrupt().each(function(){M(this,arguments).event(T).start().zoom(null,typeof b=="function"?b.apply(this,arguments):b).end()})},y.scaleBy=function(p,b,E,T){y.scaleTo(p,function(){var $=this.__zoom.k,v=typeof b=="function"?b.apply(this,arguments):b;return $*v},E,T)},y.scaleTo=function(p,b,E,T){y.transform(p,function(){var $=t.apply(this,arguments),v=this.__zoom,A=E==null?S($):typeof E=="function"?E.apply(this,arguments):E,I=v.invert(A),R=typeof b=="function"?b.apply(this,arguments):b;return n(N(x(v,R),A,I),$,i)},E,T)},y.translateBy=function(p,b,E,T){y.transform(p,function(){return n(this.__zoom.translate(typeof b=="function"?b.apply(this,arguments):b,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),i)},null,T)},y.translateTo=function(p,b,E,T,$){y.transform(p,function(){var v=t.apply(this,arguments),A=this.__zoom,I=T==null?S(v):typeof T=="function"?T.apply(this,arguments):T;return n(Te.translate(I[0],I[1]).scale(A.k).translate(typeof b=="function"?-b.apply(this,arguments):-b,typeof E=="function"?-E.apply(this,arguments):-E),v,i)},T,$)};function x(p,b){return b=Math.max(s[0],Math.min(s[1],b)),b===p.k?p:new Pe(b,p.x,p.y)}function N(p,b,E){var T=b[0]-E[0]*p.k,$=b[1]-E[1]*p.k;return T===p.x&&$===p.y?p:new Pe(p.k,T,$)}function S(p){return[(+p[0][0]+ +p[1][0])/2,(+p[0][1]+ +p[1][1])/2]}function C(p,b,E,T){p.on("start.zoom",function(){M(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event(T).end()}).tween("zoom",function(){var $=this,v=arguments,A=M($,v).event(T),I=t.apply($,v),R=E==null?S(I):typeof E=="function"?E.apply($,v):E,F=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),L=$.__zoom,X=typeof b=="function"?b.apply($,v):b,Y=a(L.invert(R).concat(F/L.k),X.invert(R).concat(F/X.k));return function(U){if(U===1)U=X;else{var q=Y(U),Z=F/q[2];U=new Pe(Z,R[0]-q[0]*Z,R[1]-q[1]*Z)}A.zoom(null,U)}})}function M(p,b,E){return!E&&p.__zooming||new P(p,b)}function P(p,b){this.that=p,this.args=b,this.active=0,this.sourceEvent=null,this.extent=t.apply(p,b),this.taps=0}P.prototype={event:function(p){return p&&(this.sourceEvent=p),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(p,b){return this.mouse&&p!=="mouse"&&(this.mouse[1]=b.invert(this.mouse[0])),this.touch0&&p!=="touch"&&(this.touch0[1]=b.invert(this.touch0[0])),this.touch1&&p!=="touch"&&(this.touch1[1]=b.invert(this.touch1[0])),this.that.__zoom=b,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(p){var b=fe(this.that).datum();u.call(p,this.that,new pl(p,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),b)}};function D(p,...b){if(!e.apply(this,arguments))return;var E=M(this,b).event(p),T=this.__zoom,$=Math.max(s[0],Math.min(s[1],T.k*Math.pow(2,o.apply(this,arguments)))),v=Se(p);if(E.wheel)(E.mouse[0][0]!==v[0]||E.mouse[0][1]!==v[1])&&(E.mouse[1]=T.invert(E.mouse[0]=v)),clearTimeout(E.wheel);else{if(T.k===$)return;E.mouse=[v,T.invert(v)],Dt(this),E.start()}ut(p),E.wheel=setTimeout(A,w),E.zoom("mouse",n(N(x(T,$),E.mouse[0],E.mouse[1]),E.extent,i));function A(){E.wheel=null,E.end()}}function k(p,...b){if(g||!e.apply(this,arguments))return;var E=p.currentTarget,T=M(this,b,!0).event(p),$=fe(p.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),v=Se(p,E),A=p.clientX,I=p.clientY;sr(p.view),un(p),T.mouse=[v,this.__zoom.invert(v)],Dt(this),T.start();function R(L){if(ut(L),!T.moved){var X=L.clientX-A,Y=L.clientY-I;T.moved=X*X+Y*Y>m}T.event(L).zoom("mouse",n(N(T.that.__zoom,T.mouse[0]=Se(L,E),T.mouse[1]),T.extent,i))}function F(L){$.on("mousemove.zoom mouseup.zoom",null),cr(L.view,T.moved),ut(L),T.event(L).end()}}function B(p,...b){if(e.apply(this,arguments)){var E=this.__zoom,T=Se(p.changedTouches?p.changedTouches[0]:p,this),$=E.invert(T),v=E.k*(p.shiftKey?.5:2),A=n(N(x(E,v),T,$),t.apply(this,b),i);ut(p),c>0?fe(this).transition().duration(c).call(C,A,T,p):fe(this).call(y.transform,A,T,p)}}function O(p,...b){if(e.apply(this,arguments)){var E=p.touches,T=E.length,$=M(this,b,p.changedTouches.length===T).event(p),v,A,I,R;for(un(p),A=0;A<T;++A)I=E[A],R=Se(I,this),R=[R,this.__zoom.invert(R),I.identifier],$.touch0?!$.touch1&&$.touch0[2]!==R[2]&&($.touch1=R,$.taps=0):($.touch0=R,v=!0,$.taps=1+!!l);l&&(l=clearTimeout(l)),v&&($.taps<2&&(d=R[0],l=setTimeout(function(){l=null},h)),Dt(this),$.start())}}function V(p,...b){if(this.__zooming){var E=M(this,b).event(p),T=p.changedTouches,$=T.length,v,A,I,R;for(ut(p),v=0;v<$;++v)A=T[v],I=Se(A,this),E.touch0&&E.touch0[2]===A.identifier?E.touch0[0]=I:E.touch1&&E.touch1[2]===A.identifier&&(E.touch1[0]=I);if(A=E.that.__zoom,E.touch1){var F=E.touch0[0],L=E.touch0[1],X=E.touch1[0],Y=E.touch1[1],U=(U=X[0]-F[0])*U+(U=X[1]-F[1])*U,q=(q=Y[0]-L[0])*q+(q=Y[1]-L[1])*q;A=x(A,Math.sqrt(U/q)),I=[(F[0]+X[0])/2,(F[1]+X[1])/2],R=[(L[0]+Y[0])/2,(L[1]+Y[1])/2]}else if(E.touch0)I=E.touch0[0],R=E.touch0[1];else return;E.zoom("touch",n(N(A,I,R),E.extent,i))}}function z(p,...b){if(this.__zooming){var E=M(this,b).event(p),T=p.changedTouches,$=T.length,v,A;for(un(p),g&&clearTimeout(g),g=setTimeout(function(){g=null},h),v=0;v<$;++v)A=T[v],E.touch0&&E.touch0[2]===A.identifier?delete E.touch0:E.touch1&&E.touch1[2]===A.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(A=Se(A,this),Math.hypot(d[0]-A[0],d[1]-A[1])<_)){var I=fe(this).on("dblclick.zoom");I&&I.apply(this,arguments)}}}return y.wheelDelta=function(p){return arguments.length?(o=typeof p=="function"?p:Ct(+p),y):o},y.filter=function(p){return arguments.length?(e=typeof p=="function"?p:Ct(!!p),y):e},y.touchable=function(p){return arguments.length?(r=typeof p=="function"?p:Ct(!!p),y):r},y.extent=function(p){return arguments.length?(t=typeof p=="function"?p:Ct([[+p[0][0],+p[0][1]],[+p[1][0],+p[1][1]]]),y):t},y.scaleExtent=function(p){return arguments.length?(s[0]=+p[0],s[1]=+p[1],y):[s[0],s[1]]},y.translateExtent=function(p){return arguments.length?(i[0][0]=+p[0][0],i[1][0]=+p[1][0],i[0][1]=+p[0][1],i[1][1]=+p[1][1],y):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},y.constrain=function(p){return arguments.length?(n=p,y):n},y.duration=function(p){return arguments.length?(c=+p,y):c},y.interpolate=function(p){return arguments.length?(a=p,y):a},y.on=function(){var p=u.on.apply(u,arguments);return p===u?y:p},y.clickDistance=function(p){return arguments.length?(m=(p=+p)*p,y):Math.sqrt(m)},y.tapDistance=function(p){return arguments.length?(_=+p,y):_},y}const Kt=f.createContext(null),vl=Kt.Provider,ge={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,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,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.`},yr=ge.error001();function G(e,t){const n=f.useContext(Kt);if(n===null)throw new Error(yr);return Wo(n,e,t)}const ne=()=>{const e=f.useContext(Kt);if(e===null)throw new Error(yr);return f.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},El=e=>e.userSelectionActive?"none":"all";function Wt({position:e,children:t,className:n,style:o,...r}){const s=G(El),i=`${e}`.split("-");return f.createElement("div",{className:se(["react-flow__panel",n,...i]),style:{...o,pointerEvents:s},...r},t)}function xl({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:f.createElement(Wt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},f.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const bl=({x:e,y:t,label:n,labelStyle:o={},labelShowBg:r=!0,labelBgStyle:s={},labelBgPadding:i=[2,4],labelBgBorderRadius:c=2,children:a,className:u,...l})=>{const d=f.useRef(null),[g,h]=f.useState({x:0,y:0,width:0,height:0}),w=se(["react-flow__edge-textwrapper",u]);return f.useEffect(()=>{if(d.current){const m=d.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:f.createElement("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:w,visibility:g.width?"visible":"hidden",...l},r&&f.createElement("rect",{width:g.width+2*i[0],x:-i[0],y:-i[1],height:g.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:c,ry:c}),f.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:d,style:o},n),a)};var wr=f.memo(bl);const Vn=e=>({width:e.offsetWidth,height:e.offsetHeight}),$e=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ln=(e={x:0,y:0},t)=>({x:$e(e.x,t[0][0],t[1][0]),y:$e(e.y,t[0][1],t[1][1])}),vo=(e,t,n)=>e<t?$e(Math.abs(e-t),1,50)/50:e>n?-$e(Math.abs(e-n),1,50)/50:0,_r=(e,t)=>{const n=vo(e.x,35,t.width-35)*20,o=vo(e.y,35,t.height-35)*20;return[n,o]},Sr=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},vr=(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)}),ot=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Hn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Eo=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Er=(e,t)=>Hn(vr(ot(e),ot(t))),Nn=(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)},Nl=e=>ye(e.width)&&ye(e.height)&&ye(e.x)&&ye(e.y),ye=e=>!isNaN(e)&&isFinite(e),j=Symbol.for("internals"),xr=["Enter"," ","Escape"],Vt=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Cl=e=>"nativeEvent"in e;function Cn(e){var r,s;const t=Cl(e)?e.nativeEvent:e,n=((s=(r=t.composedPath)==null?void 0:r.call(t))==null?void 0:s[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const br=e=>"clientX"in e,Be=(e,t)=>{var s,i;const n=br(e),o=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,r=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:o-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},Lt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},it=({id:e,path:t,labelX:n,labelY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:u,style:l,markerEnd:d,markerStart:g,interactionWidth:h=20})=>f.createElement(f.Fragment,null,f.createElement("path",{id:e,style:l,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:g}),h&&f.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),r&&ye(n)&&ye(o)?f.createElement(wr,{x:n,y:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:u}):null);it.displayName="BaseEdge";const Ml=(e,t)=>typeof t<"u"&&t?`url(#${t})`:typeof e<"u"?`url(#react-flow__${e})`:"none";function dt(e,t,n){return n===void 0?n:o=>{const r=t().edges.find(s=>s.id===e);r&&n(o,{...r})}}function Nr({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,c=o<t?o+i:o-i;return[s,c,r,i]}function Cr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:s,targetControlX:i,targetControlY:c}){const a=e*.125+r*.375+i*.375+n*.125,u=t*.125+s*.375+c*.375+o*.125,l=Math.abs(a-e),d=Math.abs(u-t);return[a,u,l,d]}exports.ConnectionMode=void 0;(function(e){e.Strict="strict",e.Loose="loose"})(exports.ConnectionMode||(exports.ConnectionMode={}));exports.PanOnScrollMode=void 0;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(exports.PanOnScrollMode||(exports.PanOnScrollMode={}));exports.SelectionMode=void 0;(function(e){e.Partial="partial",e.Full="full"})(exports.SelectionMode||(exports.SelectionMode={}));exports.ConnectionLineType=void 0;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(exports.ConnectionLineType||(exports.ConnectionLineType={}));exports.MarkerType=void 0;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(exports.MarkerType||(exports.MarkerType={}));exports.Position=void 0;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(exports.Position||(exports.Position={}));function xo({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===exports.Position.Left||e===exports.Position.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function Fn({sourceX:e,sourceY:t,sourcePosition:n=exports.Position.Bottom,targetX:o,targetY:r,targetPosition:s=exports.Position.Top}){const[i,c]=xo({pos:n,x1:e,y1:t,x2:o,y2:r}),[a,u]=xo({pos:s,x1:o,y1:r,x2:e,y2:t}),[l,d,g,h]=Cr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:i,sourceControlY:c,targetControlX:a,targetControlY:u});return[`M${e},${t} C${i},${c} ${a},${u} ${o},${r}`,l,d,g,h]}const Gt=f.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:r=exports.Position.Bottom,targetPosition:s=exports.Position.Top,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:d,style:g,markerEnd:h,markerStart:w,interactionWidth:m})=>{const[_,y,x]=Fn({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:s});return f.createElement(it,{path:_,labelX:y,labelY:x,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:d,style:g,markerEnd:h,markerStart:w,interactionWidth:m})});Gt.displayName="SimpleBezierEdge";const bo={[exports.Position.Left]:{x:-1,y:0},[exports.Position.Right]:{x:1,y:0},[exports.Position.Top]:{x:0,y:-1},[exports.Position.Bottom]:{x:0,y:1}},Al=({source:e,sourcePosition:t=exports.Position.Bottom,target:n})=>t===exports.Position.Left||t===exports.Position.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},No=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Pl({source:e,sourcePosition:t=exports.Position.Bottom,target:n,targetPosition:o=exports.Position.Top,center:r,offset:s}){const i=bo[t],c=bo[o],a={x:e.x+i.x*s,y:e.y+i.y*s},u={x:n.x+c.x*s,y:n.y+c.y*s},l=Al({source:a,sourcePosition:t,target:u}),d=l.x!==0?"x":"y",g=l[d];let h=[],w,m;const _={x:0,y:0},y={x:0,y:0},[x,N,S,C]=Nr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(i[d]*c[d]===-1){w=r.x??x,m=r.y??N;const P=[{x:w,y:a.y},{x:w,y:u.y}],D=[{x:a.x,y:m},{x:u.x,y:m}];i[d]===g?h=d==="x"?P:D:h=d==="x"?D:P}else{const P=[{x:a.x,y:u.y}],D=[{x:u.x,y:a.y}];if(d==="x"?h=i.x===g?D:P:h=i.y===g?P:D,t===o){const z=Math.abs(e[d]-n[d]);if(z<=s){const p=Math.min(s-1,s-z);i[d]===g?_[d]=(a[d]>e[d]?-1:1)*p:y[d]=(u[d]>n[d]?-1:1)*p}}if(t!==o){const z=d==="x"?"y":"x",p=i[d]===c[z],b=a[z]>u[z],E=a[z]<u[z];(i[d]===1&&(!p&&b||p&&E)||i[d]!==1&&(!p&&E||p&&b))&&(h=d==="x"?P:D)}const k={x:a.x+_.x,y:a.y+_.y},B={x:u.x+y.x,y:u.y+y.y},O=Math.max(Math.abs(k.x-h[0].x),Math.abs(B.x-h[0].x)),V=Math.max(Math.abs(k.y-h[0].y),Math.abs(B.y-h[0].y));O>=V?(w=(k.x+B.x)/2,m=h[0].y):(w=h[0].x,m=(k.y+B.y)/2)}return[[e,{x:a.x+_.x,y:a.y+_.y},...h,{x:u.x+y.x,y:u.y+y.y},n],w,m,S,C]}function Tl(e,t,n,o){const r=Math.min(No(e,t)/2,No(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 u=e.x<n.x?-1:1,l=e.y<n.y?1:-1;return`L ${s+r*u},${i}Q ${s},${i} ${s},${i+r*l}`}const c=e.x<n.x?1:-1,a=e.y<n.y?-1:1;return`L ${s},${i+r*a}Q ${s},${i} ${s+r*c},${i}`}function Ht({sourceX:e,sourceY:t,sourcePosition:n=exports.Position.Bottom,targetX:o,targetY:r,targetPosition:s=exports.Position.Top,borderRadius:i=5,centerX:c,centerY:a,offset:u=20}){const[l,d,g,h,w]=Pl({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:s,center:{x:c,y:a},offset:u});return[l.reduce((_,y,x)=>{let N="";return x>0&&x<l.length-1?N=Tl(l[x-1],y,l[x+1],i):N=`${x===0?"M":"L"}${y.x} ${y.y}`,_+=N,_},""),d,g,h,w]}const Et=f.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:u,style:l,sourcePosition:d=exports.Position.Bottom,targetPosition:g=exports.Position.Top,markerEnd:h,markerStart:w,pathOptions:m,interactionWidth:_})=>{const[y,x,N]=Ht({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:o,targetPosition:g,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset});return f.createElement(it,{path:y,labelX:x,labelY:N,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:u,style:l,markerEnd:h,markerStart:w,interactionWidth:_})});Et.displayName="SmoothStepEdge";const Zt=f.memo(e=>{var t;return f.createElement(Et,{...e,pathOptions:f.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Zt.displayName="StepEdge";function Mr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,s,i,c]=Nr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,s,i,c]}const qt=f.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:u,style:l,markerEnd:d,markerStart:g,interactionWidth:h})=>{const[w,m,_]=Mr({sourceX:e,sourceY:t,targetX:n,targetY:o});return f.createElement(it,{path:w,labelX:m,labelY:_,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:c,labelBgPadding:a,labelBgBorderRadius:u,style:l,markerEnd:d,markerStart:g,interactionWidth:h})});qt.displayName="StraightEdge";function Mt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Co({pos:e,x1:t,y1:n,x2:o,y2:r,c:s}){switch(e){case exports.Position.Left:return[t-Mt(t-o,s),n];case exports.Position.Right:return[t+Mt(o-t,s),n];case exports.Position.Top:return[t,n-Mt(n-r,s)];case exports.Position.Bottom:return[t,n+Mt(r-n,s)]}}function Xn({sourceX:e,sourceY:t,sourcePosition:n=exports.Position.Bottom,targetX:o,targetY:r,targetPosition:s=exports.Position.Top,curvature:i=.25}){const[c,a]=Co({pos:n,x1:e,y1:t,x2:o,y2:r,c:i}),[u,l]=Co({pos:s,x1:o,y1:r,x2:e,y2:t,c:i}),[d,g,h,w]=Cr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:c,sourceControlY:a,targetControlX:u,targetControlY:l});return[`M${e},${t} C${c},${a} ${u},${l} ${o},${r}`,d,g,h,w]}const _t=f.memo(({sourceX:e,sourceY:t,targetX:n,targetY:o,sourcePosition:r=exports.Position.Bottom,targetPosition:s=exports.Position.Top,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:d,style:g,markerEnd:h,markerStart:w,pathOptions:m,interactionWidth:_})=>{const[y,x,N]=Xn({sourceX:e,sourceY:t,sourcePosition:r,targetX:n,targetY:o,targetPosition:s,curvature:m==null?void 0:m.curvature});return f.createElement(it,{path:y,labelX:x,labelY:N,label:i,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:l,labelBgBorderRadius:d,style:g,markerEnd:h,markerStart:w,interactionWidth:_})});_t.displayName="BezierEdge";const Yn=f.createContext(null),kl=Yn.Provider;Yn.Consumer;const Qt=()=>f.useContext(Yn),Ar=e=>"id"in e&&"source"in e&&"target"in e,Un=e=>"id"in e&&!("source"in e)&&!("target"in e),$l=(e,t,n)=>{if(!Un(e))return[];const o=n.filter(r=>r.source===e.id).map(r=>r.target);return t.filter(r=>o.includes(r.id))},Il=(e,t,n)=>{if(!Un(e))return[];const o=n.filter(r=>r.target===e.id).map(r=>r.source);return t.filter(r=>o.includes(r.id))},Pr=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`reactflow__edge-${e}${t||""}-${n}${o||""}`,Mn=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`,Dl=(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)),Tr=(e,t)=>{if(!e.source||!e.target)return Vt("006",ge.error006()),t;let n;return Ar(e)?n={...e}:n={...e,id:Pr(e)},Dl(n,t)?t:t.concat(n)},kr=(e,t,n,o={shouldReplaceId:!0})=>{const{id:r,...s}=e;if(!t.source||!t.target)return Vt("006",ge.error006()),n;if(!n.find(a=>a.id===r))return Vt("007",ge.error007(r)),n;const c={...s,id:o.shouldReplaceId?Pr(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(a=>a.id!==r).concat(c)},Rl=(e,t,n,o={shouldReplaceId:!0})=>(console.warn("[DEPRECATED] `updateEdge` is deprecated. Instead use `reconnectEdge` https://reactflow.dev/api-reference/utils/reconnect-edge"),kr(e,t,n,o)),An=({x:e,y:t},[n,o,r],s,[i,c])=>{const a={x:(e-n)/r,y:(t-o)/r};return s?{x:i*Math.round(a.x/i),y:c*Math.round(a.y/c)}:a},$r=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o}),Ve=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],o=(e.height??0)*t[1],r={x:e.position.x-n,y:e.position.y-o};return{...r,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-o}:r}},Ke=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const{x:s,y:i}=Ve(r,t).positionAbsolute;return vr(o,ot({x:s,y:i,width:r.width||0,height:r.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Hn(n)},zl=(e,t=[0,0])=>(console.warn("[DEPRECATED] `getRectOfNodes` is deprecated. Instead use `getNodesBounds` https://reactflow.dev/api-reference/utils/get-nodes-bounds."),Ke(e,t)),Ir=(e,t,[n,o,r]=[0,0,1],s=!1,i=!1,c=[0,0])=>{const a={x:(t.x-n)/r,y:(t.y-o)/r,width:t.width/r,height:t.height/r},u=[];return e.forEach(l=>{const{width:d,height:g,selectable:h=!0,hidden:w=!1}=l;if(i&&!h||w)return!1;const{positionAbsolute:m}=Ve(l,c),_={x:m.x,y:m.y,width:d||0,height:g||0},y=Nn(a,_),x=typeof d>"u"||typeof g>"u"||d===null||g===null,N=s&&y>0,S=(d||0)*(g||0);(x||N||y>=S||l.dragging)&&u.push(l)}),u},Kn=(e,t)=>{const n=e.map(o=>o.id);return t.filter(o=>n.includes(o.source)||n.includes(o.target))},Ol=(e,t,n,o,r,s=.1)=>{const{x:i,y:c,zoom:a}=Jt(e,t,n,o,r,s);return console.warn("[DEPRECATED] `getTransformForBounds` is deprecated. Instead use `getViewportForBounds`. Beware that the return value is type Viewport (`{ x: number, y: number, zoom: number }`) instead of Transform (`[number, number, number]`). https://reactflow.dev/api-reference/utils/get-viewport-for-bounds"),[i,c,a]},Jt=(e,t,n,o,r,s=.1)=>{const i=t/(e.width*(1+s)),c=n/(e.height*(1+s)),a=Math.min(i,c),u=$e(a,o,r),l=e.x+e.width/2,d=e.y+e.height/2,g=t/2-l*u,h=n/2-d*u;return{x:g,y:h,zoom:u}},Ye=(e,t=0)=>e.transition().duration(t);function Mo(e,t,n,o){return(t[n]||[]).reduce((r,s)=>{var i,c;return`${e.id}-${s.id}-${n}`!==o&&r.push({id:s.id||null,type:n,nodeId:e.id,x:(((i=e.positionAbsolute)==null?void 0:i.x)??0)+s.x+s.width/2,y:(((c=e.positionAbsolute)==null?void 0:c.y)??0)+s.y+s.height/2}),r},[])}function Bl(e,t,n,o,r,s){const{x:i,y:c}=Be(e),u=t.elementsFromPoint(i,c).find(w=>w.classList.contains("react-flow__handle"));if(u){const w=u.getAttribute("data-nodeid");if(w){const m=Wn(void 0,u),_=u.getAttribute("data-handleid"),y=s({nodeId:w,id:_,type:m});if(y){const x=r.find(N=>N.nodeId===w&&N.type===m&&N.id===_);return{handle:{id:_,type:m,nodeId:w,x:(x==null?void 0:x.x)||n.x,y:(x==null?void 0:x.y)||n.y},validHandleResult:y}}}}let l=[],d=1/0;if(r.forEach(w=>{const m=Math.sqrt((w.x-n.x)**2+(w.y-n.y)**2);if(m<=o){const _=s(w);m<=d&&(m<d?l=[{handle:w,validHandleResult:_}]:m===d&&l.push({handle:w,validHandleResult:_}),d=m)}}),!l.length)return{handle:null,validHandleResult:Dr()};if(l.length===1)return l[0];const g=l.some(({validHandleResult:w})=>w.isValid),h=l.some(({handle:w})=>w.type==="target");return l.find(({handle:w,validHandleResult:m})=>h?w.type==="target":g?m.isValid:!0)||l[0]}const Vl={source:null,target:null,sourceHandle:null,targetHandle:null},Dr=()=>({handleDomNode:null,isValid:!1,connection:Vl,endHandle:null});function Rr(e,t,n,o,r,s,i){const c=r==="target",a=i.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...Dr(),handleDomNode:a};if(a){const l=Wn(void 0,a),d=a.getAttribute("data-nodeid"),g=a.getAttribute("data-handleid"),h=a.classList.contains("connectable"),w=a.classList.contains("connectableend"),m={source:c?d:n,sourceHandle:c?g:o,target:c?n:d,targetHandle:c?o:g};u.connection=m,h&&w&&(t===exports.ConnectionMode.Strict?c&&l==="source"||!c&&l==="target":d!==n||g!==o)&&(u.endHandle={nodeId:d,handleId:g,type:l},u.isValid=s(m))}return u}function Ll({nodes:e,nodeId:t,handleId:n,handleType:o}){return e.reduce((r,s)=>{if(s[j]){const{handleBounds:i}=s[j];let c=[],a=[];i&&(c=Mo(s,i,"source",`${t}-${n}-${o}`),a=Mo(s,i,"target",`${t}-${n}-${o}`)),r.push(...c,...a)}return r},[])}function Wn(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function dn(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function Hl(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function zr({event:e,handleId:t,nodeId:n,onConnect:o,isTarget:r,getState:s,setState:i,isValidConnection:c,edgeUpdaterType:a,onReconnectEnd:u}){const l=Sr(e.target),{connectionMode:d,domNode:g,autoPanOnConnect:h,connectionRadius:w,onConnectStart:m,panBy:_,getNodes:y,cancelConnection:x}=s();let N=0,S;const{x:C,y:M}=Be(e),P=l==null?void 0:l.elementFromPoint(C,M),D=Wn(a,P),k=g==null?void 0:g.getBoundingClientRect();if(!k||!D)return;let B,O=Be(e,k),V=!1,z=null,p=!1,b=null;const E=Ll({nodes:y(),nodeId:n,handleId:t,handleType:D}),T=()=>{if(!h)return;const[A,I]=_r(O,k);_({x:A,y:I}),N=requestAnimationFrame(T)};i({connectionPosition:O,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:D,connectionStartHandle:{nodeId:n,handleId:t,type:D},connectionEndHandle:null}),m==null||m(e,{nodeId:n,handleId:t,handleType:D});function $(A){const{transform:I}=s();O=Be(A,k);const{handle:R,validHandleResult:F}=Bl(A,l,An(O,I,!1,[1,1]),w,E,L=>Rr(L,d,n,t,r?"target":"source",c,l));if(S=R,V||(T(),V=!0),b=F.handleDomNode,z=F.connection,p=F.isValid,i({connectionPosition:S&&p?$r({x:S.x,y:S.y},I):O,connectionStatus:Hl(!!S,p),connectionEndHandle:F.endHandle}),!S&&!p&&!b)return dn(B);z.source!==z.target&&b&&(dn(B),B=b,b.classList.add("connecting","react-flow__handle-connecting"),b.classList.toggle("valid",p),b.classList.toggle("react-flow__handle-valid",p))}function v(A){var I,R;(S||b)&&z&&p&&(o==null||o(z)),(R=(I=s()).onConnectEnd)==null||R.call(I,A),a&&(u==null||u(A)),dn(B),x(),cancelAnimationFrame(N),V=!1,p=!1,z=null,b=null,l.removeEventListener("mousemove",$),l.removeEventListener("mouseup",v),l.removeEventListener("touchmove",$),l.removeEventListener("touchend",v)}l.addEventListener("mousemove",$),l.addEventListener("mouseup",v),l.addEventListener("touchmove",$),l.addEventListener("touchend",v)}const Ao=()=>!0,Fl=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),Xl=(e,t,n)=>o=>{const{connectionStartHandle:r,connectionEndHandle:s,connectionClickStartHandle:i}=o;return{connecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.handleId)===t&&(r==null?void 0:r.type)===n||(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.handleId)===t&&(s==null?void 0:s.type)===n,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n}},Or=f.forwardRef(({type:e="source",position:t=exports.Position.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:s=!0,id:i,onConnect:c,children:a,className:u,onMouseDown:l,onTouchStart:d,...g},h)=>{var k,B;const w=i||null,m=e==="target",_=ne(),y=Qt(),{connectOnClick:x,noPanClassName:N}=G(Fl,oe),{connecting:S,clickConnecting:C}=G(Xl(y,w,e),oe);y||(B=(k=_.getState()).onError)==null||B.call(k,"010",ge.error010());const M=O=>{const{defaultEdgeOptions:V,onConnect:z,hasDefaultEdges:p}=_.getState(),b={...V,...O};if(p){const{edges:E,setEdges:T}=_.getState();T(Tr(b,E))}z==null||z(b),c==null||c(b)},P=O=>{if(!y)return;const V=br(O);r&&(V&&O.button===0||!V)&&zr({event:O,handleId:w,nodeId:y,onConnect:M,isTarget:m,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||Ao}),V?l==null||l(O):d==null||d(O)},D=O=>{const{onClickConnectStart:V,onClickConnectEnd:z,connectionClickStartHandle:p,connectionMode:b,isValidConnection:E}=_.getState();if(!y||!p&&!r)return;if(!p){V==null||V(O,{nodeId:y,handleId:w,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:y,type:e,handleId:w}});return}const T=Sr(O.target),$=n||E||Ao,{connection:v,isValid:A}=Rr({nodeId:y,id:w,type:e},b,p.nodeId,p.handleId||null,p.type,$,T);A&&M(v),z==null||z(O),_.setState({connectionClickStartHandle:null})};return f.createElement("div",{"data-handleid":w,"data-nodeid":y,"data-handlepos":t,"data-id":`${y}-${w}-${e}`,className:se(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",N,u,{source:!m,target:m,connectable:o,connectablestart:r,connectableend:s,connecting:C,connectionindicator:o&&(r&&!S||s&&S)}]),onMouseDown:P,onTouchStart:P,onClick:x?D:void 0,ref:h,...g},a)});Or.displayName="Handle";var St=f.memo(Or);const Br=({data:e,isConnectable:t,targetPosition:n=exports.Position.Top,sourcePosition:o=exports.Position.Bottom})=>f.createElement(f.Fragment,null,f.createElement(St,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,f.createElement(St,{type:"source",position:o,isConnectable:t}));Br.displayName="DefaultNode";var Pn=f.memo(Br);const Vr=({data:e,isConnectable:t,sourcePosition:n=exports.Position.Bottom})=>f.createElement(f.Fragment,null,e==null?void 0:e.label,f.createElement(St,{type:"source",position:n,isConnectable:t}));Vr.displayName="InputNode";var Lr=f.memo(Vr);const Hr=({data:e,isConnectable:t,targetPosition:n=exports.Position.Top})=>f.createElement(f.Fragment,null,f.createElement(St,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Hr.displayName="OutputNode";var Fr=f.memo(Hr);const Gn=()=>null;Gn.displayName="GroupNode";const Yl=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),At=e=>e.id;function Ul(e,t){return oe(e.selectedNodes.map(At),t.selectedNodes.map(At))&&oe(e.selectedEdges.map(At),t.selectedEdges.map(At))}const Xr=f.memo(({onSelectionChange:e})=>{const t=ne(),{selectedNodes:n,selectedEdges:o}=G(Yl,Ul);return f.useEffect(()=>{const r={nodes:n,edges:o};e==null||e(r),t.getState().onSelectionChange.forEach(s=>s(r))},[n,o,e]),null});Xr.displayName="SelectionListener";const Kl=e=>!!e.onSelectionChange;function Wl({onSelectionChange:e}){const t=G(Kl);return e||t?f.createElement(Xr,{onSelectionChange:e}):null}const Gl=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function We(e,t){f.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function K(e,t,n){f.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const Zl=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:r,onConnectStart:s,onConnectEnd:i,onClickConnectStart:c,onClickConnectEnd:a,nodesDraggable:u,nodesConnectable:l,nodesFocusable:d,edgesFocusable:g,edgesUpdatable:h,elevateNodesOnSelect:w,minZoom:m,maxZoom:_,nodeExtent:y,onNodesChange:x,onEdgesChange:N,elementsSelectable:S,connectionMode:C,snapGrid:M,snapToGrid:P,translateExtent:D,connectOnClick:k,defaultEdgeOptions:B,fitView:O,fitViewOptions:V,onNodesDelete:z,onEdgesDelete:p,onNodeDrag:b,onNodeDragStart:E,onNodeDragStop:T,onSelectionDrag:$,onSelectionDragStart:v,onSelectionDragStop:A,noPanClassName:I,nodeOrigin:R,rfId:F,autoPanOnConnect:L,autoPanOnNodeDrag:X,onError:Y,connectionRadius:U,isValidConnection:q,nodeDragThreshold:Z})=>{const{setNodes:W,setEdges:ee,setDefaultNodesAndEdges:re,setMinZoom:ce,setMaxZoom:ie,setTranslateExtent:te,setNodeExtent:ae,reset:Q}=G(Gl,oe),H=ne();return f.useEffect(()=>{const J=o==null?void 0:o.map(pe=>({...pe,...B}));return re(n,J),()=>{Q()}},[]),K("defaultEdgeOptions",B,H.setState),K("connectionMode",C,H.setState),K("onConnect",r,H.setState),K("onConnectStart",s,H.setState),K("onConnectEnd",i,H.setState),K("onClickConnectStart",c,H.setState),K("onClickConnectEnd",a,H.setState),K("nodesDraggable",u,H.setState),K("nodesConnectable",l,H.setState),K("nodesFocusable",d,H.setState),K("edgesFocusable",g,H.setState),K("edgesUpdatable",h,H.setState),K("elementsSelectable",S,H.setState),K("elevateNodesOnSelect",w,H.setState),K("snapToGrid",P,H.setState),K("snapGrid",M,H.setState),K("onNodesChange",x,H.setState),K("onEdgesChange",N,H.setState),K("connectOnClick",k,H.setState),K("fitViewOnInit",O,H.setState),K("fitViewOnInitOptions",V,H.setState),K("onNodesDelete",z,H.setState),K("onEdgesDelete",p,H.setState),K("onNodeDrag",b,H.setState),K("onNodeDragStart",E,H.setState),K("onNodeDragStop",T,H.setState),K("onSelectionDrag",$,H.setState),K("onSelectionDragStart",v,H.setState),K("onSelectionDragStop",A,H.setState),K("noPanClassName",I,H.setState),K("nodeOrigin",R,H.setState),K("rfId",F,H.setState),K("autoPanOnConnect",L,H.setState),K("autoPanOnNodeDrag",X,H.setState),K("onError",Y,H.setState),K("connectionRadius",U,H.setState),K("isValidConnection",q,H.setState),K("nodeDragThreshold",Z,H.setState),We(e,W),We(t,ee),We(m,ce),We(_,ie),We(D,te),We(y,ae),null},Po={display:"none"},ql={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Yr="react-flow__node-desc",Ur="react-flow__edge-desc",Ql="react-flow__aria-live",Jl=e=>e.ariaLiveMessage;function jl({rfId:e}){const t=G(Jl);return f.createElement("div",{id:`${Ql}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ql},t)}function eu({rfId:e,disableKeyboardA11y:t}){return f.createElement(f.Fragment,null,f.createElement("div",{id:`${Yr}-${e}`,style:Po},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),f.createElement("div",{id:`${Ur}-${e}`,style:Po},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&f.createElement(jl,{rfId:e}))}var rt=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,o]=f.useState(!1),r=f.useRef(!1),s=f.useRef(new Set([])),[i,c]=f.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),l=u.reduce((d,g)=>d.concat(...g),[]);return[u,l]}return[[],[]]},[e]);return f.useEffect(()=>{const a=typeof document<"u"?document:null,u=(t==null?void 0:t.target)||a;if(e!==null){const l=h=>{if(r.current=h.ctrlKey||h.metaKey||h.shiftKey,(!r.current||r.current&&!t.actInsideInputWithModifier)&&Cn(h))return!1;const m=ko(h.code,c);s.current.add(h[m]),To(i,s.current,!1)&&(h.preventDefault(),o(!0))},d=h=>{if((!r.current||r.current&&!t.actInsideInputWithModifier)&&Cn(h))return!1;const m=ko(h.code,c);To(i,s.current,!0)?(o(!1),s.current.clear()):s.current.delete(h[m]),h.key==="Meta"&&s.current.clear(),r.current=!1},g=()=>{s.current.clear(),o(!1)};return u==null||u.addEventListener("keydown",l),u==null||u.addEventListener("keyup",d),window.addEventListener("blur",g),()=>{u==null||u.removeEventListener("keydown",l),u==null||u.removeEventListener("keyup",d),window.removeEventListener("blur",g)}}},[e,o]),n};function To(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function ko(e,t){return t.includes(e)?"code":"key"}function Kr(e,t,n,o){var c,a;const r=e.parentNode||e.parentId;if(!r)return n;const s=t.get(r),i=Ve(s,o);return Kr(s,t,{x:(n.x??0)+i.x,y:(n.y??0)+i.y,z:(((c=s[j])==null?void 0:c.z)??0)>(n.z??0)?((a=s[j])==null?void 0:a.z)??0:n.z??0},o)}function Wr(e,t,n){e.forEach(o=>{var s;const r=o.parentNode||o.parentId;if(r&&!e.has(r))throw new Error(`Parent node ${r} not found`);if(r||n!=null&&n[o.id]){const{x:i,y:c,z:a}=Kr(o,e,{...o.position,z:((s=o[j])==null?void 0:s.z)??0},t);o.positionAbsolute={x:i,y:c},o[j].z=a,n!=null&&n[o.id]&&(o[j].isParent=!0)}})}function fn(e,t,n,o){const r=new Map,s={},i=o?1e3:0;return e.forEach(c=>{var h;const a=(ye(c.zIndex)?c.zIndex:0)+(c.selected?i:0),u=t.get(c.id),l={...c,positionAbsolute:{x:c.position.x,y:c.position.y}},d=c.parentNode||c.parentId;d&&(s[d]=!0);const g=(u==null?void 0:u.type)&&(u==null?void 0:u.type)!==c.type;Object.defineProperty(l,j,{enumerable:!1,value:{handleBounds:g||(h=u==null?void 0:u[j])==null?void 0:h.handleBounds,z:a}}),r.set(c.id,l)}),Wr(r,n,s),r}function Gr(e,t={}){const{getNodes:n,width:o,height:r,minZoom:s,maxZoom:i,d3Zoom:c,d3Selection:a,fitViewOnInitDone:u,fitViewOnInit:l,nodeOrigin:d}=e(),g=t.initial&&!u&&l;if(c&&a&&(g||!t.initial)){const w=n().filter(_=>{var x;const y=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(x=t.nodes)!=null&&x.length?y&&t.nodes.some(N=>N.id===_.id):y}),m=w.every(_=>_.width&&_.height);if(w.length>0&&m){const _=Ke(w,d),{x:y,y:x,zoom:N}=Jt(_,o,r,t.minZoom??s,t.maxZoom??i,t.padding??.1),S=Te.translate(y,x).scale(N);return typeof t.duration=="number"&&t.duration>0?c.transform(Ye(a,t.duration),S):c.transform(a,S),!0}}return!1}function tu(e,t){return e.forEach(n=>{const o=t.get(n.id);o&&t.set(o.id,{...o,[j]:o[j],selected:n.selected})}),new Map(t)}function nu(e,t){return t.map(n=>{const o=e.find(r=>r.id===n.id);return o&&(n.selected=o.selected),n})}function Pt({changedNodes:e,changedEdges:t,get:n,set:o}){const{nodeInternals:r,edges:s,onNodesChange:i,onEdgesChange:c,hasDefaultNodes:a,hasDefaultEdges:u}=n();e!=null&&e.length&&(a&&o({nodeInternals:tu(e,r)}),i==null||i(e)),t!=null&&t.length&&(u&&o({edges:nu(t,s)}),c==null||c(t))}const Ge=()=>{},ou={zoomIn:Ge,zoomOut:Ge,zoomTo:Ge,getZoom:()=>1,setViewport:Ge,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ge,fitBounds:Ge,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},ru=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),iu=()=>{const e=ne(),{d3Zoom:t,d3Selection:n}=G(ru,oe);return f.useMemo(()=>n&&t?{zoomIn:r=>t.scaleBy(Ye(n,r==null?void 0:r.duration),1.2),zoomOut:r=>t.scaleBy(Ye(n,r==null?void 0:r.duration),1/1.2),zoomTo:(r,s)=>t.scaleTo(Ye(n,s==null?void 0:s.duration),r),getZoom:()=>e.getState().transform[2],setViewport:(r,s)=>{const[i,c,a]=e.getState().transform,u=Te.translate(r.x??i,r.y??c).scale(r.zoom??a);t.transform(Ye(n,s==null?void 0:s.duration),u)},getViewport:()=>{const[r,s,i]=e.getState().transform;return{x:r,y:s,zoom:i}},fitView:r=>Gr(e.getState,r),setCenter:(r,s,i)=>{const{width:c,height:a,maxZoom:u}=e.getState(),l=typeof(i==null?void 0:i.zoom)<"u"?i.zoom:u,d=c/2-r*l,g=a/2-s*l,h=Te.translate(d,g).scale(l);t.transform(Ye(n,i==null?void 0:i.duration),h)},fitBounds:(r,s)=>{const{width:i,height:c,minZoom:a,maxZoom:u}=e.getState(),{x:l,y:d,zoom:g}=Jt(r,i,c,a,u,(s==null?void 0:s.padding)??.1),h=Te.translate(l,d).scale(g);t.transform(Ye(n,s==null?void 0:s.duration),h)},project:r=>{const{transform:s,snapToGrid:i,snapGrid:c}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),An(r,s,i,c)},screenToFlowPosition:r=>{const{transform:s,snapToGrid:i,snapGrid:c,domNode:a}=e.getState();if(!a)return r;const{x:u,y:l}=a.getBoundingClientRect(),d={x:r.x-u,y:r.y-l};return An(d,s,i,c)},flowToScreenPosition:r=>{const{transform:s,domNode:i}=e.getState();if(!i)return r;const{x:c,y:a}=i.getBoundingClientRect(),u=$r(r,s);return{x:u.x+c,y:u.y+a}},viewportInitialized:!0}:ou,[t,n])};function jt(){const e=iu(),t=ne(),n=f.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),o=f.useCallback(m=>t.getState().nodeInternals.get(m),[]),r=f.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(_=>({..._}))},[]),s=f.useCallback(m=>{const{edges:_=[]}=t.getState();return _.find(y=>y.id===m)},[]),i=f.useCallback(m=>{const{getNodes:_,setNodes:y,hasDefaultNodes:x,onNodesChange:N}=t.getState(),S=_(),C=typeof m=="function"?m(S):m;if(x)y(C);else if(N){const M=C.length===0?S.map(P=>({type:"remove",id:P.id})):C.map(P=>({item:P,type:"reset"}));N(M)}},[]),c=f.useCallback(m=>{const{edges:_=[],setEdges:y,hasDefaultEdges:x,onEdgesChange:N}=t.getState(),S=typeof m=="function"?m(_):m;if(x)y(S);else if(N){const C=S.length===0?_.map(M=>({type:"remove",id:M.id})):S.map(M=>({item:M,type:"reset"}));N(C)}},[]),a=f.useCallback(m=>{const _=Array.isArray(m)?m:[m],{getNodes:y,setNodes:x,hasDefaultNodes:N,onNodesChange:S}=t.getState();if(N){const M=[...y(),..._];x(M)}else if(S){const C=_.map(M=>({item:M,type:"add"}));S(C)}},[]),u=f.useCallback(m=>{const _=Array.isArray(m)?m:[m],{edges:y=[],setEdges:x,hasDefaultEdges:N,onEdgesChange:S}=t.getState();if(N)x([...y,..._]);else if(S){const C=_.map(M=>({item:M,type:"add"}));S(C)}},[]),l=f.useCallback(()=>{const{getNodes:m,edges:_=[],transform:y}=t.getState(),[x,N,S]=y;return{nodes:m().map(C=>({...C})),edges:_.map(C=>({...C})),viewport:{x,y:N,zoom:S}}},[]),d=f.useCallback(({nodes:m,edges:_})=>{const{nodeInternals:y,getNodes:x,edges:N,hasDefaultNodes:S,hasDefaultEdges:C,onNodesDelete:M,onEdgesDelete:P,onNodesChange:D,onEdgesChange:k}=t.getState(),B=(m||[]).map(b=>b.id),O=(_||[]).map(b=>b.id),V=x().reduce((b,E)=>{const T=E.parentNode||E.parentId,$=!B.includes(E.id)&&T&&b.find(A=>A.id===T);return(typeof E.deletable=="boolean"?E.deletable:!0)&&(B.includes(E.id)||$)&&b.push(E),b},[]),z=N.filter(b=>typeof b.deletable=="boolean"?b.deletable:!0),p=z.filter(b=>O.includes(b.id));if(V||p){const b=Kn(V,z),E=[...p,...b],T=E.reduce(($,v)=>($.includes(v.id)||$.push(v.id),$),[]);if((C||S)&&(C&&t.setState({edges:N.filter($=>!T.includes($.id))}),S&&(V.forEach($=>{y.delete($.id)}),t.setState({nodeInternals:new Map(y)}))),T.length>0&&(P==null||P(E),k&&k(T.map($=>({id:$,type:"remove"})))),V.length>0&&(M==null||M(V),D)){const $=V.map(v=>({id:v.id,type:"remove"}));D($)}}},[]),g=f.useCallback(m=>{const _=Nl(m),y=_?null:t.getState().nodeInternals.get(m.id);return!_&&!y?[null,null,_]:[_?m:Eo(y),y,_]},[]),h=f.useCallback((m,_=!0,y)=>{const[x,N,S]=g(m);return x?(y||t.getState().getNodes()).filter(C=>{if(!S&&(C.id===N.id||!C.positionAbsolute))return!1;const M=Eo(C),P=Nn(M,x);return _&&P>0||P>=x.width*x.height}):[]},[]),w=f.useCallback((m,_,y=!0)=>{const[x]=g(m);if(!x)return!1;const N=Nn(x,_);return y&&N>0||N>=x.width*x.height},[]);return f.useMemo(()=>({...e,getNodes:n,getNode:o,getEdges:r,getEdge:s,setNodes:i,setEdges:c,addNodes:a,addEdges:u,toObject:l,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:w}),[e,n,o,r,s,i,c,a,u,l,d,h,w])}const su={actInsideInputWithModifier:!1};var cu=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=ne(),{deleteElements:o}=jt(),r=rt(e,su),s=rt(t);f.useEffect(()=>{if(r){const{edges:i,getNodes:c}=n.getState(),a=c().filter(l=>l.selected),u=i.filter(l=>l.selected);o({nodes:a,edges:u}),n.setState({nodesSelectionActive:!1})}},[r]),f.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])};function au(e){const t=ne();f.useEffect(()=>{let n;const o=()=>{var s,i;if(!e.current)return;const r=Vn(e.current);(r.height===0||r.width===0)&&((i=(s=t.getState()).onError)==null||i.call(s,"004",ge.error004())),t.setState({width:r.width||500,height:r.height||500})};return o(),window.addEventListener("resize",o),e.current&&(n=new ResizeObserver(()=>o()),n.observe(e.current)),()=>{window.removeEventListener("resize",o),n&&e.current&&n.unobserve(e.current)}},[])}const Zn={position:"absolute",width:"100%",height:"100%",top:0,left:0},lu=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Tt=e=>({x:e.x,y:e.y,zoom:e.k}),Ze=(e,t)=>e.target.closest(`.${t}`),$o=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Io=e=>{const t=e.ctrlKey&&Lt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},uu=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),du=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:s=!0,panOnScroll:i=!1,panOnScrollSpeed:c=.5,panOnScrollMode:a=exports.PanOnScrollMode.Free,zoomOnDoubleClick:u=!0,elementsSelectable:l,panOnDrag:d=!0,defaultViewport:g,translateExtent:h,minZoom:w,maxZoom:m,zoomActivationKeyCode:_,preventScrolling:y=!0,children:x,noWheelClassName:N,noPanClassName:S})=>{const C=f.useRef(),M=ne(),P=f.useRef(!1),D=f.useRef(!1),k=f.useRef(null),B=f.useRef({x:0,y:0,zoom:0}),{d3Zoom:O,d3Selection:V,d3ZoomHandler:z,userSelectionActive:p}=G(uu,oe),b=rt(_),E=f.useRef(0),T=f.useRef(!1),$=f.useRef();return au(k),f.useEffect(()=>{if(k.current){const v=k.current.getBoundingClientRect(),A=mr().scaleExtent([w,m]).translateExtent(h),I=fe(k.current).call(A),R=Te.translate(g.x,g.y).scale($e(g.zoom,w,m)),F=[[0,0],[v.width,v.height]],L=A.constrain()(R,F,h);A.transform(I,L),A.wheelDelta(Io),M.setState({d3Zoom:A,d3Selection:I,d3ZoomHandler:I.on("wheel.zoom"),transform:[L.x,L.y,L.k],domNode:k.current.closest(".react-flow")})}},[]),f.useEffect(()=>{V&&O&&(i&&!b&&!p?V.on("wheel.zoom",v=>{if(Ze(v,N))return!1;v.preventDefault(),v.stopImmediatePropagation();const A=V.property("__zoom").k||1;if(v.ctrlKey&&s){const q=Se(v),Z=Io(v),W=A*Math.pow(2,Z);O.scaleTo(V,W,q,v);return}const I=v.deltaMode===1?20:1;let R=a===exports.PanOnScrollMode.Vertical?0:v.deltaX*I,F=a===exports.PanOnScrollMode.Horizontal?0:v.deltaY*I;!Lt()&&v.shiftKey&&a!==exports.PanOnScrollMode.Vertical&&(R=v.deltaY*I,F=0),O.translateBy(V,-(R/A)*c,-(F/A)*c,{internal:!0});const L=Tt(V.property("__zoom")),{onViewportChangeStart:X,onViewportChange:Y,onViewportChangeEnd:U}=M.getState();clearTimeout($.current),T.current||(T.current=!0,t==null||t(v,L),X==null||X(L)),T.current&&(e==null||e(v,L),Y==null||Y(L),$.current=setTimeout(()=>{n==null||n(v,L),U==null||U(L),T.current=!1},150))},{passive:!1}):typeof z<"u"&&V.on("wheel.zoom",function(v,A){if(!y&&v.type==="wheel"&&!v.ctrlKey||Ze(v,N))return null;v.preventDefault(),z.call(this,v,A)},{passive:!1}))},[p,i,a,V,O,z,b,s,y,N,t,e,n]),f.useEffect(()=>{O&&O.on("start",v=>{var R,F;if(!v.sourceEvent||v.sourceEvent.internal)return null;E.current=(R=v.sourceEvent)==null?void 0:R.button;const{onViewportChangeStart:A}=M.getState(),I=Tt(v.transform);P.current=!0,B.current=I,((F=v.sourceEvent)==null?void 0:F.type)==="mousedown"&&M.setState({paneDragging:!0}),A==null||A(I),t==null||t(v.sourceEvent,I)})},[O,t]),f.useEffect(()=>{O&&(p&&!P.current?O.on("zoom",null):p||O.on("zoom",v=>{var I;const{onViewportChange:A}=M.getState();if(M.setState({transform:[v.transform.x,v.transform.y,v.transform.k]}),D.current=!!(o&&$o(d,E.current??0)),(e||A)&&!((I=v.sourceEvent)!=null&&I.internal)){const R=Tt(v.transform);A==null||A(R),e==null||e(v.sourceEvent,R)}}))},[p,O,e,d,o]),f.useEffect(()=>{O&&O.on("end",v=>{if(!v.sourceEvent||v.sourceEvent.internal)return null;const{onViewportChangeEnd:A}=M.getState();if(P.current=!1,M.setState({paneDragging:!1}),o&&$o(d,E.current??0)&&!D.current&&o(v.sourceEvent),D.current=!1,(n||A)&&lu(B.current,v.transform)){const I=Tt(v.transform);B.current=I,clearTimeout(C.current),C.current=setTimeout(()=>{A==null||A(I),n==null||n(v.sourceEvent,I)},i?150:0)}})},[O,i,d,n,o]),f.useEffect(()=>{O&&O.filter(v=>{const A=b||r,I=s&&v.ctrlKey;if((d===!0||Array.isArray(d)&&d.includes(1))&&v.button===1&&v.type==="mousedown"&&(Ze(v,"react-flow__node")||Ze(v,"react-flow__edge")))return!0;if(!d&&!A&&!i&&!u&&!s||p||!u&&v.type==="dblclick"||Ze(v,N)&&v.type==="wheel"||Ze(v,S)&&(v.type!=="wheel"||i&&v.type==="wheel"&&!b)||!s&&v.ctrlKey&&v.type==="wheel"||!A&&!i&&!I&&v.type==="wheel"||!d&&(v.type==="mousedown"||v.type==="touchstart")||Array.isArray(d)&&!d.includes(v.button)&&v.type==="mousedown")return!1;const R=Array.isArray(d)&&d.includes(v.button)||!v.button||v.button<=1;return(!v.ctrlKey||v.type==="wheel")&&R})},[p,O,r,s,i,u,d,l,b]),f.createElement("div",{className:"react-flow__renderer",ref:k,style:Zn},x)},fu=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function hu(){const{userSelectionActive:e,userSelectionRect:t}=G(fu,oe);return e&&t?f.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Tn(e,t){const n=t.parentNode||t.parentId,o=e.find(r=>r.id===n);if(o){const r=t.position.x+t.width-o.width,s=t.position.y+t.height-o.height;if(r>0||s>0||t.position.x<0||t.position.y<0){if(o.style={...o.style},o.style.width=o.style.width??o.width,o.style.height=o.style.height??o.height,r>0&&(o.style.width+=r),s>0&&(o.style.height+=s),t.position.x<0){const i=Math.abs(t.position.x);o.position.x=o.position.x-i,o.style.width+=i,t.position.x=0}if(t.position.y<0){const i=Math.abs(t.position.y);o.position.y=o.position.y-i,o.style.height+=i,t.position.y=0}o.width=o.style.width,o.height=o.style.height}}}function Zr(e,t){if(e.some(o=>o.type==="reset"))return e.filter(o=>o.type==="reset").map(o=>o.item);const n=e.filter(o=>o.type==="add").map(o=>o.item);return t.reduce((o,r)=>{const s=e.filter(c=>c.id===r.id);if(s.length===0)return o.push(r),o;const i={...r};for(const c of s)if(c)switch(c.type){case"select":{i.selected=c.selected;break}case"position":{typeof c.position<"u"&&(i.position=c.position),typeof c.positionAbsolute<"u"&&(i.positionAbsolute=c.positionAbsolute),typeof c.dragging<"u"&&(i.dragging=c.dragging),i.expandParent&&Tn(o,i);break}case"dimensions":{typeof c.dimensions<"u"&&(i.width=c.dimensions.width,i.height=c.dimensions.height),typeof c.updateStyle<"u"&&(i.style={...i.style||{},...c.dimensions}),typeof c.resizing=="boolean"&&(i.resizing=c.resizing),i.expandParent&&Tn(o,i);break}case"remove":return o}return o.push(i),o},n)}function qn(e,t){return Zr(e,t)}function qr(e,t){return Zr(e,t)}const Oe=(e,t)=>({id:e,type:"select",selected:t});function Qe(e,t){return e.reduce((n,o)=>{const r=t.includes(o.id);return!o.selected&&r?(o.selected=!0,n.push(Oe(o.id,!0))):o.selected&&!r&&(o.selected=!1,n.push(Oe(o.id,!1))),n},[])}const hn=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},gu=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),Qr=f.memo(({isSelecting:e,selectionMode:t=exports.SelectionMode.Full,panOnDrag:n,onSelectionStart:o,onSelectionEnd:r,onPaneClick:s,onPaneContextMenu:i,onPaneScroll:c,onPaneMouseEnter:a,onPaneMouseMove:u,onPaneMouseLeave:l,children:d})=>{const g=f.useRef(null),h=ne(),w=f.useRef(0),m=f.useRef(0),_=f.useRef(),{userSelectionActive:y,elementsSelectable:x,dragging:N}=G(gu,oe),S=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),w.current=0,m.current=0},C=z=>{s==null||s(z),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},M=z=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){z.preventDefault();return}i==null||i(z)},P=c?z=>c(z):void 0,D=z=>{const{resetSelectedElements:p,domNode:b}=h.getState();if(_.current=b==null?void 0:b.getBoundingClientRect(),!x||!e||z.button!==0||z.target!==g.current||!_.current)return;const{x:E,y:T}=Be(z,_.current);p(),h.setState({userSelectionRect:{width:0,height:0,startX:E,startY:T,x:E,y:T}}),o==null||o(z)},k=z=>{const{userSelectionRect:p,nodeInternals:b,edges:E,transform:T,onNodesChange:$,onEdgesChange:v,nodeOrigin:A,getNodes:I}=h.getState();if(!e||!_.current||!p)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const R=Be(z,_.current),F=p.startX??0,L=p.startY??0,X={...p,x:R.x<F?R.x:F,y:R.y<L?R.y:L,width:Math.abs(R.x-F),height:Math.abs(R.y-L)},Y=I(),U=Ir(b,X,T,t===exports.SelectionMode.Partial,!0,A),q=Kn(U,E).map(W=>W.id),Z=U.map(W=>W.id);if(w.current!==Z.length){w.current=Z.length;const W=Qe(Y,Z);W.length&&($==null||$(W))}if(m.current!==q.length){m.current=q.length;const W=Qe(E,q);W.length&&(v==null||v(W))}h.setState({userSelectionRect:X})},B=z=>{if(z.button!==0)return;const{userSelectionRect:p}=h.getState();!y&&p&&z.target===g.current&&(C==null||C(z)),h.setState({nodesSelectionActive:w.current>0}),S(),r==null||r(z)},O=z=>{y&&(h.setState({nodesSelectionActive:w.current>0}),r==null||r(z)),S()},V=x&&(e||y);return f.createElement("div",{className:se(["react-flow__pane",{dragging:N,selection:e}]),onClick:V?void 0:hn(C,g),onContextMenu:hn(M,g),onWheel:hn(P,g),onMouseEnter:V?void 0:a,onMouseDown:V?D:void 0,onMouseMove:V?k:u,onMouseUp:V?B:void 0,onMouseLeave:V?O:l,ref:g,style:Zn},d,f.createElement(hu,null))});Qr.displayName="Pane";function Jr(e,t){const n=e.parentNode||e.parentId;if(!n)return!1;const o=t.get(n);return o?o.selected?!0:Jr(o,t):!1}function Do(e,t,n){let o=e;do{if(o!=null&&o.matches(t))return!0;if(o===n.current)return!1;o=o.parentElement}while(o);return!1}function pu(e,t,n,o){return Array.from(e.values()).filter(r=>(r.selected||r.id===o)&&(!r.parentNode||r.parentId||!Jr(r,e))&&(r.draggable||t&&typeof r.draggable>"u")).map(r=>{var s,i;return{id:r.id,position:r.position||{x:0,y:0},positionAbsolute:r.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((s=r.positionAbsolute)==null?void 0:s.x)??0),y:n.y-(((i=r.positionAbsolute)==null?void 0:i.y)??0)},delta:{x:0,y:0},extent:r.extent,parentNode:r.parentNode||r.parentId,parentId:r.parentNode||r.parentId,width:r.width,height:r.height,expandParent:r.expandParent}})}function mu(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function jr(e,t,n,o,r=[0,0],s){const i=mu(e,e.extent||o);let c=i;const a=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(a&&e.width&&e.height){const d=n.get(a),{x:g,y:h}=Ve(d,r).positionAbsolute;c=d&&ye(g)&&ye(h)&&ye(d.width)&&ye(d.height)?[[g+e.width*r[0],h+e.height*r[1]],[g+d.width-e.width+e.width*r[0],h+d.height-e.height+e.height*r[1]]]:c}else s==null||s("005",ge.error005()),c=i;else if(e.extent&&a&&e.extent!=="parent"){const d=n.get(a),{x:g,y:h}=Ve(d,r).positionAbsolute;c=[[e.extent[0][0]+g,e.extent[0][1]+h],[e.extent[1][0]+g,e.extent[1][1]+h]]}let u={x:0,y:0};if(a){const d=n.get(a);u=Ve(d,r).positionAbsolute}const l=c&&c!=="parent"?Ln(t,c):t;return{position:{x:l.x-u.x,y:l.y-u.y},positionAbsolute:l}}function gn({nodeId:e,dragItems:t,nodeInternals:n}){const o=t.map(r=>({...n.get(r.id),position:r.position,positionAbsolute:r.positionAbsolute}));return[e?o.find(r=>r.id===e):o[0],o]}const Ro=(e,t,n,o)=>{const r=t.querySelectorAll(e);if(!r||!r.length)return null;const s=Array.from(r),i=t.getBoundingClientRect(),c={x:i.width*o[0],y:i.height*o[1]};return s.map(a=>{const u=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),position:a.getAttribute("data-handlepos"),x:(u.left-i.left-c.x)/n,y:(u.top-i.top-c.y)/n,...Vn(a)}})};function ft(e,t,n){return n===void 0?n:o=>{const r=t().nodeInternals.get(e);r&&n(o,{...r})}}function kn({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:s,multiSelectionActive:i,nodeInternals:c,onError:a}=t.getState(),u=c.get(e);if(!u){a==null||a("012",ge.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&i)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var l;return(l=o==null?void 0:o.current)==null?void 0:l.blur()})):r([e])}function Qn(){const e=ne();return f.useCallback(({sourceEvent:n})=>{const{transform:o,snapGrid:r,snapToGrid:s}=e.getState(),i=n.touches?n.touches[0].clientX:n.clientX,c=n.touches?n.touches[0].clientY:n.clientY,a={x:(i-o[0])/o[2],y:(c-o[1])/o[2]};return{xSnapped:s?r[0]*Math.round(a.x/r[0]):a.x,ySnapped:s?r[1]*Math.round(a.y/r[1]):a.y,...a}},[])}function pn(e){return(t,n,o)=>e==null?void 0:e(t,o)}function ei({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:s,selectNodesOnDrag:i}){const c=ne(),[a,u]=f.useState(!1),l=f.useRef([]),d=f.useRef({x:null,y:null}),g=f.useRef(0),h=f.useRef(null),w=f.useRef({x:0,y:0}),m=f.useRef(null),_=f.useRef(!1),y=f.useRef(!1),x=f.useRef(!1),N=Qn();return f.useEffect(()=>{if(e!=null&&e.current){const S=fe(e.current),C=({x:D,y:k})=>{const{nodeInternals:B,onNodeDrag:O,onSelectionDrag:V,updateNodePositions:z,nodeExtent:p,snapGrid:b,snapToGrid:E,nodeOrigin:T,onError:$}=c.getState();d.current={x:D,y:k};let v=!1,A={x:0,y:0,x2:0,y2:0};if(l.current.length>1&&p){const R=Ke(l.current,T);A=ot(R)}if(l.current=l.current.map(R=>{const F={x:D-R.distance.x,y:k-R.distance.y};E&&(F.x=b[0]*Math.round(F.x/b[0]),F.y=b[1]*Math.round(F.y/b[1]));const L=[[p[0][0],p[0][1]],[p[1][0],p[1][1]]];l.current.length>1&&p&&!R.extent&&(L[0][0]=R.positionAbsolute.x-A.x+p[0][0],L[1][0]=R.positionAbsolute.x+(R.width??0)-A.x2+p[1][0],L[0][1]=R.positionAbsolute.y-A.y+p[0][1],L[1][1]=R.positionAbsolute.y+(R.height??0)-A.y2+p[1][1]);const X=jr(R,F,B,L,T,$);return v=v||R.position.x!==X.position.x||R.position.y!==X.position.y,R.position=X.position,R.positionAbsolute=X.positionAbsolute,R}),!v)return;z(l.current,!0,!0),u(!0);const I=r?O:pn(V);if(I&&m.current){const[R,F]=gn({nodeId:r,dragItems:l.current,nodeInternals:B});I(m.current,R,F)}},M=()=>{if(!h.current)return;const[D,k]=_r(w.current,h.current);if(D!==0||k!==0){const{transform:B,panBy:O}=c.getState();d.current.x=(d.current.x??0)-D/B[2],d.current.y=(d.current.y??0)-k/B[2],O({x:D,y:k})&&C(d.current)}g.current=requestAnimationFrame(M)},P=D=>{var T;const{nodeInternals:k,multiSelectionActive:B,nodesDraggable:O,unselectNodesAndEdges:V,onNodeDragStart:z,onSelectionDragStart:p}=c.getState();y.current=!0;const b=r?z:pn(p);(!i||!s)&&!B&&r&&((T=k.get(r))!=null&&T.selected||V()),r&&s&&i&&kn({id:r,store:c,nodeRef:e});const E=N(D);if(d.current=E,l.current=pu(k,O,E,r),b&&l.current){const[$,v]=gn({nodeId:r,dragItems:l.current,nodeInternals:k});b(D.sourceEvent,$,v)}};if(t)S.on(".drag",null);else{const D=ar().on("start",k=>{const{domNode:B,nodeDragThreshold:O}=c.getState();O===0&&P(k),x.current=!1;const V=N(k);d.current=V,h.current=(B==null?void 0:B.getBoundingClientRect())||null,w.current=Be(k.sourceEvent,h.current)}).on("drag",k=>{var z,p;const B=N(k),{autoPanOnNodeDrag:O,nodeDragThreshold:V}=c.getState();if(k.sourceEvent.type==="touchmove"&&k.sourceEvent.touches.length>1&&(x.current=!0),!x.current){if(!_.current&&y.current&&O&&(_.current=!0,M()),!y.current){const b=B.xSnapped-(((z=d==null?void 0:d.current)==null?void 0:z.x)??0),E=B.ySnapped-(((p=d==null?void 0:d.current)==null?void 0:p.y)??0);Math.sqrt(b*b+E*E)>V&&P(k)}(d.current.x!==B.xSnapped||d.current.y!==B.ySnapped)&&l.current&&y.current&&(m.current=k.sourceEvent,w.current=Be(k.sourceEvent,h.current),C(B))}}).on("end",k=>{if(!(!y.current||x.current)&&(u(!1),_.current=!1,y.current=!1,cancelAnimationFrame(g.current),l.current)){const{updateNodePositions:B,nodeInternals:O,onNodeDragStop:V,onSelectionDragStop:z}=c.getState(),p=r?V:pn(z);if(B(l.current,!1,!1),p){const[b,E]=gn({nodeId:r,dragItems:l.current,nodeInternals:O});p(k.sourceEvent,b,E)}}}).filter(k=>{const B=k.target;return!k.button&&(!n||!Do(B,`.${n}`,e))&&(!o||Do(B,o,e))});return S.call(D),()=>{S.on(".drag",null)}}}},[e,t,n,o,s,c,r,i,N]),a}function ti(){const e=ne();return f.useCallback(n=>{const{nodeInternals:o,nodeExtent:r,updateNodePositions:s,getNodes:i,snapToGrid:c,snapGrid:a,onError:u,nodesDraggable:l}=e.getState(),d=i().filter(x=>x.selected&&(x.draggable||l&&typeof x.draggable>"u")),g=c?a[0]:5,h=c?a[1]:5,w=n.isShiftPressed?4:1,m=n.x*g*w,_=n.y*h*w,y=d.map(x=>{if(x.positionAbsolute){const N={x:x.positionAbsolute.x+m,y:x.positionAbsolute.y+_};c&&(N.x=a[0]*Math.round(N.x/a[0]),N.y=a[1]*Math.round(N.y/a[1]));const{positionAbsolute:S,position:C}=jr(x,N,o,r,void 0,u);x.position=C,x.positionAbsolute=S}return x});s(y,!0,!1)},[])}const et={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var ht=e=>{const t=({id:n,type:o,data:r,xPos:s,yPos:i,xPosOrigin:c,yPosOrigin:a,selected:u,onClick:l,onMouseEnter:d,onMouseMove:g,onMouseLeave:h,onContextMenu:w,onDoubleClick:m,style:_,className:y,isDraggable:x,isSelectable:N,isConnectable:S,isFocusable:C,selectNodesOnDrag:M,sourcePosition:P,targetPosition:D,hidden:k,resizeObserver:B,dragHandle:O,zIndex:V,isParent:z,noDragClassName:p,noPanClassName:b,initialized:E,disableKeyboardA11y:T,ariaLabel:$,rfId:v,hasHandleBounds:A})=>{const I=ne(),R=f.useRef(null),F=f.useRef(null),L=f.useRef(P),X=f.useRef(D),Y=f.useRef(o),U=N||x||l||d||g||h,q=ti(),Z=ft(n,I.getState,d),W=ft(n,I.getState,g),ee=ft(n,I.getState,h),re=ft(n,I.getState,w),ce=ft(n,I.getState,m),ie=Q=>{const{nodeDragThreshold:H}=I.getState();if(N&&(!M||!x||H>0)&&kn({id:n,store:I,nodeRef:R}),l){const J=I.getState().nodeInternals.get(n);J&&l(Q,{...J})}},te=Q=>{if(!Cn(Q)&&!T)if(xr.includes(Q.key)&&N){const H=Q.key==="Escape";kn({id:n,store:I,unselect:H,nodeRef:R})}else x&&u&&Object.prototype.hasOwnProperty.call(et,Q.key)&&(I.setState({ariaLiveMessage:`Moved selected node ${Q.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~s}, y: ${~~i}`}),q({x:et[Q.key].x,y:et[Q.key].y,isShiftPressed:Q.shiftKey}))};f.useEffect(()=>()=>{F.current&&(B==null||B.unobserve(F.current),F.current=null)},[]),f.useEffect(()=>{if(R.current&&!k){const Q=R.current;(!E||!A||F.current!==Q)&&(F.current&&(B==null||B.unobserve(F.current)),B==null||B.observe(Q),F.current=Q)}},[k,E,A]),f.useEffect(()=>{const Q=Y.current!==o,H=L.current!==P,J=X.current!==D;R.current&&(Q||H||J)&&(Q&&(Y.current=o),H&&(L.current=P),J&&(X.current=D),I.getState().updateNodeDimensions([{id:n,nodeElement:R.current,forceUpdate:!0}]))},[n,o,P,D]);const ae=ei({nodeRef:R,disabled:k||!x,noDragClassName:p,handleSelector:O,nodeId:n,isSelectable:N,selectNodesOnDrag:M});return k?null:f.createElement("div",{className:se(["react-flow__node",`react-flow__node-${o}`,{[b]:x},y,{selected:u,selectable:N,parent:z,dragging:ae}]),ref:R,style:{zIndex:V,transform:`translate(${c}px,${a}px)`,pointerEvents:U?"all":"none",visibility:E?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:Z,onMouseMove:W,onMouseLeave:ee,onContextMenu:re,onClick:ie,onDoubleClick:ce,onKeyDown:C?te:void 0,tabIndex:C?0:void 0,role:C?"button":void 0,"aria-describedby":T?void 0:`${Yr}-${v}`,"aria-label":$},f.createElement(kl,{value:n},f.createElement(e,{id:n,data:r,type:o,xPos:s,yPos:i,selected:u,isConnectable:S,sourcePosition:P,targetPosition:D,dragging:ae,dragHandle:O,zIndex:V})))};return t.displayName="NodeWrapper",f.memo(t)};const yu=e=>{const t=e.getNodes().filter(n=>n.selected);return{...Ke(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function wu({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=ne(),{width:r,height:s,x:i,y:c,transformString:a,userSelectionActive:u}=G(yu,oe),l=ti(),d=f.useRef(null);if(f.useEffect(()=>{var w;n||(w=d.current)==null||w.focus({preventScroll:!0})},[n]),ei({nodeRef:d}),u||!r||!s)return null;const g=e?w=>{const m=o.getState().getNodes().filter(_=>_.selected);e(w,m)}:void 0,h=w=>{Object.prototype.hasOwnProperty.call(et,w.key)&&l({x:et[w.key].x,y:et[w.key].y,isShiftPressed:w.shiftKey})};return f.createElement("div",{className:se(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a}},f.createElement("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:r,height:s,top:c,left:i}}))}var _u=f.memo(wu);const Su=e=>e.nodesSelectionActive,ni=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,deleteKeyCode:c,onMove:a,onMoveStart:u,onMoveEnd:l,selectionKeyCode:d,selectionOnDrag:g,selectionMode:h,onSelectionStart:w,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:y,zoomActivationKeyCode:x,elementsSelectable:N,zoomOnScroll:S,zoomOnPinch:C,panOnScroll:M,panOnScrollSpeed:P,panOnScrollMode:D,zoomOnDoubleClick:k,panOnDrag:B,defaultViewport:O,translateExtent:V,minZoom:z,maxZoom:p,preventScrolling:b,onSelectionContextMenu:E,noWheelClassName:T,noPanClassName:$,disableKeyboardA11y:v})=>{const A=G(Su),I=rt(d),R=rt(y),F=R||B,L=R||M,X=I||g&&F!==!0;return cu({deleteKeyCode:c,multiSelectionKeyCode:_}),f.createElement(du,{onMove:a,onMoveStart:u,onMoveEnd:l,onPaneContextMenu:s,elementsSelectable:N,zoomOnScroll:S,zoomOnPinch:C,panOnScroll:L,panOnScrollSpeed:P,panOnScrollMode:D,zoomOnDoubleClick:k,panOnDrag:!I&&F,defaultViewport:O,translateExtent:V,minZoom:z,maxZoom:p,zoomActivationKeyCode:x,preventScrolling:b,noWheelClassName:T,noPanClassName:$},f.createElement(Qr,{onSelectionStart:w,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:F,isSelecting:!!X,selectionMode:h},e,A&&f.createElement(_u,{onSelectionContextMenu:E,noPanClassName:$,disableKeyboardA11y:v})))};ni.displayName="FlowRenderer";var vu=f.memo(ni);function Eu(e){return G(f.useCallback(n=>e?Ir(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function xu(e){const t={input:ht(e.input||Lr),default:ht(e.default||Pn),output:ht(e.output||Fr),group:ht(e.group||Gn)},n={},o=Object.keys(e).filter(r=>!["input","default","output","group"].includes(r)).reduce((r,s)=>(r[s]=ht(e[s]||Pn),r),n);return{...t,...o}}const bu=({x:e,y:t,width:n,height:o,origin:r})=>!n||!o?{x:e,y:t}:r[0]<0||r[1]<0||r[0]>1||r[1]>1?{x:e,y:t}:{x:e-n*r[0],y:t-o*r[1]},Nu=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),oi=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,updateNodeDimensions:s,onError:i}=G(Nu,oe),c=Eu(e.onlyRenderVisibleElements),a=f.useRef(),u=f.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const l=new ResizeObserver(d=>{const g=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));s(g)});return a.current=l,l},[]);return f.useEffect(()=>()=>{var l;(l=a==null?void 0:a.current)==null||l.disconnect()},[]),f.createElement("div",{className:"react-flow__nodes",style:Zn},c.map(l=>{var C,M,P;let d=l.type||"default";e.nodeTypes[d]||(i==null||i("003",ge.error003(d)),d="default");const g=e.nodeTypes[d]||e.nodeTypes.default,h=!!(l.draggable||t&&typeof l.draggable>"u"),w=!!(l.selectable||r&&typeof l.selectable>"u"),m=!!(l.connectable||n&&typeof l.connectable>"u"),_=!!(l.focusable||o&&typeof l.focusable>"u"),y=e.nodeExtent?Ln(l.positionAbsolute,e.nodeExtent):l.positionAbsolute,x=(y==null?void 0:y.x)??0,N=(y==null?void 0:y.y)??0,S=bu({x,y:N,width:l.width??0,height:l.height??0,origin:e.nodeOrigin});return f.createElement(g,{key:l.id,id:l.id,className:l.className,style:l.style,type:d,data:l.data,sourcePosition:l.sourcePosition||exports.Position.Bottom,targetPosition:l.targetPosition||exports.Position.Top,hidden:l.hidden,xPos:x,yPos:N,xPosOrigin:S.x,yPosOrigin:S.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!l.selected,isDraggable:h,isSelectable:w,isConnectable:m,isFocusable:_,resizeObserver:u,dragHandle:l.dragHandle,zIndex:((C=l[j])==null?void 0:C.z)??0,isParent:!!((M=l[j])!=null&&M.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!l.width&&!!l.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:l.ariaLabel,hasHandleBounds:!!((P=l[j])!=null&&P.handleBounds)})}))};oi.displayName="NodeRenderer";var Cu=f.memo(oi);const Mu=(e,t,n)=>n===exports.Position.Left?e-t:n===exports.Position.Right?e+t:e,Au=(e,t,n)=>n===exports.Position.Top?e-t:n===exports.Position.Bottom?e+t:e,zo="react-flow__edgeupdater",Oo=({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:s,onMouseOut:i,type:c})=>f.createElement("circle",{onMouseDown:r,onMouseEnter:s,onMouseOut:i,className:se([zo,`${zo}-${c}`]),cx:Mu(t,o,e),cy:Au(n,o,e),r:o,stroke:"transparent",fill:"transparent"}),Pu=()=>!0;var qe=e=>{const t=({id:n,className:o,type:r,data:s,onClick:i,onEdgeDoubleClick:c,selected:a,animated:u,label:l,labelStyle:d,labelShowBg:g,labelBgStyle:h,labelBgPadding:w,labelBgBorderRadius:m,style:_,source:y,target:x,sourceX:N,sourceY:S,targetX:C,targetY:M,sourcePosition:P,targetPosition:D,elementsSelectable:k,hidden:B,sourceHandleId:O,targetHandleId:V,onContextMenu:z,onMouseEnter:p,onMouseMove:b,onMouseLeave:E,reconnectRadius:T,onReconnect:$,onReconnectStart:v,onReconnectEnd:A,markerEnd:I,markerStart:R,rfId:F,ariaLabel:L,isFocusable:X,isReconnectable:Y,pathOptions:U,interactionWidth:q,disableKeyboardA11y:Z})=>{const W=f.useRef(null),[ee,re]=f.useState(!1),[ce,ie]=f.useState(!1),te=ne(),ae=f.useMemo(()=>`url('#${Mn(R,F)}')`,[R,F]),Q=f.useMemo(()=>`url('#${Mn(I,F)}')`,[I,F]);if(B)return null;const H=le=>{var be;const{edges:_e,addSelectedEdges:Le,unselectNodesAndEdges:He,multiSelectionActive:Fe}=te.getState(),Me=_e.find(ct=>ct.id===n);Me&&(k&&(te.setState({nodesSelectionActive:!1}),Me.selected&&Fe?(He({nodes:[],edges:[Me]}),(be=W.current)==null||be.blur()):Le([n])),i&&i(le,Me))},J=dt(n,te.getState,c),pe=dt(n,te.getState,z),Ie=dt(n,te.getState,p),De=dt(n,te.getState,b),Ce=dt(n,te.getState,E),Ee=(le,_e)=>{if(le.button!==0)return;const{edges:Le,isValidConnection:He}=te.getState(),Fe=_e?x:y,Me=(_e?V:O)||null,be=_e?"target":"source",ct=He||Pu,en=_e,at=Le.find(Xe=>Xe.id===n);ie(!0),v==null||v(le,at,be);const tn=Xe=>{ie(!1),A==null||A(Xe,at,be)};zr({event:le,handleId:Me,nodeId:Fe,onConnect:Xe=>$==null?void 0:$(at,Xe),isTarget:en,getState:te.getState,setState:te.setState,isValidConnection:ct,edgeUpdaterType:be,onReconnectEnd:tn})},ue=le=>Ee(le,!0),de=le=>Ee(le,!1),me=()=>re(!0),we=()=>re(!1),xe=!k&&!i,st=le=>{var _e;if(!Z&&xr.includes(le.key)&&k){const{unselectNodesAndEdges:Le,addSelectedEdges:He,edges:Fe}=te.getState();le.key==="Escape"?((_e=W.current)==null||_e.blur(),Le({edges:[Fe.find(be=>be.id===n)]})):He([n])}};return f.createElement("g",{className:se(["react-flow__edge",`react-flow__edge-${r}`,o,{selected:a,animated:u,inactive:xe,updating:ee}]),onClick:H,onDoubleClick:J,onContextMenu:pe,onMouseEnter:Ie,onMouseMove:De,onMouseLeave:Ce,onKeyDown:X?st:void 0,tabIndex:X?0:void 0,role:X?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":L===null?void 0:L||`Edge from ${y} to ${x}`,"aria-describedby":X?`${Ur}-${F}`:void 0,ref:W},!ce&&f.createElement(e,{id:n,source:y,target:x,selected:a,animated:u,label:l,labelStyle:d,labelShowBg:g,labelBgStyle:h,labelBgPadding:w,labelBgBorderRadius:m,data:s,style:_,sourceX:N,sourceY:S,targetX:C,targetY:M,sourcePosition:P,targetPosition:D,sourceHandleId:O,targetHandleId:V,markerStart:ae,markerEnd:Q,pathOptions:U,interactionWidth:q}),Y&&f.createElement(f.Fragment,null,(Y==="source"||Y===!0)&&f.createElement(Oo,{position:P,centerX:N,centerY:S,radius:T,onMouseDown:ue,onMouseEnter:me,onMouseOut:we,type:"source"}),(Y==="target"||Y===!0)&&f.createElement(Oo,{position:D,centerX:C,centerY:M,radius:T,onMouseDown:de,onMouseEnter:me,onMouseOut:we,type:"target"})))};return t.displayName="EdgeWrapper",f.memo(t)};function Tu(e){const t={default:qe(e.default||_t),straight:qe(e.bezier||qt),step:qe(e.step||Zt),smoothstep:qe(e.step||Et),simplebezier:qe(e.simplebezier||Gt)},n={},o=Object.keys(e).filter(r=>!["default","bezier"].includes(r)).reduce((r,s)=>(r[s]=qe(e[s]||_t),r),n);return{...t,...o}}function Bo(e,t,n=null){const o=((n==null?void 0:n.x)||0)+t.x,r=((n==null?void 0:n.y)||0)+t.y,s=(n==null?void 0:n.width)||t.width,i=(n==null?void 0:n.height)||t.height;switch(e){case exports.Position.Top:return{x:o+s/2,y:r};case exports.Position.Right:return{x:o+s,y:r+i/2};case exports.Position.Bottom:return{x:o+s/2,y:r+i};case exports.Position.Left:return{x:o,y:r+i/2}}}function Vo(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const ku=(e,t,n,o,r,s)=>{const i=Bo(n,e,t),c=Bo(s,o,r);return{sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}};function $u({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:r,targetHeight:s,width:i,height:c,transform:a}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+r),y2:Math.max(e.y+o,t.y+s)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const l=ot({x:(0-a[0])/a[2],y:(0-a[1])/a[2],width:i/a[2],height:c/a[2]}),d=Math.max(0,Math.min(l.x2,u.x2)-Math.max(l.x,u.x)),g=Math.max(0,Math.min(l.y2,u.y2)-Math.max(l.y,u.y));return Math.ceil(d*g)>0}function Lo(e){var o,r,s,i,c;const t=((o=e==null?void 0:e[j])==null?void 0:o.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((r=e==null?void 0:e.positionAbsolute)==null?void 0:r.x)<"u"&&typeof((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.y)<"u";return[{x:((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)||0,y:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const Iu=[{level:0,isMaxLevel:!0,edges:[]}];function Du(e,t,n=!1){let o=-1;const r=e.reduce((i,c)=>{var l,d;const a=ye(c.zIndex);let u=a?c.zIndex:0;if(n){const g=t.get(c.target),h=t.get(c.source),w=c.selected||(g==null?void 0:g.selected)||(h==null?void 0:h.selected),m=Math.max(((l=h==null?void 0:h[j])==null?void 0:l.z)||0,((d=g==null?void 0:g[j])==null?void 0:d.z)||0,1e3);u=(a?c.zIndex:0)+(w?m:0)}return i[u]?i[u].push(c):i[u]=[c],o=u>o?u:o,i},{}),s=Object.entries(r).map(([i,c])=>{const a=+i;return{edges:c,level:a,isMaxLevel:a===o}});return s.length===0?Iu:s}function Ru(e,t,n){const o=G(f.useCallback(r=>e?r.edges.filter(s=>{const i=t.get(s.source),c=t.get(s.target);return(i==null?void 0:i.width)&&(i==null?void 0:i.height)&&(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&$u({sourcePos:i.positionAbsolute||{x:0,y:0},targetPos:c.positionAbsolute||{x:0,y:0},sourceWidth:i.width,sourceHeight:i.height,targetWidth:c.width,targetHeight:c.height,width:r.width,height:r.height,transform:r.transform})}):r.edges,[e,t]));return Du(o,t,n)}const zu=({color:e="none",strokeWidth:t=1})=>f.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),Ou=({color:e="none",strokeWidth:t=1})=>f.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Ho={[exports.MarkerType.Arrow]:zu,[exports.MarkerType.ArrowClosed]:Ou};function Bu(e){const t=ne();return f.useMemo(()=>{var r,s;return Object.prototype.hasOwnProperty.call(Ho,e)?Ho[e]:((s=(r=t.getState()).onError)==null||s.call(r,"009",ge.error009(e)),null)},[e])}const Vu=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:c="auto-start-reverse"})=>{const a=Bu(t);return a?f.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0"},f.createElement(a,{color:n,strokeWidth:i})):null},Lu=({defaultColor:e,rfId:t})=>n=>{const o=[];return n.edges.reduce((r,s)=>([s.markerStart,s.markerEnd].forEach(i=>{if(i&&typeof i=="object"){const c=Mn(i,t);o.includes(c)||(r.push({id:c,color:i.color||e,...i}),o.push(c))}}),r),[]).sort((r,s)=>r.id.localeCompare(s.id))},ri=({defaultColor:e,rfId:t})=>{const n=G(f.useCallback(Lu({defaultColor:e,rfId:t}),[e,t]),(o,r)=>!(o.length!==r.length||o.some((s,i)=>s.id!==r[i].id)));return f.createElement("defs",null,n.map(o=>f.createElement(Vu,{id:o.id,key:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient})))};ri.displayName="MarkerDefinitions";var Hu=f.memo(ri);const Fu=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),ii=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:o,edgeTypes:r,noPanClassName:s,onEdgeContextMenu:i,onEdgeMouseEnter:c,onEdgeMouseMove:a,onEdgeMouseLeave:u,onEdgeClick:l,onEdgeDoubleClick:d,onReconnect:g,onReconnectStart:h,onReconnectEnd:w,reconnectRadius:m,children:_,disableKeyboardA11y:y})=>{const{edgesFocusable:x,edgesUpdatable:N,elementsSelectable:S,width:C,height:M,connectionMode:P,nodeInternals:D,onError:k}=G(Fu,oe),B=Ru(t,D,n);return C?f.createElement(f.Fragment,null,B.map(({level:O,edges:V,isMaxLevel:z})=>f.createElement("svg",{key:O,style:{zIndex:O},width:C,height:M,className:"react-flow__edges react-flow__container"},z&&f.createElement(Hu,{defaultColor:e,rfId:o}),f.createElement("g",null,V.map(p=>{const[b,E,T]=Lo(D.get(p.source)),[$,v,A]=Lo(D.get(p.target));if(!T||!A)return null;let I=p.type||"default";r[I]||(k==null||k("011",ge.error011(I)),I="default");const R=r[I]||r.default,F=P===exports.ConnectionMode.Strict?v.target:(v.target??[]).concat(v.source??[]),L=Vo(E.source,p.sourceHandle),X=Vo(F,p.targetHandle),Y=(L==null?void 0:L.position)||exports.Position.Bottom,U=(X==null?void 0:X.position)||exports.Position.Top,q=!!(p.focusable||x&&typeof p.focusable>"u"),Z=p.reconnectable||p.updatable,W=typeof g<"u"&&(Z||N&&typeof Z>"u");if(!L||!X)return k==null||k("008",ge.error008(L,p)),null;const{sourceX:ee,sourceY:re,targetX:ce,targetY:ie}=ku(b,L,Y,$,X,U);return f.createElement(R,{key:p.id,id:p.id,className:se([p.className,s]),type:I,data:p.data,selected:!!p.selected,animated:!!p.animated,hidden:!!p.hidden,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,style:p.style,source:p.source,target:p.target,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerEnd:p.markerEnd,markerStart:p.markerStart,sourceX:ee,sourceY:re,targetX:ce,targetY:ie,sourcePosition:Y,targetPosition:U,elementsSelectable:S,onContextMenu:i,onMouseEnter:c,onMouseMove:a,onMouseLeave:u,onClick:l,onEdgeDoubleClick:d,onReconnect:g,onReconnectStart:h,onReconnectEnd:w,reconnectRadius:m,rfId:o,ariaLabel:p.ariaLabel,isFocusable:q,isReconnectable:W,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth,disableKeyboardA11y:y})})))),_):null};ii.displayName="EdgeRenderer";var Xu=f.memo(ii);const Yu=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Uu({children:e}){const t=G(Yu);return f.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function Ku(e){const t=jt(),n=f.useRef(!1);f.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Wu={[exports.Position.Left]:exports.Position.Right,[exports.Position.Right]:exports.Position.Left,[exports.Position.Top]:exports.Position.Bottom,[exports.Position.Bottom]:exports.Position.Top},si=({nodeId:e,handleType:t,style:n,type:o=exports.ConnectionLineType.Bezier,CustomComponent:r,connectionStatus:s})=>{var M,P,D;const{fromNode:i,handleId:c,toX:a,toY:u,connectionMode:l}=G(f.useCallback(k=>({fromNode:k.nodeInternals.get(e),handleId:k.connectionHandleId,toX:(k.connectionPosition.x-k.transform[0])/k.transform[2],toY:(k.connectionPosition.y-k.transform[1])/k.transform[2],connectionMode:k.connectionMode}),[e]),oe),d=(M=i==null?void 0:i[j])==null?void 0:M.handleBounds;let g=d==null?void 0:d[t];if(l===exports.ConnectionMode.Loose&&(g=g||(d==null?void 0:d[t==="source"?"target":"source"])),!i||!g)return null;const h=c?g.find(k=>k.id===c):g[0],w=h?h.x+h.width/2:(i.width??0)/2,m=h?h.y+h.height/2:i.height??0,_=(((P=i.positionAbsolute)==null?void 0:P.x)??0)+w,y=(((D=i.positionAbsolute)==null?void 0:D.y)??0)+m,x=h==null?void 0:h.position,N=x?Wu[x]:null;if(!x||!N)return null;if(r)return f.createElement(r,{connectionLineType:o,connectionLineStyle:n,fromNode:i,fromHandle:h,fromX:_,fromY:y,toX:a,toY:u,fromPosition:x,toPosition:N,connectionStatus:s});let S="";const C={sourceX:_,sourceY:y,sourcePosition:x,targetX:a,targetY:u,targetPosition:N};return o===exports.ConnectionLineType.Bezier?[S]=Xn(C):o===exports.ConnectionLineType.Step?[S]=Ht({...C,borderRadius:0}):o===exports.ConnectionLineType.SmoothStep?[S]=Ht(C):o===exports.ConnectionLineType.SimpleBezier?[S]=Fn(C):S=`M${_},${y} ${a},${u}`,f.createElement("path",{d:S,fill:"none",className:"react-flow__connection-path",style:n})};si.displayName="ConnectionLine";const Gu=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function Zu({containerStyle:e,style:t,type:n,component:o}){const{nodeId:r,handleType:s,nodesConnectable:i,width:c,height:a,connectionStatus:u}=G(Gu,oe);return!(r&&s&&c&&i)?null:f.createElement("svg",{style:e,width:c,height:a,className:"react-flow__edges react-flow__connectionline react-flow__container"},f.createElement("g",{className:se(["react-flow__connection",u])},f.createElement(si,{nodeId:r,handleType:s,style:t,type:n,CustomComponent:o,connectionStatus:u})))}function Fo(e,t){const n=f.useRef(null),o=ne();return f.useMemo(()=>{var s,i;if(process.env.NODE_ENV==="development"){const c=Object.keys(e);oe(n.current,c)&&((i=(s=o.getState()).onError)==null||i.call(s,"002",ge.error002())),n.current=c}return t(e)},[e])}const ci=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:o,onMoveEnd:r,onInit:s,onNodeClick:i,onEdgeClick:c,onNodeDoubleClick:a,onEdgeDoubleClick:u,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:g,onNodeContextMenu:h,onSelectionContextMenu:w,onSelectionStart:m,onSelectionEnd:_,connectionLineType:y,connectionLineStyle:x,connectionLineComponent:N,connectionLineContainerStyle:S,selectionKeyCode:C,selectionOnDrag:M,selectionMode:P,multiSelectionKeyCode:D,panActivationKeyCode:k,zoomActivationKeyCode:B,deleteKeyCode:O,onlyRenderVisibleElements:V,elementsSelectable:z,selectNodesOnDrag:p,defaultViewport:b,translateExtent:E,minZoom:T,maxZoom:$,preventScrolling:v,defaultMarkerColor:A,zoomOnScroll:I,zoomOnPinch:R,panOnScroll:F,panOnScrollSpeed:L,panOnScrollMode:X,zoomOnDoubleClick:Y,panOnDrag:U,onPaneClick:q,onPaneMouseEnter:Z,onPaneMouseMove:W,onPaneMouseLeave:ee,onPaneScroll:re,onPaneContextMenu:ce,onEdgeContextMenu:ie,onEdgeMouseEnter:te,onEdgeMouseMove:ae,onEdgeMouseLeave:Q,onReconnect:H,onReconnectStart:J,onReconnectEnd:pe,reconnectRadius:Ie,noDragClassName:De,noWheelClassName:Ce,noPanClassName:Ee,elevateEdgesOnSelect:ue,disableKeyboardA11y:de,nodeOrigin:me,nodeExtent:we,rfId:xe})=>{const st=Fo(e,xu),le=Fo(t,Tu);return Ku(s),f.createElement(vu,{onPaneClick:q,onPaneMouseEnter:Z,onPaneMouseMove:W,onPaneMouseLeave:ee,onPaneContextMenu:ce,onPaneScroll:re,deleteKeyCode:O,selectionKeyCode:C,selectionOnDrag:M,selectionMode:P,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:D,panActivationKeyCode:k,zoomActivationKeyCode:B,elementsSelectable:z,onMove:n,onMoveStart:o,onMoveEnd:r,zoomOnScroll:I,zoomOnPinch:R,zoomOnDoubleClick:Y,panOnScroll:F,panOnScrollSpeed:L,panOnScrollMode:X,panOnDrag:U,defaultViewport:b,translateExtent:E,minZoom:T,maxZoom:$,onSelectionContextMenu:w,preventScrolling:v,noDragClassName:De,noWheelClassName:Ce,noPanClassName:Ee,disableKeyboardA11y:de},f.createElement(Uu,null,f.createElement(Xu,{edgeTypes:le,onEdgeClick:c,onEdgeDoubleClick:u,onlyRenderVisibleElements:V,onEdgeContextMenu:ie,onEdgeMouseEnter:te,onEdgeMouseMove:ae,onEdgeMouseLeave:Q,onReconnect:H,onReconnectStart:J,onReconnectEnd:pe,reconnectRadius:Ie,defaultMarkerColor:A,noPanClassName:Ee,elevateEdgesOnSelect:!!ue,disableKeyboardA11y:de,rfId:xe},f.createElement(Zu,{style:x,type:y,component:N,containerStyle:S})),f.createElement("div",{className:"react-flow__edgelabel-renderer"}),f.createElement(Cu,{nodeTypes:st,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:g,onNodeContextMenu:h,selectNodesOnDrag:p,onlyRenderVisibleElements:V,noPanClassName:Ee,noDragClassName:De,disableKeyboardA11y:de,nodeOrigin:me,nodeExtent:we,rfId:xe})))};ci.displayName="GraphView";var qu=f.memo(ci);const $n=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Re={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:$n,nodeExtent:$n,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:exports.ConnectionMode.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Vt,isValidConnection:void 0},Qu=()=>ms((e,t)=>({...Re,setNodes:n=>{const{nodeInternals:o,nodeOrigin:r,elevateNodesOnSelect:s}=t();e({nodeInternals:fn(n,o,r,s)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:o={}}=t();e({edges:n.map(r=>({...o,...r}))})},setDefaultNodesAndEdges:(n,o)=>{const r=typeof n<"u",s=typeof o<"u",i=r?fn(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:i,edges:s?o:[],hasDefaultNodes:r,hasDefaultEdges:s})},updateNodeDimensions:n=>{const{onNodesChange:o,nodeInternals:r,fitViewOnInit:s,fitViewOnInitDone:i,fitViewOnInitOptions:c,domNode:a,nodeOrigin:u}=t(),l=a==null?void 0:a.querySelector(".react-flow__viewport");if(!l)return;const d=window.getComputedStyle(l),{m22:g}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((m,_)=>{const y=r.get(_.id);if(y!=null&&y.hidden)r.set(y.id,{...y,[j]:{...y[j],handleBounds:void 0}});else if(y){const x=Vn(_.nodeElement);!!(x.width&&x.height&&(y.width!==x.width||y.height!==x.height||_.forceUpdate))&&(r.set(y.id,{...y,[j]:{...y[j],handleBounds:{source:Ro(".source",_.nodeElement,g,u),target:Ro(".target",_.nodeElement,g,u)}},...x}),m.push({id:y.id,type:"dimensions",dimensions:x}))}return m},[]);Wr(r,u);const w=i||s&&!i&&Gr(t,{initial:!0,...c});e({nodeInternals:new Map(r),fitViewOnInitDone:w}),(h==null?void 0:h.length)>0&&(o==null||o(h))},updateNodePositions:(n,o=!0,r=!1)=>{const{triggerNodeChanges:s}=t(),i=n.map(c=>{const a={id:c.id,type:"position",dragging:r};return o&&(a.positionAbsolute=c.positionAbsolute,a.position=c.position),a});s(i)},triggerNodeChanges:n=>{const{onNodesChange:o,nodeInternals:r,hasDefaultNodes:s,nodeOrigin:i,getNodes:c,elevateNodesOnSelect:a}=t();if(n!=null&&n.length){if(s){const u=qn(n,c()),l=fn(u,r,i,a);e({nodeInternals:l})}o==null||o(n)}},addSelectedNodes:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=t();let i,c=null;o?i=n.map(a=>Oe(a,!0)):(i=Qe(s(),n),c=Qe(r,[])),Pt({changedNodes:i,changedEdges:c,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:o,edges:r,getNodes:s}=t();let i,c=null;o?i=n.map(a=>Oe(a,!0)):(i=Qe(r,n),c=Qe(s(),[])),Pt({changedNodes:c,changedEdges:i,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:o}={})=>{const{edges:r,getNodes:s}=t(),i=n||s(),c=o||r,a=i.map(l=>(l.selected=!1,Oe(l.id,!1))),u=c.map(l=>Oe(l.id,!1));Pt({changedNodes:a,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:o,maxZoom:r}=t();o==null||o.scaleExtent([n,r]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:o,minZoom:r}=t();o==null||o.scaleExtent([r,n]),e({maxZoom:n})},setTranslateExtent:n=>{var o;(o=t().d3Zoom)==null||o.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:o}=t(),s=o().filter(c=>c.selected).map(c=>Oe(c.id,!1)),i=n.filter(c=>c.selected).map(c=>Oe(c.id,!1));Pt({changedNodes:s,changedEdges:i,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:o}=t();o.forEach(r=>{r.positionAbsolute=Ln(r.position,n)}),e({nodeExtent:n,nodeInternals:new Map(o)})},panBy:n=>{const{transform:o,width:r,height:s,d3Zoom:i,d3Selection:c,translateExtent:a}=t();if(!i||!c||!n.x&&!n.y)return!1;const u=Te.translate(o[0]+n.x,o[1]+n.y).scale(o[2]),l=[[0,0],[r,s]],d=i==null?void 0:i.constrain()(u,l,a);return i.transform(c,d),o[0]!==d.x||o[1]!==d.y||o[2]!==d.k},cancelConnection:()=>e({connectionNodeId:Re.connectionNodeId,connectionHandleId:Re.connectionHandleId,connectionHandleType:Re.connectionHandleType,connectionStatus:Re.connectionStatus,connectionStartHandle:Re.connectionStartHandle,connectionEndHandle:Re.connectionEndHandle}),reset:()=>e({...Re})}),Object.is),Jn=({children:e})=>{const t=f.useRef(null);return t.current||(t.current=Qu()),f.createElement(vl,{value:t.current},e)};Jn.displayName="ReactFlowProvider";const ai=({children:e})=>f.useContext(Kt)?f.createElement(f.Fragment,null,e):f.createElement(Jn,null,e);ai.displayName="ReactFlowWrapper";const Ju={input:Lr,default:Pn,output:Fr,group:Gn},ju={default:_t,straight:qt,step:Zt,smoothstep:Et,simplebezier:Gt},ed=[0,0],td=[15,15],nd={x:0,y:0,zoom:1},od={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},jn=f.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:s=Ju,edgeTypes:i=ju,onNodeClick:c,onEdgeClick:a,onInit:u,onMove:l,onMoveStart:d,onMoveEnd:g,onConnect:h,onConnectStart:w,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:y,onNodeMouseEnter:x,onNodeMouseMove:N,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:M,onNodeDragStart:P,onNodeDrag:D,onNodeDragStop:k,onNodesDelete:B,onEdgesDelete:O,onSelectionChange:V,onSelectionDragStart:z,onSelectionDrag:p,onSelectionDragStop:b,onSelectionContextMenu:E,onSelectionStart:T,onSelectionEnd:$,connectionMode:v=exports.ConnectionMode.Strict,connectionLineType:A=exports.ConnectionLineType.Bezier,connectionLineStyle:I,connectionLineComponent:R,connectionLineContainerStyle:F,deleteKeyCode:L="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:Y=!1,selectionMode:U=exports.SelectionMode.Full,panActivationKeyCode:q="Space",multiSelectionKeyCode:Z=Lt()?"Meta":"Control",zoomActivationKeyCode:W=Lt()?"Meta":"Control",snapToGrid:ee=!1,snapGrid:re=td,onlyRenderVisibleElements:ce=!1,selectNodesOnDrag:ie=!0,nodesDraggable:te,nodesConnectable:ae,nodesFocusable:Q,nodeOrigin:H=ed,edgesFocusable:J,edgesUpdatable:pe,elementsSelectable:Ie,defaultViewport:De=nd,minZoom:Ce=.5,maxZoom:Ee=2,translateExtent:ue=$n,preventScrolling:de=!0,nodeExtent:me,defaultMarkerColor:we="#b1b1b7",zoomOnScroll:xe=!0,zoomOnPinch:st=!0,panOnScroll:le=!1,panOnScrollSpeed:_e=.5,panOnScrollMode:Le=exports.PanOnScrollMode.Free,zoomOnDoubleClick:He=!0,panOnDrag:Fe=!0,onPaneClick:Me,onPaneMouseEnter:be,onPaneMouseMove:ct,onPaneMouseLeave:en,onPaneScroll:at,onPaneContextMenu:tn,children:eo,onEdgeContextMenu:Xe,onEdgeDoubleClick:pi,onEdgeMouseEnter:mi,onEdgeMouseMove:yi,onEdgeMouseLeave:wi,onEdgeUpdate:_i,onEdgeUpdateStart:Si,onEdgeUpdateEnd:vi,onReconnect:Ei,onReconnectStart:xi,onReconnectEnd:bi,reconnectRadius:Ni=10,edgeUpdaterRadius:Ci=10,onNodesChange:Mi,onEdgesChange:Ai,noDragClassName:Pi="nodrag",noWheelClassName:Ti="nowheel",noPanClassName:to="nopan",fitView:ki=!1,fitViewOptions:$i,connectOnClick:Ii=!0,attributionPosition:Di,proOptions:Ri,defaultEdgeOptions:zi,elevateNodesOnSelect:Oi=!0,elevateEdgesOnSelect:Bi=!1,disableKeyboardA11y:no=!1,autoPanOnConnect:Vi=!0,autoPanOnNodeDrag:Li=!0,connectionRadius:Hi=20,isValidConnection:Fi,onError:Xi,style:Yi,id:oo,nodeDragThreshold:Ui,...Ki},Wi)=>{const nn=oo||"1";return f.createElement("div",{...Ki,style:{...Yi,...od},ref:Wi,className:se(["react-flow",r]),"data-testid":"rf__wrapper",id:oo},f.createElement(ai,null,f.createElement(qu,{onInit:u,onMove:l,onMoveStart:d,onMoveEnd:g,onNodeClick:c,onEdgeClick:a,onNodeMouseEnter:x,onNodeMouseMove:N,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:M,nodeTypes:s,edgeTypes:i,connectionLineType:A,connectionLineStyle:I,connectionLineComponent:R,connectionLineContainerStyle:F,selectionKeyCode:X,selectionOnDrag:Y,selectionMode:U,deleteKeyCode:L,multiSelectionKeyCode:Z,panActivationKeyCode:q,zoomActivationKeyCode:W,onlyRenderVisibleElements:ce,selectNodesOnDrag:ie,defaultViewport:De,translateExtent:ue,minZoom:Ce,maxZoom:Ee,preventScrolling:de,zoomOnScroll:xe,zoomOnPinch:st,zoomOnDoubleClick:He,panOnScroll:le,panOnScrollSpeed:_e,panOnScrollMode:Le,panOnDrag:Fe,onPaneClick:Me,onPaneMouseEnter:be,onPaneMouseMove:ct,onPaneMouseLeave:en,onPaneScroll:at,onPaneContextMenu:tn,onSelectionContextMenu:E,onSelectionStart:T,onSelectionEnd:$,onEdgeContextMenu:Xe,onEdgeDoubleClick:pi,onEdgeMouseEnter:mi,onEdgeMouseMove:yi,onEdgeMouseLeave:wi,onReconnect:Ei??_i,onReconnectStart:xi??Si,onReconnectEnd:bi??vi,reconnectRadius:Ni??Ci,defaultMarkerColor:we,noDragClassName:Pi,noWheelClassName:Ti,noPanClassName:to,elevateEdgesOnSelect:Bi,rfId:nn,disableKeyboardA11y:no,nodeOrigin:H,nodeExtent:me}),f.createElement(Zl,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:h,onConnectStart:w,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:y,nodesDraggable:te,nodesConnectable:ae,nodesFocusable:Q,edgesFocusable:J,edgesUpdatable:pe,elementsSelectable:Ie,elevateNodesOnSelect:Oi,minZoom:Ce,maxZoom:Ee,nodeExtent:me,onNodesChange:Mi,onEdgesChange:Ai,snapToGrid:ee,snapGrid:re,connectionMode:v,translateExtent:ue,connectOnClick:Ii,defaultEdgeOptions:zi,fitView:ki,fitViewOptions:$i,onNodesDelete:B,onEdgesDelete:O,onNodeDragStart:P,onNodeDrag:D,onNodeDragStop:k,onSelectionDrag:p,onSelectionDragStart:z,onSelectionDragStop:b,noPanClassName:to,nodeOrigin:H,rfId:nn,autoPanOnConnect:Vi,autoPanOnNodeDrag:Li,onError:Xi,connectionRadius:Hi,isValidConnection:Fi,nodeDragThreshold:Ui}),f.createElement(Wl,{onSelectionChange:V}),eo,f.createElement(xl,{proOptions:Ri,position:Di}),f.createElement(eu,{rfId:nn,disableKeyboardA11y:no})))});jn.displayName="ReactFlow";const rd=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function id({children:e}){const t=G(rd);return t?Xo.createPortal(e,t):null}function sd(){const e=ne();return f.useCallback(t=>{const{domNode:n,updateNodeDimensions:o}=e.getState(),s=(Array.isArray(t)?t:[t]).reduce((i,c)=>{const a=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${c}"]`);return a&&i.push({id:c,nodeElement:a,forceUpdate:!0}),i},[]);requestAnimationFrame(()=>o(s))},[])}const cd=e=>e.getNodes();function ad(){return G(cd,oe)}const ld=e=>e.edges;function ud(){return G(ld,oe)}const dd=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});function fd(){return G(dd,oe)}function li(e){return t=>{const[n,o]=f.useState(t),r=f.useCallback(s=>o(i=>e(s,i)),[]);return[n,o,r]}}const hd=li(qn),gd=li(qr);function pd({onStart:e,onChange:t,onEnd:n}){const o=ne();f.useEffect(()=>{o.setState({onViewportChangeStart:e})},[e]),f.useEffect(()=>{o.setState({onViewportChange:t})},[t]),f.useEffect(()=>{o.setState({onViewportChangeEnd:n})},[n])}function md({onChange:e}){const t=ne();f.useEffect(()=>{const n=[...t.getState().onSelectionChange,e];return t.setState({onSelectionChange:n}),()=>{const o=t.getState().onSelectionChange.filter(r=>r!==e);t.setState({onSelectionChange:o})}},[e])}const yd=e=>t=>t.nodeInternals.size===0?!1:t.getNodes().filter(n=>e.includeHiddenNodes?!0:!n.hidden).every(n=>{var o;return((o=n[j])==null?void 0:o.handleBounds)!==void 0}),wd={includeHiddenNodes:!1};function _d(e=wd){return G(yd(e))}const ui=({id:e,x:t,y:n,width:o,height:r,style:s,color:i,strokeColor:c,strokeWidth:a,className:u,borderRadius:l,shapeRendering:d,onClick:g,selected:h})=>{const{background:w,backgroundColor:m}=s||{},_=i||w||m;return f.createElement("rect",{className:se(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:l,ry:l,width:o,height:r,fill:_,stroke:c,strokeWidth:a,shapeRendering:d,onClick:g?y=>g(y,e):void 0})};ui.displayName="MiniMapNode";var Sd=f.memo(ui);const vd=e=>e.nodeOrigin,Ed=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),mn=e=>e instanceof Function?e:()=>e;function xd({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r=2,nodeComponent:s=Sd,onClick:i}){const c=G(Ed,oe),a=G(vd),u=mn(t),l=mn(e),d=mn(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return f.createElement(f.Fragment,null,c.map(h=>{const{x:w,y:m}=Ve(h,a).positionAbsolute;return f.createElement(s,{key:h.id,x:w,y:m,width:h.width,height:h.height,style:h.style,selected:h.selected,className:d(h),color:u(h),borderRadius:o,strokeColor:l(h),strokeWidth:r,shapeRendering:g,onClick:i,id:h.id})}))}var bd=f.memo(xd);const Nd=200,Cd=150,Md=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?Er(Ke(t,e.nodeOrigin),n):n,rfId:e.rfId}},Ad="react-flow__minimap-desc";function di({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:o="#e2e2e2",nodeClassName:r="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:c,maskColor:a="rgb(240, 240, 240, 0.6)",maskStrokeColor:u="none",maskStrokeWidth:l=1,position:d="bottom-right",onClick:g,onNodeClick:h,pannable:w=!1,zoomable:m=!1,ariaLabel:_="React Flow mini map",inversePan:y=!1,zoomStep:x=10,offsetScale:N=5}){const S=ne(),C=f.useRef(null),{boundingRect:M,viewBB:P,rfId:D}=G(Md,oe),k=(e==null?void 0:e.width)??Nd,B=(e==null?void 0:e.height)??Cd,O=M.width/k,V=M.height/B,z=Math.max(O,V),p=z*k,b=z*B,E=N*z,T=M.x-(p-M.width)/2-E,$=M.y-(b-M.height)/2-E,v=p+E*2,A=b+E*2,I=`${Ad}-${D}`,R=f.useRef(0);R.current=z,f.useEffect(()=>{if(C.current){const X=fe(C.current),Y=Z=>{const{transform:W,d3Selection:ee,d3Zoom:re}=S.getState();if(Z.sourceEvent.type!=="wheel"||!ee||!re)return;const ce=-Z.sourceEvent.deltaY*(Z.sourceEvent.deltaMode===1?.05:Z.sourceEvent.deltaMode?1:.002)*x,ie=W[2]*Math.pow(2,ce);re.scaleTo(ee,ie)},U=Z=>{const{transform:W,d3Selection:ee,d3Zoom:re,translateExtent:ce,width:ie,height:te}=S.getState();if(Z.sourceEvent.type!=="mousemove"||!ee||!re)return;const ae=R.current*Math.max(1,W[2])*(y?-1:1),Q={x:W[0]-Z.sourceEvent.movementX*ae,y:W[1]-Z.sourceEvent.movementY*ae},H=[[0,0],[ie,te]],J=Te.translate(Q.x,Q.y).scale(W[2]),pe=re.constrain()(J,H,ce);re.transform(ee,pe)},q=mr().on("zoom",w?U:null).on("zoom.wheel",m?Y:null);return X.call(q),()=>{X.on("zoom",null)}}},[w,m,y,x]);const F=g?X=>{const Y=Se(X);g(X,{x:Y[0],y:Y[1]})}:void 0,L=h?(X,Y)=>{const U=S.getState().nodeInternals.get(Y);h(X,U)}:void 0;return f.createElement(Wt,{position:d,style:e,className:se(["react-flow__minimap",t]),"data-testid":"rf__minimap"},f.createElement("svg",{width:k,height:B,viewBox:`${T} ${$} ${v} ${A}`,role:"img","aria-labelledby":I,ref:C,onClick:F},_&&f.createElement("title",{id:I},_),f.createElement(bd,{onClick:L,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:r,nodeStrokeWidth:i,nodeComponent:c}),f.createElement("path",{className:"react-flow__minimap-mask",d:`M${T-E},${$-E}h${v+E*2}v${A+E*2}h${-v-E*2}z
|
|
34
|
+
M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fill:a,fillRule:"evenodd",stroke:u,strokeWidth:l,pointerEvents:"none"})))}di.displayName="MiniMap";var Pd=f.memo(di);function Td(){return f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},f.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function kd(){return f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},f.createElement("path",{d:"M0 0h32v4.2H0z"}))}function $d(){return f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},f.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function Id(){return f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},f.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function Dd(){return f.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},f.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Je=({children:e,className:t,...n})=>f.createElement("button",{type:"button",className:se(["react-flow__controls-button",t]),...n},e);Je.displayName="ControlButton";const Rd=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),fi=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:s,onZoomOut:i,onFitView:c,onInteractiveChange:a,className:u,children:l,position:d="bottom-left"})=>{const g=ne(),[h,w]=f.useState(!1),{isInteractive:m,minZoomReached:_,maxZoomReached:y}=G(Rd,oe),{zoomIn:x,zoomOut:N,fitView:S}=jt();if(f.useEffect(()=>{w(!0)},[]),!h)return null;const C=()=>{x(),s==null||s()},M=()=>{N(),i==null||i()},P=()=>{S(r),c==null||c()},D=()=>{g.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),a==null||a(!m)};return f.createElement(Wt,{className:se(["react-flow__controls",u]),position:d,style:e,"data-testid":"rf__controls"},t&&f.createElement(f.Fragment,null,f.createElement(Je,{onClick:C,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:y},f.createElement(Td,null)),f.createElement(Je,{onClick:M,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:_},f.createElement(kd,null))),n&&f.createElement(Je,{className:"react-flow__controls-fitview",onClick:P,title:"fit view","aria-label":"fit view"},f.createElement($d,null)),o&&f.createElement(Je,{className:"react-flow__controls-interactive",onClick:D,title:"toggle interactivity","aria-label":"toggle interactivity"},m?f.createElement(Dd,null):f.createElement(Id,null)),l)};fi.displayName="Controls";var zd=f.memo(fi);exports.BackgroundVariant=void 0;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(exports.BackgroundVariant||(exports.BackgroundVariant={}));function Od({color:e,dimensions:t,lineWidth:n}){return f.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function Bd({color:e,radius:t}){return f.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const Vd={[exports.BackgroundVariant.Dots]:"#91919a",[exports.BackgroundVariant.Lines]:"#eee",[exports.BackgroundVariant.Cross]:"#e2e2e2"},Ld={[exports.BackgroundVariant.Dots]:1,[exports.BackgroundVariant.Lines]:1,[exports.BackgroundVariant.Cross]:6},Hd=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function hi({id:e,variant:t=exports.BackgroundVariant.Dots,gap:n=20,size:o,lineWidth:r=1,offset:s=2,color:i,style:c,className:a}){const u=f.useRef(null),{transform:l,patternId:d}=G(Hd,oe),g=i||Vd[t],h=o||Ld[t],w=t===exports.BackgroundVariant.Dots,m=t===exports.BackgroundVariant.Cross,_=Array.isArray(n)?n:[n,n],y=[_[0]*l[2]||1,_[1]*l[2]||1],x=h*l[2],N=m?[x,x]:y,S=w?[x/s,x/s]:[N[0]/s,N[1]/s];return f.createElement("svg",{className:se(["react-flow__background",a]),style:{...c,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:u,"data-testid":"rf__background"},f.createElement("pattern",{id:d+e,x:l[0]%y[0],y:l[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`},w?f.createElement(Bd,{color:g,radius:x/s}):f.createElement(Od,{dimensions:N,color:g,lineWidth:r})),f.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${d+e})`}))}hi.displayName="Background";var Fd=f.memo(hi);const Xd=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__renderer")};function Yd({children:e}){const t=G(Xd);return t?Xo.createPortal(e,t):null}const Ud=(e,t)=>{var n,o,r,s,i,c;return((n=e==null?void 0:e.positionAbsolute)==null?void 0:n.x)===((o=t==null?void 0:t.positionAbsolute)==null?void 0:o.x)&&((r=e==null?void 0:e.positionAbsolute)==null?void 0:r.y)===((s=t==null?void 0:t.positionAbsolute)==null?void 0:s.y)&&(e==null?void 0:e.width)===(t==null?void 0:t.width)&&(e==null?void 0:e.height)===(t==null?void 0:t.height)&&(e==null?void 0:e.selected)===(t==null?void 0:t.selected)&&((i=e==null?void 0:e[j])==null?void 0:i.z)===((c=t==null?void 0:t[j])==null?void 0:c.z)},Kd=(e,t)=>e.length===t.length&&e.every((n,o)=>Ud(n,t[o])),Wd=e=>({transform:e.transform,nodeOrigin:e.nodeOrigin,selectedNodesCount:e.getNodes().filter(t=>t.selected).length});function Gd(e,t,n,o,r){let s=.5;r==="start"?s=0:r==="end"&&(s=1);let i=[(e.x+e.width*s)*t[2]+t[0],e.y*t[2]+t[1]-o],c=[-100*s,-100];switch(n){case exports.Position.Right:i=[(e.x+e.width)*t[2]+t[0]+o,(e.y+e.height*s)*t[2]+t[1]],c=[0,-100*s];break;case exports.Position.Bottom:i[1]=(e.y+e.height)*t[2]+t[1]+o,c[1]=0;break;case exports.Position.Left:i=[e.x*t[2]+t[0]-o,(e.y+e.height*s)*t[2]+t[1]],c=[-100,-100*s];break}return`translate(${i[0]}px, ${i[1]}px) translate(${c[0]}%, ${c[1]}%)`}function Zd({nodeId:e,children:t,className:n,style:o,isVisible:r,position:s=exports.Position.Top,offset:i=10,align:c="center",...a}){const u=Qt(),l=f.useCallback(N=>(Array.isArray(e)?e:[e||u||""]).reduce((C,M)=>{const P=N.nodeInternals.get(M);return P&&C.push(P),C},[]),[e,u]),d=G(l,Kd),{transform:g,nodeOrigin:h,selectedNodesCount:w}=G(Wd,oe);if(!(typeof r=="boolean"?r:d.length===1&&d[0].selected&&w===1)||!d.length)return null;const _=Ke(d,h),y=Math.max(...d.map(N=>{var S;return(((S=N[j])==null?void 0:S.z)||1)+1})),x={position:"absolute",transform:Gd(_,g,s,i,c),zIndex:y,...o};return f.createElement(Yd,null,f.createElement("div",{style:x,className:se(["react-flow__node-toolbar",n]),...a},t))}exports.ResizeControlVariant=void 0;(function(e){e.Line="line",e.Handle="handle"})(exports.ResizeControlVariant||(exports.ResizeControlVariant={}));function qd({width:e,prevWidth:t,height:n,prevHeight:o,invertX:r,invertY:s}){const i=e-t,c=n-o,a=[i>0?1:i<0?-1:0,c>0?1:c<0?-1:0];return i&&r&&(a[0]=a[0]*-1),c&&s&&(a[1]=a[1]*-1),a}const gi={width:0,height:0,x:0,y:0},Qd={...gi,pointerX:0,pointerY:0,aspectRatio:1};function Jd({nodeId:e,position:t,variant:n=exports.ResizeControlVariant.Handle,className:o,style:r={},children:s,color:i,minWidth:c=10,minHeight:a=10,maxWidth:u=Number.MAX_VALUE,maxHeight:l=Number.MAX_VALUE,keepAspectRatio:d=!1,shouldResize:g,onResizeStart:h,onResize:w,onResizeEnd:m}){const _=Qt(),y=typeof e=="string"?e:_,x=ne(),N=f.useRef(null),S=f.useRef(Qd),C=f.useRef(gi),M=Qn(),P=n===exports.ResizeControlVariant.Line?"right":"bottom-right",D=t??P;f.useEffect(()=>{if(!N.current||!y)return;const V=fe(N.current),z=D.includes("right")||D.includes("left"),p=D.includes("bottom")||D.includes("top"),b=D.includes("left"),E=D.includes("top"),T=ar().on("start",$=>{const v=x.getState().nodeInternals.get(y),{xSnapped:A,ySnapped:I}=M($);C.current={width:(v==null?void 0:v.width)??0,height:(v==null?void 0:v.height)??0,x:(v==null?void 0:v.position.x)??0,y:(v==null?void 0:v.position.y)??0},S.current={...C.current,pointerX:A,pointerY:I,aspectRatio:C.current.width/C.current.height},h==null||h($,{...C.current})}).on("drag",$=>{const{nodeInternals:v,triggerNodeChanges:A}=x.getState(),{xSnapped:I,ySnapped:R}=M($),F=v.get(y);if(F){const L=[],{pointerX:X,pointerY:Y,width:U,height:q,x:Z,y:W,aspectRatio:ee}=S.current,{x:re,y:ce,width:ie,height:te}=C.current,ae=Math.floor(z?I-X:0),Q=Math.floor(p?R-Y:0);let H=$e(U+(b?-ae:ae),c,u),J=$e(q+(E?-Q:Q),a,l);if(d){const ue=H/J,de=z&&p,me=z&&!p,we=p&&!z;H=ue<=ee&&de||we?J*ee:H,J=ue>ee&&de||me?H/ee:J,H>=u?(H=u,J=u/ee):H<=c&&(H=c,J=c/ee),J>=l?(J=l,H=l*ee):J<=a&&(J=a,H=a*ee)}const pe=H!==ie,Ie=J!==te;if(b||E){const ue=b?Z-(H-U):Z,de=E?W-(J-q):W,me=ue!==re&&pe,we=de!==ce&&Ie;if(me||we){const xe={id:F.id,type:"position",position:{x:me?ue:re,y:we?de:ce}};L.push(xe),C.current.x=xe.position.x,C.current.y=xe.position.y}}if(pe||Ie){const ue={id:y,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:H,height:J}};L.push(ue),C.current.width=H,C.current.height=J}if(L.length===0)return;const De=qd({width:C.current.width,prevWidth:ie,height:C.current.height,prevHeight:te,invertX:b,invertY:E}),Ce={...C.current,direction:De};if((g==null?void 0:g($,Ce))===!1)return;w==null||w($,Ce),A(L)}}).on("end",$=>{const v={id:y,type:"dimensions",resizing:!1};m==null||m($,{...C.current}),x.getState().triggerNodeChanges([v])});return V.call(T),()=>{V.on(".drag",null)}},[y,D,c,a,u,l,d,M,h,w,m]);const k=D.split("-"),B=n===exports.ResizeControlVariant.Line?"borderColor":"backgroundColor",O=i?{...r,[B]:i}:r;return f.createElement("div",{className:se(["react-flow__resize-control","nodrag",...k,n,o]),ref:N,style:O},s)}var In=f.memo(Jd);const jd=["top-left","top-right","bottom-left","bottom-right"],ef=["top","right","bottom","left"];function tf({nodeId:e,isVisible:t=!0,handleClassName:n,handleStyle:o,lineClassName:r,lineStyle:s,color:i,minWidth:c=10,minHeight:a=10,maxWidth:u=Number.MAX_VALUE,maxHeight:l=Number.MAX_VALUE,keepAspectRatio:d=!1,shouldResize:g,onResizeStart:h,onResize:w,onResizeEnd:m}){return t?f.createElement(f.Fragment,null,ef.map(_=>f.createElement(In,{key:_,className:r,style:s,nodeId:e,position:_,variant:exports.ResizeControlVariant.Line,color:i,minWidth:c,minHeight:a,maxWidth:u,maxHeight:l,onResizeStart:h,keepAspectRatio:d,shouldResize:g,onResize:w,onResizeEnd:m})),jd.map(_=>f.createElement(In,{key:_,className:n,style:o,nodeId:e,position:_,color:i,minWidth:c,minHeight:a,maxWidth:u,maxHeight:l,onResizeStart:h,keepAspectRatio:d,shouldResize:g,onResize:w,onResizeEnd:m}))):null}exports.Background=Fd;exports.BaseEdge=it;exports.BezierEdge=_t;exports.ControlButton=Je;exports.Controls=zd;exports.EdgeLabelRenderer=id;exports.EdgeText=wr;exports.Handle=St;exports.MiniMap=Pd;exports.NodeResizeControl=In;exports.NodeResizer=tf;exports.NodeToolbar=Zd;exports.Panel=Wt;exports.ReactFlow=jn;exports.ReactFlowProvider=Jn;exports.SimpleBezierEdge=Gt;exports.SmoothStepEdge=Et;exports.StepEdge=Zt;exports.StraightEdge=qt;exports.addEdge=Tr;exports.applyEdgeChanges=qr;exports.applyNodeChanges=qn;exports.boxToRect=Hn;exports.clamp=$e;exports.default=jn;exports.getBezierPath=Xn;exports.getBoundsOfRects=Er;exports.getConnectedEdges=Kn;exports.getIncomers=Il;exports.getMarkerEnd=Ml;exports.getNodePositionWithOrigin=Ve;exports.getNodesBounds=Ke;exports.getOutgoers=$l;exports.getRectOfNodes=zl;exports.getSimpleBezierPath=Fn;exports.getSmoothStepPath=Ht;exports.getStraightPath=Mr;exports.getTransformForBounds=Ol;exports.getViewportForBounds=Jt;exports.handleParentExpand=Tn;exports.internalsSymbol=j;exports.isEdge=Ar;exports.isNode=Un;exports.reconnectEdge=kr;exports.rectToBox=ot;exports.updateEdge=Rl;exports.useEdges=ud;exports.useEdgesState=gd;exports.useGetPointerPosition=Qn;exports.useKeyPress=rt;exports.useNodeId=Qt;exports.useNodes=ad;exports.useNodesInitialized=_d;exports.useNodesState=hd;exports.useOnSelectionChange=md;exports.useOnViewportChange=pd;exports.useReactFlow=jt;exports.useStore=G;exports.useStoreApi=ne;exports.useUpdateNodeInternals=sd;exports.useViewport=fd;
|