app-v3-scripts-editor 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ (function(Se,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],I):(Se=typeof globalThis<"u"?globalThis:Se||self,I(Se["app-v3-scripts-editor"]={},Se["react/jsx-runtime"],Se.React))})(this,function(Se,I,P){"use strict";function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var ls={value:()=>{}};function wt(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new xt(n)}function xt(e){this._=e}function us(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}xt.prototype=wt.prototype={constructor:xt,on:function(e,t){var n=this._,o=us(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=fs(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=io(n[r],e.name,t);else if(t==null)for(r in n)n[r]=io(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new xt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function fs(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function io(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ls,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var dn="http://www.w3.org/1999/xhtml";const so={svg:"http://www.w3.org/2000/svg",xhtml:dn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),so.hasOwnProperty(t)?{space:so[t],local:e}:e}function ds(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===dn&&t.documentElement.namespaceURI===dn?t.createElement(e):t.createElementNS(n,e)}}function hs(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ao(e){var t=vt(e);return(t.local?hs:ds)(t)}function gs(){}function hn(e){return e==null?gs:function(){return this.querySelector(e)}}function ps(e){typeof e!="function"&&(e=hn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,f,u=0;u<s;++u)(c=i[u])&&(f=e.call(c,c.__data__,u,i))&&("__data__"in c&&(f.__data__=c.__data__),a[u]=f);return new ae(o,this._parents)}function ys(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ms(){return[]}function co(e){return e==null?ms:function(){return this.querySelectorAll(e)}}function ws(e){return function(){return ys(e.apply(this,arguments))}}function xs(e){typeof e=="function"?e=ws(e):e=co(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,f=0;f<a;++f)(c=s[f])&&(o.push(e.call(c,c.__data__,f,s)),r.push(c));return new ae(o,r)}function lo(e){return function(){return this.matches(e)}}function uo(e){return function(t){return t.matches(e)}}var vs=Array.prototype.find;function bs(e){return function(){return vs.call(this.children,e)}}function _s(){return this.firstElementChild}function Ss(e){return this.select(e==null?_s:bs(typeof e=="function"?e:uo(e)))}var Es=Array.prototype.filter;function Cs(){return Array.from(this.children)}function Ns(e){return function(){return Es.call(this.children,e)}}function Ms(e){return this.selectAll(e==null?Cs:Ns(typeof e=="function"?e:uo(e)))}function ks(e){typeof e!="function"&&(e=lo(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,f=0;f<s;++f)(c=i[f])&&e.call(c,c.__data__,f,i)&&a.push(c);return new ae(o,this._parents)}function fo(e){return new Array(e.length)}function As(){return new ae(this._enter||this._groups.map(fo),this._parents)}function bt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}bt.prototype={constructor:bt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Is(e){return function(){return e}}function Ps(e,t,n,o,r,i){for(var s=0,a,c=t.length,f=i.length;s<f;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new bt(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function Ts(e,t,n,o,r,i,s){var a,c,f=new Map,u=t.length,d=i.length,l=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(l[a]=h=s.call(c,c.__data__,a,t)+"",f.has(h)?r[a]=c:f.set(h,c));for(a=0;a<d;++a)h=s.call(e,i[a],a,i)+"",(c=f.get(h))?(o[a]=c,c.__data__=i[a],f.delete(h)):n[a]=new bt(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&f.get(l[a])===c&&(r[a]=c)}function Ds(e){return e.__data__}function Ls(e,t){if(!arguments.length)return Array.from(this,Ds);var n=t?Ts:Ps,o=this._parents,r=this._groups;typeof e!="function"&&(e=Is(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),f=0;f<i;++f){var u=o[f],d=r[f],l=d.length,h=Os(e.call(u,u&&u.__data__,f,o)),y=h.length,p=a[f]=new Array(y),w=s[f]=new Array(y),m=c[f]=new Array(l);n(u,d,p,w,m,h,t);for(var _=0,g=0,x,b;_<y;++_)if(x=p[_]){for(_>=g&&(g=_+1);!(b=w[g])&&++g<y;);x._next=b||null}}return s=new ae(s,o),s._enter=a,s._exit=c,s}function Os(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Hs(){return new ae(this._exit||this._groups.map(fo),this._parents)}function zs(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Bs(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),c=0;c<s;++c)for(var f=n[c],u=o[c],d=f.length,l=a[c]=new Array(d),h,y=0;y<d;++y)(h=f[y]||u[y])&&(l[y]=h);for(;c<r;++c)a[c]=n[c];return new ae(a,this._parents)}function Vs(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Fs(e){e||(e=Ys);function t(d,l){return d&&l?e(d.__data__,l.__data__):!d-!l}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),f,u=0;u<a;++u)(f=s[u])&&(c[u]=f);c.sort(t)}return new ae(r,this._parents).order()}function Ys(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Xs(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ws(){return Array.from(this)}function Rs(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Gs(){let e=0;for(const t of this)++e;return e}function Ks(){return!this.node()}function Us(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Zs(e){return function(){this.removeAttribute(e)}}function $s(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qs(e,t){return function(){this.setAttribute(e,t)}}function Js(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function js(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function qs(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ea(e,t){var n=vt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?$s:Zs:typeof t=="function"?n.local?qs:js:n.local?Js:Qs)(n,t))}function ho(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ta(e){return function(){this.style.removeProperty(e)}}function na(e,t,n){return function(){this.style.setProperty(e,t,n)}}function oa(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function ra(e,t,n){return arguments.length>1?this.each((t==null?ta:typeof t=="function"?oa:na)(e,t,n??"")):Oe(this.node(),e)}function Oe(e,t){return e.style.getPropertyValue(t)||ho(e).getComputedStyle(e,null).getPropertyValue(t)}function ia(e){return function(){delete this[e]}}function sa(e,t){return function(){this[e]=t}}function aa(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ca(e,t){return arguments.length>1?this.each((t==null?ia:typeof t=="function"?aa:sa)(e,t)):this.node()[e]}function go(e){return e.trim().split(/^|\s+/)}function gn(e){return e.classList||new po(e)}function po(e){this._node=e,this._names=go(e.getAttribute("class")||"")}po.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function yo(e,t){for(var n=gn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function mo(e,t){for(var n=gn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function la(e){return function(){yo(this,e)}}function ua(e){return function(){mo(this,e)}}function fa(e,t){return function(){(t.apply(this,arguments)?yo:mo)(this,e)}}function da(e,t){var n=go(e+"");if(arguments.length<2){for(var o=gn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?fa:t?la:ua)(n,t))}function ha(){this.textContent=""}function ga(e){return function(){this.textContent=e}}function pa(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function ya(e){return arguments.length?this.each(e==null?ha:(typeof e=="function"?pa:ga)(e)):this.node().textContent}function ma(){this.innerHTML=""}function wa(e){return function(){this.innerHTML=e}}function xa(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function va(e){return arguments.length?this.each(e==null?ma:(typeof e=="function"?xa:wa)(e)):this.node().innerHTML}function ba(){this.nextSibling&&this.parentNode.appendChild(this)}function _a(){return this.each(ba)}function Sa(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ea(){return this.each(Sa)}function Ca(e){var t=typeof e=="function"?e:ao(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Na(){return null}function Ma(e,t){var n=typeof e=="function"?e:ao(e),o=t==null?Na:typeof t=="function"?t:hn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ka(){var e=this.parentNode;e&&e.removeChild(this)}function Aa(){return this.each(ka)}function Ia(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Pa(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ta(e){return this.select(e?Pa:Ia)}function Da(e){return arguments.length?this.property("__data__",e):this.node().__data__}function La(e){return function(t){e.call(this,t,this.__data__)}}function Oa(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Ha(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function za(e,t,n){return function(){var o=this.__on,r,i=La(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Ba(e,t,n){var o=Oa(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,f=a.length,u;c<f;++c)for(r=0,u=a[c];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?za:Ha,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function wo(e,t,n){var o=ho(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Va(e,t){return function(){return wo(this,e,t)}}function Fa(e,t){return function(){return wo(this,e,t.apply(this,arguments))}}function Ya(e,t){return this.each((typeof t=="function"?Fa:Va)(e,t))}function*Xa(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var xo=[null];function ae(e,t){this._groups=e,this._parents=t}function $e(){return new ae([[document.documentElement]],xo)}function Wa(){return this}ae.prototype=$e.prototype={constructor:ae,select:ps,selectAll:xs,selectChild:Ss,selectChildren:Ms,filter:ks,data:Ls,enter:As,exit:Hs,join:zs,merge:Bs,selection:Wa,order:Vs,sort:Fs,call:Xs,nodes:Ws,node:Rs,size:Gs,empty:Ks,each:Us,attr:ea,style:ra,property:ca,classed:da,text:ya,html:va,raise:_a,lower:Ea,append:Ca,insert:Ma,remove:Aa,clone:Ta,datum:Da,on:Ba,dispatch:Ya,[Symbol.iterator]:Xa};function ce(e){return typeof e=="string"?new ae([[document.querySelector(e)]],[document.documentElement]):new ae([[e]],xo)}function Ra(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ue(e,t){if(e=Ra(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ga={passive:!1},Qe={capture:!0,passive:!1};function pn(e){e.stopImmediatePropagation()}function He(e){e.preventDefault(),e.stopImmediatePropagation()}function vo(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",He,Qe);"onselectstart"in t?n.on("selectstart.drag",He,Qe):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function bo(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",He,Qe),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const _t=e=>()=>e;function yn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:f,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:c,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:u}})}yn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ka(e){return!e.ctrlKey&&!e.button}function Ua(){return this.parentNode}function Za(e,t){return t??{x:e.x,y:e.y}}function $a(){return navigator.maxTouchPoints||"ontouchstart"in this}function _o(){var e=Ka,t=Ua,n=Za,o=$a,r={},i=wt("start","drag","end"),s=0,a,c,f,u,d=0;function l(x){x.on("mousedown.drag",h).filter(o).on("touchstart.drag",w).on("touchmove.drag",m,Ga).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,b){if(!(u||!e.call(this,x,b))){var E=g(this,t.call(this,x,b),x,b,"mouse");E&&(ce(x.view).on("mousemove.drag",y,Qe).on("mouseup.drag",p,Qe),vo(x.view),pn(x),f=!1,a=x.clientX,c=x.clientY,E("start",x))}}function y(x){if(He(x),!f){var b=x.clientX-a,E=x.clientY-c;f=b*b+E*E>d}r.mouse("drag",x)}function p(x){ce(x.view).on("mousemove.drag mouseup.drag",null),bo(x.view,f),He(x),r.mouse("end",x)}function w(x,b){if(e.call(this,x,b)){var E=x.changedTouches,C=t.call(this,x,b),A=E.length,O,V;for(O=0;O<A;++O)(V=g(this,C,x,b,E[O].identifier,E[O]))&&(pn(x),V("start",x,E[O]))}}function m(x){var b=x.changedTouches,E=b.length,C,A;for(C=0;C<E;++C)(A=r[b[C].identifier])&&(He(x),A("drag",x,b[C]))}function _(x){var b=x.changedTouches,E=b.length,C,A;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<E;++C)(A=r[b[C].identifier])&&(pn(x),A("end",x,b[C]))}function g(x,b,E,C,A,O){var V=i.copy(),T=ue(O||E,b),z,H,v;if((v=n.call(x,new yn("beforestart",{sourceEvent:E,target:l,identifier:A,active:s,x:T[0],y:T[1],dx:0,dy:0,dispatch:V}),C))!=null)return z=v.x-T[0]||0,H=v.y-T[1]||0,function M(S,N,D){var k=T,L;switch(S){case"start":r[A]=M,L=s++;break;case"end":delete r[A],--s;case"drag":T=ue(D||N,b),L=s;break}V.call(S,x,new yn(S,{sourceEvent:N,subject:v,target:l,identifier:A,active:L,x:T[0]+z,y:T[1]+H,dx:T[0]-k[0],dy:T[1]-k[1],dispatch:V}),C)}}return l.filter=function(x){return arguments.length?(e=typeof x=="function"?x:_t(!!x),l):e},l.container=function(x){return arguments.length?(t=typeof x=="function"?x:_t(x),l):t},l.subject=function(x){return arguments.length?(n=typeof x=="function"?x:_t(x),l):n},l.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:_t(!!x),l):o},l.on=function(){var x=i.on.apply(i,arguments);return x===i?l:x},l.clickDistance=function(x){return arguments.length?(d=(x=+x)*x,l):Math.sqrt(d)},l}function mn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function So(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Je(){}var je=.7,St=1/je,ze="\\s*([+-]?\\d+)\\s*",qe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qa=/^#([0-9a-f]{3,8})$/,Ja=new RegExp(`^rgb\\(${ze},${ze},${ze}\\)$`),ja=new RegExp(`^rgb\\(${ge},${ge},${ge}\\)$`),qa=new RegExp(`^rgba\\(${ze},${ze},${ze},${qe}\\)$`),ec=new RegExp(`^rgba\\(${ge},${ge},${ge},${qe}\\)$`),tc=new RegExp(`^hsl\\(${qe},${ge},${ge}\\)$`),nc=new RegExp(`^hsla\\(${qe},${ge},${ge},${qe}\\)$`),Eo={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};mn(Je,ke,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Co,formatHex:Co,formatHex8:oc,formatHsl:rc,formatRgb:No,toString:No});function Co(){return this.rgb().formatHex()}function oc(){return this.rgb().formatHex8()}function rc(){return Po(this).formatHsl()}function No(){return this.rgb().formatRgb()}function ke(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Qa.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Mo(t):n===3?new se(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Et(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Et(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ja.exec(e))?new se(t[1],t[2],t[3],1):(t=ja.exec(e))?new se(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=qa.exec(e))?Et(t[1],t[2],t[3],t[4]):(t=ec.exec(e))?Et(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=tc.exec(e))?Io(t[1],t[2]/100,t[3]/100,1):(t=nc.exec(e))?Io(t[1],t[2]/100,t[3]/100,t[4]):Eo.hasOwnProperty(e)?Mo(Eo[e]):e==="transparent"?new se(NaN,NaN,NaN,0):null}function Mo(e){return new se(e>>16&255,e>>8&255,e&255,1)}function Et(e,t,n,o){return o<=0&&(e=t=n=NaN),new se(e,t,n,o)}function ic(e){return e instanceof Je||(e=ke(e)),e?(e=e.rgb(),new se(e.r,e.g,e.b,e.opacity)):new se}function wn(e,t,n,o){return arguments.length===1?ic(e):new se(e,t,n,o??1)}function se(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}mn(se,wn,So(Je,{brighter(e){return e=e==null?St:Math.pow(St,e),new se(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?je:Math.pow(je,e),new se(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new se(Ae(this.r),Ae(this.g),Ae(this.b),Ct(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:ko,formatHex:ko,formatHex8:sc,formatRgb:Ao,toString:Ao}));function ko(){return`#${Ie(this.r)}${Ie(this.g)}${Ie(this.b)}`}function sc(){return`#${Ie(this.r)}${Ie(this.g)}${Ie(this.b)}${Ie((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ao(){const e=Ct(this.opacity);return`${e===1?"rgb(":"rgba("}${Ae(this.r)}, ${Ae(this.g)}, ${Ae(this.b)}${e===1?")":`, ${e})`}`}function Ct(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ae(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ie(e){return e=Ae(e),(e<16?"0":"")+e.toString(16)}function Io(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fe(e,t,n,o)}function Po(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof Je||(e=ke(e)),!e)return new fe;if(e instanceof fe)return e;e=e.rgb();var t=e.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,c=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+r:2-i-r,s*=60):a=c>0&&c<1?0:s,new fe(s,a,c,e.opacity)}function ac(e,t,n,o){return arguments.length===1?Po(e):new fe(e,t,n,o??1)}function fe(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}mn(fe,ac,So(Je,{brighter(e){return e=e==null?St:Math.pow(St,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?je:Math.pow(je,e),new fe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new se(xn(e>=240?e-240:e+120,r,o),xn(e,r,o),xn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new fe(To(this.h),Nt(this.s),Nt(this.l),Ct(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=Ct(this.opacity);return`${e===1?"hsl(":"hsla("}${To(this.h)}, ${Nt(this.s)*100}%, ${Nt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function To(e){return e=(e||0)%360,e<0?e+360:e}function Nt(e){return Math.max(0,Math.min(1,e||0))}function xn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const vn=e=>()=>e;function cc(e,t){return function(n){return e+n*t}}function lc(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)}}function uc(e){return(e=+e)==1?Do:function(t,n){return n-t?lc(t,n,e):vn(isNaN(t)?n:t)}}function Do(e,t){var n=t-e;return n?cc(e,n):vn(isNaN(e)?t:e)}const Mt=function e(t){var n=uc(t);function o(r,i){var s=n((r=wn(r)).r,(i=wn(i)).r),a=n(r.g,i.g),c=n(r.b,i.b),f=Do(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=c(u),r.opacity=f(u),r+""}}return o.gamma=e,o}(1);function fc(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function dc(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function hc(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=et(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function gc(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function pe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function pc(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=et(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var bn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_n=new RegExp(bn.source,"g");function yc(e){return function(){return e}}function mc(e){return function(t){return e(t)+""}}function Lo(e,t){var n=bn.lastIndex=_n.lastIndex=0,o,r,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(o=bn.exec(e))&&(r=_n.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,c.push({i:s,x:pe(o,r)})),n=_n.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?mc(c[0].x):yc(t):(t=c.length,function(f){for(var u=0,d;u<t;++u)a[(d=c[u]).i]=d.x(f);return a.join("")})}function et(e,t){var n=typeof t,o;return t==null||n==="boolean"?vn(t):(n==="number"?pe:n==="string"?(o=ke(t))?(t=o,Mt):Lo:t instanceof ke?Mt:t instanceof Date?gc:dc(t)?fc:Array.isArray(t)?hc:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?pc:pe)(e,t)}var Oo=180/Math.PI,Sn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ho(e,t,n,o,r,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Oo,skewX:Math.atan(c)*Oo,scaleX:s,scaleY:a}}var kt;function wc(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Sn:Ho(t.a,t.b,t.c,t.d,t.e,t.f)}function xc(e){return e==null||(kt||(kt=document.createElementNS("http://www.w3.org/2000/svg","g")),kt.setAttribute("transform",e),!(e=kt.transform.baseVal.consolidate()))?Sn:(e=e.matrix,Ho(e.a,e.b,e.c,e.d,e.e,e.f))}function zo(e,t,n,o){function r(f){return f.length?f.pop()+" ":""}function i(f,u,d,l,h,y){if(f!==d||u!==l){var p=h.push("translate(",null,t,null,n);y.push({i:p-4,x:pe(f,d)},{i:p-2,x:pe(u,l)})}else(d||l)&&h.push("translate("+d+t+l+n)}function s(f,u,d,l){f!==u?(f-u>180?u+=360:u-f>180&&(f+=360),l.push({i:d.push(r(d)+"rotate(",null,o)-2,x:pe(f,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(f,u,d,l){f!==u?l.push({i:d.push(r(d)+"skewX(",null,o)-2,x:pe(f,u)}):u&&d.push(r(d)+"skewX("+u+o)}function c(f,u,d,l,h,y){if(f!==d||u!==l){var p=h.push(r(h)+"scale(",null,",",null,")");y.push({i:p-4,x:pe(f,d)},{i:p-2,x:pe(u,l)})}else(d!==1||l!==1)&&h.push(r(h)+"scale("+d+","+l+")")}return function(f,u){var d=[],l=[];return f=e(f),u=e(u),i(f.translateX,f.translateY,u.translateX,u.translateY,d,l),s(f.rotate,u.rotate,d,l),a(f.skewX,u.skewX,d,l),c(f.scaleX,f.scaleY,u.scaleX,u.scaleY,d,l),f=u=null,function(h){for(var y=-1,p=l.length,w;++y<p;)d[(w=l[y]).i]=w.x(h);return d.join("")}}}var vc=zo(wc,"px, ","px)","deg)"),bc=zo(xc,", ",")",")"),_c=1e-12;function Bo(e){return((e=Math.exp(e))+1/e)/2}function Sc(e){return((e=Math.exp(e))-1/e)/2}function Ec(e){return((e=Math.exp(2*e))-1)/(e+1)}const At=function e(t,n,o){function r(i,s){var a=i[0],c=i[1],f=i[2],u=s[0],d=s[1],l=s[2],h=u-a,y=d-c,p=h*h+y*y,w,m;if(p<_c)m=Math.log(l/f)/t,w=function(C){return[a+C*h,c+C*y,f*Math.exp(t*C*m)]};else{var _=Math.sqrt(p),g=(l*l-f*f+o*p)/(2*f*n*_),x=(l*l-f*f-o*p)/(2*l*n*_),b=Math.log(Math.sqrt(g*g+1)-g),E=Math.log(Math.sqrt(x*x+1)-x);m=(E-b)/t,w=function(C){var A=C*m,O=Bo(b),V=f/(n*_)*(O*Ec(t*A+b)-Sc(b));return[a+V*h,c+V*y,f*O/Bo(t*A+b)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},r}(Math.SQRT2,2,4);var Be=0,tt=0,nt=0,Vo=1e3,It,ot,Pt=0,Pe=0,Tt=0,rt=typeof performance=="object"&&performance.now?performance:Date,Fo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function En(){return Pe||(Fo(Cc),Pe=rt.now()+Tt)}function Cc(){Pe=0}function Dt(){this._call=this._time=this._next=null}Dt.prototype=Yo.prototype={constructor:Dt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?En():+n)+(t==null?0:+t),!this._next&&ot!==this&&(ot?ot._next=this:It=this,ot=this),this._call=e,this._time=n,Cn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cn())}};function Yo(e,t,n){var o=new Dt;return o.restart(e,t,n),o}function Nc(){En(),++Be;for(var e=It,t;e;)(t=Pe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Be}function Xo(){Pe=(Pt=rt.now())+Tt,Be=tt=0;try{Nc()}finally{Be=0,kc(),Pe=0}}function Mc(){var e=rt.now(),t=e-Pt;t>Vo&&(Tt-=t,Pt=e)}function kc(){for(var e,t=It,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:It=n);ot=e,Cn(o)}function Cn(e){if(!Be){tt&&(tt=clearTimeout(tt));var t=e-Pe;t>24?(e<1/0&&(tt=setTimeout(Xo,e-rt.now()-Tt)),nt&&(nt=clearInterval(nt))):(nt||(Pt=rt.now(),nt=setInterval(Mc,Vo)),Be=1,Fo(Xo))}}function Wo(e,t,n){var o=new Dt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Ac=wt("start","end","cancel","interrupt"),Ic=[],Ro=0,Go=1,Nn=2,Lt=3,Ko=4,Mn=5,Ot=6;function Ht(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Pc(e,n,{name:t,index:o,group:r,on:Ac,tween:Ic,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Ro})}function kn(e,t){var n=de(e,t);if(n.state>Ro)throw new Error("too late; already scheduled");return n}function ye(e,t){var n=de(e,t);if(n.state>Lt)throw new Error("too late; already running");return n}function de(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Pc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Yo(i,0,n.time);function i(f){n.state=Go,n.timer.restart(s,n.delay,n.time),n.delay<=f&&s(f-n.delay)}function s(f){var u,d,l,h;if(n.state!==Go)return c();for(u in o)if(h=o[u],h.name===n.name){if(h.state===Lt)return Wo(s);h.state===Ko?(h.state=Ot,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=Ot,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(Wo(function(){n.state===Lt&&(n.state=Ko,n.timer.restart(a,n.delay,n.time),a(f))}),n.state=Nn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Nn){for(n.state=Lt,r=new Array(l=n.tween.length),u=0,d=-1;u<l;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function a(f){for(var u=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(c),n.state=Mn,1),d=-1,l=r.length;++d<l;)r[d].call(e,u);n.state===Mn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Ot,n.timer.stop(),delete o[t];for(var f in o)return;delete e.__transition}}function zt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Nn&&o.state<Mn,o.state=Ot,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Tc(e){return this.each(function(){zt(this,e)})}function Dc(e,t){var n,o;return function(){var r=ye(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Lc(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=ye(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,f=r.length;c<f;++c)if(r[c].name===t){r[c]=a;break}c===f&&r.push(a)}i.tween=r}}function Oc(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=de(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Dc:Lc)(n,e,t))}function An(e,t,n){var o=e._id;return e.each(function(){var r=ye(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return de(r,o).value[t]}}function Uo(e,t){var n;return(typeof t=="number"?pe:t instanceof ke?Mt:(n=ke(t))?(t=n,Mt):Lo)(e,t)}function Hc(e){return function(){this.removeAttribute(e)}}function zc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Bc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Vc(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Fc(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Yc(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Xc(e,t){var n=vt(e),o=n==="transform"?bc:Uo;return this.attrTween(e,typeof t=="function"?(n.local?Yc:Fc)(n,o,An(this,"attr."+e,t)):t==null?(n.local?zc:Hc)(n):(n.local?Vc:Bc)(n,o,t))}function Wc(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Rc(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Gc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Rc(e,i)),n}return r._value=t,r}function Kc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Wc(e,i)),n}return r._value=t,r}function Uc(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=vt(e);return this.tween(n,(o.local?Gc:Kc)(o,t))}function Zc(e,t){return function(){kn(this,e).delay=+t.apply(this,arguments)}}function $c(e,t){return t=+t,function(){kn(this,e).delay=t}}function Qc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Zc:$c)(t,e)):de(this.node(),t).delay}function Jc(e,t){return function(){ye(this,e).duration=+t.apply(this,arguments)}}function jc(e,t){return t=+t,function(){ye(this,e).duration=t}}function qc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Jc:jc)(t,e)):de(this.node(),t).duration}function el(e,t){if(typeof t!="function")throw new Error;return function(){ye(this,e).ease=t}}function tl(e){var t=this._id;return arguments.length?this.each(el(t,e)):de(this.node(),t).ease}function nl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ye(this,e).ease=n}}function ol(e){if(typeof e!="function")throw new Error;return this.each(nl(this._id,e))}function rl(e){typeof e!="function"&&(e=lo(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,f=0;f<s;++f)(c=i[f])&&e.call(c,c.__data__,f,i)&&a.push(c);return new we(o,this._parents,this._name,this._id)}function il(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 c=t[a],f=n[a],u=c.length,d=s[a]=new Array(u),l,h=0;h<u;++h)(l=c[h]||f[h])&&(d[h]=l);for(;a<o;++a)s[a]=t[a];return new we(s,this._parents,this._name,this._id)}function sl(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function al(e,t,n){var o,r,i=sl(t)?kn:ye;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function cl(e,t){var n=this._id;return arguments.length<2?de(this.node(),n).on.on(e):this.each(al(n,e,t))}function ll(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function ul(){return this.on("end.remove",ll(this._id))}function fl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=hn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,f=i[s]=new Array(c),u,d,l=0;l<c;++l)(u=a[l])&&(d=e.call(u,u.__data__,l,a))&&("__data__"in u&&(d.__data__=u.__data__),f[l]=d,Ht(f[l],t,n,l,f,de(u,n)));return new we(i,this._parents,t,n)}function dl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=co(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],f=c.length,u,d=0;d<f;++d)if(u=c[d]){for(var l=e.call(u,u.__data__,d,c),h,y=de(u,n),p=0,w=l.length;p<w;++p)(h=l[p])&&Ht(h,t,n,p,l,y);i.push(l),s.push(u)}return new we(i,s,t,n)}var hl=$e.prototype.constructor;function gl(){return new hl(this._groups,this._parents)}function pl(e,t){var n,o,r;return function(){var i=Oe(this,e),s=(this.style.removeProperty(e),Oe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Zo(e){return function(){this.style.removeProperty(e)}}function yl(e,t,n){var o,r=n+"",i;return function(){var s=Oe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function ml(e,t,n){var o,r,i;return function(){var s=Oe(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Oe(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function wl(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=ye(this,e),f=c.on,u=c.value[i]==null?a||(a=Zo(t)):void 0;(f!==n||r!==u)&&(o=(n=f).copy()).on(s,r=u),c.on=o}}function xl(e,t,n){var o=(e+="")=="transform"?vc:Uo;return t==null?this.styleTween(e,pl(e,o)).on("end.style."+e,Zo(e)):typeof t=="function"?this.styleTween(e,ml(e,o,An(this,"style."+e,t))).each(wl(this._id,e)):this.styleTween(e,yl(e,o,t),n).on("end.style."+e,null)}function vl(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function bl(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&vl(e,s,n)),o}return i._value=t,i}function _l(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,bl(e,t,n??""))}function Sl(e){return function(){this.textContent=e}}function El(e){return function(){var t=e(this);this.textContent=t??""}}function Cl(e){return this.tween("text",typeof e=="function"?El(An(this,"text",e)):Sl(e==null?"":e+""))}function Nl(e){return function(t){this.textContent=e.call(this,t)}}function Ml(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Nl(r)),t}return o._value=e,o}function kl(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Ml(e))}function Al(){for(var e=this._name,t=this._id,n=$o(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,f=0;f<a;++f)if(c=s[f]){var u=de(c,t);Ht(c,e,n,f,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new we(o,this._parents,e,n)}function Il(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var f=ye(this,o),u=f.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),f.on=t}),r===0&&i()})}var Pl=0;function we(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function $o(){return++Pl}var xe=$e.prototype;we.prototype={constructor:we,select:fl,selectAll:dl,selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:rl,merge:il,selection:gl,transition:Al,call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:cl,attr:Xc,attrTween:Uc,style:xl,styleTween:_l,text:Cl,textTween:kl,remove:ul,tween:Oc,delay:Qc,duration:qc,ease:tl,easeVarying:ol,end:Il,[Symbol.iterator]:xe[Symbol.iterator]};function Tl(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Dl={time:null,delay:0,duration:250,ease:Tl};function Ll(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Ol(e){var t,n;e instanceof we?(t=e._id,e=e._name):(t=$o(),(n=Dl).time=En(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,f=0;f<a;++f)(c=s[f])&&Ht(c,e,t,f,s,n||Ll(c,t));return new we(o,this._parents,e,t)}$e.prototype.interrupt=Tc,$e.prototype.transition=Ol;const Bt=e=>()=>e;function Hl(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 ve(e,t,n){this.k=e,this.x=t,this.y=n}ve.prototype={constructor:ve,scale:function(e){return e===1?this:new ve(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ve(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 Vt=new ve(1,0,0);Qo.prototype=ve.prototype;function Qo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Vt;return e.__zoom}function In(e){e.stopImmediatePropagation()}function it(e){e.preventDefault(),e.stopImmediatePropagation()}function zl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Bl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Jo(){return this.__zoom||Vt}function Vl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Fl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yl(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 jo(){var e=zl,t=Bl,n=Yl,o=Vl,r=Fl,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=At,f=wt("start","zoom","end"),u,d,l,h=500,y=150,p=0,w=10;function m(v){v.property("__zoom",Jo).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",T).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,M,S,N){var D=v.selection?v.selection():v;D.property("__zoom",Jo),v!==D?b(v,M,S,N):D.interrupt().each(function(){E(this,arguments).event(N).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},m.scaleBy=function(v,M,S,N){m.scaleTo(v,function(){var D=this.__zoom.k,k=typeof M=="function"?M.apply(this,arguments):M;return D*k},S,N)},m.scaleTo=function(v,M,S,N){m.transform(v,function(){var D=t.apply(this,arguments),k=this.__zoom,L=S==null?x(D):typeof S=="function"?S.apply(this,arguments):S,B=k.invert(L),F=typeof M=="function"?M.apply(this,arguments):M;return n(g(_(k,F),L,B),D,s)},S,N)},m.translateBy=function(v,M,S,N){m.transform(v,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),s)},null,N)},m.translateTo=function(v,M,S,N,D){m.transform(v,function(){var k=t.apply(this,arguments),L=this.__zoom,B=N==null?x(k):typeof N=="function"?N.apply(this,arguments):N;return n(Vt.translate(B[0],B[1]).scale(L.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof S=="function"?-S.apply(this,arguments):-S),k,s)},N,D)};function _(v,M){return M=Math.max(i[0],Math.min(i[1],M)),M===v.k?v:new ve(M,v.x,v.y)}function g(v,M,S){var N=M[0]-S[0]*v.k,D=M[1]-S[1]*v.k;return N===v.x&&D===v.y?v:new ve(v.k,N,D)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function b(v,M,S,N){v.on("start.zoom",function(){E(this,arguments).event(N).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(N).end()}).tween("zoom",function(){var D=this,k=arguments,L=E(D,k).event(N),B=t.apply(D,k),F=S==null?x(B):typeof S=="function"?S.apply(D,k):S,W=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),Y=D.__zoom,K=typeof M=="function"?M.apply(D,k):M,U=c(Y.invert(F).concat(W/Y.k),K.invert(F).concat(W/K.k));return function(R){if(R===1)R=K;else{var X=U(R),Z=W/X[2];R=new ve(Z,F[0]-X[0]*Z,F[1]-X[1]*Z)}L.zoom(null,R)}})}function E(v,M,S){return!S&&v.__zooming||new C(v,M)}function C(v,M){this.that=v,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,M),this.taps=0}C.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,M){return this.mouse&&v!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var M=ce(this.that).datum();f.call(v,this.that,new Hl(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:f}),M)}};function A(v,...M){if(!e.apply(this,arguments))return;var S=E(this,M).event(v),N=this.__zoom,D=Math.max(i[0],Math.min(i[1],N.k*Math.pow(2,o.apply(this,arguments)))),k=ue(v);if(S.wheel)(S.mouse[0][0]!==k[0]||S.mouse[0][1]!==k[1])&&(S.mouse[1]=N.invert(S.mouse[0]=k)),clearTimeout(S.wheel);else{if(N.k===D)return;S.mouse=[k,N.invert(k)],zt(this),S.start()}it(v),S.wheel=setTimeout(L,y),S.zoom("mouse",n(g(_(N,D),S.mouse[0],S.mouse[1]),S.extent,s));function L(){S.wheel=null,S.end()}}function O(v,...M){if(l||!e.apply(this,arguments))return;var S=v.currentTarget,N=E(this,M,!0).event(v),D=ce(v.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",W,!0),k=ue(v,S),L=v.clientX,B=v.clientY;vo(v.view),In(v),N.mouse=[k,this.__zoom.invert(k)],zt(this),N.start();function F(Y){if(it(Y),!N.moved){var K=Y.clientX-L,U=Y.clientY-B;N.moved=K*K+U*U>p}N.event(Y).zoom("mouse",n(g(N.that.__zoom,N.mouse[0]=ue(Y,S),N.mouse[1]),N.extent,s))}function W(Y){D.on("mousemove.zoom mouseup.zoom",null),bo(Y.view,N.moved),it(Y),N.event(Y).end()}}function V(v,...M){if(e.apply(this,arguments)){var S=this.__zoom,N=ue(v.changedTouches?v.changedTouches[0]:v,this),D=S.invert(N),k=S.k*(v.shiftKey?.5:2),L=n(g(_(S,k),N,D),t.apply(this,M),s);it(v),a>0?ce(this).transition().duration(a).call(b,L,N,v):ce(this).call(m.transform,L,N,v)}}function T(v,...M){if(e.apply(this,arguments)){var S=v.touches,N=S.length,D=E(this,M,v.changedTouches.length===N).event(v),k,L,B,F;for(In(v),L=0;L<N;++L)B=S[L],F=ue(B,this),F=[F,this.__zoom.invert(F),B.identifier],D.touch0?!D.touch1&&D.touch0[2]!==F[2]&&(D.touch1=F,D.taps=0):(D.touch0=F,k=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),k&&(D.taps<2&&(d=F[0],u=setTimeout(function(){u=null},h)),zt(this),D.start())}}function z(v,...M){if(this.__zooming){var S=E(this,M).event(v),N=v.changedTouches,D=N.length,k,L,B,F;for(it(v),k=0;k<D;++k)L=N[k],B=ue(L,this),S.touch0&&S.touch0[2]===L.identifier?S.touch0[0]=B:S.touch1&&S.touch1[2]===L.identifier&&(S.touch1[0]=B);if(L=S.that.__zoom,S.touch1){var W=S.touch0[0],Y=S.touch0[1],K=S.touch1[0],U=S.touch1[1],R=(R=K[0]-W[0])*R+(R=K[1]-W[1])*R,X=(X=U[0]-Y[0])*X+(X=U[1]-Y[1])*X;L=_(L,Math.sqrt(R/X)),B=[(W[0]+K[0])/2,(W[1]+K[1])/2],F=[(Y[0]+U[0])/2,(Y[1]+U[1])/2]}else if(S.touch0)B=S.touch0[0],F=S.touch0[1];else return;S.zoom("touch",n(g(L,B,F),S.extent,s))}}function H(v,...M){if(this.__zooming){var S=E(this,M).event(v),N=v.changedTouches,D=N.length,k,L;for(In(v),l&&clearTimeout(l),l=setTimeout(function(){l=null},h),k=0;k<D;++k)L=N[k],S.touch0&&S.touch0[2]===L.identifier?delete S.touch0:S.touch1&&S.touch1[2]===L.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(),S.taps===2&&(L=ue(L,this),Math.hypot(d[0]-L[0],d[1]-L[1])<w)){var B=ce(this).on("dblclick.zoom");B&&B.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:Bt(+v),m):o},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Bt(!!v),m):e},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:Bt(!!v),m):r},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Bt([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):t},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=f.on.apply(f,arguments);return v===f?m:v},m.clickDistance=function(v){return arguments.length?(p=(v=+v)*v,m):Math.sqrt(p)},m.tapDistance=function(v){return arguments.length?(w=+v,m):w},m}const le={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},st=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],qo=["Enter"," ","Escape"],er={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var Te;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Te||(Te={}));var at;(function(e){e.Partial="partial",e.Full="full"})(at||(at={}));const tr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Ee;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ee||(Ee={}));var Ft;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ft||(Ft={}));var G;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(G||(G={}));const nr={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function or(e){return e===null?null:e?"valid":"invalid"}const rr=e=>"id"in e&&"source"in e&&"target"in e,Xl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Pn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ct=(e,t=[0,0])=>{const{width:n,height:o}=be(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Wl=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Pn(r)?r:t.nodeLookup.get(r.id));const a=s?Wt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Yt(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Xt(n)},lt=(e,t={})=>{if(e.size===0)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(o=>{if(t.filter===void 0||t.filter(o)){const r=Wt(o);n=Yt(n,r)}}),Xt(n)},Tn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...ft(t,[n,o,r]),width:t.width/r,height:t.height/r},c=[];for(const f of e.values()){const{measured:u,selectable:d=!0,hidden:l=!1}=f;if(s&&!d||l)continue;const h=u.width??f.width??f.initialWidth??null,y=u.height??f.height??f.initialHeight??null,p=ut(a,Ye(f)),w=(h??0)*(y??0),m=i&&p>0;(!f.internals.handleBounds||m||p>=w||f.dragging)&&c.push(f)}return c},Rl=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Gl(e,t){const n=new Map,o=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Kl({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Gl(e,s),c=lt(a),f=Ln(c,t,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(f,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function ir({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:c,y:f}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",le.error005());else{const h=a.measured.width,y=a.measured.height;h&&y&&(d=[[c,f],[c+h,f+y]])}else a&&We(s.extent)&&(d=[[s.extent[0][0]+c,s.extent[0][1]+f],[s.extent[1][0]+c,s.extent[1][1]+f]]);const l=We(d)?De(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",le.error015())),{position:{x:l.x-c+(s.measured.width??0)*u[0],y:l.y-f+(s.measured.height??0)*u[1]},positionAbsolute:l}}async function Ul({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(l=>l.id)),s=[];for(const l of n){if(l.deletable===!1)continue;const h=i.has(l.id),y=!h&&l.parentId&&s.find(p=>p.id===l.parentId);(h||y)&&s.push(l)}const a=new Set(t.map(l=>l.id)),c=o.filter(l=>l.deletable!==!1),u=Rl(s,c);for(const l of c)a.has(l.id)&&!u.find(y=>y.id===l.id)&&u.push(l);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const Fe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),De=(e={x:0,y:0},t,n)=>({x:Fe(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Fe(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function sr(e,t,n){const{width:o,height:r}=be(n),{x:i,y:s}=n.internals.positionAbsolute;return De(e,[[i,s],[i+o,s+r]],t)}const ar=(e,t,n)=>e<t?Fe(Math.abs(e-t),1,t)/t:e>n?-Fe(Math.abs(e-n),1,t)/t:0,cr=(e,t,n=15,o=40)=>{const r=ar(e.x,o,t.width-o)*n,i=ar(e.y,o,t.height-o)*n;return[r,i]},Yt=(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)}),Dn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Xt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Ye=(e,t=[0,0])=>{var r,i;const{x:n,y:o}=Pn(e)?e.internals.positionAbsolute:ct(e,t);return{x:n,y:o,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Wt=(e,t=[0,0])=>{var r,i;const{x:n,y:o}=Pn(e)?e.internals.positionAbsolute:ct(e,t);return{x:n,y:o,x2:n+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:o+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},lr=(e,t)=>Xt(Yt(Dn(e),Dn(t))),ut=(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)},ur=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),fr=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Rt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ft=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Rt(a,s):a},Gt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Zl(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),i=Xe(e.left??e.x??0,t),s=Xe(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function $l(e,t,n,o,r,i){const{x:s,y:a}=Gt(e,[t,n,o]),{x:c,y:f}=Gt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,d=i-f;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const Ln=(e,t,n,o,r,i)=>{const s=Zl(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,f=Math.min(a,c),u=Fe(f,o,r),d=e.x+e.width/2,l=e.y+e.height/2,h=t/2-d*u,y=n/2-l*u,p=$l(e,h,y,u,t,n),w={left:Math.min(p.left-s.left,0),top:Math.min(p.top-s.top,0),right:Math.min(p.right-s.right,0),bottom:Math.min(p.bottom-s.bottom,0)};return{x:h-w.left+w.right,y:y-w.top+w.bottom,zoom:u}},Kt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function We(e){return e!==void 0&&e!=="parent"}function be(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function dr(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function hr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function gr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ql(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Jl(e){return{...er,...e||{}}}function dt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=me(e),a=ft({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:c,y:f}=n?Rt(a,t):a;return{xSnapped:c,ySnapped:f,...a}}const On=e=>({width:e.offsetWidth,height:e.offsetHeight}),pr=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},jl=["INPUT","SELECT","TEXTAREA"];function yr(e){var o,r;const t=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:jl.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const mr=e=>"clientX"in e,me=(e,t)=>{var i,s;const n=mr(e),o=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,r=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:o-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},wr=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...On(s)}})};function xr({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+r*.375+s*.375+n*.125,f=t*.125+i*.375+a*.375+o*.125,u=Math.abs(c-e),d=Math.abs(f-t);return[c,f,u,d]}function Ut(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vr({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case G.Left:return[t-Ut(t-o,i),n];case G.Right:return[t+Ut(o-t,i),n];case G.Top:return[t,n-Ut(n-r,i)];case G.Bottom:return[t,n+Ut(r-n,i)]}}function br({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:i=G.Top,curvature:s=.25}){const[a,c]=vr({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[f,u]=vr({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,l,h,y]=xr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:f,targetControlY:u});return[`M${e},${t} C${a},${c} ${f},${u} ${o},${r}`,d,l,h,y]}function _r({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function ql({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:r=!1}){if(o!==void 0)return o;const i=r&&n?1e3:0,s=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return i+s}function eu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Yt(Wt(e),Wt(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 ut(s,Xt(i))>0}const tu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,nu=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Sr=(e,t)=>{if(!e.source||!e.target)return fr("006",le.error006()),t;let n;return rr(e)?n={...e}:n={...e,id:tu(e)},nu(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function Er({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=_r({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Cr={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},ou=({source:e,sourcePosition:t=G.Bottom,target:n})=>t===G.Left||t===G.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Nr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function ru({source:e,sourcePosition:t=G.Bottom,target:n,targetPosition:o=G.Top,center:r,offset:i}){const s=Cr[t],a=Cr[o],c={x:e.x+s.x*i,y:e.y+s.y*i},f={x:n.x+a.x*i,y:n.y+a.y*i},u=ou({source:c,sourcePosition:t,target:f}),d=u.x!==0?"x":"y",l=u[d];let h=[],y,p;const w={x:0,y:0},m={x:0,y:0},[_,g,x,b]=_r({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*a[d]===-1){y=r.x??_,p=r.y??g;const C=[{x:y,y:c.y},{x:y,y:f.y}],A=[{x:c.x,y:p},{x:f.x,y:p}];s[d]===l?h=d==="x"?C:A:h=d==="x"?A:C}else{const C=[{x:c.x,y:f.y}],A=[{x:f.x,y:c.y}];if(d==="x"?h=s.x===l?A:C:h=s.y===l?C:A,t===o){const H=Math.abs(e[d]-n[d]);if(H<=i){const v=Math.min(i-1,i-H);s[d]===l?w[d]=(c[d]>e[d]?-1:1)*v:m[d]=(f[d]>n[d]?-1:1)*v}}if(t!==o){const H=d==="x"?"y":"x",v=s[d]===a[H],M=c[H]>f[H],S=c[H]<f[H];(s[d]===1&&(!v&&M||v&&S)||s[d]!==1&&(!v&&S||v&&M))&&(h=d==="x"?C:A)}const O={x:c.x+w.x,y:c.y+w.y},V={x:f.x+m.x,y:f.y+m.y},T=Math.max(Math.abs(O.x-h[0].x),Math.abs(V.x-h[0].x)),z=Math.max(Math.abs(O.y-h[0].y),Math.abs(V.y-h[0].y));T>=z?(y=(O.x+V.x)/2,p=h[0].y):(y=h[0].x,p=(O.y+V.y)/2)}return[[e,{x:c.x+w.x,y:c.y+w.y},...h,{x:f.x+m.x,y:f.y+m.y},n],y,p,x,b]}function iu(e,t,n,o){const r=Math.min(Nr(e,t)/2,Nr(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const f=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*f},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function Hn({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:i=G.Top,borderRadius:s=5,centerX:a,centerY:c,offset:f=20}){const[u,d,l,h,y]=ru({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:f});return[u.reduce((w,m,_)=>{let g="";return _>0&&_<u.length-1?g=iu(u[_-1],m,u[_+1],s):g=`${_===0?"M":"L"}${m.x} ${m.y}`,w+=g,w},""),d,l,h,y]}function Mr(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function su(e){var d;const{sourceNode:t,targetNode:n}=e;if(!Mr(t)||!Mr(n))return null;const o=t.internals.handleBounds||kr(t.handles),r=n.internals.handleBounds||kr(n.handles),i=Ar((o==null?void 0:o.source)??[],e.sourceHandle),s=Ar(e.connectionMode===Ve.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),e.targetHandle);if(!i||!s)return(d=e.onError)==null||d.call(e,"008",le.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||G.Bottom,c=(s==null?void 0:s.position)||G.Top,f=ht(t,i,a),u=ht(n,s,c);return{sourceX:f.x,sourceY:f.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function kr(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function ht(e,t,n=G.Left,o=!1){const r=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??be(e);if(o)return{x:r+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case G.Top:return{x:r+s/2,y:i};case G.Right:return{x:r+s,y:i+a/2};case G.Bottom:return{x:r+s/2,y:i+a};case G.Left:return{x:r,y:i+a/2}}}function Ar(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function zn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function au(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const f=zn(c,t);i.has(f)||(s.push({id:f,color:c.color||n,...c}),i.add(f))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Bn={nodeOrigin:[0,0],nodeExtent:st,elevateNodesOnSelect:!0,defaults:{}},cu={...Bn,checkEquality:!0};function Vn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function lu(e,t,n){const o=Vn(Bn,n);for(const r of e.values())if(r.parentId)Yn(r,e,t,o);else{const i=ct(r,o.nodeOrigin),s=We(r.extent)?r.extent:o.nodeExtent,a=De(i,s,be(r));r.internals.positionAbsolute=a}}function Fn(e,t,n,o){var c,f;const r=Vn(cu,o);let i=e.length>0;const s=new Map(t),a=r!=null&&r.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const u of e){let d=s.get(u.id);if(r.checkEquality&&u===(d==null?void 0:d.internals.userNode))t.set(u.id,d);else{const l=ct(u,r.nodeOrigin),h=We(u.extent)?u.extent:r.nodeExtent,y=De(l,h,be(u));d={...r.defaults,...u,measured:{width:(c=u.measured)==null?void 0:c.width,height:(f=u.measured)==null?void 0:f.height},internals:{positionAbsolute:y,handleBounds:u.measured?d==null?void 0:d.internals.handleBounds:void 0,z:Ir(u,a),userNode:u}},t.set(u.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(i=!1),u.parentId&&Yn(d,t,n,o)}return i}function uu(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Yn(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:s}=Vn(Bn,o),a=e.parentId,c=t.get(a);if(!c){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}uu(e,n);const f=r?1e3:0,{x:u,y:d,z:l}=fu(e,c,i,s,f),{positionAbsolute:h}=e.internals,y=u!==h.x||d!==h.y;(y||l!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:u,y:d}:h,z:l}})}function Ir(e,t){return(he(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function fu(e,t,n,o,r){const{x:i,y:s}=t.internals.positionAbsolute,a=be(e),c=ct(e,n),f=We(e.extent)?De(c,e.extent,a):c;let u=De({x:i+f.x,y:s+f.y},o,a);e.extent==="parent"&&(u=sr(u,a,t));const d=Ir(e,r),l=t.internals.z??0;return{x:u.x,y:u.y,z:l>=d?l+1:d}}function Xn(e,t,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const f=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ye(c),u=lr(f,a.rect);i.set(a.parentId,{expandedRect:u,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},f)=>{var g;const u=c.internals.positionAbsolute,d=be(c),l=c.origin??o,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,y=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,p=Math.max(d.width,Math.round(a.width)),w=Math.max(d.height,Math.round(a.height)),m=(p-d.width)*l[0],_=(w-d.height)*l[1];(h>0||y>0||m||_)&&(r.push({id:f,type:"position",position:{x:c.position.x-h+m,y:c.position.y-y+_}}),(g=n.get(f))==null||g.forEach(x=>{e.some(b=>b.id===x.id)||r.push({id:x.id,type:"position",position:{x:x.position.x+h,y:x.position.y+y}})})),(d.width<a.width||d.height<a.height||h||y)&&r.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:p+(h?l[0]*h-m:0),height:w+(y?l[1]*y-_:0)}})}),r}function du(e,t,n,o,r,i){const s=o==null?void 0:o.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const c=[],f=window.getComputedStyle(s),{m22:u}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const l of e.values()){const h=t.get(l.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),a=!0;continue}const y=On(l.nodeElement),p=h.measured.width!==y.width||h.measured.height!==y.height;if(!!(y.width&&y.height&&(p||!h.internals.handleBounds||l.force))){const m=l.nodeElement.getBoundingClientRect(),_=We(h.extent)?h.extent:i;let{positionAbsolute:g}=h.internals;h.parentId&&h.extent==="parent"?g=sr(g,y,t.get(h.parentId)):_&&(g=De(g,_,y));const x={...h,measured:y,internals:{...h.internals,positionAbsolute:g,handleBounds:{source:wr("source",l.nodeElement,m,u,h.id),target:wr("target",l.nodeElement,m,u,h.id)}}};t.set(h.id,x),h.parentId&&Yn(x,t,n,{nodeOrigin:r}),a=!0,p&&(c.push({id:h.id,type:"dimensions",dimensions:y}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:Ye(x,r)}))}}if(d.length>0){const l=Xn(d,t,n,r);c.push(...l)}return{changes:c,updatedInternals:a}}async function hu({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function Pr(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 c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;const f=o.get(s)||new Map;o.set(s,f.set(n,t))}}function Tr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},f=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Pr("source",c,u,e,r,s),Pr("target",c,f,e,i,a),t.set(o.id,o)}}function Dr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Dr(n,t):!1}function Lr(e,t,n){var r;let o=e;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,t))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function gu(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Dr(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Wn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){var s,a,c;const r=[];for(const[f,u]of t){const d=(s=n.get(f))==null?void 0:s.internals.userNode;d&&r.push({...d,position:u.position,dragging:o})}if(!e)return[r[0],r];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:o}:r[0],r]}function pu({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,f={x:0,y:0},u=null,d=!1,l=null,h=!1,y=!1;function p({noDragClassName:m,handleSelector:_,domNode:g,isSelectable:x,nodeId:b,nodeClickDistance:E=0}){l=ce(g);function C({x:T,y:z},H){const{nodeLookup:v,nodeExtent:M,snapGrid:S,snapToGrid:N,nodeOrigin:D,onNodeDrag:k,onSelectionDrag:L,onError:B,updateNodePositions:F}=t();i={x:T,y:z};let W=!1,Y={x:0,y:0,x2:0,y2:0};if(a.size>1&&M){const K=lt(a);Y=Dn(K)}for(const[K,U]of a){if(!v.has(K))continue;let R={x:T-U.distance.x,y:z-U.distance.y};N&&(R=Rt(R,S));let X=[[M[0][0],M[0][1]],[M[1][0],M[1][1]]];if(a.size>1&&M&&!U.extent){const{positionAbsolute:j}=U.internals,$=j.x-Y.x+M[0][0],J=j.x+U.measured.width-Y.x2+M[1][0],Q=j.y-Y.y+M[0][1],te=j.y+U.measured.height-Y.y2+M[1][1];X=[[$,Q],[J,te]]}const{position:Z,positionAbsolute:ee}=ir({nodeId:K,nextPosition:R,nodeLookup:v,nodeExtent:X,nodeOrigin:D,onError:B});W=W||U.position.x!==Z.x||U.position.y!==Z.y,U.position=Z,U.internals.positionAbsolute=ee}if(y=y||W,!!W&&(F(a,!0),H&&(o||k||!b&&L))){const[K,U]=Wn({nodeId:b,dragItems:a,nodeLookup:v});o==null||o(H,a,K,U),k==null||k(H,K,U),b||L==null||L(H,U)}}async function A(){if(!u)return;const{transform:T,panBy:z,autoPanSpeed:H,autoPanOnNodeDrag:v}=t();if(!v){c=!1,cancelAnimationFrame(s);return}const[M,S]=cr(f,u,H);(M!==0||S!==0)&&(i.x=(i.x??0)-M/T[2],i.y=(i.y??0)-S/T[2],await z({x:M,y:S})&&C(i,null)),s=requestAnimationFrame(A)}function O(T){var W;const{nodeLookup:z,multiSelectionActive:H,nodesDraggable:v,transform:M,snapGrid:S,snapToGrid:N,selectNodesOnDrag:D,onNodeDragStart:k,onSelectionDragStart:L,unselectNodesAndEdges:B}=t();d=!0,(!D||!x)&&!H&&b&&((W=z.get(b))!=null&&W.selected||B()),x&&D&&b&&(e==null||e(b));const F=dt(T.sourceEvent,{transform:M,snapGrid:S,snapToGrid:N,containerBounds:u});if(i=F,a=gu(z,v,F,b),a.size>0&&(n||k||!b&&L)){const[Y,K]=Wn({nodeId:b,dragItems:a,nodeLookup:z});n==null||n(T.sourceEvent,a,Y,K),k==null||k(T.sourceEvent,Y,K),b||L==null||L(T.sourceEvent,K)}}const V=_o().clickDistance(E).on("start",T=>{const{domNode:z,nodeDragThreshold:H,transform:v,snapGrid:M,snapToGrid:S}=t();u=(z==null?void 0:z.getBoundingClientRect())||null,h=!1,y=!1,H===0&&O(T),i=dt(T.sourceEvent,{transform:v,snapGrid:M,snapToGrid:S,containerBounds:u}),f=me(T.sourceEvent,u)}).on("drag",T=>{const{autoPanOnNodeDrag:z,transform:H,snapGrid:v,snapToGrid:M,nodeDragThreshold:S,nodeLookup:N}=t(),D=dt(T.sourceEvent,{transform:H,snapGrid:v,snapToGrid:M,containerBounds:u});if((T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||b&&!N.has(b))&&(h=!0),!h){if(!c&&z&&d&&(c=!0,A()),!d){const k=D.xSnapped-(i.x??0),L=D.ySnapped-(i.y??0);Math.sqrt(k*k+L*L)>S&&O(T)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&d&&(f=me(T.sourceEvent,u),C(D,T.sourceEvent))}}).on("end",T=>{if(!(!d||h)&&(c=!1,d=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:z,updateNodePositions:H,onNodeDragStop:v,onSelectionDragStop:M}=t();if(y&&(H(a,!1),y=!1),r||v||!b&&M){const[S,N]=Wn({nodeId:b,dragItems:a,nodeLookup:z,dragging:!1});r==null||r(T.sourceEvent,a,S,N),v==null||v(T.sourceEvent,S,N),b||M==null||M(T.sourceEvent,N)}}}).filter(T=>{const z=T.target;return!T.button&&(!m||!Lr(z,`.${m}`,g))&&(!_||Lr(z,_,g))});l.call(V)}function w(){l==null||l.on(".drag",null)}return{update:p,destroy:w}}function yu(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())ut(r,Ye(i))>0&&o.push(i);return o}const mu=250;function wu(e,t,n,o){var a,c;let r=[],i=1/0;const s=yu(e,n,t+mu);for(const f of s){const u=[...((a=f.internals.handleBounds)==null?void 0:a.source)??[],...((c=f.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of u){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:l,y:h}=ht(f,d,d.position,!0),y=Math.sqrt(Math.pow(l-e.x,2)+Math.pow(h-e.y,2));y>t||(y<i?(r=[{...d,x:l,y:h}],i=y):y===i&&r.push({...d,x:l,y:h}))}}if(!r.length)return null;if(r.length>1){const f=o.type==="source"?"target":"source";return r.find(u=>u.type===f)??r[0]}return r[0]}function Or(e,t,n,o,r,i=!1){var f,u,d;const s=o.get(e);if(!s)return null;const a=r==="strict"?(f=s.internals.handleBounds)==null?void 0:f[t]:[...((u=s.internals.handleBounds)==null?void 0:u.source)??[],...((d=s.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?a==null?void 0:a.find(l=>l.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...ht(s,c,c.position,!0)}:c}function Hr(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function xu(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const zr=()=>!0;function vu(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:f,autoPanOnConnect:u,flowId:d,panBy:l,cancelConnection:h,onConnectStart:y,onConnect:p,onConnectEnd:w,isValidConnection:m=zr,onReconnectEnd:_,updateConnection:g,getTransform:x,getFromHandle:b,autoPanSpeed:E,dragThreshold:C=1}){const A=pr(e.target);let O=0,V;const{x:T,y:z}=me(e),H=A==null?void 0:A.elementFromPoint(T,z),v=Hr(i,H),M=a==null?void 0:a.getBoundingClientRect();let S=!1;if(!M||!v)return;const N=Or(r,v,o,c,t);if(!N)return;let D=me(e,M),k=!1,L=null,B=!1,F=null;function W(){if(!u||!M)return;const[j,$]=cr(D,M,E);l({x:j,y:$}),O=requestAnimationFrame(W)}const Y={...N,nodeId:r,type:v,position:N.position},K=c.get(r);let R={inProgress:!0,isValid:null,from:ht(K,Y,G.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:K,to:D,toHandle:null,toPosition:nr[Y.position],toNode:null};function X(){S=!0,g(R),y==null||y(e,{nodeId:r,handleId:o,handleType:v})}C===0&&X();function Z(j){if(!S){const{x:te,y:re}=me(j),_e=te-T,Ue=re-z;if(!(_e*_e+Ue*Ue>C*C))return;X()}if(!b()||!Y){ee(j);return}const $=x();D=me(j,M),V=wu(ft(D,$,!1,[1,1]),n,c,Y),k||(W(),k=!0);const J=Br(j,{handle:V,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:A,lib:f,flowId:d,nodeLookup:c});F=J.handleDomNode,L=J.connection,B=xu(!!V,J.isValid);const Q={...R,isValid:B,to:J.toHandle&&B?Gt({x:J.toHandle.x,y:J.toHandle.y},$):D,toHandle:J.toHandle,toPosition:B&&J.toHandle?J.toHandle.position:nr[Y.position],toNode:J.toHandle?c.get(J.toHandle.nodeId):null};B&&V&&R.toHandle&&Q.toHandle&&R.toHandle.type===Q.toHandle.type&&R.toHandle.nodeId===Q.toHandle.nodeId&&R.toHandle.id===Q.toHandle.id&&R.to.x===Q.to.x&&R.to.y===Q.to.y||(g(Q),R=Q)}function ee(j){if(S){(V||F)&&L&&B&&(p==null||p(L));const{inProgress:$,...J}=R,Q={...J,toPosition:R.toHandle?R.toPosition:null};w==null||w(j,Q),i&&(_==null||_(j,Q))}h(),cancelAnimationFrame(O),k=!1,B=!1,L=null,F=null,A.removeEventListener("mousemove",Z),A.removeEventListener("mouseup",ee),A.removeEventListener("touchmove",Z),A.removeEventListener("touchend",ee)}A.addEventListener("mousemove",Z),A.addEventListener("mouseup",ee),A.addEventListener("touchmove",Z),A.addEventListener("touchend",ee)}function Br(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:f=zr,nodeLookup:u}){const d=i==="target",l=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y}=me(e),p=s.elementFromPoint(h,y),w=p!=null&&p.classList.contains(`${a}-flow__handle`)?p:l,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const _=Hr(void 0,w),g=w.getAttribute("data-nodeid"),x=w.getAttribute("data-handleid"),b=w.classList.contains("connectable"),E=w.classList.contains("connectableend");if(!g||!_)return m;const C={source:d?g:o,sourceHandle:d?x:r,target:d?o:g,targetHandle:d?r:x};m.connection=C;const O=b&&E&&(n===Ve.Strict?d&&_==="source"||!d&&_==="target":g!==o||x!==r);m.isValid=O&&f(C),m.toHandle=Or(g,_,x,u,n,!0)}return m}const Rn={onPointerDown:vu,isValid:Br};function bu({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:c,height:f,zoomStep:u=10,pannable:d=!0,zoomable:l=!0,inversePan:h=!1}){const y=g=>{const x=n();if(g.sourceEvent.type!=="wheel"||!t)return;const b=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,E=x[2]*Math.pow(2,b);t.scaleTo(E)};let p=[0,0];const w=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(p=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{const x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const b=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],E=[b[0]-p[0],b[1]-p[1]];p=b;const C=o()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),A={x:x[0]-E[0]*C,y:x[1]-E[1]*C},O=[[0,0],[c,f]];t.setViewportConstrained({x:A.x,y:A.y,zoom:x[2]},O,a)},_=jo().on("start",w).on("zoom",d?m:null).on("zoom.wheel",l?y:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:ue}}const _u=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Zt=e=>({x:e.x,y:e.y,zoom:e.k}),Gn=({x:e,y:t,zoom:n})=>Vt.translate(e,t).scale(n),Re=(e,t)=>e.target.closest(`.${t}`),Vr=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Su=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Kn=(e,t=0,n=Su,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Fr=e=>{const t=e.ctrlKey&&Kt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Eu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:f}){return u=>{if(Re(u,t))return!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const w=ue(u),m=Fr(u),_=d*Math.pow(2,m);o.scaleTo(n,_,w,u);return}const l=u.deltaMode===1?20:1;let h=r===Te.Vertical?0:u.deltaX*l,y=r===Te.Horizontal?0:u.deltaY*l;!Kt()&&u.shiftKey&&r!==Te.Vertical&&(h=u.deltaY*l,y=0),o.translateBy(n,-(h/d)*i,-(y/d)*i,{internal:!0});const p=Zt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a==null||a(u,p)),e.isPanScrolling&&(c==null||c(u,p),e.panScrollTimeout=setTimeout(()=>{f==null||f(u,p),e.isPanScrolling=!1},150))}}function Cu({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Re(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Nu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=Zt(o.transform);e.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(o.sourceEvent,r))}}function Mu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&Vr(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,Zt(i.transform)))}}function ku({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&Vr(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&_u(e.prevViewport,s.transform))){const c=Zt(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,c)},n?150:0)}}}function Au({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:f}){return u=>{var y;const d=e||t,l=n&&u.ctrlKey;if(u.button===1&&u.type==="mousedown"&&(Re(u,`${f}-flow__node`)||Re(u,`${f}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||Re(u,a)&&u.type==="wheel"||Re(u,c)&&(u.type!=="wheel"||r&&u.type==="wheel"&&!e)||!n&&u.ctrlKey&&u.type==="wheel")return!1;if(!n&&u.type==="touchstart"&&((y=u.touches)==null?void 0:y.length)>1)return u.preventDefault(),!1;if(!d&&!r&&!l&&u.type==="wheel"||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const h=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||u.type==="wheel")&&h}}function Iu({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:f}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),l=jo().clickDistance(!he(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),h=ce(e).call(l);g({x:i.x,y:i.y,zoom:Fe(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const y=h.on("wheel.zoom"),p=h.on("dblclick.zoom");l.wheelDelta(Fr);function w(z,H){return h?new Promise(v=>{l==null||l.interpolate((H==null?void 0:H.interpolate)==="linear"?et:At).transform(Kn(h,H==null?void 0:H.duration,H==null?void 0:H.ease,()=>v(!0)),z)}):Promise.resolve(!1)}function m({noWheelClassName:z,noPanClassName:H,onPaneContextMenu:v,userSelectionActive:M,panOnScroll:S,panOnDrag:N,panOnScrollMode:D,panOnScrollSpeed:k,preventScrolling:L,zoomOnPinch:B,zoomOnScroll:F,zoomOnDoubleClick:W,zoomActivationKeyPressed:Y,lib:K,onTransformChange:U}){M&&!u.isZoomingOrPanning&&_();const X=S&&!Y&&!M?Eu({zoomPanValues:u,noWheelClassName:z,d3Selection:h,d3Zoom:l,panOnScrollMode:D,panOnScrollSpeed:k,zoomOnPinch:B,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:c}):Cu({noWheelClassName:z,preventScrolling:L,d3ZoomHandler:y});if(h.on("wheel.zoom",X,{passive:!1}),!M){const ee=Nu({zoomPanValues:u,onDraggingChange:f,onPanZoomStart:a});l.on("start",ee);const j=Mu({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!v,onPanZoom:s,onTransformChange:U});l.on("zoom",j);const $=ku({zoomPanValues:u,panOnDrag:N,panOnScroll:S,onPaneContextMenu:v,onPanZoomEnd:c,onDraggingChange:f});l.on("end",$)}const Z=Au({zoomActivationKeyPressed:Y,panOnDrag:N,zoomOnScroll:F,panOnScroll:S,zoomOnDoubleClick:W,zoomOnPinch:B,userSelectionActive:M,noPanClassName:H,noWheelClassName:z,lib:K});l.filter(Z),W?h.on("dblclick.zoom",p):h.on("dblclick.zoom",null)}function _(){l.on("zoom",null)}async function g(z,H,v){const M=Gn(z),S=l==null?void 0:l.constrain()(M,H,v);return S&&await w(S),new Promise(N=>N(S))}async function x(z,H){const v=Gn(z);return await w(v,H),new Promise(M=>M(v))}function b(z){if(h){const H=Gn(z),v=h.property("__zoom");(v.k!==z.zoom||v.x!==z.x||v.y!==z.y)&&(l==null||l.transform(h,H,null,{sync:!0}))}}function E(){const z=h?Qo(h.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}function C(z,H){return h?new Promise(v=>{l==null||l.interpolate((H==null?void 0:H.interpolate)==="linear"?et:At).scaleTo(Kn(h,H==null?void 0:H.duration,H==null?void 0:H.ease,()=>v(!0)),z)}):Promise.resolve(!1)}function A(z,H){return h?new Promise(v=>{l==null||l.interpolate((H==null?void 0:H.interpolate)==="linear"?et:At).scaleBy(Kn(h,H==null?void 0:H.duration,H==null?void 0:H.ease,()=>v(!0)),z)}):Promise.resolve(!1)}function O(z){l==null||l.scaleExtent(z)}function V(z){l==null||l.translateExtent(z)}function T(z){const H=!he(z)||z<0?0:z;l==null||l.clickDistance(H)}return{update:m,destroy:_,setViewport:x,setViewportConstrained:g,getViewport:E,scaleTo:C,scaleBy:A,setScaleExtent:O,setTranslateExtent:V,syncViewport:b,setClickDistance:T}}var Ge;(function(e){e.Line="line",e.Handle="handle"})(Ge||(Ge={}));function Pu({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Tu(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function Ne(e,t){return Math.max(0,e-t)}function $t(e,t,n){return Math.max(0,t-e,e-n)}function Yr(e,t){return e?!t:t}function Du(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:f}=t;const{isHorizontal:u,isVertical:d}=t,l=u&&d,{xSnapped:h,ySnapped:y}=n,{minWidth:p,maxWidth:w,minHeight:m,maxHeight:_}=o,{x:g,y:x,width:b,height:E,aspectRatio:C}=e;let A=Math.floor(u?h-e.pointerX:0),O=Math.floor(d?y-e.pointerY:0);const V=b+(c?-A:A),T=E+(f?-O:O),z=-i[0]*b,H=-i[1]*E;let v=$t(V,p,w),M=$t(T,m,_);if(s){let D=0,k=0;c&&A<0?D=Ce(g+A+z,s[0][0]):!c&&A>0&&(D=Ne(g+V+z,s[1][0])),f&&O<0?k=Ce(x+O+H,s[0][1]):!f&&O>0&&(k=Ne(x+T+H,s[1][1])),v=Math.max(v,D),M=Math.max(M,k)}if(a){let D=0,k=0;c&&A>0?D=Ne(g+A,a[0][0]):!c&&A<0&&(D=Ce(g+V,a[1][0])),f&&O>0?k=Ne(x+O,a[0][1]):!f&&O<0&&(k=Ce(x+T,a[1][1])),v=Math.max(v,D),M=Math.max(M,k)}if(r){if(u){const D=$t(V/C,m,_)*C;if(v=Math.max(v,D),s){let k=0;!c&&!f||c&&!f&&l?k=Ne(x+H+V/C,s[1][1])*C:k=Ce(x+H+(c?A:-A)/C,s[0][1])*C,v=Math.max(v,k)}if(a){let k=0;!c&&!f||c&&!f&&l?k=Ce(x+V/C,a[1][1])*C:k=Ne(x+(c?A:-A)/C,a[0][1])*C,v=Math.max(v,k)}}if(d){const D=$t(T*C,p,w)/C;if(M=Math.max(M,D),s){let k=0;!c&&!f||f&&!c&&l?k=Ne(g+T*C+z,s[1][0])/C:k=Ce(g+(f?O:-O)*C+z,s[0][0])/C,M=Math.max(M,k)}if(a){let k=0;!c&&!f||f&&!c&&l?k=Ce(g+T*C,a[1][0])/C:k=Ne(g+(f?O:-O)*C,a[0][0])/C,M=Math.max(M,k)}}}O=O+(O<0?M:-M),A=A+(A<0?v:-v),r&&(l?V>T*C?O=(Yr(c,f)?-A:A)/C:A=(Yr(c,f)?-O:O)*C:u?(O=A/C,f=c):(A=O*C,c=f));const S=c?g+A:g,N=f?x+O:x;return{width:b+(c?-A:A),height:E+(f?-O:O),x:i[0]*A*(c?-1:1)+S,y:i[1]*O*(f?-1:1)+N}}const Xr={width:0,height:0,x:0,y:0},Lu={...Xr,pointerX:0,pointerY:0,aspectRatio:1};function Ou(e){return[[0,0],[e.measured.width,e.measured.height]]}function Hu(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,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function zu({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);function s({controlPosition:c,boundaries:f,keepAspectRatio:u,resizeDirection:d,onResizeStart:l,onResize:h,onResizeEnd:y,shouldResize:p}){let w={...Xr},m={...Lu};const _=Tu(c);let g,x=null,b=[],E,C,A;const O=_o().on("start",V=>{const{nodeLookup:T,transform:z,snapGrid:H,snapToGrid:v,nodeOrigin:M,paneDomNode:S}=n();if(g=T.get(t),!g)return;x=(S==null?void 0:S.getBoundingClientRect())??null;const{xSnapped:N,ySnapped:D}=dt(V.sourceEvent,{transform:z,snapGrid:H,snapToGrid:v,containerBounds:x});w={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},m={...w,pointerX:N,pointerY:D,aspectRatio:w.width/w.height},E=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(E=T.get(g.parentId),C=E&&g.extent==="parent"?Ou(E):void 0),b=[],A=void 0;for(const[k,L]of T)if(L.parentId===t&&(b.push({id:k,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const B=Hu(L,g,L.origin??M);A?A=[[Math.min(B[0][0],A[0][0]),Math.min(B[0][1],A[0][1])],[Math.max(B[1][0],A[1][0]),Math.max(B[1][1],A[1][1])]]:A=B}l==null||l(V,{...w})}).on("drag",V=>{const{transform:T,snapGrid:z,snapToGrid:H,nodeOrigin:v}=n(),M=dt(V.sourceEvent,{transform:T,snapGrid:z,snapToGrid:H,containerBounds:x}),S=[];if(!g)return;const{x:N,y:D,width:k,height:L}=w,B={},F=g.origin??v,{width:W,height:Y,x:K,y:U}=Du(m,_,M,f,u,F,C,A),R=W!==k,X=Y!==L,Z=K!==N&&R,ee=U!==D&&X;if(!Z&&!ee&&!R&&!X)return;if((Z||ee||F[0]===1||F[1]===1)&&(B.x=Z?K:w.x,B.y=ee?U:w.y,w.x=B.x,w.y=B.y,b.length>0)){const Q=K-N,te=U-D;for(const re of b)re.position={x:re.position.x-Q+F[0]*(W-k),y:re.position.y-te+F[1]*(Y-L)},S.push(re)}if((R||X)&&(B.width=R&&(!d||d==="horizontal")?W:w.width,B.height=X&&(!d||d==="vertical")?Y:w.height,w.width=B.width,w.height=B.height),E&&g.expandParent){const Q=F[0]*(B.width??0);B.x&&B.x<Q&&(w.x=Q,m.x=m.x-(B.x-Q));const te=F[1]*(B.height??0);B.y&&B.y<te&&(w.y=te,m.y=m.y-(B.y-te))}const j=Pu({width:w.width,prevWidth:k,height:w.height,prevHeight:L,affectsX:_.affectsX,affectsY:_.affectsY}),$={...w,direction:j};(p==null?void 0:p(V,$))!==!1&&(h==null||h(V,$),o(B,S))}).on("end",V=>{y==null||y(V,{...w}),r==null||r({...w})});i.call(O)}function a(){i.on(".drag",null)}return{update:s,destroy:a}}function Bu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qt={exports:{}},Un={},Jt={exports:{}},Zn={};/**
2
+ * @license React
3
+ * use-sync-external-store-shim.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Wr;function Vu(){if(Wr)return Zn;Wr=1;var e=P;function t(d,l){return d===l&&(d!==0||1/d===1/l)||d!==d&&l!==l}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(d,l){var h=l(),y=o({inst:{value:h,getSnapshot:l}}),p=y[0].inst,w=y[1];return i(function(){p.value=h,p.getSnapshot=l,c(p)&&w({inst:p})},[d,h,l]),r(function(){return c(p)&&w({inst:p}),d(function(){c(p)&&w({inst:p})})},[d]),s(h),h}function c(d){var l=d.getSnapshot;d=d.value;try{var h=l();return!n(d,h)}catch{return!0}}function f(d,l){return l()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:a;return Zn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Zn}var $n={};/**
10
+ * @license React
11
+ * use-sync-external-store-shim.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Rr;function Fu(){return Rr||(Rr=1,process.env.NODE_ENV!=="production"&&function(){function e(h,y){return h===y&&(h!==0||1/h===1/y)||h!==h&&y!==y}function t(h,y){u||r.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=y();if(!d){var w=y();i(p,w)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}w=s({inst:{value:p,getSnapshot:y}});var m=w[0].inst,_=w[1];return c(function(){m.value=p,m.getSnapshot=y,n(m)&&_({inst:m})},[h,p,y]),a(function(){return n(m)&&_({inst:m}),h(function(){n(m)&&_({inst:m})})},[h]),f(p),p}function n(h){var y=h.getSnapshot;h=h.value;try{var p=y();return!i(h,p)}catch{return!0}}function o(h,y){return y()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=P,i=typeof Object.is=="function"?Object.is:e,s=r.useState,a=r.useEffect,c=r.useLayoutEffect,f=r.useDebugValue,u=!1,d=!1,l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;$n.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:l,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),$n}var Gr;function Kr(){return Gr||(Gr=1,process.env.NODE_ENV==="production"?Jt.exports=Vu():Jt.exports=Fu()),Jt.exports}/**
18
+ * @license React
19
+ * use-sync-external-store-shim/with-selector.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var Ur;function Yu(){if(Ur)return Un;Ur=1;var e=P,t=Kr();function n(f,u){return f===u&&(f!==0||1/f===1/u)||f!==f&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return Un.useSyncExternalStoreWithSelector=function(f,u,d,l,h){var y=i(null);if(y.current===null){var p={hasValue:!1,value:null};y.current=p}else p=y.current;y=a(function(){function m(E){if(!_){if(_=!0,g=E,E=l(E),h!==void 0&&p.hasValue){var C=p.value;if(h(C,E))return x=C}return x=E}if(C=x,o(g,E))return C;var A=l(E);return h!==void 0&&h(C,A)?(g=E,C):(g=E,x=A)}var _=!1,g,x,b=d===void 0?null:d;return[function(){return m(u())},b===null?void 0:function(){return m(b())}]},[u,d,l,h]);var w=r(f,y[0],y[1]);return s(function(){p.hasValue=!0,p.value=w},[w]),c(w),w},Un}var Qn={};/**
26
+ * @license React
27
+ * use-sync-external-store-shim/with-selector.development.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Zr;function Xu(){return Zr||(Zr=1,process.env.NODE_ENV!=="production"&&function(){function e(f,u){return f===u&&(f!==0||1/f===1/u)||f!==f&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=P,n=Kr(),o=typeof Object.is=="function"?Object.is:e,r=n.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,c=t.useDebugValue;Qn.useSyncExternalStoreWithSelector=function(f,u,d,l,h){var y=i(null);if(y.current===null){var p={hasValue:!1,value:null};y.current=p}else p=y.current;y=a(function(){function m(E){if(!_){if(_=!0,g=E,E=l(E),h!==void 0&&p.hasValue){var C=p.value;if(h(C,E))return x=C}return x=E}if(C=x,o(g,E))return C;var A=l(E);return h!==void 0&&h(C,A)?(g=E,C):(g=E,x=A)}var _=!1,g,x,b=d===void 0?null:d;return[function(){return m(u())},b===null?void 0:function(){return m(b())}]},[u,d,l,h]);var w=r(f,y[0],y[1]);return s(function(){p.hasValue=!0,p.value=w},[w]),c(w),w},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Qn}var $r;function Wu(){return $r||($r=1,process.env.NODE_ENV==="production"?Qt.exports=Yu():Qt.exports=Xu()),Qt.exports}var Ru=Wu();const Gu=Bu(Ru),Ku={},Qr=e=>{let t;const n=new Set,o=(u,d)=>{const l=typeof u=="function"?u(t):u;if(!Object.is(l,t)){const h=t;t=d??(typeof l!="object"||l===null)?l:Object.assign({},t,l),n.forEach(y=>y(t,h))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>f,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Ku?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(o,r,c);return c},Uu=e=>e?Qr(e):Qr,{useDebugValue:Zu}=P,{useSyncExternalStoreWithSelector:$u}=Gu,Qu=e=>e;function Jr(e,t=Qu,n){const o=$u(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Zu(o),o}const jr=(e,t)=>{const n=Uu(e),o=(r,i=t)=>Jr(n,r,i);return Object.assign(o,n),o},Ju=(e,t)=>e?jr(e,t):jr;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const jt=P.createContext(null),ju=jt.Provider,qr=le.error001();function q(e,t){const n=P.useContext(jt);if(n===null)throw new Error(qr);return Jr(n,e,t)}function ne(){const e=P.useContext(jt);if(e===null)throw new Error(qr);return P.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ei={display:"none"},qu={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ti="react-flow__node-desc",ni="react-flow__edge-desc",ef="react-flow__aria-live",tf=e=>e.ariaLiveMessage,nf=e=>e.ariaLabelConfig;function of({rfId:e}){const t=q(tf);return I.jsx("div",{id:`${ef}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:qu,children:t})}function rf({rfId:e,disableKeyboardA11y:t}){const n=q(nf);return I.jsxs(I.Fragment,{children:[I.jsx("div",{id:`${ti}-${e}`,style:ei,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),I.jsx("div",{id:`${ni}-${e}`,style:ei,children:n["edge.a11yDescription.default"]}),!t&&I.jsx(of,{rfId:e})]})}const qt=P.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return I.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});qt.displayName="Panel";function sf({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:I.jsx(qt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:I.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const af=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},en=e=>e.id;function cf(e,t){return oe(e.selectedNodes.map(en),t.selectedNodes.map(en))&&oe(e.selectedEdges.map(en),t.selectedEdges.map(en))}function lf({onSelectionChange:e}){const t=ne(),{selectedNodes:n,selectedEdges:o}=q(af,cf);return P.useEffect(()=>{const r={nodes:n,edges:o};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const uf=e=>!!e.onSelectionChangeHandlers;function ff({onSelectionChange:e}){const t=q(uf);return e||t?I.jsx(lf,{onSelectionChange:e}):null}const oi=[0,0],df={x:0,y:0,zoom:1},ri=[...["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","paneClickDistance","ariaLabelConfig"],"rfId"],hf=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}),ii={translateExtent:st,nodeOrigin:oi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function gf(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c,setPaneClickDistance:f}=q(hf,oe),u=ne();P.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=ii,a()}),[]);const d=P.useRef(ii);return P.useEffect(()=>{for(const l of ri){const h=e[l],y=d.current[l];h!==y&&(typeof e[l]>"u"||(l==="nodes"?t(h):l==="edges"?n(h):l==="minZoom"?o(h):l==="maxZoom"?r(h):l==="translateExtent"?i(h):l==="nodeExtent"?s(h):l==="paneClickDistance"?f(h):l==="ariaLabelConfig"?u.setState({ariaLabelConfig:Jl(h)}):l==="fitView"?u.setState({fitViewQueued:h}):l==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[l]:h})))}d.current=e},ri.map(l=>e[l])),null}function si(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function pf(e){var o;const[t,n]=P.useState(e==="system"?null:e);return P.useEffect(()=>{if(e!=="system"){n(e);return}const r=si(),i=()=>n(r!=null&&r.matches?"dark":"light");return i(),r==null||r.addEventListener("change",i),()=>{r==null||r.removeEventListener("change",i)}},[e]),t!==null?t:(o=si())!=null&&o.matches?"dark":"light"}const ai=typeof document<"u"?document:null;function gt(e=null,t={target:ai,actInsideInputWithModifier:!0}){const[n,o]=P.useState(!1),r=P.useRef(!1),i=P.useRef(new Set([])),[s,a]=P.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
34
+ `).replace(`
35
+
36
+ `,`
37
+ +`).split(`
38
+ `)),u=f.reduce((d,l)=>d.concat(...l),[]);return[f,u]}return[[],[]]},[e]);return P.useEffect(()=>{const c=(t==null?void 0:t.target)??ai,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const u=h=>{var w,m;if(r.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!r.current||r.current&&!f)&&yr(h))return!1;const p=li(h.code,a);if(i.current.add(h[p]),ci(s,i.current,!1)){const _=((m=(w=h.composedPath)==null?void 0:w.call(h))==null?void 0:m[0])||h.target,g=(_==null?void 0:_.nodeName)==="BUTTON"||(_==null?void 0:_.nodeName)==="A";t.preventDefault!==!1&&(r.current||!g)&&h.preventDefault(),o(!0)}},d=h=>{const y=li(h.code,a);ci(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(h[y]),h.key==="Meta"&&i.current.clear(),r.current=!1},l=()=>{i.current.clear(),o(!1)};return c==null||c.addEventListener("keydown",u),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",l),window.addEventListener("contextmenu",l),()=>{c==null||c.removeEventListener("keydown",u),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",l),window.removeEventListener("contextmenu",l)}}},[e,o]),n}function ci(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function li(e,t){return t.includes(e)?"code":"key"}const yf=()=>{const e=ne();return P.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),c=Ln(t,o,r,i,s,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:c}=s.getBoundingClientRect(),f={x:t.x-a,y:t.y-c},u=n.snapGrid??r,d=n.snapToGrid??i;return ft(f,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=Gt(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function ui(e,t){const n=[],o=new Map,r=[];for(const i of e)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{const s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(const i of t){const s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const c of s)mf(c,a);n.push(a)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function mf(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??(t.measured={}),t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function fi(e,t){return ui(e,t)}function di(e,t){return ui(e,t)}function Le(e,t){return{id:e,type:"select",selected:t}}function Ke(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(Le(i.id,s)))}return o}function hi({items:e=[],lookup:t}){var r;const n=[],o=new Map(e.map(i=>[i.id,i]));for(const[i,s]of e.entries()){const a=t.get(s.id),c=((r=a==null?void 0:a.internals)==null?void 0:r.userNode)??a;c!==void 0&&c!==s&&n.push({id:s.id,item:s,type:"replace"}),c===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of t)o.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function gi(e){return{id:e.id,type:"remove"}}const pi=e=>Xl(e),wf=e=>rr(e);function yi(e){return P.forwardRef(e)}const xf=typeof window<"u"?P.useLayoutEffect:P.useEffect;function mi(e){const[t,n]=P.useState(BigInt(0)),[o]=P.useState(()=>vf(()=>n(r=>r+BigInt(1))));return xf(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function vf(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const wi=P.createContext(null);function bf({children:e}){const t=ne(),n=P.useCallback(a=>{const{nodes:c=[],setNodes:f,hasDefaultNodes:u,onNodesChange:d,nodeLookup:l,fitViewQueued:h}=t.getState();let y=c;for(const w of a)y=typeof w=="function"?w(y):w;const p=hi({items:y,lookup:l});u&&f(y),p.length>0?d==null||d(p):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:w,nodes:m,setNodes:_}=t.getState();w&&_(m)})},[]),o=mi(n),r=P.useCallback(a=>{const{edges:c=[],setEdges:f,hasDefaultEdges:u,onEdgesChange:d,edgeLookup:l}=t.getState();let h=c;for(const y of a)h=typeof y=="function"?y(h):y;u?f(h):d&&d(hi({items:h,lookup:l}))},[]),i=mi(r),s=P.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return I.jsx(wi.Provider,{value:s,children:e})}function _f(){const e=P.useContext(wi);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Sf=e=>!!e.panZoom;function Jn(){const e=yf(),t=ne(),n=_f(),o=q(Sf),r=P.useMemo(()=>{const i=d=>t.getState().nodeLookup.get(d),s=d=>{n.nodeQueue.push(d)},a=d=>{n.edgeQueue.push(d)},c=d=>{var m,_;const{nodeLookup:l,nodeOrigin:h}=t.getState(),y=pi(d)?d:l.get(d.id),p=y.parentId?hr(y.position,y.measured,y.parentId,l,h):y.position,w={...y,position:p,width:((m=y.measured)==null?void 0:m.width)??y.width,height:((_=y.measured)==null?void 0:_.height)??y.height};return Ye(w)},f=(d,l,h={replace:!1})=>{s(y=>y.map(p=>{if(p.id===d){const w=typeof l=="function"?l(p):l;return h.replace&&pi(w)?w:{...p,...w}}return p}))},u=(d,l,h={replace:!1})=>{a(y=>y.map(p=>{if(p.id===d){const w=typeof l=="function"?l(p):l;return h.replace&&wf(w)?w:{...p,...w}}return p}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var l;return(l=i(d))==null?void 0:l.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(l=>({...l}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:s,setEdges:a,addNodes:d=>{const l=Array.isArray(d)?d:[d];n.nodeQueue.push(h=>[...h,...l])},addEdges:d=>{const l=Array.isArray(d)?d:[d];n.edgeQueue.push(h=>[...h,...l])},toObject:()=>{const{nodes:d=[],edges:l=[],transform:h}=t.getState(),[y,p,w]=h;return{nodes:d.map(m=>({...m})),edges:l.map(m=>({...m})),viewport:{x:y,y:p,zoom:w}}},deleteElements:async({nodes:d=[],edges:l=[]})=>{const{nodes:h,edges:y,onNodesDelete:p,onEdgesDelete:w,triggerNodeChanges:m,triggerEdgeChanges:_,onDelete:g,onBeforeDelete:x}=t.getState(),{nodes:b,edges:E}=await Ul({nodesToRemove:d,edgesToRemove:l,nodes:h,edges:y,onBeforeDelete:x}),C=E.length>0,A=b.length>0;if(C){const O=E.map(gi);w==null||w(E),_(O)}if(A){const O=b.map(gi);p==null||p(b),m(O)}return(A||C)&&(g==null||g({nodes:b,edges:E})),{deletedNodes:b,deletedEdges:E}},getIntersectingNodes:(d,l=!0,h)=>{const y=ur(d),p=y?d:c(d),w=h!==void 0;return p?(h||t.getState().nodes).filter(m=>{const _=t.getState().nodeLookup.get(m.id);if(_&&!y&&(m.id===d.id||!_.internals.positionAbsolute))return!1;const g=Ye(w?m:_),x=ut(g,p);return l&&x>0||x>=p.width*p.height}):[]},isNodeIntersecting:(d,l,h=!0)=>{const p=ur(d)?d:c(d);if(!p)return!1;const w=ut(p,l);return h&&w>0||w>=p.width*p.height},updateNode:f,updateNodeData:(d,l,h={replace:!1})=>{f(d,y=>{const p=typeof l=="function"?l(y):l;return h.replace?{...y,data:p}:{...y,data:{...y.data,...p}}},h)},updateEdge:u,updateEdgeData:(d,l,h={replace:!1})=>{u(d,y=>{const p=typeof l=="function"?l(y):l;return h.replace?{...y,data:p}:{...y,data:{...y.data,...p}}},h)},getNodesBounds:d=>{const{nodeLookup:l,nodeOrigin:h}=t.getState();return Wl(d,{nodeLookup:l,nodeOrigin:h})},getHandleConnections:({type:d,id:l,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}-${d}${l?`-${l}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:d,handleId:l,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}${d?l?`-${d}-${l}`:`-${d}`:""}`))==null?void 0:y.values())??[])},fitView:async d=>{const l=t.getState().fitViewResolver??Ql();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:l}),n.nodeQueue.push(h=>[...h]),l.promise}}},[]);return P.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const xi=e=>e.selected,Ef=typeof window<"u"?window:void 0;function Cf({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ne(),{deleteElements:o}=Jn(),r=gt(e,{actInsideInputWithModifier:!1}),i=gt(t,{target:Ef});P.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter(xi),edges:s.filter(xi)}),n.setState({nodesSelectionActive:!1})}},[r]),P.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Nf(e){const t=ne();P.useEffect(()=>{const n=()=>{var r,i;if(!e.current)return!1;const o=On(e.current);(o.height===0||o.width===0)&&((i=(r=t.getState()).onError)==null||i.call(r,"004",le.error004())),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const tn={position:"absolute",width:"100%",height:"100%",top:0,left:0},Mf=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function kf({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=Te.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:f,minZoom:u,maxZoom:d,zoomActivationKeyCode:l,preventScrolling:h=!0,children:y,noWheelClassName:p,noPanClassName:w,onViewportChange:m,isControlledViewport:_,paneClickDistance:g}){const x=ne(),b=P.useRef(null),{userSelectionActive:E,lib:C}=q(Mf,oe),A=gt(l),O=P.useRef();Nf(b);const V=P.useCallback(T=>{m==null||m({x:T[0],y:T[1],zoom:T[2]}),_||x.setState({transform:T})},[m,_]);return P.useEffect(()=>{if(b.current){O.current=Iu({domNode:b.current,minZoom:u,maxZoom:d,translateExtent:f,viewport:c,paneClickDistance:g,onDraggingChange:v=>x.setState({paneDragging:v}),onPanZoomStart:(v,M)=>{const{onViewportChangeStart:S,onMoveStart:N}=x.getState();N==null||N(v,M),S==null||S(M)},onPanZoom:(v,M)=>{const{onViewportChange:S,onMove:N}=x.getState();N==null||N(v,M),S==null||S(M)},onPanZoomEnd:(v,M)=>{const{onViewportChangeEnd:S,onMoveEnd:N}=x.getState();N==null||N(v,M),S==null||S(M)}});const{x:T,y:z,zoom:H}=O.current.getViewport();return x.setState({panZoom:O.current,transform:[T,z,H],domNode:b.current.closest(".react-flow")}),()=>{var v;(v=O.current)==null||v.destroy()}}},[]),P.useEffect(()=>{var T;(T=O.current)==null||T.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:A,preventScrolling:h,noPanClassName:w,userSelectionActive:E,noWheelClassName:p,lib:C,onTransformChange:V})},[e,t,n,o,r,i,s,a,A,h,w,E,p,C,V]),I.jsx("div",{className:"react-flow__renderer",ref:b,style:tn,children:y})}const Af=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function If(){const{userSelectionActive:e,userSelectionRect:t}=q(Af,oe);return e&&t?I.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const jn=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Pf=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Tf({isSelecting:e,selectionKeyPressed:t,selectionMode:n=at.Full,panOnDrag:o,selectionOnDrag:r,onSelectionStart:i,onSelectionEnd:s,onPaneClick:a,onPaneContextMenu:c,onPaneScroll:f,onPaneMouseEnter:u,onPaneMouseMove:d,onPaneMouseLeave:l,children:h}){const y=ne(),{userSelectionActive:p,elementsSelectable:w,dragging:m,connectionInProgress:_}=q(Pf,oe),g=w&&(e||p),x=P.useRef(null),b=P.useRef(),E=P.useRef(new Set),C=P.useRef(new Set),A=P.useRef(!1),O=P.useRef(!1),V=N=>{if(A.current||_){A.current=!1;return}a==null||a(N),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},T=N=>{if(Array.isArray(o)&&(o!=null&&o.includes(2))){N.preventDefault();return}c==null||c(N)},z=f?N=>f(N):void 0,H=N=>{var F,W;const{resetSelectedElements:D,domNode:k}=y.getState();if(b.current=k==null?void 0:k.getBoundingClientRect(),!w||!e||N.button!==0||N.target!==x.current||!b.current)return;(W=(F=N.target)==null?void 0:F.setPointerCapture)==null||W.call(F,N.pointerId),O.current=!0,A.current=!1;const{x:L,y:B}=me(N.nativeEvent,b.current);D(),y.setState({userSelectionRect:{width:0,height:0,startX:L,startY:B,x:L,y:B}}),i==null||i(N)},v=N=>{const{userSelectionRect:D,transform:k,nodeLookup:L,edgeLookup:B,connectionLookup:F,triggerNodeChanges:W,triggerEdgeChanges:Y,defaultEdgeOptions:K}=y.getState();if(!b.current||!D)return;A.current=!0;const{x:U,y:R}=me(N.nativeEvent,b.current),{startX:X,startY:Z}=D,ee={startX:X,startY:Z,x:U<X?U:X,y:R<Z?R:Z,width:Math.abs(U-X),height:Math.abs(R-Z)},j=E.current,$=C.current;E.current=new Set(Tn(L,ee,k,n===at.Partial,!0).map(Q=>Q.id)),C.current=new Set;const J=(K==null?void 0:K.selectable)??!0;for(const Q of E.current){const te=F.get(Q);if(te)for(const{edgeId:re}of te.values()){const _e=B.get(re);_e&&(_e.selectable??J)&&C.current.add(re)}}if(!gr(j,E.current)){const Q=Ke(L,E.current,!0);W(Q)}if(!gr($,C.current)){const Q=Ke(B,C.current);Y(Q)}y.setState({userSelectionRect:ee,userSelectionActive:!0,nodesSelectionActive:!1})},M=N=>{var k,L;if(N.button!==0||!O.current)return;(L=(k=N.target)==null?void 0:k.releasePointerCapture)==null||L.call(k,N.pointerId);const{userSelectionRect:D}=y.getState();!p&&D&&N.target===x.current&&(V==null||V(N)),y.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:E.current.size>0}),s==null||s(N),(t||r)&&(A.current=!1),O.current=!1},S=o===!0||Array.isArray(o)&&o.includes(0);return I.jsxs("div",{className:ie(["react-flow__pane",{draggable:S,dragging:m,selection:e}]),onClick:g?void 0:jn(V,x),onContextMenu:jn(T,x),onWheel:jn(z,x),onPointerEnter:g?void 0:u,onPointerDown:g?H:d,onPointerMove:g?v:d,onPointerUp:g?M:void 0,onPointerLeave:l,ref:x,style:tn,children:[h,I.jsx(If,{})]})}function qn({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:c}=t.getState(),f=a.get(e);if(!f){c==null||c("012",le.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&s)&&(i({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var u;return(u=o==null?void 0:o.current)==null?void 0:u.blur()})):r([e])}function vi({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=ne(),[c,f]=P.useState(!1),u=P.useRef();return P.useEffect(()=>{u.current=pu({getStoreItems:()=>a.getState(),onNodeMouseDown:d=>{qn({id:d,store:a,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}})},[]),P.useEffect(()=>{var d,l;if(t)(d=u.current)==null||d.destroy();else if(e.current)return(l=u.current)==null||l.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s}),()=>{var h;(h=u.current)==null||h.destroy()}},[n,o,t,i,e,r]),c}const Df=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function bi(){const e=ne();return P.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:c,nodeLookup:f,nodeOrigin:u}=e.getState(),d=new Map,l=Df(s),h=r?i[0]:5,y=r?i[1]:5,p=n.direction.x*h*n.factor,w=n.direction.y*y*n.factor;for(const[,m]of f){if(!l(m))continue;let _={x:m.internals.positionAbsolute.x+p,y:m.internals.positionAbsolute.y+w};r&&(_=Rt(_,i));const{position:g,positionAbsolute:x}=ir({nodeId:m.id,nextPosition:_,nodeLookup:f,nodeExtent:o,nodeOrigin:u,onError:a});m.position=g,m.internals.positionAbsolute=x,d.set(m.id,m)}c(d)},[])}const eo=P.createContext(null),Lf=eo.Provider;eo.Consumer;const _i=()=>P.useContext(eo),Of=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Hf=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:c,isValid:f}=s,u=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:u,clickConnecting:(r==null?void 0:r.nodeId)===e&&(r==null?void 0:r.id)===t&&(r==null?void 0:r.type)===n,isPossibleEndHandle:i===Ve.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&f}};function zf({type:e="source",position:t=G.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:c,className:f,onMouseDown:u,onTouchStart:d,...l},h){var M,S;const y=s||null,p=e==="target",w=ne(),m=_i(),{connectOnClick:_,noPanClassName:g,rfId:x}=q(Of,oe),{connectingFrom:b,connectingTo:E,clickConnecting:C,isPossibleEndHandle:A,connectionInProcess:O,clickConnectionInProcess:V,valid:T}=q(Hf(m,y,e),oe);m||(S=(M=w.getState()).onError)==null||S.call(M,"010",le.error010());const z=N=>{const{defaultEdgeOptions:D,onConnect:k,hasDefaultEdges:L}=w.getState(),B={...D,...N};if(L){const{edges:F,setEdges:W}=w.getState();W(Sr(B,F))}k==null||k(B),a==null||a(B)},H=N=>{if(!m)return;const D=mr(N.nativeEvent);if(r&&(D&&N.button===0||!D)){const k=w.getState();Rn.onPointerDown(N.nativeEvent,{autoPanOnConnect:k.autoPanOnConnect,connectionMode:k.connectionMode,connectionRadius:k.connectionRadius,domNode:k.domNode,nodeLookup:k.nodeLookup,lib:k.lib,isTarget:p,handleId:y,nodeId:m,flowId:k.rfId,panBy:k.panBy,cancelConnection:k.cancelConnection,onConnectStart:k.onConnectStart,onConnectEnd:k.onConnectEnd,updateConnection:k.updateConnection,onConnect:z,isValidConnection:n||k.isValidConnection,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:k.autoPanSpeed,dragThreshold:k.connectionDragThreshold})}D?u==null||u(N):d==null||d(N)},v=N=>{const{onClickConnectStart:D,onClickConnectEnd:k,connectionClickStartHandle:L,connectionMode:B,isValidConnection:F,lib:W,rfId:Y,nodeLookup:K,connection:U}=w.getState();if(!m||!L&&!r)return;if(!L){D==null||D(N.nativeEvent,{nodeId:m,handleId:y,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:m,type:e,id:y}});return}const R=pr(N.target),X=n||F,{connection:Z,isValid:ee}=Rn.isValid(N.nativeEvent,{handle:{nodeId:m,id:y,type:e},connectionMode:B,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:X,flowId:Y,doc:R,lib:W,nodeLookup:K});ee&&Z&&z(Z);const j=structuredClone(U);delete j.inProgress,j.toPosition=j.toHandle?j.toHandle.position:null,k==null||k(N,j),w.setState({connectionClickStartHandle:null})};return I.jsx("div",{"data-handleid":y,"data-nodeid":m,"data-handlepos":t,"data-id":`${x}-${m}-${y}-${e}`,className:ie(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,f,{source:!p,target:p,connectable:o,connectablestart:r,connectableend:i,clickconnecting:C,connectingfrom:b,connectingto:E,valid:T,connectionindicator:o&&(!O||A)&&(O||V?i:r)}]),onMouseDown:H,onTouchStart:H,onClick:_?v:void 0,ref:h,...l,children:c})}const nn=P.memo(yi(zf));function Bf({data:e,isConnectable:t,sourcePosition:n=G.Bottom}){return I.jsxs(I.Fragment,{children:[e==null?void 0:e.label,I.jsx(nn,{type:"source",position:n,isConnectable:t})]})}function Vf({data:e,isConnectable:t,targetPosition:n=G.Top,sourcePosition:o=G.Bottom}){return I.jsxs(I.Fragment,{children:[I.jsx(nn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,I.jsx(nn,{type:"source",position:o,isConnectable:t})]})}function Ff(){return null}function Yf({data:e,isConnectable:t,targetPosition:n=G.Top}){return I.jsxs(I.Fragment,{children:[I.jsx(nn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const on={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Si={input:Bf,default:Vf,output:Yf,group:Ff};function Xf(e){var t,n,o,r;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((o=e.style)==null?void 0:o.width),height:e.height??((r=e.style)==null?void 0:r.height)}}const Wf=e=>{const{width:t,height:n,x:o,y:r}=lt(e.nodeLookup,{filter:i=>!!i.selected});return{width:he(t)?t:null,height:he(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 Rf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=ne(),{width:r,height:i,transformString:s,userSelectionActive:a}=q(Wf,oe),c=bi(),f=P.useRef(null);if(P.useEffect(()=>{var l;n||(l=f.current)==null||l.focus({preventScroll:!0})},[n]),vi({nodeRef:f}),a||!r||!i)return null;const u=e?l=>{const h=o.getState().nodes.filter(y=>y.selected);e(l,h)}:void 0,d=l=>{Object.prototype.hasOwnProperty.call(on,l.key)&&(l.preventDefault(),c({direction:on[l.key],factor:l.shiftKey?4:1}))};return I.jsx("div",{className:ie(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:I.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:r,height:i}})})}const Ei=typeof window<"u"?window:void 0,Gf=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Ci({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:f,selectionOnDrag:u,selectionMode:d,onSelectionStart:l,onSelectionEnd:h,multiSelectionKeyCode:y,panActivationKeyCode:p,zoomActivationKeyCode:w,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:g,panOnScroll:x,panOnScrollSpeed:b,panOnScrollMode:E,zoomOnDoubleClick:C,panOnDrag:A,defaultViewport:O,translateExtent:V,minZoom:T,maxZoom:z,preventScrolling:H,onSelectionContextMenu:v,noWheelClassName:M,noPanClassName:S,disableKeyboardA11y:N,onViewportChange:D,isControlledViewport:k}){const{nodesSelectionActive:L,userSelectionActive:B}=q(Gf),F=gt(f,{target:Ei}),W=gt(p,{target:Ei}),Y=W||A,K=W||x,U=u&&Y!==!0,R=F||B||U;return Cf({deleteKeyCode:c,multiSelectionKeyCode:y}),I.jsx(kf,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:g,panOnScroll:K,panOnScrollSpeed:b,panOnScrollMode:E,zoomOnDoubleClick:C,panOnDrag:!F&&Y,defaultViewport:O,translateExtent:V,minZoom:T,maxZoom:z,zoomActivationKeyCode:w,preventScrolling:H,noWheelClassName:M,noPanClassName:S,onViewportChange:D,isControlledViewport:k,paneClickDistance:a,children:I.jsxs(Tf,{onSelectionStart:l,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:Y,isSelecting:!!R,selectionMode:d,selectionKeyPressed:F,selectionOnDrag:U,children:[e,L&&I.jsx(Rf,{onSelectionContextMenu:v,noPanClassName:S,disableKeyboardA11y:N})]})})}Ci.displayName="FlowRenderer";const Kf=P.memo(Ci),Uf=e=>t=>e?Tn(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Zf(e){return q(P.useCallback(Uf(e),[e]),oe)}const $f=e=>e.updateNodeInternals;function Qf(){const e=q($f),[t]=P.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),e(o)}));return P.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Jf({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=ne(),i=P.useRef(null),s=P.useRef(null),a=P.useRef(e.sourcePosition),c=P.useRef(e.targetPosition),f=P.useRef(t),u=n&&!!e.internals.handleBounds;return P.useEffect(()=>{i.current&&!e.hidden&&(!u||s.current!==i.current)&&(s.current&&(o==null||o.unobserve(s.current)),o==null||o.observe(i.current),s.current=i.current)},[u,e.hidden]),P.useEffect(()=>()=>{s.current&&(o==null||o.unobserve(s.current),s.current=null)},[]),P.useEffect(()=>{if(i.current){const d=f.current!==t,l=a.current!==e.sourcePosition,h=c.current!==e.targetPosition;(d||l||h)&&(f.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function jf({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:c,nodesConnectable:f,nodesFocusable:u,resizeObserver:d,noDragClassName:l,noPanClassName:h,disableKeyboardA11y:y,rfId:p,nodeTypes:w,nodeClickDistance:m,onError:_}){const{node:g,internals:x,isParent:b}=q(X=>{const Z=X.nodeLookup.get(e),ee=X.parentLookup.has(e);return{node:Z,internals:Z.internals,isParent:ee}},oe);let E=g.type||"default",C=(w==null?void 0:w[E])||Si[E];C===void 0&&(_==null||_("003",le.error003(E)),E="default",C=Si.default);const A=!!(g.draggable||a&&typeof g.draggable>"u"),O=!!(g.selectable||c&&typeof g.selectable>"u"),V=!!(g.connectable||f&&typeof g.connectable>"u"),T=!!(g.focusable||u&&typeof g.focusable>"u"),z=ne(),H=dr(g),v=Jf({node:g,nodeType:E,hasDimensions:H,resizeObserver:d}),M=vi({nodeRef:v,disabled:g.hidden||!A,noDragClassName:l,handleSelector:g.dragHandle,nodeId:e,isSelectable:O,nodeClickDistance:m}),S=bi();if(g.hidden)return null;const N=be(g),D=Xf(g),k=O||A||t||n||o||r,L=n?X=>n(X,{...x.userNode}):void 0,B=o?X=>o(X,{...x.userNode}):void 0,F=r?X=>r(X,{...x.userNode}):void 0,W=i?X=>i(X,{...x.userNode}):void 0,Y=s?X=>s(X,{...x.userNode}):void 0,K=X=>{const{selectNodesOnDrag:Z,nodeDragThreshold:ee}=z.getState();O&&(!Z||!A||ee>0)&&qn({id:e,store:z,nodeRef:v}),t&&t(X,{...x.userNode})},U=X=>{if(!(yr(X.nativeEvent)||y)){if(qo.includes(X.key)&&O){const Z=X.key==="Escape";qn({id:e,store:z,unselect:Z,nodeRef:v})}else if(A&&g.selected&&Object.prototype.hasOwnProperty.call(on,X.key)){X.preventDefault();const{ariaLabelConfig:Z}=z.getState();z.setState({ariaLiveMessage:Z["node.a11yDescription.ariaLiveMessage"]({direction:X.key.replace("Arrow","").toLowerCase(),x:~~x.positionAbsolute.x,y:~~x.positionAbsolute.y})}),S({direction:on[X.key],factor:X.shiftKey?4:1})}}},R=()=>{var Q;if(y||!((Q=v.current)!=null&&Q.matches(":focus-visible")))return;const{transform:X,width:Z,height:ee,autoPanOnNodeFocus:j,setCenter:$}=z.getState();if(!j)return;Tn(new Map([[e,g]]),{x:0,y:0,width:Z,height:ee},X,!0).length>0||$(g.position.x+N.width/2,g.position.y+N.height/2,{zoom:X[2]})};return I.jsx("div",{className:ie(["react-flow__node",`react-flow__node-${E}`,{[h]:A},g.className,{selected:g.selected,selectable:O,parent:b,draggable:A,dragging:M}]),ref:v,style:{zIndex:x.z,transform:`translate(${x.positionAbsolute.x}px,${x.positionAbsolute.y}px)`,pointerEvents:k?"all":"none",visibility:H?"visible":"hidden",...g.style,...D},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:B,onMouseLeave:F,onContextMenu:W,onClick:K,onDoubleClick:Y,onKeyDown:T?U:void 0,tabIndex:T?0:void 0,onFocus:T?R:void 0,role:g.ariaRole??(T?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${ti}-${p}`,"aria-label":g.ariaLabel,...g.domAttributes,children:I.jsx(Lf,{value:e,children:I.jsx(C,{id:e,data:g.data,type:E,positionAbsoluteX:x.positionAbsolute.x,positionAbsoluteY:x.positionAbsolute.y,selected:g.selected??!1,selectable:O,draggable:A,deletable:g.deletable??!0,isConnectable:V,sourcePosition:g.sourcePosition,targetPosition:g.targetPosition,dragging:M,dragHandle:g.dragHandle,zIndex:x.z,parentId:g.parentId,...N})})})}const qf=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ni(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:i}=q(qf,oe),s=Zf(e.onlyRenderVisibleElements),a=Qf();return I.jsx("div",{className:"react-flow__nodes",style:tn,children:s.map(c=>I.jsx(jf,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}Ni.displayName="NodeRenderer";const ed=P.memo(Ni);function td(e){return q(P.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&eu({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),oe)}const nd=({color:e="none",strokeWidth:t=1})=>I.jsx("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),od=({color:e="none",strokeWidth:t=1})=>I.jsx("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Mi={[Ft.Arrow]:nd,[Ft.ArrowClosed]:od};function rd(e){const t=ne();return P.useMemo(()=>{var r,i;return Object.prototype.hasOwnProperty.call(Mi,e)?Mi[e]:((i=(r=t.getState()).onError)==null||i.call(r,"009",le.error009(e)),null)},[e])}const id=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const c=rd(t);return c?I.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:I.jsx(c,{color:n,strokeWidth:s})}):null},ki=({defaultColor:e,rfId:t})=>{const n=q(i=>i.edges),o=q(i=>i.defaultEdgeOptions),r=P.useMemo(()=>au(n,{id:t,defaultColor:e,defaultMarkerStart:o==null?void 0:o.markerStart,defaultMarkerEnd:o==null?void 0:o.markerEnd}),[n,o,t,e]);return r.length?I.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:I.jsx("defs",{children:r.map(i=>I.jsx(id,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};ki.displayName="MarkerDefinitions";var sd=P.memo(ki);function Ai({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:c,className:f,...u}){const[d,l]=P.useState({x:1,y:0,width:0,height:0}),h=ie(["react-flow__edge-textwrapper",f]),y=P.useRef(null);return P.useEffect(()=>{if(y.current){const p=y.current.getBBox();l({x:p.x,y:p.y,width:p.width,height:p.height})}},[n]),n?I.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:h,visibility:d.width?"visible":"hidden",...u,children:[r&&I.jsx("rect",{width:d.width+2*s[0],x:-s[0],y:-s[1],height:d.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),I.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:y,style:o,children:n}),c]}):null}Ai.displayName="EdgeText";const ad=P.memo(Ai);function rn({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:f=20,...u}){return I.jsxs(I.Fragment,{children:[I.jsx("path",{...u,d:e,fill:"none",className:ie(["react-flow__edge-path",u.className])}),f&&I.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}),o&&he(t)&&he(n)?I.jsx(ad,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function Ii({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===G.Left||e===G.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function Pi({sourceX:e,sourceY:t,sourcePosition:n=G.Bottom,targetX:o,targetY:r,targetPosition:i=G.Top}){const[s,a]=Ii({pos:n,x1:e,y1:t,x2:o,y2:r}),[c,f]=Ii({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,l,h]=xr({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:c,targetControlY:f});return[`M${e},${t} C${s},${a} ${c},${f} ${o},${r}`,u,d,l,h]}function Ti(e){return P.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:c,labelStyle:f,labelShowBg:u,labelBgStyle:d,labelBgPadding:l,labelBgBorderRadius:h,style:y,markerEnd:p,markerStart:w,interactionWidth:m})=>{const[_,g,x]=Pi({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),b=e.isInternal?void 0:t;return I.jsx(rn,{id:b,path:_,labelX:g,labelY:x,label:c,labelStyle:f,labelShowBg:u,labelBgStyle:d,labelBgPadding:l,labelBgBorderRadius:h,style:y,markerEnd:p,markerStart:w,interactionWidth:m})})}const cd=Ti({isInternal:!1}),Di=Ti({isInternal:!0});cd.displayName="SimpleBezierEdge",Di.displayName="SimpleBezierEdgeInternal";function Li(e){return P.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:d,style:l,sourcePosition:h=G.Bottom,targetPosition:y=G.Top,markerEnd:p,markerStart:w,pathOptions:m,interactionWidth:_})=>{const[g,x,b]=Hn({sourceX:n,sourceY:o,sourcePosition:h,targetX:r,targetY:i,targetPosition:y,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset}),E=e.isInternal?void 0:t;return I.jsx(rn,{id:E,path:g,labelX:x,labelY:b,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:d,style:l,markerEnd:p,markerStart:w,interactionWidth:_})})}const Oi=Li({isInternal:!1}),Hi=Li({isInternal:!0});Oi.displayName="SmoothStepEdge",Hi.displayName="SmoothStepEdgeInternal";function zi(e){return P.memo(({id:t,...n})=>{var r;const o=e.isInternal?void 0:t;return I.jsx(Oi,{...n,id:o,pathOptions:P.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(r=n.pathOptions)==null?void 0:r.offset])})})}const ld=zi({isInternal:!1}),Bi=zi({isInternal:!0});ld.displayName="StepEdge",Bi.displayName="StepEdgeInternal";function Vi(e){return P.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:d,style:l,markerEnd:h,markerStart:y,interactionWidth:p})=>{const[w,m,_]=Er({sourceX:n,sourceY:o,targetX:r,targetY:i}),g=e.isInternal?void 0:t;return I.jsx(rn,{id:g,path:w,labelX:m,labelY:_,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:f,labelBgPadding:u,labelBgBorderRadius:d,style:l,markerEnd:h,markerStart:y,interactionWidth:p})})}const ud=Vi({isInternal:!1}),Fi=Vi({isInternal:!0});ud.displayName="StraightEdge",Fi.displayName="StraightEdgeInternal";function Yi(e){return P.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=G.Bottom,targetPosition:a=G.Top,label:c,labelStyle:f,labelShowBg:u,labelBgStyle:d,labelBgPadding:l,labelBgBorderRadius:h,style:y,markerEnd:p,markerStart:w,pathOptions:m,interactionWidth:_})=>{const[g,x,b]=br({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:m==null?void 0:m.curvature}),E=e.isInternal?void 0:t;return I.jsx(rn,{id:E,path:g,labelX:x,labelY:b,label:c,labelStyle:f,labelShowBg:u,labelBgStyle:d,labelBgPadding:l,labelBgBorderRadius:h,style:y,markerEnd:p,markerStart:w,interactionWidth:_})})}const fd=Yi({isInternal:!1}),Xi=Yi({isInternal:!0});fd.displayName="BezierEdge",Xi.displayName="BezierEdgeInternal";const Wi={default:Xi,straight:Fi,step:Bi,smoothstep:Hi,simplebezier:Di},Ri={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},dd=(e,t,n)=>n===G.Left?e-t:n===G.Right?e+t:e,hd=(e,t,n)=>n===G.Top?e-t:n===G.Bottom?e+t:e,Gi="react-flow__edgeupdater";function Ki({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return I.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ie([Gi,`${Gi}-${a}`]),cx:dd(t,o,e),cy:hd(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function gd({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:c,onReconnect:f,onReconnectStart:u,onReconnectEnd:d,setReconnecting:l,setUpdateHover:h}){const y=ne(),p=(x,b)=>{if(x.button!==0)return;const{autoPanOnConnect:E,domNode:C,isValidConnection:A,connectionMode:O,connectionRadius:V,lib:T,onConnectStart:z,onConnectEnd:H,cancelConnection:v,nodeLookup:M,rfId:S,panBy:N,updateConnection:D}=y.getState(),k=b.type==="target",L=(W,Y)=>{l(!1),d==null||d(W,n,b.type,Y)},B=W=>f==null?void 0:f(n,W),F=(W,Y)=>{l(!0),u==null||u(x,n,b.type),z==null||z(W,Y)};Rn.onPointerDown(x.nativeEvent,{autoPanOnConnect:E,connectionMode:O,connectionRadius:V,domNode:C,handleId:b.id,nodeId:b.nodeId,nodeLookup:M,isTarget:k,edgeUpdaterType:b.type,lib:T,flowId:S,cancelConnection:v,panBy:N,isValidConnection:A,onConnect:B,onConnectStart:F,onConnectEnd:H,onReconnectEnd:L,updateConnection:D,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold})},w=x=>p(x,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=x=>p(x,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),_=()=>h(!0),g=()=>h(!1);return I.jsxs(I.Fragment,{children:[(e===!0||e==="source")&&I.jsx(Ki,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:w,onMouseEnter:_,onMouseOut:g,type:"source"}),(e===!0||e==="target")&&I.jsx(Ki,{position:c,centerX:i,centerY:s,radius:t,onMouseDown:m,onMouseEnter:_,onMouseOut:g,type:"target"})]})}function pd({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:f,reconnectRadius:u,onReconnect:d,onReconnectStart:l,onReconnectEnd:h,rfId:y,edgeTypes:p,noPanClassName:w,onError:m,disableKeyboardA11y:_}){let g=q($=>$.edgeLookup.get(e));const x=q($=>$.defaultEdgeOptions);g=x?{...x,...g}:g;let b=g.type||"default",E=(p==null?void 0:p[b])||Wi[b];E===void 0&&(m==null||m("011",le.error011(b)),b="default",E=Wi.default);const C=!!(g.focusable||t&&typeof g.focusable>"u"),A=typeof d<"u"&&(g.reconnectable||n&&typeof g.reconnectable>"u"),O=!!(g.selectable||o&&typeof g.selectable>"u"),V=P.useRef(null),[T,z]=P.useState(!1),[H,v]=P.useState(!1),M=ne(),{zIndex:S,sourceX:N,sourceY:D,targetX:k,targetY:L,sourcePosition:B,targetPosition:F}=q(P.useCallback($=>{const J=$.nodeLookup.get(g.source),Q=$.nodeLookup.get(g.target);if(!J||!Q)return{zIndex:g.zIndex,...Ri};const te=su({id:e,sourceNode:J,targetNode:Q,sourceHandle:g.sourceHandle||null,targetHandle:g.targetHandle||null,connectionMode:$.connectionMode,onError:m});return{zIndex:ql({selected:g.selected,zIndex:g.zIndex,sourceNode:J,targetNode:Q,elevateOnSelect:$.elevateEdgesOnSelect}),...te||Ri}},[g.source,g.target,g.sourceHandle,g.targetHandle,g.selected,g.zIndex]),oe),W=P.useMemo(()=>g.markerStart?`url('#${zn(g.markerStart,y)}')`:void 0,[g.markerStart,y]),Y=P.useMemo(()=>g.markerEnd?`url('#${zn(g.markerEnd,y)}')`:void 0,[g.markerEnd,y]);if(g.hidden||N===null||D===null||k===null||L===null)return null;const K=$=>{var re;const{addSelectedEdges:J,unselectNodesAndEdges:Q,multiSelectionActive:te}=M.getState();O&&(M.setState({nodesSelectionActive:!1}),g.selected&&te?(Q({nodes:[],edges:[g]}),(re=V.current)==null||re.blur()):J([e])),r&&r($,g)},U=i?$=>{i($,{...g})}:void 0,R=s?$=>{s($,{...g})}:void 0,X=a?$=>{a($,{...g})}:void 0,Z=c?$=>{c($,{...g})}:void 0,ee=f?$=>{f($,{...g})}:void 0,j=$=>{var J;if(!_&&qo.includes($.key)&&O){const{unselectNodesAndEdges:Q,addSelectedEdges:te}=M.getState();$.key==="Escape"?((J=V.current)==null||J.blur(),Q({edges:[g]})):te([e])}};return I.jsx("svg",{style:{zIndex:S},children:I.jsxs("g",{className:ie(["react-flow__edge",`react-flow__edge-${b}`,g.className,w,{selected:g.selected,animated:g.animated,inactive:!O&&!r,updating:T,selectable:O}]),onClick:K,onDoubleClick:U,onContextMenu:R,onMouseEnter:X,onMouseMove:Z,onMouseLeave:ee,onKeyDown:C?j:void 0,tabIndex:C?0:void 0,role:g.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":g.ariaLabel===null?void 0:g.ariaLabel||`Edge from ${g.source} to ${g.target}`,"aria-describedby":C?`${ni}-${y}`:void 0,ref:V,...g.domAttributes,children:[!H&&I.jsx(E,{id:e,source:g.source,target:g.target,type:g.type,selected:g.selected,animated:g.animated,selectable:O,deletable:g.deletable??!0,label:g.label,labelStyle:g.labelStyle,labelShowBg:g.labelShowBg,labelBgStyle:g.labelBgStyle,labelBgPadding:g.labelBgPadding,labelBgBorderRadius:g.labelBgBorderRadius,sourceX:N,sourceY:D,targetX:k,targetY:L,sourcePosition:B,targetPosition:F,data:g.data,style:g.style,sourceHandleId:g.sourceHandle,targetHandleId:g.targetHandle,markerStart:W,markerEnd:Y,pathOptions:"pathOptions"in g?g.pathOptions:void 0,interactionWidth:g.interactionWidth}),A&&I.jsx(gd,{edge:g,isReconnectable:A,reconnectRadius:u,onReconnect:d,onReconnectStart:l,onReconnectEnd:h,sourceX:N,sourceY:D,targetX:k,targetY:L,sourcePosition:B,targetPosition:F,setUpdateHover:z,setReconnecting:v})]})})}const yd=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ui({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:f,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:l,onReconnectStart:h,onReconnectEnd:y,disableKeyboardA11y:p}){const{edgesFocusable:w,edgesReconnectable:m,elementsSelectable:_,onError:g}=q(yd,oe),x=td(t);return I.jsxs("div",{className:"react-flow__edges",children:[I.jsx(sd,{defaultColor:e,rfId:n}),x.map(b=>I.jsx(pd,{id:b,edgesFocusable:w,edgesReconnectable:m,elementsSelectable:_,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:f,onClick:u,reconnectRadius:d,onDoubleClick:l,onReconnectStart:h,onReconnectEnd:y,rfId:n,onError:g,edgeTypes:o,disableKeyboardA11y:p},b))]})}Ui.displayName="EdgeRenderer";const md=P.memo(Ui),wd=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function xd({children:e}){const t=q(wd);return I.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function vd(e){const t=Jn(),n=P.useRef(!1);P.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const bd=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function _d(e){const t=q(bd),n=ne();return P.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Sd(e){return e.connection.inProgress?{...e.connection,to:ft(e.connection.to,e.transform)}:{...e.connection}}function Ed(e){return Sd}function Cd(e){const t=Ed();return q(t,oe)}const Nd=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Md({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:c}=q(Nd,oe);return!(i&&r&&c)?null:I.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:I.jsx("g",{className:ie(["react-flow__connection",or(a)]),children:I.jsx(Zi,{style:t,type:n,CustomComponent:o,isValid:a})})})}const Zi=({style:e,type:t=Ee.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:c,to:f,toNode:u,toHandle:d,toPosition:l}=Cd();if(!r)return;if(n)return I.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:f.x,toY:f.y,fromPosition:c,toPosition:l,connectionStatus:or(o),toNode:u,toHandle:d});let h="";const y={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:f.x,targetY:f.y,targetPosition:l};switch(t){case Ee.Bezier:[h]=br(y);break;case Ee.SimpleBezier:[h]=Pi(y);break;case Ee.Step:[h]=Hn({...y,borderRadius:0});break;case Ee.SmoothStep:[h]=Hn(y);break;default:[h]=Er(y)}return I.jsx("path",{d:h,fill:"none",className:"react-flow__connection-path",style:e})};Zi.displayName="ConnectionLine";const kd={};function $i(e=kd){const t=P.useRef(e),n=ne();P.useEffect(()=>{var o,r;if(process.env.NODE_ENV==="development"){const i=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const s of i)if(t.current[s]!==e[s]){(r=(o=n.getState()).onError)==null||r.call(o,"002",le.error002());break}t.current=e}},[e])}function Ad(){const e=ne(),t=P.useRef(!1);P.useEffect(()=>{var n,o;if(process.env.NODE_ENV==="development"&&!t.current){const r=document.querySelector(".react-flow__pane");r&&window.getComputedStyle(r).zIndex!=="1"&&((o=(n=e.getState()).onError)==null||o.call(n,"013",le.error013("react"))),t.current=!0}},[])}function Qi({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:f,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:l,onSelectionEnd:h,connectionLineType:y,connectionLineStyle:p,connectionLineComponent:w,connectionLineContainerStyle:m,selectionKeyCode:_,selectionOnDrag:g,selectionMode:x,multiSelectionKeyCode:b,panActivationKeyCode:E,zoomActivationKeyCode:C,deleteKeyCode:A,onlyRenderVisibleElements:O,elementsSelectable:V,defaultViewport:T,translateExtent:z,minZoom:H,maxZoom:v,preventScrolling:M,defaultMarkerColor:S,zoomOnScroll:N,zoomOnPinch:D,panOnScroll:k,panOnScrollSpeed:L,panOnScrollMode:B,zoomOnDoubleClick:F,panOnDrag:W,onPaneClick:Y,onPaneMouseEnter:K,onPaneMouseMove:U,onPaneMouseLeave:R,onPaneScroll:X,onPaneContextMenu:Z,paneClickDistance:ee,nodeClickDistance:j,onEdgeContextMenu:$,onEdgeMouseEnter:J,onEdgeMouseMove:Q,onEdgeMouseLeave:te,reconnectRadius:re,onReconnect:_e,onReconnectStart:Ue,onReconnectEnd:an,noDragClassName:cn,noWheelClassName:ln,noPanClassName:pt,disableKeyboardA11y:yt,nodeExtent:no,rfId:un,viewport:Ze,onViewportChange:mt}){return $i(e),$i(t),Ad(),vd(n),_d(Ze),I.jsx(Kf,{onPaneClick:Y,onPaneMouseEnter:K,onPaneMouseMove:U,onPaneMouseLeave:R,onPaneContextMenu:Z,onPaneScroll:X,paneClickDistance:ee,deleteKeyCode:A,selectionKeyCode:_,selectionOnDrag:g,selectionMode:x,onSelectionStart:l,onSelectionEnd:h,multiSelectionKeyCode:b,panActivationKeyCode:E,zoomActivationKeyCode:C,elementsSelectable:V,zoomOnScroll:N,zoomOnPinch:D,zoomOnDoubleClick:F,panOnScroll:k,panOnScrollSpeed:L,panOnScrollMode:B,panOnDrag:W,defaultViewport:T,translateExtent:z,minZoom:H,maxZoom:v,onSelectionContextMenu:d,preventScrolling:M,noDragClassName:cn,noWheelClassName:ln,noPanClassName:pt,disableKeyboardA11y:yt,onViewportChange:mt,isControlledViewport:!!Ze,children:I.jsxs(xd,{children:[I.jsx(md,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:_e,onReconnectStart:Ue,onReconnectEnd:an,onlyRenderVisibleElements:O,onEdgeContextMenu:$,onEdgeMouseEnter:J,onEdgeMouseMove:Q,onEdgeMouseLeave:te,reconnectRadius:re,defaultMarkerColor:S,noPanClassName:pt,disableKeyboardA11y:yt,rfId:un}),I.jsx(Md,{style:p,type:y,component:w,containerStyle:m}),I.jsx("div",{className:"react-flow__edgelabel-renderer"}),I.jsx(ed,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:f,onNodeContextMenu:u,nodeClickDistance:j,onlyRenderVisibleElements:O,noPanClassName:pt,noDragClassName:cn,disableKeyboardA11y:yt,nodeExtent:no,rfId:un}),I.jsx("div",{className:"react-flow__viewport-portal"})]})})}Qi.displayName="GraphView";const Id=P.memo(Qi),Ji=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:c=.5,maxZoom:f=2,nodeOrigin:u,nodeExtent:d}={})=>{const l=new Map,h=new Map,y=new Map,p=new Map,w=o??t??[],m=n??e??[],_=u??[0,0],g=d??st;Tr(y,p,w);const x=Fn(m,l,h,{nodeOrigin:_,nodeExtent:g,elevateNodesOnSelect:!1});let b=[0,0,1];if(s&&r&&i){const E=lt(l,{filter:V=>!!((V.width||V.initialWidth)&&(V.height||V.initialHeight))}),{x:C,y:A,zoom:O}=Ln(E,r,i,c,f,(a==null?void 0:a.padding)??.1);b=[C,A,O]}return{rfId:"1",width:0,height:0,transform:b,nodes:m,nodesInitialized:x,nodeLookup:l,parentLookup:h,edges:w,edgeLookup:p,connectionLookup:y,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:c,maxZoom:f,translateExtent:st,nodeExtent:g,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ve.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:_,nodeDragThreshold:1,connectionDragThreshold: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:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...tr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:fr,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:er}},Pd=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:f,nodeOrigin:u,nodeExtent:d})=>Ju((l,h)=>{async function y(){const{nodeLookup:p,panZoom:w,fitViewOptions:m,fitViewResolver:_,width:g,height:x,minZoom:b,maxZoom:E}=h();w&&(await Kl({nodes:p,width:g,height:x,panZoom:w,minZoom:b,maxZoom:E},m),_==null||_.resolve(!0),l({fitViewResolver:null}))}return{...Ji({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:f,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o}),setNodes:p=>{const{nodeLookup:w,parentLookup:m,nodeOrigin:_,elevateNodesOnSelect:g,fitViewQueued:x}=h(),b=Fn(p,w,m,{nodeOrigin:_,nodeExtent:d,elevateNodesOnSelect:g,checkEquality:!0});x&&b?(y(),l({nodes:p,nodesInitialized:b,fitViewQueued:!1,fitViewOptions:void 0})):l({nodes:p,nodesInitialized:b})},setEdges:p=>{const{connectionLookup:w,edgeLookup:m}=h();Tr(w,m,p),l({edges:p})},setDefaultNodesAndEdges:(p,w)=>{if(p){const{setNodes:m}=h();m(p),l({hasDefaultNodes:!0})}if(w){const{setEdges:m}=h();m(w),l({hasDefaultEdges:!0})}},updateNodeInternals:p=>{const{triggerNodeChanges:w,nodeLookup:m,parentLookup:_,domNode:g,nodeOrigin:x,nodeExtent:b,debug:E,fitViewQueued:C}=h(),{changes:A,updatedInternals:O}=du(p,m,_,g,x,b);O&&(lu(m,_,{nodeOrigin:x,nodeExtent:b}),C?(y(),l({fitViewQueued:!1,fitViewOptions:void 0})):l({}),(A==null?void 0:A.length)>0&&(E&&console.log("React Flow: trigger node changes",A),w==null||w(A)))},updateNodePositions:(p,w=!1)=>{const m=[],_=[],{nodeLookup:g,triggerNodeChanges:x}=h();for(const[b,E]of p){const C=g.get(b),A=!!(C!=null&&C.expandParent&&(C!=null&&C.parentId)&&(E!=null&&E.position)),O={id:b,type:"position",position:A?{x:Math.max(0,E.position.x),y:Math.max(0,E.position.y)}:E.position,dragging:w};A&&C.parentId&&m.push({id:b,parentId:C.parentId,rect:{...E.internals.positionAbsolute,width:E.measured.width??0,height:E.measured.height??0}}),_.push(O)}if(m.length>0){const{parentLookup:b,nodeOrigin:E}=h(),C=Xn(m,g,b,E);_.push(...C)}x(_)},triggerNodeChanges:p=>{const{onNodesChange:w,setNodes:m,nodes:_,hasDefaultNodes:g,debug:x}=h();if(p!=null&&p.length){if(g){const b=fi(p,_);m(b)}x&&console.log("React Flow: trigger node changes",p),w==null||w(p)}},triggerEdgeChanges:p=>{const{onEdgesChange:w,setEdges:m,edges:_,hasDefaultEdges:g,debug:x}=h();if(p!=null&&p.length){if(g){const b=di(p,_);m(b)}x&&console.log("React Flow: trigger edge changes",p),w==null||w(p)}},addSelectedNodes:p=>{const{multiSelectionActive:w,edgeLookup:m,nodeLookup:_,triggerNodeChanges:g,triggerEdgeChanges:x}=h();if(w){const b=p.map(E=>Le(E,!0));g(b);return}g(Ke(_,new Set([...p]),!0)),x(Ke(m))},addSelectedEdges:p=>{const{multiSelectionActive:w,edgeLookup:m,nodeLookup:_,triggerNodeChanges:g,triggerEdgeChanges:x}=h();if(w){const b=p.map(E=>Le(E,!0));x(b);return}x(Ke(m,new Set([...p]))),g(Ke(_,new Set,!0))},unselectNodesAndEdges:({nodes:p,edges:w}={})=>{const{edges:m,nodes:_,nodeLookup:g,triggerNodeChanges:x,triggerEdgeChanges:b}=h(),E=p||_,C=w||m,A=E.map(V=>{const T=g.get(V.id);return T&&(T.selected=!1),Le(V.id,!1)}),O=C.map(V=>Le(V.id,!1));x(A),b(O)},setMinZoom:p=>{const{panZoom:w,maxZoom:m}=h();w==null||w.setScaleExtent([p,m]),l({minZoom:p})},setMaxZoom:p=>{const{panZoom:w,minZoom:m}=h();w==null||w.setScaleExtent([m,p]),l({maxZoom:p})},setTranslateExtent:p=>{var w;(w=h().panZoom)==null||w.setTranslateExtent(p),l({translateExtent:p})},setPaneClickDistance:p=>{var w;(w=h().panZoom)==null||w.setClickDistance(p)},resetSelectedElements:()=>{const{edges:p,nodes:w,triggerNodeChanges:m,triggerEdgeChanges:_,elementsSelectable:g}=h();if(!g)return;const x=w.reduce((E,C)=>C.selected?[...E,Le(C.id,!1)]:E,[]),b=p.reduce((E,C)=>C.selected?[...E,Le(C.id,!1)]:E,[]);m(x),_(b)},setNodeExtent:p=>{const{nodes:w,nodeLookup:m,parentLookup:_,nodeOrigin:g,elevateNodesOnSelect:x,nodeExtent:b}=h();p[0][0]===b[0][0]&&p[0][1]===b[0][1]&&p[1][0]===b[1][0]&&p[1][1]===b[1][1]||(Fn(w,m,_,{nodeOrigin:g,nodeExtent:p,elevateNodesOnSelect:x,checkEquality:!1}),l({nodeExtent:p}))},panBy:p=>{const{transform:w,width:m,height:_,panZoom:g,translateExtent:x}=h();return hu({delta:p,panZoom:g,transform:w,translateExtent:x,width:m,height:_})},setCenter:async(p,w,m)=>{const{width:_,height:g,maxZoom:x,panZoom:b}=h();if(!b)return Promise.resolve(!1);const E=typeof(m==null?void 0:m.zoom)<"u"?m.zoom:x;return await b.setViewport({x:_/2-p*E,y:g/2-w*E,zoom:E},{duration:m==null?void 0:m.duration,ease:m==null?void 0:m.ease,interpolate:m==null?void 0:m.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{l({connection:{...tr}})},updateConnection:p=>{l({connection:p})},reset:()=>l({...Ji()})}},Object.is);function Td({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:c,fitView:f,nodeOrigin:u,nodeExtent:d,children:l}){const[h]=P.useState(()=>Pd({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:f,minZoom:s,maxZoom:a,fitViewOptions:c,nodeOrigin:u,nodeExtent:d}));return I.jsx(ju,{value:h,children:I.jsx(bf,{children:l})})}function Dd({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:c,minZoom:f,maxZoom:u,nodeOrigin:d,nodeExtent:l}){return P.useContext(jt)?I.jsx(I.Fragment,{children:e}):I.jsx(Td,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:c,initialMinZoom:f,initialMaxZoom:u,nodeOrigin:d,nodeExtent:l,children:e})}const Ld={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Od({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:c,onInit:f,onMove:u,onMoveStart:d,onMoveEnd:l,onConnect:h,onConnectStart:y,onConnectEnd:p,onClickConnectStart:w,onClickConnectEnd:m,onNodeMouseEnter:_,onNodeMouseMove:g,onNodeMouseLeave:x,onNodeContextMenu:b,onNodeDoubleClick:E,onNodeDragStart:C,onNodeDrag:A,onNodeDragStop:O,onNodesDelete:V,onEdgesDelete:T,onDelete:z,onSelectionChange:H,onSelectionDragStart:v,onSelectionDrag:M,onSelectionDragStop:S,onSelectionContextMenu:N,onSelectionStart:D,onSelectionEnd:k,onBeforeDelete:L,connectionMode:B,connectionLineType:F=Ee.Bezier,connectionLineStyle:W,connectionLineComponent:Y,connectionLineContainerStyle:K,deleteKeyCode:U="Backspace",selectionKeyCode:R="Shift",selectionOnDrag:X=!1,selectionMode:Z=at.Full,panActivationKeyCode:ee="Space",multiSelectionKeyCode:j=Kt()?"Meta":"Control",zoomActivationKeyCode:$=Kt()?"Meta":"Control",snapToGrid:J,snapGrid:Q,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:re,nodesDraggable:_e,autoPanOnNodeFocus:Ue,nodesConnectable:an,nodesFocusable:cn,nodeOrigin:ln=oi,edgesFocusable:pt,edgesReconnectable:yt,elementsSelectable:no=!0,defaultViewport:un=df,minZoom:Ze=.5,maxZoom:mt=2,translateExtent:ts=st,preventScrolling:yh=!0,nodeExtent:oo,defaultMarkerColor:mh="#b1b1b7",zoomOnScroll:wh=!0,zoomOnPinch:xh=!0,panOnScroll:vh=!1,panOnScrollSpeed:bh=.5,panOnScrollMode:_h=Te.Free,zoomOnDoubleClick:Sh=!0,panOnDrag:Eh=!0,onPaneClick:Ch,onPaneMouseEnter:Nh,onPaneMouseMove:Mh,onPaneMouseLeave:kh,onPaneScroll:Ah,onPaneContextMenu:Ih,paneClickDistance:ns=0,nodeClickDistance:Ph=0,children:Th,onReconnect:Dh,onReconnectStart:Lh,onReconnectEnd:Oh,onEdgeContextMenu:Hh,onEdgeDoubleClick:zh,onEdgeMouseEnter:Bh,onEdgeMouseMove:Vh,onEdgeMouseLeave:Fh,reconnectRadius:Yh=10,onNodesChange:Xh,onEdgesChange:Wh,noDragClassName:Rh="nodrag",noWheelClassName:Gh="nowheel",noPanClassName:os="nopan",fitView:rs,fitViewOptions:is,connectOnClick:Kh,attributionPosition:Uh,proOptions:Zh,defaultEdgeOptions:$h,elevateNodesOnSelect:Qh,elevateEdgesOnSelect:Jh,disableKeyboardA11y:ss=!1,autoPanOnConnect:jh,autoPanOnNodeDrag:qh,autoPanSpeed:eg,connectionRadius:tg,isValidConnection:ng,onError:og,style:rg,id:as,nodeDragThreshold:ig,connectionDragThreshold:sg,viewport:ag,onViewportChange:cg,width:lg,height:ug,colorMode:fg="light",debug:dg,onScroll:fn,ariaLabelConfig:hg,...gg},pg){const ro=as||"1",yg=pf(fg),mg=P.useCallback(cs=>{cs.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),fn==null||fn(cs)},[fn]);return I.jsx("div",{"data-testid":"rf__wrapper",...gg,onScroll:mg,style:{...rg,...Ld},ref:pg,className:ie(["react-flow",r,yg]),id:as,role:"application",children:I.jsxs(Dd,{nodes:e,edges:t,width:lg,height:ug,fitView:rs,fitViewOptions:is,minZoom:Ze,maxZoom:mt,nodeOrigin:ln,nodeExtent:oo,children:[I.jsx(Id,{onInit:f,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:_,onNodeMouseMove:g,onNodeMouseLeave:x,onNodeContextMenu:b,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:s,connectionLineType:F,connectionLineStyle:W,connectionLineComponent:Y,connectionLineContainerStyle:K,selectionKeyCode:R,selectionOnDrag:X,selectionMode:Z,deleteKeyCode:U,multiSelectionKeyCode:j,panActivationKeyCode:ee,zoomActivationKeyCode:$,onlyRenderVisibleElements:te,defaultViewport:un,translateExtent:ts,minZoom:Ze,maxZoom:mt,preventScrolling:yh,zoomOnScroll:wh,zoomOnPinch:xh,zoomOnDoubleClick:Sh,panOnScroll:vh,panOnScrollSpeed:bh,panOnScrollMode:_h,panOnDrag:Eh,onPaneClick:Ch,onPaneMouseEnter:Nh,onPaneMouseMove:Mh,onPaneMouseLeave:kh,onPaneScroll:Ah,onPaneContextMenu:Ih,paneClickDistance:ns,nodeClickDistance:Ph,onSelectionContextMenu:N,onSelectionStart:D,onSelectionEnd:k,onReconnect:Dh,onReconnectStart:Lh,onReconnectEnd:Oh,onEdgeContextMenu:Hh,onEdgeDoubleClick:zh,onEdgeMouseEnter:Bh,onEdgeMouseMove:Vh,onEdgeMouseLeave:Fh,reconnectRadius:Yh,defaultMarkerColor:mh,noDragClassName:Rh,noWheelClassName:Gh,noPanClassName:os,rfId:ro,disableKeyboardA11y:ss,nodeExtent:oo,viewport:ag,onViewportChange:cg}),I.jsx(gf,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:h,onConnectStart:y,onConnectEnd:p,onClickConnectStart:w,onClickConnectEnd:m,nodesDraggable:_e,autoPanOnNodeFocus:Ue,nodesConnectable:an,nodesFocusable:cn,edgesFocusable:pt,edgesReconnectable:yt,elementsSelectable:no,elevateNodesOnSelect:Qh,elevateEdgesOnSelect:Jh,minZoom:Ze,maxZoom:mt,nodeExtent:oo,onNodesChange:Xh,onEdgesChange:Wh,snapToGrid:J,snapGrid:Q,connectionMode:B,translateExtent:ts,connectOnClick:Kh,defaultEdgeOptions:$h,fitView:rs,fitViewOptions:is,onNodesDelete:V,onEdgesDelete:T,onDelete:z,onNodeDragStart:C,onNodeDrag:A,onNodeDragStop:O,onSelectionDrag:M,onSelectionDragStart:v,onSelectionDragStop:S,onMove:u,onMoveStart:d,onMoveEnd:l,noPanClassName:os,nodeOrigin:ln,rfId:ro,autoPanOnConnect:jh,autoPanOnNodeDrag:qh,autoPanSpeed:eg,onError:og,connectionRadius:tg,isValidConnection:ng,selectNodesOnDrag:re,nodeDragThreshold:ig,connectionDragThreshold:sg,onBeforeDelete:L,paneClickDistance:ns,debug:dg,ariaLabelConfig:hg}),I.jsx(ff,{onSelectionChange:H}),Th,I.jsx(sf,{proOptions:Zh,position:Uh}),I.jsx(rf,{rfId:ro,disableKeyboardA11y:ss})]})})}var Hd=yi(Od);function zd(e){const[t,n]=P.useState(e),o=P.useCallback(r=>n(i=>fi(r,i)),[]);return[t,n,o]}function Bd(e){const[t,n]=P.useState(e),o=P.useCallback(r=>n(i=>di(r,i)),[]);return[t,n,o]}function Vd({dimensions:e,lineWidth:t,variant:n,className:o}){return I.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ie(["react-flow__background-pattern",n,o])})}function Fd({radius:e,className:t}){return I.jsx("circle",{cx:e,cy:e,r:e,className:ie(["react-flow__background-pattern","dots",t])})}var Me;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Me||(Me={}));const Yd={[Me.Dots]:1,[Me.Lines]:1,[Me.Cross]:6},Xd=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ji({id:e,variant:t=Me.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:c,className:f,patternClassName:u}){const d=P.useRef(null),{transform:l,patternId:h}=q(Xd,oe),y=o||Yd[t],p=t===Me.Dots,w=t===Me.Cross,m=Array.isArray(n)?n:[n,n],_=[m[0]*l[2]||1,m[1]*l[2]||1],g=y*l[2],x=Array.isArray(i)?i:[i,i],b=w?[g,g]:_,E=[x[0]*l[2]||1+b[0]/2,x[1]*l[2]||1+b[1]/2],C=`${h}${e||""}`;return I.jsxs("svg",{className:ie(["react-flow__background",f]),style:{...c,...tn,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:d,"data-testid":"rf__background",children:[I.jsx("pattern",{id:C,x:l[0]%_[0],y:l[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:p?I.jsx(Fd,{radius:g/2,className:u}):I.jsx(Vd,{dimensions:b,lineWidth:r,variant:t,className:u})}),I.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}ji.displayName="Background";const Wd=P.memo(ji);function Rd(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:I.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Gd(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:I.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Kd(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:I.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 Ud(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:I.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 Zd(){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:I.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 sn({children:e,className:t,...n}){return I.jsx("button",{type:"button",className:ie(["react-flow__controls-button",t]),...n,children:e})}const $d=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function qi({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:c,className:f,children:u,position:d="bottom-left",orientation:l="vertical","aria-label":h}){const y=ne(),{isInteractive:p,minZoomReached:w,maxZoomReached:m,ariaLabelConfig:_}=q($d,oe),{zoomIn:g,zoomOut:x,fitView:b}=Jn(),E=()=>{g(),i==null||i()},C=()=>{x(),s==null||s()},A=()=>{b(r),a==null||a()},O=()=>{y.setState({nodesDraggable:!p,nodesConnectable:!p,elementsSelectable:!p}),c==null||c(!p)},V=l==="horizontal"?"horizontal":"vertical";return I.jsxs(qt,{className:ie(["react-flow__controls",V,f]),position:d,style:e,"data-testid":"rf__controls","aria-label":h??_["controls.ariaLabel"],children:[t&&I.jsxs(I.Fragment,{children:[I.jsx(sn,{onClick:E,className:"react-flow__controls-zoomin",title:_["controls.zoomIn.ariaLabel"],"aria-label":_["controls.zoomIn.ariaLabel"],disabled:m,children:I.jsx(Rd,{})}),I.jsx(sn,{onClick:C,className:"react-flow__controls-zoomout",title:_["controls.zoomOut.ariaLabel"],"aria-label":_["controls.zoomOut.ariaLabel"],disabled:w,children:I.jsx(Gd,{})})]}),n&&I.jsx(sn,{className:"react-flow__controls-fitview",onClick:A,title:_["controls.fitView.ariaLabel"],"aria-label":_["controls.fitView.ariaLabel"],children:I.jsx(Kd,{})}),o&&I.jsx(sn,{className:"react-flow__controls-interactive",onClick:O,title:_["controls.interactive.ariaLabel"],"aria-label":_["controls.interactive.ariaLabel"],children:p?I.jsx(Zd,{}):I.jsx(Ud,{})}),u]})}qi.displayName="Controls";const Qd=P.memo(qi);function Jd({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:c,className:f,borderRadius:u,shapeRendering:d,selected:l,onClick:h}){const{background:y,backgroundColor:p}=i||{},w=s||y||p;return I.jsx("rect",{className:ie(["react-flow__minimap-node",{selected:l},f]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:w,stroke:a,strokeWidth:c},shapeRendering:d,onClick:h?m=>h(m,e):void 0})}const jd=P.memo(Jd),qd=e=>e.nodes.map(t=>t.id),to=e=>e instanceof Function?e:()=>e;function eh({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=jd,onClick:s}){const a=q(qd,oe),c=to(t),f=to(e),u=to(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return I.jsx(I.Fragment,{children:a.map(l=>I.jsx(nh,{id:l,nodeColorFunc:c,nodeStrokeColorFunc:f,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:d},l))})}function th({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:c}){const{node:f,x:u,y:d,width:l,height:h}=q(y=>{const{internals:p}=y.nodeLookup.get(e),w=p.userNode,{x:m,y:_}=p.positionAbsolute,{width:g,height:x}=be(w);return{node:w,x:m,y:_,width:g,height:x}},oe);return!f||f.hidden||!dr(f)?null:I.jsx(a,{x:u,y:d,width:l,height:h,style:f.style,selected:!!f.selected,className:o(f),color:t(f),borderRadius:r,strokeColor:n(f),strokeWidth:i,shapeRendering:s,onClick:c,id:f.id})}const nh=P.memo(th);var oh=P.memo(eh);const rh=200,ih=150,sh=e=>!e.hidden,ah=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?lr(lt(e.nodeLookup,{filter:sh}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ch="react-flow__minimap-desc";function es({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:c,maskColor:f,maskStrokeColor:u,maskStrokeWidth:d,position:l="bottom-right",onClick:h,onNodeClick:y,pannable:p=!1,zoomable:w=!1,ariaLabel:m,inversePan:_,zoomStep:g=10,offsetScale:x=5}){const b=ne(),E=P.useRef(null),{boundingRect:C,viewBB:A,rfId:O,panZoom:V,translateExtent:T,flowWidth:z,flowHeight:H,ariaLabelConfig:v}=q(ah,oe),M=(e==null?void 0:e.width)??rh,S=(e==null?void 0:e.height)??ih,N=C.width/M,D=C.height/S,k=Math.max(N,D),L=k*M,B=k*S,F=x*k,W=C.x-(L-C.width)/2-F,Y=C.y-(B-C.height)/2-F,K=L+F*2,U=B+F*2,R=`${ch}-${O}`,X=P.useRef(0),Z=P.useRef();X.current=k,P.useEffect(()=>{if(E.current&&V)return Z.current=bu({domNode:E.current,panZoom:V,getTransform:()=>b.getState().transform,getViewScale:()=>X.current}),()=>{var J;(J=Z.current)==null||J.destroy()}},[V]),P.useEffect(()=>{var J;(J=Z.current)==null||J.update({translateExtent:T,width:z,height:H,inversePan:_,pannable:p,zoomStep:g,zoomable:w})},[p,w,_,g,T,z,H]);const ee=h?J=>{var re;const[Q,te]=((re=Z.current)==null?void 0:re.pointer(J))||[0,0];h(J,{x:Q,y:te})}:void 0,j=y?P.useCallback((J,Q)=>{const te=b.getState().nodeLookup.get(Q).internals.userNode;y(J,te)},[]):void 0,$=m??v["minimap.ariaLabel"];return I.jsx(qt,{position:l,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*k:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ie(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:I.jsxs("svg",{width:M,height:S,viewBox:`${W} ${Y} ${K} ${U}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":R,ref:E,onClick:ee,children:[$&&I.jsx("title",{id:R,children:$}),I.jsx(oh,{onClick:j,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),I.jsx("path",{className:"react-flow__minimap-mask",d:`M${W-F},${Y-F}h${K+F*2}v${U+F*2}h${-K-F*2}z
39
+ M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}es.displayName="MiniMap";const lh=P.memo(es),uh=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,fh={[Ge.Line]:"right",[Ge.Handle]:"bottom-right"};function dh({nodeId:e,position:t,variant:n=Ge.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:c=10,maxWidth:f=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:l,autoScale:h=!0,shouldResize:y,onResizeStart:p,onResize:w,onResizeEnd:m}){const _=_i(),g=typeof e=="string"?e:_,x=ne(),b=P.useRef(null),E=n===Ge.Handle,C=q(P.useCallback(uh(E&&h),[E,h]),oe),A=P.useRef(null),O=t??fh[n];P.useEffect(()=>{if(!(!b.current||!g))return A.current||(A.current=zu({domNode:b.current,nodeId:g,getStoreItems:()=>{const{nodeLookup:T,transform:z,snapGrid:H,snapToGrid:v,nodeOrigin:M,domNode:S}=x.getState();return{nodeLookup:T,transform:z,snapGrid:H,snapToGrid:v,nodeOrigin:M,paneDomNode:S}},onChange:(T,z)=>{const{triggerNodeChanges:H,nodeLookup:v,parentLookup:M,nodeOrigin:S}=x.getState(),N=[],D={x:T.x,y:T.y},k=v.get(g);if(k&&k.expandParent&&k.parentId){const L=k.origin??S,B=T.width??k.measured.width??0,F=T.height??k.measured.height??0,W={id:k.id,parentId:k.parentId,rect:{width:B,height:F,...hr({x:T.x??k.position.x,y:T.y??k.position.y},{width:B,height:F},k.parentId,v,L)}},Y=Xn([W],v,M,S);N.push(...Y),D.x=T.x?Math.max(L[0]*B,T.x):void 0,D.y=T.y?Math.max(L[1]*F,T.y):void 0}if(D.x!==void 0&&D.y!==void 0){const L={id:g,type:"position",position:{...D}};N.push(L)}if(T.width!==void 0&&T.height!==void 0){const B={id:g,type:"dimensions",resizing:!0,setAttributes:l?l==="horizontal"?"width":"height":!0,dimensions:{width:T.width,height:T.height}};N.push(B)}for(const L of z){const B={...L,type:"position"};N.push(B)}H(N)},onEnd:({width:T,height:z})=>{const H={id:g,type:"dimensions",resizing:!1,dimensions:{width:T,height:z}};x.getState().triggerNodeChanges([H])}})),A.current.update({controlPosition:O,boundaries:{minWidth:a,minHeight:c,maxWidth:f,maxHeight:u},keepAspectRatio:d,resizeDirection:l,onResizeStart:p,onResize:w,onResizeEnd:m,shouldResize:y}),()=>{var T;(T=A.current)==null||T.destroy()}},[O,a,c,f,u,d,p,w,m,y]);const V=O.split("-");return I.jsx("div",{className:ie(["react-flow__resize-control","nodrag",...V,n,o]),ref:b,style:{...r,scale:C,...s&&{[E?"backgroundColor":"borderColor"]:s}},children:i})}P.memo(dh);const hh=[{id:"1",position:{x:0,y:0},data:{label:"1"}},{id:"2",position:{x:0,y:100},data:{label:"2"}}],gh=[{id:"e1-2",source:"1",target:"2"}],ph=({})=>{const[e,t,n]=zd(hh),[o,r,i]=Bd(gh),s=P.useCallback(a=>r(c=>Sr(a,c)),[r]);return I.jsx("div",{style:{width:"100vw",height:"100vh"},children:I.jsxs(Hd,{nodes:e,edges:o,onNodesChange:n,onEdgesChange:i,onConnect:s,children:[I.jsx(Qd,{}),I.jsx(lh,{}),I.jsx(Wd,{variant:"dots",gap:12,size:1})]})})};Se.ScriptEditor=ph,Object.defineProperty(Se,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1 @@
1
+ export * from './scripts';
@@ -0,0 +1,2 @@
1
+ export * from './scripts';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ import { ScriptEditorInterface } from './types';
2
+ export declare const ScriptEditor: ({}: ScriptEditorInterface) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export interface ScriptEditorInterface {
2
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,4 @@
1
+ export declare const objectValuesToControls: (obj: Record<string, string>, control?: string) => {
2
+ control: string;
3
+ options: string[];
4
+ };
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "app-v3-scripts-editor",
3
+ "private": false,
4
+ "version": "0.0.1",
5
+ "packageManager": "pnpm@10.12.1",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/ucall-asia/app-v3-scripts-editor"
9
+ },
10
+ "main": "./dist/app-v3-scripts-editor.umd.js",
11
+ "module": "./dist/app-v3-scripts-editor.es.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/app-v3-scripts-editor.es.js",
17
+ "require": "./dist/app-v3-scripts-editor.umd.js"
18
+ },
19
+ "./styles.css": "./dist/app-v3-scripts-editor.css"
20
+ },
21
+ "engines": {
22
+ "node": ">=22"
23
+ },
24
+ "scripts": {
25
+ "dev": "storybook dev -p 6006",
26
+ "build": "storybook build",
27
+ "build:lib": "tsc && vite build",
28
+ "lint": "npx @biomejs/biome lint --write ./src",
29
+ "format": "npx @biomejs/biome check --write --organize-imports-enabled=true ./src",
30
+ "test": "vitest",
31
+ "test:cov": "vitest run --coverage",
32
+ "prepack": "json -f package.json -I -e \"delete this.devDependencies; delete this.dependencies\""
33
+ },
34
+ "peerDependencies": {
35
+ "react": "19.1.0",
36
+ "react-dom": "19.1.0"
37
+ },
38
+ "files": [
39
+ "dist"
40
+ ],
41
+ "lint-staged": {
42
+ "*.{js,ts,cjs,mjs,d.cts,d.mts,json,jsonc}": [
43
+ "biome check --files-ignore-unknown=true",
44
+ "biome check --write --no-errors-on-unmatched",
45
+ "biome lint --write --no-errors-on-unmatched --files-ignore-unknown=true",
46
+ "biome format --write --no-errors-on-unmatched"
47
+ ]
48
+ }
49
+ }