@nomoreide/cli-darwin-arm64 0.0.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +662 -0
- package/bin/nomoreide +0 -0
- package/package.json +8 -3
- package/share/nomoreide/build-info.txt +3 -0
- package/share/nomoreide/web/client/assets/SymbolsNerdFontMono-Regular-DDncdh2F.ttf +0 -0
- package/share/nomoreide/web/client/assets/code-editor-Cqq76LC_.js +30 -0
- package/share/nomoreide/web/client/assets/context-graph-DUCyWlak.js +7 -0
- package/share/nomoreide/web/client/assets/core-DhEqZVGG.js +1 -0
- package/share/nomoreide/web/client/assets/event-BK_86lmQ.js +1 -0
- package/share/nomoreide/web/client/assets/index-BhDAhmA1.js +1 -0
- package/share/nomoreide/web/client/assets/index-BpCXYcED.js +352 -0
- package/share/nomoreide/web/client/assets/index-CSo__8A6.css +1 -0
- package/share/nomoreide/web/client/assets/nomoreide-favicon-Ds7Tgj9p.svg +24 -0
- package/share/nomoreide/web/client/assets/system-process-table-BWJjrSZy.js +1 -0
- package/share/nomoreide/web/client/assets/window-DlR023_X.js +1 -0
- package/share/nomoreide/web/client/index.html +44 -0
- package/README.md +0 -5
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{g as Na,l as Pr,i as Ca,R as Ma,r as $,j as C,u as ka,f as lt,e as Ia,T as Aa,F as vo,c as $a,b as Pa}from"./index-BpCXYcED.js";const Da=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],za=Na("pin",Da);function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ta={value:()=>{}};function en(){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 Ot(n)}function Ot(e){this._=e}function Ra(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Ot.prototype=en.prototype={constructor:Ot,on:function(e,t){var n=this._,o=Ra(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=Ha(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=bo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=bo(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Ot(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function Ha(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function bo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Ta,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Pn="http://www.w3.org/1999/xhtml";const _o={svg:"http://www.w3.org/2000/svg",xhtml:Pn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function tn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),_o.hasOwnProperty(t)?{space:_o[t],local:e}:e}function La(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Pn&&t.documentElement.namespaceURI===Pn?t.createElement(e):t.createElementNS(n,e)}}function Oa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Dr(e){var t=tn(e);return(t.local?Oa:La)(t)}function Va(){}function Zn(e){return e==null?Va:function(){return this.querySelector(e)}}function Ba(e){typeof e!="function"&&(e=Zn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,d,c=0;c<s;++c)(l=i[c])&&(d=e.call(l,l.__data__,c,i))&&("__data__"in l&&(d.__data__=l.__data__),a[c]=d);return new ue(o,this._parents)}function ja(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Fa(){return[]}function zr(e){return e==null?Fa:function(){return this.querySelectorAll(e)}}function Xa(e){return function(){return ja(e.apply(this,arguments))}}function Ya(e){typeof e=="function"?e=Xa(e):e=zr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,d=0;d<a;++d)(l=s[d])&&(o.push(e.call(l,l.__data__,d,s)),r.push(l));return new ue(o,r)}function Tr(e){return function(){return this.matches(e)}}function Rr(e){return function(t){return t.matches(e)}}var Za=Array.prototype.find;function Wa(e){return function(){return Za.call(this.children,e)}}function qa(){return this.firstElementChild}function Ga(e){return this.select(e==null?qa:Wa(typeof e=="function"?e:Rr(e)))}var Ka=Array.prototype.filter;function Ua(){return Array.from(this.children)}function Qa(e){return function(){return Ka.call(this.children,e)}}function Ja(e){return this.selectAll(e==null?Ua:Qa(typeof e=="function"?e:Rr(e)))}function ec(e){typeof e!="function"&&(e=Tr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,d=0;d<s;++d)(l=i[d])&&e.call(l,l.__data__,d,i)&&a.push(l);return new ue(o,this._parents)}function Hr(e){return new Array(e.length)}function tc(){return new ue(this._enter||this._groups.map(Hr),this._parents)}function Xt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Xt.prototype={constructor:Xt,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 nc(e){return function(){return e}}function oc(e,t,n,o,r,i){for(var s=0,a,l=t.length,d=i.length;s<d;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Xt(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function rc(e,t,n,o,r,i,s){var a,l,d=new Map,c=t.length,u=i.length,f=new Array(c),h;for(a=0;a<c;++a)(l=t[a])&&(f[a]=h=s.call(l,l.__data__,a,t)+"",d.has(h)?r[a]=l:d.set(h,l));for(a=0;a<u;++a)h=s.call(e,i[a],a,i)+"",(l=d.get(h))?(o[a]=l,l.__data__=i[a],d.delete(h)):n[a]=new Xt(e,i[a]);for(a=0;a<c;++a)(l=t[a])&&d.get(f[a])===l&&(r[a]=l)}function ic(e){return e.__data__}function sc(e,t){if(!arguments.length)return Array.from(this,ic);var n=t?rc:oc,o=this._parents,r=this._groups;typeof e!="function"&&(e=nc(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),d=0;d<i;++d){var c=o[d],u=r[d],f=u.length,h=ac(e.call(c,c&&c.__data__,d,o)),g=h.length,w=a[d]=new Array(g),y=s[d]=new Array(g),m=l[d]=new Array(f);n(c,u,w,y,m,h,t);for(var b=0,p=0,v,N;b<g;++b)if(v=w[b]){for(b>=p&&(p=b+1);!(N=y[p])&&++p<g;);v._next=N||null}}return s=new ue(s,o),s._enter=a,s._exit=l,s}function ac(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function cc(){return new ue(this._exit||this._groups.map(Hr),this._parents)}function lc(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function uc(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var d=n[l],c=o[l],u=d.length,f=a[l]=new Array(u),h,g=0;g<u;++g)(h=d[g]||c[g])&&(f[g]=h);for(;l<r;++l)a[l]=n[l];return new ue(a,this._parents)}function dc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function fc(e){e||(e=hc);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),d,c=0;c<a;++c)(d=s[c])&&(l[c]=d);l.sort(t)}return new ue(r,this._parents).order()}function hc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function gc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pc(){return Array.from(this)}function mc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function yc(){let e=0;for(const t of this)++e;return e}function xc(){return!this.node()}function wc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function vc(e){return function(){this.removeAttribute(e)}}function bc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _c(e,t){return function(){this.setAttribute(e,t)}}function Ec(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Sc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Nc(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 Cc(e,t){var n=tn(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?bc:vc:typeof t=="function"?n.local?Nc:Sc:n.local?Ec:_c)(n,t))}function Lr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Mc(e){return function(){this.style.removeProperty(e)}}function kc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ic(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Ac(e,t,n){return arguments.length>1?this.each((t==null?Mc:typeof t=="function"?Ic:kc)(e,t,n??"")):Qe(this.node(),e)}function Qe(e,t){return e.style.getPropertyValue(t)||Lr(e).getComputedStyle(e,null).getPropertyValue(t)}function $c(e){return function(){delete this[e]}}function Pc(e,t){return function(){this[e]=t}}function Dc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function zc(e,t){return arguments.length>1?this.each((t==null?$c:typeof t=="function"?Dc:Pc)(e,t)):this.node()[e]}function Or(e){return e.trim().split(/^|\s+/)}function Wn(e){return e.classList||new Vr(e)}function Vr(e){this._node=e,this._names=Or(e.getAttribute("class")||"")}Vr.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 Br(e,t){for(var n=Wn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function jr(e,t){for(var n=Wn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Tc(e){return function(){Br(this,e)}}function Rc(e){return function(){jr(this,e)}}function Hc(e,t){return function(){(t.apply(this,arguments)?Br:jr)(this,e)}}function Lc(e,t){var n=Or(e+"");if(arguments.length<2){for(var o=Wn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?Hc:t?Tc:Rc)(n,t))}function Oc(){this.textContent=""}function Vc(e){return function(){this.textContent=e}}function Bc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function jc(e){return arguments.length?this.each(e==null?Oc:(typeof e=="function"?Bc:Vc)(e)):this.node().textContent}function Fc(){this.innerHTML=""}function Xc(e){return function(){this.innerHTML=e}}function Yc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Zc(e){return arguments.length?this.each(e==null?Fc:(typeof e=="function"?Yc:Xc)(e)):this.node().innerHTML}function Wc(){this.nextSibling&&this.parentNode.appendChild(this)}function qc(){return this.each(Wc)}function Gc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Kc(){return this.each(Gc)}function Uc(e){var t=typeof e=="function"?e:Dr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Qc(){return null}function Jc(e,t){var n=typeof e=="function"?e:Dr(e),o=t==null?Qc:typeof t=="function"?t:Zn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function el(){var e=this.parentNode;e&&e.removeChild(this)}function tl(){return this.each(el)}function nl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ol(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rl(e){return this.select(e?ol:nl)}function il(e){return arguments.length?this.property("__data__",e):this.node().__data__}function sl(e){return function(t){e.call(this,t,this.__data__)}}function al(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 cl(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function ll(e,t,n){return function(){var o=this.__on,r,i=sl(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function ul(e,t,n){var o=al(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,d=a.length,c;l<d;++l)for(r=0,c=a[l];r<i;++r)if((s=o[r]).type===c.type&&s.name===c.name)return c.value}return}for(a=t?ll:cl,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Fr(e,t,n){var o=Lr(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function dl(e,t){return function(){return Fr(this,e,t)}}function fl(e,t){return function(){return Fr(this,e,t.apply(this,arguments))}}function hl(e,t){return this.each((typeof t=="function"?fl:dl)(e,t))}function*gl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Xr=[null];function ue(e,t){this._groups=e,this._parents=t}function St(){return new ue([[document.documentElement]],Xr)}function pl(){return this}ue.prototype=St.prototype={constructor:ue,select:Ba,selectAll:Ya,selectChild:Ga,selectChildren:Ja,filter:ec,data:sc,enter:tc,exit:cc,join:lc,merge:uc,selection:pl,order:dc,sort:fc,call:gc,nodes:pc,node:mc,size:yc,empty:xc,each:wc,attr:Cc,style:Ac,property:zc,classed:Lc,text:jc,html:Zc,raise:qc,lower:Kc,append:Uc,insert:Jc,remove:tl,clone:rl,datum:il,on:ul,dispatch:hl,[Symbol.iterator]:gl};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Xr)}function ml(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=ml(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const yl={passive:!1},gt={capture:!0,passive:!1};function pn(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function Yr(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Ke,gt);"onselectstart"in t?n.on("selectstart.drag",Ke,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Zr(e,t){var n=e.document.documentElement,o=le(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ke,gt),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 At=e=>()=>e;function Dn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:d,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:c}})}Dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function xl(e){return!e.ctrlKey&&!e.button}function wl(){return this.parentNode}function vl(e,t){return t??{x:e.x,y:e.y}}function bl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wr(){var e=xl,t=wl,n=vl,o=bl,r={},i=en("start","drag","end"),s=0,a,l,d,c,u=0;function f(v){v.on("mousedown.drag",h).filter(o).on("touchstart.drag",y).on("touchmove.drag",m,yl).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(v,N){if(!(c||!e.call(this,v,N))){var _=p(this,t.call(this,v,N),v,N,"mouse");_&&(le(v.view).on("mousemove.drag",g,gt).on("mouseup.drag",w,gt),Yr(v.view),pn(v),d=!1,a=v.clientX,l=v.clientY,_("start",v))}}function g(v){if(Ke(v),!d){var N=v.clientX-a,_=v.clientY-l;d=N*N+_*_>u}r.mouse("drag",v)}function w(v){le(v.view).on("mousemove.drag mouseup.drag",null),Zr(v.view,d),Ke(v),r.mouse("end",v)}function y(v,N){if(e.call(this,v,N)){var _=v.changedTouches,M=t.call(this,v,N),I=_.length,A,B;for(A=0;A<I;++A)(B=p(this,M,v,N,_[A].identifier,_[A]))&&(pn(v),B("start",v,_[A]))}}function m(v){var N=v.changedTouches,_=N.length,M,I;for(M=0;M<_;++M)(I=r[N[M].identifier])&&(Ke(v),I("drag",v,N[M]))}function b(v){var N=v.changedTouches,_=N.length,M,I;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),M=0;M<_;++M)(I=r[N[M].identifier])&&(pn(v),I("end",v,N[M]))}function p(v,N,_,M,I,A){var B=i.copy(),z=fe(A||_,N),L,T,x;if((x=n.call(v,new Dn("beforestart",{sourceEvent:_,target:f,identifier:I,active:s,x:z[0],y:z[1],dx:0,dy:0,dispatch:B}),M))!=null)return L=x.x-z[0]||0,T=x.y-z[1]||0,function E(S,k,D){var P=z,V;switch(S){case"start":r[I]=E,V=s++;break;case"end":delete r[I],--s;case"drag":z=fe(D||k,N),V=s;break}B.call(S,v,new Dn(S,{sourceEvent:k,subject:x,target:f,identifier:I,active:V,x:z[0]+L,y:z[1]+T,dx:z[0]-P[0],dy:z[1]-P[1],dispatch:B}),M)}}return f.filter=function(v){return arguments.length?(e=typeof v=="function"?v:At(!!v),f):e},f.container=function(v){return arguments.length?(t=typeof v=="function"?v:At(v),f):t},f.subject=function(v){return arguments.length?(n=typeof v=="function"?v:At(v),f):n},f.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:At(!!v),f):o},f.on=function(){var v=i.on.apply(i,arguments);return v===i?f:v},f.clickDistance=function(v){return arguments.length?(u=(v=+v)*v,f):Math.sqrt(u)},f}function qn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function qr(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Nt(){}var pt=.7,Yt=1/pt,Ue="\\s*([+-]?\\d+)\\s*",mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_l=/^#([0-9a-f]{3,8})$/,El=new RegExp(`^rgb\\(${Ue},${Ue},${Ue}\\)$`),Sl=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),Nl=new RegExp(`^rgba\\(${Ue},${Ue},${Ue},${mt}\\)$`),Cl=new RegExp(`^rgba\\(${be},${be},${be},${mt}\\)$`),Ml=new RegExp(`^hsl\\(${mt},${be},${be}\\)$`),kl=new RegExp(`^hsla\\(${mt},${be},${be},${mt}\\)$`),Eo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};qn(Nt,je,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:So,formatHex:So,formatHex8:Il,formatHsl:Al,formatRgb:No,toString:No});function So(){return this.rgb().formatHex()}function Il(){return this.rgb().formatHex8()}function Al(){return Gr(this).formatHsl()}function No(){return this.rgb().formatRgb()}function je(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_l.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Co(t):n===3?new ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$t(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$t(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=El.exec(e))?new ce(t[1],t[2],t[3],1):(t=Sl.exec(e))?new ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Nl.exec(e))?$t(t[1],t[2],t[3],t[4]):(t=Cl.exec(e))?$t(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ml.exec(e))?Io(t[1],t[2]/100,t[3]/100,1):(t=kl.exec(e))?Io(t[1],t[2]/100,t[3]/100,t[4]):Eo.hasOwnProperty(e)?Co(Eo[e]):e==="transparent"?new ce(NaN,NaN,NaN,0):null}function Co(e){return new ce(e>>16&255,e>>8&255,e&255,1)}function $t(e,t,n,o){return o<=0&&(e=t=n=NaN),new ce(e,t,n,o)}function $l(e){return e instanceof Nt||(e=je(e)),e?(e=e.rgb(),new ce(e.r,e.g,e.b,e.opacity)):new ce}function zn(e,t,n,o){return arguments.length===1?$l(e):new ce(e,t,n,o??1)}function ce(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}qn(ce,zn,qr(Nt,{brighter(e){return e=e==null?Yt:Math.pow(Yt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pt:Math.pow(pt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ce(Ve(this.r),Ve(this.g),Ve(this.b),Zt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Mo,formatHex:Mo,formatHex8:Pl,formatRgb:ko,toString:ko}));function Mo(){return`#${Oe(this.r)}${Oe(this.g)}${Oe(this.b)}`}function Pl(){return`#${Oe(this.r)}${Oe(this.g)}${Oe(this.b)}${Oe((isNaN(this.opacity)?1:this.opacity)*255)}`}function ko(){const e=Zt(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function Zt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Oe(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function Io(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,o)}function Gr(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof Nt||(e=je(e)),!e)return new he;if(e instanceof he)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new he(s,a,l,e.opacity)}function Dl(e,t,n,o){return arguments.length===1?Gr(e):new he(e,t,n,o??1)}function he(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}qn(he,Dl,qr(Nt,{brighter(e){return e=e==null?Yt:Math.pow(Yt,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pt:Math.pow(pt,e),new he(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new ce(mn(e>=240?e-240:e+120,r,o),mn(e,r,o),mn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new he(Ao(this.h),Pt(this.s),Pt(this.l),Zt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Zt(this.opacity);return`${e===1?"hsl(":"hsla("}${Ao(this.h)}, ${Pt(this.s)*100}%, ${Pt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ao(e){return e=(e||0)%360,e<0?e+360:e}function Pt(e){return Math.max(0,Math.min(1,e||0))}function mn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Gn=e=>()=>e;function zl(e,t){return function(n){return e+n*t}}function Tl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function Rl(e){return(e=+e)==1?Kr:function(t,n){return n-t?Tl(t,n,e):Gn(isNaN(t)?n:t)}}function Kr(e,t){var n=t-e;return n?zl(e,n):Gn(isNaN(e)?t:e)}const Wt=(function e(t){var n=Rl(t);function o(r,i){var s=n((r=zn(r)).r,(i=zn(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),d=Kr(r.opacity,i.opacity);return function(c){return r.r=s(c),r.g=a(c),r.b=l(c),r.opacity=d(c),r+""}}return o.gamma=e,o})(1);function Hl(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function Ll(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ol(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=ft(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function Vl(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function ve(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Bl(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=ft(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var Tn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yn=new RegExp(Tn.source,"g");function jl(e){return function(){return e}}function Fl(e){return function(t){return e(t)+""}}function Ur(e,t){var n=Tn.lastIndex=yn.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Tn.exec(e))&&(r=yn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:ve(o,r)})),n=yn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Fl(l[0].x):jl(t):(t=l.length,function(d){for(var c=0,u;c<t;++c)a[(u=l[c]).i]=u.x(d);return a.join("")})}function ft(e,t){var n=typeof t,o;return t==null||n==="boolean"?Gn(t):(n==="number"?ve:n==="string"?(o=je(t))?(t=o,Wt):Ur:t instanceof je?Wt:t instanceof Date?Vl:Ll(t)?Hl:Array.isArray(t)?Ol:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Bl:ve)(e,t)}var $o=180/Math.PI,Rn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Qr(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*$o,skewX:Math.atan(l)*$o,scaleX:s,scaleY:a}}var Dt;function Xl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rn:Qr(t.a,t.b,t.c,t.d,t.e,t.f)}function Yl(e){return e==null||(Dt||(Dt=document.createElementNS("http://www.w3.org/2000/svg","g")),Dt.setAttribute("transform",e),!(e=Dt.transform.baseVal.consolidate()))?Rn:(e=e.matrix,Qr(e.a,e.b,e.c,e.d,e.e,e.f))}function Jr(e,t,n,o){function r(d){return d.length?d.pop()+" ":""}function i(d,c,u,f,h,g){if(d!==u||c!==f){var w=h.push("translate(",null,t,null,n);g.push({i:w-4,x:ve(d,u)},{i:w-2,x:ve(c,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function s(d,c,u,f){d!==c?(d-c>180?c+=360:c-d>180&&(d+=360),f.push({i:u.push(r(u)+"rotate(",null,o)-2,x:ve(d,c)})):c&&u.push(r(u)+"rotate("+c+o)}function a(d,c,u,f){d!==c?f.push({i:u.push(r(u)+"skewX(",null,o)-2,x:ve(d,c)}):c&&u.push(r(u)+"skewX("+c+o)}function l(d,c,u,f,h,g){if(d!==u||c!==f){var w=h.push(r(h)+"scale(",null,",",null,")");g.push({i:w-4,x:ve(d,u)},{i:w-2,x:ve(c,f)})}else(u!==1||f!==1)&&h.push(r(h)+"scale("+u+","+f+")")}return function(d,c){var u=[],f=[];return d=e(d),c=e(c),i(d.translateX,d.translateY,c.translateX,c.translateY,u,f),s(d.rotate,c.rotate,u,f),a(d.skewX,c.skewX,u,f),l(d.scaleX,d.scaleY,c.scaleX,c.scaleY,u,f),d=c=null,function(h){for(var g=-1,w=f.length,y;++g<w;)u[(y=f[g]).i]=y.x(h);return u.join("")}}}var Zl=Jr(Xl,"px, ","px)","deg)"),Wl=Jr(Yl,", ",")",")"),ql=1e-12;function Po(e){return((e=Math.exp(e))+1/e)/2}function Gl(e){return((e=Math.exp(e))-1/e)/2}function Kl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Vt=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],d=i[2],c=s[0],u=s[1],f=s[2],h=c-a,g=u-l,w=h*h+g*g,y,m;if(w<ql)m=Math.log(f/d)/t,y=function(M){return[a+M*h,l+M*g,d*Math.exp(t*M*m)]};else{var b=Math.sqrt(w),p=(f*f-d*d+o*w)/(2*d*n*b),v=(f*f-d*d-o*w)/(2*f*n*b),N=Math.log(Math.sqrt(p*p+1)-p),_=Math.log(Math.sqrt(v*v+1)-v);m=(_-N)/t,y=function(M){var I=M*m,A=Po(N),B=d/(n*b)*(A*Kl(t*I+N)-Gl(N));return[a+B*h,l+B*g,d*A/Po(t*I+N)]}}return y.duration=m*1e3*t/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Je=0,ut=0,at=0,ei=1e3,qt,dt,Gt=0,Fe=0,nn=0,yt=typeof performance=="object"&&performance.now?performance:Date,ti=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kn(){return Fe||(ti(Ul),Fe=yt.now()+nn)}function Ul(){Fe=0}function Kt(){this._call=this._time=this._next=null}Kt.prototype=ni.prototype={constructor:Kt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Kn():+n)+(t==null?0:+t),!this._next&&dt!==this&&(dt?dt._next=this:qt=this,dt=this),this._call=e,this._time=n,Hn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Hn())}};function ni(e,t,n){var o=new Kt;return o.restart(e,t,n),o}function Ql(){Kn(),++Je;for(var e=qt,t;e;)(t=Fe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Je}function Do(){Fe=(Gt=yt.now())+nn,Je=ut=0;try{Ql()}finally{Je=0,eu(),Fe=0}}function Jl(){var e=yt.now(),t=e-Gt;t>ei&&(nn-=t,Gt=e)}function eu(){for(var e,t=qt,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:qt=n);dt=e,Hn(o)}function Hn(e){if(!Je){ut&&(ut=clearTimeout(ut));var t=e-Fe;t>24?(e<1/0&&(ut=setTimeout(Do,e-yt.now()-nn)),at&&(at=clearInterval(at))):(at||(Gt=yt.now(),at=setInterval(Jl,ei)),Je=1,ti(Do))}}function zo(e,t,n){var o=new Kt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var tu=en("start","end","cancel","interrupt"),nu=[],oi=0,To=1,Ln=2,Bt=3,Ro=4,On=5,jt=6;function on(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;ou(e,n,{name:t,index:o,group:r,on:tu,tween:nu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:oi})}function Un(e,t){var n=ye(e,t);if(n.state>oi)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=ye(e,t);if(n.state>Bt)throw new Error("too late; already running");return n}function ye(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ou(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=ni(i,0,n.time);function i(d){n.state=To,n.timer.restart(s,n.delay,n.time),n.delay<=d&&s(d-n.delay)}function s(d){var c,u,f,h;if(n.state!==To)return l();for(c in o)if(h=o[c],h.name===n.name){if(h.state===Bt)return zo(s);h.state===Ro?(h.state=jt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[c]):+c<t&&(h.state=jt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[c])}if(zo(function(){n.state===Bt&&(n.state=Ro,n.timer.restart(a,n.delay,n.time),a(d))}),n.state=Ln,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ln){for(n.state=Bt,r=new Array(f=n.tween.length),c=0,u=-1;c<f;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=h);r.length=u+1}}function a(d){for(var c=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(l),n.state=On,1),u=-1,f=r.length;++u<f;)r[u].call(e,c);n.state===On&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=jt,n.timer.stop(),delete o[t];for(var d in o)return;delete e.__transition}}function Ft(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Ln&&o.state<On,o.state=jt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function ru(e){return this.each(function(){Ft(this,e)})}function iu(e,t){var n,o;return function(){var r=_e(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function su(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=_e(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,d=r.length;l<d;++l)if(r[l].name===t){r[l]=a;break}l===d&&r.push(a)}i.tween=r}}function au(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ye(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?iu:su)(n,e,t))}function Qn(e,t,n){var o=e._id;return e.each(function(){var r=_e(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ye(r,o).value[t]}}function ri(e,t){var n;return(typeof t=="number"?ve:t instanceof je?Wt:(n=je(t))?(t=n,Wt):Ur)(e,t)}function cu(e){return function(){this.removeAttribute(e)}}function lu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uu(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function du(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function fu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function hu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function gu(e,t){var n=tn(e),o=n==="transform"?Wl:ri;return this.attrTween(e,typeof t=="function"?(n.local?hu:fu)(n,o,Qn(this,"attr."+e,t)):t==null?(n.local?lu:cu)(n):(n.local?du:uu)(n,o,t))}function pu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function mu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function yu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&mu(e,i)),n}return r._value=t,r}function xu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&pu(e,i)),n}return r._value=t,r}function wu(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=tn(e);return this.tween(n,(o.local?yu:xu)(o,t))}function vu(e,t){return function(){Un(this,e).delay=+t.apply(this,arguments)}}function bu(e,t){return t=+t,function(){Un(this,e).delay=t}}function _u(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vu:bu)(t,e)):ye(this.node(),t).delay}function Eu(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function Su(e,t){return t=+t,function(){_e(this,e).duration=t}}function Nu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Eu:Su)(t,e)):ye(this.node(),t).duration}function Cu(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function Mu(e){var t=this._id;return arguments.length?this.each(Cu(t,e)):ye(this.node(),t).ease}function ku(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function Iu(e){if(typeof e!="function")throw new Error;return this.each(ku(this._id,e))}function Au(e){typeof e!="function"&&(e=Tr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,d=0;d<s;++d)(l=i[d])&&e.call(l,l.__data__,d,i)&&a.push(l);return new $e(o,this._parents,this._name,this._id)}function $u(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],d=n[a],c=l.length,u=s[a]=new Array(c),f,h=0;h<c;++h)(f=l[h]||d[h])&&(u[h]=f);for(;a<o;++a)s[a]=t[a];return new $e(s,this._parents,this._name,this._id)}function Pu(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 Du(e,t,n){var o,r,i=Pu(t)?Un:_e;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function zu(e,t){var n=this._id;return arguments.length<2?ye(this.node(),n).on.on(e):this.each(Du(n,e,t))}function Tu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ru(){return this.on("end.remove",Tu(this._id))}function Hu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Zn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,d=i[s]=new Array(l),c,u,f=0;f<l;++f)(c=a[f])&&(u=e.call(c,c.__data__,f,a))&&("__data__"in c&&(u.__data__=c.__data__),d[f]=u,on(d[f],t,n,f,d,ye(c,n)));return new $e(i,this._parents,t,n)}function Lu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],d=l.length,c,u=0;u<d;++u)if(c=l[u]){for(var f=e.call(c,c.__data__,u,l),h,g=ye(c,n),w=0,y=f.length;w<y;++w)(h=f[w])&&on(h,t,n,w,f,g);i.push(f),s.push(c)}return new $e(i,s,t,n)}var Ou=St.prototype.constructor;function Vu(){return new Ou(this._groups,this._parents)}function Bu(e,t){var n,o,r;return function(){var i=Qe(this,e),s=(this.style.removeProperty(e),Qe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function ii(e){return function(){this.style.removeProperty(e)}}function ju(e,t,n){var o,r=n+"",i;return function(){var s=Qe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Fu(e,t,n){var o,r,i;return function(){var s=Qe(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Qe(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function Xu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=_e(this,e),d=l.on,c=l.value[i]==null?a||(a=ii(t)):void 0;(d!==n||r!==c)&&(o=(n=d).copy()).on(s,r=c),l.on=o}}function Yu(e,t,n){var o=(e+="")=="transform"?Zl:ri;return t==null?this.styleTween(e,Bu(e,o)).on("end.style."+e,ii(e)):typeof t=="function"?this.styleTween(e,Fu(e,o,Qn(this,"style."+e,t))).each(Xu(this._id,e)):this.styleTween(e,ju(e,o,t),n).on("end.style."+e,null)}function Zu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Wu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Zu(e,s,n)),o}return i._value=t,i}function qu(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,Wu(e,t,n??""))}function Gu(e){return function(){this.textContent=e}}function Ku(e){return function(){var t=e(this);this.textContent=t??""}}function Uu(e){return this.tween("text",typeof e=="function"?Ku(Qn(this,"text",e)):Gu(e==null?"":e+""))}function Qu(e){return function(t){this.textContent=e.call(this,t)}}function Ju(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Qu(r)),t}return o._value=e,o}function ed(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,Ju(e))}function td(){for(var e=this._name,t=this._id,n=si(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,d=0;d<a;++d)if(l=s[d]){var c=ye(l,t);on(l,e,n,d,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new $e(o,this._parents,e,n)}function nd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var d=_e(this,o),c=d.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),d.on=t}),r===0&&i()})}var od=0;function $e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function si(){return++od}var ke=St.prototype;$e.prototype={constructor:$e,select:Hu,selectAll:Lu,selectChild:ke.selectChild,selectChildren:ke.selectChildren,filter:Au,merge:$u,selection:Vu,transition:td,call:ke.call,nodes:ke.nodes,node:ke.node,size:ke.size,empty:ke.empty,each:ke.each,on:zu,attr:gu,attrTween:wu,style:Yu,styleTween:qu,text:Uu,textTween:ed,remove:Ru,tween:au,delay:_u,duration:Nu,ease:Mu,easeVarying:Iu,end:nd,[Symbol.iterator]:ke[Symbol.iterator]};function rd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var id={time:null,delay:0,duration:250,ease:rd};function sd(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 ad(e){var t,n;e instanceof $e?(t=e._id,e=e._name):(t=si(),(n=id).time=Kn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,d=0;d<a;++d)(l=s[d])&&on(l,e,t,d,s,n||sd(l,t));return new $e(o,this._parents,e,t)}St.prototype.interrupt=ru;St.prototype.transition=ad;const zt=e=>()=>e;function cd(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ie(e,t,n){this.k=e,this.x=t,this.y=n}Ie.prototype={constructor:Ie,scale:function(e){return e===1?this:new Ie(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ie(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 rn=new Ie(1,0,0);ai.prototype=Ie.prototype;function ai(e){for(;!e.__zoom;)if(!(e=e.parentNode))return rn;return e.__zoom}function xn(e){e.stopImmediatePropagation()}function ct(e){e.preventDefault(),e.stopImmediatePropagation()}function ld(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ud(){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 Ho(){return this.__zoom||rn}function dd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fd(){return navigator.maxTouchPoints||"ontouchstart"in this}function hd(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function ci(){var e=ld,t=ud,n=hd,o=dd,r=fd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Vt,d=en("start","zoom","end"),c,u,f,h=500,g=150,w=0,y=10;function m(x){x.property("__zoom",Ho).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",z).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",T).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(x,E,S,k){var D=x.selection?x.selection():x;D.property("__zoom",Ho),x!==D?N(x,E,S,k):D.interrupt().each(function(){_(this,arguments).event(k).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},m.scaleBy=function(x,E,S,k){m.scaleTo(x,function(){var D=this.__zoom.k,P=typeof E=="function"?E.apply(this,arguments):E;return D*P},S,k)},m.scaleTo=function(x,E,S,k){m.transform(x,function(){var D=t.apply(this,arguments),P=this.__zoom,V=S==null?v(D):typeof S=="function"?S.apply(this,arguments):S,O=P.invert(V),H=typeof E=="function"?E.apply(this,arguments):E;return n(p(b(P,H),V,O),D,s)},S,k)},m.translateBy=function(x,E,S,k){m.transform(x,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),s)},null,k)},m.translateTo=function(x,E,S,k,D){m.transform(x,function(){var P=t.apply(this,arguments),V=this.__zoom,O=k==null?v(P):typeof k=="function"?k.apply(this,arguments):k;return n(rn.translate(O[0],O[1]).scale(V.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof S=="function"?-S.apply(this,arguments):-S),P,s)},k,D)};function b(x,E){return E=Math.max(i[0],Math.min(i[1],E)),E===x.k?x:new Ie(E,x.x,x.y)}function p(x,E,S){var k=E[0]-S[0]*x.k,D=E[1]-S[1]*x.k;return k===x.x&&D===x.y?x:new Ie(x.k,k,D)}function v(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}function N(x,E,S,k){x.on("start.zoom",function(){_(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(k).end()}).tween("zoom",function(){var D=this,P=arguments,V=_(D,P).event(k),O=t.apply(D,P),H=S==null?v(O):typeof S=="function"?S.apply(D,P):S,Y=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),F=D.__zoom,W=typeof E=="function"?E.apply(D,P):E,Q=l(F.invert(H).concat(Y/F.k),W.invert(H).concat(Y/W.k));return function(q){if(q===1)q=W;else{var R=Q(q),j=Y/R[2];q=new Ie(j,H[0]-R[0]*j,H[1]-R[1]*j)}V.zoom(null,q)}})}function _(x,E,S){return!S&&x.__zooming||new M(x,E)}function M(x,E){this.that=x,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,E),this.taps=0}M.prototype={event:function(x){return x&&(this.sourceEvent=x),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(x,E){return this.mouse&&x!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&x!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(x){var E=le(this.that).datum();d.call(x,this.that,new cd(x,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:d}),E)}};function I(x,...E){if(!e.apply(this,arguments))return;var S=_(this,E).event(x),k=this.__zoom,D=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),P=fe(x);if(S.wheel)(S.mouse[0][0]!==P[0]||S.mouse[0][1]!==P[1])&&(S.mouse[1]=k.invert(S.mouse[0]=P)),clearTimeout(S.wheel);else{if(k.k===D)return;S.mouse=[P,k.invert(P)],Ft(this),S.start()}ct(x),S.wheel=setTimeout(V,g),S.zoom("mouse",n(p(b(k,D),S.mouse[0],S.mouse[1]),S.extent,s));function V(){S.wheel=null,S.end()}}function A(x,...E){if(f||!e.apply(this,arguments))return;var S=x.currentTarget,k=_(this,E,!0).event(x),D=le(x.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",Y,!0),P=fe(x,S),V=x.clientX,O=x.clientY;Yr(x.view),xn(x),k.mouse=[P,this.__zoom.invert(P)],Ft(this),k.start();function H(F){if(ct(F),!k.moved){var W=F.clientX-V,Q=F.clientY-O;k.moved=W*W+Q*Q>w}k.event(F).zoom("mouse",n(p(k.that.__zoom,k.mouse[0]=fe(F,S),k.mouse[1]),k.extent,s))}function Y(F){D.on("mousemove.zoom mouseup.zoom",null),Zr(F.view,k.moved),ct(F),k.event(F).end()}}function B(x,...E){if(e.apply(this,arguments)){var S=this.__zoom,k=fe(x.changedTouches?x.changedTouches[0]:x,this),D=S.invert(k),P=S.k*(x.shiftKey?.5:2),V=n(p(b(S,P),k,D),t.apply(this,E),s);ct(x),a>0?le(this).transition().duration(a).call(N,V,k,x):le(this).call(m.transform,V,k,x)}}function z(x,...E){if(e.apply(this,arguments)){var S=x.touches,k=S.length,D=_(this,E,x.changedTouches.length===k).event(x),P,V,O,H;for(xn(x),V=0;V<k;++V)O=S[V],H=fe(O,this),H=[H,this.__zoom.invert(H),O.identifier],D.touch0?!D.touch1&&D.touch0[2]!==H[2]&&(D.touch1=H,D.taps=0):(D.touch0=H,P=!0,D.taps=1+!!c);c&&(c=clearTimeout(c)),P&&(D.taps<2&&(u=H[0],c=setTimeout(function(){c=null},h)),Ft(this),D.start())}}function L(x,...E){if(this.__zooming){var S=_(this,E).event(x),k=x.changedTouches,D=k.length,P,V,O,H;for(ct(x),P=0;P<D;++P)V=k[P],O=fe(V,this),S.touch0&&S.touch0[2]===V.identifier?S.touch0[0]=O:S.touch1&&S.touch1[2]===V.identifier&&(S.touch1[0]=O);if(V=S.that.__zoom,S.touch1){var Y=S.touch0[0],F=S.touch0[1],W=S.touch1[0],Q=S.touch1[1],q=(q=W[0]-Y[0])*q+(q=W[1]-Y[1])*q,R=(R=Q[0]-F[0])*R+(R=Q[1]-F[1])*R;V=b(V,Math.sqrt(q/R)),O=[(Y[0]+W[0])/2,(Y[1]+W[1])/2],H=[(F[0]+Q[0])/2,(F[1]+Q[1])/2]}else if(S.touch0)O=S.touch0[0],H=S.touch0[1];else return;S.zoom("touch",n(p(V,O,H),S.extent,s))}}function T(x,...E){if(this.__zooming){var S=_(this,E).event(x),k=x.changedTouches,D=k.length,P,V;for(xn(x),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),P=0;P<D;++P)V=k[P],S.touch0&&S.touch0[2]===V.identifier?delete S.touch0:S.touch1&&S.touch1[2]===V.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&&(V=fe(V,this),Math.hypot(u[0]-V[0],u[1]-V[1])<y)){var O=le(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return m.wheelDelta=function(x){return arguments.length?(o=typeof x=="function"?x:zt(+x),m):o},m.filter=function(x){return arguments.length?(e=typeof x=="function"?x:zt(!!x),m):e},m.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:zt(!!x),m):r},m.extent=function(x){return arguments.length?(t=typeof x=="function"?x:zt([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),m):t},m.scaleExtent=function(x){return arguments.length?(i[0]=+x[0],i[1]=+x[1],m):[i[0],i[1]]},m.translateExtent=function(x){return arguments.length?(s[0][0]=+x[0][0],s[1][0]=+x[1][0],s[0][1]=+x[0][1],s[1][1]=+x[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(x){return arguments.length?(n=x,m):n},m.duration=function(x){return arguments.length?(a=+x,m):a},m.interpolate=function(x){return arguments.length?(l=x,m):l},m.on=function(){var x=d.on.apply(d,arguments);return x===d?m:x},m.clickDistance=function(x){return arguments.length?(w=(x=+x)*x,m):Math.sqrt(w)},m.tapDistance=function(x){return arguments.length?(y=+x,m):y},m}const me={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.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 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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},xt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],li=["Enter"," ","Escape"],ui={"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 et;(function(e){e.Strict="strict",e.Loose="loose"})(et||(et={}));var Be;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Be||(Be={}));var wt;(function(e){e.Partial="partial",e.Full="full"})(wt||(wt={}));const di={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ze;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ze||(ze={}));var vt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(vt||(vt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const Lo={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function fi(e){return e===null?null:e?"valid":"invalid"}const hi=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,gd=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Jn=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ct=(e,t=[0,0])=>{const{width:n,height:o}=Ee(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},pd=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Jn(r)?r:t.nodeLookup.get(r.id));const a=s?Ut(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return sn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return an(n)},Mt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=sn(n,Ut(r)),o=!0)}),o?an(n):{x:0,y:0,width:0,height:0}},eo=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,l=(t.y-o)/r,d=t.width/r,c=t.height/r,u=[];for(const f of e.values()){const{measured:h,selectable:g=!0,hidden:w=!1}=f;if(s&&!g||w)continue;const y=h.width??f.width??f.initialWidth??0,m=h.height??f.height??f.initialHeight??0,{x:b,y:p}=f.internals.positionAbsolute,v=yi(a,l,d,c,b,p,y,m),N=y*m,_=i&&v>0;(!f.internals.handleBounds||_||v>=N||f.dragging)&&u.push(f)}return u},md=(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 yd(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){const{width:s,height:a}=Ee(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function xd({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;const a=yd(e,s),l=Mt(a),d=no(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(d,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function gi({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:d}=a?a.internals.positionAbsolute:{x:0,y:0},c=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",me.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[l,d],[l+h,d+g]])}else a&&Ye(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+d],[s.extent[1][0]+l,s.extent[1][1]+d]]);const f=Ye(u)?Xe(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",me.error015()),{position:{x:f.x-l+(s.measured.width??0)*c[0],y:f.y-d+(s.measured.height??0)*c[1]},positionAbsolute:f}}async function wd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(w=>w.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),c=md(s,l);for(const f of l)a.has(f.id)&&!c.find(g=>g.id===f.id)&&c.push(f);if(!r)return{edges:c,nodes:s};const u=await r({nodes:s,edges:c});return typeof u=="boolean"?u?{edges:c,nodes:s}:{edges:[],nodes:[]}:u}const tt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Xe=(e={x:0,y:0},t,n)=>({x:tt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:tt(e.y,t[0][1],t[1][1]-(n?.height??0))});function pi(e,t,n){const{width:o,height:r}=Ee(n),{x:i,y:s}=n.internals.positionAbsolute;return Xe(e,[[i,s],[i+o,s+r]],t)}const Oo=(e,t,n)=>e<t?tt(Math.abs(e-t),1,t)/t:e>n?-tt(Math.abs(e-n),1,t)/t:0,to=(e,t,n=15,o=40)=>{const r=Oo(e.x,o,t.width-o)*n,i=Oo(e.y,o,t.height-o)*n;return[r,i]},sn=(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)}),Vn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),an=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),bt=(e,t=[0,0])=>{const{x:n,y:o}=Jn(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{const{x:n,y:o}=Jn(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},mi=(e,t)=>an(sn(Vn(e),Vn(t))),yi=(e,t,n,o,r,i,s,a)=>{const l=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),d=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(l*d)},Qt=(e,t)=>yi(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Vo=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),xi=(e,t)=>(n,o)=>{},kt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),It=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?kt(a,s):a},nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function We(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function vd(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=We(e,n),r=We(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=We(e.top??e.y??0,n),r=We(e.bottom??e.y??0,n),i=We(e.left??e.x??0,t),s=We(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function bd(e,t,n,o,r,i){const{x:s,y:a}=nt(e,[t,n,o]),{x:l,y:d}=nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),c=r-l,u=i-d;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(c),bottom:Math.floor(u)}}const no=(e,t,n,o,r,i)=>{const s=vd(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,d=Math.min(a,l),c=tt(d,o,r),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*c,g=n/2-f*c,w=bd(e,h,g,c,t,n),y={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:g-y.top+y.bottom,zoom:c}},_t=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function Ee(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function wi(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function vi(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function Bo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function _d(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Ed(e){return{...ui,...e||{}}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=pe(e),a=It({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:d}=n?kt(a,t):a;return{xSnapped:l,ySnapped:d,...a}}const oo=e=>({width:e.offsetWidth,height:e.offsetHeight}),bi=e=>e?.getRootNode?.()||window?.document,Sd=["INPUT","SELECT","TEXTAREA"];function _i(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Sd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ei=e=>"clientX"in e,pe=(e,t)=>{const n=Ei(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},jo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...oo(s)}})};function Si({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,d=t*.125+i*.375+a*.375+o*.125,c=Math.abs(l-e),u=Math.abs(d-t);return[l,d,c,u]}function Tt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Fo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-Tt(t-o,i),n];case X.Right:return[t+Tt(o-t,i),n];case X.Top:return[t,n-Tt(n-r,i)];case X.Bottom:return[t,n+Tt(r-n,i)]}}function Ni({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,l]=Fo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[d,c]=Fo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,f,h,g]=Si({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:d,targetControlY:c});return[`M${e},${t} C${a},${l} ${d},${c} ${o},${r}`,u,f,h,g]}function Ci({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function Nd({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function Cd({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=sn(Ut(e),Ut(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Qt(s,an(i))>0}const Md=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,kd=(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)),Id=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",me.error006()),t;const o=n.getEdgeId||Md;let r;return hi(e)?r={...e}:r={...e,id:o(e)},kd(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Mi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=Ci({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Xo={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Ad=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.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},Yo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function $d({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=Xo[t],l=Xo[o],d={x:e.x+a.x*i,y:e.y+a.y*i},c={x:n.x+l.x*i,y:n.y+l.y*i},u=Ad({source:d,sourcePosition:t,target:c}),f=u.x!==0?"x":"y",h=u[f];let g=[],w,y;const m={x:0,y:0},b={x:0,y:0},[,,p,v]=Ci({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(w=r.x??d.x+(c.x-d.x)*s,y=r.y??(d.y+c.y)/2):(w=r.x??(d.x+c.x)/2,y=r.y??d.y+(c.y-d.y)*s);const I=[{x:w,y:d.y},{x:w,y:c.y}],A=[{x:d.x,y},{x:c.x,y}];a[f]===h?g=f==="x"?I:A:g=f==="x"?A:I}else{const I=[{x:d.x,y:c.y}],A=[{x:c.x,y:d.y}];if(f==="x"?g=a.x===h?A:I:g=a.y===h?I:A,t===o){const x=Math.abs(e[f]-n[f]);if(x<=i){const E=Math.min(i-1,i-x);a[f]===h?m[f]=(d[f]>e[f]?-1:1)*E:b[f]=(c[f]>n[f]?-1:1)*E}}if(t!==o){const x=f==="x"?"y":"x",E=a[f]===l[x],S=d[x]>c[x],k=d[x]<c[x];(a[f]===1&&(!E&&S||E&&k)||a[f]!==1&&(!E&&k||E&&S))&&(g=f==="x"?I:A)}const B={x:d.x+m.x,y:d.y+m.y},z={x:c.x+b.x,y:c.y+b.y},L=Math.max(Math.abs(B.x-g[0].x),Math.abs(z.x-g[0].x)),T=Math.max(Math.abs(B.y-g[0].y),Math.abs(z.y-g[0].y));L>=T?(w=(B.x+z.x)/2,y=g[0].y):(w=g[0].x,y=(B.y+z.y)/2)}const N={x:d.x+m.x,y:d.y+m.y},_={x:c.x+b.x,y:c.y+b.y};return[[e,...N.x!==g[0].x||N.y!==g[0].y?[N]:[],...g,..._.x!==g[g.length-1].x||_.y!==g[g.length-1].y?[_]:[],n],w,y,p,v]}function Pd(e,t,n,o){const r=Math.min(Yo(e,t)/2,Yo(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const d=e.x<n.x?-1:1,c=e.y<n.y?1:-1;return`L ${i+r*d},${s}Q ${i},${s} ${i},${s+r*c}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function Bn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:l,offset:d=20,stepPosition:c=.5}){const[u,f,h,g,w]=$d({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:d,stepPosition:c});let y=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)y+=Pd(u[m-1],u[m],u[m+1],s);return y+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[y,f,h,g,w]}function Zo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Dd(e){const{sourceNode:t,targetNode:n}=e;if(!Zo(t)||!Zo(n))return null;const o=t.internals.handleBounds||Wo(t.handles),r=n.internals.handleBounds||Wo(n.handles),i=qo(o?.source??[],e.sourceHandle),s=qo(e.connectionMode===et.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",me.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||X.Bottom,l=s?.position||X.Top,d=Ze(t,i,a),c=Ze(n,s,l);return{sourceX:d.x,sourceY:d.y,targetX:c.x,targetY:c.y,sourcePosition:a,targetPosition:l}}function Wo(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 Ze(e,t,n=X.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ee(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function qo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function jn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function zd(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const d=jn(l,t);i.has(d)||(s.push({id:d,color:l.color||n,...l}),i.add(d))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const ki=1e3,Td=10,ro={nodeOrigin:[0,0],nodeExtent:xt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Rd={...ro,checkEquality:!0};function io(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Hd(e,t,n){const o=io(ro,n);for(const r of e.values())if(r.parentId)ao(r,e,t,o);else{const i=Ct(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,a=Xe(i,s,Ee(r));r.internals.positionAbsolute=a}}function Ld(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function so(e){return e==="manual"}function Fn(e,t,n,o={}){const r=io(Rd,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!so(r.zIndexMode)?ki:0;let l=e.length>0,d=!1;t.clear(),n.clear();for(const c of e){let u=s.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const f=Ct(c,r.nodeOrigin),h=Ye(c.extent)?c.extent:r.nodeExtent,g=Xe(f,h,Ee(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:Ld(c,u),z:Ii(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&ao(u,t,n,o,i),d||=c.selected??!1}return{nodesInitialized:l,hasSelectedNodes:d}}function Od(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 ao(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=io(ro,o),d=e.parentId,c=t.get(d);if(!c){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Od(e,n),r&&!c.parentId&&c.internals.rootParentIndex===void 0&&l==="auto"&&(c.internals.rootParentIndex=++r.i,c.internals.z=c.internals.z+r.i*Td),r&&c.internals.rootParentIndex!==void 0&&(r.i=c.internals.rootParentIndex);const u=i&&!so(l)?ki:0,{x:f,y:h,z:g}=Vd(e,c,s,a,u,l),{positionAbsolute:w}=e.internals,y=f!==w.x||h!==w.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:f,y:h}:w,z:g}})}function Ii(e,t,n){const o=ge(e.zIndex)?e.zIndex:0;return so(n)?o:o+(e.selected?t:0)}function Vd(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Ee(e),d=Ct(e,n),c=Ye(e.extent)?Xe(d,e.extent,l):d;let u=Xe({x:s+c.x,y:a+c.y},o,l);e.extent==="parent"&&(u=pi(u,l,t));const f=Ii(e,r,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}function co(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??bt(a),d=mi(l,s.rect);i.set(s.parentId,{expandedRect:d,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const d=a.internals.positionAbsolute,c=Ee(a),u=a.origin??o,f=s.x<d.x?Math.round(Math.abs(d.x-s.x)):0,h=s.y<d.y?Math.round(Math.abs(d.y-s.y)):0,g=Math.max(c.width,Math.round(s.width)),w=Math.max(c.height,Math.round(s.height)),y=(g-c.width)*u[0],m=(w-c.height)*u[1];(f>0||h>0||y||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+y,y:a.position.y-h+m}}),n.get(l)?.forEach(b=>{e.some(p=>p.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+f,y:b.position.y+h}})})),(c.width<s.width||c.height<s.height||f||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?u[0]*f-y:0),height:w+(h?u[1]*h-m:0)}})}),r}function Bd(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const d=[],c=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(c.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const w=oo(h.nodeElement),y=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(y||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Ye(g.extent)?g.extent:i;let{positionAbsolute:v}=g.internals;if(g.parentId&&g.extent==="parent"){const _=t.get(g.parentId);_&&(v=pi(v,w,_))}else p&&(v=Xe(v,p,w));const N={...g,measured:w,internals:{...g.internals,positionAbsolute:v,handleBounds:{source:jo("source",h.nodeElement,b,u,g.id),target:jo("target",h.nodeElement,b,u,g.id)}}};t.set(g.id,N),g.parentId&&ao(N,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,y&&(d.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:bt(N,r)}))}}if(f.length>0){const h=co(f,t,n,r);d.push(...h)}return{changes:d,updatedInternals:l}}async function jd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Go(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const d=o.get(s)||new Map;o.set(s,d.set(n,t))}}function Ai(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},d=`${r}-${s}--${i}-${a}`,c=`${i}-${a}--${r}-${s}`;Go("source",l,c,e,r,s),Go("target",l,d,e,i,a),t.set(o.id,o)}}function $i(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:$i(n,t):!1}function Ko(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Fd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!$i(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function wn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Xd({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=kt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Yd({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,d={x:0,y:0},c=null,u=!1,f=null,h=!1,g=!1,w=null;function y({noDragClassName:b,handleSelector:p,domNode:v,isSelectable:N,nodeId:_,nodeClickDistance:M=0}){f=le(v);function I({x:L,y:T}){const{nodeLookup:x,nodeExtent:E,snapGrid:S,snapToGrid:k,nodeOrigin:D,onNodeDrag:P,onSelectionDrag:V,onError:O,updateNodePositions:H}=t();i={x:L,y:T};let Y=!1;const F=a.size>1,W=F&&E?Vn(Mt(a)):null,Q=F&&k?Xd({dragItems:a,snapGrid:S,x:L,y:T}):null;for(const[q,R]of a){if(!x.has(q))continue;let j={x:L-R.distance.x,y:T-R.distance.y};k&&(j=Q?{x:Math.round(j.x+Q.x),y:Math.round(j.y+Q.y)}:kt(j,S));let U=null;if(F&&E&&!R.extent&&W){const{positionAbsolute:G}=R.internals,J=G.x-W.x+E[0][0],te=G.x+R.measured.width-W.x2+E[1][0],oe=G.y-W.y+E[0][1],ae=G.y+R.measured.height-W.y2+E[1][1];U=[[J,oe],[te,ae]]}const{position:K,positionAbsolute:Z}=gi({nodeId:q,nextPosition:j,nodeLookup:x,nodeExtent:U||E,nodeOrigin:D,onError:O});Y=Y||R.position.x!==K.x||R.position.y!==K.y,R.position=K,R.internals.positionAbsolute=Z}if(g=g||Y,!!Y&&(H(a,!0),w&&(o||P||!_&&V))){const[q,R]=wn({nodeId:_,dragItems:a,nodeLookup:x});o?.(w,a,q,R),P?.(w,q,R),_||V?.(w,R)}}async function A(){if(!c)return;const{transform:L,panBy:T,autoPanSpeed:x,autoPanOnNodeDrag:E}=t();if(!E){l=!1,cancelAnimationFrame(s);return}const[S,k]=to(d,c,x);(S!==0||k!==0)&&(i.x=(i.x??0)-S/L[2],i.y=(i.y??0)-k/L[2],await T({x:S,y:k})&&I(i)),s=requestAnimationFrame(A)}function B(L){const{nodeLookup:T,multiSelectionActive:x,nodesDraggable:E,transform:S,snapGrid:k,snapToGrid:D,selectNodesOnDrag:P,onNodeDragStart:V,onSelectionDragStart:O,unselectNodesAndEdges:H}=t();u=!0,(!P||!N)&&!x&&_&&(T.get(_)?.selected||H()),N&&P&&_&&e?.(_);const Y=ht(L.sourceEvent,{transform:S,snapGrid:k,snapToGrid:D,containerBounds:c});if(i=Y,a=Fd(T,E,Y,_),a.size>0&&(n||V||!_&&O)){const[F,W]=wn({nodeId:_,dragItems:a,nodeLookup:T});n?.(L.sourceEvent,a,F,W),V?.(L.sourceEvent,F,W),_||O?.(L.sourceEvent,W)}}const z=Wr().clickDistance(M).on("start",L=>{const{domNode:T,nodeDragThreshold:x,transform:E,snapGrid:S,snapToGrid:k}=t();c=T?.getBoundingClientRect()||null,h=!1,g=!1,w=L.sourceEvent,x===0&&B(L),i=ht(L.sourceEvent,{transform:E,snapGrid:S,snapToGrid:k,containerBounds:c}),d=pe(L.sourceEvent,c)}).on("drag",L=>{const{autoPanOnNodeDrag:T,transform:x,snapGrid:E,snapToGrid:S,nodeDragThreshold:k,nodeLookup:D}=t(),P=ht(L.sourceEvent,{transform:x,snapGrid:E,snapToGrid:S,containerBounds:c});if(w=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||_&&!D.has(_))&&(h=!0),!h){if(!l&&T&&u&&(l=!0,A()),!u){const V=pe(L.sourceEvent,c),O=V.x-d.x,H=V.y-d.y;Math.sqrt(O*O+H*H)>k&&B(L)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&a&&u&&(d=pe(L.sourceEvent,c),I(P))}}).on("end",L=>{if(!u||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(l=!1,u=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:T,updateNodePositions:x,onNodeDragStop:E,onSelectionDragStop:S}=t();if(g&&(x(a,!1),g=!1),r||E||!_&&S){const[k,D]=wn({nodeId:_,dragItems:a,nodeLookup:T,dragging:!1});r?.(L.sourceEvent,a,k,D),E?.(L.sourceEvent,k,D),_||S?.(L.sourceEvent,D)}}}).filter(L=>{const T=L.target;return!L.button&&(!b||!Ko(T,`.${b}`,v))&&(!p||Ko(T,p,v))});f.call(z)}function m(){f?.on(".drag",null)}return{update:y,destroy:m}}function Zd(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Qt(r,bt(i))>0&&o.push(i);return o}const Wd=250;function qd(e,t,n,o){let r=[],i=1/0;const s=Zd(e,n,t+Wd);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const d of l){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:c,y:u}=Ze(a,d,d.position,!0),f=Math.sqrt(Math.pow(c-e.x,2)+Math.pow(u-e.y,2));f>t||(f<i?(r=[{...d,x:c,y:u}],i=f):f===i&&r.push({...d,x:c,y:u}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function Pi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(d=>d.id===n):a?.[0])??null;return l&&i?{...l,...Ze(s,l,l.position,!0)}:l}function Di(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Gd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const zi=()=>!0;function Kd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:d,autoPanOnConnect:c,flowId:u,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:w,onConnectEnd:y,isValidConnection:m=zi,onReconnectEnd:b,updateConnection:p,getTransform:v,getFromHandle:N,autoPanSpeed:_,dragThreshold:M=1,handleDomNode:I}){const A=bi(e.target);let B=0,z;const{x:L,y:T}=pe(e),x=Di(i,I),E=a?.getBoundingClientRect();let S=!1;if(!E||!x)return;const k=Pi(r,x,o,l,t);if(!k)return;let D=pe(e,E),P=!1,V=null,O=!1,H=null;function Y(){if(!c||!E)return;const[K,Z]=to(D,E,_);f({x:K,y:Z}),B=requestAnimationFrame(Y)}const F={...k,nodeId:r,type:x,position:k.position},W=l.get(r);let q={inProgress:!0,isValid:null,from:Ze(W,F,X.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:W,to:D,toHandle:null,toPosition:Lo[F.position],toNode:null,pointer:D};function R(){S=!0,p(q),g?.(e,{nodeId:r,handleId:o,handleType:x})}M===0&&R();function j(K){if(!S){const{x:ae,y:Se}=pe(K),xe=ae-L,we=Se-T;if(!(xe*xe+we*we>M*M))return;R()}if(!N()||!F){U(K);return}const Z=v();D=pe(K,E),z=qd(It(D,Z,!1,[1,1]),n,l,F),P||(Y(),P=!0);const G=Ti(K,{handle:z,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:A,lib:d,flowId:u,nodeLookup:l});H=G.handleDomNode,V=G.connection,O=Gd(!!z,G.isValid);const J=l.get(r),te=J?Ze(J,F,X.Left,!0):q.from,oe={...q,from:te,isValid:O,to:G.toHandle&&O?nt({x:G.toHandle.x,y:G.toHandle.y},Z):D,toHandle:G.toHandle,toPosition:O&&G.toHandle?G.toHandle.position:Lo[F.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:D};p(oe),q=oe}function U(K){if(!("touches"in K&&K.touches.length>0)){if(S){(z||H)&&V&&O&&w?.(V);const{inProgress:Z,...G}=q,J={...G,toPosition:q.toHandle?q.toPosition:null};y?.(K,J),i&&b?.(K,J)}h(),cancelAnimationFrame(B),P=!1,O=!1,V=null,H=null,A.removeEventListener("mousemove",j),A.removeEventListener("mouseup",U),A.removeEventListener("touchmove",j),A.removeEventListener("touchend",U)}}A.addEventListener("mousemove",j),A.addEventListener("mouseup",U),A.addEventListener("touchmove",j),A.addEventListener("touchend",U)}function Ti(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:d=zi,nodeLookup:c}){const u=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=pe(e),w=s.elementFromPoint(h,g),y=w?.classList.contains(`${a}-flow__handle`)?w:f,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const b=Di(void 0,y),p=y.getAttribute("data-nodeid"),v=y.getAttribute("data-handleid"),N=y.classList.contains("connectable"),_=y.classList.contains("connectableend");if(!p||!b)return m;const M={source:u?p:o,sourceHandle:u?v:r,target:u?o:p,targetHandle:u?r:v};m.connection=M;const A=N&&_&&(n===et.Strict?u&&b==="source"||!u&&b==="target":p!==o||v!==r);m.isValid=A&&d(M),m.toHandle=Pi(p,b,v,c,n,!0)}return m}const Xn={onPointerDown:Kd,isValid:Ti};function Ud({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:a,width:l,height:d,zoomStep:c=1,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const v=n(),N=p.sourceEvent.ctrlKey&&_t()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*c,M=v[2]*Math.pow(2,_*N);t.scaleTo(M)};let w=[0,0];const y=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(w=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const v=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[N[0]-w[0],N[1]-w[1]];w=N;const M=o()*Math.max(v[2],Math.log(v[2]))*(h?-1:1),I={x:v[0]-_[0]*M,y:v[1]-_[1]*M},A=[[0,0],[l,d]];t.setViewportConstrained({x:I.x,y:I.y,zoom:v[2]},A,a)},b=ci().on("start",y).on("zoom",u?m:null).on("zoom.wheel",f?g:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const cn=e=>({x:e.x,y:e.y,zoom:e.k}),vn=({x:e,y:t,zoom:n})=>rn.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),Ri=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Qd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,bn=(e,t=0,n=Qd,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Hi=e=>{const t=e.ctrlKey&&_t()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Jd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:d}){return c=>{if(qe(c,t))return c.ctrlKey&&c.preventDefault(),!1;c.preventDefault(),c.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(c.ctrlKey&&s){const y=fe(c),m=Hi(c),b=u*Math.pow(2,m);o.scaleTo(n,b,y,c);return}const f=c.deltaMode===1?20:1;let h=r===Be.Vertical?0:c.deltaX*f,g=r===Be.Horizontal?0:c.deltaY*f;!_t()&&c.shiftKey&&r!==Be.Vertical&&(h=c.deltaY*f,g=0),o.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const w=cn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(c,w):(e.isPanScrolling=!0,a?.(c,w)),e.panScrollTimeout=setTimeout(()=>{d?.(c,w),e.isPanScrolling=!1},150)}}function ef({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=qe(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function tf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=cn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function nf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Ri(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,cn(i.transform))}}function of({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Ri(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=cn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function rf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:d,connectionInProgress:c}){return u=>{const f=e||t,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(qe(u,`${d}-flow__node`)||qe(u,`${d}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||c&&!g||qe(u,a)&&g||qe(u,l)&&(!g||r&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!f&&!r&&!h&&g||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&w}}function sf({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},c=e.getBoundingClientRect();let u=[[0,0],[c.width,c.height]];(typeof ResizeObserver<"u"?new ResizeObserver(T=>{const x=T[0];x&&(u=[[0,0],[x.contentRect.width,x.contentRect.height]])}):null)?.observe(e);const h=ci().extent(()=>u).scaleExtent([t,n]).translateExtent(o),g=le(e).call(h);v({x:r.x,y:r.y,zoom:tt(r.zoom,t,n)},[[0,0],[c.width,c.height]],o);const w=g.on("wheel.zoom"),y=g.on("dblclick.zoom");h.wheelDelta(Hi);async function m(T,x){return g?new Promise(E=>{h?.interpolate(x?.interpolate==="linear"?ft:Vt).transform(bn(g,x?.duration,x?.ease,()=>E(!0)),T)}):!1}function b({noWheelClassName:T,noPanClassName:x,onPaneContextMenu:E,userSelectionActive:S,panOnScroll:k,panOnDrag:D,panOnScrollMode:P,panOnScrollSpeed:V,preventScrolling:O,zoomOnPinch:H,zoomOnScroll:Y,zoomOnDoubleClick:F,zoomActivationKeyPressed:W,lib:Q,onTransformChange:q,connectionInProgress:R,paneClickDistance:j,selectionOnDrag:U}){S&&!d.isZoomingOrPanning&&p();const K=k&&!W&&!S;h.clickDistance(U?1/0:!ge(j)||j<0?0:j);const Z=K?Jd({zoomPanValues:d,noWheelClassName:T,d3Selection:g,d3Zoom:h,panOnScrollMode:P,panOnScrollSpeed:V,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):ef({noWheelClassName:T,preventScrolling:O,d3ZoomHandler:w});g.on("wheel.zoom",Z,{passive:!1});const G=tf({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:s});h.on("start",G);const J=nf({zoomPanValues:d,panOnDrag:D,onPaneContextMenu:!!E,onPanZoom:i,onTransformChange:q});h.on("zoom",J);const te=of({zoomPanValues:d,panOnDrag:D,panOnScroll:k,onPaneContextMenu:E,onPanZoomEnd:a,onDraggingChange:l});h.on("end",te);const oe=rf({zoomActivationKeyPressed:W,panOnDrag:D,zoomOnScroll:Y,panOnScroll:k,zoomOnDoubleClick:F,zoomOnPinch:H,userSelectionActive:S,noPanClassName:x,noWheelClassName:T,lib:Q,connectionInProgress:R});h.filter(oe),F?g.on("dblclick.zoom",y):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function v(T,x,E){const S=vn(T),k=h?.constrain()(S,x,E);return k&&await m(k),k}async function N(T,x){const E=vn(T);return await m(E,x),E}function _(T){if(g){const x=vn(T),E=g.property("__zoom");(E.k!==T.zoom||E.x!==T.x||E.y!==T.y)&&h?.transform(g,x,null,{sync:!0})}}function M(){const T=g?ai(g.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}async function I(T,x){return g?new Promise(E=>{h?.interpolate(x?.interpolate==="linear"?ft:Vt).scaleTo(bn(g,x?.duration,x?.ease,()=>E(!0)),T)}):!1}async function A(T,x){return g?new Promise(E=>{h?.interpolate(x?.interpolate==="linear"?ft:Vt).scaleBy(bn(g,x?.duration,x?.ease,()=>E(!0)),T)}):!1}function B(T){h?.scaleExtent(T)}function z(T){h?.translateExtent(T)}function L(T){const x=!ge(T)||T<0?0:T;h?.clickDistance(x)}return{update:b,destroy:p,setViewport:N,setViewportConstrained:v,getViewport:M,scaleTo:I,scaleBy:A,setScaleExtent:B,setTranslateExtent:z,syncViewport:_,setClickDistance:L}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function af({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Uo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Pe(e,t){return Math.max(0,t-e)}function De(e,t){return Math.max(0,e-t)}function Rt(e,t,n){return Math.max(0,t-e,e-n)}function Qo(e,t){return e?!t:t}function cf(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:d}=t;const{isHorizontal:c,isVertical:u}=t,f=c&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:w,maxWidth:y,minHeight:m,maxHeight:b}=o,{x:p,y:v,width:N,height:_,aspectRatio:M}=e;let I=Math.floor(c?h-e.pointerX:0),A=Math.floor(u?g-e.pointerY:0);const B=N+(l?-I:I),z=_+(d?-A:A),L=-i[0]*N,T=-i[1]*_;let x=Rt(B,w,y),E=Rt(z,m,b);if(s){let D=0,P=0;l&&I<0?D=Pe(p+I+L,s[0][0]):!l&&I>0&&(D=De(p+B+L,s[1][0])),d&&A<0?P=Pe(v+A+T,s[0][1]):!d&&A>0&&(P=De(v+z+T,s[1][1])),x=Math.max(x,D),E=Math.max(E,P)}if(a){let D=0,P=0;l&&I>0?D=De(p+I,a[0][0]):!l&&I<0&&(D=Pe(p+B,a[1][0])),d&&A>0?P=De(v+A,a[0][1]):!d&&A<0&&(P=Pe(v+z,a[1][1])),x=Math.max(x,D),E=Math.max(E,P)}if(r){if(c){const D=Rt(B/M,m,b)*M;if(x=Math.max(x,D),s){let P=0;!l&&!d||l&&!d&&f?P=De(v+T+B/M,s[1][1])*M:P=Pe(v+T+(l?I:-I)/M,s[0][1])*M,x=Math.max(x,P)}if(a){let P=0;!l&&!d||l&&!d&&f?P=Pe(v+B/M,a[1][1])*M:P=De(v+(l?I:-I)/M,a[0][1])*M,x=Math.max(x,P)}}if(u){const D=Rt(z*M,w,y)/M;if(E=Math.max(E,D),s){let P=0;!l&&!d||d&&!l&&f?P=De(p+z*M+L,s[1][0])/M:P=Pe(p+(d?A:-A)*M+L,s[0][0])/M,E=Math.max(E,P)}if(a){let P=0;!l&&!d||d&&!l&&f?P=Pe(p+z*M,a[1][0])/M:P=De(p+(d?A:-A)*M,a[0][0])/M,E=Math.max(E,P)}}}A=A+(A<0?E:-E),I=I+(I<0?x:-x),r&&(f?B>z*M?A=(Qo(l,d)?-I:I)/M:I=(Qo(l,d)?-A:A)*M:c?(A=I/M,d=l):(I=A*M,l=d));const S=l?p+I:p,k=d?v+A:v;return{width:N+(l?-I:I),height:_+(d?-A:A),x:i[0]*I*(l?-1:1)+S,y:i[1]*A*(d?-1:1)+k}}const Li={width:0,height:0,x:0,y:0},lf={...Li,pointerX:0,pointerY:0,aspectRatio:1};function uf(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function df({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:Uo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:d,boundaries:c,keepAspectRatio:u,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:w,shouldResize:y}){let m={...Li},b={...lf};s={boundaries:c,resizeDirection:f,keepAspectRatio:u,controlDirection:Uo(d)};let p,v=null,N=[],_,M,I,A=!1;const B=Wr().on("start",z=>{const{nodeLookup:L,transform:T,snapGrid:x,snapToGrid:E,nodeOrigin:S,paneDomNode:k}=n();if(p=L.get(t),!p)return;v=k?.getBoundingClientRect()??null;const{xSnapped:D,ySnapped:P}=ht(z.sourceEvent,{transform:T,snapGrid:x,snapToGrid:E,containerBounds:v});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...m,pointerX:D,pointerY:P,aspectRatio:m.width/m.height},_=void 0,M=Ye(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=L.get(p.parentId)),_&&p.extent==="parent"&&(M=[[0,0],[_.measured.width,_.measured.height]]),N=[],I=void 0;for(const[V,O]of L)if(O.parentId===t&&(N.push({id:V,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const H=uf(O,p,O.origin??S);I?I=[[Math.min(H[0][0],I[0][0]),Math.min(H[0][1],I[0][1])],[Math.max(H[1][0],I[1][0]),Math.max(H[1][1],I[1][1])]]:I=H}h?.(z,{...m})}).on("drag",z=>{const{transform:L,snapGrid:T,snapToGrid:x,nodeOrigin:E}=n(),S=ht(z.sourceEvent,{transform:L,snapGrid:T,snapToGrid:x,containerBounds:v}),k=[];if(!p)return;const{x:D,y:P,width:V,height:O}=m,H={},Y=p.origin??E,{width:F,height:W,x:Q,y:q}=cf(b,s.controlDirection,S,s.boundaries,s.keepAspectRatio,Y,M,I),R=F!==V,j=W!==O,U=Q!==D&&R,K=q!==P&&j;if(!U&&!K&&!R&&!j)return;if((U||K||Y[0]===1||Y[1]===1)&&(H.x=U?Q:m.x,H.y=K?q:m.y,m.x=H.x,m.y=H.y,N.length>0)){const te=Q-D,oe=q-P;for(const ae of N)ae.position={x:ae.position.x-te+Y[0]*(F-V),y:ae.position.y-oe+Y[1]*(W-O)},k.push(ae)}if((R||j)&&(H.width=R&&(!s.resizeDirection||s.resizeDirection==="horizontal")?F:m.width,H.height=j&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=H.width,m.height=H.height),_&&p.expandParent){const te=Y[0]*(H.width??0);H.x&&H.x<te&&(m.x=te,b.x=b.x-(H.x-te));const oe=Y[1]*(H.height??0);H.y&&H.y<oe&&(m.y=oe,b.y=b.y-(H.y-oe))}const Z=af({width:m.width,prevWidth:V,height:m.height,prevHeight:O,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:Z};y?.(z,G)!==!1&&(A=!0,g?.(z,G),o(H,k))}).on("end",z=>{A&&(w?.(z,{...m}),r?.({...m}),A=!1)});i.call(B)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var _n={exports:{}},En={},Sn={exports:{}},Nn={};var Jo;function ff(){if(Jo)return Nn;Jo=1;var e=Pr();function t(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(u,f){var h=f(),g=o({inst:{value:h,getSnapshot:f}}),w=g[0].inst,y=g[1];return i(function(){w.value=h,w.getSnapshot=f,l(w)&&y({inst:w})},[u,h,f]),r(function(){return l(w)&&y({inst:w}),u(function(){l(w)&&y({inst:w})})},[u]),s(h),h}function l(u){var f=u.getSnapshot;u=u.value;try{var h=f();return!n(u,h)}catch{return!0}}function d(u,f){return f()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Nn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:c,Nn}var er;function hf(){return er||(er=1,Sn.exports=ff()),Sn.exports}var tr;function gf(){if(tr)return En;tr=1;var e=Pr(),t=hf();function n(d,c){return d===c&&(d!==0||1/d===1/c)||d!==d&&c!==c}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return En.useSyncExternalStoreWithSelector=function(d,c,u,f,h){var g=i(null);if(g.current===null){var w={hasValue:!1,value:null};g.current=w}else w=g.current;g=a(function(){function m(_){if(!b){if(b=!0,p=_,_=f(_),h!==void 0&&w.hasValue){var M=w.value;if(h(M,_))return v=M}return v=_}if(M=v,o(p,_))return M;var I=f(_);return h!==void 0&&h(M,I)?(p=_,M):(p=_,v=I)}var b=!1,p,v,N=u===void 0?null:u;return[function(){return m(c())},N===null?void 0:function(){return m(N())}]},[c,u,f,h]);var y=r(d,g[0],g[1]);return s(function(){w.hasValue=!0,w.value=y},[y]),l(y),y},En}var nr;function pf(){return nr||(nr=1,_n.exports=gf()),_n.exports}var mf=pf();const yf=Ca(mf),xf={},or=e=>{let t;const n=new Set,o=(c,u)=>{const f=typeof c=="function"?c(t):c;if(!Object.is(f,t)){const h=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>d,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(xf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(o,r,l);return l},wf=e=>e?or(e):or,{useDebugValue:vf}=Ma,{useSyncExternalStoreWithSelector:bf}=yf,_f=e=>e;function Oi(e,t=_f,n){const o=bf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return vf(o),o}const rr=(e,t)=>{const n=wf(e),o=(r,i=t)=>Oi(n,r,i);return Object.assign(o,n),o},Ef=(e,t)=>e?rr(e,t):rr;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const ln=$.createContext(null),Sf=ln.Provider,Vi=me.error001("react");function ee(e,t){const n=$.useContext(ln);if(n===null)throw new Error(Vi);return Oi(n,e,t)}function ne(){const e=$.useContext(ln);if(e===null)throw new Error(Vi);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ir={display:"none"},Nf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Bi="react-flow__node-desc",ji="react-flow__edge-desc",Cf="react-flow__aria-live",Mf=e=>e.ariaLiveMessage,kf=e=>e.ariaLabelConfig;function If({rfId:e}){const t=ee(Mf);return C.jsx("div",{id:`${Cf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Nf,children:t})}function Af({rfId:e,disableKeyboardA11y:t}){const n=ee(kf);return C.jsxs(C.Fragment,{children:[C.jsx("div",{id:`${Bi}-${e}`,style:ir,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),C.jsx("div",{id:`${ji}-${e}`,style:ir,children:n["edge.a11yDescription.default"]}),!t&&C.jsx(If,{rfId:e})]})}const rt=$.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return C.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});rt.displayName="Panel";const sr="https://reactflow.dev?utm_source=attribution";function $f({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:C.jsx(rt,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${sr}`,children:C.jsx("a",{href:sr,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Pf=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}},Ht=e=>e.id;function Df(e,t){return re(e.selectedNodes.map(Ht),t.selectedNodes.map(Ht))&&re(e.selectedEdges.map(Ht),t.selectedEdges.map(Ht))}function zf({onSelectionChange:e}){const t=ne(),{selectedNodes:n,selectedEdges:o}=ee(Pf,Df);return $.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Tf=e=>!!e.onSelectionChangeHandlers;function Rf({onSelectionChange:e}){const t=ee(Tf);return e||t?C.jsx(zf,{onSelectionChange:e}):null}const Fi=[0,0],Hf={x:0,y:0,zoom:1},Lf=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ar=[...Lf,"rfId"],Of=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),cr={translateExtent:xt,nodeOrigin:Fi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Vf(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=ee(Of,re),d=ne();$.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{c.current=cr,a()}),[]);const c=$.useRef(cr);return $.useEffect(()=>{for(const u of ar){const f=e[u],h=c.current[u];f!==h&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?o(f):u==="maxZoom"?r(f):u==="translateExtent"?i(f):u==="nodeExtent"?s(f):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:Ed(f)}):u==="fitView"?d.setState({fitViewQueued:f}):u==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[u]:f})))}c.current=e},ar.map(u=>e[u])),null}function lr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Bf(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const o=lr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:lr()?.matches?"dark":"light"}const ur=typeof document<"u"?document:null;function Et(e=null,t={target:ur,actInsideInputWithModifier:!0}){const[n,o]=$.useState(!1),r=$.useRef(!1),i=$.useRef(new Set([])),[s,a]=$.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
2
|
+
`).replace(`
|
|
3
|
+
|
|
4
|
+
`,`
|
|
5
|
+
+`).split(`
|
|
6
|
+
`)),c=d.reduce((u,f)=>u.concat(...f),[]);return[d,c]}return[[],[]]},[e]);return $.useEffect(()=>{const l=t?.target??ur,d=t?.actInsideInputWithModifier??!0;if(e!==null){const c=h=>{if(r.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!r.current||r.current&&!d)&&_i(h))return!1;const w=fr(h.code,a);if(i.current.add(h[w]),dr(s,i.current,!1)){const y=h.composedPath?.()?.[0]||h.target,m=y?.nodeName==="BUTTON"||y?.nodeName==="A";t.preventDefault!==!1&&(r.current||!m)&&h.preventDefault(),o(!0)}},u=h=>{const g=fr(h.code,a);dr(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),r.current=!1},f=()=>{i.current.clear(),o(!1)};return l?.addEventListener("keydown",c),l?.addEventListener("keyup",u),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{l?.removeEventListener("keydown",c),l?.removeEventListener("keyup",u),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,o]),n}function dr(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function fr(e,t){return t.includes(e)?"code":"key"}const jf=()=>{const e=ne();return $.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=no(t,o,r,i,s,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),d={x:t.x-a,y:t.y-l},c=n.snapGrid??r,u=n.snapToGrid??i;return It(d,o,u,c)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=nt(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function Xi(e,t){const n=[],o=new Map,r=[];for(const i of e)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{const s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(const i of t){const s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const l of s)Ff(l,a);n.push(a)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Ff(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Yi(e,t){return Xi(e,t)}function Xf(e,t){return Xi(e,t)}function Le(e,t){return{id:e,type:"select",selected:t}}function Ge(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(Le(i.id,s)))}return o}function hr({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,i]of e.entries()){const s=t.get(i.id),a=s?.internals?.userNode??s;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:"replace"}),a===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 gr(e){return{id:e.id,type:"remove"}}const Yf=xi();function Zf(e,t,n={}){return Id(e,t,{...n,onError:n.onError??Yf})}const pr=e=>gd(e),Wf=e=>hi(e);function Zi(e){return $.forwardRef(e)}const Wi=typeof window<"u"?$.useLayoutEffect:$.useEffect;function mr(e){const[t,n]=$.useState(BigInt(0)),[o]=$.useState(()=>qf(()=>n(r=>r+BigInt(1))));return Wi(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function qf(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const qi=$.createContext(null);function Gf({children:e}){const t=ne(),n=$.useCallback(a=>{const{nodes:l=[],setNodes:d,hasDefaultNodes:c,onNodesChange:u,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let w=l;for(const m of a)w=typeof m=="function"?m(w):m;let y=hr({items:w,lookup:f});for(const m of g.values())y=m(y);c&&d(w),y.length>0?u?.(y):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:b,setNodes:p}=t.getState();m&&p(b)})},[]),o=mr(n),r=$.useCallback(a=>{const{edges:l=[],setEdges:d,hasDefaultEdges:c,onEdgesChange:u,edgeLookup:f}=t.getState();let h=l;for(const g of a)h=typeof g=="function"?g(h):g;c?d(h):u&&u(hr({items:h,lookup:f}))},[]),i=mr(r),s=$.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return C.jsx(qi.Provider,{value:s,children:e})}function Kf(){const e=$.useContext(qi);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Uf=e=>!!e.panZoom;function lo(){const e=jf(),t=ne(),n=Kf(),o=ee(Uf),r=$.useMemo(()=>{const i=u=>t.getState().nodeLookup.get(u),s=u=>{n.nodeQueue.push(u)},a=u=>{n.edgeQueue.push(u)},l=u=>{const{nodeLookup:f,nodeOrigin:h}=t.getState(),g=pr(u)?u:f.get(u.id),w=g.parentId?vi(g.position,g.measured,g.parentId,f,h):g.position,y={...g,position:w,width:g.measured?.width??g.width,height:g.measured?.height??g.height};return bt(y)},d=(u,f,h={replace:!1})=>{s(g=>g.map(w=>{if(w.id===u){const y=typeof f=="function"?f(w):f;return h.replace&&pr(y)?y:{...w,...y}}return w}))},c=(u,f,h={replace:!1})=>{a(g=>g.map(w=>{if(w.id===u){const y=typeof f=="function"?f(w):f;return h.replace&&Wf(y)?y:{...w,...y}}return w}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>i(u)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:u=[]}=t.getState();return u.map(f=>({...f}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:s,setEdges:a,addNodes:u=>{const f=Array.isArray(u)?u:[u];n.nodeQueue.push(h=>[...h,...f])},addEdges:u=>{const f=Array.isArray(u)?u:[u];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:u=[],edges:f=[],transform:h}=t.getState(),[g,w,y]=h;return{nodes:u.map(m=>({...m})),edges:f.map(m=>({...m})),viewport:{x:g,y:w,zoom:y}}},deleteElements:async({nodes:u=[],edges:f=[]})=>{const{nodes:h,edges:g,onNodesDelete:w,onEdgesDelete:y,triggerNodeChanges:m,triggerEdgeChanges:b,onDelete:p,onBeforeDelete:v}=t.getState(),{nodes:N,edges:_}=await wd({nodesToRemove:u,edgesToRemove:f,nodes:h,edges:g,onBeforeDelete:v}),M=_.length>0,I=N.length>0;if(M){const A=_.map(gr);y?.(_),b(A)}if(I){const A=N.map(gr);w?.(N),m(A)}return(I||M)&&p?.({nodes:N,edges:_}),{deletedNodes:N,deletedEdges:_}},getIntersectingNodes:(u,f=!0,h)=>{const g=Vo(u),w=g?u:l(u),y=h!==void 0;return w?(h||t.getState().nodes).filter(m=>{const b=t.getState().nodeLookup.get(m.id);if(b&&!g&&(m.id===u.id||!b.internals.positionAbsolute))return!1;const p=bt(y?m:b),v=Qt(p,w);return f&&v>0||v>=p.width*p.height||v>=w.width*w.height}):[]},isNodeIntersecting:(u,f,h=!0)=>{const w=Vo(u)?u:l(u);if(!w)return!1;const y=Qt(w,f);return h&&y>0||y>=f.width*f.height||y>=w.width*w.height},updateNode:d,updateNodeData:(u,f,h={replace:!1})=>{d(u,g=>{const w=typeof f=="function"?f(g):f;return h.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},h)},updateEdge:c,updateEdgeData:(u,f,h={replace:!1})=>{c(u,g=>{const w=typeof f=="function"?f(g):f;return h.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},h)},getNodesBounds:u=>{const{nodeLookup:f,nodeOrigin:h}=t.getState();return pd(u,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:u,id:f,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}-${u}${f?`-${f}`:""}`)?.values()??[]),getNodeConnections:({type:u,handleId:f,nodeId:h})=>Array.from(t.getState().connectionLookup.get(`${h}${u?f?`-${u}-${f}`:`-${u}`:""}`)?.values()??[]),fitView:async u=>{const f=t.getState().fitViewResolver??_d();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return $.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const yr=e=>e.selected,Qf=typeof window<"u"?window:void 0;function Jf({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ne(),{deleteElements:o}=lo(),r=Et(e,{actInsideInputWithModifier:!1}),i=Et(t,{target:Qf});$.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter(yr),edges:s.filter(yr)}),n.setState({nodesSelectionActive:!1})}},[r]),$.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function eh(e){const t=ne();$.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=oo(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",me.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 un={position:"absolute",width:"100%",height:"100%",top:0,left:0},th=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function nh({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=Be.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:d,minZoom:c,maxZoom:u,zoomActivationKeyCode:f,preventScrolling:h=!0,children:g,noWheelClassName:w,noPanClassName:y,onViewportChange:m,isControlledViewport:b,paneClickDistance:p,selectionOnDrag:v}){const N=ne(),_=$.useRef(null),{userSelectionActive:M,lib:I,connectionInProgress:A}=ee(th,re),B=Et(f),z=$.useRef();eh(_);const L=$.useCallback(T=>{m?.({x:T[0],y:T[1],zoom:T[2]}),b||N.setState({transform:T})},[m,b]);return $.useEffect(()=>{if(_.current){z.current=sf({domNode:_.current,minZoom:c,maxZoom:u,translateExtent:d,viewport:l,onDraggingChange:S=>N.setState(k=>k.paneDragging===S?k:{paneDragging:S}),onPanZoomStart:(S,k)=>{const{onViewportChangeStart:D,onMoveStart:P}=N.getState();P?.(S,k),D?.(k)},onPanZoom:(S,k)=>{const{onViewportChange:D,onMove:P}=N.getState();P?.(S,k),D?.(k)},onPanZoomEnd:(S,k)=>{const{onViewportChangeEnd:D,onMoveEnd:P}=N.getState();P?.(S,k),D?.(k)}});const{x:T,y:x,zoom:E}=z.current.getViewport();return N.setState({panZoom:z.current,transform:[T,x,E],domNode:_.current.closest(".react-flow")}),()=>{z.current?.destroy()}}},[]),$.useEffect(()=>{z.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:B,preventScrolling:h,noPanClassName:y,userSelectionActive:M,noWheelClassName:w,lib:I,onTransformChange:L,connectionInProgress:A,selectionOnDrag:v,paneClickDistance:p})},[e,t,n,o,r,i,s,a,B,h,y,M,w,I,L,A,v,p]),C.jsx("div",{className:"react-flow__renderer",ref:_,style:un,children:g})}const oh=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function rh(){const{userSelectionActive:e,userSelectionRect:t}=ee(oh,re);return e&&t?C.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 Cn=(e,t)=>n=>{n.target===t.current&&e?.(n)},ih=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function sh({isSelecting:e,selectionKeyPressed:t,selectionMode:n=wt.Full,panOnDrag:o,autoPanOnSelection:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:a,onSelectionEnd:l,onPaneClick:d,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:g,children:w}){const y=$.useRef(0),m=ne(),{userSelectionActive:b,elementsSelectable:p,dragging:v,panBy:N,autoPanSpeed:_}=ee(ih,re),M=p&&(e||b),I=$.useRef(null),A=$.useRef(),B=$.useRef(new Set),z=$.useRef(new Set),L=$.useRef(!1),T=$.useRef(!1),x=$.useRef({x:0,y:0}),E=$.useRef(!1),S=R=>{if(T.current||L.current||m.getState().connection.inProgress){T.current=!1,L.current=!1;return}d?.(R),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},k=R=>{if(Array.isArray(o)&&o?.includes(2)){R.preventDefault();return}c?.(R)},D=u?R=>u(R):void 0,P=R=>{T.current&&(R.stopPropagation(),T.current=!1)},V=R=>{const{domNode:j,transform:U}=m.getState();if(A.current=j?.getBoundingClientRect(),!A.current)return;const K=R.target===I.current;if(!K&&!!R.target.closest(".nokey")||!e||!(s&&K||t)||R.button!==0||!R.isPrimary)return;R.target?.setPointerCapture?.(R.pointerId),T.current=!1;const{x:J,y:te}=pe(R.nativeEvent,A.current),oe=It({x:J,y:te},U);m.setState({userSelectionRect:{width:0,height:0,startX:oe.x,startY:oe.y,x:J,y:te}}),K||(R.stopPropagation(),R.preventDefault())};function O(R,j){const{userSelectionRect:U}=m.getState();if(!U)return;const{transform:K,nodeLookup:Z,edgeLookup:G,connectionLookup:J,triggerNodeChanges:te,triggerEdgeChanges:oe,defaultEdgeOptions:ae}=m.getState(),Se={x:U.startX,y:U.startY},{x:xe,y:we}=nt(Se,K),Ne={startX:Se.x,startY:Se.y,x:R<xe?R:xe,y:j<we?j:we,width:Math.abs(R-xe),height:Math.abs(j-we)},st=B.current,Te=z.current;B.current=new Set(eo(Z,Ne,K,n===wt.Partial,!0).map(de=>de.id)),z.current=new Set;const Re=ae?.selectable??!0;for(const de of B.current){const Ce=J.get(de);if(Ce)for(const{edgeId:Me}of Ce.values()){const He=G.get(Me);He&&(He.selectable??Re)&&z.current.add(Me)}}if(!Bo(st,B.current)){const de=Ge(Z,B.current,!0);te(de)}if(!Bo(Te,z.current)){const de=Ge(G,z.current);oe(de)}m.setState({userSelectionRect:Ne,userSelectionActive:!0,nodesSelectionActive:!1})}function H(){if(!r||!A.current)return;const[R,j]=to(x.current,A.current,_);N({x:R,y:j}).then(U=>{if(!T.current||!U){y.current=requestAnimationFrame(H);return}const{x:K,y:Z}=x.current;O(K,Z),y.current=requestAnimationFrame(H)})}const Y=()=>{cancelAnimationFrame(y.current),y.current=0,E.current=!1};$.useEffect(()=>()=>Y(),[]);const F=R=>{const{userSelectionRect:j,transform:U,resetSelectedElements:K}=m.getState();if(!A.current||!j)return;const{x:Z,y:G}=pe(R.nativeEvent,A.current);x.current={x:Z,y:G};const J=nt({x:j.startX,y:j.startY},U);if(!T.current){const te=t?0:i;if(Math.hypot(Z-J.x,G-J.y)<=te)return;K(),a?.(R)}T.current=!0,E.current||(H(),E.current=!0),O(Z,G)},W=R=>{if(!M){R.target===I.current&&m.getState().connection.inProgress&&(L.current=!0);return}R.button===0&&(R.target?.releasePointerCapture?.(R.pointerId),!b&&R.target===I.current&&m.getState().userSelectionRect&&S?.(R),m.setState({userSelectionActive:!1,userSelectionRect:null}),T.current&&(l?.(R),m.setState({nodesSelectionActive:B.current.size>0})),Y())},Q=R=>{R.target?.releasePointerCapture?.(R.pointerId),Y()},q=o===!0||Array.isArray(o)&&o.includes(0);return C.jsxs("div",{className:ie(["react-flow__pane",{draggable:q,dragging:v,selection:e}]),onClick:M?void 0:Cn(S,I),onContextMenu:Cn(k,I),onWheel:Cn(D,I),onPointerEnter:M?void 0:f,onPointerMove:M?F:h,onPointerUp:W,onPointerCancel:M?Q:void 0,onPointerDownCapture:M?V:void 0,onClickCapture:M?P:void 0,onPointerLeave:g,ref:I,style:un,children:[w,C.jsx(rh,{})]})}function Yn({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),d=a.get(e);if(!d){l?.("012",me.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&s)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function Gi({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=ne(),[l,d]=$.useState(!1),c=$.useRef();return $.useEffect(()=>{if(!t)return c.current=Yd({getStoreItems:()=>a.getState(),onNodeMouseDown:u=>{Yn({id:u,store:a,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}}),()=>{c.current?.destroy(),c.current=void 0}},[t,a,e]),$.useEffect(()=>{t||!e.current||!c.current||c.current.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s})},[n,o,t,i,e,r,s]),l}const ah=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Ki(){const e=ne();return $.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:l,nodeLookup:d,nodeOrigin:c}=e.getState(),u=new Map,f=ah(s),h=r?i[0]:5,g=r?i[1]:5,w=n.direction.x*h*n.factor,y=n.direction.y*g*n.factor;for(const[,m]of d){if(!f(m))continue;let b={x:m.internals.positionAbsolute.x+w,y:m.internals.positionAbsolute.y+y};r&&(b=kt(b,i));const{position:p,positionAbsolute:v}=gi({nodeId:m.id,nextPosition:b,nodeLookup:d,nodeExtent:o,nodeOrigin:c,onError:a});m.position=p,m.internals.positionAbsolute=v,u.set(m.id,m)}l(u)},[])}const uo=$.createContext(null),ch=uo.Provider;uo.Consumer;const Ui=()=>$.useContext(uo),lh=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Qi=$.createContext(null);function uh({children:e}){const t=ee(lh,re);return C.jsx(Qi.Provider,{value:t,children:e})}function dh(){const e=$.useContext(Qi);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const fh={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},hh=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:d}=s;if(!a&&!r)return fh;const c=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:c,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===et.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:c&&d}};function gh({type:e="source",position:t=X.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:l,className:d,onMouseDown:c,onTouchStart:u,...f},h){const g=s||null,w=e==="target",y=ne(),m=Ui(),{connectOnClick:b,noPanClassName:p,rfId:v}=dh(),{connectingFrom:N,connectingTo:_,clickConnecting:M,isPossibleEndHandle:I,connectionInProcess:A,clickConnectionInProcess:B,valid:z}=ee(hh(m,g,e),re);m||y.getState().onError?.("010",me.error010());const L=E=>{const{defaultEdgeOptions:S,onConnect:k,hasDefaultEdges:D}=y.getState(),P={...S,...E};if(D){const{edges:V,setEdges:O,onError:H}=y.getState();O(Zf(P,V,{onError:H}))}k?.(P),a?.(P)},T=E=>{if(!m)return;const S=Ei(E.nativeEvent);if(r&&(S&&E.button===0||!S)){const k=y.getState();Xn.onPointerDown(E.nativeEvent,{handleDomNode:E.currentTarget,autoPanOnConnect:k.autoPanOnConnect,connectionMode:k.connectionMode,connectionRadius:k.connectionRadius,domNode:k.domNode,nodeLookup:k.nodeLookup,lib:k.lib,isTarget:w,handleId:g,nodeId:m,flowId:k.rfId,panBy:k.panBy,cancelConnection:k.cancelConnection,onConnectStart:k.onConnectStart,onConnectEnd:(...D)=>y.getState().onConnectEnd?.(...D),updateConnection:k.updateConnection,onConnect:L,isValidConnection:n||((...D)=>y.getState().isValidConnection?.(...D)??!0),getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:k.autoPanSpeed,dragThreshold:k.connectionDragThreshold})}S?c?.(E):u?.(E)},x=E=>{const{onClickConnectStart:S,onClickConnectEnd:k,connectionClickStartHandle:D,connectionMode:P,isValidConnection:V,lib:O,rfId:H,nodeLookup:Y,connection:F}=y.getState();if(!m||!D&&!r)return;if(!D){S?.(E.nativeEvent,{nodeId:m,handleId:g,handleType:e}),y.setState({connectionClickStartHandle:{nodeId:m,type:e,id:g}});return}const W=bi(E.target),Q=n||V,{connection:q,isValid:R}=Xn.isValid(E.nativeEvent,{handle:{nodeId:m,id:g,type:e},connectionMode:P,fromNodeId:D.nodeId,fromHandleId:D.id||null,fromType:D.type,isValidConnection:Q,flowId:H,doc:W,lib:O,nodeLookup:Y});R&&q&&L(q);const j=structuredClone(F);delete j.inProgress,j.toPosition=j.toHandle?j.toHandle.position:null,k?.(E,j),y.setState({connectionClickStartHandle:null})};return C.jsx("div",{"data-handleid":g,"data-nodeid":m,"data-handlepos":t,"data-id":`${v}-${m}-${g}-${e}`,className:ie(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,d,{source:!w,target:w,connectable:o,connectablestart:r,connectableend:i,clickconnecting:M,connectingfrom:N,connectingto:_,valid:z,connectionindicator:o&&(!A||I)&&(A||B?i:r)}]),onMouseDown:T,onTouchStart:T,onClick:b?x:void 0,ref:h,...f,children:l})}const it=$.memo(Zi(gh));function ph({data:e,isConnectable:t,sourcePosition:n=X.Bottom}){return C.jsxs(C.Fragment,{children:[e?.label,C.jsx(it,{type:"source",position:n,isConnectable:t})]})}function mh({data:e,isConnectable:t,targetPosition:n=X.Top,sourcePosition:o=X.Bottom}){return C.jsxs(C.Fragment,{children:[C.jsx(it,{type:"target",position:n,isConnectable:t}),e?.label,C.jsx(it,{type:"source",position:o,isConnectable:t})]})}function yh(){return null}function xh({data:e,isConnectable:t,targetPosition:n=X.Top}){return C.jsxs(C.Fragment,{children:[C.jsx(it,{type:"target",position:n,isConnectable:t}),e?.label]})}const Jt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},xr={input:ph,default:mh,output:xh,group:yh};function wh(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const vh=e=>{const{width:t,height:n,x:o,y:r}=Mt(e.nodeLookup,{filter:i=>!!i.selected});return{width:ge(t)?t:null,height:ge(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function bh({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=ne(),{width:r,height:i,transformString:s,userSelectionActive:a}=ee(vh,re),l=Ki(),d=$.useRef(null);$.useEffect(()=>{n||d.current?.focus({preventScroll:!0})},[n]);const c=!a&&r!==null&&i!==null;if(Gi({nodeRef:d,disabled:!c}),!c)return null;const u=e?h=>{const g=o.getState().nodes.filter(w=>w.selected);e(h,g)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(Jt,h.key)&&(h.preventDefault(),l({direction:Jt[h.key],factor:h.shiftKey?4:1}))};return C.jsx("div",{className:ie(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:C.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:r,height:i}})})}const wr=typeof window<"u"?window:void 0,_h=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Ji({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:d,selectionOnDrag:c,selectionMode:u,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:w,zoomActivationKeyCode:y,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:v,panOnScrollSpeed:N,panOnScrollMode:_,zoomOnDoubleClick:M,panOnDrag:I,autoPanOnSelection:A,defaultViewport:B,translateExtent:z,minZoom:L,maxZoom:T,preventScrolling:x,onSelectionContextMenu:E,noWheelClassName:S,noPanClassName:k,disableKeyboardA11y:D,onViewportChange:P,isControlledViewport:V}){const{nodesSelectionActive:O,userSelectionActive:H}=ee(_h,re),Y=Et(d,{target:wr}),F=Et(w,{target:wr}),W=F||I,Q=F||v,q=c&&W!==!0,R=Y||H||q;return Jf({deleteKeyCode:l,multiSelectionKeyCode:g}),C.jsx(nh,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:Q,panOnScrollSpeed:N,panOnScrollMode:_,zoomOnDoubleClick:M,panOnDrag:!Y&&W,defaultViewport:B,translateExtent:z,minZoom:L,maxZoom:T,zoomActivationKeyCode:y,preventScrolling:x,noWheelClassName:S,noPanClassName:k,onViewportChange:P,isControlledViewport:V,paneClickDistance:a,selectionOnDrag:q,children:C.jsxs(sh,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:W,autoPanOnSelection:A,isSelecting:!!R,selectionMode:u,selectionKeyPressed:Y,paneClickDistance:a,selectionOnDrag:q,children:[e,O&&C.jsx(bh,{onSelectionContextMenu:E,noPanClassName:k,disableKeyboardA11y:D})]})})}Ji.displayName="FlowRenderer";const Eh=$.memo(Ji),Sh=e=>t=>e?eo(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 Nh(e){return ee($.useCallback(Sh(e),[e]),re)}const Ch=e=>e.updateNodeInternals;function Mh(){const e=ee(Ch),[t]=$.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),e(o)}));return $.useEffect(()=>()=>{t?.disconnect()},[t]),t}function kh({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=ne(),i=$.useRef(null),s=$.useRef(null),a=$.useRef(e.sourcePosition),l=$.useRef(e.targetPosition),d=$.useRef(t),c=n&&!!e.internals.handleBounds;return $.useEffect(()=>{i.current&&!e.hidden&&(!c||s.current!==i.current)&&(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[c,e.hidden]),$.useEffect(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),$.useEffect(()=>{if(i.current){const u=d.current!==t,f=a.current!==e.sourcePosition,h=l.current!==e.targetPosition;(u||f||h)&&(d.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function Ih({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:l,nodesConnectable:d,nodesFocusable:c,resizeObserver:u,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:g,rfId:w,nodeTypes:y,nodeClickDistance:m,onError:b}){const{node:p,internals:v,isParent:N}=ee(R=>{const j=R.nodeLookup.get(e),U=R.parentLookup.has(e);return{node:j,internals:j.internals,isParent:U}},re);let _=p.type||"default",M=y?.[_]||xr[_];M===void 0&&(b?.("003",me.error003(_)),_="default",M=y?.default||xr.default);const I=!!(p.draggable||a&&typeof p.draggable>"u"),A=!!(p.selectable||l&&typeof p.selectable>"u"),B=!!(p.connectable||d&&typeof p.connectable>"u"),z=!!(p.focusable||c&&typeof p.focusable>"u"),L=ne(),T=wi(p),x=kh({node:p,nodeType:_,hasDimensions:T,resizeObserver:u}),E=Gi({nodeRef:x,disabled:p.hidden||!I,noDragClassName:f,handleSelector:p.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:m}),S=Ki();if(p.hidden)return null;const k=Ee(p),D=wh(p),P=A||I||t||n||o||r,V=n?R=>n(R,{...v.userNode}):void 0,O=o?R=>o(R,{...v.userNode}):void 0,H=r?R=>r(R,{...v.userNode}):void 0,Y=i?R=>i(R,{...v.userNode}):void 0,F=s?R=>s(R,{...v.userNode}):void 0,W=R=>{const{selectNodesOnDrag:j,nodeDragThreshold:U}=L.getState();A&&(!j||!I||U>0)&&Yn({id:e,store:L,nodeRef:x}),t&&t(R,{...v.userNode})},Q=R=>{if(!(_i(R.nativeEvent)||g)){if(li.includes(R.key)&&A){const j=R.key==="Escape";Yn({id:e,store:L,unselect:j,nodeRef:x})}else if(I&&p.selected&&Object.prototype.hasOwnProperty.call(Jt,R.key)){R.preventDefault();const{ariaLabelConfig:j}=L.getState();L.setState({ariaLiveMessage:j["node.a11yDescription.ariaLiveMessage"]({direction:R.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),S({direction:Jt[R.key],factor:R.shiftKey?4:1})}}},q=()=>{if(g||!x.current?.matches(":focus-visible"))return;const{transform:R,width:j,height:U,autoPanOnNodeFocus:K,setCenter:Z}=L.getState();if(!K)return;eo(new Map([[e,p]]),{x:0,y:0,width:j,height:U},R,!0).length>0||Z(p.position.x+k.width/2,p.position.y+k.height/2,{zoom:R[2]})};return C.jsx("div",{className:ie(["react-flow__node",`react-flow__node-${_}`,{[h]:I},p.className,{selected:p.selected,selectable:A,parent:N,draggable:I,dragging:E}]),ref:x,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:P?"all":"none",visibility:T?"visible":"hidden",...p.style,...D},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:V,onMouseMove:O,onMouseLeave:H,onContextMenu:Y,onClick:W,onDoubleClick:F,onKeyDown:z?Q:void 0,tabIndex:z?0:void 0,onFocus:z?q:void 0,role:p.ariaRole??(z?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Bi}-${w}`,"aria-label":p.ariaLabel,...p.domAttributes,children:C.jsx(ch,{value:e,children:C.jsx(M,{id:e,data:p.data,type:_,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:p.selected??!1,selectable:A,draggable:I,deletable:p.deletable??!0,isConnectable:B,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:E,dragHandle:p.dragHandle,zIndex:v.z,parentId:p.parentId,...k})})})}var Ah=$.memo(Ih);const $h=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function es(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,onError:r}=ee($h,re),i=Nh(e.onlyRenderVisibleElements),s=Mh();return C.jsx("div",{className:"react-flow__nodes",style:un,children:i.map(a=>C.jsx(Ah,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:r},a))})}es.displayName="NodeRenderer";const Ph=$.memo(es);function Dh(e){return ee($.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&Cd({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),re)}const zh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return C.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Th=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return C.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},vr={[vt.Arrow]:zh,[vt.ArrowClosed]:Th};function Rh(e){const t=ne();return $.useMemo(()=>Object.prototype.hasOwnProperty.call(vr,e)?vr[e]:(t.getState().onError?.("009",me.error009(e)),null),[e])}const Hh=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=Rh(t);return l?C.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:C.jsx(l,{color:n,strokeWidth:s})}):null},ts=({defaultColor:e,rfId:t})=>{const n=ee(i=>i.edges),o=ee(i=>i.defaultEdgeOptions),r=$.useMemo(()=>zd(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?C.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:C.jsx("defs",{children:r.map(i=>C.jsx(Hh,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};ts.displayName="MarkerDefinitions";var Lh=$.memo(ts);function ns({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:d,...c}){const[u,f]=$.useState({x:1,y:0,width:0,height:0}),h=ie(["react-flow__edge-textwrapper",d]),g=$.useRef(null);return $.useEffect(()=>{if(g.current){const w=g.current.getBBox();f({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?C.jsxs("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:h,visibility:u.width?"visible":"hidden",...c,children:[r&&C.jsx("rect",{width:u.width+2*s[0],x:-s[0],y:-s[1],height:u.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),C.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:g,style:o,children:n}),l]}):null}ns.displayName="EdgeText";const Oh=$.memo(ns);function dn({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:d=20,...c}){return C.jsxs(C.Fragment,{children:[C.jsx("path",{...c,d:e,fill:"none",className:ie(["react-flow__edge-path",c.className])}),d?C.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,o&&ge(t)&&ge(n)?C.jsx(Oh,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function br({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===X.Left||e===X.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function os({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top}){const[s,a]=br({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,d]=br({pos:i,x1:o,y1:r,x2:e,y2:t}),[c,u,f,h]=Si({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:d});return[`M${e},${t} C${s},${a} ${l},${d} ${o},${r}`,c,u,f,h]}function rs(e){return $.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:d,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:y,interactionWidth:m})=>{const[b,p,v]=os({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),N=e.isInternal?void 0:t;return C.jsx(dn,{id:N,path:b,labelX:p,labelY:v,label:l,labelStyle:d,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:y,interactionWidth:m})})}const Vh=rs({isInternal:!1}),is=rs({isInternal:!0});Vh.displayName="SimpleBezierEdge";is.displayName="SimpleBezierEdgeInternal";function ss(e){return $.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:c,labelBgBorderRadius:u,style:f,sourcePosition:h=X.Bottom,targetPosition:g=X.Top,markerEnd:w,markerStart:y,pathOptions:m,interactionWidth:b})=>{const[p,v,N]=Bn({sourceX:n,sourceY:o,sourcePosition:h,targetX:r,targetY:i,targetPosition:g,borderRadius:m?.borderRadius,offset:m?.offset,stepPosition:m?.stepPosition}),_=e.isInternal?void 0:t;return C.jsx(dn,{id:_,path:p,labelX:v,labelY:N,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:c,labelBgBorderRadius:u,style:f,markerEnd:w,markerStart:y,interactionWidth:b})})}const as=ss({isInternal:!1}),cs=ss({isInternal:!0});as.displayName="SmoothStepEdge";cs.displayName="SmoothStepEdgeInternal";function ls(e){return $.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return C.jsx(as,{...n,id:o,pathOptions:$.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const Bh=ls({isInternal:!1}),us=ls({isInternal:!0});Bh.displayName="StepEdge";us.displayName="StepEdgeInternal";function ds(e){return $.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:c,labelBgBorderRadius:u,style:f,markerEnd:h,markerStart:g,interactionWidth:w})=>{const[y,m,b]=Mi({sourceX:n,sourceY:o,targetX:r,targetY:i}),p=e.isInternal?void 0:t;return C.jsx(dn,{id:p,path:y,labelX:m,labelY:b,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:c,labelBgBorderRadius:u,style:f,markerEnd:h,markerStart:g,interactionWidth:w})})}const jh=ds({isInternal:!1}),fs=ds({isInternal:!0});jh.displayName="StraightEdge";fs.displayName="StraightEdgeInternal";function hs(e){return $.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=X.Bottom,targetPosition:a=X.Top,label:l,labelStyle:d,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:y,pathOptions:m,interactionWidth:b})=>{const[p,v,N]=Ni({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:m?.curvature}),_=e.isInternal?void 0:t;return C.jsx(dn,{id:_,path:p,labelX:v,labelY:N,label:l,labelStyle:d,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:y,interactionWidth:b})})}const Fh=hs({isInternal:!1}),gs=hs({isInternal:!0});Fh.displayName="BezierEdge";gs.displayName="BezierEdgeInternal";const _r={default:gs,straight:fs,step:us,smoothstep:cs,simplebezier:is},Er={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},Xh=(e,t,n)=>n===X.Left?e-t:n===X.Right?e+t:e,Yh=(e,t,n)=>n===X.Top?e-t:n===X.Bottom?e+t:e,Sr="react-flow__edgeupdater";function Nr({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return C.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ie([Sr,`${Sr}-${a}`]),cx:Xh(t,o,e),cy:Yh(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Zh({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:d,onReconnectStart:c,onReconnectEnd:u,setReconnecting:f,setUpdateHover:h}){const g=ne(),w=(v,N)=>{if(v.button!==0)return;const{autoPanOnConnect:_,domNode:M,connectionMode:I,connectionRadius:A,lib:B,onConnectStart:z,cancelConnection:L,nodeLookup:T,rfId:x,panBy:E,updateConnection:S}=g.getState(),k=N.type==="target",D=(O,H)=>{f(!1),u?.(O,n,N.type,H)},P=O=>d?.(n,O),V=(O,H)=>{f(!0),c?.(v,n,N.type),z?.(O,H)};Xn.onPointerDown(v.nativeEvent,{autoPanOnConnect:_,connectionMode:I,connectionRadius:A,domNode:M,handleId:N.id,nodeId:N.nodeId,nodeLookup:T,isTarget:k,edgeUpdaterType:N.type,lib:B,flowId:x,cancelConnection:L,panBy:E,isValidConnection:(...O)=>g.getState().isValidConnection?.(...O)??!0,onConnect:P,onConnectStart:V,onConnectEnd:(...O)=>g.getState().onConnectEnd?.(...O),onReconnectEnd:D,updateConnection:S,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},y=v=>w(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=v=>w(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),p=()=>h(!1);return C.jsxs(C.Fragment,{children:[(e===!0||e==="source")&&C.jsx(Nr,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:y,onMouseEnter:b,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&C.jsx(Nr,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:m,onMouseEnter:b,onMouseOut:p,type:"target"})]})}function Wh({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:d,reconnectRadius:c,onReconnect:u,onReconnectStart:f,onReconnectEnd:h,rfId:g,edgeTypes:w,noPanClassName:y,onError:m,disableKeyboardA11y:b}){let p=ee(Z=>Z.edgeLookup.get(e));const v=ee(Z=>Z.defaultEdgeOptions);p=v?{...v,...p}:p;let N=p.type||"default",_=w?.[N]||_r[N];_===void 0&&(m?.("011",me.error011(N)),N="default",_=w?.default||_r.default);const M=!!(p.focusable||t&&typeof p.focusable>"u"),I=typeof u<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),A=!!(p.selectable||o&&typeof p.selectable>"u"),B=$.useRef(null),[z,L]=$.useState(!1),[T,x]=$.useState(!1),E=ne(),{zIndex:S=p.zIndex,sourceX:k,sourceY:D,targetX:P,targetY:V,sourcePosition:O,targetPosition:H}=ee($.useCallback(Z=>{const G=Z.nodeLookup.get(p.source),J=Z.nodeLookup.get(p.target);if(!G||!J)return Er;const te=Dd({id:e,sourceNode:G,targetNode:J,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:Z.connectionMode,onError:m}),oe=Nd({selected:p.selected,zIndex:p.zIndex,sourceNode:G,targetNode:J,elevateOnSelect:Z.elevateEdgesOnSelect,zIndexMode:Z.zIndexMode});return{...te||Er,zIndex:oe}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),re),Y=$.useMemo(()=>p.markerStart?`url('#${jn(p.markerStart,g)}')`:void 0,[p.markerStart,g]),F=$.useMemo(()=>p.markerEnd?`url('#${jn(p.markerEnd,g)}')`:void 0,[p.markerEnd,g]);if(p.hidden||k===null||D===null||P===null||V===null)return null;const W=Z=>{const{addSelectedEdges:G,unselectNodesAndEdges:J,multiSelectionActive:te}=E.getState();A&&(E.setState({nodesSelectionActive:!1}),p.selected&&te?(J({nodes:[],edges:[p]}),B.current?.blur()):G([e])),r&&r(Z,p)},Q=i?Z=>{i(Z,{...p})}:void 0,q=s?Z=>{s(Z,{...p})}:void 0,R=a?Z=>{a(Z,{...p})}:void 0,j=l?Z=>{l(Z,{...p})}:void 0,U=d?Z=>{d(Z,{...p})}:void 0,K=Z=>{if(!b&&li.includes(Z.key)&&A){const{unselectNodesAndEdges:G,addSelectedEdges:J}=E.getState();Z.key==="Escape"?(B.current?.blur(),G({edges:[p]})):J([e])}};return C.jsx("svg",{style:{zIndex:S},children:C.jsxs("g",{className:ie(["react-flow__edge",`react-flow__edge-${N}`,p.className,y,{selected:p.selected,animated:p.animated,inactive:!A&&!r,updating:z,selectable:A}]),onClick:W,onDoubleClick:Q,onContextMenu:q,onMouseEnter:R,onMouseMove:j,onMouseLeave:U,onKeyDown:M?K:void 0,tabIndex:M?0:void 0,role:p.ariaRole??(M?"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":M?`${ji}-${g}`:void 0,ref:B,...p.domAttributes,children:[!T&&C.jsx(_,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:A,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:k,sourceY:D,targetX:P,targetY:V,sourcePosition:O,targetPosition:H,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:Y,markerEnd:F,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),I&&C.jsx(Zh,{edge:p,isReconnectable:I,reconnectRadius:c,onReconnect:u,onReconnectStart:f,onReconnectEnd:h,sourceX:k,sourceY:D,targetX:P,targetY:V,sourcePosition:O,targetPosition:H,setUpdateHover:L,setReconnecting:x})]})})}var qh=$.memo(Wh);const Gh=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ps({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:d,onEdgeClick:c,reconnectRadius:u,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:w}){const{edgesFocusable:y,edgesReconnectable:m,elementsSelectable:b,onError:p}=ee(Gh,re),v=Dh(t);return C.jsxs("div",{className:"react-flow__edges",children:[C.jsx(Lh,{defaultColor:e,rfId:n}),v.map(N=>C.jsx(qh,{id:N,edgesFocusable:y,edgesReconnectable:m,elementsSelectable:b,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:d,onClick:c,reconnectRadius:u,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:p,edgeTypes:o,disableKeyboardA11y:w},N))]})}ps.displayName="EdgeRenderer";const Kh=$.memo(ps),Cr=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Uh({children:e}){const t=ne(),n=$.useRef(null),[o]=$.useState(()=>t.getState().transform);return Wi(()=>{let r=null;const i=()=>{const s=t.getState().transform;r&&s[0]===r[0]&&s[1]===r[1]&&s[2]===r[2]||(r=s,n.current&&(n.current.style.transform=Cr(s)))};return i(),t.subscribe(i)},[t]),C.jsx("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Cr(o)},children:e})}function Qh(e){const t=lo(),n=$.useRef(!1);$.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Jh=e=>e.panZoom?.syncViewport;function eg(e){const t=ee(Jh),n=ne();return $.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function tg(e){return e.connection.inProgress?{...e.connection,to:It(e.connection.to,e.transform)}:{...e.connection}}function ng(e){return tg}function og(e){const t=ng();return ee(t,re)}const rg=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function ig({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=ee(rg,re);return!(i&&r&&l)?null:C.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:C.jsx("g",{className:ie(["react-flow__connection",fi(a)]),children:C.jsx(ms,{style:t,type:n,CustomComponent:o,isValid:a})})})}const ms=({style:e,type:t=ze.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:d,toNode:c,toHandle:u,toPosition:f,pointer:h}=og();if(!r)return;if(n)return C.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:l,toPosition:f,connectionStatus:fi(o),toNode:c,toHandle:u,pointer:h});let g="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:d.x,targetY:d.y,targetPosition:f};switch(t){case ze.Bezier:[g]=Ni(w);break;case ze.SimpleBezier:[g]=os(w);break;case ze.Step:[g]=Bn({...w,borderRadius:0});break;case ze.SmoothStep:[g]=Bn(w);break;default:[g]=Mi(w)}return C.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};ms.displayName="ConnectionLine";const sg={};function Mr(e=sg){$.useRef(e),ne(),$.useEffect(()=>{},[e])}function ag(){ne(),$.useRef(!1),$.useEffect(()=>{},[])}function ys({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:d,onNodeContextMenu:c,onSelectionContextMenu:u,onSelectionStart:f,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:w,connectionLineComponent:y,connectionLineContainerStyle:m,selectionKeyCode:b,selectionOnDrag:p,selectionMode:v,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:M,deleteKeyCode:I,onlyRenderVisibleElements:A,elementsSelectable:B,defaultViewport:z,translateExtent:L,minZoom:T,maxZoom:x,preventScrolling:E,defaultMarkerColor:S,zoomOnScroll:k,zoomOnPinch:D,panOnScroll:P,panOnScrollSpeed:V,panOnScrollMode:O,zoomOnDoubleClick:H,panOnDrag:Y,autoPanOnSelection:F,onPaneClick:W,onPaneMouseEnter:Q,onPaneMouseMove:q,onPaneMouseLeave:R,onPaneScroll:j,onPaneContextMenu:U,paneClickDistance:K,nodeClickDistance:Z,onEdgeContextMenu:G,onEdgeMouseEnter:J,onEdgeMouseMove:te,onEdgeMouseLeave:oe,reconnectRadius:ae,onReconnect:Se,onReconnectStart:xe,onReconnectEnd:we,noDragClassName:Ne,noWheelClassName:st,noPanClassName:Te,disableKeyboardA11y:Re,nodeExtent:de,rfId:Ce,viewport:Me,onViewportChange:He,nodesDraggable:fn}){return Mr(e),Mr(t),ag(),Qh(n),eg(Me),C.jsx(Eh,{onPaneClick:W,onPaneMouseEnter:Q,onPaneMouseMove:q,onPaneMouseLeave:R,onPaneContextMenu:U,onPaneScroll:j,paneClickDistance:K,deleteKeyCode:I,selectionKeyCode:b,selectionOnDrag:p,selectionMode:v,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:M,elementsSelectable:B,zoomOnScroll:k,zoomOnPinch:D,zoomOnDoubleClick:H,panOnScroll:P,panOnScrollSpeed:V,panOnScrollMode:O,panOnDrag:Y,autoPanOnSelection:F,defaultViewport:z,translateExtent:L,minZoom:T,maxZoom:x,onSelectionContextMenu:u,preventScrolling:E,noDragClassName:Ne,noWheelClassName:st,noPanClassName:Te,disableKeyboardA11y:Re,onViewportChange:He,isControlledViewport:!!Me,children:C.jsxs(Uh,{children:[C.jsx(Kh,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:Se,onReconnectStart:xe,onReconnectEnd:we,onlyRenderVisibleElements:A,onEdgeContextMenu:G,onEdgeMouseEnter:J,onEdgeMouseMove:te,onEdgeMouseLeave:oe,reconnectRadius:ae,defaultMarkerColor:S,noPanClassName:Te,disableKeyboardA11y:Re,rfId:Ce}),C.jsx(ig,{style:w,type:g,component:y,containerStyle:m}),C.jsx("div",{className:"react-flow__edgelabel-renderer"}),C.jsx(Ph,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:d,onNodeContextMenu:c,nodeClickDistance:Z,onlyRenderVisibleElements:A,noPanClassName:Te,noDragClassName:Ne,disableKeyboardA11y:Re,nodeExtent:de,rfId:Ce,nodesDraggable:fn}),C.jsx("div",{className:"react-flow__viewport-portal"})]})})}ys.displayName="GraphView";const cg=$.memo(ys),lg=xi(),kr=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:d=2,nodeOrigin:c,nodeExtent:u,zIndexMode:f="basic"}={})=>{const h=new Map,g=new Map,w=new Map,y=new Map,m=o??t??[],b=n??e??[],p=c??[0,0],v=u??xt;Ai(w,y,m);const{nodesInitialized:N}=Fn(b,h,g,{nodeOrigin:p,nodeExtent:v,zIndexMode:f});let _=[0,0,1];if(s&&r&&i){const M=Mt(h,{filter:z=>!!((z.width||z.initialWidth)&&(z.height||z.initialHeight))}),{x:I,y:A,zoom:B}=no(M,r,i,l,d,a?.padding??.1);_=[I,A,B]}return{rfId:"1",width:r??0,height:i??0,transform:_,nodes:b,nodesInitialized:N,nodeLookup:h,parentLookup:g,edges:m,edgeLookup:y,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:d,translateExtent:xt,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:et.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...di},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:lg,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:ui,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},ug=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:d,nodeOrigin:c,nodeExtent:u,zIndexMode:f})=>Ef((h,g)=>{async function w(){const{nodeLookup:y,panZoom:m,fitViewOptions:b,fitViewResolver:p,width:v,height:N,minZoom:_,maxZoom:M}=g();m&&(await xd({nodes:y,width:v,height:N,panZoom:m,minZoom:_,maxZoom:M},b),p?.resolve(!0),h({fitViewResolver:null}))}return{...kr({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:d,nodeOrigin:c,nodeExtent:u,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:y=>{const{nodeLookup:m,parentLookup:b,nodeOrigin:p,elevateNodesOnSelect:v,fitViewQueued:N,zIndexMode:_,nodesSelectionActive:M}=g(),{nodesInitialized:I,hasSelectedNodes:A}=Fn(y,m,b,{nodeOrigin:p,nodeExtent:u,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:_}),B=M&&A;N&&I?(w(),h({nodes:y,nodesInitialized:I,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):h({nodes:y,nodesInitialized:I,nodesSelectionActive:B})},setEdges:y=>{const{connectionLookup:m,edgeLookup:b}=g();Ai(m,b,y),h({edges:y})},setDefaultNodesAndEdges:(y,m)=>{if(y){const{setNodes:b}=g();b(y),h({hasDefaultNodes:!0})}if(m){const{setEdges:b}=g();b(m),h({hasDefaultEdges:!0})}},updateNodeInternals:y=>{const{triggerNodeChanges:m,nodeLookup:b,parentLookup:p,domNode:v,nodeOrigin:N,nodeExtent:_,debug:M,fitViewQueued:I,zIndexMode:A}=g(),{changes:B,updatedInternals:z}=Bd(y,b,p,v,N,_,A);z&&(Hd(b,p,{nodeOrigin:N,nodeExtent:_,zIndexMode:A}),I?(w(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),B?.length>0&&(M&&console.log("React Flow: trigger node changes",B),m?.(B)))},updateNodePositions:(y,m=!1)=>{const b=[];let p=[];const{nodeLookup:v,triggerNodeChanges:N,connection:_,updateConnection:M,onNodesChangeMiddlewareMap:I}=g();for(const[A,B]of y){const z=v.get(A),L=!!(z?.expandParent&&z?.parentId&&B?.position),T={id:A,type:"position",position:L?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:m};if(z&&_.inProgress&&_.fromNode.id===z.id){const x=Ze(z,_.fromHandle,X.Left,!0);M({..._,from:x})}L&&z.parentId&&b.push({id:A,parentId:z.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),p.push(T)}if(b.length>0){const{parentLookup:A,nodeOrigin:B}=g(),z=co(b,v,A,B);p.push(...z)}for(const A of I.values())p=A(p);N(p)},triggerNodeChanges:y=>{const{onNodesChange:m,setNodes:b,nodes:p,hasDefaultNodes:v,debug:N}=g();if(y?.length){if(v){const _=Yi(y,p);b(_)}N&&console.log("React Flow: trigger node changes",y),m?.(y)}},triggerEdgeChanges:y=>{const{onEdgesChange:m,setEdges:b,edges:p,hasDefaultEdges:v,debug:N}=g();if(y?.length){if(v){const _=Xf(y,p);b(_)}N&&console.log("React Flow: trigger edge changes",y),m?.(y)}},addSelectedNodes:y=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:p,triggerNodeChanges:v,triggerEdgeChanges:N}=g();if(m){const _=y.map(M=>Le(M,!0));v(_);return}v(Ge(p,new Set([...y]),!0)),N(Ge(b))},addSelectedEdges:y=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:p,triggerNodeChanges:v,triggerEdgeChanges:N}=g();if(m){const _=y.map(M=>Le(M,!0));N(_);return}N(Ge(b,new Set([...y]))),v(Ge(p,new Set,!0))},unselectNodesAndEdges:({nodes:y,edges:m}={})=>{const{edges:b,nodes:p,nodeLookup:v,triggerNodeChanges:N,triggerEdgeChanges:_}=g(),M=y||p,I=m||b,A=[];for(const z of M){if(!z.selected)continue;const L=v.get(z.id);L&&(L.selected=!1),A.push(Le(z.id,!1))}const B=[];for(const z of I)z.selected&&B.push(Le(z.id,!1));N(A),_(B)},setMinZoom:y=>{const{panZoom:m,maxZoom:b}=g();m?.setScaleExtent([y,b]),h({minZoom:y})},setMaxZoom:y=>{const{panZoom:m,minZoom:b}=g();m?.setScaleExtent([b,y]),h({maxZoom:y})},setTranslateExtent:y=>{g().panZoom?.setTranslateExtent(y),h({translateExtent:y})},resetSelectedElements:()=>{const{edges:y,nodes:m,triggerNodeChanges:b,triggerEdgeChanges:p,elementsSelectable:v}=g();if(!v)return;const N=m.reduce((M,I)=>I.selected?[...M,Le(I.id,!1)]:M,[]),_=y.reduce((M,I)=>I.selected?[...M,Le(I.id,!1)]:M,[]);b(N),p(_)},setNodeExtent:y=>{const{nodes:m,nodeLookup:b,parentLookup:p,nodeOrigin:v,elevateNodesOnSelect:N,nodeExtent:_,zIndexMode:M}=g();y[0][0]===_[0][0]&&y[0][1]===_[0][1]&&y[1][0]===_[1][0]&&y[1][1]===_[1][1]||(Fn(m,b,p,{nodeOrigin:v,nodeExtent:y,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:M}),h({nodeExtent:y}))},panBy:y=>{const{transform:m,width:b,height:p,panZoom:v,translateExtent:N}=g();return jd({delta:y,panZoom:v,transform:m,translateExtent:N,width:b,height:p})},setCenter:async(y,m,b)=>{const{width:p,height:v,maxZoom:N,panZoom:_}=g();if(!_)return!1;const M=typeof b?.zoom<"u"?b.zoom:N;return await _.setViewport({x:p/2-y*M,y:v/2-m*M,zoom:M},{duration:b?.duration,ease:b?.ease,interpolate:b?.interpolate}),!0},cancelConnection:()=>{h({connection:{...di}})},updateConnection:y=>{h({connection:y})},reset:()=>h({...kr()})}},Object.is);function dg({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:l,fitView:d,nodeOrigin:c,nodeExtent:u,zIndexMode:f,children:h}){const[g]=$.useState(()=>ug({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:d,minZoom:s,maxZoom:a,fitViewOptions:l,nodeOrigin:c,nodeExtent:u,zIndexMode:f}));return C.jsx(Sf,{value:g,children:C.jsx(Gf,{children:C.jsx(uh,{children:h})})})}function fg({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:d,maxZoom:c,nodeOrigin:u,nodeExtent:f,zIndexMode:h}){return $.useContext(ln)?C.jsx(C.Fragment,{children:e}):C.jsx(dg,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:l,initialMinZoom:d,initialMaxZoom:c,nodeOrigin:u,nodeExtent:f,zIndexMode:h,children:e})}const hg={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function gg({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:l,onInit:d,onMove:c,onMoveStart:u,onMoveEnd:f,onConnect:h,onConnectStart:g,onConnectEnd:w,onClickConnectStart:y,onClickConnectEnd:m,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:v,onNodeContextMenu:N,onNodeDoubleClick:_,onNodeDragStart:M,onNodeDrag:I,onNodeDragStop:A,onNodesDelete:B,onEdgesDelete:z,onDelete:L,onSelectionChange:T,onSelectionDragStart:x,onSelectionDrag:E,onSelectionDragStop:S,onSelectionContextMenu:k,onSelectionStart:D,onSelectionEnd:P,onBeforeDelete:V,connectionMode:O,connectionLineType:H=ze.Bezier,connectionLineStyle:Y,connectionLineComponent:F,connectionLineContainerStyle:W,deleteKeyCode:Q="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:R=!1,selectionMode:j=wt.Full,panActivationKeyCode:U="Space",multiSelectionKeyCode:K=_t()?"Meta":"Control",zoomActivationKeyCode:Z=_t()?"Meta":"Control",snapToGrid:G,snapGrid:J,onlyRenderVisibleElements:te=!1,selectNodesOnDrag:oe,nodesDraggable:ae,autoPanOnNodeFocus:Se,nodesConnectable:xe,nodesFocusable:we,nodeOrigin:Ne=Fi,edgesFocusable:st,edgesReconnectable:Te,elementsSelectable:Re=!0,defaultViewport:de=Hf,minZoom:Ce=.5,maxZoom:Me=2,translateExtent:He=xt,preventScrolling:fn=!0,nodeExtent:hn,defaultMarkerColor:_s="#b1b1b7",zoomOnScroll:Es=!0,zoomOnPinch:Ss=!0,panOnScroll:Ns=!1,panOnScrollSpeed:Cs=.5,panOnScrollMode:Ms=Be.Free,zoomOnDoubleClick:ks=!0,panOnDrag:Is=!0,onPaneClick:As,onPaneMouseEnter:$s,onPaneMouseMove:Ps,onPaneMouseLeave:Ds,onPaneScroll:zs,onPaneContextMenu:Ts,paneClickDistance:Rs=1,nodeClickDistance:Hs=0,children:Ls,onReconnect:Os,onReconnectStart:Vs,onReconnectEnd:Bs,onEdgeContextMenu:js,onEdgeDoubleClick:Fs,onEdgeMouseEnter:Xs,onEdgeMouseMove:Ys,onEdgeMouseLeave:Zs,reconnectRadius:Ws=10,onNodesChange:qs,onEdgesChange:Gs,noDragClassName:Ks="nodrag",noWheelClassName:Us="nowheel",noPanClassName:fo="nopan",fitView:ho,fitViewOptions:go,connectOnClick:Qs,attributionPosition:Js,proOptions:ea,defaultEdgeOptions:ta,elevateNodesOnSelect:na=!0,elevateEdgesOnSelect:oa=!1,disableKeyboardA11y:po=!1,autoPanOnConnect:ra,autoPanOnNodeDrag:ia,autoPanOnSelection:sa=!0,autoPanSpeed:aa,connectionRadius:ca,isValidConnection:la,onError:ua,style:da,id:mo,nodeDragThreshold:fa,connectionDragThreshold:ha,viewport:ga,onViewportChange:pa,width:ma,height:ya,colorMode:xa="light",debug:wa,onScroll:yo,ariaLabelConfig:va,zIndexMode:xo="basic",...ba},_a){const gn=mo||"1",Ea=Bf(xa),Sa=$.useCallback(wo=>{wo.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),yo?.(wo)},[yo]);return C.jsx("div",{"data-testid":"rf__wrapper",...ba,onScroll:Sa,style:{...da,...hg},ref:_a,className:ie(["react-flow",r,Ea]),id:mo,role:"application",children:C.jsxs(fg,{nodes:e,edges:t,width:ma,height:ya,fitView:ho,fitViewOptions:go,minZoom:Ce,maxZoom:Me,nodeOrigin:Ne,nodeExtent:hn,zIndexMode:xo,children:[C.jsx(Vf,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:h,onConnectStart:g,onConnectEnd:w,onClickConnectStart:y,onClickConnectEnd:m,nodesDraggable:ae,autoPanOnNodeFocus:Se,nodesConnectable:xe,nodesFocusable:we,edgesFocusable:st,edgesReconnectable:Te,elementsSelectable:Re,elevateNodesOnSelect:na,elevateEdgesOnSelect:oa,minZoom:Ce,maxZoom:Me,nodeExtent:hn,onNodesChange:qs,onEdgesChange:Gs,snapToGrid:G,snapGrid:J,connectionMode:O,translateExtent:He,connectOnClick:Qs,defaultEdgeOptions:ta,fitView:ho,fitViewOptions:go,onNodesDelete:B,onEdgesDelete:z,onDelete:L,onNodeDragStart:M,onNodeDrag:I,onNodeDragStop:A,onSelectionDrag:E,onSelectionDragStart:x,onSelectionDragStop:S,onMove:c,onMoveStart:u,onMoveEnd:f,noPanClassName:fo,nodeOrigin:Ne,rfId:gn,autoPanOnConnect:ra,autoPanOnNodeDrag:ia,autoPanSpeed:aa,onError:ua,connectionRadius:ca,isValidConnection:la,selectNodesOnDrag:oe,nodeDragThreshold:fa,connectionDragThreshold:ha,onBeforeDelete:V,debug:wa,ariaLabelConfig:va,zIndexMode:xo}),C.jsx(cg,{onInit:d,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:v,onNodeContextMenu:N,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:s,connectionLineType:H,connectionLineStyle:Y,connectionLineComponent:F,connectionLineContainerStyle:W,selectionKeyCode:q,selectionOnDrag:R,selectionMode:j,deleteKeyCode:Q,multiSelectionKeyCode:K,panActivationKeyCode:U,zoomActivationKeyCode:Z,onlyRenderVisibleElements:te,defaultViewport:de,translateExtent:He,minZoom:Ce,maxZoom:Me,preventScrolling:fn,zoomOnScroll:Es,zoomOnPinch:Ss,zoomOnDoubleClick:ks,panOnScroll:Ns,panOnScrollSpeed:Cs,panOnScrollMode:Ms,panOnDrag:Is,autoPanOnSelection:sa,onPaneClick:As,onPaneMouseEnter:$s,onPaneMouseMove:Ps,onPaneMouseLeave:Ds,onPaneScroll:zs,onPaneContextMenu:Ts,paneClickDistance:Rs,nodeClickDistance:Hs,onSelectionContextMenu:k,onSelectionStart:D,onSelectionEnd:P,onReconnect:Os,onReconnectStart:Vs,onReconnectEnd:Bs,onEdgeContextMenu:js,onEdgeDoubleClick:Fs,onEdgeMouseEnter:Xs,onEdgeMouseMove:Ys,onEdgeMouseLeave:Zs,reconnectRadius:Ws,defaultMarkerColor:_s,noDragClassName:Ks,noWheelClassName:Us,noPanClassName:fo,rfId:gn,disableKeyboardA11y:po,nodeExtent:hn,viewport:ga,onViewportChange:pa,nodesDraggable:ae}),C.jsx(Rf,{onSelectionChange:T}),Ls,C.jsx($f,{proOptions:ea,position:Js}),C.jsx(Af,{rfId:gn,disableKeyboardA11y:po})]})})}var pg=Zi(gg);function mg(e){const[t,n]=$.useState(e),o=$.useCallback(r=>n(i=>Yi(r,i)),[]);return[t,n,o]}function yg({dimensions:e,lineWidth:t,variant:n,className:o}){return C.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ie(["react-flow__background-pattern",n,o])})}function xg({radius:e,className:t}){return C.jsx("circle",{cx:e,cy:e,r:e,className:ie(["react-flow__background-pattern","dots",t])})}var Ae;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ae||(Ae={}));const wg={[Ae.Dots]:1,[Ae.Lines]:1,[Ae.Cross]:6},vg=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function xs({id:e,variant:t=Ae.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:l,className:d,patternClassName:c}){const u=$.useRef(null),{transform:f,patternId:h}=ee(vg,re),g=o||wg[t],w=t===Ae.Dots,y=t===Ae.Cross,m=Array.isArray(n)?n:[n,n],b=[m[0]*f[2]||1,m[1]*f[2]||1],p=g*f[2],v=Array.isArray(i)?i:[i,i],N=y?[p,p]:b,_=[v[0]*f[2]||1+N[0]/2,v[1]*f[2]||1+N[1]/2],M=`${h}${e||""}`;return C.jsxs("svg",{className:ie(["react-flow__background",d]),style:{...l,...un,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:u,"data-testid":"rf__background",children:[C.jsx("pattern",{id:M,x:f[0]%b[0],y:f[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:w?C.jsx(xg,{radius:p/2,className:c}):C.jsx(yg,{dimensions:N,lineWidth:r,variant:t,className:c})}),C.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}xs.displayName="Background";const bg=$.memo(xs);function _g(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:C.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Eg(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:C.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Sg(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:C.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 Ng(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:C.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 Cg(){return C.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:C.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 Lt({children:e,className:t,...n}){return C.jsx("button",{type:"button",className:ie(["react-flow__controls-button",t]),...n,children:e})}const Mg=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ws({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:d,children:c,position:u="bottom-left",orientation:f="vertical","aria-label":h}){const g=ne(),{isInteractive:w,minZoomReached:y,maxZoomReached:m,ariaLabelConfig:b}=ee(Mg,re),{zoomIn:p,zoomOut:v,fitView:N}=lo(),_=()=>{p(),i?.()},M=()=>{v(),s?.()},I=()=>{N(r),a?.()},A=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),l?.(!w)},B=f==="horizontal"?"horizontal":"vertical";return C.jsxs(rt,{className:ie(["react-flow__controls",B,d]),position:u,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&C.jsxs(C.Fragment,{children:[C.jsx(Lt,{onClick:_,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:m,children:C.jsx(_g,{})}),C.jsx(Lt,{onClick:M,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:y,children:C.jsx(Eg,{})})]}),n&&C.jsx(Lt,{className:"react-flow__controls-fitview",onClick:I,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:C.jsx(Sg,{})}),o&&C.jsx(Lt,{className:"react-flow__controls-interactive",onClick:A,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:w?C.jsx(Cg,{}):C.jsx(Ng,{})}),c]})}ws.displayName="Controls";const kg=$.memo(ws);function Ig({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:d,borderRadius:c,shapeRendering:u,selected:f,onClick:h}){const{background:g,backgroundColor:w}=i||{},y=s||g||w;return C.jsx("rect",{className:ie(["react-flow__minimap-node",{selected:f},d]),x:t,y:n,rx:c,ry:c,width:o,height:r,style:{fill:y,stroke:a,strokeWidth:l},shapeRendering:u,onClick:h?m=>h(m,e):void 0})}const Ag=$.memo(Ig),$g=e=>e.nodes.map(t=>t.id),Mn=e=>e instanceof Function?e:()=>e;function Pg({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=Ag,onClick:s}){const a=ee($g,re),l=Mn(t),d=Mn(e),c=Mn(n),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return C.jsx(C.Fragment,{children:a.map(f=>C.jsx(zg,{id:f,nodeColorFunc:l,nodeStrokeColorFunc:d,nodeClassNameFunc:c,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:u},f))})}function Dg({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:d,x:c,y:u,width:f,height:h}=ee(g=>{const w=g.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const y=w.internals.userNode,{x:m,y:b}=w.internals.positionAbsolute,{width:p,height:v}=Ee(y);return{node:y,x:m,y:b,width:p,height:v}},re);return!d||d.hidden||!wi(d)?null:C.jsx(a,{x:c,y:u,width:f,height:h,style:d.style,selected:!!d.selected,className:o(d),color:t(d),borderRadius:r,strokeColor:n(d),strokeWidth:i,shapeRendering:s,onClick:l,id:d.id})}const zg=$.memo(Dg);var Tg=$.memo(Pg);const Rg=200,Hg=150,Lg=e=>!e.hidden,Og=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?mi(Mt(e.nodeLookup,{filter:Lg}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Ir=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Vg=(e,t)=>Ir(e.viewBB,t.viewBB)&&Ir(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,Bg="react-flow__minimap-desc";function vs({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:l,maskColor:d,maskStrokeColor:c,maskStrokeWidth:u,position:f="bottom-right",onClick:h,onNodeClick:g,pannable:w=!1,zoomable:y=!1,ariaLabel:m,inversePan:b,zoomStep:p=1,offsetScale:v=5}){const N=ne(),_=$.useRef(null),{boundingRect:M,viewBB:I,rfId:A,panZoom:B,translateExtent:z,flowWidth:L,flowHeight:T,ariaLabelConfig:x}=ee(Og,Vg),E=e?.width??Rg,S=e?.height??Hg,k=M.width/E,D=M.height/S,P=Math.max(k,D),V=P*E,O=P*S,H=v*P,Y=M.x-(V-M.width)/2-H,F=M.y-(O-M.height)/2-H,W=V+H*2,Q=O+H*2,q=`${Bg}-${A}`,R=$.useRef(0),j=$.useRef();R.current=P,$.useEffect(()=>{if(_.current&&B)return j.current=Ud({domNode:_.current,panZoom:B,getTransform:()=>N.getState().transform,getViewScale:()=>R.current}),()=>{j.current?.destroy()}},[B]),$.useEffect(()=>{j.current?.update({translateExtent:z,width:L,height:T,inversePan:b,pannable:w,zoomStep:p,zoomable:y})},[w,y,b,p,z,L,T]);const U=h?G=>{const[J,te]=j.current?.pointer(G)||[0,0];h(G,{x:J,y:te})}:void 0,K=g?$.useCallback((G,J)=>{const te=N.getState().nodeLookup.get(J).internals.userNode;g(G,te)},[]):void 0,Z=m??x["minimap.ariaLabel"];return C.jsx(rt,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*P:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ie(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:C.jsxs("svg",{width:E,height:S,viewBox:`${Y} ${F} ${W} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":q,ref:_,onClick:U,children:[Z&&C.jsx("title",{id:q,children:Z}),C.jsx(Tg,{onClick:K,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),C.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-H},${F-H}h${W+H*2}v${Q+H*2}h${-W-H*2}z
|
|
7
|
+
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}vs.displayName="MiniMap";const jg=$.memo(vs),Fg=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Xg={[ot.Line]:"right",[ot.Handle]:"bottom-right"};function Yg({nodeId:e,position:t,variant:n=ot.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:d=Number.MAX_VALUE,maxHeight:c=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:f,autoScale:h=!0,shouldResize:g,onResizeStart:w,onResize:y,onResizeEnd:m}){const b=Ui(),p=typeof e=="string"?e:b,v=ne(),N=$.useRef(null),_=n===ot.Handle,M=ee($.useCallback(Fg(_&&h),[_,h]),re),I=$.useRef(null),A=t??Xg[n];$.useEffect(()=>{if(!(!N.current||!p))return I.current||(I.current=df({domNode:N.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:z,transform:L,snapGrid:T,snapToGrid:x,nodeOrigin:E,domNode:S}=v.getState();return{nodeLookup:z,transform:L,snapGrid:T,snapToGrid:x,nodeOrigin:E,paneDomNode:S}},onChange:(z,L)=>{const{triggerNodeChanges:T,nodeLookup:x,parentLookup:E,nodeOrigin:S}=v.getState(),k=[],D={x:z.x,y:z.y},P=x.get(p);if(P&&P.expandParent&&P.parentId){const V=P.origin??S,O=z.width??P.measured.width??0,H=z.height??P.measured.height??0,Y={id:P.id,parentId:P.parentId,rect:{width:O,height:H,...vi({x:z.x??P.position.x,y:z.y??P.position.y},{width:O,height:H},P.parentId,x,V)}},F=co([Y],x,E,S);k.push(...F),D.x=z.x?Math.max(V[0]*O,z.x):void 0,D.y=z.y?Math.max(V[1]*H,z.y):void 0}if(D.x!==void 0&&D.y!==void 0){const V={id:p,type:"position",position:{...D}};k.push(V)}if(z.width!==void 0&&z.height!==void 0){const O={id:p,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:z.width,height:z.height}};k.push(O)}for(const V of L){const O={...V,type:"position"};k.push(O)}T(k)},onEnd:({width:z,height:L})=>{const T={id:p,type:"dimensions",resizing:!1,dimensions:{width:z,height:L}};v.getState().triggerNodeChanges([T])}})),I.current.update({controlPosition:A,boundaries:{minWidth:a,minHeight:l,maxWidth:d,maxHeight:c},keepAspectRatio:u,resizeDirection:f,onResizeStart:w,onResize:y,onResizeEnd:m,shouldResize:g}),()=>{I.current?.destroy()}},[A,a,l,d,c,u,w,y,m,g]);const B=A.split("-");return C.jsx("div",{className:ie(["react-flow__resize-control","nodrag",...B,n,o]),ref:N,style:{...r,scale:M,...s&&{[_?"backgroundColor":"borderColor"]:s}},children:i})}$.memo(Yg);const kn=168,In=48,Ar=72,Zg=["project","service","file","incident","session","note"];function se(e){return`${e.kind}:${e.id}`}function sp({graph:e,items:t,onSelect:n,selected:o}){const r=ka(),i=$.useMemo(()=>Wg(e,t),[e,t]),s=$.useMemo(()=>qg(e,o),[e,o?.kind,o?.id]),[a,l,d]=mg(i);return $.useEffect(()=>l(i),[i,l]),$.useEffect(()=>{const c=o?se(o):null;l(u=>u.map(f=>({...f,selected:f.id===c})))},[o,l]),e.nodes.length?C.jsx("div",{className:"context-flow h-full min-h-[320px] overflow-hidden border-y border-border bg-background",children:C.jsxs(pg,{"aria-label":r("context.graphAria"),defaultEdgeOptions:{type:"straight"},edges:s,elevateEdgesOnSelect:!0,fitView:!0,fitViewOptions:{padding:.24,maxZoom:1.2},maxZoom:1.8,minZoom:.22,nodeTypes:Gg,nodes:a,nodesConnectable:!1,nodesFocusable:!0,onNodeClick:(c,u)=>n(u.data.item),onNodesChange:d,onlyRenderVisibleElements:!0,panOnScroll:!0,proOptions:{hideAttribution:!0},selectionOnDrag:!0,zoomOnDoubleClick:!1,children:[C.jsx(bg,{color:"hsl(var(--border) / 0.55)",gap:28,size:1,variant:Ae.Cross}),C.jsx(kg,{fitViewOptions:{padding:.2},position:"bottom-left",showInteractive:!1}),a.length>10?C.jsx(jg,{ariaLabel:r("context.graphMinimap"),maskColor:"hsl(var(--background) / 0.72)",nodeColor:c=>ep(c.data.item.kind),pannable:!0,position:"bottom-right",zoomable:!0}):null,C.jsx(rt,{className:"context-flow-panel",position:"top-left",children:C.jsx("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1",children:Zg.filter(c=>a.some(u=>u.data.item.kind===c)).map(c=>C.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] text-muted-foreground",children:[C.jsx("span",{className:lt("size-2 border border-muted-foreground/70",bs(c))}),c]},c))})}),C.jsx(rt,{className:"context-flow-panel",position:"top-right",children:C.jsxs("span",{className:"font-mono text-[9px] tabular-nums text-muted-foreground",children:[r("context.graphSummary",{nodes:e.nodes.length,edges:e.edges.length}),e.truncated?` · ${r("context.graphTruncated")}`:""]})})]})}):C.jsx("div",{className:"grid h-full place-items-center text-xs text-muted-foreground",children:r("context.noMatches")})}function Wg(e,t){const n=new Map(t.map(c=>[se(c.ref),c])),o=e.nodes.flatMap(c=>{const u=n.get(se(c.ref));return u?[{node:c,item:u}]:[]});if(!o.length)return[];const r=new Map(o.map((c,u)=>[se(c.node.ref),u])),i=Math.max(180,Math.sqrt(o.length)*92),s=o.map((c,u)=>{const f=An(se(c.node.ref))*Math.PI*2,h=tp(c.node.kind),g=u*.61803398875%1*.18;return{x:Math.cos(f)*i*(h+g),y:Math.sin(f)*i*(h+g),vx:0,vy:0}}),a=e.edges.flatMap(c=>{const u=r.get(se(c.from)),f=r.get(se(c.to));return u===void 0||f===void 0?[]:[{source:u,target:f,type:c.type}]});for(let c=0;c<180;c+=1){for(let u=0;u<s.length;u+=1)for(let f=u+1;f<s.length;f+=1){const h=s[u],g=s[f];let w=h.x-g.x,y=h.y-g.y;w===0&&y===0&&(w=An(`${u}:${f}`)-.5,y=An(`${f}:${u}`)-.5);const m=Math.max(16,w*w+y*y),b=Math.sqrt(m),p=Math.max(0,132-b)*.035,v=Math.min(4.5,12e3/m)+p,N=w/b*v,_=y/b*v;h.vx+=N,h.vy+=_,g.vx-=N,g.vy-=_}for(const u of a){const f=s[u.source],h=s[u.target],g=h.x-f.x,w=h.y-f.y,y=Math.max(1,Math.sqrt(g*g+w*w)),m=$n((y-np(u.type))*.018,-1.8,2.8),b=g/y*m,p=w/y*m;f.vx+=b,f.vy+=p,h.vx-=b,h.vy-=p}for(let u=0;u<s.length;u+=1){const f=s[u],h=o[u].node.kind==="project"?.012:.004;f.vx-=f.x*h,f.vy-=f.y*h,f.vx=$n(f.vx*.76,-9,9),f.vy=$n(f.vy*.76,-9,9),f.x+=f.vx,f.y+=f.vy}}rp(s);const l=Math.min(...s.map(c=>c.x-kn/2)),d=Math.min(...s.map(c=>c.y-In/2));return o.map((c,u)=>{const f=s[u];return{id:se(c.node.ref),type:"context",position:{x:$r(f.x-kn/2-l+Ar),y:$r(f.y-In/2-d+Ar)},data:{item:c.item,label:c.node.title},width:kn,height:In}})}function qg(e,t){const n=t?se(t):null;return e.edges.map(o=>({id:`${se(o.from)}>${se(o.to)}:${o.type}`,source:se(o.from),target:se(o.to),type:"straight",ariaLabel:o.type,markerEnd:{type:vt.ArrowClosed,width:9,height:9},style:{stroke:n&&(se(o.from)===n||se(o.to)===n)?"hsl(var(--foreground))":"hsl(var(--border))",strokeDasharray:op(o.type),strokeWidth:n&&(se(o.from)===n||se(o.to)===n)?1.5:1,opacity:n&&se(o.from)!==n&&se(o.to)!==n?.35:.9}}))}const Gg={context:Kg};function Kg({data:e,selected:t}){const{item:n,label:o}=e,r=Ug(n.kind);return C.jsxs("div",{className:lt("group flex h-12 w-[168px] items-center gap-2 text-foreground",t&&"z-10"),title:`${o} · ${n.kind}`,children:[C.jsx(it,{className:"!size-1 !border-0 !bg-transparent",position:X.Left,type:"target"}),C.jsx("span",{className:lt("grid size-8 shrink-0 place-items-center border bg-background transition-colors",bs(n.kind),t?"border-foreground bg-foreground text-background":Qg(n.kind)),children:C.jsx(r,{"aria-hidden":"true",className:lt("size-3.5",Jg(n.kind))})}),C.jsxs("span",{className:lt("min-w-0 flex-1 border-l pl-2",t?"border-foreground":"border-border"),children:[C.jsx("span",{className:"block truncate text-[11px] font-medium leading-tight",children:o}),C.jsx("span",{className:"mt-0.5 block truncate text-[9px] text-muted-foreground",children:n.kind})]}),n.pinned?C.jsx(za,{"aria-label":"Pinned",className:"size-3 shrink-0 text-muted-foreground"}):null,C.jsx(it,{className:"!size-1 !border-0 !bg-transparent",position:X.Right,type:"source"})]})}function Ug(e){return{note:vo,project:Pa,service:$a,file:vo,incident:Aa,session:Ia}[e]}function bs(e){return{project:"rotate-45 rounded-[2px]",service:"rounded-full",file:"rounded-[2px]",incident:"rotate-45 rounded-full",session:"rounded-full border-dashed",note:"rotate-45 rounded-[2px] border-dashed"}[e]}function Qg(e){return{note:"border-muted-foreground/60 text-muted-foreground",project:"border-foreground text-foreground",service:"border-muted-foreground text-foreground",file:"border-border text-muted-foreground",incident:"border-red-500 text-red-600 dark:text-red-400",session:"border-muted-foreground/70 text-muted-foreground"}[e]}function Jg(e){return e==="project"||e==="note"||e==="incident"?"-rotate-45":""}function ep(e){return{note:"hsl(var(--muted-foreground))",project:"hsl(var(--foreground))",service:"hsl(var(--muted-foreground))",file:"hsl(var(--border))",incident:"#ef4444",session:"hsl(var(--muted-foreground))"}[e]}function tp(e){return{project:.18,service:.48,incident:.68,session:.72,note:.84,file:1}[e]}function np(e){return{wiki:145,"belongs-to":175,mentions:160,"depends-on":140}[e]}function op(e){return{wiki:"4 4","belongs-to":void 0,mentions:"2 5","depends-on":void 0}[e]}function An(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0)/4294967295}function $n(e,t,n){return Math.max(t,Math.min(n,e))}function $r(e){return Math.round(e*10)/10}function rp(e){const t=Math.min(...e.map(h=>h.x)),n=Math.max(...e.map(h=>h.x)),o=Math.min(...e.map(h=>h.y)),r=Math.max(...e.map(h=>h.y)),i=Math.max(1,n-t),s=Math.max(1,r-o),a=(t+n)/2,l=(o+r)/2,d=1.35,c=i/s,u=c<1/d?Math.min(3,s/d/i):1,f=c>d?Math.min(3,i/d/s):1;for(const h of e)h.x=a+(h.x-a)*u,h.y=l+(h.y-l)*f}export{sp as ContextGraph,Wg as layoutContextNodes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(n,e,i,s){if(typeof e=="function"?n!==e||!s:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?s:i==="a"?s.call(n):s?s.value:e.get(n)}function c(n,e,i,s,_){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,i),i}var a,r,o,l,u;const d="__TAURI_TO_IPC_KEY__";function w(n,e=!1){return window.__TAURI_INTERNALS__.transformCallback(n,e)}class g{constructor(e){a.set(this,void 0),r.set(this,0),o.set(this,[]),l.set(this,void 0),c(this,a,e||(()=>{})),this.id=w(i=>{const s=i.index;if("end"in i){s==t(this,r,"f")?this.cleanupCallback():c(this,l,s);return}const _=i.message;if(s==t(this,r,"f")){for(t(this,a,"f").call(this,_),c(this,r,t(this,r,"f")+1);t(this,r,"f")in t(this,o,"f");){const p=t(this,o,"f")[t(this,r,"f")];t(this,a,"f").call(this,p),delete t(this,o,"f")[t(this,r,"f")],c(this,r,t(this,r,"f")+1)}t(this,r,"f")===t(this,l,"f")&&this.cleanupCallback()}else t(this,o,"f")[s]=_})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(e){c(this,a,e)}get onmessage(){return t(this,a,"f")}[(a=new WeakMap,r=new WeakMap,o=new WeakMap,l=new WeakMap,d)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[d]()}}class f{constructor(e,i,s){this.plugin=e,this.event=i,this.channelId=s}async unregister(){return h(`plugin:${this.plugin}|remove_listener`,{event:this.event,channelId:this.channelId})}}async function m(n,e,i){const s=new g(i);try{return await h(`plugin:${n}|register_listener`,{event:e,handler:s}),new f(n,e,s.id)}catch{return await h(`plugin:${n}|registerListener`,{event:e,handler:s}),new f(n,e,s.id)}}async function I(n){return h(`plugin:${n}|check_permissions`)}async function C(n){return h(`plugin:${n}|request_permissions`)}async function h(n,e={},i){return window.__TAURI_INTERNALS__.invoke(n,e,i)}function T(n,e="asset"){return window.__TAURI_INTERNALS__.convertFileSrc(n,e)}class k{get rid(){return t(this,u,"f")}constructor(e){u.set(this,void 0),c(this,u,e)}async close(){return h("plugin:resources|close",{rid:this.rid})}}u=new WeakMap;function E(){return!!(globalThis||window).isTauri}export{g as Channel,f as PluginListener,k as Resource,d as SERIALIZE_TO_IPC_FN,m as addPluginListener,I as checkPermissions,T as convertFileSrc,h as invoke,E as isTauri,C as requestPermissions,w as transformCallback};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{invoke as n,transformCallback as d}from"./core-DhEqZVGG.js";var i;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WINDOW_SUSPENDED="tauri://suspended",e.WINDOW_RESUMED="tauri://resumed",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(i||(i={}));async function _(e,r){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,r),await n("plugin:event|unlisten",{event:e,eventId:r})}async function u(e,r,t){var a;const l=typeof t?.target=="string"?{kind:"AnyLabel",label:t.target}:(a=t?.target)!==null&&a!==void 0?a:{kind:"Any"};return n("plugin:event|listen",{event:e,target:l,handler:d(r)}).then(D=>async()=>_(e,D))}async function c(e,r,t){return u(e,a=>{_(e,a.id),r(a)},t)}async function o(e,r){await n("plugin:event|emit",{event:e,payload:r})}async function s(e,r,t){await n("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:r,payload:t})}export{i as TauriEvent,o as emit,s as emitTo,u as listen,c as once};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{invoke as a}from"./core-DhEqZVGG.js";async function t(e={}){return typeof e=="object"&&Object.freeze(e),await a("plugin:dialog|save",{options:e})}export{t as save};
|