@xyflow/react 12.5.6 → 12.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts +1 -1
- package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/types.d.ts +7 -2
- package/dist/esm/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/esm/components/ReactFlowProvider/index.d.ts +33 -2
- package/dist/esm/components/ReactFlowProvider/index.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/Wrapper.d.ts +5 -2
- package/dist/esm/container/ReactFlow/Wrapper.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/esm/index.js +43 -18
- package/dist/esm/index.mjs +43 -18
- package/dist/esm/store/index.d.ts +5 -2
- package/dist/esm/store/index.d.ts.map +1 -1
- package/dist/esm/store/initialState.d.ts +5 -2
- package/dist/esm/store/initialState.d.ts.map +1 -1
- package/dist/esm/utils/changes.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts +1 -1
- package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/types.d.ts +7 -2
- package/dist/umd/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/umd/components/ReactFlowProvider/index.d.ts +33 -2
- package/dist/umd/components/ReactFlowProvider/index.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/Wrapper.d.ts +5 -2
- package/dist/umd/container/ReactFlow/Wrapper.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/store/index.d.ts +5 -2
- package/dist/umd/store/index.d.ts.map +1 -1
- package/dist/umd/store/initialState.d.ts +5 -2
- package/dist/umd/store/initialState.d.ts.map +1 -1
- package/dist/umd/utils/changes.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/umd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactFlow={},e.jsxRuntime,e.React,e.ReactDOM)}(this,(function(e,t,n,o){"use strict";function r(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=r(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var i={value:()=>{}};function s(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new a(o)}function a(e){this._=e}function l(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function c(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=i,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}a.prototype=s.prototype={constructor:a,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++s<a;)if(n=(e=i[s]).type)r[n]=c(r[n],e.name,t);else if(null==t)for(n in r)r[n]=c(r[n],e.name,null);return this}for(;++s<a;)if((n=(e=i[s]).type)&&(n=l(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new a(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};var u="http://www.w3.org/1999/xhtml",d={svg:"http://www.w3.org/2000/svg",xhtml:u,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function h(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),d.hasOwnProperty(t)?{space:d[t],local:e}:e}function f(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===u&&t.documentElement.namespaceURI===u?t.createElement(e):t.createElementNS(n,e)}}function g(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function p(e){var t=h(e);return(t.local?g:f)(t)}function m(){}function y(e){return null==e?m:function(){return this.querySelector(e)}}function v(){return[]}function x(e){return null==e?v:function(){return this.querySelectorAll(e)}}function w(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function b(e){return function(){return this.matches(e)}}function S(e){return function(t){return t.matches(e)}}var C=Array.prototype.find;function E(){return this.firstElementChild}var k=Array.prototype.filter;function N(){return Array.from(this.children)}function M(e){return new Array(e.length)}function _(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function P(e,t,n,o,r,i){for(var s,a=0,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],o[a]=s):n[a]=new _(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function z(e,t,n,o,r,i,s){var a,l,c,u=new Map,d=t.length,h=i.length,f=new Array(d);for(a=0;a<d;++a)(l=t[a])&&(f[a]=c=s.call(l,l.__data__,a,t)+"",u.has(c)?r[a]=l:u.set(c,l));for(a=0;a<h;++a)c=s.call(e,i[a],a,i)+"",(l=u.get(c))?(o[a]=l,l.__data__=i[a],u.delete(c)):n[a]=new _(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&u.get(f[a])===l&&(r[a]=l)}function O(e){return e.__data__}function A(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function R(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function I(e){return function(){this.removeAttribute(e)}}function D(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $(e,t){return function(){this.setAttribute(e,t)}}function L(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function B(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function T(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function V(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function j(e){return function(){this.style.removeProperty(e)}}function H(e,t,n){return function(){this.style.setProperty(e,t,n)}}function X(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Y(e,t){return e.style.getPropertyValue(t)||V(e).getComputedStyle(e,null).getPropertyValue(t)}function Z(e){return function(){delete this[e]}}function W(e,t){return function(){this[e]=t}}function F(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function K(e){return e.trim().split(/^|\s+/)}function G(e){return e.classList||new q(e)}function q(e){this._node=e,this._names=K(e.getAttribute("class")||"")}function U(e,t){for(var n=G(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Q(e,t){for(var n=G(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function J(e){return function(){U(this,e)}}function ee(e){return function(){Q(this,e)}}function te(e,t){return function(){(t.apply(this,arguments)?U:Q)(this,e)}}function ne(){this.textContent=""}function oe(e){return function(){this.textContent=e}}function re(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function ie(){this.innerHTML=""}function se(e){return function(){this.innerHTML=e}}function ae(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function le(){this.nextSibling&&this.parentNode.appendChild(this)}function ce(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ue(){return null}function de(){var e=this.parentNode;e&&e.removeChild(this)}function he(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ge(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function pe(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);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 me(e,t,n){var o=V(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ye(e,t){return function(){return me(this,e,t)}}function ve(e,t){return function(){return me(this,e,t.apply(this,arguments))}}_.prototype={constructor:_,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)}},q.prototype={add:function(e){this._names.indexOf(e)<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}};var xe=[null];function we(e,t){this._groups=e,this._parents=t}function be(){return new we([[document.documentElement]],xe)}function Se(e){return"string"==typeof e?new we([[document.querySelector(e)]],[document.documentElement]):new we([[e]],xe)}function Ce(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}we.prototype=be.prototype={constructor:we,select:function(e){"function"!=typeof e&&(e=y(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s,a=t[r],l=a.length,c=o[r]=new Array(l),u=0;u<l;++u)(i=a[u])&&(s=e.call(i,i.__data__,u,a))&&("__data__"in i&&(s.__data__=i.__data__),c[u]=s);return new we(o,this._parents)},selectAll:function(e){e="function"==typeof e?w(e):x(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s,a=t[i],l=a.length,c=0;c<l;++c)(s=a[c])&&(o.push(e.call(s,s.__data__,c,a)),r.push(s));return new we(o,r)},selectChild:function(e){return this.select(null==e?E:function(e){return function(){return C.call(this.children,e)}}("function"==typeof e?e:S(e)))},selectChildren:function(e){return this.selectAll(null==e?N:function(e){return function(){return k.call(this.children,e)}}("function"==typeof e?e:S(e)))},filter:function(e){"function"!=typeof e&&(e=b(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new we(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,O);var n,o=t?z:P,r=this._parents,i=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var s=i.length,a=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var d=r[u],h=i[u],f=h.length,g=A(e.call(d,d&&d.__data__,u,r)),p=g.length,m=l[u]=new Array(p),y=a[u]=new Array(p);o(d,h,m,y,c[u]=new Array(f),g,t);for(var v,x,w=0,b=0;w<p;++w)if(v=m[w]){for(w>=b&&(b=w+1);!(x=y[b])&&++b<p;);v._next=x||null}}return(a=new we(a,r))._enter=l,a._exit=c,a},enter:function(){return new we(this._enter||this._groups.map(M),this._parents)},exit:function(){return new we(this._exit||this._groups.map(M),this._parents)},join:function(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c,u=n[l],d=o[l],h=u.length,f=a[l]=new Array(h),g=0;g<h;++g)(c=u[g]||d[g])&&(f[g]=c);for(;l<r;++l)a[l]=n[l];return new we(a,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,s=r[i];--i>=0;)(o=r[i])&&(s&&4^o.compareDocumentPosition(s)&&s.parentNode.insertBefore(o,s),s=o);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=R);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s,a=n[i],l=a.length,c=r[i]=new Array(l),u=0;u<l;++u)(s=a[u])&&(c[u]=s);c.sort(t)}return new we(r,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],s=0,a=i.length;s<a;++s)(r=i[s])&&e.call(r,r.__data__,s,i);return this},attr:function(e,t){var n=h(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?D:I:"function"==typeof t?n.local?T:B:n.local?L:$)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?j:"function"==typeof t?X:H)(e,t,null==n?"":n)):Y(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Z:"function"==typeof t?F:W)(e,t)):this.node()[e]},classed:function(e,t){var n=K(e+"");if(arguments.length<2){for(var o=G(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?te:t?J:ee)(n,t))},text:function(e){return arguments.length?this.each(null==e?ne:("function"==typeof e?re:oe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?ie:("function"==typeof e?ae:se)(e)):this.node().innerHTML},raise:function(){return this.each(le)},lower:function(){return this.each(ce)},append:function(e){var t="function"==typeof e?e:p(e);return this.select((function(){return this.appendChild(t.apply(this,arguments))}))},insert:function(e,t){var n="function"==typeof e?e:p(e),o=null==t?ue:"function"==typeof t?t:y(t);return this.select((function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)}))},remove:function(){return this.each(de)},clone:function(e){return this.select(e?fe:he)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}(e+""),s=i.length;if(!(arguments.length<2)){for(a=t?pe:ge,o=0;o<s;++o)this.each(a(i[o],t,n));return this}var a=this.node().__on;if(a)for(var l,c=0,u=a.length;c<u;++c)for(o=0,l=a[c];o<s;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?ve:ye)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,s=r.length;i<s;++i)(o=r[i])&&(yield o)}};const Ee={passive:!1},ke={capture:!0,passive:!1};function Ne(e){e.stopImmediatePropagation()}function Me(e){e.preventDefault(),e.stopImmediatePropagation()}function _e(e){var t=e.document.documentElement,n=Se(e).on("dragstart.drag",Me,ke);"onselectstart"in t?n.on("selectstart.drag",Me,ke):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Pe(e,t){var n=e.document.documentElement,o=Se(e).on("dragstart.drag",null);t&&(o.on("click.drag",Me,ke),setTimeout((function(){o.on("click.drag",null)}),0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var ze=e=>()=>e;function Oe(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function Ae(e){return!e.ctrlKey&&!e.button}function Re(){return this.parentNode}function Ie(e,t){return null==t?{x:e.x,y:e.y}:t}function De(){return navigator.maxTouchPoints||"ontouchstart"in this}function $e(){var e,t,n,o,r=Ae,i=Re,a=Ie,l=De,c={},u=s("start","drag","end"),d=0,h=0;function f(e){e.on("mousedown.drag",g).filter(l).on("touchstart.drag",y).on("touchmove.drag",v,Ee).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(s,a){if(!o&&r.call(this,s,a)){var l=w(this,i.call(this,s,a),s,a,"mouse");l&&(Se(s.view).on("mousemove.drag",p,ke).on("mouseup.drag",m,ke),_e(s.view),Ne(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function p(o){if(Me(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>h}c.mouse("drag",o)}function m(e){Se(e.view).on("mousemove.drag mouseup.drag",null),Pe(e.view,n),Me(e),c.mouse("end",e)}function y(e,t){if(r.call(this,e,t)){var n,o,s=e.changedTouches,a=i.call(this,e,t),l=s.length;for(n=0;n<l;++n)(o=w(this,a,e,t,s[n].identifier,s[n]))&&(Ne(e),o("start",e,s[n]))}}function v(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=c[o[t].identifier])&&(Me(e),n("drag",e,o[t]))}function x(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout((function(){o=null}),500),t=0;t<i;++t)(n=c[r[t].identifier])&&(Ne(e),n("end",e,r[t]))}function w(e,t,n,o,r,i){var s,l,h,g=u.copy(),p=Ce(i||n,t);if(null!=(h=a.call(e,new Oe("beforestart",{sourceEvent:n,target:f,identifier:r,active:d,x:p[0],y:p[1],dx:0,dy:0,dispatch:g}),o)))return s=h.x-p[0]||0,l=h.y-p[1]||0,function n(i,a,u){var m,y=p;switch(i){case"start":c[r]=n,m=d++;break;case"end":delete c[r],--d;case"drag":p=Ce(u||a,t),m=d}g.call(i,e,new Oe(i,{sourceEvent:a,subject:h,target:f,identifier:r,active:m,x:p[0]+s,y:p[1]+l,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:g}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:ze(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:ze(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:ze(e),f):a},f.touchable=function(e){return arguments.length?(l="function"==typeof e?e:ze(!!e),f):l},f.on=function(){var e=u.on.apply(u,arguments);return e===u?f:e},f.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,f):Math.sqrt(h)},f}function Le(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Be(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Te(){}Oe.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Ve=.7,je=1/Ve,He="\\s*([+-]?\\d+)\\s*",Xe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ye="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ze=/^#([0-9a-f]{3,8})$/,We=new RegExp(`^rgb\\(${He},${He},${He}\\)$`),Fe=new RegExp(`^rgb\\(${Ye},${Ye},${Ye}\\)$`),Ke=new RegExp(`^rgba\\(${He},${He},${He},${Xe}\\)$`),Ge=new RegExp(`^rgba\\(${Ye},${Ye},${Ye},${Xe}\\)$`),qe=new RegExp(`^hsl\\(${Xe},${Ye},${Ye}\\)$`),Ue=new RegExp(`^hsla\\(${Xe},${Ye},${Ye},${Xe}\\)$`),Qe={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};function Je(){return this.rgb().formatHex()}function et(){return this.rgb().formatRgb()}function tt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Ze.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?nt(t):3===n?new it(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ot(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ot(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=We.exec(e))?new it(t[1],t[2],t[3],1):(t=Fe.exec(e))?new it(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Ke.exec(e))?ot(t[1],t[2],t[3],t[4]):(t=Ge.exec(e))?ot(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=qe.exec(e))?dt(t[1],t[2]/100,t[3]/100,1):(t=Ue.exec(e))?dt(t[1],t[2]/100,t[3]/100,t[4]):Qe.hasOwnProperty(e)?nt(Qe[e]):"transparent"===e?new it(NaN,NaN,NaN,0):null}function nt(e){return new it(e>>16&255,e>>8&255,255&e,1)}function ot(e,t,n,o){return o<=0&&(e=t=n=NaN),new it(e,t,n,o)}function rt(e,t,n,o){return 1===arguments.length?((r=e)instanceof Te||(r=tt(r)),r?new it((r=r.rgb()).r,r.g,r.b,r.opacity):new it):new it(e,t,n,null==o?1:o);var r}function it(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function st(){return`#${ut(this.r)}${ut(this.g)}${ut(this.b)}`}function at(){const e=lt(this.opacity);return`${1===e?"rgb(":"rgba("}${ct(this.r)}, ${ct(this.g)}, ${ct(this.b)}${1===e?")":`, ${e})`}`}function lt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ct(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ut(e){return((e=ct(e))<16?"0":"")+e.toString(16)}function dt(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ft(e,t,n,o)}function ht(e){if(e instanceof ft)return new ft(e.h,e.s,e.l,e.opacity);if(e instanceof Te||(e=tt(e)),!e)return new ft;if(e instanceof ft)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(s=t===i?(n-o)/a+6*(n<o):n===i?(o-t)/a+2:(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new ft(s,a,l,e.opacity)}function ft(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function gt(e){return(e=(e||0)%360)<0?e+360:e}function pt(e){return Math.max(0,Math.min(1,e||0))}function mt(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Le(Te,tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Je,formatHex:Je,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ht(this).formatHsl()},formatRgb:et,toString:et}),Le(it,rt,Be(Te,{brighter(e){return e=null==e?je:Math.pow(je,e),new it(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Ve:Math.pow(Ve,e),new it(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new it(ct(this.r),ct(this.g),ct(this.b),lt(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:st,formatHex:st,formatHex8:function(){return`#${ut(this.r)}${ut(this.g)}${ut(this.b)}${ut(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:at,toString:at})),Le(ft,(function(e,t,n,o){return 1===arguments.length?ht(e):new ft(e,t,n,null==o?1:o)}),Be(Te,{brighter(e){return e=null==e?je:Math.pow(je,e),new ft(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Ve:Math.pow(Ve,e),new ft(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new it(mt(e>=240?e-240:e+120,r,o),mt(e,r,o),mt(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new ft(gt(this.h),pt(this.s),pt(this.l),lt(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=lt(this.opacity);return`${1===e?"hsl(":"hsla("}${gt(this.h)}, ${100*pt(this.s)}%, ${100*pt(this.l)}%${1===e?")":`, ${e})`}`}}));var yt=e=>()=>e;function vt(e){return 1==(e=+e)?xt:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):yt(isNaN(t)?n:t)}}function xt(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):yt(isNaN(e)?t:e)}var wt=function e(t){var n=vt(t);function o(e,t){var o=n((e=rt(e)).r,(t=rt(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),s=xt(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=s(t),e+""}}return o.gamma=e,o}(1);function bt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var St=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ct=new RegExp(St.source,"g");function Et(e,t){var n,o,r,i=St.lastIndex=Ct.lastIndex=0,s=-1,a=[],l=[];for(e+="",t+="";(n=St.exec(e))&&(o=Ct.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),a[s]?a[s]+=r:a[++s]=r),(n=n[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,l.push({i:s,x:bt(n,o)})),i=Ct.lastIndex;return i<t.length&&(r=t.slice(i),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)a[(n=l[o]).i]=n.x(e);return a.join("")})}var kt,Nt=180/Math.PI,Mt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _t(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Nt,skewX:Math.atan(l)*Nt,scaleX:s,scaleY:a}}function Pt(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,s){var a=[],l=[];return i=e(i),s=e(s),function(e,o,r,i,s,a){if(e!==r||o!==i){var l=s.push("translate(",null,t,null,n);a.push({i:l-4,x:bt(e,r)},{i:l-2,x:bt(o,i)})}else(r||i)&&s.push("translate("+r+t+i+n)}(i.translateX,i.translateY,s.translateX,s.translateY,a,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:bt(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,s.rotate,a,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:bt(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,s.skewX,a,l),function(e,t,n,o,i,s){if(e!==n||t!==o){var a=i.push(r(i)+"scale(",null,",",null,")");s.push({i:a-4,x:bt(e,n)},{i:a-2,x:bt(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,s.scaleX,s.scaleY,a,l),i=s=null,function(e){for(var t,n=-1,o=l.length;++n<o;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var zt=Pt((function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Mt:_t(t.a,t.b,t.c,t.d,t.e,t.f)}),"px, ","px)","deg)"),Ot=Pt((function(e){return null==e?Mt:(kt||(kt=document.createElementNS("http://www.w3.org/2000/svg","g")),kt.setAttribute("transform",e),(e=kt.transform.baseVal.consolidate())?_t((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Mt)}),", ",")",")");function At(e){return((e=Math.exp(e))+1/e)/2}var Rt,It,Dt=function e(t,n,o){function r(e,r){var i,s,a=e[0],l=e[1],c=e[2],u=r[0],d=r[1],h=r[2],f=u-a,g=d-l,p=f*f+g*g;if(p<1e-12)s=Math.log(h/c)/t,i=function(e){return[a+e*f,l+e*g,c*Math.exp(t*e*s)]};else{var m=Math.sqrt(p),y=(h*h-c*c+o*p)/(2*c*n*m),v=(h*h-c*c-o*p)/(2*h*n*m),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(v*v+1)-v);s=(w-x)/t,i=function(e){var o,r=e*s,i=At(x),u=c/(n*m)*(i*(o=t*r+x,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(x));return[a+u*f,l+u*g,c*i/At(t*r+x)]}}return i.duration=1e3*s*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4),$t=0,Lt=0,Bt=0,Tt=1e3,Vt=0,jt=0,Ht=0,Xt="object"==typeof performance&&performance.now?performance:Date,Yt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Zt(){return jt||(Yt(Wt),jt=Xt.now()+Ht)}function Wt(){jt=0}function Ft(){this._call=this._time=this._next=null}function Kt(e,t,n){var o=new Ft;return o.restart(e,t,n),o}function Gt(){jt=(Vt=Xt.now())+Ht,$t=Lt=0;try{!function(){Zt(),++$t;for(var e,t=Rt;t;)(e=jt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--$t}()}finally{$t=0,function(){var e,t,n=Rt,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Rt=t);It=e,Ut(o)}(),jt=0}}function qt(){var e=Xt.now(),t=e-Vt;t>Tt&&(Ht-=t,Vt=e)}function Ut(e){$t||(Lt&&(Lt=clearTimeout(Lt)),e-jt>24?(e<1/0&&(Lt=setTimeout(Gt,e-Xt.now()-Ht)),Bt&&(Bt=clearInterval(Bt))):(Bt||(Vt=Xt.now(),Bt=setInterval(qt,Tt)),$t=1,Yt(Gt)))}function Qt(e,t,n){var o=new Ft;return t=null==t?0:+t,o.restart((n=>{o.stop(),e(n+t)}),t,n),o}Ft.prototype=Kt.prototype={constructor:Ft,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Zt():+n)+(null==t?0:+t),this._next||It===this||(It?It._next=this:Rt=this,It=this),this._call=e,this._time=n,Ut()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ut())}};var Jt=s("start","end","cancel","interrupt"),en=[],tn=0,nn=1,on=2,rn=3,sn=4,an=5,ln=6;function cn(e,t,n,o,r,i){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(e){n.state=nn,n.timer.restart(s,n.delay,n.time),n.delay<=e&&s(e-n.delay)}function s(i){var c,u,d,h;if(n.state!==nn)return l();for(c in r)if((h=r[c]).name===n.name){if(h.state===rn)return Qt(s);h.state===sn?(h.state=ln,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+c<t&&(h.state=ln,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[c])}if(Qt((function(){n.state===rn&&(n.state=sn,n.timer.restart(a,n.delay,n.time),a(i))})),n.state=on,n.on.call("start",e,e.__data__,n.index,n.group),n.state===on){for(n.state=rn,o=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function a(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=an,1),i=-1,s=o.length;++i<s;)o[i].call(e,r);n.state===an&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var o in n.state=ln,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Kt(i,0,n.time)}(e,n,{name:t,index:o,group:r,on:Jt,tween:en,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:tn})}function un(e,t){var n=hn(e,t);if(n.state>tn)throw new Error("too late; already scheduled");return n}function dn(e,t){var n=hn(e,t);if(n.state>rn)throw new Error("too late; already running");return n}function hn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function fn(e,t){var n,o,r,i=e.__transition,s=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>on&&n.state<an,n.state=ln,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):s=!1;s&&delete e.__transition}}function gn(e,t){var n,o;return function(){var r=dn(this,e),i=r.tween;if(i!==n)for(var s=0,a=(o=n=i).length;s<a;++s)if(o[s].name===t){(o=o.slice()).splice(s,1);break}r.tween=o}}function pn(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=dn(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function mn(e,t,n){var o=e._id;return e.each((function(){var e=dn(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)})),function(e){return hn(e,o).value[t]}}function yn(e,t){var n;return("number"==typeof t?bt:t instanceof tt?wt:(n=tt(t))?(t=n,wt):Et)(e,t)}function vn(e){return function(){this.removeAttribute(e)}}function xn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wn(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttribute(e);return s===i?null:s===o?r:r=t(o=s,n)}}function bn(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===o?r:r=t(o=s,n)}}function Sn(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttribute(e))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttribute(e)}}function Cn(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttributeNS(e.space,e.local))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttributeNS(e.space,e.local)}}function En(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function kn(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function Nn(e,t){return function(){un(this,e).delay=+t.apply(this,arguments)}}function Mn(e,t){return t=+t,function(){un(this,e).delay=t}}function _n(e,t){return function(){dn(this,e).duration=+t.apply(this,arguments)}}function Pn(e,t){return t=+t,function(){dn(this,e).duration=t}}var zn=be.prototype.constructor;function On(e){return function(){this.style.removeProperty(e)}}var An=0;function Rn(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function In(){return++An}var Dn=be.prototype;Rn.prototype={constructor:Rn,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=y(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a,l,c=o[s],u=c.length,d=i[s]=new Array(u),h=0;h<u;++h)(a=c[h])&&(l=e.call(a,a.__data__,h,c))&&("__data__"in a&&(l.__data__=a.__data__),d[h]=l,cn(d[h],t,n,h,d,hn(a,n)));return new Rn(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=x(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l,c=o[a],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var h,f=e.call(l,l.__data__,d,c),g=hn(l,n),p=0,m=f.length;p<m;++p)(h=f[p])&&cn(h,t,n,p,f,g);i.push(f),s.push(l)}return new Rn(i,s,t,n)},selectChild:Dn.selectChild,selectChildren:Dn.selectChildren,filter:function(e){"function"!=typeof e&&(e=b(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new Rn(o,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l,c=t[a],u=n[a],d=c.length,h=s[a]=new Array(d),f=0;f<d;++f)(l=c[f]||u[f])&&(h[f]=l);for(;a<o;++a)s[a]=t[a];return new Rn(s,this._parents,this._name,this._id)},selection:function(){return new zn(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=In(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)if(s=a[c]){var u=hn(s,t);cn(s,e,n,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Rn(o,this._parents,e,n)},call:Dn.call,nodes:Dn.nodes,node:Dn.node,size:Dn.size,empty:Dn.empty,each:Dn.each,on:function(e,t){var n=this._id;return arguments.length<2?hn(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?un:dn;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}(n,e,t))},attr:function(e,t){var n=h(e),o="transform"===n?Ot:yn;return this.attrTween(e,"function"==typeof t?(n.local?Cn:Sn)(n,o,mn(this,"attr."+e,t)):null==t?(n.local?xn:vn)(n):(n.local?bn:wn)(n,o,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=h(e);return this.tween(n,(o.local?En:kn)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?zt:yn;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=Y(this,e),s=(this.style.removeProperty(e),Y(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}(e,o)).on("end.style."+e,On(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var s=Y(this,e),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(e),l=a=Y(this,e)),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}(e,o,mn(this,"style."+e,t))).each(function(e,t){var n,o,r,i,s="style."+t,a="end."+s;return function(){var l=dn(this,e),c=l.on,u=null==l.value[s]?i||(i=On(t)):void 0;c===n&&r===u||(o=(n=c).copy()).on(a,r=u),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var s=Y(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}(e,o,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(mn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=hn(this.node(),n).tween,i=0,s=r.length;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?gn:pn)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Nn:Mn)(t,e)):hn(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?_n:Pn)(t,e)):hn(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){dn(this,e).ease=t}}(t,e)):hn(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;dn(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,o=n._id,r=n.size();return new Promise((function(i,s){var a={value:s},l={value:function(){0==--r&&i()}};n.each((function(){var n=dn(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),n.on=t})),0===r&&i()}))},[Symbol.iterator]:Dn[Symbol.iterator]};var $n={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Ln(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}be.prototype.interrupt=function(e){return this.each((function(){fn(this,e)}))},be.prototype.transition=function(e){var t,n;e instanceof Rn?(t=e._id,e=e._name):(t=In(),(n=$n).time=Zt(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)(s=a[c])&&cn(s,e,t,c,a,n||Ln(s,t));return new Rn(o,this._parents,e,t)};var Bn=e=>()=>e;function Tn(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Vn(e,t,n){this.k=e,this.x=t,this.y=n}Vn.prototype={constructor:Vn,scale:function(e){return 1===e?this:new Vn(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Vn(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 jn=new Vn(1,0,0);function Hn(e){for(;!e.__zoom;)if(!(e=e.parentNode))return jn;return e.__zoom}function Xn(e){e.stopImmediatePropagation()}function Yn(e){e.preventDefault(),e.stopImmediatePropagation()}function Zn(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Wn(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).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 Fn(){return this.__zoom||jn}function Kn(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Gn(){return navigator.maxTouchPoints||"ontouchstart"in this}function qn(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Un(){var e,t,n,o=Zn,r=Wn,i=qn,a=Kn,l=Gn,c=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,h=Dt,f=s("start","zoom","end"),g=500,p=150,m=0,y=10;function v(e){e.property("__zoom",Fn).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",M).filter(l).on("touchstart.zoom",_).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(e,t){return(t=Math.max(c[0],Math.min(c[1],t)))===e.k?e:new Vn(t,e.x,e.y)}function w(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Vn(e.k,o,r)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function S(e,t,n,o){e.on("start.zoom",(function(){C(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){C(this,arguments).event(o).end()})).tween("zoom",(function(){var e=this,i=arguments,s=C(e,i).event(o),a=r.apply(e,i),l=null==n?b(a):"function"==typeof n?n.apply(e,i):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),u=e.__zoom,d="function"==typeof t?t.apply(e,i):t,f=h(u.invert(l).concat(c/u.k),d.invert(l).concat(c/d.k));return function(e){if(1===e)e=d;else{var t=f(e),n=c/t[2];e=new Vn(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}}))}function C(e,t,n){return!n&&e.__zooming||new E(e,t)}function E(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function k(e,...t){if(o.apply(this,arguments)){var n=C(this,t).event(e),r=this.__zoom,s=Math.max(c[0],Math.min(c[1],r.k*Math.pow(2,a.apply(this,arguments)))),l=Ce(e);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=r.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(r.k===s)return;n.mouse=[l,r.invert(l)],fn(this),n.start()}Yn(e),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),p),n.zoom("mouse",i(w(x(r,s),n.mouse[0],n.mouse[1]),n.extent,u))}}function N(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,s=C(this,t,!0).event(e),a=Se(e.view).on("mousemove.zoom",(function(e){if(Yn(e),!s.moved){var t=e.clientX-c,n=e.clientY-d;s.moved=t*t+n*n>m}s.event(e).zoom("mouse",i(w(s.that.__zoom,s.mouse[0]=Ce(e,r),s.mouse[1]),s.extent,u))}),!0).on("mouseup.zoom",(function(e){a.on("mousemove.zoom mouseup.zoom",null),Pe(e.view,s.moved),Yn(e),s.event(e).end()}),!0),l=Ce(e,r),c=e.clientX,d=e.clientY;_e(e.view),Xn(e),s.mouse=[l,this.__zoom.invert(l)],fn(this),s.start()}}function M(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,s=Ce(e.changedTouches?e.changedTouches[0]:e,this),a=n.invert(s),l=n.k*(e.shiftKey?.5:2),c=i(w(x(n,l),s,a),r.apply(this,t),u);Yn(e),d>0?Se(this).transition().duration(d).call(S,c,s,e):Se(this).call(v.transform,c,s,e)}}function _(n,...r){if(o.apply(this,arguments)){var i,s,a,l,c=n.touches,u=c.length,d=C(this,r,n.changedTouches.length===u).event(n);for(Xn(n),s=0;s<u;++s)l=[l=Ce(a=c[s],this),this.__zoom.invert(l),a.identifier],d.touch0?d.touch1||d.touch0[2]===l[2]||(d.touch1=l,d.taps=0):(d.touch0=l,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(t=l[0],e=setTimeout((function(){e=null}),g)),fn(this),d.start())}}function P(e,...t){if(this.__zooming){var n,o,r,s,a=C(this,t).event(e),l=e.changedTouches,c=l.length;for(Yn(e),n=0;n<c;++n)r=Ce(o=l[n],this),a.touch0&&a.touch0[2]===o.identifier?a.touch0[0]=r:a.touch1&&a.touch1[2]===o.identifier&&(a.touch1[0]=r);if(o=a.that.__zoom,a.touch1){var d=a.touch0[0],h=a.touch0[1],f=a.touch1[0],g=a.touch1[1],p=(p=f[0]-d[0])*p+(p=f[1]-d[1])*p,m=(m=g[0]-h[0])*m+(m=g[1]-h[1])*m;o=x(o,Math.sqrt(p/m)),r=[(d[0]+f[0])/2,(d[1]+f[1])/2],s=[(h[0]+g[0])/2,(h[1]+g[1])/2]}else{if(!a.touch0)return;r=a.touch0[0],s=a.touch0[1]}a.zoom("touch",i(w(o,r,s),a.extent,u))}}function z(e,...o){if(this.__zooming){var r,i,s=C(this,o).event(e),a=e.changedTouches,l=a.length;for(Xn(e),n&&clearTimeout(n),n=setTimeout((function(){n=null}),g),r=0;r<l;++r)i=a[r],s.touch0&&s.touch0[2]===i.identifier?delete s.touch0:s.touch1&&s.touch1[2]===i.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(i=Ce(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<y)){var c=Se(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return v.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",Fn),e!==r?S(e,t,n,o):r.interrupt().each((function(){C(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}))},v.scaleBy=function(e,t,n,o){v.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)}),n,o)},v.scaleTo=function(e,t,n,o){v.transform(e,(function(){var e=r.apply(this,arguments),o=this.__zoom,s=null==n?b(e):"function"==typeof n?n.apply(this,arguments):n,a=o.invert(s),l="function"==typeof t?t.apply(this,arguments):t;return i(w(x(o,l),s,a),e,u)}),n,o)},v.translateBy=function(e,t,n,o){v.transform(e,(function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),u)}),null,o)},v.translateTo=function(e,t,n,o,s){v.transform(e,(function(){var e=r.apply(this,arguments),s=this.__zoom,a=null==o?b(e):"function"==typeof o?o.apply(this,arguments):o;return i(jn.translate(a[0],a[1]).scale(s.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,u)}),o,s)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=Se(this.that).datum();f.call(e,this.that,new Tn(e,{sourceEvent:this.sourceEvent,target:v,type:e,transform:this.that.__zoom,dispatch:f}),t)}},v.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:Bn(+e),v):a},v.filter=function(e){return arguments.length?(o="function"==typeof e?e:Bn(!!e),v):o},v.touchable=function(e){return arguments.length?(l="function"==typeof e?e:Bn(!!e),v):l},v.extent=function(e){return arguments.length?(r="function"==typeof e?e:Bn([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),v):r},v.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],v):[c[0],c[1]]},v.translateExtent=function(e){return arguments.length?(u[0][0]=+e[0][0],u[1][0]=+e[1][0],u[0][1]=+e[0][1],u[1][1]=+e[1][1],v):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},v.constrain=function(e){return arguments.length?(i=e,v):i},v.duration=function(e){return arguments.length?(d=+e,v):d},v.interpolate=function(e){return arguments.length?(h=e,v):h},v.on=function(){var e=f.on.apply(f,arguments);return e===f?v:e},v.clickDistance=function(e){return arguments.length?(m=(e=+e)*e,v):Math.sqrt(m)},v.tapDistance=function(e){return arguments.length?(y=+e,v):y},v}Hn.prototype=Vn.prototype;const Qn={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Jn=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],eo=["Enter"," ","Escape"];var to,no,oo;e.ConnectionMode=void 0,(to=e.ConnectionMode||(e.ConnectionMode={})).Strict="strict",to.Loose="loose",e.PanOnScrollMode=void 0,(no=e.PanOnScrollMode||(e.PanOnScrollMode={})).Free="free",no.Vertical="vertical",no.Horizontal="horizontal",e.SelectionMode=void 0,(oo=e.SelectionMode||(e.SelectionMode={})).Partial="partial",oo.Full="full";const ro={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var io,so,ao;e.ConnectionLineType=void 0,(io=e.ConnectionLineType||(e.ConnectionLineType={})).Bezier="default",io.Straight="straight",io.Step="step",io.SmoothStep="smoothstep",io.SimpleBezier="simplebezier",e.MarkerType=void 0,(so=e.MarkerType||(e.MarkerType={})).Arrow="arrow",so.ArrowClosed="arrowclosed",e.Position=void 0,(ao=e.Position||(e.Position={})).Left="left",ao.Top="top",ao.Right="right",ao.Bottom="bottom";const lo={[e.Position.Left]:e.Position.Right,[e.Position.Right]:e.Position.Left,[e.Position.Top]:e.Position.Bottom,[e.Position.Bottom]:e.Position.Top};function co(e,t){if(!e&&!t)return!0;if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(const n of e.keys())if(!t.has(n))return!1;return!0}function uo(e,t,n){if(!n)return;const o=[];e.forEach(((e,n)=>{t?.has(n)||o.push(e)})),o.length&&n(o)}function ho(e){return null===e?null:e?"valid":"invalid"}const fo=e=>"id"in e&&"source"in e&&"target"in e,go=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),po=(e,t=[0,0])=>{const{width:n,height:o}=Yo(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},mo=(e,t={nodeOrigin:[0,0]})=>{if(0===e.length)return{x:0,y:0,width:0,height:0};const n=e.reduce(((e,n)=>{const o="string"==typeof n;let r=t.nodeLookup||o?void 0:n;t.nodeLookup&&(r=o?t.nodeLookup.get(n):go(n)?n:t.nodeLookup.get(n.id));const i=r?Oo(r,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Mo(e,i)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Po(n)},yo=(e,t={})=>{if(0===e.size)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach((e=>{if(void 0===t.filter||t.filter(e)){const t=Oo(e);n=Mo(n,t)}})),Po(n)},vo=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...Bo(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(s&&!n||o)continue;const r=e.width??t.width??t.initialWidth??null,c=e.height??t.height??t.initialHeight??null,u=Ro(a,zo(t)),d=(r??0)*(c??0),h=i&&u>0;(!t.internals.handleBounds||h||u>=d||t.dragging)&&l.push(t)}return l},xo=(e,t)=>{const n=new Set;return e.forEach((e=>{n.add(e.id)})),t.filter((e=>n.has(e.source)||n.has(e.target)))};async function wo({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(0===e.size)return Promise.resolve(!0);const a=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map((e=>e.id))):null;return e.forEach((e=>{!e.measured.width||!e.measured.height||!t?.includeHiddenNodes&&e.hidden||o&&!o.has(e.id)||n.set(e.id,e)})),n}(e,s),l=yo(a),c=jo(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration}),Promise.resolve(!0)}function bo({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=r;if("parent"!==s.extent||s.expandParent)a&&Xo(s.extent)&&(d=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);else if(a){const e=a.measured.width,t=a.measured.height;e&&t&&(d=[[l,c],[l+e,c+t]])}else i?.("005",Qn.error005());const h=Xo(d)?Co(t,d,s.measured):t;return void 0!==s.measured.width&&void 0!==s.measured.height||i?.("015",Qn.error015()),{position:{x:h.x-l+(s.measured.width??0)*u[0],y:h.y-c+(s.measured.height??0)*u[1]},positionAbsolute:h}}const So=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Co=(e={x:0,y:0},t,n)=>({x:So(e.x,t[0][0],t[1][0]-(n?.width??0)),y:So(e.y,t[0][1],t[1][1]-(n?.height??0))});function Eo(e,t,n){const{width:o,height:r}=Yo(n),{x:i,y:s}=n.internals.positionAbsolute;return Co(e,[[i,s],[i+o,s+r]],t)}const ko=(e,t,n)=>e<t?So(Math.abs(e-t),1,t)/t:e>n?-So(Math.abs(e-n),1,t)/t:0,No=(e,t,n=15,o=40)=>[ko(e.x,o,t.width-o)*n,ko(e.y,o,t.height-o)*n],Mo=(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)}),_o=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Po=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),zo=(e,t=[0,0])=>{const{x:n,y:o}=go(e)?e.internals.positionAbsolute:po(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Oo=(e,t=[0,0])=>{const{x:n,y:o}=go(e)?e.internals.positionAbsolute:po(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Ao=(e,t)=>Po(Mo(_o(e),_o(t))),Ro=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Io=e=>Do(e.width)&&Do(e.height)&&Do(e.x)&&Do(e.y),Do=e=>!isNaN(e)&&isFinite(e),$o=(e,t)=>{},Lo=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Bo=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Lo(a,s):a},To=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Vo(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&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}const jo=(e,t,n,o,r,i)=>{const s=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Vo(e,n),r=Vo(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Vo(e.top??e.y??0,n),r=Vo(e.bottom??e.y??0,n),i=Vo(e.left??e.x??0,t),s=Vo(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=So(c,o,r),d=t/2-(e.x+e.width/2)*u,h=n/2-(e.y+e.height/2)*u,f=function(e,t,n,o,r,i){const{x:s,y:a}=To(e,[t,n,o]),{x:l,y:c}=To({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}(e,d,h,u,t,n),g=Math.min(f.left-s.left,0),p=Math.min(f.top-s.top,0);return{x:d-g+Math.min(f.right-s.right,0),y:h-p+Math.min(f.bottom-s.bottom,0),zoom:u}},Ho=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Xo(e){return void 0!==e&&"parent"!==e}function Yo(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Zo(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function Wo(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const e=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function Fo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ko(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=er(e),a=Bo({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?Lo(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const Go=e=>({width:e.offsetWidth,height:e.offsetHeight}),qo=e=>e?.getRootNode?.()||window?.document,Uo=["INPUT","SELECT","TEXTAREA"];function Qo(e){const t=e.composedPath?.()?.[0]||e.target;if(1!==t?.nodeType)return!1;return Uo.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Jo=e=>"clientX"in e,er=(e,t)=>{const n=Jo(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},tr=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map((t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...Go(t)}})):null};function nr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=.125*e+.375*r+.375*s+.125*n,c=.125*t+.375*i+.375*a+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function or(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function rr({pos:t,x1:n,y1:o,x2:r,y2:i,c:s}){switch(t){case e.Position.Left:return[n-or(n-r,s),o];case e.Position.Right:return[n+or(r-n,s),o];case e.Position.Top:return[n,o-or(o-i,s)];case e.Position.Bottom:return[n,o+or(i-o,s)]}}function ir({sourceX:t,sourceY:n,sourcePosition:o=e.Position.Bottom,targetX:r,targetY:i,targetPosition:s=e.Position.Top,curvature:a=.25}){const[l,c]=rr({pos:o,x1:t,y1:n,x2:r,y2:i,c:a}),[u,d]=rr({pos:s,x1:r,y1:i,x2:t,y2:n,c:a}),[h,f,g,p]=nr({sourceX:t,sourceY:n,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${t},${n} C${l},${c} ${u},${d} ${r},${i}`,h,f,g,p]}function sr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2;return[i,o<t?o+s:o-s,r,s]}function ar({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Mo(Oo(e),Oo(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Ro(s,Po(i))>0}const lr=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,cr=(e,t)=>{if(!e.source||!e.target)return t;let n;return n=fo(e)?{...e}:{...e,id:lr(e)},((e,t)=>t.some((t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle)))))(n,t)?t:(null===n.sourceHandle&&delete n.sourceHandle,null===n.targetHandle&&delete n.targetHandle,t.concat(n))};function ur({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=sr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const dr={[e.Position.Left]:{x:-1,y:0},[e.Position.Right]:{x:1,y:0},[e.Position.Top]:{x:0,y:-1},[e.Position.Bottom]:{x:0,y:1}},hr=({source:t,sourcePosition:n=e.Position.Bottom,target:o})=>n===e.Position.Left||n===e.Position.Right?t.x<o.x?{x:1,y:0}:{x:-1,y:0}:t.y<o.y?{x:0,y:1}:{x:0,y:-1},fr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function gr({sourceX:t,sourceY:n,sourcePosition:o=e.Position.Bottom,targetX:r,targetY:i,targetPosition:s=e.Position.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20}){const[d,h,f,g,p]=function({source:t,sourcePosition:n=e.Position.Bottom,target:o,targetPosition:r=e.Position.Top,center:i,offset:s}){const a=dr[n],l=dr[r],c={x:t.x+a.x*s,y:t.y+a.y*s},u={x:o.x+l.x*s,y:o.y+l.y*s},d=hr({source:c,sourcePosition:n,target:u}),h=0!==d.x?"x":"y",f=d[h];let g,p,m=[];const y={x:0,y:0},v={x:0,y:0},[x,w,b,S]=sr({sourceX:t.x,sourceY:t.y,targetX:o.x,targetY:o.y});if(a[h]*l[h]==-1){g=i.x??x,p=i.y??w;const e=[{x:g,y:c.y},{x:g,y:u.y}],t=[{x:c.x,y:p},{x:u.x,y:p}];m=a[h]===f?"x"===h?e:t:"x"===h?t:e}else{const e=[{x:c.x,y:u.y}],i=[{x:u.x,y:c.y}];if(m="x"===h?a.x===f?i:e:a.y===f?e:i,n===r){const e=Math.abs(t[h]-o[h]);if(e<=s){const n=Math.min(s-1,s-e);a[h]===f?y[h]=(c[h]>t[h]?-1:1)*n:v[h]=(u[h]>o[h]?-1:1)*n}}if(n!==r){const t="x"===h?"y":"x",n=a[h]===l[t],o=c[t]>u[t],r=c[t]<u[t];(1===a[h]&&(!n&&o||n&&r)||1!==a[h]&&(!n&&r||n&&o))&&(m="x"===h?e:i)}const d={x:c.x+y.x,y:c.y+y.y},x={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(x.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(x.y-m[0].y))?(g=(d.x+x.x)/2,p=m[0].y):(g=m[0].x,p=(d.y+x.y)/2)}return[[t,{x:c.x+y.x,y:c.y+y.y},...m,{x:u.x+v.x,y:u.y+v.y},o],g,p,b,S]}({source:{x:t,y:n},sourcePosition:o,target:{x:r,y:i},targetPosition:s,center:{x:l,y:c},offset:u});return[d.reduce(((e,t,n)=>{let o="";return o=n>0&&n<d.length-1?function(e,t,n,o){const r=Math.min(fr(e,t)/2,fr(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s)return`L ${i+r*(e.x<n.x?-1:1)},${s}Q ${i},${s} ${i},${s+r*(e.y<n.y?1:-1)}`;const a=e.x<n.x?1:-1;return`L ${i},${s+r*(e.y<n.y?-1:1)}Q ${i},${s} ${i+r*a},${s}`}(d[n-1],t,d[n+1],a):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o}),""),h,f,g,p]}function pr(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function mr(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function yr(t,n,o=e.Position.Left,r=!1){const i=(n?.x??0)+t.internals.positionAbsolute.x,s=(n?.y??0)+t.internals.positionAbsolute.y,{width:a,height:l}=n??Yo(t);if(r)return{x:i+a/2,y:s+l/2};switch(n?.position??o){case e.Position.Top:return{x:i+a/2,y:s};case e.Position.Right:return{x:i+a,y:s+l/2};case e.Position.Bottom:return{x:i+a/2,y:s+l};case e.Position.Left:return{x:i,y:s+l/2}}}function vr(e,t){return e&&(t?e.find((e=>e.id===t)):e[0])||null}function xr(e,t){if(!e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map((t=>`${t}=${e[t]}`)).join("&")}`}function wr(t,n,o,r,i){let s=.5;"start"===i?s=0:"end"===i&&(s=1);let a=[(t.x+t.width*s)*n.zoom+n.x,t.y*n.zoom+n.y-r],l=[-100*s,-100];switch(o){case e.Position.Right:a=[(t.x+t.width)*n.zoom+n.x+r,(t.y+t.height*s)*n.zoom+n.y],l=[0,-100*s];break;case e.Position.Bottom:a[1]=(t.y+t.height)*n.zoom+n.y+r,l[1]=0;break;case e.Position.Left:a=[t.x*n.zoom+n.x-r,(t.y+t.height*s)*n.zoom+n.y],l=[-100,-100*s]}return`translate(${a[0]}px, ${a[1]}px) translate(${l[0]}%, ${l[1]}%)`}const br={nodeOrigin:[0,0],nodeExtent:Jn,elevateNodesOnSelect:!0,defaults:{}},Sr={...br,checkEquality:!0};function Cr(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function Er(e,t,n,o){const r=Cr(Sr,o);let i=e.length>0;const s=new Map(t),a=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const l of e){let e=s.get(l.id);if(r.checkEquality&&l===e?.internals.userNode)t.set(l.id,e);else{const n=po(l,r.nodeOrigin),o=Xo(l.extent)?l.extent:r.nodeExtent,i=Co(n,o,Yo(l));e={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:i,handleBounds:l.measured?e?.internals.handleBounds:void 0,z:Nr(l,a),userNode:l}},t.set(l.id,e)}e.measured&&e.measured.width&&e.measured.height||e.hidden||(i=!1),l.parentId&&kr(e,t,n,o)}return i}function kr(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:s}=Cr(br,o),a=e.parentId,l=t.get(a);if(!l)return void console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(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]]))}(e,n);const c=r?1e3:0,{x:u,y:d,z:h}=function(e,t,n,o,r){const{x:i,y:s}=t.internals.positionAbsolute,a=Yo(e),l=po(e,n),c=Xo(e.extent)?Co(l,e.extent,a):l;let u=Co({x:i+c.x,y:s+c.y},o,a);"parent"===e.extent&&(u=Eo(u,a,t));const d=Nr(e,r),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>d?h:d}}(e,l,i,s,c),{positionAbsolute:f}=e.internals,g=u!==f.x||d!==f.y;(g||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:g?{x:u,y:d}:f,z:h}})}function Nr(e,t){return(Do(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Mr(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??zo(e),r=Ao(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach((({expandedRect:t,parent:i},s)=>{const a=i.internals.positionAbsolute,l=Yo(i),c=i.origin??o,u=t.x<a.x?Math.round(Math.abs(a.x-t.x)):0,d=t.y<a.y?Math.round(Math.abs(a.y-t.y)):0,h=Math.max(l.width,Math.round(t.width)),f=Math.max(l.height,Math.round(t.height)),g=(h-l.width)*c[0],p=(f-l.height)*c[1];(u>0||d>0||g||p)&&(r.push({id:s,type:"position",position:{x:i.position.x-u+g,y:i.position.y-d+p}}),n.get(s)?.forEach((t=>{e.some((e=>e.id===t.id))||r.push({id:t.id,type:"position",position:{x:t.position.x+u,y:t.position.y+d}})}))),(l.width<t.width||l.height<t.height||u||d)&&r.push({id:s,type:"dimensions",setAttributes:!0,dimensions:{width:h+(u?c[0]*u-g:0),height:f+(d?c[1]*d-p:0)}})})),r}function _r(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const a=o.get(s)||new Map;o.set(s,a.set(n,t))}}function Pr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:s=null}=o,a={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:s},l=`${n}-${i}--${r}-${s}`;_r("source",a,`${r}-${s}--${n}-${i}`,e,n,i),_r("target",a,l,e,r,s),t.set(o.id,o)}}function zr(e,t){if(null===e||null===t)return!1;const n=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t];if(n.length!==o.length)return!1;for(let e=0;e<n.length;e++)if(n[e].id!==o[e].id||n[e].type!==o[e].type||!Object.is(n[e].data,o[e].data))return!1;return!0}function Or(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Or(n,t))}function Ar(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Rr({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Ir({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,h=null,f=!1;return{update:function({noDragClassName:g,handleSelector:p,domNode:m,isSelectable:y,nodeId:v,nodeClickDistance:x=0}){function w({x:e,y:n},r){const{nodeLookup:s,nodeExtent:l,snapGrid:c,snapToGrid:u,nodeOrigin:d,onNodeDrag:h,onSelectionDrag:f,onError:g,updateNodePositions:p}=t();i={x:e,y:n};let m=!1,y={x:0,y:0,x2:0,y2:0};if(a.size>1&&l){const e=yo(a);y=_o(e)}for(const[t,o]of a){if(!s.has(t))continue;let r={x:e-o.distance.x,y:n-o.distance.y};u&&(r=Lo(r,c));let i=[[l[0][0],l[0][1]],[l[1][0],l[1][1]]];if(a.size>1&&l&&!o.extent){const{positionAbsolute:e}=o.internals,t=e.x-y.x+l[0][0],n=e.x+o.measured.width-y.x2+l[1][0];i=[[t,e.y-y.y+l[0][1]],[n,e.y+o.measured.height-y.y2+l[1][1]]]}const{position:h,positionAbsolute:f}=bo({nodeId:t,nextPosition:r,nodeLookup:s,nodeExtent:i,nodeOrigin:d,onError:g});m=m||o.position.x!==h.x||o.position.y!==h.y,o.position=h,o.internals.positionAbsolute=f}if(m&&(p(a,!0),r&&(o||h||!v&&f))){const[e,t]=Rr({nodeId:v,dragItems:a,nodeLookup:s});o?.(r,a,e,t),h?.(r,e,t),v||f?.(r,t)}}async function b(){if(!u)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(s);const[a,d]=No(c,u,o);0===a&&0===d||(i.x=(i.x??0)-a/e[2],i.y=(i.y??0)-d/e[2],await n({x:a,y:d})&&w(i,null)),s=requestAnimationFrame(b)}function S(o){const{nodeLookup:r,multiSelectionActive:s,nodesDraggable:l,transform:c,snapGrid:h,snapToGrid:f,selectNodesOnDrag:g,onNodeDragStart:p,onSelectionDragStart:m,unselectNodesAndEdges:x}=t();d=!0,g&&y||s||!v||r.get(v)?.selected||x(),y&&g&&v&&e?.(v);const w=Ko(o.sourceEvent,{transform:c,snapGrid:h,snapToGrid:f,containerBounds:u});if(i=w,a=function(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Or(s,e))&&(s.draggable||t&&void 0===s.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,w,v),a.size>0&&(n||p||!v&&m)){const[e,t]=Rr({nodeId:v,dragItems:a,nodeLookup:r});n?.(o.sourceEvent,a,e,t),p?.(o.sourceEvent,e,t),v||m?.(o.sourceEvent,t)}}h=Se(m);const C=$e().clickDistance(x).on("start",(e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:s,snapToGrid:a}=t();u=n?.getBoundingClientRect()||null,f=!1,0===o&&S(e);const l=Ko(e.sourceEvent,{transform:r,snapGrid:s,snapToGrid:a,containerBounds:u});i=l,c=er(e.sourceEvent,u)})).on("drag",(e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:s,nodeDragThreshold:h,nodeLookup:g}=t(),p=Ko(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:s,containerBounds:u});if(("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||v&&!g.has(v))&&(f=!0),!f){if(!l&&n&&d&&(l=!0,b()),!d){const t=p.xSnapped-(i.x??0),n=p.ySnapped-(i.y??0);Math.sqrt(t*t+n*n)>h&&S(e)}(i.x!==p.xSnapped||i.y!==p.ySnapped)&&a&&d&&(c=er(e.sourceEvent,u),w(p,e.sourceEvent))}})).on("end",(e=>{if(d&&!f&&(l=!1,d=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:s}=t();if(o(a,!1),r||i||!v&&s){const[t,o]=Rr({nodeId:v,dragItems:a,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,a,t,o),i?.(e.sourceEvent,t,o),v||s?.(e.sourceEvent,o)}}})).filter((e=>{const t=e.target;return!e.button&&(!g||!Ar(t,`.${g}`,m))&&(!p||Ar(t,p,m))}));h.call(C)},destroy:function(){h?.on(".drag",null)}}}const Dr=250;function $r(e,t,n,o){let r=[],i=1/0;const s=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())Ro(r,zo(e))>0&&o.push(e);return o}(e,n,t+Dr);for(const n of s){const s=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const a of s){if(o.nodeId===a.nodeId&&o.type===a.type&&o.id===a.id)continue;const{x:s,y:l}=yr(n,a,a.position,!0),c=Math.sqrt(Math.pow(s-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...a,x:s,y:l}],i=c):c===i&&r.push({...a,x:s,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find((t=>t.type===e))??r[0]}return r[0]}function Lr(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a="strict"===r?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find((e=>e.id===n)):a?.[0])??null;return l&&i?{...l,...yr(s,l,l.position,!0)}:l}function Br(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const Tr=()=>!0;function Vr(t,{handle:n,connectionMode:o,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=Tr,nodeLookup:d}){const h="target"===s,f=n?a.querySelector(`.${l}-flow__handle[data-id="${c}-${n?.nodeId}-${n?.id}-${n?.type}"]`):null,{x:g,y:p}=er(t),m=a.elementFromPoint(g,p),y=m?.classList.contains(`${l}-flow__handle`)?m:f,v={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const t=Br(void 0,y),n=y.getAttribute("data-nodeid"),s=y.getAttribute("data-handleid"),a=y.classList.contains("connectable"),l=y.classList.contains("connectableend");if(!n||!t)return v;const c={source:h?n:r,sourceHandle:h?s:i,target:h?r:n,targetHandle:h?i:s};v.connection=c;const f=a&&l&&(o===e.ConnectionMode.Strict?h&&"source"===t||!h&&"target"===t:n!==r||s!==i);v.isValid=f&&u(c),v.toHandle=Lr(n,t,s,d,o,!1)}return v}const jr={onPointerDown:function(t,{connectionMode:n,connectionRadius:o,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:h,panBy:f,cancelConnection:g,onConnectStart:p,onConnect:m,onConnectEnd:y,isValidConnection:v=Tr,onReconnectEnd:x,updateConnection:w,getTransform:b,getFromHandle:S,autoPanSpeed:C}){const E=qo(t.target);let k,N=0;const{x:M,y:_}=er(t),P=E?.elementFromPoint(M,_),z=Br(s,P),O=l?.getBoundingClientRect();if(!O||!z)return;const A=Lr(i,z,r,c,n);if(!A)return;let R=er(t,O),I=!1,D=null,$=!1,L=null;function B(){if(!d||!O)return;const[e,t]=No(R,O,C);f({x:e,y:t}),N=requestAnimationFrame(B)}const T={...A,nodeId:i,type:z,position:A.position},V=c.get(i),j={inProgress:!0,isValid:null,from:yr(V,T,e.Position.Left,!0),fromHandle:T,fromPosition:T.position,fromNode:V,to:R,toHandle:null,toPosition:lo[T.position],toNode:null};w(j);let H=j;function X(e){if(!S()||!T)return void Y(e);const t=b();R=er(e,O),k=$r(Bo(R,t,!1,[1,1]),o,c,T),I||(B(),I=!0);const s=Vr(e,{handle:k,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:v,doc:E,lib:u,flowId:h,nodeLookup:c});L=s.handleDomNode,D=s.connection,$=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!k,s.isValid);const l={...H,isValid:$,to:k&&$?To({x:k.x,y:k.y},t):R,toHandle:s.toHandle,toPosition:$&&s.toHandle?s.toHandle.position:lo[T.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null};$&&k&&H.toHandle&&l.toHandle&&H.toHandle.type===l.toHandle.type&&H.toHandle.nodeId===l.toHandle.nodeId&&H.toHandle.id===l.toHandle.id&&H.to.x===l.to.x&&H.to.y===l.to.y||(w(l),H=l)}function Y(e){(k||L)&&D&&$&&m?.(D);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};y?.(e,o),s&&x?.(e,o),g(),cancelAnimationFrame(N),I=!1,$=!1,D=null,L=null,E.removeEventListener("mousemove",X),E.removeEventListener("mouseup",Y),E.removeEventListener("touchmove",X),E.removeEventListener("touchend",Y)}p?.(t,{nodeId:i,handleId:r,handleType:z}),E.addEventListener("mousemove",X),E.addEventListener("mouseup",Y),E.addEventListener("touchmove",X),E.addEventListener("touchend",Y)},isValid:Vr};const Hr=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Xr=e=>({x:e.x,y:e.y,zoom:e.k}),Yr=({x:e,y:t,zoom:n})=>jn.translate(e,t).scale(n),Zr=(e,t)=>e.target.closest(`.${t}`),Wr=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Fr=(e,t=0,n=(()=>{}))=>{const o="number"==typeof t&&t>0;return o||n(),o?e.transition().duration(t).on("end",n):e},Kr=e=>{const t=e.ctrlKey&&Ho()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function Gr({domNode:t,minZoom:n,maxZoom:o,paneClickDistance:r,translateExtent:i,viewport:s,onPanZoom:a,onPanZoomStart:l,onPanZoomEnd:c,onDraggingChange:u}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=t.getBoundingClientRect(),f=Un().clickDistance(!Do(r)||r<0?0:r).scaleExtent([n,o]).translateExtent(i),g=Se(t).call(f);x({x:s.x,y:s.y,zoom:So(s.zoom,n,o)},[[0,0],[h.width,h.height]],i);const p=g.on("wheel.zoom"),m=g.on("dblclick.zoom");function y(e,t){return g?new Promise((n=>{f?.transform(Fr(g,t?.duration,(()=>n(!0))),e)})):Promise.resolve(!1)}function v(){f.on("zoom",null)}async function x(e,t,n){const o=Yr(e),r=f?.constrain()(o,t,n);return r&&await y(r),new Promise((e=>e(r)))}return f.wheelDelta(Kr),{update:function({noWheelClassName:t,noPanClassName:n,onPaneContextMenu:o,userSelectionActive:r,panOnScroll:i,panOnDrag:s,panOnScrollMode:h,panOnScrollSpeed:y,preventScrolling:x,zoomOnPinch:w,zoomOnScroll:b,zoomOnDoubleClick:S,zoomActivationKeyPressed:C,lib:E,onTransformChange:k}){r&&!d.isZoomingOrPanning&&v();const N=i&&!C&&!r?function({zoomPanValues:t,noWheelClassName:n,d3Selection:o,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Zr(d,n))return!1;d.preventDefault(),d.stopImmediatePropagation();const h=o.property("__zoom").k||1;if(d.ctrlKey&&a){const e=Ce(d),t=Kr(d),n=h*Math.pow(2,t);return void r.scaleTo(o,n,e,d)}const f=1===d.deltaMode?20:1;let g=i===e.PanOnScrollMode.Vertical?0:d.deltaX*f,p=i===e.PanOnScrollMode.Horizontal?0:d.deltaY*f;!Ho()&&d.shiftKey&&i!==e.PanOnScrollMode.Vertical&&(g=d.deltaY*f,p=0),r.translateBy(o,-g/h*s,-p/h*s,{internal:!0});const m=Xr(o.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling||(t.isPanScrolling=!0,l?.(d,m)),t.isPanScrolling&&(c?.(d,m),t.panScrollTimeout=setTimeout((()=>{u?.(d,m),t.isPanScrolling=!1}),150))}}({zoomPanValues:d,noWheelClassName:t,d3Selection:g,d3Zoom:f,panOnScrollMode:h,panOnScrollSpeed:y,zoomOnPinch:w,onPanZoomStart:l,onPanZoom:a,onPanZoomEnd:c}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,s=!t&&i&&!o.ctrlKey,a=Zr(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:t,preventScrolling:x,d3ZoomHandler:p});if(g.on("wheel.zoom",N,{passive:!1}),!r){const e=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Xr(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:d,onDraggingChange:u,onPanZoomStart:l});f.on("start",e);const t=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Wr(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Xr(i.transform))}}({zoomPanValues:d,panOnDrag:s,onPaneContextMenu:!!o,onPanZoom:a,onTransformChange:k});f.on("zoom",t);const n=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Wr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&Hr(e.prevViewport,s.transform))){const t=Xr(s.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout((()=>{r?.(s.sourceEvent,t)}),n?150:0)}}}({zoomPanValues:d,panOnDrag:s,panOnScroll:i,onPaneContextMenu:o,onPanZoomEnd:c,onDraggingChange:u});f.on("end",n)}const M=function({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c}){return u=>{const d=e||t,h=n&&u.ctrlKey;if(1===u.button&&"mousedown"===u.type&&(Zr(u,`${c}-flow__node`)||Zr(u,`${c}-flow__edge`)))return!0;if(!(o||d||r||i||n))return!1;if(s)return!1;if(Zr(u,a)&&"wheel"===u.type)return!1;if(Zr(u,l)&&("wheel"!==u.type||r&&"wheel"===u.type&&!e))return!1;if(!n&&u.ctrlKey&&"wheel"===u.type)return!1;if(!n&&"touchstart"===u.type&&u.touches?.length>1)return u.preventDefault(),!1;if(!d&&!r&&!h&&"wheel"===u.type)return!1;if(!o&&("mousedown"===u.type||"touchstart"===u.type))return!1;if(Array.isArray(o)&&!o.includes(u.button)&&"mousedown"===u.type)return!1;const f=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||"wheel"===u.type)&&f}}({zoomActivationKeyPressed:C,panOnDrag:s,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:S,zoomOnPinch:w,userSelectionActive:r,noPanClassName:n,noWheelClassName:t,lib:E});f.filter(M),S?g.on("dblclick.zoom",m):g.on("dblclick.zoom",null)},destroy:v,setViewport:async function(e,t){const n=Yr(e);return await y(n,t),new Promise((e=>e(n)))},setViewportConstrained:x,getViewport:function(){const e=g?Hn(g.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,t){return g?new Promise((n=>{f?.scaleTo(Fr(g,t?.duration,(()=>n(!0))),e)})):Promise.resolve(!1)},scaleBy:function(e,t){return g?new Promise((n=>{f?.scaleBy(Fr(g,t?.duration,(()=>n(!0))),e)})):Promise.resolve(!1)},setScaleExtent:function(e){f?.scaleExtent(e)},setTranslateExtent:function(e){f?.translateExtent(e)},syncViewport:function(e){if(g){const t=Yr(e),n=g.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||f?.transform(g,t,null,{sync:!0})}},setClickDistance:function(e){const t=!Do(e)||e<0?0:e;f?.clickDistance(t)}}}var qr;e.ResizeControlVariant=void 0,(qr=e.ResizeControlVariant||(e.ResizeControlVariant={})).Line="line",qr.Handle="handle";const Ur=["top-left","top-right","bottom-left","bottom-right"],Qr=["top","right","bottom","left"];function Jr(e,t){return Math.max(0,t-e)}function ei(e,t){return Math.max(0,e-t)}function ti(e,t,n){return Math.max(0,t-e,e-n)}function ni(e,t){return e?!t:t}const oi={width:0,height:0,x:0,y:0},ri={...oi,pointerX:0,pointerY:0,aspectRatio:1};function ii(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function si({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=Se(e);return{update:function({controlPosition:e,boundaries:s,keepAspectRatio:a,onResizeStart:l,onResize:c,onResizeEnd:u,shouldResize:d}){let h={...oi},f={...ri};const g=function(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}(e);let p,m,y,v,x=null,w=[];const b=$e().on("start",(e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:s,nodeOrigin:a,paneDomNode:c}=n();if(p=o.get(t),!p)return;x=c?.getBoundingClientRect()??null;const{xSnapped:u,ySnapped:d}=Ko(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:s,containerBounds:x});h={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},f={...h,pointerX:u,pointerY:d,aspectRatio:h.width/h.height},m=void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(m=o.get(p.parentId),y=m&&"parent"===p.extent?function(e){return[[0,0],[e.measured.width,e.measured.height]]}(m):void 0),w=[],v=void 0;for(const[e,n]of o)if(n.parentId===t&&(w.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=ii(n,p,n.origin??a);v=v?[[Math.min(e[0][0],v[0][0]),Math.min(e[0][1],v[0][1])],[Math.max(e[1][0],v[1][0]),Math.max(e[1][1],v[1][1])]]:e}l?.(e,{...h})})).on("drag",(e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:l}=n(),u=Ko(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:x}),b=[];if(!p)return;const{x:S,y:C,width:E,height:k}=h,N={},M=p.origin??l,{width:_,height:P,x:z,y:O}=function(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,h=u&&d,{xSnapped:f,ySnapped:g}=n,{minWidth:p,maxWidth:m,minHeight:y,maxHeight:v}=o,{x:x,y:w,width:b,height:S,aspectRatio:C}=e;let E=Math.floor(u?f-e.pointerX:0),k=Math.floor(d?g-e.pointerY:0);const N=b+(l?-E:E),M=S+(c?-k:k),_=-i[0]*b,P=-i[1]*S;let z=ti(N,p,m),O=ti(M,y,v);if(s){let e=0,t=0;l&&E<0?e=Jr(x+E+_,s[0][0]):!l&&E>0&&(e=ei(x+N+_,s[1][0])),c&&k<0?t=Jr(w+k+P,s[0][1]):!c&&k>0&&(t=ei(w+M+P,s[1][1])),z=Math.max(z,e),O=Math.max(O,t)}if(a){let e=0,t=0;l&&E>0?e=ei(x+E,a[0][0]):!l&&E<0&&(e=Jr(x+N,a[1][0])),c&&k>0?t=ei(w+k,a[0][1]):!c&&k<0&&(t=Jr(w+M,a[1][1])),z=Math.max(z,e),O=Math.max(O,t)}if(r){if(u){const e=ti(N/C,y,v)*C;if(z=Math.max(z,e),s){let e=0;e=!l&&!c||l&&!c&&h?ei(w+P+N/C,s[1][1])*C:Jr(w+P+(l?E:-E)/C,s[0][1])*C,z=Math.max(z,e)}if(a){let e=0;e=!l&&!c||l&&!c&&h?Jr(w+N/C,a[1][1])*C:ei(w+(l?E:-E)/C,a[0][1])*C,z=Math.max(z,e)}}if(d){const e=ti(M*C,p,m)/C;if(O=Math.max(O,e),s){let e=0;e=!l&&!c||c&&!l&&h?ei(x+M*C+_,s[1][0])/C:Jr(x+(c?k:-k)*C+_,s[0][0])/C,O=Math.max(O,e)}if(a){let e=0;e=!l&&!c||c&&!l&&h?Jr(x+M*C,a[1][0])/C:ei(x+(c?k:-k)*C,a[0][0])/C,O=Math.max(O,e)}}}k+=k<0?O:-O,E+=E<0?z:-z,r&&(h?N>M*C?k=(ni(l,c)?-E:E)/C:E=(ni(l,c)?-k:k)*C:u?(k=E/C,c=l):(E=k*C,l=c));const A=l?x+E:x,R=c?w+k:w;return{width:b+(l?-E:E),height:S+(c?-k:k),x:i[0]*E*(l?-1:1)+A,y:i[1]*k*(c?-1:1)+R}}(f,g,u,s,a,M,y,v),A=_!==E,R=P!==k,I=z!==S&&A,D=O!==C&&R;if(!(I||D||A||R))return;if((I||D||1===M[0]||1===M[1])&&(N.x=I?z:h.x,N.y=D?O:h.y,h.x=N.x,h.y=N.y,w.length>0)){const e=z-S,t=O-C;for(const n of w)n.position={x:n.position.x-e+M[0]*(_-E),y:n.position.y-t+M[1]*(P-k)},b.push(n)}if((A||R)&&(N.width=A?_:h.width,N.height=R?P:h.height,h.width=N.width,h.height=N.height),m&&p.expandParent){const e=M[0]*(N.width??0);N.x&&N.x<e&&(h.x=e,f.x=f.x-(N.x-e));const t=M[1]*(N.height??0);N.y&&N.y<t&&(h.y=t,f.y=f.y-(N.y-t))}const $=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=-1*l[0]),a&&i&&(l[1]=-1*l[1]),l}({width:h.width,prevWidth:E,height:h.height,prevHeight:k,affectsX:g.affectsX,affectsY:g.affectsY}),L={...h,direction:$},B=d?.(e,L);!1!==B&&(c?.(e,L),o(N,b))})).on("end",(e=>{u?.(e,{...h}),r?.({...h})}));i.call(b)},destroy:function(){i.on(".drag",null)}}}function ai(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var li,ci,ui,di={exports:{}},hi={},fi={exports:{}},gi={};function pi(){return ci||(ci=1,fi.exports=function(){if(li)return gi;li=1;var e=n,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(e){var n=e.getSnapshot;e=e.value;try{var o=n();return!t(e,o)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=o({inst:{value:n,getSnapshot:t}}),c=l[0].inst,u=l[1];return i((function(){c.value=n,c.getSnapshot=t,a(c)&&u({inst:c})}),[e,n,t]),r((function(){return a(c)&&u({inst:c}),e((function(){a(c)&&u({inst:c})}))}),[e]),s(n),n};return gi.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,gi}()),fi.exports}
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactFlow={},e.jsxRuntime,e.React,e.ReactDOM)}(this,(function(e,t,n,o){"use strict";function r(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=r(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var i={value:()=>{}};function s(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new a(o)}function a(e){this._=e}function l(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function c(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=i,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}a.prototype=s.prototype={constructor:a,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++s<a;)if(n=(e=i[s]).type)r[n]=c(r[n],e.name,t);else if(null==t)for(n in r)r[n]=c(r[n],e.name,null);return this}for(;++s<a;)if((n=(e=i[s]).type)&&(n=l(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new a(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};var u="http://www.w3.org/1999/xhtml",d={svg:"http://www.w3.org/2000/svg",xhtml:u,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function h(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),d.hasOwnProperty(t)?{space:d[t],local:e}:e}function f(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===u&&t.documentElement.namespaceURI===u?t.createElement(e):t.createElementNS(n,e)}}function g(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function p(e){var t=h(e);return(t.local?g:f)(t)}function m(){}function y(e){return null==e?m:function(){return this.querySelector(e)}}function v(){return[]}function x(e){return null==e?v:function(){return this.querySelectorAll(e)}}function w(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function b(e){return function(){return this.matches(e)}}function S(e){return function(t){return t.matches(e)}}var C=Array.prototype.find;function E(){return this.firstElementChild}var k=Array.prototype.filter;function M(){return Array.from(this.children)}function N(e){return new Array(e.length)}function _(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function P(e,t,n,o,r,i){for(var s,a=0,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],o[a]=s):n[a]=new _(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function z(e,t,n,o,r,i,s){var a,l,c,u=new Map,d=t.length,h=i.length,f=new Array(d);for(a=0;a<d;++a)(l=t[a])&&(f[a]=c=s.call(l,l.__data__,a,t)+"",u.has(c)?r[a]=l:u.set(c,l));for(a=0;a<h;++a)c=s.call(e,i[a],a,i)+"",(l=u.get(c))?(o[a]=l,l.__data__=i[a],u.delete(c)):n[a]=new _(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&u.get(f[a])===l&&(r[a]=l)}function O(e){return e.__data__}function A(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function R(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function I(e){return function(){this.removeAttribute(e)}}function D(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $(e,t){return function(){this.setAttribute(e,t)}}function L(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function B(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function T(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function V(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function j(e){return function(){this.style.removeProperty(e)}}function H(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Z(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function X(e,t){return e.style.getPropertyValue(t)||V(e).getComputedStyle(e,null).getPropertyValue(t)}function Y(e){return function(){delete this[e]}}function F(e,t){return function(){this[e]=t}}function W(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function K(e){return e.trim().split(/^|\s+/)}function G(e){return e.classList||new q(e)}function q(e){this._node=e,this._names=K(e.getAttribute("class")||"")}function U(e,t){for(var n=G(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Q(e,t){for(var n=G(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function J(e){return function(){U(this,e)}}function ee(e){return function(){Q(this,e)}}function te(e,t){return function(){(t.apply(this,arguments)?U:Q)(this,e)}}function ne(){this.textContent=""}function oe(e){return function(){this.textContent=e}}function re(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function ie(){this.innerHTML=""}function se(e){return function(){this.innerHTML=e}}function ae(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function le(){this.nextSibling&&this.parentNode.appendChild(this)}function ce(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ue(){return null}function de(){var e=this.parentNode;e&&e.removeChild(this)}function he(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function fe(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ge(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function pe(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);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 me(e,t,n){var o=V(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function ye(e,t){return function(){return me(this,e,t)}}function ve(e,t){return function(){return me(this,e,t.apply(this,arguments))}}_.prototype={constructor:_,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)}},q.prototype={add:function(e){this._names.indexOf(e)<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}};var xe=[null];function we(e,t){this._groups=e,this._parents=t}function be(){return new we([[document.documentElement]],xe)}function Se(e){return"string"==typeof e?new we([[document.querySelector(e)]],[document.documentElement]):new we([[e]],xe)}function Ce(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}we.prototype=be.prototype={constructor:we,select:function(e){"function"!=typeof e&&(e=y(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s,a=t[r],l=a.length,c=o[r]=new Array(l),u=0;u<l;++u)(i=a[u])&&(s=e.call(i,i.__data__,u,a))&&("__data__"in i&&(s.__data__=i.__data__),c[u]=s);return new we(o,this._parents)},selectAll:function(e){e="function"==typeof e?w(e):x(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s,a=t[i],l=a.length,c=0;c<l;++c)(s=a[c])&&(o.push(e.call(s,s.__data__,c,a)),r.push(s));return new we(o,r)},selectChild:function(e){return this.select(null==e?E:function(e){return function(){return C.call(this.children,e)}}("function"==typeof e?e:S(e)))},selectChildren:function(e){return this.selectAll(null==e?M:function(e){return function(){return k.call(this.children,e)}}("function"==typeof e?e:S(e)))},filter:function(e){"function"!=typeof e&&(e=b(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new we(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,O);var n,o=t?z:P,r=this._parents,i=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var s=i.length,a=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var d=r[u],h=i[u],f=h.length,g=A(e.call(d,d&&d.__data__,u,r)),p=g.length,m=l[u]=new Array(p),y=a[u]=new Array(p);o(d,h,m,y,c[u]=new Array(f),g,t);for(var v,x,w=0,b=0;w<p;++w)if(v=m[w]){for(w>=b&&(b=w+1);!(x=y[b])&&++b<p;);v._next=x||null}}return(a=new we(a,r))._enter=l,a._exit=c,a},enter:function(){return new we(this._enter||this._groups.map(N),this._parents)},exit:function(){return new we(this._exit||this._groups.map(N),this._parents)},join:function(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c,u=n[l],d=o[l],h=u.length,f=a[l]=new Array(h),g=0;g<h;++g)(c=u[g]||d[g])&&(f[g]=c);for(;l<r;++l)a[l]=n[l];return new we(a,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,s=r[i];--i>=0;)(o=r[i])&&(s&&4^o.compareDocumentPosition(s)&&s.parentNode.insertBefore(o,s),s=o);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=R);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s,a=n[i],l=a.length,c=r[i]=new Array(l),u=0;u<l;++u)(s=a[u])&&(c[u]=s);c.sort(t)}return new we(r,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],s=0,a=i.length;s<a;++s)(r=i[s])&&e.call(r,r.__data__,s,i);return this},attr:function(e,t){var n=h(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?D:I:"function"==typeof t?n.local?T:B:n.local?L:$)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?j:"function"==typeof t?Z:H)(e,t,null==n?"":n)):X(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Y:"function"==typeof t?W:F)(e,t)):this.node()[e]},classed:function(e,t){var n=K(e+"");if(arguments.length<2){for(var o=G(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?te:t?J:ee)(n,t))},text:function(e){return arguments.length?this.each(null==e?ne:("function"==typeof e?re:oe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?ie:("function"==typeof e?ae:se)(e)):this.node().innerHTML},raise:function(){return this.each(le)},lower:function(){return this.each(ce)},append:function(e){var t="function"==typeof e?e:p(e);return this.select((function(){return this.appendChild(t.apply(this,arguments))}))},insert:function(e,t){var n="function"==typeof e?e:p(e),o=null==t?ue:"function"==typeof t?t:y(t);return this.select((function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)}))},remove:function(){return this.each(de)},clone:function(e){return this.select(e?fe:he)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}(e+""),s=i.length;if(!(arguments.length<2)){for(a=t?pe:ge,o=0;o<s;++o)this.each(a(i[o],t,n));return this}var a=this.node().__on;if(a)for(var l,c=0,u=a.length;c<u;++c)for(o=0,l=a[c];o<s;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?ve:ye)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,s=r.length;i<s;++i)(o=r[i])&&(yield o)}};const Ee={passive:!1},ke={capture:!0,passive:!1};function Me(e){e.stopImmediatePropagation()}function Ne(e){e.preventDefault(),e.stopImmediatePropagation()}function _e(e){var t=e.document.documentElement,n=Se(e).on("dragstart.drag",Ne,ke);"onselectstart"in t?n.on("selectstart.drag",Ne,ke):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Pe(e,t){var n=e.document.documentElement,o=Se(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ne,ke),setTimeout((function(){o.on("click.drag",null)}),0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var ze=e=>()=>e;function Oe(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function Ae(e){return!e.ctrlKey&&!e.button}function Re(){return this.parentNode}function Ie(e,t){return null==t?{x:e.x,y:e.y}:t}function De(){return navigator.maxTouchPoints||"ontouchstart"in this}function $e(){var e,t,n,o,r=Ae,i=Re,a=Ie,l=De,c={},u=s("start","drag","end"),d=0,h=0;function f(e){e.on("mousedown.drag",g).filter(l).on("touchstart.drag",y).on("touchmove.drag",v,Ee).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(s,a){if(!o&&r.call(this,s,a)){var l=w(this,i.call(this,s,a),s,a,"mouse");l&&(Se(s.view).on("mousemove.drag",p,ke).on("mouseup.drag",m,ke),_e(s.view),Me(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function p(o){if(Ne(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>h}c.mouse("drag",o)}function m(e){Se(e.view).on("mousemove.drag mouseup.drag",null),Pe(e.view,n),Ne(e),c.mouse("end",e)}function y(e,t){if(r.call(this,e,t)){var n,o,s=e.changedTouches,a=i.call(this,e,t),l=s.length;for(n=0;n<l;++n)(o=w(this,a,e,t,s[n].identifier,s[n]))&&(Me(e),o("start",e,s[n]))}}function v(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=c[o[t].identifier])&&(Ne(e),n("drag",e,o[t]))}function x(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout((function(){o=null}),500),t=0;t<i;++t)(n=c[r[t].identifier])&&(Me(e),n("end",e,r[t]))}function w(e,t,n,o,r,i){var s,l,h,g=u.copy(),p=Ce(i||n,t);if(null!=(h=a.call(e,new Oe("beforestart",{sourceEvent:n,target:f,identifier:r,active:d,x:p[0],y:p[1],dx:0,dy:0,dispatch:g}),o)))return s=h.x-p[0]||0,l=h.y-p[1]||0,function n(i,a,u){var m,y=p;switch(i){case"start":c[r]=n,m=d++;break;case"end":delete c[r],--d;case"drag":p=Ce(u||a,t),m=d}g.call(i,e,new Oe(i,{sourceEvent:a,subject:h,target:f,identifier:r,active:m,x:p[0]+s,y:p[1]+l,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:g}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:ze(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:ze(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:ze(e),f):a},f.touchable=function(e){return arguments.length?(l="function"==typeof e?e:ze(!!e),f):l},f.on=function(){var e=u.on.apply(u,arguments);return e===u?f:e},f.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,f):Math.sqrt(h)},f}function Le(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Be(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Te(){}Oe.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Ve=.7,je=1/Ve,He="\\s*([+-]?\\d+)\\s*",Ze="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ye=/^#([0-9a-f]{3,8})$/,Fe=new RegExp(`^rgb\\(${He},${He},${He}\\)$`),We=new RegExp(`^rgb\\(${Xe},${Xe},${Xe}\\)$`),Ke=new RegExp(`^rgba\\(${He},${He},${He},${Ze}\\)$`),Ge=new RegExp(`^rgba\\(${Xe},${Xe},${Xe},${Ze}\\)$`),qe=new RegExp(`^hsl\\(${Ze},${Xe},${Xe}\\)$`),Ue=new RegExp(`^hsla\\(${Ze},${Xe},${Xe},${Ze}\\)$`),Qe={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};function Je(){return this.rgb().formatHex()}function et(){return this.rgb().formatRgb()}function tt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Ye.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?nt(t):3===n?new it(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ot(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ot(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Fe.exec(e))?new it(t[1],t[2],t[3],1):(t=We.exec(e))?new it(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Ke.exec(e))?ot(t[1],t[2],t[3],t[4]):(t=Ge.exec(e))?ot(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=qe.exec(e))?dt(t[1],t[2]/100,t[3]/100,1):(t=Ue.exec(e))?dt(t[1],t[2]/100,t[3]/100,t[4]):Qe.hasOwnProperty(e)?nt(Qe[e]):"transparent"===e?new it(NaN,NaN,NaN,0):null}function nt(e){return new it(e>>16&255,e>>8&255,255&e,1)}function ot(e,t,n,o){return o<=0&&(e=t=n=NaN),new it(e,t,n,o)}function rt(e,t,n,o){return 1===arguments.length?((r=e)instanceof Te||(r=tt(r)),r?new it((r=r.rgb()).r,r.g,r.b,r.opacity):new it):new it(e,t,n,null==o?1:o);var r}function it(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function st(){return`#${ut(this.r)}${ut(this.g)}${ut(this.b)}`}function at(){const e=lt(this.opacity);return`${1===e?"rgb(":"rgba("}${ct(this.r)}, ${ct(this.g)}, ${ct(this.b)}${1===e?")":`, ${e})`}`}function lt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ct(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ut(e){return((e=ct(e))<16?"0":"")+e.toString(16)}function dt(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ft(e,t,n,o)}function ht(e){if(e instanceof ft)return new ft(e.h,e.s,e.l,e.opacity);if(e instanceof Te||(e=tt(e)),!e)return new ft;if(e instanceof ft)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(s=t===i?(n-o)/a+6*(n<o):n===i?(o-t)/a+2:(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new ft(s,a,l,e.opacity)}function ft(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function gt(e){return(e=(e||0)%360)<0?e+360:e}function pt(e){return Math.max(0,Math.min(1,e||0))}function mt(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Le(Te,tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Je,formatHex:Je,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ht(this).formatHsl()},formatRgb:et,toString:et}),Le(it,rt,Be(Te,{brighter(e){return e=null==e?je:Math.pow(je,e),new it(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Ve:Math.pow(Ve,e),new it(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new it(ct(this.r),ct(this.g),ct(this.b),lt(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:st,formatHex:st,formatHex8:function(){return`#${ut(this.r)}${ut(this.g)}${ut(this.b)}${ut(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:at,toString:at})),Le(ft,(function(e,t,n,o){return 1===arguments.length?ht(e):new ft(e,t,n,null==o?1:o)}),Be(Te,{brighter(e){return e=null==e?je:Math.pow(je,e),new ft(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Ve:Math.pow(Ve,e),new ft(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new it(mt(e>=240?e-240:e+120,r,o),mt(e,r,o),mt(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new ft(gt(this.h),pt(this.s),pt(this.l),lt(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=lt(this.opacity);return`${1===e?"hsl(":"hsla("}${gt(this.h)}, ${100*pt(this.s)}%, ${100*pt(this.l)}%${1===e?")":`, ${e})`}`}}));var yt=e=>()=>e;function vt(e){return 1==(e=+e)?xt:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):yt(isNaN(t)?n:t)}}function xt(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):yt(isNaN(e)?t:e)}var wt=function e(t){var n=vt(t);function o(e,t){var o=n((e=rt(e)).r,(t=rt(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),s=xt(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=s(t),e+""}}return o.gamma=e,o}(1);function bt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var St=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ct=new RegExp(St.source,"g");function Et(e,t){var n,o,r,i=St.lastIndex=Ct.lastIndex=0,s=-1,a=[],l=[];for(e+="",t+="";(n=St.exec(e))&&(o=Ct.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),a[s]?a[s]+=r:a[++s]=r),(n=n[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,l.push({i:s,x:bt(n,o)})),i=Ct.lastIndex;return i<t.length&&(r=t.slice(i),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)a[(n=l[o]).i]=n.x(e);return a.join("")})}var kt,Mt=180/Math.PI,Nt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _t(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Mt,skewX:Math.atan(l)*Mt,scaleX:s,scaleY:a}}function Pt(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,s){var a=[],l=[];return i=e(i),s=e(s),function(e,o,r,i,s,a){if(e!==r||o!==i){var l=s.push("translate(",null,t,null,n);a.push({i:l-4,x:bt(e,r)},{i:l-2,x:bt(o,i)})}else(r||i)&&s.push("translate("+r+t+i+n)}(i.translateX,i.translateY,s.translateX,s.translateY,a,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:bt(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,s.rotate,a,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:bt(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,s.skewX,a,l),function(e,t,n,o,i,s){if(e!==n||t!==o){var a=i.push(r(i)+"scale(",null,",",null,")");s.push({i:a-4,x:bt(e,n)},{i:a-2,x:bt(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,s.scaleX,s.scaleY,a,l),i=s=null,function(e){for(var t,n=-1,o=l.length;++n<o;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var zt=Pt((function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Nt:_t(t.a,t.b,t.c,t.d,t.e,t.f)}),"px, ","px)","deg)"),Ot=Pt((function(e){return null==e?Nt:(kt||(kt=document.createElementNS("http://www.w3.org/2000/svg","g")),kt.setAttribute("transform",e),(e=kt.transform.baseVal.consolidate())?_t((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Nt)}),", ",")",")");function At(e){return((e=Math.exp(e))+1/e)/2}var Rt,It,Dt=function e(t,n,o){function r(e,r){var i,s,a=e[0],l=e[1],c=e[2],u=r[0],d=r[1],h=r[2],f=u-a,g=d-l,p=f*f+g*g;if(p<1e-12)s=Math.log(h/c)/t,i=function(e){return[a+e*f,l+e*g,c*Math.exp(t*e*s)]};else{var m=Math.sqrt(p),y=(h*h-c*c+o*p)/(2*c*n*m),v=(h*h-c*c-o*p)/(2*h*n*m),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(v*v+1)-v);s=(w-x)/t,i=function(e){var o,r=e*s,i=At(x),u=c/(n*m)*(i*(o=t*r+x,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(x));return[a+u*f,l+u*g,c*i/At(t*r+x)]}}return i.duration=1e3*s*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4),$t=0,Lt=0,Bt=0,Tt=1e3,Vt=0,jt=0,Ht=0,Zt="object"==typeof performance&&performance.now?performance:Date,Xt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Yt(){return jt||(Xt(Ft),jt=Zt.now()+Ht)}function Ft(){jt=0}function Wt(){this._call=this._time=this._next=null}function Kt(e,t,n){var o=new Wt;return o.restart(e,t,n),o}function Gt(){jt=(Vt=Zt.now())+Ht,$t=Lt=0;try{!function(){Yt(),++$t;for(var e,t=Rt;t;)(e=jt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--$t}()}finally{$t=0,function(){var e,t,n=Rt,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Rt=t);It=e,Ut(o)}(),jt=0}}function qt(){var e=Zt.now(),t=e-Vt;t>Tt&&(Ht-=t,Vt=e)}function Ut(e){$t||(Lt&&(Lt=clearTimeout(Lt)),e-jt>24?(e<1/0&&(Lt=setTimeout(Gt,e-Zt.now()-Ht)),Bt&&(Bt=clearInterval(Bt))):(Bt||(Vt=Zt.now(),Bt=setInterval(qt,Tt)),$t=1,Xt(Gt)))}function Qt(e,t,n){var o=new Wt;return t=null==t?0:+t,o.restart((n=>{o.stop(),e(n+t)}),t,n),o}Wt.prototype=Kt.prototype={constructor:Wt,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Yt():+n)+(null==t?0:+t),this._next||It===this||(It?It._next=this:Rt=this,It=this),this._call=e,this._time=n,Ut()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ut())}};var Jt=s("start","end","cancel","interrupt"),en=[],tn=0,nn=1,on=2,rn=3,sn=4,an=5,ln=6;function cn(e,t,n,o,r,i){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(e){n.state=nn,n.timer.restart(s,n.delay,n.time),n.delay<=e&&s(e-n.delay)}function s(i){var c,u,d,h;if(n.state!==nn)return l();for(c in r)if((h=r[c]).name===n.name){if(h.state===rn)return Qt(s);h.state===sn?(h.state=ln,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+c<t&&(h.state=ln,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[c])}if(Qt((function(){n.state===rn&&(n.state=sn,n.timer.restart(a,n.delay,n.time),a(i))})),n.state=on,n.on.call("start",e,e.__data__,n.index,n.group),n.state===on){for(n.state=rn,o=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function a(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=an,1),i=-1,s=o.length;++i<s;)o[i].call(e,r);n.state===an&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var o in n.state=ln,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Kt(i,0,n.time)}(e,n,{name:t,index:o,group:r,on:Jt,tween:en,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:tn})}function un(e,t){var n=hn(e,t);if(n.state>tn)throw new Error("too late; already scheduled");return n}function dn(e,t){var n=hn(e,t);if(n.state>rn)throw new Error("too late; already running");return n}function hn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function fn(e,t){var n,o,r,i=e.__transition,s=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>on&&n.state<an,n.state=ln,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):s=!1;s&&delete e.__transition}}function gn(e,t){var n,o;return function(){var r=dn(this,e),i=r.tween;if(i!==n)for(var s=0,a=(o=n=i).length;s<a;++s)if(o[s].name===t){(o=o.slice()).splice(s,1);break}r.tween=o}}function pn(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=dn(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function mn(e,t,n){var o=e._id;return e.each((function(){var e=dn(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)})),function(e){return hn(e,o).value[t]}}function yn(e,t){var n;return("number"==typeof t?bt:t instanceof tt?wt:(n=tt(t))?(t=n,wt):Et)(e,t)}function vn(e){return function(){this.removeAttribute(e)}}function xn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wn(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttribute(e);return s===i?null:s===o?r:r=t(o=s,n)}}function bn(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===o?r:r=t(o=s,n)}}function Sn(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttribute(e))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttribute(e)}}function Cn(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttributeNS(e.space,e.local))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttributeNS(e.space,e.local)}}function En(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function kn(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function Mn(e,t){return function(){un(this,e).delay=+t.apply(this,arguments)}}function Nn(e,t){return t=+t,function(){un(this,e).delay=t}}function _n(e,t){return function(){dn(this,e).duration=+t.apply(this,arguments)}}function Pn(e,t){return t=+t,function(){dn(this,e).duration=t}}var zn=be.prototype.constructor;function On(e){return function(){this.style.removeProperty(e)}}var An=0;function Rn(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function In(){return++An}var Dn=be.prototype;Rn.prototype={constructor:Rn,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=y(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a,l,c=o[s],u=c.length,d=i[s]=new Array(u),h=0;h<u;++h)(a=c[h])&&(l=e.call(a,a.__data__,h,c))&&("__data__"in a&&(l.__data__=a.__data__),d[h]=l,cn(d[h],t,n,h,d,hn(a,n)));return new Rn(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=x(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l,c=o[a],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var h,f=e.call(l,l.__data__,d,c),g=hn(l,n),p=0,m=f.length;p<m;++p)(h=f[p])&&cn(h,t,n,p,f,g);i.push(f),s.push(l)}return new Rn(i,s,t,n)},selectChild:Dn.selectChild,selectChildren:Dn.selectChildren,filter:function(e){"function"!=typeof e&&(e=b(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new Rn(o,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l,c=t[a],u=n[a],d=c.length,h=s[a]=new Array(d),f=0;f<d;++f)(l=c[f]||u[f])&&(h[f]=l);for(;a<o;++a)s[a]=t[a];return new Rn(s,this._parents,this._name,this._id)},selection:function(){return new zn(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=In(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)if(s=a[c]){var u=hn(s,t);cn(s,e,n,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Rn(o,this._parents,e,n)},call:Dn.call,nodes:Dn.nodes,node:Dn.node,size:Dn.size,empty:Dn.empty,each:Dn.each,on:function(e,t){var n=this._id;return arguments.length<2?hn(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?un:dn;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}(n,e,t))},attr:function(e,t){var n=h(e),o="transform"===n?Ot:yn;return this.attrTween(e,"function"==typeof t?(n.local?Cn:Sn)(n,o,mn(this,"attr."+e,t)):null==t?(n.local?xn:vn)(n):(n.local?bn:wn)(n,o,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=h(e);return this.tween(n,(o.local?En:kn)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?zt:yn;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=X(this,e),s=(this.style.removeProperty(e),X(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}(e,o)).on("end.style."+e,On(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var s=X(this,e),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(e),l=a=X(this,e)),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}(e,o,mn(this,"style."+e,t))).each(function(e,t){var n,o,r,i,s="style."+t,a="end."+s;return function(){var l=dn(this,e),c=l.on,u=null==l.value[s]?i||(i=On(t)):void 0;c===n&&r===u||(o=(n=c).copy()).on(a,r=u),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var s=X(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}(e,o,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(mn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=hn(this.node(),n).tween,i=0,s=r.length;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?gn:pn)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Mn:Nn)(t,e)):hn(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?_n:Pn)(t,e)):hn(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){dn(this,e).ease=t}}(t,e)):hn(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;dn(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,o=n._id,r=n.size();return new Promise((function(i,s){var a={value:s},l={value:function(){0==--r&&i()}};n.each((function(){var n=dn(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),n.on=t})),0===r&&i()}))},[Symbol.iterator]:Dn[Symbol.iterator]};var $n={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Ln(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}be.prototype.interrupt=function(e){return this.each((function(){fn(this,e)}))},be.prototype.transition=function(e){var t,n;e instanceof Rn?(t=e._id,e=e._name):(t=In(),(n=$n).time=Yt(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)(s=a[c])&&cn(s,e,t,c,a,n||Ln(s,t));return new Rn(o,this._parents,e,t)};var Bn=e=>()=>e;function Tn(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Vn(e,t,n){this.k=e,this.x=t,this.y=n}Vn.prototype={constructor:Vn,scale:function(e){return 1===e?this:new Vn(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Vn(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 jn=new Vn(1,0,0);function Hn(e){for(;!e.__zoom;)if(!(e=e.parentNode))return jn;return e.__zoom}function Zn(e){e.stopImmediatePropagation()}function Xn(e){e.preventDefault(),e.stopImmediatePropagation()}function Yn(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Fn(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).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 Wn(){return this.__zoom||jn}function Kn(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Gn(){return navigator.maxTouchPoints||"ontouchstart"in this}function qn(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Un(){var e,t,n,o=Yn,r=Fn,i=qn,a=Kn,l=Gn,c=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,h=Dt,f=s("start","zoom","end"),g=500,p=150,m=0,y=10;function v(e){e.property("__zoom",Wn).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",N).filter(l).on("touchstart.zoom",_).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(e,t){return(t=Math.max(c[0],Math.min(c[1],t)))===e.k?e:new Vn(t,e.x,e.y)}function w(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Vn(e.k,o,r)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function S(e,t,n,o){e.on("start.zoom",(function(){C(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){C(this,arguments).event(o).end()})).tween("zoom",(function(){var e=this,i=arguments,s=C(e,i).event(o),a=r.apply(e,i),l=null==n?b(a):"function"==typeof n?n.apply(e,i):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),u=e.__zoom,d="function"==typeof t?t.apply(e,i):t,f=h(u.invert(l).concat(c/u.k),d.invert(l).concat(c/d.k));return function(e){if(1===e)e=d;else{var t=f(e),n=c/t[2];e=new Vn(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}}))}function C(e,t,n){return!n&&e.__zooming||new E(e,t)}function E(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function k(e,...t){if(o.apply(this,arguments)){var n=C(this,t).event(e),r=this.__zoom,s=Math.max(c[0],Math.min(c[1],r.k*Math.pow(2,a.apply(this,arguments)))),l=Ce(e);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=r.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(r.k===s)return;n.mouse=[l,r.invert(l)],fn(this),n.start()}Xn(e),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),p),n.zoom("mouse",i(w(x(r,s),n.mouse[0],n.mouse[1]),n.extent,u))}}function M(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,s=C(this,t,!0).event(e),a=Se(e.view).on("mousemove.zoom",(function(e){if(Xn(e),!s.moved){var t=e.clientX-c,n=e.clientY-d;s.moved=t*t+n*n>m}s.event(e).zoom("mouse",i(w(s.that.__zoom,s.mouse[0]=Ce(e,r),s.mouse[1]),s.extent,u))}),!0).on("mouseup.zoom",(function(e){a.on("mousemove.zoom mouseup.zoom",null),Pe(e.view,s.moved),Xn(e),s.event(e).end()}),!0),l=Ce(e,r),c=e.clientX,d=e.clientY;_e(e.view),Zn(e),s.mouse=[l,this.__zoom.invert(l)],fn(this),s.start()}}function N(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,s=Ce(e.changedTouches?e.changedTouches[0]:e,this),a=n.invert(s),l=n.k*(e.shiftKey?.5:2),c=i(w(x(n,l),s,a),r.apply(this,t),u);Xn(e),d>0?Se(this).transition().duration(d).call(S,c,s,e):Se(this).call(v.transform,c,s,e)}}function _(n,...r){if(o.apply(this,arguments)){var i,s,a,l,c=n.touches,u=c.length,d=C(this,r,n.changedTouches.length===u).event(n);for(Zn(n),s=0;s<u;++s)l=[l=Ce(a=c[s],this),this.__zoom.invert(l),a.identifier],d.touch0?d.touch1||d.touch0[2]===l[2]||(d.touch1=l,d.taps=0):(d.touch0=l,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(t=l[0],e=setTimeout((function(){e=null}),g)),fn(this),d.start())}}function P(e,...t){if(this.__zooming){var n,o,r,s,a=C(this,t).event(e),l=e.changedTouches,c=l.length;for(Xn(e),n=0;n<c;++n)r=Ce(o=l[n],this),a.touch0&&a.touch0[2]===o.identifier?a.touch0[0]=r:a.touch1&&a.touch1[2]===o.identifier&&(a.touch1[0]=r);if(o=a.that.__zoom,a.touch1){var d=a.touch0[0],h=a.touch0[1],f=a.touch1[0],g=a.touch1[1],p=(p=f[0]-d[0])*p+(p=f[1]-d[1])*p,m=(m=g[0]-h[0])*m+(m=g[1]-h[1])*m;o=x(o,Math.sqrt(p/m)),r=[(d[0]+f[0])/2,(d[1]+f[1])/2],s=[(h[0]+g[0])/2,(h[1]+g[1])/2]}else{if(!a.touch0)return;r=a.touch0[0],s=a.touch0[1]}a.zoom("touch",i(w(o,r,s),a.extent,u))}}function z(e,...o){if(this.__zooming){var r,i,s=C(this,o).event(e),a=e.changedTouches,l=a.length;for(Zn(e),n&&clearTimeout(n),n=setTimeout((function(){n=null}),g),r=0;r<l;++r)i=a[r],s.touch0&&s.touch0[2]===i.identifier?delete s.touch0:s.touch1&&s.touch1[2]===i.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(i=Ce(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<y)){var c=Se(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return v.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",Wn),e!==r?S(e,t,n,o):r.interrupt().each((function(){C(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}))},v.scaleBy=function(e,t,n,o){v.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)}),n,o)},v.scaleTo=function(e,t,n,o){v.transform(e,(function(){var e=r.apply(this,arguments),o=this.__zoom,s=null==n?b(e):"function"==typeof n?n.apply(this,arguments):n,a=o.invert(s),l="function"==typeof t?t.apply(this,arguments):t;return i(w(x(o,l),s,a),e,u)}),n,o)},v.translateBy=function(e,t,n,o){v.transform(e,(function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),u)}),null,o)},v.translateTo=function(e,t,n,o,s){v.transform(e,(function(){var e=r.apply(this,arguments),s=this.__zoom,a=null==o?b(e):"function"==typeof o?o.apply(this,arguments):o;return i(jn.translate(a[0],a[1]).scale(s.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,u)}),o,s)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=Se(this.that).datum();f.call(e,this.that,new Tn(e,{sourceEvent:this.sourceEvent,target:v,type:e,transform:this.that.__zoom,dispatch:f}),t)}},v.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:Bn(+e),v):a},v.filter=function(e){return arguments.length?(o="function"==typeof e?e:Bn(!!e),v):o},v.touchable=function(e){return arguments.length?(l="function"==typeof e?e:Bn(!!e),v):l},v.extent=function(e){return arguments.length?(r="function"==typeof e?e:Bn([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),v):r},v.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],v):[c[0],c[1]]},v.translateExtent=function(e){return arguments.length?(u[0][0]=+e[0][0],u[1][0]=+e[1][0],u[0][1]=+e[0][1],u[1][1]=+e[1][1],v):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},v.constrain=function(e){return arguments.length?(i=e,v):i},v.duration=function(e){return arguments.length?(d=+e,v):d},v.interpolate=function(e){return arguments.length?(h=e,v):h},v.on=function(){var e=f.on.apply(f,arguments);return e===f?v:e},v.clickDistance=function(e){return arguments.length?(m=(e=+e)*e,v):Math.sqrt(m)},v.tapDistance=function(e){return arguments.length?(y=+e,v):y},v}Hn.prototype=Vn.prototype;const Qn={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Jn=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],eo=["Enter"," ","Escape"];var to,no,oo;e.ConnectionMode=void 0,(to=e.ConnectionMode||(e.ConnectionMode={})).Strict="strict",to.Loose="loose",e.PanOnScrollMode=void 0,(no=e.PanOnScrollMode||(e.PanOnScrollMode={})).Free="free",no.Vertical="vertical",no.Horizontal="horizontal",e.SelectionMode=void 0,(oo=e.SelectionMode||(e.SelectionMode={})).Partial="partial",oo.Full="full";const ro={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var io,so,ao;e.ConnectionLineType=void 0,(io=e.ConnectionLineType||(e.ConnectionLineType={})).Bezier="default",io.Straight="straight",io.Step="step",io.SmoothStep="smoothstep",io.SimpleBezier="simplebezier",e.MarkerType=void 0,(so=e.MarkerType||(e.MarkerType={})).Arrow="arrow",so.ArrowClosed="arrowclosed",e.Position=void 0,(ao=e.Position||(e.Position={})).Left="left",ao.Top="top",ao.Right="right",ao.Bottom="bottom";const lo={[e.Position.Left]:e.Position.Right,[e.Position.Right]:e.Position.Left,[e.Position.Top]:e.Position.Bottom,[e.Position.Bottom]:e.Position.Top};function co(e,t){if(!e&&!t)return!0;if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(const n of e.keys())if(!t.has(n))return!1;return!0}function uo(e,t,n){if(!n)return;const o=[];e.forEach(((e,n)=>{t?.has(n)||o.push(e)})),o.length&&n(o)}function ho(e){return null===e?null:e?"valid":"invalid"}const fo=e=>"id"in e&&"source"in e&&"target"in e,go=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),po=(e,t=[0,0])=>{const{width:n,height:o}=Xo(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},mo=(e,t={nodeOrigin:[0,0]})=>{if(0===e.length)return{x:0,y:0,width:0,height:0};const n=e.reduce(((e,n)=>{const o="string"==typeof n;let r=t.nodeLookup||o?void 0:n;t.nodeLookup&&(r=o?t.nodeLookup.get(n):go(n)?n:t.nodeLookup.get(n.id));const i=r?Oo(r,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return No(e,i)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Po(n)},yo=(e,t={})=>{if(0===e.size)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach((e=>{if(void 0===t.filter||t.filter(e)){const t=Oo(e);n=No(n,t)}})),Po(n)},vo=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...Bo(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(s&&!n||o)continue;const r=e.width??t.width??t.initialWidth??null,c=e.height??t.height??t.initialHeight??null,u=Ro(a,zo(t)),d=(r??0)*(c??0),h=i&&u>0;(!t.internals.handleBounds||h||u>=d||t.dragging)&&l.push(t)}return l},xo=(e,t)=>{const n=new Set;return e.forEach((e=>{n.add(e.id)})),t.filter((e=>n.has(e.source)||n.has(e.target)))};async function wo({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(0===e.size)return Promise.resolve(!0);const a=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map((e=>e.id))):null;return e.forEach((e=>{!e.measured.width||!e.measured.height||!t?.includeHiddenNodes&&e.hidden||o&&!o.has(e.id)||n.set(e.id,e)})),n}(e,s),l=yo(a),c=jo(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration}),Promise.resolve(!0)}function bo({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=r;if("parent"!==s.extent||s.expandParent)a&&Zo(s.extent)&&(d=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);else if(a){const e=a.measured.width,t=a.measured.height;e&&t&&(d=[[l,c],[l+e,c+t]])}else i?.("005",Qn.error005());const h=Zo(d)?Co(t,d,s.measured):t;return void 0!==s.measured.width&&void 0!==s.measured.height||i?.("015",Qn.error015()),{position:{x:h.x-l+(s.measured.width??0)*u[0],y:h.y-c+(s.measured.height??0)*u[1]},positionAbsolute:h}}const So=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Co=(e={x:0,y:0},t,n)=>({x:So(e.x,t[0][0],t[1][0]-(n?.width??0)),y:So(e.y,t[0][1],t[1][1]-(n?.height??0))});function Eo(e,t,n){const{width:o,height:r}=Xo(n),{x:i,y:s}=n.internals.positionAbsolute;return Co(e,[[i,s],[i+o,s+r]],t)}const ko=(e,t,n)=>e<t?So(Math.abs(e-t),1,t)/t:e>n?-So(Math.abs(e-n),1,t)/t:0,Mo=(e,t,n=15,o=40)=>[ko(e.x,o,t.width-o)*n,ko(e.y,o,t.height-o)*n],No=(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)}),_o=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Po=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),zo=(e,t=[0,0])=>{const{x:n,y:o}=go(e)?e.internals.positionAbsolute:po(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Oo=(e,t=[0,0])=>{const{x:n,y:o}=go(e)?e.internals.positionAbsolute:po(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Ao=(e,t)=>Po(No(_o(e),_o(t))),Ro=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Io=e=>Do(e.width)&&Do(e.height)&&Do(e.x)&&Do(e.y),Do=e=>!isNaN(e)&&isFinite(e),$o=(e,t)=>{},Lo=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Bo=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Lo(a,s):a},To=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Vo(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&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}const jo=(e,t,n,o,r,i)=>{const s=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Vo(e,n),r=Vo(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Vo(e.top??e.y??0,n),r=Vo(e.bottom??e.y??0,n),i=Vo(e.left??e.x??0,t),s=Vo(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=So(c,o,r),d=t/2-(e.x+e.width/2)*u,h=n/2-(e.y+e.height/2)*u,f=function(e,t,n,o,r,i){const{x:s,y:a}=To(e,[t,n,o]),{x:l,y:c}=To({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}(e,d,h,u,t,n),g=Math.min(f.left-s.left,0),p=Math.min(f.top-s.top,0);return{x:d-g+Math.min(f.right-s.right,0),y:h-p+Math.min(f.bottom-s.bottom,0),zoom:u}},Ho=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Zo(e){return void 0!==e&&"parent"!==e}function Xo(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Yo(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function Fo(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const e=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function Wo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ko(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=er(e),a=Bo({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?Lo(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const Go=e=>({width:e.offsetWidth,height:e.offsetHeight}),qo=e=>e?.getRootNode?.()||window?.document,Uo=["INPUT","SELECT","TEXTAREA"];function Qo(e){const t=e.composedPath?.()?.[0]||e.target;if(1!==t?.nodeType)return!1;return Uo.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Jo=e=>"clientX"in e,er=(e,t)=>{const n=Jo(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},tr=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map((t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...Go(t)}})):null};function nr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=.125*e+.375*r+.375*s+.125*n,c=.125*t+.375*i+.375*a+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function or(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function rr({pos:t,x1:n,y1:o,x2:r,y2:i,c:s}){switch(t){case e.Position.Left:return[n-or(n-r,s),o];case e.Position.Right:return[n+or(r-n,s),o];case e.Position.Top:return[n,o-or(o-i,s)];case e.Position.Bottom:return[n,o+or(i-o,s)]}}function ir({sourceX:t,sourceY:n,sourcePosition:o=e.Position.Bottom,targetX:r,targetY:i,targetPosition:s=e.Position.Top,curvature:a=.25}){const[l,c]=rr({pos:o,x1:t,y1:n,x2:r,y2:i,c:a}),[u,d]=rr({pos:s,x1:r,y1:i,x2:t,y2:n,c:a}),[h,f,g,p]=nr({sourceX:t,sourceY:n,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${t},${n} C${l},${c} ${u},${d} ${r},${i}`,h,f,g,p]}function sr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2;return[i,o<t?o+s:o-s,r,s]}function ar({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=No(Oo(e),Oo(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Ro(s,Po(i))>0}const lr=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,cr=(e,t)=>{if(!e.source||!e.target)return t;let n;return n=fo(e)?{...e}:{...e,id:lr(e)},((e,t)=>t.some((t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle)))))(n,t)?t:(null===n.sourceHandle&&delete n.sourceHandle,null===n.targetHandle&&delete n.targetHandle,t.concat(n))};function ur({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=sr({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const dr={[e.Position.Left]:{x:-1,y:0},[e.Position.Right]:{x:1,y:0},[e.Position.Top]:{x:0,y:-1},[e.Position.Bottom]:{x:0,y:1}},hr=({source:t,sourcePosition:n=e.Position.Bottom,target:o})=>n===e.Position.Left||n===e.Position.Right?t.x<o.x?{x:1,y:0}:{x:-1,y:0}:t.y<o.y?{x:0,y:1}:{x:0,y:-1},fr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function gr({sourceX:t,sourceY:n,sourcePosition:o=e.Position.Bottom,targetX:r,targetY:i,targetPosition:s=e.Position.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20}){const[d,h,f,g,p]=function({source:t,sourcePosition:n=e.Position.Bottom,target:o,targetPosition:r=e.Position.Top,center:i,offset:s}){const a=dr[n],l=dr[r],c={x:t.x+a.x*s,y:t.y+a.y*s},u={x:o.x+l.x*s,y:o.y+l.y*s},d=hr({source:c,sourcePosition:n,target:u}),h=0!==d.x?"x":"y",f=d[h];let g,p,m=[];const y={x:0,y:0},v={x:0,y:0},[x,w,b,S]=sr({sourceX:t.x,sourceY:t.y,targetX:o.x,targetY:o.y});if(a[h]*l[h]==-1){g=i.x??x,p=i.y??w;const e=[{x:g,y:c.y},{x:g,y:u.y}],t=[{x:c.x,y:p},{x:u.x,y:p}];m=a[h]===f?"x"===h?e:t:"x"===h?t:e}else{const e=[{x:c.x,y:u.y}],i=[{x:u.x,y:c.y}];if(m="x"===h?a.x===f?i:e:a.y===f?e:i,n===r){const e=Math.abs(t[h]-o[h]);if(e<=s){const n=Math.min(s-1,s-e);a[h]===f?y[h]=(c[h]>t[h]?-1:1)*n:v[h]=(u[h]>o[h]?-1:1)*n}}if(n!==r){const t="x"===h?"y":"x",n=a[h]===l[t],o=c[t]>u[t],r=c[t]<u[t];(1===a[h]&&(!n&&o||n&&r)||1!==a[h]&&(!n&&r||n&&o))&&(m="x"===h?e:i)}const d={x:c.x+y.x,y:c.y+y.y},x={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(x.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(x.y-m[0].y))?(g=(d.x+x.x)/2,p=m[0].y):(g=m[0].x,p=(d.y+x.y)/2)}return[[t,{x:c.x+y.x,y:c.y+y.y},...m,{x:u.x+v.x,y:u.y+v.y},o],g,p,b,S]}({source:{x:t,y:n},sourcePosition:o,target:{x:r,y:i},targetPosition:s,center:{x:l,y:c},offset:u});return[d.reduce(((e,t,n)=>{let o="";return o=n>0&&n<d.length-1?function(e,t,n,o){const r=Math.min(fr(e,t)/2,fr(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s)return`L ${i+r*(e.x<n.x?-1:1)},${s}Q ${i},${s} ${i},${s+r*(e.y<n.y?1:-1)}`;const a=e.x<n.x?1:-1;return`L ${i},${s+r*(e.y<n.y?-1:1)}Q ${i},${s} ${i+r*a},${s}`}(d[n-1],t,d[n+1],a):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o}),""),h,f,g,p]}function pr(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function mr(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function yr(t,n,o=e.Position.Left,r=!1){const i=(n?.x??0)+t.internals.positionAbsolute.x,s=(n?.y??0)+t.internals.positionAbsolute.y,{width:a,height:l}=n??Xo(t);if(r)return{x:i+a/2,y:s+l/2};switch(n?.position??o){case e.Position.Top:return{x:i+a/2,y:s};case e.Position.Right:return{x:i+a,y:s+l/2};case e.Position.Bottom:return{x:i+a/2,y:s+l};case e.Position.Left:return{x:i,y:s+l/2}}}function vr(e,t){return e&&(t?e.find((e=>e.id===t)):e[0])||null}function xr(e,t){if(!e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map((t=>`${t}=${e[t]}`)).join("&")}`}function wr(t,n,o,r,i){let s=.5;"start"===i?s=0:"end"===i&&(s=1);let a=[(t.x+t.width*s)*n.zoom+n.x,t.y*n.zoom+n.y-r],l=[-100*s,-100];switch(o){case e.Position.Right:a=[(t.x+t.width)*n.zoom+n.x+r,(t.y+t.height*s)*n.zoom+n.y],l=[0,-100*s];break;case e.Position.Bottom:a[1]=(t.y+t.height)*n.zoom+n.y+r,l[1]=0;break;case e.Position.Left:a=[t.x*n.zoom+n.x-r,(t.y+t.height*s)*n.zoom+n.y],l=[-100,-100*s]}return`translate(${a[0]}px, ${a[1]}px) translate(${l[0]}%, ${l[1]}%)`}const br={nodeOrigin:[0,0],nodeExtent:Jn,elevateNodesOnSelect:!0,defaults:{}},Sr={...br,checkEquality:!0};function Cr(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function Er(e,t,n,o){const r=Cr(Sr,o);let i=e.length>0;const s=new Map(t),a=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const l of e){let e=s.get(l.id);if(r.checkEquality&&l===e?.internals.userNode)t.set(l.id,e);else{const n=po(l,r.nodeOrigin),o=Zo(l.extent)?l.extent:r.nodeExtent,i=Co(n,o,Xo(l));e={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:i,handleBounds:l.measured?e?.internals.handleBounds:void 0,z:Mr(l,a),userNode:l}},t.set(l.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(i=!1),l.parentId&&kr(e,t,n,o)}return i}function kr(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:s}=Cr(br,o),a=e.parentId,l=t.get(a);if(!l)return void console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(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]]))}(e,n);const c=r?1e3:0,{x:u,y:d,z:h}=function(e,t,n,o,r){const{x:i,y:s}=t.internals.positionAbsolute,a=Xo(e),l=po(e,n),c=Zo(e.extent)?Co(l,e.extent,a):l;let u=Co({x:i+c.x,y:s+c.y},o,a);"parent"===e.extent&&(u=Eo(u,a,t));const d=Mr(e,r),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>d?h:d}}(e,l,i,s,c),{positionAbsolute:f}=e.internals,g=u!==f.x||d!==f.y;(g||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:g?{x:u,y:d}:f,z:h}})}function Mr(e,t){return(Do(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Nr(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??zo(e),r=Ao(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach((({expandedRect:t,parent:i},s)=>{const a=i.internals.positionAbsolute,l=Xo(i),c=i.origin??o,u=t.x<a.x?Math.round(Math.abs(a.x-t.x)):0,d=t.y<a.y?Math.round(Math.abs(a.y-t.y)):0,h=Math.max(l.width,Math.round(t.width)),f=Math.max(l.height,Math.round(t.height)),g=(h-l.width)*c[0],p=(f-l.height)*c[1];(u>0||d>0||g||p)&&(r.push({id:s,type:"position",position:{x:i.position.x-u+g,y:i.position.y-d+p}}),n.get(s)?.forEach((t=>{e.some((e=>e.id===t.id))||r.push({id:t.id,type:"position",position:{x:t.position.x+u,y:t.position.y+d}})}))),(l.width<t.width||l.height<t.height||u||d)&&r.push({id:s,type:"dimensions",setAttributes:!0,dimensions:{width:h+(u?c[0]*u-g:0),height:f+(d?c[1]*d-p:0)}})})),r}function _r(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const a=o.get(s)||new Map;o.set(s,a.set(n,t))}}function Pr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:s=null}=o,a={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:s},l=`${n}-${i}--${r}-${s}`;_r("source",a,`${r}-${s}--${n}-${i}`,e,n,i),_r("target",a,l,e,r,s),t.set(o.id,o)}}function zr(e,t){if(null===e||null===t)return!1;const n=Array.isArray(e)?e:[e],o=Array.isArray(t)?t:[t];if(n.length!==o.length)return!1;for(let e=0;e<n.length;e++)if(n[e].id!==o[e].id||n[e].type!==o[e].type||!Object.is(n[e].data,o[e].data))return!1;return!0}function Or(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Or(n,t))}function Ar(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Rr({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Ir({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,h=null,f=!1;return{update:function({noDragClassName:g,handleSelector:p,domNode:m,isSelectable:y,nodeId:v,nodeClickDistance:x=0}){function w({x:e,y:n},r){const{nodeLookup:s,nodeExtent:l,snapGrid:c,snapToGrid:u,nodeOrigin:d,onNodeDrag:h,onSelectionDrag:f,onError:g,updateNodePositions:p}=t();i={x:e,y:n};let m=!1,y={x:0,y:0,x2:0,y2:0};if(a.size>1&&l){const e=yo(a);y=_o(e)}for(const[t,o]of a){if(!s.has(t))continue;let r={x:e-o.distance.x,y:n-o.distance.y};u&&(r=Lo(r,c));let i=[[l[0][0],l[0][1]],[l[1][0],l[1][1]]];if(a.size>1&&l&&!o.extent){const{positionAbsolute:e}=o.internals,t=e.x-y.x+l[0][0],n=e.x+o.measured.width-y.x2+l[1][0];i=[[t,e.y-y.y+l[0][1]],[n,e.y+o.measured.height-y.y2+l[1][1]]]}const{position:h,positionAbsolute:f}=bo({nodeId:t,nextPosition:r,nodeLookup:s,nodeExtent:i,nodeOrigin:d,onError:g});m=m||o.position.x!==h.x||o.position.y!==h.y,o.position=h,o.internals.positionAbsolute=f}if(m&&(p(a,!0),r&&(o||h||!v&&f))){const[e,t]=Rr({nodeId:v,dragItems:a,nodeLookup:s});o?.(r,a,e,t),h?.(r,e,t),v||f?.(r,t)}}async function b(){if(!u)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(s);const[a,d]=Mo(c,u,o);0===a&&0===d||(i.x=(i.x??0)-a/e[2],i.y=(i.y??0)-d/e[2],await n({x:a,y:d})&&w(i,null)),s=requestAnimationFrame(b)}function S(o){const{nodeLookup:r,multiSelectionActive:s,nodesDraggable:l,transform:c,snapGrid:h,snapToGrid:f,selectNodesOnDrag:g,onNodeDragStart:p,onSelectionDragStart:m,unselectNodesAndEdges:x}=t();d=!0,g&&y||s||!v||r.get(v)?.selected||x(),y&&g&&v&&e?.(v);const w=Ko(o.sourceEvent,{transform:c,snapGrid:h,snapToGrid:f,containerBounds:u});if(i=w,a=function(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Or(s,e))&&(s.draggable||t&&void 0===s.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,w,v),a.size>0&&(n||p||!v&&m)){const[e,t]=Rr({nodeId:v,dragItems:a,nodeLookup:r});n?.(o.sourceEvent,a,e,t),p?.(o.sourceEvent,e,t),v||m?.(o.sourceEvent,t)}}h=Se(m);const C=$e().clickDistance(x).on("start",(e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:s,snapToGrid:a}=t();u=n?.getBoundingClientRect()||null,f=!1,0===o&&S(e);const l=Ko(e.sourceEvent,{transform:r,snapGrid:s,snapToGrid:a,containerBounds:u});i=l,c=er(e.sourceEvent,u)})).on("drag",(e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:s,nodeDragThreshold:h,nodeLookup:g}=t(),p=Ko(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:s,containerBounds:u});if(("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||v&&!g.has(v))&&(f=!0),!f){if(!l&&n&&d&&(l=!0,b()),!d){const t=p.xSnapped-(i.x??0),n=p.ySnapped-(i.y??0);Math.sqrt(t*t+n*n)>h&&S(e)}(i.x!==p.xSnapped||i.y!==p.ySnapped)&&a&&d&&(c=er(e.sourceEvent,u),w(p,e.sourceEvent))}})).on("end",(e=>{if(d&&!f&&(l=!1,d=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:s}=t();if(o(a,!1),r||i||!v&&s){const[t,o]=Rr({nodeId:v,dragItems:a,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,a,t,o),i?.(e.sourceEvent,t,o),v||s?.(e.sourceEvent,o)}}})).filter((e=>{const t=e.target;return!e.button&&(!g||!Ar(t,`.${g}`,m))&&(!p||Ar(t,p,m))}));h.call(C)},destroy:function(){h?.on(".drag",null)}}}const Dr=250;function $r(e,t,n,o){let r=[],i=1/0;const s=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())Ro(r,zo(e))>0&&o.push(e);return o}(e,n,t+Dr);for(const n of s){const s=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const a of s){if(o.nodeId===a.nodeId&&o.type===a.type&&o.id===a.id)continue;const{x:s,y:l}=yr(n,a,a.position,!0),c=Math.sqrt(Math.pow(s-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...a,x:s,y:l}],i=c):c===i&&r.push({...a,x:s,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find((t=>t.type===e))??r[0]}return r[0]}function Lr(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a="strict"===r?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find((e=>e.id===n)):a?.[0])??null;return l&&i?{...l,...yr(s,l,l.position,!0)}:l}function Br(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const Tr=()=>!0;function Vr(t,{handle:n,connectionMode:o,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=Tr,nodeLookup:d}){const h="target"===s,f=n?a.querySelector(`.${l}-flow__handle[data-id="${c}-${n?.nodeId}-${n?.id}-${n?.type}"]`):null,{x:g,y:p}=er(t),m=a.elementFromPoint(g,p),y=m?.classList.contains(`${l}-flow__handle`)?m:f,v={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const t=Br(void 0,y),n=y.getAttribute("data-nodeid"),s=y.getAttribute("data-handleid"),a=y.classList.contains("connectable"),l=y.classList.contains("connectableend");if(!n||!t)return v;const c={source:h?n:r,sourceHandle:h?s:i,target:h?r:n,targetHandle:h?i:s};v.connection=c;const f=a&&l&&(o===e.ConnectionMode.Strict?h&&"source"===t||!h&&"target"===t:n!==r||s!==i);v.isValid=f&&u(c),v.toHandle=Lr(n,t,s,d,o,!1)}return v}const jr={onPointerDown:function(t,{connectionMode:n,connectionRadius:o,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:h,panBy:f,cancelConnection:g,onConnectStart:p,onConnect:m,onConnectEnd:y,isValidConnection:v=Tr,onReconnectEnd:x,updateConnection:w,getTransform:b,getFromHandle:S,autoPanSpeed:C}){const E=qo(t.target);let k,M=0;const{x:N,y:_}=er(t),P=E?.elementFromPoint(N,_),z=Br(s,P),O=l?.getBoundingClientRect();if(!O||!z)return;const A=Lr(i,z,r,c,n);if(!A)return;let R=er(t,O),I=!1,D=null,$=!1,L=null;function B(){if(!d||!O)return;const[e,t]=Mo(R,O,C);f({x:e,y:t}),M=requestAnimationFrame(B)}const T={...A,nodeId:i,type:z,position:A.position},V=c.get(i),j={inProgress:!0,isValid:null,from:yr(V,T,e.Position.Left,!0),fromHandle:T,fromPosition:T.position,fromNode:V,to:R,toHandle:null,toPosition:lo[T.position],toNode:null};w(j);let H=j;function Z(e){if(!S()||!T)return void X(e);const t=b();R=er(e,O),k=$r(Bo(R,t,!1,[1,1]),o,c,T),I||(B(),I=!0);const s=Vr(e,{handle:k,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:v,doc:E,lib:u,flowId:h,nodeLookup:c});L=s.handleDomNode,D=s.connection,$=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!k,s.isValid);const l={...H,isValid:$,to:k&&$?To({x:k.x,y:k.y},t):R,toHandle:s.toHandle,toPosition:$&&s.toHandle?s.toHandle.position:lo[T.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null};$&&k&&H.toHandle&&l.toHandle&&H.toHandle.type===l.toHandle.type&&H.toHandle.nodeId===l.toHandle.nodeId&&H.toHandle.id===l.toHandle.id&&H.to.x===l.to.x&&H.to.y===l.to.y||(w(l),H=l)}function X(e){(k||L)&&D&&$&&m?.(D);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};y?.(e,o),s&&x?.(e,o),g(),cancelAnimationFrame(M),I=!1,$=!1,D=null,L=null,E.removeEventListener("mousemove",Z),E.removeEventListener("mouseup",X),E.removeEventListener("touchmove",Z),E.removeEventListener("touchend",X)}p?.(t,{nodeId:i,handleId:r,handleType:z}),E.addEventListener("mousemove",Z),E.addEventListener("mouseup",X),E.addEventListener("touchmove",Z),E.addEventListener("touchend",X)},isValid:Vr};const Hr=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Zr=e=>({x:e.x,y:e.y,zoom:e.k}),Xr=({x:e,y:t,zoom:n})=>jn.translate(e,t).scale(n),Yr=(e,t)=>e.target.closest(`.${t}`),Fr=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Wr=(e,t=0,n=(()=>{}))=>{const o="number"==typeof t&&t>0;return o||n(),o?e.transition().duration(t).on("end",n):e},Kr=e=>{const t=e.ctrlKey&&Ho()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function Gr({domNode:t,minZoom:n,maxZoom:o,paneClickDistance:r,translateExtent:i,viewport:s,onPanZoom:a,onPanZoomStart:l,onPanZoomEnd:c,onDraggingChange:u}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=t.getBoundingClientRect(),f=Un().clickDistance(!Do(r)||r<0?0:r).scaleExtent([n,o]).translateExtent(i),g=Se(t).call(f);x({x:s.x,y:s.y,zoom:So(s.zoom,n,o)},[[0,0],[h.width,h.height]],i);const p=g.on("wheel.zoom"),m=g.on("dblclick.zoom");function y(e,t){return g?new Promise((n=>{f?.transform(Wr(g,t?.duration,(()=>n(!0))),e)})):Promise.resolve(!1)}function v(){f.on("zoom",null)}async function x(e,t,n){const o=Xr(e),r=f?.constrain()(o,t,n);return r&&await y(r),new Promise((e=>e(r)))}return f.wheelDelta(Kr),{update:function({noWheelClassName:t,noPanClassName:n,onPaneContextMenu:o,userSelectionActive:r,panOnScroll:i,panOnDrag:s,panOnScrollMode:h,panOnScrollSpeed:y,preventScrolling:x,zoomOnPinch:w,zoomOnScroll:b,zoomOnDoubleClick:S,zoomActivationKeyPressed:C,lib:E,onTransformChange:k}){r&&!d.isZoomingOrPanning&&v();const M=i&&!C&&!r?function({zoomPanValues:t,noWheelClassName:n,d3Selection:o,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Yr(d,n))return!1;d.preventDefault(),d.stopImmediatePropagation();const h=o.property("__zoom").k||1;if(d.ctrlKey&&a){const e=Ce(d),t=Kr(d),n=h*Math.pow(2,t);return void r.scaleTo(o,n,e,d)}const f=1===d.deltaMode?20:1;let g=i===e.PanOnScrollMode.Vertical?0:d.deltaX*f,p=i===e.PanOnScrollMode.Horizontal?0:d.deltaY*f;!Ho()&&d.shiftKey&&i!==e.PanOnScrollMode.Vertical&&(g=d.deltaY*f,p=0),r.translateBy(o,-g/h*s,-p/h*s,{internal:!0});const m=Zr(o.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling||(t.isPanScrolling=!0,l?.(d,m)),t.isPanScrolling&&(c?.(d,m),t.panScrollTimeout=setTimeout((()=>{u?.(d,m),t.isPanScrolling=!1}),150))}}({zoomPanValues:d,noWheelClassName:t,d3Selection:g,d3Zoom:f,panOnScrollMode:h,panOnScrollSpeed:y,zoomOnPinch:w,onPanZoomStart:l,onPanZoom:a,onPanZoomEnd:c}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,s=!t&&i&&!o.ctrlKey,a=Yr(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:t,preventScrolling:x,d3ZoomHandler:p});if(g.on("wheel.zoom",M,{passive:!1}),!r){const e=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Zr(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:d,onDraggingChange:u,onPanZoomStart:l});f.on("start",e);const t=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Fr(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Zr(i.transform))}}({zoomPanValues:d,panOnDrag:s,onPaneContextMenu:!!o,onPanZoom:a,onTransformChange:k});f.on("zoom",t);const n=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Fr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&Hr(e.prevViewport,s.transform))){const t=Zr(s.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout((()=>{r?.(s.sourceEvent,t)}),n?150:0)}}}({zoomPanValues:d,panOnDrag:s,panOnScroll:i,onPaneContextMenu:o,onPanZoomEnd:c,onDraggingChange:u});f.on("end",n)}const N=function({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c}){return u=>{const d=e||t,h=n&&u.ctrlKey;if(1===u.button&&"mousedown"===u.type&&(Yr(u,`${c}-flow__node`)||Yr(u,`${c}-flow__edge`)))return!0;if(!(o||d||r||i||n))return!1;if(s)return!1;if(Yr(u,a)&&"wheel"===u.type)return!1;if(Yr(u,l)&&("wheel"!==u.type||r&&"wheel"===u.type&&!e))return!1;if(!n&&u.ctrlKey&&"wheel"===u.type)return!1;if(!n&&"touchstart"===u.type&&u.touches?.length>1)return u.preventDefault(),!1;if(!d&&!r&&!h&&"wheel"===u.type)return!1;if(!o&&("mousedown"===u.type||"touchstart"===u.type))return!1;if(Array.isArray(o)&&!o.includes(u.button)&&"mousedown"===u.type)return!1;const f=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||"wheel"===u.type)&&f}}({zoomActivationKeyPressed:C,panOnDrag:s,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:S,zoomOnPinch:w,userSelectionActive:r,noPanClassName:n,noWheelClassName:t,lib:E});f.filter(N),S?g.on("dblclick.zoom",m):g.on("dblclick.zoom",null)},destroy:v,setViewport:async function(e,t){const n=Xr(e);return await y(n,t),new Promise((e=>e(n)))},setViewportConstrained:x,getViewport:function(){const e=g?Hn(g.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,t){return g?new Promise((n=>{f?.scaleTo(Wr(g,t?.duration,(()=>n(!0))),e)})):Promise.resolve(!1)},scaleBy:function(e,t){return g?new Promise((n=>{f?.scaleBy(Wr(g,t?.duration,(()=>n(!0))),e)})):Promise.resolve(!1)},setScaleExtent:function(e){f?.scaleExtent(e)},setTranslateExtent:function(e){f?.translateExtent(e)},syncViewport:function(e){if(g){const t=Xr(e),n=g.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||f?.transform(g,t,null,{sync:!0})}},setClickDistance:function(e){const t=!Do(e)||e<0?0:e;f?.clickDistance(t)}}}var qr;e.ResizeControlVariant=void 0,(qr=e.ResizeControlVariant||(e.ResizeControlVariant={})).Line="line",qr.Handle="handle";const Ur=["top-left","top-right","bottom-left","bottom-right"],Qr=["top","right","bottom","left"];function Jr(e,t){return Math.max(0,t-e)}function ei(e,t){return Math.max(0,e-t)}function ti(e,t,n){return Math.max(0,t-e,e-n)}function ni(e,t){return e?!t:t}const oi={width:0,height:0,x:0,y:0},ri={...oi,pointerX:0,pointerY:0,aspectRatio:1};function ii(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function si({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=Se(e);return{update:function({controlPosition:e,boundaries:s,keepAspectRatio:a,resizeDirection:l,onResizeStart:c,onResize:u,onResizeEnd:d,shouldResize:h}){let f={...oi},g={...ri};const p=function(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}(e);let m,y,v,x,w=null,b=[];const S=$e().on("start",(e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:s,nodeOrigin:a,paneDomNode:l}=n();if(m=o.get(t),!m)return;w=l?.getBoundingClientRect()??null;const{xSnapped:u,ySnapped:d}=Ko(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:s,containerBounds:w});f={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},g={...f,pointerX:u,pointerY:d,aspectRatio:f.width/f.height},y=void 0,m.parentId&&("parent"===m.extent||m.expandParent)&&(y=o.get(m.parentId),v=y&&"parent"===m.extent?function(e){return[[0,0],[e.measured.width,e.measured.height]]}(y):void 0),b=[],x=void 0;for(const[e,n]of o)if(n.parentId===t&&(b.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=ii(n,m,n.origin??a);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}c?.(e,{...f})})).on("drag",(e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:c}=n(),d=Ko(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),S=[];if(!m)return;const{x:C,y:E,width:k,height:M}=f,N={},_=m.origin??c,{width:P,height:z,x:O,y:A}=function(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,h=u&&d,{xSnapped:f,ySnapped:g}=n,{minWidth:p,maxWidth:m,minHeight:y,maxHeight:v}=o,{x:x,y:w,width:b,height:S,aspectRatio:C}=e;let E=Math.floor(u?f-e.pointerX:0),k=Math.floor(d?g-e.pointerY:0);const M=b+(l?-E:E),N=S+(c?-k:k),_=-i[0]*b,P=-i[1]*S;let z=ti(M,p,m),O=ti(N,y,v);if(s){let e=0,t=0;l&&E<0?e=Jr(x+E+_,s[0][0]):!l&&E>0&&(e=ei(x+M+_,s[1][0])),c&&k<0?t=Jr(w+k+P,s[0][1]):!c&&k>0&&(t=ei(w+N+P,s[1][1])),z=Math.max(z,e),O=Math.max(O,t)}if(a){let e=0,t=0;l&&E>0?e=ei(x+E,a[0][0]):!l&&E<0&&(e=Jr(x+M,a[1][0])),c&&k>0?t=ei(w+k,a[0][1]):!c&&k<0&&(t=Jr(w+N,a[1][1])),z=Math.max(z,e),O=Math.max(O,t)}if(r){if(u){const e=ti(M/C,y,v)*C;if(z=Math.max(z,e),s){let e=0;e=!l&&!c||l&&!c&&h?ei(w+P+M/C,s[1][1])*C:Jr(w+P+(l?E:-E)/C,s[0][1])*C,z=Math.max(z,e)}if(a){let e=0;e=!l&&!c||l&&!c&&h?Jr(w+M/C,a[1][1])*C:ei(w+(l?E:-E)/C,a[0][1])*C,z=Math.max(z,e)}}if(d){const e=ti(N*C,p,m)/C;if(O=Math.max(O,e),s){let e=0;e=!l&&!c||c&&!l&&h?ei(x+N*C+_,s[1][0])/C:Jr(x+(c?k:-k)*C+_,s[0][0])/C,O=Math.max(O,e)}if(a){let e=0;e=!l&&!c||c&&!l&&h?Jr(x+N*C,a[1][0])/C:ei(x+(c?k:-k)*C,a[0][0])/C,O=Math.max(O,e)}}}k+=k<0?O:-O,E+=E<0?z:-z,r&&(h?M>N*C?k=(ni(l,c)?-E:E)/C:E=(ni(l,c)?-k:k)*C:u?(k=E/C,c=l):(E=k*C,l=c));const A=l?x+E:x,R=c?w+k:w;return{width:b+(l?-E:E),height:S+(c?-k:k),x:i[0]*E*(l?-1:1)+A,y:i[1]*k*(c?-1:1)+R}}(g,p,d,s,a,_,v,x),R=P!==k,I=z!==M,D=O!==C&&R,$=A!==E&&I;if(!(D||$||R||I))return;if((D||$||1===_[0]||1===_[1])&&(N.x=D?O:f.x,N.y=$?A:f.y,f.x=N.x,f.y=N.y,b.length>0)){const e=O-C,t=A-E;for(const n of b)n.position={x:n.position.x-e+_[0]*(P-k),y:n.position.y-t+_[1]*(z-M)},S.push(n)}if((R||I)&&(N.width=!R||l&&"horizontal"!==l?f.width:P,N.height=!I||l&&"vertical"!==l?f.height:z,f.width=N.width,f.height=N.height),y&&m.expandParent){const e=_[0]*(N.width??0);N.x&&N.x<e&&(f.x=e,g.x=g.x-(N.x-e));const t=_[1]*(N.height??0);N.y&&N.y<t&&(f.y=t,g.y=g.y-(N.y-t))}const L=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=-1*l[0]),a&&i&&(l[1]=-1*l[1]),l}({width:f.width,prevWidth:k,height:f.height,prevHeight:M,affectsX:p.affectsX,affectsY:p.affectsY}),B={...f,direction:L},T=h?.(e,B);!1!==T&&(u?.(e,B),o(N,S))})).on("end",(e=>{d?.(e,{...f}),r?.({...f})}));i.call(S)},destroy:function(){i.on(".drag",null)}}}function ai(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var li,ci,ui,di={exports:{}},hi={},fi={exports:{}},gi={};function pi(){return ci||(ci=1,fi.exports=function(){if(li)return gi;li=1;var e=n,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(e){var n=e.getSnapshot;e=e.value;try{var o=n();return!t(e,o)}catch(e){return!0}}var l="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),l=o({inst:{value:n,getSnapshot:t}}),c=l[0].inst,u=l[1];return i((function(){c.value=n,c.getSnapshot=t,a(c)&&u({inst:c})}),[e,n,t]),r((function(){return a(c)&&u({inst:c}),e((function(){a(c)&&u({inst:c})}))}),[e]),s(n),n};return gi.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:l,gi}()),fi.exports}
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/di.exports=function(){if(ui)return hi;ui=1;var e=n,t=pi(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return hi.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=a((function(){function e(e){if(!s){if(s=!0,r=e,e=c(e),void 0!==u&&h.hasValue){var t=h.value;if(u(t,e))return i=t}return i=e}if(t=i,o(r,e))return t;var n=c(e);return void 0!==u&&u(t,n)?t:(r=e,i=n)}var r,i,s=!1,a=void 0===n?null:n;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]}),[t,n,c,u]);var f=r(e,d[0],d[1]);return s((function(){h.hasValue=!0,h.value=f}),[f]),l(f),f},hi}();var mi=ai(di.exports);const yi=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r)?r:Object.assign({},t,r),n.forEach((n=>n(t,e)))}},r=()=>t,i={setState:o,getState:r,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{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()}};return t=e(o,r,i),i},{useSyncExternalStoreWithSelector:vi}=mi;function xi(e,t=e.getState,o){const r=vi(e.subscribe,e.getState,e.getServerState||e.getState,t,o);return n.useDebugValue(r),r}const wi=(e,t)=>{const n=(e=>e?yi(e):yi)(e),o=(e,o=t)=>xi(n,e,o);return Object.assign(o,n),o},bi=n.createContext(null),Si=bi.Provider,Ci=Qn.error001();function Ei(e,t){const o=n.useContext(bi);if(null===o)throw new Error(Ci);return xi(o,e,t)}function ki(){const e=n.useContext(bi);if(null===e)throw new Error(Ci);return n.useMemo((()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe})),[e])}const Ni={display:"none"},Mi={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_i="react-flow__node-desc",Pi="react-flow__edge-desc",zi="react-flow__aria-live",Oi=e=>e.ariaLiveMessage;function Ai({rfId:e}){const n=Ei(Oi);return t.jsx("div",{id:`${zi}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Mi,children:n})}function Ri({rfId:e,disableKeyboardA11y:n}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{id:`${_i}-${e}`,style:Ni,children:["Press enter or space to select a node.",!n&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),t.jsx("div",{id:`${Pi}-${e}`,style:Ni,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!n&&t.jsx(Ai,{rfId:e})]})}const Ii=e=>e.userSelectionActive?"none":"all",Di=n.forwardRef((({position:e="top-left",children:n,className:o,style:i,...s},a)=>{const l=Ei(Ii),c=`${e}`.split("-");return t.jsx("div",{className:r(["react-flow__panel",o,...c]),style:{...i,pointerEvents:l},ref:a,...s,children:n})}));function $i({proOptions:e,position:n="bottom-right"}){return e?.hideAttribution?null:t.jsx(Di,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:t.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}function Li(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o=0;o<n.length;o++)if(!Object.prototype.hasOwnProperty.call(t,n[o])||!Object.is(e[n[o]],t[n[o]]))return!1;return!0}Di.displayName="Panel";const Bi=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&(e.elementsSelectable||n.selectable)&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&(e.elementsSelectable||t.selectable)&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Ti=e=>e.id;function Vi(e,t){return Li(e.selectedNodes.map(Ti),t.selectedNodes.map(Ti))&&Li(e.selectedEdges.map(Ti),t.selectedEdges.map(Ti))}function ji({onSelectionChange:e}){const t=ki(),{selectedNodes:o,selectedEdges:r}=Ei(Bi,Vi);return n.useEffect((()=>{const n={nodes:o,edges:r};e?.(n),t.getState().onSelectionChangeHandlers.forEach((e=>e(n)))}),[o,r,e]),null}const Hi=e=>!!e.onSelectionChangeHandlers;function Xi({onSelectionChange:e}){const n=Ei(Hi);return e||n?t.jsx(ji,{onSelectionChange:e}):null}const Yi=[0,0],Zi={x:0,y:0,zoom:1},Wi=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","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","onBeforeDelete","debug","autoPanSpeed","paneClickDistance","rfId"],Fi=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,setPaneClickDistance:e.setPaneClickDistance}),Ki={translateExtent:Jn,nodeOrigin:Yi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function Gi(e){const{setNodes:t,setEdges:o,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c,setPaneClickDistance:u}=Ei(Fi,Li),d=ki();n.useEffect((()=>(c(e.defaultNodes,e.defaultEdges),()=>{h.current=Ki,l()})),[]);const h=n.useRef(Ki);return n.useEffect((()=>{for(const n of Wi){const l=e[n];l!==h.current[n]&&(void 0!==e[n]&&("nodes"===n?t(l):"edges"===n?o(l):"minZoom"===n?r(l):"maxZoom"===n?i(l):"translateExtent"===n?s(l):"nodeExtent"===n?a(l):"paneClickDistance"===n?u(l):"fitView"===n?d.setState({fitViewQueued:l}):"fitViewOptions"===n?d.setState({fitViewOptions:l}):d.setState({[n]:l})))}h.current=e}),Wi.map((t=>e[t]))),null}function qi(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const Ui="undefined"!=typeof document?document:null;function Qi(e=null,t={target:Ui,actInsideInputWithModifier:!0}){const[o,r]=n.useState(!1),i=n.useRef(!1),s=n.useRef(new Set([])),[a,l]=n.useMemo((()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter((e=>"string"==typeof e)).map((e=>e.replace("+","\n").replace("\n\n","\n+").split("\n"))),n=t.reduce(((e,t)=>e.concat(...t)),[]);return[t,n]}return[[],[]]}),[e]);return n.useEffect((()=>{const n=t?.target||Ui;if(null!==e){const e=e=>{i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey;if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Qo(e))return!1;const n=es(e.code,l);if(s.current.add(e[n]),Ji(a,s.current,!1)){const n=e.composedPath?.()?.[0]||e.target,o="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!i.current&&o||e.preventDefault(),r(!0)}},o=e=>{const t=es(e.code,l);Ji(a,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(e[t]),"Meta"===e.key&&s.current.clear(),i.current=!1},c=()=>{s.current.clear(),r(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",o),window.addEventListener("blur",c),window.addEventListener("contextmenu",c),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",o),window.removeEventListener("blur",c),window.removeEventListener("contextmenu",c)}}}),[e,r]),o}function Ji(e,t,n){return e.filter((e=>n||e.length===t.size)).some((e=>e.every((e=>t.has(e)))))}function es(e,t){return t.includes(e)?"code":"key"}const ts=()=>{const e=ki();return n.useMemo((()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},{duration:n?.duration}),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>{const{width:r,height:i,maxZoom:s,panZoom:a}=e.getState(),l=void 0!==o?.zoom?o.zoom:s,c=r/2-t*l,u=i/2-n*l;return a?(await a.setViewport({x:c,y:u,zoom:l},{duration:o?.duration}),Promise.resolve(!0)):Promise.resolve(!1)},fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=jo(t,o,r,i,s,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return Bo(c,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=To(t,n);return{x:s.x+r,y:s.y+i}}})),[])};function ns(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)os(e,r);n.push(r)}return r.length&&r.forEach((e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})})),n}function os(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&(t.width=e.dimensions.width,t.height=e.dimensions.height)),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function rs(e,t){return ns(e,t)}function is(e,t){return ns(e,t)}function ss(e,t){return{id:e,type:"select",selected:t}}function as(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(ss(i.id,e)))}return o}function ls({items:e=[],lookup:t}){const n=[],o=new Map(e.map((e=>[e.id,e])));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t){void 0===o.get(e)&&n.push({id:e,type:"remove"})}return n}function cs(e){return{id:e.id,type:"remove"}}const us=e=>(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e),ds=e=>fo(e);function hs(e){return n.forwardRef(e)}const fs="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function gs(e){const[t,o]=n.useState(BigInt(0)),[r]=n.useState((()=>function(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}((()=>o((e=>e+BigInt(1)))))));return fs((()=>{const t=r.get();t.length&&(e(t),r.reset())}),[t]),r}const ps=n.createContext(null);function ms({children:e}){const o=ki(),r=gs(n.useCallback((e=>{const{nodes:t=[],setNodes:n,hasDefaultNodes:r,onNodesChange:i,nodeLookup:s,fitViewQueued:a}=o.getState();let l=t;for(const t of e)l="function"==typeof t?t(l):t;if(r)n(l);else{const e=ls({items:l,lookup:s});e.length>0?i?.(e):a&&window.requestAnimationFrame((()=>{const{fitViewQueued:e,nodes:t,setNodes:n}=o.getState();e&&n(t)}))}}),[])),i=gs(n.useCallback((e=>{const{edges:t=[],setEdges:n,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:s}=o.getState();let a=t;for(const t of e)a="function"==typeof t?t(a):t;r?n(a):i&&i(ls({items:a,lookup:s}))}),[])),s=n.useMemo((()=>({nodeQueue:r,edgeQueue:i})),[]);return t.jsx(ps.Provider,{value:s,children:e})}const ys=e=>!!e.panZoom;function vs(){const e=ts(),t=ki(),o=function(){const e=n.useContext(ps);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),r=Ei(ys),i=n.useMemo((()=>{const e=e=>t.getState().nodeLookup.get(e),n=e=>{o.nodeQueue.push(e)},r=e=>{o.edgeQueue.push(e)},i=e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState(),r=us(e)?e:n.get(e.id),i=r.parentId?Wo(r.position,r.measured,r.parentId,n,o):r.position,s={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return zo(s)},s=(e,t,o={replace:!1})=>{n((n=>n.map((n=>{if(n.id===e){const e="function"==typeof t?t(n):t;return o.replace&&us(e)?e:{...n,...e}}return n}))))},a=(e,t,n={replace:!1})=>{r((o=>o.map((o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&ds(e)?e:{...o,...e}}return o}))))};return{getNodes:()=>t.getState().nodes.map((e=>({...e}))),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map((e=>({...e})))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:n,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];o.nodeQueue.push((e=>[...e,...t]))},addEdges:e=>{const t=Array.isArray(e)?e:[e];o.edgeQueue.push((e=>[...e,...t]))},toObject:()=>{const{nodes:e=[],edges:n=[],transform:o}=t.getState(),[r,i,s]=o;return{nodes:e.map((e=>({...e}))),edges:n.map((e=>({...e}))),viewport:{x:r,y:i,zoom:s}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:s,triggerNodeChanges:a,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:u}=t.getState(),{nodes:d,edges:h}=await async function({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map((e=>e.id))),s=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&s.find((t=>t.id===e.parentId));(t||n)&&s.push(e)}const a=new Set(t.map((e=>e.id))),l=o.filter((e=>!1!==e.deletable)),c=xo(s,l);for(const e of l)a.has(e.id)&&!c.find((t=>t.id===e.id))&&c.push(e);if(!r)return{edges:c,nodes:s};const u=await r({nodes:s,edges:c});return"boolean"==typeof u?u?{edges:c,nodes:s}:{edges:[],nodes:[]}:u}({nodesToRemove:e,edgesToRemove:n,nodes:o,edges:r,onBeforeDelete:u}),f=h.length>0,g=d.length>0;if(f){const e=h.map(cs);s?.(h),l(e)}if(g){const e=d.map(cs);i?.(d),a(e)}return(g||f)&&c?.({nodes:d,edges:h}),{deletedNodes:d,deletedEdges:h}},getIntersectingNodes:(e,n=!0,o)=>{const r=Io(e),s=r?e:i(e),a=void 0!==o;return s?(o||t.getState().nodes).filter((o=>{const i=t.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=zo(a?o:i),c=Ro(l,s);return n&&c>0||c>=s.width*s.height})):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=Io(e)?e:i(e);if(!o)return!1;const r=Ro(o,t);return n&&r>0||r>=o.width*o.height},updateNode:s,updateNodeData:(e,t,n={replace:!1})=>{s(e,(e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}}),n)},updateEdge:a,updateEdgeData:(e,t,n={replace:!1})=>{a(e,(e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}}),n)},getNodesBounds:e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState();return mo(e,{nodeLookup:n,nodeOrigin:o})},getHandleConnections:({type:e,id:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const n=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise(((n,o)=>{e=n,t=o})),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:n}),o.nodeQueue.push((e=>[...e])),n.promise}}}),[]);return n.useMemo((()=>({...i,...e,viewportInitialized:r})),[r])}const xs=e=>e.selected,ws={actInsideInputWithModifier:!1},bs="undefined"!=typeof window?window:void 0;const Ss={position:"absolute",width:"100%",height:"100%",top:0,left:0},Cs=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function Es({onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=e.PanOnScrollMode.Free,zoomOnDoubleClick:c=!0,panOnDrag:u=!0,defaultViewport:d,translateExtent:h,minZoom:f,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:m=!0,children:y,noWheelClassName:v,noPanClassName:x,onViewportChange:w,isControlledViewport:b,paneClickDistance:S}){const C=ki(),E=n.useRef(null),{userSelectionActive:k,lib:N}=Ei(Cs,Li),M=Qi(p),_=n.useRef();!function(e){const t=ki();n.useEffect((()=>{const n=()=>{if(!e.current)return!1;const n=Go(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004",Qn.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver((()=>n()));return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}}),[])}(E);const P=n.useCallback((e=>{w?.({x:e[0],y:e[1],zoom:e[2]}),b||C.setState({transform:e})}),[w,b]);return n.useEffect((()=>{if(E.current){_.current=Gr({domNode:E.current,minZoom:f,maxZoom:g,translateExtent:h,viewport:d,paneClickDistance:S,onDraggingChange:e=>C.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=C.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=C.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=C.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=_.current.getViewport();return C.setState({panZoom:_.current,transform:[e,t,n],domNode:E.current.closest(".react-flow")}),()=>{_.current?.destroy()}}}),[]),n.useEffect((()=>{_.current?.update({onPaneContextMenu:o,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:s,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:c,panOnDrag:u,zoomActivationKeyPressed:M,preventScrolling:m,noPanClassName:x,userSelectionActive:k,noWheelClassName:v,lib:N,onTransformChange:P})}),[o,r,i,s,a,l,c,u,M,m,x,k,v,N,P]),t.jsx("div",{className:"react-flow__renderer",ref:E,style:Ss,children:y})}const ks=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ns(){const{userSelectionActive:e,userSelectionRect:n}=Ei(ks,Li);return e&&n?t.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const Ms=(e,t)=>n=>{n.target===t.current&&e?.(n)},_s=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Ps({isSelecting:o,selectionKeyPressed:i,selectionMode:s=e.SelectionMode.Full,panOnDrag:a,selectionOnDrag:l,onSelectionStart:c,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:f,onPaneMouseEnter:g,onPaneMouseMove:p,onPaneMouseLeave:m,children:y}){const v=ki(),{userSelectionActive:x,elementsSelectable:w,dragging:b,connectionInProgress:S}=Ei(_s,Li),C=w&&(o||x),E=n.useRef(null),k=n.useRef(),N=n.useRef(new Set),M=n.useRef(new Set),_=n.useRef(!1),P=n.useRef(!1),z=e=>{_.current||S?_.current=!1:(d?.(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1}))},O=f?e=>f(e):void 0,A=!0===a||Array.isArray(a)&&a.includes(0);return t.jsxs("div",{className:r(["react-flow__pane",{draggable:A,dragging:b,selection:o}]),onClick:C?void 0:Ms(z,E),onContextMenu:Ms((e=>{Array.isArray(a)&&a?.includes(2)?e.preventDefault():h?.(e)}),E),onWheel:Ms(O,E),onPointerEnter:C?void 0:g,onPointerDown:C?e=>{const{resetSelectedElements:t,domNode:n}=v.getState();if(k.current=n?.getBoundingClientRect(),!w||!o||0!==e.button||e.target!==E.current||!k.current)return;e.target?.setPointerCapture?.(e.pointerId),P.current=!0,_.current=!1;const{x:r,y:i}=er(e.nativeEvent,k.current);t(),v.setState({userSelectionRect:{width:0,height:0,startX:r,startY:i,x:r,y:i}}),c?.(e)}:p,onPointerMove:C?t=>{const{userSelectionRect:n,transform:o,nodeLookup:r,edgeLookup:i,connectionLookup:a,triggerNodeChanges:l,triggerEdgeChanges:c,defaultEdgeOptions:u}=v.getState();if(!k.current||!n)return;_.current=!0;const{x:d,y:h}=er(t.nativeEvent,k.current),{startX:f,startY:g}=n,p={startX:f,startY:g,x:d<f?d:f,y:h<g?h:g,width:Math.abs(d-f),height:Math.abs(h-g)},m=N.current,y=M.current;N.current=new Set(vo(r,p,o,s===e.SelectionMode.Partial,!0).map((e=>e.id))),M.current=new Set;const x=u?.selectable??!0;for(const e of N.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=i.get(e);t&&(t.selectable??x)&&M.current.add(e)}}if(!Fo(m,N.current)){l(as(r,N.current,!0))}if(!Fo(y,M.current)){c(as(i,M.current))}v.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}:p,onPointerUp:C?e=>{if(0!==e.button||!P.current)return;e.target?.releasePointerCapture?.(e.pointerId);const{userSelectionRect:t}=v.getState();!x&&t&&e.target===E.current&&z?.(e),v.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:N.current.size>0}),u?.(e),(i||l)&&(_.current=!1),P.current=!1}:void 0,onPointerLeave:m,ref:E,style:Ss,children:[y,t.jsx(Ns,{})]})}function zs({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame((()=>o?.current?.blur()))):r([e])):l?.("012",Qn.error012(e))}function Os({nodeRef:e,disabled:t=!1,noDragClassName:o,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:a}){const l=ki(),[c,u]=n.useState(!1),d=n.useRef();return n.useEffect((()=>{d.current=Ir({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{zs({id:t,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})}),[]),n.useEffect((()=>{if(t)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:o,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:a}),()=>{d.current?.destroy()}}),[o,r,t,s,e,i]),c}const As=e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable);function Rs(){const e=ki();return n.useCallback((t=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:s,updateNodePositions:a,nodeLookup:l,nodeOrigin:c}=e.getState(),u=new Map,d=As(i),h=o?r[0]:5,f=o?r[1]:5,g=t.direction.x*h*t.factor,p=t.direction.y*f*t.factor;for(const[,e]of l){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+g,y:e.internals.positionAbsolute.y+p};o&&(t=Lo(t,r));const{position:i,positionAbsolute:a}=bo({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:s});e.position=i,e.internals.positionAbsolute=a,u.set(e.id,e)}a(u)}),[])}const Is=n.createContext(null),Ds=Is.Provider;Is.Consumer;const $s=()=>n.useContext(Is),Ls=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId});const Bs=n.memo(hs((function({type:n="source",position:o=e.Position.Top,isValidConnection:i,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:u,children:d,className:h,onMouseDown:f,onTouchStart:g,...p},m){const y=c||null,v="target"===n,x=ki(),w=$s(),{connectOnClick:b,noPanClassName:S,rfId:C}=Ei(Ls,Li),{connectingFrom:E,connectingTo:k,clickConnecting:N,isPossibleEndHandle:M,connectionInProcess:_,clickConnectionInProcess:P,valid:z}=Ei(((t,n,o)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:a}=r,{fromHandle:l,toHandle:c,isValid:u}=a,d=c?.nodeId===t&&c?.id===n&&c?.type===o;return{connectingFrom:l?.nodeId===t&&l?.id===n&&l?.type===o,connectingTo:d,clickConnecting:i?.nodeId===t&&i?.id===n&&i?.type===o,isPossibleEndHandle:s===e.ConnectionMode.Strict?l?.type!==o:t!==l?.nodeId||n!==l?.id,connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:d&&u}})(w,y,n),Li);w||x.getState().onError?.("010",Qn.error010());const O=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=x.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t}=x.getState();t(cr(r,e))}n?.(r),u?.(r)},A=e=>{if(!w)return;const t=Jo(e.nativeEvent);if(a&&(t&&0===e.button||!t)){const t=x.getState();jr.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:v,handleId:y,nodeId:w,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:O,isValidConnection:i||t.isValidConnection,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed})}t?f?.(e):g?.(e)};return t.jsx("div",{"data-handleid":y,"data-nodeid":w,"data-handlepos":o,"data-id":`${C}-${w}-${y}-${n}`,className:r(["react-flow__handle",`react-flow__handle-${o}`,"nodrag",S,h,{source:!v,target:v,connectable:s,connectablestart:a,connectableend:l,clickconnecting:N,connectingfrom:E,connectingto:k,valid:z,connectionindicator:s&&(!_||M)&&(_||P?l:a)}]),onMouseDown:A,onTouchStart:A,onClick:b?e=>{const{onClickConnectStart:t,onClickConnectEnd:o,connectionClickStartHandle:r,connectionMode:s,isValidConnection:l,lib:c,rfId:u,nodeLookup:d,connection:h}=x.getState();if(!w||!r&&!a)return;if(!r)return t?.(e.nativeEvent,{nodeId:w,handleId:y,handleType:n}),void x.setState({connectionClickStartHandle:{nodeId:w,type:n,id:y}});const f=qo(e.target),g=i||l,{connection:p,isValid:m}=jr.isValid(e.nativeEvent,{handle:{nodeId:w,id:y,type:n},connectionMode:s,fromNodeId:r.nodeId,fromHandleId:r.id||null,fromType:r.type,isValidConnection:g,flowId:u,doc:f,lib:c,nodeLookup:d});m&&p&&O(p);const v=structuredClone(h);delete v.inProgress,v.toPosition=v.toHandle?v.toHandle.position:null,o?.(e,v),x.setState({connectionClickStartHandle:null})}:void 0,ref:m,...p,children:d})})));const Ts={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Vs={input:function({data:n,isConnectable:o,sourcePosition:r=e.Position.Bottom}){return t.jsxs(t.Fragment,{children:[n?.label,t.jsx(Bs,{type:"source",position:r,isConnectable:o})]})},default:function({data:n,isConnectable:o,targetPosition:r=e.Position.Top,sourcePosition:i=e.Position.Bottom}){return t.jsxs(t.Fragment,{children:[t.jsx(Bs,{type:"target",position:r,isConnectable:o}),n?.label,t.jsx(Bs,{type:"source",position:i,isConnectable:o})]})},output:function({data:n,isConnectable:o,targetPosition:r=e.Position.Top}){return t.jsxs(t.Fragment,{children:[t.jsx(Bs,{type:"target",position:r,isConnectable:o}),n?.label]})},group:function(){return null}};const js=e=>{const{width:t,height:n,x:o,y:r}=yo(e.nodeLookup,{filter:e=>!!e.selected});return{width:Do(t)?t:null,height:Do(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Hs({onSelectionContextMenu:e,noPanClassName:o,disableKeyboardA11y:i}){const s=ki(),{width:a,height:l,transformString:c,userSelectionActive:u}=Ei(js,Li),d=Rs(),h=n.useRef(null);if(n.useEffect((()=>{i||h.current?.focus({preventScroll:!0})}),[i]),Os({nodeRef:h}),u||!a||!l)return null;const f=e?t=>{const n=s.getState().nodes.filter((e=>e.selected));e(t,n)}:void 0;return t.jsx("div",{className:r(["react-flow__nodesselection","react-flow__container",o]),style:{transform:c},children:t.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:i?void 0:-1,onKeyDown:i?void 0:e=>{Object.prototype.hasOwnProperty.call(Ts,e.key)&&(e.preventDefault(),d({direction:Ts[e.key],factor:e.shiftKey?4:1}))},style:{width:a,height:l}})})}const Xs="undefined"!=typeof window?window:void 0,Ys=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Zs({children:e,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:h,selectionMode:f,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:v,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:N,defaultViewport:M,translateExtent:_,minZoom:P,maxZoom:z,preventScrolling:O,onSelectionContextMenu:A,noWheelClassName:R,noPanClassName:I,disableKeyboardA11y:D,onViewportChange:$,isControlledViewport:L}){const{nodesSelectionActive:B,userSelectionActive:T}=Ei(Ys),V=Qi(d,{target:Xs}),j=Qi(y,{target:Xs}),H=j||N,X=j||S,Y=h&&!0!==H,Z=V||T||Y;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const o=ki(),{deleteElements:r}=vs(),i=Qi(e,ws),s=Qi(t,{target:bs});n.useEffect((()=>{if(i){const{edges:e,nodes:t}=o.getState();r({nodes:t.filter(xs),edges:e.filter(xs)}),o.setState({nodesSelectionActive:!1})}}),[i]),n.useEffect((()=>{o.setState({multiSelectionActive:s})}),[s])}({deleteKeyCode:u,multiSelectionKeyCode:m}),t.jsx(Es,{onPaneContextMenu:a,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:X,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!V&&H,defaultViewport:M,translateExtent:_,minZoom:P,maxZoom:z,zoomActivationKeyCode:v,preventScrolling:O,noWheelClassName:R,noPanClassName:I,onViewportChange:$,isControlledViewport:L,paneClickDistance:c,children:t.jsxs(Ps,{onSelectionStart:g,onSelectionEnd:p,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:H,isSelecting:!!Z,selectionMode:f,selectionKeyPressed:V,selectionOnDrag:Y,children:[e,B&&t.jsx(Hs,{onSelectionContextMenu:A,noPanClassName:I,disableKeyboardA11y:D})]})})}Zs.displayName="FlowRenderer";const Ws=n.memo(Zs),Fs=e=>t=>e?vo(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map((e=>e.id)):Array.from(t.nodeLookup.keys());const Ks=e=>e.updateNodeInternals;function Gs({id:e,onClick:o,onMouseEnter:i,onMouseMove:s,onMouseLeave:a,onContextMenu:l,onDoubleClick:c,nodesDraggable:u,elementsSelectable:d,nodesConnectable:h,nodesFocusable:f,resizeObserver:g,noDragClassName:p,noPanClassName:m,disableKeyboardA11y:y,rfId:v,nodeTypes:x,nodeClickDistance:w,onError:b}){const{node:S,internals:C,isParent:E}=Ei((t=>{const n=t.nodeLookup.get(e),o=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:o}}),Li);let k=S.type||"default",N=x?.[k]||Vs[k];void 0===N&&(b?.("003",Qn.error003(k)),k="default",N=Vs.default);const M=!!(S.draggable||u&&void 0===S.draggable),_=!!(S.selectable||d&&void 0===S.selectable),P=!!(S.connectable||h&&void 0===S.connectable),z=!!(S.focusable||f&&void 0===S.focusable),O=ki(),A=Zo(S),R=function({node:e,nodeType:t,hasDimensions:o,resizeObserver:r}){const i=ki(),s=n.useRef(null),a=n.useRef(null),l=n.useRef(e.sourcePosition),c=n.useRef(e.targetPosition),u=n.useRef(t),d=o&&!!e.internals.handleBounds;return n.useEffect((()=>{!s.current||e.hidden||d&&a.current===s.current||(a.current&&r?.unobserve(a.current),r?.observe(s.current),a.current=s.current)}),[d,e.hidden]),n.useEffect((()=>()=>{a.current&&(r?.unobserve(a.current),a.current=null)}),[]),n.useEffect((()=>{if(s.current){const n=u.current!==t,o=l.current!==e.sourcePosition,r=c.current!==e.targetPosition;(n||o||r)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}}),[e.id,t,e.sourcePosition,e.targetPosition]),s}({node:S,nodeType:k,hasDimensions:A,resizeObserver:g}),I=Os({nodeRef:R,disabled:S.hidden||!M,noDragClassName:p,handleSelector:S.dragHandle,nodeId:e,isSelectable:_,nodeClickDistance:w}),D=Rs();if(S.hidden)return null;const $=Yo(S),L=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(S),B=_||M||o||i||s||a,T=i?e=>i(e,{...C.userNode}):void 0,V=s?e=>s(e,{...C.userNode}):void 0,j=a?e=>a(e,{...C.userNode}):void 0,H=l?e=>l(e,{...C.userNode}):void 0,X=c?e=>c(e,{...C.userNode}):void 0;return t.jsx("div",{className:r(["react-flow__node",`react-flow__node-${k}`,{[m]:M},S.className,{selected:S.selected,selectable:_,parent:E,draggable:M,dragging:I}]),ref:R,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:A?"visible":"hidden",...S.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:T,onMouseMove:V,onMouseLeave:j,onContextMenu:H,onClick:t=>{const{selectNodesOnDrag:n,nodeDragThreshold:r}=O.getState();_&&(!n||!M||r>0)&&zs({id:e,store:O,nodeRef:R}),o&&o(t,{...C.userNode})},onDoubleClick:X,onKeyDown:z?t=>{if(!Qo(t.nativeEvent)&&!y)if(eo.includes(t.key)&&_){const n="Escape"===t.key;zs({id:e,store:O,unselect:n,nodeRef:R})}else M&&S.selected&&Object.prototype.hasOwnProperty.call(Ts,t.key)&&(t.preventDefault(),O.setState({ariaLiveMessage:`Moved selected node ${t.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~C.positionAbsolute.x}, y: ${~~C.positionAbsolute.y}`}),D({direction:Ts[t.key],factor:t.shiftKey?4:1}))}:void 0,tabIndex:z?0:void 0,role:z?"button":void 0,"aria-describedby":y?void 0:`${_i}-${v}`,"aria-label":S.ariaLabel,children:t.jsx(Ds,{value:e,children:t.jsx(N,{id:e,data:S.data,type:k,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:S.selected??!1,selectable:_,draggable:M,deletable:S.deletable??!0,isConnectable:P,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:I,dragHandle:S.dragHandle,zIndex:C.z,parentId:S.parentId,...$})})})}const qs=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Us(e){const{nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:s,onError:a}=Ei(qs,Li),l=(c=e.onlyRenderVisibleElements,Ei(n.useCallback(Fs(c),[c]),Li));var c;const u=function(){const e=Ei(Ks),[t]=n.useState((()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver((t=>{const n=new Map;t.forEach((e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})})),e(n)}))));return n.useEffect((()=>()=>{t?.disconnect()}),[t]),t}();return t.jsx("div",{className:"react-flow__nodes",style:Ss,children:l.map((n=>t.jsx(Gs,{id:n,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:u,nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:a},n)))})}Us.displayName="NodeRenderer";const Qs=n.memo(Us);const Js={[e.MarkerType.Arrow]:({color:e="none",strokeWidth:n=1})=>t.jsx("polyline",{style:{stroke:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[e.MarkerType.ArrowClosed]:({color:e="none",strokeWidth:n=1})=>t.jsx("polyline",{style:{stroke:e,fill:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})};const ea=({id:e,type:o,color:r,width:i=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const u=function(e){const t=ki();return n.useMemo((()=>Object.prototype.hasOwnProperty.call(Js,e)?Js[e]:(t.getState().onError?.("009",Qn.error009(e)),null)),[e])}(o);return u?t.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:c,refX:"0",refY:"0",children:t.jsx(u,{color:r,strokeWidth:l})}):null},ta=({defaultColor:e,rfId:o})=>{const r=Ei((e=>e.edges)),i=Ei((e=>e.defaultEdgeOptions)),s=n.useMemo((()=>{const t=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce(((e,s)=>([s.markerStart||o,s.markerEnd||r].forEach((o=>{if(o&&"object"==typeof o){const r=xr(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}})),e)),[]).sort(((e,t)=>e.id.localeCompare(t.id)))}(r,{id:o,defaultColor:e,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd});return t}),[r,i,o,e]);return s.length?t.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:t.jsx("defs",{children:s.map((e=>t.jsx(ea,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id)))})}):null};ta.displayName="MarkerDefinitions";var na=n.memo(ta);function oa({x:e,y:o,label:i,labelStyle:s,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:d,className:h,...f}){const[g,p]=n.useState({x:1,y:0,width:0,height:0}),m=r(["react-flow__edge-textwrapper",h]),y=n.useRef(null);return n.useEffect((()=>{if(y.current){const e=y.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}}),[i]),i?t.jsxs("g",{transform:`translate(${e-g.width/2} ${o-g.height/2})`,className:m,visibility:g.width?"visible":"hidden",...f,children:[a&&t.jsx("rect",{width:g.width+2*c[0],x:-c[0],y:-c[1],height:g.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),t.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:y,style:s,children:i}),d]}):null}oa.displayName="EdgeText";const ra=n.memo(oa);function ia({path:e,labelX:n,labelY:o,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,interactionWidth:d=20,...h}){return t.jsxs(t.Fragment,{children:[t.jsx("path",{...h,d:e,fill:"none",className:r(["react-flow__edge-path",h.className])}),d&&t.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}),i&&Do(n)&&Do(o)?t.jsx(ra,{x:n,y:o,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u}):null]})}function sa({pos:t,x1:n,y1:o,x2:r,y2:i}){return t===e.Position.Left||t===e.Position.Right?[.5*(n+r),o]:[n,.5*(o+i)]}function aa({sourceX:t,sourceY:n,sourcePosition:o=e.Position.Bottom,targetX:r,targetY:i,targetPosition:s=e.Position.Top}){const[a,l]=sa({pos:o,x1:t,y1:n,x2:r,y2:i}),[c,u]=sa({pos:s,x1:r,y1:i,x2:t,y2:n}),[d,h,f,g]=nr({sourceX:t,sourceY:n,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${t},${n} C${a},${l} ${c},${u} ${r},${i}`,d,h,f,g]}function la(e){return n.memo((({id:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[x,w,b]=aa({sourceX:o,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l}),S=e.isInternal?void 0:n;return t.jsx(ia,{id:S,path:x,labelX:w,labelY:b,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,interactionWidth:v})}))}const ca=la({isInternal:!1}),ua=la({isInternal:!0});function da(o){return n.memo((({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:f,style:g,sourcePosition:p=e.Position.Bottom,targetPosition:m=e.Position.Top,markerEnd:y,markerStart:v,pathOptions:x,interactionWidth:w})=>{const[b,S,C]=gr({sourceX:r,sourceY:i,sourcePosition:p,targetX:s,targetY:a,targetPosition:m,borderRadius:x?.borderRadius,offset:x?.offset}),E=o.isInternal?void 0:n;return t.jsx(ia,{id:E,path:b,labelX:S,labelY:C,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:y,markerStart:v,interactionWidth:w})}))}ca.displayName="SimpleBezierEdge",ua.displayName="SimpleBezierEdgeInternal";const ha=da({isInternal:!1}),fa=da({isInternal:!0});function ga(e){return n.memo((({id:o,...r})=>{const i=e.isInternal?void 0:o;return t.jsx(ha,{...r,id:i,pathOptions:n.useMemo((()=>({borderRadius:0,offset:r.pathOptions?.offset})),[r.pathOptions?.offset])})}))}ha.displayName="SmoothStepEdge",fa.displayName="SmoothStepEdgeInternal";const pa=ga({isInternal:!1}),ma=ga({isInternal:!0});function ya(e){return n.memo((({id:n,sourceX:o,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:g,markerStart:p,interactionWidth:m})=>{const[y,v,x]=ur({sourceX:o,sourceY:r,targetX:i,targetY:s}),w=e.isInternal?void 0:n;return t.jsx(ia,{id:w,path:y,labelX:v,labelY:x,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:g,markerStart:p,interactionWidth:m})}))}pa.displayName="StepEdge",ma.displayName="StepEdgeInternal";const va=ya({isInternal:!1}),xa=ya({isInternal:!0});function wa(o){return n.memo((({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:l=e.Position.Bottom,targetPosition:c=e.Position.Top,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:v,pathOptions:x,interactionWidth:w})=>{const[b,S,C]=ir({sourceX:r,sourceY:i,sourcePosition:l,targetX:s,targetY:a,targetPosition:c,curvature:x?.curvature}),E=o.isInternal?void 0:n;return t.jsx(ia,{id:E,path:b,labelX:S,labelY:C,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:v,interactionWidth:w})}))}va.displayName="StraightEdge",xa.displayName="StraightEdgeInternal";const ba=wa({isInternal:!1}),Sa=wa({isInternal:!0});ba.displayName="BezierEdge",Sa.displayName="BezierEdgeInternal";const Ca={default:Sa,straight:xa,step:ma,smoothstep:fa,simplebezier:ua},Ea={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},ka=(t,n,o)=>o===e.Position.Left?t-n:o===e.Position.Right?t+n:t,Na=(t,n,o)=>o===e.Position.Top?t-n:o===e.Position.Bottom?t+n:t,Ma="react-flow__edgeupdater";function _a({position:e,centerX:n,centerY:o,radius:i=10,onMouseDown:s,onMouseEnter:a,onMouseOut:l,type:c}){return t.jsx("circle",{onMouseDown:s,onMouseEnter:a,onMouseOut:l,className:r([Ma,`${Ma}-${c}`]),cx:ka(n,i,e),cy:Na(o,i,e),r:i,stroke:"transparent",fill:"transparent"})}function Pa({isReconnectable:e,reconnectRadius:n,edge:o,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:h,setReconnecting:f,setUpdateHover:g}){const p=ki(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:n,domNode:r,isValidConnection:i,connectionMode:s,connectionRadius:a,lib:l,onConnectStart:c,onConnectEnd:g,cancelConnection:m,nodeLookup:y,rfId:v,panBy:x,updateConnection:w}=p.getState(),b="target"===t.type;f(!0),d?.(e,o,t.type);jr.onPointerDown(e.nativeEvent,{autoPanOnConnect:n,connectionMode:s,connectionRadius:a,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:y,isTarget:b,edgeUpdaterType:t.type,lib:l,flowId:v,cancelConnection:m,panBy:x,isValidConnection:i,onConnect:e=>u?.(o,e),onConnectStart:c,onConnectEnd:g,onReconnectEnd:(e,n)=>{f(!1),h?.(e,o,t.type,n)},updateConnection:w,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle})},y=()=>g(!0),v=()=>g(!1);return t.jsxs(t.Fragment,{children:[(!0===e||"source"===e)&&t.jsx(_a,{position:l,centerX:r,centerY:i,radius:n,onMouseDown:e=>m(e,{nodeId:o.target,id:o.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:v,type:"source"}),(!0===e||"target"===e)&&t.jsx(_a,{position:c,centerX:s,centerY:a,radius:n,onMouseDown:e=>m(e,{nodeId:o.source,id:o.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:v,type:"target"})]})}function za({id:o,edgesFocusable:i,edgesReconnectable:s,elementsSelectable:a,onClick:l,onDoubleClick:c,onContextMenu:u,onMouseEnter:d,onMouseMove:h,onMouseLeave:f,reconnectRadius:g,onReconnect:p,onReconnectStart:m,onReconnectEnd:y,rfId:v,edgeTypes:x,noPanClassName:w,onError:b,disableKeyboardA11y:S}){let C=Ei((e=>e.edgeLookup.get(o)));const E=Ei((e=>e.defaultEdgeOptions));C=E?{...E,...C}:C;let k=C.type||"default",N=x?.[k]||Ca[k];void 0===N&&(b?.("011",Qn.error011(k)),k="default",N=Ca.default);const M=!!(C.focusable||i&&void 0===C.focusable),_=void 0!==p&&(C.reconnectable||s&&void 0===C.reconnectable),P=!!(C.selectable||a&&void 0===C.selectable),z=n.useRef(null),[O,A]=n.useState(!1),[R,I]=n.useState(!1),D=ki(),{zIndex:$,sourceX:L,sourceY:B,targetX:T,targetY:V,sourcePosition:j,targetPosition:H}=Ei(n.useCallback((t=>{const n=t.nodeLookup.get(C.source),r=t.nodeLookup.get(C.target);if(!n||!r)return{zIndex:C.zIndex,...Ea};const i=function(t){const{sourceNode:n,targetNode:o}=t;if(!pr(n)||!pr(o))return null;const r=n.internals.handleBounds||mr(n.handles),i=o.internals.handleBounds||mr(o.handles),s=vr(r?.source??[],t.sourceHandle),a=vr(t.connectionMode===e.ConnectionMode.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),t.targetHandle);if(!s||!a)return t.onError?.("008",Qn.error008(s?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const l=s?.position||e.Position.Bottom,c=a?.position||e.Position.Top,u=yr(n,s,l),d=yr(o,a,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}({id:o,sourceNode:n,targetNode:r,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:t.connectionMode,onError:b}),s=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1}){if(!r)return o;const i=n||t.selected||e.selected,s=Math.max(e.internals.z||0,t.internals.z||0,1e3);return o+(i?s:0)}({selected:C.selected,zIndex:C.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect});return{zIndex:s,...i||Ea}}),[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),Li),X=n.useMemo((()=>C.markerStart?`url('#${xr(C.markerStart,v)}')`:void 0),[C.markerStart,v]),Y=n.useMemo((()=>C.markerEnd?`url('#${xr(C.markerEnd,v)}')`:void 0),[C.markerEnd,v]);if(C.hidden||null===L||null===B||null===T||null===V)return null;const Z=c?e=>{c(e,{...C})}:void 0,W=u?e=>{u(e,{...C})}:void 0,F=d?e=>{d(e,{...C})}:void 0,K=h?e=>{h(e,{...C})}:void 0,G=f?e=>{f(e,{...C})}:void 0;return t.jsx("svg",{style:{zIndex:$},children:t.jsxs("g",{className:r(["react-flow__edge",`react-flow__edge-${k}`,C.className,w,{selected:C.selected,animated:C.animated,inactive:!P&&!l,updating:O,selectable:P}]),onClick:e=>{const{addSelectedEdges:t,unselectNodesAndEdges:n,multiSelectionActive:r}=D.getState();P&&(D.setState({nodesSelectionActive:!1}),C.selected&&r?(n({nodes:[],edges:[C]}),z.current?.blur()):t([o])),l&&l(e,C)},onDoubleClick:Z,onContextMenu:W,onMouseEnter:F,onMouseMove:K,onMouseLeave:G,onKeyDown:M?e=>{if(!S&&eo.includes(e.key)&&P){const{unselectNodesAndEdges:t,addSelectedEdges:n}=D.getState();"Escape"===e.key?(z.current?.blur(),t({edges:[C]})):n([o])}}:void 0,tabIndex:M?0:void 0,role:M?"button":"img","data-id":o,"data-testid":`rf__edge-${o}`,"aria-label":null===C.ariaLabel?void 0:C.ariaLabel||`Edge from ${C.source} to ${C.target}`,"aria-describedby":M?`${Pi}-${v}`:void 0,ref:z,children:[!R&&t.jsx(N,{id:o,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:P,deletable:C.deletable??!0,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:L,sourceY:B,targetX:T,targetY:V,sourcePosition:j,targetPosition:H,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:X,markerEnd:Y,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),_&&t.jsx(Pa,{edge:C,isReconnectable:_,reconnectRadius:g,onReconnect:p,onReconnectStart:m,onReconnectEnd:y,sourceX:L,sourceY:B,targetX:T,targetY:V,sourcePosition:j,targetPosition:H,setUpdateHover:A,setReconnecting:I})]})})}const Oa=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Aa({defaultMarkerColor:e,onlyRenderVisibleElements:o,rfId:r,edgeTypes:i,noPanClassName:s,onReconnect:a,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:h,reconnectRadius:f,onEdgeDoubleClick:g,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:v,edgesReconnectable:x,elementsSelectable:w,onError:b}=Ei(Oa,Li),S=(C=o,Ei(n.useCallback((e=>{if(!C)return e.edges.map((e=>e.id));const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&ar({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t}),[C]),Li));var C;return t.jsxs("div",{className:"react-flow__edges",children:[t.jsx(na,{defaultColor:e,rfId:r}),S.map((e=>t.jsx(za,{id:e,edgesFocusable:v,edgesReconnectable:x,elementsSelectable:w,noPanClassName:s,onReconnect:a,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,onClick:h,reconnectRadius:f,onDoubleClick:g,onReconnectStart:p,onReconnectEnd:m,rfId:r,onError:b,edgeTypes:i,disableKeyboardA11y:y},e)))]})}Aa.displayName="EdgeRenderer";const Ra=n.memo(Aa),Ia=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Da({children:e}){const n=Ei(Ia);return t.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}const $a=e=>e.panZoom?.syncViewport;function La(e){return e.connection.inProgress?{...e.connection,to:Bo(e.connection.to,e.transform)}:{...e.connection}}function Ba(e){const t=function(e){if(e)return t=>{const n=La(t);return e(n)};return La}(e);return Ei(t,Li)}const Ta=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Va({containerStyle:e,style:n,type:o,component:i}){const{nodesConnectable:s,width:a,height:l,isValid:c,inProgress:u}=Ei(Ta,Li);return!!(a&&s&&u)?t.jsx("svg",{style:e,width:a,height:l,className:"react-flow__connectionline react-flow__container",children:t.jsx("g",{className:r(["react-flow__connection",ho(c)]),children:t.jsx(ja,{style:n,type:o,CustomComponent:i,isValid:c})})}):null}const ja=({style:n,type:o=e.ConnectionLineType.Bezier,CustomComponent:r,isValid:i})=>{const{inProgress:s,from:a,fromNode:l,fromHandle:c,fromPosition:u,to:d,toNode:h,toHandle:f,toPosition:g}=Ba();if(!s)return;if(r)return t.jsx(r,{connectionLineType:o,connectionLineStyle:n,fromNode:l,fromHandle:c,fromX:a.x,fromY:a.y,toX:d.x,toY:d.y,fromPosition:u,toPosition:g,connectionStatus:ho(i),toNode:h,toHandle:f});let p="";const m={sourceX:a.x,sourceY:a.y,sourcePosition:u,targetX:d.x,targetY:d.y,targetPosition:g};switch(o){case e.ConnectionLineType.Bezier:[p]=ir(m);break;case e.ConnectionLineType.SimpleBezier:[p]=aa(m);break;case e.ConnectionLineType.Step:[p]=gr({...m,borderRadius:0});break;case e.ConnectionLineType.SmoothStep:[p]=gr(m);break;default:[p]=ur(m)}return t.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:n})};ja.displayName="ConnectionLine";const Ha={};function Xa(e=Ha){n.useRef(e),ki(),n.useEffect((()=>{}),[e])}function Ya({nodeTypes:e,edgeTypes:o,onInit:r,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:f,onSelectionStart:g,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:x,selectionKeyCode:w,selectionOnDrag:b,selectionMode:S,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:k,deleteKeyCode:N,onlyRenderVisibleElements:M,elementsSelectable:_,defaultViewport:P,translateExtent:z,minZoom:O,maxZoom:A,preventScrolling:R,defaultMarkerColor:I,zoomOnScroll:D,zoomOnPinch:$,panOnScroll:L,panOnScrollSpeed:B,panOnScrollMode:T,zoomOnDoubleClick:V,panOnDrag:j,onPaneClick:H,onPaneMouseEnter:X,onPaneMouseMove:Y,onPaneMouseLeave:Z,onPaneScroll:W,onPaneContextMenu:F,paneClickDistance:K,nodeClickDistance:G,onEdgeContextMenu:q,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,noDragClassName:re,noWheelClassName:ie,noPanClassName:se,disableKeyboardA11y:ae,nodeExtent:le,rfId:ce,viewport:ue,onViewportChange:de}){return Xa(e),Xa(o),ki(),n.useRef(!1),n.useEffect((()=>{}),[]),function(e){const t=vs(),o=n.useRef(!1);n.useEffect((()=>{!o.current&&t.viewportInitialized&&e&&(setTimeout((()=>e(t)),1),o.current=!0)}),[e,t.viewportInitialized])}(r),function(e){const t=Ei($a),o=ki();n.useEffect((()=>{e&&(t?.(e),o.setState({transform:[e.x,e.y,e.zoom]}))}),[e,t])}(ue),t.jsx(Ws,{onPaneClick:H,onPaneMouseEnter:X,onPaneMouseMove:Y,onPaneMouseLeave:Z,onPaneContextMenu:F,onPaneScroll:W,paneClickDistance:K,deleteKeyCode:N,selectionKeyCode:w,selectionOnDrag:b,selectionMode:S,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:k,elementsSelectable:_,zoomOnScroll:D,zoomOnPinch:$,zoomOnDoubleClick:V,panOnScroll:L,panOnScrollSpeed:B,panOnScrollMode:T,panOnDrag:j,defaultViewport:P,translateExtent:z,minZoom:O,maxZoom:A,onSelectionContextMenu:f,preventScrolling:R,noDragClassName:re,noWheelClassName:ie,noPanClassName:se,disableKeyboardA11y:ae,onViewportChange:de,isControlledViewport:!!ue,children:t.jsxs(Da,{children:[t.jsx(Ra,{edgeTypes:o,onEdgeClick:s,onEdgeDoubleClick:l,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,onlyRenderVisibleElements:M,onEdgeContextMenu:q,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,defaultMarkerColor:I,noPanClassName:se,disableKeyboardA11y:ae,rfId:ce}),t.jsx(Va,{style:y,type:m,component:v,containerStyle:x}),t.jsx("div",{className:"react-flow__edgelabel-renderer"}),t.jsx(Qs,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:h,nodeClickDistance:G,onlyRenderVisibleElements:M,noPanClassName:se,noDragClassName:re,disableKeyboardA11y:ae,nodeExtent:le,rfId:ce}),t.jsx("div",{className:"react-flow__viewport-portal"})]})})}Ya.displayName="GraphView";const Za=n.memo(Ya),Wa=({nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,nodeOrigin:l,nodeExtent:c}={})=>{const u=new Map,d=new Map,h=new Map,f=new Map,g=r??n??[],p=o??t??[],m=l??[0,0],y=c??Jn;Pr(h,f,g);const v=Er(p,u,d,{nodeOrigin:m,nodeExtent:y,elevateNodesOnSelect:!1});let x=[0,0,1];if(a&&i&&s){const e=yo(u,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=jo(e,i,s,.5,2,.1);x=[t,n,o]}return{rfId:"1",width:0,height:0,transform:x,nodes:p,nodesInitialized:v,nodeLookup:u,parentLookup:d,edges:g,edgeLookup:f,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==o,hasDefaultEdges:void 0!==r,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:Jn,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:e.ConnectionMode.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:m,nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:void 0,fitViewResolver:null,connection:{...ro},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanSpeed:15,connectionRadius:20,onError:$o,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},Fa=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,nodeOrigin:a,nodeExtent:l})=>{return c=(c,u)=>{async function d(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:s,maxZoom:a}=u();t&&(await wo({nodes:e,width:r,height:i,panZoom:t,minZoom:s,maxZoom:a},n),o?.resolve(!0),c({fitViewResolver:null}))}return{...Wa({nodes:e,edges:t,width:r,height:i,fitView:s,nodeOrigin:a,nodeExtent:l,defaultNodes:n,defaultEdges:o}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,elevateNodesOnSelect:r,fitViewQueued:i}=u(),s=Er(e,t,n,{nodeOrigin:o,nodeExtent:l,elevateNodesOnSelect:r,checkEquality:!0});i&&s?(d(),c({nodes:e,nodesInitialized:s,fitViewQueued:!1,fitViewOptions:void 0})):c({nodes:e,nodesInitialized:s})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=u();Pr(t,n,e),c({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=u();t(e),c({hasDefaultNodes:!0})}if(t){const{setEdges:e}=u();e(t),c({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:s,debug:a,fitViewQueued:l}=u(),{changes:h,updatedInternals:f}=function(e,t,n,o,r,i){const s=o?.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const l=[],c=window.getComputedStyle(s),{m22:u}=new window.DOMMatrixReadOnly(c.transform),d=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),a=!0;continue}const s=Go(o.nodeElement),c=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(c||!e.internals.handleBounds||o.force)){const h=o.nodeElement.getBoundingClientRect(),f=Xo(e.extent)?e.extent:i;let{positionAbsolute:g}=e.internals;e.parentId&&"parent"===e.extent?g=Eo(g,s,t.get(e.parentId)):f&&(g=Co(g,f,s));const p={...e,measured:s,internals:{...e.internals,positionAbsolute:g,handleBounds:{source:tr("source",o.nodeElement,h,u,e.id),target:tr("target",o.nodeElement,h,u,e.id)}}};t.set(e.id,p),e.parentId&&kr(p,t,n,{nodeOrigin:r}),a=!0,c&&(l.push({id:e.id,type:"dimensions",dimensions:s}),e.expandParent&&e.parentId&&d.push({id:e.id,parentId:e.parentId,rect:zo(p,r)}))}}if(d.length>0){const e=Mr(d,t,n,r);l.push(...e)}return{changes:l,updatedInternals:a}}(e,n,o,r,i,s);f&&(function(e,t,n){const o=Cr(br,n);for(const n of e.values())if(n.parentId)kr(n,e,t,o);else{const e=po(n,o.nodeOrigin),t=Xo(n.extent)?n.extent:o.nodeExtent,r=Co(e,t,Yo(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:s}),l?(d(),c({fitViewQueued:!1,fitViewOptions:void 0})):c({}),h?.length>0&&(a&&console.log("React Flow: trigger node changes",h),t?.(h)))},updateNodePositions:(e,t=!1)=>{const n=[],o=[],{nodeLookup:r,triggerNodeChanges:i}=u();for(const[i,s]of e){const e=r.get(i),a=!!(e?.expandParent&&e?.parentId&&s?.position),l={id:i,type:"position",position:a?{x:Math.max(0,s.position.x),y:Math.max(0,s.position.y)}:s.position,dragging:t};a&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...s.internals.positionAbsolute,width:s.measured.width??0,height:s.measured.height??0}}),o.push(l)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=u(),i=Mr(n,r,e,t);o.push(...i)}i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=u();e?.length&&(r&&n(rs(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=u();e?.length&&(r&&n(is(e,o)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=u();t?r(e.map((e=>ss(e,!0)))):(r(as(o,new Set([...e]),!0)),i(as(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=u();t?i(e.map((e=>ss(e,!0)))):(i(as(n,new Set([...e]))),r(as(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:s}=u(),a=t||n,l=(e||o).map((e=>{const t=r.get(e.id);return t&&(t.selected=!1),ss(e.id,!1)})),c=a.map((e=>ss(e.id,!1)));i(l),s(c)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=u();t?.setScaleExtent([e,n]),c({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=u();t?.setScaleExtent([n,e]),c({maxZoom:e})},setTranslateExtent:e=>{u().panZoom?.setTranslateExtent(e),c({translateExtent:e})},setPaneClickDistance:e=>{u().panZoom?.setClickDistance(e)},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o}=u(),r=t.reduce(((e,t)=>t.selected?[...e,ss(t.id,!1)]:e),[]),i=e.reduce(((e,t)=>t.selected?[...e,ss(t.id,!1)]:e),[]);n(r),o(i)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:s}=u();e[0][0]===s[0][0]&&e[0][1]===s[0][1]&&e[1][0]===s[1][0]&&e[1][1]===s[1][1]||(Er(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1}),c({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=u();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},cancelConnection:()=>{c({connection:{...ro}})},updateConnection:e=>{c({connection:e})},reset:()=>c({...Wa()})}},u=Object.is,c?wi(c,u):wi;var c,u};function Ka({initialNodes:e,initialEdges:o,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:a,fitView:l,nodeOrigin:c,nodeExtent:u,children:d}){const[h]=n.useState((()=>Fa({nodes:e,edges:o,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:l,nodeOrigin:c,nodeExtent:u})));return t.jsx(Si,{value:h,children:t.jsx(ms,{children:d})})}function Ga({children:e,nodes:o,edges:r,defaultNodes:i,defaultEdges:s,width:a,height:l,fitView:c,nodeOrigin:u,nodeExtent:d}){return n.useContext(bi)?t.jsx(t.Fragment,{children:e}):t.jsx(Ka,{initialNodes:o,initialEdges:r,defaultNodes:i,defaultEdges:s,initialWidth:a,initialHeight:l,fitView:c,nodeOrigin:u,nodeExtent:d,children:e})}const qa={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var Ua=hs((function({nodes:o,edges:i,defaultNodes:s,defaultEdges:a,className:l,nodeTypes:c,edgeTypes:u,onNodeClick:d,onEdgeClick:h,onInit:f,onMove:g,onMoveStart:p,onMoveEnd:m,onConnect:y,onConnectStart:v,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:b,onNodeMouseEnter:S,onNodeMouseMove:C,onNodeMouseLeave:E,onNodeContextMenu:k,onNodeDoubleClick:N,onNodeDragStart:M,onNodeDrag:_,onNodeDragStop:P,onNodesDelete:z,onEdgesDelete:O,onDelete:A,onSelectionChange:R,onSelectionDragStart:I,onSelectionDrag:D,onSelectionDragStop:$,onSelectionContextMenu:L,onSelectionStart:B,onSelectionEnd:T,onBeforeDelete:V,connectionMode:j,connectionLineType:H=e.ConnectionLineType.Bezier,connectionLineStyle:X,connectionLineComponent:Y,connectionLineContainerStyle:Z,deleteKeyCode:W="Backspace",selectionKeyCode:F="Shift",selectionOnDrag:K=!1,selectionMode:G=e.SelectionMode.Full,panActivationKeyCode:q="Space",multiSelectionKeyCode:U=(Ho()?"Meta":"Control"),zoomActivationKeyCode:Q=(Ho()?"Meta":"Control"),snapToGrid:J,snapGrid:ee,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:ne,nodesDraggable:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:se=Yi,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:ue=Zi,minZoom:de=.5,maxZoom:he=2,translateExtent:fe=Jn,preventScrolling:ge=!0,nodeExtent:pe,defaultMarkerColor:me="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:ve=!0,panOnScroll:xe=!1,panOnScrollSpeed:we=.5,panOnScrollMode:be=e.PanOnScrollMode.Free,zoomOnDoubleClick:Se=!0,panOnDrag:Ce=!0,onPaneClick:Ee,onPaneMouseEnter:ke,onPaneMouseMove:Ne,onPaneMouseLeave:Me,onPaneScroll:_e,onPaneContextMenu:Pe,paneClickDistance:ze=0,nodeClickDistance:Oe=0,children:Ae,onReconnect:Re,onReconnectStart:Ie,onReconnectEnd:De,onEdgeContextMenu:$e,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:Te,onEdgeMouseLeave:Ve,reconnectRadius:je=10,onNodesChange:He,onEdgesChange:Xe,noDragClassName:Ye="nodrag",noWheelClassName:Ze="nowheel",noPanClassName:We="nopan",fitView:Fe,fitViewOptions:Ke,connectOnClick:Ge,attributionPosition:qe,proOptions:Ue,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,connectionRadius:it,isValidConnection:st,onError:at,style:lt,id:ct,nodeDragThreshold:ut,viewport:dt,onViewportChange:ht,width:ft,height:gt,colorMode:pt="light",debug:mt,onScroll:yt,...vt},xt){const wt=ct||"1",bt=function(e){const[t,o]=n.useState("system"===e?null:e);return n.useEffect((()=>{if("system"!==e)return void o(e);const t=qi(),n=()=>o(t?.matches?"dark":"light");return n(),t?.addEventListener("change",n),()=>{t?.removeEventListener("change",n)}}),[e]),null!==t?t:qi()?.matches?"dark":"light"}(pt),St=n.useCallback((e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),yt?.(e)}),[yt]);return t.jsx("div",{"data-testid":"rf__wrapper",...vt,onScroll:St,style:{...lt,...qa},ref:xt,className:r(["react-flow",l,bt]),id:ct,children:t.jsxs(Ga,{nodes:o,edges:i,width:ft,height:gt,fitView:Fe,nodeOrigin:se,nodeExtent:pe,children:[t.jsx(Za,{onInit:f,onNodeClick:d,onEdgeClick:h,onNodeMouseEnter:S,onNodeMouseMove:C,onNodeMouseLeave:E,onNodeContextMenu:k,onNodeDoubleClick:N,nodeTypes:c,edgeTypes:u,connectionLineType:H,connectionLineStyle:X,connectionLineComponent:Y,connectionLineContainerStyle:Z,selectionKeyCode:F,selectionOnDrag:K,selectionMode:G,deleteKeyCode:W,multiSelectionKeyCode:U,panActivationKeyCode:q,zoomActivationKeyCode:Q,onlyRenderVisibleElements:te,defaultViewport:ue,translateExtent:fe,minZoom:de,maxZoom:he,preventScrolling:ge,zoomOnScroll:ye,zoomOnPinch:ve,zoomOnDoubleClick:Se,panOnScroll:xe,panOnScrollSpeed:we,panOnScrollMode:be,panOnDrag:Ce,onPaneClick:Ee,onPaneMouseEnter:ke,onPaneMouseMove:Ne,onPaneMouseLeave:Me,onPaneScroll:_e,onPaneContextMenu:Pe,paneClickDistance:ze,nodeClickDistance:Oe,onSelectionContextMenu:L,onSelectionStart:B,onSelectionEnd:T,onReconnect:Re,onReconnectStart:Ie,onReconnectEnd:De,onEdgeContextMenu:$e,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:Te,onEdgeMouseLeave:Ve,reconnectRadius:je,defaultMarkerColor:me,noDragClassName:Ye,noWheelClassName:Ze,noPanClassName:We,rfId:wt,disableKeyboardA11y:tt,nodeExtent:pe,viewport:dt,onViewportChange:ht}),t.jsx(Gi,{nodes:o,edges:i,defaultNodes:s,defaultEdges:a,onConnect:y,onConnectStart:v,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:b,nodesDraggable:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:de,maxZoom:he,nodeExtent:pe,onNodesChange:He,onEdgesChange:Xe,snapToGrid:J,snapGrid:ee,connectionMode:j,translateExtent:fe,connectOnClick:Ge,defaultEdgeOptions:Qe,fitView:Fe,fitViewOptions:Ke,onNodesDelete:z,onEdgesDelete:O,onDelete:A,onNodeDragStart:M,onNodeDrag:_,onNodeDragStop:P,onSelectionDrag:D,onSelectionDragStart:I,onSelectionDragStop:$,onMove:g,onMoveStart:p,onMoveEnd:m,noPanClassName:We,nodeOrigin:se,rfId:wt,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,onError:at,connectionRadius:it,isValidConnection:st,selectNodesOnDrag:ne,nodeDragThreshold:ut,onBeforeDelete:V,paneClickDistance:ze,debug:mt}),t.jsx(Xi,{onSelectionChange:R}),Ae,t.jsx($i,{proOptions:Ue,position:qe}),t.jsx(Ri,{rfId:wt,disableKeyboardA11y:tt})]})})}));const Qa=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");const Ja=e=>e.domNode?.querySelector(".react-flow__viewport-portal");const el=e=>e.nodes;const tl=e=>e.edges;const nl=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});const ol=Qn.error014();function rl({dimensions:e,lineWidth:n,variant:o,className:i}){return t.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:r(["react-flow__background-pattern",o,i])})}function il({radius:e,className:n}){return t.jsx("circle",{cx:e,cy:e,r:e,className:r(["react-flow__background-pattern","dots",n])})}var sl;e.BackgroundVariant=void 0,(sl=e.BackgroundVariant||(e.BackgroundVariant={})).Lines="lines",sl.Dots="dots",sl.Cross="cross";const al={[e.BackgroundVariant.Dots]:1,[e.BackgroundVariant.Lines]:1,[e.BackgroundVariant.Cross]:6},ll=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function cl({id:o,variant:i=e.BackgroundVariant.Dots,gap:s=20,size:a,lineWidth:l=1,offset:c=0,color:u,bgColor:d,style:h,className:f,patternClassName:g}){const p=n.useRef(null),{transform:m,patternId:y}=Ei(ll,Li),v=a||al[i],x=i===e.BackgroundVariant.Dots,w=i===e.BackgroundVariant.Cross,b=Array.isArray(s)?s:[s,s],S=[b[0]*m[2]||1,b[1]*m[2]||1],C=v*m[2],E=Array.isArray(c)?c:[c,c],k=w?[C,C]:S,N=[E[0]*m[2]||1+k[0]/2,E[1]*m[2]||1+k[1]/2],M=`${y}${o||""}`;return t.jsxs("svg",{className:r(["react-flow__background",f]),style:{...h,...Ss,"--xy-background-color-props":d,"--xy-background-pattern-color-props":u},ref:p,"data-testid":"rf__background",children:[t.jsx("pattern",{id:M,x:m[0]%S[0],y:m[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:x?t.jsx(il,{radius:C/2,className:g}):t.jsx(rl,{dimensions:k,lineWidth:l,variant:i,className:g})}),t.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}cl.displayName="Background";const ul=n.memo(cl);function dl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:t.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function hl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:t.jsx("path",{d:"M0 0h32v4.2H0z"})})}function fl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:t.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 gl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:t.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 pl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:t.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 ml({children:e,className:n,...o}){return t.jsx("button",{type:"button",className:r(["react-flow__controls-button",n]),...o,children:e})}const yl=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom});function vl({style:e,showZoom:n=!0,showFitView:o=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:a,onZoomOut:l,onFitView:c,onInteractiveChange:u,className:d,children:h,position:f="bottom-left",orientation:g="vertical","aria-label":p="React Flow controls"}){const m=ki(),{isInteractive:y,minZoomReached:v,maxZoomReached:x}=Ei(yl,Li),{zoomIn:w,zoomOut:b,fitView:S}=vs(),C="horizontal"===g?"horizontal":"vertical";return t.jsxs(Di,{className:r(["react-flow__controls",C,d]),position:f,style:e,"data-testid":"rf__controls","aria-label":p,children:[n&&t.jsxs(t.Fragment,{children:[t.jsx(ml,{onClick:()=>{w(),a?.()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:x,children:t.jsx(dl,{})}),t.jsx(ml,{onClick:()=>{b(),l?.()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:v,children:t.jsx(hl,{})})]}),o&&t.jsx(ml,{className:"react-flow__controls-fitview",onClick:()=>{S(s),c?.()},title:"fit view","aria-label":"fit view",children:t.jsx(fl,{})}),i&&t.jsx(ml,{className:"react-flow__controls-interactive",onClick:()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),u?.(!y)},title:"toggle interactivity","aria-label":"toggle interactivity",children:y?t.jsx(pl,{}):t.jsx(gl,{})}),h]})}vl.displayName="Controls";const xl=n.memo(vl);const wl=n.memo((function({id:e,x:n,y:o,width:i,height:s,style:a,color:l,strokeColor:c,strokeWidth:u,className:d,borderRadius:h,shapeRendering:f,selected:g,onClick:p}){const{background:m,backgroundColor:y}=a||{},v=l||m||y;return t.jsx("rect",{className:r(["react-flow__minimap-node",{selected:g},d]),x:n,y:o,rx:h,ry:h,width:i,height:s,style:{fill:v,stroke:c,strokeWidth:u},shapeRendering:f,onClick:p?t=>p(t,e):void 0})})),bl=e=>e.nodes.map((e=>e.id)),Sl=e=>e instanceof Function?e:()=>e;const Cl=n.memo((function({id:e,nodeColorFunc:n,nodeStrokeColorFunc:o,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:h,width:f,height:g}=Ei((t=>{const{internals:n}=t.nodeLookup.get(e),o=n.userNode,{x:r,y:i}=n.positionAbsolute,{width:s,height:a}=Yo(o);return{node:o,x:r,y:i,width:s,height:a}}),Li);return u&&!u.hidden&&Zo(u)?t.jsx(l,{x:d,y:h,width:f,height:g,style:u.style,selected:!!u.selected,className:r(u),color:n(u),borderRadius:i,strokeColor:o(u),strokeWidth:s,shapeRendering:a,onClick:c,id:u.id}):null}));var El=n.memo((function({nodeStrokeColor:e,nodeColor:n,nodeClassName:o="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=wl,onClick:a}){const l=Ei(bl,Li),c=Sl(n),u=Sl(e),d=Sl(o),h="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return t.jsx(t.Fragment,{children:l.map((e=>t.jsx(Cl,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:h},e)))})}));const kl=e=>!e.hidden,Nl=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?Ao(yo(e.nodeLookup,{filter:kl}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height}};function Ml({style:e,className:o,nodeStrokeColor:i,nodeColor:s,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c,nodeComponent:u,bgColor:d,maskColor:h,maskStrokeColor:f,maskStrokeWidth:g,position:p="bottom-right",onClick:m,onNodeClick:y,pannable:v=!1,zoomable:x=!1,ariaLabel:w="React Flow mini map",inversePan:b,zoomStep:S=10,offsetScale:C=5}){const E=ki(),k=n.useRef(null),{boundingRect:N,viewBB:M,rfId:_,panZoom:P,translateExtent:z,flowWidth:O,flowHeight:A}=Ei(Nl,Li),R=e?.width??200,I=e?.height??150,D=N.width/R,$=N.height/I,L=Math.max(D,$),B=L*R,T=L*I,V=C*L,j=N.x-(B-N.width)/2-V,H=N.y-(T-N.height)/2-V,X=B+2*V,Y=T+2*V,Z=`react-flow__minimap-desc-${_}`,W=n.useRef(0),F=n.useRef();W.current=L,n.useEffect((()=>{if(k.current&&P)return F.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=Se(e);return{update:function({translateExtent:e,width:i,height:s,zoomStep:a=10,pannable:l=!0,zoomable:c=!0,inversePan:u=!1}){let d=[0,0];const h=Un().on("start",(e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(d=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])})).on("zoom",l?r=>{const a=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-d[0],l[1]-d[1]];d=l;const h=o()*Math.max(a[2],Math.log(a[2]))*(u?-1:1),f={x:a[0]-c[0]*h,y:a[1]-c[1]*h},g=[[0,0],[i,s]];t.setViewportConstrained({x:f.x,y:f.y,zoom:a[2]},g,e)}:null).on("zoom.wheel",c?e=>{const o=n();if("wheel"!==e.sourceEvent.type||!t)return;const r=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*a,i=o[2]*Math.pow(2,r);t.scaleTo(i)}:null);r.call(h,{})},destroy:function(){r.on("zoom",null)},pointer:Ce}}({domNode:k.current,panZoom:P,getTransform:()=>E.getState().transform,getViewScale:()=>W.current}),()=>{F.current?.destroy()}}),[P]),n.useEffect((()=>{F.current?.update({translateExtent:z,width:O,height:A,inversePan:b,pannable:v,zoomStep:S,zoomable:x})}),[v,x,b,S,z,O,A]);const K=m?e=>{const[t,n]=F.current?.pointer(e)||[0,0];m(e,{x:t,y:n})}:void 0,G=y?n.useCallback(((e,t)=>{const n=E.getState().nodeLookup.get(t).internals.userNode;y(e,n)}),[]):void 0;return t.jsx(Di,{position:p,style:{...e,"--xy-minimap-background-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof h?h:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof g?g*L:void 0,"--xy-minimap-node-background-color-props":"string"==typeof s?s:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof i?i:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof c?c:void 0},className:r(["react-flow__minimap",o]),"data-testid":"rf__minimap",children:t.jsxs("svg",{width:R,height:I,viewBox:`${j} ${H} ${X} ${Y}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:k,onClick:K,children:[w&&t.jsx("title",{id:Z,children:w}),t.jsx(El,{onClick:G,nodeColor:s,nodeStrokeColor:i,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),t.jsx("path",{className:"react-flow__minimap-mask",d:`M${j-V},${H-V}h${X+2*V}v${Y+2*V}h${-X-2*V}z\n M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Ml.displayName="MiniMap";const _l=n.memo(Ml);const Pl=n.memo((function({nodeId:o,position:i,variant:s=e.ResizeControlVariant.Handle,className:a,style:l={},children:c,color:u,minWidth:d=10,minHeight:h=10,maxWidth:f=Number.MAX_VALUE,maxHeight:g=Number.MAX_VALUE,keepAspectRatio:p=!1,shouldResize:m,onResizeStart:y,onResize:v,onResizeEnd:x}){const w=$s(),b="string"==typeof o?o:w,S=ki(),C=n.useRef(null),E=s===e.ResizeControlVariant.Line?"right":"bottom-right",k=i??E,N=n.useRef(null);n.useEffect((()=>{if(C.current&&b)return N.current||(N.current=si({domNode:C.current,nodeId:b,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=S.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=S.getState(),s=[],a={x:e.x,y:e.y},l=o.get(b);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,u=Mr([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...Wo({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);s.push(...u),a.x=e.x?Math.max(t[0]*n,e.x):void 0,a.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==a.x&&void 0!==a.y){const e={id:b,type:"position",position:{...a}};s.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:b,type:"dimensions",resizing:!0,setAttributes:!0,dimensions:{width:e.width,height:e.height}};s.push(t)}for(const e of t){const t={...e,type:"position"};s.push(t)}n(s)},onEnd:({width:e,height:t})=>{const n={id:b,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};S.getState().triggerNodeChanges([n])}})),N.current.update({controlPosition:k,boundaries:{minWidth:d,minHeight:h,maxWidth:f,maxHeight:g},keepAspectRatio:p,onResizeStart:y,onResize:v,onResizeEnd:x,shouldResize:m}),()=>{N.current?.destroy()}}),[k,d,h,f,g,p,y,v,x,m]);const M=k.split("-"),_=s===e.ResizeControlVariant.Line?"borderColor":"backgroundColor",P=u?{...l,[_]:u}:l;return t.jsx("div",{className:r(["react-flow__resize-control","nodrag",...M,s,a]),ref:C,style:P,children:c})}));const zl=e=>e.domNode?.querySelector(".react-flow__renderer");function Ol({children:e}){const t=Ei(zl);return t?o.createPortal(e,t):null}const Al=(e,t)=>e?.internals.positionAbsolute.x!==t?.internals.positionAbsolute.x||e?.internals.positionAbsolute.y!==t?.internals.positionAbsolute.y||e?.measured.width!==t?.measured.width||e?.measured.height!==t?.measured.height||e?.selected!==t?.selected||e?.internals.z!==t?.internals.z,Rl=(e,t)=>{if(e.size!==t.size)return!1;for(const[n,o]of e)if(Al(o,t.get(n)))return!1;return!0},Il=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2],selectedNodesCount:e.nodes.filter((e=>e.selected)).length});e.Background=ul,e.BaseEdge=ia,e.BezierEdge=ba,e.ControlButton=ml,e.Controls=xl,e.EdgeLabelRenderer=function({children:e}){const t=Ei(Qa);return t?o.createPortal(e,t):null},e.EdgeText=ra,e.Handle=Bs,e.MiniMap=_l,e.NodeResizeControl=Pl,e.NodeResizer=function({nodeId:n,isVisible:o=!0,handleClassName:r,handleStyle:i,lineClassName:s,lineStyle:a,color:l,minWidth:c=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:f=!1,shouldResize:g,onResizeStart:p,onResize:m,onResizeEnd:y}){return o?t.jsxs(t.Fragment,{children:[Qr.map((o=>t.jsx(Pl,{className:s,style:a,nodeId:n,position:o,variant:e.ResizeControlVariant.Line,color:l,minWidth:c,minHeight:u,maxWidth:d,maxHeight:h,onResizeStart:p,keepAspectRatio:f,shouldResize:g,onResize:m,onResizeEnd:y},o))),Ur.map((e=>t.jsx(Pl,{className:r,style:i,nodeId:n,position:e,color:l,minWidth:c,minHeight:u,maxWidth:d,maxHeight:h,onResizeStart:p,keepAspectRatio:f,shouldResize:g,onResize:m,onResizeEnd:y},e)))]}):null},e.NodeToolbar=function({nodeId:o,children:i,className:s,style:a,isVisible:l,position:c=e.Position.Top,offset:u=10,align:d="center",...h}){const f=$s(),g=n.useCallback((e=>{const t=(Array.isArray(o)?o:[o||f||""]).reduce(((t,n)=>{const o=e.nodeLookup.get(n);return o&&t.set(o.id,o),t}),new Map);return t}),[o,f]),p=Ei(g,Rl),{x:m,y:y,zoom:v,selectedNodesCount:x}=Ei(Il,Li);if(!("boolean"==typeof l?l:1===p.size&&p.values().next().value?.selected&&1===x)||!p.size)return null;const w=yo(p),b=Array.from(p.values()),S=Math.max(...b.map((e=>e.internals.z+1))),C={position:"absolute",transform:wr(w,{x:m,y:y,zoom:v},c,u,d),zIndex:S,...a};return t.jsx(Ol,{children:t.jsx("div",{style:C,className:r(["react-flow__node-toolbar",s]),...h,"data-id":b.reduce(((e,t)=>`${e}${t.id} `),"").trim(),children:i})})},e.Panel=Di,e.ReactFlow=Ua,e.ReactFlowProvider=Ka,e.SimpleBezierEdge=ca,e.SmoothStepEdge=ha,e.StepEdge=pa,e.StraightEdge=va,e.ViewportPortal=function({children:e}){const t=Ei(Ja);return t?o.createPortal(e,t):null},e.addEdge=cr,e.applyEdgeChanges=is,e.applyNodeChanges=rs,e.getBezierEdgeCenter=nr,e.getBezierPath=ir,e.getConnectedEdges=xo,e.getEdgeCenter=sr,e.getIncomers=(e,t,n)=>{if(!e.id)return[];const o=new Set;return n.forEach((t=>{t.target===e.id&&o.add(t.source)})),t.filter((e=>o.has(e.id)))},e.getNodesBounds=mo,e.getOutgoers=(e,t,n)=>{if(!e.id)return[];const o=new Set;return n.forEach((t=>{t.source===e.id&&o.add(t.target)})),t.filter((e=>o.has(e.id)))},e.getSimpleBezierPath=aa,e.getSmoothStepPath=gr,e.getStraightPath=ur,e.getViewportForBounds=jo,e.isEdge=ds,e.isNode=us,e.reconnectEdge=(e,t,n,o={shouldReplaceId:!0})=>{const{id:r,...i}=e;if(!t.source||!t.target)return n;if(!n.find((t=>t.id===e.id)))return n;const s={...i,id:o.shouldReplaceId?lr(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter((e=>e.id!==r)).concat(s)},e.useConnection=Ba,e.useEdges=function(){return Ei(tl,Li)},e.useEdgesState=function(e){const[t,o]=n.useState(e),r=n.useCallback((e=>o((t=>is(e,t)))),[]);return[t,o,r]},e.useHandleConnections=function({type:e,id:t,nodeId:o,onConnect:r,onDisconnect:i}){console.warn("[DEPRECATED] `useHandleConnections` is deprecated. Instead use `useNodeConnections` https://reactflow.dev/api-reference/hooks/useNodeConnections");const s=$s(),a=o??s,l=n.useRef(null),c=Ei((n=>n.connectionLookup.get(`${a}-${e}${t?`-${t}`:""}`)),co);return n.useEffect((()=>{if(l.current&&l.current!==c){const e=c??new Map;uo(l.current,e,i),uo(e,l.current,r)}l.current=c??new Map}),[c,r,i]),n.useMemo((()=>Array.from(c?.values()??[])),[c])},e.useInternalNode=function(e){return Ei(n.useCallback((t=>t.nodeLookup.get(e)),[e]),Li)},e.useKeyPress=Qi,e.useNodeConnections=function({id:e,handleType:t,handleId:o,onConnect:r,onDisconnect:i}={}){const s=$s(),a=e??s;if(!a)throw new Error(ol);const l=n.useRef(null),c=Ei((e=>e.connectionLookup.get(`${a}${t?o?`-${t}-${o}`:`-${t}`:""}`)),co);return n.useEffect((()=>{if(l.current&&l.current!==c){const e=c??new Map;uo(l.current,e,i),uo(e,l.current,r)}l.current=c??new Map}),[c,r,i]),n.useMemo((()=>Array.from(c?.values()??[])),[c])},e.useNodeId=$s,e.useNodes=function(){return Ei(el,Li)},e.useNodesData=function(e){return Ei(n.useCallback((t=>{const n=[],o=Array.isArray(e),r=o?e:[e];for(const e of r){const o=t.nodeLookup.get(e);o&&n.push({id:o.id,type:o.type,data:o.data})}return o?n:n[0]??null}),[e]),zr)},e.useNodesInitialized=function(e={includeHiddenNodes:!1}){return Ei((e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(0===t.nodeLookup.size)return!1;for(const[,{internals:e}]of t.nodeLookup)if(void 0===e.handleBounds||!Zo(e.userNode))return!1;return!0})(e))},e.useNodesState=function(e){const[t,o]=n.useState(e),r=n.useCallback((e=>o((t=>rs(e,t)))),[]);return[t,o,r]},e.useOnSelectionChange=function({onChange:e}){const t=ki();n.useEffect((()=>{const n=[...t.getState().onSelectionChangeHandlers,e];return t.setState({onSelectionChangeHandlers:n}),()=>{const n=t.getState().onSelectionChangeHandlers.filter((t=>t!==e));t.setState({onSelectionChangeHandlers:n})}}),[e])},e.useOnViewportChange=function({onStart:e,onChange:t,onEnd:o}){const r=ki();n.useEffect((()=>{r.setState({onViewportChangeStart:e})}),[e]),n.useEffect((()=>{r.setState({onViewportChange:t})}),[t]),n.useEffect((()=>{r.setState({onViewportChangeEnd:o})}),[o])},e.useReactFlow=vs,e.useStore=Ei,e.useStoreApi=ki,e.useUpdateNodeInternals=function(){const e=ki();return n.useCallback((t=>{const{domNode:n,updateNodeInternals:o}=e.getState(),r=Array.isArray(t)?t:[t],i=new Map;r.forEach((e=>{const t=n?.querySelector(`.react-flow__node[data-id="${e}"]`);t&&i.set(e,{id:e,nodeElement:t,force:!0})})),requestAnimationFrame((()=>o(i,{triggerFitView:!1})))}),[])},e.useViewport=function(){return Ei(nl,Li)}}));
|
|
10
|
+
*/di.exports=function(){if(ui)return hi;ui=1;var e=n,t=pi(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return hi.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=a((function(){function e(e){if(!s){if(s=!0,r=e,e=c(e),void 0!==u&&h.hasValue){var t=h.value;if(u(t,e))return i=t}return i=e}if(t=i,o(r,e))return t;var n=c(e);return void 0!==u&&u(t,n)?t:(r=e,i=n)}var r,i,s=!1,a=void 0===n?null:n;return[function(){return e(t())},null===a?void 0:function(){return e(a())}]}),[t,n,c,u]);var f=r(e,d[0],d[1]);return s((function(){h.hasValue=!0,h.value=f}),[f]),l(f),f},hi}();var mi=ai(di.exports);const yi=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r)?r:Object.assign({},t,r),n.forEach((n=>n(t,e)))}},r=()=>t,i={setState:o,getState:r,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{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()}};return t=e(o,r,i),i},{useSyncExternalStoreWithSelector:vi}=mi;function xi(e,t=e.getState,o){const r=vi(e.subscribe,e.getState,e.getServerState||e.getState,t,o);return n.useDebugValue(r),r}const wi=(e,t)=>{const n=(e=>e?yi(e):yi)(e),o=(e,o=t)=>xi(n,e,o);return Object.assign(o,n),o},bi=n.createContext(null),Si=bi.Provider,Ci=Qn.error001();function Ei(e,t){const o=n.useContext(bi);if(null===o)throw new Error(Ci);return xi(o,e,t)}function ki(){const e=n.useContext(bi);if(null===e)throw new Error(Ci);return n.useMemo((()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe})),[e])}const Mi={display:"none"},Ni={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_i="react-flow__node-desc",Pi="react-flow__edge-desc",zi="react-flow__aria-live",Oi=e=>e.ariaLiveMessage;function Ai({rfId:e}){const n=Ei(Oi);return t.jsx("div",{id:`${zi}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ni,children:n})}function Ri({rfId:e,disableKeyboardA11y:n}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{id:`${_i}-${e}`,style:Mi,children:["Press enter or space to select a node.",!n&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),t.jsx("div",{id:`${Pi}-${e}`,style:Mi,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!n&&t.jsx(Ai,{rfId:e})]})}const Ii=e=>e.userSelectionActive?"none":"all",Di=n.forwardRef((({position:e="top-left",children:n,className:o,style:i,...s},a)=>{const l=Ei(Ii),c=`${e}`.split("-");return t.jsx("div",{className:r(["react-flow__panel",o,...c]),style:{...i,pointerEvents:l},ref:a,...s,children:n})}));function $i({proOptions:e,position:n="bottom-right"}){return e?.hideAttribution?null:t.jsx(Di,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:t.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}function Li(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o=0;o<n.length;o++)if(!Object.prototype.hasOwnProperty.call(t,n[o])||!Object.is(e[n[o]],t[n[o]]))return!1;return!0}Di.displayName="Panel";const Bi=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Ti=e=>e.id;function Vi(e,t){return Li(e.selectedNodes.map(Ti),t.selectedNodes.map(Ti))&&Li(e.selectedEdges.map(Ti),t.selectedEdges.map(Ti))}function ji({onSelectionChange:e}){const t=ki(),{selectedNodes:o,selectedEdges:r}=Ei(Bi,Vi);return n.useEffect((()=>{const n={nodes:o,edges:r};e?.(n),t.getState().onSelectionChangeHandlers.forEach((e=>e(n)))}),[o,r,e]),null}const Hi=e=>!!e.onSelectionChangeHandlers;function Zi({onSelectionChange:e}){const n=Ei(Hi);return e||n?t.jsx(ji,{onSelectionChange:e}):null}const Xi=[0,0],Yi={x:0,y:0,zoom:1},Fi=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","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","onBeforeDelete","debug","autoPanSpeed","paneClickDistance","rfId"],Wi=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,setPaneClickDistance:e.setPaneClickDistance}),Ki={translateExtent:Jn,nodeOrigin:Xi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function Gi(e){const{setNodes:t,setEdges:o,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c,setPaneClickDistance:u}=Ei(Wi,Li),d=ki();n.useEffect((()=>(c(e.defaultNodes,e.defaultEdges),()=>{h.current=Ki,l()})),[]);const h=n.useRef(Ki);return n.useEffect((()=>{for(const n of Fi){const l=e[n];l!==h.current[n]&&(void 0!==e[n]&&("nodes"===n?t(l):"edges"===n?o(l):"minZoom"===n?r(l):"maxZoom"===n?i(l):"translateExtent"===n?s(l):"nodeExtent"===n?a(l):"paneClickDistance"===n?u(l):"fitView"===n?d.setState({fitViewQueued:l}):"fitViewOptions"===n?d.setState({fitViewOptions:l}):d.setState({[n]:l})))}h.current=e}),Fi.map((t=>e[t]))),null}function qi(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const Ui="undefined"!=typeof document?document:null;function Qi(e=null,t={target:Ui,actInsideInputWithModifier:!0}){const[o,r]=n.useState(!1),i=n.useRef(!1),s=n.useRef(new Set([])),[a,l]=n.useMemo((()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter((e=>"string"==typeof e)).map((e=>e.replace("+","\n").replace("\n\n","\n+").split("\n"))),n=t.reduce(((e,t)=>e.concat(...t)),[]);return[t,n]}return[[],[]]}),[e]);return n.useEffect((()=>{const n=t?.target||Ui;if(null!==e){const e=e=>{i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey;if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Qo(e))return!1;const n=es(e.code,l);if(s.current.add(e[n]),Ji(a,s.current,!1)){const n=e.composedPath?.()?.[0]||e.target,o="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!i.current&&o||e.preventDefault(),r(!0)}},o=e=>{const t=es(e.code,l);Ji(a,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(e[t]),"Meta"===e.key&&s.current.clear(),i.current=!1},c=()=>{s.current.clear(),r(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",o),window.addEventListener("blur",c),window.addEventListener("contextmenu",c),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",o),window.removeEventListener("blur",c),window.removeEventListener("contextmenu",c)}}}),[e,r]),o}function Ji(e,t,n){return e.filter((e=>n||e.length===t.size)).some((e=>e.every((e=>t.has(e)))))}function es(e,t){return t.includes(e)?"code":"key"}const ts=()=>{const e=ki();return n.useMemo((()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},{duration:n?.duration}),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>{const{width:r,height:i,maxZoom:s,panZoom:a}=e.getState(),l=void 0!==o?.zoom?o.zoom:s,c=r/2-t*l,u=i/2-n*l;return a?(await a.setViewport({x:c,y:u,zoom:l},{duration:o?.duration}),Promise.resolve(!0)):Promise.resolve(!1)},fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=jo(t,o,r,i,s,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return Bo(c,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=To(t,n);return{x:s.x+r,y:s.y+i}}})),[])};function ns(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)os(e,r);n.push(r)}return r.length&&r.forEach((e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})})),n}function os(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function rs(e,t){return ns(e,t)}function is(e,t){return ns(e,t)}function ss(e,t){return{id:e,type:"select",selected:t}}function as(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(ss(i.id,e)))}return o}function ls({items:e=[],lookup:t}){const n=[],o=new Map(e.map((e=>[e.id,e])));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t){void 0===o.get(e)&&n.push({id:e,type:"remove"})}return n}function cs(e){return{id:e.id,type:"remove"}}const us=e=>(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e),ds=e=>fo(e);function hs(e){return n.forwardRef(e)}const fs="undefined"!=typeof window?n.useLayoutEffect:n.useEffect;function gs(e){const[t,o]=n.useState(BigInt(0)),[r]=n.useState((()=>function(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}((()=>o((e=>e+BigInt(1)))))));return fs((()=>{const t=r.get();t.length&&(e(t),r.reset())}),[t]),r}const ps=n.createContext(null);function ms({children:e}){const o=ki(),r=gs(n.useCallback((e=>{const{nodes:t=[],setNodes:n,hasDefaultNodes:r,onNodesChange:i,nodeLookup:s,fitViewQueued:a}=o.getState();let l=t;for(const t of e)l="function"==typeof t?t(l):t;if(r)n(l);else{const e=ls({items:l,lookup:s});e.length>0?i?.(e):a&&window.requestAnimationFrame((()=>{const{fitViewQueued:e,nodes:t,setNodes:n}=o.getState();e&&n(t)}))}}),[])),i=gs(n.useCallback((e=>{const{edges:t=[],setEdges:n,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:s}=o.getState();let a=t;for(const t of e)a="function"==typeof t?t(a):t;r?n(a):i&&i(ls({items:a,lookup:s}))}),[])),s=n.useMemo((()=>({nodeQueue:r,edgeQueue:i})),[]);return t.jsx(ps.Provider,{value:s,children:e})}const ys=e=>!!e.panZoom;function vs(){const e=ts(),t=ki(),o=function(){const e=n.useContext(ps);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),r=Ei(ys),i=n.useMemo((()=>{const e=e=>t.getState().nodeLookup.get(e),n=e=>{o.nodeQueue.push(e)},r=e=>{o.edgeQueue.push(e)},i=e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState(),r=us(e)?e:n.get(e.id),i=r.parentId?Fo(r.position,r.measured,r.parentId,n,o):r.position,s={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return zo(s)},s=(e,t,o={replace:!1})=>{n((n=>n.map((n=>{if(n.id===e){const e="function"==typeof t?t(n):t;return o.replace&&us(e)?e:{...n,...e}}return n}))))},a=(e,t,n={replace:!1})=>{r((o=>o.map((o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&ds(e)?e:{...o,...e}}return o}))))};return{getNodes:()=>t.getState().nodes.map((e=>({...e}))),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map((e=>({...e})))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:n,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];o.nodeQueue.push((e=>[...e,...t]))},addEdges:e=>{const t=Array.isArray(e)?e:[e];o.edgeQueue.push((e=>[...e,...t]))},toObject:()=>{const{nodes:e=[],edges:n=[],transform:o}=t.getState(),[r,i,s]=o;return{nodes:e.map((e=>({...e}))),edges:n.map((e=>({...e}))),viewport:{x:r,y:i,zoom:s}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:s,triggerNodeChanges:a,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:u}=t.getState(),{nodes:d,edges:h}=await async function({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map((e=>e.id))),s=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&s.find((t=>t.id===e.parentId));(t||n)&&s.push(e)}const a=new Set(t.map((e=>e.id))),l=o.filter((e=>!1!==e.deletable)),c=xo(s,l);for(const e of l)a.has(e.id)&&!c.find((t=>t.id===e.id))&&c.push(e);if(!r)return{edges:c,nodes:s};const u=await r({nodes:s,edges:c});return"boolean"==typeof u?u?{edges:c,nodes:s}:{edges:[],nodes:[]}:u}({nodesToRemove:e,edgesToRemove:n,nodes:o,edges:r,onBeforeDelete:u}),f=h.length>0,g=d.length>0;if(f){const e=h.map(cs);s?.(h),l(e)}if(g){const e=d.map(cs);i?.(d),a(e)}return(g||f)&&c?.({nodes:d,edges:h}),{deletedNodes:d,deletedEdges:h}},getIntersectingNodes:(e,n=!0,o)=>{const r=Io(e),s=r?e:i(e),a=void 0!==o;return s?(o||t.getState().nodes).filter((o=>{const i=t.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=zo(a?o:i),c=Ro(l,s);return n&&c>0||c>=s.width*s.height})):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=Io(e)?e:i(e);if(!o)return!1;const r=Ro(o,t);return n&&r>0||r>=o.width*o.height},updateNode:s,updateNodeData:(e,t,n={replace:!1})=>{s(e,(e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}}),n)},updateEdge:a,updateEdgeData:(e,t,n={replace:!1})=>{a(e,(e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}}),n)},getNodesBounds:e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState();return mo(e,{nodeLookup:n,nodeOrigin:o})},getHandleConnections:({type:e,id:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const n=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise(((n,o)=>{e=n,t=o})),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:n}),o.nodeQueue.push((e=>[...e])),n.promise}}}),[]);return n.useMemo((()=>({...i,...e,viewportInitialized:r})),[r])}const xs=e=>e.selected,ws={actInsideInputWithModifier:!1},bs="undefined"!=typeof window?window:void 0;const Ss={position:"absolute",width:"100%",height:"100%",top:0,left:0},Cs=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function Es({onPaneContextMenu:o,zoomOnScroll:r=!0,zoomOnPinch:i=!0,panOnScroll:s=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=e.PanOnScrollMode.Free,zoomOnDoubleClick:c=!0,panOnDrag:u=!0,defaultViewport:d,translateExtent:h,minZoom:f,maxZoom:g,zoomActivationKeyCode:p,preventScrolling:m=!0,children:y,noWheelClassName:v,noPanClassName:x,onViewportChange:w,isControlledViewport:b,paneClickDistance:S}){const C=ki(),E=n.useRef(null),{userSelectionActive:k,lib:M}=Ei(Cs,Li),N=Qi(p),_=n.useRef();!function(e){const t=ki();n.useEffect((()=>{const n=()=>{if(!e.current)return!1;const n=Go(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004",Qn.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver((()=>n()));return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}}),[])}(E);const P=n.useCallback((e=>{w?.({x:e[0],y:e[1],zoom:e[2]}),b||C.setState({transform:e})}),[w,b]);return n.useEffect((()=>{if(E.current){_.current=Gr({domNode:E.current,minZoom:f,maxZoom:g,translateExtent:h,viewport:d,paneClickDistance:S,onDraggingChange:e=>C.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=C.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=C.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=C.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=_.current.getViewport();return C.setState({panZoom:_.current,transform:[e,t,n],domNode:E.current.closest(".react-flow")}),()=>{_.current?.destroy()}}}),[]),n.useEffect((()=>{_.current?.update({onPaneContextMenu:o,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:s,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:c,panOnDrag:u,zoomActivationKeyPressed:N,preventScrolling:m,noPanClassName:x,userSelectionActive:k,noWheelClassName:v,lib:M,onTransformChange:P})}),[o,r,i,s,a,l,c,u,N,m,x,k,v,M,P]),t.jsx("div",{className:"react-flow__renderer",ref:E,style:Ss,children:y})}const ks=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ms(){const{userSelectionActive:e,userSelectionRect:n}=Ei(ks,Li);return e&&n?t.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const Ns=(e,t)=>n=>{n.target===t.current&&e?.(n)},_s=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Ps({isSelecting:o,selectionKeyPressed:i,selectionMode:s=e.SelectionMode.Full,panOnDrag:a,selectionOnDrag:l,onSelectionStart:c,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:f,onPaneMouseEnter:g,onPaneMouseMove:p,onPaneMouseLeave:m,children:y}){const v=ki(),{userSelectionActive:x,elementsSelectable:w,dragging:b,connectionInProgress:S}=Ei(_s,Li),C=w&&(o||x),E=n.useRef(null),k=n.useRef(),M=n.useRef(new Set),N=n.useRef(new Set),_=n.useRef(!1),P=n.useRef(!1),z=e=>{_.current||S?_.current=!1:(d?.(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1}))},O=f?e=>f(e):void 0,A=!0===a||Array.isArray(a)&&a.includes(0);return t.jsxs("div",{className:r(["react-flow__pane",{draggable:A,dragging:b,selection:o}]),onClick:C?void 0:Ns(z,E),onContextMenu:Ns((e=>{Array.isArray(a)&&a?.includes(2)?e.preventDefault():h?.(e)}),E),onWheel:Ns(O,E),onPointerEnter:C?void 0:g,onPointerDown:C?e=>{const{resetSelectedElements:t,domNode:n}=v.getState();if(k.current=n?.getBoundingClientRect(),!w||!o||0!==e.button||e.target!==E.current||!k.current)return;e.target?.setPointerCapture?.(e.pointerId),P.current=!0,_.current=!1;const{x:r,y:i}=er(e.nativeEvent,k.current);t(),v.setState({userSelectionRect:{width:0,height:0,startX:r,startY:i,x:r,y:i}}),c?.(e)}:p,onPointerMove:C?t=>{const{userSelectionRect:n,transform:o,nodeLookup:r,edgeLookup:i,connectionLookup:a,triggerNodeChanges:l,triggerEdgeChanges:c,defaultEdgeOptions:u}=v.getState();if(!k.current||!n)return;_.current=!0;const{x:d,y:h}=er(t.nativeEvent,k.current),{startX:f,startY:g}=n,p={startX:f,startY:g,x:d<f?d:f,y:h<g?h:g,width:Math.abs(d-f),height:Math.abs(h-g)},m=M.current,y=N.current;M.current=new Set(vo(r,p,o,s===e.SelectionMode.Partial,!0).map((e=>e.id))),N.current=new Set;const x=u?.selectable??!0;for(const e of M.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=i.get(e);t&&(t.selectable??x)&&N.current.add(e)}}if(!Wo(m,M.current)){l(as(r,M.current,!0))}if(!Wo(y,N.current)){c(as(i,N.current))}v.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}:p,onPointerUp:C?e=>{if(0!==e.button||!P.current)return;e.target?.releasePointerCapture?.(e.pointerId);const{userSelectionRect:t}=v.getState();!x&&t&&e.target===E.current&&z?.(e),v.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:M.current.size>0}),u?.(e),(i||l)&&(_.current=!1),P.current=!1}:void 0,onPointerLeave:m,ref:E,style:Ss,children:[y,t.jsx(Ms,{})]})}function zs({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame((()=>o?.current?.blur()))):r([e])):l?.("012",Qn.error012(e))}function Os({nodeRef:e,disabled:t=!1,noDragClassName:o,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:a}){const l=ki(),[c,u]=n.useState(!1),d=n.useRef();return n.useEffect((()=>{d.current=Ir({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{zs({id:t,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})}),[]),n.useEffect((()=>{if(t)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:o,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:a}),()=>{d.current?.destroy()}}),[o,r,t,s,e,i]),c}const As=e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable);function Rs(){const e=ki();return n.useCallback((t=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:s,updateNodePositions:a,nodeLookup:l,nodeOrigin:c}=e.getState(),u=new Map,d=As(i),h=o?r[0]:5,f=o?r[1]:5,g=t.direction.x*h*t.factor,p=t.direction.y*f*t.factor;for(const[,e]of l){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+g,y:e.internals.positionAbsolute.y+p};o&&(t=Lo(t,r));const{position:i,positionAbsolute:a}=bo({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:s});e.position=i,e.internals.positionAbsolute=a,u.set(e.id,e)}a(u)}),[])}const Is=n.createContext(null),Ds=Is.Provider;Is.Consumer;const $s=()=>n.useContext(Is),Ls=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId});const Bs=n.memo(hs((function({type:n="source",position:o=e.Position.Top,isValidConnection:i,isConnectable:s=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:c,onConnect:u,children:d,className:h,onMouseDown:f,onTouchStart:g,...p},m){const y=c||null,v="target"===n,x=ki(),w=$s(),{connectOnClick:b,noPanClassName:S,rfId:C}=Ei(Ls,Li),{connectingFrom:E,connectingTo:k,clickConnecting:M,isPossibleEndHandle:N,connectionInProcess:_,clickConnectionInProcess:P,valid:z}=Ei(((t,n,o)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:a}=r,{fromHandle:l,toHandle:c,isValid:u}=a,d=c?.nodeId===t&&c?.id===n&&c?.type===o;return{connectingFrom:l?.nodeId===t&&l?.id===n&&l?.type===o,connectingTo:d,clickConnecting:i?.nodeId===t&&i?.id===n&&i?.type===o,isPossibleEndHandle:s===e.ConnectionMode.Strict?l?.type!==o:t!==l?.nodeId||n!==l?.id,connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:d&&u}})(w,y,n),Li);w||x.getState().onError?.("010",Qn.error010());const O=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=x.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t}=x.getState();t(cr(r,e))}n?.(r),u?.(r)},A=e=>{if(!w)return;const t=Jo(e.nativeEvent);if(a&&(t&&0===e.button||!t)){const t=x.getState();jr.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:v,handleId:y,nodeId:w,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:O,isValidConnection:i||t.isValidConnection,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed})}t?f?.(e):g?.(e)};return t.jsx("div",{"data-handleid":y,"data-nodeid":w,"data-handlepos":o,"data-id":`${C}-${w}-${y}-${n}`,className:r(["react-flow__handle",`react-flow__handle-${o}`,"nodrag",S,h,{source:!v,target:v,connectable:s,connectablestart:a,connectableend:l,clickconnecting:M,connectingfrom:E,connectingto:k,valid:z,connectionindicator:s&&(!_||N)&&(_||P?l:a)}]),onMouseDown:A,onTouchStart:A,onClick:b?e=>{const{onClickConnectStart:t,onClickConnectEnd:o,connectionClickStartHandle:r,connectionMode:s,isValidConnection:l,lib:c,rfId:u,nodeLookup:d,connection:h}=x.getState();if(!w||!r&&!a)return;if(!r)return t?.(e.nativeEvent,{nodeId:w,handleId:y,handleType:n}),void x.setState({connectionClickStartHandle:{nodeId:w,type:n,id:y}});const f=qo(e.target),g=i||l,{connection:p,isValid:m}=jr.isValid(e.nativeEvent,{handle:{nodeId:w,id:y,type:n},connectionMode:s,fromNodeId:r.nodeId,fromHandleId:r.id||null,fromType:r.type,isValidConnection:g,flowId:u,doc:f,lib:c,nodeLookup:d});m&&p&&O(p);const v=structuredClone(h);delete v.inProgress,v.toPosition=v.toHandle?v.toHandle.position:null,o?.(e,v),x.setState({connectionClickStartHandle:null})}:void 0,ref:m,...p,children:d})})));const Ts={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Vs={input:function({data:n,isConnectable:o,sourcePosition:r=e.Position.Bottom}){return t.jsxs(t.Fragment,{children:[n?.label,t.jsx(Bs,{type:"source",position:r,isConnectable:o})]})},default:function({data:n,isConnectable:o,targetPosition:r=e.Position.Top,sourcePosition:i=e.Position.Bottom}){return t.jsxs(t.Fragment,{children:[t.jsx(Bs,{type:"target",position:r,isConnectable:o}),n?.label,t.jsx(Bs,{type:"source",position:i,isConnectable:o})]})},output:function({data:n,isConnectable:o,targetPosition:r=e.Position.Top}){return t.jsxs(t.Fragment,{children:[t.jsx(Bs,{type:"target",position:r,isConnectable:o}),n?.label]})},group:function(){return null}};const js=e=>{const{width:t,height:n,x:o,y:r}=yo(e.nodeLookup,{filter:e=>!!e.selected});return{width:Do(t)?t:null,height:Do(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Hs({onSelectionContextMenu:e,noPanClassName:o,disableKeyboardA11y:i}){const s=ki(),{width:a,height:l,transformString:c,userSelectionActive:u}=Ei(js,Li),d=Rs(),h=n.useRef(null);if(n.useEffect((()=>{i||h.current?.focus({preventScroll:!0})}),[i]),Os({nodeRef:h}),u||!a||!l)return null;const f=e?t=>{const n=s.getState().nodes.filter((e=>e.selected));e(t,n)}:void 0;return t.jsx("div",{className:r(["react-flow__nodesselection","react-flow__container",o]),style:{transform:c},children:t.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:i?void 0:-1,onKeyDown:i?void 0:e=>{Object.prototype.hasOwnProperty.call(Ts,e.key)&&(e.preventDefault(),d({direction:Ts[e.key],factor:e.shiftKey?4:1}))},style:{width:a,height:l}})})}const Zs="undefined"!=typeof window?window:void 0,Xs=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Ys({children:e,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:h,selectionMode:f,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:v,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:M,defaultViewport:N,translateExtent:_,minZoom:P,maxZoom:z,preventScrolling:O,onSelectionContextMenu:A,noWheelClassName:R,noPanClassName:I,disableKeyboardA11y:D,onViewportChange:$,isControlledViewport:L}){const{nodesSelectionActive:B,userSelectionActive:T}=Ei(Xs),V=Qi(d,{target:Zs}),j=Qi(y,{target:Zs}),H=j||M,Z=j||S,X=h&&!0!==H,Y=V||T||X;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const o=ki(),{deleteElements:r}=vs(),i=Qi(e,ws),s=Qi(t,{target:bs});n.useEffect((()=>{if(i){const{edges:e,nodes:t}=o.getState();r({nodes:t.filter(xs),edges:e.filter(xs)}),o.setState({nodesSelectionActive:!1})}}),[i]),n.useEffect((()=>{o.setState({multiSelectionActive:s})}),[s])}({deleteKeyCode:u,multiSelectionKeyCode:m}),t.jsx(Es,{onPaneContextMenu:a,elementsSelectable:x,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:Z,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!V&&H,defaultViewport:N,translateExtent:_,minZoom:P,maxZoom:z,zoomActivationKeyCode:v,preventScrolling:O,noWheelClassName:R,noPanClassName:I,onViewportChange:$,isControlledViewport:L,paneClickDistance:c,children:t.jsxs(Ps,{onSelectionStart:g,onSelectionEnd:p,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:H,isSelecting:!!Y,selectionMode:f,selectionKeyPressed:V,selectionOnDrag:X,children:[e,B&&t.jsx(Hs,{onSelectionContextMenu:A,noPanClassName:I,disableKeyboardA11y:D})]})})}Ys.displayName="FlowRenderer";const Fs=n.memo(Ys),Ws=e=>t=>e?vo(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map((e=>e.id)):Array.from(t.nodeLookup.keys());const Ks=e=>e.updateNodeInternals;function Gs({id:e,onClick:o,onMouseEnter:i,onMouseMove:s,onMouseLeave:a,onContextMenu:l,onDoubleClick:c,nodesDraggable:u,elementsSelectable:d,nodesConnectable:h,nodesFocusable:f,resizeObserver:g,noDragClassName:p,noPanClassName:m,disableKeyboardA11y:y,rfId:v,nodeTypes:x,nodeClickDistance:w,onError:b}){const{node:S,internals:C,isParent:E}=Ei((t=>{const n=t.nodeLookup.get(e),o=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:o}}),Li);let k=S.type||"default",M=x?.[k]||Vs[k];void 0===M&&(b?.("003",Qn.error003(k)),k="default",M=Vs.default);const N=!!(S.draggable||u&&void 0===S.draggable),_=!!(S.selectable||d&&void 0===S.selectable),P=!!(S.connectable||h&&void 0===S.connectable),z=!!(S.focusable||f&&void 0===S.focusable),O=ki(),A=Yo(S),R=function({node:e,nodeType:t,hasDimensions:o,resizeObserver:r}){const i=ki(),s=n.useRef(null),a=n.useRef(null),l=n.useRef(e.sourcePosition),c=n.useRef(e.targetPosition),u=n.useRef(t),d=o&&!!e.internals.handleBounds;return n.useEffect((()=>{!s.current||e.hidden||d&&a.current===s.current||(a.current&&r?.unobserve(a.current),r?.observe(s.current),a.current=s.current)}),[d,e.hidden]),n.useEffect((()=>()=>{a.current&&(r?.unobserve(a.current),a.current=null)}),[]),n.useEffect((()=>{if(s.current){const n=u.current!==t,o=l.current!==e.sourcePosition,r=c.current!==e.targetPosition;(n||o||r)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}}),[e.id,t,e.sourcePosition,e.targetPosition]),s}({node:S,nodeType:k,hasDimensions:A,resizeObserver:g}),I=Os({nodeRef:R,disabled:S.hidden||!N,noDragClassName:p,handleSelector:S.dragHandle,nodeId:e,isSelectable:_,nodeClickDistance:w}),D=Rs();if(S.hidden)return null;const $=Xo(S),L=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(S),B=_||N||o||i||s||a,T=i?e=>i(e,{...C.userNode}):void 0,V=s?e=>s(e,{...C.userNode}):void 0,j=a?e=>a(e,{...C.userNode}):void 0,H=l?e=>l(e,{...C.userNode}):void 0,Z=c?e=>c(e,{...C.userNode}):void 0;return t.jsx("div",{className:r(["react-flow__node",`react-flow__node-${k}`,{[m]:N},S.className,{selected:S.selected,selectable:_,parent:E,draggable:N,dragging:I}]),ref:R,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:A?"visible":"hidden",...S.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:T,onMouseMove:V,onMouseLeave:j,onContextMenu:H,onClick:t=>{const{selectNodesOnDrag:n,nodeDragThreshold:r}=O.getState();_&&(!n||!N||r>0)&&zs({id:e,store:O,nodeRef:R}),o&&o(t,{...C.userNode})},onDoubleClick:Z,onKeyDown:z?t=>{if(!Qo(t.nativeEvent)&&!y)if(eo.includes(t.key)&&_){const n="Escape"===t.key;zs({id:e,store:O,unselect:n,nodeRef:R})}else N&&S.selected&&Object.prototype.hasOwnProperty.call(Ts,t.key)&&(t.preventDefault(),O.setState({ariaLiveMessage:`Moved selected node ${t.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~C.positionAbsolute.x}, y: ${~~C.positionAbsolute.y}`}),D({direction:Ts[t.key],factor:t.shiftKey?4:1}))}:void 0,tabIndex:z?0:void 0,role:z?"button":void 0,"aria-describedby":y?void 0:`${_i}-${v}`,"aria-label":S.ariaLabel,children:t.jsx(Ds,{value:e,children:t.jsx(M,{id:e,data:S.data,type:k,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:S.selected??!1,selectable:_,draggable:N,deletable:S.deletable??!0,isConnectable:P,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:I,dragHandle:S.dragHandle,zIndex:C.z,parentId:S.parentId,...$})})})}const qs=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Us(e){const{nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:s,onError:a}=Ei(qs,Li),l=(c=e.onlyRenderVisibleElements,Ei(n.useCallback(Ws(c),[c]),Li));var c;const u=function(){const e=Ei(Ks),[t]=n.useState((()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver((t=>{const n=new Map;t.forEach((e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})})),e(n)}))));return n.useEffect((()=>()=>{t?.disconnect()}),[t]),t}();return t.jsx("div",{className:"react-flow__nodes",style:Ss,children:l.map((n=>t.jsx(Gs,{id:n,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:u,nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:a},n)))})}Us.displayName="NodeRenderer";const Qs=n.memo(Us);const Js={[e.MarkerType.Arrow]:({color:e="none",strokeWidth:n=1})=>t.jsx("polyline",{style:{stroke:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[e.MarkerType.ArrowClosed]:({color:e="none",strokeWidth:n=1})=>t.jsx("polyline",{style:{stroke:e,fill:e,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})};const ea=({id:e,type:o,color:r,width:i=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const u=function(e){const t=ki();return n.useMemo((()=>Object.prototype.hasOwnProperty.call(Js,e)?Js[e]:(t.getState().onError?.("009",Qn.error009(e)),null)),[e])}(o);return u?t.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:c,refX:"0",refY:"0",children:t.jsx(u,{color:r,strokeWidth:l})}):null},ta=({defaultColor:e,rfId:o})=>{const r=Ei((e=>e.edges)),i=Ei((e=>e.defaultEdgeOptions)),s=n.useMemo((()=>{const t=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce(((e,s)=>([s.markerStart||o,s.markerEnd||r].forEach((o=>{if(o&&"object"==typeof o){const r=xr(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}})),e)),[]).sort(((e,t)=>e.id.localeCompare(t.id)))}(r,{id:o,defaultColor:e,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd});return t}),[r,i,o,e]);return s.length?t.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:t.jsx("defs",{children:s.map((e=>t.jsx(ea,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id)))})}):null};ta.displayName="MarkerDefinitions";var na=n.memo(ta);function oa({x:e,y:o,label:i,labelStyle:s,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:d,className:h,...f}){const[g,p]=n.useState({x:1,y:0,width:0,height:0}),m=r(["react-flow__edge-textwrapper",h]),y=n.useRef(null);return n.useEffect((()=>{if(y.current){const e=y.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}}),[i]),i?t.jsxs("g",{transform:`translate(${e-g.width/2} ${o-g.height/2})`,className:m,visibility:g.width?"visible":"hidden",...f,children:[a&&t.jsx("rect",{width:g.width+2*c[0],x:-c[0],y:-c[1],height:g.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),t.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:y,style:s,children:i}),d]}):null}oa.displayName="EdgeText";const ra=n.memo(oa);function ia({path:e,labelX:n,labelY:o,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u,interactionWidth:d=20,...h}){return t.jsxs(t.Fragment,{children:[t.jsx("path",{...h,d:e,fill:"none",className:r(["react-flow__edge-path",h.className])}),d&&t.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}),i&&Do(n)&&Do(o)?t.jsx(ra,{x:n,y:o,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:u}):null]})}function sa({pos:t,x1:n,y1:o,x2:r,y2:i}){return t===e.Position.Left||t===e.Position.Right?[.5*(n+r),o]:[n,.5*(o+i)]}function aa({sourceX:t,sourceY:n,sourcePosition:o=e.Position.Bottom,targetX:r,targetY:i,targetPosition:s=e.Position.Top}){const[a,l]=sa({pos:o,x1:t,y1:n,x2:r,y2:i}),[c,u]=sa({pos:s,x1:r,y1:i,x2:t,y2:n}),[d,h,f,g]=nr({sourceX:t,sourceY:n,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${t},${n} C${a},${l} ${c},${u} ${r},${i}`,d,h,f,g]}function la(e){return n.memo((({id:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[x,w,b]=aa({sourceX:o,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l}),S=e.isInternal?void 0:n;return t.jsx(ia,{id:S,path:x,labelX:w,labelY:b,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:y,interactionWidth:v})}))}const ca=la({isInternal:!1}),ua=la({isInternal:!0});function da(o){return n.memo((({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:f,style:g,sourcePosition:p=e.Position.Bottom,targetPosition:m=e.Position.Top,markerEnd:y,markerStart:v,pathOptions:x,interactionWidth:w})=>{const[b,S,C]=gr({sourceX:r,sourceY:i,sourcePosition:p,targetX:s,targetY:a,targetPosition:m,borderRadius:x?.borderRadius,offset:x?.offset}),E=o.isInternal?void 0:n;return t.jsx(ia,{id:E,path:b,labelX:S,labelY:C,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:y,markerStart:v,interactionWidth:w})}))}ca.displayName="SimpleBezierEdge",ua.displayName="SimpleBezierEdgeInternal";const ha=da({isInternal:!1}),fa=da({isInternal:!0});function ga(e){return n.memo((({id:o,...r})=>{const i=e.isInternal?void 0:o;return t.jsx(ha,{...r,id:i,pathOptions:n.useMemo((()=>({borderRadius:0,offset:r.pathOptions?.offset})),[r.pathOptions?.offset])})}))}ha.displayName="SmoothStepEdge",fa.displayName="SmoothStepEdgeInternal";const pa=ga({isInternal:!1}),ma=ga({isInternal:!0});function ya(e){return n.memo((({id:n,sourceX:o,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:g,markerStart:p,interactionWidth:m})=>{const[y,v,x]=ur({sourceX:o,sourceY:r,targetX:i,targetY:s}),w=e.isInternal?void 0:n;return t.jsx(ia,{id:w,path:y,labelX:v,labelY:x,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,style:f,markerEnd:g,markerStart:p,interactionWidth:m})}))}pa.displayName="StepEdge",ma.displayName="StepEdgeInternal";const va=ya({isInternal:!1}),xa=ya({isInternal:!0});function wa(o){return n.memo((({id:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:l=e.Position.Bottom,targetPosition:c=e.Position.Top,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:v,pathOptions:x,interactionWidth:w})=>{const[b,S,C]=ir({sourceX:r,sourceY:i,sourcePosition:l,targetX:s,targetY:a,targetPosition:c,curvature:x?.curvature}),E=o.isInternal?void 0:n;return t.jsx(ia,{id:E,path:b,labelX:S,labelY:C,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:v,interactionWidth:w})}))}va.displayName="StraightEdge",xa.displayName="StraightEdgeInternal";const ba=wa({isInternal:!1}),Sa=wa({isInternal:!0});ba.displayName="BezierEdge",Sa.displayName="BezierEdgeInternal";const Ca={default:Sa,straight:xa,step:ma,smoothstep:fa,simplebezier:ua},Ea={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},ka=(t,n,o)=>o===e.Position.Left?t-n:o===e.Position.Right?t+n:t,Ma=(t,n,o)=>o===e.Position.Top?t-n:o===e.Position.Bottom?t+n:t,Na="react-flow__edgeupdater";function _a({position:e,centerX:n,centerY:o,radius:i=10,onMouseDown:s,onMouseEnter:a,onMouseOut:l,type:c}){return t.jsx("circle",{onMouseDown:s,onMouseEnter:a,onMouseOut:l,className:r([Na,`${Na}-${c}`]),cx:ka(n,i,e),cy:Ma(o,i,e),r:i,stroke:"transparent",fill:"transparent"})}function Pa({isReconnectable:e,reconnectRadius:n,edge:o,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:h,setReconnecting:f,setUpdateHover:g}){const p=ki(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:n,domNode:r,isValidConnection:i,connectionMode:s,connectionRadius:a,lib:l,onConnectStart:c,onConnectEnd:g,cancelConnection:m,nodeLookup:y,rfId:v,panBy:x,updateConnection:w}=p.getState(),b="target"===t.type;f(!0),d?.(e,o,t.type);jr.onPointerDown(e.nativeEvent,{autoPanOnConnect:n,connectionMode:s,connectionRadius:a,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:y,isTarget:b,edgeUpdaterType:t.type,lib:l,flowId:v,cancelConnection:m,panBy:x,isValidConnection:i,onConnect:e=>u?.(o,e),onConnectStart:c,onConnectEnd:g,onReconnectEnd:(e,n)=>{f(!1),h?.(e,o,t.type,n)},updateConnection:w,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle})},y=()=>g(!0),v=()=>g(!1);return t.jsxs(t.Fragment,{children:[(!0===e||"source"===e)&&t.jsx(_a,{position:l,centerX:r,centerY:i,radius:n,onMouseDown:e=>m(e,{nodeId:o.target,id:o.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:v,type:"source"}),(!0===e||"target"===e)&&t.jsx(_a,{position:c,centerX:s,centerY:a,radius:n,onMouseDown:e=>m(e,{nodeId:o.source,id:o.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:v,type:"target"})]})}function za({id:o,edgesFocusable:i,edgesReconnectable:s,elementsSelectable:a,onClick:l,onDoubleClick:c,onContextMenu:u,onMouseEnter:d,onMouseMove:h,onMouseLeave:f,reconnectRadius:g,onReconnect:p,onReconnectStart:m,onReconnectEnd:y,rfId:v,edgeTypes:x,noPanClassName:w,onError:b,disableKeyboardA11y:S}){let C=Ei((e=>e.edgeLookup.get(o)));const E=Ei((e=>e.defaultEdgeOptions));C=E?{...E,...C}:C;let k=C.type||"default",M=x?.[k]||Ca[k];void 0===M&&(b?.("011",Qn.error011(k)),k="default",M=Ca.default);const N=!!(C.focusable||i&&void 0===C.focusable),_=void 0!==p&&(C.reconnectable||s&&void 0===C.reconnectable),P=!!(C.selectable||a&&void 0===C.selectable),z=n.useRef(null),[O,A]=n.useState(!1),[R,I]=n.useState(!1),D=ki(),{zIndex:$,sourceX:L,sourceY:B,targetX:T,targetY:V,sourcePosition:j,targetPosition:H}=Ei(n.useCallback((t=>{const n=t.nodeLookup.get(C.source),r=t.nodeLookup.get(C.target);if(!n||!r)return{zIndex:C.zIndex,...Ea};const i=function(t){const{sourceNode:n,targetNode:o}=t;if(!pr(n)||!pr(o))return null;const r=n.internals.handleBounds||mr(n.handles),i=o.internals.handleBounds||mr(o.handles),s=vr(r?.source??[],t.sourceHandle),a=vr(t.connectionMode===e.ConnectionMode.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),t.targetHandle);if(!s||!a)return t.onError?.("008",Qn.error008(s?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const l=s?.position||e.Position.Bottom,c=a?.position||e.Position.Top,u=yr(n,s,l),d=yr(o,a,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}({id:o,sourceNode:n,targetNode:r,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:t.connectionMode,onError:b}),s=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1}){if(!r)return o;const i=n||t.selected||e.selected,s=Math.max(e.internals.z||0,t.internals.z||0,1e3);return o+(i?s:0)}({selected:C.selected,zIndex:C.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect});return{zIndex:s,...i||Ea}}),[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),Li),Z=n.useMemo((()=>C.markerStart?`url('#${xr(C.markerStart,v)}')`:void 0),[C.markerStart,v]),X=n.useMemo((()=>C.markerEnd?`url('#${xr(C.markerEnd,v)}')`:void 0),[C.markerEnd,v]);if(C.hidden||null===L||null===B||null===T||null===V)return null;const Y=c?e=>{c(e,{...C})}:void 0,F=u?e=>{u(e,{...C})}:void 0,W=d?e=>{d(e,{...C})}:void 0,K=h?e=>{h(e,{...C})}:void 0,G=f?e=>{f(e,{...C})}:void 0;return t.jsx("svg",{style:{zIndex:$},children:t.jsxs("g",{className:r(["react-flow__edge",`react-flow__edge-${k}`,C.className,w,{selected:C.selected,animated:C.animated,inactive:!P&&!l,updating:O,selectable:P}]),onClick:e=>{const{addSelectedEdges:t,unselectNodesAndEdges:n,multiSelectionActive:r}=D.getState();P&&(D.setState({nodesSelectionActive:!1}),C.selected&&r?(n({nodes:[],edges:[C]}),z.current?.blur()):t([o])),l&&l(e,C)},onDoubleClick:Y,onContextMenu:F,onMouseEnter:W,onMouseMove:K,onMouseLeave:G,onKeyDown:N?e=>{if(!S&&eo.includes(e.key)&&P){const{unselectNodesAndEdges:t,addSelectedEdges:n}=D.getState();"Escape"===e.key?(z.current?.blur(),t({edges:[C]})):n([o])}}:void 0,tabIndex:N?0:void 0,role:N?"button":"img","data-id":o,"data-testid":`rf__edge-${o}`,"aria-label":null===C.ariaLabel?void 0:C.ariaLabel||`Edge from ${C.source} to ${C.target}`,"aria-describedby":N?`${Pi}-${v}`:void 0,ref:z,children:[!R&&t.jsx(M,{id:o,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:P,deletable:C.deletable??!0,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:L,sourceY:B,targetX:T,targetY:V,sourcePosition:j,targetPosition:H,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:Z,markerEnd:X,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),_&&t.jsx(Pa,{edge:C,isReconnectable:_,reconnectRadius:g,onReconnect:p,onReconnectStart:m,onReconnectEnd:y,sourceX:L,sourceY:B,targetX:T,targetY:V,sourcePosition:j,targetPosition:H,setUpdateHover:A,setReconnecting:I})]})})}const Oa=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Aa({defaultMarkerColor:e,onlyRenderVisibleElements:o,rfId:r,edgeTypes:i,noPanClassName:s,onReconnect:a,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:h,reconnectRadius:f,onEdgeDoubleClick:g,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:v,edgesReconnectable:x,elementsSelectable:w,onError:b}=Ei(Oa,Li),S=(C=o,Ei(n.useCallback((e=>{if(!C)return e.edges.map((e=>e.id));const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&ar({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t}),[C]),Li));var C;return t.jsxs("div",{className:"react-flow__edges",children:[t.jsx(na,{defaultColor:e,rfId:r}),S.map((e=>t.jsx(za,{id:e,edgesFocusable:v,edgesReconnectable:x,elementsSelectable:w,noPanClassName:s,onReconnect:a,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,onClick:h,reconnectRadius:f,onDoubleClick:g,onReconnectStart:p,onReconnectEnd:m,rfId:r,onError:b,edgeTypes:i,disableKeyboardA11y:y},e)))]})}Aa.displayName="EdgeRenderer";const Ra=n.memo(Aa),Ia=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Da({children:e}){const n=Ei(Ia);return t.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:e})}const $a=e=>e.panZoom?.syncViewport;function La(e){return e.connection.inProgress?{...e.connection,to:Bo(e.connection.to,e.transform)}:{...e.connection}}function Ba(e){const t=function(e){if(e)return t=>{const n=La(t);return e(n)};return La}(e);return Ei(t,Li)}const Ta=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Va({containerStyle:e,style:n,type:o,component:i}){const{nodesConnectable:s,width:a,height:l,isValid:c,inProgress:u}=Ei(Ta,Li);return!!(a&&s&&u)?t.jsx("svg",{style:e,width:a,height:l,className:"react-flow__connectionline react-flow__container",children:t.jsx("g",{className:r(["react-flow__connection",ho(c)]),children:t.jsx(ja,{style:n,type:o,CustomComponent:i,isValid:c})})}):null}const ja=({style:n,type:o=e.ConnectionLineType.Bezier,CustomComponent:r,isValid:i})=>{const{inProgress:s,from:a,fromNode:l,fromHandle:c,fromPosition:u,to:d,toNode:h,toHandle:f,toPosition:g}=Ba();if(!s)return;if(r)return t.jsx(r,{connectionLineType:o,connectionLineStyle:n,fromNode:l,fromHandle:c,fromX:a.x,fromY:a.y,toX:d.x,toY:d.y,fromPosition:u,toPosition:g,connectionStatus:ho(i),toNode:h,toHandle:f});let p="";const m={sourceX:a.x,sourceY:a.y,sourcePosition:u,targetX:d.x,targetY:d.y,targetPosition:g};switch(o){case e.ConnectionLineType.Bezier:[p]=ir(m);break;case e.ConnectionLineType.SimpleBezier:[p]=aa(m);break;case e.ConnectionLineType.Step:[p]=gr({...m,borderRadius:0});break;case e.ConnectionLineType.SmoothStep:[p]=gr(m);break;default:[p]=ur(m)}return t.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:n})};ja.displayName="ConnectionLine";const Ha={};function Za(e=Ha){n.useRef(e),ki(),n.useEffect((()=>{}),[e])}function Xa({nodeTypes:e,edgeTypes:o,onInit:r,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:f,onSelectionStart:g,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:x,selectionKeyCode:w,selectionOnDrag:b,selectionMode:S,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:k,deleteKeyCode:M,onlyRenderVisibleElements:N,elementsSelectable:_,defaultViewport:P,translateExtent:z,minZoom:O,maxZoom:A,preventScrolling:R,defaultMarkerColor:I,zoomOnScroll:D,zoomOnPinch:$,panOnScroll:L,panOnScrollSpeed:B,panOnScrollMode:T,zoomOnDoubleClick:V,panOnDrag:j,onPaneClick:H,onPaneMouseEnter:Z,onPaneMouseMove:X,onPaneMouseLeave:Y,onPaneScroll:F,onPaneContextMenu:W,paneClickDistance:K,nodeClickDistance:G,onEdgeContextMenu:q,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,noDragClassName:re,noWheelClassName:ie,noPanClassName:se,disableKeyboardA11y:ae,nodeExtent:le,rfId:ce,viewport:ue,onViewportChange:de}){return Za(e),Za(o),ki(),n.useRef(!1),n.useEffect((()=>{}),[]),function(e){const t=vs(),o=n.useRef(!1);n.useEffect((()=>{!o.current&&t.viewportInitialized&&e&&(setTimeout((()=>e(t)),1),o.current=!0)}),[e,t.viewportInitialized])}(r),function(e){const t=Ei($a),o=ki();n.useEffect((()=>{e&&(t?.(e),o.setState({transform:[e.x,e.y,e.zoom]}))}),[e,t])}(ue),t.jsx(Fs,{onPaneClick:H,onPaneMouseEnter:Z,onPaneMouseMove:X,onPaneMouseLeave:Y,onPaneContextMenu:W,onPaneScroll:F,paneClickDistance:K,deleteKeyCode:M,selectionKeyCode:w,selectionOnDrag:b,selectionMode:S,onSelectionStart:g,onSelectionEnd:p,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:k,elementsSelectable:_,zoomOnScroll:D,zoomOnPinch:$,zoomOnDoubleClick:V,panOnScroll:L,panOnScrollSpeed:B,panOnScrollMode:T,panOnDrag:j,defaultViewport:P,translateExtent:z,minZoom:O,maxZoom:A,onSelectionContextMenu:f,preventScrolling:R,noDragClassName:re,noWheelClassName:ie,noPanClassName:se,disableKeyboardA11y:ae,onViewportChange:de,isControlledViewport:!!ue,children:t.jsxs(Da,{children:[t.jsx(Ra,{edgeTypes:o,onEdgeClick:s,onEdgeDoubleClick:l,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,onlyRenderVisibleElements:N,onEdgeContextMenu:q,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,defaultMarkerColor:I,noPanClassName:se,disableKeyboardA11y:ae,rfId:ce}),t.jsx(Va,{style:y,type:m,component:v,containerStyle:x}),t.jsx("div",{className:"react-flow__edgelabel-renderer"}),t.jsx(Qs,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:h,nodeClickDistance:G,onlyRenderVisibleElements:N,noPanClassName:se,noDragClassName:re,disableKeyboardA11y:ae,nodeExtent:le,rfId:ce}),t.jsx("div",{className:"react-flow__viewport-portal"})]})})}Xa.displayName="GraphView";const Ya=n.memo(Xa),Fa=({nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:h}={})=>{const f=new Map,g=new Map,p=new Map,m=new Map,y=r??n??[],v=o??t??[],x=d??[0,0],w=h??Jn;Pr(p,m,y);const b=Er(v,f,g,{nodeOrigin:x,nodeExtent:w,elevateNodesOnSelect:!1});let S=[0,0,1];if(a&&i&&s){const e=yo(f,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=jo(e,i,s,c,u,l?.padding??.1);S=[t,n,o]}return{rfId:"1",width:0,height:0,transform:S,nodes:v,nodesInitialized:b,nodeLookup:f,parentLookup:g,edges:y,edgeLookup:m,connectionLookup:p,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==o,hasDefaultEdges:void 0!==r,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Jn,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:e.ConnectionMode.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...ro},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanSpeed:15,connectionRadius:20,onError:$o,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},Wa=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d})=>{return h=(h,f)=>{async function g(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:s,maxZoom:a}=f();t&&(await wo({nodes:e,width:r,height:i,panZoom:t,minZoom:s,maxZoom:a},n),o?.resolve(!0),h({fitViewResolver:null}))}return{...Fa({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,elevateNodesOnSelect:r,fitViewQueued:i}=f(),s=Er(e,t,n,{nodeOrigin:o,nodeExtent:d,elevateNodesOnSelect:r,checkEquality:!0});i&&s?(g(),h({nodes:e,nodesInitialized:s,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:e,nodesInitialized:s})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=f();Pr(t,n,e),h({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=f();t(e),h({hasDefaultNodes:!0})}if(t){const{setEdges:e}=f();e(t),h({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:s,debug:a,fitViewQueued:l}=f(),{changes:c,updatedInternals:u}=function(e,t,n,o,r,i){const s=o?.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const l=[],c=window.getComputedStyle(s),{m22:u}=new window.DOMMatrixReadOnly(c.transform),d=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),a=!0;continue}const s=Go(o.nodeElement),c=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(c||!e.internals.handleBounds||o.force)){const h=o.nodeElement.getBoundingClientRect(),f=Zo(e.extent)?e.extent:i;let{positionAbsolute:g}=e.internals;e.parentId&&"parent"===e.extent?g=Eo(g,s,t.get(e.parentId)):f&&(g=Co(g,f,s));const p={...e,measured:s,internals:{...e.internals,positionAbsolute:g,handleBounds:{source:tr("source",o.nodeElement,h,u,e.id),target:tr("target",o.nodeElement,h,u,e.id)}}};t.set(e.id,p),e.parentId&&kr(p,t,n,{nodeOrigin:r}),a=!0,c&&(l.push({id:e.id,type:"dimensions",dimensions:s}),e.expandParent&&e.parentId&&d.push({id:e.id,parentId:e.parentId,rect:zo(p,r)}))}}if(d.length>0){const e=Nr(d,t,n,r);l.push(...e)}return{changes:l,updatedInternals:a}}(e,n,o,r,i,s);u&&(function(e,t,n){const o=Cr(br,n);for(const n of e.values())if(n.parentId)kr(n,e,t,o);else{const e=po(n,o.nodeOrigin),t=Zo(n.extent)?n.extent:o.nodeExtent,r=Co(e,t,Xo(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:s}),l?(g(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),c?.length>0&&(a&&console.log("React Flow: trigger node changes",c),t?.(c)))},updateNodePositions:(e,t=!1)=>{const n=[],o=[],{nodeLookup:r,triggerNodeChanges:i}=f();for(const[i,s]of e){const e=r.get(i),a=!!(e?.expandParent&&e?.parentId&&s?.position),l={id:i,type:"position",position:a?{x:Math.max(0,s.position.x),y:Math.max(0,s.position.y)}:s.position,dragging:t};a&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...s.internals.positionAbsolute,width:s.measured.width??0,height:s.measured.height??0}}),o.push(l)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=f(),i=Nr(n,r,e,t);o.push(...i)}i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=f();e?.length&&(r&&n(rs(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=f();e?.length&&(r&&n(is(e,o)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=f();t?r(e.map((e=>ss(e,!0)))):(r(as(o,new Set([...e]),!0)),i(as(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=f();t?i(e.map((e=>ss(e,!0)))):(i(as(n,new Set([...e]))),r(as(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:s}=f(),a=t||n,l=(e||o).map((e=>{const t=r.get(e.id);return t&&(t.selected=!1),ss(e.id,!1)})),c=a.map((e=>ss(e.id,!1)));i(l),s(c)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=f();t?.setScaleExtent([e,n]),h({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=f();t?.setScaleExtent([n,e]),h({maxZoom:e})},setTranslateExtent:e=>{f().panZoom?.setTranslateExtent(e),h({translateExtent:e})},setPaneClickDistance:e=>{f().panZoom?.setClickDistance(e)},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o,elementsSelectable:r}=f();if(!r)return;const i=t.reduce(((e,t)=>t.selected?[...e,ss(t.id,!1)]:e),[]),s=e.reduce(((e,t)=>t.selected?[...e,ss(t.id,!1)]:e),[]);n(i),o(s)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:s}=f();e[0][0]===s[0][0]&&e[0][1]===s[0][1]&&e[1][0]===s[1][0]&&e[1][1]===s[1][1]||(Er(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1}),h({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=f();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},cancelConnection:()=>{h({connection:{...ro}})},updateConnection:e=>{h({connection:e})},reset:()=>h({...Fa()})}},f=Object.is,h?wi(h,f):wi;var h,f};function Ka({initialNodes:e,initialEdges:o,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:a,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:u,fitView:d,nodeOrigin:h,nodeExtent:f,children:g}){const[p]=n.useState((()=>Wa({nodes:e,edges:o,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:u,nodeOrigin:h,nodeExtent:f})));return t.jsx(Si,{value:p,children:t.jsx(ms,{children:g})})}function Ga({children:e,nodes:o,edges:r,defaultNodes:i,defaultEdges:s,width:a,height:l,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:f,nodeExtent:g}){return n.useContext(bi)?t.jsx(t.Fragment,{children:e}):t.jsx(Ka,{initialNodes:o,initialEdges:r,defaultNodes:i,defaultEdges:s,initialWidth:a,initialHeight:l,fitView:c,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:h,nodeOrigin:f,nodeExtent:g,children:e})}const qa={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var Ua=hs((function({nodes:o,edges:i,defaultNodes:s,defaultEdges:a,className:l,nodeTypes:c,edgeTypes:u,onNodeClick:d,onEdgeClick:h,onInit:f,onMove:g,onMoveStart:p,onMoveEnd:m,onConnect:y,onConnectStart:v,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:b,onNodeMouseEnter:S,onNodeMouseMove:C,onNodeMouseLeave:E,onNodeContextMenu:k,onNodeDoubleClick:M,onNodeDragStart:N,onNodeDrag:_,onNodeDragStop:P,onNodesDelete:z,onEdgesDelete:O,onDelete:A,onSelectionChange:R,onSelectionDragStart:I,onSelectionDrag:D,onSelectionDragStop:$,onSelectionContextMenu:L,onSelectionStart:B,onSelectionEnd:T,onBeforeDelete:V,connectionMode:j,connectionLineType:H=e.ConnectionLineType.Bezier,connectionLineStyle:Z,connectionLineComponent:X,connectionLineContainerStyle:Y,deleteKeyCode:F="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:K=!1,selectionMode:G=e.SelectionMode.Full,panActivationKeyCode:q="Space",multiSelectionKeyCode:U=(Ho()?"Meta":"Control"),zoomActivationKeyCode:Q=(Ho()?"Meta":"Control"),snapToGrid:J,snapGrid:ee,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:ne,nodesDraggable:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:se=Xi,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:ue=Yi,minZoom:de=.5,maxZoom:he=2,translateExtent:fe=Jn,preventScrolling:ge=!0,nodeExtent:pe,defaultMarkerColor:me="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:ve=!0,panOnScroll:xe=!1,panOnScrollSpeed:we=.5,panOnScrollMode:be=e.PanOnScrollMode.Free,zoomOnDoubleClick:Se=!0,panOnDrag:Ce=!0,onPaneClick:Ee,onPaneMouseEnter:ke,onPaneMouseMove:Me,onPaneMouseLeave:Ne,onPaneScroll:_e,onPaneContextMenu:Pe,paneClickDistance:ze=0,nodeClickDistance:Oe=0,children:Ae,onReconnect:Re,onReconnectStart:Ie,onReconnectEnd:De,onEdgeContextMenu:$e,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:Te,onEdgeMouseLeave:Ve,reconnectRadius:je=10,onNodesChange:He,onEdgesChange:Ze,noDragClassName:Xe="nodrag",noWheelClassName:Ye="nowheel",noPanClassName:Fe="nopan",fitView:We,fitViewOptions:Ke,connectOnClick:Ge,attributionPosition:qe,proOptions:Ue,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,connectionRadius:it,isValidConnection:st,onError:at,style:lt,id:ct,nodeDragThreshold:ut,viewport:dt,onViewportChange:ht,width:ft,height:gt,colorMode:pt="light",debug:mt,onScroll:yt,...vt},xt){const wt=ct||"1",bt=function(e){const[t,o]=n.useState("system"===e?null:e);return n.useEffect((()=>{if("system"!==e)return void o(e);const t=qi(),n=()=>o(t?.matches?"dark":"light");return n(),t?.addEventListener("change",n),()=>{t?.removeEventListener("change",n)}}),[e]),null!==t?t:qi()?.matches?"dark":"light"}(pt),St=n.useCallback((e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),yt?.(e)}),[yt]);return t.jsx("div",{"data-testid":"rf__wrapper",...vt,onScroll:St,style:{...lt,...qa},ref:xt,className:r(["react-flow",l,bt]),id:ct,children:t.jsxs(Ga,{nodes:o,edges:i,width:ft,height:gt,fitView:We,fitViewOptions:Ke,minZoom:de,maxZoom:he,nodeOrigin:se,nodeExtent:pe,children:[t.jsx(Ya,{onInit:f,onNodeClick:d,onEdgeClick:h,onNodeMouseEnter:S,onNodeMouseMove:C,onNodeMouseLeave:E,onNodeContextMenu:k,onNodeDoubleClick:M,nodeTypes:c,edgeTypes:u,connectionLineType:H,connectionLineStyle:Z,connectionLineComponent:X,connectionLineContainerStyle:Y,selectionKeyCode:W,selectionOnDrag:K,selectionMode:G,deleteKeyCode:F,multiSelectionKeyCode:U,panActivationKeyCode:q,zoomActivationKeyCode:Q,onlyRenderVisibleElements:te,defaultViewport:ue,translateExtent:fe,minZoom:de,maxZoom:he,preventScrolling:ge,zoomOnScroll:ye,zoomOnPinch:ve,zoomOnDoubleClick:Se,panOnScroll:xe,panOnScrollSpeed:we,panOnScrollMode:be,panOnDrag:Ce,onPaneClick:Ee,onPaneMouseEnter:ke,onPaneMouseMove:Me,onPaneMouseLeave:Ne,onPaneScroll:_e,onPaneContextMenu:Pe,paneClickDistance:ze,nodeClickDistance:Oe,onSelectionContextMenu:L,onSelectionStart:B,onSelectionEnd:T,onReconnect:Re,onReconnectStart:Ie,onReconnectEnd:De,onEdgeContextMenu:$e,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:Te,onEdgeMouseLeave:Ve,reconnectRadius:je,defaultMarkerColor:me,noDragClassName:Xe,noWheelClassName:Ye,noPanClassName:Fe,rfId:wt,disableKeyboardA11y:tt,nodeExtent:pe,viewport:dt,onViewportChange:ht}),t.jsx(Gi,{nodes:o,edges:i,defaultNodes:s,defaultEdges:a,onConnect:y,onConnectStart:v,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:b,nodesDraggable:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:de,maxZoom:he,nodeExtent:pe,onNodesChange:He,onEdgesChange:Ze,snapToGrid:J,snapGrid:ee,connectionMode:j,translateExtent:fe,connectOnClick:Ge,defaultEdgeOptions:Qe,fitView:We,fitViewOptions:Ke,onNodesDelete:z,onEdgesDelete:O,onDelete:A,onNodeDragStart:N,onNodeDrag:_,onNodeDragStop:P,onSelectionDrag:D,onSelectionDragStart:I,onSelectionDragStop:$,onMove:g,onMoveStart:p,onMoveEnd:m,noPanClassName:Fe,nodeOrigin:se,rfId:wt,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,onError:at,connectionRadius:it,isValidConnection:st,selectNodesOnDrag:ne,nodeDragThreshold:ut,onBeforeDelete:V,paneClickDistance:ze,debug:mt}),t.jsx(Zi,{onSelectionChange:R}),Ae,t.jsx($i,{proOptions:Ue,position:qe}),t.jsx(Ri,{rfId:wt,disableKeyboardA11y:tt})]})})}));const Qa=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");const Ja=e=>e.domNode?.querySelector(".react-flow__viewport-portal");const el=e=>e.nodes;const tl=e=>e.edges;const nl=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2]});const ol=Qn.error014();function rl({dimensions:e,lineWidth:n,variant:o,className:i}){return t.jsx("path",{strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:r(["react-flow__background-pattern",o,i])})}function il({radius:e,className:n}){return t.jsx("circle",{cx:e,cy:e,r:e,className:r(["react-flow__background-pattern","dots",n])})}var sl;e.BackgroundVariant=void 0,(sl=e.BackgroundVariant||(e.BackgroundVariant={})).Lines="lines",sl.Dots="dots",sl.Cross="cross";const al={[e.BackgroundVariant.Dots]:1,[e.BackgroundVariant.Lines]:1,[e.BackgroundVariant.Cross]:6},ll=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function cl({id:o,variant:i=e.BackgroundVariant.Dots,gap:s=20,size:a,lineWidth:l=1,offset:c=0,color:u,bgColor:d,style:h,className:f,patternClassName:g}){const p=n.useRef(null),{transform:m,patternId:y}=Ei(ll,Li),v=a||al[i],x=i===e.BackgroundVariant.Dots,w=i===e.BackgroundVariant.Cross,b=Array.isArray(s)?s:[s,s],S=[b[0]*m[2]||1,b[1]*m[2]||1],C=v*m[2],E=Array.isArray(c)?c:[c,c],k=w?[C,C]:S,M=[E[0]*m[2]||1+k[0]/2,E[1]*m[2]||1+k[1]/2],N=`${y}${o||""}`;return t.jsxs("svg",{className:r(["react-flow__background",f]),style:{...h,...Ss,"--xy-background-color-props":d,"--xy-background-pattern-color-props":u},ref:p,"data-testid":"rf__background",children:[t.jsx("pattern",{id:N,x:m[0]%S[0],y:m[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${M[0]},-${M[1]})`,children:x?t.jsx(il,{radius:C/2,className:g}):t.jsx(rl,{dimensions:k,lineWidth:l,variant:i,className:g})}),t.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}cl.displayName="Background";const ul=n.memo(cl);function dl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:t.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function hl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:t.jsx("path",{d:"M0 0h32v4.2H0z"})})}function fl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:t.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 gl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:t.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 pl(){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:t.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 ml({children:e,className:n,...o}){return t.jsx("button",{type:"button",className:r(["react-flow__controls-button",n]),...o,children:e})}const yl=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom});function vl({style:e,showZoom:n=!0,showFitView:o=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:a,onZoomOut:l,onFitView:c,onInteractiveChange:u,className:d,children:h,position:f="bottom-left",orientation:g="vertical","aria-label":p="React Flow controls"}){const m=ki(),{isInteractive:y,minZoomReached:v,maxZoomReached:x}=Ei(yl,Li),{zoomIn:w,zoomOut:b,fitView:S}=vs(),C="horizontal"===g?"horizontal":"vertical";return t.jsxs(Di,{className:r(["react-flow__controls",C,d]),position:f,style:e,"data-testid":"rf__controls","aria-label":p,children:[n&&t.jsxs(t.Fragment,{children:[t.jsx(ml,{onClick:()=>{w(),a?.()},className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:x,children:t.jsx(dl,{})}),t.jsx(ml,{onClick:()=>{b(),l?.()},className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:v,children:t.jsx(hl,{})})]}),o&&t.jsx(ml,{className:"react-flow__controls-fitview",onClick:()=>{S(s),c?.()},title:"fit view","aria-label":"fit view",children:t.jsx(fl,{})}),i&&t.jsx(ml,{className:"react-flow__controls-interactive",onClick:()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),u?.(!y)},title:"toggle interactivity","aria-label":"toggle interactivity",children:y?t.jsx(pl,{}):t.jsx(gl,{})}),h]})}vl.displayName="Controls";const xl=n.memo(vl);const wl=n.memo((function({id:e,x:n,y:o,width:i,height:s,style:a,color:l,strokeColor:c,strokeWidth:u,className:d,borderRadius:h,shapeRendering:f,selected:g,onClick:p}){const{background:m,backgroundColor:y}=a||{},v=l||m||y;return t.jsx("rect",{className:r(["react-flow__minimap-node",{selected:g},d]),x:n,y:o,rx:h,ry:h,width:i,height:s,style:{fill:v,stroke:c,strokeWidth:u},shapeRendering:f,onClick:p?t=>p(t,e):void 0})})),bl=e=>e.nodes.map((e=>e.id)),Sl=e=>e instanceof Function?e:()=>e;const Cl=n.memo((function({id:e,nodeColorFunc:n,nodeStrokeColorFunc:o,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:h,width:f,height:g}=Ei((t=>{const{internals:n}=t.nodeLookup.get(e),o=n.userNode,{x:r,y:i}=n.positionAbsolute,{width:s,height:a}=Xo(o);return{node:o,x:r,y:i,width:s,height:a}}),Li);return u&&!u.hidden&&Yo(u)?t.jsx(l,{x:d,y:h,width:f,height:g,style:u.style,selected:!!u.selected,className:r(u),color:n(u),borderRadius:i,strokeColor:o(u),strokeWidth:s,shapeRendering:a,onClick:c,id:u.id}):null}));var El=n.memo((function({nodeStrokeColor:e,nodeColor:n,nodeClassName:o="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=wl,onClick:a}){const l=Ei(bl,Li),c=Sl(n),u=Sl(e),d=Sl(o),h="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return t.jsx(t.Fragment,{children:l.map((e=>t.jsx(Cl,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:h},e)))})}));const kl=e=>!e.hidden,Ml=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?Ao(yo(e.nodeLookup,{filter:kl}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height}};function Nl({style:e,className:o,nodeStrokeColor:i,nodeColor:s,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c,nodeComponent:u,bgColor:d,maskColor:h,maskStrokeColor:f,maskStrokeWidth:g,position:p="bottom-right",onClick:m,onNodeClick:y,pannable:v=!1,zoomable:x=!1,ariaLabel:w="React Flow mini map",inversePan:b,zoomStep:S=10,offsetScale:C=5}){const E=ki(),k=n.useRef(null),{boundingRect:M,viewBB:N,rfId:_,panZoom:P,translateExtent:z,flowWidth:O,flowHeight:A}=Ei(Ml,Li),R=e?.width??200,I=e?.height??150,D=M.width/R,$=M.height/I,L=Math.max(D,$),B=L*R,T=L*I,V=C*L,j=M.x-(B-M.width)/2-V,H=M.y-(T-M.height)/2-V,Z=B+2*V,X=T+2*V,Y=`react-flow__minimap-desc-${_}`,F=n.useRef(0),W=n.useRef();F.current=L,n.useEffect((()=>{if(k.current&&P)return W.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=Se(e);return{update:function({translateExtent:e,width:i,height:s,zoomStep:a=10,pannable:l=!0,zoomable:c=!0,inversePan:u=!1}){let d=[0,0];const h=Un().on("start",(e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(d=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])})).on("zoom",l?r=>{const a=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-d[0],l[1]-d[1]];d=l;const h=o()*Math.max(a[2],Math.log(a[2]))*(u?-1:1),f={x:a[0]-c[0]*h,y:a[1]-c[1]*h},g=[[0,0],[i,s]];t.setViewportConstrained({x:f.x,y:f.y,zoom:a[2]},g,e)}:null).on("zoom.wheel",c?e=>{const o=n();if("wheel"!==e.sourceEvent.type||!t)return;const r=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*a,i=o[2]*Math.pow(2,r);t.scaleTo(i)}:null);r.call(h,{})},destroy:function(){r.on("zoom",null)},pointer:Ce}}({domNode:k.current,panZoom:P,getTransform:()=>E.getState().transform,getViewScale:()=>F.current}),()=>{W.current?.destroy()}}),[P]),n.useEffect((()=>{W.current?.update({translateExtent:z,width:O,height:A,inversePan:b,pannable:v,zoomStep:S,zoomable:x})}),[v,x,b,S,z,O,A]);const K=m?e=>{const[t,n]=W.current?.pointer(e)||[0,0];m(e,{x:t,y:n})}:void 0,G=y?n.useCallback(((e,t)=>{const n=E.getState().nodeLookup.get(t).internals.userNode;y(e,n)}),[]):void 0;return t.jsx(Di,{position:p,style:{...e,"--xy-minimap-background-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof h?h:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof g?g*L:void 0,"--xy-minimap-node-background-color-props":"string"==typeof s?s:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof i?i:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof c?c:void 0},className:r(["react-flow__minimap",o]),"data-testid":"rf__minimap",children:t.jsxs("svg",{width:R,height:I,viewBox:`${j} ${H} ${Z} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Y,ref:k,onClick:K,children:[w&&t.jsx("title",{id:Y,children:w}),t.jsx(El,{onClick:G,nodeColor:s,nodeStrokeColor:i,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),t.jsx("path",{className:"react-flow__minimap-mask",d:`M${j-V},${H-V}h${Z+2*V}v${X+2*V}h${-Z-2*V}z\n M${N.x},${N.y}h${N.width}v${N.height}h${-N.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Nl.displayName="MiniMap";const _l=n.memo(Nl);const Pl=n.memo((function({nodeId:o,position:i,variant:s=e.ResizeControlVariant.Handle,className:a,style:l={},children:c,color:u,minWidth:d=10,minHeight:h=10,maxWidth:f=Number.MAX_VALUE,maxHeight:g=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:m,shouldResize:y,onResizeStart:v,onResize:x,onResizeEnd:w}){const b=$s(),S="string"==typeof o?o:b,C=ki(),E=n.useRef(null),k=s===e.ResizeControlVariant.Line?"right":"bottom-right",M=i??k,N=n.useRef(null);n.useEffect((()=>{if(E.current&&S)return N.current||(N.current=si({domNode:E.current,nodeId:S,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=C.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=C.getState(),s=[],a={x:e.x,y:e.y},l=o.get(S);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,u=Nr([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...Fo({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);s.push(...u),a.x=e.x?Math.max(t[0]*n,e.x):void 0,a.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==a.x&&void 0!==a.y){const e={id:S,type:"position",position:{...a}};s.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:S,type:"dimensions",resizing:!0,setAttributes:!m||("horizontal"===m?"width":"height"),dimensions:{width:e.width,height:e.height}};s.push(t)}for(const e of t){const t={...e,type:"position"};s.push(t)}n(s)},onEnd:({width:e,height:t})=>{const n={id:S,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};C.getState().triggerNodeChanges([n])}})),N.current.update({controlPosition:M,boundaries:{minWidth:d,minHeight:h,maxWidth:f,maxHeight:g},keepAspectRatio:p,resizeDirection:m,onResizeStart:v,onResize:x,onResizeEnd:w,shouldResize:y}),()=>{N.current?.destroy()}}),[M,d,h,f,g,p,v,x,w,y]);const _=M.split("-"),P=s===e.ResizeControlVariant.Line?"borderColor":"backgroundColor",z=u?{...l,[P]:u}:l;return t.jsx("div",{className:r(["react-flow__resize-control","nodrag",..._,s,a]),ref:E,style:z,children:c})}));const zl=e=>e.domNode?.querySelector(".react-flow__renderer");function Ol({children:e}){const t=Ei(zl);return t?o.createPortal(e,t):null}const Al=(e,t)=>e?.internals.positionAbsolute.x!==t?.internals.positionAbsolute.x||e?.internals.positionAbsolute.y!==t?.internals.positionAbsolute.y||e?.measured.width!==t?.measured.width||e?.measured.height!==t?.measured.height||e?.selected!==t?.selected||e?.internals.z!==t?.internals.z,Rl=(e,t)=>{if(e.size!==t.size)return!1;for(const[n,o]of e)if(Al(o,t.get(n)))return!1;return!0},Il=e=>({x:e.transform[0],y:e.transform[1],zoom:e.transform[2],selectedNodesCount:e.nodes.filter((e=>e.selected)).length});e.Background=ul,e.BaseEdge=ia,e.BezierEdge=ba,e.ControlButton=ml,e.Controls=xl,e.EdgeLabelRenderer=function({children:e}){const t=Ei(Qa);return t?o.createPortal(e,t):null},e.EdgeText=ra,e.Handle=Bs,e.MiniMap=_l,e.NodeResizeControl=Pl,e.NodeResizer=function({nodeId:n,isVisible:o=!0,handleClassName:r,handleStyle:i,lineClassName:s,lineStyle:a,color:l,minWidth:c=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:f=!1,shouldResize:g,onResizeStart:p,onResize:m,onResizeEnd:y}){return o?t.jsxs(t.Fragment,{children:[Qr.map((o=>t.jsx(Pl,{className:s,style:a,nodeId:n,position:o,variant:e.ResizeControlVariant.Line,color:l,minWidth:c,minHeight:u,maxWidth:d,maxHeight:h,onResizeStart:p,keepAspectRatio:f,shouldResize:g,onResize:m,onResizeEnd:y},o))),Ur.map((e=>t.jsx(Pl,{className:r,style:i,nodeId:n,position:e,color:l,minWidth:c,minHeight:u,maxWidth:d,maxHeight:h,onResizeStart:p,keepAspectRatio:f,shouldResize:g,onResize:m,onResizeEnd:y},e)))]}):null},e.NodeToolbar=function({nodeId:o,children:i,className:s,style:a,isVisible:l,position:c=e.Position.Top,offset:u=10,align:d="center",...h}){const f=$s(),g=n.useCallback((e=>{const t=(Array.isArray(o)?o:[o||f||""]).reduce(((t,n)=>{const o=e.nodeLookup.get(n);return o&&t.set(o.id,o),t}),new Map);return t}),[o,f]),p=Ei(g,Rl),{x:m,y:y,zoom:v,selectedNodesCount:x}=Ei(Il,Li);if(!("boolean"==typeof l?l:1===p.size&&p.values().next().value?.selected&&1===x)||!p.size)return null;const w=yo(p),b=Array.from(p.values()),S=Math.max(...b.map((e=>e.internals.z+1))),C={position:"absolute",transform:wr(w,{x:m,y:y,zoom:v},c,u,d),zIndex:S,...a};return t.jsx(Ol,{children:t.jsx("div",{style:C,className:r(["react-flow__node-toolbar",s]),...h,"data-id":b.reduce(((e,t)=>`${e}${t.id} `),"").trim(),children:i})})},e.Panel=Di,e.ReactFlow=Ua,e.ReactFlowProvider=Ka,e.SimpleBezierEdge=ca,e.SmoothStepEdge=ha,e.StepEdge=pa,e.StraightEdge=va,e.ViewportPortal=function({children:e}){const t=Ei(Ja);return t?o.createPortal(e,t):null},e.addEdge=cr,e.applyEdgeChanges=is,e.applyNodeChanges=rs,e.getBezierEdgeCenter=nr,e.getBezierPath=ir,e.getConnectedEdges=xo,e.getEdgeCenter=sr,e.getIncomers=(e,t,n)=>{if(!e.id)return[];const o=new Set;return n.forEach((t=>{t.target===e.id&&o.add(t.source)})),t.filter((e=>o.has(e.id)))},e.getNodesBounds=mo,e.getOutgoers=(e,t,n)=>{if(!e.id)return[];const o=new Set;return n.forEach((t=>{t.source===e.id&&o.add(t.target)})),t.filter((e=>o.has(e.id)))},e.getSimpleBezierPath=aa,e.getSmoothStepPath=gr,e.getStraightPath=ur,e.getViewportForBounds=jo,e.isEdge=ds,e.isNode=us,e.reconnectEdge=(e,t,n,o={shouldReplaceId:!0})=>{const{id:r,...i}=e;if(!t.source||!t.target)return n;if(!n.find((t=>t.id===e.id)))return n;const s={...i,id:o.shouldReplaceId?lr(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter((e=>e.id!==r)).concat(s)},e.useConnection=Ba,e.useEdges=function(){return Ei(tl,Li)},e.useEdgesState=function(e){const[t,o]=n.useState(e),r=n.useCallback((e=>o((t=>is(e,t)))),[]);return[t,o,r]},e.useHandleConnections=function({type:e,id:t,nodeId:o,onConnect:r,onDisconnect:i}){console.warn("[DEPRECATED] `useHandleConnections` is deprecated. Instead use `useNodeConnections` https://reactflow.dev/api-reference/hooks/useNodeConnections");const s=$s(),a=o??s,l=n.useRef(null),c=Ei((n=>n.connectionLookup.get(`${a}-${e}${t?`-${t}`:""}`)),co);return n.useEffect((()=>{if(l.current&&l.current!==c){const e=c??new Map;uo(l.current,e,i),uo(e,l.current,r)}l.current=c??new Map}),[c,r,i]),n.useMemo((()=>Array.from(c?.values()??[])),[c])},e.useInternalNode=function(e){return Ei(n.useCallback((t=>t.nodeLookup.get(e)),[e]),Li)},e.useKeyPress=Qi,e.useNodeConnections=function({id:e,handleType:t,handleId:o,onConnect:r,onDisconnect:i}={}){const s=$s(),a=e??s;if(!a)throw new Error(ol);const l=n.useRef(null),c=Ei((e=>e.connectionLookup.get(`${a}${t?o?`-${t}-${o}`:`-${t}`:""}`)),co);return n.useEffect((()=>{if(l.current&&l.current!==c){const e=c??new Map;uo(l.current,e,i),uo(e,l.current,r)}l.current=c??new Map}),[c,r,i]),n.useMemo((()=>Array.from(c?.values()??[])),[c])},e.useNodeId=$s,e.useNodes=function(){return Ei(el,Li)},e.useNodesData=function(e){return Ei(n.useCallback((t=>{const n=[],o=Array.isArray(e),r=o?e:[e];for(const e of r){const o=t.nodeLookup.get(e);o&&n.push({id:o.id,type:o.type,data:o.data})}return o?n:n[0]??null}),[e]),zr)},e.useNodesInitialized=function(e={includeHiddenNodes:!1}){return Ei((e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(0===t.nodeLookup.size)return!1;for(const[,{internals:e}]of t.nodeLookup)if(void 0===e.handleBounds||!Yo(e.userNode))return!1;return!0})(e))},e.useNodesState=function(e){const[t,o]=n.useState(e),r=n.useCallback((e=>o((t=>rs(e,t)))),[]);return[t,o,r]},e.useOnSelectionChange=function({onChange:e}){const t=ki();n.useEffect((()=>{const n=[...t.getState().onSelectionChangeHandlers,e];return t.setState({onSelectionChangeHandlers:n}),()=>{const n=t.getState().onSelectionChangeHandlers.filter((t=>t!==e));t.setState({onSelectionChangeHandlers:n})}}),[e])},e.useOnViewportChange=function({onStart:e,onChange:t,onEnd:o}){const r=ki();n.useEffect((()=>{r.setState({onViewportChangeStart:e})}),[e]),n.useEffect((()=>{r.setState({onViewportChange:t})}),[t]),n.useEffect((()=>{r.setState({onViewportChangeEnd:o})}),[o])},e.useReactFlow=vs,e.useStore=Ei,e.useStoreApi=ki,e.useUpdateNodeInternals=function(){const e=ki();return n.useCallback((t=>{const{domNode:n,updateNodeInternals:o}=e.getState(),r=Array.isArray(t)?t:[t],i=new Map;r.forEach((e=>{const t=n?.querySelector(`.react-flow__node[data-id="${e}"]`);t&&i.set(e,{id:e,nodeElement:t,force:!0})})),requestAnimationFrame((()=>o(i,{triggerFitView:!1})))}),[])},e.useViewport=function(){return Ei(nl,Li)}}));
|