@grackle-ai/web 0.85.2 → 0.86.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/KnowledgePage-D2RhOFV4.js +1 -0
- package/dist/assets/dagview-CzJGOIoX.js +47 -0
- package/dist/assets/{grpc-DU5jMhZD.js → grpc-DT6vMFm5.js} +1 -1
- package/dist/assets/index-BtJLKpAw.css +1 -0
- package/dist/assets/{index-qSWpvSA-.js → index-CfiUmZUF.js} +38 -38
- package/dist/assets/markdown-DH3wQq0i.js +31 -0
- package/dist/index.html +5 -5
- package/package.json +4 -11
- package/dist/assets/KnowledgePage-C39vVNnH.js +0 -1
- package/dist/assets/dagview-BA5TtMAQ.js +0 -31
- package/dist/assets/index-pFJWXkif.css +0 -1
- package/dist/assets/markdown-gcy1Jmzi.js +0 -47
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
function $o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wn={exports:{}},st={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.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 br;function Na(){if(br)return st;br=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,i){var s=null;if(i!==void 0&&(s=""+i),o.key!==void 0&&(s=""+o.key),"key"in o){i={};for(var c in o)c!=="key"&&(i[c]=o[c])}else i=o;return o=i.ref,{$$typeof:e,type:r,key:s,ref:o!==void 0?o:null,props:i}}return st.Fragment=t,st.jsx=n,st.jsxs=n,st}var Er;function Sa(){return Er||(Er=1,wn.exports=Na()),wn.exports}var W=Sa(),_n={exports:{}},ee={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react.production.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 Nr;function Ca(){if(Nr)return ee;Nr=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),s=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),l=Symbol.for("react.activity"),d=Symbol.iterator;function h(m){return m===null||typeof m!="object"?null:(m=d&&m[d]||m["@@iterator"],typeof m=="function"?m:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,E={};function _(m,M,Y){this.props=m,this.context=M,this.refs=E,this.updater=Y||g}_.prototype.isReactComponent={},_.prototype.setState=function(m,M){if(typeof m!="object"&&typeof m!="function"&&m!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,m,M,"setState")},_.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function b(){}b.prototype=_.prototype;function p(m,M,Y){this.props=m,this.context=M,this.refs=E,this.updater=Y||g}var y=p.prototype=new b;y.constructor=p,w(y,_.prototype),y.isPureReactComponent=!0;var T=Array.isArray;function k(){}var I={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function F(m,M,Y){var S=Y.ref;return{$$typeof:e,type:m,key:M,ref:S!==void 0?S:null,props:Y}}function j(m,M){return F(m.type,M,m.props)}function C(m){return typeof m=="object"&&m!==null&&m.$$typeof===e}function R(m){var M={"=":"=0",":":"=2"};return"$"+m.replace(/[=:]/g,function(Y){return M[Y]})}var D=/\/+/g;function x(m,M){return typeof m=="object"&&m!==null&&m.key!=null?R(""+m.key):M.toString(36)}function L(m){switch(m.status){case"fulfilled":return m.value;case"rejected":throw m.reason;default:switch(typeof m.status=="string"?m.then(k,k):(m.status="pending",m.then(function(M){m.status==="pending"&&(m.status="fulfilled",m.value=M)},function(M){m.status==="pending"&&(m.status="rejected",m.reason=M)})),m.status){case"fulfilled":return m.value;case"rejected":throw m.reason}}throw m}function N(m,M,Y,S,v){var $=typeof m;($==="undefined"||$==="boolean")&&(m=null);var z=!1;if(m===null)z=!0;else switch($){case"bigint":case"string":case"number":z=!0;break;case"object":switch(m.$$typeof){case e:case t:z=!0;break;case f:return z=m._init,N(z(m._payload),M,Y,S,v)}}if(z)return v=v(m),z=S===""?"."+x(m,0):S,T(v)?(Y="",z!=null&&(Y=z.replace(D,"$&/")+"/"),N(v,M,Y,"",function(q){return q})):v!=null&&(C(v)&&(v=j(v,Y+(v.key==null||m&&m.key===v.key?"":(""+v.key).replace(D,"$&/")+"/")+z)),M.push(v)),1;z=0;var V=S===""?".":S+":";if(T(m))for(var X=0;X<m.length;X++)S=m[X],$=V+x(S,X),z+=N(S,M,Y,$,v);else if(X=h(m),typeof X=="function")for(m=X.call(m),X=0;!(S=m.next()).done;)S=S.value,$=V+x(S,X++),z+=N(S,M,Y,$,v);else if($==="object"){if(typeof m.then=="function")return N(L(m),M,Y,S,v);throw M=String(m),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(m).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return z}function P(m,M,Y){if(m==null)return m;var S=[],v=0;return N(m,S,"","",function($){return M.call(Y,$,v++)}),S}function A(m){if(m._status===-1){var M=m._result;M=M(),M.then(function(Y){(m._status===0||m._status===-1)&&(m._status=1,m._result=Y)},function(Y){(m._status===0||m._status===-1)&&(m._status=2,m._result=Y)}),m._status===-1&&(m._status=0,m._result=M)}if(m._status===1)return m._result.default;throw m._result}var O=typeof reportError=="function"?reportError:function(m){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof m=="object"&&m!==null&&typeof m.message=="string"?String(m.message):String(m),error:m});if(!window.dispatchEvent(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",m);return}console.error(m)},B={map:P,forEach:function(m,M,Y){P(m,function(){M.apply(this,arguments)},Y)},count:function(m){var M=0;return P(m,function(){M++}),M},toArray:function(m){return P(m,function(M){return M})||[]},only:function(m){if(!C(m))throw Error("React.Children.only expected to receive a single React element child.");return m}};return ee.Activity=l,ee.Children=B,ee.Component=_,ee.Fragment=n,ee.Profiler=o,ee.PureComponent=p,ee.StrictMode=r,ee.Suspense=a,ee.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,ee.__COMPILER_RUNTIME={__proto__:null,c:function(m){return I.H.useMemoCache(m)}},ee.cache=function(m){return function(){return m.apply(null,arguments)}},ee.cacheSignal=function(){return null},ee.cloneElement=function(m,M,Y){if(m==null)throw Error("The argument must be a React element, but you passed "+m+".");var S=w({},m.props),v=m.key;if(M!=null)for($ in M.key!==void 0&&(v=""+M.key),M)!H.call(M,$)||$==="key"||$==="__self"||$==="__source"||$==="ref"&&M.ref===void 0||(S[$]=M[$]);var $=arguments.length-2;if($===1)S.children=Y;else if(1<$){for(var z=Array($),V=0;V<$;V++)z[V]=arguments[V+2];S.children=z}return F(m.type,v,S)},ee.createContext=function(m){return m={$$typeof:s,_currentValue:m,_currentValue2:m,_threadCount:0,Provider:null,Consumer:null},m.Provider=m,m.Consumer={$$typeof:i,_context:m},m},ee.createElement=function(m,M,Y){var S,v={},$=null;if(M!=null)for(S in M.key!==void 0&&($=""+M.key),M)H.call(M,S)&&S!=="key"&&S!=="__self"&&S!=="__source"&&(v[S]=M[S]);var z=arguments.length-2;if(z===1)v.children=Y;else if(1<z){for(var V=Array(z),X=0;X<z;X++)V[X]=arguments[X+2];v.children=V}if(m&&m.defaultProps)for(S in z=m.defaultProps,z)v[S]===void 0&&(v[S]=z[S]);return F(m,$,v)},ee.createRef=function(){return{current:null}},ee.forwardRef=function(m){return{$$typeof:c,render:m}},ee.isValidElement=C,ee.lazy=function(m){return{$$typeof:f,_payload:{_status:-1,_result:m},_init:A}},ee.memo=function(m,M){return{$$typeof:u,type:m,compare:M===void 0?null:M}},ee.startTransition=function(m){var M=I.T,Y={};I.T=Y;try{var S=m(),v=I.S;v!==null&&v(Y,S),typeof S=="object"&&S!==null&&typeof S.then=="function"&&S.then(k,O)}catch($){O($)}finally{M!==null&&Y.types!==null&&(M.types=Y.types),I.T=M}},ee.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},ee.use=function(m){return I.H.use(m)},ee.useActionState=function(m,M,Y){return I.H.useActionState(m,M,Y)},ee.useCallback=function(m,M){return I.H.useCallback(m,M)},ee.useContext=function(m){return I.H.useContext(m)},ee.useDebugValue=function(){},ee.useDeferredValue=function(m,M){return I.H.useDeferredValue(m,M)},ee.useEffect=function(m,M){return I.H.useEffect(m,M)},ee.useEffectEvent=function(m){return I.H.useEffectEvent(m)},ee.useId=function(){return I.H.useId()},ee.useImperativeHandle=function(m,M,Y){return I.H.useImperativeHandle(m,M,Y)},ee.useInsertionEffect=function(m,M){return I.H.useInsertionEffect(m,M)},ee.useLayoutEffect=function(m,M){return I.H.useLayoutEffect(m,M)},ee.useMemo=function(m,M){return I.H.useMemo(m,M)},ee.useOptimistic=function(m,M){return I.H.useOptimistic(m,M)},ee.useReducer=function(m,M,Y){return I.H.useReducer(m,M,Y)},ee.useRef=function(m){return I.H.useRef(m)},ee.useState=function(m){return I.H.useState(m)},ee.useSyncExternalStore=function(m,M,Y){return I.H.useSyncExternalStore(m,M,Y)},ee.useTransition=function(){return I.H.useTransition()},ee.version="19.2.4",ee}var Sr;function rn(){return Sr||(Sr=1,_n.exports=Ca()),_n.exports}var G=rn();const ka=$o(G);var bn={exports:{}},le={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* react-dom.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 Cr;function Ma(){if(Cr)return le;Cr=1;var e=rn();function t(a){var u="https://react.dev/errors/"+a;if(1<arguments.length){u+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)u+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+a+"; visit "+u+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function i(a,u,f){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:l==null?null:""+l,children:a,containerInfo:u,implementation:f}}var s=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(a,u){if(a==="font")return"";if(typeof u=="string")return u==="use-credentials"?u:""}return le.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,le.createPortal=function(a,u){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)throw Error(t(299));return i(a,u,null,f)},le.flushSync=function(a){var u=s.T,f=r.p;try{if(s.T=null,r.p=2,a)return a()}finally{s.T=u,r.p=f,r.d.f()}},le.preconnect=function(a,u){typeof a=="string"&&(u?(u=u.crossOrigin,u=typeof u=="string"?u==="use-credentials"?u:"":void 0):u=null,r.d.C(a,u))},le.prefetchDNS=function(a){typeof a=="string"&&r.d.D(a)},le.preinit=function(a,u){if(typeof a=="string"&&u&&typeof u.as=="string"){var f=u.as,l=c(f,u.crossOrigin),d=typeof u.integrity=="string"?u.integrity:void 0,h=typeof u.fetchPriority=="string"?u.fetchPriority:void 0;f==="style"?r.d.S(a,typeof u.precedence=="string"?u.precedence:void 0,{crossOrigin:l,integrity:d,fetchPriority:h}):f==="script"&&r.d.X(a,{crossOrigin:l,integrity:d,fetchPriority:h,nonce:typeof u.nonce=="string"?u.nonce:void 0})}},le.preinitModule=function(a,u){if(typeof a=="string")if(typeof u=="object"&&u!==null){if(u.as==null||u.as==="script"){var f=c(u.as,u.crossOrigin);r.d.M(a,{crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0})}}else u==null&&r.d.M(a)},le.preload=function(a,u){if(typeof a=="string"&&typeof u=="object"&&u!==null&&typeof u.as=="string"){var f=u.as,l=c(f,u.crossOrigin);r.d.L(a,f,{crossOrigin:l,integrity:typeof u.integrity=="string"?u.integrity:void 0,nonce:typeof u.nonce=="string"?u.nonce:void 0,type:typeof u.type=="string"?u.type:void 0,fetchPriority:typeof u.fetchPriority=="string"?u.fetchPriority:void 0,referrerPolicy:typeof u.referrerPolicy=="string"?u.referrerPolicy:void 0,imageSrcSet:typeof u.imageSrcSet=="string"?u.imageSrcSet:void 0,imageSizes:typeof u.imageSizes=="string"?u.imageSizes:void 0,media:typeof u.media=="string"?u.media:void 0})}},le.preloadModule=function(a,u){if(typeof a=="string")if(u){var f=c(u.as,u.crossOrigin);r.d.m(a,{as:typeof u.as=="string"&&u.as!=="script"?u.as:void 0,crossOrigin:f,integrity:typeof u.integrity=="string"?u.integrity:void 0})}else r.d.m(a)},le.requestFormReset=function(a){r.d.r(a)},le.unstable_batchedUpdates=function(a,u){return a(u)},le.useFormState=function(a,u,f){return s.H.useFormState(a,u,f)},le.useFormStatus=function(){return s.H.useHostTransitionStatus()},le.version="19.2.4",le}var kr;function Ia(){if(kr)return bn.exports;kr=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),bn.exports=Ma(),bn.exports}function ce(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ce(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ta={value:()=>{}};function on(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new zt(n)}function zt(e){this._=e}function Aa(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}zt.prototype=on.prototype={constructor:zt,on:function(e,t){var n=this._,r=Aa(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=Pa(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=Mr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Mr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function Pa(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Mr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=Ta,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ln="http://www.w3.org/1999/xhtml";const Ir={svg:"http://www.w3.org/2000/svg",xhtml:Ln,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function sn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ir.hasOwnProperty(t)?{space:Ir[t],local:e}:e}function Oa(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ln&&t.documentElement.namespaceURI===Ln?t.createElement(e):t.createElementNS(n,e)}}function Ra(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Lo(e){var t=sn(e);return(t.local?Ra:Oa)(t)}function $a(){}function Kn(e){return e==null?$a:function(){return this.querySelector(e)}}function La(e){typeof e!="function"&&(e=Kn(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,c=r[o]=new Array(s),a,u,f=0;f<s;++f)(a=i[f])&&(u=e.call(a,a.__data__,f,i))&&("__data__"in a&&(u.__data__=a.__data__),c[f]=u);return new he(r,this._parents)}function Da(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ja(){return[]}function Do(e){return e==null?ja:function(){return this.querySelectorAll(e)}}function za(e){return function(){return Da(e.apply(this,arguments))}}function Ha(e){typeof e=="function"?e=za(e):e=Do(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],c=s.length,a,u=0;u<c;++u)(a=s[u])&&(r.push(e.call(a,a.__data__,u,s)),o.push(a));return new he(r,o)}function jo(e){return function(){return this.matches(e)}}function zo(e){return function(t){return t.matches(e)}}var Va=Array.prototype.find;function Ba(e){return function(){return Va.call(this.children,e)}}function Fa(){return this.firstElementChild}function Ya(e){return this.select(e==null?Fa:Ba(typeof e=="function"?e:zo(e)))}var Xa=Array.prototype.filter;function Wa(){return Array.from(this.children)}function Ga(e){return function(){return Xa.call(this.children,e)}}function qa(e){return this.selectAll(e==null?Wa:Ga(typeof e=="function"?e:zo(e)))}function Ua(e){typeof e!="function"&&(e=jo(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,c=r[o]=[],a,u=0;u<s;++u)(a=i[u])&&e.call(a,a.__data__,u,i)&&c.push(a);return new he(r,this._parents)}function Ho(e){return new Array(e.length)}function Ka(){return new he(this._enter||this._groups.map(Ho),this._parents)}function Yt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yt.prototype={constructor:Yt,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 Za(e){return function(){return e}}function Qa(e,t,n,r,o,i){for(var s=0,c,a=t.length,u=i.length;s<u;++s)(c=t[s])?(c.__data__=i[s],r[s]=c):n[s]=new Yt(e,i[s]);for(;s<a;++s)(c=t[s])&&(o[s]=c)}function Ja(e,t,n,r,o,i,s){var c,a,u=new Map,f=t.length,l=i.length,d=new Array(f),h;for(c=0;c<f;++c)(a=t[c])&&(d[c]=h=s.call(a,a.__data__,c,t)+"",u.has(h)?o[c]=a:u.set(h,a));for(c=0;c<l;++c)h=s.call(e,i[c],c,i)+"",(a=u.get(h))?(r[c]=a,a.__data__=i[c],u.delete(h)):n[c]=new Yt(e,i[c]);for(c=0;c<f;++c)(a=t[c])&&u.get(d[c])===a&&(o[c]=a)}function ec(e){return e.__data__}function tc(e,t){if(!arguments.length)return Array.from(this,ec);var n=t?Ja:Qa,r=this._parents,o=this._groups;typeof e!="function"&&(e=Za(e));for(var i=o.length,s=new Array(i),c=new Array(i),a=new Array(i),u=0;u<i;++u){var f=r[u],l=o[u],d=l.length,h=nc(e.call(f,f&&f.__data__,u,r)),g=h.length,w=c[u]=new Array(g),E=s[u]=new Array(g),_=a[u]=new Array(d);n(f,l,w,E,_,h,t);for(var b=0,p=0,y,T;b<g;++b)if(y=w[b]){for(b>=p&&(p=b+1);!(T=E[p])&&++p<g;);y._next=T||null}}return s=new he(s,r),s._enter=c,s._exit=a,s}function nc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function rc(){return new he(this._exit||this._groups.map(Ho),this._parents)}function oc(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function ic(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),c=new Array(o),a=0;a<s;++a)for(var u=n[a],f=r[a],l=u.length,d=c[a]=new Array(l),h,g=0;g<l;++g)(h=u[g]||f[g])&&(d[g]=h);for(;a<o;++a)c[a]=n[a];return new he(c,this._parents)}function sc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function ac(e){e||(e=cc);function t(l,d){return l&&d?e(l.__data__,d.__data__):!l-!d}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],c=s.length,a=o[i]=new Array(c),u,f=0;f<c;++f)(u=s[f])&&(a[f]=u);a.sort(t)}return new he(o,this._parents).order()}function cc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function uc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function lc(){return Array.from(this)}function fc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function dc(){let e=0;for(const t of this)++e;return e}function hc(){return!this.node()}function gc(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,c;i<s;++i)(c=o[i])&&e.call(c,c.__data__,i,o);return this}function pc(e){return function(){this.removeAttribute(e)}}function mc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function yc(e,t){return function(){this.setAttribute(e,t)}}function xc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function vc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function wc(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 _c(e,t){var n=sn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?mc:pc:typeof t=="function"?n.local?wc:vc:n.local?xc:yc)(n,t))}function Vo(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function bc(e){return function(){this.style.removeProperty(e)}}function Ec(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Nc(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Sc(e,t,n){return arguments.length>1?this.each((t==null?bc:typeof t=="function"?Nc:Ec)(e,t,n??"")):Ue(this.node(),e)}function Ue(e,t){return e.style.getPropertyValue(t)||Vo(e).getComputedStyle(e,null).getPropertyValue(t)}function Cc(e){return function(){delete this[e]}}function kc(e,t){return function(){this[e]=t}}function Mc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ic(e,t){return arguments.length>1?this.each((t==null?Cc:typeof t=="function"?Mc:kc)(e,t)):this.node()[e]}function Bo(e){return e.trim().split(/^|\s+/)}function Zn(e){return e.classList||new Fo(e)}function Fo(e){this._node=e,this._names=Bo(e.getAttribute("class")||"")}Fo.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 Yo(e,t){for(var n=Zn(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Xo(e,t){for(var n=Zn(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Tc(e){return function(){Yo(this,e)}}function Ac(e){return function(){Xo(this,e)}}function Pc(e,t){return function(){(t.apply(this,arguments)?Yo:Xo)(this,e)}}function Oc(e,t){var n=Bo(e+"");if(arguments.length<2){for(var r=Zn(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?Pc:t?Tc:Ac)(n,t))}function Rc(){this.textContent=""}function $c(e){return function(){this.textContent=e}}function Lc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Dc(e){return arguments.length?this.each(e==null?Rc:(typeof e=="function"?Lc:$c)(e)):this.node().textContent}function jc(){this.innerHTML=""}function zc(e){return function(){this.innerHTML=e}}function Hc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Vc(e){return arguments.length?this.each(e==null?jc:(typeof e=="function"?Hc:zc)(e)):this.node().innerHTML}function Bc(){this.nextSibling&&this.parentNode.appendChild(this)}function Fc(){return this.each(Bc)}function Yc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Xc(){return this.each(Yc)}function Wc(e){var t=typeof e=="function"?e:Lo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Gc(){return null}function qc(e,t){var n=typeof e=="function"?e:Lo(e),r=t==null?Gc:typeof t=="function"?t:Kn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Uc(){var e=this.parentNode;e&&e.removeChild(this)}function Kc(){return this.each(Uc)}function Zc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Qc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Jc(e){return this.select(e?Qc:Zc)}function eu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function tu(e){return function(t){e.call(this,t,this.__data__)}}function nu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function ru(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function ou(e,t,n){return function(){var r=this.__on,o,i=tu(t);if(r){for(var s=0,c=r.length;s<c;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function iu(e,t,n){var r=nu(e+""),o,i=r.length,s;if(arguments.length<2){var c=this.node().__on;if(c){for(var a=0,u=c.length,f;a<u;++a)for(o=0,f=c[a];o<i;++o)if((s=r[o]).type===f.type&&s.name===f.name)return f.value}return}for(c=t?ou:ru,o=0;o<i;++o)this.each(c(r[o],t,n));return this}function Wo(e,t,n){var r=Vo(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function su(e,t){return function(){return Wo(this,e,t)}}function au(e,t){return function(){return Wo(this,e,t.apply(this,arguments))}}function cu(e,t){return this.each((typeof t=="function"?au:su)(e,t))}function*uu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var Go=[null];function he(e,t){this._groups=e,this._parents=t}function bt(){return new he([[document.documentElement]],Go)}function lu(){return this}he.prototype=bt.prototype={constructor:he,select:La,selectAll:Ha,selectChild:Ya,selectChildren:qa,filter:Ua,data:tc,enter:Ka,exit:rc,join:oc,merge:ic,selection:lu,order:sc,sort:ac,call:uc,nodes:lc,node:fc,size:dc,empty:hc,each:gc,attr:_c,style:Sc,property:Ic,classed:Oc,text:Dc,html:Vc,raise:Fc,lower:Xc,append:Wc,insert:qc,remove:Kc,clone:Jc,datum:eu,on:iu,dispatch:cu,[Symbol.iterator]:uu};function de(e){return typeof e=="string"?new he([[document.querySelector(e)]],[document.documentElement]):new he([[e]],Go)}function fu(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=fu(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const du={passive:!1},ht={capture:!0,passive:!1};function En(e){e.stopImmediatePropagation()}function Ge(e){e.preventDefault(),e.stopImmediatePropagation()}function qo(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",Ge,ht);"onselectstart"in t?n.on("selectstart.drag",Ge,ht):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Uo(e,t){var n=e.document.documentElement,r=de(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ge,ht),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Tt=e=>()=>e;function Dn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:c,dx:a,dy:u,dispatch:f}){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:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,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:f}})}Dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function hu(e){return!e.ctrlKey&&!e.button}function gu(){return this.parentNode}function pu(e,t){return t??{x:e.x,y:e.y}}function mu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ko(){var e=hu,t=gu,n=pu,r=mu,o={},i=on("start","drag","end"),s=0,c,a,u,f,l=0;function d(y){y.on("mousedown.drag",h).filter(r).on("touchstart.drag",E).on("touchmove.drag",_,du).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(y,T){if(!(f||!e.call(this,y,T))){var k=p(this,t.call(this,y,T),y,T,"mouse");k&&(de(y.view).on("mousemove.drag",g,ht).on("mouseup.drag",w,ht),qo(y.view),En(y),u=!1,c=y.clientX,a=y.clientY,k("start",y))}}function g(y){if(Ge(y),!u){var T=y.clientX-c,k=y.clientY-a;u=T*T+k*k>l}o.mouse("drag",y)}function w(y){de(y.view).on("mousemove.drag mouseup.drag",null),Uo(y.view,u),Ge(y),o.mouse("end",y)}function E(y,T){if(e.call(this,y,T)){var k=y.changedTouches,I=t.call(this,y,T),H=k.length,F,j;for(F=0;F<H;++F)(j=p(this,I,y,T,k[F].identifier,k[F]))&&(En(y),j("start",y,k[F]))}}function _(y){var T=y.changedTouches,k=T.length,I,H;for(I=0;I<k;++I)(H=o[T[I].identifier])&&(Ge(y),H("drag",y,T[I]))}function b(y){var T=y.changedTouches,k=T.length,I,H;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),I=0;I<k;++I)(H=o[T[I].identifier])&&(En(y),H("end",y,T[I]))}function p(y,T,k,I,H,F){var j=i.copy(),C=pe(F||k,T),R,D,x;if((x=n.call(y,new Dn("beforestart",{sourceEvent:k,target:d,identifier:H,active:s,x:C[0],y:C[1],dx:0,dy:0,dispatch:j}),I))!=null)return R=x.x-C[0]||0,D=x.y-C[1]||0,function L(N,P,A){var O=C,B;switch(N){case"start":o[H]=L,B=s++;break;case"end":delete o[H],--s;case"drag":C=pe(A||P,T),B=s;break}j.call(N,y,new Dn(N,{sourceEvent:P,subject:x,target:d,identifier:H,active:B,x:C[0]+R,y:C[1]+D,dx:C[0]-O[0],dy:C[1]-O[1],dispatch:j}),I)}}return d.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Tt(!!y),d):e},d.container=function(y){return arguments.length?(t=typeof y=="function"?y:Tt(y),d):t},d.subject=function(y){return arguments.length?(n=typeof y=="function"?y:Tt(y),d):n},d.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Tt(!!y),d):r},d.on=function(){var y=i.on.apply(i,arguments);return y===i?d:y},d.clickDistance=function(y){return arguments.length?(l=(y=+y)*y,d):Math.sqrt(l)},d}function Qn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Zo(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Et(){}var gt=.7,Xt=1/gt,qe="\\s*([+-]?\\d+)\\s*",pt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",yu=/^#([0-9a-f]{3,8})$/,xu=new RegExp(`^rgb\\(${qe},${qe},${qe}\\)$`),vu=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),wu=new RegExp(`^rgba\\(${qe},${qe},${qe},${pt}\\)$`),_u=new RegExp(`^rgba\\(${be},${be},${be},${pt}\\)$`),bu=new RegExp(`^hsl\\(${pt},${be},${be}\\)$`),Eu=new RegExp(`^hsla\\(${pt},${be},${be},${pt}\\)$`),Tr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Qn(Et,ze,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ar,formatHex:Ar,formatHex8:Nu,formatHsl:Su,formatRgb:Pr,toString:Pr});function Ar(){return this.rgb().formatHex()}function Nu(){return this.rgb().formatHex8()}function Su(){return Qo(this).formatHsl()}function Pr(){return this.rgb().formatRgb()}function ze(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=yu.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Or(t):n===3?new fe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?At(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?At(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=xu.exec(e))?new fe(t[1],t[2],t[3],1):(t=vu.exec(e))?new fe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=wu.exec(e))?At(t[1],t[2],t[3],t[4]):(t=_u.exec(e))?At(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=bu.exec(e))?Lr(t[1],t[2]/100,t[3]/100,1):(t=Eu.exec(e))?Lr(t[1],t[2]/100,t[3]/100,t[4]):Tr.hasOwnProperty(e)?Or(Tr[e]):e==="transparent"?new fe(NaN,NaN,NaN,0):null}function Or(e){return new fe(e>>16&255,e>>8&255,e&255,1)}function At(e,t,n,r){return r<=0&&(e=t=n=NaN),new fe(e,t,n,r)}function Cu(e){return e instanceof Et||(e=ze(e)),e?(e=e.rgb(),new fe(e.r,e.g,e.b,e.opacity)):new fe}function jn(e,t,n,r){return arguments.length===1?Cu(e):new fe(e,t,n,r??1)}function fe(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Qn(fe,jn,Zo(Et,{brighter(e){return e=e==null?Xt:Math.pow(Xt,e),new fe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gt:Math.pow(gt,e),new fe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fe(De(this.r),De(this.g),De(this.b),Wt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Rr,formatHex:Rr,formatHex8:ku,formatRgb:$r,toString:$r}));function Rr(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}`}function ku(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}${Le((isNaN(this.opacity)?1:this.opacity)*255)}`}function $r(){const e=Wt(this.opacity);return`${e===1?"rgb(":"rgba("}${De(this.r)}, ${De(this.g)}, ${De(this.b)}${e===1?")":`, ${e})`}`}function Wt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function De(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Le(e){return e=De(e),(e<16?"0":"")+e.toString(16)}function Lr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new me(e,t,n,r)}function Qo(e){if(e instanceof me)return new me(e.h,e.s,e.l,e.opacity);if(e instanceof Et||(e=ze(e)),!e)return new me;if(e instanceof me)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,c=i-o,a=(i+o)/2;return c?(t===i?s=(n-r)/c+(n<r)*6:n===i?s=(r-t)/c+2:s=(t-n)/c+4,c/=a<.5?i+o:2-i-o,s*=60):c=a>0&&a<1?0:s,new me(s,c,a,e.opacity)}function Mu(e,t,n,r){return arguments.length===1?Qo(e):new me(e,t,n,r??1)}function me(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Qn(me,Mu,Zo(Et,{brighter(e){return e=e==null?Xt:Math.pow(Xt,e),new me(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gt:Math.pow(gt,e),new me(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new fe(Nn(e>=240?e-240:e+120,o,r),Nn(e,o,r),Nn(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new me(Dr(this.h),Pt(this.s),Pt(this.l),Wt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Wt(this.opacity);return`${e===1?"hsl(":"hsla("}${Dr(this.h)}, ${Pt(this.s)*100}%, ${Pt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dr(e){return e=(e||0)%360,e<0?e+360:e}function Pt(e){return Math.max(0,Math.min(1,e||0))}function Nn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Jn=e=>()=>e;function Iu(e,t){return function(n){return e+n*t}}function Tu(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Au(e){return(e=+e)==1?Jo:function(t,n){return n-t?Tu(t,n,e):Jn(isNaN(t)?n:t)}}function Jo(e,t){var n=t-e;return n?Iu(e,n):Jn(isNaN(e)?t:e)}const Gt=(function e(t){var n=Au(t);function r(o,i){var s=n((o=jn(o)).r,(i=jn(i)).r),c=n(o.g,i.g),a=n(o.b,i.b),u=Jo(o.opacity,i.opacity);return function(f){return o.r=s(f),o.g=c(f),o.b=a(f),o.opacity=u(f),o+""}}return r.gamma=e,r})(1);function Pu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function Ou(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ru(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=ft(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(c){for(s=0;s<r;++s)i[s]=o[s](c);return i}}function $u(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function _e(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Lu(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=ft(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var zn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Sn=new RegExp(zn.source,"g");function Du(e){return function(){return e}}function ju(e){return function(t){return e(t)+""}}function ei(e,t){var n=zn.lastIndex=Sn.lastIndex=0,r,o,i,s=-1,c=[],a=[];for(e=e+"",t=t+"";(r=zn.exec(e))&&(o=Sn.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),c[s]?c[s]+=i:c[++s]=i),(r=r[0])===(o=o[0])?c[s]?c[s]+=o:c[++s]=o:(c[++s]=null,a.push({i:s,x:_e(r,o)})),n=Sn.lastIndex;return n<t.length&&(i=t.slice(n),c[s]?c[s]+=i:c[++s]=i),c.length<2?a[0]?ju(a[0].x):Du(t):(t=a.length,function(u){for(var f=0,l;f<t;++f)c[(l=a[f]).i]=l.x(u);return c.join("")})}function ft(e,t){var n=typeof t,r;return t==null||n==="boolean"?Jn(t):(n==="number"?_e:n==="string"?(r=ze(t))?(t=r,Gt):ei:t instanceof ze?Gt:t instanceof Date?$u:Ou(t)?Pu:Array.isArray(t)?Ru:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Lu:_e)(e,t)}var jr=180/Math.PI,Hn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ti(e,t,n,r,o,i){var s,c,a;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(a=e*n+t*r)&&(n-=e*a,r-=t*a),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,a/=c),e*r<t*n&&(e=-e,t=-t,a=-a,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*jr,skewX:Math.atan(a)*jr,scaleX:s,scaleY:c}}var Ot;function zu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Hn:ti(t.a,t.b,t.c,t.d,t.e,t.f)}function Hu(e){return e==null||(Ot||(Ot=document.createElementNS("http://www.w3.org/2000/svg","g")),Ot.setAttribute("transform",e),!(e=Ot.transform.baseVal.consolidate()))?Hn:(e=e.matrix,ti(e.a,e.b,e.c,e.d,e.e,e.f))}function ni(e,t,n,r){function o(u){return u.length?u.pop()+" ":""}function i(u,f,l,d,h,g){if(u!==l||f!==d){var w=h.push("translate(",null,t,null,n);g.push({i:w-4,x:_e(u,l)},{i:w-2,x:_e(f,d)})}else(l||d)&&h.push("translate("+l+t+d+n)}function s(u,f,l,d){u!==f?(u-f>180?f+=360:f-u>180&&(u+=360),d.push({i:l.push(o(l)+"rotate(",null,r)-2,x:_e(u,f)})):f&&l.push(o(l)+"rotate("+f+r)}function c(u,f,l,d){u!==f?d.push({i:l.push(o(l)+"skewX(",null,r)-2,x:_e(u,f)}):f&&l.push(o(l)+"skewX("+f+r)}function a(u,f,l,d,h,g){if(u!==l||f!==d){var w=h.push(o(h)+"scale(",null,",",null,")");g.push({i:w-4,x:_e(u,l)},{i:w-2,x:_e(f,d)})}else(l!==1||d!==1)&&h.push(o(h)+"scale("+l+","+d+")")}return function(u,f){var l=[],d=[];return u=e(u),f=e(f),i(u.translateX,u.translateY,f.translateX,f.translateY,l,d),s(u.rotate,f.rotate,l,d),c(u.skewX,f.skewX,l,d),a(u.scaleX,u.scaleY,f.scaleX,f.scaleY,l,d),u=f=null,function(h){for(var g=-1,w=d.length,E;++g<w;)l[(E=d[g]).i]=E.x(h);return l.join("")}}}var Vu=ni(zu,"px, ","px)","deg)"),Bu=ni(Hu,", ",")",")"),Fu=1e-12;function zr(e){return((e=Math.exp(e))+1/e)/2}function Yu(e){return((e=Math.exp(e))-1/e)/2}function Xu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ht=(function e(t,n,r){function o(i,s){var c=i[0],a=i[1],u=i[2],f=s[0],l=s[1],d=s[2],h=f-c,g=l-a,w=h*h+g*g,E,_;if(w<Fu)_=Math.log(d/u)/t,E=function(I){return[c+I*h,a+I*g,u*Math.exp(t*I*_)]};else{var b=Math.sqrt(w),p=(d*d-u*u+r*w)/(2*u*n*b),y=(d*d-u*u-r*w)/(2*d*n*b),T=Math.log(Math.sqrt(p*p+1)-p),k=Math.log(Math.sqrt(y*y+1)-y);_=(k-T)/t,E=function(I){var H=I*_,F=zr(T),j=u/(n*b)*(F*Xu(t*H+T)-Yu(T));return[c+j*h,a+j*g,u*F/zr(t*H+T)]}}return E.duration=_*1e3*t/Math.SQRT2,E}return o.rho=function(i){var s=Math.max(.001,+i),c=s*s,a=c*c;return e(s,c,a)},o})(Math.SQRT2,2,4);var Ke=0,ut=0,at=0,ri=1e3,qt,lt,Ut=0,He=0,an=0,mt=typeof performance=="object"&&performance.now?performance:Date,oi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function er(){return He||(oi(Wu),He=mt.now()+an)}function Wu(){He=0}function Kt(){this._call=this._time=this._next=null}Kt.prototype=ii.prototype={constructor:Kt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?er():+n)+(t==null?0:+t),!this._next&<!==this&&(lt?lt._next=this:qt=this,lt=this),this._call=e,this._time=n,Vn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vn())}};function ii(e,t,n){var r=new Kt;return r.restart(e,t,n),r}function Gu(){er(),++Ke;for(var e=qt,t;e;)(t=He-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ke}function Hr(){He=(Ut=mt.now())+an,Ke=ut=0;try{Gu()}finally{Ke=0,Uu(),He=0}}function qu(){var e=mt.now(),t=e-Ut;t>ri&&(an-=t,Ut=e)}function Uu(){for(var e,t=qt,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qt=n);lt=e,Vn(r)}function Vn(e){if(!Ke){ut&&(ut=clearTimeout(ut));var t=e-He;t>24?(e<1/0&&(ut=setTimeout(Hr,e-mt.now()-an)),at&&(at=clearInterval(at))):(at||(Ut=mt.now(),at=setInterval(qu,ri)),Ke=1,oi(Hr))}}function Vr(e,t,n){var r=new Kt;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Ku=on("start","end","cancel","interrupt"),Zu=[],si=0,Br=1,Bn=2,Vt=3,Fr=4,Fn=5,Bt=6;function cn(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Qu(e,n,{name:t,index:r,group:o,on:Ku,tween:Zu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:si})}function tr(e,t){var n=we(e,t);if(n.state>si)throw new Error("too late; already scheduled");return n}function Ne(e,t){var n=we(e,t);if(n.state>Vt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Qu(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=ii(i,0,n.time);function i(u){n.state=Br,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var f,l,d,h;if(n.state!==Br)return a();for(f in r)if(h=r[f],h.name===n.name){if(h.state===Vt)return Vr(s);h.state===Fr?(h.state=Bt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[f]):+f<t&&(h.state=Bt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[f])}if(Vr(function(){n.state===Vt&&(n.state=Fr,n.timer.restart(c,n.delay,n.time),c(u))}),n.state=Bn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Bn){for(n.state=Vt,o=new Array(d=n.tween.length),f=0,l=-1;f<d;++f)(h=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(o[++l]=h);o.length=l+1}}function c(u){for(var f=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(a),n.state=Fn,1),l=-1,d=o.length;++l<d;)o[l].call(e,f);n.state===Fn&&(n.on.call("end",e,e.__data__,n.index,n.group),a())}function a(){n.state=Bt,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Ft(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Bn&&r.state<Fn,r.state=Bt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function Ju(e){return this.each(function(){Ft(this,e)})}function el(e,t){var n,r;return function(){var o=Ne(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,c=r.length;s<c;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function tl(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=Ne(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var c={name:t,value:n},a=0,u=o.length;a<u;++a)if(o[a].name===t){o[a]=c;break}a===u&&o.push(c)}i.tween=o}}function nl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=we(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?el:tl)(n,e,t))}function nr(e,t,n){var r=e._id;return e.each(function(){var o=Ne(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return we(o,r).value[t]}}function ai(e,t){var n;return(typeof t=="number"?_e:t instanceof ze?Gt:(n=ze(t))?(t=n,Gt):ei)(e,t)}function rl(e){return function(){this.removeAttribute(e)}}function ol(e){return function(){this.removeAttributeNS(e.space,e.local)}}function il(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function sl(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function al(e,t,n){var r,o,i;return function(){var s,c=n(this),a;return c==null?void this.removeAttribute(e):(s=this.getAttribute(e),a=c+"",s===a?null:s===r&&a===o?i:(o=a,i=t(r=s,c)))}}function cl(e,t,n){var r,o,i;return function(){var s,c=n(this),a;return c==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),a=c+"",s===a?null:s===r&&a===o?i:(o=a,i=t(r=s,c)))}}function ul(e,t){var n=sn(e),r=n==="transform"?Bu:ai;return this.attrTween(e,typeof t=="function"?(n.local?cl:al)(n,r,nr(this,"attr."+e,t)):t==null?(n.local?ol:rl)(n):(n.local?sl:il)(n,r,t))}function ll(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function fl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function dl(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&fl(e,i)),n}return o._value=t,o}function hl(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&ll(e,i)),n}return o._value=t,o}function gl(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 r=sn(e);return this.tween(n,(r.local?dl:hl)(r,t))}function pl(e,t){return function(){tr(this,e).delay=+t.apply(this,arguments)}}function ml(e,t){return t=+t,function(){tr(this,e).delay=t}}function yl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?pl:ml)(t,e)):we(this.node(),t).delay}function xl(e,t){return function(){Ne(this,e).duration=+t.apply(this,arguments)}}function vl(e,t){return t=+t,function(){Ne(this,e).duration=t}}function wl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xl:vl)(t,e)):we(this.node(),t).duration}function _l(e,t){if(typeof t!="function")throw new Error;return function(){Ne(this,e).ease=t}}function bl(e){var t=this._id;return arguments.length?this.each(_l(t,e)):we(this.node(),t).ease}function El(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ne(this,e).ease=n}}function Nl(e){if(typeof e!="function")throw new Error;return this.each(El(this._id,e))}function Sl(e){typeof e!="function"&&(e=jo(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,c=r[o]=[],a,u=0;u<s;++u)(a=i[u])&&e.call(a,a.__data__,u,i)&&c.push(a);return new Me(r,this._parents,this._name,this._id)}function Cl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),c=0;c<i;++c)for(var a=t[c],u=n[c],f=a.length,l=s[c]=new Array(f),d,h=0;h<f;++h)(d=a[h]||u[h])&&(l[h]=d);for(;c<r;++c)s[c]=t[c];return new Me(s,this._parents,this._name,this._id)}function kl(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 Ml(e,t,n){var r,o,i=kl(t)?tr:Ne;return function(){var s=i(this,e),c=s.on;c!==r&&(o=(r=c).copy()).on(t,n),s.on=o}}function Il(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Ml(n,e,t))}function Tl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Al(){return this.on("end.remove",Tl(this._id))}function Pl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Kn(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var c=r[s],a=c.length,u=i[s]=new Array(a),f,l,d=0;d<a;++d)(f=c[d])&&(l=e.call(f,f.__data__,d,c))&&("__data__"in f&&(l.__data__=f.__data__),u[d]=l,cn(u[d],t,n,d,u,we(f,n)));return new Me(i,this._parents,t,n)}function Ol(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Do(e));for(var r=this._groups,o=r.length,i=[],s=[],c=0;c<o;++c)for(var a=r[c],u=a.length,f,l=0;l<u;++l)if(f=a[l]){for(var d=e.call(f,f.__data__,l,a),h,g=we(f,n),w=0,E=d.length;w<E;++w)(h=d[w])&&cn(h,t,n,w,d,g);i.push(d),s.push(f)}return new Me(i,s,t,n)}var Rl=bt.prototype.constructor;function $l(){return new Rl(this._groups,this._parents)}function Ll(e,t){var n,r,o;return function(){var i=Ue(this,e),s=(this.style.removeProperty(e),Ue(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function ci(e){return function(){this.style.removeProperty(e)}}function Dl(e,t,n){var r,o=n+"",i;return function(){var s=Ue(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function jl(e,t,n){var r,o,i;return function(){var s=Ue(this,e),c=n(this),a=c+"";return c==null&&(a=c=(this.style.removeProperty(e),Ue(this,e))),s===a?null:s===r&&a===o?i:(o=a,i=t(r=s,c))}}function zl(e,t){var n,r,o,i="style."+t,s="end."+i,c;return function(){var a=Ne(this,e),u=a.on,f=a.value[i]==null?c||(c=ci(t)):void 0;(u!==n||o!==f)&&(r=(n=u).copy()).on(s,o=f),a.on=r}}function Hl(e,t,n){var r=(e+="")=="transform"?Vu:ai;return t==null?this.styleTween(e,Ll(e,r)).on("end.style."+e,ci(e)):typeof t=="function"?this.styleTween(e,jl(e,r,nr(this,"style."+e,t))).each(zl(this._id,e)):this.styleTween(e,Dl(e,r,t),n).on("end.style."+e,null)}function Vl(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Bl(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&Vl(e,s,n)),r}return i._value=t,i}function Fl(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Bl(e,t,n??""))}function Yl(e){return function(){this.textContent=e}}function Xl(e){return function(){var t=e(this);this.textContent=t??""}}function Wl(e){return this.tween("text",typeof e=="function"?Xl(nr(this,"text",e)):Yl(e==null?"":e+""))}function Gl(e){return function(t){this.textContent=e.call(this,t)}}function ql(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Gl(o)),t}return r._value=e,r}function Ul(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,ql(e))}function Kl(){for(var e=this._name,t=this._id,n=ui(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],c=s.length,a,u=0;u<c;++u)if(a=s[u]){var f=we(a,t);cn(a,e,n,u,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Me(r,this._parents,e,n)}function Zl(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var c={value:s},a={value:function(){--o===0&&i()}};n.each(function(){var u=Ne(this,r),f=u.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(a)),u.on=t}),o===0&&i()})}var Ql=0;function Me(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ui(){return++Ql}var Ce=bt.prototype;Me.prototype={constructor:Me,select:Pl,selectAll:Ol,selectChild:Ce.selectChild,selectChildren:Ce.selectChildren,filter:Sl,merge:Cl,selection:$l,transition:Kl,call:Ce.call,nodes:Ce.nodes,node:Ce.node,size:Ce.size,empty:Ce.empty,each:Ce.each,on:Il,attr:ul,attrTween:gl,style:Hl,styleTween:Fl,text:Wl,textTween:Ul,remove:Al,tween:nl,delay:yl,duration:wl,ease:bl,easeVarying:Nl,end:Zl,[Symbol.iterator]:Ce[Symbol.iterator]};function Jl(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var ef={time:null,delay:0,duration:250,ease:Jl};function tf(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 nf(e){var t,n;e instanceof Me?(t=e._id,e=e._name):(t=ui(),(n=ef).time=er(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],c=s.length,a,u=0;u<c;++u)(a=s[u])&&cn(a,e,t,u,s,n||tf(a,t));return new Me(r,this._parents,e,t)}bt.prototype.interrupt=Ju;bt.prototype.transition=nf;const Rt=e=>()=>e;function rf(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:r,enumerable:!0,configurable:!0},_:{value:o}})}function ke(e,t,n){this.k=e,this.x=t,this.y=n}ke.prototype={constructor:ke,scale:function(e){return e===1?this:new ke(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ke(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 un=new ke(1,0,0);li.prototype=ke.prototype;function li(e){for(;!e.__zoom;)if(!(e=e.parentNode))return un;return e.__zoom}function Cn(e){e.stopImmediatePropagation()}function ct(e){e.preventDefault(),e.stopImmediatePropagation()}function of(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function sf(){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 Yr(){return this.__zoom||un}function af(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function cf(){return navigator.maxTouchPoints||"ontouchstart"in this}function uf(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function fi(){var e=of,t=sf,n=uf,r=af,o=cf,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,a=Ht,u=on("start","zoom","end"),f,l,d,h=500,g=150,w=0,E=10;function _(x){x.property("__zoom",Yr).on("wheel.zoom",H,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",j).filter(o).on("touchstart.zoom",C).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(x,L,N,P){var A=x.selection?x.selection():x;A.property("__zoom",Yr),x!==A?T(x,L,N,P):A.interrupt().each(function(){k(this,arguments).event(P).start().zoom(null,typeof L=="function"?L.apply(this,arguments):L).end()})},_.scaleBy=function(x,L,N,P){_.scaleTo(x,function(){var A=this.__zoom.k,O=typeof L=="function"?L.apply(this,arguments):L;return A*O},N,P)},_.scaleTo=function(x,L,N,P){_.transform(x,function(){var A=t.apply(this,arguments),O=this.__zoom,B=N==null?y(A):typeof N=="function"?N.apply(this,arguments):N,m=O.invert(B),M=typeof L=="function"?L.apply(this,arguments):L;return n(p(b(O,M),B,m),A,s)},N,P)},_.translateBy=function(x,L,N,P){_.transform(x,function(){return n(this.__zoom.translate(typeof L=="function"?L.apply(this,arguments):L,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,P)},_.translateTo=function(x,L,N,P,A){_.transform(x,function(){var O=t.apply(this,arguments),B=this.__zoom,m=P==null?y(O):typeof P=="function"?P.apply(this,arguments):P;return n(un.translate(m[0],m[1]).scale(B.k).translate(typeof L=="function"?-L.apply(this,arguments):-L,typeof N=="function"?-N.apply(this,arguments):-N),O,s)},P,A)};function b(x,L){return L=Math.max(i[0],Math.min(i[1],L)),L===x.k?x:new ke(L,x.x,x.y)}function p(x,L,N){var P=L[0]-N[0]*x.k,A=L[1]-N[1]*x.k;return P===x.x&&A===x.y?x:new ke(x.k,P,A)}function y(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}function T(x,L,N,P){x.on("start.zoom",function(){k(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(P).end()}).tween("zoom",function(){var A=this,O=arguments,B=k(A,O).event(P),m=t.apply(A,O),M=N==null?y(m):typeof N=="function"?N.apply(A,O):N,Y=Math.max(m[1][0]-m[0][0],m[1][1]-m[0][1]),S=A.__zoom,v=typeof L=="function"?L.apply(A,O):L,$=a(S.invert(M).concat(Y/S.k),v.invert(M).concat(Y/v.k));return function(z){if(z===1)z=v;else{var V=$(z),X=Y/V[2];z=new ke(X,M[0]-V[0]*X,M[1]-V[1]*X)}B.zoom(null,z)}})}function k(x,L,N){return!N&&x.__zooming||new I(x,L)}function I(x,L){this.that=x,this.args=L,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,L),this.taps=0}I.prototype={event:function(x){return x&&(this.sourceEvent=x),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(x,L){return this.mouse&&x!=="mouse"&&(this.mouse[1]=L.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=L.invert(this.touch0[0])),this.touch1&&x!=="touch"&&(this.touch1[1]=L.invert(this.touch1[0])),this.that.__zoom=L,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(x){var L=de(this.that).datum();u.call(x,this.that,new rf(x,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:u}),L)}};function H(x,...L){if(!e.apply(this,arguments))return;var N=k(this,L).event(x),P=this.__zoom,A=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,r.apply(this,arguments)))),O=pe(x);if(N.wheel)(N.mouse[0][0]!==O[0]||N.mouse[0][1]!==O[1])&&(N.mouse[1]=P.invert(N.mouse[0]=O)),clearTimeout(N.wheel);else{if(P.k===A)return;N.mouse=[O,P.invert(O)],Ft(this),N.start()}ct(x),N.wheel=setTimeout(B,g),N.zoom("mouse",n(p(b(P,A),N.mouse[0],N.mouse[1]),N.extent,s));function B(){N.wheel=null,N.end()}}function F(x,...L){if(d||!e.apply(this,arguments))return;var N=x.currentTarget,P=k(this,L,!0).event(x),A=de(x.view).on("mousemove.zoom",M,!0).on("mouseup.zoom",Y,!0),O=pe(x,N),B=x.clientX,m=x.clientY;qo(x.view),Cn(x),P.mouse=[O,this.__zoom.invert(O)],Ft(this),P.start();function M(S){if(ct(S),!P.moved){var v=S.clientX-B,$=S.clientY-m;P.moved=v*v+$*$>w}P.event(S).zoom("mouse",n(p(P.that.__zoom,P.mouse[0]=pe(S,N),P.mouse[1]),P.extent,s))}function Y(S){A.on("mousemove.zoom mouseup.zoom",null),Uo(S.view,P.moved),ct(S),P.event(S).end()}}function j(x,...L){if(e.apply(this,arguments)){var N=this.__zoom,P=pe(x.changedTouches?x.changedTouches[0]:x,this),A=N.invert(P),O=N.k*(x.shiftKey?.5:2),B=n(p(b(N,O),P,A),t.apply(this,L),s);ct(x),c>0?de(this).transition().duration(c).call(T,B,P,x):de(this).call(_.transform,B,P,x)}}function C(x,...L){if(e.apply(this,arguments)){var N=x.touches,P=N.length,A=k(this,L,x.changedTouches.length===P).event(x),O,B,m,M;for(Cn(x),B=0;B<P;++B)m=N[B],M=pe(m,this),M=[M,this.__zoom.invert(M),m.identifier],A.touch0?!A.touch1&&A.touch0[2]!==M[2]&&(A.touch1=M,A.taps=0):(A.touch0=M,O=!0,A.taps=1+!!f);f&&(f=clearTimeout(f)),O&&(A.taps<2&&(l=M[0],f=setTimeout(function(){f=null},h)),Ft(this),A.start())}}function R(x,...L){if(this.__zooming){var N=k(this,L).event(x),P=x.changedTouches,A=P.length,O,B,m,M;for(ct(x),O=0;O<A;++O)B=P[O],m=pe(B,this),N.touch0&&N.touch0[2]===B.identifier?N.touch0[0]=m:N.touch1&&N.touch1[2]===B.identifier&&(N.touch1[0]=m);if(B=N.that.__zoom,N.touch1){var Y=N.touch0[0],S=N.touch0[1],v=N.touch1[0],$=N.touch1[1],z=(z=v[0]-Y[0])*z+(z=v[1]-Y[1])*z,V=(V=$[0]-S[0])*V+(V=$[1]-S[1])*V;B=b(B,Math.sqrt(z/V)),m=[(Y[0]+v[0])/2,(Y[1]+v[1])/2],M=[(S[0]+$[0])/2,(S[1]+$[1])/2]}else if(N.touch0)m=N.touch0[0],M=N.touch0[1];else return;N.zoom("touch",n(p(B,m,M),N.extent,s))}}function D(x,...L){if(this.__zooming){var N=k(this,L).event(x),P=x.changedTouches,A=P.length,O,B;for(Cn(x),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),O=0;O<A;++O)B=P[O],N.touch0&&N.touch0[2]===B.identifier?delete N.touch0:N.touch1&&N.touch1[2]===B.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(B=pe(B,this),Math.hypot(l[0]-B[0],l[1]-B[1])<E)){var m=de(this).on("dblclick.zoom");m&&m.apply(this,arguments)}}}return _.wheelDelta=function(x){return arguments.length?(r=typeof x=="function"?x:Rt(+x),_):r},_.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Rt(!!x),_):e},_.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:Rt(!!x),_):o},_.extent=function(x){return arguments.length?(t=typeof x=="function"?x:Rt([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),_):t},_.scaleExtent=function(x){return arguments.length?(i[0]=+x[0],i[1]=+x[1],_):[i[0],i[1]]},_.translateExtent=function(x){return arguments.length?(s[0][0]=+x[0][0],s[1][0]=+x[1][0],s[0][1]=+x[0][1],s[1][1]=+x[1][1],_):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},_.constrain=function(x){return arguments.length?(n=x,_):n},_.duration=function(x){return arguments.length?(c=+x,_):c},_.interpolate=function(x){return arguments.length?(a=x,_):a},_.on=function(){var x=u.on.apply(u,arguments);return x===u?_:x},_.clickDistance=function(x){return arguments.length?(w=(x=+x)*x,_):Math.sqrt(w)},_.tapDistance=function(x){return arguments.length?(E=+x,_):E},_}const Ee={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],di=["Enter"," ","Escape"],hi={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ze;(function(e){e.Strict="strict",e.Loose="loose"})(Ze||(Ze={}));var je;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(je||(je={}));var xt;(function(e){e.Partial="partial",e.Full="full"})(xt||(xt={}));const gi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pe||(Pe={}));var Zt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Zt||(Zt={}));var Q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Q||(Q={}));const Xr={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function pi(e){return e===null?null:e?"valid":"invalid"}const mi=e=>"id"in e&&"source"in e&&"target"in e,lf=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),rr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Nt=(e,t=[0,0])=>{const{width:n,height:r}=Ie(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},ff=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):rr(o)?o:t.nodeLookup.get(o.id));const c=s?Qt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ln(r,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},St=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=ln(n,Qt(o)),r=!0)}),r?fn(n):{x:0,y:0,width:0,height:0}},or=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const c={...kt(t,[n,r,o]),width:t.width/o,height:t.height/o},a=[];for(const u of e.values()){const{measured:f,selectable:l=!0,hidden:d=!1}=u;if(s&&!l||d)continue;const h=f.width??u.width??u.initialWidth??null,g=f.height??u.height??u.initialHeight??null,w=vt(c,Je(u)),E=(h??0)*(g??0),_=i&&w>0;(!u.internals.handleBounds||_||w>=E||u.dragging)&&a.push(u)}return a},df=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function hf(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function gf({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const c=hf(e,s),a=St(c),u=ir(a,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(u,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function yi({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),c=s.parentId?n.get(s.parentId):void 0,{x:a,y:u}=c?c.internals.positionAbsolute:{x:0,y:0},f=s.origin??r;let l=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!c)i==null||i("005",Ee.error005());else{const h=c.measured.width,g=c.measured.height;h&&g&&(l=[[a,u],[a+h,u+g]])}else c&&et(s.extent)&&(l=[[s.extent[0][0]+a,s.extent[0][1]+u],[s.extent[1][0]+a,s.extent[1][1]+u]]);const d=et(l)?Ve(t,l,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",Ee.error015())),{position:{x:d.x-a+(s.measured.width??0)*f[0],y:d.y-u+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function pf({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(w=>w.id===d.parentId);(h||g)&&s.push(d)}const c=new Set(t.map(d=>d.id)),a=r.filter(d=>d.deletable!==!1),f=df(s,a);for(const d of a)c.has(d.id)&&!f.find(g=>g.id===d.id)&&f.push(d);if(!o)return{edges:f,nodes:s};const l=await o({nodes:s,edges:f});return typeof l=="boolean"?l?{edges:f,nodes:s}:{edges:[],nodes:[]}:l}const Qe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ve=(e={x:0,y:0},t,n)=>({x:Qe(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Qe(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function xi(e,t,n){const{width:r,height:o}=Ie(n),{x:i,y:s}=n.internals.positionAbsolute;return Ve(e,[[i,s],[i+r,s+o]],t)}const Wr=(e,t,n)=>e<t?Qe(Math.abs(e-t),1,t)/t:e>n?-Qe(Math.abs(e-n),1,t)/t:0,vi=(e,t,n=15,r=40)=>{const o=Wr(e.x,r,t.width-r)*n,i=Wr(e.y,r,t.height-r)*n;return[o,i]},ln=(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)}),Yn=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),fn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Je=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=rr(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Qt=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=rr(e)?e.internals.positionAbsolute:Nt(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},wi=(e,t)=>fn(ln(Yn(e),Yn(t))),vt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Gr=e=>ye(e.width)&&ye(e.height)&&ye(e.x)&&ye(e.y),ye=e=>!isNaN(e)&&isFinite(e),mf=(e,t)=>{},Ct=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),kt=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const c={x:(e-n)/o,y:(t-r)/o};return i?Ct(c,s):c},Jt=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Ye(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function yf(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ye(e,n),o=Ye(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Ye(e.top??e.y??0,n),o=Ye(e.bottom??e.y??0,n),i=Ye(e.left??e.x??0,t),s=Ye(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function xf(e,t,n,r,o,i){const{x:s,y:c}=Jt(e,[t,n,r]),{x:a,y:u}=Jt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=o-a,l=i-u;return{left:Math.floor(s),top:Math.floor(c),right:Math.floor(f),bottom:Math.floor(l)}}const ir=(e,t,n,r,o,i)=>{const s=yf(i,t,n),c=(t-s.x)/e.width,a=(n-s.y)/e.height,u=Math.min(c,a),f=Qe(u,r,o),l=e.x+e.width/2,d=e.y+e.height/2,h=t/2-l*f,g=n/2-d*f,w=xf(e,h,g,f,t,n),E={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-E.left+E.right,y:g-E.top+E.bottom,zoom:f}},wt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function et(e){return e!=null&&e!=="parent"}function Ie(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function _i(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function bi(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const c=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function qr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function vf(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function wf(e){return{...hi,...e||{}}}function dt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=xe(e),c=kt({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:a,y:u}=n?Ct(c,t):c;return{xSnapped:a,ySnapped:u,...c}}const sr=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ei=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},_f=["INPUT","SELECT","TEXTAREA"];function Ni(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:_f.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Si=e=>"clientX"in e,xe=(e,t)=>{var i,s;const n=Si(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Ur=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const c=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(c.left-n.left)/r,y:(c.top-n.top)/r,...sr(s)}})};function Ci({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:c}){const a=e*.125+o*.375+s*.375+n*.125,u=t*.125+i*.375+c*.375+r*.125,f=Math.abs(a-e),l=Math.abs(u-t);return[a,u,f,l]}function $t(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Kr({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case Q.Left:return[t-$t(t-r,i),n];case Q.Right:return[t+$t(r-t,i),n];case Q.Top:return[t,n-$t(n-o,i)];case Q.Bottom:return[t,n+$t(o-n,i)]}}function ki({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:o,targetPosition:i=Q.Top,curvature:s=.25}){const[c,a]=Kr({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[u,f]=Kr({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[l,d,h,g]=Ci({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:c,sourceControlY:a,targetControlX:u,targetControlY:f});return[`M${e},${t} C${c},${a} ${u},${f} ${r},${o}`,l,d,h,g]}function Mi({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,c=r<t?r+s:r-s;return[i,c,o,s]}function bf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,c=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+c}function Ef({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=ln(Qt(e),Qt(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return vt(s,fn(i))>0}const Nf=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Sf=(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)),Cf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||Nf;let o;return mi(e)?o={...e}:o={...e,id:r(e)},Sf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Ii({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,c]=Mi({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,c]}const Zr={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},kf=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.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},Qr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Mf({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:o,offset:i,stepPosition:s}){const c=Zr[t],a=Zr[r],u={x:e.x+c.x*i,y:e.y+c.y*i},f={x:n.x+a.x*i,y:n.y+a.y*i},l=kf({source:u,sourcePosition:t,target:f}),d=l.x!==0?"x":"y",h=l[d];let g=[],w,E;const _={x:0,y:0},b={x:0,y:0},[,,p,y]=Mi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[d]*a[d]===-1){d==="x"?(w=o.x??u.x+(f.x-u.x)*s,E=o.y??(u.y+f.y)/2):(w=o.x??(u.x+f.x)/2,E=o.y??u.y+(f.y-u.y)*s);const k=[{x:w,y:u.y},{x:w,y:f.y}],I=[{x:u.x,y:E},{x:f.x,y:E}];c[d]===h?g=d==="x"?k:I:g=d==="x"?I:k}else{const k=[{x:u.x,y:f.y}],I=[{x:f.x,y:u.y}];if(d==="x"?g=c.x===h?I:k:g=c.y===h?k:I,t===r){const R=Math.abs(e[d]-n[d]);if(R<=i){const D=Math.min(i-1,i-R);c[d]===h?_[d]=(u[d]>e[d]?-1:1)*D:b[d]=(f[d]>n[d]?-1:1)*D}}if(t!==r){const R=d==="x"?"y":"x",D=c[d]===a[R],x=u[R]>f[R],L=u[R]<f[R];(c[d]===1&&(!D&&x||D&&L)||c[d]!==1&&(!D&&L||D&&x))&&(g=d==="x"?k:I)}const H={x:u.x+_.x,y:u.y+_.y},F={x:f.x+b.x,y:f.y+b.y},j=Math.max(Math.abs(H.x-g[0].x),Math.abs(F.x-g[0].x)),C=Math.max(Math.abs(H.y-g[0].y),Math.abs(F.y-g[0].y));j>=C?(w=(H.x+F.x)/2,E=g[0].y):(w=g[0].x,E=(H.y+F.y)/2)}return[[e,{x:u.x+_.x,y:u.y+_.y},...g,{x:f.x+b.x,y:f.y+b.y},n],w,E,p,y]}function If(e,t,n,r){const o=Math.min(Qr(e,t)/2,Qr(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const u=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+o*u},${s}Q ${i},${s} ${i},${s+o*f}`}const c=e.x<n.x?1:-1,a=e.y<n.y?-1:1;return`L ${i},${s+o*a}Q ${i},${s} ${i+o*c},${s}`}function Xn({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:o,targetPosition:i=Q.Top,borderRadius:s=5,centerX:c,centerY:a,offset:u=20,stepPosition:f=.5}){const[l,d,h,g,w]=Mf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:c,y:a},offset:u,stepPosition:f});return[l.reduce((_,b,p)=>{let y="";return p>0&&p<l.length-1?y=If(l[p-1],b,l[p+1],s):y=`${p===0?"M":"L"}${b.x} ${b.y}`,_+=y,_},""),d,h,g,w]}function Jr(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Tf(e){var l;const{sourceNode:t,targetNode:n}=e;if(!Jr(t)||!Jr(n))return null;const r=t.internals.handleBounds||eo(t.handles),o=n.internals.handleBounds||eo(n.handles),i=to((r==null?void 0:r.source)??[],e.sourceHandle),s=to(e.connectionMode===Ze.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(l=e.onError)==null||l.call(e,"008",Ee.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=(i==null?void 0:i.position)||Q.Bottom,a=(s==null?void 0:s.position)||Q.Top,u=Be(t,i,c),f=Be(n,s,a);return{sourceX:u.x,sourceY:u.y,targetX:f.x,targetY:f.y,sourcePosition:c,targetPosition:a}}function eo(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Be(e,t,n=Q.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:c}=t??Ie(e);if(r)return{x:o+s/2,y:i+c/2};switch((t==null?void 0:t.position)??n){case Q.Top:return{x:o+s/2,y:i};case Q.Right:return{x:o+s,y:i+c/2};case Q.Bottom:return{x:o+s/2,y:i+c};case Q.Left:return{x:o,y:i+c/2}}}function to(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Wn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Af(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,c)=>([c.markerStart||r,c.markerEnd||o].forEach(a=>{if(a&&typeof a=="object"){const u=Wn(a,t);i.has(u)||(s.push({id:u,color:a.color||n,...a}),i.add(u))}}),s),[]).sort((s,c)=>s.id.localeCompare(c.id))}const Ti=1e3,Pf=10,ar={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Of={...ar,checkEquality:!0};function cr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Rf(e,t,n){const r=cr(ar,n);for(const o of e.values())if(o.parentId)lr(o,e,t,r);else{const i=Nt(o,r.nodeOrigin),s=et(o.extent)?o.extent:r.nodeExtent,c=Ve(i,s,Ie(o));o.internals.positionAbsolute=c}}function $f(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function ur(e){return e==="manual"}function Gn(e,t,n,r={}){var u,f;const o=cr(Of,r),i={i:0},s=new Map(t),c=o!=null&&o.elevateNodesOnSelect&&!ur(o.zIndexMode)?Ti:0;let a=e.length>0;t.clear(),n.clear();for(const l of e){let d=s.get(l.id);if(o.checkEquality&&l===(d==null?void 0:d.internals.userNode))t.set(l.id,d);else{const h=Nt(l,o.nodeOrigin),g=et(l.extent)?l.extent:o.nodeExtent,w=Ve(h,g,Ie(l));d={...o.defaults,...l,measured:{width:(u=l.measured)==null?void 0:u.width,height:(f=l.measured)==null?void 0:f.height},internals:{positionAbsolute:w,handleBounds:$f(l,d),z:Ai(l,c,o.zIndexMode),userNode:l}},t.set(l.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(a=!1),l.parentId&&lr(d,t,n,r,i)}return a}function Lf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function lr(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:c,zIndexMode:a}=cr(ar,r),u=e.parentId,f=t.get(u);if(!f){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Lf(e,n),o&&!f.parentId&&f.internals.rootParentIndex===void 0&&a==="auto"&&(f.internals.rootParentIndex=++o.i,f.internals.z=f.internals.z+o.i*Pf),o&&f.internals.rootParentIndex!==void 0&&(o.i=f.internals.rootParentIndex);const l=i&&!ur(a)?Ti:0,{x:d,y:h,z:g}=Df(e,f,s,c,l,a),{positionAbsolute:w}=e.internals,E=d!==w.x||h!==w.y;(E||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:E?{x:d,y:h}:w,z:g}})}function Ai(e,t,n){const r=ye(e.zIndex)?e.zIndex:0;return ur(n)?r:r+(e.selected?t:0)}function Df(e,t,n,r,o,i){const{x:s,y:c}=t.internals.positionAbsolute,a=Ie(e),u=Nt(e,n),f=et(e.extent)?Ve(u,e.extent,a):u;let l=Ve({x:s+f.x,y:c+f.y},r,a);e.extent==="parent"&&(l=xi(l,a,t));const d=Ai(e,o,i),h=t.internals.z??0;return{x:l.x,y:l.y,z:h>=d?h+1:d}}function fr(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const c of e){const a=t.get(c.parentId);if(!a)continue;const u=((s=i.get(c.parentId))==null?void 0:s.expandedRect)??Je(a),f=wi(u,c.rect);i.set(c.parentId,{expandedRect:f,parent:a})}return i.size>0&&i.forEach(({expandedRect:c,parent:a},u)=>{var p;const f=a.internals.positionAbsolute,l=Ie(a),d=a.origin??r,h=c.x<f.x?Math.round(Math.abs(f.x-c.x)):0,g=c.y<f.y?Math.round(Math.abs(f.y-c.y)):0,w=Math.max(l.width,Math.round(c.width)),E=Math.max(l.height,Math.round(c.height)),_=(w-l.width)*d[0],b=(E-l.height)*d[1];(h>0||g>0||_||b)&&(o.push({id:u,type:"position",position:{x:a.position.x-h+_,y:a.position.y-g+b}}),(p=n.get(u))==null||p.forEach(y=>{e.some(T=>T.id===y.id)||o.push({id:y.id,type:"position",position:{x:y.position.x+h,y:y.position.y+g}})})),(l.width<c.width||l.height<c.height||h||g)&&o.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:w+(h?d[0]*h-_:0),height:E+(g?d[1]*g-b:0)}})}),o}function jf(e,t,n,r,o,i,s){const c=r==null?void 0:r.querySelector(".xyflow__viewport");let a=!1;if(!c)return{changes:[],updatedInternals:a};const u=[],f=window.getComputedStyle(c),{m22:l}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),a=!0;continue}const w=sr(h.nodeElement),E=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(E||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=et(g.extent)?g.extent:i;let{positionAbsolute:y}=g.internals;g.parentId&&g.extent==="parent"?y=xi(y,w,t.get(g.parentId)):p&&(y=Ve(y,p,w));const T={...g,measured:w,internals:{...g.internals,positionAbsolute:y,handleBounds:{source:Ur("source",h.nodeElement,b,l,g.id),target:Ur("target",h.nodeElement,b,l,g.id)}}};t.set(g.id,T),g.parentId&&lr(T,t,n,{nodeOrigin:o,zIndexMode:s}),a=!0,E&&(u.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Je(T,o)}))}}if(d.length>0){const h=fr(d,t,n,o);u.push(...h)}return{changes:u,updatedInternals:a}}async function zf({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r),c=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(c)}function no(e,t,n,r,o,i){let s=o;const c=r.get(s)||new Map;r.set(s,c.set(n,t)),s=`${o}-${e}`;const a=r.get(s)||new Map;if(r.set(s,a.set(n,t)),i){s=`${o}-${e}-${i}`;const u=r.get(s)||new Map;r.set(s,u.set(n,t))}}function Pi(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:c=null}=r,a={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:c},u=`${o}-${s}--${i}-${c}`,f=`${i}-${c}--${o}-${s}`;no("source",a,f,e,o,s),no("target",a,u,e,i,c),t.set(r.id,r)}}function Oi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Oi(n,t):!1}function ro(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Hf(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!Oi(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const c=e.get(i);c&&o.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return o}function kn({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,c,a;const o=[];for(const[u,f]of t){const l=(s=n.get(u))==null?void 0:s.internals.userNode;l&&o.push({...l,position:f.position,dragging:r})}if(!e)return[o[0],o];const i=(c=n.get(e))==null?void 0:c.internals.userNode;return[i?{...i,position:((a=t.get(e))==null?void 0:a.position)||i.position,dragging:r}:o[0],o]}function Vf({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=Ct(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Bf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,c=new Map,a=!1,u={x:0,y:0},f=null,l=!1,d=null,h=!1,g=!1,w=null;function E({noDragClassName:b,handleSelector:p,domNode:y,isSelectable:T,nodeId:k,nodeClickDistance:I=0}){d=de(y);function H({x:R,y:D}){const{nodeLookup:x,nodeExtent:L,snapGrid:N,snapToGrid:P,nodeOrigin:A,onNodeDrag:O,onSelectionDrag:B,onError:m,updateNodePositions:M}=t();i={x:R,y:D};let Y=!1;const S=c.size>1,v=S&&L?Yn(St(c)):null,$=S&&P?Vf({dragItems:c,snapGrid:N,x:R,y:D}):null;for(const[z,V]of c){if(!x.has(z))continue;let X={x:R-V.distance.x,y:D-V.distance.y};P&&(X=$?{x:Math.round(X.x+$.x),y:Math.round(X.y+$.y)}:Ct(X,N));let q=null;if(S&&L&&!V.extent&&v){const{positionAbsolute:Z}=V.internals,J=Z.x-v.x+L[0][0],te=Z.x+V.measured.width-v.x2+L[1][0],ne=Z.y-v.y+L[0][1],ue=Z.y+V.measured.height-v.y2+L[1][1];q=[[J,ne],[te,ue]]}const{position:U,positionAbsolute:K}=yi({nodeId:z,nextPosition:X,nodeLookup:x,nodeExtent:q||L,nodeOrigin:A,onError:m});Y=Y||V.position.x!==U.x||V.position.y!==U.y,V.position=U,V.internals.positionAbsolute=K}if(g=g||Y,!!Y&&(M(c,!0),w&&(r||O||!k&&B))){const[z,V]=kn({nodeId:k,dragItems:c,nodeLookup:x});r==null||r(w,c,z,V),O==null||O(w,z,V),k||B==null||B(w,V)}}async function F(){if(!f)return;const{transform:R,panBy:D,autoPanSpeed:x,autoPanOnNodeDrag:L}=t();if(!L){a=!1,cancelAnimationFrame(s);return}const[N,P]=vi(u,f,x);(N!==0||P!==0)&&(i.x=(i.x??0)-N/R[2],i.y=(i.y??0)-P/R[2],await D({x:N,y:P})&&H(i)),s=requestAnimationFrame(F)}function j(R){var S;const{nodeLookup:D,multiSelectionActive:x,nodesDraggable:L,transform:N,snapGrid:P,snapToGrid:A,selectNodesOnDrag:O,onNodeDragStart:B,onSelectionDragStart:m,unselectNodesAndEdges:M}=t();l=!0,(!O||!T)&&!x&&k&&((S=D.get(k))!=null&&S.selected||M()),T&&O&&k&&(e==null||e(k));const Y=dt(R.sourceEvent,{transform:N,snapGrid:P,snapToGrid:A,containerBounds:f});if(i=Y,c=Hf(D,L,Y,k),c.size>0&&(n||B||!k&&m)){const[v,$]=kn({nodeId:k,dragItems:c,nodeLookup:D});n==null||n(R.sourceEvent,c,v,$),B==null||B(R.sourceEvent,v,$),k||m==null||m(R.sourceEvent,$)}}const C=Ko().clickDistance(I).on("start",R=>{const{domNode:D,nodeDragThreshold:x,transform:L,snapGrid:N,snapToGrid:P}=t();f=(D==null?void 0:D.getBoundingClientRect())||null,h=!1,g=!1,w=R.sourceEvent,x===0&&j(R),i=dt(R.sourceEvent,{transform:L,snapGrid:N,snapToGrid:P,containerBounds:f}),u=xe(R.sourceEvent,f)}).on("drag",R=>{const{autoPanOnNodeDrag:D,transform:x,snapGrid:L,snapToGrid:N,nodeDragThreshold:P,nodeLookup:A}=t(),O=dt(R.sourceEvent,{transform:x,snapGrid:L,snapToGrid:N,containerBounds:f});if(w=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||k&&!A.has(k))&&(h=!0),!h){if(!a&&D&&l&&(a=!0,F()),!l){const B=xe(R.sourceEvent,f),m=B.x-u.x,M=B.y-u.y;Math.sqrt(m*m+M*M)>P&&j(R)}(i.x!==O.xSnapped||i.y!==O.ySnapped)&&c&&l&&(u=xe(R.sourceEvent,f),H(O))}}).on("end",R=>{if(!(!l||h)&&(a=!1,l=!1,cancelAnimationFrame(s),c.size>0)){const{nodeLookup:D,updateNodePositions:x,onNodeDragStop:L,onSelectionDragStop:N}=t();if(g&&(x(c,!1),g=!1),o||L||!k&&N){const[P,A]=kn({nodeId:k,dragItems:c,nodeLookup:D,dragging:!1});o==null||o(R.sourceEvent,c,P,A),L==null||L(R.sourceEvent,P,A),k||N==null||N(R.sourceEvent,A)}}}).filter(R=>{const D=R.target;return!R.button&&(!b||!ro(D,`.${b}`,y))&&(!p||ro(D,p,y))});d.call(C)}function _(){d==null||d.on(".drag",null)}return{update:E,destroy:_}}function Ff(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())vt(o,Je(i))>0&&r.push(i);return r}const Yf=250;function Xf(e,t,n,r){var c,a;let o=[],i=1/0;const s=Ff(e,n,t+Yf);for(const u of s){const f=[...((c=u.internals.handleBounds)==null?void 0:c.source)??[],...((a=u.internals.handleBounds)==null?void 0:a.target)??[]];for(const l of f){if(r.nodeId===l.nodeId&&r.type===l.type&&r.id===l.id)continue;const{x:d,y:h}=Be(u,l,l.position,!0),g=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...l,x:d,y:h}],i=g):g===i&&o.push({...l,x:d,y:h}))}}if(!o.length)return null;if(o.length>1){const u=r.type==="source"?"target":"source";return o.find(f=>f.type===u)??o[0]}return o[0]}function Ri(e,t,n,r,o,i=!1){var u,f,l;const s=r.get(e);if(!s)return null;const c=o==="strict"?(u=s.internals.handleBounds)==null?void 0:u[t]:[...((f=s.internals.handleBounds)==null?void 0:f.source)??[],...((l=s.internals.handleBounds)==null?void 0:l.target)??[]],a=(n?c==null?void 0:c.find(d=>d.id===n):c==null?void 0:c[0])??null;return a&&i?{...a,...Be(s,a,a.position,!0)}:a}function $i(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Wf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Li=()=>!0;function Gf(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:c,nodeLookup:a,lib:u,autoPanOnConnect:f,flowId:l,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:w,onConnectEnd:E,isValidConnection:_=Li,onReconnectEnd:b,updateConnection:p,getTransform:y,getFromHandle:T,autoPanSpeed:k,dragThreshold:I=1,handleDomNode:H}){const F=Ei(e.target);let j=0,C;const{x:R,y:D}=xe(e),x=$i(i,H),L=c==null?void 0:c.getBoundingClientRect();let N=!1;if(!L||!x)return;const P=Ri(o,x,r,a,t);if(!P)return;let A=xe(e,L),O=!1,B=null,m=!1,M=null;function Y(){if(!f||!L)return;const[U,K]=vi(A,L,k);d({x:U,y:K}),j=requestAnimationFrame(Y)}const S={...P,nodeId:o,type:x,position:P.position},v=a.get(o);let z={inProgress:!0,isValid:null,from:Be(v,S,Q.Left,!0),fromHandle:S,fromPosition:S.position,fromNode:v,to:A,toHandle:null,toPosition:Xr[S.position],toNode:null,pointer:A};function V(){N=!0,p(z),g==null||g(e,{nodeId:o,handleId:r,handleType:x})}I===0&&V();function X(U){if(!N){const{x:ue,y:ge}=xe(U),Se=ue-R,Re=ge-D;if(!(Se*Se+Re*Re>I*I))return;V()}if(!T()||!S){q(U);return}const K=y();A=xe(U,L),C=Xf(kt(A,K,!1,[1,1]),n,a,S),O||(Y(),O=!0);const Z=Di(U,{handle:C,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:_,doc:F,lib:u,flowId:l,nodeLookup:a});M=Z.handleDomNode,B=Z.connection,m=Wf(!!C,Z.isValid);const J=a.get(o),te=J?Be(J,S,Q.Left,!0):z.from,ne={...z,from:te,isValid:m,to:Z.toHandle&&m?Jt({x:Z.toHandle.x,y:Z.toHandle.y},K):A,toHandle:Z.toHandle,toPosition:m&&Z.toHandle?Z.toHandle.position:Xr[S.position],toNode:Z.toHandle?a.get(Z.toHandle.nodeId):null,pointer:A};p(ne),z=ne}function q(U){if(!("touches"in U&&U.touches.length>0)){if(N){(C||M)&&B&&m&&(w==null||w(B));const{inProgress:K,...Z}=z,J={...Z,toPosition:z.toHandle?z.toPosition:null};E==null||E(U,J),i&&(b==null||b(U,J))}h(),cancelAnimationFrame(j),O=!1,m=!1,B=null,M=null,F.removeEventListener("mousemove",X),F.removeEventListener("mouseup",q),F.removeEventListener("touchmove",X),F.removeEventListener("touchend",q)}}F.addEventListener("mousemove",X),F.addEventListener("mouseup",q),F.addEventListener("touchmove",X),F.addEventListener("touchend",q)}function Di(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:c,flowId:a,isValidConnection:u=Li,nodeLookup:f}){const l=i==="target",d=t?s.querySelector(`.${c}-flow__handle[data-id="${a}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=xe(e),w=s.elementFromPoint(h,g),E=w!=null&&w.classList.contains(`${c}-flow__handle`)?w:d,_={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const b=$i(void 0,E),p=E.getAttribute("data-nodeid"),y=E.getAttribute("data-handleid"),T=E.classList.contains("connectable"),k=E.classList.contains("connectableend");if(!p||!b)return _;const I={source:l?p:r,sourceHandle:l?y:o,target:l?r:p,targetHandle:l?o:y};_.connection=I;const F=T&&k&&(n===Ze.Strict?l&&b==="source"||!l&&b==="target":p!==r||y!==o);_.isValid=F&&u(I),_.toHandle=Ri(p,b,y,f,n,!0)}return _}const qn={onPointerDown:Gf,isValid:Di};function qf({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=de(e);function i({translateExtent:c,width:a,height:u,zoomStep:f=1,pannable:l=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const y=n(),T=p.sourceEvent.ctrlKey&&wt()?10:1,k=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*f,I=y[2]*Math.pow(2,k*T);t.scaleTo(I)};let w=[0,0];const E=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(w=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},_=p=>{const y=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const T=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],k=[T[0]-w[0],T[1]-w[1]];w=T;const I=r()*Math.max(y[2],Math.log(y[2]))*(h?-1:1),H={x:y[0]-k[0]*I,y:y[1]-k[1]*I},F=[[0,0],[a,u]];t.setViewportConstrained({x:H.x,y:H.y,zoom:y[2]},F,c)},b=fi().on("start",E).on("zoom",l?_:null).on("zoom.wheel",d?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:pe}}const dn=e=>({x:e.x,y:e.y,zoom:e.k}),Mn=({x:e,y:t,zoom:n})=>un.translate(e,t).scale(n),Xe=(e,t)=>e.target.closest(`.${t}`),ji=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Uf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,In=(e,t=0,n=Uf,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},zi=e=>{const t=e.ctrlKey&&wt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Kf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:u}){return f=>{if(Xe(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const l=n.property("__zoom").k||1;if(f.ctrlKey&&s){const E=pe(f),_=zi(f),b=l*Math.pow(2,_);r.scaleTo(n,b,E,f);return}const d=f.deltaMode===1?20:1;let h=o===je.Vertical?0:f.deltaX*d,g=o===je.Horizontal?0:f.deltaY*d;!wt()&&f.shiftKey&&o!==je.Vertical&&(h=f.deltaY*d,g=0),r.translateBy(n,-(h/l)*i,-(g/l)*i,{internal:!0});const w=dn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(a==null||a(f,w),e.panScrollTimeout=setTimeout(()=>{u==null||u(f,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c==null||c(f,w))}}function Zf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,c=Xe(r,e);if(r.ctrlKey&&i&&c&&r.preventDefault(),s||c)return null;r.preventDefault(),n.call(this,r,o)}}function Qf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,c;if((i=r.sourceEvent)!=null&&i.internal)return;const o=dn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((c=r.sourceEvent)==null?void 0:c.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Jf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,c;e.usedRightMouseButton=!!(n&&ji(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((c=i.sourceEvent)!=null&&c.internal)&&(o==null||o(i.sourceEvent,dn(i.transform)))}}function ed({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var c;if(!((c=s.sourceEvent)!=null&&c.internal)&&(e.isZoomingOrPanning=!1,i&&ji(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const a=dn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,a)},n?150:0)}}}function td({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:c,noPanClassName:a,lib:u,connectionInProgress:f}){return l=>{var E;const d=e||t,h=n&&l.ctrlKey,g=l.type==="wheel";if(l.button===1&&l.type==="mousedown"&&(Xe(l,`${u}-flow__node`)||Xe(l,`${u}-flow__edge`)))return!0;if(!r&&!d&&!o&&!i&&!n||s||f&&!g||Xe(l,c)&&g||Xe(l,a)&&(!g||o&&g&&!e)||!n&&l.ctrlKey&&g)return!1;if(!n&&l.type==="touchstart"&&((E=l.touches)==null?void 0:E.length)>1)return l.preventDefault(),!1;if(!d&&!o&&!h&&g||!r&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(r)&&!r.includes(l.button)&&l.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||g)&&w}}function nd({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:a}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),l=fi().scaleExtent([t,n]).translateExtent(r),d=de(e).call(l);b({x:o.x,y:o.y,zoom:Qe(o.zoom,t,n)},[[0,0],[f.width,f.height]],r);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");l.wheelDelta(zi);function w(C,R){return d?new Promise(D=>{l==null||l.interpolate((R==null?void 0:R.interpolate)==="linear"?ft:Ht).transform(In(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function E({noWheelClassName:C,noPanClassName:R,onPaneContextMenu:D,userSelectionActive:x,panOnScroll:L,panOnDrag:N,panOnScrollMode:P,panOnScrollSpeed:A,preventScrolling:O,zoomOnPinch:B,zoomOnScroll:m,zoomOnDoubleClick:M,zoomActivationKeyPressed:Y,lib:S,onTransformChange:v,connectionInProgress:$,paneClickDistance:z,selectionOnDrag:V}){x&&!u.isZoomingOrPanning&&_();const X=L&&!Y&&!x;l.clickDistance(V?1/0:!ye(z)||z<0?0:z);const q=X?Kf({zoomPanValues:u,noWheelClassName:C,d3Selection:d,d3Zoom:l,panOnScrollMode:P,panOnScrollSpeed:A,zoomOnPinch:B,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:c}):Zf({noWheelClassName:C,preventScrolling:O,d3ZoomHandler:h});if(d.on("wheel.zoom",q,{passive:!1}),!x){const K=Qf({zoomPanValues:u,onDraggingChange:a,onPanZoomStart:s});l.on("start",K);const Z=Jf({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!D,onPanZoom:i,onTransformChange:v});l.on("zoom",Z);const J=ed({zoomPanValues:u,panOnDrag:N,panOnScroll:L,onPaneContextMenu:D,onPanZoomEnd:c,onDraggingChange:a});l.on("end",J)}const U=td({zoomActivationKeyPressed:Y,panOnDrag:N,zoomOnScroll:m,panOnScroll:L,zoomOnDoubleClick:M,zoomOnPinch:B,userSelectionActive:x,noPanClassName:R,noWheelClassName:C,lib:S,connectionInProgress:$});l.filter(U),M?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function _(){l.on("zoom",null)}async function b(C,R,D){const x=Mn(C),L=l==null?void 0:l.constrain()(x,R,D);return L&&await w(L),new Promise(N=>N(L))}async function p(C,R){const D=Mn(C);return await w(D,R),new Promise(x=>x(D))}function y(C){if(d){const R=Mn(C),D=d.property("__zoom");(D.k!==C.zoom||D.x!==C.x||D.y!==C.y)&&(l==null||l.transform(d,R,null,{sync:!0}))}}function T(){const C=d?li(d.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function k(C,R){return d?new Promise(D=>{l==null||l.interpolate((R==null?void 0:R.interpolate)==="linear"?ft:Ht).scaleTo(In(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function I(C,R){return d?new Promise(D=>{l==null||l.interpolate((R==null?void 0:R.interpolate)==="linear"?ft:Ht).scaleBy(In(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>D(!0)),C)}):Promise.resolve(!1)}function H(C){l==null||l.scaleExtent(C)}function F(C){l==null||l.translateExtent(C)}function j(C){const R=!ye(C)||C<0?0:C;l==null||l.clickDistance(R)}return{update:E,destroy:_,setViewport:p,setViewportConstrained:b,getViewport:T,scaleTo:k,scaleBy:I,setScaleExtent:H,setTranslateExtent:F,syncViewport:y,setClickDistance:j}}var tt;(function(e){e.Line="line",e.Handle="handle"})(tt||(tt={}));function rd({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,c=n-r,a=[s>0?1:s<0?-1:0,c>0?1:c<0?-1:0];return s&&o&&(a[0]=a[0]*-1),c&&i&&(a[1]=a[1]*-1),a}function oo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Te(e,t){return Math.max(0,t-e)}function Ae(e,t){return Math.max(0,e-t)}function Lt(e,t,n){return Math.max(0,t-e,e-n)}function io(e,t){return e?!t:t}function od(e,t,n,r,o,i,s,c){let{affectsX:a,affectsY:u}=t;const{isHorizontal:f,isVertical:l}=t,d=f&&l,{xSnapped:h,ySnapped:g}=n,{minWidth:w,maxWidth:E,minHeight:_,maxHeight:b}=r,{x:p,y,width:T,height:k,aspectRatio:I}=e;let H=Math.floor(f?h-e.pointerX:0),F=Math.floor(l?g-e.pointerY:0);const j=T+(a?-H:H),C=k+(u?-F:F),R=-i[0]*T,D=-i[1]*k;let x=Lt(j,w,E),L=Lt(C,_,b);if(s){let A=0,O=0;a&&H<0?A=Te(p+H+R,s[0][0]):!a&&H>0&&(A=Ae(p+j+R,s[1][0])),u&&F<0?O=Te(y+F+D,s[0][1]):!u&&F>0&&(O=Ae(y+C+D,s[1][1])),x=Math.max(x,A),L=Math.max(L,O)}if(c){let A=0,O=0;a&&H>0?A=Ae(p+H,c[0][0]):!a&&H<0&&(A=Te(p+j,c[1][0])),u&&F>0?O=Ae(y+F,c[0][1]):!u&&F<0&&(O=Te(y+C,c[1][1])),x=Math.max(x,A),L=Math.max(L,O)}if(o){if(f){const A=Lt(j/I,_,b)*I;if(x=Math.max(x,A),s){let O=0;!a&&!u||a&&!u&&d?O=Ae(y+D+j/I,s[1][1])*I:O=Te(y+D+(a?H:-H)/I,s[0][1])*I,x=Math.max(x,O)}if(c){let O=0;!a&&!u||a&&!u&&d?O=Te(y+j/I,c[1][1])*I:O=Ae(y+(a?H:-H)/I,c[0][1])*I,x=Math.max(x,O)}}if(l){const A=Lt(C*I,w,E)/I;if(L=Math.max(L,A),s){let O=0;!a&&!u||u&&!a&&d?O=Ae(p+C*I+R,s[1][0])/I:O=Te(p+(u?F:-F)*I+R,s[0][0])/I,L=Math.max(L,O)}if(c){let O=0;!a&&!u||u&&!a&&d?O=Te(p+C*I,c[1][0])/I:O=Ae(p+(u?F:-F)*I,c[0][0])/I,L=Math.max(L,O)}}}F=F+(F<0?L:-L),H=H+(H<0?x:-x),o&&(d?j>C*I?F=(io(a,u)?-H:H)/I:H=(io(a,u)?-F:F)*I:f?(F=H/I,u=a):(H=F*I,a=u));const N=a?p+H:p,P=u?y+F:y;return{width:T+(a?-H:H),height:k+(u?-F:F),x:i[0]*H*(a?-1:1)+N,y:i[1]*F*(u?-1:1)+P}}const Hi={width:0,height:0,x:0,y:0},id={...Hi,pointerX:0,pointerY:0,aspectRatio:1};function sd(e){return[[0,0],[e.measured.width,e.measured.height]]}function ad(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,c=n[0]*i,a=n[1]*s;return[[r-c,o-a],[r+i-c,o+s-a]]}function cd({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=de(e);let s={controlDirection:oo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:u,boundaries:f,keepAspectRatio:l,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:w,shouldResize:E}){let _={...Hi},b={...id};s={boundaries:f,resizeDirection:d,keepAspectRatio:l,controlDirection:oo(u)};let p,y=null,T=[],k,I,H,F=!1;const j=Ko().on("start",C=>{const{nodeLookup:R,transform:D,snapGrid:x,snapToGrid:L,nodeOrigin:N,paneDomNode:P}=n();if(p=R.get(t),!p)return;y=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:A,ySnapped:O}=dt(C.sourceEvent,{transform:D,snapGrid:x,snapToGrid:L,containerBounds:y});_={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={..._,pointerX:A,pointerY:O,aspectRatio:_.width/_.height},k=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(k=R.get(p.parentId),I=k&&p.extent==="parent"?sd(k):void 0),T=[],H=void 0;for(const[B,m]of R)if(m.parentId===t&&(T.push({id:B,position:{...m.position},extent:m.extent}),m.extent==="parent"||m.expandParent)){const M=ad(m,p,m.origin??N);H?H=[[Math.min(M[0][0],H[0][0]),Math.min(M[0][1],H[0][1])],[Math.max(M[1][0],H[1][0]),Math.max(M[1][1],H[1][1])]]:H=M}h==null||h(C,{..._})}).on("drag",C=>{const{transform:R,snapGrid:D,snapToGrid:x,nodeOrigin:L}=n(),N=dt(C.sourceEvent,{transform:R,snapGrid:D,snapToGrid:x,containerBounds:y}),P=[];if(!p)return;const{x:A,y:O,width:B,height:m}=_,M={},Y=p.origin??L,{width:S,height:v,x:$,y:z}=od(b,s.controlDirection,N,s.boundaries,s.keepAspectRatio,Y,I,H),V=S!==B,X=v!==m,q=$!==A&&V,U=z!==O&&X;if(!q&&!U&&!V&&!X)return;if((q||U||Y[0]===1||Y[1]===1)&&(M.x=q?$:_.x,M.y=U?z:_.y,_.x=M.x,_.y=M.y,T.length>0)){const te=$-A,ne=z-O;for(const ue of T)ue.position={x:ue.position.x-te+Y[0]*(S-B),y:ue.position.y-ne+Y[1]*(v-m)},P.push(ue)}if((V||X)&&(M.width=V&&(!s.resizeDirection||s.resizeDirection==="horizontal")?S:_.width,M.height=X&&(!s.resizeDirection||s.resizeDirection==="vertical")?v:_.height,_.width=M.width,_.height=M.height),k&&p.expandParent){const te=Y[0]*(M.width??0);M.x&&M.x<te&&(_.x=te,b.x=b.x-(M.x-te));const ne=Y[1]*(M.height??0);M.y&&M.y<ne&&(_.y=ne,b.y=b.y-(M.y-ne))}const K=rd({width:_.width,prevWidth:B,height:_.height,prevHeight:m,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),Z={..._,direction:K};(E==null?void 0:E(C,Z))!==!1&&(F=!0,g==null||g(C,Z),r(M,P))}).on("end",C=>{F&&(w==null||w(C,{..._}),o==null||o({..._}),F=!1)});i.call(j)}function a(){i.on(".drag",null)}return{update:c,destroy:a}}var Tn={exports:{}},An={},Pn={exports:{}},On={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* use-sync-external-store-shim.production.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 so;function ud(){if(so)return On;so=1;var e=rn();function t(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function c(l,d){var h=d(),g=r({inst:{value:h,getSnapshot:d}}),w=g[0].inst,E=g[1];return i(function(){w.value=h,w.getSnapshot=d,a(w)&&E({inst:w})},[l,h,d]),o(function(){return a(w)&&E({inst:w}),l(function(){a(w)&&E({inst:w})})},[l]),s(h),h}function a(l){var d=l.getSnapshot;l=l.value;try{var h=d();return!n(l,h)}catch{return!0}}function u(l,d){return d()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:c;return On.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,On}var ao;function ld(){return ao||(ao=1,Pn.exports=ud()),Pn.exports}/**
|
|
34
|
+
* @license React
|
|
35
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var co;function fd(){if(co)return An;co=1;var e=rn(),t=ld();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,c=e.useMemo,a=e.useDebugValue;return An.useSyncExternalStoreWithSelector=function(u,f,l,d,h){var g=i(null);if(g.current===null){var w={hasValue:!1,value:null};g.current=w}else w=g.current;g=c(function(){function _(k){if(!b){if(b=!0,p=k,k=d(k),h!==void 0&&w.hasValue){var I=w.value;if(h(I,k))return y=I}return y=k}if(I=y,r(p,k))return I;var H=d(k);return h!==void 0&&h(I,H)?(p=k,I):(p=k,y=H)}var b=!1,p,y,T=l===void 0?null:l;return[function(){return _(f())},T===null?void 0:function(){return _(T())}]},[f,l,d,h]);var E=o(u,g[0],g[1]);return s(function(){w.hasValue=!0,w.value=E},[E]),a(E),E},An}var uo;function dd(){return uo||(uo=1,Tn.exports=fd()),Tn.exports}var hd=dd();const gd=$o(hd),pd={},lo=e=>{let t;const n=new Set,r=(f,l)=>{const d=typeof f=="function"?f(t):f;if(!Object.is(d,t)){const h=t;t=l??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,h))}},o=()=>t,a={setState:r,getState:o,getInitialState:()=>u,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(pd?"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(r,o,a);return a},md=e=>e?lo(e):lo,{useDebugValue:yd}=ka,{useSyncExternalStoreWithSelector:xd}=gd,vd=e=>e;function Vi(e,t=vd,n){const r=xd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return yd(r),r}const fo=(e,t)=>{const n=md(e),r=(o,i=t)=>Vi(n,o,i);return Object.assign(r,n),r},wd=(e,t)=>e?fo(e,t):fo;function ie(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[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}Ia();const hn=G.createContext(null),_d=hn.Provider,Bi=Ee.error001();function re(e,t){const n=G.useContext(hn);if(n===null)throw new Error(Bi);return Vi(n,e,t)}function se(){const e=G.useContext(hn);if(e===null)throw new Error(Bi);return G.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ho={display:"none"},bd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Fi="react-flow__node-desc",Yi="react-flow__edge-desc",Ed="react-flow__aria-live",Nd=e=>e.ariaLiveMessage,Sd=e=>e.ariaLabelConfig;function Cd({rfId:e}){const t=re(Nd);return W.jsx("div",{id:`${Ed}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:bd,children:t})}function kd({rfId:e,disableKeyboardA11y:t}){const n=re(Sd);return W.jsxs(W.Fragment,{children:[W.jsx("div",{id:`${Fi}-${e}`,style:ho,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),W.jsx("div",{id:`${Yi}-${e}`,style:ho,children:n["edge.a11yDescription.default"]}),!t&&W.jsx(Cd,{rfId:e})]})}const gn=G.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return W.jsx("div",{className:ce(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});gn.displayName="Panel";function Md({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:W.jsx(gn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:W.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Id=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Dt=e=>e.id;function Td(e,t){return ie(e.selectedNodes.map(Dt),t.selectedNodes.map(Dt))&&ie(e.selectedEdges.map(Dt),t.selectedEdges.map(Dt))}function Ad({onSelectionChange:e}){const t=se(),{selectedNodes:n,selectedEdges:r}=re(Id,Td);return G.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const Pd=e=>!!e.onSelectionChangeHandlers;function Od({onSelectionChange:e}){const t=re(Pd);return e||t?W.jsx(Ad,{onSelectionChange:e}):null}const Xi=[0,0],Rd={x:0,y:0,zoom:1},$d=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],go=[...$d,"rfId"],Ld=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),po={translateExtent:yt,nodeOrigin:Xi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Dd(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:c,setDefaultNodesAndEdges:a}=re(Ld,ie),u=se();G.useEffect(()=>(a(e.defaultNodes,e.defaultEdges),()=>{f.current=po,c()}),[]);const f=G.useRef(po);return G.useEffect(()=>{for(const l of go){const d=e[l],h=f.current[l];d!==h&&(typeof e[l]>"u"||(l==="nodes"?t(d):l==="edges"?n(d):l==="minZoom"?r(d):l==="maxZoom"?o(d):l==="translateExtent"?i(d):l==="nodeExtent"?s(d):l==="ariaLabelConfig"?u.setState({ariaLabelConfig:wf(d)}):l==="fitView"?u.setState({fitViewQueued:d}):l==="fitViewOptions"?u.setState({fitViewOptions:d}):u.setState({[l]:d})))}f.current=e},go.map(l=>e[l])),null}function mo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function jd(e){var r;const[t,n]=G.useState(e==="system"?null:e);return G.useEffect(()=>{if(e!=="system"){n(e);return}const o=mo(),i=()=>n(o!=null&&o.matches?"dark":"light");return i(),o==null||o.addEventListener("change",i),()=>{o==null||o.removeEventListener("change",i)}},[e]),t!==null?t:(r=mo())!=null&&r.matches?"dark":"light"}const yo=typeof document<"u"?document:null;function _t(e=null,t={target:yo,actInsideInputWithModifier:!0}){const[n,r]=G.useState(!1),o=G.useRef(!1),i=G.useRef(new Set([])),[s,c]=G.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(l=>typeof l=="string").map(l=>l.replace("+",`
|
|
42
|
+
`).replace(`
|
|
43
|
+
|
|
44
|
+
`,`
|
|
45
|
+
+`).split(`
|
|
46
|
+
`)),f=u.reduce((l,d)=>l.concat(...d),[]);return[u,f]}return[[],[]]},[e]);return G.useEffect(()=>{const a=(t==null?void 0:t.target)??yo,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const f=h=>{var E,_;if(o.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!o.current||o.current&&!u)&&Ni(h))return!1;const w=vo(h.code,c);if(i.current.add(h[w]),xo(s,i.current,!1)){const b=((_=(E=h.composedPath)==null?void 0:E.call(h))==null?void 0:_[0])||h.target,p=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";t.preventDefault!==!1&&(o.current||!p)&&h.preventDefault(),r(!0)}},l=h=>{const g=vo(h.code,c);xo(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),o.current=!1},d=()=>{i.current.clear(),r(!1)};return a==null||a.addEventListener("keydown",f),a==null||a.addEventListener("keyup",l),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{a==null||a.removeEventListener("keydown",f),a==null||a.removeEventListener("keyup",l),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function xo(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function vo(e,t){return t.includes(e)?"code":"key"}const zd=()=>{const e=se();return G.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:s,panZoom:c}=e.getState(),a=ir(t,r,o,i,s,(n==null?void 0:n.padding)??.1);return c?(await c.setViewport(a,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:c,y:a}=s.getBoundingClientRect(),u={x:t.x-c,y:t.y-a},f=n.snapGrid??o,l=n.snapToGrid??i;return kt(u,r,l,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=Jt(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function Wi(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const s=r.get(i.id);s?s.push(i):r.set(i.id,[i])}for(const i of t){const s=r.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const c={...i};for(const a of s)Hd(a,c);n.push(c)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Hd(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Vd(e,t){return Wi(e,t)}function Bd(e,t){return Wi(e,t)}function $e(e,t){return{id:e,type:"select",selected:t}}function We(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const s=t.has(o);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),r.push($e(i.id,s)))}return r}function wo({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,s]of e.entries()){const c=t.get(s.id),a=((o=c==null?void 0:c.internals)==null?void 0:o.userNode)??c;a!==void 0&&a!==s&&n.push({id:s.id,item:s,type:"replace"}),a===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function _o(e){return{id:e.id,type:"remove"}}const bo=e=>lf(e),Fd=e=>mi(e);function Gi(e){return G.forwardRef(e)}const Yd=typeof window<"u"?G.useLayoutEffect:G.useEffect;function Eo(e){const[t,n]=G.useState(BigInt(0)),[r]=G.useState(()=>Xd(()=>n(o=>o+BigInt(1))));return Yd(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Xd(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const qi=G.createContext(null);function Wd({children:e}){const t=se(),n=G.useCallback(c=>{const{nodes:a=[],setNodes:u,hasDefaultNodes:f,onNodesChange:l,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let w=a;for(const _ of c)w=typeof _=="function"?_(w):_;let E=wo({items:w,lookup:d});for(const _ of g.values())E=_(E);f&&u(w),E.length>0?l==null||l(E):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:b,setNodes:p}=t.getState();_&&p(b)})},[]),r=Eo(n),o=G.useCallback(c=>{const{edges:a=[],setEdges:u,hasDefaultEdges:f,onEdgesChange:l,edgeLookup:d}=t.getState();let h=a;for(const g of c)h=typeof g=="function"?g(h):g;f?u(h):l&&l(wo({items:h,lookup:d}))},[]),i=Eo(o),s=G.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return W.jsx(qi.Provider,{value:s,children:e})}function Gd(){const e=G.useContext(qi);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const qd=e=>!!e.panZoom;function dr(){const e=zd(),t=se(),n=Gd(),r=re(qd),o=G.useMemo(()=>{const i=l=>t.getState().nodeLookup.get(l),s=l=>{n.nodeQueue.push(l)},c=l=>{n.edgeQueue.push(l)},a=l=>{var _,b;const{nodeLookup:d,nodeOrigin:h}=t.getState(),g=bo(l)?l:d.get(l.id),w=g.parentId?bi(g.position,g.measured,g.parentId,d,h):g.position,E={...g,position:w,width:((_=g.measured)==null?void 0:_.width)??g.width,height:((b=g.measured)==null?void 0:b.height)??g.height};return Je(E)},u=(l,d,h={replace:!1})=>{s(g=>g.map(w=>{if(w.id===l){const E=typeof d=="function"?d(w):d;return h.replace&&bo(E)?E:{...w,...E}}return w}))},f=(l,d,h={replace:!1})=>{c(g=>g.map(w=>{if(w.id===l){const E=typeof d=="function"?d(w):d;return h.replace&&Fd(E)?E:{...w,...E}}return w}))};return{getNodes:()=>t.getState().nodes.map(l=>({...l})),getNode:l=>{var d;return(d=i(l))==null?void 0:d.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:l=[]}=t.getState();return l.map(d=>({...d}))},getEdge:l=>t.getState().edgeLookup.get(l),setNodes:s,setEdges:c,addNodes:l=>{const d=Array.isArray(l)?l:[l];n.nodeQueue.push(h=>[...h,...d])},addEdges:l=>{const d=Array.isArray(l)?l:[l];n.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:l=[],edges:d=[],transform:h}=t.getState(),[g,w,E]=h;return{nodes:l.map(_=>({..._})),edges:d.map(_=>({..._})),viewport:{x:g,y:w,zoom:E}}},deleteElements:async({nodes:l=[],edges:d=[]})=>{const{nodes:h,edges:g,onNodesDelete:w,onEdgesDelete:E,triggerNodeChanges:_,triggerEdgeChanges:b,onDelete:p,onBeforeDelete:y}=t.getState(),{nodes:T,edges:k}=await pf({nodesToRemove:l,edgesToRemove:d,nodes:h,edges:g,onBeforeDelete:y}),I=k.length>0,H=T.length>0;if(I){const F=k.map(_o);E==null||E(k),b(F)}if(H){const F=T.map(_o);w==null||w(T),_(F)}return(H||I)&&(p==null||p({nodes:T,edges:k})),{deletedNodes:T,deletedEdges:k}},getIntersectingNodes:(l,d=!0,h)=>{const g=Gr(l),w=g?l:a(l),E=h!==void 0;return w?(h||t.getState().nodes).filter(_=>{const b=t.getState().nodeLookup.get(_.id);if(b&&!g&&(_.id===l.id||!b.internals.positionAbsolute))return!1;const p=Je(E?_:b),y=vt(p,w);return d&&y>0||y>=p.width*p.height||y>=w.width*w.height}):[]},isNodeIntersecting:(l,d,h=!0)=>{const w=Gr(l)?l:a(l);if(!w)return!1;const E=vt(w,d);return h&&E>0||E>=d.width*d.height||E>=w.width*w.height},updateNode:u,updateNodeData:(l,d,h={replace:!1})=>{u(l,g=>{const w=typeof d=="function"?d(g):d;return h.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},h)},updateEdge:f,updateEdgeData:(l,d,h={replace:!1})=>{f(l,g=>{const w=typeof d=="function"?d(g):d;return h.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},h)},getNodesBounds:l=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return ff(l,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:l,id:d,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${l}${d?`-${d}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:l,handleId:d,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${l?d?`-${l}-${d}`:`-${l}`:""}`))==null?void 0:g.values())??[])},fitView:async l=>{const d=t.getState().fitViewResolver??vf();return t.setState({fitViewQueued:!0,fitViewOptions:l,fitViewResolver:d}),n.nodeQueue.push(h=>[...h]),d.promise}}},[]);return G.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const No=e=>e.selected,Ud=typeof window<"u"?window:void 0;function Kd({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=se(),{deleteElements:r}=dr(),o=_t(e,{actInsideInputWithModifier:!1}),i=_t(t,{target:Ud});G.useEffect(()=>{if(o){const{edges:s,nodes:c}=n.getState();r({nodes:c.filter(No),edges:s.filter(No)}),n.setState({nodesSelectionActive:!1})}},[o]),G.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Zd(e){const t=se();G.useEffect(()=>{const n=()=>{var o,i,s,c;if(!e.current||!(((i=(o=e.current).checkVisibility)==null?void 0:i.call(o))??!0))return!1;const r=sr(e.current);(r.height===0||r.width===0)&&((c=(s=t.getState()).onError)==null||c.call(s,"004",Ee.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const pn={position:"absolute",width:"100%",height:"100%",top:0,left:0},Qd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Jd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=je.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:a,translateExtent:u,minZoom:f,maxZoom:l,zoomActivationKeyCode:d,preventScrolling:h=!0,children:g,noWheelClassName:w,noPanClassName:E,onViewportChange:_,isControlledViewport:b,paneClickDistance:p,selectionOnDrag:y}){const T=se(),k=G.useRef(null),{userSelectionActive:I,lib:H,connectionInProgress:F}=re(Qd,ie),j=_t(d),C=G.useRef();Zd(k);const R=G.useCallback(D=>{_==null||_({x:D[0],y:D[1],zoom:D[2]}),b||T.setState({transform:D})},[_,b]);return G.useEffect(()=>{if(k.current){C.current=nd({domNode:k.current,minZoom:f,maxZoom:l,translateExtent:u,viewport:a,onDraggingChange:N=>T.setState(P=>P.paneDragging===N?P:{paneDragging:N}),onPanZoomStart:(N,P)=>{const{onViewportChangeStart:A,onMoveStart:O}=T.getState();O==null||O(N,P),A==null||A(P)},onPanZoom:(N,P)=>{const{onViewportChange:A,onMove:O}=T.getState();O==null||O(N,P),A==null||A(P)},onPanZoomEnd:(N,P)=>{const{onViewportChangeEnd:A,onMoveEnd:O}=T.getState();O==null||O(N,P),A==null||A(P)}});const{x:D,y:x,zoom:L}=C.current.getViewport();return T.setState({panZoom:C.current,transform:[D,x,L],domNode:k.current.closest(".react-flow")}),()=>{var N;(N=C.current)==null||N.destroy()}}},[]),G.useEffect(()=>{var D;(D=C.current)==null||D.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:j,preventScrolling:h,noPanClassName:E,userSelectionActive:I,noWheelClassName:w,lib:H,onTransformChange:R,connectionInProgress:F,selectionOnDrag:y,paneClickDistance:p})},[e,t,n,r,o,i,s,c,j,h,E,I,w,H,R,F,y,p]),W.jsx("div",{className:"react-flow__renderer",ref:k,style:pn,children:g})}const eh=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function th(){const{userSelectionActive:e,userSelectionRect:t}=re(eh,ie);return e&&t?W.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Rn=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},nh=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function rh({isSelecting:e,selectionKeyPressed:t,selectionMode:n=xt.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:c,onPaneClick:a,onPaneContextMenu:u,onPaneScroll:f,onPaneMouseEnter:l,onPaneMouseMove:d,onPaneMouseLeave:h,children:g}){const w=se(),{userSelectionActive:E,elementsSelectable:_,dragging:b,connectionInProgress:p}=re(nh,ie),y=_&&(e||E),T=G.useRef(null),k=G.useRef(),I=G.useRef(new Set),H=G.useRef(new Set),F=G.useRef(!1),j=A=>{if(F.current||p){F.current=!1;return}a==null||a(A),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},C=A=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){A.preventDefault();return}u==null||u(A)},R=f?A=>f(A):void 0,D=A=>{F.current&&(A.stopPropagation(),F.current=!1)},x=A=>{var v,$;const{domNode:O}=w.getState();if(k.current=O==null?void 0:O.getBoundingClientRect(),!k.current)return;const B=A.target===T.current;if(!B&&!!A.target.closest(".nokey")||!e||!(i&&B||t)||A.button!==0||!A.isPrimary)return;($=(v=A.target)==null?void 0:v.setPointerCapture)==null||$.call(v,A.pointerId),F.current=!1;const{x:Y,y:S}=xe(A.nativeEvent,k.current);w.setState({userSelectionRect:{width:0,height:0,startX:Y,startY:S,x:Y,y:S}}),B||(A.stopPropagation(),A.preventDefault())},L=A=>{const{userSelectionRect:O,transform:B,nodeLookup:m,edgeLookup:M,connectionLookup:Y,triggerNodeChanges:S,triggerEdgeChanges:v,defaultEdgeOptions:$,resetSelectedElements:z}=w.getState();if(!k.current||!O)return;const{x:V,y:X}=xe(A.nativeEvent,k.current),{startX:q,startY:U}=O;if(!F.current){const ne=t?0:o;if(Math.hypot(V-q,X-U)<=ne)return;z(),s==null||s(A)}F.current=!0;const K={startX:q,startY:U,x:V<q?V:q,y:X<U?X:U,width:Math.abs(V-q),height:Math.abs(X-U)},Z=I.current,J=H.current;I.current=new Set(or(m,K,B,n===xt.Partial,!0).map(ne=>ne.id)),H.current=new Set;const te=($==null?void 0:$.selectable)??!0;for(const ne of I.current){const ue=Y.get(ne);if(ue)for(const{edgeId:ge}of ue.values()){const Se=M.get(ge);Se&&(Se.selectable??te)&&H.current.add(ge)}}if(!qr(Z,I.current)){const ne=We(m,I.current,!0);S(ne)}if(!qr(J,H.current)){const ne=We(M,H.current);v(ne)}w.setState({userSelectionRect:K,userSelectionActive:!0,nodesSelectionActive:!1})},N=A=>{var O,B;A.button===0&&((B=(O=A.target)==null?void 0:O.releasePointerCapture)==null||B.call(O,A.pointerId),!E&&A.target===T.current&&w.getState().userSelectionRect&&(j==null||j(A)),w.setState({userSelectionActive:!1,userSelectionRect:null}),F.current&&(c==null||c(A),w.setState({nodesSelectionActive:I.current.size>0})))},P=r===!0||Array.isArray(r)&&r.includes(0);return W.jsxs("div",{className:ce(["react-flow__pane",{draggable:P,dragging:b,selection:e}]),onClick:y?void 0:Rn(j,T),onContextMenu:Rn(C,T),onWheel:Rn(R,T),onPointerEnter:y?void 0:l,onPointerMove:y?L:d,onPointerUp:y?N:void 0,onPointerDownCapture:y?x:void 0,onClickCapture:y?D:void 0,onPointerLeave:h,ref:T,style:pn,children:[g,W.jsx(th,{})]})}function Un({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:c,onError:a}=t.getState(),u=c.get(e);if(!u){a==null||a("012",Ee.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&s)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var f;return(f=r==null?void 0:r.current)==null?void 0:f.blur()})):o([e])}function Ui({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const c=se(),[a,u]=G.useState(!1),f=G.useRef();return G.useEffect(()=>{f.current=Bf({getStoreItems:()=>c.getState(),onNodeMouseDown:l=>{Un({id:l,store:c,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),G.useEffect(()=>{if(!(t||!e.current||!f.current))return f.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s}),()=>{var l;(l=f.current)==null||l.destroy()}},[n,r,t,i,e,o,s]),a}const oh=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Ki(){const e=se();return G.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:c,updateNodePositions:a,nodeLookup:u,nodeOrigin:f}=e.getState(),l=new Map,d=oh(s),h=o?i[0]:5,g=o?i[1]:5,w=n.direction.x*h*n.factor,E=n.direction.y*g*n.factor;for(const[,_]of u){if(!d(_))continue;let b={x:_.internals.positionAbsolute.x+w,y:_.internals.positionAbsolute.y+E};o&&(b=Ct(b,i));const{position:p,positionAbsolute:y}=yi({nodeId:_.id,nextPosition:b,nodeLookup:u,nodeExtent:r,nodeOrigin:f,onError:c});_.position=p,_.internals.positionAbsolute=y,l.set(_.id,_)}a(l)},[])}const hr=G.createContext(null),ih=hr.Provider;hr.Consumer;const Zi=()=>G.useContext(hr),sh=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ah=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:c,toHandle:a,isValid:u}=s,f=(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n;return{connectingFrom:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n,connectingTo:f,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===Ze.Strict?(c==null?void 0:c.type)!==n:e!==(c==null?void 0:c.nodeId)||t!==(c==null?void 0:c.id),connectionInProcess:!!c,clickConnectionInProcess:!!o,valid:f&&u}};function ch({type:e="source",position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:c,children:a,className:u,onMouseDown:f,onTouchStart:l,...d},h){var L,N;const g=s||null,w=e==="target",E=se(),_=Zi(),{connectOnClick:b,noPanClassName:p,rfId:y}=re(sh,ie),{connectingFrom:T,connectingTo:k,clickConnecting:I,isPossibleEndHandle:H,connectionInProcess:F,clickConnectionInProcess:j,valid:C}=re(ah(_,g,e),ie);_||(N=(L=E.getState()).onError)==null||N.call(L,"010",Ee.error010());const R=P=>{const{defaultEdgeOptions:A,onConnect:O,hasDefaultEdges:B}=E.getState(),m={...A,...P};if(B){const{edges:M,setEdges:Y}=E.getState();Y(Cf(m,M))}O==null||O(m),c==null||c(m)},D=P=>{if(!_)return;const A=Si(P.nativeEvent);if(o&&(A&&P.button===0||!A)){const O=E.getState();qn.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:O.autoPanOnConnect,connectionMode:O.connectionMode,connectionRadius:O.connectionRadius,domNode:O.domNode,nodeLookup:O.nodeLookup,lib:O.lib,isTarget:w,handleId:g,nodeId:_,flowId:O.rfId,panBy:O.panBy,cancelConnection:O.cancelConnection,onConnectStart:O.onConnectStart,onConnectEnd:(...B)=>{var m,M;return(M=(m=E.getState()).onConnectEnd)==null?void 0:M.call(m,...B)},updateConnection:O.updateConnection,onConnect:R,isValidConnection:n||((...B)=>{var m,M;return((M=(m=E.getState()).isValidConnection)==null?void 0:M.call(m,...B))??!0}),getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:O.autoPanSpeed,dragThreshold:O.connectionDragThreshold})}A?f==null||f(P):l==null||l(P)},x=P=>{const{onClickConnectStart:A,onClickConnectEnd:O,connectionClickStartHandle:B,connectionMode:m,isValidConnection:M,lib:Y,rfId:S,nodeLookup:v,connection:$}=E.getState();if(!_||!B&&!o)return;if(!B){A==null||A(P.nativeEvent,{nodeId:_,handleId:g,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:_,type:e,id:g}});return}const z=Ei(P.target),V=n||M,{connection:X,isValid:q}=qn.isValid(P.nativeEvent,{handle:{nodeId:_,id:g,type:e},connectionMode:m,fromNodeId:B.nodeId,fromHandleId:B.id||null,fromType:B.type,isValidConnection:V,flowId:S,doc:z,lib:Y,nodeLookup:v});q&&X&&R(X);const U=structuredClone($);delete U.inProgress,U.toPosition=U.toHandle?U.toHandle.position:null,O==null||O(P,U),E.setState({connectionClickStartHandle:null})};return W.jsx("div",{"data-handleid":g,"data-nodeid":_,"data-handlepos":t,"data-id":`${y}-${_}-${g}-${e}`,className:ce(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,u,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:i,clickconnecting:I,connectingfrom:T,connectingto:k,valid:C,connectionindicator:r&&(!F||H)&&(F||j?i:o)}]),onMouseDown:D,onTouchStart:D,onClick:b?x:void 0,ref:h,...d,children:a})}const en=G.memo(Gi(ch));function uh({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return W.jsxs(W.Fragment,{children:[e==null?void 0:e.label,W.jsx(en,{type:"source",position:n,isConnectable:t})]})}function lh({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return W.jsxs(W.Fragment,{children:[W.jsx(en,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,W.jsx(en,{type:"source",position:r,isConnectable:t})]})}function fh(){return null}function dh({data:e,isConnectable:t,targetPosition:n=Q.Top}){return W.jsxs(W.Fragment,{children:[W.jsx(en,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const tn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},So={input:uh,default:lh,output:dh,group:fh};function hh(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const gh=e=>{const{width:t,height:n,x:r,y:o}=St(e.nodeLookup,{filter:i=>!!i.selected});return{width:ye(t)?t:null,height:ye(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function ph({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=se(),{width:o,height:i,transformString:s,userSelectionActive:c}=re(gh,ie),a=Ki(),u=G.useRef(null);G.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const f=!c&&o!==null&&i!==null;if(Ui({nodeRef:u,disabled:!f}),!f)return null;const l=e?h=>{const g=r.getState().nodes.filter(w=>w.selected);e(h,g)}:void 0,d=h=>{Object.prototype.hasOwnProperty.call(tn,h.key)&&(h.preventDefault(),a({direction:tn[h.key],factor:h.shiftKey?4:1}))};return W.jsx("div",{className:ce(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:W.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:l,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:o,height:i}})})}const Co=typeof window<"u"?window:void 0,mh=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Qi({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:c,deleteKeyCode:a,selectionKeyCode:u,selectionOnDrag:f,selectionMode:l,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:w,zoomActivationKeyCode:E,elementsSelectable:_,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:y,panOnScrollSpeed:T,panOnScrollMode:k,zoomOnDoubleClick:I,panOnDrag:H,defaultViewport:F,translateExtent:j,minZoom:C,maxZoom:R,preventScrolling:D,onSelectionContextMenu:x,noWheelClassName:L,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:A,isControlledViewport:O}){const{nodesSelectionActive:B,userSelectionActive:m}=re(mh,ie),M=_t(u,{target:Co}),Y=_t(w,{target:Co}),S=Y||H,v=Y||y,$=f&&S!==!0,z=M||m||$;return Kd({deleteKeyCode:a,multiSelectionKeyCode:g}),W.jsx(Jd,{onPaneContextMenu:i,elementsSelectable:_,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:v,panOnScrollSpeed:T,panOnScrollMode:k,zoomOnDoubleClick:I,panOnDrag:!M&&S,defaultViewport:F,translateExtent:j,minZoom:C,maxZoom:R,zoomActivationKeyCode:E,preventScrolling:D,noWheelClassName:L,noPanClassName:N,onViewportChange:A,isControlledViewport:O,paneClickDistance:c,selectionOnDrag:$,children:W.jsxs(rh,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:S,isSelecting:!!z,selectionMode:l,selectionKeyPressed:M,paneClickDistance:c,selectionOnDrag:$,children:[e,B&&W.jsx(ph,{onSelectionContextMenu:x,noPanClassName:N,disableKeyboardA11y:P})]})})}Qi.displayName="FlowRenderer";const yh=G.memo(Qi),xh=e=>t=>e?or(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function vh(e){return re(G.useCallback(xh(e),[e]),ie)}const wh=e=>e.updateNodeInternals;function _h(){const e=re(wh),[t]=G.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return G.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function bh({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=se(),i=G.useRef(null),s=G.useRef(null),c=G.useRef(e.sourcePosition),a=G.useRef(e.targetPosition),u=G.useRef(t),f=n&&!!e.internals.handleBounds;return G.useEffect(()=>{i.current&&!e.hidden&&(!f||s.current!==i.current)&&(s.current&&(r==null||r.unobserve(s.current)),r==null||r.observe(i.current),s.current=i.current)},[f,e.hidden]),G.useEffect(()=>()=>{s.current&&(r==null||r.unobserve(s.current),s.current=null)},[]),G.useEffect(()=>{if(i.current){const l=u.current!==t,d=c.current!==e.sourcePosition,h=a.current!==e.targetPosition;(l||d||h)&&(u.current=t,c.current=e.sourcePosition,a.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Eh({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:c,elementsSelectable:a,nodesConnectable:u,nodesFocusable:f,resizeObserver:l,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:g,rfId:w,nodeTypes:E,nodeClickDistance:_,onError:b}){const{node:p,internals:y,isParent:T}=re(V=>{const X=V.nodeLookup.get(e),q=V.parentLookup.has(e);return{node:X,internals:X.internals,isParent:q}},ie);let k=p.type||"default",I=(E==null?void 0:E[k])||So[k];I===void 0&&(b==null||b("003",Ee.error003(k)),k="default",I=(E==null?void 0:E.default)||So.default);const H=!!(p.draggable||c&&typeof p.draggable>"u"),F=!!(p.selectable||a&&typeof p.selectable>"u"),j=!!(p.connectable||u&&typeof p.connectable>"u"),C=!!(p.focusable||f&&typeof p.focusable>"u"),R=se(),D=_i(p),x=bh({node:p,nodeType:k,hasDimensions:D,resizeObserver:l}),L=Ui({nodeRef:x,disabled:p.hidden||!H,noDragClassName:d,handleSelector:p.dragHandle,nodeId:e,isSelectable:F,nodeClickDistance:_}),N=Ki();if(p.hidden)return null;const P=Ie(p),A=hh(p),O=F||H||t||n||r||o,B=n?V=>n(V,{...y.userNode}):void 0,m=r?V=>r(V,{...y.userNode}):void 0,M=o?V=>o(V,{...y.userNode}):void 0,Y=i?V=>i(V,{...y.userNode}):void 0,S=s?V=>s(V,{...y.userNode}):void 0,v=V=>{const{selectNodesOnDrag:X,nodeDragThreshold:q}=R.getState();F&&(!X||!H||q>0)&&Un({id:e,store:R,nodeRef:x}),t&&t(V,{...y.userNode})},$=V=>{if(!(Ni(V.nativeEvent)||g)){if(di.includes(V.key)&&F){const X=V.key==="Escape";Un({id:e,store:R,unselect:X,nodeRef:x})}else if(H&&p.selected&&Object.prototype.hasOwnProperty.call(tn,V.key)){V.preventDefault();const{ariaLabelConfig:X}=R.getState();R.setState({ariaLiveMessage:X["node.a11yDescription.ariaLiveMessage"]({direction:V.key.replace("Arrow","").toLowerCase(),x:~~y.positionAbsolute.x,y:~~y.positionAbsolute.y})}),N({direction:tn[V.key],factor:V.shiftKey?4:1})}}},z=()=>{var J;if(g||!((J=x.current)!=null&&J.matches(":focus-visible")))return;const{transform:V,width:X,height:q,autoPanOnNodeFocus:U,setCenter:K}=R.getState();if(!U)return;or(new Map([[e,p]]),{x:0,y:0,width:X,height:q},V,!0).length>0||K(p.position.x+P.width/2,p.position.y+P.height/2,{zoom:V[2]})};return W.jsx("div",{className:ce(["react-flow__node",`react-flow__node-${k}`,{[h]:H},p.className,{selected:p.selected,selectable:F,parent:T,draggable:H,dragging:L}]),ref:x,style:{zIndex:y.z,transform:`translate(${y.positionAbsolute.x}px,${y.positionAbsolute.y}px)`,pointerEvents:O?"all":"none",visibility:D?"visible":"hidden",...p.style,...A},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:m,onMouseLeave:M,onContextMenu:Y,onClick:v,onDoubleClick:S,onKeyDown:C?$:void 0,tabIndex:C?0:void 0,onFocus:C?z:void 0,role:p.ariaRole??(C?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Fi}-${w}`,"aria-label":p.ariaLabel,...p.domAttributes,children:W.jsx(ih,{value:e,children:W.jsx(I,{id:e,data:p.data,type:k,positionAbsoluteX:y.positionAbsolute.x,positionAbsoluteY:y.positionAbsolute.y,selected:p.selected??!1,selectable:F,draggable:H,deletable:p.deletable??!0,isConnectable:j,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:L,dragHandle:p.dragHandle,zIndex:y.z,parentId:p.parentId,...P})})})}var Nh=G.memo(Eh);const Sh=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ji(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=re(Sh,ie),s=vh(e.onlyRenderVisibleElements),c=_h();return W.jsx("div",{className:"react-flow__nodes",style:pn,children:s.map(a=>W.jsx(Nh,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:c,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}Ji.displayName="NodeRenderer";const Ch=G.memo(Ji);function kh(e){return re(G.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),s=n.nodeLookup.get(o.target);i&&s&&Ef({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),ie)}const Mh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return W.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Ih=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return W.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},ko={[Zt.Arrow]:Mh,[Zt.ArrowClosed]:Ih};function Th(e){const t=se();return G.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(ko,e)?ko[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",Ee.error009(e)),null)},[e])}const Ah=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:c="auto-start-reverse"})=>{const a=Th(t);return a?W.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:c,refX:"0",refY:"0",children:W.jsx(a,{color:n,strokeWidth:s})}):null},es=({defaultColor:e,rfId:t})=>{const n=re(i=>i.edges),r=re(i=>i.defaultEdgeOptions),o=G.useMemo(()=>Af(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?W.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:W.jsx("defs",{children:o.map(i=>W.jsx(Ah,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};es.displayName="MarkerDefinitions";var Ph=G.memo(es);function ts({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:c=2,children:a,className:u,...f}){const[l,d]=G.useState({x:1,y:0,width:0,height:0}),h=ce(["react-flow__edge-textwrapper",u]),g=G.useRef(null);return G.useEffect(()=>{if(g.current){const w=g.current.getBBox();d({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?W.jsxs("g",{transform:`translate(${e-l.width/2} ${t-l.height/2})`,className:h,visibility:l.width?"visible":"hidden",...f,children:[o&&W.jsx("rect",{width:l.width+2*s[0],x:-s[0],y:-s[1],height:l.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:c,ry:c}),W.jsx("text",{className:"react-flow__edge-text",y:l.height/2,dy:"0.3em",ref:g,style:r,children:n}),a]}):null}ts.displayName="EdgeText";const Oh=G.memo(ts);function mn({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:a,interactionWidth:u=20,...f}){return W.jsxs(W.Fragment,{children:[W.jsx("path",{...f,d:e,fill:"none",className:ce(["react-flow__edge-path",f.className])}),u?W.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&ye(t)&&ye(n)?W.jsx(Oh,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:a}):null]})}function Mo({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function ns({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:o,targetPosition:i=Q.Top}){const[s,c]=Mo({pos:n,x1:e,y1:t,x2:r,y2:o}),[a,u]=Mo({pos:i,x1:r,y1:o,x2:e,y2:t}),[f,l,d,h]=Ci({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:c,targetControlX:a,targetControlY:u});return[`M${e},${t} C${s},${c} ${a},${u} ${r},${o}`,f,l,d,h]}function rs(e){return G.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:c,label:a,labelStyle:u,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:E,interactionWidth:_})=>{const[b,p,y]=ns({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:c}),T=e.isInternal?void 0:t;return W.jsx(mn,{id:T,path:b,labelX:p,labelY:y,label:a,labelStyle:u,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:E,interactionWidth:_})})}const Rh=rs({isInternal:!1}),os=rs({isInternal:!0});Rh.displayName="SimpleBezierEdge";os.displayName="SimpleBezierEdgeInternal";function is(e){return G.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:l,style:d,sourcePosition:h=Q.Bottom,targetPosition:g=Q.Top,markerEnd:w,markerStart:E,pathOptions:_,interactionWidth:b})=>{const[p,y,T]=Xn({sourceX:n,sourceY:r,sourcePosition:h,targetX:o,targetY:i,targetPosition:g,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset,stepPosition:_==null?void 0:_.stepPosition}),k=e.isInternal?void 0:t;return W.jsx(mn,{id:k,path:p,labelX:y,labelY:T,label:s,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:l,style:d,markerEnd:w,markerStart:E,interactionWidth:b})})}const ss=is({isInternal:!1}),as=is({isInternal:!0});ss.displayName="SmoothStepEdge";as.displayName="SmoothStepEdgeInternal";function cs(e){return G.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return W.jsx(ss,{...n,id:r,pathOptions:G.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const $h=cs({isInternal:!1}),us=cs({isInternal:!0});$h.displayName="StepEdge";us.displayName="StepEdgeInternal";function ls(e){return G.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:l,style:d,markerEnd:h,markerStart:g,interactionWidth:w})=>{const[E,_,b]=Ii({sourceX:n,sourceY:r,targetX:o,targetY:i}),p=e.isInternal?void 0:t;return W.jsx(mn,{id:p,path:E,labelX:_,labelY:b,label:s,labelStyle:c,labelShowBg:a,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:l,style:d,markerEnd:h,markerStart:g,interactionWidth:w})})}const Lh=ls({isInternal:!1}),fs=ls({isInternal:!0});Lh.displayName="StraightEdge";fs.displayName="StraightEdgeInternal";function ds(e){return G.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=Q.Bottom,targetPosition:c=Q.Top,label:a,labelStyle:u,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:E,pathOptions:_,interactionWidth:b})=>{const[p,y,T]=ki({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:c,curvature:_==null?void 0:_.curvature}),k=e.isInternal?void 0:t;return W.jsx(mn,{id:k,path:p,labelX:y,labelY:T,label:a,labelStyle:u,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:E,interactionWidth:b})})}const Dh=ds({isInternal:!1}),hs=ds({isInternal:!0});Dh.displayName="BezierEdge";hs.displayName="BezierEdgeInternal";const Io={default:hs,straight:fs,step:us,smoothstep:as,simplebezier:os},To={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},jh=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,zh=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,Ao="react-flow__edgeupdater";function Po({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:c}){return W.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:ce([Ao,`${Ao}-${c}`]),cx:jh(t,r,e),cy:zh(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Hh({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:c,targetPosition:a,onReconnect:u,onReconnectStart:f,onReconnectEnd:l,setReconnecting:d,setUpdateHover:h}){const g=se(),w=(y,T)=>{if(y.button!==0)return;const{autoPanOnConnect:k,domNode:I,connectionMode:H,connectionRadius:F,lib:j,onConnectStart:C,cancelConnection:R,nodeLookup:D,rfId:x,panBy:L,updateConnection:N}=g.getState(),P=T.type==="target",A=(m,M)=>{d(!1),l==null||l(m,n,T.type,M)},O=m=>u==null?void 0:u(n,m),B=(m,M)=>{d(!0),f==null||f(y,n,T.type),C==null||C(m,M)};qn.onPointerDown(y.nativeEvent,{autoPanOnConnect:k,connectionMode:H,connectionRadius:F,domNode:I,handleId:T.id,nodeId:T.nodeId,nodeLookup:D,isTarget:P,edgeUpdaterType:T.type,lib:j,flowId:x,cancelConnection:R,panBy:L,isValidConnection:(...m)=>{var M,Y;return((Y=(M=g.getState()).isValidConnection)==null?void 0:Y.call(M,...m))??!0},onConnect:O,onConnectStart:B,onConnectEnd:(...m)=>{var M,Y;return(Y=(M=g.getState()).onConnectEnd)==null?void 0:Y.call(M,...m)},onReconnectEnd:A,updateConnection:N,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:y.currentTarget})},E=y=>w(y,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),_=y=>w(y,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),p=()=>h(!1);return W.jsxs(W.Fragment,{children:[(e===!0||e==="source")&&W.jsx(Po,{position:c,centerX:r,centerY:o,radius:t,onMouseDown:E,onMouseEnter:b,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&W.jsx(Po,{position:a,centerX:i,centerY:s,radius:t,onMouseDown:_,onMouseEnter:b,onMouseOut:p,type:"target"})]})}function Vh({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:c,onMouseMove:a,onMouseLeave:u,reconnectRadius:f,onReconnect:l,onReconnectStart:d,onReconnectEnd:h,rfId:g,edgeTypes:w,noPanClassName:E,onError:_,disableKeyboardA11y:b}){let p=re(K=>K.edgeLookup.get(e));const y=re(K=>K.defaultEdgeOptions);p=y?{...y,...p}:p;let T=p.type||"default",k=(w==null?void 0:w[T])||Io[T];k===void 0&&(_==null||_("011",Ee.error011(T)),T="default",k=(w==null?void 0:w.default)||Io.default);const I=!!(p.focusable||t&&typeof p.focusable>"u"),H=typeof l<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),F=!!(p.selectable||r&&typeof p.selectable>"u"),j=G.useRef(null),[C,R]=G.useState(!1),[D,x]=G.useState(!1),L=se(),{zIndex:N,sourceX:P,sourceY:A,targetX:O,targetY:B,sourcePosition:m,targetPosition:M}=re(G.useCallback(K=>{const Z=K.nodeLookup.get(p.source),J=K.nodeLookup.get(p.target);if(!Z||!J)return{zIndex:p.zIndex,...To};const te=Tf({id:e,sourceNode:Z,targetNode:J,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:K.connectionMode,onError:_});return{zIndex:bf({selected:p.selected,zIndex:p.zIndex,sourceNode:Z,targetNode:J,elevateOnSelect:K.elevateEdgesOnSelect,zIndexMode:K.zIndexMode}),...te||To}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),ie),Y=G.useMemo(()=>p.markerStart?`url('#${Wn(p.markerStart,g)}')`:void 0,[p.markerStart,g]),S=G.useMemo(()=>p.markerEnd?`url('#${Wn(p.markerEnd,g)}')`:void 0,[p.markerEnd,g]);if(p.hidden||P===null||A===null||O===null||B===null)return null;const v=K=>{var ne;const{addSelectedEdges:Z,unselectNodesAndEdges:J,multiSelectionActive:te}=L.getState();F&&(L.setState({nodesSelectionActive:!1}),p.selected&&te?(J({nodes:[],edges:[p]}),(ne=j.current)==null||ne.blur()):Z([e])),o&&o(K,p)},$=i?K=>{i(K,{...p})}:void 0,z=s?K=>{s(K,{...p})}:void 0,V=c?K=>{c(K,{...p})}:void 0,X=a?K=>{a(K,{...p})}:void 0,q=u?K=>{u(K,{...p})}:void 0,U=K=>{var Z;if(!b&&di.includes(K.key)&&F){const{unselectNodesAndEdges:J,addSelectedEdges:te}=L.getState();K.key==="Escape"?((Z=j.current)==null||Z.blur(),J({edges:[p]})):te([e])}};return W.jsx("svg",{style:{zIndex:N},children:W.jsxs("g",{className:ce(["react-flow__edge",`react-flow__edge-${T}`,p.className,E,{selected:p.selected,animated:p.animated,inactive:!F&&!o,updating:C,selectable:F}]),onClick:v,onDoubleClick:$,onContextMenu:z,onMouseEnter:V,onMouseMove:X,onMouseLeave:q,onKeyDown:I?U:void 0,tabIndex:I?0:void 0,role:p.ariaRole??(I?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":I?`${Yi}-${g}`:void 0,ref:j,...p.domAttributes,children:[!D&&W.jsx(k,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:F,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:P,sourceY:A,targetX:O,targetY:B,sourcePosition:m,targetPosition:M,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:Y,markerEnd:S,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),H&&W.jsx(Hh,{edge:p,isReconnectable:H,reconnectRadius:f,onReconnect:l,onReconnectStart:d,onReconnectEnd:h,sourceX:P,sourceY:A,targetX:O,targetY:B,sourcePosition:m,targetPosition:M,setUpdateHover:R,setReconnecting:x})]})})}var Bh=G.memo(Vh);const Fh=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function gs({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:c,onEdgeMouseMove:a,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:l,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:w}){const{edgesFocusable:E,edgesReconnectable:_,elementsSelectable:b,onError:p}=re(Fh,ie),y=kh(t);return W.jsxs("div",{className:"react-flow__edges",children:[W.jsx(Ph,{defaultColor:e,rfId:n}),y.map(T=>W.jsx(Bh,{id:T,edgesFocusable:E,edgesReconnectable:_,elementsSelectable:b,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:c,onMouseMove:a,onMouseLeave:u,onClick:f,reconnectRadius:l,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:p,edgeTypes:r,disableKeyboardA11y:w},T))]})}gs.displayName="EdgeRenderer";const Yh=G.memo(gs),Xh=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Wh({children:e}){const t=re(Xh);return W.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Gh(e){const t=dr(),n=G.useRef(!1);G.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const qh=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Uh(e){const t=re(qh),n=se();return G.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Kh(e){return e.connection.inProgress?{...e.connection,to:kt(e.connection.to,e.transform)}:{...e.connection}}function Zh(e){return Kh}function Qh(e){const t=Zh();return re(t,ie)}const Jh=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function eg({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:c,inProgress:a}=re(Jh,ie);return!(i&&o&&a)?null:W.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:W.jsx("g",{className:ce(["react-flow__connection",pi(c)]),children:W.jsx(ps,{style:t,type:n,CustomComponent:r,isValid:c})})})}const ps=({style:e,type:t=Pe.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:c,fromPosition:a,to:u,toNode:f,toHandle:l,toPosition:d,pointer:h}=Qh();if(!o)return;if(n)return W.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:c,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:a,toPosition:d,connectionStatus:pi(r),toNode:f,toHandle:l,pointer:h});let g="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:a,targetX:u.x,targetY:u.y,targetPosition:d};switch(t){case Pe.Bezier:[g]=ki(w);break;case Pe.SimpleBezier:[g]=ns(w);break;case Pe.Step:[g]=Xn({...w,borderRadius:0});break;case Pe.SmoothStep:[g]=Xn(w);break;default:[g]=Ii(w)}return W.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};ps.displayName="ConnectionLine";const tg={};function Oo(e=tg){G.useRef(e),se(),G.useEffect(()=>{},[e])}function ng(){se(),G.useRef(!1),G.useEffect(()=>{},[])}function ms({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:a,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:l,onSelectionStart:d,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:w,connectionLineComponent:E,connectionLineContainerStyle:_,selectionKeyCode:b,selectionOnDrag:p,selectionMode:y,multiSelectionKeyCode:T,panActivationKeyCode:k,zoomActivationKeyCode:I,deleteKeyCode:H,onlyRenderVisibleElements:F,elementsSelectable:j,defaultViewport:C,translateExtent:R,minZoom:D,maxZoom:x,preventScrolling:L,defaultMarkerColor:N,zoomOnScroll:P,zoomOnPinch:A,panOnScroll:O,panOnScrollSpeed:B,panOnScrollMode:m,zoomOnDoubleClick:M,panOnDrag:Y,onPaneClick:S,onPaneMouseEnter:v,onPaneMouseMove:$,onPaneMouseLeave:z,onPaneScroll:V,onPaneContextMenu:X,paneClickDistance:q,nodeClickDistance:U,onEdgeContextMenu:K,onEdgeMouseEnter:Z,onEdgeMouseMove:J,onEdgeMouseLeave:te,reconnectRadius:ne,onReconnect:ue,onReconnectStart:ge,onReconnectEnd:Se,noDragClassName:Re,noWheelClassName:nt,noPanClassName:rt,disableKeyboardA11y:ot,nodeExtent:yn,rfId:Mt,viewport:Fe,onViewportChange:it}){return Oo(e),Oo(t),ng(),Gh(n),Uh(Fe),W.jsx(yh,{onPaneClick:S,onPaneMouseEnter:v,onPaneMouseMove:$,onPaneMouseLeave:z,onPaneContextMenu:X,onPaneScroll:V,paneClickDistance:q,deleteKeyCode:H,selectionKeyCode:b,selectionOnDrag:p,selectionMode:y,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:T,panActivationKeyCode:k,zoomActivationKeyCode:I,elementsSelectable:j,zoomOnScroll:P,zoomOnPinch:A,zoomOnDoubleClick:M,panOnScroll:O,panOnScrollSpeed:B,panOnScrollMode:m,panOnDrag:Y,defaultViewport:C,translateExtent:R,minZoom:D,maxZoom:x,onSelectionContextMenu:l,preventScrolling:L,noDragClassName:Re,noWheelClassName:nt,noPanClassName:rt,disableKeyboardA11y:ot,onViewportChange:it,isControlledViewport:!!Fe,children:W.jsxs(Wh,{children:[W.jsx(Yh,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:ue,onReconnectStart:ge,onReconnectEnd:Se,onlyRenderVisibleElements:F,onEdgeContextMenu:K,onEdgeMouseEnter:Z,onEdgeMouseMove:J,onEdgeMouseLeave:te,reconnectRadius:ne,defaultMarkerColor:N,noPanClassName:rt,disableKeyboardA11y:ot,rfId:Mt}),W.jsx(eg,{style:w,type:g,component:E,containerStyle:_}),W.jsx("div",{className:"react-flow__edgelabel-renderer"}),W.jsx(Ch,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:c,onNodeMouseMove:a,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:U,onlyRenderVisibleElements:F,noPanClassName:rt,noDragClassName:Re,disableKeyboardA11y:ot,nodeExtent:yn,rfId:Mt}),W.jsx("div",{className:"react-flow__viewport-portal"})]})})}ms.displayName="GraphView";const rg=G.memo(ms),Ro=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:c,minZoom:a=.5,maxZoom:u=2,nodeOrigin:f,nodeExtent:l,zIndexMode:d="basic"}={})=>{const h=new Map,g=new Map,w=new Map,E=new Map,_=r??t??[],b=n??e??[],p=f??[0,0],y=l??yt;Pi(w,E,_);const T=Gn(b,h,g,{nodeOrigin:p,nodeExtent:y,zIndexMode:d});let k=[0,0,1];if(s&&o&&i){const I=St(h,{filter:C=>!!((C.width||C.initialWidth)&&(C.height||C.initialHeight))}),{x:H,y:F,zoom:j}=ir(I,o,i,a,u,(c==null?void 0:c.padding)??.1);k=[H,F,j]}return{rfId:"1",width:o??0,height:i??0,transform:k,nodes:b,nodesInitialized:T,nodeLookup:h,parentLookup:g,edges:_,edgeLookup:E,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:a,maxZoom:u,translateExtent:yt,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ze.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:c,fitViewResolver:null,connection:{...gi},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:mf,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:hi,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},og=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:c,minZoom:a,maxZoom:u,nodeOrigin:f,nodeExtent:l,zIndexMode:d})=>wd((h,g)=>{async function w(){const{nodeLookup:E,panZoom:_,fitViewOptions:b,fitViewResolver:p,width:y,height:T,minZoom:k,maxZoom:I}=g();_&&(await gf({nodes:E,width:y,height:T,panZoom:_,minZoom:k,maxZoom:I},b),p==null||p.resolve(!0),h({fitViewResolver:null}))}return{...Ro({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:c,minZoom:a,maxZoom:u,nodeOrigin:f,nodeExtent:l,defaultNodes:n,defaultEdges:r,zIndexMode:d}),setNodes:E=>{const{nodeLookup:_,parentLookup:b,nodeOrigin:p,elevateNodesOnSelect:y,fitViewQueued:T,zIndexMode:k}=g(),I=Gn(E,_,b,{nodeOrigin:p,nodeExtent:l,elevateNodesOnSelect:y,checkEquality:!0,zIndexMode:k});T&&I?(w(),h({nodes:E,nodesInitialized:I,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:E,nodesInitialized:I})},setEdges:E=>{const{connectionLookup:_,edgeLookup:b}=g();Pi(_,b,E),h({edges:E})},setDefaultNodesAndEdges:(E,_)=>{if(E){const{setNodes:b}=g();b(E),h({hasDefaultNodes:!0})}if(_){const{setEdges:b}=g();b(_),h({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:_,nodeLookup:b,parentLookup:p,domNode:y,nodeOrigin:T,nodeExtent:k,debug:I,fitViewQueued:H,zIndexMode:F}=g(),{changes:j,updatedInternals:C}=jf(E,b,p,y,T,k,F);C&&(Rf(b,p,{nodeOrigin:T,nodeExtent:k,zIndexMode:F}),H?(w(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(j==null?void 0:j.length)>0&&(I&&console.log("React Flow: trigger node changes",j),_==null||_(j)))},updateNodePositions:(E,_=!1)=>{const b=[];let p=[];const{nodeLookup:y,triggerNodeChanges:T,connection:k,updateConnection:I,onNodesChangeMiddlewareMap:H}=g();for(const[F,j]of E){const C=y.get(F),R=!!(C!=null&&C.expandParent&&(C!=null&&C.parentId)&&(j!=null&&j.position)),D={id:F,type:"position",position:R?{x:Math.max(0,j.position.x),y:Math.max(0,j.position.y)}:j.position,dragging:_};if(C&&k.inProgress&&k.fromNode.id===C.id){const x=Be(C,k.fromHandle,Q.Left,!0);I({...k,from:x})}R&&C.parentId&&b.push({id:F,parentId:C.parentId,rect:{...j.internals.positionAbsolute,width:j.measured.width??0,height:j.measured.height??0}}),p.push(D)}if(b.length>0){const{parentLookup:F,nodeOrigin:j}=g(),C=fr(b,y,F,j);p.push(...C)}for(const F of H.values())p=F(p);T(p)},triggerNodeChanges:E=>{const{onNodesChange:_,setNodes:b,nodes:p,hasDefaultNodes:y,debug:T}=g();if(E!=null&&E.length){if(y){const k=Vd(E,p);b(k)}T&&console.log("React Flow: trigger node changes",E),_==null||_(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:_,setEdges:b,edges:p,hasDefaultEdges:y,debug:T}=g();if(E!=null&&E.length){if(y){const k=Bd(E,p);b(k)}T&&console.log("React Flow: trigger edge changes",E),_==null||_(E)}},addSelectedNodes:E=>{const{multiSelectionActive:_,edgeLookup:b,nodeLookup:p,triggerNodeChanges:y,triggerEdgeChanges:T}=g();if(_){const k=E.map(I=>$e(I,!0));y(k);return}y(We(p,new Set([...E]),!0)),T(We(b))},addSelectedEdges:E=>{const{multiSelectionActive:_,edgeLookup:b,nodeLookup:p,triggerNodeChanges:y,triggerEdgeChanges:T}=g();if(_){const k=E.map(I=>$e(I,!0));T(k);return}T(We(b,new Set([...E]))),y(We(p,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:_}={})=>{const{edges:b,nodes:p,nodeLookup:y,triggerNodeChanges:T,triggerEdgeChanges:k}=g(),I=E||p,H=_||b,F=[];for(const C of I){if(!C.selected)continue;const R=y.get(C.id);R&&(R.selected=!1),F.push($e(C.id,!1))}const j=[];for(const C of H)C.selected&&j.push($e(C.id,!1));T(F),k(j)},setMinZoom:E=>{const{panZoom:_,maxZoom:b}=g();_==null||_.setScaleExtent([E,b]),h({minZoom:E})},setMaxZoom:E=>{const{panZoom:_,minZoom:b}=g();_==null||_.setScaleExtent([b,E]),h({maxZoom:E})},setTranslateExtent:E=>{var _;(_=g().panZoom)==null||_.setTranslateExtent(E),h({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:_,triggerNodeChanges:b,triggerEdgeChanges:p,elementsSelectable:y}=g();if(!y)return;const T=_.reduce((I,H)=>H.selected?[...I,$e(H.id,!1)]:I,[]),k=E.reduce((I,H)=>H.selected?[...I,$e(H.id,!1)]:I,[]);b(T),p(k)},setNodeExtent:E=>{const{nodes:_,nodeLookup:b,parentLookup:p,nodeOrigin:y,elevateNodesOnSelect:T,nodeExtent:k,zIndexMode:I}=g();E[0][0]===k[0][0]&&E[0][1]===k[0][1]&&E[1][0]===k[1][0]&&E[1][1]===k[1][1]||(Gn(_,b,p,{nodeOrigin:y,nodeExtent:E,elevateNodesOnSelect:T,checkEquality:!1,zIndexMode:I}),h({nodeExtent:E}))},panBy:E=>{const{transform:_,width:b,height:p,panZoom:y,translateExtent:T}=g();return zf({delta:E,panZoom:y,transform:_,translateExtent:T,width:b,height:p})},setCenter:async(E,_,b)=>{const{width:p,height:y,maxZoom:T,panZoom:k}=g();if(!k)return Promise.resolve(!1);const I=typeof(b==null?void 0:b.zoom)<"u"?b.zoom:T;return await k.setViewport({x:p/2-E*I,y:y/2-_*I,zoom:I},{duration:b==null?void 0:b.duration,ease:b==null?void 0:b.ease,interpolate:b==null?void 0:b.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...gi}})},updateConnection:E=>{h({connection:E})},reset:()=>h({...Ro()})}},Object.is);function ig({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:c,initialFitViewOptions:a,fitView:u,nodeOrigin:f,nodeExtent:l,zIndexMode:d,children:h}){const[g]=G.useState(()=>og({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:u,minZoom:s,maxZoom:c,fitViewOptions:a,nodeOrigin:f,nodeExtent:l,zIndexMode:d}));return W.jsx(_d,{value:g,children:W.jsx(Wd,{children:h})})}function sg({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:c,fitViewOptions:a,minZoom:u,maxZoom:f,nodeOrigin:l,nodeExtent:d,zIndexMode:h}){return G.useContext(hn)?W.jsx(W.Fragment,{children:e}):W.jsx(ig,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:c,initialFitViewOptions:a,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:l,nodeExtent:d,zIndexMode:h,children:e})}const ag={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function cg({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:c,onEdgeClick:a,onInit:u,onMove:f,onMoveStart:l,onMoveEnd:d,onConnect:h,onConnectStart:g,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:_,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:y,onNodeContextMenu:T,onNodeDoubleClick:k,onNodeDragStart:I,onNodeDrag:H,onNodeDragStop:F,onNodesDelete:j,onEdgesDelete:C,onDelete:R,onSelectionChange:D,onSelectionDragStart:x,onSelectionDrag:L,onSelectionDragStop:N,onSelectionContextMenu:P,onSelectionStart:A,onSelectionEnd:O,onBeforeDelete:B,connectionMode:m,connectionLineType:M=Pe.Bezier,connectionLineStyle:Y,connectionLineComponent:S,connectionLineContainerStyle:v,deleteKeyCode:$="Backspace",selectionKeyCode:z="Shift",selectionOnDrag:V=!1,selectionMode:X=xt.Full,panActivationKeyCode:q="Space",multiSelectionKeyCode:U=wt()?"Meta":"Control",zoomActivationKeyCode:K=wt()?"Meta":"Control",snapToGrid:Z,snapGrid:J,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:ne,nodesDraggable:ue,autoPanOnNodeFocus:ge,nodesConnectable:Se,nodesFocusable:Re,nodeOrigin:nt=Xi,edgesFocusable:rt,edgesReconnectable:ot,elementsSelectable:yn=!0,defaultViewport:Mt=Rd,minZoom:Fe=.5,maxZoom:it=2,translateExtent:gr=yt,preventScrolling:_s=!0,nodeExtent:xn,defaultMarkerColor:bs="#b1b1b7",zoomOnScroll:Es=!0,zoomOnPinch:Ns=!0,panOnScroll:Ss=!1,panOnScrollSpeed:Cs=.5,panOnScrollMode:ks=je.Free,zoomOnDoubleClick:Ms=!0,panOnDrag:Is=!0,onPaneClick:Ts,onPaneMouseEnter:As,onPaneMouseMove:Ps,onPaneMouseLeave:Os,onPaneScroll:Rs,onPaneContextMenu:$s,paneClickDistance:Ls=1,nodeClickDistance:Ds=0,children:js,onReconnect:zs,onReconnectStart:Hs,onReconnectEnd:Vs,onEdgeContextMenu:Bs,onEdgeDoubleClick:Fs,onEdgeMouseEnter:Ys,onEdgeMouseMove:Xs,onEdgeMouseLeave:Ws,reconnectRadius:Gs=10,onNodesChange:qs,onEdgesChange:Us,noDragClassName:Ks="nodrag",noWheelClassName:Zs="nowheel",noPanClassName:pr="nopan",fitView:mr,fitViewOptions:yr,connectOnClick:Qs,attributionPosition:Js,proOptions:ea,defaultEdgeOptions:ta,elevateNodesOnSelect:na=!0,elevateEdgesOnSelect:ra=!1,disableKeyboardA11y:xr=!1,autoPanOnConnect:oa,autoPanOnNodeDrag:ia,autoPanSpeed:sa,connectionRadius:aa,isValidConnection:ca,onError:ua,style:la,id:vr,nodeDragThreshold:fa,connectionDragThreshold:da,viewport:ha,onViewportChange:ga,width:pa,height:ma,colorMode:ya="light",debug:xa,onScroll:It,ariaLabelConfig:va,zIndexMode:wr="basic",...wa},_a){const vn=vr||"1",ba=jd(ya),Ea=G.useCallback(_r=>{_r.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),It==null||It(_r)},[It]);return W.jsx("div",{"data-testid":"rf__wrapper",...wa,onScroll:Ea,style:{...la,...ag},ref:_a,className:ce(["react-flow",o,ba]),id:vr,role:"application",children:W.jsxs(sg,{nodes:e,edges:t,width:pa,height:ma,fitView:mr,fitViewOptions:yr,minZoom:Fe,maxZoom:it,nodeOrigin:nt,nodeExtent:xn,zIndexMode:wr,children:[W.jsx(rg,{onInit:u,onNodeClick:c,onEdgeClick:a,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:y,onNodeContextMenu:T,onNodeDoubleClick:k,nodeTypes:i,edgeTypes:s,connectionLineType:M,connectionLineStyle:Y,connectionLineComponent:S,connectionLineContainerStyle:v,selectionKeyCode:z,selectionOnDrag:V,selectionMode:X,deleteKeyCode:$,multiSelectionKeyCode:U,panActivationKeyCode:q,zoomActivationKeyCode:K,onlyRenderVisibleElements:te,defaultViewport:Mt,translateExtent:gr,minZoom:Fe,maxZoom:it,preventScrolling:_s,zoomOnScroll:Es,zoomOnPinch:Ns,zoomOnDoubleClick:Ms,panOnScroll:Ss,panOnScrollSpeed:Cs,panOnScrollMode:ks,panOnDrag:Is,onPaneClick:Ts,onPaneMouseEnter:As,onPaneMouseMove:Ps,onPaneMouseLeave:Os,onPaneScroll:Rs,onPaneContextMenu:$s,paneClickDistance:Ls,nodeClickDistance:Ds,onSelectionContextMenu:P,onSelectionStart:A,onSelectionEnd:O,onReconnect:zs,onReconnectStart:Hs,onReconnectEnd:Vs,onEdgeContextMenu:Bs,onEdgeDoubleClick:Fs,onEdgeMouseEnter:Ys,onEdgeMouseMove:Xs,onEdgeMouseLeave:Ws,reconnectRadius:Gs,defaultMarkerColor:bs,noDragClassName:Ks,noWheelClassName:Zs,noPanClassName:pr,rfId:vn,disableKeyboardA11y:xr,nodeExtent:xn,viewport:ha,onViewportChange:ga}),W.jsx(Dd,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:w,onClickConnectStart:E,onClickConnectEnd:_,nodesDraggable:ue,autoPanOnNodeFocus:ge,nodesConnectable:Se,nodesFocusable:Re,edgesFocusable:rt,edgesReconnectable:ot,elementsSelectable:yn,elevateNodesOnSelect:na,elevateEdgesOnSelect:ra,minZoom:Fe,maxZoom:it,nodeExtent:xn,onNodesChange:qs,onEdgesChange:Us,snapToGrid:Z,snapGrid:J,connectionMode:m,translateExtent:gr,connectOnClick:Qs,defaultEdgeOptions:ta,fitView:mr,fitViewOptions:yr,onNodesDelete:j,onEdgesDelete:C,onDelete:R,onNodeDragStart:I,onNodeDrag:H,onNodeDragStop:F,onSelectionDrag:L,onSelectionDragStart:x,onSelectionDragStop:N,onMove:f,onMoveStart:l,onMoveEnd:d,noPanClassName:pr,nodeOrigin:nt,rfId:vn,autoPanOnConnect:oa,autoPanOnNodeDrag:ia,autoPanSpeed:sa,onError:ua,connectionRadius:aa,isValidConnection:ca,selectNodesOnDrag:ne,nodeDragThreshold:fa,connectionDragThreshold:da,onBeforeDelete:B,debug:xa,ariaLabelConfig:va,zIndexMode:wr}),W.jsx(Od,{onSelectionChange:D}),js,W.jsx(Md,{proOptions:ea,position:Js}),W.jsx(kd,{rfId:vn,disableKeyboardA11y:xr})]})})}var ip=Gi(cg);function ug({dimensions:e,lineWidth:t,variant:n,className:r}){return W.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ce(["react-flow__background-pattern",n,r])})}function lg({radius:e,className:t}){return W.jsx("circle",{cx:e,cy:e,r:e,className:ce(["react-flow__background-pattern","dots",t])})}var Oe;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Oe||(Oe={}));const fg={[Oe.Dots]:1,[Oe.Lines]:1,[Oe.Cross]:6},dg=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ys({id:e,variant:t=Oe.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:c,style:a,className:u,patternClassName:f}){const l=G.useRef(null),{transform:d,patternId:h}=re(dg,ie),g=r||fg[t],w=t===Oe.Dots,E=t===Oe.Cross,_=Array.isArray(n)?n:[n,n],b=[_[0]*d[2]||1,_[1]*d[2]||1],p=g*d[2],y=Array.isArray(i)?i:[i,i],T=E?[p,p]:b,k=[y[0]*d[2]||1+T[0]/2,y[1]*d[2]||1+T[1]/2],I=`${h}${e||""}`;return W.jsxs("svg",{className:ce(["react-flow__background",u]),style:{...a,...pn,"--xy-background-color-props":c,"--xy-background-pattern-color-props":s},ref:l,"data-testid":"rf__background",children:[W.jsx("pattern",{id:I,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:w?W.jsx(lg,{radius:p/2,className:f}):W.jsx(ug,{dimensions:T,lineWidth:o,variant:t,className:f})}),W.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${I})`})]})}ys.displayName="Background";const sp=G.memo(ys);function hg(){return W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:W.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function gg(){return W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:W.jsx("path",{d:"M0 0h32v4.2H0z"})})}function pg(){return W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:W.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function mg(){return W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:W.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function yg(){return W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:W.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function jt({children:e,className:t,...n}){return W.jsx("button",{type:"button",className:ce(["react-flow__controls-button",t]),...n,children:e})}const xg=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function xs({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:c,onInteractiveChange:a,className:u,children:f,position:l="bottom-left",orientation:d="vertical","aria-label":h}){const g=se(),{isInteractive:w,minZoomReached:E,maxZoomReached:_,ariaLabelConfig:b}=re(xg,ie),{zoomIn:p,zoomOut:y,fitView:T}=dr(),k=()=>{p(),i==null||i()},I=()=>{y(),s==null||s()},H=()=>{T(o),c==null||c()},F=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),a==null||a(!w)},j=d==="horizontal"?"horizontal":"vertical";return W.jsxs(gn,{className:ce(["react-flow__controls",j,u]),position:l,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&W.jsxs(W.Fragment,{children:[W.jsx(jt,{onClick:k,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:_,children:W.jsx(hg,{})}),W.jsx(jt,{onClick:I,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:E,children:W.jsx(gg,{})})]}),n&&W.jsx(jt,{className:"react-flow__controls-fitview",onClick:H,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:W.jsx(pg,{})}),r&&W.jsx(jt,{className:"react-flow__controls-interactive",onClick:F,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:w?W.jsx(yg,{}):W.jsx(mg,{})}),f]})}xs.displayName="Controls";const ap=G.memo(xs);function vg({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:c,strokeWidth:a,className:u,borderRadius:f,shapeRendering:l,selected:d,onClick:h}){const{background:g,backgroundColor:w}=i||{},E=s||g||w;return W.jsx("rect",{className:ce(["react-flow__minimap-node",{selected:d},u]),x:t,y:n,rx:f,ry:f,width:r,height:o,style:{fill:E,stroke:c,strokeWidth:a},shapeRendering:l,onClick:h?_=>h(_,e):void 0})}const wg=G.memo(vg),_g=e=>e.nodes.map(t=>t.id),$n=e=>e instanceof Function?e:()=>e;function bg({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=wg,onClick:s}){const c=re(_g,ie),a=$n(t),u=$n(e),f=$n(n),l=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return W.jsx(W.Fragment,{children:c.map(d=>W.jsx(Ng,{id:d,nodeColorFunc:a,nodeStrokeColorFunc:u,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:l},d))})}function Eg({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:c,onClick:a}){const{node:u,x:f,y:l,width:d,height:h}=re(g=>{const w=g.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const E=w.internals.userNode,{x:_,y:b}=w.internals.positionAbsolute,{width:p,height:y}=Ie(E);return{node:E,x:_,y:b,width:p,height:y}},ie);return!u||u.hidden||!_i(u)?null:W.jsx(c,{x:f,y:l,width:d,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:o,strokeColor:n(u),strokeWidth:i,shapeRendering:s,onClick:a,id:u.id})}const Ng=G.memo(Eg);var Sg=G.memo(bg);const Cg=200,kg=150,Mg=e=>!e.hidden,Ig=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?wi(St(e.nodeLookup,{filter:Mg}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Tg="react-flow__minimap-desc";function vs({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:c,bgColor:a,maskColor:u,maskStrokeColor:f,maskStrokeWidth:l,position:d="bottom-right",onClick:h,onNodeClick:g,pannable:w=!1,zoomable:E=!1,ariaLabel:_,inversePan:b,zoomStep:p=1,offsetScale:y=5}){const T=se(),k=G.useRef(null),{boundingRect:I,viewBB:H,rfId:F,panZoom:j,translateExtent:C,flowWidth:R,flowHeight:D,ariaLabelConfig:x}=re(Ig,ie),L=(e==null?void 0:e.width)??Cg,N=(e==null?void 0:e.height)??kg,P=I.width/L,A=I.height/N,O=Math.max(P,A),B=O*L,m=O*N,M=y*O,Y=I.x-(B-I.width)/2-M,S=I.y-(m-I.height)/2-M,v=B+M*2,$=m+M*2,z=`${Tg}-${F}`,V=G.useRef(0),X=G.useRef();V.current=O,G.useEffect(()=>{if(k.current&&j)return X.current=qf({domNode:k.current,panZoom:j,getTransform:()=>T.getState().transform,getViewScale:()=>V.current}),()=>{var Z;(Z=X.current)==null||Z.destroy()}},[j]),G.useEffect(()=>{var Z;(Z=X.current)==null||Z.update({translateExtent:C,width:R,height:D,inversePan:b,pannable:w,zoomStep:p,zoomable:E})},[w,E,b,p,C,R,D]);const q=h?Z=>{var ne;const[J,te]=((ne=X.current)==null?void 0:ne.pointer(Z))||[0,0];h(Z,{x:J,y:te})}:void 0,U=g?G.useCallback((Z,J)=>{const te=T.getState().nodeLookup.get(J).internals.userNode;g(Z,te)},[]):void 0,K=_??x["minimap.ariaLabel"];return W.jsx(gn,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof a=="string"?a:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof l=="number"?l*O:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ce(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:W.jsxs("svg",{width:L,height:N,viewBox:`${Y} ${S} ${v} ${$}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":z,ref:k,onClick:q,children:[K&&W.jsx("title",{id:z,children:K}),W.jsx(Sg,{onClick:U,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:c}),W.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-M},${S-M}h${v+M*2}v${$+M*2}h${-v-M*2}z
|
|
47
|
+
M${H.x},${H.y}h${H.width}v${H.height}h${-H.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}vs.displayName="MiniMap";const cp=G.memo(vs),Ag=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Pg={[tt.Line]:"right",[tt.Handle]:"bottom-right"};function Og({nodeId:e,position:t,variant:n=tt.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:c=10,minHeight:a=10,maxWidth:u=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:l=!1,resizeDirection:d,autoScale:h=!0,shouldResize:g,onResizeStart:w,onResize:E,onResizeEnd:_}){const b=Zi(),p=typeof e=="string"?e:b,y=se(),T=G.useRef(null),k=n===tt.Handle,I=re(G.useCallback(Ag(k&&h),[k,h]),ie),H=G.useRef(null),F=t??Pg[n];G.useEffect(()=>{if(!(!T.current||!p))return H.current||(H.current=cd({domNode:T.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:C,transform:R,snapGrid:D,snapToGrid:x,nodeOrigin:L,domNode:N}=y.getState();return{nodeLookup:C,transform:R,snapGrid:D,snapToGrid:x,nodeOrigin:L,paneDomNode:N}},onChange:(C,R)=>{const{triggerNodeChanges:D,nodeLookup:x,parentLookup:L,nodeOrigin:N}=y.getState(),P=[],A={x:C.x,y:C.y},O=x.get(p);if(O&&O.expandParent&&O.parentId){const B=O.origin??N,m=C.width??O.measured.width??0,M=C.height??O.measured.height??0,Y={id:O.id,parentId:O.parentId,rect:{width:m,height:M,...bi({x:C.x??O.position.x,y:C.y??O.position.y},{width:m,height:M},O.parentId,x,B)}},S=fr([Y],x,L,N);P.push(...S),A.x=C.x?Math.max(B[0]*m,C.x):void 0,A.y=C.y?Math.max(B[1]*M,C.y):void 0}if(A.x!==void 0&&A.y!==void 0){const B={id:p,type:"position",position:{...A}};P.push(B)}if(C.width!==void 0&&C.height!==void 0){const m={id:p,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:C.width,height:C.height}};P.push(m)}for(const B of R){const m={...B,type:"position"};P.push(m)}D(P)},onEnd:({width:C,height:R})=>{const D={id:p,type:"dimensions",resizing:!1,dimensions:{width:C,height:R}};y.getState().triggerNodeChanges([D])}})),H.current.update({controlPosition:F,boundaries:{minWidth:c,minHeight:a,maxWidth:u,maxHeight:f},keepAspectRatio:l,resizeDirection:d,onResizeStart:w,onResize:E,onResizeEnd:_,shouldResize:g}),()=>{var C;(C=H.current)==null||C.destroy()}},[F,c,a,u,f,l,w,E,_,g]);const j=F.split("-");return W.jsx("div",{className:ce(["react-flow__resize-control","nodrag",...j,n,r]),ref:T,style:{...o,scale:I,...s&&{[k?"backgroundColor":"borderColor"]:s}},children:i})}G.memo(Og);var oe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ve=oe((e,t)=>{var n=Object.defineProperty,r=(D,x,L)=>x in D?n(D,x,{enumerable:!0,configurable:!0,writable:!0,value:L}):D[x]=L,o=(D,x)=>()=>(x||D((x={exports:{}}).exports,x),x.exports),i=(D,x,L)=>r(D,typeof x!="symbol"?x+"":x,L),s=o((D,x)=>{var L="\0",N="\0",P="",A=class{constructor(S){i(this,"_isDirected",!0),i(this,"_isMultigraph",!1),i(this,"_isCompound",!1),i(this,"_label"),i(this,"_defaultNodeLabelFn",()=>{}),i(this,"_defaultEdgeLabelFn",()=>{}),i(this,"_nodes",{}),i(this,"_in",{}),i(this,"_preds",{}),i(this,"_out",{}),i(this,"_sucs",{}),i(this,"_edgeObjs",{}),i(this,"_edgeLabels",{}),i(this,"_nodeCount",0),i(this,"_edgeCount",0),i(this,"_parent"),i(this,"_children"),S&&(this._isDirected=Object.hasOwn(S,"directed")?S.directed:!0,this._isMultigraph=Object.hasOwn(S,"multigraph")?S.multigraph:!1,this._isCompound=Object.hasOwn(S,"compound")?S.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[N]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(S){return this._label=S,this}graph(){return this._label}setDefaultNodeLabel(S){return this._defaultNodeLabelFn=S,typeof S!="function"&&(this._defaultNodeLabelFn=()=>S),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var S=this;return this.nodes().filter(v=>Object.keys(S._in[v]).length===0)}sinks(){var S=this;return this.nodes().filter(v=>Object.keys(S._out[v]).length===0)}setNodes(S,v){var $=arguments,z=this;return S.forEach(function(V){$.length>1?z.setNode(V,v):z.setNode(V)}),this}setNode(S,v){return Object.hasOwn(this._nodes,S)?(arguments.length>1&&(this._nodes[S]=v),this):(this._nodes[S]=arguments.length>1?v:this._defaultNodeLabelFn(S),this._isCompound&&(this._parent[S]=N,this._children[S]={},this._children[N][S]=!0),this._in[S]={},this._preds[S]={},this._out[S]={},this._sucs[S]={},++this._nodeCount,this)}node(S){return this._nodes[S]}hasNode(S){return Object.hasOwn(this._nodes,S)}removeNode(S){var v=this;if(Object.hasOwn(this._nodes,S)){var $=z=>v.removeEdge(v._edgeObjs[z]);delete this._nodes[S],this._isCompound&&(this._removeFromParentsChildList(S),delete this._parent[S],this.children(S).forEach(function(z){v.setParent(z)}),delete this._children[S]),Object.keys(this._in[S]).forEach($),delete this._in[S],delete this._preds[S],Object.keys(this._out[S]).forEach($),delete this._out[S],delete this._sucs[S],--this._nodeCount}return this}setParent(S,v){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(v===void 0)v=N;else{v+="";for(var $=v;$!==void 0;$=this.parent($))if($===S)throw new Error("Setting "+v+" as parent of "+S+" would create a cycle");this.setNode(v)}return this.setNode(S),this._removeFromParentsChildList(S),this._parent[S]=v,this._children[v][S]=!0,this}_removeFromParentsChildList(S){delete this._children[this._parent[S]][S]}parent(S){if(this._isCompound){var v=this._parent[S];if(v!==N)return v}}children(S=N){if(this._isCompound){var v=this._children[S];if(v)return Object.keys(v)}else{if(S===N)return this.nodes();if(this.hasNode(S))return[]}}predecessors(S){var v=this._preds[S];if(v)return Object.keys(v)}successors(S){var v=this._sucs[S];if(v)return Object.keys(v)}neighbors(S){var v=this.predecessors(S);if(v){let z=new Set(v);for(var $ of this.successors(S))z.add($);return Array.from(z.values())}}isLeaf(S){var v;return this.isDirected()?v=this.successors(S):v=this.neighbors(S),v.length===0}filterNodes(S){var v=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});v.setGraph(this.graph());var $=this;Object.entries(this._nodes).forEach(function([X,q]){S(X)&&v.setNode(X,q)}),Object.values(this._edgeObjs).forEach(function(X){v.hasNode(X.v)&&v.hasNode(X.w)&&v.setEdge(X,$.edge(X))});var z={};function V(X){var q=$.parent(X);return q===void 0||v.hasNode(q)?(z[X]=q,q):q in z?z[q]:V(q)}return this._isCompound&&v.nodes().forEach(X=>v.setParent(X,V(X))),v}setDefaultEdgeLabel(S){return this._defaultEdgeLabelFn=S,typeof S!="function"&&(this._defaultEdgeLabelFn=()=>S),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(S,v){var $=this,z=arguments;return S.reduce(function(V,X){return z.length>1?$.setEdge(V,X,v):$.setEdge(V,X),X}),this}setEdge(){var S,v,$,z,V=!1,X=arguments[0];typeof X=="object"&&X!==null&&"v"in X?(S=X.v,v=X.w,$=X.name,arguments.length===2&&(z=arguments[1],V=!0)):(S=X,v=arguments[1],$=arguments[3],arguments.length>2&&(z=arguments[2],V=!0)),S=""+S,v=""+v,$!==void 0&&($=""+$);var q=m(this._isDirected,S,v,$);if(Object.hasOwn(this._edgeLabels,q))return V&&(this._edgeLabels[q]=z),this;if($!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(S),this.setNode(v),this._edgeLabels[q]=V?z:this._defaultEdgeLabelFn(S,v,$);var U=M(this._isDirected,S,v,$);return S=U.v,v=U.w,Object.freeze(U),this._edgeObjs[q]=U,O(this._preds[v],S),O(this._sucs[S],v),this._in[v][q]=U,this._out[S][q]=U,this._edgeCount++,this}edge(S,v,$){var z=arguments.length===1?Y(this._isDirected,arguments[0]):m(this._isDirected,S,v,$);return this._edgeLabels[z]}edgeAsObj(){let S=this.edge(...arguments);return typeof S!="object"?{label:S}:S}hasEdge(S,v,$){var z=arguments.length===1?Y(this._isDirected,arguments[0]):m(this._isDirected,S,v,$);return Object.hasOwn(this._edgeLabels,z)}removeEdge(S,v,$){var z=arguments.length===1?Y(this._isDirected,arguments[0]):m(this._isDirected,S,v,$),V=this._edgeObjs[z];return V&&(S=V.v,v=V.w,delete this._edgeLabels[z],delete this._edgeObjs[z],B(this._preds[v],S),B(this._sucs[S],v),delete this._in[v][z],delete this._out[S][z],this._edgeCount--),this}inEdges(S,v){return this.isDirected()?this.filterEdges(this._in[S],S,v):this.nodeEdges(S,v)}outEdges(S,v){return this.isDirected()?this.filterEdges(this._out[S],S,v):this.nodeEdges(S,v)}nodeEdges(S,v){if(S in this._nodes)return this.filterEdges({...this._in[S],...this._out[S]},S,v)}filterEdges(S,v,$){if(S){var z=Object.values(S);return $?z.filter(function(V){return V.v===v&&V.w===$||V.v===$&&V.w===v}):z}}};function O(S,v){S[v]?S[v]++:S[v]=1}function B(S,v){--S[v]||delete S[v]}function m(S,v,$,z){var V=""+v,X=""+$;if(!S&&V>X){var q=V;V=X,X=q}return V+P+X+P+(z===void 0?L:z)}function M(S,v,$,z){var V=""+v,X=""+$;if(!S&&V>X){var q=V;V=X,X=q}var U={v:V,w:X};return z&&(U.name=z),U}function Y(S,v){return m(S,v.v,v.w,v.name)}x.exports=A}),c=o((D,x)=>{x.exports="3.0.2"}),a=o((D,x)=>{x.exports={Graph:s(),version:c()}}),u=o((D,x)=>{var L=s();x.exports={write:N,read:O};function N(B){var m={options:{directed:B.isDirected(),multigraph:B.isMultigraph(),compound:B.isCompound()},nodes:P(B),edges:A(B)};return B.graph()!==void 0&&(m.value=structuredClone(B.graph())),m}function P(B){return B.nodes().map(function(m){var M=B.node(m),Y=B.parent(m),S={v:m};return M!==void 0&&(S.value=M),Y!==void 0&&(S.parent=Y),S})}function A(B){return B.edges().map(function(m){var M=B.edge(m),Y={v:m.v,w:m.w};return m.name!==void 0&&(Y.name=m.name),M!==void 0&&(Y.value=M),Y})}function O(B){var m=new L(B.options).setGraph(B.value);return B.nodes.forEach(function(M){m.setNode(M.v,M.value),M.parent&&m.setParent(M.v,M.parent)}),B.edges.forEach(function(M){m.setEdge({v:M.v,w:M.w,name:M.name},M.value)}),m}}),f=o((D,x)=>{x.exports=N;var L=()=>1;function N(A,O,B,m){return P(A,String(O),B||L,m||function(M){return A.outEdges(M)})}function P(A,O,B,m){var M={},Y=!0,S=0,v=A.nodes(),$=function(q){var U=B(q);M[q.v].distance+U<M[q.w].distance&&(M[q.w]={distance:M[q.v].distance+U,predecessor:q.v},Y=!0)},z=function(){v.forEach(function(q){m(q).forEach(function(U){var K=U.v===q?U.v:U.w,Z=K===U.v?U.w:U.v;$({v:K,w:Z})})})};v.forEach(function(q){var U=q===O?0:Number.POSITIVE_INFINITY;M[q]={distance:U}});for(var V=v.length,X=1;X<V&&(Y=!1,S++,z(),!!Y);X++);if(S===V-1&&(Y=!1,z(),Y))throw new Error("The graph contains a negative weight cycle");return M}}),l=o((D,x)=>{x.exports=L;function L(N){var P={},A=[],O;function B(m){Object.hasOwn(P,m)||(P[m]=!0,O.push(m),N.successors(m).forEach(B),N.predecessors(m).forEach(B))}return N.nodes().forEach(function(m){O=[],B(m),O.length&&A.push(O)}),A}}),d=o((D,x)=>{var L=class{constructor(){i(this,"_arr",[]),i(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(N){return N.key})}has(N){return Object.hasOwn(this._keyIndices,N)}priority(N){var P=this._keyIndices[N];if(P!==void 0)return this._arr[P].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(N,P){var A=this._keyIndices;if(N=String(N),!Object.hasOwn(A,N)){var O=this._arr,B=O.length;return A[N]=B,O.push({key:N,priority:P}),this._decrease(B),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var N=this._arr.pop();return delete this._keyIndices[N.key],this._heapify(0),N.key}decrease(N,P){var A=this._keyIndices[N];if(P>this._arr[A].priority)throw new Error("New priority is greater than current priority. Key: "+N+" Old: "+this._arr[A].priority+" New: "+P);this._arr[A].priority=P,this._decrease(A)}_heapify(N){var P=this._arr,A=2*N,O=A+1,B=N;A<P.length&&(B=P[A].priority<P[B].priority?A:B,O<P.length&&(B=P[O].priority<P[B].priority?O:B),B!==N&&(this._swap(N,B),this._heapify(B)))}_decrease(N){for(var P=this._arr,A=P[N].priority,O;N!==0&&(O=N>>1,!(P[O].priority<A));)this._swap(N,O),N=O}_swap(N,P){var A=this._arr,O=this._keyIndices,B=A[N],m=A[P];A[N]=m,A[P]=B,O[m.key]=N,O[B.key]=P}};x.exports=L}),h=o((D,x)=>{var L=d();x.exports=P;var N=()=>1;function P(O,B,m,M){var Y=function(S){return O.outEdges(S)};return A(O,String(B),m||N,M||Y)}function A(O,B,m,M){var Y={},S=new L,v,$,z=function(V){var X=V.v!==v?V.v:V.w,q=Y[X],U=m(V),K=$.distance+U;if(U<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+V+" Weight: "+U);K<q.distance&&(q.distance=K,q.predecessor=v,S.decrease(X,K))};for(O.nodes().forEach(function(V){var X=V===B?0:Number.POSITIVE_INFINITY;Y[V]={distance:X},S.add(V,X)});S.size()>0&&(v=S.removeMin(),$=Y[v],$.distance!==Number.POSITIVE_INFINITY);)M(v).forEach(z);return Y}}),g=o((D,x)=>{var L=h();x.exports=N;function N(P,A,O){return P.nodes().reduce(function(B,m){return B[m]=L(P,m,A,O),B},{})}}),w=o((D,x)=>{x.exports=L;function L(P,A,O){if(P[A].predecessor!==void 0)throw new Error("Invalid source vertex");if(P[O].predecessor===void 0&&O!==A)throw new Error("Invalid destination vertex");return{weight:P[O].distance,path:N(P,A,O)}}function N(P,A,O){for(var B=[],m=O;m!==A;)B.push(m),m=P[m].predecessor;return B.push(A),B.reverse()}}),E=o((D,x)=>{x.exports=L;function L(N){var P=0,A=[],O={},B=[];function m(M){var Y=O[M]={onStack:!0,lowlink:P,index:P++};if(A.push(M),N.successors(M).forEach(function($){Object.hasOwn(O,$)?O[$].onStack&&(Y.lowlink=Math.min(Y.lowlink,O[$].index)):(m($),Y.lowlink=Math.min(Y.lowlink,O[$].lowlink))}),Y.lowlink===Y.index){var S=[],v;do v=A.pop(),O[v].onStack=!1,S.push(v);while(M!==v);B.push(S)}}return N.nodes().forEach(function(M){Object.hasOwn(O,M)||m(M)}),B}}),_=o((D,x)=>{var L=E();x.exports=N;function N(P){return L(P).filter(function(A){return A.length>1||A.length===1&&P.hasEdge(A[0],A[0])})}}),b=o((D,x)=>{x.exports=N;var L=()=>1;function N(A,O,B){return P(A,O||L,B||function(m){return A.outEdges(m)})}function P(A,O,B){var m={},M=A.nodes();return M.forEach(function(Y){m[Y]={},m[Y][Y]={distance:0},M.forEach(function(S){Y!==S&&(m[Y][S]={distance:Number.POSITIVE_INFINITY})}),B(Y).forEach(function(S){var v=S.v===Y?S.w:S.v,$=O(S);m[Y][v]={distance:$,predecessor:Y}})}),M.forEach(function(Y){var S=m[Y];M.forEach(function(v){var $=m[v];M.forEach(function(z){var V=$[Y],X=S[z],q=$[z],U=V.distance+X.distance;U<q.distance&&(q.distance=U,q.predecessor=X.predecessor)})})}),m}}),p=o((D,x)=>{function L(P){var A={},O={},B=[];function m(M){if(Object.hasOwn(O,M))throw new N;Object.hasOwn(A,M)||(O[M]=!0,A[M]=!0,P.predecessors(M).forEach(m),delete O[M],B.push(M))}if(P.sinks().forEach(m),Object.keys(A).length!==P.nodeCount())throw new N;return B}var N=class extends Error{constructor(){super(...arguments)}};x.exports=L,L.CycleException=N}),y=o((D,x)=>{var L=p();x.exports=N;function N(P){try{L(P)}catch(A){if(A instanceof L.CycleException)return!1;throw A}return!0}}),T=o((D,x)=>{x.exports=L;function L(P,A,O,B,m){Array.isArray(A)||(A=[A]);var M=(P.isDirected()?P.successors:P.neighbors).bind(P),Y={};return A.forEach(function(S){if(!P.hasNode(S))throw new Error("Graph does not have node: "+S);m=N(P,S,O==="post",Y,M,B,m)}),m}function N(P,A,O,B,m,M,Y){return Object.hasOwn(B,A)||(B[A]=!0,O||(Y=M(Y,A)),m(A).forEach(function(S){Y=N(P,S,O,B,m,M,Y)}),O&&(Y=M(Y,A))),Y}}),k=o((D,x)=>{var L=T();x.exports=N;function N(P,A,O){return L(P,A,O,function(B,m){return B.push(m),B},[])}}),I=o((D,x)=>{var L=k();x.exports=N;function N(P,A){return L(P,A,"post")}}),H=o((D,x)=>{var L=k();x.exports=N;function N(P,A){return L(P,A,"pre")}}),F=o((D,x)=>{var L=s(),N=d();x.exports=P;function P(A,O){var B=new L,m={},M=new N,Y;function S($){var z=$.v===Y?$.w:$.v,V=M.priority(z);if(V!==void 0){var X=O($);X<V&&(m[z]=Y,M.decrease(z,X))}}if(A.nodeCount()===0)return B;A.nodes().forEach(function($){M.add($,Number.POSITIVE_INFINITY),B.setNode($)}),M.decrease(A.nodes()[0],0);for(var v=!1;M.size()>0;){if(Y=M.removeMin(),Object.hasOwn(m,Y))B.setEdge(Y,m[Y]);else{if(v)throw new Error("Input graph is not connected: "+A);v=!0}A.nodeEdges(Y).forEach(S)}return B}}),j=o((D,x)=>{var L=h(),N=f();x.exports=P;function P(O,B,m,M){return A(O,B,m,M||function(Y){return O.outEdges(Y)})}function A(O,B,m,M){if(m===void 0)return L(O,B,m,M);for(var Y=!1,S=O.nodes(),v=0;v<S.length;v++){for(var $=M(S[v]),z=0;z<$.length;z++){var V=$[z],X=V.v===S[v]?V.v:V.w,q=X===V.v?V.w:V.v;m({v:X,w:q})<0&&(Y=!0)}if(Y)return N(O,B,m,M)}return L(O,B,m,M)}}),C=o((D,x)=>{x.exports={bellmanFord:f(),components:l(),dijkstra:h(),dijkstraAll:g(),extractPath:w(),findCycles:_(),floydWarshall:b(),isAcyclic:y(),postorder:I(),preorder:H(),prim:F(),shortestPaths:j(),reduce:T(),tarjan:E(),topsort:p()}}),R=a();t.exports={Graph:R.Graph,json:u(),alg:C(),version:R.version}}),Rg=oe((e,t)=>{var n=class{constructor(){let i={};i._next=i._prev=i,this._sentinel=i}dequeue(){let i=this._sentinel,s=i._prev;if(s!==i)return r(s),s}enqueue(i){let s=this._sentinel;i._prev&&i._next&&r(i),i._next=s._next,s._next._prev=i,s._next=i,i._prev=s}toString(){let i=[],s=this._sentinel,c=s._prev;for(;c!==s;)i.push(JSON.stringify(c,o)),c=c._prev;return"["+i.join(", ")+"]"}};function r(i){i._prev._next=i._next,i._next._prev=i._prev,delete i._next,delete i._prev}function o(i,s){if(i!=="_next"&&i!=="_prev")return s}t.exports=n}),$g=oe((e,t)=>{var n=ve().Graph,r=Rg();t.exports=i;var o=()=>1;function i(l,d){if(l.nodeCount()<=1)return[];let h=a(l,d||o);return s(h.graph,h.buckets,h.zeroIdx).flatMap(g=>l.outEdges(g.v,g.w))}function s(l,d,h){let g=[],w=d[d.length-1],E=d[0],_;for(;l.nodeCount();){for(;_=E.dequeue();)c(l,d,h,_);for(;_=w.dequeue();)c(l,d,h,_);if(l.nodeCount()){for(let b=d.length-2;b>0;--b)if(_=d[b].dequeue(),_){g=g.concat(c(l,d,h,_,!0));break}}}return g}function c(l,d,h,g,w){let E=w?[]:void 0;return l.inEdges(g.v).forEach(_=>{let b=l.edge(_),p=l.node(_.v);w&&E.push({v:_.v,w:_.w}),p.out-=b,u(d,h,p)}),l.outEdges(g.v).forEach(_=>{let b=l.edge(_),p=_.w,y=l.node(p);y.in-=b,u(d,h,y)}),l.removeNode(g.v),E}function a(l,d){let h=new n,g=0,w=0;l.nodes().forEach(b=>{h.setNode(b,{v:b,in:0,out:0})}),l.edges().forEach(b=>{let p=h.edge(b.v,b.w)||0,y=d(b),T=p+y;h.setEdge(b.v,b.w,T),w=Math.max(w,h.node(b.v).out+=y),g=Math.max(g,h.node(b.w).in+=y)});let E=f(w+g+3).map(()=>new r),_=g+1;return h.nodes().forEach(b=>{u(E,_,h.node(b))}),{graph:h,buckets:E,zeroIdx:_}}function u(l,d,h){h.out?h.in?l[h.out-h.in+d].enqueue(h):l[l.length-1].enqueue(h):l[0].enqueue(h)}function f(l){let d=[];for(let h=0;h<l;h++)d.push(h);return d}}),ae=oe((e,t)=>{var n=ve().Graph;t.exports={addBorderNode:d,addDummyNode:r,applyWithChunking:w,asNonCompoundGraph:i,buildLayerMatrix:u,intersectRect:a,mapValues:H,maxRank:E,normalizeRanks:f,notime:p,partition:_,pick:I,predecessorWeights:c,range:k,removeEmptyRanks:l,simplify:o,successorWeights:s,time:b,uniqueId:T,zipObject:F};function r(j,C,R,D){for(var x=D;j.hasNode(x);)x=T(D);return R.dummy=C,j.setNode(x,R),x}function o(j){let C=new n().setGraph(j.graph());return j.nodes().forEach(R=>C.setNode(R,j.node(R))),j.edges().forEach(R=>{let D=C.edge(R.v,R.w)||{weight:0,minlen:1},x=j.edge(R);C.setEdge(R.v,R.w,{weight:D.weight+x.weight,minlen:Math.max(D.minlen,x.minlen)})}),C}function i(j){let C=new n({multigraph:j.isMultigraph()}).setGraph(j.graph());return j.nodes().forEach(R=>{j.children(R).length||C.setNode(R,j.node(R))}),j.edges().forEach(R=>{C.setEdge(R,j.edge(R))}),C}function s(j){let C=j.nodes().map(R=>{let D={};return j.outEdges(R).forEach(x=>{D[x.w]=(D[x.w]||0)+j.edge(x).weight}),D});return F(j.nodes(),C)}function c(j){let C=j.nodes().map(R=>{let D={};return j.inEdges(R).forEach(x=>{D[x.v]=(D[x.v]||0)+j.edge(x).weight}),D});return F(j.nodes(),C)}function a(j,C){let R=j.x,D=j.y,x=C.x-R,L=C.y-D,N=j.width/2,P=j.height/2;if(!x&&!L)throw new Error("Not possible to find intersection inside of the rectangle");let A,O;return Math.abs(L)*N>Math.abs(x)*P?(L<0&&(P=-P),A=P*x/L,O=P):(x<0&&(N=-N),A=N,O=N*L/x),{x:R+A,y:D+O}}function u(j){let C=k(E(j)+1).map(()=>[]);return j.nodes().forEach(R=>{let D=j.node(R),x=D.rank;x!==void 0&&(C[x][D.order]=R)}),C}function f(j){let C=j.nodes().map(D=>{let x=j.node(D).rank;return x===void 0?Number.MAX_VALUE:x}),R=w(Math.min,C);j.nodes().forEach(D=>{let x=j.node(D);Object.hasOwn(x,"rank")&&(x.rank-=R)})}function l(j){let C=j.nodes().map(N=>j.node(N).rank).filter(N=>N!==void 0),R=w(Math.min,C),D=[];j.nodes().forEach(N=>{let P=j.node(N).rank-R;D[P]||(D[P]=[]),D[P].push(N)});let x=0,L=j.graph().nodeRankFactor;Array.from(D).forEach((N,P)=>{N===void 0&&P%L!==0?--x:N!==void 0&&x&&N.forEach(A=>j.node(A).rank+=x)})}function d(j,C,R,D){let x={width:0,height:0};return arguments.length>=4&&(x.rank=R,x.order=D),r(j,"border",x,C)}function h(j,C=g){let R=[];for(let D=0;D<j.length;D+=C){let x=j.slice(D,D+C);R.push(x)}return R}var g=65535;function w(j,C){if(C.length>g){let R=h(C);return j.apply(null,R.map(D=>j.apply(null,D)))}else return j.apply(null,C)}function E(j){let C=j.nodes().map(R=>{let D=j.node(R).rank;return D===void 0?Number.MIN_VALUE:D});return w(Math.max,C)}function _(j,C){let R={lhs:[],rhs:[]};return j.forEach(D=>{C(D)?R.lhs.push(D):R.rhs.push(D)}),R}function b(j,C){let R=Date.now();try{return C()}finally{console.log(j+" time: "+(Date.now()-R)+"ms")}}function p(j,C){return C()}var y=0;function T(j){var C=++y;return j+(""+C)}function k(j,C,R=1){C==null&&(C=j,j=0);let D=L=>L<C;R<0&&(D=L=>C<L);let x=[];for(let L=j;D(L);L+=R)x.push(L);return x}function I(j,C){let R={};for(let D of C)j[D]!==void 0&&(R[D]=j[D]);return R}function H(j,C){let R=C;return typeof C=="string"&&(R=D=>D[C]),Object.entries(j).reduce((D,[x,L])=>(D[x]=R(L,x),D),{})}function F(j,C){return j.reduce((R,D,x)=>(R[D]=C[x],R),{})}}),Lg=oe((e,t)=>{var n=$g(),r=ae().uniqueId;t.exports={run:o,undo:s};function o(c){(c.graph().acyclicer==="greedy"?n(c,a(c)):i(c)).forEach(u=>{let f=c.edge(u);c.removeEdge(u),f.forwardName=u.name,f.reversed=!0,c.setEdge(u.w,u.v,f,r("rev"))});function a(u){return f=>u.edge(f).weight}}function i(c){let a=[],u={},f={};function l(d){Object.hasOwn(f,d)||(f[d]=!0,u[d]=!0,c.outEdges(d).forEach(h=>{Object.hasOwn(u,h.w)?a.push(h):l(h.w)}),delete u[d])}return c.nodes().forEach(l),a}function s(c){c.edges().forEach(a=>{let u=c.edge(a);if(u.reversed){c.removeEdge(a);let f=u.forwardName;delete u.reversed,delete u.forwardName,c.setEdge(a.w,a.v,u,f)}})}}),Dg=oe((e,t)=>{var n=ae();t.exports={run:r,undo:i};function r(s){s.graph().dummyChains=[],s.edges().forEach(c=>o(s,c))}function o(s,c){let a=c.v,u=s.node(a).rank,f=c.w,l=s.node(f).rank,d=c.name,h=s.edge(c),g=h.labelRank;if(l===u+1)return;s.removeEdge(c);let w,E,_;for(_=0,++u;u<l;++_,++u)h.points=[],E={width:0,height:0,edgeLabel:h,edgeObj:c,rank:u},w=n.addDummyNode(s,"edge",E,"_d"),u===g&&(E.width=h.width,E.height=h.height,E.dummy="edge-label",E.labelpos=h.labelpos),s.setEdge(a,w,{weight:h.weight},d),_===0&&s.graph().dummyChains.push(w),a=w;s.setEdge(a,f,{weight:h.weight},d)}function i(s){s.graph().dummyChains.forEach(c=>{let a=s.node(c),u=a.edgeLabel,f;for(s.setEdge(a.edgeObj,u);a.dummy;)f=s.successors(c)[0],s.removeNode(c),u.points.push({x:a.x,y:a.y}),a.dummy==="edge-label"&&(u.x=a.x,u.y=a.y,u.width=a.width,u.height=a.height),c=f,a=s.node(c)})}}),nn=oe((e,t)=>{var{applyWithChunking:n}=ae();t.exports={longestPath:r,slack:o};function r(i){var s={};function c(a){var u=i.node(a);if(Object.hasOwn(s,a))return u.rank;s[a]=!0;let f=i.outEdges(a).map(d=>d==null?Number.POSITIVE_INFINITY:c(d.w)-i.edge(d).minlen);var l=n(Math.min,f);return l===Number.POSITIVE_INFINITY&&(l=0),u.rank=l}i.sources().forEach(c)}function o(i,s){return i.node(s.w).rank-i.node(s.v).rank-i.edge(s).minlen}}),ws=oe((e,t)=>{var n=ve().Graph,r=nn().slack;t.exports=o;function o(a){var u=new n({directed:!1}),f=a.nodes()[0],l=a.nodeCount();u.setNode(f,{});for(var d,h;i(u,a)<l;)d=s(u,a),h=u.hasNode(d.v)?r(a,d):-r(a,d),c(u,a,h);return u}function i(a,u){function f(l){u.nodeEdges(l).forEach(d=>{var h=d.v,g=l===h?d.w:h;!a.hasNode(g)&&!r(u,d)&&(a.setNode(g,{}),a.setEdge(l,g,{}),f(g))})}return a.nodes().forEach(f),a.nodeCount()}function s(a,u){return u.edges().reduce((f,l)=>{let d=Number.POSITIVE_INFINITY;return a.hasNode(l.v)!==a.hasNode(l.w)&&(d=r(u,l)),d<f[0]?[d,l]:f},[Number.POSITIVE_INFINITY,null])[1]}function c(a,u,f){a.nodes().forEach(l=>u.node(l).rank+=f)}}),jg=oe((e,t)=>{var n=ws(),r=nn().slack,o=nn().longestPath,i=ve().alg.preorder,s=ve().alg.postorder,c=ae().simplify;t.exports=a,a.initLowLimValues=d,a.initCutValues=u,a.calcCutValue=l,a.leaveEdge=g,a.enterEdge=w,a.exchangeEdges=E;function a(y){y=c(y),o(y);var T=n(y);d(T),u(T,y);for(var k,I;k=g(T);)I=w(T,y,k),E(T,y,k,I)}function u(y,T){var k=s(y,y.nodes());k=k.slice(0,k.length-1),k.forEach(I=>f(y,T,I))}function f(y,T,k){var I=y.node(k),H=I.parent;y.edge(k,H).cutvalue=l(y,T,k)}function l(y,T,k){var I=y.node(k),H=I.parent,F=!0,j=T.edge(k,H),C=0;return j||(F=!1,j=T.edge(H,k)),C=j.weight,T.nodeEdges(k).forEach(R=>{var D=R.v===k,x=D?R.w:R.v;if(x!==H){var L=D===F,N=T.edge(R).weight;if(C+=L?N:-N,b(y,k,x)){var P=y.edge(k,x).cutvalue;C+=L?-P:P}}}),C}function d(y,T){arguments.length<2&&(T=y.nodes()[0]),h(y,{},1,T)}function h(y,T,k,I,H){var F=k,j=y.node(I);return T[I]=!0,y.neighbors(I).forEach(C=>{Object.hasOwn(T,C)||(k=h(y,T,k,C,I))}),j.low=F,j.lim=k++,H?j.parent=H:delete j.parent,k}function g(y){return y.edges().find(T=>y.edge(T).cutvalue<0)}function w(y,T,k){var I=k.v,H=k.w;T.hasEdge(I,H)||(I=k.w,H=k.v);var F=y.node(I),j=y.node(H),C=F,R=!1;F.lim>j.lim&&(C=j,R=!0);var D=T.edges().filter(x=>R===p(y,y.node(x.v),C)&&R!==p(y,y.node(x.w),C));return D.reduce((x,L)=>r(T,L)<r(T,x)?L:x)}function E(y,T,k,I){var H=k.v,F=k.w;y.removeEdge(H,F),y.setEdge(I.v,I.w,{}),d(y),u(y,T),_(y,T)}function _(y,T){var k=y.nodes().find(H=>!T.node(H).parent),I=i(y,k);I=I.slice(1),I.forEach(H=>{var F=y.node(H).parent,j=T.edge(H,F),C=!1;j||(j=T.edge(F,H),C=!0),T.node(H).rank=T.node(F).rank+(C?j.minlen:-j.minlen)})}function b(y,T,k){return y.hasEdge(T,k)}function p(y,T,k){return k.low<=T.lim&&T.lim<=k.lim}}),zg=oe((e,t)=>{var n=nn(),r=n.longestPath,o=ws(),i=jg();t.exports=s;function s(f){var l=f.graph().ranker;if(l instanceof Function)return l(f);switch(f.graph().ranker){case"network-simplex":u(f);break;case"tight-tree":a(f);break;case"longest-path":c(f);break;case"none":break;default:u(f)}}var c=r;function a(f){r(f),o(f)}function u(f){i(f)}}),Hg=oe((e,t)=>{t.exports=n;function n(i){let s=o(i);i.graph().dummyChains.forEach(c=>{let a=i.node(c),u=a.edgeObj,f=r(i,s,u.v,u.w),l=f.path,d=f.lca,h=0,g=l[h],w=!0;for(;c!==u.w;){if(a=i.node(c),w){for(;(g=l[h])!==d&&i.node(g).maxRank<a.rank;)h++;g===d&&(w=!1)}if(!w){for(;h<l.length-1&&i.node(g=l[h+1]).minRank<=a.rank;)h++;g=l[h]}i.setParent(c,g),c=i.successors(c)[0]}})}function r(i,s,c,a){let u=[],f=[],l=Math.min(s[c].low,s[a].low),d=Math.max(s[c].lim,s[a].lim),h,g;h=c;do h=i.parent(h),u.push(h);while(h&&(s[h].low>l||d>s[h].lim));for(g=h,h=a;(h=i.parent(h))!==g;)f.push(h);return{path:u.concat(f.reverse()),lca:g}}function o(i){let s={},c=0;function a(u){let f=c;i.children(u).forEach(a),s[u]={low:f,lim:c++}}return i.children().forEach(a),s}}),Vg=oe((e,t)=>{var n=ae();t.exports={run:r,cleanup:c};function r(a){let u=n.addDummyNode(a,"root",{},"_root"),f=i(a),l=Object.values(f),d=n.applyWithChunking(Math.max,l)-1,h=2*d+1;a.graph().nestingRoot=u,a.edges().forEach(w=>a.edge(w).minlen*=h);let g=s(a)+1;a.children().forEach(w=>o(a,u,h,g,d,f,w)),a.graph().nodeRankFactor=h}function o(a,u,f,l,d,h,g){let w=a.children(g);if(!w.length){g!==u&&a.setEdge(u,g,{weight:0,minlen:f});return}let E=n.addBorderNode(a,"_bt"),_=n.addBorderNode(a,"_bb"),b=a.node(g);a.setParent(E,g),b.borderTop=E,a.setParent(_,g),b.borderBottom=_,w.forEach(p=>{o(a,u,f,l,d,h,p);let y=a.node(p),T=y.borderTop?y.borderTop:p,k=y.borderBottom?y.borderBottom:p,I=y.borderTop?l:2*l,H=T!==k?1:d-h[g]+1;a.setEdge(E,T,{weight:I,minlen:H,nestingEdge:!0}),a.setEdge(k,_,{weight:I,minlen:H,nestingEdge:!0})}),a.parent(g)||a.setEdge(u,E,{weight:0,minlen:d+h[g]})}function i(a){var u={};function f(l,d){var h=a.children(l);h&&h.length&&h.forEach(g=>f(g,d+1)),u[l]=d}return a.children().forEach(l=>f(l,1)),u}function s(a){return a.edges().reduce((u,f)=>u+a.edge(f).weight,0)}function c(a){var u=a.graph();a.removeNode(u.nestingRoot),delete u.nestingRoot,a.edges().forEach(f=>{var l=a.edge(f);l.nestingEdge&&a.removeEdge(f)})}}),Bg=oe((e,t)=>{var n=ae();t.exports=r;function r(i){function s(c){let a=i.children(c),u=i.node(c);if(a.length&&a.forEach(s),Object.hasOwn(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(let f=u.minRank,l=u.maxRank+1;f<l;++f)o(i,"borderLeft","_bl",c,u,f),o(i,"borderRight","_br",c,u,f)}}i.children().forEach(s)}function o(i,s,c,a,u,f){let l={width:0,height:0,rank:f,borderType:s},d=u[s][f-1],h=n.addDummyNode(i,"border",l,c);u[s][f]=h,i.setParent(h,a),d&&i.setEdge(d,h,{weight:1})}}),Fg=oe((e,t)=>{t.exports={adjust:n,undo:r};function n(f){let l=f.graph().rankdir.toLowerCase();(l==="lr"||l==="rl")&&o(f)}function r(f){let l=f.graph().rankdir.toLowerCase();(l==="bt"||l==="rl")&&s(f),(l==="lr"||l==="rl")&&(a(f),o(f))}function o(f){f.nodes().forEach(l=>i(f.node(l))),f.edges().forEach(l=>i(f.edge(l)))}function i(f){let l=f.width;f.width=f.height,f.height=l}function s(f){f.nodes().forEach(l=>c(f.node(l))),f.edges().forEach(l=>{let d=f.edge(l);d.points.forEach(c),Object.hasOwn(d,"y")&&c(d)})}function c(f){f.y=-f.y}function a(f){f.nodes().forEach(l=>u(f.node(l))),f.edges().forEach(l=>{let d=f.edge(l);d.points.forEach(u),Object.hasOwn(d,"x")&&u(d)})}function u(f){let l=f.x;f.x=f.y,f.y=l}}),Yg=oe((e,t)=>{var n=ae();t.exports=r;function r(o){let i={},s=o.nodes().filter(l=>!o.children(l).length),c=s.map(l=>o.node(l).rank),a=n.applyWithChunking(Math.max,c),u=n.range(a+1).map(()=>[]);function f(l){if(i[l])return;i[l]=!0;let d=o.node(l);u[d.rank].push(l),o.successors(l).forEach(f)}return s.sort((l,d)=>o.node(l).rank-o.node(d).rank).forEach(f),u}}),Xg=oe((e,t)=>{var n=ae().zipObject;t.exports=r;function r(i,s){let c=0;for(let a=1;a<s.length;++a)c+=o(i,s[a-1],s[a]);return c}function o(i,s,c){let a=n(c,c.map((g,w)=>w)),u=s.flatMap(g=>i.outEdges(g).map(w=>({pos:a[w.w],weight:i.edge(w).weight})).sort((w,E)=>w.pos-E.pos)),f=1;for(;f<c.length;)f<<=1;let l=2*f-1;f-=1;let d=new Array(l).fill(0),h=0;return u.forEach(g=>{let w=g.pos+f;d[w]+=g.weight;let E=0;for(;w>0;)w%2&&(E+=d[w+1]),w=w-1>>1,d[w]+=g.weight;h+=g.weight*E}),h}}),Wg=oe((e,t)=>{t.exports=n;function n(r,o=[]){return o.map(i=>{let s=r.inEdges(i);if(s.length){let c=s.reduce((a,u)=>{let f=r.edge(u),l=r.node(u.v);return{sum:a.sum+f.weight*l.order,weight:a.weight+f.weight}},{sum:0,weight:0});return{v:i,barycenter:c.sum/c.weight,weight:c.weight}}else return{v:i}})}}),Gg=oe((e,t)=>{var n=ae();t.exports=r;function r(s,c){let a={};s.forEach((f,l)=>{let d=a[f.v]={indegree:0,in:[],out:[],vs:[f.v],i:l};f.barycenter!==void 0&&(d.barycenter=f.barycenter,d.weight=f.weight)}),c.edges().forEach(f=>{let l=a[f.v],d=a[f.w];l!==void 0&&d!==void 0&&(d.indegree++,l.out.push(a[f.w]))});let u=Object.values(a).filter(f=>!f.indegree);return o(u)}function o(s){let c=[];function a(f){return l=>{l.merged||(l.barycenter===void 0||f.barycenter===void 0||l.barycenter>=f.barycenter)&&i(f,l)}}function u(f){return l=>{l.in.push(f),--l.indegree===0&&s.push(l)}}for(;s.length;){let f=s.pop();c.push(f),f.in.reverse().forEach(a(f)),f.out.forEach(u(f))}return c.filter(f=>!f.merged).map(f=>n.pick(f,["vs","i","barycenter","weight"]))}function i(s,c){let a=0,u=0;s.weight&&(a+=s.barycenter*s.weight,u+=s.weight),c.weight&&(a+=c.barycenter*c.weight,u+=c.weight),s.vs=c.vs.concat(s.vs),s.barycenter=a/u,s.weight=u,s.i=Math.min(c.i,s.i),c.merged=!0}}),qg=oe((e,t)=>{var n=ae();t.exports=r;function r(s,c){let a=n.partition(s,E=>Object.hasOwn(E,"barycenter")),u=a.lhs,f=a.rhs.sort((E,_)=>_.i-E.i),l=[],d=0,h=0,g=0;u.sort(i(!!c)),g=o(l,f,g),u.forEach(E=>{g+=E.vs.length,l.push(E.vs),d+=E.barycenter*E.weight,h+=E.weight,g=o(l,f,g)});let w={vs:l.flat(!0)};return h&&(w.barycenter=d/h,w.weight=h),w}function o(s,c,a){let u;for(;c.length&&(u=c[c.length-1]).i<=a;)c.pop(),s.push(u.vs),a++;return a}function i(s){return(c,a)=>c.barycenter<a.barycenter?-1:c.barycenter>a.barycenter?1:s?a.i-c.i:c.i-a.i}}),Ug=oe((e,t)=>{var n=Wg(),r=Gg(),o=qg();t.exports=i;function i(a,u,f,l){let d=a.children(u),h=a.node(u),g=h?h.borderLeft:void 0,w=h?h.borderRight:void 0,E={};g&&(d=d.filter(y=>y!==g&&y!==w));let _=n(a,d);_.forEach(y=>{if(a.children(y.v).length){let T=i(a,y.v,f,l);E[y.v]=T,Object.hasOwn(T,"barycenter")&&c(y,T)}});let b=r(_,f);s(b,E);let p=o(b,l);if(g&&(p.vs=[g,p.vs,w].flat(!0),a.predecessors(g).length)){let y=a.node(a.predecessors(g)[0]),T=a.node(a.predecessors(w)[0]);Object.hasOwn(p,"barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+y.order+T.order)/(p.weight+2),p.weight+=2}return p}function s(a,u){a.forEach(f=>{f.vs=f.vs.flatMap(l=>u[l]?u[l].vs:l)})}function c(a,u){a.barycenter!==void 0?(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight):(a.barycenter=u.barycenter,a.weight=u.weight)}}),Kg=oe((e,t)=>{var n=ve().Graph,r=ae();t.exports=o;function o(s,c,a,u){u||(u=s.nodes());let f=i(s),l=new n({compound:!0}).setGraph({root:f}).setDefaultNodeLabel(d=>s.node(d));return u.forEach(d=>{let h=s.node(d),g=s.parent(d);(h.rank===c||h.minRank<=c&&c<=h.maxRank)&&(l.setNode(d),l.setParent(d,g||f),s[a](d).forEach(w=>{let E=w.v===d?w.w:w.v,_=l.edge(E,d),b=_!==void 0?_.weight:0;l.setEdge(E,d,{weight:s.edge(w).weight+b})}),Object.hasOwn(h,"minRank")&&l.setNode(d,{borderLeft:h.borderLeft[c],borderRight:h.borderRight[c]}))}),l}function i(s){for(var c;s.hasNode(c=r.uniqueId("_root")););return c}}),Zg=oe((e,t)=>{t.exports=n;function n(r,o,i){let s={},c;i.forEach(a=>{let u=r.parent(a),f,l;for(;u;){if(f=r.parent(u),f?(l=s[f],s[f]=u):(l=c,c=u),l&&l!==u){o.setEdge(l,u);return}u=f}})}}),Qg=oe((e,t)=>{var n=Yg(),r=Xg(),o=Ug(),i=Kg(),s=Zg(),c=ve().Graph,a=ae();t.exports=u;function u(h,g={}){if(typeof g.customOrder=="function"){g.customOrder(h,u);return}let w=a.maxRank(h),E=f(h,a.range(1,w+1),"inEdges"),_=f(h,a.range(w-1,-1,-1),"outEdges"),b=n(h);if(d(h,b),g.disableOptimalOrderHeuristic)return;let p=Number.POSITIVE_INFINITY,y,T=g.constraints||[];for(let k=0,I=0;I<4;++k,++I){l(k%2?E:_,k%4>=2,T),b=a.buildLayerMatrix(h);let H=r(h,b);H<p?(I=0,y=Object.assign({},b),p=H):H===p&&(y=structuredClone(b))}d(h,y)}function f(h,g,w){let E=new Map,_=(b,p)=>{E.has(b)||E.set(b,[]),E.get(b).push(p)};for(let b of h.nodes()){let p=h.node(b);if(typeof p.rank=="number"&&_(p.rank,b),typeof p.minRank=="number"&&typeof p.maxRank=="number")for(let y=p.minRank;y<=p.maxRank;y++)y!==p.rank&&_(y,b)}return g.map(function(b){return i(h,b,w,E.get(b)||[])})}function l(h,g,w){let E=new c;h.forEach(function(_){w.forEach(y=>E.setEdge(y.left,y.right));let b=_.graph().root,p=o(_,b,E,g);p.vs.forEach((y,T)=>_.node(y).order=T),s(_,E,p.vs)})}function d(h,g){Object.values(g).forEach(w=>w.forEach((E,_)=>h.node(E).order=_))}}),Jg=oe((e,t)=>{var n=ve().Graph,r=ae();t.exports={positionX:w,findType1Conflicts:o,findType2Conflicts:i,addConflict:c,hasConflict:a,verticalAlignment:u,horizontalCompaction:f,alignCoordinates:h,findSmallestWidthAlignment:d,balance:g};function o(b,p){let y={};function T(k,I){let H=0,F=0,j=k.length,C=I[I.length-1];return I.forEach((R,D)=>{let x=s(b,R),L=x?b.node(x).order:j;(x||R===C)&&(I.slice(F,D+1).forEach(N=>{b.predecessors(N).forEach(P=>{let A=b.node(P),O=A.order;(O<H||L<O)&&!(A.dummy&&b.node(N).dummy)&&c(y,P,N)})}),F=D+1,H=L)}),I}return p.length&&p.reduce(T),y}function i(b,p){let y={};function T(I,H,F,j,C){let R;r.range(H,F).forEach(D=>{R=I[D],b.node(R).dummy&&b.predecessors(R).forEach(x=>{let L=b.node(x);L.dummy&&(L.order<j||L.order>C)&&c(y,x,R)})})}function k(I,H){let F=-1,j,C=0;return H.forEach((R,D)=>{if(b.node(R).dummy==="border"){let x=b.predecessors(R);x.length&&(j=b.node(x[0]).order,T(H,C,D,F,j),C=D,F=j)}T(H,C,H.length,j,I.length)}),H}return p.length&&p.reduce(k),y}function s(b,p){if(b.node(p).dummy)return b.predecessors(p).find(y=>b.node(y).dummy)}function c(b,p,y){if(p>y){let k=p;p=y,y=k}let T=b[p];T||(b[p]=T={}),T[y]=!0}function a(b,p,y){if(p>y){let T=p;p=y,y=T}return!!b[p]&&Object.hasOwn(b[p],y)}function u(b,p,y,T){let k={},I={},H={};return p.forEach(F=>{F.forEach((j,C)=>{k[j]=j,I[j]=j,H[j]=C})}),p.forEach(F=>{let j=-1;F.forEach(C=>{let R=T(C);if(R.length){R=R.sort((x,L)=>H[x]-H[L]);let D=(R.length-1)/2;for(let x=Math.floor(D),L=Math.ceil(D);x<=L;++x){let N=R[x];I[C]===C&&j<H[N]&&!a(y,C,N)&&(I[N]=C,I[C]=k[C]=k[N],j=H[N])}}})}),{root:k,align:I}}function f(b,p,y,T,k){let I={},H=l(b,p,y,k),F=k?"borderLeft":"borderRight";function j(D,x){let L=H.nodes().slice(),N={},P=L.pop();for(;P;){if(N[P])D(P);else{N[P]=!0,L.push(P);for(let A of x(P))L.push(A)}P=L.pop()}}function C(D){I[D]=H.inEdges(D).reduce((x,L)=>Math.max(x,I[L.v]+H.edge(L)),0)}function R(D){let x=H.outEdges(D).reduce((N,P)=>Math.min(N,I[P.w]-H.edge(P)),Number.POSITIVE_INFINITY),L=b.node(D);x!==Number.POSITIVE_INFINITY&&L.borderType!==F&&(I[D]=Math.max(I[D],x))}return j(C,H.predecessors.bind(H)),j(R,H.successors.bind(H)),Object.keys(T).forEach(D=>I[D]=I[y[D]]),I}function l(b,p,y,T){let k=new n,I=b.graph(),H=E(I.nodesep,I.edgesep,T);return p.forEach(F=>{let j;F.forEach(C=>{let R=y[C];if(k.setNode(R),j){var D=y[j],x=k.edge(D,R);k.setEdge(D,R,Math.max(H(b,C,j),x||0))}j=C})}),k}function d(b,p){return Object.values(p).reduce((y,T)=>{let k=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;Object.entries(T).forEach(([F,j])=>{let C=_(b,F)/2;k=Math.max(j+C,k),I=Math.min(j-C,I)});let H=k-I;return H<y[0]&&(y=[H,T]),y},[Number.POSITIVE_INFINITY,null])[1]}function h(b,p){let y=Object.values(p),T=r.applyWithChunking(Math.min,y),k=r.applyWithChunking(Math.max,y);["u","d"].forEach(I=>{["l","r"].forEach(H=>{let F=I+H,j=b[F];if(j===p)return;let C=Object.values(j),R=T-r.applyWithChunking(Math.min,C);H!=="l"&&(R=k-r.applyWithChunking(Math.max,C)),R&&(b[F]=r.mapValues(j,D=>D+R))})})}function g(b,p){return r.mapValues(b.ul,(y,T)=>{if(p)return b[p.toLowerCase()][T];{let k=Object.values(b).map(I=>I[T]).sort((I,H)=>I-H);return(k[1]+k[2])/2}})}function w(b){let p=r.buildLayerMatrix(b),y=Object.assign(o(b,p),i(b,p)),T={},k;["u","d"].forEach(H=>{k=H==="u"?p:Object.values(p).reverse(),["l","r"].forEach(F=>{F==="r"&&(k=k.map(D=>Object.values(D).reverse()));let j=(H==="u"?b.predecessors:b.successors).bind(b),C=u(b,k,y,j),R=f(b,k,C.root,C.align,F==="r");F==="r"&&(R=r.mapValues(R,D=>-D)),T[H+F]=R})});let I=d(b,T);return h(T,I),g(T,b.graph().align)}function E(b,p,y){return(T,k,I)=>{let H=T.node(k),F=T.node(I),j=0,C;if(j+=H.width/2,Object.hasOwn(H,"labelpos"))switch(H.labelpos.toLowerCase()){case"l":C=-H.width/2;break;case"r":C=H.width/2;break}if(C&&(j+=y?C:-C),C=0,j+=(H.dummy?p:b)/2,j+=(F.dummy?p:b)/2,j+=F.width/2,Object.hasOwn(F,"labelpos"))switch(F.labelpos.toLowerCase()){case"l":C=F.width/2;break;case"r":C=-F.width/2;break}return C&&(j+=y?C:-C),C=0,j}}function _(b,p){return b.node(p).width}}),ep=oe((e,t)=>{var n=ae(),r=Jg().positionX;t.exports=o;function o(s){s=n.asNonCompoundGraph(s),i(s),Object.entries(r(s)).forEach(([c,a])=>s.node(c).x=a)}function i(s){let c=n.buildLayerMatrix(s),a=s.graph().ranksep,u=s.graph().rankalign,f=0;c.forEach(l=>{let d=l.reduce((h,g)=>{let w=s.node(g).height;return h>w?h:w},0);l.forEach(h=>{let g=s.node(h);u==="top"?g.y=f+g.height/2:u==="bottom"?g.y=f+d-g.height/2:g.y=f+d/2}),f+=d+a})}}),tp=oe((e,t)=>{var n=Lg(),r=Dg(),o=zg(),i=ae().normalizeRanks,s=Hg(),c=ae().removeEmptyRanks,a=Vg(),u=Bg(),f=Fg(),l=Qg(),d=ep(),h=ae(),g=ve().Graph;t.exports=w;function w(v,$={}){let z=$.debugTiming?h.time:h.notime;return z("layout",()=>{let V=z(" buildLayoutGraph",()=>j(v));return z(" runLayout",()=>E(V,z,$)),z(" updateInputGraph",()=>_(v,V)),V})}function E(v,$,z){$(" makeSpaceForEdgeLabels",()=>C(v)),$(" removeSelfEdges",()=>B(v)),$(" acyclic",()=>n.run(v)),$(" nestingGraph.run",()=>a.run(v)),$(" rank",()=>o(h.asNonCompoundGraph(v))),$(" injectEdgeLabelProxies",()=>R(v)),$(" removeEmptyRanks",()=>c(v)),$(" nestingGraph.cleanup",()=>a.cleanup(v)),$(" normalizeRanks",()=>i(v)),$(" assignRankMinMax",()=>D(v)),$(" removeEdgeLabelProxies",()=>x(v)),$(" normalize.run",()=>r.run(v)),$(" parentDummyChains",()=>s(v)),$(" addBorderSegments",()=>u(v)),$(" order",()=>l(v,z)),$(" insertSelfEdges",()=>m(v)),$(" adjustCoordinateSystem",()=>f.adjust(v)),$(" position",()=>d(v)),$(" positionSelfEdges",()=>M(v)),$(" removeBorderNodes",()=>O(v)),$(" normalize.undo",()=>r.undo(v)),$(" fixupEdgeLabelCoords",()=>P(v)),$(" undoCoordinateSystem",()=>f.undo(v)),$(" translateGraph",()=>L(v)),$(" assignNodeIntersects",()=>N(v)),$(" reversePoints",()=>A(v)),$(" acyclic.undo",()=>n.undo(v))}function _(v,$){v.nodes().forEach(z=>{let V=v.node(z),X=$.node(z);V&&(V.x=X.x,V.y=X.y,V.order=X.order,V.rank=X.rank,$.children(z).length&&(V.width=X.width,V.height=X.height))}),v.edges().forEach(z=>{let V=v.edge(z),X=$.edge(z);V.points=X.points,Object.hasOwn(X,"x")&&(V.x=X.x,V.y=X.y)}),v.graph().width=$.graph().width,v.graph().height=$.graph().height}var b=["nodesep","edgesep","ranksep","marginx","marginy"],p={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},y=["acyclicer","ranker","rankdir","align","rankalign"],T=["width","height","rank"],k={width:0,height:0},I=["minlen","weight","width","height","labeloffset"],H={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},F=["labelpos"];function j(v){let $=new g({multigraph:!0,compound:!0}),z=S(v.graph());return $.setGraph(Object.assign({},p,Y(z,b),h.pick(z,y))),v.nodes().forEach(V=>{let X=S(v.node(V)),q=Y(X,T);Object.keys(k).forEach(U=>{q[U]===void 0&&(q[U]=k[U])}),$.setNode(V,q),$.setParent(V,v.parent(V))}),v.edges().forEach(V=>{let X=S(v.edge(V));$.setEdge(V,Object.assign({},H,Y(X,I),h.pick(X,F)))}),$}function C(v){let $=v.graph();$.ranksep/=2,v.edges().forEach(z=>{let V=v.edge(z);V.minlen*=2,V.labelpos.toLowerCase()!=="c"&&($.rankdir==="TB"||$.rankdir==="BT"?V.width+=V.labeloffset:V.height+=V.labeloffset)})}function R(v){v.edges().forEach($=>{let z=v.edge($);if(z.width&&z.height){let V=v.node($.v),X={rank:(v.node($.w).rank-V.rank)/2+V.rank,e:$};h.addDummyNode(v,"edge-proxy",X,"_ep")}})}function D(v){let $=0;v.nodes().forEach(z=>{let V=v.node(z);V.borderTop&&(V.minRank=v.node(V.borderTop).rank,V.maxRank=v.node(V.borderBottom).rank,$=Math.max($,V.maxRank))}),v.graph().maxRank=$}function x(v){v.nodes().forEach($=>{let z=v.node($);z.dummy==="edge-proxy"&&(v.edge(z.e).labelRank=z.rank,v.removeNode($))})}function L(v){let $=Number.POSITIVE_INFINITY,z=0,V=Number.POSITIVE_INFINITY,X=0,q=v.graph(),U=q.marginx||0,K=q.marginy||0;function Z(J){let te=J.x,ne=J.y,ue=J.width,ge=J.height;$=Math.min($,te-ue/2),z=Math.max(z,te+ue/2),V=Math.min(V,ne-ge/2),X=Math.max(X,ne+ge/2)}v.nodes().forEach(J=>Z(v.node(J))),v.edges().forEach(J=>{let te=v.edge(J);Object.hasOwn(te,"x")&&Z(te)}),$-=U,V-=K,v.nodes().forEach(J=>{let te=v.node(J);te.x-=$,te.y-=V}),v.edges().forEach(J=>{let te=v.edge(J);te.points.forEach(ne=>{ne.x-=$,ne.y-=V}),Object.hasOwn(te,"x")&&(te.x-=$),Object.hasOwn(te,"y")&&(te.y-=V)}),q.width=z-$+U,q.height=X-V+K}function N(v){v.edges().forEach($=>{let z=v.edge($),V=v.node($.v),X=v.node($.w),q,U;z.points?(q=z.points[0],U=z.points[z.points.length-1]):(z.points=[],q=X,U=V),z.points.unshift(h.intersectRect(V,q)),z.points.push(h.intersectRect(X,U))})}function P(v){v.edges().forEach($=>{let z=v.edge($);if(Object.hasOwn(z,"x"))switch((z.labelpos==="l"||z.labelpos==="r")&&(z.width-=z.labeloffset),z.labelpos){case"l":z.x-=z.width/2+z.labeloffset;break;case"r":z.x+=z.width/2+z.labeloffset;break}})}function A(v){v.edges().forEach($=>{let z=v.edge($);z.reversed&&z.points.reverse()})}function O(v){v.nodes().forEach($=>{if(v.children($).length){let z=v.node($),V=v.node(z.borderTop),X=v.node(z.borderBottom),q=v.node(z.borderLeft[z.borderLeft.length-1]),U=v.node(z.borderRight[z.borderRight.length-1]);z.width=Math.abs(U.x-q.x),z.height=Math.abs(X.y-V.y),z.x=q.x+z.width/2,z.y=V.y+z.height/2}}),v.nodes().forEach($=>{v.node($).dummy==="border"&&v.removeNode($)})}function B(v){v.edges().forEach($=>{if($.v===$.w){var z=v.node($.v);z.selfEdges||(z.selfEdges=[]),z.selfEdges.push({e:$,label:v.edge($)}),v.removeEdge($)}})}function m(v){var $=h.buildLayerMatrix(v);$.forEach(z=>{var V=0;z.forEach((X,q)=>{var U=v.node(X);U.order=q+V,(U.selfEdges||[]).forEach(K=>{h.addDummyNode(v,"selfedge",{width:K.label.width,height:K.label.height,rank:U.rank,order:q+ ++V,e:K.e,label:K.label},"_se")}),delete U.selfEdges})})}function M(v){v.nodes().forEach($=>{var z=v.node($);if(z.dummy==="selfedge"){var V=v.node(z.e.v),X=V.x+V.width/2,q=V.y,U=z.x-X,K=V.height/2;v.setEdge(z.e,z.label),v.removeNode($),z.label.points=[{x:X+2*U/3,y:q-K},{x:X+5*U/6,y:q-K},{x:X+U,y:q},{x:X+5*U/6,y:q+K},{x:X+2*U/3,y:q+K}],z.label.x=z.x,z.label.y=z.y}})}function Y(v,$){return h.mapValues(h.pick(v,$),Number)}function S(v){var $={};return v&&Object.entries(v).forEach(([z,V])=>{typeof z=="string"&&(z=z.toLowerCase()),$[z]=V}),$}}),np=oe((e,t)=>{var n=ae(),r=ve().Graph;t.exports={debugOrdering:o};function o(i){let s=n.buildLayerMatrix(i),c=new r({compound:!0,multigraph:!0}).setGraph({});return i.nodes().forEach(a=>{c.setNode(a,{label:a}),c.setParent(a,"layer"+i.node(a).rank)}),i.edges().forEach(a=>c.setEdge(a.v,a.w,{},a.name)),s.forEach((a,u)=>{let f="layer"+u;c.setNode(f,{rank:"same"}),a.reduce((l,d)=>(c.setEdge(l,d,{style:"invis"}),d))}),c}}),rp=oe((e,t)=>{t.exports="2.0.4"}),op=oe((e,t)=>{t.exports={graphlib:ve(),layout:tp(),debug:np(),util:{time:ae().time,notime:ae().notime},version:rp()}});const up=op();/*! For license information please see dagre.esm.js.LEGAL.txt */export{sp as B,ap as C,en as H,cp as M,Q as P,Ia as a,G as b,Oe as c,up as d,on as e,un as f,$o as g,ip as i,W as j,rn as r,de as s,ii as t,fi as z};
|