PageSourceSearch

https://cloud.agenty.com/assets/page-B2lSgZat.js

js agenty.com collected 2026-09-24 12:15:25 UTC 193,245 bytes, 7 lines download raw bytes

1import{j as g,M as jt,N as It,H as we,ab as Ui,aC as Ko,aD as Qo,aE as Jo,aF as es,aG as ts,U as ae,aQ as ns,aR as pn,ba as os,aI as ss,ax as tn,ay as nn,az as on,aA as sn,aB as rn,aL as rs,V as is,O as Kn,P as Qn,aJ as Zi,W as Jn}from"./ui-CfRm5DTA.js";import{a as Ki,r as I,aG as Qi,m as as,a7 as Ji,ag as ea,a2 as ta,L as na,ai as oa}from"./icons-CoWim_VM.js";import{i as Ce,c as eo,a as to,b as sa,d as an}from"./value-DqH_WevB.js";import{i as ra,j as ia,L as aa,u as ca,b as la,g as ua}from"./index-CO7lCi65.js";import{M as da}from"./multi-select-Il5ucPYl.js";import{a as Te,A as $e}from"./api-TVx_5Nik.js";var no=180/Math.PI,mn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cs(e,t,n,o,s,r){var i,a,l;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,i=-i),{translateX:s,translateY:r,rotate:Math.atan2(t,e)*no,skewX:Math.atan(l)*no,scaleX:i,scaleY:a}}var xt;function fa(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?mn:cs(t.a,t.b,t.c,t.d,t.e,t.f)}function ha(e){return e==null||(xt||(xt=document.createElementNS("http://www.w3.org/2000/svg","g")),xt.setAttribute("transform",e),!(e=xt.transform.baseVal.consolidate()))?mn:(e=e.matrix,cs(e.a,e.b,e.c,e.d,e.e,e.f))}function ls(e,t,n,o){function s(u){return u.length?u.pop()+" ":""}function r(u,f,d,c,h,w){if(u!==d||f!==c){var x=h.push("translate(",null,t,null,n);w.push({i:x-4,x:Ce(u,d)},{i:x-2,x:Ce(f,c)})}else(d||c)&&h.push("translate("+d+t+c+n)}function i(u,f,d,c){u!==f?(u-f>180?f+=360:f-u>180&&(u+=360),c.push({i:d.push(s(d)+"rotate(",null,o)-2,x:Ce(u,f)})):f&&d.push(s(d)+"rotate("+f+o)}function a(u,f,d,c){u!==f?c.push({i:d.push(s(d)+"skewX(",null,o)-2,x:Ce(u,f)}):f&&d.push(s(d)+"skewX("+f+o)}function l(u,f,d,c,h,w){if(u!==d||f!==c){var x=h.push(s(h)+"scale(",null,",",null,")");w.push({i:x-4,x:Ce(u,d)},{i:x-2,x:Ce(f,c)})}else(d!==1||c!==1)&&h.push(s(h)+"scale("+d+","+c+")")}return function(u,f){var d=[],c=[];return u=e(u),f=e(f),r(u.translateX,u.translateY,f.translateX,f.translateY,d,c),i(u.rotate,f.rotate,d,c),a(u.skewX,f.skewX,d,c),l(u.scaleX,u.scaleY,f.scaleX,f.scaleY,d,c),u=f=null,function(h){for(var w=-1,x=c.length,m;++w<x;)d[(m=c[w]).i]=m.x(h);return d.join("")}}}var ga=ls(fa,"px, ","px)","deg)"),pa=ls(ha,", ",")",")"),ma=1e-12;function oo(e){return((e=Math.exp(e))+1/e)/2}function ya(e){return((e=Math.exp(e))-1/e)/2}function xa(e){return((e=Math.exp(2*e))-1)/(e+1)}const Et=function e(t,n,o){function s(r,i){var a=r[0],l=r[1],u=r[2],f=i[0],d=i[1],c=i[2],h=f-a,w=d-l,x=h*h+w*w,m,y;if(x<ma)y=Math.log(c/u)/t,m=function(A){return[a+A*h,l+A*w,u*Math.exp(t*A*y)]};else{var N=Math.sqrt(x),p=(c*c-u*u+o*x)/(2*u*n*N),v=(c*c-u*u-o*x)/(2*c*n*N),_=Math.log(Math.sqrt(p*p+1)-p),E=Math.log(Math.sqrt(v*v+1)-v);
1y=(E-_)/t,m=function(A){var T=A*y,$=oo(_),B=u/(n*N)*($*xa(t*T+_)-ya(_));return[a+B*h,l+B*w,u*$/oo(t*T+_)]}}return m.duration=y*1e3*t/Math.SQRT2,m}return s.rho=function(r){var i=Math.max(.001,+r),a=i*i,l=a*a;return e(i,a,l)},s}(Math.SQRT2,2,4);function re(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=re(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var wa={value:()=>{}};function Rt(){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 Ct(n)}function Ct(e){this._=e}function va(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",s=n.indexOf(".");if(s>=0&&(o=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Ct.prototype=Rt.prototype={constructor:Ct,on:function(e,t){var n=this._,o=va(e+"",n),s,r=-1,i=o.length;if(arguments.length<2){for(;++r<i;)if((s=(e=o[r]).type)&&(s=ba(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<i;)if(s=(e=o[r]).type)n[s]=so(n[s],e.name,t);else if(t==null)for(s in n)n[s]=so(n[s],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Ct(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),o=0,s,r;o<s;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],o=0,s=r.length;o<s;++o)r[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],s=0,r=o.length;s<r;++s)o[s].value.apply(t,n)}};function ba(e,t){for(var n=0,o=e.length,s;n<o;++n)if((s=e[n]).name===t)return s.value}function so(e,t,n){for(var o=0,s=e.length;o<s;++o)if(e[o].name===t){e[o]=wa,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var yn="http://www.w3.org/1999/xhtml";const ro={svg:"http://www.w3.org/2000/svg",xhtml:yn,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)),ro.hasOwnProperty(t)?{space:ro[t],local:e}:e}function _a(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===yn&&t.documentElement.namespaceURI===yn?t.createElement(e):t.createElementNS(n,e)}}function Na(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function us(e){var t=Vt(e);return(t.local?Na:_a)(t)}function Sa(){}function Mn(e){return e==null?Sa:function(){return this.querySelector(e)}}function Ea(e){typeof e!="function"&&(e=Mn(e));for(var t=this._groups,n=t.length,o=new Array(n),s=0;s<n;++s)for(var r=t[s],i=r.length,a=o[s]=new Array(i),l,u,f=0;f<i;++f)(l=r[f])&&(u=e.call(l,l.__data__,f,r))&&("__data__"in l&&(u.__data__=l.__data__),a[f]=u);return new le(o,this._parents)}function Ca(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ka(){return[]}function ds(e){return e==null?ka:function(){return this.querySelectorAll(e)}}function Ma(e){return function(){return Ca(e.apply(this,arguments))}}function Aa(e){typeof e=="function"?e=Ma(e):e=ds(e);for(var t=this._groups,n=t.length,o=[],s=[],r=0;r<n;++r)for(var i=t[r],a=i.length,l,u=0;u<a;++u)(l=i[u])&&(o.push(e.call(l,l.__data__,u,i)),s.push(l));return new le(o,s)}function fs(e){return function(){return this.matches(e)}}function hs(e){return function(t){return t.matches(e)}}var ja=Array.prototype.find;function Ia(e){return function(){return ja.call(this.children,e)}}function Pa(){return this.firstElementChild}function Ta(e){return this.select(e==null?Pa:Ia(typeof e=="function"?e:hs(e)))}var $a=Array.prototype.filter;function Da(){return Array.from(this.children)}function za(e){return function(){return $a.call(this.children,e)}}function La(e){return this.selectAll(e==null?Da:za(typeof e=="function"?e:hs(e)))}function Ha(e){typeof e!="function"&&(e=fs(e));for(var t=this._groups,n=t.length,o=new Array(n),s=0;s<n;++s)for(var r=t[s],i=r.length,a=o[s]=[],l,u=0;u<i;++u)(l=r[u])&&e.call(l,l.__data__,u,r)&&a.push(l);return new le(o,this._parents)}function gs(e){return new Array(e.length)}function Fa(){return new le(this._enter||this._groups.map(gs),this._parents)}function Pt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Pt.prototype={constructor:Pt,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 Ra(e){return function(){return e}}function Va(e,t,n,o,s,r){for(var i=0,a,l=t.length,u=r.length;i<u;++i)(a=t[i])?(a.__data__=r[i],o[i]=a):n[i]=new Pt(e,r[i]);for(;i<l;++i)(a=t[i])&&(s[i]=a)}function Ba(e,t,n,o,s,r,i){var a,l,u=new Map,f=t.length,d=r.length,c=new Array(f),h;for(a=0;a<f;++a)(l=t[a])&&(c[a]=h=i.call(l,l.__data__,a,t)+"",u.has(h)?s[a]=l:u.set(h,l));for(a=0;a<d;++a)h=i.call(e,r[a],a,r)+"",(l=u.get(h))?(o[a]=l,l.__data__=r[a],u.delete(h)):n[a]=new Pt(e,r[a]);for(a=0;a<f;++a)(l=t[a])&&u.get(c[a])===l&&(s[a]=l)}function Oa(e){return e.__data__}function Ya(e,t){if(!arguments.length)return Array.from(this,Oa);var n=t?Ba:Va,o=this._parents,s=this._groups;typeof e!="function"&&(e=Ra(e));for(var r=s.length,i=new Array(r),a=new Array(r),l=new Array(r),u=0;u<r;++u){var f=o[u],d=s[u],c=d.length,h=Xa(e.call(f,f&&f.__data__,u,o)),w=h.length,x=a[u]=new Array(w),m=i[u]=new Array(w),y=l[u]=new Array(c);n(f,d,x,m,y,h,t);for(var N=0,p=0,v,_;N<w;++N)if(v=x[N]){for(N>=p&&(p=N+1);!(_=m[p])&&++p<w;);v._next=_||null}}return i=new le(i,o),i._enter=a,i._exit=l,i}function Xa(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function qa(){return new le(this._exit||this._groups.map(gs),this._parents)}function Wa(e,t,n){var o=this.enter(),s=this,r=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?r.remove():n(r),o&&s?o.merge
vendor: 4,457 bytes, line 1
1(s).order():s}function Ga(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,s=n.length,r=o.length,i=Math.min(s,r),a=new Array(s),l=0;l<i;++l)for(var u=n[l],f=o[l],d=u.length,c=a[l]=new Array(d),h,w=0;w<d;++w)(h=u[w]||f[w])&&(c[w]=h);for(;l<s;++l)a[l]=n[l];return new le(a,this._parents)}function Ua(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],s=o.length-1,r=o[s],i;--s>=0;)(i=o[s])&&(r&&i.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(i,r),r=i);return this}function Za(e){e||(e=Ka);function t(d,c){return d&&c?e(d.__data__,c.__data__):!d-!c}for(var n=this._groups,o=n.length,s=new Array(o),r=0;r<o;++r){for(var i=n[r],a=i.length,l=s[r]=new Array(a),u,f=0;f<a;++f)(u=i[f])&&(l[f]=u);l.sort(t)}return new le(s,this._parents).order()}function Ka(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Qa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ja(){return Array.from(this)}function ec(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],s=0,r=o.length;s<r;++s){var i=o[s];if(i)return i}return null}function tc(){let e=0;for(const t of this)++e;return e}function nc(){return!this.node()}function oc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var s=t[n],r=0,i=s.length,a;r<i;++r)(a=s[r])&&e.call(a,a.__data__,r,s);return this}function sc(e){return function(){this.removeAttribute(e)}}function rc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ic(e,t){return function(){this.setAttribute(e,t)}}function ac(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function cc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function lc(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 uc(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?rc:sc:typeof t=="function"?n.local?lc:cc:n.local?ac:ic)(n,t))}function ps(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function dc(e){return function(){this.style.removeProperty(e)}}function fc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function hc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function gc(e,t,n){return arguments.length>1?this.each((t==null?dc:typeof t=="function"?hc:fc)(e,t,n??"")):Fe(this.node(),e)}function Fe(e,t){return e.style.getPropertyValue(t)||ps(e).getComputedStyle(e,null).getPropertyValue(t)}function pc(e){return function(){delete this[e]}}function mc(e,t){return function(){this[e]=t}}function yc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function xc(e,t){return arguments.length>1?this.each((t==null?pc:typeof t=="function"?yc:mc)(e,t)):this.node()[e]}function ms(e){return e.trim().split(/^|\s+/)}function An(e){return e.classList||new ys(e)}function ys(e){this._node=e,this._names=ms(e.getAttribute("class")||"")}ys.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 xs(e,t){for(var n=An(e),o=-1,s=t.length;++o<s;)n.add(t[o])}function ws(e,t){for(var n=An(e),o=-1,s=t.length;++o<s;)n.remove(t[o])}function wc(e){return function(){xs(this,e)}}function vc(e){return function(){ws(this,e)}}function bc(e,t){return function(){(t.apply(this,arguments)?xs:ws)(this,e)}}function _c(e,t){var n=ms(e+"");if(arguments.length<2){for(var o=An(this.node()),s=-1,r=n.length;++s<r;)if(!o.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?bc:t?wc:vc)(n,t))}function Nc(){this.textContent=""}function Sc(e){return function(){this.textContent=e}}function Ec(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Cc(e){return arguments.length?this.each(e==null?Nc:(typeof e=="function"?Ec:Sc)(e)):this.node().textContent}function kc(){this.innerHTML=""}function Mc(e){return function(){this.innerHTML=e}}function Ac(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}
vendor: 4,647 bytes, line 1
1function jc(e){return arguments.length?this.each(e==null?kc:(typeof e=="function"?Ac:Mc)(e)):this.node().innerHTML}function Ic(){this.nextSibling&&this.parentNode.appendChild(this)}function Pc(){return this.each(Ic)}function Tc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $c(){return this.each(Tc)}function Dc(e){var t=typeof e=="function"?e:us(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zc(){return null}function Lc(e,t){var n=typeof e=="function"?e:us(e),o=t==null?zc:typeof t=="function"?t:Mn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Hc(){var e=this.parentNode;e&&e.removeChild(this)}function Fc(){return this.each(Hc)}function Rc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Bc(e){return this.select(e?Vc:Rc)}function Oc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Yc(e){return function(t){e.call(this,t,this.__data__)}}function Xc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function qc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,s=t.length,r;n<s;++n)r=t[n],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++o]=r;++o?t.length=o:delete this.__on}}}function Wc(e,t,n){return function(){var o=this.__on,s,r=Yc(t);if(o){for(var i=0,a=o.length;i<a;++i)if((s=o[i]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=r,s.options=n),s.value=t;return}}this.addEventListener(e.type,r,n),s={type:e.type,name:e.name,value:t,listener:r,options:n},o?o.push(s):this.__on=[s]}}function Gc(e,t,n){var o=Xc(e+""),s,r=o.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,u=a.length,f;l<u;++l)for(s=0,f=a[l];s<r;++s)if((i=o[s]).type===f.type&&i.name===f.name)return f.value}return}for(a=t?Wc:qc,s=0;s<r;++s)this.each(a(o[s],t,n));return this}function vs(e,t,n){var o=ps(e),s=o.CustomEvent;typeof s=="function"?s=new s(t,n):(s=o.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function Uc(e,t){return function(){return vs(this,e,t)}}function Zc(e,t){return function(){return vs(this,e,t.apply(this,arguments))}}function Kc(e,t){return this.each((typeof t=="function"?Zc:Uc)(e,t))}function*Qc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],s=0,r=o.length,i;s<r;++s)(i=o[s])&&(yield i)}var bs=[null];function le(e,t){this._groups=e,this._parents=t}function ct(){return new le([[document.documentElement]],bs)}function Jc(){return this}le.prototype=ct.prototype={constructor:le,select:Ea,selectAll:Aa,selectChild:Ta,selectChildren:La,filter:Ha,data:Ya,enter:Fa,exit:qa,join:Wa,merge:Ga,selection:Jc,order:Ua,sort:Za,call:Qa,nodes:Ja,node:ec,size:tc,empty:nc,each:oc,attr:uc,style:gc,property:xc,classed:_c,text:Cc,html:jc,raise:Pc,lower:$c,append:Dc,insert:Lc,remove:Fc,clone:Bc,datum:Oc,on:Gc,dispatch:Kc,[Symbol.iterator]:Qc};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],bs)}function el(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ue(e,t){if(e=el(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 s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}}return[e.pageX,e.pageY]}const tl={passive:!1},et={capture:!0,passive:!1};function cn(e){e.stopImmediatePropagation()}function He(e){e.preventDefault(),e.stopImmediatePropagation()}function _s(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",He,et);"onselectstart"in t?n.on("selectstart.drag",He,et):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ns(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",He,et),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 wt=e=>()=>e;function xn(e,{sourceEvent:t,subject:n,target:o,identifier:s,active:r,x:i,y:a,dx:l,dy:u,dis
1patch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}xn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function nl(e){return!e.ctrlKey&&!e.button}function ol(){return this.parentNode}function sl(e,t){return t??{x:e.x,y:e.y}}function rl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ss(){var e=nl,t=ol,n=sl,o=rl,s={},r=Rt("start","drag","end"),i=0,a,l,u,f,d=0;function c(v){v.on("mousedown.drag",h).filter(o).on("touchstart.drag",m).on("touchmove.drag",y,tl).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(v,_){if(!(f||!e.call(this,v,_))){var E=p(this,t.call(this,v,_),v,_,"mouse");E&&(ce(v.view).on("mousemove.drag",w,et).on("mouseup.drag",x,et),_s(v.view),cn(v),u=!1,a=v.clientX,l=v.clientY,E("start",v))}}function w(v){if(He(v),!u){var _=v.clientX-a,E=v.clientY-l;u=_*_+E*E>d}s.mouse("drag",v)}function x(v){ce(v.view).on("mousemove.drag mouseup.drag",null),Ns(v.view,u),He(v),s.mouse("end",v)}function m(v,_){if(e.call(this,v,_)){var E=v.changedTouches,A=t.call(this,v,_),T=E.length,$,B;for($=0;$<T;++$)(B=p(this,A,v,_,E[$].identifier,E[$]))&&(cn(v),B("start",v,E[$]))}}function y(v){var _=v.changedTouches,E=_.length,A,T;for(A=0;A<E;++A)(T=s[_[A].identifier])&&(He(v),T("drag",v,_[A]))}function N(v){var _=v.changedTouches,E=_.length,A,T;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),A=0;A<E;++A)(T=s[_[A].identifier])&&(cn(v),T("end",v,_[A]))}function p(v,_,E,A,T,$){var B=r.copy(),V=ue($||E,_),P,D,b;if((b=n.call(v,new xn("beforestart",{sourceEvent:E,target:c,identifier:T,active:i,x:V[0],y:V[1],dx:0,dy:0,dispatch:B}),A))!=null)return P=b.x-V[0]||0,D=b.y-V[1]||0,function k(S,j,C){var M=V,L;switch(S){case"start":s[T]=k,L=i++;break;case"end":delete s[T],--i;case"drag":V=ue(C||j,_),L=i;break}B.call(S,v,new xn(S,{sourceEvent:j,subject:b,target:c,identifier:T,active:L,x:V[0]+P,y:V[1]+D,dx:V[0]-M[0],dy:V[1]-M[1],dispatch:B}),A)}}return c.filter=function(v){return arguments.length?(e=typeof v=="function"?v:wt(!!v),c):e},c.container=function(v){return arguments.length?(t=typeof v=="function"?v:wt(v),c):t},c.subject=function(v){return arguments.length?(n=typeof v=="function"?v:wt(v),c):n},c.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:wt(!!v),c):o},c.on=function(){var v=r.on.apply(r,arguments);return v===r?c:v},c.clickDistance=function(v){return arguments.length?(d=(v=+v)*v,c):Math.sqrt(d)},c}var Re=0,Ke=0,Ue=0,Es=1e3,Tt,Qe,$t=0,Ae=0,Bt=0,tt=typeof performance=="object"&&performance.now?performance:Date,Cs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function jn(){return Ae||(Cs(il),Ae=tt.now()+Bt)}function il(){Ae=0}function Dt(){this._call=this._time=this._next=null}Dt.prototype=ks.prototype={constructor:Dt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?jn():+n)+(t==null?0:+t),!this._next&&Qe!==this&&(Qe?Qe._next=this:Tt=this,Qe=this),this._call=e,this._time=n,wn()},stop:function(){this._call&&(this._call=null,this._time=1/0,wn())}};function ks(e,t,n){var o=new Dt;return o.restart(e,t,n),o}function al(){jn(),++Re;for(var e=Tt,t;e;)(t=Ae-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Re}function io(){Ae=($t=tt.now())+Bt,Re=Ke=0;try{al()}finally{Re=0,ll(),Ae=0}}function cl(){var e=tt.now(),t=e-$t;t>Es&&(Bt-=t,$t=e)}function ll(){for(var e,t=Tt,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:Tt=n);Qe=e,wn(o)}function wn(e){if(!Re){Ke&&(Ke=clearTimeout(Ke));var t=e-Ae;t>24?(e<1/0&&(Ke=setTimeout(io,e-tt.now()-Bt)),Ue&&(Ue=clearInterval(Ue))):(Ue||($t=tt.now(),Ue=setInterval(cl,Es)),Re=1,Cs(io))}}
vendor: 5,947 bytes, line 1
1function ao(e,t,n){var o=new Dt;return t=t==null?0:+t,o.restart(s=>{o.stop(),e(s+t)},t,n),o}var ul=Rt("start","end","cancel","interrupt"),dl=[],Ms=0,co=1,vn=2,kt=3,lo=4,bn=5,Mt=6;function Ot(e,t,n,o,s,r){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;fl(e,n,{name:t,index:o,group:s,on:ul,tween:dl,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Ms})}function In(e,t){var n=he(e,t);if(n.state>Ms)throw new Error("too late; already scheduled");return n}function pe(e,t){var n=he(e,t);if(n.state>kt)throw new Error("too late; already running");return n}function he(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function fl(e,t,n){var o=e.__transition,s;o[t]=n,n.timer=ks(r,0,n.time);function r(u){n.state=co,n.timer.restart(i,n.delay,n.time),n.delay<=u&&i(u-n.delay)}function i(u){var f,d,c,h;if(n.state!==co)return l();for(f in o)if(h=o[f],h.name===n.name){if(h.state===kt)return ao(i);h.state===lo?(h.state=Mt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[f]):+f<t&&(h.state=Mt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[f])}if(ao(function(){n.state===kt&&(n.state=lo,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=vn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===vn){for(n.state=kt,s=new Array(c=n.tween.length),f=0,d=-1;f<c;++f)(h=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(s[++d]=h);s.length=d+1}}function a(u){for(var f=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(l),n.state=bn,1),d=-1,c=s.length;++d<c;)s[d].call(e,f);n.state===bn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Mt,n.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function At(e,t){var n=e.__transition,o,s,r=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((o=n[i]).name!==t){r=!1;continue}s=o.state>vn&&o.state<bn,o.state=Mt,o.timer.stop(),o.on.call(s?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[i]}r&&delete e.__transition}}function hl(e){return this.each(function(){At(this,e)})}function gl(e,t){var n,o;return function(){var s=pe(this,e),r=s.tween;if(r!==n){o=n=r;for(var i=0,a=o.length;i<a;++i)if(o[i].name===t){o=o.slice(),o.splice(i,1);break}}s.tween=o}}function pl(e,t,n){var o,s;if(typeof n!="function")throw new Error;return function(){var r=pe(this,e),i=r.tween;if(i!==o){s=(o=i).slice();for(var a={name:t,value:n},l=0,u=s.length;l<u;++l)if(s[l].name===t){s[l]=a;break}l===u&&s.push(a)}r.tween=s}}function ml(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=he(this.node(),n).tween,s=0,r=o.length,i;s<r;++s)if((i=o[s]).name===e)return i.value;return null}return this.each((t==null?gl:pl)(n,e,t))}function Pn(e,t,n){var o=e._id;return e.each(function(){var s=pe(this,o);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return he(s,o).value[t]}}function As(e,t){var n;return(typeof t=="number"?Ce:t instanceof eo?to:(n=eo(t))?(t=n,to):sa)(e,t)}function yl(e){return function(){this.removeAttribute(e)}}function xl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wl(e,t,n){var o,s=n+"",r;return function(){var i=this.getAttribute(e);return i===s?null:i===o?r:r=t(o=i,n)}}function vl(e,t,n){var o,s=n+"",r;return function(){var i=this.getAttributeNS(e.space,e.local);return i===s?null:i===o?r:r=t(o=i,n)}}function bl(e,t,n){var o,s,r;return function(){var i,a=n(this),l;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),l=a+"",i===l?null:i===o&&l===s?r:(s=l,r=t(o=i,a)))}}function _l(e,t,n){var o,s,r;return function(){var i,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),l=a+"",i===l?null:i===o&&l===s?r:(s=l,r=t(o=i,a)))}}function Nl(e,t){var n=Vt(e),o=n==="transform"?pa:As;return this.attrTween(e,typeof t=="function"?(n.local?_l:bl)(n,o,Pn(this,"attr."+e,t)):t==null?(n.local?xl:yl)(n):(n.local?vl:wl)(n,o,t))}function Sl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function El(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Cl(e,t){var n,o;function s(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&El(e,r)),n}return s._value=t,s}function kl(e,t){var n,o;function s(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Sl(e,r)),n}return s._value=t,s}function Ml(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?Cl:kl)(o,t))}function Al(e,t){return function(){In(this,e).delay=+t.apply(this,arguments)}}function jl(e,t){return t=+t,function(){In(this,e).delay=t}}function Il(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Al:jl)(t,e)):he(this.node(),t).delay}function Pl(e,t){return function(){pe(this,e).duration=+t.apply(this,arguments)}}function Tl(e,t){return t=+t,function(){pe(this,e).duration=t}}function $l(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Pl:Tl)(t,e)):he(this.node(),t).duration}function Dl(e,t){if(typeof t!="function")throw new Error;return function(){pe(this,e).ease=t}}function zl(e){var t=this._id;return arguments.length?this.each(Dl(t,e)):he(this.node(),t).ease}function Ll(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;pe(this,e).ease=n}}function Hl(e){if(typeof e!="function")throw new Error;return this.each(Ll(this._id,e))}function Fl(e){typeof e!="function"&&(e=fs(e));for(var t=this._groups,n=t.length,o=new Array(n),s=0;s<n;++s)for(var r=t[s],i=r.length,a=o[s]=[],l,u=0;u<i;++u)(l=r[u])&&e.call(l,l.__data__,u,r)&&a.push(l);return new ve(o,this._parents,this._name,this._id)}function Rl(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,s=n.length,r=Math.min(o,s),i=new Array(o),a=0;a<r;
vendor: 11,324 bytes, line 1
1++a)for(var l=t[a],u=n[a],f=l.length,d=i[a]=new Array(f),c,h=0;h<f;++h)(c=l[h]||u[h])&&(d[h]=c);for(;a<o;++a)i[a]=t[a];return new ve(i,this._parents,this._name,this._id)}function Vl(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 Bl(e,t,n){var o,s,r=Vl(t)?In:pe;return function(){var i=r(this,e),a=i.on;a!==o&&(s=(o=a).copy()).on(t,n),i.on=s}}function Ol(e,t){var n=this._id;return arguments.length<2?he(this.node(),n).on.on(e):this.each(Bl(n,e,t))}function Yl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Xl(){return this.on("end.remove",Yl(this._id))}function ql(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Mn(e));for(var o=this._groups,s=o.length,r=new Array(s),i=0;i<s;++i)for(var a=o[i],l=a.length,u=r[i]=new Array(l),f,d,c=0;c<l;++c)(f=a[c])&&(d=e.call(f,f.__data__,c,a))&&("__data__"in f&&(d.__data__=f.__data__),u[c]=d,Ot(u[c],t,n,c,u,he(f,n)));return new ve(r,this._parents,t,n)}function Wl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ds(e));for(var o=this._groups,s=o.length,r=[],i=[],a=0;a<s;++a)for(var l=o[a],u=l.length,f,d=0;d<u;++d)if(f=l[d]){for(var c=e.call(f,f.__data__,d,l),h,w=he(f,n),x=0,m=c.length;x<m;++x)(h=c[x])&&Ot(h,t,n,x,c,w);r.push(c),i.push(f)}return new ve(r,i,t,n)}var Gl=ct.prototype.constructor;function Ul(){return new Gl(this._groups,this._parents)}function Zl(e,t){var n,o,s;return function(){var r=Fe(this,e),i=(this.style.removeProperty(e),Fe(this,e));return r===i?null:r===n&&i===o?s:s=t(n=r,o=i)}}function js(e){return function(){this.style.removeProperty(e)}}function Kl(e,t,n){var o,s=n+"",r;return function(){var i=Fe(this,e);return i===s?null:i===o?r:r=t(o=i,n)}}function Ql(e,t,n){var o,s,r;return function(){var i=Fe(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Fe(this,e))),i===l?null:i===o&&l===s?r:(s=l,r=t(o=i,a))}}function Jl(e,t){var n,o,s,r="style."+t,i="end."+r,a;return function(){var l=pe(this,e),u=l.on,f=l.value[r]==null?a||(a=js(t)):void 0;(u!==n||s!==f)&&(o=(n=u).copy()).on(i,s=f),l.on=o}}function eu(e,t,n){var o=(e+="")=="transform"?ga:As;return t==null?this.styleTween(e,Zl(e,o)).on("end.style."+e,js(e)):typeof t=="function"?this.styleTween(e,Ql(e,o,Pn(this,"style."+e,t))).each(Jl(this._id,e)):this.styleTween(e,Kl(e,o,t),n).on("end.style."+e,null)}function tu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function nu(e,t,n){var o,s;function r(){var i=t.apply(this,arguments);return i!==s&&(o=(s=i)&&tu(e,i,n)),o}return r._value=t,r}function ou(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,nu(e,t,n??""))}function su(e){return function(){this.textContent=e}}function ru(e){return function(){var t=e(this);this.textContent=t??""}}function iu(e){return this.tween("text",typeof e=="function"?ru(Pn(this,"text",e)):su(e==null?"":e+""))}function au(e){return function(t){this.textContent=e.call(this,t)}}function cu(e){var t,n;function o(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&au(s)),t}return o._value=e,o}function lu(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,cu(e))}function uu(){for(var e=this._name,t=this._id,n=Is(),o=this._groups,s=o.length,r=0;r<s;++r)for(var i=o[r],a=i.length,l,u=0;u<a;++u)if(l=i[u]){var f=he(l,t);Ot(l,e,n,u,i,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new ve(o,this._parents,e,n)}function du(){var e,t,n=this,o=n._id,s=n.size();return new Promise(function(r,i){var a={value:i},l={value:function(){--s===0&&r()}};n.each(function(){var u=pe(this,o),f=u.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),u.on=t}),s===0&&r()})}var fu=0;function ve(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Is(){return++fu}var ye=ct.prototype;ve.prototype={constructor:ve,select:ql,selectAll:Wl,selectChild:ye.selectChild,selectChildren:ye.selectChildren,filter:Fl,merge:Rl,selection:Ul,transition:uu,call:ye.call,nodes:ye.nodes,node:ye.node,size:ye.size,empty:ye.empty,each:ye.each,on:Ol,attr:Nl,attrTween:Ml,style:eu,styleTween:ou,text:iu,textTween:lu,remove:Xl,tween:ml,delay:Il,duration:$l,ease:zl,easeVarying:Hl,end:du,[Symbol.iterator]:ye[Symbol.iterator]};function hu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var gu={time:null,delay:0,duration:250,ease:hu};function pu(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 mu(e){var t,n;e instanceof ve?(t=e._id,e=e._name):(t=Is(),(n=gu).time=jn(),e=e==null?null:e+"");for(var o=this._groups,s=o.length,r=0;r<s;++r)for(var i=o[r],a=i.length,l,u=0;u<a;++u)(l=i[u])&&Ot(l,e,t,u,i,n||pu(l,t));return new ve(o,this._parents,e,t)}ct.prototype.interrupt=hl;ct.prototype.transition=mu;const vt=e=>()=>e;function yu(e,{sourceEvent:t,target:n,transform:o,dispatch:s}){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:s}})}function xe(e,t,n){this.k=e,this.x=t,this.y=n}xe.prototype={constructor:xe,scale:function(e){return e===1?this:new xe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new xe(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 Yt=new xe(1,0,0);Ps.prototype=xe.prototype;function Ps(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Yt;return e.__zoom}function ln(e){e.stopImmediatePropagation()}function Ze(e){e.preventDefault(),e.stopImmediatePropagation()}function xu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function wu(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function uo(){return this.__zoom||Yt}function vu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bu(){return navigator.maxTouchPoints||"ontouchstart"in this}function _u(e,t,n){var o=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s),i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i))}function Ts(){var e=xu,t=wu,n=_u,o=vu,s=bu,r=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Et,u=Rt("start","zoom","end"),f,d,c,h=500,w=150,x=0,m=10;function y(b){b.property("__zoom",uo).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",B).filter(s).on("touchstart.zoom",V).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(b,k,S,j){var C=b.selection?b.selection():b;C.property("__zoom",uo),b!==C?_(b,k,S,j):C.interrupt().each(function(){E(this,arguments).event(j).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},y.scaleBy=function(b,k,S,j){y.scaleTo(b,function(){var C=this.__zoom.k,M=typeof k=="function"?k.apply(this,arguments):k;return C*M},S,j)},y.scaleTo=function(b,k,S,j){y.transform(b,function(){var C=t.apply(this,arguments),M=this.__zoom,L=S==null?v(C):typeof S=="function"?S.apply(this,arguments):S,H=M.invert(L),F=typeof k=="function"?k.apply(this,arguments):k;return n(p(N(M,F),L,H),C,i)},S,j)},y.translateBy=function(b,k,S,j){y.transform(b,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),i)},null,j)},y.translateTo=function(b,k,S,j,C){y.transform(b,function(){var M=t.apply(this,arguments),L=this.__zoom,H=j==null?v(M):typeof j=="function"?j.apply(this,arguments):j;return n(Yt.translate(H[0],H[1]).scale(L.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof S=="function"?-S.apply(this,arguments):-S),M,i)},j,C)};function N(b,k){return k=Math.max(r[0],Math.min(r[1],k)),k===b.k?b:new xe(k,b.x,b.y)}function p(b,k,S){var j=k[0]-S[0]*b.k,C=k[1]-S[1]*b.k;return j===b.x&&C===b.y?b:new xe(b.k,j,C)}function v(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function _(b,k,S,j){b.on("start.zoom",function(){E(this,arguments).event(j).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(j).end()}).tween("zoom",function(){var C=this,M=arguments,L=E(C,M).event(j),H=t.apply(C,M),F=S==null?v(H):typeof S=="function"?S.apply(C,M):S,z=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),R=C.__zoom,Y=typeof k=="function"?k.apply(C,M):k,q=l(R.invert(F).concat(z/R.k),Y.invert(F).concat(z/Y.k));return function(X){if(X===1)X=Y;else{var O=q(X),G=z/O[2];X=new xe(G,F[0]-O[0]*G,F[1]-O[1]*G)}L.zoom(null,X)}})}function E(b,k,S){return!S&&b.__zooming||new A(b,k)}function A(b,k){this.that=b,this.args=k,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,k),this.taps=0}A.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,k){return this.mouse&&b!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var k=ce(this.that).datum();u.call(b,this.that,new yu(b,{sourceEvent:this.sourceEvent,target:y,type:b,transform:this.that.__zoom,dispatch:u}),k)}};function T(b,...k){if(!e.apply(this,arguments))return;var S=E(this,k).event(b),j=this.__zoom,C=Math.max(r[0],Math.min(r[1],j.k*Math.pow(2,o.apply(this,arguments)))),M=ue(b);if(S.wheel)(S.mouse[0][0]!==M[0]||S.mouse[0][1]!==M[1])&&(S.mouse[1]=j.invert(S.mouse[0]=M)),clearTimeout(S.wheel);else{if(j.k===C)return;S.mouse=[M,j.invert(M)],At(this),S.start()}Ze(b),S.wheel=setTimeout(L,w),S.zoom("mouse",n(p(N(j,C),S.mouse[0],S.mouse[1]),S.extent,i));function L(){S.wheel=null,S.end()}}function $(b,...k){if(c||!e.apply(this,arguments))return;var S=b.currentTarget,j=E(this,k,!0).event(b),C=ce(b.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",z,!0),M=ue(b,S),L=b.clientX,H=b.clientY;_s(b.view),ln(b),j.mouse=[M,this.__zoom.invert(M)],At(this),j.start();function F(R){if(Ze(R),!j.moved){var Y=R.clientX-L,q=R.clientY-H;j.moved=Y*Y+q*q>x}
1j.event(R).zoom("mouse",n(p(j.that.__zoom,j.mouse[0]=ue(R,S),j.mouse[1]),j.extent,i))}function z(R){C.on("mousemove.zoom mouseup.zoom",null),Ns(R.view,j.moved),Ze(R),j.event(R).end()}}function B(b,...k){if(e.apply(this,arguments)){var S=this.__zoom,j=ue(b.changedTouches?b.changedTouches[0]:b,this),C=S.invert(j),M=S.k*(b.shiftKey?.5:2),L=n(p(N(S,M),j,C),t.apply(this,k),i);Ze(b),a>0?ce(this).transition().duration(a).call(_,L,j,b):ce(this).call(y.transform,L,j,b)}}function V(b,...k){if(e.apply(this,arguments)){var S=b.touches,j=S.length,C=E(this,k,b.changedTouches.length===j).event(b),M,L,H,F;for(ln(b),L=0;L<j;++L)H=S[L],F=ue(H,this),F=[F,this.__zoom.invert(F),H.identifier],C.touch0?!C.touch1&&C.touch0[2]!==F[2]&&(C.touch1=F,C.taps=0):(C.touch0=F,M=!0,C.taps=1+!!f);f&&(f=clearTimeout(f)),M&&(C.taps<2&&(d=F[0],f=setTimeout(function(){f=null},h)),At(this),C.start())}}function P(b,...k){if(this.__zooming){var S=E(this,k).event(b),j=b.changedTouches,C=j.length,M,L,H,F;for(Ze(b),M=0;M<C;++M)L=j[M],H=ue(L,this),S.touch0&&S.touch0[2]===L.identifier?S.touch0[0]=H:S.touch1&&S.touch1[2]===L.identifier&&(S.touch1[0]=H);if(L=S.that.__zoom,S.touch1){var z=S.touch0[0],R=S.touch0[1],Y=S.touch1[0],q=S.touch1[1],X=(X=Y[0]-z[0])*X+(X=Y[1]-z[1])*X,O=(O=q[0]-R[0])*O+(O=q[1]-R[1])*O;L=N(L,Math.sqrt(X/O)),H=[(z[0]+Y[0])/2,(z[1]+Y[1])/2],F=[(R[0]+q[0])/2,(R[1]+q[1])/2]}else if(S.touch0)H=S.touch0[0],F=S.touch0[1];else return;S.zoom("touch",n(p(L,H,F),S.extent,i))}}function D(b,...k){if(this.__zooming){var S=E(this,k).event(b),j=b.changedTouches,C=j.length,M,L;for(ln(b),c&&clearTimeout(c),c=setTimeout(function(){c=null},h),M=0;M<C;++M)L=j[M],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])<m)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return y.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:vt(+b),y):o},y.filter=function(b){return arguments.length?(e=typeof b=="function"?b:vt(!!b),y):e},y.touchable=function(b){return arguments.length?(s=typeof b=="function"?b:vt(!!b),y):s},y.extent=function(b){return arguments.length?(t=typeof b=="function"?b:vt([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),y):t},y.scaleExtent=function(b){return arguments.length?(r[0]=+b[0],r[1]=+b[1],y):[r[0],r[1]]},y.translateExtent=function(b){return arguments.length?(i[0][0]=+b[0][0],i[1][0]=+b[1][0],i[0][1]=+b[0][1],i[1][1]=+b[1][1],y):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},y.constrain=function(b){return arguments.length?(n=b,y):n},y.duration=function(b){return arguments.length?(a=+b,y):a},y.interpolate=function(b){return arguments.length?(l=b,y):l},y.on=function(){var b=u.on.apply(u,arguments);return b===u?y:b},y.clickDistance=function(b){return arguments.length?(x=(b=+b)*b,y):Math.sqrt(x)},y.tapDistance=function(b){return arguments.length?(m=+b,y):m},y}const ge={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{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."},nt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],$s=["Enter"," ","Escape"],Ds={"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 Me;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Me||(Me={}));var ot;(function(e){e.Partial="partial",e.Full="full"})(ot||(ot={}));const zs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var Se;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Se||(Se={}));var zt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(zt||(zt={}));var W;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(W||(W={}));const fo={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top};function Ls(e){return e===null?null:e?"valid":"invalid"}const Hs=e=>"id"in e&&"source"in e&&"target"in e,Nu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Tn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),lt=(e,t=[0,0])=>{const{width:n,height:o}=be(e),s=e.origin??t,r=n*s[0],i=o*s[1];return{x:e.position.x-r,y:e.position.y-i}},Su=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,s)=>{const r=typeof s=="string";let i=!t.nodeLookup&&!r?s:void 0;t.nodeLookup&&(i=r?t.nodeLookup.get(s):Tn(s)?s:t.nodeLookup.get(s.id));const a=i?Lt(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Xt(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return qt(n)},ut=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=Xt(n,Lt(s)),o=!0)}),o?qt(n):{x:0,y:0,width:0,height:0}}
1,$n=(e,t,[n,o,s]=[0,0,1],r=!1,i=!1)=>{const a={...ft(t,[n,o,s]),width:t.width/s,height:t.height/s},l=[];for(const u of e.values()){const{measured:f,selectable:d=!0,hidden:c=!1}=u;if(i&&!d||c)continue;const h=f.width??u.width??u.initialWidth??null,w=f.height??u.height??u.initialHeight??null,x=st(a,Oe(u)),m=(h??0)*(w??0),y=r&&x>0;(!u.internals.handleBounds||y||x>=m||u.dragging)&&l.push(u)}return l},Eu=(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 Cu(e,t){const n=new Map,o=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!o||o.has(s.id))&&n.set(s.id,s)}),n}async function ku({nodes:e,width:t,height:n,panZoom:o,minZoom:s,maxZoom:r},i){if(e.size===0)return Promise.resolve(!0);const a=Cu(e,i),l=ut(a),u=Dn(l,t,n,(i==null?void 0:i.minZoom)??s,(i==null?void 0:i.maxZoom)??r,(i==null?void 0:i.padding)??.1);return await o.setViewport(u,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)}function Fs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:s,onError:r}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:l,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},f=i.origin??o;let d=i.extent||s;if(i.extent==="parent"&&!i.expandParent)if(!a)r==null||r("005",ge.error005());else{const h=a.measured.width,w=a.measured.height;h&&w&&(d=[[l,u],[l+h,u+w]])}else a&&Ye(i.extent)&&(d=[[i.extent[0][0]+l,i.extent[0][1]+u],[i.extent[1][0]+l,i.extent[1][1]+u]]);const c=Ye(d)?je(t,d,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(r==null||r("015",ge.error015())),{position:{x:c.x-l+(i.measured.width??0)*f[0],y:c.y-u+(i.measured.height??0)*f[1]},positionAbsolute:c}}async function Mu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:s}){const r=new Set(e.map(c=>c.id)),i=[];for(const c of n){if(c.deletable===!1)continue;const h=r.has(c.id),w=!h&&c.parentId&&i.find(x=>x.id===c.parentId);(h||w)&&i.push(c)}const a=new Set(t.map(c=>c.id)),l=o.filter(c=>c.deletable!==!1),f=Eu(i,l);for(const c of l)a.has(c.id)&&!f.find(w=>w.id===c.id)&&f.push(c);if(!s)return{edges:f,nodes:i};const d=await s({nodes:i,edges:f});return typeof d=="boolean"?d?{edges:f,nodes:i}:{edges:[],nodes:[]}:d}const Be=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),je=(e={x:0,y:0},t,n)=>({x:Be(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Be(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Rs(e,t,n){const{width:o,height:s}=be(n),{x:r,y:i}=n.internals.positionAbsolute;return je(e,[[r,i],[r+o,i+s]],t)}const ho=(e,t,n)=>e<t?Be(Math.abs(e-t),1,t)/t:e>n?-Be(Math.abs(e-n),1,t)/t:0,Vs=(e,t,n=15,o=40)=>{const s=ho(e.x,o,t.width-o)*n,r=ho(e.y,o,t.height-o)*n;return[s,r]},Xt=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),_n=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),qt=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Oe=(e,t=[0,0])=>{var s,r;const{x:n,y:o}=Tn(e)?e.internals.positionAbsolute:lt(e,t);return{x:n,y:o,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}},Lt=(e,t=[0,0])=>{var s,r;const{x:n,y:o}=Tn(e)?e.internals.positionAbsolute:lt(e,t);return{x:n,y:o,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:o+(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0)}},Bs=(e,t)=>qt(Xt(_n(e),_n(t))),st=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},go=e=>de(e.width)&&de(e.height)&&de(e.x)&&de(e.y),de=e=>!isNaN(e)&&isFinite(e),Au=(e,t)=>{},dt=(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,s],r=!1,i=[1,1])=>{const a={x:(e-n)/s,y:(t-o)/s};return r?dt(a,i):a},Ht=({x:e,y:t},[n,o,s])=>({x:e*s+n,y:t*s+o});function De(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);
1if(!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 ju(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=De(e,n),s=De(e,t);return{top:o,right:s,bottom:o,left:s,x:s*2,y:o*2}}if(typeof e=="object"){const o=De(e.top??e.y??0,n),s=De(e.bottom??e.y??0,n),r=De(e.left??e.x??0,t),i=De(e.right??e.x??0,t);return{top:o,right:i,bottom:s,left:r,x:r+i,y:o+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Iu(e,t,n,o,s,r){const{x:i,y:a}=Ht(e,[t,n,o]),{x:l,y:u}=Ht({x:e.x+e.width,y:e.y+e.height},[t,n,o]),f=s-l,d=r-u;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(f),bottom:Math.floor(d)}}const Dn=(e,t,n,o,s,r)=>{const i=ju(r,t,n),a=(t-i.x)/e.width,l=(n-i.y)/e.height,u=Math.min(a,l),f=Be(u,o,s),d=e.x+e.width/2,c=e.y+e.height/2,h=t/2-d*f,w=n/2-c*f,x=Iu(e,h,w,f,t,n),m={left:Math.min(x.left-i.left,0),top:Math.min(x.top-i.top,0),right:Math.min(x.right-i.right,0),bottom:Math.min(x.bottom-i.bottom,0)};return{x:h-m.left+m.right,y:w-m.top+m.bottom,zoom:f}},rt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ye(e){return e!=null&&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 Os(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 Ys(e,t={width:0,height:0},n,o,s){const r={...e},i=o.get(n);if(i){const a=i.origin||s;r.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],r.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return r}function po(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Pu(){let e,t;return{promise:new Promise((o,s)=>{e=o,t=s}),resolve:e,reject:t}}function Tu(e){return{...Ds,...e||{}}}function Je(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:s}){const{x:r,y:i}=fe(e),a=ft({x:r-((s==null?void 0:s.left)??0),y:i-((s==null?void 0:s.top)??0)},o),{x:l,y:u}=n?dt(a,t):a;return{xSnapped:l,ySnapped:u,...a}}const zn=e=>({width:e.offsetWidth,height:e.offsetHeight}),Xs=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},$u=["INPUT","SELECT","TEXTAREA"];function qs(e){var o,s;const t=((s=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:$u.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".
1nokey")}const Ws=e=>"clientX"in e,fe=(e,t)=>{var r,i;const n=Ws(e),o=n?e.clientX:(r=e.touches)==null?void 0:r[0].clientX,s=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:o-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},mo=(e,t,n,o,s)=>{const r=t.querySelectorAll(`.${e}`);return!r||!r.length?null:Array.from(r).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:s,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...zn(i)}})};function Gs({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:s,sourceControlY:r,targetControlX:i,targetControlY:a}){const l=e*.125+s*.375+i*.375+n*.125,u=t*.125+r*.375+a*.375+o*.125,f=Math.abs(l-e),d=Math.abs(u-t);return[l,u,f,d]}function bt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function yo({pos:e,x1:t,y1:n,x2:o,y2:s,c:r}){switch(e){case W.Left:return[t-bt(t-o,r),n];case W.Right:return[t+bt(o-t,r),n];case W.Top:return[t,n-bt(n-s,r)];case W.Bottom:return[t,n+bt(s-n,r)]}}function Us({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:o,targetY:s,targetPosition:r=W.Top,curvature:i=.25}){const[a,l]=yo({pos:n,x1:e,y1:t,x2:o,y2:s,c:i}),[u,f]=yo({pos:r,x1:o,y1:s,x2:e,y2:t,c:i}),[d,c,h,w]=Gs({sourceX:e,sourceY:t,targetX:o,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:f});return[`M${e},${t} C${a},${l} ${u},${f} ${o},${s}`,d,c,h,w]}function Zs({sourceX:e,sourceY:t,targetX:n,targetY:o}){const s=Math.abs(n-e)/2,r=n<e?n+s:n-s,i=Math.abs(o-t)/2,a=o<t?o+i:o-i;return[r,a,s,i]}function Du({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:s=!1}){if(o!==void 0)return o;const r=s&&n?1e3:0,i=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return r+i}function zu({sourceNode:e,targetNode:t,width:n,height:o,transform:s}){const r=Xt(Lt(e),Lt(t));r.x===r.x2&&(r.x2+=1),r.y===r.y2&&(r.y2+=1);const i={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:o/s[2]};return st(i,qt(r))>0}const Lu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Hu=(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)),Ks=(e,t)=>{if(!e.source||!e.target)return t;let n;return Hs(e)?n={...e}:n={...e,id:Lu(e)},Hu(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function Qs({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[s,r,i,a]=Zs({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,s,r,i,a]}const xo={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},Fu=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},wo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Ru({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:o=W.Top,center:s,offset:r,stepPosition:i}){const a=xo[t],l=xo[o],u={x:e.x+a.x*r,y:e.y+a.y*r},f={x:n.x+l.x*r,y:n.y+l.y*r},d=Fu({source:u,sourcePosition:t,target:f}),c=d.x!==0?"x":"y",h=d[c];let w=[],x,m;const y={x:0,y:0},N={x:0,y:0},[,,p,v]=Zs({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[c]*l[c]===-1){c==="x"?(x=s.x??u.x+(f.x-u.x)*i,m=s.y??(u.y+f.y)/2):(x=s.x??(u.x+f.x)/2,m=s.y??u.y+(f.y-u.y)*i);const E=[{x,y:u.y},{x,y:f.y}],A=[{x:u.x,y:m},{x:f.x,y:m}];a[c]===h?w=c==="x"?E:A:w=c==="x"?A:E}else{const E=[{x:u.x,y:f.y}],A=[{x:f.x,y:u.y}];if(c==="x"?w=a.x===h?A:E:w=a.y===h?E:A,t===o){const P=Math.abs(e[c]-n[c]);if(P<=r){const D=Math.min(r-1,r-P);a[c]===h?y[c]=(u[c]>e[c]?-1:1)*D:N[c]=(f[c]>n[c]?-1:1)*D}}if(t!==o){const P=c==="x"?"y":"x",D=a[c]===l[P],b=u[P]>f[P],k=u[P]<f[P];(a[c]===1&&(!D&&b||D&&k)||a[c]!==1&&(!D&&k||D&&b))&&(w=c==="x"?E:A)}const T={x:u.x+y.x,y:u.y+y.y},$={x:f.x+N.x,y:f.y+N.y},B=Math.max(Math.abs(T.x-w[0].x),Math.abs($.x-w[0].x)),V=Math.max(Math.abs(T.y-w[0].y),Math.abs($.y-w[0].y));B>=V?(x=(T.x+$.x)/2,m=w[0].y):(x=w[0].x,m=(T.y+$.y)/2)}return[[e,{x:u.x+y.x,y:u.y+y.y},...w,{x:f.x+N.x,y:f.y+N.y},n],x,m,p,v]}function Vu(e,t,n,o){const s=Math.min(wo(e,t)/2,wo(t,n)/2,o),{x:r,y:i}=t;if(e.x===r&&r===n.x||e.y===i&&i===n.y)return`L${r} ${i}`;if(e.y===i){const u=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${r+s*u},${i}Q ${r},${i} ${r},${i+s*f}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${r},${i+s*l}
1Q ${r},${i} ${r+s*a},${i}`}function Nn({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:o,targetY:s,targetPosition:r=W.Top,borderRadius:i=5,centerX:a,centerY:l,offset:u=20,stepPosition:f=.5}){const[d,c,h,w,x]=Ru({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:s},targetPosition:r,center:{x:a,y:l},offset:u,stepPosition:f});return[d.reduce((y,N,p)=>{let v="";return p>0&&p<d.length-1?v=Vu(d[p-1],N,d[p+1],i):v=`${p===0?"M":"L"}${N.x} ${N.y}`,y+=v,y},""),c,h,w,x]}function vo(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Bu(e){var d;const{sourceNode:t,targetNode:n}=e;if(!vo(t)||!vo(n))return null;const o=t.internals.handleBounds||bo(t.handles),s=n.internals.handleBounds||bo(n.handles),r=_o((o==null?void 0:o.source)??[],e.sourceHandle),i=_o(e.connectionMode===Ve.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!r||!i)return(d=e.onError)==null||d.call(e,"008",ge.error008(r?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(r==null?void 0:r.position)||W.Bottom,l=(i==null?void 0:i.position)||W.Top,u=it(t,r,a),f=it(n,i,l);return{sourceX:u.x,sourceY:u.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:l}}function bo(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 it(e,t,n=W.Left,o=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,r=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??be(e);if(o)return{x:s+i/2,y:r+a/2};switch((t==null?void 0:t.position)??n){case W.Top:return{x:s+i/2,y:r};case W.Right:return{x:s+i,y:r+a/2};case W.Bottom:return{x:s+i/2,y:r+a};case W.Left:return{x:s,y:r+a/2}}}function _o(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Sn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Ou(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:s}){const r=new Set;return e.reduce((i,a)=>
1([a.markerStart||o,a.markerEnd||s].forEach(l=>{if(l&&typeof l=="object"){const u=Sn(l,t);r.has(u)||(i.push({id:u,color:l.color||n,...l}),r.add(u))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const Js=1e3,Yu=10,Ln={nodeOrigin:[0,0],nodeExtent:nt,elevateNodesOnSelect:!0,defaults:{}},Xu={...Ln,checkEquality:!0};function Hn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function qu(e,t,n){const o=Hn(Ln,n);for(const s of e.values())if(s.parentId)Fn(s,e,t,o);else{const r=lt(s,o.nodeOrigin),i=Ye(s.extent)?s.extent:o.nodeExtent,a=je(r,i,be(s));s.internals.positionAbsolute=a}}function Wu(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],o=[];for(const s of e.handles){const r={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(r):s.type==="target"&&o.push(r)}return{source:n,target:o}}function En(e,t,n,o){var u,f;const s=Hn(Xu,o);let r={i:-1},i=e.length>0;const a=new Map(t),l=s!=null&&s.elevateNodesOnSelect?Js:0;t.clear(),n.clear();for(const d of e){let c=a.get(d.id);if(s.checkEquality&&d===(c==null?void 0:c.internals.userNode))t.set(d.id,c);else{const h=lt(d,s.nodeOrigin),w=Ye(d.extent)?d.extent:s.nodeExtent,x=je(h,w,be(d));c={...s.defaults,...d,measured:{width:(u=d.measured)==null?void 0:u.width,height:(f=d.measured)==null?void 0:f.height},internals:{positionAbsolute:x,handleBounds:Wu(d,c),z:er(d,l),userNode:d}},t.set(d.id,c)}(c.measured===void 0||c.measured.width===void 0||c.measured.height===void 0)&&!c.hidden&&(i=!1),d.parentId&&Fn(c,t,n,o,r)}return i}function Gu(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 Fn(e,t,n,o,s){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:a}=Hn(Ln,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Gu(e,n),s&&!u.parentId&&u.internals.rootParentIndex===void 0&&(u.internals.rootParentIndex=++s.i,u.internals.z=u.internals.z+s.i*Yu),s&&u.internals.rootParentIndex!==void 0&&(s.i=u.internals.rootParentIndex);const f=r?Js:0,{x:d,y:c,z:h}=Uu(e,u,i,a,f),{positionAbsolute:w}=e.internals,x=d!==w.x||c!==w.y;(x||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:d,y:c}:w,z:h}})}function er(e,t){return(de(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Uu(e,t,n,o,s){const{x:r,y:i}=t.internals.positionAbsolute,a=be(e),l=lt(e,n),u=Ye(e.extent)?je(l,e.extent,a):l;let f=je({x:r+u.x,y:i+u.y},o,a);e.extent==="parent"&&(f=Rs(f,a,t));const d=er(e,s),c=t.internals.z??0;return{x:f.x,y:f.y,z:c>=d?c+1:d}}function Rn(e,t,n,o=[0,0]){var i;const s=[],r=new Map;for(const a of e){const l=t.get(a.parentId);if(!l)continue;const u=((i=r.get(a.parentId))==null?void 0:i.expandedRect)??Oe(l),f=Bs(u,a.rect);r.set(a.parentId,{expandedRect:f,parent:l})}return r.size>0&&r.forEach(({expandedRect:a,parent:l},u)=>{var p;const f=l.internals.positionAbsolute,d=be(l),c=l.origin??o,h=a.x<f.x?Math.round(Math.abs(f.x-a.x)):0,w=a.y<f.y?Math.round(Math.abs(f.y-a.y)):0,x=Math.max(d.width,Math.round(a.width)),m=Math.max(d.height,Math.round(a.height)),y=(x-d.width)*c[0],N=(m-d.height)*c[1];(h>0||w>0||y||N)&&(s.push({id:u,type:"position",position:{x:l.position.x-h+y,y:l.position.y-w+N}}),(p=n.get(u))==null||p.forEach(v=>{e.some(_=>_.id===v.id)||s.push({id:v.id,type:"position",position:{x:v.position.x+h,y:v.position.y+w}})})),(d.width<a.width||d.height<a.height||h||w)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?c[0]*h-y:0),height:m+(w?c[1]*w-N:0)}})}),s}function Zu(e,t,n,o,s,r){const i=o==null?void 0:o.querySelector(".xyflow__viewport");let a=!1;if(!i)return{changes:[],updatedInternals:a};const l=[],u=window.getComputedStyle(i),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(const c of e.values()){const h=t.get(c.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),a=!0;continue}const w=zn(c.nodeElement),x=h.measured.width!==w.width||h.measured.height!==w.height;if(!!(w.width&&w.height&&(x||!h.internals.handleBounds||c.force))){const y=c.nodeElement.getBoundingClientRect(),N=Ye(h.extent)?h.extent:r;let{positionAbsolute:p}=h.internals;h.parentId&&h.extent==="parent"?p=Rs(p,w,t.get(h.parentId)):N&&(p=je(p,N,w));const v={...h,measured:w,internals:{...h.internals,positionAbsolute:p,handleBounds:{source:mo("source",c.nodeElement,y,f,h.id),target:mo("target",c.nodeElement,y,f,h.id)}}};t.set(h.id,v),h.parentId&&Fn(v,t,n,{nodeOrigin:s}),a=!0,x&&(l.push({id:h.id,type:"dimensions",dimensions:w}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:Oe(v,s)}))}}if(d.length>0){const c=Rn(d,t,n,s);l.push(...c)}return{changes:l,updatedInternals:a}}async function Ku({delta:e,panZoom:t,transform:n,translateExtent:o,width:s,height:r}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,r]],o),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function No(e,t,n,o,s,r){let i=s;const a=o.get(i)||new Map;o.set(i,a.set(n,t)),i=`${s}-${e}`;const l=o.get(i)||new Map;if(o.set(i,l.set(n,t)),r){i=`${s}-${e}-${r}`;const u=o.get(i)||new Map;o.set(i,u.set(n,t))}}function tr(e,t,n){e.clear(),t.clear();for(const o of n){const{source:s,target:r,sourceHandle:i=null,targetHandle:a=null}=o,l={edgeId:o.id,source:s,target:r,sourceHandle:i,targetHandle:a},u=`${s}-${i}--${r}-${a}`,f=`${r}-${a}--${s}-${i}`;No("source",l,f,e,s,i),No("target",l,u,e,r,a),t.set(o.id,o)}}function nr(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:nr(n,t):!1}function So(e,t,n){var s;let o=e;do{if((s=o==null?void 0:o.matches)!=null&&s.call(o,t))return!0;
1if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function Qu(e,t,n,o){const s=new Map;for(const[r,i]of e)if((i.selected||i.id===o)&&(!i.parentId||!nr(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(r);a&&s.set(r,{id:r,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 s}function un({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){var i,a,l;const s=[];for(const[u,f]of t){const d=(i=n.get(u))==null?void 0:i.internals.userNode;d&&s.push({...d,position:f.position,dragging:o})}if(!e)return[s[0],s];const r=(a=n.get(e))==null?void 0:a.internals.userNode;return[r?{...r,position:((l=t.get(e))==null?void 0:l.position)||r.position,dragging:o}:s[0],s]}function Ju({dragItems:e,snapGrid:t,x:n,y:o}){const s=e.values().next().value;if(!s)return null;const r={x:n-s.distance.x,y:o-s.distance.y},i=dt(r,t);return{x:i.x-r.x,y:i.y-r.y}}function ed({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:s}){let r={x:null,y:null},i=0,a=new Map,l=!1,u={x:0,y:0},f=null,d=!1,c=null,h=!1,w=!1,x=null;function m({noDragClassName:N,handleSelector:p,domNode:v,isSelectable:_,nodeId:E,nodeClickDistance:A=0}){c=ce(v);function T({x:P,y:D}
1){const{nodeLookup:b,nodeExtent:k,snapGrid:S,snapToGrid:j,nodeOrigin:C,onNodeDrag:M,onSelectionDrag:L,onError:H,updateNodePositions:F}=t();r={x:P,y:D};let z=!1;const R=a.size>1,Y=R&&k?_n(ut(a)):null,q=R&&j?Ju({dragItems:a,snapGrid:S,x:P,y:D}):null;for(const[X,O]of a){if(!b.has(X))continue;let G={x:P-O.distance.x,y:D-O.distance.y};j&&(G=q?{x:Math.round(G.x+q.x),y:Math.round(G.y+q.y)}:dt(G,S));let Q=null;if(R&&k&&!O.extent&&Y){const{positionAbsolute:U}=O.internals,J=U.x-Y.x+k[0][0],te=U.x+O.measured.width-Y.x2+k[1][0],ne=U.y-Y.y+k[0][1],ie=U.y+O.measured.height-Y.y2+k[1][1];Q=[[J,ne],[te,ie]]}const{position:K,positionAbsolute:Z}=Fs({nodeId:X,nextPosition:G,nodeLookup:b,nodeExtent:Q||k,nodeOrigin:C,onError:H});z=z||O.position.x!==K.x||O.position.y!==K.y,O.position=K,O.internals.positionAbsolute=Z}if(w=w||z,!!z&&(F(a,!0),x&&(o||M||!E&&L))){const[X,O]=un({nodeId:E,dragItems:a,nodeLookup:b});o==null||o(x,a,X,O),M==null||M(x,X,O),E||L==null||L(x,O)}}async function $(){if(!f)return;const{transform:P,panBy:D,autoPanSpeed:b,autoPanOnNodeDrag:k}=t();if(!k){l=!1,cancelAnimationFrame(i);return}const[S,j]=Vs(u,f,b);(S!==0||j!==0)&&(r.x=(r.x??0)-S/P[2],r.y=(r.y??0)-j/P[2],await D({x:S,y:j})&&T(r)),i=requestAnimationFrame($)}function B(P){var R;const{nodeLookup:D,multiSelectionActive:b,nodesDraggable:k,transform:S,snapGrid:j,snapToGri
1d:C,selectNodesOnDrag:M,onNodeDragStart:L,onSelectionDragStart:H,unselectNodesAndEdges:F}=t();d=!0,(!M||!_)&&!b&&E&&((R=D.get(E))!=null&&R.selected||F()),_&&M&&E&&(e==null||e(E));const z=Je(P.sourceEvent,{transform:S,snapGrid:j,snapToGrid:C,containerBounds:f});if(r=z,a=Qu(D,k,z,E),a.size>0&&(n||L||!E&&H)){const[Y,q]=un({nodeId:E,dragItems:a,nodeLookup:D});n==null||n(P.sourceEvent,a,Y,q),L==null||L(P.sourceEvent,Y,q),E||H==null||H(P.sourceEvent,q)}}const V=Ss().clickDistance(A).on("start",P=>{const{domNode:D,nodeDragThreshold:b,transform:k,snapGrid:S,snapToGrid:j}=t();f=(D==null?void 0:D.getBoundingClientRect())||null,h=!1,w=!1,x=P.sourceEvent,b===0&&B(P),r=Je(P.sourceEvent,{transform:k,snapGrid:S,snapToGrid:j,containerBounds:f}),u=fe(P.sourceEvent,f)}).on("drag",P=>{const{autoPanOnNodeDrag:D,transform:b,snapGrid:k,snapToGrid:S,nodeDragThreshold:j,nodeLookup:C}=t(),M=Je(P.sourceEvent,{transform:b,snapGrid:k,snapToGrid:S,containerBounds:f});if(x=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||E&&!C.has(E))&&(h=!0),!h){if(!l&&D&&d&&(l=!0,$()),!d){const L=fe(P.sourceEvent,f),H=L.x-u.x,F=L.y-u.y;Math.sqrt(H*H+F*F)>j&&B(P)}(r.x!==M.xSnapped||r.y!==M.ySnapped)&&a&&d&&(u=fe(P.sourceEvent,f),T(M))}}).on("end",P=>{if(!(!d||h)&&(l=!1,d=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:D,updateNodePositions:b,onNodeDragStop:k,onSelectionDragStop:S}=t();if(w&&(b(a,!1),w=!1),s||k||!E&&S){const[j,C]=un({nodeId:E,dragItems:a,nodeLookup:D,dragging:!1});s==null||s(P.sourceEvent,a,j,C),k==null||k(P.sourceEvent,j,C),E||S==null||S(P.sourceEvent,C)}}}).filter(P=>{const D=P.target;return!P.button&&(!N||!So(D,`.${N}`,v))&&(!p||So(D,p,v))});c.call(V)}function y(){c==null||c.on(".drag",null)}return{update:m,destroy:y}}function td(e,t,n){const o=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())st(s,Oe(r))>0&&o.push(r);return o}const nd=250;function od(e,t,n,o){var a,l;let s=[],r=1/0;const i=td(e,n,t+nd);for(const u of i){const f=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((l=u.internals.handleBounds)==null?void 0:l.target)??[]];for(const d of f){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:c,y:h}=it(u,d,d.position,!0),w=Math.sqrt(Math.pow(c-e.x,2)+Math.pow(h-e.y,2));w>t||(w<r?(s=[{...d,x:c,y:h}],r=w):w===r&&s.push({...d,x:c,y:h}))}}if(!s.length)return null;if(s.length>1){const u=o.type==="source"?"target":"source";return s.find(f=>f.type===u)??s[0]}return s[0]}function or(e,t,n,o,s,r=!1){var u,f,d;const i=o.get(e);if(!i)return null;const a=s==="strict"?(u=i.internals.handleBounds)==null?void 0:u[t]:[...((f=i.internals.handleBounds)==null?void 0:f.source)??[],...((d=i.internals.handleBounds)==null?void 0:d.target)??[]],l=(n?a==null?void 0:a.find(c=>c.id===n):a==null?void 0:a[0])??null;return l&&r?{...l,...it(i,l,l.position,!0)}:l}function sr(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function sd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const rr=()=>!0;function rd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:s,edgeUpdaterType:r,isTarget:i,domNode:a,nodeLookup:l,lib:u,autoPanOnConnect:f,flowId:d,panBy:c,cancelConnection:h,onConnectStart:w,onConnect:x,onConnectEnd:m,isValidConnection:y=rr,onReconnectEnd:N,updateConnection:p,getTransform:v,getFromHandle:_,autoPanSpeed:E,dragThreshold:A=1,handleDomNode:T}){const $=Xs(e.target);let B=0,V;const{x:P,y:D}=fe(e),b=sr(r,T),k=a==null?void 0:a.getBoundingClientRect();let S=!1;if(!k||!b)return;const j=or(s,b,o,l,t);if(!j)return;let C=fe(e,k),M=!1,L=null,H=!1,F=null;function z(){if(!f||!k)return;const[K,Z]=Vs(C,k,E);c({x:K,y:Z}),B=requestAnimationFrame(z)}const R={...j,nodeId:s,type:b,position:j.position},Y=l.get(s);let X={inProgress:!0,isValid:null,from:it(Y,R,W.Left,!0),fromHandle:R,fromPosition:R.position,fromNode:Y,to:C,toHandle:null,toPosition:fo[R.position],toNode:null};function O(){S=!0,p(X),w==null||w(e,{nodeId:s,handleId:o,handleType:b})}A===0&&O();function G(K){if(!S){const{x:te,y:ne}=fe(K),ie=te-P,me=ne-D;if(!(ie*ie+me*me>A*A))return;O()}if(!_()||!R){Q(K);return}const Z=v();C=fe(K,k),V=od(ft(C,Z,!1,[1,1]),n,l,R),M||(z(),M=!0);const U=ir(K,{handle:V,connectionMode:t,fromNodeId:s,fromHandleId:o,fromType:i?"target":"source",isValidConnection:y,doc:$,lib:u,flowId:d,nodeLookup:l});
1F=U.handleDomNode,L=U.connection,H=sd(!!V,U.isValid);const J={...X,isValid:H,to:U.toHandle&&H?Ht({x:U.toHandle.x,y:U.toHandle.y},Z):C,toHandle:U.toHandle,toPosition:H&&U.toHandle?U.toHandle.position:fo[R.position],toNode:U.toHandle?l.get(U.toHandle.nodeId):null};H&&V&&X.toHandle&&J.toHandle&&X.toHandle.type===J.toHandle.type&&X.toHandle.nodeId===J.toHandle.nodeId&&X.toHandle.id===J.toHandle.id&&X.to.x===J.to.x&&X.to.y===J.to.y||(p(J),X=J)}function Q(K){if(!("touches"in K&&K.touches.length>0)){if(S){(V||F)&&L&&H&&(x==null||x(L));const{inProgress:Z,...U}=X,J={...U,toPosition:X.toHandle?X.toPosition:null};m==null||m(K,J),r&&(N==null||N(K,J))}h(),cancelAnimationFrame(B),M=!1,H=!1,L=null,F=null,$.removeEventListener("mousemove",G),$.removeEventListener("mouseup",Q),$.removeEventListener("touchmove",G),$.removeEventListener("touchend",Q)}}$.addEventListener("mousemove",G),$.addEventListener("mouseup",Q),$.addEventListener("touchmove",G),$.addEventListener("touchend",Q)}function ir(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:s,fromType:r,doc:i,lib:a,flowId:l,isValidConnection:u=rr,nodeLookup:f}){const d=r==="target",c=t?i.querySelector(`.${a}-flow__handle[data-id="${l}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:w}=fe(e),x=i.elementFromPoint(h,w),m=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:c,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const N=sr(void 0,m),p=m.getAttribute("data-nodeid"),v=m.getAttribute("data-handleid"),_=m.classList.contains("connectable"),E=m.classList.contains("connectableend");if(!p||!N)return y;const A={source:d?p:o,sourceHandle:d?v:s,target:d?o:p,targetHandle:d?s:v};y.connection=A;const $=_&&E&&(n===Ve.Strict?d&&N==="source"||!d&&N==="target":p!==o||v!==s);y.isValid=$&&u(A),y.toHandle=or(p,N,v,f,n,!0)}return y}const Cn={onPointerDown:rd,isValid:ir};function id({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const s=ce(e);function r({translateExtent:a,width:l,height:u,zoomStep:f=1,pannable:d=!0,zoomable:c=!0,inversePan:h=!1}){const w=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const v=n(),_=p.sourceEvent.ctrlKey&&rt()?10:1,E=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*f,A=v[2]*Math.pow(2,E*_);t.scaleTo(A)};let x=[0,0];const m=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(x=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},y=p=>{const v=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const _=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],E=[_[0]-x[0],_[1]-x[1]];x=_;const A=o()*Math.max(v[2],Math.log(v[2]))*(h?-1:1),T={x:v[0]-E[0]*A,y:v[1]-E[1]*A},$=[[0,0],[l,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:v[2]},$,a)},N=Ts().on("start",m).on("zoom",d?y:null).on("zoom.wheel",c?w:null);s.call(N,{})}function i(){s.on("zoom",null)}return{update:r,destroy:i,pointer:ue}}const Wt=e=>({x:e.x,y:e.y,zoom:e.k}),dn=({x:e,y:t,zoom:n})=>Yt.translate(e,t).scale(n),ze=(e,t)=>e.target.closest(`.${t}`),ar=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ad=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,fn=(e,t=0,n=ad,o=()=>{})=>{const s=typeof t=="number"&&t>0;return s||o(),s?e.transition().duration(t).ease(n).on("end",o):e},cr=e=>{const t=e.ctrlKey&&rt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function cd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:s,panOnScrollSpeed:r,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:u}){return f=>{if(ze(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(f.ctrlKey&&i){const m=ue(f),y=cr(f),N=d*Math.pow(2,y);o.scaleTo(n,N,m,f);return}const c=f.deltaMode===1?20:1;let h=s===Me.Vertical?0:f.deltaX*c,w=s===Me.Horizontal?0:f.deltaY*c;!rt()&&f.shiftKey&&s!==Me.Vertical&&(h=f.deltaY*c,w=0),o.translateBy(n,-(h/d)*r,-(w/d)*r,{internal:!0});const x=Wt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l==null||l(f,x),e.panScrollTimeout=setTimeout(()=>{u==null||u(f,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(f,x))}}function ld({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,s){const r=o.type==="wheel",i=!t&&r&&!o.ctrlKey,a=ze(o,e);if(o.ctrlKey&&r&&a&&o.preventDefault(),i||a)return null;o.preventDefault(),n.call(this,o,s)}}function ud({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{var r,i,a;if((r=o.sourceEvent)!=null&&r.internal)return;const s=Wt(o.transform);e.mouseButton=((i=o.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(o.sourceEvent,s))}}function dd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:s}){return r=>{var i,a;e.usedRightMouseButton=!!(n&&ar(t,e.mouseButton??0)),(i=r.sourceEvent)!=null&&i.sync||o([r.transform.x,r.transform.y,r.transform.k]),s&&!((a=r.sourceEvent)!=null&&a.internal)&&(s==null||s(r.sourceEvent,Wt(r.transform)))}}function fd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:s,onPaneContextMenu:r}){return i=>{var a;if(!((a=i.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,r&&ar(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&r(i.sourceEvent),e.usedRightMouseButton=!1,o(!1),s)){const l=Wt(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(i.sourceEvent,l)},n?150:0)}}}function hd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:s,zoomOnDoubleClick:r,userSelectionActive:i,noWheelClassName:a,noPanClassName:l,lib:u,connectionInProgress:f}){return d=>{var m;const c=e||t,h=n&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(ze(d,`${u}-flow__node`)||ze(d,`${u}-flow__edge`)))return!0;
1if(!o&&!c&&!s&&!r&&!n||i||f&&!w||ze(d,a)&&w||ze(d,l)&&(!w||s&&w&&!e)||!n&&d.ctrlKey&&w)return!1;if(!n&&d.type==="touchstart"&&((m=d.touches)==null?void 0:m.length)>1)return d.preventDefault(),!1;if(!c&&!s&&!h&&w||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w)&&x}}function gd({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:s,viewport:r,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:u}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),c=Ts().clickDistance(!de(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(s),h=ce(e).call(c);p({x:r.x,y:r.y,zoom:Be(r.zoom,t,n)},[[0,0],[d.width,d.height]],s);const w=h.on("wheel.zoom"),x=h.on("dblclick.zoom");c.wheelDelta(cr);function m(P,D){return h?new Promise(b=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?an:Et).transform(fn(h,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>b(!0)),P)}):Promise.resolve(!1)}function y({noWheelClassName:P,noPanClassName:D,onPaneContextMenu:b,userSelectionActive:k,panOnScroll:S,panOnDrag:j,panOnScrollMode:C,panOnScrollSpeed:M,preventScrolling:L,zoomOnPinch:H,zoomOnScroll:F,zoomOnDoubleClick:z,zoomActivationKeyPressed:R,lib:Y,onTransformChange:q,connectionInProgress:X}){k&&!f.isZoomingOrPanning&&N();const G=S&&!R&&!k?cd({zoomPanValues:f,noWheelClassName:P,d3Selection:h,d3Zoom:c,panOnScrollMode:C,panOnScrollSpeed:M,zoomOnPinch:H,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):ld({noWheelClassName:P,preventScrolling:L,d3ZoomHandler:w});if(h.on("wheel.zoom",G,{passive:!1}),!k){const K=ud({zoomPanValues:f,onDraggingChange:u,onPanZoomStart:a});c.on("start",K);const Z=dd({zoomPanValues:f,panOnDrag:j,onPaneContextMenu:!!b,onPanZoom:i,onTransformChange:q});c.on("zoom",Z);const U=fd({zoomPanValues:f,panOnDrag:j,panOnScroll:S,onPaneContextMenu:b,onPanZoomEnd:l,onDraggingChange:u});c.on("end",U)}const Q=hd({zoomActivationKeyPressed:R,panOnDrag:j,zoomOnScroll:F,panOnScroll:S,zoomOnDoubleClick:z,zoomOnPinch:H,userSelectionActive:k,noPanClassName:D,noWheelClassName:P,lib:Y,connectionInProgress:X});c.filter(Q),z?h.on("dblclick.zoom",x):h.on("dblclick.zoom",null)}function N(){c.on("zoom",null)}async function p(P,D,b){const k=dn(P),S=c==null?void 0:c.constrain()(k,D,b);return S&&await m(S),new Promise(j=>j(S))}async function v(P,D){const b=dn(P);return await m(b,D),new Promise(k=>k(b))}function _(P){if(h){const D=dn(P),b=h.property("__zoom");(b.k!==P.zoom||b.x!==P.x||b.y!==P.y)&&(c==null||c.transform(h,D,null,{sync:!0}))}}function E(){const P=h?Ps(h.node()):{x:0,y:0,k:1};return{x:P.x,y:P.y,zoom:P.k}}function A(P,D){return h?new Promise(b=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?an:Et).scaleTo(fn(h,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>b(!0)),P)}):Promise.resolve(!1)}function T(P,D){return h?new Promise(b=>{c==null||c.interpolate((D==null?void 0:D.interpolate)==="linear"?an:Et).scaleBy(fn(h,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>b(!0)),P)}):Promise.resolve(!1)}function $(P){c==null||c.scaleExtent(P)}function B(P){c==null||c.translateExtent(P)}function V(P){const D=!de(P)||P<0?0:P;c==null||c.clickDistance(D)}return{update:y,destroy:N,setViewport:v,setViewportConstrained:p,getViewport:E,scaleTo:A,scaleBy:T,setScaleExtent:$,setTranslateExtent:B,syncViewport:_,setClickDistance:V}}var Xe;(function(e){e.Line="line",e.Handle="handle"})(Xe||(Xe={}));function pd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:s,affectsY:r}){const i=e-t,a=n-o,l=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&s&&(l[0]=l[0]*-1),a&&r&&(l[1]=l[1]*-1),l}function Eo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:s}}function _e(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 Co(e,t){return e?!t:t}function md(e,t,n,o,s,r,i,a){let{affectsX:l,affectsY:u}=t;const{isHorizontal:f,isVertical:d}=t,c=f&&d,{xSnapped:h,ySnapped:w}=n,{minWidth:x,maxWidth:m,minHeight:y,maxHeight:N}=o,{x:p,y:v,width:_,height:E,aspectRatio:A}=e;let T=Math.floor(f?h-e.pointerX:0),$=Math.floor(d?w-e.pointerY:0);const B=_+(l?-T:T),V=E+(u?-$:$),P=-r[0]*_,D=-r[1]*E;let b=_t(B,x,m),k=_t(V,y,N);if(i){let C=0,M=0;l&&T<0?C=_e(p+T+P,i[0][0]):!l&&T>0&&(C=Ne(p+B+P,i[1][0])),u&&$<0?M=_e(v+$+D,i[0][1]):!u&&$>0&&(M=Ne(v+V+D,i[1][1])),b=Math.max(b,C),k=Math.max(k,M)}if(a){let C=0,M=0;l&&T>
10?C=Ne(p+T,a[0][0]):!l&&T<0&&(C=_e(p+B,a[1][0])),u&&$>0?M=Ne(v+$,a[0][1]):!u&&$<0&&(M=_e(v+V,a[1][1])),b=Math.max(b,C),k=Math.max(k,M)}if(s){if(f){const C=_t(B/A,y,N)*A;if(b=Math.max(b,C),i){let M=0;!l&&!u||l&&!u&&c?M=Ne(v+D+B/A,i[1][1])*A:M=_e(v+D+(l?T:-T)/A,i[0][1])*A,b=Math.max(b,M)}if(a){let M=0;!l&&!u||l&&!u&&c?M=_e(v+B/A,a[1][1])*A:M=Ne(v+(l?T:-T)/A,a[0][1])*A,b=Math.max(b,M)}}if(d){const C=_t(V*A,x,m)/A;if(k=Math.max(k,C),i){let M=0;!l&&!u||u&&!l&&c?M=Ne(p+V*A+P,i[1][0])/A:M=_e(p+(u?$:-$)*A+P,i[0][0])/A,k=Math.max(k,M)}if(a){let M=0;!l&&!u||u&&!l&&c?M=_e(p+V*A,a[1][0])/A:M=Ne(p+(u?$:-$)*A,a[0][0])/A,k=Math.max(k,M)}}}$=$+($<0?k:-k),T=T+(T<0?b:-b),s&&(c?B>V*A?$=(Co(l,u)?-T:T)/A:T=(Co(l,u)?-$:$)*A:f?($=T/A,u=l):(T=$*A,l=u));const S=l?p+T:p,j=u?v+$:v;return{width:_+(l?-T:T),height:E+(u?-$:$),x:r[0]*T*(l?-1:1)+S,y:r[1]*$*(u?-1:1)+j}}const lr={width:0,height:0,x:0,y:0},yd={...lr,pointerX:0,pointerY:0,aspectRatio:1};function xd(e){return[[0,0],[e.measured.width,e.measured.height]]}function wd(e,t,n){const o=t.position.x+e.position.x,s=t.position.y+e.position.y,r=e.measured.width??0,i=e.measured.height??0,a=n[0]*r,l=n[1]*i;return[[o-a,s-l],[o+r-a,s+i-l]]}function vd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:s}){const r=ce(e);let i={controlDirection:Eo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:f,keepAspectRatio:d,resizeDirection:c,onResizeStart:h,onResize:w,onResizeEnd:x,shouldResize:m}){let y={...lr},N={...yd};i={boundaries:f,resizeDirection:c,keepAspectRatio:d,controlDirection:Eo(u)};let p,v=null,_=[],E,A,T,$=!1;const B=Ss().on("start",V=>{const{nodeLookup:P,transform:D,snapGrid:b,snapToGrid:k,nodeOrigin:S,paneDomNode:j}=n();if(p=P.get(t),!p)return;v=(j==null?void 0:j.getBoundingClientRect())??null;const{xSnapped:C,ySnapped:M}=Je(V.sourceEvent,{transform:D,snapGrid:b,snapToGrid:k,containerBounds:v});y={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},N={...y,pointerX:C,pointerY:M,aspectRatio:y.width/y.height},E=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(E=P.get(p.parentId),A=E&&p.extent==="parent"?xd(E):void 0),_=[],T=void 0;for(const[L,H]of P)if(H.parentId===t&&(_.push({id:L,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const F=wd(H,p,H.origin??S);T?T=[[Math.min(F[0][0],T[0][0]),Math.min(F[0][1],T[0][1])],[Math.max(F[1][0],T[1][0]),Math.max(F[1][1],T[1][1])]]:T=F}h==null||h(V,{...y})}).on("drag",V=>{const{transform:P,snapGrid:D,snapToGrid:b,nodeOrigin:k}=n(),S=Je(V.sourceEvent,{transform:P,snapGrid:D,snapToGrid:b,containerBounds:v}),j=[];if(!p)return;const{x:C,y:M,width:L,height:H}=y,F={},z=p.origin??k,{width:R,height:Y,x:q,y:X}=md(N,i.controlDirection,S,i.boundaries,i.keepAspectRatio,z,A,T),O=R!==L,G=Y!==H,Q=q!==C&&O,K=X!==M&&G;if(!Q&&!K&&!O&&!G)return;if((Q||K||z[0]===1||z[1]===1)&&(F.x=Q?q:y.x,F.y=K?X:y.y,y.x=F.x,y.y=F.y,_.length>0)){const te=q-C,ne=X-M;for(const ie of _)ie.position={x:ie.position.x-te+z[0]*(R-L),y:ie.position.y-ne+z[1]*(Y-H)},j.push(ie)}if((O||G)&&(F.width=O&&(!i.resizeDirection||i.resizeDirection==="horizontal")?R:y.width,F.height=G&&(!i.resizeDirection||i.resizeDirection==="vertical")?Y:y.height,y.width=F.width,y.height=F.height),E&&p.expandParent){const te=z[0]*(F.width??0);F.x&&F.x<te&&(y.x=te,N.x=N.x-(F.x-te));const ne=z[1]*(F.height??0);F.y&&F.y<ne&&(y.y=ne,N.y=N.y-(F.y-ne))}const Z=pd({width:y.width,prevWidth:L,height:y.height,prevHeight:H,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),U={...y,direction:Z};(m==null?void 0:m(V,U))!==!1&&($=!0,w==null||w(V,U),o(F,j))}).on("end",V=>{$&&(x==null||x(V,{...y}),s==null||s({...y}),$=!1)});r.call(B)}function l(){r.on(".drag",null)}return{update:a,destroy:l}}const{useDebugValue:bd}=Ki,{useSyncExternalStoreWithSelector:_d}=ra,Nd=e=>e;function ur(e,t=Nd,n){const o=_d(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return bd(o),o}const ko=(e,t)=>{const n=ia(e),o=(s,r=t)=>ur(n,s,r);return Object.assign(o,n),o},Sd=(e,t)=>e?ko(e,t):ko;function se(e,t){if(Object.is(e,t))return!0;
1if(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,s]of e)if(!Object.is(s,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 Gt=I.createContext(null),Ed=Gt.Provider,dr=ge.error001();function ee(e,t){const n=I.useContext(Gt);if(n===null)throw new Error(dr);return ur(n,e,t)}function oe(){const e=I.useContext(Gt);if(e===null)throw new Error(dr);return I.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Mo={display:"none"},Cd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},fr="react-flow__node-desc",hr="react-flow__edge-desc",kd="react-flow__aria-live",Md=e=>e.ariaLiveMessage,Ad=e=>e.ariaLabelConfig;function jd({rfId:e}){const t=ee(Md);return g.jsx("div",{id:`${kd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Cd,children:t})}function Id({rfId:e,disableKeyboardA11y:t}){const n=ee(Ad);return g.jsxs(g.Fragment,{children:[g.jsx("div",{id:`${fr}-${e}`,style:Mo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),g.jsx("div",{id:`${hr}-${e}`,style:Mo,children:n["edge.a11yDescription.default"]}),!t&&g.jsx(jd,{rfId:e})]})}const Ut=I.forwardRef(({position:e="top-left",children:t,className:n,style:o,...s},r)=>{const i=`${e}`.split("-");return g.jsx("div",{className:re(["react-flow__panel",n,...i]),style:o,ref:r,...s,children:t})});Ut.displayName="Panel";function Pd({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:g.jsx(Ut,{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:g.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Td=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}},Nt=e=>e.id;function $d(e,t){return se(e.selectedNodes.map(Nt),t.selectedNodes.map(Nt))&&se(e.selectedEdges.map(Nt),t.selectedEdges.map(Nt))}function Dd({onSelectionChange:e}){const t=oe(),{selectedNodes:n,selectedEdges:o}=ee(Td,$d);return I.useEffect(()=>{const s={nodes:n,edges:o};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(r=>r(s))},[n,o,e]),null}const zd=e=>!!e.onSelectionChangeHandlers;function Ld({onSelectionChange:e}){const t=ee(zd);return e||t?g.jsx(Dd,{onSelectionChange:e}):null}const gr=[0,0],Hd={x:0,y:0,zoom:1},Fd=["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"],Ao=[...Fd,"rfId"],Rd=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setN
1odeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),jo={translateExtent:nt,nodeOrigin:gr,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function Vd(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:s,setTranslateExtent:r,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:l,setPaneClickDistance:u}=ee(Rd,se),f=oe();I.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=jo,a()}),[]);const d=I.useRef(jo);return I.useEffect(()=>{for(const c of Ao){const h=e[c],w=d.current[c];h!==w&&(typeof e[c]>"u"||(c==="nodes"?t(h):c==="edges"?n(h):c==="minZoom"?o(h):c==="maxZoom"?s(h):c==="translateExtent"?r(h):c==="nodeExtent"?i(h):c==="paneClickDistance"?u(h):c==="ariaLabelConfig"?f.setState({ariaLabelConfig:Tu(h)}):c==="fitView"?f.setState({fitViewQueued:h}):c==="fitViewOptions"?f.setState({fitViewOptions:h}):f.setState({[c]:h})))}d.current=e},Ao.map(c=>e[c])),null}function Io(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Bd(e){var o;const[t,n]=I.useState(e==="system"?null:e);return I.useEffect(()=>{if(e!=="system"){n(e);return}const s=Io(),r=()=>n(s!=null&&s.matches?"dark":"light");return r(),s==null||s.addEventListener("change",r),()=>{s==null||s.removeEventListener("change",r)}},[e]),t!==null?t:(o=Io())!=null&&o.matches?"dark":"light"}const Po=typeof document<"u"?document:null;function at(e=null,t={target:Po,actInsideInputWithModifier:!0}){const[n,o]=I.useState(!1),s=I.useRef(!1),r=I.useRef(new Set([])),[i,a]=I.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
2`).replace(`
3
4`,`
5+`).split(`
6`)),f=u.reduce((d,c)=>d.concat(...c),[]);return[u,f]}return[[],[]]},[e]);return I.useEffect(()=>{const l=(t==null?void 0:t.target)??Po,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const f=h=>{var m,y;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!u)&&qs(h))return!1;const x=$o(h.code,a);if(r.current.add(h[x]),To(i,r.current,!1)){const N=((y=(m=h.composedPath)==null?void 0:m.call(h))==null?void 0:y[0])||h.target,p=(N==null?void 0:N.nodeName)==="BUTTON"||(N==null?void 0:N.nodeName)==="A";t.preventDefault!==!1&&(s.current||!p)&&h.preventDefault(),o(!0)}},d=h=>{const w=$o(h.code,a);To(i,r.current,!0)?(o(!1),r.current.clear()):r.current.delete(h[w]),h.key==="Meta"&&r.current.clear(),s.current=!1},c=()=>{r.current.clear(),o(!1)};return l==null||l.addEventListener("keydown",f),l==null||l.addEventListener("keyup",d),window.addEventListener("blur",c),window.addEventListener("contextmenu",c),()=>{l==null||l.removeEventListener("keydown",f),l==null||l.removeEventListener("keyup",d),window.removeEventListener("blur",c),window.removeEventListener("contextmenu",c)}}},[e,o]),n}function To(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(s=>t.has(s)))}function $o(e,t){return t.includes(e)?"code":"key"}const Od=()=>{const e=oe();return I.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,s,r],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??o,y:t.y??s,zoom:t.zoom??r},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:s,minZoom:r,maxZoom:i,panZoom:a}=e.getState(),l=Dn(t,o,s,r,i,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(l,{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={})=>
6{const{transform:o,snapGrid:s,snapToGrid:r,domNode:i}=e.getState();if(!i)return t;const{x:a,y:l}=i.getBoundingClientRect(),u={x:t.x-a,y:t.y-l},f=n.snapGrid??s,d=n.snapToGrid??r;return ft(u,o,d,f)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:s,y:r}=o.getBoundingClientRect(),i=Ht(t,n);return{x:i.x+s,y:i.y+r}}}),[])};function pr(e,t){const n=[],o=new Map,s=[];for(const r of e)if(r.type==="add"){s.push(r);continue}else if(r.type==="remove"||r.type==="replace")o.set(r.id,[r]);else{const i=o.get(r.id);i?i.push(r):o.set(r.id,[r])}for(const r of t){const i=o.get(r.id);if(!i){n.push(r);continue}if(i[0].type==="remove")continue;if(i[0].type==="replace"){n.push({...i[0].item});continue}const a={...r};for(const l of i)Yd(l,a);n.push(a)}return s.length&&s.forEach(r=>{r.index!==void 0?n.splice(r.index,0,{...r.item}):n.push({...r.item})}),n}function Yd(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 mr(e,t){return pr(e,t)}function yr(e,t){return pr(e,t)}function ke(e,t){return{id:e,type:"select",selected:t}}function Le(e,t=new Set,n=!1){const o=[];for(const[s,r]of e){const i=t.has(s);!(r.selected===void 0&&!i)&&r.selected!==i&&(n&&(r.selected=i),o.push(ke(r.id,i)))}return o}function Do({items:e=[],lookup:t}){var s;const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,i]of e.entries()){const a=t.get(i.id),l=((s=a==null?void 0:a.internals)==null?void 0:s.userNode)??a;l!==void 0&&l!==i&&n.push({id:i.id,item:i,type:"replace"}),l===void 0&&n.push({item:i,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function zo(e){return{id:e.id,type:"remove"}}const Lo=e=>Nu(e),Xd=e=>Hs(e);function xr(e){return I.forwardRef(e)}const qd=typeof window<"u"?I.useLayoutEffect:I.useEffect;function Ho(e){const[t,n]=I.useState(BigInt(0)),[o]=I.useState(()=>Wd(()=>n(s=>s+BigInt(1))));return qd(()=>{const s=o.get();s.length&&(e(s),o.reset())},[t]),o}function Wd(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const wr=I.createContext(null);function Gd({children:e}){const t=oe(),n=I.useCallback(a=>{const{nodes:l=[],setNodes:u,hasDefaultNodes:f,onNodesChange:d,nodeLookup:c,fitViewQueued:h}=t.getState();let w=l;for(const m of a)w=typeof m=="function"?m(w):m;const x=Do({items:w,lookup:c});f&&u(w),x.length>0?d==null||d(x):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:y,setNodes:N}=t.getState();m&&N(y)})},[]),o=Ho(n),s=I.useCallback(a=>{const{edges:l=[],setEdges:u,hasDefaultEdges:f,onEdgesChange:d,edgeLookup:c}=t.getState();let h=l;for(const w of a)h=typeof w=="function"?w(h):w;f?u(h):d&&d(Do({items:h,lookup:c}))},[]),r=Ho(s),i=I.useMemo(()=>({nodeQueue:o,edgeQueue:r}),[]);return g.jsx(wr.Provider,{value:i,children:e})}function Ud(){const e=I.useContext(wr);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Zd=e=>!!e.panZoom;function Vn(){const e=Od(),t=oe(),n=Ud(),o=ee(Zd),s=I.useMemo(()=>{const r=d=>t.getState().nodeLookup.get(d),i=d=>{n.nodeQueue.push(d)},a=d=>{n.edgeQueue.push(d)},l=d=>{var y,N;const{nodeLookup:c,nodeOrigin:h}=t.getState(),w=Lo(d)?d:c.get(d.id),x=w.parentId?Ys(w.position,w.measured,w.parentId,c,h):w.position,m={...w,position:x,width:((y=w.measured)==null?void 0:y.width)??w.width,height:((N=w.measured)==null?void 0:N.height)??w.height};return Oe(m)},u=(d,c,h={replace:!1})=>{i(w=>w.map(x=>{if(x.id===d){const m=typeof c=="function"?c(x):c;return h.replace&&Lo(m)?m:{...x,...m}}return x}))},f=(d,c,h={replace:!1})=>{a(w=>w.map(x=>{if(x.id===d){const m=typeof c=="function"?c(x):c;return h.replace&&Xd(m)?m:{...x,...m}}return x}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var c;return(c=r(d))==null?void 0:c.internals.userNode},getInternalNode:r,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(c=>({...c}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:i,setEdges:a,addNodes:d=>{const c=Array.isArray(d)?d:[d];n.nodeQueue.push(h=>[...h,...c])},addEdges:d=>{const c=Array.isArray(d)?d:[d];n.edgeQueue.push(h=>[...h,...c])},toObject:()=>{const{nodes:d=[],edges:c=[],transform:h}=t.getState(),[w,x,m]=h;return{nodes:d.map(y=>({...y})),edges:c.map(y=>({...y})),viewport:{x:w,y:x,zoom:m}}},deleteElements:async({nodes:d=[],edges:c=[]})=>{const{nodes:h,edges:w,onNodesDelete:x,onEdgesDelete:m,triggerNodeChanges:y,triggerEdgeChanges:N,onDelete:p,onBeforeDelete:v}=t.getState(),{nodes:_,edges:E}=await Mu({nodesToRemove:d,edgesToRemove:c,nodes:h,edges:w,onBeforeDelete:v}),A=E.length>0,T=_.length>0;if(A){const $=E.map(zo);m==null||m(E),N($)}if(T){const $=_.map(zo);x==null||x(_),y($)}return(T||A)&&(p==null||p({nodes:_,edges:E})),{deletedNodes:_,deletedEdges:E}},getIntersectingNodes:(d,c=!0,h)=>{const w=go(d),x=w?d:l(d),m=h!==void 0;return x?(h||t.getState().nodes).filter(y=>{const N=t.getState().nodeLookup.get(y.id);if(N&&!w&&(y.id===d.id||!N.internals.positionAbsolute))return!1;const p=Oe(m?y:N),v=st(p,x);return c&&v>0||v>=p.width*p.height||v>=x.width*x.height}):[]},isNodeIntersecting:(d,c,h=!0)=>{const x=go(d)?d:l(d);if(!x)return!1;const m=st(x,c);return h&&m>0||m>=c.width*c.height||m>=x.width*x.height},updateNode:u,updateNodeData:(d,c,h={replace:!1})=>{u(d,w=>{const x=typeof c=="function"?c(w):c;return h.replace?{...w,data:x}:{...w,data:{...w.data,...x}}},h)},updateEdge:f,updateEdgeData:(d,c,h={replace:!1})=>{f(d,w=>{const x=typeof c=="function"?c(w):c;return h.replace?{...w,data:x}:{...w,data:{...w.data,...x}}},h)}
6,getNodesBounds:d=>{const{nodeLookup:c,nodeOrigin:h}=t.getState();return Su(d,{nodeLookup:c,nodeOrigin:h})},getHandleConnections:({type:d,id:c,nodeId:h})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${h}-${d}${c?`-${c}`:""}`))==null?void 0:w.values())??[])},getNodeConnections:({type:d,handleId:c,nodeId:h})=>{var w;return Array.from(((w=t.getState().connectionLookup.get(`${h}${d?c?`-${d}-${c}`:`-${d}`:""}`))==null?void 0:w.values())??[])},fitView:async d=>{const c=t.getState().fitViewResolver??Pu();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:c}),n.nodeQueue.push(h=>[...h]),c.promise}}},[]);return I.useMemo(()=>({...s,...e,viewportInitialized:o}),[o])}const Fo=e=>e.selected,Kd=typeof window<"u"?window:void 0;function Qd({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=oe(),{deleteElements:o}=Vn(),s=at(e,{actInsideInputWithModifier:!1}),r=at(t,{target:Kd});I.useEffect(()=>{if(s){const{edges:i,nodes:a}=n.getState();o({nodes:a.filter(Fo),edges:i.filter(Fo)}),n.setState({nodesSelectionActive:!1})}},[s]),I.useEffect(()=>{n.setState({multiSelectionActive:r})},[r])}function Jd(e){const t=oe();I.useEffect(()=>{const n=()=>{var s,r,i,a;if(!e.current||!(((r=(s=e.current).checkVisibility)==null?void 0:r.call(s))??!0))return!1;const o=zn(e.current);(o.height===0||o.width===0)&&((a=(i=t.getState()).onError)==null||a.call(i,"004",ge.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 Zt={position:"absolute",width:"100%",height:"100%",top:0,left:0},ef=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function tf({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:r=Me.Free,zoomOnDoubleClick:i=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:u,minZoom:f,maxZoom:d,zoomActivationKeyCode:c,preventScrolling:h=!0,children:w,noWheelClassName:x,noPanClassName:m,onViewportChange:y,isControlledViewport:N,paneClickDistance:p}){const v=oe(),_=I.useRef(null),{userSelectionActive:E,lib:A,connectionInProgress:T}=ee(ef,se),$=at(c),B=I.useRef();Jd(_);const V=I.useCallback(P=>{y==null||y({x:P[0],y:P[1],zoom:P[2]}),N||v.setState({transform:P})},[y,N]);return I.useEffect(()=>{if(_.current){B.current=gd({domNode:_.current,minZoom:f,maxZoom:d,translateExtent:u,viewport:l,paneClickDistance:p,onDraggingChange:k=>v.setState({paneDragging:k}),onPanZoomStart:(k,S)=>{const{onViewportChangeStart:j,onMoveStart:C}=v.getState();C==null||C(k,S),j==null||j(S)},onPanZoom:(k,S)=>{const{onViewportChange:j,onMove:C}=v.getState();C==null||C(k,S),j==null||j(S)},onPanZoomEnd:(k,S)=>{const{onViewportChangeEnd:j,onMoveEnd:C}=v.getState();C==null||C(k,S),j==null||j(S)}});const{x:P,y:D,zoom:b}=B.current.getViewport();return v.setState({panZoom:B.current,transform:[P,D,b],domNode:_.current.closest(".react-flow")}),()=>{var k;(k=B.current)==null||k.destroy()}}},[]),I.useEffect(()=>{var P;(P=B.current)==null||P.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:s,panOnScrollMode:r,zoomOnDoubleClick:i,panOnDrag:a,zoomActivationKeyPressed:$,preventScrolling:h,noPanClassName:m,userSelectionActive:E,noWheelClassName:x,lib:A,onTransformChange:V,connectionInProgress:T})},[e,t,n,o,s,r,i,a,$,h,m,E,x,A,V,T]),g.jsx("div",{className:"react-flow__renderer",ref:_,style:Zt,children:w})}const nf=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function of(){const{userSelectionActive:e,userSelectionRect:t}=ee(nf,se);return e&&t?g.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 hn=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},sf=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});
6function rf({isSelecting:e,selectionKeyPressed:t,selectionMode:n=ot.Full,panOnDrag:o,selectionOnDrag:s,onSelectionStart:r,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:d,onPaneMouseLeave:c,children:h}){const w=oe(),{userSelectionActive:x,elementsSelectable:m,dragging:y,connectionInProgress:N}=ee(sf,se),p=m&&(e||x),v=I.useRef(null),_=I.useRef(),E=I.useRef(new Set),A=I.useRef(new Set),T=I.useRef(!1),$=I.useRef(!1),B=C=>{if(T.current||N){T.current=!1;return}a==null||a(C),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},V=C=>{if(Array.isArray(o)&&(o!=null&&o.includes(2))){C.preventDefault();return}l==null||l(C)},P=u?C=>u(C):void 0,D=C=>{(s&&v.current===C.target||!s||t)&&C.stopPropagation()},b=C=>{var Y,q;const{resetSelectedElements:M,domNode:L}=w.getState();_.current=L==null?void 0:L.getBoundingClientRect();const H=C.target!==v.current&&!!C.target.closest(".nokey"),F=s&&v.current===C.target||!s||t;if(!m||!e||C.button!==0||!_.current||H||!F||!C.isPrimary)return;C.stopPropagation(),C.preventDefault(),(q=(Y=C.target)==null?void 0:Y.setPointerCapture)==null||q.call(Y,C.pointerId),$.current=!0,T.current=!1;const{x:z,y:R}=fe(C.nativeEvent,_.current);M(),w.setState({userSelectionRect:{width:0,height:0,startX:z,startY:R,x:z,y:R}}),r==null||r(C)},k=C=>{const{userSelectionRect:M,transform:L,nodeLookup:H,edgeLookup:F,connectionLookup:z,triggerNodeChanges:R,triggerEdgeChanges:Y,defaultEdgeOptions:q}=w.getState();if(!_.current||!M)return;T.current=!0;const{x:X,y:O}=fe(C.nativeEvent,_.current),{startX:G,startY:Q}=M,K={startX:G,startY:Q,x:X<G?X:G,y:O<Q?O:Q,width:Math.abs(X-G),height:Math.abs(O-Q)},Z=E.current,U=A.current;E.current=new Set($n(H,K,L,n===ot.Partial,!0).map(te=>te.id)),A.current=new Set;const J=(q==null?void 0:q.selectable)??!0;for(const te of E.current){const ne=z.get(te);if(ne)for(const{edgeId:ie}of ne.values()){const me=F.get(ie);me&&(me.selectable??J)&&A.current.add(ie)}}if(!po(Z,E.current)){const te=Le(H,E.current,!0);R(te)}if(!po(U,A.current)){const te=Le(F,A.current);Y(te)}w.setState({userSelectionRect:K,userSelectionActive:!0,nodesSelectionActive:!1})},S=C=>{var L,H;if(C.button!==0||!$.current)return;(H=(L=C.target)==null?void 0:L.releasePointerCapture)==null||H.call(L,C.pointerId);const{userSelectionRect:M}=w.getState();!x&&M&&C.target===v.current&&(B==null||B(C)),w.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:E.current.size>0}),i==null||i(C),(t||s)&&(T.current=!1),$.current=!1},j=o===!0||Array.isArray(o)&&o.includes(0);return g.jsxs("div",{className:re(["react-flow__pane",{draggable:j,dragging:y,selection:e}]),onClick:p?void 0:hn(B,v),onContextMenu:hn(V,v),onWheel:hn(P,v),onPointerEnter:p?void 0:f,onPointerMove:p?k:d,onPointerUp:p?S:void 0,onPointerDownCapture:p?b:void 0,onClickCapture:p?D:void 0,onPointerLeave:c,ref:v,style:Zt,children:[h,g.jsx(of,{})]})}function kn({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:s,unselectNodesAndEdges:r,multiSelectionActive:i,nodeLookup:a,onError:l}=t.getState(),u=a.get(e);if(!u){l==null||l("012",ge.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&i)&&(r({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var f;return(f=o==null?void 0:o.current)==null?void 0:f.blur()})):s([e])}function vr({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:s,isSelectable:r,nodeClickDistance:i}){const a=oe(),[l,u]=I.useState(!1),f=I.useRef();return I.useEffect(()=>{f.current=ed({getStoreItems:()=>a.getState(),onNodeMouseDown:d=>{kn({id:d,store:a,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),I.useEffect(()=>{var d,c;if(t)(d=f.current)==null||d.destroy();else if(e.current)return(c=f.current)==null||c.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:r,nodeId:s,nodeClickDistance:i}),()=>{var h;(h=f.current)==null||h.destroy()}},[n,o,t,r,e,s]),l}const af=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function br(){const e=oe();return I.useCallback(n=>
6{const{nodeExtent:o,snapToGrid:s,snapGrid:r,nodesDraggable:i,onError:a,updateNodePositions:l,nodeLookup:u,nodeOrigin:f}=e.getState(),d=new Map,c=af(i),h=s?r[0]:5,w=s?r[1]:5,x=n.direction.x*h*n.factor,m=n.direction.y*w*n.factor;for(const[,y]of u){if(!c(y))continue;let N={x:y.internals.positionAbsolute.x+x,y:y.internals.positionAbsolute.y+m};s&&(N=dt(N,r));const{position:p,positionAbsolute:v}=Fs({nodeId:y.id,nextPosition:N,nodeLookup:u,nodeExtent:o,nodeOrigin:f,onError:a});y.position=p,y.internals.positionAbsolute=v,d.set(y.id,y)}l(d)},[])}const Bn=I.createContext(null),cf=Bn.Provider;Bn.Consumer;const _r=()=>I.useContext(Bn),lf=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),uf=(e,t,n)=>o=>{const{connectionClickStartHandle:s,connectionMode:r,connection:i}=o,{fromHandle:a,toHandle:l,isValid:u}=i,f=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.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:f,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:r===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:!!s,valid:f&&u}};function df({type:e="source",position:t=W.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:s=!0,isConnectableEnd:r=!0,id:i,onConnect:a,children:l,className:u,onMouseDown:f,onTouchStart:d,...c},h){var k,S;const w=i||null,x=e==="target",m=oe(),y=_r(),{connectOnClick:N,noPanClassName:p,rfId:v}=ee(lf,se),{connectingFrom:_,connectingTo:E,clickConnecting:A,isPossibleEndHandle:T,connectionInProcess:$,clickConnectionInProcess:B,valid:V}=ee(uf(y,w,e),se);y||(S=(k=m.getState()).onError)==null||S.call(k,"010",ge.error010());const P=j=>{const{defaultEdgeOptions:C,onConnect:M,hasDefaultEdges:L}=m.getState(),H={...C,...j};if(L){const{edges:F,setEdges:z}=m.getState();z(Ks(H,F))}M==null||M(H),a==null||a(H)},D=j=>{if(!y)return;const C=Ws(j.nativeEvent);if(s&&(C&&j.button===0||!C)){const M=m.getState();Cn.onPointerDown(j.nativeEvent,{handleDomNode:j.currentTarget,autoPanOnConnect:M.autoPanOnConnect,connectionMode:M.connectionMode,connectionRadius:M.connectionRadius,domNode:M.domNode,nodeLookup:M.nodeLookup,lib:M.lib,isTarget:x,handleId:w,nodeId:y,flowId:M.rfId,panBy:M.panBy,cancelConnection:M.cancelConnection,onConnectStart:M.onConnectStart,onConnectEnd:M.onConnectEnd,updateConnection:M.updateConnection,onConnect:P,isValidConnection:n||M.isValidConnection,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,autoPanSpeed:M.autoPanSpeed,dragThreshold:M.connectionDragThreshold})}C?f==null||f(j):d==null||d(j)},b=j=>{const{onClickConnectStart:C,onClickConnectEnd:M,connectionClickStartHandle:L,connectionMode:H,isValidConnection:F,lib:z,rfId:R,nodeLookup:Y,connection:q}=m.getState();if(!y||!L&&!s)return;if(!L){C==null||C(j.nativeEvent,{nodeId:y,handleId:w,handleType:e}),m.setState({connectionClickStartHandle:{nodeId:y,type:e,id:w}});return}const X=Xs(j.target),O=n||F,{connection:G,isValid:Q}=Cn.isValid(j.nativeEvent,{handle:{nodeId:y,id:w,type:e},connectionMode:H,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:O,flowId:R,doc:X,lib:z,nodeLookup:Y});Q&&G&&P(G);const K=structuredClone(q);delete K.inProgress,K.toPosition=K.toHandle?K.toHandle.position:null,M==null||M(j,K),m.setState({connectionClickStartHandle:null})};return g.jsx("div",{"data-handleid":w,"data-nodeid":y,"data-handlepos":t,"data-id":`${v}-${y}-${w}-${e}`,className:re(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,u,{source:!x,target:x,connectable:o,connectablestart:s,connectableend:r,clickconnecting:A,connectingfrom:_,connectingto:E,valid:V,connectionindicator:o&&(!$||T)&&($||B?r:s)}]),onMouseDown:D,onTouchStart:D,onClick:N?b:void 0,ref:h,...c,children:l})}const Ie=I.memo(xr(df));function ff({data:e,isConnectable:t,sourcePosition:n=W.Bottom}){return g.jsxs(g.Fragment,{children:[e==null?void 0:e.label,g.jsx(Ie,{type:"source",position:n,isConnectable:t})]})}function hf({data:e,isConnectable:t,targetPosition:n=W.Top,sourcePosition:o=W.Bottom}){return g.jsxs(g.Fragment,{children:[g.jsx(Ie,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,g.jsx(Ie,{type:"source",position:o,isConnectable:t})]})}function gf(){return null}function pf({data:e,isConnectable:t,targetPosition:n=W.Top}){return g.jsxs(g.Fragment,{children:[g.jsx(Ie,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Ft={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ro={input:ff,default:hf,output:pf,group:gf};function mf(e){var t,n,o,s;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??((s=e.style)==null?void 0:s.height)}}const yf=e=>{const{width:t,height:n,x:o,y:s}=ut(e.nodeLookup,{filter:r=>!!r.selected});return{width:de(t)?t:null,height:de(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${s}px)`}};function xf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=oe(),{width:s,height:r,transformString:i,userSelectionActive:a}=ee(yf,se),l=br(),u=I.useRef(null);if(I.useEffect(()=>{var c;n||(c=u.current)==null||c.focus({preventScroll:!0})},[n]),vr({nodeRef:u}),a||!s||!r)return null;const f=e?c=>{const h=o.getState().nodes.filter(w=>w.selected);e(c,h)}:void 0,d=c=>{Object.prototype.hasOwnProperty.call(Ft,c.key)&&(c.preventDefault(),l({direction:Ft[c.key],factor:c.shiftKey?4:1}))};return g.jsx("div",{className:re(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:g.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:s,height:r}})})}const Vo=typeof window<"u"?window:void 0,wf=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Nr({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:r,onPaneScroll:i,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:u,selectionOnDrag:f,selectionMode:d,onSelectionStart:c,onSelectionEnd:h,multiSelectionKeyCode:w,panActivationKeyCode:x,zoomActivationKeyCode:m,elementsSelectable:y,zoomOnScroll:N,zoomOnPinch:p,panOnScroll:v,panOnScrollSpeed:_,panOnScrollMode:E,zoomOnDoubleClick:A,panOnDrag:T,defaultViewport:$,translateExtent:B,minZoom:V,maxZoom:P,preventScrolling:D,onSelectionContextMenu:b,noWheelClassName:k,noPanClassName:S,disableKeyboardA11y:j,onViewportChange:C,isControlledViewport:M}){const{nodesSelectionActive:L,userSelectionActive:H}=ee(wf),F=at(u,{target:Vo}),z=at(x,{target:Vo}),R=z||T,Y=z||v,q=f&&R!==!0,X=F||H||q;return Qd({deleteKeyCode:l,multiSelectionKeyCode:w}),g.jsx(tf,{onPaneContextMenu:r,elementsSelectable:y,zoomOnScroll:N,zoomOnPinch:p,panOnScroll:Y,panOnScrollSpeed:_,panOnScrollMode:E,zoomOnDoubleClick:A,panOnDrag:!F&&R,defaultViewport:$,translateExtent:B,minZoom:V,maxZoom:P,zoomActivationKeyCode:m,preventScrolling:D,noWheelClassName:k,noPanClassName:S,onViewportChange:C,isControlledViewport:M,paneClickDistance:a,children:g.jsxs(rf,{onSelectionStart:c,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:r,onPaneScroll:i,panOnDrag:R,isSelecting:!!X,selectionMode:d,selectionKeyPressed:F,selectionOnDrag:q,children:[e,L&&g.jsx(xf,{onSelectionContextMenu:b,noPanClassName:S,disableKeyboardA11y:j})]})})}Nr.displayName="FlowRenderer";const vf=I.memo(Nr),bf=e=>t=>e?$n(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 _f(e){return ee(I.useCallback(bf(e),[e]),se)}const Nf=e=>e.updateNodeInternals;
6function Sf(){const e=ee(Nf),[t]=I.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(s=>{const r=s.target.getAttribute("data-id");o.set(r,{id:r,nodeElement:s.target,force:!0})}),e(o)}));return I.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Ef({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const s=oe(),r=I.useRef(null),i=I.useRef(null),a=I.useRef(e.sourcePosition),l=I.useRef(e.targetPosition),u=I.useRef(t),f=n&&!!e.internals.handleBounds;return I.useEffect(()=>{r.current&&!e.hidden&&(!f||i.current!==r.current)&&(i.current&&(o==null||o.unobserve(i.current)),o==null||o.observe(r.current),i.current=r.current)},[f,e.hidden]),I.useEffect(()=>()=>{i.current&&(o==null||o.unobserve(i.current),i.current=null)},[]),I.useEffect(()=>{if(r.current){const d=u.current!==t,c=a.current!==e.sourcePosition,h=l.current!==e.targetPosition;(d||c||h)&&(u.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:r.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),r}function Cf({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:s,onContextMenu:r,onDoubleClick:i,nodesDraggable:a,elementsSelectable:l,nodesConnectable:u,nodesFocusable:f,resizeObserver:d,noDragClassName:c,noPanClassName:h,disableKeyboardA11y:w,rfId:x,nodeTypes:m,nodeClickDistance:y,onError:N}){const{node:p,internals:v,isParent:_}=ee(O=>{const G=O.nodeLookup.get(e),Q=O.parentLookup.has(e);return{node:G,internals:G.internals,isParent:Q}},se);let E=p.type||"default",A=(m==null?void 0:m[E])||Ro[E];A===void 0&&(N==null||N("003",ge.error003(E)),E="default",A=(m==null?void 0:m.default)||Ro.default);const T=!!(p.draggable||a&&typeof p.draggable>"u"),$=!!(p.selectable||l&&typeof p.selectable>"u"),B=!!(p.connectable||u&&typeof p.connectable>"u"),V=!!(p.focusable||f&&typeof p.focusable>"u"),P=oe(),D=Os(p),b=Ef({node:p,nodeType:E,hasDimensions:D,resizeObserver:d}),k=vr({nodeRef:b,disabled:p.hidden||!T,noDragClassName:c,handleSelector:p.dragHandle,nodeId:e,isSelectable:$,nodeClickDistance:y}),S=br();if(p.hidden)return null;const j=be(p),C=mf(p),M=$||T||t||n||o||s,L=n?O=>n(O,{...v.userNode}):void 0,H=o?O=>o(O,{...v.userNode}):void 0,F=s?O=>s(O,{...v.userNode}):void 0,z=r?O=>r(O,{...v.userNode}):void 0,R=i?O=>i(O,{...v.userNode}):void 0,Y=O=>{const{selectNodesOnDrag:G,nodeDragThreshold:Q}=P.getState();$&&(!G||!T||Q>0)&&kn({id:e,store:P,nodeRef:b}),t&&t(O,{...v.userNode})},q=O=>{if(!(qs(O.nativeEvent)||w)){if($s.includes(O.key)&&$){const G=O.key==="Escape";kn({id:e,store:P,unselect:G,nodeRef:b})}else if(T&&p.selected&&Object.prototype.hasOwnProperty.call(Ft,O.key)){O.preventDefault();const{ariaLabelConfig:G}=P.getState();P.setState({ariaLiveMessage:G["node.a11yDescription.ariaLiveMessage"]({direction:O.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),S({direction:Ft[O.key],factor:O.shiftKey?4:1})}}},X=()=>{var J;if(w||!((J=b.current)!=null&&J.matches(":focus-visible")))return;const{transform:O,width:G,height:Q,autoPanOnNodeFocus:K,setCenter:Z}=P.getState();if(!K)return;$n(new Map([[e,p]]),{x:0,y:0,width:G,height:Q},O,!0).length>0||Z(p.position.x+j.width/2,p.position.y+j.height/2,{zoom:O[2]})};return g.jsx("div",{className:re(["react-flow__node",`react-flow__node-${E}`,{[h]:T},p.className,{selected:p.selected,selectable:$,parent:_,draggable:T,dragging:k}]),ref:b,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:M?"all":"none",visibility:D?"visible":"hidden",...p.style,...C},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:H,onMouseLeave:F,onContextMenu:z,onClick:Y,onDoubleClick:R,onKeyDown:V?q:void 0,tabIndex:V?0:void 0,onFocus:V?X:void 0,role:p.ariaRole??(V?"group":void 0),"aria-roledescription":"node","aria-describedby":w?void 0:`${fr}-${x}`,"aria-label":p.ariaLabel,...p.domAttributes,children:g.jsx(cf,{value:e,children:g.jsx(A,{id:e,data:p.data,type:E,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:p.selected??!1,selectable:$,draggable:T,deletable:p.deletable??!0,isConnectable:B,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:k,dragHandle:p.dragHandle,zIndex:v.z,parentId:p.parentId,...j})})})}var kf=I.memo(Cf);const Mf=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,no
6desFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Sr(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:s,onError:r}=ee(Mf,se),i=_f(e.onlyRenderVisibleElements),a=Sf();return g.jsx("div",{className:"react-flow__nodes",style:Zt,children:i.map(l=>g.jsx(kf,{id:l,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:s,nodeClickDistance:e.nodeClickDistance,onError:r},l))})}Sr.displayName="NodeRenderer";const Af=I.memo(Sr);function jf(e){return ee(I.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const o=[];if(n.width&&n.height)for(const s of n.edges){const r=n.nodeLookup.get(s.source),i=n.nodeLookup.get(s.target);r&&i&&zu({sourceNode:r,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&o.push(s.id)}return o},[e]),se)}const If=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return g.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Pf=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return g.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Bo={[zt.Arrow]:If,[zt.ArrowClosed]:Pf};function Tf(e){const t=oe();return I.useMemo(()=>{var s,r;return Object.prototype.hasOwnProperty.call(Bo,e)?Bo[e]:((r=(s=t.getState()).onError)==null||r.call(s,"009",ge.error009(e)),null)},[e])}const $f=({id:e,type:t,color:n,width:o=12.5,height:s=12.5,markerUnits:r="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const l=Tf(t);return l?g.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:r,orient:a,refX:"0",refY:"0",children:g.jsx(l,{color:n,strokeWidth:i})}):null},Er=({defaultColor:e,rfId:t})=>{const n=ee(r=>r.edges),o=ee(r=>r.defaultEdgeOptions),s=I.useMemo(()=>Ou(n,{id:t,defaultColor:e,defaultMarkerStart:o==null?void 0:o.markerStart,defaultMarkerEnd:o==null?void 0:o.markerEnd}),[n,o,t,e]);return s.length?g.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:g.jsx("defs",{children:s.map(r=>g.jsx($f,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})}):null};Er.displayName="MarkerDefinitions";var Df=I.memo(Er);function Cr({x:e,y:t,label:n,labelStyle:o,labelShowBg:s=!0,labelBgStyle:r,labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:l,className:u,...f}){const[d,c]=I.useState({x:1,y:0,width:0,height:0}),h=re(["react-flow__edge-textwrapper",u]),w=I.useRef(null);return I.useEffect(()=>{if(w.current){const x=w.current.getBBox();c({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?g.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:h,visibility:d.width?"visible":"hidden",...f,children:[s&&g.jsx("rect",{width:d.width+2*i[0],x:-i[0],y:-i[1],height:d.height+2*i[1],className:"react-flow__edge-textbg",style:r,rx:a,ry:a}),g.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:w,style:o,children:n}),l]}):null}Cr.displayName="EdgeText";const zf=I.memo(Cr);function Kt({path:e,labelX:t,labelY:n,label:o,labelStyle:s,labelShowBg:r,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:u=20,...f}){return g.jsxs(g.Fragment,{children:[g.jsx("path",{...f,d:e,fill:"none",className:re(["react-flow__edge-path",f.className])}),u?g.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,o&&de(t)&&de(n)?g.jsx(zf,{x:t,y:n,label:o,labelStyle:s,labelShowBg:r,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Oo({pos:e,x1:t,y1:n,x2:o,y2:s}){return e===W.Left||e===W.Right?[.5*(t+o),n]:[t,.5*(n+s)]}function kr({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:o,targetY:s,targetPosition:r=W.Top}){const[i,a]=Oo({pos:n,x1:e,y1:t,x2:o,y2:s}),[l,u]=Oo({pos:r,x1:o,y1:s,x2:e,y2:t}),[f,d,c,h]=Gs({sourceX:e,sourceY:t,targetX:o,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:l,targetControlY:u});return[`M${e},${t} C${i},${a} ${l},${u} ${o},${s}`,f,d,c,h]}function Mr(e){return I.memo(({id:t,sourceX:n,sourceY:o,targetX:s,targetY:r,sourcePosition:i,targetPosition:a,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:c,labelBgBorderRadius:h,style:w,markerEnd:x,markerStart:m,interactionWidth:y})=>{const[N,p,v]=kr({sourceX:n,sourceY:o,sourcePosition:i,targetX:s,targetY:r,targetPosition:a}),_=e.isInternal?void 0:t;return g.jsx(Kt,{id:_,path:N,labelX:p,labelY:v,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:c,labelBgBorderRadius:h,style:w,markerEnd:x,markerStart:m,interactionWidth:y})})}const Lf=Mr({isInternal:!1}),Ar=Mr({isInternal:!0});Lf.displayName="SimpleBezierEdge";Ar.displayName="SimpleBezierEdgeInternal";function jr(e){return I.memo(({id:t,sourceX:n,sourceY:o,targetX:s,targetY:r,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:c,sourcePosition:h=W.Bottom,targetPosition:w=W.Top,markerEnd:x,markerStart:m,pathOptions:y,interactionWidth:N})=>{const[p,v,_]=Nn({sourceX:n,sourceY:o,sourcePosition:h,targetX:s,targetY:r,targetPosition:w,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),E=e.isInternal?void 0:t;return g.jsx(Kt,{id:E,path:p,labelX:v,labelY:_,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:c,markerEnd:x,markerStart:m,interactionWidth:N})})}const Ir=jr({isInternal:!1}),Pr=jr({isInternal:!0});Ir.displayName="SmoothStepEdge";Pr.displayName="SmoothStepEdgeInternal";function Tr(e){return I.memo(({id:t,...n})=>{var s;const o=e.isInternal?void 0:t;return g.jsx(Ir,{...n,id:o,pathOptions:I.useMemo(()=>{var r;return{borderRadius:0,offset:(r=n.pathOptions)==null?void 0:r.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const Hf=Tr({isInternal:!1}),$r=Tr({isInternal:!0});Hf.displayName="StepEdge";$r.displayName="StepEdgeInternal";function Dr(e){return I.memo(({id:t,sourceX:n,sourceY:o,targetX:s,targetY:r,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:c,markerEnd:h,markerStart:w,interactionWidth:x})=>{const[m,y,N]=Qs({sourceX:n,sourceY:o,targetX:s,targetY:r}),p=e.isInternal?void 0:t;return g.jsx(Kt,{id:p,path:m,labelX:y,labelY:N,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:d,style:c,markerEnd:h,markerStart:w,interactionWidth:x})})}const Ff=Dr({isInternal:!1}),zr=Dr({isInternal:!0});Ff.displayName="StraightEdge";zr.displayName="StraightEdgeInternal";function Lr(e){return I.memo(({id:t,sourceX:n,sourceY:o,targetX:s,targetY:r,sourcePosition:i=W.Bottom,targetPosition:a=W.Top,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:c,labelBgBorderRadius:h,style:w,markerEnd:x,markerStart:m,pathOptions:y,interactionWidth:N})=>{const[p,v,_]=Us({sourceX:n,sourceY:o,sourcePosition:i,targetX:s,targetY:r,targetPosition:a,curvature:y==null?void 0:y.curvature}),E=e.isInternal?void 0:t;return g.jsx(Kt,{id:E,path:p,labelX:v,labelY:_,label:l,labelStyle:u,labelShowBg:f,labelBgStyle:d,labelBgPadding:c,labelBgBorderRadius:h,style:w,markerEnd:x,markerStart:m,interactionWidth:N})})}const Rf=Lr({isInternal:!1}),Hr=Lr({isInternal:!0});Rf.displayName="BezierEdge";Hr.displayName="BezierEdgeInternal";const Yo={default:Hr,straight:zr,step:$r,smoothstep:Pr,simplebezier:Ar},Xo={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null}
6,Vf=(e,t,n)=>n===W.Left?e-t:n===W.Right?e+t:e,Bf=(e,t,n)=>n===W.Top?e-t:n===W.Bottom?e+t:e,qo="react-flow__edgeupdater";function Wo({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:s,onMouseEnter:r,onMouseOut:i,type:a}){return g.jsx("circle",{onMouseDown:s,onMouseEnter:r,onMouseOut:i,className:re([qo,`${qo}-${a}`]),cx:Vf(t,o,e),cy:Bf(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Of({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:s,targetX:r,targetY:i,sourcePosition:a,targetPosition:l,onReconnect:u,onReconnectStart:f,onReconnectEnd:d,setReconnecting:c,setUpdateHover:h}){const w=oe(),x=(v,_)=>{if(v.button!==0)return;const{autoPanOnConnect:E,domNode:A,isValidConnection:T,connectionMode:$,connectionRadius:B,lib:V,onConnectStart:P,onConnectEnd:D,cancelConnection:b,nodeLookup:k,rfId:S,panBy:j,updateConnection:C}=w.getState(),M=_.type==="target",L=(z,R)=>{c(!1),d==null||d(z,n,_.type,R)},H=z=>u==null?void 0:u(n,z),F=(z,R)=>{c(!0),f==null||f(v,n,_.type),P==null||P(z,R)};Cn.onPointerDown(v.nativeEvent,{autoPanOnConnect:E,connectionMode:$,connectionRadius:B,domNode:A,handleId:_.id,nodeId:_.nodeId,nodeLookup:k,isTarget:M,edgeUpdaterType:_.type,lib:V,flowId:S,cancelConnection:b,panBy:j,isValidConnection:T,onConnect:H,onConnectStart:F,onConnectEnd:D,onReconnectEnd:L,updateConnection:C,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,dragThreshold:w.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},m=v=>x(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=v=>x(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),N=()=>h(!0),p=()=>h(!1);return g.jsxs(g.Fragment,{children:[(e===!0||e==="source")&&g.jsx(Wo,{position:a,centerX:o,centerY:s,radius:t,onMouseDown:m,onMouseEnter:N,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&g.jsx(Wo,{position:l,centerX:r,centerY:i,radius:t,onMouseDown:y,onMouseEnter:N,onMouseOut:p,type:"target"})]})}function Yf({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:s,onDoubleClick:r,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:u,reconnectRadius:f,onReconnect:d,onReconnectStart:c,onReconnectEnd:h,rfId:w,edgeTypes:x,noPanClassName:m,onError:y,disableKeyboardA11y:N}){let p=ee(Z=>Z.edgeLookup.get(e));const v=ee(Z=>Z.defaultEdgeOptions);p=v?{...v,...p}:p;let _=p.type||"default",E=(x==null?void 0:x[_])||Yo[_];E===void 0&&(y==null||y("011",ge.error011(_)),_="default",E=(x==null?void 0:x.default)||Yo.default);const A=!!(p.focusable||t&&typeof p.focusable>"u"),T=typeof d<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),$=!!(p.selectable||o&&typeof p.selectable>"u"),B=I.useRef(null),[V,P]=I.useState(!1),[D,b]=I.useState(!1),k=oe(),{zIndex:S,sourceX:j,sourceY:C,targetX:M,targetY:L,sourcePosition:H,targetPosition:F}=ee(I.useCallback(Z=>{const U=Z.nodeLookup.get(p.source),J=Z.nodeLookup.get(p.target);if(!U||!J)return{zIndex:p.zIndex,...Xo};const te=Bu({id:e,sourceNode:U,targetNode:J,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:Z.connectionMode,onError:y});return{zIndex:Du({selected:p.selected,zIndex:p.zIndex,sourceNode:U,targetNode:J,elevateOnSelect:Z.elevateEdgesOnSelect}),...te||Xo}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),se),z=I.useMemo(()=>p.markerStart?`url('#${Sn(p.markerStart,w)}')`:void 0,[p.markerStart,w]),R=I.useMemo(()=>p.markerEnd?`url('#${Sn(p.markerEnd,w)}')`:void 0,[p.markerEnd,w]);if(p.hidden||j===null||C===null||M===null||L===null)return null;const Y=Z=>{var ne;const{addSelectedEdges:U,unselectNodesAndEdges:J,multiSelectionActive:te}=k.getState();$&&(k.setState({nodesSelectionActive:!1}),p.selected&&te?(J({nodes:[],edges:[p]}),(ne=B.current)==null||ne.blur()):U([e])),s&&s(Z,p)},q=r?Z=>{r(Z,{...p})}:void 0,X=i?Z=>{i(Z,{...p})}:void 0,O=a?Z=>{a(Z,{...p})}:void 0,G=l?Z=>{l(Z,{...p})}:void 0,Q=u?Z=>{u(Z,{...p})}:void 0,K=Z=>{var U;if(!N&&$s.includes(Z.key)&&$){const{unselectNodesAndEdges:J,addSelectedEdges:te}=k.getState();Z.key==="Escape"?((U=B.current)==null||U.blur(),J({edges:[p]})):te([e])}};return g.jsx("svg",{style:{zIndex:S},children:g.jsxs("g",{className:re(["react-flow__edge",`react-flow__edge-${_}`,p.className,m,{selected:p.selected,animated:p.animated,inactive:!$&&!s,updating:V,selectable:$}]),onClick:Y,onDoubleClick:q,onContextMenu:X,onMouseEnter:O,onMouseMove:G,onMouseLeave:Q,onKeyDown:A?K:void 0,tabIndex:A?0:void 0,role:p.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":A?`${hr}-${w}`:void 0,ref:B,...p.domAttributes,children:[!D&&g.jsx(E,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:$,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:j,sourceY:C,targetX:M,targetY:L,sourcePosition:H,targetPosition:F,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:z,markerEnd:R,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),T&&g.jsx(Of,{edge:p,isReconnectable:T,reconnectRadius:f,onReconnect:d,onReconnectStart:c,onReconnectEnd:h,sourceX:j,sourceY:C,targetX:M,targetY:L,sourcePosition:H,targetPosition:F,setUpdateHover:P,setReconnecting:b})]})})}var Xf=I.memo(Yf);const qf=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Fr({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:s,onReconnect:r,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:u,onEdgeClick:f,re
6connectRadius:d,onEdgeDoubleClick:c,onReconnectStart:h,onReconnectEnd:w,disableKeyboardA11y:x}){const{edgesFocusable:m,edgesReconnectable:y,elementsSelectable:N,onError:p}=ee(qf,se),v=jf(t);return g.jsxs("div",{className:"react-flow__edges",children:[g.jsx(Df,{defaultColor:e,rfId:n}),v.map(_=>g.jsx(Xf,{id:_,edgesFocusable:m,edgesReconnectable:y,elementsSelectable:N,noPanClassName:s,onReconnect:r,onContextMenu:i,onMouseEnter:a,onMouseMove:l,onMouseLeave:u,onClick:f,reconnectRadius:d,onDoubleClick:c,onReconnectStart:h,onReconnectEnd:w,rfId:n,onError:p,edgeTypes:o,disableKeyboardA11y:x},_))]})}Fr.displayName="EdgeRenderer";const Wf=I.memo(Fr),Gf=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Uf({children:e}){const t=ee(Gf);return g.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Zf(e){const t=Vn(),n=I.useRef(!1);I.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Kf=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Qf(e){const t=ee(Kf),n=oe();return I.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Jf(e){return e.connection.inProgress?{...e.connection,to:ft(e.connection.to,e.transform)}:{...e.connection}}function eh(e){return Jf}function th(e){const t=eh();return ee(t,se)}const nh=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function oh({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:s,width:r,height:i,isValid:a,inProgress:l}=ee(nh,se);return!(r&&s&&l)?null:g.jsx("svg",{style:e,width:r,height:i,className:"react-flow__connectionline react-flow__container",children:g.jsx("g",{className:re(["react-flow__connection",Ls(a)]),children:g.jsx(Rr,{style:t,type:n,CustomComponent:o,isValid:a})})})}const Rr=({style:e,type:t=Se.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:s,from:r,fromNode:i,fromHandle:a,fromPosition:l,to:u,toNode:f,toHandle:d,toPosition:c}=th();if(!s)return;if(n)return g.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:a,fromX:r.x,fromY:r.y,toX:u.x,toY:u.y,fromPosition:l,toPosition:c,connectionStatus:Ls(o),toNode:f,toHandle:d});let h="";const w={sourceX:r.x,sourceY:r.y,sourcePosition:l,targetX:u.x,targetY:u.y,targetPosition:c};switch(t){case Se.Bezier:[h]=Us(w);break;case Se.SimpleBezier:[h]=kr(w);break;case Se.Step:[h]=Nn({...w,borderRadius:0});break;case Se.SmoothStep:[h]=Nn(w);break;default:[h]=Qs(w)}return g.jsx("path",{d:h,fill:"none",className:"react-flow__connection-path",style:e})};Rr.displayName="ConnectionLine";const sh={};function Go(e=sh){I.useRef(e),oe(),I.useEffect(()=>{},[e])}function rh(){oe(),I.useRef(!1),I.useEffect(()=>{},[])}function Vr({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:r,onEdgeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:d,onSelectionStart:c,onSelectionEnd:h,connectionLineType:w,connectionLineStyle:x,connectionLineComponent:m,connectionLineContainerStyle:y,selectionKeyCode:N,selectionOnDrag:p,selectionMode:v,multiSelectionKeyCode:_,panActivationKeyCode:E,zoomActivationKeyCode:A,deleteKeyCode:T,onlyRenderVisibleElements:$,elementsSelectable:B,defaultViewport:V,translateExtent:P,minZoom:D,maxZoom:b,preventScrolling:k,defaultMarkerColor:S,zoomOnScroll:j,zoomOnPinch:C,panOnScroll:M,panOnScrollSpeed:L,panOnScrollMode:H,zoomOnDoubleClick:F,panOnDrag:z,onPaneClick:R,onPaneMouseEnter:Y,onPaneMouseMove:q,onPaneMouseLeave:X,onPaneScroll:O,onPaneContextMenu:G,paneClickDistance:Q,nodeClickDistance:K,onEdgeContextMenu:Z,onEdgeMouseEnter:U,onEdgeMouseMove:J,onEdgeMouseLeave:te,reconnectRadius:ne,onReconnect:ie,onReconnectStart:me,onReconnectEnd:ht,noDragClassName:gt,noWheelClassName:pt,noPanClassName:qe,disableKeyboardA11y:We,nodeExtent:Qt,rfId:mt,viewport:Pe,onViewportChange:Ge}){return Go(e),Go(t),rh(),Zf(n),Qf(Pe),g.jsx(vf,{onPaneClick:R,onPaneMouseEnter:Y,onPaneMouseMove:q,onPaneMouseLeave:X,onPaneContextMenu:G,onPaneScroll:O,paneClickDistance:Q,deleteKeyCode:T,selectionKeyCode:N,selectionOnDrag:p,selectionMode:v,onSelectionStart:c,onSelectionEnd:h,multiSelectionKeyCode:_,panActivationKeyCode:E,zoomActivationKeyCode:A,elementsSelectable:B,zoomOnScroll:j,zoomOnPinch:C,zoomOnDoubleClick:F,panOnScroll:M,panOnScrollSpeed:L,panOnScrollMode:H,panOnDrag:z,defaultViewport:V,translateExtent:P,minZoom:D,maxZoom:b,onSelectionContextMenu:d,preventScrolling:k,noDragClassName:gt,noWheelClassName:pt,noPanClassName:qe,disableKeyboardA11y:We,onViewportChange:Ge,isControlledViewport:!!Pe,children:g.jsxs(Uf,{children:[g.jsx(Wf,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:i,onReconnect:ie,onReconnectStart:me,onReconnectEnd:ht,onlyRenderVisibleElements:$,onEdgeContextMenu:Z,onEdgeMouseEnter:U,onEdgeMouseMove:J,onEdgeMouseLeave:te,reconnectRadius:ne,defaultMarkerColor:S,noPanClassName:qe,disableKeyboardA11y:We,rfId:mt}),g.jsx(oh,{style:x,type:w,component:m,containerStyle:y}),g.jsx("div",{className:"react-flow__edgelabel-renderer"}),g.jsx(Af,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:r,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:K,onlyRenderVisibleElements:$,noPanClassName:qe,noDragClassName:gt,disableKeyboardA11y:We,nodeExtent:Qt,rfId:mt}),g.jsx("div",{className:"react-flow__viewport-portal"})]})})}Vr.displayName="GraphView";const ih=I.memo(Vr),Uo=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:s,height:r,fitView:i,fitViewOptions:a,minZoom:l=.5,maxZoom:u=2,nodeOrigin:f,nodeExtent:d}={})=>{const c=new Map,h=new Map,w=new Map,x=new Map,m=o??t??[],y=n??e??[],N=f??[0,0],p=d??nt;tr(w,x,m);const v=En(y,c,h,{nodeOrigin:N,nodeExtent:p,elevateNodesOnSelect:!1});let _=[0,0,1];if(i&&s&&r){const E=ut(c,{filter:B=>!!((B.width||B.initialWidth)&&(B.height||B.initialHeight))}),{x:A,y:T,zoom:$}=Dn(E,s,r,l,u,(a==null?void 0:a.padding)??.1);_=[A,T,$]}return{rfId:"1",width:s??0,height:r??0,transform:_,nodes:y,nodesInitialized:v,nodeLookup:c,parentLookup:h,edges:m,edgeLookup:x,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:u,translateExtent:nt,no
6deExtent:p,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ve.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:N,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:i??!1,fitViewOptions:a,fitViewResolver:null,connection:{...zs},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Au,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Ds}},ah=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:s,height:r,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:u,nodeOrigin:f,nodeExtent:d})=>Sd((c,h)=>{async function w(){const{nodeLookup:x,panZoom:m,fitViewOptions:y,fitViewResolver:N,width:p,height:v,minZoom:_,maxZoom:E}=h();m&&(await ku({nodes:x,width:p,height:v,panZoom:m,minZoom:_,maxZoom:E},y),N==null||N.resolve(!0),c({fitViewResolver:null}))}return{...Uo({nodes:e,edges:t,width:s,height:r,fitView:i,fitViewOptions:a,minZoom:l,maxZoom:u,nodeOrigin:f,nodeExtent:d,defaultNodes:n,defaultEdges:o}),setNodes:x=>{const{nodeLookup:m,parentLookup:y,nodeOrigin:N,elevateNodesOnSelect:p,fitViewQueued:v}=h(),_=En(x,m,y,{nodeOrigin:N,nodeExtent:d,elevateNodesOnSelect:p,checkEquality:!0});v&&_?(w(),c({nodes:x,nodesInitialized:_,fitViewQueued:!1,fitViewOptions:void 0})):c({nodes:x,nodesInitialized:_})},setEdges:x=>{const{connectionLookup:m,edgeLookup:y}=h();tr(m,y,x),c({edges:x})},setDefaultNodesAndEdges:(x,m)=>{if(x){const{setNodes:y}=h();y(x),c({hasDefaultNodes:!0})}if(m){const{setEdges:y}=h();y(m),c({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:m,nodeLookup:y,parentLookup:N,domNode:p,nodeOrigin:v,nodeExtent:_,debug:E,fitViewQueued:A}=h(),{changes:T,updatedInternals:$}=Zu(x,y,N,p,v,_);$&&(qu(y,N,{nodeOrigin:v,nodeExtent:_}),A?(w(),c({fitViewQueued:!1,fitViewOptions:void 0})):c({}),(T==null?void 0:T.length)>0&&(E&&console.log("React Flow: trigger node changes",T),m==null||m(T)))},updateNodePositions:(x,m=!1)=>{const y=[],N=[],{nodeLookup:p,triggerNodeChanges:v}=h();for(const[_,E]of x){const A=p.get(_),T=!!(A!=null&&A.expandParent&&(A!=null&&A.parentId)&&(E!=null&&E.position)),$={id:_,type:"position",position:T?{x:Math.max(0,E.position.x),y:Math.max(0,E.position.y)}:E.position,dragging:m};T&&A.parentId&&y.push({id:_,parentId:A.parentId,rect:{...E.internals.positionAbsolute,width:E.measured.width??0,height:E.measured.height??0}}),N.push($)}if(y.length>0){const{parentLookup:_,nodeOrigin:E}=h(),A=Rn(y,p,_,E);N.push(...A)}v(N)},triggerNodeChanges:x=>{const{onNodesChange:m,setNodes:y,nodes:N,hasDefaultNodes:p,debug:v}=h();if(x!=null&&x.length){if(p){const _=mr(x,N);y(_)}v&&console.log("React Flow: trigger node changes",x),m==null||m(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:m,setEdges:y,edges:N,hasDefaultEdges:p,debug:v}=h();if(x!=null&&x.length){if(p){const _=yr(x,N);y(_)}v&&console.log("React Flow: trigger edge changes",x),m==null||m(x)}},addSelectedNodes:x=>{const{multiSelectionActive:m,edgeLookup:y,nodeLookup:N,triggerNodeChanges:p,triggerEdgeChanges:v}=h();if(m){const _=x.map(E=>ke(E,!0));p(_);return}p(Le(N,new Set([...x]),!0)),v(Le(y))},addSelectedEdges:x=>{const{multiSelectionActive:m,edgeLookup:y,nodeLookup:N,triggerNodeChanges:p,triggerEdgeChanges:v}=h();if(m){const _=x.map(E=>ke(E,!0));v(_);return}v(Le(y,new Set([...x]))),p(Le(N,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:m}={})=>{const{edges:y,nodes:N,nodeLookup:p,triggerNodeChanges:v,triggerEdgeChanges:_}=h(),E=x||N,A=m||y,T=E.map(B=>{const V=p.get(B.id);return V&&(V.selected=!1),ke(B.id,!1)}),$=A.map(B=>ke(B.id,!1));v(T),_($)},setMinZoom:x=>{const{panZoom:m,maxZoom:y}=h();m==null||m.setScaleExtent([x,y]),c({minZoom:x})},setMaxZoom:x=>{const{panZoom:m,minZoom:y}=h();m==null||m.setScaleExtent([y,x]),c({maxZoom:x})},setTranslateExtent:x=>{var m;(m=h().panZoom)==null||m.setTranslateExtent(x),c({translateExtent:x})},setPaneClickDistance:x=>{var m;(m=h().panZoom)==null||m.setClickDistance(x)},resetSelectedElements:()=>{const{edges:x,nodes:m,triggerNodeChanges:y,triggerEdgeChanges:N,elementsSelectable:p}=h();if(!p)return;const v=m.reduce((E,A)=>A.selected?[...E,ke(A.id,!1)]:E,[]),_=x.reduce((E,A)=>A.selected?[...E,ke(A.id,!1)]:E,[]);y(v),N(_)},setNodeExtent:x=>{const{nodes:m,nodeLookup:y,parentLookup:N,nodeOrigin:p,elevateNodesOnSelect:v,nodeExtent:_}=h();x[0][0]===_[0][0]&&x[0][1]===_[0][1]&&x[1][0]===_[1][0]&&x[1][1]===_[1][1]||(En(m,y,N,{nodeOrigin:p,nodeExtent:x,elevateNodesOnSelect:v,checkEquality:!1}),c({nodeExtent:x}
6))},panBy:x=>{const{transform:m,width:y,height:N,panZoom:p,translateExtent:v}=h();return Ku({delta:x,panZoom:p,transform:m,translateExtent:v,width:y,height:N})},setCenter:async(x,m,y)=>{const{width:N,height:p,maxZoom:v,panZoom:_}=h();if(!_)return Promise.resolve(!1);const E=typeof(y==null?void 0:y.zoom)<"u"?y.zoom:v;return await _.setViewport({x:N/2-x*E,y:p/2-m*E,zoom:E},{duration:y==null?void 0:y.duration,ease:y==null?void 0:y.ease,interpolate:y==null?void 0:y.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{c({connection:{...zs}})},updateConnection:x=>{c({connection:x})},reset:()=>c({...Uo()})}},Object.is);function ch({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:s,initialHeight:r,initialMinZoom:i,initialMaxZoom:a,initialFitViewOptions:l,fitView:u,nodeOrigin:f,nodeExtent:d,children:c}){const[h]=I.useState(()=>ah({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:s,height:r,fitView:u,minZoom:i,maxZoom:a,fitViewOptions:l,nodeOrigin:f,nodeExtent:d}));return g.jsx(Ed,{value:h,children:g.jsx(Gd,{children:c})})}function lh({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:s,width:r,height:i,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:f,nodeOrigin:d,nodeExtent:c}){return I.useContext(Gt)?g.jsx(g.Fragment,{children:e}):g.jsx(ch,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:s,initialWidth:r,initialHeight:i,fitView:a,initialFitViewOptions:l,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:d,nodeExtent:c,children:e})}const uh={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function dh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:s,nodeTypes:r,edgeTypes:i,onNodeClick:a,onEdgeClick:l,onInit:u,onMove:f,onMoveStart:d,onMoveEnd:c,onConnect:h,onConnectStart:w,onConnectEnd:x,onClickConnectStart:m,onClickConnectEnd:y,onNodeMouseEnter:N,onNodeMouseMove:p,onNodeMouseLeave:v,onNodeContextMenu:_,onNodeDoubleClick:E,onNodeDragStart:A,onNodeDrag:T,onNodeDragStop:$,onNodesDelete:B,onEdgesDelete:V,onDelete:P,onSelectionChange:D,onSelectionDragStart:b,onSelectionDrag:k,onSelectionDragStop:S,onSelectionContextMenu:j,onSelectionStart:C,onSelectionEnd:M,onBeforeDelete:L,connectionMode:H,connectionLineType:F=Se.Bezier,connectionLineStyle:z,connectionLineComponent:R,connectionLineContainerStyle:Y,deleteKeyCode:q="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:O=!1,selectionMode:G=ot.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:K=rt()?"Meta":"Control",zoomActivationKeyCode:Z=rt()?"Meta":"Control",snapToGrid:U,snapGrid:J,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:ne,nodesDraggable:ie,autoPanOnNodeFocus:me,nodesConnectable:ht,nodesFocusable:gt,nodeOrigin:pt=gr,edgesFocusable:qe,edgesReconnectable:We,elementsSelectable:Qt=!0,defaultViewport:mt=Hd,minZoom:Pe=.5,maxZoom:Ge=2,translateExtent:On=nt,preventScrolling:Wr=!0,nodeExtent:Jt,defaultMarkerColor:Gr="#b1b1b7",zoomOnScroll:Ur=!0,zoomOnPinch:Zr=!0,panOnScroll:Kr=!1,panOnScrollSpeed:Qr=.5,panOnScrollMode:Jr=Me.Free,zoomOnDoubleClick:ei=!0,panOnDrag:ti=!0,onPaneClick:ni,onPaneMouseEnter:oi,onPaneMouseMove:si,onPaneMouseLeave:ri,onPaneScroll:ii,onPaneContextMenu:ai,paneClickDistance:Yn=0,nodeClickDistance:ci=0,children:li,onReconnect:ui,onReconnectStart:di,onReconnectEnd:fi,onEdgeContextMenu:hi,onEdgeDoubleClick:gi,onEdgeMouseEnter:pi,onEdgeMouseMove:mi,onEdgeMouseLeave:yi,reconnectRadius:xi=10,onNodesChange:wi,onEdgesChange:vi,noDragClassName:bi="nodrag",noWheelClassName:_i="nowheel",noPanClassName:Xn="nopan",fitView:qn,fitViewOptions:Wn,connectOnClick:Ni,attributionPosition:Si,proOptions:Ei,defaultEdgeOptions:Ci,elevateNodesOnSelect:ki,elevateEdgesOnSelect:Mi,disableKeyboardA11y:Gn=!1,autoPanOnConnect:Ai,autoPanOnNodeDrag:ji,autoPanSpeed:Ii,connectionRadius:Pi,isValidConnection:Ti,onError:$i,style:Di,id:Un,nodeDragThreshold:zi,connectionDragThreshold:Li,viewport:Hi,onViewportChange:Fi,width:Ri,height:Vi,colorMode:Bi="light",debug:Oi,onScroll:yt,ariaLabelConfig:Yi,...Xi},qi){const en=Un||"1",Wi=Bd(Bi),Gi=I.useCallback(Zn=>{Zn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),yt==null||yt(Zn)},[yt]);return g.jsx("div",{"data-testid":"rf__wrapper",...Xi,onScroll:Gi,style:{...Di,...uh},ref:qi,className:re(["react-flow",s,Wi]),id:Un,role:"application",children:g.jsxs(lh,{nodes:e,edges:t,width:Ri,height:Vi,fitView:qn,fitViewOptions:Wn,minZoom:Pe,maxZoom:Ge,nodeOrigin:pt,nodeExtent:Jt,children:[g.jsx(ih,{onInit:u,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:N,onNodeMouseMove:p,onNodeMouseLeave:v,onNodeContextMenu:_,onNodeDoubleClick:E,nodeTypes:r,edgeTypes:i,connectionLineType:F,connectionLineStyle:z,connectionLineComponent:R,connectionLineContainerStyle:Y,selectionKeyCode:X,selectionOnDrag:O,selectionMode:G,deleteKeyCode:q,multiSelectionKeyCode:K,panActivationKeyCode:Q,zoomActivationKeyCode:Z,onlyRenderVisibleElements:te,defaultViewport:mt,translateExtent:On,minZoom:Pe,maxZoom:Ge,preventScrolling:Wr,zoomOnScroll:Ur,zoomOnPinch:Zr,zoomOnDoubleClick:ei,panOnScroll:Kr,panOnScrollSpeed:Qr,panOnScrollMode:Jr,panOnDrag:ti,onPaneClick:ni,onPaneMouseEnter:oi,onPaneMouseMove:si,onPaneMouseLeave:ri,onPaneScroll:ii,onPaneContextMenu:ai,paneClickDistance:Yn,nodeClickDistance:ci,onSelectionContextMenu:j,onSelectionStart:C,onSelectionEnd:M,onReconnect:ui,onReconnectStart:di,onReconnectEnd:fi,onEdgeContextMenu:hi,onEdgeDoubleClick:gi,onEdgeMouseEnter:pi,onEdgeMouseMove:mi,onEdgeMouseLeave:yi,reconnectRadius:xi,defaultMarkerColor:Gr,noDragClassName:bi,noWheelClassName:_i,noPanClassName:Xn,rfId:en,disableKeyboardA11y:Gn,nodeExtent:Jt,viewport:Hi,onViewportChange:Fi}),g.jsx(Vd,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:h,onConnectStart:w,onConnectEnd:x,onClickConnectStart:m,onClickConnectEnd:y,nodesDraggable:ie,autoPanOnNodeFocus:me,nodesConnectable:ht,nodesFocusable:gt,edgesFocusable:qe,edgesReconnectable:We,elementsSelectable:Qt,elevateNodesOnSelect:ki,elevateEdgesOnSelect:Mi,minZoom:Pe,maxZoom:Ge,nodeExtent:Jt,onNodesChange:wi,onEdgesChange:vi,snapToGri
6d:U,snapGrid:J,connectionMode:H,translateExtent:On,connectOnClick:Ni,defaultEdgeOptions:Ci,fitView:qn,fitViewOptions:Wn,onNodesDelete:B,onEdgesDelete:V,onDelete:P,onNodeDragStart:A,onNodeDrag:T,onNodeDragStop:$,onSelectionDrag:k,onSelectionDragStart:b,onSelectionDragStop:S,onMove:f,onMoveStart:d,onMoveEnd:c,noPanClassName:Xn,nodeOrigin:pt,rfId:en,autoPanOnConnect:Ai,autoPanOnNodeDrag:ji,autoPanSpeed:Ii,onError:$i,connectionRadius:Pi,isValidConnection:Ti,selectNodesOnDrag:ne,nodeDragThreshold:zi,connectionDragThreshold:Li,onBeforeDelete:L,paneClickDistance:Yn,debug:Oi,ariaLabelConfig:Yi}),g.jsx(Ld,{onSelectionChange:D}),li,g.jsx(Pd,{proOptions:Ei,position:Si}),g.jsx(Id,{rfId:en,disableKeyboardA11y:Gn})]})})}var fh=xr(dh);function hh(e){const[t,n]=I.useState(e),o=I.useCallback(s=>n(r=>mr(s,r)),[]);return[t,n,o]}function gh(e){const[t,n]=I.useState(e),o=I.useCallback(s=>n(r=>yr(s,r)),[]);return[t,n,o]}function ph({dimensions:e,lineWidth:t,variant:n,className:o}){return g.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:re(["react-flow__background-pattern",n,o])})}function mh({radius:e,className:t}){return g.jsx("circle",{cx:e,cy:e,r:e,className:re(["react-flow__background-pattern","dots",t])})}var Ee;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ee||(Ee={}));const yh={[Ee.Dots]:1,[Ee.Lines]:1,[Ee.Cross]:6},xh=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Br({id:e,variant:t=Ee.Dots,gap:n=20,size:o,lineWidth:s=1,offset:r=0,color:i,bgColor:a,style:l,className:u,patternClassName:f}){const d=I.useRef(null),{transform:c,patternId:h}=ee(xh,se),w=o||yh[t],x=t===Ee.Dots,m=t===Ee.Cross,y=Array.isArray(n)?n:[n,n],N=[y[0]*c[2]||1,y[1]*c[2]||1],p=w*c[2],v=Array.isArray(r)?r:[r,r],_=m?[p,p]:N,E=[v[0]*c[2]||1+_[0]/2,v[1]*c[2]||1+_[1]/2],A=`${h}${e||""}`;return g.jsxs("svg",{className:re(["react-flow__background",u]),style:{...l,...Zt,"--xy-background-color-props":a,"--xy-background-pattern-color-props":i},ref:d,"data-testid":"rf__background",children:[g.jsx("pattern",{id:A,x:c[0]%N[0],y:c[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:x?g.jsx(mh,{radius:p/2,className:f}):g.jsx(ph,{dimensions:_,lineWidth:s,variant:t,className:f})}),g.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}Br.displayName="Background";const wh=I.memo(Br);function vh(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:g.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function bh(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:g.jsx("path",{d:"M0 0h32v4.2H0z"})})}function _h(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:g.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 Nh(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:g.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 Sh(){return g.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:g.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 St({children:e,className:t,...n}){return g.jsx("button",{type:"button",className:re(["react-flow__controls-button",t]),...n,children:e})}const Eh=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Or({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:s,onZoomIn:r,onZoomOut:i,onFitView:a,onInteractiveChange:l,className:u,children:f,position:d="bottom-left",orientation:c="vertical","aria-label":h}){const w=oe(),{isInteractive:x,minZoomReached:m,maxZoomReached:y,ariaLabelConfig:N}=ee(Eh,se),{zoomIn:p,zoomOut:v,fitView:_}=Vn(),E=()=>{p(),r==null||r()},A=()=>{v(),i==null||i()},T=()=>{_(s),a==null||a()},$=()=>{w.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),l==null||l(!x)},B=c==="horizontal"?"horizontal":"vertical";return g.jsxs(Ut,{className:re(["react-flow__controls",B,u]),position:d,style:e,"data-testid":"rf__controls","aria-label":h??N["controls.ariaLabel"],children:[t&&g.jsxs(g.Fragment,{children:[g.jsx(St,{onClick:E,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:y,children:g.jsx(vh,{})}),g.jsx(St,{onClick:A,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:m,children:g.jsx(bh,{})})]}),n&&g.jsx(St,{className:"react-flow__controls-fitview",onClick:T,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:g.jsx(_h,{})}),o&&g.jsx(St,{className:"react-flow__controls-interactive",onClick:$,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:x?g.jsx(Sh,{}):g.jsx(Nh,{})}),f]})}Or.displayName="Controls";const Ch=I.memo(Or);function kh({id:e,x:t,y:n,width:o,height:s,style:r,color:i,strokeColor:a,strokeWidth:l,className:u,borderRadius:f,shapeRendering:d,selected:c,onClick:h}){const{background:w,backgroundColor:x}=r||{},m=i||w||x;return g.jsx("rect",{className:re(["react-flow__minimap-node",{selected:c},u]),x:t,y:n,rx:f,ry:f,width:o,height:s,style:{fill:m,stroke:a,strokeWidth:l},shapeRendering:d,onClick:h?y=>h(y,e):void 0})}const Mh=I.memo(kh),Ah=e=>e.nodes.map(t=>
6t.id),gn=e=>e instanceof Function?e:()=>e;function jh({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:s,nodeComponent:r=Mh,onClick:i}){const a=ee(Ah,se),l=gn(t),u=gn(e),f=gn(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return g.jsx(g.Fragment,{children:a.map(c=>g.jsx(Ph,{id:c,nodeColorFunc:l,nodeStrokeColorFunc:u,nodeClassNameFunc:f,nodeBorderRadius:o,nodeStrokeWidth:s,NodeComponent:r,onClick:i,shapeRendering:d},c))})}function Ih({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:s,nodeStrokeWidth:r,shapeRendering:i,NodeComponent:a,onClick:l}){const{node:u,x:f,y:d,width:c,height:h}=ee(w=>{const{internals:x}=w.nodeLookup.get(e),m=x.userNode,{x:y,y:N}=x.positionAbsolute,{width:p,height:v}=be(m);return{node:m,x:y,y:N,width:p,height:v}},se);return!u||u.hidden||!Os(u)?null:g.jsx(a,{x:f,y:d,width:c,height:h,style:u.style,selected:!!u.selected,className:o(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:r,shapeRendering:i,onClick:l,id:u.id})}const Ph=I.memo(Ih);var Th=I.memo(jh);const $h=200,Dh=150,zh=e=>!e.hidden,Lh=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?Bs(ut(e.nodeLookup,{filter:zh}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Hh="react-flow__minimap-desc";function Yr({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:s="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a,bgColor:l,maskColor:u,maskStrokeColor:f,maskStrokeWidth:d,position:c="bottom-right",onClick:h,onNodeClick:w,pannable:x=!1,zoomable:m=!1,ariaLabel:y,inversePan:N,zoomStep:p=1,offsetScale:v=5}){const _=oe(),E=I.useRef(null),{boundingRect:A,viewBB:T,rfId:$,panZoom:B,translateExtent:V,flowWidth:P,flowHeight:D,ariaLabelConfig:b}=ee(Lh,se),k=(e==null?void 0:e.width)??$h,S=(e==null?void 0:e.height)??Dh,j=A.width/k,C=A.height/S,M=Math.max(j,C),L=M*k,H=M*S,F=v*M,z=A.x-(L-A.width)/2-F,R=A.y-(H-A.height)/2-F,Y=L+F*2,q=H+F*2,X=`${Hh}-${$}`,O=I.useRef(0),G=I.useRef();O.current=M,I.useEffect(()=>{if(E.current&&B)return G.current=id({domNode:E.current,panZoom:B,getTransform:()=>_.getState().transform,getViewScale:()=>O.current}),()=>{var U;(U=G.current)==null||U.destroy()}},[B]),I.useEffect(()=>{var U;(U=G.current)==null||U.update({translateExtent:V,width:P,height:D,inversePan:N,pannable:x,zoomStep:p,zoomable:m})},[x,m,N,p,V,P,D]);const Q=h?U=>{var ne;const[J,te]=((ne=G.current)==null?void 0:ne.pointer(U))||[0,0];h(U,{x:J,y:te})}:void 0,K=w?I.useCallback((U,J)=>{const te=_.getState().nodeLookup.get(J).internals.userNode;w(U,te)},[]):void 0,Z=y??b["minimap.ariaLabel"];return g.jsx(Ut,{position:c,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*M: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 i=="number"?i:void 0},className:re(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:g.jsxs("svg",{width:k,height:S,viewBox:`${z} ${R} ${Y} ${q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":X,ref:E,onClick:Q,children:[Z&&g.jsx("title",{id:X,children:Z}),g.jsx(Th,{onClick:K,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:r,nodeClassName:s,nodeStrokeWidth:i,nodeComponent:a}),g.jsx("path",{className:"react-flow__minimap-mask",d:`M${z-F},${R-F}h${Y+F*2}v${q+F*2}h${-Y-F*2}z
7        M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Yr.displayName="MiniMap";const Fh=I.memo(Yr),Rh=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Vh={[Xe.Line]:"right",[Xe.Handle]:"bottom-right"};function Bh({nodeId:e,position:t,variant:n=Xe.Handle,className:o,style:s=void 0,children:r,color:i,minWidth:a=10,minHeight:l=10,maxWidth:u=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:c,autoScale:h=!0,shouldResize:w,onResizeStart:x,onResize:m,onResizeEnd:y}){const N=_r(),p=typeof e=="string"?e:N,v=oe(),_=I.useRef(null),E=n===Xe.Handle,A=ee(I.useCallback(Rh(E&&h),[E,h]),se),T=I.useRef(null),$=t??Vh[n];I.useEffect(()=>{if(!(!_.current||!p))return T.current||(T.current=vd({domNode:_.current,nodeId:p,getStoreItems:()=>
7{const{nodeLookup:V,transform:P,snapGrid:D,snapToGrid:b,nodeOrigin:k,domNode:S}=v.getState();return{nodeLookup:V,transform:P,snapGrid:D,snapToGrid:b,nodeOrigin:k,paneDomNode:S}},onChange:(V,P)=>{const{triggerNodeChanges:D,nodeLookup:b,parentLookup:k,nodeOrigin:S}=v.getState(),j=[],C={x:V.x,y:V.y},M=b.get(p);if(M&&M.expandParent&&M.parentId){const L=M.origin??S,H=V.width??M.measured.width??0,F=V.height??M.measured.height??0,z={id:M.id,parentId:M.parentId,rect:{width:H,height:F,...Ys({x:V.x??M.position.x,y:V.y??M.position.y},{width:H,height:F},M.parentId,b,L)}},R=Rn([z],b,k,S);j.push(...R),C.x=V.x?Math.max(L[0]*H,V.x):void 0,C.y=V.y?Math.max(L[1]*F,V.y):void 0}if(C.x!==void 0&&C.y!==void 0){const L={id:p,type:"position",position:{...C}};j.push(L)}if(V.width!==void 0&&V.height!==void 0){const H={id:p,type:"dimensions",resizing:!0,setAttributes:c?c==="horizontal"?"width":"height":!0,dimensions:{width:V.width,height:V.height}};j.push(H)}for(const L of P){const H={...L,type:"position"};j.push(H)}D(j)},onEnd:({width:V,height:P})=>{const D={id:p,type:"dimensions",resizing:!1,dimensions:{width:V,height:P}};v.getState().triggerNodeChanges([D])}})),T.current.update({controlPosition:$,boundaries:{minWidth:a,minHeight:l,maxWidth:u,maxHeight:f},keepAspectRatio:d,resizeDirection:c,onResizeStart:x,onResize:m,onResizeEnd:y,shouldResize:w}),()=>{var V;(V=T.current)==null||V.destroy()}},[$,a,l,u,f,d,x,m,y,w]);const B=$.split("-");return g.jsx("div",{className:re(["react-flow__resize-control","nodrag",...B,n,o]),ref:_,style:{...s,scale:A,...i&&{[E?"backgroundColor":"borderColor"]:i}},children:r})}I.memo(Bh);const Xr=I.memo(({data:e})=>g.jsxs(g.Fragment,{children:[g.jsx(jt,{className:"w-64 shadow-lg",children:g.jsxs(It,{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[g.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-primary/10",children:g.jsx(Qi,{className:"h-4 w-4 text-primary"})}),g.jsxs("div",{className:"flex-1",children:[g.jsx("div",{className:"font-semibold text-sm",children:"Trigger"}),g.jsx("div",{className:"text-xs text-muted-foreground",children:"When events occur"})]}),g.jsx(we,{size:"icon",variant:"ghost",onClick:e.onEdit,children:g.jsx(as,{className:"h-4 w-4"})})]}),e.when.length>0?g.jsx("div",{className:"flex flex-wrap gap-1",children:e.when.map(t=>g.jsx(Ui,{variant:"secondary",className:"text-xs",children:t.replace(/_/g," ")},t))}):g.jsx("div",{className:"text-xs text-muted-foreground italic",children:"Not configured"})]})}),g.jsx(Ie,{type:"source",position:W.Bottom,className:"w-3 h-3"})]}));Xr.displayName="TriggerNode";const Oh=[{value:"job_completed",label:"Job Completed"},{value:"job_error",label:"Job Error"},{value:"change_detected",label:"Change Detected"}];function Yh({open:e,onOpenChange:t,initialConfig:n,agents:o,onSave:s}){var d;const[r,i]=I.useState(((d=n.trigger)==null?void 0:d.when)||[]),[a,l]=I.useState(n.agents);I.useEffect(()=>{var c;i(((c=n.trigger)==null?void 0:c.when)||[]),l(n.agents)},[n,e]);const u=c=>{i(h=>h.includes(c)?h.filter(w=>w!==c):[...h,c])},f=()=>{s({trigger:{when:r},agents:a})};return g.jsx(Ko,{open:e,onOpenChange:t,children:g.jsxs(Qo,{children:[g.jsxs(Jo,{children:[g.jsx(es,{children:"Configure Trigger"}),g.jsx(ts,{children:"Select which agents, and events should trigger this workflow"})]}),g.jsxs("div",{className:"space-y-6 px-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx(ae,{className:"text-sm font-medium",children:"Applicable to*"}),g.jsxs(ns,{value:a.all?"all":"selected",onValueChange:c=>l(h=>({...h,all:c==="all"})),className:"space-y-2",children:[g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx(pn,{value:"all",id:"agents-all"}),g.jsx(ae,{htmlFor:"agents-all",className:"cursor-pointer",children:"All agents"})]}),g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx(pn,{value:"selected",id:"agents-selected"}),g.jsx(ae,{htmlFor:"agents-selected",className:"cursor-pointer",children:"Selected agents only"})]}),g.jsx(da,{options:o.map(c=>({label:c.name,value:c.agent_id})),placeholder:"Select agents",defaultValue:a.selected,onValueChange:c=>{l(h=>({...h,selected:c,all:!1}))},disabled:a.all,modalPopover:!0})]})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsx(ae,{className:"text-sm font-medium",children:"Trigger when*"}),Oh.map(c=>g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx(os,{id:c.value,checked:r.includes(c.value),onCheckedChange:()=>u(c.value)}),g.jsx(ae,{htmlFor:c.value,className:"text-sm font-normal cursor-pointer",children:c.label})]},c.value))]})]}),g.jsxs(ss,{children:[g.jsx(we,{onClick:f,disabled:r.length===0,children:"Save Trigger"}),g.jsx(we,{variant:"outline",onClick:()=>t(!1),children:"Cancel"})]})]})})}function Xh({open:e,onOpenChange:t,initialAction:n,integrationType:o,integrations:s,agents:r,connections:i,onSave:a}){const[l,u]=I.useState((n==null?void 0:n.config)||{}),f=(n==null?void 0:n.type)||o||"",d=s.find(m=>m.id===f);I.useEffect(()=>{u(n?n.config:{})},[n,e]);const c=(m,y)=>{u(N=>({...N,[m]:y}))},h=()=>{a({type:f,config:l})},w=m=>{var p,v;const y=`field-${m.name}
7`,N=l[m.name];if(m.name==="agent_id")return g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ae,{htmlFor:y,children:[m.label,m.required&&g.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),g.jsxs(tn,{value:N||"",onValueChange:_=>c(m.name,_),children:[g.jsx(nn,{id:y,className:"w-full",children:g.jsx(on,{placeholder:`Select ${m.label}`})}),g.jsx(sn,{children:r.map(_=>g.jsxs(rn,{value:_.agent_id,children:[_.name," (# ",_.agent_id,")"]},_.agent_id))})]}),m.message&&g.jsx("p",{className:"text-xs text-muted-foreground",children:m.message})]},m.name);if(m.name==="connection_id")return g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ae,{htmlFor:y,children:[m.label,m.required&&g.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),g.jsxs(tn,{value:N||"",onValueChange:_=>c(m.name,_),children:[g.jsx(nn,{id:y,className:"w-full",children:g.jsx(on,{placeholder:`Select ${m.label}`})}),g.jsx(sn,{children:i.filter(_=>_.type===f).length===0?g.jsxs("div",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:[g.jsx("p",{className:"mb-2",children:"No connections available"}),g.jsxs("p",{className:"text-xs",children:["Go to"," ",g.jsxs(aa,{to:"/settings/connections",className:"text-blue-500 underline",children:["Settings ",">"," Connections"]})," ","to connect with ",f]})]}):i.filter(_=>_.type===f).map(_=>g.jsxs(rn,{value:_.connection_id.toString(),children:[_.name," (# ",_.connection_id,")"]},_.connection_id))})]}),m.message&&g.jsx("p",{className:"text-xs text-muted-foreground",children:m.message})]},m.name);switch(m.type){case"text":case"number":return g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ae,{htmlFor:y,children:[m.label,m.required&&g.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),g.jsx(is,{id:y,type:m.type,placeholder:m.name,value:N||"",onChange:_=>c(m.name,_.target.value)}),m.message&&g.jsx("p",{className:"text-xs text-muted-foreground",children:m.message})]},m.name);case"textarea":return g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ae,{htmlFor:y,children:[m.label,m.required&&g.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),g.jsx(rs,{id:y,placeholder:m.name,value:N||"",onChange:_=>c(m.name,_.target.value),rows:3}),m.message&&g.jsx("p",{className:"text-xs text-muted-foreground",children:m.message})]},m.name);case"checkbox":return g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx(os,{id:y,checked:N||!1,onCheckedChange:_=>c(m.name,_)}),g.jsxs(ae,{htmlFor:y,className:"cursor-pointer",children:[m.label,m.required&&g.jsx("span",{className:"text-destructive ml-1",children:"*"})]})]}),m.message&&g.jsx("p",{className:"text-xs text-muted-foreground ml-6",children:m.message})]},m.name);case"select":return g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ae,{htmlFor:y,children:[m.label,m.required&&g.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),g.jsxs(tn,{value:N||"",onValueChange:_=>c(m.name,_),children:[g.jsx(nn,{id:y,className:"w-full",children:g.jsx(on,{placeholder:`Select ${m.label}`})}),g.jsx(sn,{children:(p=m.options)==null?void 0:p.map(_=>g.jsx(rn,{value:_,children:_},_))})]}),m.message&&g.jsx("p",{className:"text-xs text-muted-foreground",children:m.message})]},m.name);case"radio":return g.jsxs("div",{className:"space-y-2",children:[g.jsxs(ae,{children:[m.label,m.required&&g.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),g.jsx(ns,{value:N||"",onValueChange:_=>c(m.name,_),children:(v=m.options)==null?void 0:v.map(_=>g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx(pn,{value:_.key,id:`${y}-${_.key}`}),g.jsx(ae,{htmlFor:`${y}-${_.key}`,className:"cursor-pointer",children:_.label})]},_.key))}),m.message&&g.jsx("p",{className:"text-xs text-muted-foreground",children:m.message})]},m.name);default:return null}},x=()=>d?d.fields.every(m=>{if(!m.required)return!0;const y=l[m.name];return m.type==="checkbox"?!0:y!=null&&y!==""}):!1;return d?g.jsx(Ko,{open:e,onOpenChange:t,children:g.jsxs(Qo,{className:"overflow-y-auto sm:max-w-md",children:[g.jsx(Jo,{className:"border-b",children:g.jsxs("div",{className:"flex items-start gap-3",children:[d.icon&&g.jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-lg bg-background border flex-shrink-0",children:g.jsx("img",{src:d.icon,alt:d.name,className:"w-6 h-6 object-contain"})}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[g.jsx(es,{className:"font-semibold text-sm",children:d.name}),g.jsxs("span",{className:"text-xs text-muted-foreground capitalize",children:["(",d.category,")"]})]}),g.jsx(ts,{className:"text-xs text-muted-foreground mb-2",children:d.description}),d.docs&&g.jsxs("a",{href:d.docs,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["View Documentation",g.jsx(Ji,{className:"h-3 w-3"})]})]})]})}),g.jsx("div",{className:"space-y-4 p-4",children:g.jsx("div",{className:"space-y-4",children:d.fields.map(m=>w(m))})}),g.jsx(ss,{children:g.jsx(we,{onClick:h,disabled:!x(),children:"Save Action"})})]})}):null}const qh=[{type:"connector",id:"email",name:"Email",category:"automation",plan:"Free",icon:"https://cdn.agenty.com/icons/email-plugin.png",description:"Trigger a job completed email notification to given email address(s) when the agent completes a job.",docs:"https://agenty.com/docs/email-notification-with-attachment/104",fields:[{name:"emails",label:"Email Address(s)",type:"textarea",options:null,required:!0,message:"Separate email address(s) by comma or new line if multiples."},{name:"attach_result",label:"Send the output file as attachment?",type:"checkbox",options:null,required:!1,message:"The output.csv file will be attached on email notification. Maximum size(5mb)"}
7]},{type:"connector",id:"webhook",name:"Webhook",category:"automation",plan:"Free",icon:"https://cdn.agenty.com/icons/webhook-plugin.png",description:"Sends a HTTP POST request with result body in JSON format to given call_back URL, when the agent completes a job.",docs:"https://agenty.com/docs/webhook-integration/109",fields:[{name:"url",label:"URL Endpoint",type:"text",options:null,required:!0,message:"Must be a valid http/https URL"},{name:"batch_size",label:"Batch Size",type:"number",value:1e3,options:null,required:!0,message:"Number or records per batch to split the large result files into batches. (Default : 1000, Maximum : 2500)"},{name:"collections",label:"Collections",type:"text",value:"1",options:null,required:!0,message:"Use comma separated list of collections(1,2,3...). If the agent is setup to extract data into multiple collections(Default : 1)"}]},{type:"oauth",id:"googlesheets",name:"Google Sheets",category:"spreadsheet",plan:"Free",icon:"https://cdn.agenty.com/icons/google-sheets.png",description:"Import the agent result to your Google sheet",docs:"https://agenty.com/docs/web-scraping-with-google-sheets/392",fields:[{name:"sheet_id",label:"Sheet Id",type:"text",options:null,required:!0,message:"Enter your Google sheet Id"},{name:"range",label:"Range",type:"text",options:null,required:!1,message:"Range in the sheet, default: Sheet1!A1"},{name:"headers",label:"Add headers",type:"radio",options:[{key:"Yes",label:"Yes"},{key:"No",label:"No"}],required:!1,message:""},{name:"write_mode",label:"Write mode",type:"radio",options:[{key:"Append",label:"Append"},{key:"Overwrite",label:"Overwrite"}],required:!1,message:""}]},{type:"oauth",id:"dropbox",name:"DropBox",category:"storage",plan:"Professional",icon:"https://cdn.agenty.com/icons/dropbox.png",description:"Upload the agent result CSV file on your Dropbox account.",docs:"https://agenty.com/docs/dropbox-integration/103",fields:[{name:"path",label:"Dropbox Path",type:"text",options:null,required:!0,message:"Define the 'Folder/filename' where the agent result file will be uploaded. For example: Agenty/Job-{{job_id}}-{{MMddyyyy}}-{{name}}.csv . If you don't specify a folder, the agent result will be stored in the root of the app"},{name:"collections",label:"Collections",type:"text",options:null,required:!1,message:"Use comma separated list of collections(1,2,3...). If the agent is setup to extract data into multiple collections(Default : 1)"}]},{type:"connector",id:"amazons3",name:"Amazon S3",category:"storage",plan:"Professional",icon:"https://cdn.agenty.com/icons/amazons3.png",description:"Upload the agent result CSV file to your Amazon S3 Bucket on selected region.",docs:"https://agenty.com/docs/amazon-s3-integration/102",fields:[{name:"access_key",label:"AWS Access Key",type:"text",options:null,required:!0,message:"AWS access key for authentication"},{name:"secret_key",label:"AWS Secret Key",type:"text",options:null,required:!0,message:"AWS access secret token for authentication"},{name:"region",label:"S3 Region",type:"text",options:null,required:!0,message:"Must be a valid S3 Region name, for example : us-east-1, ap-east-1, ca-central-1 etc"},{name:"bucket",label:"S3 Bucket",type:"text",options:null,required:!0,message:"Must be a valid bucket name in the given region"},{name:"path",label:"S3 Path",type:"text",options:null,required:!0,message:"Define the 'Folder/filename' where the agent result file will be uploaded. For example: Agenty/Job-{{job_id}}-{{MMddyyyy}}-{{name}}.csv . If you don't specify a folder, the agent result will be stored in the root of the bucket."},{name:"collections",label:"Collections",type:"text",options:null,required:!0,message:"Use comma separated list of collections(1,2,3...). If your agent is setup to extract data into multiple collections(Default : 1)"}]},{type:"connector",id:"algolia",name:"Algolia",category:"search",plan:"Professional",icon:"https://cdn.agenty.com/icons/algolia.png",description:"Crawl website and add, update agent result to your search indices on Algolia.",docs:"https://agenty.com/docs/algolia-integration-crawl-your-website-and-import-to-algolia-indices-to-create-custom-search-engine/101",fields:[{name:"application_id",label:"Algolia Application Id",type:"text",options:null,required:!0,message:"Must be a valid Algolia unique application identifier"},{name:"api_key",label:"Algolia Admin Api Key",type:"text",options:null,required:!0,message:"A valid Algolia admin api key to create, update and delete indices"},{name:"indices_name",label:"Algolia Indices Name",type:"text",options:null,required:!0,message:"A valid indices name. Algolia will create one, if no indices found with this name"},{name:"url_field",label:"URL Field Name",type:"text",options:null,required:!0,message:"Enter the field name containing page URL of your website to generate objectId automatically for upsert documents in index."},{name:"clear_index",label:"Clear indices?",type:"checkbox",options:null,required:!0,message:"Clear the indices data every time before starting an import"}]},{type:"connector",id:"sftp",name:"SFTP",category:"storage",plan:"Professional",icon:"https://cdn.agenty.com/icons/ftp.png",description:"Upload the agent result CSV file to your FTP or SFTP server.",docs:"https://agenty.com/docs/sftp-integration/107",fields:[{name:"ftp_type",label:"FTP Type",type:"select",options:["FTP","FTPS","SFTP"],required:!0,message:"Select the type of FTP, should be one of: FTP, FTPS or SFTP"},{name:"host",label:"Host",type:"text",options:null,required:!0,message:"Host or IP address"},{name:"port",label:"Port",type:"number",options:null,required:!0,message:"Port number. Must be an integer"},{name:"username",label:"Username",type:"text",options:null,required:!0,message:"Valid login user name"},{name:"password",label:"Password",type:"text",options:null,required:!0,message:"Valid login password"},{name:"path",label:"Path",type:"text",options:null,required:!0,message:"Your FTP directory where the file should be uploaded. By default is root directory"},{name:"name",label:"Name",type:"text",options:null,required:!0,message:"Name of file. For example: Job-{{job_id}}-{{MMddyyyy}}-output.csv"}]},{type:"connector",id:"agenty",name:"Agenty",category:"automation",plan:"Free",icon:"https://cdn.agenty.com/logo/agenty-icon.svg",description:"This plugin lets you start another agent job for selected agent in your Agenty account. Now you can run dependents agents on sequence automatically.",docs:"#",fields:[{name:"agent_id",label:"Agent Id",type:"select",options:null,required:!0,message:"Select an agent from your account"}]},{type:"connector",id:"zapier",name:"Zapier",category:"automation",plan:"Free",icon:"https://cdn.agenty.com/icons/zapier.png",description:"Send the agent result to Zapier webhook.",docs:"https://agenty.com/docs/zapier-integration/110",fields:[{name:"url",label:"Zapier Webhook URL",type:"text",options:null,required:!0,message:"Must be a valid Zapier webhook URL"},{name:"batch_size",label:"Batch Size",type:"number",options:null,required:!0,message:"Number or records per batch to split the large result files into batches. (Default : 1000, Maximum : 2500)"},{name:"collections",label:"Collections",type:"text",options:null,required:!0,message:"Use comma separated list of collections(1,2,3...). If the agent is setup to extract data into multiple collections(Default : 1)"}]}
7,{type:"oauth",id:"firebase",name:"Firebase",category:"spreadsheet",plan:"Business",icon:"https://cdn.agenty.com/icons/firestore.png",description:"Import the agent result to your Google Cloud Firebase NoSQL document database",docs:"https://agenty.com/docs/firestore-integration/105",fields:[{name:"project_id",label:"Firebase Project Id",type:"text",options:null,required:!0,message:"Define the Firebase project id"},{name:"collection_name",label:"Firebase Collection Name",type:"text",options:null,required:!0,message:"A valid collection name. Agenty will create the new collection with specified name, if it doesn't exists in your Firebase DB"},{name:"key_field",label:"Primary key field",type:"text",options:null,required:!1,message:"Specify a primary key field from your agent to overwrite (upsert) existing rows (if any). If not specified, Agenty will auto-generate primary key to insert as new document"}]},{type:"connector",id:"mongodb",name:"MongoDB",category:"database",plan:"Business",icon:"https://cdn.agenty.com/icons/mongodb.png",description:"Import the agent result to your MongoDB NoSQL database collection.",docs:"https://agenty.com/docs/mongodb-integration/106",fields:[{name:"connection_string",label:"MongoDB Connection String",type:"text",options:null,required:!0,message:"Must be in mongodb://[username:password@]hostname[:port][/[database][?options]] format"},{name:"database_name",label:"MongoDB Database Name",type:"text",options:null,required:!0,message:"A valid database name"},{name:"collection_name",label:"MongoDB Collection Name",type:"text",options:null,required:!0,message:"A valid collection name. Agenty will create the new collection with specified name, if it doesn't exists in your MongoDB"}]}],qr=I.memo(({data:e})=>{const t=qh.find(n=>n.id===e.label);return g.jsxs(g.Fragment,{children:[g.jsx(Ie,{type:"target",position:W.Top,className:"w-3 h-3"}),g.jsx(jt,{className:"w-64 shadow-lg hover:shadow-xl transition-shadow",children:g.jsxs(It,{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[g.jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-full bg-secondary text-gray-600 dark:text-gray-400",children:t&&g.jsx("img",{src:t.icon,alt:t.name,className:"w-4 h-4 object-contain",onError:n=>n.currentTarget.style.display="none"})}),g.jsxs("div",{className:"flex-1",children:[g.jsx("div",{className:"font-semibold text-sm capitalize",children:e.label}),g.jsx("div",{className:"text-xs text-muted-foreground",children:"Action"})]}),g.jsxs("div",{className:"flex gap-1",children:[g.jsx(we,{size:"icon",variant:"ghost",onClick:e.onEdit,children:g.jsx(as,{className:"h-4 w-4"})}),g.jsx(we,{size:"icon",variant:"ghost",onClick:e.onDelete,children:g.jsx(ea,{className:"h-4 w-4 text-destructive"})})]})]}),e.config&&Object.keys(e.config).length>0&&g.jsx("div",{className:"text-xs space-y-1 bg-secondary/30 p-2 rounded",children:Object.entries(e.config).slice(0,2).map(([n,o])=>g.jsxs("div",{className:"flex gap-2",children:[g.jsxs("span",{className:"text-muted-foreground",children:[n,":"]}),g.jsx("span",{className:"font-medium truncate flex-1",children:String(o).substring(0,30)})]},n))})]})}),g.jsx(Ie,{type:"source",position:W.Bottom,className:"w-3 h-3"})]})});qr.displayName="ActionNode";const Wh={trigger:Xr,action:qr},Zo={name:"New Workflow",is_enabled:!0,agents:{all:!0,selected:[]},trigger:{when:["job_completed"]},actions:[]};function eg(){const{id:e}=ca(),t=la(),n=e!=="add",{theme:o}=ua(),[s,r]=I.useState(Zo),[i,a]=I.useState(!0),[l,u]=I.useState([]),[f,d]=I.useState([]),[c,h]=I.useState([]),[w,x,m]=hh([]),[y,N,p]=gh([]),[v,_]=I.useState(!1),[E,A]=I.useState(!1),[T,$]=I.use
7State(null),[B,V]=I.useState(!1);I.useEffect(()=>{(async()=>{if(n&&e){const R=await Te.get($e.workflows,e);r(R)}else r(Zo)})()},[e,n,t]);const P=I.useCallback(async()=>{try{const z=await Te.list($e.agents,{offset:0,limit:1e3});z!=null&&z.result&&u(z.result)}catch{}},[]),D=I.useCallback(async()=>{try{const z=await Te.list($e.connections);z!=null&&z.result&&h(z.result)}catch{}},[]),b=I.useCallback(async()=>{try{const z=await Te.list($e.integrations);z&&d(z)}catch{}},[]);I.useEffect(()=>{(async()=>{a(!0),await Promise.all([P(),b(),D()]),a(!1)})()},[P,D,b]),I.useEffect(()=>{const z=[{id:"trigger",type:"trigger",position:{x:250,y:50},data:{label:"Trigger",when:s.trigger.when,onEdit:()=>_(!0)}}],R=[];let Y=200;s.actions.forEach((q,X)=>{const O=`action-${X}`;z.push({id:O,type:"action",position:{x:250,y:Y},data:{label:q.type,config:q.config,onEdit:()=>{$(X),A(!0)},onDelete:()=>j(X)}});const G=X===0?"trigger":`action-${X-1}`;R.push({id:`e-${G}-${O}`,source:G,target:O,animated:!0}),Y+=150}),x(z),N(R)},[s.trigger.when,s.actions]);const k=z=>{r(R=>({...R,...z})),_(!1)},S=z=>{let R;r(Y=>{const q=[...Y.actions];return T!==null?q[T]=z:q.push(z),R={...Y,actions:q},R}),$(null),A(!1),H(R)},j=z=>{r(R=>({...R,actions:R.actions.filter((Y,q)=>q!==z)}))},C=z=>{const R={type:z,config:{}};r(Y=>{const q=[...Y.actions];return q.push(R),{...Y,actions:q}}),$(s.actions.length),A(!0)},M=(z,R)=>{z.dataTransfer.setData("application/reactflow",R),z.dataTransfer.effectAllowed="move",C(R)},L=I.useCallback(z=>N(R=>Ks(z,R)),[N]),H=async z=>{V(!0);try{if(n&&e)await Te.put($e.workflows,e,z);else{const R=await Te.post($e.workflows,z);r(Y=>({...Y,...R})),t(`/workflows/${R.workflow_id}`,{replace:!0})}Jn.success("Workflow saved successfully")}catch(R){Jn.error(R.message)}finally{V(!1)}},F=()=>{};return g.jsxs("div",{className:"flex flex-col -m-4 md:-m-6 min-h-screen",children:[g.jsx("div",{className:"border-b bg-background p-4 flex-shrink-0",children:g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("div",{className:"flex items-center space-x-4",children:g.jsxs("div",{children:[g.jsx("h1",{className:"text-xl font-semibold",children:n?"Edit Workflow":"Create Workflow"}),g.jsx("p",{className:"text-sm text-muted-foreground",children:"Design your automation workflow"})]})}),g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsxs(we,{variant:"outline",onClick:F,disabled:!0,children:[g.jsx(ta,{className:"mr-2 h-4 w-4"}),"Test"]}),g.jsxs(we,{onClick:()=>H(s),disabled:B,children:[B?g.jsx(na,{className:"mr-2 h-4 w-4 animate-spin"}):g.jsx(oa,{className:"mr-2 h-4 w-4"}),"Save"]})]})]})}),g.jsxs("div",{className:"flex-1 flex",children:[g.jsxs("aside",{className:"w-80 bg-muted/30 border-r p-4 space-y-4  overflow-y-auto",children:[g.jsxs(jt,{className:"gap-0",children:[g.jsx(Kn,{children:g.jsx(Qn,{className:"text-base",children:"Workflow Settings"})}),g.jsxs(It,{className:"space-y-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx(ae,{htmlFor:"name",children:"Name"}),g.jsx(is,{id:"name",value:s.name,onChange:z=>r({...s,name:z.target.value}),placeholder:"Enter workflow name"})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx(ae,{htmlFor:"description",children:"Description"}),g.jsx(rs,{id:"description",value:s.description,onChange:z=>r({...s,description:z.target.value}),placeholder:"Enter workflow description",className:"min-h-[80px]"})]}),g.jsxs("div",{className:"flex items-center space-x-2",children:[g.jsx(Zi,{id:"enabled",checked:s.is_enabled,onCheckedChange:z=>r({...s,is_enabled:z})}),g.jsx(ae,{htmlFor:"enabled",children:"Enable workflow"})]})]})]}),g.jsxs(jt,{className:"gap-0",children:[g.jsx(Kn,{children:g.jsx(Qn,{className:"text-base",children:"Add Actions"})}),g.jsxs(It,{className:"space-y-2",children:[g.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Drag actions to the canvas to add them to your workflow"}),f.map(z=>g.jsxs(we,{variant:"outline",size:"sm",className:"w-full",onClick:()=>C(z.id),draggable:!0,onDragStart:R=>M(R,z.id),children:[z.icon&&g.jsx("img",{src:z.icon,alt:z.name,className:"w-4 h-4 object-contain",onError:R=>R.currentTarget.style.display="none"}),g.jsx("span",{className:"group-hover:translate-x-0.5 transition-transform",children:z.name})]},z.id))]})]})]}),g.jsx("main",{className:"flex-1",children:g.jsxs(fh,{nodes:w,edges:y,onNodesChange:m,onEdgesChange:p,onConnect:L,nodeTypes:Wh,colorMode:o,fitView:!0,children:[g.jsx(wh,{}),g.jsx(Ch,{}),g.jsx(Fh,{})]})})]}),i===!1&&g.jsx(Yh,{open:v,onOpenChange:_,initialConfig:{trigger:s.trigger,agents:s.agents},agents:l,onSave:k}),i===!1&&g.jsx(Xh,{open:E,onOpenChange:z=>{A(z),z||$(null)},initialAction:T!==null?s.actions[T]:void 0,integrations:f,agents:l,connections:c,onSave:S})]})}export{eg as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.