@barefootjs/xyflow 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{createSignal as d,createEffect as o7,createMemo as e7,untrack as Q0}from"@barefootjs/client";var d6={value:()=>{}};function G9(){for(var f=0,_=arguments.length,Q={},J;f<_;++f){if(!(J=arguments[f]+"")||J in Q||/[\s.]/.test(J))throw Error("illegal type: "+J);Q[J]=[]}return new mf(Q)}function mf(f){this._=f}function t6(f,_){return f.trim().split(/^|\s+/).map(function(Q){var J="",$=Q.indexOf(".");if($>=0)J=Q.slice($+1),Q=Q.slice(0,$);if(Q&&!_.hasOwnProperty(Q))throw Error("unknown type: "+Q);return{type:Q,name:J}})}mf.prototype=G9.prototype={constructor:mf,on:function(f,_){var Q=this._,J=t6(f+"",Q),$,q=-1,F=J.length;if(arguments.length<2){while(++q<F)if(($=(f=J[q]).type)&&($=n6(Q[$],f.name)))return $;return}if(_!=null&&typeof _!=="function")throw Error("invalid callback: "+_);while(++q<F)if($=(f=J[q]).type)Q[$]=W9(Q[$],f.name,_);else if(_==null)for($ in Q)Q[$]=W9(Q[$],f.name,null);return this},copy:function(){var f={},_=this._;for(var Q in _)f[Q]=_[Q].slice();return new mf(f)},call:function(f,_){if(($=arguments.length-2)>0)for(var Q=Array($),J=0,$,q;J<$;++J)Q[J]=arguments[J+2];if(!this._.hasOwnProperty(f))throw Error("unknown type: "+f);for(q=this._[f],J=0,$=q.length;J<$;++J)q[J].value.apply(_,Q)},apply:function(f,_,Q){if(!this._.hasOwnProperty(f))throw Error("unknown type: "+f);for(var J=this._[f],$=0,q=J.length;$<q;++$)J[$].value.apply(_,Q)}};function n6(f,_){for(var Q=0,J=f.length,$;Q<J;++Q)if(($=f[Q]).name===_)return $.value}function W9(f,_,Q){for(var J=0,$=f.length;J<$;++J)if(f[J].name===_){f[J]=d6,f=f.slice(0,J).concat(f.slice(J+1));break}if(Q!=null)f.push({name:_,value:Q});return f}var N0=G9;var gf="http://www.w3.org/1999/xhtml",L_={svg:"http://www.w3.org/2000/svg",xhtml:gf,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function M0(f){var _=f+="",Q=_.indexOf(":");if(Q>=0&&(_=f.slice(0,Q))!=="xmlns")f=f.slice(Q+1);return L_.hasOwnProperty(_)?{space:L_[_],local:f}:f}function o6(f){return function(){var _=this.ownerDocument,Q=this.namespaceURI;return Q===gf&&_.documentElement.namespaceURI===gf?_.createElement(f):_.createElementNS(Q,f)}}function e6(f){return function(){return this.ownerDocument.createElementNS(f.space,f.local)}}function Wf(f){var _=M0(f);return(_.local?e6:o6)(_)}function f8(){}function z0(f){return f==null?f8:function(){return this.querySelector(f)}}function w_(f){if(typeof f!=="function")f=z0(f);for(var _=this._groups,Q=_.length,J=Array(Q),$=0;$<Q;++$)for(var q=_[$],F=q.length,K=J[$]=Array(F),A,U,W=0;W<F;++W)if((A=q[W])&&(U=f.call(A,A.__data__,W,q))){if("__data__"in A)U.__data__=A.__data__;K[W]=U}return new s(J,this._parents)}function T_(f){return f==null?[]:Array.isArray(f)?f:Array.from(f)}function _8(){return[]}function d0(f){return f==null?_8:function(){return this.querySelectorAll(f)}}function Q8(f){return function(){return T_(f.apply(this,arguments))}}function O_(f){if(typeof f==="function")f=Q8(f);else f=d0(f);for(var _=this._groups,Q=_.length,J=[],$=[],q=0;q<Q;++q)for(var F=_[q],K=F.length,A,U=0;U<K;++U)if(A=F[U])J.push(f.call(A,A.__data__,U,F)),$.push(A);return new s(J,$)}function t0(f){return function(){return this.matches(f)}}function pf(f){return function(_){return _.matches(f)}}var J8=Array.prototype.find;function $8(f){return function(){return J8.call(this.children,f)}}function q8(){return this.firstElementChild}function R_(f){return this.select(f==null?q8:$8(typeof f==="function"?f:pf(f)))}var F8=Array.prototype.filter;function K8(){return Array.from(this.children)}function U8(f){return function(){return F8.call(this.children,f)}}function z_(f){return this.selectAll(f==null?K8:U8(typeof f==="function"?f:pf(f)))}function H_(f){if(typeof f!=="function")f=t0(f);for(var _=this._groups,Q=_.length,J=Array(Q),$=0;$<Q;++$)for(var q=_[$],F=q.length,K=J[$]=[],A,U=0;U<F;++U)if((A=q[U])&&f.call(A,A.__data__,U,q))K.push(A);return new s(J,this._parents)}function Gf(f){return Array(f.length)}function D_(){return new s(this._enter||this._groups.map(Gf),this._parents)}function Bf(f,_){this.ownerDocument=f.ownerDocument,this.namespaceURI=f.namespaceURI,this._next=null,this._parent=f,this.__data__=_}Bf.prototype={constructor:Bf,appendChild:function(f){return this._parent.insertBefore(f,this._next)},insertBefore:function(f,_){return this._parent.insertBefore(f,_)},querySelector:function(f){return this._parent.querySelector(f)},querySelectorAll:function(f){return this._parent.querySelectorAll(f)}};function C_(f){return function(){return f}}function A8(f,_,Q,J,$,q){var F=0,K,A=_.length,U=q.length;for(;F<U;++F)if(K=_[F])K.__data__=q[F],J[F]=K;else Q[F]=new Bf(f,q[F]);for(;F<A;++F)if(K=_[F])$[F]=K}function W8(f,_,Q,J,$,q,F){var K,A,U=new Map,W=_.length,G=q.length,j=Array(W),M;for(K=0;K<W;++K)if(A=_[K])if(j[K]=M=F.call(A,A.__data__,K,_)+"",U.has(M))$[K]=A;else U.set(M,A);for(K=0;K<G;++K)if(M=F.call(f,q[K],K,q)+"",A=U.get(M))J[K]=A,A.__data__=q[K],U.delete(M);else Q[K]=new Bf(f,q[K]);for(K=0;K<W;++K)if((A=_[K])&&U.get(j[K])===A)$[K]=A}function G8(f){return f.__data__}function I_(f,_){if(!arguments.length)return Array.from(this,G8);var Q=_?W8:A8,J=this._parents,$=this._groups;if(typeof f!=="function")f=C_(f);for(var q=$.length,F=Array(q),K=Array(q),A=Array(q),U=0;U<q;++U){var W=J[U],G=$[U],j=G.length,M=B8(f.call(W,W&&W.__data__,U,J)),Y=M.length,w=K[U]=Array(Y),L=F[U]=Array(Y),Z=A[U]=Array(j);Q(W,G,w,L,Z,M,_);for(var C=0,H=0,X,S;C<Y;++C)if(X=w[C]){if(C>=H)H=C+1;while(!(S=L[H])&&++H<Y);X._next=S||null}}return F=new s(F,J),F._enter=K,F._exit=A,F}function B8(f){return typeof f==="object"&&"length"in f?f:Array.from(f)}function S_(){return new s(this._exit||this._groups.map(Gf),this._parents)}function E_(f,_,Q){var J=this.enter(),$=this,q=this.exit();if(typeof f==="function"){if(J=f(J),J)J=J.selection()}else J=J.append(f+"");if(_!=null){if($=_($),$)$=$.selection()}if(Q==null)q.remove();else Q(q);return J&&$?J.merge($).order():$}function y_(f){var _=f.selection?f.selection():f;for(var Q=this._groups,J=_._groups,$=Q.length,q=J.length,F=Math.min($,q),K=Array($),A=0;A<F;++A)for(var U=Q[A],W=J[A],G=U.length,j=K[A]=Array(G),M,Y=0;Y<G;++Y)if(M=U[Y]||W[Y])j[Y]=M;for(;A<$;++A)K[A]=Q[A];return new s(K,this._parents)}function N_(){for(var f=this._groups,_=-1,Q=f.length;++_<Q;)for(var J=f[_],$=J.length-1,q=J[$],F;--$>=0;)if(F=J[$]){if(q&&F.compareDocumentPosition(q)^4)q.parentNode.insertBefore(F,q);q=F}return this}function u_(f){if(!f)f=j8;function _(G,j){return G&&j?f(G.__data__,j.__data__):!G-!j}for(var Q=this._groups,J=Q.length,$=Array(J),q=0;q<J;++q){for(var F=Q[q],K=F.length,A=$[q]=Array(K),U,W=0;W<K;++W)if(U=F[W])A[W]=U;A.sort(_)}return new s($,this._parents).order()}function j8(f,_){return f<_?-1:f>_?1:f>=_?0:NaN}function b_(){var f=arguments[0];return arguments[0]=this,f.apply(null,arguments),this}function x_(){return Array.from(this)}function k_(){for(var f=this._groups,_=0,Q=f.length;_<Q;++_)for(var J=f[_],$=0,q=J.length;$<q;++$){var F=J[$];if(F)return F}return null}function P_(){let f=0;for(let _ of this)++f;return f}function h_(){return!this.node()}function v_(f){for(var _=this._groups,Q=0,J=_.length;Q<J;++Q)for(var $=_[Q],q=0,F=$.length,K;q<F;++q)if(K=$[q])f.call(K,K.__data__,q,$);return this}function M8(f){return function(){this.removeAttribute(f)}}function Z8(f){return function(){this.removeAttributeNS(f.space,f.local)}}function V8(f,_){return function(){this.setAttribute(f,_)}}function Y8(f,_){return function(){this.setAttributeNS(f.space,f.local,_)}}function X8(f,_){return function(){var Q=_.apply(this,arguments);if(Q==null)this.removeAttribute(f);else this.setAttribute(f,Q)}}function L8(f,_){return function(){var Q=_.apply(this,arguments);if(Q==null)this.removeAttributeNS(f.space,f.local);else this.setAttributeNS(f.space,f.local,Q)}}function m_(f,_){var Q=M0(f);if(arguments.length<2){var J=this.node();return Q.local?J.getAttributeNS(Q.space,Q.local):J.getAttribute(Q)}return this.each((_==null?Q.local?Z8:M8:typeof _==="function"?Q.local?L8:X8:Q.local?Y8:V8)(Q,_))}function jf(f){return f.ownerDocument&&f.ownerDocument.defaultView||f.document&&f||f.defaultView}function w8(f){return function(){this.style.removeProperty(f)}}function T8(f,_,Q){return function(){this.style.setProperty(f,_,Q)}}function O8(f,_,Q){return function(){var J=_.apply(this,arguments);if(J==null)this.style.removeProperty(f);else this.style.setProperty(f,J,Q)}}function g_(f,_,Q){return arguments.length>1?this.each((_==null?w8:typeof _==="function"?O8:T8)(f,_,Q==null?"":Q)):H0(this.node(),f)}function H0(f,_){return f.style.getPropertyValue(_)||jf(f).getComputedStyle(f,null).getPropertyValue(_)}function R8(f){return function(){delete this[f]}}function z8(f,_){return function(){this[f]=_}}function H8(f,_){return function(){var Q=_.apply(this,arguments);if(Q==null)delete this[f];else this[f]=Q}}function p_(f,_){return arguments.length>1?this.each((_==null?R8:typeof _==="function"?H8:z8)(f,_)):this.node()[f]}function B9(f){return f.trim().split(/^|\s+/)}function c_(f){return f.classList||new j9(f)}function j9(f){this._node=f,this._names=B9(f.getAttribute("class")||"")}j9.prototype={add:function(f){var _=this._names.indexOf(f);if(_<0)this._names.push(f),this._node.setAttribute("class",this._names.join(" "))},remove:function(f){var _=this._names.indexOf(f);if(_>=0)this._names.splice(_,1),this._node.setAttribute("class",this._names.join(" "))},contains:function(f){return this._names.indexOf(f)>=0}};function M9(f,_){var Q=c_(f),J=-1,$=_.length;while(++J<$)Q.add(_[J])}function Z9(f,_){var Q=c_(f),J=-1,$=_.length;while(++J<$)Q.remove(_[J])}function D8(f){return function(){M9(this,f)}}function C8(f){return function(){Z9(this,f)}}function I8(f,_){return function(){(_.apply(this,arguments)?M9:Z9)(this,f)}}function l_(f,_){var Q=B9(f+"");if(arguments.length<2){var J=c_(this.node()),$=-1,q=Q.length;while(++$<q)if(!J.contains(Q[$]))return!1;return!0}return this.each((typeof _==="function"?I8:_?D8:C8)(Q,_))}function S8(){this.textContent=""}function E8(f){return function(){this.textContent=f}}function y8(f){return function(){var _=f.apply(this,arguments);this.textContent=_==null?"":_}}function r_(f){return arguments.length?this.each(f==null?S8:(typeof f==="function"?y8:E8)(f)):this.node().textContent}function N8(){this.innerHTML=""}function u8(f){return function(){this.innerHTML=f}}function b8(f){return function(){var _=f.apply(this,arguments);this.innerHTML=_==null?"":_}}function i_(f){return arguments.length?this.each(f==null?N8:(typeof f==="function"?b8:u8)(f)):this.node().innerHTML}function x8(){if(this.nextSibling)this.parentNode.appendChild(this)}function s_(){return this.each(x8)}function k8(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function a_(){return this.each(k8)}function d_(f){var _=typeof f==="function"?f:Wf(f);return this.select(function(){return this.appendChild(_.apply(this,arguments))})}function P8(){return null}function t_(f,_){var Q=typeof f==="function"?f:Wf(f),J=_==null?P8:typeof _==="function"?_:z0(_);return this.select(function(){return this.insertBefore(Q.apply(this,arguments),J.apply(this,arguments)||null)})}function h8(){var f=this.parentNode;if(f)f.removeChild(this)}function n_(){return this.each(h8)}function v8(){var f=this.cloneNode(!1),_=this.parentNode;return _?_.insertBefore(f,this.nextSibling):f}function m8(){var f=this.cloneNode(!0),_=this.parentNode;return _?_.insertBefore(f,this.nextSibling):f}function o_(f){return this.select(f?m8:v8)}function e_(f){return arguments.length?this.property("__data__",f):this.node().__data__}function g8(f){return function(_){f.call(this,_,this.__data__)}}function p8(f){return f.trim().split(/^|\s+/).map(function(_){var Q="",J=_.indexOf(".");if(J>=0)Q=_.slice(J+1),_=_.slice(0,J);return{type:_,name:Q}})}function c8(f){return function(){var _=this.__on;if(!_)return;for(var Q=0,J=-1,$=_.length,q;Q<$;++Q)if(q=_[Q],(!f.type||q.type===f.type)&&q.name===f.name)this.removeEventListener(q.type,q.listener,q.options);else _[++J]=q;if(++J)_.length=J;else delete this.__on}}function l8(f,_,Q){return function(){var J=this.__on,$,q=g8(_);if(J){for(var F=0,K=J.length;F<K;++F)if(($=J[F]).type===f.type&&$.name===f.name){this.removeEventListener($.type,$.listener,$.options),this.addEventListener($.type,$.listener=q,$.options=Q),$.value=_;return}}if(this.addEventListener(f.type,q,Q),$={type:f.type,name:f.name,value:_,listener:q,options:Q},!J)this.__on=[$];else J.push($)}}function fQ(f,_,Q){var J=p8(f+""),$,q=J.length,F;if(arguments.length<2){var K=this.node().__on;if(K){for(var A=0,U=K.length,W;A<U;++A)for($=0,W=K[A];$<q;++$)if((F=J[$]).type===W.type&&F.name===W.name)return W.value}return}K=_?l8:c8;for($=0;$<q;++$)this.each(K(J[$],_,Q));return this}function V9(f,_,Q){var J=jf(f),$=J.CustomEvent;if(typeof $==="function")$=new $(_,Q);else if($=J.document.createEvent("Event"),Q)$.initEvent(_,Q.bubbles,Q.cancelable),$.detail=Q.detail;else $.initEvent(_,!1,!1);f.dispatchEvent($)}function r8(f,_){return function(){return V9(this,f,_)}}function i8(f,_){return function(){return V9(this,f,_.apply(this,arguments))}}function _Q(f,_){return this.each((typeof _==="function"?i8:r8)(f,_))}function*QQ(){for(var f=this._groups,_=0,Q=f.length;_<Q;++_)for(var J=f[_],$=0,q=J.length,F;$<q;++$)if(F=J[$])yield F}var JQ=[null];function s(f,_){this._groups=f,this._parents=_}function Y9(){return new s([[document.documentElement]],JQ)}function s8(){return this}s.prototype=Y9.prototype={constructor:s,select:w_,selectAll:O_,selectChild:R_,selectChildren:z_,filter:H_,data:I_,enter:D_,exit:S_,join:E_,merge:y_,selection:s8,order:N_,sort:u_,call:b_,nodes:x_,node:k_,size:P_,empty:h_,each:v_,attr:m_,style:g_,property:p_,classed:l_,text:r_,html:i_,raise:s_,lower:a_,append:d_,insert:t_,remove:n_,clone:o_,datum:e_,on:fQ,dispatch:_Q,[Symbol.iterator]:QQ};var X0=Y9;function f0(f){return typeof f==="string"?new s([[document.querySelector(f)]],[document.documentElement]):new s([[f]],JQ)}function $Q(f){let _;while(_=f.sourceEvent)f=_;return f}function q0(f,_){if(f=$Q(f),_===void 0)_=f.currentTarget;if(_){var Q=_.ownerSVGElement||_;if(Q.createSVGPoint){var J=Q.createSVGPoint();return J.x=f.clientX,J.y=f.clientY,J=J.matrixTransform(_.getScreenCTM().inverse()),[J.x,J.y]}if(_.getBoundingClientRect){var $=_.getBoundingClientRect();return[f.clientX-$.left-_.clientLeft,f.clientY-$.top-_.clientTop]}}return[f.pageX,f.pageY]}var X9={passive:!1},u0={capture:!0,passive:!1};function cf(f){f.stopImmediatePropagation()}function L0(f){f.preventDefault(),f.stopImmediatePropagation()}function n0(f){var _=f.document.documentElement,Q=f0(f).on("dragstart.drag",L0,u0);if("onselectstart"in _)Q.on("selectstart.drag",L0,u0);else _.__noselect=_.style.MozUserSelect,_.style.MozUserSelect="none"}function Mf(f,_){var Q=f.document.documentElement,J=f0(f).on("dragstart.drag",null);if(_)J.on("click.drag",L0,u0),setTimeout(function(){J.on("click.drag",null)},0);if("onselectstart"in Q)J.on("selectstart.drag",null);else Q.style.MozUserSelect=Q.__noselect,delete Q.__noselect}var Zf=(f)=>()=>f;function Vf(f,{sourceEvent:_,subject:Q,target:J,identifier:$,active:q,x:F,y:K,dx:A,dy:U,dispatch:W}){Object.defineProperties(this,{type:{value:f,enumerable:!0,configurable:!0},sourceEvent:{value:_,enumerable:!0,configurable:!0},subject:{value:Q,enumerable:!0,configurable:!0},target:{value:J,enumerable:!0,configurable:!0},identifier:{value:$,enumerable:!0,configurable:!0},active:{value:q,enumerable:!0,configurable:!0},x:{value:F,enumerable:!0,configurable:!0},y:{value:K,enumerable:!0,configurable:!0},dx:{value:A,enumerable:!0,configurable:!0},dy:{value:U,enumerable:!0,configurable:!0},_:{value:W}})}Vf.prototype.on=function(){var f=this._.on.apply(this._,arguments);return f===this._?this:f};function a8(f){return!f.ctrlKey&&!f.button}function d8(){return this.parentNode}function t8(f,_){return _==null?{x:f.x,y:f.y}:_}function n8(){return navigator.maxTouchPoints||"ontouchstart"in this}function lf(){var f=a8,_=d8,Q=t8,J=n8,$={},q=N0("start","drag","end"),F=0,K,A,U,W,G=0;function j(X){X.on("mousedown.drag",M).filter(J).on("touchstart.drag",L).on("touchmove.drag",Z,X9).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function M(X,S){if(W||!f.call(this,X,S))return;var y=H(this,_.call(this,X,S),X,S,"mouse");if(!y)return;f0(X.view).on("mousemove.drag",Y,u0).on("mouseup.drag",w,u0),n0(X.view),cf(X),U=!1,K=X.clientX,A=X.clientY,y("start",X)}function Y(X){if(L0(X),!U){var S=X.clientX-K,y=X.clientY-A;U=S*S+y*y>G}$.mouse("drag",X)}function w(X){f0(X.view).on("mousemove.drag mouseup.drag",null),Mf(X.view,U),L0(X),$.mouse("end",X)}function L(X,S){if(!f.call(this,X,S))return;var y=X.changedTouches,D=_.call(this,X,S),R=y.length,I,N;for(I=0;I<R;++I)if(N=H(this,D,X,S,y[I].identifier,y[I]))cf(X),N("start",X,y[I])}function Z(X){var S=X.changedTouches,y=S.length,D,R;for(D=0;D<y;++D)if(R=$[S[D].identifier])L0(X),R("drag",X,S[D])}function C(X){var S=X.changedTouches,y=S.length,D,R;if(W)clearTimeout(W);W=setTimeout(function(){W=null},500);for(D=0;D<y;++D)if(R=$[S[D].identifier])cf(X),R("end",X,S[D])}function H(X,S,y,D,R,I){var N=q.copy(),T=q0(I||y,S),b,k,B;if((B=Q.call(X,new Vf("beforestart",{sourceEvent:y,target:j,identifier:R,active:F,x:T[0],y:T[1],dx:0,dy:0,dispatch:N}),D))==null)return;return b=B.x-T[0]||0,k=B.y-T[1]||0,function O(V,z,u){var E=T,x;switch(V){case"start":$[R]=O,x=F++;break;case"end":delete $[R],--F;case"drag":T=q0(u||z,S),x=F;break}N.call(V,X,new Vf(V,{sourceEvent:z,subject:B,target:j,identifier:R,active:x,x:T[0]+b,y:T[1]+k,dx:T[0]-E[0],dy:T[1]-E[1],dispatch:N}),D)}}return j.filter=function(X){return arguments.length?(f=typeof X==="function"?X:Zf(!!X),j):f},j.container=function(X){return arguments.length?(_=typeof X==="function"?X:Zf(X),j):_},j.subject=function(X){return arguments.length?(Q=typeof X==="function"?X:Zf(X),j):Q},j.touchable=function(X){return arguments.length?(J=typeof X==="function"?X:Zf(!!X),j):J},j.on=function(){var X=q.on.apply(q,arguments);return X===q?j:X},j.clickDistance=function(X){return arguments.length?(G=(X=+X)*X,j):Math.sqrt(G)},j}function Yf(f,_,Q){f.prototype=_.prototype=Q,Q.constructor=f}function qQ(f,_){var Q=Object.create(f.prototype);for(var J in _)Q[J]=_[J];return Q}function wf(){}var Xf=0.7,af=1/Xf,o0="\\s*([+-]?\\d+)\\s*",Lf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Z0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",o8=/^#([0-9a-f]{3,8})$/,e8=new RegExp(`^rgb\\(${o0},${o0},${o0}\\)$`),fJ=new RegExp(`^rgb\\(${Z0},${Z0},${Z0}\\)$`),_J=new RegExp(`^rgba\\(${o0},${o0},${o0},${Lf}\\)$`),QJ=new RegExp(`^rgba\\(${Z0},${Z0},${Z0},${Lf}\\)$`),JJ=new RegExp(`^hsl\\(${Lf},${Z0},${Z0}\\)$`),$J=new RegExp(`^hsla\\(${Lf},${Z0},${Z0},${Lf}\\)$`),L9={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};Yf(wf,G0,{copy(f){return Object.assign(new this.constructor,this,f)},displayable(){return this.rgb().displayable()},hex:w9,formatHex:w9,formatHex8:qJ,formatHsl:FJ,formatRgb:T9,toString:T9});function w9(){return this.rgb().formatHex()}function qJ(){return this.rgb().formatHex8()}function FJ(){return C9(this).formatHsl()}function T9(){return this.rgb().formatRgb()}function G0(f){var _,Q;return f=(f+"").trim().toLowerCase(),(_=o8.exec(f))?(Q=_[1].length,_=parseInt(_[1],16),Q===6?O9(_):Q===3?new K0(_>>8&15|_>>4&240,_>>4&15|_&240,(_&15)<<4|_&15,1):Q===8?rf(_>>24&255,_>>16&255,_>>8&255,(_&255)/255):Q===4?rf(_>>12&15|_>>8&240,_>>8&15|_>>4&240,_>>4&15|_&240,((_&15)<<4|_&15)/255):null):(_=e8.exec(f))?new K0(_[1],_[2],_[3],1):(_=fJ.exec(f))?new K0(_[1]*255/100,_[2]*255/100,_[3]*255/100,1):(_=_J.exec(f))?rf(_[1],_[2],_[3],_[4]):(_=QJ.exec(f))?rf(_[1]*255/100,_[2]*255/100,_[3]*255/100,_[4]):(_=JJ.exec(f))?H9(_[1],_[2]/100,_[3]/100,1):(_=$J.exec(f))?H9(_[1],_[2]/100,_[3]/100,_[4]):L9.hasOwnProperty(f)?O9(L9[f]):f==="transparent"?new K0(NaN,NaN,NaN,0):null}function O9(f){return new K0(f>>16&255,f>>8&255,f&255,1)}function rf(f,_,Q,J){if(J<=0)f=_=Q=NaN;return new K0(f,_,Q,J)}function KJ(f){if(!(f instanceof wf))f=G0(f);if(!f)return new K0;return f=f.rgb(),new K0(f.r,f.g,f.b,f.opacity)}function e0(f,_,Q,J){return arguments.length===1?KJ(f):new K0(f,_,Q,J==null?1:J)}function K0(f,_,Q,J){this.r=+f,this.g=+_,this.b=+Q,this.opacity=+J}Yf(K0,e0,qQ(wf,{brighter(f){return f=f==null?af:Math.pow(af,f),new K0(this.r*f,this.g*f,this.b*f,this.opacity)},darker(f){return f=f==null?Xf:Math.pow(Xf,f),new K0(this.r*f,this.g*f,this.b*f,this.opacity)},rgb(){return this},clamp(){return new K0(x0(this.r),x0(this.g),x0(this.b),df(this.opacity))},displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:R9,formatHex:R9,formatHex8:UJ,formatRgb:z9,toString:z9}));function R9(){return`#${b0(this.r)}${b0(this.g)}${b0(this.b)}`}function UJ(){return`#${b0(this.r)}${b0(this.g)}${b0(this.b)}${b0((isNaN(this.opacity)?1:this.opacity)*255)}`}function z9(){let f=df(this.opacity);return`${f===1?"rgb(":"rgba("}${x0(this.r)}, ${x0(this.g)}, ${x0(this.b)}${f===1?")":`, ${f})`}`}function df(f){return isNaN(f)?1:Math.max(0,Math.min(1,f))}function x0(f){return Math.max(0,Math.min(255,Math.round(f)||0))}function b0(f){return f=x0(f),(f<16?"0":"")+f.toString(16)}function H9(f,_,Q,J){if(J<=0)f=_=Q=NaN;else if(Q<=0||Q>=1)f=_=NaN;else if(_<=0)f=NaN;return new W0(f,_,Q,J)}function C9(f){if(f instanceof W0)return new W0(f.h,f.s,f.l,f.opacity);if(!(f instanceof wf))f=G0(f);if(!f)return new W0;if(f instanceof W0)return f;f=f.rgb();var _=f.r/255,Q=f.g/255,J=f.b/255,$=Math.min(_,Q,J),q=Math.max(_,Q,J),F=NaN,K=q-$,A=(q+$)/2;if(K){if(_===q)F=(Q-J)/K+(Q<J)*6;else if(Q===q)F=(J-_)/K+2;else F=(_-Q)/K+4;K/=A<0.5?q+$:2-q-$,F*=60}else K=A>0&&A<1?0:F;return new W0(F,K,A,f.opacity)}function I9(f,_,Q,J){return arguments.length===1?C9(f):new W0(f,_,Q,J==null?1:J)}function W0(f,_,Q,J){this.h=+f,this.s=+_,this.l=+Q,this.opacity=+J}Yf(W0,I9,qQ(wf,{brighter(f){return f=f==null?af:Math.pow(af,f),new W0(this.h,this.s,this.l*f,this.opacity)},darker(f){return f=f==null?Xf:Math.pow(Xf,f),new W0(this.h,this.s,this.l*f,this.opacity)},rgb(){var f=this.h%360+(this.h<0)*360,_=isNaN(f)||isNaN(this.s)?0:this.s,Q=this.l,J=Q+(Q<0.5?Q:1-Q)*_,$=2*Q-J;return new K0(FQ(f>=240?f-240:f+120,$,J),FQ(f,$,J),FQ(f<120?f+240:f-120,$,J),this.opacity)},clamp(){return new W0(D9(this.h),sf(this.s),sf(this.l),df(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(){let f=df(this.opacity);return`${f===1?"hsl(":"hsla("}${D9(this.h)}, ${sf(this.s)*100}%, ${sf(this.l)*100}%${f===1?")":`, ${f})`}`}}));function D9(f){return f=(f||0)%360,f<0?f+360:f}function sf(f){return Math.max(0,Math.min(1,f||0))}function FQ(f,_,Q){return(f<60?_+(Q-_)*f/60:f<180?Q:f<240?_+(Q-_)*(240-f)/60:_)*255}function KQ(f,_,Q,J,$){var q=f*f,F=q*f;return((1-3*f+3*q-F)*_+(4-6*q+3*F)*Q+(1+3*f+3*q-3*F)*J+F*$)/6}function UQ(f){var _=f.length-1;return function(Q){var J=Q<=0?Q=0:Q>=1?(Q=1,_-1):Math.floor(Q*_),$=f[J],q=f[J+1],F=J>0?f[J-1]:2*$-q,K=J<_-1?f[J+2]:2*q-$;return KQ((Q-J/_)*_,F,$,q,K)}}function AQ(f){var _=f.length;return function(Q){var J=Math.floor(((Q%=1)<0?++Q:Q)*_),$=f[(J+_-1)%_],q=f[J%_],F=f[(J+1)%_],K=f[(J+2)%_];return KQ((Q-J/_)*_,$,q,F,K)}}var Tf=(f)=>()=>f;function AJ(f,_){return function(Q){return f+Q*_}}function WJ(f,_,Q){return f=Math.pow(f,Q),_=Math.pow(_,Q)-f,Q=1/Q,function(J){return Math.pow(f+J*_,Q)}}function S9(f){return(f=+f)===1?tf:function(_,Q){return Q-_?WJ(_,Q,f):Tf(isNaN(_)?Q:_)}}function tf(f,_){var Q=_-f;return Q?AJ(f,Q):Tf(isNaN(f)?_:f)}var k0=function f(_){var Q=S9(_);function J($,q){var F=Q(($=e0($)).r,(q=e0(q)).r),K=Q($.g,q.g),A=Q($.b,q.b),U=tf($.opacity,q.opacity);return function(W){return $.r=F(W),$.g=K(W),$.b=A(W),$.opacity=U(W),$+""}}return J.gamma=f,J}(1);function E9(f){return function(_){var Q=_.length,J=Array(Q),$=Array(Q),q=Array(Q),F,K;for(F=0;F<Q;++F)K=e0(_[F]),J[F]=K.r||0,$[F]=K.g||0,q[F]=K.b||0;return J=f(J),$=f($),q=f(q),K.opacity=1,function(A){return K.r=J(A),K.g=$(A),K.b=q(A),K+""}}}var GJ=E9(UQ),BJ=E9(AQ);function WQ(f,_){if(!_)_=[];var Q=f?Math.min(_.length,f.length):0,J=_.slice(),$;return function(q){for($=0;$<Q;++$)J[$]=f[$]*(1-q)+_[$]*q;return J}}function y9(f){return ArrayBuffer.isView(f)&&!(f instanceof DataView)}function N9(f,_){var Q=_?_.length:0,J=f?Math.min(Q,f.length):0,$=Array(J),q=Array(Q),F;for(F=0;F<J;++F)$[F]=V0(f[F],_[F]);for(;F<Q;++F)q[F]=_[F];return function(K){for(F=0;F<J;++F)q[F]=$[F](K);return q}}function GQ(f,_){var Q=new Date;return f=+f,_=+_,function(J){return Q.setTime(f*(1-J)+_*J),Q}}function J0(f,_){return f=+f,_=+_,function(Q){return f*(1-Q)+_*Q}}function BQ(f,_){var Q={},J={},$;if(f===null||typeof f!=="object")f={};if(_===null||typeof _!=="object")_={};for($ in _)if($ in f)Q[$]=V0(f[$],_[$]);else J[$]=_[$];return function(q){for($ in Q)J[$]=Q[$](q);return J}}var MQ=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jQ=new RegExp(MQ.source,"g");function jJ(f){return function(){return f}}function MJ(f){return function(_){return f(_)+""}}function ff(f,_){var Q=MQ.lastIndex=jQ.lastIndex=0,J,$,q,F=-1,K=[],A=[];f=f+"",_=_+"";while((J=MQ.exec(f))&&($=jQ.exec(_))){if((q=$.index)>Q)if(q=_.slice(Q,q),K[F])K[F]+=q;else K[++F]=q;if((J=J[0])===($=$[0]))if(K[F])K[F]+=$;else K[++F]=$;else K[++F]=null,A.push({i:F,x:J0(J,$)});Q=jQ.lastIndex}if(Q<_.length)if(q=_.slice(Q),K[F])K[F]+=q;else K[++F]=q;return K.length<2?A[0]?MJ(A[0].x):jJ(_):(_=A.length,function(U){for(var W=0,G;W<_;++W)K[(G=A[W]).i]=G.x(U);return K.join("")})}function V0(f,_){var Q=typeof _,J;return _==null||Q==="boolean"?Tf(_):(Q==="number"?J0:Q==="string"?(J=G0(_))?(_=J,k0):ff:_ instanceof G0?k0:_ instanceof Date?GQ:y9(_)?WQ:Array.isArray(_)?N9:typeof _.valueOf!=="function"&&typeof _.toString!=="function"||isNaN(_)?BQ:J0)(f,_)}var u9=180/Math.PI,nf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function of(f,_,Q,J,$,q){var F,K,A;if(F=Math.sqrt(f*f+_*_))f/=F,_/=F;if(A=f*Q+_*J)Q-=f*A,J-=_*A;if(K=Math.sqrt(Q*Q+J*J))Q/=K,J/=K,A/=K;if(f*J<_*Q)f=-f,_=-_,A=-A,F=-F;return{translateX:$,translateY:q,rotate:Math.atan2(_,f)*u9,skewX:Math.atan(A)*u9,scaleX:F,scaleY:K}}var ef;function b9(f){let _=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(f+"");return _.isIdentity?nf:of(_.a,_.b,_.c,_.d,_.e,_.f)}function x9(f){if(f==null)return nf;if(!ef)ef=document.createElementNS("http://www.w3.org/2000/svg","g");if(ef.setAttribute("transform",f),!(f=ef.transform.baseVal.consolidate()))return nf;return f=f.matrix,of(f.a,f.b,f.c,f.d,f.e,f.f)}function k9(f,_,Q,J){function $(U){return U.length?U.pop()+" ":""}function q(U,W,G,j,M,Y){if(U!==G||W!==j){var w=M.push("translate(",null,_,null,Q);Y.push({i:w-4,x:J0(U,G)},{i:w-2,x:J0(W,j)})}else if(G||j)M.push("translate("+G+_+j+Q)}function F(U,W,G,j){if(U!==W){if(U-W>180)W+=360;else if(W-U>180)U+=360;j.push({i:G.push($(G)+"rotate(",null,J)-2,x:J0(U,W)})}else if(W)G.push($(G)+"rotate("+W+J)}function K(U,W,G,j){if(U!==W)j.push({i:G.push($(G)+"skewX(",null,J)-2,x:J0(U,W)});else if(W)G.push($(G)+"skewX("+W+J)}function A(U,W,G,j,M,Y){if(U!==G||W!==j){var w=M.push($(M)+"scale(",null,",",null,")");Y.push({i:w-4,x:J0(U,G)},{i:w-2,x:J0(W,j)})}else if(G!==1||j!==1)M.push($(M)+"scale("+G+","+j+")")}return function(U,W){var G=[],j=[];return U=f(U),W=f(W),q(U.translateX,U.translateY,W.translateX,W.translateY,G,j),F(U.rotate,W.rotate,G,j),K(U.skewX,W.skewX,G,j),A(U.scaleX,U.scaleY,W.scaleX,W.scaleY,G,j),U=W=null,function(M){var Y=-1,w=j.length,L;while(++Y<w)G[(L=j[Y]).i]=L.x(M);return G.join("")}}}var ZQ=k9(b9,"px, ","px)","deg)"),VQ=k9(x9,", ",")",")");var ZJ=0.000000000001;function P9(f){return((f=Math.exp(f))+1/f)/2}function VJ(f){return((f=Math.exp(f))-1/f)/2}function YJ(f){return((f=Math.exp(2*f))-1)/(f+1)}var P0=function f(_,Q,J){function $(q,F){var K=q[0],A=q[1],U=q[2],W=F[0],G=F[1],j=F[2],M=W-K,Y=G-A,w=M*M+Y*Y,L,Z;if(w<ZJ)Z=Math.log(j/U)/_,L=function(D){return[K+D*M,A+D*Y,U*Math.exp(_*D*Z)]};else{var C=Math.sqrt(w),H=(j*j-U*U+J*w)/(2*U*Q*C),X=(j*j-U*U-J*w)/(2*j*Q*C),S=Math.log(Math.sqrt(H*H+1)-H),y=Math.log(Math.sqrt(X*X+1)-X);Z=(y-S)/_,L=function(D){var R=D*Z,I=P9(S),N=U/(Q*C)*(I*YJ(_*R+S)-VJ(S));return[K+N*M,A+N*Y,U*I/P9(_*R+S)]}}return L.duration=Z*1000*_/Math.SQRT2,L}return $.rho=function(q){var F=Math.max(0.001,+q),K=F*F,A=K*K;return f(F,K,A)},$}(Math.SQRT2,2,4);var _f=0,Rf=0,Of=0,v9=1000,f_,zf,__=0,h0=0,Q_=0,Hf=typeof performance==="object"&&performance.now?performance:Date,m9=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(f){setTimeout(f,17)};function Cf(){return h0||(m9(XJ),h0=Hf.now()+Q_)}function XJ(){h0=0}function Df(){this._call=this._time=this._next=null}Df.prototype=J_.prototype={constructor:Df,restart:function(f,_,Q){if(typeof f!=="function")throw TypeError("callback is not a function");if(Q=(Q==null?Cf():+Q)+(_==null?0:+_),!this._next&&zf!==this){if(zf)zf._next=this;else f_=this;zf=this}this._call=f,this._time=Q,YQ()},stop:function(){if(this._call)this._call=null,this._time=1/0,YQ()}};function J_(f,_,Q){var J=new Df;return J.restart(f,_,Q),J}function g9(){Cf(),++_f;var f=f_,_;while(f){if((_=h0-f._time)>=0)f._call.call(void 0,_);f=f._next}--_f}function h9(){h0=(__=Hf.now())+Q_,_f=Rf=0;try{g9()}finally{_f=0,wJ(),h0=0}}function LJ(){var f=Hf.now(),_=f-__;if(_>v9)Q_-=_,__=f}function wJ(){var f,_=f_,Q,J=1/0;while(_)if(_._call){if(J>_._time)J=_._time;f=_,_=_._next}else Q=_._next,_._next=null,_=f?f._next=Q:f_=Q;zf=f,YQ(J)}function YQ(f){if(_f)return;if(Rf)Rf=clearTimeout(Rf);var _=f-h0;if(_>24){if(f<1/0)Rf=setTimeout(h9,f-Hf.now()-Q_);if(Of)Of=clearInterval(Of)}else{if(!Of)__=Hf.now(),Of=setInterval(LJ,v9);_f=1,m9(h9)}}function If(f,_,Q){var J=new Df;return _=_==null?0:+_,J.restart(($)=>{J.stop(),f($+_)},_,Q),J}var TJ=N0("start","end","cancel","interrupt"),OJ=[],l9=0,p9=1,q_=2,$_=3,c9=4,F_=5,Sf=6;function w0(f,_,Q,J,$,q){var F=f.__transition;if(!F)f.__transition={};else if(Q in F)return;RJ(f,Q,{name:_,index:J,group:$,on:TJ,tween:OJ,time:q.time,delay:q.delay,duration:q.duration,ease:q.ease,timer:null,state:l9})}function Ef(f,_){var Q=n(f,_);if(Q.state>l9)throw Error("too late; already scheduled");return Q}function _0(f,_){var Q=n(f,_);if(Q.state>$_)throw Error("too late; already running");return Q}function n(f,_){var Q=f.__transition;if(!Q||!(Q=Q[_]))throw Error("transition not found");return Q}function RJ(f,_,Q){var J=f.__transition,$;J[_]=Q,Q.timer=J_(q,0,Q.time);function q(U){if(Q.state=p9,Q.timer.restart(F,Q.delay,Q.time),Q.delay<=U)F(U-Q.delay)}function F(U){var W,G,j,M;if(Q.state!==p9)return A();for(W in J){if(M=J[W],M.name!==Q.name)continue;if(M.state===$_)return If(F);if(M.state===c9)M.state=Sf,M.timer.stop(),M.on.call("interrupt",f,f.__data__,M.index,M.group),delete J[W];else if(+W<_)M.state=Sf,M.timer.stop(),M.on.call("cancel",f,f.__data__,M.index,M.group),delete J[W]}if(If(function(){if(Q.state===$_)Q.state=c9,Q.timer.restart(K,Q.delay,Q.time),K(U)}),Q.state=q_,Q.on.call("start",f,f.__data__,Q.index,Q.group),Q.state!==q_)return;Q.state=$_,$=Array(j=Q.tween.length);for(W=0,G=-1;W<j;++W)if(M=Q.tween[W].value.call(f,f.__data__,Q.index,Q.group))$[++G]=M;$.length=G+1}function K(U){var W=U<Q.duration?Q.ease.call(null,U/Q.duration):(Q.timer.restart(A),Q.state=F_,1),G=-1,j=$.length;while(++G<j)$[G].call(f,W);if(Q.state===F_)Q.on.call("end",f,f.__data__,Q.index,Q.group),A()}function A(){Q.state=Sf,Q.timer.stop(),delete J[_];for(var U in J)return;delete f.__transition}}function D0(f,_){var Q=f.__transition,J,$,q=!0,F;if(!Q)return;_=_==null?null:_+"";for(F in Q){if((J=Q[F]).name!==_){q=!1;continue}$=J.state>q_&&J.state<F_,J.state=Sf,J.timer.stop(),J.on.call($?"interrupt":"cancel",f,f.__data__,J.index,J.group),delete Q[F]}if(q)delete f.__transition}function XQ(f){return this.each(function(){D0(this,f)})}function zJ(f,_){var Q,J;return function(){var $=_0(this,f),q=$.tween;if(q!==Q){J=Q=q;for(var F=0,K=J.length;F<K;++F)if(J[F].name===_){J=J.slice(),J.splice(F,1);break}}$.tween=J}}function HJ(f,_,Q){var J,$;if(typeof Q!=="function")throw Error();return function(){var q=_0(this,f),F=q.tween;if(F!==J){$=(J=F).slice();for(var K={name:_,value:Q},A=0,U=$.length;A<U;++A)if($[A].name===_){$[A]=K;break}if(A===U)$.push(K)}q.tween=$}}function LQ(f,_){var Q=this._id;if(f+="",arguments.length<2){var J=n(this.node(),Q).tween;for(var $=0,q=J.length,F;$<q;++$)if((F=J[$]).name===f)return F.value;return null}return this.each((_==null?zJ:HJ)(Q,f,_))}function Qf(f,_,Q){var J=f._id;return f.each(function(){var $=_0(this,J);($.value||($.value={}))[_]=Q.apply(this,arguments)}),function($){return n($,J).value[_]}}function yf(f,_){var Q;return(typeof _==="number"?J0:_ instanceof G0?k0:(Q=G0(_))?(_=Q,k0):ff)(f,_)}function DJ(f){return function(){this.removeAttribute(f)}}function CJ(f){return function(){this.removeAttributeNS(f.space,f.local)}}function IJ(f,_,Q){var J,$=Q+"",q;return function(){var F=this.getAttribute(f);return F===$?null:F===J?q:q=_(J=F,Q)}}function SJ(f,_,Q){var J,$=Q+"",q;return function(){var F=this.getAttributeNS(f.space,f.local);return F===$?null:F===J?q:q=_(J=F,Q)}}function EJ(f,_,Q){var J,$,q;return function(){var F,K=Q(this),A;if(K==null)return void this.removeAttribute(f);return F=this.getAttribute(f),A=K+"",F===A?null:F===J&&A===$?q:($=A,q=_(J=F,K))}}function yJ(f,_,Q){var J,$,q;return function(){var F,K=Q(this),A;if(K==null)return void this.removeAttributeNS(f.space,f.local);return F=this.getAttributeNS(f.space,f.local),A=K+"",F===A?null:F===J&&A===$?q:($=A,q=_(J=F,K))}}function wQ(f,_){var Q=M0(f),J=Q==="transform"?VQ:yf;return this.attrTween(f,typeof _==="function"?(Q.local?yJ:EJ)(Q,J,Qf(this,"attr."+f,_)):_==null?(Q.local?CJ:DJ)(Q):(Q.local?SJ:IJ)(Q,J,_))}function NJ(f,_){return function(Q){this.setAttribute(f,_.call(this,Q))}}function uJ(f,_){return function(Q){this.setAttributeNS(f.space,f.local,_.call(this,Q))}}function bJ(f,_){var Q,J;function $(){var q=_.apply(this,arguments);if(q!==J)Q=(J=q)&&uJ(f,q);return Q}return $._value=_,$}function xJ(f,_){var Q,J;function $(){var q=_.apply(this,arguments);if(q!==J)Q=(J=q)&&NJ(f,q);return Q}return $._value=_,$}function TQ(f,_){var Q="attr."+f;if(arguments.length<2)return(Q=this.tween(Q))&&Q._value;if(_==null)return this.tween(Q,null);if(typeof _!=="function")throw Error();var J=M0(f);return this.tween(Q,(J.local?bJ:xJ)(J,_))}function kJ(f,_){return function(){Ef(this,f).delay=+_.apply(this,arguments)}}function PJ(f,_){return _=+_,function(){Ef(this,f).delay=_}}function OQ(f){var _=this._id;return arguments.length?this.each((typeof f==="function"?kJ:PJ)(_,f)):n(this.node(),_).delay}function hJ(f,_){return function(){_0(this,f).duration=+_.apply(this,arguments)}}function vJ(f,_){return _=+_,function(){_0(this,f).duration=_}}function RQ(f){var _=this._id;return arguments.length?this.each((typeof f==="function"?hJ:vJ)(_,f)):n(this.node(),_).duration}function mJ(f,_){if(typeof _!=="function")throw Error();return function(){_0(this,f).ease=_}}function zQ(f){var _=this._id;return arguments.length?this.each(mJ(_,f)):n(this.node(),_).ease}function gJ(f,_){return function(){var Q=_.apply(this,arguments);if(typeof Q!=="function")throw Error();_0(this,f).ease=Q}}function HQ(f){if(typeof f!=="function")throw Error();return this.each(gJ(this._id,f))}function DQ(f){if(typeof f!=="function")f=t0(f);for(var _=this._groups,Q=_.length,J=Array(Q),$=0;$<Q;++$)for(var q=_[$],F=q.length,K=J[$]=[],A,U=0;U<F;++U)if((A=q[U])&&f.call(A,A.__data__,U,q))K.push(A);return new F0(J,this._parents,this._name,this._id)}function CQ(f){if(f._id!==this._id)throw Error();for(var _=this._groups,Q=f._groups,J=_.length,$=Q.length,q=Math.min(J,$),F=Array(J),K=0;K<q;++K)for(var A=_[K],U=Q[K],W=A.length,G=F[K]=Array(W),j,M=0;M<W;++M)if(j=A[M]||U[M])G[M]=j;for(;K<J;++K)F[K]=_[K];return new F0(F,this._parents,this._name,this._id)}function pJ(f){return(f+"").trim().split(/^|\s+/).every(function(_){var Q=_.indexOf(".");if(Q>=0)_=_.slice(0,Q);return!_||_==="start"})}function cJ(f,_,Q){var J,$,q=pJ(_)?Ef:_0;return function(){var F=q(this,f),K=F.on;if(K!==J)($=(J=K).copy()).on(_,Q);F.on=$}}function IQ(f,_){var Q=this._id;return arguments.length<2?n(this.node(),Q).on.on(f):this.each(cJ(Q,f,_))}function lJ(f){return function(){var _=this.parentNode;for(var Q in this.__transition)if(+Q!==f)return;if(_)_.removeChild(this)}}function SQ(){return this.on("end.remove",lJ(this._id))}function EQ(f){var _=this._name,Q=this._id;if(typeof f!=="function")f=z0(f);for(var J=this._groups,$=J.length,q=Array($),F=0;F<$;++F)for(var K=J[F],A=K.length,U=q[F]=Array(A),W,G,j=0;j<A;++j)if((W=K[j])&&(G=f.call(W,W.__data__,j,K))){if("__data__"in W)G.__data__=W.__data__;U[j]=G,w0(U[j],_,Q,j,U,n(W,Q))}return new F0(q,this._parents,_,Q)}function yQ(f){var _=this._name,Q=this._id;if(typeof f!=="function")f=d0(f);for(var J=this._groups,$=J.length,q=[],F=[],K=0;K<$;++K)for(var A=J[K],U=A.length,W,G=0;G<U;++G)if(W=A[G]){for(var j=f.call(W,W.__data__,G,A),M,Y=n(W,Q),w=0,L=j.length;w<L;++w)if(M=j[w])w0(M,_,Q,w,j,Y);q.push(j),F.push(W)}return new F0(q,F,_,Q)}var rJ=X0.prototype.constructor;function NQ(){return new rJ(this._groups,this._parents)}function iJ(f,_){var Q,J,$;return function(){var q=H0(this,f),F=(this.style.removeProperty(f),H0(this,f));return q===F?null:q===Q&&F===J?$:$=_(Q=q,J=F)}}function r9(f){return function(){this.style.removeProperty(f)}}function sJ(f,_,Q){var J,$=Q+"",q;return function(){var F=H0(this,f);return F===$?null:F===J?q:q=_(J=F,Q)}}function aJ(f,_,Q){var J,$,q;return function(){var F=H0(this,f),K=Q(this),A=K+"";if(K==null)A=K=(this.style.removeProperty(f),H0(this,f));return F===A?null:F===J&&A===$?q:($=A,q=_(J=F,K))}}function dJ(f,_){var Q,J,$,q="style."+_,F="end."+q,K;return function(){var A=_0(this,f),U=A.on,W=A.value[q]==null?K||(K=r9(_)):void 0;if(U!==Q||$!==W)(J=(Q=U).copy()).on(F,$=W);A.on=J}}function uQ(f,_,Q){var J=(f+="")==="transform"?ZQ:yf;return _==null?this.styleTween(f,iJ(f,J)).on("end.style."+f,r9(f)):typeof _==="function"?this.styleTween(f,aJ(f,J,Qf(this,"style."+f,_))).each(dJ(this._id,f)):this.styleTween(f,sJ(f,J,_),Q).on("end.style."+f,null)}function tJ(f,_,Q){return function(J){this.style.setProperty(f,_.call(this,J),Q)}}function nJ(f,_,Q){var J,$;function q(){var F=_.apply(this,arguments);if(F!==$)J=($=F)&&tJ(f,F,Q);return J}return q._value=_,q}function bQ(f,_,Q){var J="style."+(f+="");if(arguments.length<2)return(J=this.tween(J))&&J._value;if(_==null)return this.tween(J,null);if(typeof _!=="function")throw Error();return this.tween(J,nJ(f,_,Q==null?"":Q))}function oJ(f){return function(){this.textContent=f}}function eJ(f){return function(){var _=f(this);this.textContent=_==null?"":_}}function xQ(f){return this.tween("text",typeof f==="function"?eJ(Qf(this,"text",f)):oJ(f==null?"":f+""))}function f7(f){return function(_){this.textContent=f.call(this,_)}}function _7(f){var _,Q;function J(){var $=f.apply(this,arguments);if($!==Q)_=(Q=$)&&f7($);return _}return J._value=f,J}function kQ(f){var _="text";if(arguments.length<1)return(_=this.tween(_))&&_._value;if(f==null)return this.tween(_,null);if(typeof f!=="function")throw Error();return this.tween(_,_7(f))}function PQ(){var f=this._name,_=this._id,Q=K_();for(var J=this._groups,$=J.length,q=0;q<$;++q)for(var F=J[q],K=F.length,A,U=0;U<K;++U)if(A=F[U]){var W=n(A,_);w0(A,f,Q,U,F,{time:W.time+W.delay+W.duration,delay:0,duration:W.duration,ease:W.ease})}return new F0(J,this._parents,f,Q)}function hQ(){var f,_,Q=this,J=Q._id,$=Q.size();return new Promise(function(q,F){var K={value:F},A={value:function(){if(--$===0)q()}};if(Q.each(function(){var U=_0(this,J),W=U.on;if(W!==f)_=(f=W).copy(),_._.cancel.push(K),_._.interrupt.push(K),_._.end.push(A);U.on=_}),$===0)q()})}var Q7=0;function F0(f,_,Q,J){this._groups=f,this._parents=_,this._name=Q,this._id=J}function i9(f){return X0().transition(f)}function K_(){return++Q7}var T0=X0.prototype;F0.prototype=i9.prototype={constructor:F0,select:EQ,selectAll:yQ,selectChild:T0.selectChild,selectChildren:T0.selectChildren,filter:DQ,merge:CQ,selection:NQ,transition:PQ,call:T0.call,nodes:T0.nodes,node:T0.node,size:T0.size,empty:T0.empty,each:T0.each,on:IQ,attr:wQ,attrTween:TQ,style:uQ,styleTween:bQ,text:xQ,textTween:kQ,remove:SQ,tween:LQ,delay:OQ,duration:RQ,ease:zQ,easeVarying:HQ,end:hQ,[Symbol.iterator]:T0[Symbol.iterator]};function U_(f){return((f*=2)<=1?f*f*f:(f-=2)*f*f+2)/2}var J7={time:null,delay:0,duration:250,ease:U_};function $7(f,_){var Q;while(!(Q=f.__transition)||!(Q=Q[_]))if(!(f=f.parentNode))throw Error(`transition ${_} not found`);return Q}function vQ(f){var _,Q;if(f instanceof F0)_=f._id,f=f._name;else _=K_(),(Q=J7).time=Cf(),f=f==null?null:f+"";for(var J=this._groups,$=J.length,q=0;q<$;++q)for(var F=J[q],K=F.length,A,U=0;U<K;++U)if(A=F[U])w0(A,f,_,U,F,Q||$7(A,_));return new F0(J,this._parents,f,_)}X0.prototype.interrupt=XQ;X0.prototype.transition=vQ;var Nf=(f)=>()=>f;function mQ(f,{sourceEvent:_,target:Q,transform:J,dispatch:$}){Object.defineProperties(this,{type:{value:f,enumerable:!0,configurable:!0},sourceEvent:{value:_,enumerable:!0,configurable:!0},target:{value:Q,enumerable:!0,configurable:!0},transform:{value:J,enumerable:!0,configurable:!0},_:{value:$}})}function B0(f,_,Q){this.k=f,this.x=_,this.y=Q}B0.prototype={constructor:B0,scale:function(f){return f===1?this:new B0(this.k*f,this.x,this.y)},translate:function(f,_){return f===0&_===0?this:new B0(this.k,this.x+this.k*f,this.y+this.k*_)},apply:function(f){return[f[0]*this.k+this.x,f[1]*this.k+this.y]},applyX:function(f){return f*this.k+this.x},applyY:function(f){return f*this.k+this.y},invert:function(f){return[(f[0]-this.x)/this.k,(f[1]-this.y)/this.k]},invertX:function(f){return(f-this.x)/this.k},invertY:function(f){return(f-this.y)/this.k},rescaleX:function(f){return f.copy().domain(f.range().map(this.invertX,this).map(f.invert,f))},rescaleY:function(f){return f.copy().domain(f.range().map(this.invertY,this).map(f.invert,f))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var v0=new B0(1,0,0);uf.prototype=B0.prototype;function uf(f){while(!f.__zoom)if(!(f=f.parentNode))return v0;return f.__zoom}function A_(f){f.stopImmediatePropagation()}function m0(f){f.preventDefault(),f.stopImmediatePropagation()}function q7(f){return(!f.ctrlKey||f.type==="wheel")&&!f.button}function F7(){var f=this;if(f instanceof SVGElement){if(f=f.ownerSVGElement||f,f.hasAttribute("viewBox"))return f=f.viewBox.baseVal,[[f.x,f.y],[f.x+f.width,f.y+f.height]];return[[0,0],[f.width.baseVal.value,f.height.baseVal.value]]}return[[0,0],[f.clientWidth,f.clientHeight]]}function s9(){return this.__zoom||v0}function K7(f){return-f.deltaY*(f.deltaMode===1?0.05:f.deltaMode?1:0.002)*(f.ctrlKey?10:1)}function U7(){return navigator.maxTouchPoints||"ontouchstart"in this}function A7(f,_,Q){var J=f.invertX(_[0][0])-Q[0][0],$=f.invertX(_[1][0])-Q[1][0],q=f.invertY(_[0][1])-Q[0][1],F=f.invertY(_[1][1])-Q[1][1];return f.translate($>J?(J+$)/2:Math.min(0,J)||Math.max(0,$),F>q?(q+F)/2:Math.min(0,q)||Math.max(0,F))}function W_(){var f=q7,_=F7,Q=A7,J=K7,$=U7,q=[0,1/0],F=[[-1/0,-1/0],[1/0,1/0]],K=250,A=P0,U=N0("start","zoom","end"),W,G,j,M=500,Y=150,w=0,L=10;function Z(B){B.property("__zoom",s9).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",N).filter($).on("touchstart.zoom",T).on("touchmove.zoom",b).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}Z.transform=function(B,O,V,z){var u=B.selection?B.selection():B;if(u.property("__zoom",s9),B!==u)S(B,O,V,z);else u.interrupt().each(function(){y(this,arguments).event(z).start().zoom(null,typeof O==="function"?O.apply(this,arguments):O).end()})},Z.scaleBy=function(B,O,V,z){Z.scaleTo(B,function(){var u=this.__zoom.k,E=typeof O==="function"?O.apply(this,arguments):O;return u*E},V,z)},Z.scaleTo=function(B,O,V,z){Z.transform(B,function(){var u=_.apply(this,arguments),E=this.__zoom,x=V==null?X(u):typeof V==="function"?V.apply(this,arguments):V,h=E.invert(x),P=typeof O==="function"?O.apply(this,arguments):O;return Q(H(C(E,P),x,h),u,F)},V,z)},Z.translateBy=function(B,O,V,z){Z.transform(B,function(){return Q(this.__zoom.translate(typeof O==="function"?O.apply(this,arguments):O,typeof V==="function"?V.apply(this,arguments):V),_.apply(this,arguments),F)},null,z)},Z.translateTo=function(B,O,V,z,u){Z.transform(B,function(){var E=_.apply(this,arguments),x=this.__zoom,h=z==null?X(E):typeof z==="function"?z.apply(this,arguments):z;return Q(v0.translate(h[0],h[1]).scale(x.k).translate(typeof O==="function"?-O.apply(this,arguments):-O,typeof V==="function"?-V.apply(this,arguments):-V),E,F)},z,u)};function C(B,O){return O=Math.max(q[0],Math.min(q[1],O)),O===B.k?B:new B0(O,B.x,B.y)}function H(B,O,V){var z=O[0]-V[0]*B.k,u=O[1]-V[1]*B.k;return z===B.x&&u===B.y?B:new B0(B.k,z,u)}function X(B){return[(+B[0][0]+ +B[1][0])/2,(+B[0][1]+ +B[1][1])/2]}function S(B,O,V,z){B.on("start.zoom",function(){y(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){y(this,arguments).event(z).end()}).tween("zoom",function(){var u=this,E=arguments,x=y(u,E).event(z),h=_.apply(u,E),P=V==null?X(h):typeof V==="function"?V.apply(u,E):V,l=Math.max(h[1][0]-h[0][0],h[1][1]-h[0][1]),r=u.__zoom,t=typeof O==="function"?O.apply(u,E):O,e=A(r.invert(P).concat(l/r.k),t.invert(P).concat(l/t.k));return function(a){if(a===1)a=t;else{var o=e(a),A0=l/o[2];a=new B0(A0,P[0]-o[0]*A0,P[1]-o[1]*A0)}x.zoom(null,a)}})}function y(B,O,V){return!V&&B.__zooming||new D(B,O)}function D(B,O){this.that=B,this.args=O,this.active=0,this.sourceEvent=null,this.extent=_.apply(B,O),this.taps=0}D.prototype={event:function(B){if(B)this.sourceEvent=B;return this},start:function(){if(++this.active===1)this.that.__zooming=this,this.emit("start");return this},zoom:function(B,O){if(this.mouse&&B!=="mouse")this.mouse[1]=O.invert(this.mouse[0]);if(this.touch0&&B!=="touch")this.touch0[1]=O.invert(this.touch0[0]);if(this.touch1&&B!=="touch")this.touch1[1]=O.invert(this.touch1[0]);return this.that.__zoom=O,this.emit("zoom"),this},end:function(){if(--this.active===0)delete this.that.__zooming,this.emit("end");return this},emit:function(B){var O=f0(this.that).datum();U.call(B,this.that,new mQ(B,{sourceEvent:this.sourceEvent,target:Z,type:B,transform:this.that.__zoom,dispatch:U}),O)}};function R(B,...O){if(!f.apply(this,arguments))return;var V=y(this,O).event(B),z=this.__zoom,u=Math.max(q[0],Math.min(q[1],z.k*Math.pow(2,J.apply(this,arguments)))),E=q0(B);if(V.wheel){if(V.mouse[0][0]!==E[0]||V.mouse[0][1]!==E[1])V.mouse[1]=z.invert(V.mouse[0]=E);clearTimeout(V.wheel)}else if(z.k===u)return;else V.mouse=[E,z.invert(E)],D0(this),V.start();m0(B),V.wheel=setTimeout(x,Y),V.zoom("mouse",Q(H(C(z,u),V.mouse[0],V.mouse[1]),V.extent,F));function x(){V.wheel=null,V.end()}}function I(B,...O){if(j||!f.apply(this,arguments))return;var V=B.currentTarget,z=y(this,O,!0).event(B),u=f0(B.view).on("mousemove.zoom",P,!0).on("mouseup.zoom",l,!0),E=q0(B,V),x=B.clientX,h=B.clientY;n0(B.view),A_(B),z.mouse=[E,this.__zoom.invert(E)],D0(this),z.start();function P(r){if(m0(r),!z.moved){var t=r.clientX-x,e=r.clientY-h;z.moved=t*t+e*e>w}z.event(r).zoom("mouse",Q(H(z.that.__zoom,z.mouse[0]=q0(r,V),z.mouse[1]),z.extent,F))}function l(r){u.on("mousemove.zoom mouseup.zoom",null),Mf(r.view,z.moved),m0(r),z.event(r).end()}}function N(B,...O){if(!f.apply(this,arguments))return;var V=this.__zoom,z=q0(B.changedTouches?B.changedTouches[0]:B,this),u=V.invert(z),E=V.k*(B.shiftKey?0.5:2),x=Q(H(C(V,E),z,u),_.apply(this,O),F);if(m0(B),K>0)f0(this).transition().duration(K).call(S,x,z,B);else f0(this).call(Z.transform,x,z,B)}function T(B,...O){if(!f.apply(this,arguments))return;var V=B.touches,z=V.length,u=y(this,O,B.changedTouches.length===z).event(B),E,x,h,P;A_(B);for(x=0;x<z;++x)if(h=V[x],P=q0(h,this),P=[P,this.__zoom.invert(P),h.identifier],!u.touch0)u.touch0=P,E=!0,u.taps=1+!!W;else if(!u.touch1&&u.touch0[2]!==P[2])u.touch1=P,u.taps=0;if(W)W=clearTimeout(W);if(E){if(u.taps<2)G=P[0],W=setTimeout(function(){W=null},M);D0(this),u.start()}}function b(B,...O){if(!this.__zooming)return;var V=y(this,O).event(B),z=B.changedTouches,u=z.length,E,x,h,P;m0(B);for(E=0;E<u;++E)if(x=z[E],h=q0(x,this),V.touch0&&V.touch0[2]===x.identifier)V.touch0[0]=h;else if(V.touch1&&V.touch1[2]===x.identifier)V.touch1[0]=h;if(x=V.that.__zoom,V.touch1){var l=V.touch0[0],r=V.touch0[1],t=V.touch1[0],e=V.touch1[1],a=(a=t[0]-l[0])*a+(a=t[1]-l[1])*a,o=(o=e[0]-r[0])*o+(o=e[1]-r[1])*o;x=C(x,Math.sqrt(a/o)),h=[(l[0]+t[0])/2,(l[1]+t[1])/2],P=[(r[0]+e[0])/2,(r[1]+e[1])/2]}else if(V.touch0)h=V.touch0[0],P=V.touch0[1];else return;V.zoom("touch",Q(H(x,h,P),V.extent,F))}function k(B,...O){if(!this.__zooming)return;var V=y(this,O).event(B),z=B.changedTouches,u=z.length,E,x;if(A_(B),j)clearTimeout(j);j=setTimeout(function(){j=null},M);for(E=0;E<u;++E)if(x=z[E],V.touch0&&V.touch0[2]===x.identifier)delete V.touch0;else if(V.touch1&&V.touch1[2]===x.identifier)delete V.touch1;if(V.touch1&&!V.touch0)V.touch0=V.touch1,delete V.touch1;if(V.touch0)V.touch0[1]=this.__zoom.invert(V.touch0[0]);else if(V.end(),V.taps===2){if(x=q0(x,this),Math.hypot(G[0]-x[0],G[1]-x[1])<L){var h=f0(this).on("dblclick.zoom");if(h)h.apply(this,arguments)}}}return Z.wheelDelta=function(B){return arguments.length?(J=typeof B==="function"?B:Nf(+B),Z):J},Z.filter=function(B){return arguments.length?(f=typeof B==="function"?B:Nf(!!B),Z):f},Z.touchable=function(B){return arguments.length?($=typeof B==="function"?B:Nf(!!B),Z):$},Z.extent=function(B){return arguments.length?(_=typeof B==="function"?B:Nf([[+B[0][0],+B[0][1]],[+B[1][0],+B[1][1]]]),Z):_},Z.scaleExtent=function(B){return arguments.length?(q[0]=+B[0],q[1]=+B[1],Z):[q[0],q[1]]},Z.translateExtent=function(B){return arguments.length?(F[0][0]=+B[0][0],F[1][0]=+B[1][0],F[0][1]=+B[0][1],F[1][1]=+B[1][1],Z):[[F[0][0],F[0][1]],[F[1][0],F[1][1]]]},Z.constrain=function(B){return arguments.length?(Q=B,Z):Q},Z.duration=function(B){return arguments.length?(K=+B,Z):K},Z.interpolate=function(B){return arguments.length?(A=B,Z):A},Z.on=function(){var B=U.on.apply(U,arguments);return B===U?Z:B},Z.clickDistance=function(B){return arguments.length?(w=(B=+B)*B,Z):Math.sqrt(w)},Z.tapDistance=function(B){return arguments.length?(L=+B,Z):L},Z}var j_={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:(f)=>`Node type "${f}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:(f)=>`The old edge with id=${f} does not exist.`,error009:(f)=>`Marker type "${f}" doesn't exist.`,error008:(f,{id:_,sourceHandle:Q,targetHandle:J})=>`Couldn't create edge for ${f} handle id: "${f==="source"?Q:J}", edge id: ${_}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:(f)=>`Edge type "${f}" not found. Using fallback type "default".`,error012:(f)=>`Node with id "${f}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(f="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${f}/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."},W7=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var p0;(function(f){f.Strict="strict",f.Loose="loose"})(p0||(p0={}));var g0;(function(f){f.Free="free",f.Vertical="vertical",f.Horizontal="horizontal"})(g0||(g0={}));var a9;(function(f){f.Partial="partial",f.Full="full"})(a9||(a9={}));var d9;(function(f){f.Bezier="default",f.Straight="straight",f.Step="step",f.SmoothStep="smoothstep",f.SimpleBezier="simplebezier"})(d9||(d9={}));var cQ;(function(f){f.Arrow="arrow",f.ArrowClosed="arrowclosed"})(cQ||(cQ={}));var v;(function(f){f.Left="left",f.Top="top",f.Right="right",f.Bottom="bottom"})(v||(v={}));var vU={[v.Left]:v.Right,[v.Right]:v.Left,[v.Top]:v.Bottom,[v.Bottom]:v.Top};var G7=(f)=>("id"in f)&&("source"in f)&&("target"in f);var iQ=(f)=>("id"in f)&&("internals"in f)&&!("source"in f)&&!("target"in f),B7=(f,_,Q)=>{if(!f.id)return[];let J=new Set;return Q.forEach(($)=>{if($.source===f.id)J.add($.target)}),_.filter(($)=>J.has($.id))},j7=(f,_,Q)=>{if(!f.id)return[];let J=new Set;return Q.forEach(($)=>{if($.target===f.id)J.add($.source)}),_.filter(($)=>J.has($.id))},bf=(f,_=[0,0])=>{let{width:Q,height:J}=c0(f),$=f.origin??_,q=Q*$[0],F=J*$[1];return{x:f.position.x-q,y:f.position.y-F}},M7=(f,_={nodeOrigin:[0,0]})=>{if(!_.nodeLookup)console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows.");if(f.length===0)return{x:0,y:0,width:0,height:0};let Q=f.reduce((J,$)=>{let q=typeof $==="string",F=!_.nodeLookup&&!q?$:void 0;if(_.nodeLookup)F=q?_.nodeLookup.get($):!iQ($)?_.nodeLookup.get($.id):$;let K=F?B6(F,_.nodeOrigin):{x:0,y:0,x2:0,y2:0};return sQ(J,K)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return aQ(Q)},Z7=(f,_={})=>{let Q={x:1/0,y:1/0,x2:-1/0,y2:-1/0},J=!1;return f.forEach(($)=>{if(_.filter===void 0||_.filter($))Q=sQ(Q,B6($)),J=!0}),J?aQ(Q):{x:0,y:0,width:0,height:0}},V7=(f,_,[Q,J,$]=[0,0,1],q=!1,F=!1)=>{let K={...Ff(_,[Q,J,$]),width:_.width/$,height:_.height/$},A=[];for(let U of f.values()){let{measured:W,selectable:G=!0,hidden:j=!1}=U;if(F&&!G||j)continue;let M=W.width??U.width??U.initialWidth??null,Y=W.height??U.height??U.initialHeight??null,w=w7(K,dQ(U)),L=(M??0)*(Y??0),Z=q&&w>0;if(!U.internals.handleBounds||Z||w>=L||U.dragging)A.push(U)}return A},Y7=(f,_)=>{let Q=new Set;return f.forEach((J)=>{Q.add(J.id)}),_.filter((J)=>Q.has(J.source)||Q.has(J.target))};function X7(f,_){let Q=new Map,J=_?.nodes?new Set(_.nodes.map(($)=>$.id)):null;return f.forEach(($)=>{if($.measured.width&&$.measured.height&&(_?.includeHiddenNodes||!$.hidden)&&(!J||J.has($.id)))Q.set($.id,$)}),Q}async function W6({nodes:f,width:_,height:Q,panZoom:J,minZoom:$,maxZoom:q},F){if(f.size===0)return Promise.resolve(!0);let K=X7(f,F),A=Z7(K),U=R7(A,_,Q,F?.minZoom??$,F?.maxZoom??q,F?.padding??0.1);return await J.setViewport(U,{duration:F?.duration,ease:F?.ease,interpolate:F?.interpolate}),Promise.resolve(!0)}var M_=(f,_=0,Q=1)=>Math.min(Math.max(f,_),Q),qf=(f={x:0,y:0},_,Q)=>({x:M_(f.x,_[0][0],_[1][0]-(Q?.width??0)),y:M_(f.y,_[0][1],_[1][1]-(Q?.height??0))});function G6(f,_,Q){let{width:J,height:$}=c0(Q),{x:q,y:F}=Q.internals.positionAbsolute;return qf(f,[[q,F],[q+J,F+$]],_)}var sQ=(f,_)=>({x:Math.min(f.x,_.x),y:Math.min(f.y,_.y),x2:Math.max(f.x2,_.x2),y2:Math.max(f.y2,_.y2)}),t9=({x:f,y:_,width:Q,height:J})=>({x:f,y:_,x2:f+Q,y2:_+J}),aQ=({x:f,y:_,x2:Q,y2:J})=>({x:f,y:_,width:Q-f,height:J-_}),dQ=(f,_=[0,0])=>{let{x:Q,y:J}=iQ(f)?f.internals.positionAbsolute:bf(f,_);return{x:Q,y:J,width:f.measured?.width??f.width??f.initialWidth??0,height:f.measured?.height??f.height??f.initialHeight??0}},B6=(f,_=[0,0])=>{let{x:Q,y:J}=iQ(f)?f.internals.positionAbsolute:bf(f,_);return{x:Q,y:J,x2:Q+(f.measured?.width??f.width??f.initialWidth??0),y2:J+(f.measured?.height??f.height??f.initialHeight??0)}},L7=(f,_)=>aQ(sQ(t9(f),t9(_))),w7=(f,_)=>{let Q=Math.max(0,Math.min(f.x+f.width,_.x+_.width)-Math.max(f.x,_.x)),J=Math.max(0,Math.min(f.y+f.height,_.y+_.height)-Math.max(f.y,_.y));return Math.ceil(Q*J)};var lQ=(f)=>!isNaN(f)&&isFinite(f),rQ=(f,_)=>{console.warn(`[React Flow]: ${_} Help: https://reactflow.dev/error#${f}`)},j6=(f,_=[1,1])=>{return{x:_[0]*Math.round(f.x/_[0]),y:_[1]*Math.round(f.y/_[1])}},Ff=({x:f,y:_},[Q,J,$],q=!1,F=[1,1])=>{let K={x:(f-Q)/$,y:(_-J)/$};return q?j6(K,F):K},n9=({x:f,y:_},[Q,J,$])=>{return{x:f*$+Q,y:_*$+J}};function Jf(f,_){if(typeof f==="number")return Math.floor((_-_/(1+f))*0.5);if(typeof f==="string"&&f.endsWith("px")){let Q=parseFloat(f);if(!Number.isNaN(Q))return Math.floor(Q)}if(typeof f==="string"&&f.endsWith("%")){let Q=parseFloat(f);if(!Number.isNaN(Q))return Math.floor(_*Q*0.01)}return console.error(`[React Flow] The padding value "${f}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function T7(f,_,Q){if(typeof f==="string"||typeof f==="number"){let J=Jf(f,Q),$=Jf(f,_);return{top:J,right:$,bottom:J,left:$,x:$*2,y:J*2}}if(typeof f==="object"){let J=Jf(f.top??f.y??0,Q),$=Jf(f.bottom??f.y??0,Q),q=Jf(f.left??f.x??0,_),F=Jf(f.right??f.x??0,_);return{top:J,right:F,bottom:$,left:q,x:q+F,y:J+$}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function O7(f,_,Q,J,$,q){let{x:F,y:K}=n9(f,[_,Q,J]),{x:A,y:U}=n9({x:f.x+f.width,y:f.y+f.height},[_,Q,J]),W=$-A,G=q-U;return{left:Math.floor(F),top:Math.floor(K),right:Math.floor(W),bottom:Math.floor(G)}}var R7=(f,_,Q,J,$,q)=>{let F=T7(q,_,Q),K=(_-F.x)/f.width,A=(Q-F.y)/f.height,U=Math.min(K,A),W=M_(U,J,$),G=f.x+f.width/2,j=f.y+f.height/2,M=_/2-G*W,Y=Q/2-j*W,w=O7(f,M,Y,W,_,Q),L={left:Math.min(w.left-F.left,0),top:Math.min(w.top-F.top,0),right:Math.min(w.right-F.right,0),bottom:Math.min(w.bottom-F.bottom,0)};return{x:M-L.left+L.right,y:Y-L.top+L.bottom,zoom:W}},M6=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Z_(f){return f!==void 0&&f!==null&&f!=="parent"}function c0(f){return{width:f.measured?.width??f.width??f.initialWidth??0,height:f.measured?.height??f.height??f.initialHeight??0}}function o9(f,{snapGrid:_=[0,0],snapToGrid:Q=!1,transform:J,containerBounds:$}){let{x:q,y:F}=H7(f),K=Ff({x:q-($?.left??0),y:F-($?.top??0)},J),{x:A,y:U}=Q?j6(K,_):K;return{xSnapped:A,ySnapped:U,...K}}var Z6=(f)=>({width:f.offsetWidth,height:f.offsetHeight});var z7=(f)=>("clientX"in f),H7=(f,_)=>{let Q=z7(f),J=Q?f.clientX:f.touches?.[0].clientX,$=Q?f.clientY:f.touches?.[0].clientY;return{x:J-(_?.left??0),y:$-(_?.top??0)}},e9=(f,_,Q,J,$)=>{let q=_.querySelectorAll(`.${f}`);if(!q||!q.length)return null;return Array.from(q).map((F)=>{let K=F.getBoundingClientRect();return{id:F.getAttribute("data-handleid"),type:f,nodeId:$,position:F.getAttribute("data-handlepos"),x:(K.left-Q.left)/J,y:(K.top-Q.top)/J,...Z6(F)}})};function D7({sourceX:f,sourceY:_,targetX:Q,targetY:J,sourceControlX:$,sourceControlY:q,targetControlX:F,targetControlY:K}){let A=f*0.125+$*0.375+F*0.375+Q*0.125,U=_*0.125+q*0.375+K*0.375+J*0.125,W=Math.abs(A-f),G=Math.abs(U-_);return[A,U,W,G]}function G_(f,_){if(f>=0)return 0.5*f;return _*25*Math.sqrt(-f)}function f6({pos:f,x1:_,y1:Q,x2:J,y2:$,c:q}){switch(f){case v.Left:return[_-G_(_-J,q),Q];case v.Right:return[_+G_(J-_,q),Q];case v.Top:return[_,Q-G_(Q-$,q)];case v.Bottom:return[_,Q+G_($-Q,q)]}}function tQ({sourceX:f,sourceY:_,sourcePosition:Q=v.Bottom,targetX:J,targetY:$,targetPosition:q=v.Top,curvature:F=0.25}){let[K,A]=f6({pos:Q,x1:f,y1:_,x2:J,y2:$,c:F}),[U,W]=f6({pos:q,x1:J,y1:$,x2:f,y2:_,c:F}),[G,j,M,Y]=D7({sourceX:f,sourceY:_,targetX:J,targetY:$,sourceControlX:K,sourceControlY:A,targetControlX:U,targetControlY:W});return[`M${f},${_} C${K},${A} ${U},${W} ${J},${$}`,G,j,M,Y]}function V6({sourceX:f,sourceY:_,targetX:Q,targetY:J}){let $=Math.abs(Q-f)/2,q=Q<f?Q+$:Q-$,F=Math.abs(J-_)/2,K=J<_?J+F:J-F;return[q,K,$,F]}var Y6=({source:f,sourceHandle:_,target:Q,targetHandle:J})=>`xy-edge__${f}${_||""}-${Q}${J||""}`,C7=(f,_)=>{return _.some((Q)=>Q.source===f.source&&Q.target===f.target&&(Q.sourceHandle===f.sourceHandle||!Q.sourceHandle&&!f.sourceHandle)&&(Q.targetHandle===f.targetHandle||!Q.targetHandle&&!f.targetHandle))},X6=(f,_,Q={})=>{if(!f.source||!f.target)return rQ("006",j_.error006()),_;let J=Q.getEdgeId||Y6,$;if(G7(f))$={...f};else $={...f,id:J(f)};if(C7($,_))return _;if($.sourceHandle===null)delete $.sourceHandle;if($.targetHandle===null)delete $.targetHandle;return _.concat($)},V_=(f,_,Q,J={shouldReplaceId:!0})=>{let{id:$,...q}=f;if(!_.source||!_.target)return rQ("006",j_.error006()),Q;if(!Q.find((U)=>U.id===f.id))return rQ("007",j_.error007($)),Q;let K=J.getEdgeId||Y6,A={...q,id:J.shouldReplaceId?K(_):$,source:_.source,target:_.target,sourceHandle:_.sourceHandle,targetHandle:_.targetHandle};return Q.filter((U)=>U.id!==$).concat(A)};function nQ({sourceX:f,sourceY:_,targetX:Q,targetY:J}){let[$,q,F,K]=V6({sourceX:f,sourceY:_,targetX:Q,targetY:J});return[`M ${f},${_}L ${Q},${J}`,$,q,F,K]}var _6={[v.Left]:{x:-1,y:0},[v.Right]:{x:1,y:0},[v.Top]:{x:0,y:-1},[v.Bottom]:{x:0,y:1}},I7=({source:f,sourcePosition:_=v.Bottom,target:Q})=>{if(_===v.Left||_===v.Right)return f.x<Q.x?{x:1,y:0}:{x:-1,y:0};return f.y<Q.y?{x:0,y:1}:{x:0,y:-1}},Q6=(f,_)=>Math.sqrt(Math.pow(_.x-f.x,2)+Math.pow(_.y-f.y,2));function S7({source:f,sourcePosition:_=v.Bottom,target:Q,targetPosition:J=v.Top,center:$,offset:q,stepPosition:F}){let K=_6[_],A=_6[J],U={x:f.x+K.x*q,y:f.y+K.y*q},W={x:Q.x+A.x*q,y:Q.y+A.y*q},G=I7({source:U,sourcePosition:_,target:W}),j=G.x!==0?"x":"y",M=G[j],Y=[],w,L,Z={x:0,y:0},C={x:0,y:0},[,,H,X]=V6({sourceX:f.x,sourceY:f.y,targetX:Q.x,targetY:Q.y});if(K[j]*A[j]===-1){if(j==="x")w=$.x??U.x+(W.x-U.x)*F,L=$.y??(U.y+W.y)/2;else w=$.x??(U.x+W.x)/2,L=$.y??U.y+(W.y-U.y)*F;let R=[{x:w,y:U.y},{x:w,y:W.y}],I=[{x:U.x,y:L},{x:W.x,y:L}];if(K[j]===M)Y=j==="x"?R:I;else Y=j==="x"?I:R}else{let R=[{x:U.x,y:W.y}],I=[{x:W.x,y:U.y}];if(j==="x")Y=K.x===M?I:R;else Y=K.y===M?R:I;if(_===J){let B=Math.abs(f[j]-Q[j]);if(B<=q){let O=Math.min(q-1,q-B);if(K[j]===M)Z[j]=(U[j]>f[j]?-1:1)*O;else C[j]=(W[j]>Q[j]?-1:1)*O}}if(_!==J){let B=j==="x"?"y":"x",O=K[j]===A[B],V=U[B]>W[B],z=U[B]<W[B];if(K[j]===1&&(!O&&V||O&&z)||K[j]!==1&&(!O&&z||O&&V))Y=j==="x"?R:I}let N={x:U.x+Z.x,y:U.y+Z.y},T={x:W.x+C.x,y:W.y+C.y},b=Math.max(Math.abs(N.x-Y[0].x),Math.abs(T.x-Y[0].x)),k=Math.max(Math.abs(N.y-Y[0].y),Math.abs(T.y-Y[0].y));if(b>=k)w=(N.x+T.x)/2,L=Y[0].y;else w=Y[0].x,L=(N.y+T.y)/2}let S={x:U.x+Z.x,y:U.y+Z.y},y={x:W.x+C.x,y:W.y+C.y};return[[f,...S.x!==Y[0].x||S.y!==Y[0].y?[S]:[],...Y,...y.x!==Y[Y.length-1].x||y.y!==Y[Y.length-1].y?[y]:[],Q],w,L,H,X]}function E7(f,_,Q,J){let $=Math.min(Q6(f,_)/2,Q6(_,Q)/2,J),{x:q,y:F}=_;if(f.x===q&&q===Q.x||f.y===F&&F===Q.y)return`L${q} ${F}`;if(f.y===F){let U=f.x<Q.x?-1:1,W=f.y<Q.y?1:-1;return`L ${q+$*U},${F}Q ${q},${F} ${q},${F+$*W}`}let K=f.x<Q.x?1:-1,A=f.y<Q.y?-1:1;return`L ${q},${F+$*A}Q ${q},${F} ${q+$*K},${F}`}function Kf({sourceX:f,sourceY:_,sourcePosition:Q=v.Bottom,targetX:J,targetY:$,targetPosition:q=v.Top,borderRadius:F=5,centerX:K,centerY:A,offset:U=20,stepPosition:W=0.5}){let[G,j,M,Y,w]=S7({source:{x:f,y:_},sourcePosition:Q,target:{x:J,y:$},targetPosition:q,center:{x:K,y:A},offset:U,stepPosition:W}),L=`M${G[0].x} ${G[0].y}`;for(let Z=1;Z<G.length-1;Z++)L+=E7(G[Z-1],G[Z],G[Z+1],F);return L+=`L${G[G.length-1].x} ${G[G.length-1].y}`,[L,j,M,Y,w]}function J6(f){return f&&!!(f.internals.handleBounds||f.handles?.length)&&!!(f.measured.width||f.width||f.initialWidth)}function L6(f){let{sourceNode:_,targetNode:Q}=f;if(!J6(_)||!J6(Q))return null;let J=_.internals.handleBounds||$6(_.handles),$=Q.internals.handleBounds||$6(Q.handles),q=F6(J?.source??[],f.sourceHandle),F=F6(f.connectionMode===p0.Strict?$?.target??[]:($?.target??[]).concat($?.source??[]),f.targetHandle);if(!q||!F)return f.onError?.("008",j_.error008(!q?"source":"target",{id:f.id,sourceHandle:f.sourceHandle,targetHandle:f.targetHandle})),null;let K=q?.position||v.Bottom,A=F?.position||v.Top,U=q6(_,q,K),W=q6(Q,F,A);return{sourceX:U.x,sourceY:U.y,targetX:W.x,targetY:W.y,sourcePosition:K,targetPosition:A}}function $6(f){if(!f)return null;let _=[],Q=[];for(let J of f)if(J.width=J.width??1,J.height=J.height??1,J.type==="source")_.push(J);else if(J.type==="target")Q.push(J);return{source:_,target:Q}}function q6(f,_,Q=v.Left,J=!1){let $=(_?.x??0)+f.internals.positionAbsolute.x,q=(_?.y??0)+f.internals.positionAbsolute.y,{width:F,height:K}=_??c0(f);if(J)return{x:$+F/2,y:q+K/2};switch(_?.position??Q){case v.Top:return{x:$+F/2,y:q};case v.Right:return{x:$+F,y:q+K/2};case v.Bottom:return{x:$+F/2,y:q+K};case v.Left:return{x:$,y:q+K/2}}}function F6(f,_){if(!f)return null;return(!_?f[0]:f.find((Q)=>Q.id===_))||null}var y7={left:0,center:50,right:100},N7={top:0,center:50,bottom:100};function u7(f,_,Q,J="center",$="center"){return`translate(${f}px, ${_}px) scale(${1/Q}) translate(${-(y7[J]??50)}%, ${-(N7[$]??50)}%)`}var w6=1000,b7=10,oQ={nodeOrigin:[0,0],nodeExtent:W7,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},x7={...oQ,checkEquality:!0};function eQ(f,_){let Q={...f};for(let J in _)if(_[J]!==void 0)Q[J]=_[J];return Q}function T6(f,_,Q){let J=eQ(oQ,Q);for(let $ of f.values())if($.parentId)_9($,f,_,J);else{let q=bf($,J.nodeOrigin),F=Z_($.extent)?$.extent:J.nodeExtent,K=qf(q,F,c0($));$.internals.positionAbsolute=K}}function k7(f,_){if(!f.handles)return!f.measured?void 0:_?.internals.handleBounds;let Q=[],J=[];for(let $ of f.handles){let q={id:$.id,width:$.width??1,height:$.height??1,nodeId:f.id,x:$.x,y:$.y,position:$.position,type:$.type};if($.type==="source")Q.push(q);else if($.type==="target")J.push(q)}return{source:Q,target:J}}function f9(f){return f==="manual"}function O6(f,_,Q,J={}){let $=eQ(x7,J),q={i:0},F=new Map(_),K=$?.elevateNodesOnSelect&&!f9($.zIndexMode)?w6:0,A=f.length>0,U=!1;_.clear(),Q.clear();for(let W of f){let G=F.get(W.id);if($.checkEquality&&W===G?.internals.userNode)_.set(W.id,G);else{let j=bf(W,$.nodeOrigin),M=Z_(W.extent)?W.extent:$.nodeExtent,Y=qf(j,M,c0(W));G={...$.defaults,...W,measured:{width:W.measured?.width,height:W.measured?.height},internals:{positionAbsolute:Y,handleBounds:k7(W,G),z:R6(W,K,$.zIndexMode),userNode:W}},_.set(W.id,G)}if((G.measured===void 0||G.measured.width===void 0||G.measured.height===void 0)&&!G.hidden)A=!1;if(W.parentId)_9(G,_,Q,J,q);U||=W.selected??!1}return{nodesInitialized:A,hasSelectedNodes:U}}function P7(f,_){if(!f.parentId)return;let Q=_.get(f.parentId);if(Q)Q.set(f.id,f);else _.set(f.parentId,new Map([[f.id,f]]))}function _9(f,_,Q,J,$){let{elevateNodesOnSelect:q,nodeOrigin:F,nodeExtent:K,zIndexMode:A}=eQ(oQ,J),U=f.parentId,W=_.get(U);if(!W){console.warn(`Parent node ${U} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}if(P7(f,Q),$&&!W.parentId&&W.internals.rootParentIndex===void 0&&A==="auto")W.internals.rootParentIndex=++$.i,W.internals.z=W.internals.z+$.i*b7;if($&&W.internals.rootParentIndex!==void 0)$.i=W.internals.rootParentIndex;let G=q&&!f9(A)?w6:0,{x:j,y:M,z:Y}=h7(f,W,F,K,G,A),{positionAbsolute:w}=f.internals,L=j!==w.x||M!==w.y;if(L||Y!==f.internals.z)_.set(f.id,{...f,internals:{...f.internals,positionAbsolute:L?{x:j,y:M}:w,z:Y}})}function R6(f,_,Q){let J=lQ(f.zIndex)?f.zIndex:0;if(f9(Q))return J;return J+(f.selected?_:0)}function h7(f,_,Q,J,$,q){let{x:F,y:K}=_.internals.positionAbsolute,A=c0(f),U=bf(f,Q),W=Z_(f.extent)?qf(U,f.extent,A):U,G=qf({x:F+W.x,y:K+W.y},J,A);if(f.extent==="parent")G=G6(G,A,_);let j=R6(f,$,q),M=_.internals.z??0;return{x:G.x,y:G.y,z:M>=j?M+1:j}}function v7(f,_,Q,J=[0,0]){let $=[],q=new Map;for(let F of f){let K=_.get(F.parentId);if(!K)continue;let A=q.get(F.parentId)?.expandedRect??dQ(K),U=L7(A,F.rect);q.set(F.parentId,{expandedRect:U,parent:K})}if(q.size>0)q.forEach(({expandedRect:F,parent:K},A)=>{let U=K.internals.positionAbsolute,W=c0(K),G=K.origin??J,j=F.x<U.x?Math.round(Math.abs(U.x-F.x)):0,M=F.y<U.y?Math.round(Math.abs(U.y-F.y)):0,Y=Math.max(W.width,Math.round(F.width)),w=Math.max(W.height,Math.round(F.height)),L=(Y-W.width)*G[0],Z=(w-W.height)*G[1];if(j>0||M>0||L||Z)$.push({id:A,type:"position",position:{x:K.position.x-j+L,y:K.position.y-M+Z}}),Q.get(A)?.forEach((C)=>{if(!f.some((H)=>H.id===C.id))$.push({id:C.id,type:"position",position:{x:C.position.x+j,y:C.position.y+M}})});if(W.width<F.width||W.height<F.height||j||M)$.push({id:A,type:"dimensions",setAttributes:!0,dimensions:{width:Y+(j?G[0]*j-L:0),height:w+(M?G[1]*M-Z:0)}})});return $}function z6(f,_,Q,J,$,q,F){let K=J?.querySelector(".xyflow__viewport"),A=!1;if(!K)return{changes:[],updatedInternals:A};let U=[],W=window.getComputedStyle(K),{m22:G}=new window.DOMMatrixReadOnly(W.transform),j=[];for(let M of f.values()){let Y=_.get(M.id);if(!Y)continue;if(Y.hidden){_.set(Y.id,{...Y,internals:{...Y.internals,handleBounds:void 0}}),A=!0;continue}let w=Z6(M.nodeElement),L=Y.measured.width!==w.width||Y.measured.height!==w.height;if(!!(w.width&&w.height&&(L||!Y.internals.handleBounds||M.force))){let C=M.nodeElement.getBoundingClientRect(),H=Z_(Y.extent)?Y.extent:q,{positionAbsolute:X}=Y.internals;if(Y.parentId&&Y.extent==="parent")X=G6(X,w,_.get(Y.parentId));else if(H)X=qf(X,H,w);let S={...Y,measured:w,internals:{...Y.internals,positionAbsolute:X,handleBounds:{source:e9("source",M.nodeElement,C,G,Y.id),target:e9("target",M.nodeElement,C,G,Y.id)}}};if(_.set(Y.id,S),Y.parentId)_9(S,_,Q,{nodeOrigin:$,zIndexMode:F});if(A=!0,L){if(U.push({id:Y.id,type:"dimensions",dimensions:w}),Y.expandParent&&Y.parentId)j.push({id:Y.id,parentId:Y.parentId,rect:dQ(S,$)})}}}if(j.length>0){let M=v7(j,_,Q,$);U.push(...M)}return{changes:U,updatedInternals:A}}async function H6({delta:f,panZoom:_,transform:Q,translateExtent:J,width:$,height:q}){if(!_||!f.x&&!f.y)return Promise.resolve(!1);let F=await _.setViewportConstrained({x:Q[0]+f.x,y:Q[1]+f.y,zoom:Q[2]},[[0,0],[$,q]],J),K=!!F&&(F.x!==Q[0]||F.y!==Q[1]||F.k!==Q[2]);return Promise.resolve(K)}function K6(f,_,Q,J,$,q){let F=$,K=J.get(F)||new Map;J.set(F,K.set(Q,_)),F=`${$}-${f}`;let A=J.get(F)||new Map;if(J.set(F,A.set(Q,_)),q){F=`${$}-${f}-${q}`;let U=J.get(F)||new Map;J.set(F,U.set(Q,_))}}function D6(f,_,Q){f.clear(),_.clear();for(let J of Q){let{source:$,target:q,sourceHandle:F=null,targetHandle:K=null}=J,A={edgeId:J.id,source:$,target:q,sourceHandle:F,targetHandle:K},U=`${$}-${F}--${q}-${K}`,W=`${q}-${K}--${$}-${F}`;K6("source",A,W,f,$,F),K6("target",A,U,f,q,K),_.set(J.id,J)}}var Y_=(f)=>({x:f.x,y:f.y,zoom:f.k}),gQ=({x:f,y:_,zoom:Q})=>v0.translate(f,_).scale(Q),$f=(f,_)=>f.target.closest(`.${_}`),C6=(f,_)=>_===2&&Array.isArray(f)&&f.includes(2),m7=(f)=>((f*=2)<=1?f*f*f:(f-=2)*f*f+2)/2,pQ=(f,_=0,Q=m7,J=()=>{})=>{let $=typeof _==="number"&&_>0;if(!$)J();return $?f.transition().duration(_).ease(Q).on("end",J):f},I6=(f)=>{let _=f.ctrlKey&&M6()?10:1;return-f.deltaY*(f.deltaMode===1?0.05:f.deltaMode?1:0.002)*_};function g7({zoomPanValues:f,noWheelClassName:_,d3Selection:Q,d3Zoom:J,panOnScrollMode:$,panOnScrollSpeed:q,zoomOnPinch:F,onPanZoomStart:K,onPanZoom:A,onPanZoomEnd:U}){return(W)=>{if($f(W,_)){if(W.ctrlKey)W.preventDefault();return!1}W.preventDefault(),W.stopImmediatePropagation();let G=Q.property("__zoom").k||1;if(W.ctrlKey&&F){let L=q0(W),Z=I6(W),C=G*Math.pow(2,Z);J.scaleTo(Q,C,L,W);return}let j=W.deltaMode===1?20:1,M=$===g0.Vertical?0:W.deltaX*j,Y=$===g0.Horizontal?0:W.deltaY*j;if(!M6()&&W.shiftKey&&$!==g0.Vertical)M=W.deltaY*j,Y=0;J.translateBy(Q,-(M/G)*q,-(Y/G)*q,{internal:!0});let w=Y_(Q.property("__zoom"));if(clearTimeout(f.panScrollTimeout),!f.isPanScrolling)f.isPanScrolling=!0,K?.(W,w);else A?.(W,w),f.panScrollTimeout=setTimeout(()=>{U?.(W,w),f.isPanScrolling=!1},150)}}function p7({noWheelClassName:f,preventScrolling:_,d3ZoomHandler:Q}){return function(J,$){let q=J.type==="wheel",F=!_&&q&&!J.ctrlKey,K=$f(J,f);if(J.ctrlKey&&q&&K)J.preventDefault();if(F||K)return null;J.preventDefault(),Q.call(this,J,$)}}function c7({zoomPanValues:f,onDraggingChange:_,onPanZoomStart:Q}){return(J)=>{if(J.sourceEvent?.internal)return;let $=Y_(J.transform);if(f.mouseButton=J.sourceEvent?.button||0,f.isZoomingOrPanning=!0,f.prevViewport=$,J.sourceEvent?.type==="mousedown")_(!0);if(Q)Q?.(J.sourceEvent,$)}}function l7({zoomPanValues:f,panOnDrag:_,onPaneContextMenu:Q,onTransformChange:J,onPanZoom:$}){return(q)=>{if(f.usedRightMouseButton=!!(Q&&C6(_,f.mouseButton??0)),!q.sourceEvent?.sync)J([q.transform.x,q.transform.y,q.transform.k]);if($&&!q.sourceEvent?.internal)$?.(q.sourceEvent,Y_(q.transform))}}function r7({zoomPanValues:f,panOnDrag:_,panOnScroll:Q,onDraggingChange:J,onPanZoomEnd:$,onPaneContextMenu:q}){return(F)=>{if(F.sourceEvent?.internal)return;if(f.isZoomingOrPanning=!1,q&&C6(_,f.mouseButton??0)&&!f.usedRightMouseButton&&F.sourceEvent)q(F.sourceEvent);if(f.usedRightMouseButton=!1,J(!1),$){let K=Y_(F.transform);f.prevViewport=K,clearTimeout(f.timerId),f.timerId=setTimeout(()=>{$?.(F.sourceEvent,K)},Q?150:0)}}}function i7({zoomActivationKeyPressed:f,zoomOnScroll:_,zoomOnPinch:Q,panOnDrag:J,panOnScroll:$,zoomOnDoubleClick:q,userSelectionActive:F,noWheelClassName:K,noPanClassName:A,lib:U,connectionInProgress:W}){return(G)=>{let j=f||_,M=Q&&G.ctrlKey,Y=G.type==="wheel";if(G.button===1&&G.type==="mousedown"&&($f(G,`${U}-flow__node`)||$f(G,`${U}-flow__edge`)))return!0;if(!J&&!j&&!$&&!q&&!Q)return!1;if(F)return!1;if(W&&!Y)return!1;if($f(G,K)&&Y)return!1;if($f(G,A)&&(!Y||$&&Y&&!f))return!1;if(!Q&&G.ctrlKey&&Y)return!1;if(!Q&&G.type==="touchstart"&&G.touches?.length>1)return G.preventDefault(),!1;if(!j&&!$&&!M&&Y)return!1;if(!J&&(G.type==="mousedown"||G.type==="touchstart"))return!1;if(Array.isArray(J)&&!J.includes(G.button)&&G.type==="mousedown")return!1;let w=Array.isArray(J)&&J.includes(G.button)||!G.button||G.button<=1;return(!G.ctrlKey||Y)&&w}}function S6({domNode:f,minZoom:_,maxZoom:Q,translateExtent:J,viewport:$,onPanZoom:q,onPanZoomStart:F,onPanZoomEnd:K,onDraggingChange:A}){let U={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},W=f.getBoundingClientRect(),G=W_().scaleExtent([_,Q]).translateExtent(J),j=f0(f).call(G);C({x:$.x,y:$.y,zoom:M_($.zoom,_,Q)},[[0,0],[W.width,W.height]],J);let M=j.on("wheel.zoom"),Y=j.on("dblclick.zoom");G.wheelDelta(I6);function w(T,b){if(j)return new Promise((k)=>{G?.interpolate(b?.interpolate==="linear"?V0:P0).transform(pQ(j,b?.duration,b?.ease,()=>k(!0)),T)});return Promise.resolve(!1)}function L({noWheelClassName:T,noPanClassName:b,onPaneContextMenu:k,userSelectionActive:B,panOnScroll:O,panOnDrag:V,panOnScrollMode:z,panOnScrollSpeed:u,preventScrolling:E,zoomOnPinch:x,zoomOnScroll:h,zoomOnDoubleClick:P,zoomActivationKeyPressed:l,lib:r,onTransformChange:t,connectionInProgress:e,paneClickDistance:a,selectionOnDrag:o}){if(B&&!U.isZoomingOrPanning)Z();let A0=O&&!l&&!B;G.clickDistance(o?1/0:!lQ(a)||a<0?0:a);let O0=A0?g7({zoomPanValues:U,noWheelClassName:T,d3Selection:j,d3Zoom:G,panOnScrollMode:z,panOnScrollSpeed:u,zoomOnPinch:x,onPanZoomStart:F,onPanZoom:q,onPanZoomEnd:K}):p7({noWheelClassName:T,preventScrolling:E,d3ZoomHandler:M});if(j.on("wheel.zoom",O0,{passive:!1}),!B){let i0=c7({zoomPanValues:U,onDraggingChange:A,onPanZoomStart:F});G.on("start",i0);let s0=l7({zoomPanValues:U,panOnDrag:V,onPaneContextMenu:!!k,onPanZoom:q,onTransformChange:t});G.on("zoom",s0);let Af=r7({zoomPanValues:U,panOnDrag:V,panOnScroll:O,onPaneContextMenu:k,onPanZoomEnd:K,onDraggingChange:A});G.on("end",Af)}let S0=i7({zoomActivationKeyPressed:l,panOnDrag:V,zoomOnScroll:h,panOnScroll:O,zoomOnDoubleClick:P,zoomOnPinch:x,userSelectionActive:B,noPanClassName:b,noWheelClassName:T,lib:r,connectionInProgress:e});if(G.filter(S0),P)j.on("dblclick.zoom",Y);else j.on("dblclick.zoom",null)}function Z(){G.on("zoom",null)}async function C(T,b,k){let B=gQ(T),O=G?.constrain()(B,b,k);if(O)await w(O);return new Promise((V)=>V(O))}async function H(T,b){let k=gQ(T);return await w(k,b),new Promise((B)=>B(k))}function X(T){if(j){let b=gQ(T),k=j.property("__zoom");if(k.k!==T.zoom||k.x!==T.x||k.y!==T.y)G?.transform(j,b,null,{sync:!0})}}function S(){let T=j?uf(j.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}function y(T,b){if(j)return new Promise((k)=>{G?.interpolate(b?.interpolate==="linear"?V0:P0).scaleTo(pQ(j,b?.duration,b?.ease,()=>k(!0)),T)});return Promise.resolve(!1)}function D(T,b){if(j)return new Promise((k)=>{G?.interpolate(b?.interpolate==="linear"?V0:P0).scaleBy(pQ(j,b?.duration,b?.ease,()=>k(!0)),T)});return Promise.resolve(!1)}function R(T){G?.scaleExtent(T)}function I(T){G?.translateExtent(T)}function N(T){let b=!lQ(T)||T<0?0:T;G?.clickDistance(b)}return{update:L,destroy:Z,setViewport:H,setViewportConstrained:C,getViewport:S,scaleTo:y,scaleBy:D,setScaleExtent:R,setTranslateExtent:I,syncViewport:X,setClickDistance:N}}var Y0;(function(f){f.Line="line",f.Handle="handle"})(Y0||(Y0={}));var E6=["top-left","top-right","bottom-left","bottom-right"],y6=["top","right","bottom","left"];function s7({width:f,prevWidth:_,height:Q,prevHeight:J,affectsX:$,affectsY:q}){let F=f-_,K=Q-J,A=[F>0?1:F<0?-1:0,K>0?1:K<0?-1:0];if(F&&$)A[0]=A[0]*-1;if(K&&q)A[1]=A[1]*-1;return A}function U6(f){let _=f.includes("right")||f.includes("left"),Q=f.includes("bottom")||f.includes("top"),J=f.includes("left"),$=f.includes("top");return{isHorizontal:_,isVertical:Q,affectsX:J,affectsY:$}}function C0(f,_){return Math.max(0,_-f)}function I0(f,_){return Math.max(0,f-_)}function B_(f,_,Q){return Math.max(0,_-f,f-Q)}function A6(f,_){return f?!_:_}function a7(f,_,Q,J,$,q,F,K){let{affectsX:A,affectsY:U}=_,{isHorizontal:W,isVertical:G}=_,j=W&&G,{xSnapped:M,ySnapped:Y}=Q,{minWidth:w,maxWidth:L,minHeight:Z,maxHeight:C}=J,{x:H,y:X,width:S,height:y,aspectRatio:D}=f,R=Math.floor(W?M-f.pointerX:0),I=Math.floor(G?Y-f.pointerY:0),N=S+(A?-R:R),T=y+(U?-I:I),b=-q[0]*S,k=-q[1]*y,B=B_(N,w,L),O=B_(T,Z,C);if(F){let u=0,E=0;if(A&&R<0)u=C0(H+R+b,F[0][0]);else if(!A&&R>0)u=I0(H+N+b,F[1][0]);if(U&&I<0)E=C0(X+I+k,F[0][1]);else if(!U&&I>0)E=I0(X+T+k,F[1][1]);B=Math.max(B,u),O=Math.max(O,E)}if(K){let u=0,E=0;if(A&&R>0)u=I0(H+R,K[0][0]);else if(!A&&R<0)u=C0(H+N,K[1][0]);if(U&&I>0)E=I0(X+I,K[0][1]);else if(!U&&I<0)E=C0(X+T,K[1][1]);B=Math.max(B,u),O=Math.max(O,E)}if($){if(W){let u=B_(N/D,Z,C)*D;if(B=Math.max(B,u),F){let E=0;if(!A&&!U||A&&!U&&j)E=I0(X+k+N/D,F[1][1])*D;else E=C0(X+k+(A?R:-R)/D,F[0][1])*D;B=Math.max(B,E)}if(K){let E=0;if(!A&&!U||A&&!U&&j)E=C0(X+N/D,K[1][1])*D;else E=I0(X+(A?R:-R)/D,K[0][1])*D;B=Math.max(B,E)}}if(G){let u=B_(T*D,w,L)/D;if(O=Math.max(O,u),F){let E=0;if(!A&&!U||U&&!A&&j)E=I0(H+T*D+b,F[1][0])/D;else E=C0(H+(U?I:-I)*D+b,F[0][0])/D;O=Math.max(O,E)}if(K){let E=0;if(!A&&!U||U&&!A&&j)E=C0(H+T*D,K[1][0])/D;else E=I0(H+(U?I:-I)*D,K[0][0])/D;O=Math.max(O,E)}}}if(I=I+(I<0?O:-O),R=R+(R<0?B:-B),$)if(j)if(N>T*D)I=(A6(A,U)?-R:R)/D;else R=(A6(A,U)?-I:I)*D;else if(W)I=R/D,U=A;else R=I*D,A=U;let V=A?H+R:H,z=U?X+I:X;return{width:S+(A?-R:R),height:y+(U?-I:I),x:q[0]*R*(!A?1:-1)+V,y:q[1]*I*(!U?1:-1)+z}}var N6={width:0,height:0,x:0,y:0},d7={...N6,pointerX:0,pointerY:0,aspectRatio:1};function t7(f){return[[0,0],[f.measured.width,f.measured.height]]}function n7(f,_,Q){let J=_.position.x+f.position.x,$=_.position.y+f.position.y,q=f.measured.width??0,F=f.measured.height??0,K=Q[0]*q,A=Q[1]*F;return[[J-K,$-A],[J+q-K,$+F-A]]}function u6({domNode:f,nodeId:_,getStoreItems:Q,onChange:J,onEnd:$}){let q=f0(f),F={controlDirection:U6("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function K({controlPosition:U,boundaries:W,keepAspectRatio:G,resizeDirection:j,onResizeStart:M,onResize:Y,onResizeEnd:w,shouldResize:L}){let Z={...N6},C={...d7};F={boundaries:W,resizeDirection:j,keepAspectRatio:G,controlDirection:U6(U)};let H=void 0,X=null,S=[],y=void 0,D=void 0,R=void 0,I=!1,N=lf().on("start",(T)=>{let{nodeLookup:b,transform:k,snapGrid:B,snapToGrid:O,nodeOrigin:V,paneDomNode:z}=Q();if(H=b.get(_),!H)return;X=z?.getBoundingClientRect()??null;let{xSnapped:u,ySnapped:E}=o9(T.sourceEvent,{transform:k,snapGrid:B,snapToGrid:O,containerBounds:X});if(Z={width:H.measured.width??0,height:H.measured.height??0,x:H.position.x??0,y:H.position.y??0},C={...Z,pointerX:u,pointerY:E,aspectRatio:Z.width/Z.height},y=void 0,H.parentId&&(H.extent==="parent"||H.expandParent))y=b.get(H.parentId),D=y&&H.extent==="parent"?t7(y):void 0;S=[],R=void 0;for(let[x,h]of b)if(h.parentId===_){if(S.push({id:x,position:{...h.position},extent:h.extent}),h.extent==="parent"||h.expandParent){let P=n7(h,H,h.origin??V);if(R)R=[[Math.min(P[0][0],R[0][0]),Math.min(P[0][1],R[0][1])],[Math.max(P[1][0],R[1][0]),Math.max(P[1][1],R[1][1])]];else R=P}}M?.(T,{...Z})}).on("drag",(T)=>{let{transform:b,snapGrid:k,snapToGrid:B,nodeOrigin:O}=Q(),V=o9(T.sourceEvent,{transform:b,snapGrid:k,snapToGrid:B,containerBounds:X}),z=[];if(!H)return;let{x:u,y:E,width:x,height:h}=Z,P={},l=H.origin??O,{width:r,height:t,x:e,y:a}=a7(C,F.controlDirection,V,F.boundaries,F.keepAspectRatio,l,D,R),o=r!==x,A0=t!==h,O0=e!==u&&o,S0=a!==E&&A0;if(!O0&&!S0&&!o&&!A0)return;if(O0||S0||l[0]===1||l[1]===1){if(P.x=O0?e:Z.x,P.y=S0?a:Z.y,Z.x=P.x,Z.y=P.y,S.length>0){let E0=e-u,y0=a-E;for(let a0 of S)a0.position={x:a0.position.x-E0+l[0]*(r-x),y:a0.position.y-y0+l[1]*(t-h)},z.push(a0)}}if(o||A0)P.width=o&&(!F.resizeDirection||F.resizeDirection==="horizontal")?r:Z.width,P.height=A0&&(!F.resizeDirection||F.resizeDirection==="vertical")?t:Z.height,Z.width=P.width,Z.height=P.height;if(y&&H.expandParent){let E0=l[0]*(P.width??0);if(P.x&&P.x<E0)Z.x=E0,C.x=C.x-(P.x-E0);let y0=l[1]*(P.height??0);if(P.y&&P.y<y0)Z.y=y0,C.y=C.y-(P.y-y0)}let i0=s7({width:Z.width,prevWidth:x,height:Z.height,prevHeight:h,affectsX:F.controlDirection.affectsX,affectsY:F.controlDirection.affectsY}),s0={...Z,direction:i0};if(L?.(T,s0)===!1)return;I=!0,Y?.(T,s0),J(P,z)}).on("end",(T)=>{if(!I)return;w?.(T,{...Z}),$?.({...Z}),I=!1});q.call(N)}function A(){q.on(".drag",null)}return{update:K,destroy:A}}var xf="http://www.w3.org/2000/svg",kf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var f$={x:0,y:0,zoom:1};function _$(f={}){let _=f.minZoom??0.5,Q=f.maxZoom??2,J=f.nodeOrigin??[0,0],$=f.nodeExtent??kf,q=f.snapToGrid??!1,F=f.snapGrid??[15,15],K=f.edgesReconnectable??!1,[A,U]=d(f.nodes??[]),[W,G]=d(f.edges??[]),[j,M]=d(f.defaultViewport??f$),[Y,w]=d(0),[L,Z]=d(0),[C,H]=d(!1),[X,S]=d(null),[y,D]=d(null),[R,I]=d(new Map),[N,T]=d(new Map),[b,k]=d(new Map),[B,O]=d(new Map),V=new Map;function z(m){let g=V.get(m);if(!g){let[c,p]=d(void 0);g={get:c,set:p},V.set(m,g)}return g}function u(m){return z(m).get()}let[E,x]=d(0),h=e7(()=>{let m=A(),g=Q0(R),c=Q0(N);for(let i of m){if(i.measured?.width)continue;let $0=g.get(i.id);if($0?.measured.width)i.measured={width:$0.measured.width,height:$0.measured.height}}let p=O6(m,g,c,{nodeOrigin:J,nodeExtent:$,checkEquality:!1});T6(g,c,{nodeOrigin:J,nodeExtent:$});for(let[i,$0]of g){let R0=z(i);if(Q0(R0.get)?.internals.userNode!==$0.internals.userNode)R0.set($0)}for(let[i,$0]of V)if(!g.has(i)&&Q0($0.get)!==void 0)$0.set(void 0);return I(()=>new Map(g)),T(()=>new Map(c)),p.nodesInitialized});o7(()=>{let m=W(),g=new Map;for(let p of m)g.set(p.id,p);k(()=>g);let c=Q0(B);D6(c,g,m),O(()=>new Map(c))});let[P,l]=d(!1),[r,t]=d(f.nodesDraggable??!0),[e,a]=d(f.nodesConnectable??!0),[o,A0]=d(f.elementsSelectable??!0),[O0,S0]=d(f.panOnDrag??!0),[i0,s0]=d(f.panOnScroll??!1),[Af,E0]=d(f.zoomOnScroll??!0),y0=f.deleteKeyCode!==void 0?f.deleteKeyCode:["Delete","Backspace"],a0=f.selectionKeyCode!==void 0?f.selectionKeyCode:"Shift",P6=f.connectionLineStyle,h6=f.defaultEdgeOptions,v6=f.elevateNodesOnSelect??!1,m6=f.reconnectRadius??20,g6=f.zoomOnDoubleClick??!0;function p6(){let m=Q0(X);if(!m)return;m.update({noWheelClassName:"nowheel",noPanClassName:"nopan",preventScrolling:!0,panOnScroll:i0(),panOnDrag:O0(),panOnScrollMode:"free",panOnScrollSpeed:0.5,userSelectionActive:!1,zoomOnPinch:!0,zoomOnScroll:Af(),zoomOnDoubleClick:g6,zoomActivationKeyPressed:!1,lib:"bf",onTransformChange:(g)=>{M({x:g[0],y:g[1],zoom:g[2]})},connectionInProgress:!1,paneClickDistance:0})}function U9(){let m=Q0(j);return[m.x,m.y,m.zoom]}function A9(){x((m)=>m+1)}function c6(m,g=!0){let c=Q0(R),p=!1;for(let[i,$0]of m){let R0=c.get(i);if(!R0)continue;R0.internals.positionAbsolute=$0.internals?$0.internals.positionAbsolute:{x:$0.position.x,y:$0.position.y},R0.internals.userNode.position=$0.position,R0.internals.userNode.dragging=g;let X_={...R0};c.set(i,X_),z(i).set(X_),p=!0}if(p)I(()=>new Map(c));A9()}function l6(m){let g=Q0(A),c=Q0(W);if(m?.nodes){let p=new Set(m.nodes.map((i)=>i.id));U(g.map((i)=>p.has(i.id)?{...i,selected:!1}:i))}else U(g.map((p)=>p.selected?{...p,selected:!1}:p));if(m?.edges){let p=new Set(m.edges.map((i)=>i.id));G(c.map((i)=>p.has(i.id)?{...i,selected:!1}:i))}else G(c.map((p)=>p.selected?{...p,selected:!1}:p))}async function r6(m){return H6({delta:m,panZoom:Q0(X),transform:U9(),translateExtent:kf,width:Q0(Y),height:Q0(L)})}function i6(m){G((g)=>[...g,m])}function s6(m){if(m.nodes?.length){let g=new Set(m.nodes.map((c)=>c.id));U((c)=>c.filter((p)=>!g.has(p.id))),G((c)=>c.filter((p)=>!g.has(p.source)&&!g.has(p.target)))}if(m.edges?.length){let g=new Set(m.edges.map((c)=>c.id));G((c)=>c.filter((p)=>!g.has(p.id)))}}function a6(m){let g=Q0(X);if(!g)return;let c=Q0(R),p=Q0(Y),i=Q0(L);W6({nodes:c,width:p,height:i,panZoom:g,minZoom:_,maxZoom:Q},{padding:0.1,...m})}return{nodes:A,edges:W,viewport:j,width:Y,height:L,dragging:C,nodesInitialized:h,nodeLookup:R,parentLookup:N,edgeLookup:b,connectionLookup:B,nodeSignal:u,panZoom:X,domNode:y,setNodes:U,setEdges:G,setViewport:M,setWidth:w,setHeight:Z,multiSelectionActive:P,nodesDraggable:r,setNodesDraggable:t,nodesConnectable:e,setNodesConnectable:a,elementsSelectable:o,setElementsSelectable:A0,panOnDrag:O0,setPanOnDrag:S0,panOnScroll:i0,setPanOnScroll:s0,zoomOnScroll:Af,setZoomOnScroll:E0,deleteKeyCode:y0,selectionKeyCode:a0,connectionLineStyle:P6,defaultEdgeOptions:h6,elevateNodesOnSelect:v6,reconnectRadius:m6,positionEpoch:E,triggerPositionUpdate:A9,setDragging:H,setPanZoom:S,setDomNode:D,setMultiSelectionActive:l,updatePanZoomConfig:p6,fitView:a6,updateNodePositions:c6,unselectNodesAndEdges:l6,panByDelta:r6,addEdge:i6,deleteElements:s6,minZoom:_,maxZoom:Q,nodeOrigin:J,nodeExtent:$,snapToGrid:q,snapGrid:F,edgesReconnectable:K,getTransform:U9,nodeTypes:f.nodeTypes,edgeTypes:f.edgeTypes,onConnect:f.onConnect,onConnectStart:f.onConnectStart,onConnectEnd:f.onConnectEnd,isValidConnection:f.isValidConnection,onReconnect:f.onReconnect,onInit:f.onInit,onNodeDragStart:f.onNodeDragStart,onNodeDragStop:f.onNodeDragStop,onMoveEnd:f.onMoveEnd,onPaneClick:f.onPaneClick,onPaneMouseMove:f.onPaneMouseMove,onNodesDelete:f.onNodesDelete,onEdgesDelete:f.onEdgesDelete}}import{createContext as Q$}from"@barefootjs/client";var Q9=Q$();import{useContext as J$}from"@barefootjs/client/runtime";import{createMemo as $$,untrack as q$}from"@barefootjs/client/runtime";function j0(){return J$(Q9)}function b6(){return j0().viewport}function F$(){return j0().nodes}function K$(){return j0().edges}function U$(){return j0().nodesInitialized}function A$(f){let _=j0();return $$(()=>f(_))}function W$(f){let _=j0(),Q=q$(_.domNode);if(!Q)return f;let J=Q.getBoundingClientRect(),$=_.getTransform();return Ff({x:f.x-J.left,y:f.y-J.top},$)}function J9(f,_,Q){let J=!!(f.sourceHandle||f.targetHandle),$=L6({id:f.id,sourceNode:_,sourceHandle:f.sourceHandle??null,targetNode:Q,targetHandle:f.targetHandle??null,connectionMode:J?p0.Strict:p0.Loose});if($)return $;let q=_.measured.width??150,F=_.measured.height??40,K=Q.measured.width??150,A=_.internals.positionAbsolute,U=Q.internals.positionAbsolute;return{sourceX:A.x+q/2,sourceY:A.y+F,targetX:U.x+K/2,targetY:U.y,sourcePosition:v.Bottom,targetPosition:v.Top}}function $9(f,_){let Q={sourceX:_.sourceX,sourceY:_.sourceY,sourcePosition:_.sourcePosition,targetX:_.targetX,targetY:_.targetY,targetPosition:_.targetPosition},J=f.type??"default";switch(J){case"straight":return nQ(Q);case"smoothstep":case"step":return Kf({...Q,borderRadius:J==="step"?0:void 0});case"default":case"bezier":default:return tQ(Q)}}import{createEffect as M$,onCleanup as Pf,untrack as l0}from"@barefootjs/client";import{onCleanup as x6,untrack as Uf}from"@barefootjs/client";function q9(f,_){function Q($){let q=$.target;if(q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable)return;let F=f.deleteKeyCode;if(F&&F.includes($.key)){if(!Uf(f.nodesDraggable))return;let A=Uf(f.nodes).filter((W)=>W.selected),U=Uf(f.edges).filter((W)=>W.selected);if(A.length>0||U.length>0){if(A.length>0&&f.onNodesDelete)f.onNodesDelete(A);if(U.length>0&&f.onEdgesDelete)f.onEdgesDelete(U);f.deleteElements({nodes:A,edges:U}),$.preventDefault()}}if($.key==="Escape")f.unselectNodesAndEdges();let K=f.selectionKeyCode;if(K&&$.key===K)f.setMultiSelectionActive(!0)}function J($){let q=f.selectionKeyCode;if(q&&$.key===q)f.setMultiSelectionActive(!1)}_.setAttribute("tabindex","0"),_.style.outline="none",_.addEventListener("keydown",Q),_.addEventListener("keyup",J),x6(()=>{_.removeEventListener("keydown",Q),_.removeEventListener("keyup",J)})}function G$(f,_,Q){f.addEventListener("mousedown",(J)=>{if(J.button!==0)return;let $=Uf(Q.multiSelectionActive)||J.shiftKey;if(!$)Q.unselectNodesAndEdges();let q=Uf(Q.domNode);if(q)q.focus();Q.setNodes((F)=>F.map((K)=>K.id===_?{...K,selected:$?!K.selected:!0}:K))})}function B$(f,_,[Q,J,$],q){let F={x:(_.x-Q)/$,y:(_.y-J)/$,width:_.width/$,height:_.height/$},K=[];for(let A of f.values()){if(A.hidden)continue;let U=A.measured.width??0,W=A.measured.height??0;if(U===0&&W===0)continue;let G=A.internals.positionAbsolute,j=Math.max(0,Math.min(F.x+F.width,G.x+U)-Math.max(F.x,G.x)),M=Math.max(0,Math.min(F.y+F.height,G.y+W)-Math.max(F.y,G.y)),Y=j*M,w=U*W;if(q){if(Y>0)K.push(A)}else if(Y>=w)K.push(A)}return K}function j$(f,[_,Q,J]){if(f.length===0)return null;let $=1/0,q=1/0,F=-1/0,K=-1/0;for(let A of f){let U=A.internals.positionAbsolute,W=A.measured.width??0,G=A.measured.height??0,j=U.x*J+_,M=U.y*J+Q,Y=W*J,w=G*J;$=Math.min($,j),q=Math.min(q,M),F=Math.max(F,j+Y),K=Math.max(K,M+w)}return{x:$,y:q,width:F-$,height:K-q}}function F9(f,_,Q={}){let J=Q.selectionOnDrag??!1,$=Q.selectionMode??"partial",q=null,F=!1,K=0,A=0;function U(M){if(M.button!==0)return;if(q)q.remove(),q=null;let Y=M.target;if(!(Y===_||Y.classList.contains("bf-flow__viewport")||Y.classList.contains("bf-flow__nodes")||Y.classList.contains("bf-flow__edges")))return;if(!M.shiftKey&&!J)return;M.stopPropagation(),M.preventDefault(),F=!0,K=M.clientX,A=M.clientY,q=document.createElement("div"),q.className="bf-flow__selection",q.style.position="absolute",q.style.pointerEvents="none",q.style.left="0",q.style.top="0",q.style.width="0",q.style.height="0",q.style.zIndex="5",_.appendChild(q),document.addEventListener("mousemove",W),document.addEventListener("mouseup",G)}function W(M){if(!F||!q)return;let Y=_.getBoundingClientRect(),w=M.clientX,L=M.clientY,Z=Math.min(K,w)-Y.left,C=Math.min(A,L)-Y.top,H=Math.abs(w-K),X=Math.abs(L-A);q.style.left=`${Z}px`,q.style.top=`${C}px`,q.style.width=`${H}px`,q.style.height=`${X}px`}function G(M){if(!F)return;document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",G);let Y=_.getBoundingClientRect(),w=M.clientX,L=M.clientY,Z=Math.min(K,w)-Y.left,C=Math.min(A,L)-Y.top,H=Math.abs(w-K),X=Math.abs(L-A);if(H>5||X>5){let S=f.getTransform(),y=Uf(f.nodeLookup),R=B$(y,{x:Z,y:C,width:H,height:X},S,$==="partial"),I=new Set(R.map((N)=>N.id));if(I.size>0){if(f.setNodes((N)=>N.map((T)=>I.has(T.id)?{...T,selected:!0}:{...T,selected:!1})),q){let N=f.getTransform(),T=j$(R,N);if(T)q.style.left=`${T.x}px`,q.style.top=`${T.y}px`,q.style.width=`${T.width}px`,q.style.height=`${T.height}px`,q.classList.add("bf-flow__selection--active"),_.focus();else q.remove(),q=null}}else if(f.unselectNodesAndEdges(),q)q.remove(),q=null}else if(f.unselectNodesAndEdges(),q)q.remove(),q=null;F=!1}function j(M){if(!q)return;if(M.key==="Delete"||M.key==="Backspace")q.remove(),q=null}_.addEventListener("mousedown",U,!0),_.addEventListener("keydown",j),x6(()=>{if(_.removeEventListener("mousedown",U,!0),_.removeEventListener("keydown",j),document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",G),q)q.remove(),q=null})}function k6(f,_,Q){let J=Q.get(_);if(!J)return f;let $=J.internals.userNode;if(!$.parentId||$.extent!=="parent")return f;let q=Q.get($.parentId);if(!q)return f;let F=J.measured?.width,K=J.measured?.height,A=q.measured?.width,U=q.measured?.height;if(F==null||K==null||A==null||U==null)return f;let W=Math.max(0,A-F),G=Math.max(0,U-K);return{x:Math.min(Math.max(f.x,0),W),y:Math.min(Math.max(f.y,0),G)}}function Z$(f,_,Q){V$(),f.style.position="relative",f.style.overflow="hidden",_.setDomNode(f),f.__bfFlowStore=_,_.setWidth(f.offsetWidth),_.setHeight(f.offsetHeight);let J=new ResizeObserver(()=>{_.setWidth(f.offsetWidth),_.setHeight(f.offsetHeight)});J.observe(f),Pf(()=>J.disconnect());let $=S6({domNode:f,minZoom:_.minZoom,maxZoom:_.maxZoom,viewport:l0(_.viewport),translateExtent:kf,onDraggingChange:(L)=>{_.setDragging(L)},onPanZoom:(L,Z)=>{_.setViewport(Z)},onPanZoomStart:void 0,onPanZoomEnd:(L,Z)=>{if(_.onMoveEnd)_.onMoveEnd(L,Z)}});_.setPanZoom($);let q=(L)=>({noWheelClassName:"nowheel",noPanClassName:"nopan",preventScrolling:!0,panOnScroll:Q.panOnScroll??!1,panOnDrag:Q.panOnDrag??!0,panOnScrollMode:g0.Free,panOnScrollSpeed:0.5,userSelectionActive:!1,zoomOnPinch:!0,zoomOnScroll:Q.zoomOnScroll??!0,zoomOnDoubleClick:Q.zoomOnDoubleClick??!0,zoomActivationKeyPressed:L,lib:"bf",onTransformChange:(Z)=>{_.setViewport({x:Z[0],y:Z[1],zoom:Z[2]})},connectionInProgress:!1,paneClickDistance:0});$.update(q(!1)),Pf(()=>$.destroy());let F=Q.zoomActivationKeyCode;if(F){let L=!1,Z=(H)=>{if(H.key===F&&!L)L=!0,$.update(q(!0))},C=(H)=>{if(H.key===F&&L)L=!1,$.update(q(!1))};document.addEventListener("keydown",Z),document.addEventListener("keyup",C),Pf(()=>{document.removeEventListener("keydown",Z),document.removeEventListener("keyup",C)})}q9(_,f),F9(_,f,{selectionOnDrag:Q.selectionOnDrag,selectionMode:Q.selectionMode});let K=null,A=(L)=>{let Z=L.target;if(!Z.closest(".bf-flow__node")&&!Z.closest(".bf-flow__handle")&&!Z.closest(".bf-flow__edge, [data-hit-id]"))K={x:L.clientX,y:L.clientY};else K=null},U=(L)=>{if(!K)return;let Z=L.clientX-K.x,C=L.clientY-K.y;if(K=null,Math.abs(Z)>5||Math.abs(C)>5)return;let H=L.target;if(H.closest(".bf-flow__node")||H.closest(".bf-flow__handle")||H.closest(".bf-flow__edge, [data-hit-id]"))return;if(_.unselectNodesAndEdges(),_.onPaneClick)_.onPaneClick(L)},W=(L)=>{if(_.onPaneMouseMove)_.onPaneMouseMove(L)};f.addEventListener("mousedown",A,!0),f.addEventListener("mouseup",U,!0),f.addEventListener("mousemove",W),Pf(()=>{f.removeEventListener("mousedown",A,!0),f.removeEventListener("mouseup",U,!0),f.removeEventListener("mousemove",W)});let G=null,j=(L)=>{if(L.button!==0)return;if(!l0(_.nodesDraggable))return;let Z=L.target;if(!Z)return;if(Z.closest(".bf-flow__handle"))return;if(Z.closest(".nodrag"))return;let C=Z.closest(".bf-flow__node");if(!C||!f.contains(C))return;let H=C.dataset.id;if(!H)return;let X=l0(_.nodeLookup).get(H);if(!X)return;L.stopPropagation(),G={nodeId:H,pointerId:L.pointerId,startClientX:L.clientX,startClientY:L.clientY,startNodeX:X.position.x,startNodeY:X.position.y,captureEl:C},C.setPointerCapture?.(L.pointerId),_.setDragging(!0)},M=(L,Z,C,H)=>{let X=l0(_.nodes),S=!1,y=X.map((D)=>{if(D.id!==L)return D;let R=D.position;if(R.x===Z&&R.y===C)return D;return S=!0,{...D,position:{x:Z,y:C}}});if(S)_.setNodes(y);_.setDragging(H)},Y=(L)=>{if(!G||L.pointerId!==G.pointerId)return;let Z=l0(_.viewport).zoom||1,C=(L.clientX-G.startClientX)/Z,H=(L.clientY-G.startClientY)/Z,X=k6({x:G.startNodeX+C,y:G.startNodeY+H},G.nodeId,l0(_.nodeLookup));M(G.nodeId,X.x,X.y,!0)},w=(L)=>{if(!G||L.pointerId!==G.pointerId)return;G.captureEl.releasePointerCapture?.(L.pointerId);let C=G.nodeId;G=null;let X=l0(_.nodeLookup).get(C);if(X)M(C,X.position.x,X.position.y,!1);else _.setDragging(!1)};if(f.addEventListener("pointerdown",j),f.addEventListener("pointermove",Y),f.addEventListener("pointerup",w),f.addEventListener("pointercancel",w),Pf(()=>{f.removeEventListener("pointerdown",j),f.removeEventListener("pointermove",Y),f.removeEventListener("pointerup",w),f.removeEventListener("pointercancel",w)}),M$(()=>{_.positionEpoch();let L=_.edges(),Z=_.nodeLookup(),C=f.querySelector(".bf-flow__edges");if(!C)return;for(let H of L){let X=Z.get(H.source),S=Z.get(H.target);if(!X||!S)continue;let y=J9(H,X,S);if(!y)continue;let D=$9(H,y);if(!D)continue;let R=D[0],I=C.querySelectorAll(`path[data-id="${H.id}"], path[data-hit-id="${H.id}"]`);for(let N of I)if(N.getAttribute("d")!==R)N.setAttribute("d",R)}}),typeof Q.onInit==="function")Q.onInit(_)}function V$(){if(typeof document>"u")return;if(document.getElementById("bf-flow-styles"))return;let f=document.createElement("style");f.id="bf-flow-styles",f.textContent=Y$,document.head.appendChild(f)}var Y$=`
1
+ import{createSignal as d,createEffect as o7,createMemo as e7,untrack as Q0}from"@barefootjs/client";var d6={value:()=>{}};function G9(){for(var f=0,_=arguments.length,Q={},J;f<_;++f){if(!(J=arguments[f]+"")||J in Q||/[\s.]/.test(J))throw Error("illegal type: "+J);Q[J]=[]}return new mf(Q)}function mf(f){this._=f}function t6(f,_){return f.trim().split(/^|\s+/).map(function(Q){var J="",$=Q.indexOf(".");if($>=0)J=Q.slice($+1),Q=Q.slice(0,$);if(Q&&!_.hasOwnProperty(Q))throw Error("unknown type: "+Q);return{type:Q,name:J}})}mf.prototype=G9.prototype={constructor:mf,on:function(f,_){var Q=this._,J=t6(f+"",Q),$,q=-1,F=J.length;if(arguments.length<2){while(++q<F)if(($=(f=J[q]).type)&&($=n6(Q[$],f.name)))return $;return}if(_!=null&&typeof _!=="function")throw Error("invalid callback: "+_);while(++q<F)if($=(f=J[q]).type)Q[$]=W9(Q[$],f.name,_);else if(_==null)for($ in Q)Q[$]=W9(Q[$],f.name,null);return this},copy:function(){var f={},_=this._;for(var Q in _)f[Q]=_[Q].slice();return new mf(f)},call:function(f,_){if(($=arguments.length-2)>0)for(var Q=Array($),J=0,$,q;J<$;++J)Q[J]=arguments[J+2];if(!this._.hasOwnProperty(f))throw Error("unknown type: "+f);for(q=this._[f],J=0,$=q.length;J<$;++J)q[J].value.apply(_,Q)},apply:function(f,_,Q){if(!this._.hasOwnProperty(f))throw Error("unknown type: "+f);for(var J=this._[f],$=0,q=J.length;$<q;++$)J[$].value.apply(_,Q)}};function n6(f,_){for(var Q=0,J=f.length,$;Q<J;++Q)if(($=f[Q]).name===_)return $.value}function W9(f,_,Q){for(var J=0,$=f.length;J<$;++J)if(f[J].name===_){f[J]=d6,f=f.slice(0,J).concat(f.slice(J+1));break}if(Q!=null)f.push({name:_,value:Q});return f}var N0=G9;function d0(f){return function(){return this.matches(f)}}function gf(f){return function(_){return _.matches(f)}}var pf="http://www.w3.org/1999/xhtml",L_={svg:"http://www.w3.org/2000/svg",xhtml:pf,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function M0(f){var _=f+="",Q=_.indexOf(":");if(Q>=0&&(_=f.slice(0,Q))!=="xmlns")f=f.slice(Q+1);return L_.hasOwnProperty(_)?{space:L_[_],local:f}:f}function w_(f){let _;while(_=f.sourceEvent)f=_;return f}function q0(f,_){if(f=w_(f),_===void 0)_=f.currentTarget;if(_){var Q=_.ownerSVGElement||_;if(Q.createSVGPoint){var J=Q.createSVGPoint();return J.x=f.clientX,J.y=f.clientY,J=J.matrixTransform(_.getScreenCTM().inverse()),[J.x,J.y]}if(_.getBoundingClientRect){var $=_.getBoundingClientRect();return[f.clientX-$.left-_.clientLeft,f.clientY-$.top-_.clientTop]}}return[f.pageX,f.pageY]}function o6(){}function z0(f){return f==null?o6:function(){return this.querySelector(f)}}function T_(f){if(typeof f!=="function")f=z0(f);for(var _=this._groups,Q=_.length,J=Array(Q),$=0;$<Q;++$)for(var q=_[$],F=q.length,K=J[$]=Array(F),A,U,W=0;W<F;++W)if((A=q[W])&&(U=f.call(A,A.__data__,W,q))){if("__data__"in A)U.__data__=A.__data__;K[W]=U}return new s(J,this._parents)}function O_(f){return f==null?[]:Array.isArray(f)?f:Array.from(f)}function e6(){return[]}function t0(f){return f==null?e6:function(){return this.querySelectorAll(f)}}function f8(f){return function(){return O_(f.apply(this,arguments))}}function R_(f){if(typeof f==="function")f=f8(f);else f=t0(f);for(var _=this._groups,Q=_.length,J=[],$=[],q=0;q<Q;++q)for(var F=_[q],K=F.length,A,U=0;U<K;++U)if(A=F[U])J.push(f.call(A,A.__data__,U,F)),$.push(A);return new s(J,$)}var _8=Array.prototype.find;function Q8(f){return function(){return _8.call(this.children,f)}}function J8(){return this.firstElementChild}function z_(f){return this.select(f==null?J8:Q8(typeof f==="function"?f:gf(f)))}var $8=Array.prototype.filter;function q8(){return Array.from(this.children)}function F8(f){return function(){return $8.call(this.children,f)}}function H_(f){return this.selectAll(f==null?q8:F8(typeof f==="function"?f:gf(f)))}function D_(f){if(typeof f!=="function")f=d0(f);for(var _=this._groups,Q=_.length,J=Array(Q),$=0;$<Q;++$)for(var q=_[$],F=q.length,K=J[$]=[],A,U=0;U<F;++U)if((A=q[U])&&f.call(A,A.__data__,U,q))K.push(A);return new s(J,this._parents)}function Wf(f){return Array(f.length)}function C_(){return new s(this._enter||this._groups.map(Wf),this._parents)}function Gf(f,_){this.ownerDocument=f.ownerDocument,this.namespaceURI=f.namespaceURI,this._next=null,this._parent=f,this.__data__=_}Gf.prototype={constructor:Gf,appendChild:function(f){return this._parent.insertBefore(f,this._next)},insertBefore:function(f,_){return this._parent.insertBefore(f,_)},querySelector:function(f){return this._parent.querySelector(f)},querySelectorAll:function(f){return this._parent.querySelectorAll(f)}};function I_(f){return function(){return f}}function K8(f,_,Q,J,$,q){var F=0,K,A=_.length,U=q.length;for(;F<U;++F)if(K=_[F])K.__data__=q[F],J[F]=K;else Q[F]=new Gf(f,q[F]);for(;F<A;++F)if(K=_[F])$[F]=K}function U8(f,_,Q,J,$,q,F){var K,A,U=new Map,W=_.length,G=q.length,j=Array(W),M;for(K=0;K<W;++K)if(A=_[K])if(j[K]=M=F.call(A,A.__data__,K,_)+"",U.has(M))$[K]=A;else U.set(M,A);for(K=0;K<G;++K)if(M=F.call(f,q[K],K,q)+"",A=U.get(M))J[K]=A,A.__data__=q[K],U.delete(M);else Q[K]=new Gf(f,q[K]);for(K=0;K<W;++K)if((A=_[K])&&U.get(j[K])===A)$[K]=A}function A8(f){return f.__data__}function S_(f,_){if(!arguments.length)return Array.from(this,A8);var Q=_?U8:K8,J=this._parents,$=this._groups;if(typeof f!=="function")f=I_(f);for(var q=$.length,F=Array(q),K=Array(q),A=Array(q),U=0;U<q;++U){var W=J[U],G=$[U],j=G.length,M=W8(f.call(W,W&&W.__data__,U,J)),Y=M.length,w=K[U]=Array(Y),L=F[U]=Array(Y),Z=A[U]=Array(j);Q(W,G,w,L,Z,M,_);for(var C=0,H=0,X,S;C<Y;++C)if(X=w[C]){if(C>=H)H=C+1;while(!(S=L[H])&&++H<Y);X._next=S||null}}return F=new s(F,J),F._enter=K,F._exit=A,F}function W8(f){return typeof f==="object"&&"length"in f?f:Array.from(f)}function E_(){return new s(this._exit||this._groups.map(Wf),this._parents)}function y_(f,_,Q){var J=this.enter(),$=this,q=this.exit();if(typeof f==="function"){if(J=f(J),J)J=J.selection()}else J=J.append(f+"");if(_!=null){if($=_($),$)$=$.selection()}if(Q==null)q.remove();else Q(q);return J&&$?J.merge($).order():$}function N_(f){var _=f.selection?f.selection():f;for(var Q=this._groups,J=_._groups,$=Q.length,q=J.length,F=Math.min($,q),K=Array($),A=0;A<F;++A)for(var U=Q[A],W=J[A],G=U.length,j=K[A]=Array(G),M,Y=0;Y<G;++Y)if(M=U[Y]||W[Y])j[Y]=M;for(;A<$;++A)K[A]=Q[A];return new s(K,this._parents)}function u_(){for(var f=this._groups,_=-1,Q=f.length;++_<Q;)for(var J=f[_],$=J.length-1,q=J[$],F;--$>=0;)if(F=J[$]){if(q&&F.compareDocumentPosition(q)^4)q.parentNode.insertBefore(F,q);q=F}return this}function b_(f){if(!f)f=G8;function _(G,j){return G&&j?f(G.__data__,j.__data__):!G-!j}for(var Q=this._groups,J=Q.length,$=Array(J),q=0;q<J;++q){for(var F=Q[q],K=F.length,A=$[q]=Array(K),U,W=0;W<K;++W)if(U=F[W])A[W]=U;A.sort(_)}return new s($,this._parents).order()}function G8(f,_){return f<_?-1:f>_?1:f>=_?0:NaN}function x_(){var f=arguments[0];return arguments[0]=this,f.apply(null,arguments),this}function k_(){return Array.from(this)}function P_(){for(var f=this._groups,_=0,Q=f.length;_<Q;++_)for(var J=f[_],$=0,q=J.length;$<q;++$){var F=J[$];if(F)return F}return null}function h_(){let f=0;for(let _ of this)++f;return f}function v_(){return!this.node()}function m_(f){for(var _=this._groups,Q=0,J=_.length;Q<J;++Q)for(var $=_[Q],q=0,F=$.length,K;q<F;++q)if(K=$[q])f.call(K,K.__data__,q,$);return this}function B8(f){return function(){this.removeAttribute(f)}}function j8(f){return function(){this.removeAttributeNS(f.space,f.local)}}function M8(f,_){return function(){this.setAttribute(f,_)}}function Z8(f,_){return function(){this.setAttributeNS(f.space,f.local,_)}}function V8(f,_){return function(){var Q=_.apply(this,arguments);if(Q==null)this.removeAttribute(f);else this.setAttribute(f,Q)}}function Y8(f,_){return function(){var Q=_.apply(this,arguments);if(Q==null)this.removeAttributeNS(f.space,f.local);else this.setAttributeNS(f.space,f.local,Q)}}function g_(f,_){var Q=M0(f);if(arguments.length<2){var J=this.node();return Q.local?J.getAttributeNS(Q.space,Q.local):J.getAttribute(Q)}return this.each((_==null?Q.local?j8:B8:typeof _==="function"?Q.local?Y8:V8:Q.local?Z8:M8)(Q,_))}function Bf(f){return f.ownerDocument&&f.ownerDocument.defaultView||f.document&&f||f.defaultView}function X8(f){return function(){this.style.removeProperty(f)}}function L8(f,_,Q){return function(){this.style.setProperty(f,_,Q)}}function w8(f,_,Q){return function(){var J=_.apply(this,arguments);if(J==null)this.style.removeProperty(f);else this.style.setProperty(f,J,Q)}}function p_(f,_,Q){return arguments.length>1?this.each((_==null?X8:typeof _==="function"?w8:L8)(f,_,Q==null?"":Q)):H0(this.node(),f)}function H0(f,_){return f.style.getPropertyValue(_)||Bf(f).getComputedStyle(f,null).getPropertyValue(_)}function T8(f){return function(){delete this[f]}}function O8(f,_){return function(){this[f]=_}}function R8(f,_){return function(){var Q=_.apply(this,arguments);if(Q==null)delete this[f];else this[f]=Q}}function c_(f,_){return arguments.length>1?this.each((_==null?T8:typeof _==="function"?R8:O8)(f,_)):this.node()[f]}function B9(f){return f.trim().split(/^|\s+/)}function l_(f){return f.classList||new j9(f)}function j9(f){this._node=f,this._names=B9(f.getAttribute("class")||"")}j9.prototype={add:function(f){var _=this._names.indexOf(f);if(_<0)this._names.push(f),this._node.setAttribute("class",this._names.join(" "))},remove:function(f){var _=this._names.indexOf(f);if(_>=0)this._names.splice(_,1),this._node.setAttribute("class",this._names.join(" "))},contains:function(f){return this._names.indexOf(f)>=0}};function M9(f,_){var Q=l_(f),J=-1,$=_.length;while(++J<$)Q.add(_[J])}function Z9(f,_){var Q=l_(f),J=-1,$=_.length;while(++J<$)Q.remove(_[J])}function z8(f){return function(){M9(this,f)}}function H8(f){return function(){Z9(this,f)}}function D8(f,_){return function(){(_.apply(this,arguments)?M9:Z9)(this,f)}}function r_(f,_){var Q=B9(f+"");if(arguments.length<2){var J=l_(this.node()),$=-1,q=Q.length;while(++$<q)if(!J.contains(Q[$]))return!1;return!0}return this.each((typeof _==="function"?D8:_?z8:H8)(Q,_))}function C8(){this.textContent=""}function I8(f){return function(){this.textContent=f}}function S8(f){return function(){var _=f.apply(this,arguments);this.textContent=_==null?"":_}}function i_(f){return arguments.length?this.each(f==null?C8:(typeof f==="function"?S8:I8)(f)):this.node().textContent}function E8(){this.innerHTML=""}function y8(f){return function(){this.innerHTML=f}}function N8(f){return function(){var _=f.apply(this,arguments);this.innerHTML=_==null?"":_}}function s_(f){return arguments.length?this.each(f==null?E8:(typeof f==="function"?N8:y8)(f)):this.node().innerHTML}function u8(){if(this.nextSibling)this.parentNode.appendChild(this)}function a_(){return this.each(u8)}function b8(){if(this.previousSibling)this.parentNode.insertBefore(this,this.parentNode.firstChild)}function d_(){return this.each(b8)}function x8(f){return function(){var _=this.ownerDocument,Q=this.namespaceURI;return Q===pf&&_.documentElement.namespaceURI===pf?_.createElement(f):_.createElementNS(Q,f)}}function k8(f){return function(){return this.ownerDocument.createElementNS(f.space,f.local)}}function jf(f){var _=M0(f);return(_.local?k8:x8)(_)}function t_(f){var _=typeof f==="function"?f:jf(f);return this.select(function(){return this.appendChild(_.apply(this,arguments))})}function P8(){return null}function n_(f,_){var Q=typeof f==="function"?f:jf(f),J=_==null?P8:typeof _==="function"?_:z0(_);return this.select(function(){return this.insertBefore(Q.apply(this,arguments),J.apply(this,arguments)||null)})}function h8(){var f=this.parentNode;if(f)f.removeChild(this)}function o_(){return this.each(h8)}function v8(){var f=this.cloneNode(!1),_=this.parentNode;return _?_.insertBefore(f,this.nextSibling):f}function m8(){var f=this.cloneNode(!0),_=this.parentNode;return _?_.insertBefore(f,this.nextSibling):f}function e_(f){return this.select(f?m8:v8)}function fQ(f){return arguments.length?this.property("__data__",f):this.node().__data__}function g8(f){return function(_){f.call(this,_,this.__data__)}}function p8(f){return f.trim().split(/^|\s+/).map(function(_){var Q="",J=_.indexOf(".");if(J>=0)Q=_.slice(J+1),_=_.slice(0,J);return{type:_,name:Q}})}function c8(f){return function(){var _=this.__on;if(!_)return;for(var Q=0,J=-1,$=_.length,q;Q<$;++Q)if(q=_[Q],(!f.type||q.type===f.type)&&q.name===f.name)this.removeEventListener(q.type,q.listener,q.options);else _[++J]=q;if(++J)_.length=J;else delete this.__on}}function l8(f,_,Q){return function(){var J=this.__on,$,q=g8(_);if(J){for(var F=0,K=J.length;F<K;++F)if(($=J[F]).type===f.type&&$.name===f.name){this.removeEventListener($.type,$.listener,$.options),this.addEventListener($.type,$.listener=q,$.options=Q),$.value=_;return}}if(this.addEventListener(f.type,q,Q),$={type:f.type,name:f.name,value:_,listener:q,options:Q},!J)this.__on=[$];else J.push($)}}function _Q(f,_,Q){var J=p8(f+""),$,q=J.length,F;if(arguments.length<2){var K=this.node().__on;if(K){for(var A=0,U=K.length,W;A<U;++A)for($=0,W=K[A];$<q;++$)if((F=J[$]).type===W.type&&F.name===W.name)return W.value}return}K=_?l8:c8;for($=0;$<q;++$)this.each(K(J[$],_,Q));return this}function V9(f,_,Q){var J=Bf(f),$=J.CustomEvent;if(typeof $==="function")$=new $(_,Q);else if($=J.document.createEvent("Event"),Q)$.initEvent(_,Q.bubbles,Q.cancelable),$.detail=Q.detail;else $.initEvent(_,!1,!1);f.dispatchEvent($)}function r8(f,_){return function(){return V9(this,f,_)}}function i8(f,_){return function(){return V9(this,f,_.apply(this,arguments))}}function QQ(f,_){return this.each((typeof _==="function"?i8:r8)(f,_))}function*JQ(){for(var f=this._groups,_=0,Q=f.length;_<Q;++_)for(var J=f[_],$=0,q=J.length,F;$<q;++$)if(F=J[$])yield F}var $Q=[null];function s(f,_){this._groups=f,this._parents=_}function Y9(){return new s([[document.documentElement]],$Q)}function s8(){return this}s.prototype=Y9.prototype={constructor:s,select:T_,selectAll:R_,selectChild:z_,selectChildren:H_,filter:D_,data:S_,enter:C_,exit:E_,join:y_,merge:N_,selection:s8,order:u_,sort:b_,call:x_,nodes:k_,node:P_,size:h_,empty:v_,each:m_,attr:g_,style:p_,property:c_,classed:r_,text:i_,html:s_,raise:a_,lower:d_,append:t_,insert:n_,remove:o_,clone:e_,datum:fQ,on:_Q,dispatch:QQ,[Symbol.iterator]:JQ};var X0=Y9;function f0(f){return typeof f==="string"?new s([[document.querySelector(f)]],[document.documentElement]):new s([[f]],$Q)}var X9={passive:!1},u0={capture:!0,passive:!1};function cf(f){f.stopImmediatePropagation()}function L0(f){f.preventDefault(),f.stopImmediatePropagation()}function n0(f){var _=f.document.documentElement,Q=f0(f).on("dragstart.drag",L0,u0);if("onselectstart"in _)Q.on("selectstart.drag",L0,u0);else _.__noselect=_.style.MozUserSelect,_.style.MozUserSelect="none"}function Mf(f,_){var Q=f.document.documentElement,J=f0(f).on("dragstart.drag",null);if(_)J.on("click.drag",L0,u0),setTimeout(function(){J.on("click.drag",null)},0);if("onselectstart"in Q)J.on("selectstart.drag",null);else Q.style.MozUserSelect=Q.__noselect,delete Q.__noselect}var Zf=(f)=>()=>f;function Vf(f,{sourceEvent:_,subject:Q,target:J,identifier:$,active:q,x:F,y:K,dx:A,dy:U,dispatch:W}){Object.defineProperties(this,{type:{value:f,enumerable:!0,configurable:!0},sourceEvent:{value:_,enumerable:!0,configurable:!0},subject:{value:Q,enumerable:!0,configurable:!0},target:{value:J,enumerable:!0,configurable:!0},identifier:{value:$,enumerable:!0,configurable:!0},active:{value:q,enumerable:!0,configurable:!0},x:{value:F,enumerable:!0,configurable:!0},y:{value:K,enumerable:!0,configurable:!0},dx:{value:A,enumerable:!0,configurable:!0},dy:{value:U,enumerable:!0,configurable:!0},_:{value:W}})}Vf.prototype.on=function(){var f=this._.on.apply(this._,arguments);return f===this._?this:f};function a8(f){return!f.ctrlKey&&!f.button}function d8(){return this.parentNode}function t8(f,_){return _==null?{x:f.x,y:f.y}:_}function n8(){return navigator.maxTouchPoints||"ontouchstart"in this}function lf(){var f=a8,_=d8,Q=t8,J=n8,$={},q=N0("start","drag","end"),F=0,K,A,U,W,G=0;function j(X){X.on("mousedown.drag",M).filter(J).on("touchstart.drag",L).on("touchmove.drag",Z,X9).on("touchend.drag touchcancel.drag",C).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function M(X,S){if(W||!f.call(this,X,S))return;var y=H(this,_.call(this,X,S),X,S,"mouse");if(!y)return;f0(X.view).on("mousemove.drag",Y,u0).on("mouseup.drag",w,u0),n0(X.view),cf(X),U=!1,K=X.clientX,A=X.clientY,y("start",X)}function Y(X){if(L0(X),!U){var S=X.clientX-K,y=X.clientY-A;U=S*S+y*y>G}$.mouse("drag",X)}function w(X){f0(X.view).on("mousemove.drag mouseup.drag",null),Mf(X.view,U),L0(X),$.mouse("end",X)}function L(X,S){if(!f.call(this,X,S))return;var y=X.changedTouches,D=_.call(this,X,S),R=y.length,I,N;for(I=0;I<R;++I)if(N=H(this,D,X,S,y[I].identifier,y[I]))cf(X),N("start",X,y[I])}function Z(X){var S=X.changedTouches,y=S.length,D,R;for(D=0;D<y;++D)if(R=$[S[D].identifier])L0(X),R("drag",X,S[D])}function C(X){var S=X.changedTouches,y=S.length,D,R;if(W)clearTimeout(W);W=setTimeout(function(){W=null},500);for(D=0;D<y;++D)if(R=$[S[D].identifier])cf(X),R("end",X,S[D])}function H(X,S,y,D,R,I){var N=q.copy(),T=q0(I||y,S),b,k,B;if((B=Q.call(X,new Vf("beforestart",{sourceEvent:y,target:j,identifier:R,active:F,x:T[0],y:T[1],dx:0,dy:0,dispatch:N}),D))==null)return;return b=B.x-T[0]||0,k=B.y-T[1]||0,function O(V,z,u){var E=T,x;switch(V){case"start":$[R]=O,x=F++;break;case"end":delete $[R],--F;case"drag":T=q0(u||z,S),x=F;break}N.call(V,X,new Vf(V,{sourceEvent:z,subject:B,target:j,identifier:R,active:x,x:T[0]+b,y:T[1]+k,dx:T[0]-E[0],dy:T[1]-E[1],dispatch:N}),D)}}return j.filter=function(X){return arguments.length?(f=typeof X==="function"?X:Zf(!!X),j):f},j.container=function(X){return arguments.length?(_=typeof X==="function"?X:Zf(X),j):_},j.subject=function(X){return arguments.length?(Q=typeof X==="function"?X:Zf(X),j):Q},j.touchable=function(X){return arguments.length?(J=typeof X==="function"?X:Zf(!!X),j):J},j.on=function(){var X=q.on.apply(q,arguments);return X===q?j:X},j.clickDistance=function(X){return arguments.length?(G=(X=+X)*X,j):Math.sqrt(G)},j}function Yf(f,_,Q){f.prototype=_.prototype=Q,Q.constructor=f}function qQ(f,_){var Q=Object.create(f.prototype);for(var J in _)Q[J]=_[J];return Q}function wf(){}var Xf=0.7,af=1/Xf,o0="\\s*([+-]?\\d+)\\s*",Lf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Z0="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",o8=/^#([0-9a-f]{3,8})$/,e8=new RegExp(`^rgb\\(${o0},${o0},${o0}\\)$`),fJ=new RegExp(`^rgb\\(${Z0},${Z0},${Z0}\\)$`),_J=new RegExp(`^rgba\\(${o0},${o0},${o0},${Lf}\\)$`),QJ=new RegExp(`^rgba\\(${Z0},${Z0},${Z0},${Lf}\\)$`),JJ=new RegExp(`^hsl\\(${Lf},${Z0},${Z0}\\)$`),$J=new RegExp(`^hsla\\(${Lf},${Z0},${Z0},${Lf}\\)$`),L9={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};Yf(wf,G0,{copy(f){return Object.assign(new this.constructor,this,f)},displayable(){return this.rgb().displayable()},hex:w9,formatHex:w9,formatHex8:qJ,formatHsl:FJ,formatRgb:T9,toString:T9});function w9(){return this.rgb().formatHex()}function qJ(){return this.rgb().formatHex8()}function FJ(){return C9(this).formatHsl()}function T9(){return this.rgb().formatRgb()}function G0(f){var _,Q;return f=(f+"").trim().toLowerCase(),(_=o8.exec(f))?(Q=_[1].length,_=parseInt(_[1],16),Q===6?O9(_):Q===3?new K0(_>>8&15|_>>4&240,_>>4&15|_&240,(_&15)<<4|_&15,1):Q===8?rf(_>>24&255,_>>16&255,_>>8&255,(_&255)/255):Q===4?rf(_>>12&15|_>>8&240,_>>8&15|_>>4&240,_>>4&15|_&240,((_&15)<<4|_&15)/255):null):(_=e8.exec(f))?new K0(_[1],_[2],_[3],1):(_=fJ.exec(f))?new K0(_[1]*255/100,_[2]*255/100,_[3]*255/100,1):(_=_J.exec(f))?rf(_[1],_[2],_[3],_[4]):(_=QJ.exec(f))?rf(_[1]*255/100,_[2]*255/100,_[3]*255/100,_[4]):(_=JJ.exec(f))?H9(_[1],_[2]/100,_[3]/100,1):(_=$J.exec(f))?H9(_[1],_[2]/100,_[3]/100,_[4]):L9.hasOwnProperty(f)?O9(L9[f]):f==="transparent"?new K0(NaN,NaN,NaN,0):null}function O9(f){return new K0(f>>16&255,f>>8&255,f&255,1)}function rf(f,_,Q,J){if(J<=0)f=_=Q=NaN;return new K0(f,_,Q,J)}function KJ(f){if(!(f instanceof wf))f=G0(f);if(!f)return new K0;return f=f.rgb(),new K0(f.r,f.g,f.b,f.opacity)}function e0(f,_,Q,J){return arguments.length===1?KJ(f):new K0(f,_,Q,J==null?1:J)}function K0(f,_,Q,J){this.r=+f,this.g=+_,this.b=+Q,this.opacity=+J}Yf(K0,e0,qQ(wf,{brighter(f){return f=f==null?af:Math.pow(af,f),new K0(this.r*f,this.g*f,this.b*f,this.opacity)},darker(f){return f=f==null?Xf:Math.pow(Xf,f),new K0(this.r*f,this.g*f,this.b*f,this.opacity)},rgb(){return this},clamp(){return new K0(x0(this.r),x0(this.g),x0(this.b),df(this.opacity))},displayable(){return-0.5<=this.r&&this.r<255.5&&(-0.5<=this.g&&this.g<255.5)&&(-0.5<=this.b&&this.b<255.5)&&(0<=this.opacity&&this.opacity<=1)},hex:R9,formatHex:R9,formatHex8:UJ,formatRgb:z9,toString:z9}));function R9(){return`#${b0(this.r)}${b0(this.g)}${b0(this.b)}`}function UJ(){return`#${b0(this.r)}${b0(this.g)}${b0(this.b)}${b0((isNaN(this.opacity)?1:this.opacity)*255)}`}function z9(){let f=df(this.opacity);return`${f===1?"rgb(":"rgba("}${x0(this.r)}, ${x0(this.g)}, ${x0(this.b)}${f===1?")":`, ${f})`}`}function df(f){return isNaN(f)?1:Math.max(0,Math.min(1,f))}function x0(f){return Math.max(0,Math.min(255,Math.round(f)||0))}function b0(f){return f=x0(f),(f<16?"0":"")+f.toString(16)}function H9(f,_,Q,J){if(J<=0)f=_=Q=NaN;else if(Q<=0||Q>=1)f=_=NaN;else if(_<=0)f=NaN;return new W0(f,_,Q,J)}function C9(f){if(f instanceof W0)return new W0(f.h,f.s,f.l,f.opacity);if(!(f instanceof wf))f=G0(f);if(!f)return new W0;if(f instanceof W0)return f;f=f.rgb();var _=f.r/255,Q=f.g/255,J=f.b/255,$=Math.min(_,Q,J),q=Math.max(_,Q,J),F=NaN,K=q-$,A=(q+$)/2;if(K){if(_===q)F=(Q-J)/K+(Q<J)*6;else if(Q===q)F=(J-_)/K+2;else F=(_-Q)/K+4;K/=A<0.5?q+$:2-q-$,F*=60}else K=A>0&&A<1?0:F;return new W0(F,K,A,f.opacity)}function I9(f,_,Q,J){return arguments.length===1?C9(f):new W0(f,_,Q,J==null?1:J)}function W0(f,_,Q,J){this.h=+f,this.s=+_,this.l=+Q,this.opacity=+J}Yf(W0,I9,qQ(wf,{brighter(f){return f=f==null?af:Math.pow(af,f),new W0(this.h,this.s,this.l*f,this.opacity)},darker(f){return f=f==null?Xf:Math.pow(Xf,f),new W0(this.h,this.s,this.l*f,this.opacity)},rgb(){var f=this.h%360+(this.h<0)*360,_=isNaN(f)||isNaN(this.s)?0:this.s,Q=this.l,J=Q+(Q<0.5?Q:1-Q)*_,$=2*Q-J;return new K0(FQ(f>=240?f-240:f+120,$,J),FQ(f,$,J),FQ(f<120?f+240:f-120,$,J),this.opacity)},clamp(){return new W0(D9(this.h),sf(this.s),sf(this.l),df(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(){let f=df(this.opacity);return`${f===1?"hsl(":"hsla("}${D9(this.h)}, ${sf(this.s)*100}%, ${sf(this.l)*100}%${f===1?")":`, ${f})`}`}}));function D9(f){return f=(f||0)%360,f<0?f+360:f}function sf(f){return Math.max(0,Math.min(1,f||0))}function FQ(f,_,Q){return(f<60?_+(Q-_)*f/60:f<180?Q:f<240?_+(Q-_)*(240-f)/60:_)*255}function KQ(f,_,Q,J,$){var q=f*f,F=q*f;return((1-3*f+3*q-F)*_+(4-6*q+3*F)*Q+(1+3*f+3*q-3*F)*J+F*$)/6}function UQ(f){var _=f.length-1;return function(Q){var J=Q<=0?Q=0:Q>=1?(Q=1,_-1):Math.floor(Q*_),$=f[J],q=f[J+1],F=J>0?f[J-1]:2*$-q,K=J<_-1?f[J+2]:2*q-$;return KQ((Q-J/_)*_,F,$,q,K)}}function AQ(f){var _=f.length;return function(Q){var J=Math.floor(((Q%=1)<0?++Q:Q)*_),$=f[(J+_-1)%_],q=f[J%_],F=f[(J+1)%_],K=f[(J+2)%_];return KQ((Q-J/_)*_,$,q,F,K)}}var Tf=(f)=>()=>f;function AJ(f,_){return function(Q){return f+Q*_}}function WJ(f,_,Q){return f=Math.pow(f,Q),_=Math.pow(_,Q)-f,Q=1/Q,function(J){return Math.pow(f+J*_,Q)}}function S9(f){return(f=+f)===1?tf:function(_,Q){return Q-_?WJ(_,Q,f):Tf(isNaN(_)?Q:_)}}function tf(f,_){var Q=_-f;return Q?AJ(f,Q):Tf(isNaN(f)?_:f)}var k0=function f(_){var Q=S9(_);function J($,q){var F=Q(($=e0($)).r,(q=e0(q)).r),K=Q($.g,q.g),A=Q($.b,q.b),U=tf($.opacity,q.opacity);return function(W){return $.r=F(W),$.g=K(W),$.b=A(W),$.opacity=U(W),$+""}}return J.gamma=f,J}(1);function E9(f){return function(_){var Q=_.length,J=Array(Q),$=Array(Q),q=Array(Q),F,K;for(F=0;F<Q;++F)K=e0(_[F]),J[F]=K.r||0,$[F]=K.g||0,q[F]=K.b||0;return J=f(J),$=f($),q=f(q),K.opacity=1,function(A){return K.r=J(A),K.g=$(A),K.b=q(A),K+""}}}var GJ=E9(UQ),BJ=E9(AQ);function WQ(f,_){if(!_)_=[];var Q=f?Math.min(_.length,f.length):0,J=_.slice(),$;return function(q){for($=0;$<Q;++$)J[$]=f[$]*(1-q)+_[$]*q;return J}}function y9(f){return ArrayBuffer.isView(f)&&!(f instanceof DataView)}function N9(f,_){var Q=_?_.length:0,J=f?Math.min(Q,f.length):0,$=Array(J),q=Array(Q),F;for(F=0;F<J;++F)$[F]=V0(f[F],_[F]);for(;F<Q;++F)q[F]=_[F];return function(K){for(F=0;F<J;++F)q[F]=$[F](K);return q}}function GQ(f,_){var Q=new Date;return f=+f,_=+_,function(J){return Q.setTime(f*(1-J)+_*J),Q}}function J0(f,_){return f=+f,_=+_,function(Q){return f*(1-Q)+_*Q}}function BQ(f,_){var Q={},J={},$;if(f===null||typeof f!=="object")f={};if(_===null||typeof _!=="object")_={};for($ in _)if($ in f)Q[$]=V0(f[$],_[$]);else J[$]=_[$];return function(q){for($ in Q)J[$]=Q[$](q);return J}}var MQ=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jQ=new RegExp(MQ.source,"g");function jJ(f){return function(){return f}}function MJ(f){return function(_){return f(_)+""}}function ff(f,_){var Q=MQ.lastIndex=jQ.lastIndex=0,J,$,q,F=-1,K=[],A=[];f=f+"",_=_+"";while((J=MQ.exec(f))&&($=jQ.exec(_))){if((q=$.index)>Q)if(q=_.slice(Q,q),K[F])K[F]+=q;else K[++F]=q;if((J=J[0])===($=$[0]))if(K[F])K[F]+=$;else K[++F]=$;else K[++F]=null,A.push({i:F,x:J0(J,$)});Q=jQ.lastIndex}if(Q<_.length)if(q=_.slice(Q),K[F])K[F]+=q;else K[++F]=q;return K.length<2?A[0]?MJ(A[0].x):jJ(_):(_=A.length,function(U){for(var W=0,G;W<_;++W)K[(G=A[W]).i]=G.x(U);return K.join("")})}function V0(f,_){var Q=typeof _,J;return _==null||Q==="boolean"?Tf(_):(Q==="number"?J0:Q==="string"?(J=G0(_))?(_=J,k0):ff:_ instanceof G0?k0:_ instanceof Date?GQ:y9(_)?WQ:Array.isArray(_)?N9:typeof _.valueOf!=="function"&&typeof _.toString!=="function"||isNaN(_)?BQ:J0)(f,_)}var u9=180/Math.PI,nf={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function of(f,_,Q,J,$,q){var F,K,A;if(F=Math.sqrt(f*f+_*_))f/=F,_/=F;if(A=f*Q+_*J)Q-=f*A,J-=_*A;if(K=Math.sqrt(Q*Q+J*J))Q/=K,J/=K,A/=K;if(f*J<_*Q)f=-f,_=-_,A=-A,F=-F;return{translateX:$,translateY:q,rotate:Math.atan2(_,f)*u9,skewX:Math.atan(A)*u9,scaleX:F,scaleY:K}}var ef;function b9(f){let _=new(typeof DOMMatrix==="function"?DOMMatrix:WebKitCSSMatrix)(f+"");return _.isIdentity?nf:of(_.a,_.b,_.c,_.d,_.e,_.f)}function x9(f){if(f==null)return nf;if(!ef)ef=document.createElementNS("http://www.w3.org/2000/svg","g");if(ef.setAttribute("transform",f),!(f=ef.transform.baseVal.consolidate()))return nf;return f=f.matrix,of(f.a,f.b,f.c,f.d,f.e,f.f)}function k9(f,_,Q,J){function $(U){return U.length?U.pop()+" ":""}function q(U,W,G,j,M,Y){if(U!==G||W!==j){var w=M.push("translate(",null,_,null,Q);Y.push({i:w-4,x:J0(U,G)},{i:w-2,x:J0(W,j)})}else if(G||j)M.push("translate("+G+_+j+Q)}function F(U,W,G,j){if(U!==W){if(U-W>180)W+=360;else if(W-U>180)U+=360;j.push({i:G.push($(G)+"rotate(",null,J)-2,x:J0(U,W)})}else if(W)G.push($(G)+"rotate("+W+J)}function K(U,W,G,j){if(U!==W)j.push({i:G.push($(G)+"skewX(",null,J)-2,x:J0(U,W)});else if(W)G.push($(G)+"skewX("+W+J)}function A(U,W,G,j,M,Y){if(U!==G||W!==j){var w=M.push($(M)+"scale(",null,",",null,")");Y.push({i:w-4,x:J0(U,G)},{i:w-2,x:J0(W,j)})}else if(G!==1||j!==1)M.push($(M)+"scale("+G+","+j+")")}return function(U,W){var G=[],j=[];return U=f(U),W=f(W),q(U.translateX,U.translateY,W.translateX,W.translateY,G,j),F(U.rotate,W.rotate,G,j),K(U.skewX,W.skewX,G,j),A(U.scaleX,U.scaleY,W.scaleX,W.scaleY,G,j),U=W=null,function(M){var Y=-1,w=j.length,L;while(++Y<w)G[(L=j[Y]).i]=L.x(M);return G.join("")}}}var ZQ=k9(b9,"px, ","px)","deg)"),VQ=k9(x9,", ",")",")");var ZJ=0.000000000001;function P9(f){return((f=Math.exp(f))+1/f)/2}function VJ(f){return((f=Math.exp(f))-1/f)/2}function YJ(f){return((f=Math.exp(2*f))-1)/(f+1)}var P0=function f(_,Q,J){function $(q,F){var K=q[0],A=q[1],U=q[2],W=F[0],G=F[1],j=F[2],M=W-K,Y=G-A,w=M*M+Y*Y,L,Z;if(w<ZJ)Z=Math.log(j/U)/_,L=function(D){return[K+D*M,A+D*Y,U*Math.exp(_*D*Z)]};else{var C=Math.sqrt(w),H=(j*j-U*U+J*w)/(2*U*Q*C),X=(j*j-U*U-J*w)/(2*j*Q*C),S=Math.log(Math.sqrt(H*H+1)-H),y=Math.log(Math.sqrt(X*X+1)-X);Z=(y-S)/_,L=function(D){var R=D*Z,I=P9(S),N=U/(Q*C)*(I*YJ(_*R+S)-VJ(S));return[K+N*M,A+N*Y,U*I/P9(_*R+S)]}}return L.duration=Z*1000*_/Math.SQRT2,L}return $.rho=function(q){var F=Math.max(0.001,+q),K=F*F,A=K*K;return f(F,K,A)},$}(Math.SQRT2,2,4);var _f=0,Rf=0,Of=0,v9=1000,f_,zf,__=0,h0=0,Q_=0,Hf=typeof performance==="object"&&performance.now?performance:Date,m9=typeof window==="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(f){setTimeout(f,17)};function Cf(){return h0||(m9(XJ),h0=Hf.now()+Q_)}function XJ(){h0=0}function Df(){this._call=this._time=this._next=null}Df.prototype=J_.prototype={constructor:Df,restart:function(f,_,Q){if(typeof f!=="function")throw TypeError("callback is not a function");if(Q=(Q==null?Cf():+Q)+(_==null?0:+_),!this._next&&zf!==this){if(zf)zf._next=this;else f_=this;zf=this}this._call=f,this._time=Q,YQ()},stop:function(){if(this._call)this._call=null,this._time=1/0,YQ()}};function J_(f,_,Q){var J=new Df;return J.restart(f,_,Q),J}function g9(){Cf(),++_f;var f=f_,_;while(f){if((_=h0-f._time)>=0)f._call.call(void 0,_);f=f._next}--_f}function h9(){h0=(__=Hf.now())+Q_,_f=Rf=0;try{g9()}finally{_f=0,wJ(),h0=0}}function LJ(){var f=Hf.now(),_=f-__;if(_>v9)Q_-=_,__=f}function wJ(){var f,_=f_,Q,J=1/0;while(_)if(_._call){if(J>_._time)J=_._time;f=_,_=_._next}else Q=_._next,_._next=null,_=f?f._next=Q:f_=Q;zf=f,YQ(J)}function YQ(f){if(_f)return;if(Rf)Rf=clearTimeout(Rf);var _=f-h0;if(_>24){if(f<1/0)Rf=setTimeout(h9,f-Hf.now()-Q_);if(Of)Of=clearInterval(Of)}else{if(!Of)__=Hf.now(),Of=setInterval(LJ,v9);_f=1,m9(h9)}}function If(f,_,Q){var J=new Df;return _=_==null?0:+_,J.restart(($)=>{J.stop(),f($+_)},_,Q),J}var TJ=N0("start","end","cancel","interrupt"),OJ=[],l9=0,p9=1,q_=2,$_=3,c9=4,F_=5,Sf=6;function w0(f,_,Q,J,$,q){var F=f.__transition;if(!F)f.__transition={};else if(Q in F)return;RJ(f,Q,{name:_,index:J,group:$,on:TJ,tween:OJ,time:q.time,delay:q.delay,duration:q.duration,ease:q.ease,timer:null,state:l9})}function Ef(f,_){var Q=n(f,_);if(Q.state>l9)throw Error("too late; already scheduled");return Q}function _0(f,_){var Q=n(f,_);if(Q.state>$_)throw Error("too late; already running");return Q}function n(f,_){var Q=f.__transition;if(!Q||!(Q=Q[_]))throw Error("transition not found");return Q}function RJ(f,_,Q){var J=f.__transition,$;J[_]=Q,Q.timer=J_(q,0,Q.time);function q(U){if(Q.state=p9,Q.timer.restart(F,Q.delay,Q.time),Q.delay<=U)F(U-Q.delay)}function F(U){var W,G,j,M;if(Q.state!==p9)return A();for(W in J){if(M=J[W],M.name!==Q.name)continue;if(M.state===$_)return If(F);if(M.state===c9)M.state=Sf,M.timer.stop(),M.on.call("interrupt",f,f.__data__,M.index,M.group),delete J[W];else if(+W<_)M.state=Sf,M.timer.stop(),M.on.call("cancel",f,f.__data__,M.index,M.group),delete J[W]}if(If(function(){if(Q.state===$_)Q.state=c9,Q.timer.restart(K,Q.delay,Q.time),K(U)}),Q.state=q_,Q.on.call("start",f,f.__data__,Q.index,Q.group),Q.state!==q_)return;Q.state=$_,$=Array(j=Q.tween.length);for(W=0,G=-1;W<j;++W)if(M=Q.tween[W].value.call(f,f.__data__,Q.index,Q.group))$[++G]=M;$.length=G+1}function K(U){var W=U<Q.duration?Q.ease.call(null,U/Q.duration):(Q.timer.restart(A),Q.state=F_,1),G=-1,j=$.length;while(++G<j)$[G].call(f,W);if(Q.state===F_)Q.on.call("end",f,f.__data__,Q.index,Q.group),A()}function A(){Q.state=Sf,Q.timer.stop(),delete J[_];for(var U in J)return;delete f.__transition}}function D0(f,_){var Q=f.__transition,J,$,q=!0,F;if(!Q)return;_=_==null?null:_+"";for(F in Q){if((J=Q[F]).name!==_){q=!1;continue}$=J.state>q_&&J.state<F_,J.state=Sf,J.timer.stop(),J.on.call($?"interrupt":"cancel",f,f.__data__,J.index,J.group),delete Q[F]}if(q)delete f.__transition}function XQ(f){return this.each(function(){D0(this,f)})}function zJ(f,_){var Q,J;return function(){var $=_0(this,f),q=$.tween;if(q!==Q){J=Q=q;for(var F=0,K=J.length;F<K;++F)if(J[F].name===_){J=J.slice(),J.splice(F,1);break}}$.tween=J}}function HJ(f,_,Q){var J,$;if(typeof Q!=="function")throw Error();return function(){var q=_0(this,f),F=q.tween;if(F!==J){$=(J=F).slice();for(var K={name:_,value:Q},A=0,U=$.length;A<U;++A)if($[A].name===_){$[A]=K;break}if(A===U)$.push(K)}q.tween=$}}function LQ(f,_){var Q=this._id;if(f+="",arguments.length<2){var J=n(this.node(),Q).tween;for(var $=0,q=J.length,F;$<q;++$)if((F=J[$]).name===f)return F.value;return null}return this.each((_==null?zJ:HJ)(Q,f,_))}function Qf(f,_,Q){var J=f._id;return f.each(function(){var $=_0(this,J);($.value||($.value={}))[_]=Q.apply(this,arguments)}),function($){return n($,J).value[_]}}function yf(f,_){var Q;return(typeof _==="number"?J0:_ instanceof G0?k0:(Q=G0(_))?(_=Q,k0):ff)(f,_)}function DJ(f){return function(){this.removeAttribute(f)}}function CJ(f){return function(){this.removeAttributeNS(f.space,f.local)}}function IJ(f,_,Q){var J,$=Q+"",q;return function(){var F=this.getAttribute(f);return F===$?null:F===J?q:q=_(J=F,Q)}}function SJ(f,_,Q){var J,$=Q+"",q;return function(){var F=this.getAttributeNS(f.space,f.local);return F===$?null:F===J?q:q=_(J=F,Q)}}function EJ(f,_,Q){var J,$,q;return function(){var F,K=Q(this),A;if(K==null)return void this.removeAttribute(f);return F=this.getAttribute(f),A=K+"",F===A?null:F===J&&A===$?q:($=A,q=_(J=F,K))}}function yJ(f,_,Q){var J,$,q;return function(){var F,K=Q(this),A;if(K==null)return void this.removeAttributeNS(f.space,f.local);return F=this.getAttributeNS(f.space,f.local),A=K+"",F===A?null:F===J&&A===$?q:($=A,q=_(J=F,K))}}function wQ(f,_){var Q=M0(f),J=Q==="transform"?VQ:yf;return this.attrTween(f,typeof _==="function"?(Q.local?yJ:EJ)(Q,J,Qf(this,"attr."+f,_)):_==null?(Q.local?CJ:DJ)(Q):(Q.local?SJ:IJ)(Q,J,_))}function NJ(f,_){return function(Q){this.setAttribute(f,_.call(this,Q))}}function uJ(f,_){return function(Q){this.setAttributeNS(f.space,f.local,_.call(this,Q))}}function bJ(f,_){var Q,J;function $(){var q=_.apply(this,arguments);if(q!==J)Q=(J=q)&&uJ(f,q);return Q}return $._value=_,$}function xJ(f,_){var Q,J;function $(){var q=_.apply(this,arguments);if(q!==J)Q=(J=q)&&NJ(f,q);return Q}return $._value=_,$}function TQ(f,_){var Q="attr."+f;if(arguments.length<2)return(Q=this.tween(Q))&&Q._value;if(_==null)return this.tween(Q,null);if(typeof _!=="function")throw Error();var J=M0(f);return this.tween(Q,(J.local?bJ:xJ)(J,_))}function kJ(f,_){return function(){Ef(this,f).delay=+_.apply(this,arguments)}}function PJ(f,_){return _=+_,function(){Ef(this,f).delay=_}}function OQ(f){var _=this._id;return arguments.length?this.each((typeof f==="function"?kJ:PJ)(_,f)):n(this.node(),_).delay}function hJ(f,_){return function(){_0(this,f).duration=+_.apply(this,arguments)}}function vJ(f,_){return _=+_,function(){_0(this,f).duration=_}}function RQ(f){var _=this._id;return arguments.length?this.each((typeof f==="function"?hJ:vJ)(_,f)):n(this.node(),_).duration}function mJ(f,_){if(typeof _!=="function")throw Error();return function(){_0(this,f).ease=_}}function zQ(f){var _=this._id;return arguments.length?this.each(mJ(_,f)):n(this.node(),_).ease}function gJ(f,_){return function(){var Q=_.apply(this,arguments);if(typeof Q!=="function")throw Error();_0(this,f).ease=Q}}function HQ(f){if(typeof f!=="function")throw Error();return this.each(gJ(this._id,f))}function DQ(f){if(typeof f!=="function")f=d0(f);for(var _=this._groups,Q=_.length,J=Array(Q),$=0;$<Q;++$)for(var q=_[$],F=q.length,K=J[$]=[],A,U=0;U<F;++U)if((A=q[U])&&f.call(A,A.__data__,U,q))K.push(A);return new F0(J,this._parents,this._name,this._id)}function CQ(f){if(f._id!==this._id)throw Error();for(var _=this._groups,Q=f._groups,J=_.length,$=Q.length,q=Math.min(J,$),F=Array(J),K=0;K<q;++K)for(var A=_[K],U=Q[K],W=A.length,G=F[K]=Array(W),j,M=0;M<W;++M)if(j=A[M]||U[M])G[M]=j;for(;K<J;++K)F[K]=_[K];return new F0(F,this._parents,this._name,this._id)}function pJ(f){return(f+"").trim().split(/^|\s+/).every(function(_){var Q=_.indexOf(".");if(Q>=0)_=_.slice(0,Q);return!_||_==="start"})}function cJ(f,_,Q){var J,$,q=pJ(_)?Ef:_0;return function(){var F=q(this,f),K=F.on;if(K!==J)($=(J=K).copy()).on(_,Q);F.on=$}}function IQ(f,_){var Q=this._id;return arguments.length<2?n(this.node(),Q).on.on(f):this.each(cJ(Q,f,_))}function lJ(f){return function(){var _=this.parentNode;for(var Q in this.__transition)if(+Q!==f)return;if(_)_.removeChild(this)}}function SQ(){return this.on("end.remove",lJ(this._id))}function EQ(f){var _=this._name,Q=this._id;if(typeof f!=="function")f=z0(f);for(var J=this._groups,$=J.length,q=Array($),F=0;F<$;++F)for(var K=J[F],A=K.length,U=q[F]=Array(A),W,G,j=0;j<A;++j)if((W=K[j])&&(G=f.call(W,W.__data__,j,K))){if("__data__"in W)G.__data__=W.__data__;U[j]=G,w0(U[j],_,Q,j,U,n(W,Q))}return new F0(q,this._parents,_,Q)}function yQ(f){var _=this._name,Q=this._id;if(typeof f!=="function")f=t0(f);for(var J=this._groups,$=J.length,q=[],F=[],K=0;K<$;++K)for(var A=J[K],U=A.length,W,G=0;G<U;++G)if(W=A[G]){for(var j=f.call(W,W.__data__,G,A),M,Y=n(W,Q),w=0,L=j.length;w<L;++w)if(M=j[w])w0(M,_,Q,w,j,Y);q.push(j),F.push(W)}return new F0(q,F,_,Q)}var rJ=X0.prototype.constructor;function NQ(){return new rJ(this._groups,this._parents)}function iJ(f,_){var Q,J,$;return function(){var q=H0(this,f),F=(this.style.removeProperty(f),H0(this,f));return q===F?null:q===Q&&F===J?$:$=_(Q=q,J=F)}}function r9(f){return function(){this.style.removeProperty(f)}}function sJ(f,_,Q){var J,$=Q+"",q;return function(){var F=H0(this,f);return F===$?null:F===J?q:q=_(J=F,Q)}}function aJ(f,_,Q){var J,$,q;return function(){var F=H0(this,f),K=Q(this),A=K+"";if(K==null)A=K=(this.style.removeProperty(f),H0(this,f));return F===A?null:F===J&&A===$?q:($=A,q=_(J=F,K))}}function dJ(f,_){var Q,J,$,q="style."+_,F="end."+q,K;return function(){var A=_0(this,f),U=A.on,W=A.value[q]==null?K||(K=r9(_)):void 0;if(U!==Q||$!==W)(J=(Q=U).copy()).on(F,$=W);A.on=J}}function uQ(f,_,Q){var J=(f+="")==="transform"?ZQ:yf;return _==null?this.styleTween(f,iJ(f,J)).on("end.style."+f,r9(f)):typeof _==="function"?this.styleTween(f,aJ(f,J,Qf(this,"style."+f,_))).each(dJ(this._id,f)):this.styleTween(f,sJ(f,J,_),Q).on("end.style."+f,null)}function tJ(f,_,Q){return function(J){this.style.setProperty(f,_.call(this,J),Q)}}function nJ(f,_,Q){var J,$;function q(){var F=_.apply(this,arguments);if(F!==$)J=($=F)&&tJ(f,F,Q);return J}return q._value=_,q}function bQ(f,_,Q){var J="style."+(f+="");if(arguments.length<2)return(J=this.tween(J))&&J._value;if(_==null)return this.tween(J,null);if(typeof _!=="function")throw Error();return this.tween(J,nJ(f,_,Q==null?"":Q))}function oJ(f){return function(){this.textContent=f}}function eJ(f){return function(){var _=f(this);this.textContent=_==null?"":_}}function xQ(f){return this.tween("text",typeof f==="function"?eJ(Qf(this,"text",f)):oJ(f==null?"":f+""))}function f7(f){return function(_){this.textContent=f.call(this,_)}}function _7(f){var _,Q;function J(){var $=f.apply(this,arguments);if($!==Q)_=(Q=$)&&f7($);return _}return J._value=f,J}function kQ(f){var _="text";if(arguments.length<1)return(_=this.tween(_))&&_._value;if(f==null)return this.tween(_,null);if(typeof f!=="function")throw Error();return this.tween(_,_7(f))}function PQ(){var f=this._name,_=this._id,Q=K_();for(var J=this._groups,$=J.length,q=0;q<$;++q)for(var F=J[q],K=F.length,A,U=0;U<K;++U)if(A=F[U]){var W=n(A,_);w0(A,f,Q,U,F,{time:W.time+W.delay+W.duration,delay:0,duration:W.duration,ease:W.ease})}return new F0(J,this._parents,f,Q)}function hQ(){var f,_,Q=this,J=Q._id,$=Q.size();return new Promise(function(q,F){var K={value:F},A={value:function(){if(--$===0)q()}};if(Q.each(function(){var U=_0(this,J),W=U.on;if(W!==f)_=(f=W).copy(),_._.cancel.push(K),_._.interrupt.push(K),_._.end.push(A);U.on=_}),$===0)q()})}var Q7=0;function F0(f,_,Q,J){this._groups=f,this._parents=_,this._name=Q,this._id=J}function i9(f){return X0().transition(f)}function K_(){return++Q7}var T0=X0.prototype;F0.prototype=i9.prototype={constructor:F0,select:EQ,selectAll:yQ,selectChild:T0.selectChild,selectChildren:T0.selectChildren,filter:DQ,merge:CQ,selection:NQ,transition:PQ,call:T0.call,nodes:T0.nodes,node:T0.node,size:T0.size,empty:T0.empty,each:T0.each,on:IQ,attr:wQ,attrTween:TQ,style:uQ,styleTween:bQ,text:xQ,textTween:kQ,remove:SQ,tween:LQ,delay:OQ,duration:RQ,ease:zQ,easeVarying:HQ,end:hQ,[Symbol.iterator]:T0[Symbol.iterator]};function U_(f){return((f*=2)<=1?f*f*f:(f-=2)*f*f+2)/2}var J7={time:null,delay:0,duration:250,ease:U_};function $7(f,_){var Q;while(!(Q=f.__transition)||!(Q=Q[_]))if(!(f=f.parentNode))throw Error(`transition ${_} not found`);return Q}function vQ(f){var _,Q;if(f instanceof F0)_=f._id,f=f._name;else _=K_(),(Q=J7).time=Cf(),f=f==null?null:f+"";for(var J=this._groups,$=J.length,q=0;q<$;++q)for(var F=J[q],K=F.length,A,U=0;U<K;++U)if(A=F[U])w0(A,f,_,U,F,Q||$7(A,_));return new F0(J,this._parents,f,_)}X0.prototype.interrupt=XQ;X0.prototype.transition=vQ;var Nf=(f)=>()=>f;function mQ(f,{sourceEvent:_,target:Q,transform:J,dispatch:$}){Object.defineProperties(this,{type:{value:f,enumerable:!0,configurable:!0},sourceEvent:{value:_,enumerable:!0,configurable:!0},target:{value:Q,enumerable:!0,configurable:!0},transform:{value:J,enumerable:!0,configurable:!0},_:{value:$}})}function B0(f,_,Q){this.k=f,this.x=_,this.y=Q}B0.prototype={constructor:B0,scale:function(f){return f===1?this:new B0(this.k*f,this.x,this.y)},translate:function(f,_){return f===0&_===0?this:new B0(this.k,this.x+this.k*f,this.y+this.k*_)},apply:function(f){return[f[0]*this.k+this.x,f[1]*this.k+this.y]},applyX:function(f){return f*this.k+this.x},applyY:function(f){return f*this.k+this.y},invert:function(f){return[(f[0]-this.x)/this.k,(f[1]-this.y)/this.k]},invertX:function(f){return(f-this.x)/this.k},invertY:function(f){return(f-this.y)/this.k},rescaleX:function(f){return f.copy().domain(f.range().map(this.invertX,this).map(f.invert,f))},rescaleY:function(f){return f.copy().domain(f.range().map(this.invertY,this).map(f.invert,f))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var v0=new B0(1,0,0);uf.prototype=B0.prototype;function uf(f){while(!f.__zoom)if(!(f=f.parentNode))return v0;return f.__zoom}function A_(f){f.stopImmediatePropagation()}function m0(f){f.preventDefault(),f.stopImmediatePropagation()}function q7(f){return(!f.ctrlKey||f.type==="wheel")&&!f.button}function F7(){var f=this;if(f instanceof SVGElement){if(f=f.ownerSVGElement||f,f.hasAttribute("viewBox"))return f=f.viewBox.baseVal,[[f.x,f.y],[f.x+f.width,f.y+f.height]];return[[0,0],[f.width.baseVal.value,f.height.baseVal.value]]}return[[0,0],[f.clientWidth,f.clientHeight]]}function s9(){return this.__zoom||v0}function K7(f){return-f.deltaY*(f.deltaMode===1?0.05:f.deltaMode?1:0.002)*(f.ctrlKey?10:1)}function U7(){return navigator.maxTouchPoints||"ontouchstart"in this}function A7(f,_,Q){var J=f.invertX(_[0][0])-Q[0][0],$=f.invertX(_[1][0])-Q[1][0],q=f.invertY(_[0][1])-Q[0][1],F=f.invertY(_[1][1])-Q[1][1];return f.translate($>J?(J+$)/2:Math.min(0,J)||Math.max(0,$),F>q?(q+F)/2:Math.min(0,q)||Math.max(0,F))}function W_(){var f=q7,_=F7,Q=A7,J=K7,$=U7,q=[0,1/0],F=[[-1/0,-1/0],[1/0,1/0]],K=250,A=P0,U=N0("start","zoom","end"),W,G,j,M=500,Y=150,w=0,L=10;function Z(B){B.property("__zoom",s9).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",N).filter($).on("touchstart.zoom",T).on("touchmove.zoom",b).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}Z.transform=function(B,O,V,z){var u=B.selection?B.selection():B;if(u.property("__zoom",s9),B!==u)S(B,O,V,z);else u.interrupt().each(function(){y(this,arguments).event(z).start().zoom(null,typeof O==="function"?O.apply(this,arguments):O).end()})},Z.scaleBy=function(B,O,V,z){Z.scaleTo(B,function(){var u=this.__zoom.k,E=typeof O==="function"?O.apply(this,arguments):O;return u*E},V,z)},Z.scaleTo=function(B,O,V,z){Z.transform(B,function(){var u=_.apply(this,arguments),E=this.__zoom,x=V==null?X(u):typeof V==="function"?V.apply(this,arguments):V,h=E.invert(x),P=typeof O==="function"?O.apply(this,arguments):O;return Q(H(C(E,P),x,h),u,F)},V,z)},Z.translateBy=function(B,O,V,z){Z.transform(B,function(){return Q(this.__zoom.translate(typeof O==="function"?O.apply(this,arguments):O,typeof V==="function"?V.apply(this,arguments):V),_.apply(this,arguments),F)},null,z)},Z.translateTo=function(B,O,V,z,u){Z.transform(B,function(){var E=_.apply(this,arguments),x=this.__zoom,h=z==null?X(E):typeof z==="function"?z.apply(this,arguments):z;return Q(v0.translate(h[0],h[1]).scale(x.k).translate(typeof O==="function"?-O.apply(this,arguments):-O,typeof V==="function"?-V.apply(this,arguments):-V),E,F)},z,u)};function C(B,O){return O=Math.max(q[0],Math.min(q[1],O)),O===B.k?B:new B0(O,B.x,B.y)}function H(B,O,V){var z=O[0]-V[0]*B.k,u=O[1]-V[1]*B.k;return z===B.x&&u===B.y?B:new B0(B.k,z,u)}function X(B){return[(+B[0][0]+ +B[1][0])/2,(+B[0][1]+ +B[1][1])/2]}function S(B,O,V,z){B.on("start.zoom",function(){y(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){y(this,arguments).event(z).end()}).tween("zoom",function(){var u=this,E=arguments,x=y(u,E).event(z),h=_.apply(u,E),P=V==null?X(h):typeof V==="function"?V.apply(u,E):V,l=Math.max(h[1][0]-h[0][0],h[1][1]-h[0][1]),r=u.__zoom,t=typeof O==="function"?O.apply(u,E):O,e=A(r.invert(P).concat(l/r.k),t.invert(P).concat(l/t.k));return function(a){if(a===1)a=t;else{var o=e(a),A0=l/o[2];a=new B0(A0,P[0]-o[0]*A0,P[1]-o[1]*A0)}x.zoom(null,a)}})}function y(B,O,V){return!V&&B.__zooming||new D(B,O)}function D(B,O){this.that=B,this.args=O,this.active=0,this.sourceEvent=null,this.extent=_.apply(B,O),this.taps=0}D.prototype={event:function(B){if(B)this.sourceEvent=B;return this},start:function(){if(++this.active===1)this.that.__zooming=this,this.emit("start");return this},zoom:function(B,O){if(this.mouse&&B!=="mouse")this.mouse[1]=O.invert(this.mouse[0]);if(this.touch0&&B!=="touch")this.touch0[1]=O.invert(this.touch0[0]);if(this.touch1&&B!=="touch")this.touch1[1]=O.invert(this.touch1[0]);return this.that.__zoom=O,this.emit("zoom"),this},end:function(){if(--this.active===0)delete this.that.__zooming,this.emit("end");return this},emit:function(B){var O=f0(this.that).datum();U.call(B,this.that,new mQ(B,{sourceEvent:this.sourceEvent,target:Z,type:B,transform:this.that.__zoom,dispatch:U}),O)}};function R(B,...O){if(!f.apply(this,arguments))return;var V=y(this,O).event(B),z=this.__zoom,u=Math.max(q[0],Math.min(q[1],z.k*Math.pow(2,J.apply(this,arguments)))),E=q0(B);if(V.wheel){if(V.mouse[0][0]!==E[0]||V.mouse[0][1]!==E[1])V.mouse[1]=z.invert(V.mouse[0]=E);clearTimeout(V.wheel)}else if(z.k===u)return;else V.mouse=[E,z.invert(E)],D0(this),V.start();m0(B),V.wheel=setTimeout(x,Y),V.zoom("mouse",Q(H(C(z,u),V.mouse[0],V.mouse[1]),V.extent,F));function x(){V.wheel=null,V.end()}}function I(B,...O){if(j||!f.apply(this,arguments))return;var V=B.currentTarget,z=y(this,O,!0).event(B),u=f0(B.view).on("mousemove.zoom",P,!0).on("mouseup.zoom",l,!0),E=q0(B,V),x=B.clientX,h=B.clientY;n0(B.view),A_(B),z.mouse=[E,this.__zoom.invert(E)],D0(this),z.start();function P(r){if(m0(r),!z.moved){var t=r.clientX-x,e=r.clientY-h;z.moved=t*t+e*e>w}z.event(r).zoom("mouse",Q(H(z.that.__zoom,z.mouse[0]=q0(r,V),z.mouse[1]),z.extent,F))}function l(r){u.on("mousemove.zoom mouseup.zoom",null),Mf(r.view,z.moved),m0(r),z.event(r).end()}}function N(B,...O){if(!f.apply(this,arguments))return;var V=this.__zoom,z=q0(B.changedTouches?B.changedTouches[0]:B,this),u=V.invert(z),E=V.k*(B.shiftKey?0.5:2),x=Q(H(C(V,E),z,u),_.apply(this,O),F);if(m0(B),K>0)f0(this).transition().duration(K).call(S,x,z,B);else f0(this).call(Z.transform,x,z,B)}function T(B,...O){if(!f.apply(this,arguments))return;var V=B.touches,z=V.length,u=y(this,O,B.changedTouches.length===z).event(B),E,x,h,P;A_(B);for(x=0;x<z;++x)if(h=V[x],P=q0(h,this),P=[P,this.__zoom.invert(P),h.identifier],!u.touch0)u.touch0=P,E=!0,u.taps=1+!!W;else if(!u.touch1&&u.touch0[2]!==P[2])u.touch1=P,u.taps=0;if(W)W=clearTimeout(W);if(E){if(u.taps<2)G=P[0],W=setTimeout(function(){W=null},M);D0(this),u.start()}}function b(B,...O){if(!this.__zooming)return;var V=y(this,O).event(B),z=B.changedTouches,u=z.length,E,x,h,P;m0(B);for(E=0;E<u;++E)if(x=z[E],h=q0(x,this),V.touch0&&V.touch0[2]===x.identifier)V.touch0[0]=h;else if(V.touch1&&V.touch1[2]===x.identifier)V.touch1[0]=h;if(x=V.that.__zoom,V.touch1){var l=V.touch0[0],r=V.touch0[1],t=V.touch1[0],e=V.touch1[1],a=(a=t[0]-l[0])*a+(a=t[1]-l[1])*a,o=(o=e[0]-r[0])*o+(o=e[1]-r[1])*o;x=C(x,Math.sqrt(a/o)),h=[(l[0]+t[0])/2,(l[1]+t[1])/2],P=[(r[0]+e[0])/2,(r[1]+e[1])/2]}else if(V.touch0)h=V.touch0[0],P=V.touch0[1];else return;V.zoom("touch",Q(H(x,h,P),V.extent,F))}function k(B,...O){if(!this.__zooming)return;var V=y(this,O).event(B),z=B.changedTouches,u=z.length,E,x;if(A_(B),j)clearTimeout(j);j=setTimeout(function(){j=null},M);for(E=0;E<u;++E)if(x=z[E],V.touch0&&V.touch0[2]===x.identifier)delete V.touch0;else if(V.touch1&&V.touch1[2]===x.identifier)delete V.touch1;if(V.touch1&&!V.touch0)V.touch0=V.touch1,delete V.touch1;if(V.touch0)V.touch0[1]=this.__zoom.invert(V.touch0[0]);else if(V.end(),V.taps===2){if(x=q0(x,this),Math.hypot(G[0]-x[0],G[1]-x[1])<L){var h=f0(this).on("dblclick.zoom");if(h)h.apply(this,arguments)}}}return Z.wheelDelta=function(B){return arguments.length?(J=typeof B==="function"?B:Nf(+B),Z):J},Z.filter=function(B){return arguments.length?(f=typeof B==="function"?B:Nf(!!B),Z):f},Z.touchable=function(B){return arguments.length?($=typeof B==="function"?B:Nf(!!B),Z):$},Z.extent=function(B){return arguments.length?(_=typeof B==="function"?B:Nf([[+B[0][0],+B[0][1]],[+B[1][0],+B[1][1]]]),Z):_},Z.scaleExtent=function(B){return arguments.length?(q[0]=+B[0],q[1]=+B[1],Z):[q[0],q[1]]},Z.translateExtent=function(B){return arguments.length?(F[0][0]=+B[0][0],F[1][0]=+B[1][0],F[0][1]=+B[0][1],F[1][1]=+B[1][1],Z):[[F[0][0],F[0][1]],[F[1][0],F[1][1]]]},Z.constrain=function(B){return arguments.length?(Q=B,Z):Q},Z.duration=function(B){return arguments.length?(K=+B,Z):K},Z.interpolate=function(B){return arguments.length?(A=B,Z):A},Z.on=function(){var B=U.on.apply(U,arguments);return B===U?Z:B},Z.clickDistance=function(B){return arguments.length?(w=(B=+B)*B,Z):Math.sqrt(w)},Z.tapDistance=function(B){return arguments.length?(L=+B,Z):L},Z}var j_={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:(f)=>`Node type "${f}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:(f)=>`The old edge with id=${f} does not exist.`,error009:(f)=>`Marker type "${f}" doesn't exist.`,error008:(f,{id:_,sourceHandle:Q,targetHandle:J})=>`Couldn't create edge for ${f} handle id: "${f==="source"?Q:J}", edge id: ${_}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:(f)=>`Edge type "${f}" not found. Using fallback type "default".`,error012:(f)=>`Node with id "${f}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(f="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${f}/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."},W7=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var p0;(function(f){f.Strict="strict",f.Loose="loose"})(p0||(p0={}));var g0;(function(f){f.Free="free",f.Vertical="vertical",f.Horizontal="horizontal"})(g0||(g0={}));var a9;(function(f){f.Partial="partial",f.Full="full"})(a9||(a9={}));var d9;(function(f){f.Bezier="default",f.Straight="straight",f.Step="step",f.SmoothStep="smoothstep",f.SimpleBezier="simplebezier"})(d9||(d9={}));var cQ;(function(f){f.Arrow="arrow",f.ArrowClosed="arrowclosed"})(cQ||(cQ={}));var v;(function(f){f.Left="left",f.Top="top",f.Right="right",f.Bottom="bottom"})(v||(v={}));var S1={[v.Left]:v.Right,[v.Right]:v.Left,[v.Top]:v.Bottom,[v.Bottom]:v.Top};var G7=(f)=>("id"in f)&&("source"in f)&&("target"in f);var iQ=(f)=>("id"in f)&&("internals"in f)&&!("source"in f)&&!("target"in f),B7=(f,_,Q)=>{if(!f.id)return[];let J=new Set;return Q.forEach(($)=>{if($.source===f.id)J.add($.target)}),_.filter(($)=>J.has($.id))},j7=(f,_,Q)=>{if(!f.id)return[];let J=new Set;return Q.forEach(($)=>{if($.target===f.id)J.add($.source)}),_.filter(($)=>J.has($.id))},bf=(f,_=[0,0])=>{let{width:Q,height:J}=c0(f),$=f.origin??_,q=Q*$[0],F=J*$[1];return{x:f.position.x-q,y:f.position.y-F}},M7=(f,_={nodeOrigin:[0,0]})=>{if(!_.nodeLookup)console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows.");if(f.length===0)return{x:0,y:0,width:0,height:0};let Q=f.reduce((J,$)=>{let q=typeof $==="string",F=!_.nodeLookup&&!q?$:void 0;if(_.nodeLookup)F=q?_.nodeLookup.get($):!iQ($)?_.nodeLookup.get($.id):$;let K=F?B6(F,_.nodeOrigin):{x:0,y:0,x2:0,y2:0};return sQ(J,K)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return aQ(Q)},Z7=(f,_={})=>{let Q={x:1/0,y:1/0,x2:-1/0,y2:-1/0},J=!1;return f.forEach(($)=>{if(_.filter===void 0||_.filter($))Q=sQ(Q,B6($)),J=!0}),J?aQ(Q):{x:0,y:0,width:0,height:0}},V7=(f,_,[Q,J,$]=[0,0,1],q=!1,F=!1)=>{let K={...Ff(_,[Q,J,$]),width:_.width/$,height:_.height/$},A=[];for(let U of f.values()){let{measured:W,selectable:G=!0,hidden:j=!1}=U;if(F&&!G||j)continue;let M=W.width??U.width??U.initialWidth??null,Y=W.height??U.height??U.initialHeight??null,w=w7(K,dQ(U)),L=(M??0)*(Y??0),Z=q&&w>0;if(!U.internals.handleBounds||Z||w>=L||U.dragging)A.push(U)}return A},Y7=(f,_)=>{let Q=new Set;return f.forEach((J)=>{Q.add(J.id)}),_.filter((J)=>Q.has(J.source)||Q.has(J.target))};function X7(f,_){let Q=new Map,J=_?.nodes?new Set(_.nodes.map(($)=>$.id)):null;return f.forEach(($)=>{if($.measured.width&&$.measured.height&&(_?.includeHiddenNodes||!$.hidden)&&(!J||J.has($.id)))Q.set($.id,$)}),Q}async function W6({nodes:f,width:_,height:Q,panZoom:J,minZoom:$,maxZoom:q},F){if(f.size===0)return Promise.resolve(!0);let K=X7(f,F),A=Z7(K),U=R7(A,_,Q,F?.minZoom??$,F?.maxZoom??q,F?.padding??0.1);return await J.setViewport(U,{duration:F?.duration,ease:F?.ease,interpolate:F?.interpolate}),Promise.resolve(!0)}var M_=(f,_=0,Q=1)=>Math.min(Math.max(f,_),Q),qf=(f={x:0,y:0},_,Q)=>({x:M_(f.x,_[0][0],_[1][0]-(Q?.width??0)),y:M_(f.y,_[0][1],_[1][1]-(Q?.height??0))});function G6(f,_,Q){let{width:J,height:$}=c0(Q),{x:q,y:F}=Q.internals.positionAbsolute;return qf(f,[[q,F],[q+J,F+$]],_)}var sQ=(f,_)=>({x:Math.min(f.x,_.x),y:Math.min(f.y,_.y),x2:Math.max(f.x2,_.x2),y2:Math.max(f.y2,_.y2)}),t9=({x:f,y:_,width:Q,height:J})=>({x:f,y:_,x2:f+Q,y2:_+J}),aQ=({x:f,y:_,x2:Q,y2:J})=>({x:f,y:_,width:Q-f,height:J-_}),dQ=(f,_=[0,0])=>{let{x:Q,y:J}=iQ(f)?f.internals.positionAbsolute:bf(f,_);return{x:Q,y:J,width:f.measured?.width??f.width??f.initialWidth??0,height:f.measured?.height??f.height??f.initialHeight??0}},B6=(f,_=[0,0])=>{let{x:Q,y:J}=iQ(f)?f.internals.positionAbsolute:bf(f,_);return{x:Q,y:J,x2:Q+(f.measured?.width??f.width??f.initialWidth??0),y2:J+(f.measured?.height??f.height??f.initialHeight??0)}},L7=(f,_)=>aQ(sQ(t9(f),t9(_))),w7=(f,_)=>{let Q=Math.max(0,Math.min(f.x+f.width,_.x+_.width)-Math.max(f.x,_.x)),J=Math.max(0,Math.min(f.y+f.height,_.y+_.height)-Math.max(f.y,_.y));return Math.ceil(Q*J)};var lQ=(f)=>!isNaN(f)&&isFinite(f),rQ=(f,_)=>{console.warn(`[React Flow]: ${_} Help: https://reactflow.dev/error#${f}`)},j6=(f,_=[1,1])=>{return{x:_[0]*Math.round(f.x/_[0]),y:_[1]*Math.round(f.y/_[1])}},Ff=({x:f,y:_},[Q,J,$],q=!1,F=[1,1])=>{let K={x:(f-Q)/$,y:(_-J)/$};return q?j6(K,F):K},n9=({x:f,y:_},[Q,J,$])=>{return{x:f*$+Q,y:_*$+J}};function Jf(f,_){if(typeof f==="number")return Math.floor((_-_/(1+f))*0.5);if(typeof f==="string"&&f.endsWith("px")){let Q=parseFloat(f);if(!Number.isNaN(Q))return Math.floor(Q)}if(typeof f==="string"&&f.endsWith("%")){let Q=parseFloat(f);if(!Number.isNaN(Q))return Math.floor(_*Q*0.01)}return console.error(`[React Flow] The padding value "${f}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function T7(f,_,Q){if(typeof f==="string"||typeof f==="number"){let J=Jf(f,Q),$=Jf(f,_);return{top:J,right:$,bottom:J,left:$,x:$*2,y:J*2}}if(typeof f==="object"){let J=Jf(f.top??f.y??0,Q),$=Jf(f.bottom??f.y??0,Q),q=Jf(f.left??f.x??0,_),F=Jf(f.right??f.x??0,_);return{top:J,right:F,bottom:$,left:q,x:q+F,y:J+$}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function O7(f,_,Q,J,$,q){let{x:F,y:K}=n9(f,[_,Q,J]),{x:A,y:U}=n9({x:f.x+f.width,y:f.y+f.height},[_,Q,J]),W=$-A,G=q-U;return{left:Math.floor(F),top:Math.floor(K),right:Math.floor(W),bottom:Math.floor(G)}}var R7=(f,_,Q,J,$,q)=>{let F=T7(q,_,Q),K=(_-F.x)/f.width,A=(Q-F.y)/f.height,U=Math.min(K,A),W=M_(U,J,$),G=f.x+f.width/2,j=f.y+f.height/2,M=_/2-G*W,Y=Q/2-j*W,w=O7(f,M,Y,W,_,Q),L={left:Math.min(w.left-F.left,0),top:Math.min(w.top-F.top,0),right:Math.min(w.right-F.right,0),bottom:Math.min(w.bottom-F.bottom,0)};return{x:M-L.left+L.right,y:Y-L.top+L.bottom,zoom:W}},M6=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Z_(f){return f!==void 0&&f!==null&&f!=="parent"}function c0(f){return{width:f.measured?.width??f.width??f.initialWidth??0,height:f.measured?.height??f.height??f.initialHeight??0}}function o9(f,{snapGrid:_=[0,0],snapToGrid:Q=!1,transform:J,containerBounds:$}){let{x:q,y:F}=H7(f),K=Ff({x:q-($?.left??0),y:F-($?.top??0)},J),{x:A,y:U}=Q?j6(K,_):K;return{xSnapped:A,ySnapped:U,...K}}var Z6=(f)=>({width:f.offsetWidth,height:f.offsetHeight});var z7=(f)=>("clientX"in f),H7=(f,_)=>{let Q=z7(f),J=Q?f.clientX:f.touches?.[0].clientX,$=Q?f.clientY:f.touches?.[0].clientY;return{x:J-(_?.left??0),y:$-(_?.top??0)}},e9=(f,_,Q,J,$)=>{let q=_.querySelectorAll(`.${f}`);if(!q||!q.length)return null;return Array.from(q).map((F)=>{let K=F.getBoundingClientRect();return{id:F.getAttribute("data-handleid"),type:f,nodeId:$,position:F.getAttribute("data-handlepos"),x:(K.left-Q.left)/J,y:(K.top-Q.top)/J,...Z6(F)}})};function D7({sourceX:f,sourceY:_,targetX:Q,targetY:J,sourceControlX:$,sourceControlY:q,targetControlX:F,targetControlY:K}){let A=f*0.125+$*0.375+F*0.375+Q*0.125,U=_*0.125+q*0.375+K*0.375+J*0.125,W=Math.abs(A-f),G=Math.abs(U-_);return[A,U,W,G]}function G_(f,_){if(f>=0)return 0.5*f;return _*25*Math.sqrt(-f)}function f6({pos:f,x1:_,y1:Q,x2:J,y2:$,c:q}){switch(f){case v.Left:return[_-G_(_-J,q),Q];case v.Right:return[_+G_(J-_,q),Q];case v.Top:return[_,Q-G_(Q-$,q)];case v.Bottom:return[_,Q+G_($-Q,q)]}}function tQ({sourceX:f,sourceY:_,sourcePosition:Q=v.Bottom,targetX:J,targetY:$,targetPosition:q=v.Top,curvature:F=0.25}){let[K,A]=f6({pos:Q,x1:f,y1:_,x2:J,y2:$,c:F}),[U,W]=f6({pos:q,x1:J,y1:$,x2:f,y2:_,c:F}),[G,j,M,Y]=D7({sourceX:f,sourceY:_,targetX:J,targetY:$,sourceControlX:K,sourceControlY:A,targetControlX:U,targetControlY:W});return[`M${f},${_} C${K},${A} ${U},${W} ${J},${$}`,G,j,M,Y]}function V6({sourceX:f,sourceY:_,targetX:Q,targetY:J}){let $=Math.abs(Q-f)/2,q=Q<f?Q+$:Q-$,F=Math.abs(J-_)/2,K=J<_?J+F:J-F;return[q,K,$,F]}var Y6=({source:f,sourceHandle:_,target:Q,targetHandle:J})=>`xy-edge__${f}${_||""}-${Q}${J||""}`,C7=(f,_)=>{return _.some((Q)=>Q.source===f.source&&Q.target===f.target&&(Q.sourceHandle===f.sourceHandle||!Q.sourceHandle&&!f.sourceHandle)&&(Q.targetHandle===f.targetHandle||!Q.targetHandle&&!f.targetHandle))},X6=(f,_,Q={})=>{if(!f.source||!f.target)return rQ("006",j_.error006()),_;let J=Q.getEdgeId||Y6,$;if(G7(f))$={...f};else $={...f,id:J(f)};if(C7($,_))return _;if($.sourceHandle===null)delete $.sourceHandle;if($.targetHandle===null)delete $.targetHandle;return _.concat($)},V_=(f,_,Q,J={shouldReplaceId:!0})=>{let{id:$,...q}=f;if(!_.source||!_.target)return rQ("006",j_.error006()),Q;if(!Q.find((U)=>U.id===f.id))return rQ("007",j_.error007($)),Q;let K=J.getEdgeId||Y6,A={...q,id:J.shouldReplaceId?K(_):$,source:_.source,target:_.target,sourceHandle:_.sourceHandle,targetHandle:_.targetHandle};return Q.filter((U)=>U.id!==$).concat(A)};function nQ({sourceX:f,sourceY:_,targetX:Q,targetY:J}){let[$,q,F,K]=V6({sourceX:f,sourceY:_,targetX:Q,targetY:J});return[`M ${f},${_}L ${Q},${J}`,$,q,F,K]}var _6={[v.Left]:{x:-1,y:0},[v.Right]:{x:1,y:0},[v.Top]:{x:0,y:-1},[v.Bottom]:{x:0,y:1}},I7=({source:f,sourcePosition:_=v.Bottom,target:Q})=>{if(_===v.Left||_===v.Right)return f.x<Q.x?{x:1,y:0}:{x:-1,y:0};return f.y<Q.y?{x:0,y:1}:{x:0,y:-1}},Q6=(f,_)=>Math.sqrt(Math.pow(_.x-f.x,2)+Math.pow(_.y-f.y,2));function S7({source:f,sourcePosition:_=v.Bottom,target:Q,targetPosition:J=v.Top,center:$,offset:q,stepPosition:F}){let K=_6[_],A=_6[J],U={x:f.x+K.x*q,y:f.y+K.y*q},W={x:Q.x+A.x*q,y:Q.y+A.y*q},G=I7({source:U,sourcePosition:_,target:W}),j=G.x!==0?"x":"y",M=G[j],Y=[],w,L,Z={x:0,y:0},C={x:0,y:0},[,,H,X]=V6({sourceX:f.x,sourceY:f.y,targetX:Q.x,targetY:Q.y});if(K[j]*A[j]===-1){if(j==="x")w=$.x??U.x+(W.x-U.x)*F,L=$.y??(U.y+W.y)/2;else w=$.x??(U.x+W.x)/2,L=$.y??U.y+(W.y-U.y)*F;let R=[{x:w,y:U.y},{x:w,y:W.y}],I=[{x:U.x,y:L},{x:W.x,y:L}];if(K[j]===M)Y=j==="x"?R:I;else Y=j==="x"?I:R}else{let R=[{x:U.x,y:W.y}],I=[{x:W.x,y:U.y}];if(j==="x")Y=K.x===M?I:R;else Y=K.y===M?R:I;if(_===J){let B=Math.abs(f[j]-Q[j]);if(B<=q){let O=Math.min(q-1,q-B);if(K[j]===M)Z[j]=(U[j]>f[j]?-1:1)*O;else C[j]=(W[j]>Q[j]?-1:1)*O}}if(_!==J){let B=j==="x"?"y":"x",O=K[j]===A[B],V=U[B]>W[B],z=U[B]<W[B];if(K[j]===1&&(!O&&V||O&&z)||K[j]!==1&&(!O&&z||O&&V))Y=j==="x"?R:I}let N={x:U.x+Z.x,y:U.y+Z.y},T={x:W.x+C.x,y:W.y+C.y},b=Math.max(Math.abs(N.x-Y[0].x),Math.abs(T.x-Y[0].x)),k=Math.max(Math.abs(N.y-Y[0].y),Math.abs(T.y-Y[0].y));if(b>=k)w=(N.x+T.x)/2,L=Y[0].y;else w=Y[0].x,L=(N.y+T.y)/2}let S={x:U.x+Z.x,y:U.y+Z.y},y={x:W.x+C.x,y:W.y+C.y};return[[f,...S.x!==Y[0].x||S.y!==Y[0].y?[S]:[],...Y,...y.x!==Y[Y.length-1].x||y.y!==Y[Y.length-1].y?[y]:[],Q],w,L,H,X]}function E7(f,_,Q,J){let $=Math.min(Q6(f,_)/2,Q6(_,Q)/2,J),{x:q,y:F}=_;if(f.x===q&&q===Q.x||f.y===F&&F===Q.y)return`L${q} ${F}`;if(f.y===F){let U=f.x<Q.x?-1:1,W=f.y<Q.y?1:-1;return`L ${q+$*U},${F}Q ${q},${F} ${q},${F+$*W}`}let K=f.x<Q.x?1:-1,A=f.y<Q.y?-1:1;return`L ${q},${F+$*A}Q ${q},${F} ${q+$*K},${F}`}function Kf({sourceX:f,sourceY:_,sourcePosition:Q=v.Bottom,targetX:J,targetY:$,targetPosition:q=v.Top,borderRadius:F=5,centerX:K,centerY:A,offset:U=20,stepPosition:W=0.5}){let[G,j,M,Y,w]=S7({source:{x:f,y:_},sourcePosition:Q,target:{x:J,y:$},targetPosition:q,center:{x:K,y:A},offset:U,stepPosition:W}),L=`M${G[0].x} ${G[0].y}`;for(let Z=1;Z<G.length-1;Z++)L+=E7(G[Z-1],G[Z],G[Z+1],F);return L+=`L${G[G.length-1].x} ${G[G.length-1].y}`,[L,j,M,Y,w]}function J6(f){return f&&!!(f.internals.handleBounds||f.handles?.length)&&!!(f.measured.width||f.width||f.initialWidth)}function L6(f){let{sourceNode:_,targetNode:Q}=f;if(!J6(_)||!J6(Q))return null;let J=_.internals.handleBounds||$6(_.handles),$=Q.internals.handleBounds||$6(Q.handles),q=F6(J?.source??[],f.sourceHandle),F=F6(f.connectionMode===p0.Strict?$?.target??[]:($?.target??[]).concat($?.source??[]),f.targetHandle);if(!q||!F)return f.onError?.("008",j_.error008(!q?"source":"target",{id:f.id,sourceHandle:f.sourceHandle,targetHandle:f.targetHandle})),null;let K=q?.position||v.Bottom,A=F?.position||v.Top,U=q6(_,q,K),W=q6(Q,F,A);return{sourceX:U.x,sourceY:U.y,targetX:W.x,targetY:W.y,sourcePosition:K,targetPosition:A}}function $6(f){if(!f)return null;let _=[],Q=[];for(let J of f)if(J.width=J.width??1,J.height=J.height??1,J.type==="source")_.push(J);else if(J.type==="target")Q.push(J);return{source:_,target:Q}}function q6(f,_,Q=v.Left,J=!1){let $=(_?.x??0)+f.internals.positionAbsolute.x,q=(_?.y??0)+f.internals.positionAbsolute.y,{width:F,height:K}=_??c0(f);if(J)return{x:$+F/2,y:q+K/2};switch(_?.position??Q){case v.Top:return{x:$+F/2,y:q};case v.Right:return{x:$+F,y:q+K/2};case v.Bottom:return{x:$+F/2,y:q+K};case v.Left:return{x:$,y:q+K/2}}}function F6(f,_){if(!f)return null;return(!_?f[0]:f.find((Q)=>Q.id===_))||null}var y7={left:0,center:50,right:100},N7={top:0,center:50,bottom:100};function u7(f,_,Q,J="center",$="center"){return`translate(${f}px, ${_}px) scale(${1/Q}) translate(${-(y7[J]??50)}%, ${-(N7[$]??50)}%)`}var w6=1000,b7=10,oQ={nodeOrigin:[0,0],nodeExtent:W7,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},x7={...oQ,checkEquality:!0};function eQ(f,_){let Q={...f};for(let J in _)if(_[J]!==void 0)Q[J]=_[J];return Q}function T6(f,_,Q){let J=eQ(oQ,Q);for(let $ of f.values())if($.parentId)_9($,f,_,J);else{let q=bf($,J.nodeOrigin),F=Z_($.extent)?$.extent:J.nodeExtent,K=qf(q,F,c0($));$.internals.positionAbsolute=K}}function k7(f,_){if(!f.handles)return!f.measured?void 0:_?.internals.handleBounds;let Q=[],J=[];for(let $ of f.handles){let q={id:$.id,width:$.width??1,height:$.height??1,nodeId:f.id,x:$.x,y:$.y,position:$.position,type:$.type};if($.type==="source")Q.push(q);else if($.type==="target")J.push(q)}return{source:Q,target:J}}function f9(f){return f==="manual"}function O6(f,_,Q,J={}){let $=eQ(x7,J),q={i:0},F=new Map(_),K=$?.elevateNodesOnSelect&&!f9($.zIndexMode)?w6:0,A=f.length>0,U=!1;_.clear(),Q.clear();for(let W of f){let G=F.get(W.id);if($.checkEquality&&W===G?.internals.userNode)_.set(W.id,G);else{let j=bf(W,$.nodeOrigin),M=Z_(W.extent)?W.extent:$.nodeExtent,Y=qf(j,M,c0(W));G={...$.defaults,...W,measured:{width:W.measured?.width,height:W.measured?.height},internals:{positionAbsolute:Y,handleBounds:k7(W,G),z:R6(W,K,$.zIndexMode),userNode:W}},_.set(W.id,G)}if((G.measured===void 0||G.measured.width===void 0||G.measured.height===void 0)&&!G.hidden)A=!1;if(W.parentId)_9(G,_,Q,J,q);U||=W.selected??!1}return{nodesInitialized:A,hasSelectedNodes:U}}function P7(f,_){if(!f.parentId)return;let Q=_.get(f.parentId);if(Q)Q.set(f.id,f);else _.set(f.parentId,new Map([[f.id,f]]))}function _9(f,_,Q,J,$){let{elevateNodesOnSelect:q,nodeOrigin:F,nodeExtent:K,zIndexMode:A}=eQ(oQ,J),U=f.parentId,W=_.get(U);if(!W){console.warn(`Parent node ${U} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}if(P7(f,Q),$&&!W.parentId&&W.internals.rootParentIndex===void 0&&A==="auto")W.internals.rootParentIndex=++$.i,W.internals.z=W.internals.z+$.i*b7;if($&&W.internals.rootParentIndex!==void 0)$.i=W.internals.rootParentIndex;let G=q&&!f9(A)?w6:0,{x:j,y:M,z:Y}=h7(f,W,F,K,G,A),{positionAbsolute:w}=f.internals,L=j!==w.x||M!==w.y;if(L||Y!==f.internals.z)_.set(f.id,{...f,internals:{...f.internals,positionAbsolute:L?{x:j,y:M}:w,z:Y}})}function R6(f,_,Q){let J=lQ(f.zIndex)?f.zIndex:0;if(f9(Q))return J;return J+(f.selected?_:0)}function h7(f,_,Q,J,$,q){let{x:F,y:K}=_.internals.positionAbsolute,A=c0(f),U=bf(f,Q),W=Z_(f.extent)?qf(U,f.extent,A):U,G=qf({x:F+W.x,y:K+W.y},J,A);if(f.extent==="parent")G=G6(G,A,_);let j=R6(f,$,q),M=_.internals.z??0;return{x:G.x,y:G.y,z:M>=j?M+1:j}}function v7(f,_,Q,J=[0,0]){let $=[],q=new Map;for(let F of f){let K=_.get(F.parentId);if(!K)continue;let A=q.get(F.parentId)?.expandedRect??dQ(K),U=L7(A,F.rect);q.set(F.parentId,{expandedRect:U,parent:K})}if(q.size>0)q.forEach(({expandedRect:F,parent:K},A)=>{let U=K.internals.positionAbsolute,W=c0(K),G=K.origin??J,j=F.x<U.x?Math.round(Math.abs(U.x-F.x)):0,M=F.y<U.y?Math.round(Math.abs(U.y-F.y)):0,Y=Math.max(W.width,Math.round(F.width)),w=Math.max(W.height,Math.round(F.height)),L=(Y-W.width)*G[0],Z=(w-W.height)*G[1];if(j>0||M>0||L||Z)$.push({id:A,type:"position",position:{x:K.position.x-j+L,y:K.position.y-M+Z}}),Q.get(A)?.forEach((C)=>{if(!f.some((H)=>H.id===C.id))$.push({id:C.id,type:"position",position:{x:C.position.x+j,y:C.position.y+M}})});if(W.width<F.width||W.height<F.height||j||M)$.push({id:A,type:"dimensions",setAttributes:!0,dimensions:{width:Y+(j?G[0]*j-L:0),height:w+(M?G[1]*M-Z:0)}})});return $}function z6(f,_,Q,J,$,q,F){let K=J?.querySelector(".xyflow__viewport"),A=!1;if(!K)return{changes:[],updatedInternals:A};let U=[],W=window.getComputedStyle(K),{m22:G}=new window.DOMMatrixReadOnly(W.transform),j=[];for(let M of f.values()){let Y=_.get(M.id);if(!Y)continue;if(Y.hidden){_.set(Y.id,{...Y,internals:{...Y.internals,handleBounds:void 0}}),A=!0;continue}let w=Z6(M.nodeElement),L=Y.measured.width!==w.width||Y.measured.height!==w.height;if(!!(w.width&&w.height&&(L||!Y.internals.handleBounds||M.force))){let C=M.nodeElement.getBoundingClientRect(),H=Z_(Y.extent)?Y.extent:q,{positionAbsolute:X}=Y.internals;if(Y.parentId&&Y.extent==="parent")X=G6(X,w,_.get(Y.parentId));else if(H)X=qf(X,H,w);let S={...Y,measured:w,internals:{...Y.internals,positionAbsolute:X,handleBounds:{source:e9("source",M.nodeElement,C,G,Y.id),target:e9("target",M.nodeElement,C,G,Y.id)}}};if(_.set(Y.id,S),Y.parentId)_9(S,_,Q,{nodeOrigin:$,zIndexMode:F});if(A=!0,L){if(U.push({id:Y.id,type:"dimensions",dimensions:w}),Y.expandParent&&Y.parentId)j.push({id:Y.id,parentId:Y.parentId,rect:dQ(S,$)})}}}if(j.length>0){let M=v7(j,_,Q,$);U.push(...M)}return{changes:U,updatedInternals:A}}async function H6({delta:f,panZoom:_,transform:Q,translateExtent:J,width:$,height:q}){if(!_||!f.x&&!f.y)return Promise.resolve(!1);let F=await _.setViewportConstrained({x:Q[0]+f.x,y:Q[1]+f.y,zoom:Q[2]},[[0,0],[$,q]],J),K=!!F&&(F.x!==Q[0]||F.y!==Q[1]||F.k!==Q[2]);return Promise.resolve(K)}function K6(f,_,Q,J,$,q){let F=$,K=J.get(F)||new Map;J.set(F,K.set(Q,_)),F=`${$}-${f}`;let A=J.get(F)||new Map;if(J.set(F,A.set(Q,_)),q){F=`${$}-${f}-${q}`;let U=J.get(F)||new Map;J.set(F,U.set(Q,_))}}function D6(f,_,Q){f.clear(),_.clear();for(let J of Q){let{source:$,target:q,sourceHandle:F=null,targetHandle:K=null}=J,A={edgeId:J.id,source:$,target:q,sourceHandle:F,targetHandle:K},U=`${$}-${F}--${q}-${K}`,W=`${q}-${K}--${$}-${F}`;K6("source",A,W,f,$,F),K6("target",A,U,f,q,K),_.set(J.id,J)}}var Y_=(f)=>({x:f.x,y:f.y,zoom:f.k}),gQ=({x:f,y:_,zoom:Q})=>v0.translate(f,_).scale(Q),$f=(f,_)=>f.target.closest(`.${_}`),C6=(f,_)=>_===2&&Array.isArray(f)&&f.includes(2),m7=(f)=>((f*=2)<=1?f*f*f:(f-=2)*f*f+2)/2,pQ=(f,_=0,Q=m7,J=()=>{})=>{let $=typeof _==="number"&&_>0;if(!$)J();return $?f.transition().duration(_).ease(Q).on("end",J):f},I6=(f)=>{let _=f.ctrlKey&&M6()?10:1;return-f.deltaY*(f.deltaMode===1?0.05:f.deltaMode?1:0.002)*_};function g7({zoomPanValues:f,noWheelClassName:_,d3Selection:Q,d3Zoom:J,panOnScrollMode:$,panOnScrollSpeed:q,zoomOnPinch:F,onPanZoomStart:K,onPanZoom:A,onPanZoomEnd:U}){return(W)=>{if($f(W,_)){if(W.ctrlKey)W.preventDefault();return!1}W.preventDefault(),W.stopImmediatePropagation();let G=Q.property("__zoom").k||1;if(W.ctrlKey&&F){let L=q0(W),Z=I6(W),C=G*Math.pow(2,Z);J.scaleTo(Q,C,L,W);return}let j=W.deltaMode===1?20:1,M=$===g0.Vertical?0:W.deltaX*j,Y=$===g0.Horizontal?0:W.deltaY*j;if(!M6()&&W.shiftKey&&$!==g0.Vertical)M=W.deltaY*j,Y=0;J.translateBy(Q,-(M/G)*q,-(Y/G)*q,{internal:!0});let w=Y_(Q.property("__zoom"));if(clearTimeout(f.panScrollTimeout),!f.isPanScrolling)f.isPanScrolling=!0,K?.(W,w);else A?.(W,w),f.panScrollTimeout=setTimeout(()=>{U?.(W,w),f.isPanScrolling=!1},150)}}function p7({noWheelClassName:f,preventScrolling:_,d3ZoomHandler:Q}){return function(J,$){let q=J.type==="wheel",F=!_&&q&&!J.ctrlKey,K=$f(J,f);if(J.ctrlKey&&q&&K)J.preventDefault();if(F||K)return null;J.preventDefault(),Q.call(this,J,$)}}function c7({zoomPanValues:f,onDraggingChange:_,onPanZoomStart:Q}){return(J)=>{if(J.sourceEvent?.internal)return;let $=Y_(J.transform);if(f.mouseButton=J.sourceEvent?.button||0,f.isZoomingOrPanning=!0,f.prevViewport=$,J.sourceEvent?.type==="mousedown")_(!0);if(Q)Q?.(J.sourceEvent,$)}}function l7({zoomPanValues:f,panOnDrag:_,onPaneContextMenu:Q,onTransformChange:J,onPanZoom:$}){return(q)=>{if(f.usedRightMouseButton=!!(Q&&C6(_,f.mouseButton??0)),!q.sourceEvent?.sync)J([q.transform.x,q.transform.y,q.transform.k]);if($&&!q.sourceEvent?.internal)$?.(q.sourceEvent,Y_(q.transform))}}function r7({zoomPanValues:f,panOnDrag:_,panOnScroll:Q,onDraggingChange:J,onPanZoomEnd:$,onPaneContextMenu:q}){return(F)=>{if(F.sourceEvent?.internal)return;if(f.isZoomingOrPanning=!1,q&&C6(_,f.mouseButton??0)&&!f.usedRightMouseButton&&F.sourceEvent)q(F.sourceEvent);if(f.usedRightMouseButton=!1,J(!1),$){let K=Y_(F.transform);f.prevViewport=K,clearTimeout(f.timerId),f.timerId=setTimeout(()=>{$?.(F.sourceEvent,K)},Q?150:0)}}}function i7({zoomActivationKeyPressed:f,zoomOnScroll:_,zoomOnPinch:Q,panOnDrag:J,panOnScroll:$,zoomOnDoubleClick:q,userSelectionActive:F,noWheelClassName:K,noPanClassName:A,lib:U,connectionInProgress:W}){return(G)=>{let j=f||_,M=Q&&G.ctrlKey,Y=G.type==="wheel";if(G.button===1&&G.type==="mousedown"&&($f(G,`${U}-flow__node`)||$f(G,`${U}-flow__edge`)))return!0;if(!J&&!j&&!$&&!q&&!Q)return!1;if(F)return!1;if(W&&!Y)return!1;if($f(G,K)&&Y)return!1;if($f(G,A)&&(!Y||$&&Y&&!f))return!1;if(!Q&&G.ctrlKey&&Y)return!1;if(!Q&&G.type==="touchstart"&&G.touches?.length>1)return G.preventDefault(),!1;if(!j&&!$&&!M&&Y)return!1;if(!J&&(G.type==="mousedown"||G.type==="touchstart"))return!1;if(Array.isArray(J)&&!J.includes(G.button)&&G.type==="mousedown")return!1;let w=Array.isArray(J)&&J.includes(G.button)||!G.button||G.button<=1;return(!G.ctrlKey||Y)&&w}}function S6({domNode:f,minZoom:_,maxZoom:Q,translateExtent:J,viewport:$,onPanZoom:q,onPanZoomStart:F,onPanZoomEnd:K,onDraggingChange:A}){let U={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},W=f.getBoundingClientRect(),G=W_().scaleExtent([_,Q]).translateExtent(J),j=f0(f).call(G);C({x:$.x,y:$.y,zoom:M_($.zoom,_,Q)},[[0,0],[W.width,W.height]],J);let M=j.on("wheel.zoom"),Y=j.on("dblclick.zoom");G.wheelDelta(I6);function w(T,b){if(j)return new Promise((k)=>{G?.interpolate(b?.interpolate==="linear"?V0:P0).transform(pQ(j,b?.duration,b?.ease,()=>k(!0)),T)});return Promise.resolve(!1)}function L({noWheelClassName:T,noPanClassName:b,onPaneContextMenu:k,userSelectionActive:B,panOnScroll:O,panOnDrag:V,panOnScrollMode:z,panOnScrollSpeed:u,preventScrolling:E,zoomOnPinch:x,zoomOnScroll:h,zoomOnDoubleClick:P,zoomActivationKeyPressed:l,lib:r,onTransformChange:t,connectionInProgress:e,paneClickDistance:a,selectionOnDrag:o}){if(B&&!U.isZoomingOrPanning)Z();let A0=O&&!l&&!B;G.clickDistance(o?1/0:!lQ(a)||a<0?0:a);let O0=A0?g7({zoomPanValues:U,noWheelClassName:T,d3Selection:j,d3Zoom:G,panOnScrollMode:z,panOnScrollSpeed:u,zoomOnPinch:x,onPanZoomStart:F,onPanZoom:q,onPanZoomEnd:K}):p7({noWheelClassName:T,preventScrolling:E,d3ZoomHandler:M});if(j.on("wheel.zoom",O0,{passive:!1}),!B){let i0=c7({zoomPanValues:U,onDraggingChange:A,onPanZoomStart:F});G.on("start",i0);let s0=l7({zoomPanValues:U,panOnDrag:V,onPaneContextMenu:!!k,onPanZoom:q,onTransformChange:t});G.on("zoom",s0);let Af=r7({zoomPanValues:U,panOnDrag:V,panOnScroll:O,onPaneContextMenu:k,onPanZoomEnd:K,onDraggingChange:A});G.on("end",Af)}let S0=i7({zoomActivationKeyPressed:l,panOnDrag:V,zoomOnScroll:h,panOnScroll:O,zoomOnDoubleClick:P,zoomOnPinch:x,userSelectionActive:B,noPanClassName:b,noWheelClassName:T,lib:r,connectionInProgress:e});if(G.filter(S0),P)j.on("dblclick.zoom",Y);else j.on("dblclick.zoom",null)}function Z(){G.on("zoom",null)}async function C(T,b,k){let B=gQ(T),O=G?.constrain()(B,b,k);if(O)await w(O);return new Promise((V)=>V(O))}async function H(T,b){let k=gQ(T);return await w(k,b),new Promise((B)=>B(k))}function X(T){if(j){let b=gQ(T),k=j.property("__zoom");if(k.k!==T.zoom||k.x!==T.x||k.y!==T.y)G?.transform(j,b,null,{sync:!0})}}function S(){let T=j?uf(j.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}function y(T,b){if(j)return new Promise((k)=>{G?.interpolate(b?.interpolate==="linear"?V0:P0).scaleTo(pQ(j,b?.duration,b?.ease,()=>k(!0)),T)});return Promise.resolve(!1)}function D(T,b){if(j)return new Promise((k)=>{G?.interpolate(b?.interpolate==="linear"?V0:P0).scaleBy(pQ(j,b?.duration,b?.ease,()=>k(!0)),T)});return Promise.resolve(!1)}function R(T){G?.scaleExtent(T)}function I(T){G?.translateExtent(T)}function N(T){let b=!lQ(T)||T<0?0:T;G?.clickDistance(b)}return{update:L,destroy:Z,setViewport:H,setViewportConstrained:C,getViewport:S,scaleTo:y,scaleBy:D,setScaleExtent:R,setTranslateExtent:I,syncViewport:X,setClickDistance:N}}var Y0;(function(f){f.Line="line",f.Handle="handle"})(Y0||(Y0={}));var E6=["top-left","top-right","bottom-left","bottom-right"],y6=["top","right","bottom","left"];function s7({width:f,prevWidth:_,height:Q,prevHeight:J,affectsX:$,affectsY:q}){let F=f-_,K=Q-J,A=[F>0?1:F<0?-1:0,K>0?1:K<0?-1:0];if(F&&$)A[0]=A[0]*-1;if(K&&q)A[1]=A[1]*-1;return A}function U6(f){let _=f.includes("right")||f.includes("left"),Q=f.includes("bottom")||f.includes("top"),J=f.includes("left"),$=f.includes("top");return{isHorizontal:_,isVertical:Q,affectsX:J,affectsY:$}}function C0(f,_){return Math.max(0,_-f)}function I0(f,_){return Math.max(0,f-_)}function B_(f,_,Q){return Math.max(0,_-f,f-Q)}function A6(f,_){return f?!_:_}function a7(f,_,Q,J,$,q,F,K){let{affectsX:A,affectsY:U}=_,{isHorizontal:W,isVertical:G}=_,j=W&&G,{xSnapped:M,ySnapped:Y}=Q,{minWidth:w,maxWidth:L,minHeight:Z,maxHeight:C}=J,{x:H,y:X,width:S,height:y,aspectRatio:D}=f,R=Math.floor(W?M-f.pointerX:0),I=Math.floor(G?Y-f.pointerY:0),N=S+(A?-R:R),T=y+(U?-I:I),b=-q[0]*S,k=-q[1]*y,B=B_(N,w,L),O=B_(T,Z,C);if(F){let u=0,E=0;if(A&&R<0)u=C0(H+R+b,F[0][0]);else if(!A&&R>0)u=I0(H+N+b,F[1][0]);if(U&&I<0)E=C0(X+I+k,F[0][1]);else if(!U&&I>0)E=I0(X+T+k,F[1][1]);B=Math.max(B,u),O=Math.max(O,E)}if(K){let u=0,E=0;if(A&&R>0)u=I0(H+R,K[0][0]);else if(!A&&R<0)u=C0(H+N,K[1][0]);if(U&&I>0)E=I0(X+I,K[0][1]);else if(!U&&I<0)E=C0(X+T,K[1][1]);B=Math.max(B,u),O=Math.max(O,E)}if($){if(W){let u=B_(N/D,Z,C)*D;if(B=Math.max(B,u),F){let E=0;if(!A&&!U||A&&!U&&j)E=I0(X+k+N/D,F[1][1])*D;else E=C0(X+k+(A?R:-R)/D,F[0][1])*D;B=Math.max(B,E)}if(K){let E=0;if(!A&&!U||A&&!U&&j)E=C0(X+N/D,K[1][1])*D;else E=I0(X+(A?R:-R)/D,K[0][1])*D;B=Math.max(B,E)}}if(G){let u=B_(T*D,w,L)/D;if(O=Math.max(O,u),F){let E=0;if(!A&&!U||U&&!A&&j)E=I0(H+T*D+b,F[1][0])/D;else E=C0(H+(U?I:-I)*D+b,F[0][0])/D;O=Math.max(O,E)}if(K){let E=0;if(!A&&!U||U&&!A&&j)E=C0(H+T*D,K[1][0])/D;else E=I0(H+(U?I:-I)*D,K[0][0])/D;O=Math.max(O,E)}}}if(I=I+(I<0?O:-O),R=R+(R<0?B:-B),$)if(j)if(N>T*D)I=(A6(A,U)?-R:R)/D;else R=(A6(A,U)?-I:I)*D;else if(W)I=R/D,U=A;else R=I*D,A=U;let V=A?H+R:H,z=U?X+I:X;return{width:S+(A?-R:R),height:y+(U?-I:I),x:q[0]*R*(!A?1:-1)+V,y:q[1]*I*(!U?1:-1)+z}}var N6={width:0,height:0,x:0,y:0},d7={...N6,pointerX:0,pointerY:0,aspectRatio:1};function t7(f){return[[0,0],[f.measured.width,f.measured.height]]}function n7(f,_,Q){let J=_.position.x+f.position.x,$=_.position.y+f.position.y,q=f.measured.width??0,F=f.measured.height??0,K=Q[0]*q,A=Q[1]*F;return[[J-K,$-A],[J+q-K,$+F-A]]}function u6({domNode:f,nodeId:_,getStoreItems:Q,onChange:J,onEnd:$}){let q=f0(f),F={controlDirection:U6("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function K({controlPosition:U,boundaries:W,keepAspectRatio:G,resizeDirection:j,onResizeStart:M,onResize:Y,onResizeEnd:w,shouldResize:L}){let Z={...N6},C={...d7};F={boundaries:W,resizeDirection:j,keepAspectRatio:G,controlDirection:U6(U)};let H=void 0,X=null,S=[],y=void 0,D=void 0,R=void 0,I=!1,N=lf().on("start",(T)=>{let{nodeLookup:b,transform:k,snapGrid:B,snapToGrid:O,nodeOrigin:V,paneDomNode:z}=Q();if(H=b.get(_),!H)return;X=z?.getBoundingClientRect()??null;let{xSnapped:u,ySnapped:E}=o9(T.sourceEvent,{transform:k,snapGrid:B,snapToGrid:O,containerBounds:X});if(Z={width:H.measured.width??0,height:H.measured.height??0,x:H.position.x??0,y:H.position.y??0},C={...Z,pointerX:u,pointerY:E,aspectRatio:Z.width/Z.height},y=void 0,H.parentId&&(H.extent==="parent"||H.expandParent))y=b.get(H.parentId),D=y&&H.extent==="parent"?t7(y):void 0;S=[],R=void 0;for(let[x,h]of b)if(h.parentId===_){if(S.push({id:x,position:{...h.position},extent:h.extent}),h.extent==="parent"||h.expandParent){let P=n7(h,H,h.origin??V);if(R)R=[[Math.min(P[0][0],R[0][0]),Math.min(P[0][1],R[0][1])],[Math.max(P[1][0],R[1][0]),Math.max(P[1][1],R[1][1])]];else R=P}}M?.(T,{...Z})}).on("drag",(T)=>{let{transform:b,snapGrid:k,snapToGrid:B,nodeOrigin:O}=Q(),V=o9(T.sourceEvent,{transform:b,snapGrid:k,snapToGrid:B,containerBounds:X}),z=[];if(!H)return;let{x:u,y:E,width:x,height:h}=Z,P={},l=H.origin??O,{width:r,height:t,x:e,y:a}=a7(C,F.controlDirection,V,F.boundaries,F.keepAspectRatio,l,D,R),o=r!==x,A0=t!==h,O0=e!==u&&o,S0=a!==E&&A0;if(!O0&&!S0&&!o&&!A0)return;if(O0||S0||l[0]===1||l[1]===1){if(P.x=O0?e:Z.x,P.y=S0?a:Z.y,Z.x=P.x,Z.y=P.y,S.length>0){let E0=e-u,y0=a-E;for(let a0 of S)a0.position={x:a0.position.x-E0+l[0]*(r-x),y:a0.position.y-y0+l[1]*(t-h)},z.push(a0)}}if(o||A0)P.width=o&&(!F.resizeDirection||F.resizeDirection==="horizontal")?r:Z.width,P.height=A0&&(!F.resizeDirection||F.resizeDirection==="vertical")?t:Z.height,Z.width=P.width,Z.height=P.height;if(y&&H.expandParent){let E0=l[0]*(P.width??0);if(P.x&&P.x<E0)Z.x=E0,C.x=C.x-(P.x-E0);let y0=l[1]*(P.height??0);if(P.y&&P.y<y0)Z.y=y0,C.y=C.y-(P.y-y0)}let i0=s7({width:Z.width,prevWidth:x,height:Z.height,prevHeight:h,affectsX:F.controlDirection.affectsX,affectsY:F.controlDirection.affectsY}),s0={...Z,direction:i0};if(L?.(T,s0)===!1)return;I=!0,Y?.(T,s0),J(P,z)}).on("end",(T)=>{if(!I)return;w?.(T,{...Z}),$?.({...Z}),I=!1});q.call(N)}function A(){q.on(".drag",null)}return{update:K,destroy:A}}var xf="http://www.w3.org/2000/svg",kf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var f$={x:0,y:0,zoom:1};function _$(f={}){let _=f.minZoom??0.5,Q=f.maxZoom??2,J=f.nodeOrigin??[0,0],$=f.nodeExtent??kf,q=f.snapToGrid??!1,F=f.snapGrid??[15,15],K=f.edgesReconnectable??!1,[A,U]=d(f.nodes??[]),[W,G]=d(f.edges??[]),[j,M]=d(f.defaultViewport??f$),[Y,w]=d(0),[L,Z]=d(0),[C,H]=d(!1),[X,S]=d(null),[y,D]=d(null),[R,I]=d(new Map),[N,T]=d(new Map),[b,k]=d(new Map),[B,O]=d(new Map),V=new Map;function z(m){let g=V.get(m);if(!g){let[c,p]=d(void 0);g={get:c,set:p},V.set(m,g)}return g}function u(m){return z(m).get()}let[E,x]=d(0),h=e7(()=>{let m=A(),g=Q0(R),c=Q0(N);for(let i of m){if(i.measured?.width)continue;let $0=g.get(i.id);if($0?.measured.width)i.measured={width:$0.measured.width,height:$0.measured.height}}let p=O6(m,g,c,{nodeOrigin:J,nodeExtent:$,checkEquality:!1});T6(g,c,{nodeOrigin:J,nodeExtent:$});for(let[i,$0]of g){let R0=z(i);if(Q0(R0.get)?.internals.userNode!==$0.internals.userNode)R0.set($0)}for(let[i,$0]of V)if(!g.has(i)&&Q0($0.get)!==void 0)$0.set(void 0);return I(()=>new Map(g)),T(()=>new Map(c)),p.nodesInitialized});o7(()=>{let m=W(),g=new Map;for(let p of m)g.set(p.id,p);k(()=>g);let c=Q0(B);D6(c,g,m),O(()=>new Map(c))});let[P,l]=d(!1),[r,t]=d(f.nodesDraggable??!0),[e,a]=d(f.nodesConnectable??!0),[o,A0]=d(f.elementsSelectable??!0),[O0,S0]=d(f.panOnDrag??!0),[i0,s0]=d(f.panOnScroll??!1),[Af,E0]=d(f.zoomOnScroll??!0),y0=f.deleteKeyCode!==void 0?f.deleteKeyCode:["Delete","Backspace"],a0=f.selectionKeyCode!==void 0?f.selectionKeyCode:"Shift",P6=f.connectionLineStyle,h6=f.defaultEdgeOptions,v6=f.elevateNodesOnSelect??!1,m6=f.reconnectRadius??20,g6=f.zoomOnDoubleClick??!0;function p6(){let m=Q0(X);if(!m)return;m.update({noWheelClassName:"nowheel",noPanClassName:"nopan",preventScrolling:!0,panOnScroll:i0(),panOnDrag:O0(),panOnScrollMode:"free",panOnScrollSpeed:0.5,userSelectionActive:!1,zoomOnPinch:!0,zoomOnScroll:Af(),zoomOnDoubleClick:g6,zoomActivationKeyPressed:!1,lib:"bf",onTransformChange:(g)=>{M({x:g[0],y:g[1],zoom:g[2]})},connectionInProgress:!1,paneClickDistance:0})}function U9(){let m=Q0(j);return[m.x,m.y,m.zoom]}function A9(){x((m)=>m+1)}function c6(m,g=!0){let c=Q0(R),p=!1;for(let[i,$0]of m){let R0=c.get(i);if(!R0)continue;R0.internals.positionAbsolute=$0.internals?$0.internals.positionAbsolute:{x:$0.position.x,y:$0.position.y},R0.internals.userNode.position=$0.position,R0.internals.userNode.dragging=g;let X_={...R0};c.set(i,X_),z(i).set(X_),p=!0}if(p)I(()=>new Map(c));A9()}function l6(m){let g=Q0(A),c=Q0(W);if(m?.nodes){let p=new Set(m.nodes.map((i)=>i.id));U(g.map((i)=>p.has(i.id)?{...i,selected:!1}:i))}else U(g.map((p)=>p.selected?{...p,selected:!1}:p));if(m?.edges){let p=new Set(m.edges.map((i)=>i.id));G(c.map((i)=>p.has(i.id)?{...i,selected:!1}:i))}else G(c.map((p)=>p.selected?{...p,selected:!1}:p))}async function r6(m){return H6({delta:m,panZoom:Q0(X),transform:U9(),translateExtent:kf,width:Q0(Y),height:Q0(L)})}function i6(m){G((g)=>[...g,m])}function s6(m){if(m.nodes?.length){let g=new Set(m.nodes.map((c)=>c.id));U((c)=>c.filter((p)=>!g.has(p.id))),G((c)=>c.filter((p)=>!g.has(p.source)&&!g.has(p.target)))}if(m.edges?.length){let g=new Set(m.edges.map((c)=>c.id));G((c)=>c.filter((p)=>!g.has(p.id)))}}function a6(m){let g=Q0(X);if(!g)return;let c=Q0(R),p=Q0(Y),i=Q0(L);W6({nodes:c,width:p,height:i,panZoom:g,minZoom:_,maxZoom:Q},{padding:0.1,...m})}return{nodes:A,edges:W,viewport:j,width:Y,height:L,dragging:C,nodesInitialized:h,nodeLookup:R,parentLookup:N,edgeLookup:b,connectionLookup:B,nodeSignal:u,panZoom:X,domNode:y,setNodes:U,setEdges:G,setViewport:M,setWidth:w,setHeight:Z,multiSelectionActive:P,nodesDraggable:r,setNodesDraggable:t,nodesConnectable:e,setNodesConnectable:a,elementsSelectable:o,setElementsSelectable:A0,panOnDrag:O0,setPanOnDrag:S0,panOnScroll:i0,setPanOnScroll:s0,zoomOnScroll:Af,setZoomOnScroll:E0,deleteKeyCode:y0,selectionKeyCode:a0,connectionLineStyle:P6,defaultEdgeOptions:h6,elevateNodesOnSelect:v6,reconnectRadius:m6,positionEpoch:E,triggerPositionUpdate:A9,setDragging:H,setPanZoom:S,setDomNode:D,setMultiSelectionActive:l,updatePanZoomConfig:p6,fitView:a6,updateNodePositions:c6,unselectNodesAndEdges:l6,panByDelta:r6,addEdge:i6,deleteElements:s6,minZoom:_,maxZoom:Q,nodeOrigin:J,nodeExtent:$,snapToGrid:q,snapGrid:F,edgesReconnectable:K,getTransform:U9,nodeTypes:f.nodeTypes,edgeTypes:f.edgeTypes,onConnect:f.onConnect,onConnectStart:f.onConnectStart,onConnectEnd:f.onConnectEnd,isValidConnection:f.isValidConnection,onReconnect:f.onReconnect,onInit:f.onInit,onNodeDragStart:f.onNodeDragStart,onNodeDragStop:f.onNodeDragStop,onMoveEnd:f.onMoveEnd,onPaneClick:f.onPaneClick,onPaneMouseMove:f.onPaneMouseMove,onNodesDelete:f.onNodesDelete,onEdgesDelete:f.onEdgesDelete}}import{createContext as Q$}from"@barefootjs/client";var Q9=Q$();import{useContext as J$}from"@barefootjs/client/runtime";import{createMemo as $$,untrack as q$}from"@barefootjs/client/runtime";function j0(){return J$(Q9)}function b6(){return j0().viewport}function F$(){return j0().nodes}function K$(){return j0().edges}function U$(){return j0().nodesInitialized}function A$(f){let _=j0();return $$(()=>f(_))}function W$(f){let _=j0(),Q=q$(_.domNode);if(!Q)return f;let J=Q.getBoundingClientRect(),$=_.getTransform();return Ff({x:f.x-J.left,y:f.y-J.top},$)}function J9(f,_,Q){let J=!!(f.sourceHandle||f.targetHandle),$=L6({id:f.id,sourceNode:_,sourceHandle:f.sourceHandle??null,targetNode:Q,targetHandle:f.targetHandle??null,connectionMode:J?p0.Strict:p0.Loose});if($)return $;let q=_.measured.width??150,F=_.measured.height??40,K=Q.measured.width??150,A=_.internals.positionAbsolute,U=Q.internals.positionAbsolute;return{sourceX:A.x+q/2,sourceY:A.y+F,targetX:U.x+K/2,targetY:U.y,sourcePosition:v.Bottom,targetPosition:v.Top}}function $9(f,_){let Q={sourceX:_.sourceX,sourceY:_.sourceY,sourcePosition:_.sourcePosition,targetX:_.targetX,targetY:_.targetY,targetPosition:_.targetPosition},J=f.type??"default";switch(J){case"straight":return nQ(Q);case"smoothstep":case"step":return Kf({...Q,borderRadius:J==="step"?0:void 0});case"default":case"bezier":default:return tQ(Q)}}import{createEffect as M$,onCleanup as Pf,untrack as l0}from"@barefootjs/client";import{onCleanup as x6,untrack as Uf}from"@barefootjs/client";function q9(f,_){function Q($){let q=$.target;if(q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable)return;let F=f.deleteKeyCode;if(F&&F.includes($.key)){if(!Uf(f.nodesDraggable))return;let A=Uf(f.nodes).filter((W)=>W.selected),U=Uf(f.edges).filter((W)=>W.selected);if(A.length>0||U.length>0){if(A.length>0&&f.onNodesDelete)f.onNodesDelete(A);if(U.length>0&&f.onEdgesDelete)f.onEdgesDelete(U);f.deleteElements({nodes:A,edges:U}),$.preventDefault()}}if($.key==="Escape")f.unselectNodesAndEdges();let K=f.selectionKeyCode;if(K&&$.key===K)f.setMultiSelectionActive(!0)}function J($){let q=f.selectionKeyCode;if(q&&$.key===q)f.setMultiSelectionActive(!1)}_.setAttribute("tabindex","0"),_.style.outline="none",_.addEventListener("keydown",Q),_.addEventListener("keyup",J),x6(()=>{_.removeEventListener("keydown",Q),_.removeEventListener("keyup",J)})}function G$(f,_,Q){f.addEventListener("mousedown",(J)=>{if(J.button!==0)return;let $=Uf(Q.multiSelectionActive)||J.shiftKey;if(!$)Q.unselectNodesAndEdges();let q=Uf(Q.domNode);if(q)q.focus();Q.setNodes((F)=>F.map((K)=>K.id===_?{...K,selected:$?!K.selected:!0}:K))})}function B$(f,_,[Q,J,$],q){let F={x:(_.x-Q)/$,y:(_.y-J)/$,width:_.width/$,height:_.height/$},K=[];for(let A of f.values()){if(A.hidden)continue;let U=A.measured.width??0,W=A.measured.height??0;if(U===0&&W===0)continue;let G=A.internals.positionAbsolute,j=Math.max(0,Math.min(F.x+F.width,G.x+U)-Math.max(F.x,G.x)),M=Math.max(0,Math.min(F.y+F.height,G.y+W)-Math.max(F.y,G.y)),Y=j*M,w=U*W;if(q){if(Y>0)K.push(A)}else if(Y>=w)K.push(A)}return K}function j$(f,[_,Q,J]){if(f.length===0)return null;let $=1/0,q=1/0,F=-1/0,K=-1/0;for(let A of f){let U=A.internals.positionAbsolute,W=A.measured.width??0,G=A.measured.height??0,j=U.x*J+_,M=U.y*J+Q,Y=W*J,w=G*J;$=Math.min($,j),q=Math.min(q,M),F=Math.max(F,j+Y),K=Math.max(K,M+w)}return{x:$,y:q,width:F-$,height:K-q}}function F9(f,_,Q={}){let J=Q.selectionOnDrag??!1,$=Q.selectionMode??"partial",q=null,F=!1,K=0,A=0;function U(M){if(M.button!==0)return;if(q)q.remove(),q=null;let Y=M.target;if(!(Y===_||Y.classList.contains("bf-flow__viewport")||Y.classList.contains("bf-flow__nodes")||Y.classList.contains("bf-flow__edges")))return;if(!M.shiftKey&&!J)return;M.stopPropagation(),M.preventDefault(),F=!0,K=M.clientX,A=M.clientY,q=document.createElement("div"),q.className="bf-flow__selection",q.style.position="absolute",q.style.pointerEvents="none",q.style.left="0",q.style.top="0",q.style.width="0",q.style.height="0",q.style.zIndex="5",_.appendChild(q),document.addEventListener("mousemove",W),document.addEventListener("mouseup",G)}function W(M){if(!F||!q)return;let Y=_.getBoundingClientRect(),w=M.clientX,L=M.clientY,Z=Math.min(K,w)-Y.left,C=Math.min(A,L)-Y.top,H=Math.abs(w-K),X=Math.abs(L-A);q.style.left=`${Z}px`,q.style.top=`${C}px`,q.style.width=`${H}px`,q.style.height=`${X}px`}function G(M){if(!F)return;document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",G);let Y=_.getBoundingClientRect(),w=M.clientX,L=M.clientY,Z=Math.min(K,w)-Y.left,C=Math.min(A,L)-Y.top,H=Math.abs(w-K),X=Math.abs(L-A);if(H>5||X>5){let S=f.getTransform(),y=Uf(f.nodeLookup),R=B$(y,{x:Z,y:C,width:H,height:X},S,$==="partial"),I=new Set(R.map((N)=>N.id));if(I.size>0){if(f.setNodes((N)=>N.map((T)=>I.has(T.id)?{...T,selected:!0}:{...T,selected:!1})),q){let N=f.getTransform(),T=j$(R,N);if(T)q.style.left=`${T.x}px`,q.style.top=`${T.y}px`,q.style.width=`${T.width}px`,q.style.height=`${T.height}px`,q.classList.add("bf-flow__selection--active"),_.focus();else q.remove(),q=null}}else if(f.unselectNodesAndEdges(),q)q.remove(),q=null}else if(f.unselectNodesAndEdges(),q)q.remove(),q=null;F=!1}function j(M){if(!q)return;if(M.key==="Delete"||M.key==="Backspace")q.remove(),q=null}_.addEventListener("mousedown",U,!0),_.addEventListener("keydown",j),x6(()=>{if(_.removeEventListener("mousedown",U,!0),_.removeEventListener("keydown",j),document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",G),q)q.remove(),q=null})}function k6(f,_,Q){let J=Q.get(_);if(!J)return f;let $=J.internals.userNode;if(!$.parentId||$.extent!=="parent")return f;let q=Q.get($.parentId);if(!q)return f;let F=J.measured?.width,K=J.measured?.height,A=q.measured?.width,U=q.measured?.height;if(F==null||K==null||A==null||U==null)return f;let W=Math.max(0,A-F),G=Math.max(0,U-K);return{x:Math.min(Math.max(f.x,0),W),y:Math.min(Math.max(f.y,0),G)}}function Z$(f,_,Q){V$(),f.style.position="relative",f.style.overflow="hidden",_.setDomNode(f),f.__bfFlowStore=_,_.setWidth(f.offsetWidth),_.setHeight(f.offsetHeight);let J=new ResizeObserver(()=>{_.setWidth(f.offsetWidth),_.setHeight(f.offsetHeight)});J.observe(f),Pf(()=>J.disconnect());let $=S6({domNode:f,minZoom:_.minZoom,maxZoom:_.maxZoom,viewport:l0(_.viewport),translateExtent:kf,onDraggingChange:(L)=>{_.setDragging(L)},onPanZoom:(L,Z)=>{_.setViewport(Z)},onPanZoomStart:void 0,onPanZoomEnd:(L,Z)=>{if(_.onMoveEnd)_.onMoveEnd(L,Z)}});_.setPanZoom($);let q=(L)=>({noWheelClassName:"nowheel",noPanClassName:"nopan",preventScrolling:!0,panOnScroll:Q.panOnScroll??!1,panOnDrag:Q.panOnDrag??!0,panOnScrollMode:g0.Free,panOnScrollSpeed:0.5,userSelectionActive:!1,zoomOnPinch:!0,zoomOnScroll:Q.zoomOnScroll??!0,zoomOnDoubleClick:Q.zoomOnDoubleClick??!0,zoomActivationKeyPressed:L,lib:"bf",onTransformChange:(Z)=>{_.setViewport({x:Z[0],y:Z[1],zoom:Z[2]})},connectionInProgress:!1,paneClickDistance:0});$.update(q(!1)),Pf(()=>$.destroy());let F=Q.zoomActivationKeyCode;if(F){let L=!1,Z=(H)=>{if(H.key===F&&!L)L=!0,$.update(q(!0))},C=(H)=>{if(H.key===F&&L)L=!1,$.update(q(!1))};document.addEventListener("keydown",Z),document.addEventListener("keyup",C),Pf(()=>{document.removeEventListener("keydown",Z),document.removeEventListener("keyup",C)})}q9(_,f),F9(_,f,{selectionOnDrag:Q.selectionOnDrag,selectionMode:Q.selectionMode});let K=null,A=(L)=>{let Z=L.target;if(!Z.closest(".bf-flow__node")&&!Z.closest(".bf-flow__handle")&&!Z.closest(".bf-flow__edge, [data-hit-id]"))K={x:L.clientX,y:L.clientY};else K=null},U=(L)=>{if(!K)return;let Z=L.clientX-K.x,C=L.clientY-K.y;if(K=null,Math.abs(Z)>5||Math.abs(C)>5)return;let H=L.target;if(H.closest(".bf-flow__node")||H.closest(".bf-flow__handle")||H.closest(".bf-flow__edge, [data-hit-id]"))return;if(_.unselectNodesAndEdges(),_.onPaneClick)_.onPaneClick(L)},W=(L)=>{if(_.onPaneMouseMove)_.onPaneMouseMove(L)};f.addEventListener("mousedown",A,!0),f.addEventListener("mouseup",U,!0),f.addEventListener("mousemove",W),Pf(()=>{f.removeEventListener("mousedown",A,!0),f.removeEventListener("mouseup",U,!0),f.removeEventListener("mousemove",W)});let G=null,j=(L)=>{if(L.button!==0)return;if(!l0(_.nodesDraggable))return;let Z=L.target;if(!Z)return;if(Z.closest(".bf-flow__handle"))return;if(Z.closest(".nodrag"))return;let C=Z.closest(".bf-flow__node");if(!C||!f.contains(C))return;let H=C.dataset.id;if(!H)return;let X=l0(_.nodeLookup).get(H);if(!X)return;L.stopPropagation(),G={nodeId:H,pointerId:L.pointerId,startClientX:L.clientX,startClientY:L.clientY,startNodeX:X.position.x,startNodeY:X.position.y,captureEl:C},C.setPointerCapture?.(L.pointerId),_.setDragging(!0)},M=(L,Z,C,H)=>{let X=l0(_.nodes),S=!1,y=X.map((D)=>{if(D.id!==L)return D;let R=D.position;if(R.x===Z&&R.y===C)return D;return S=!0,{...D,position:{x:Z,y:C}}});if(S)_.setNodes(y);_.setDragging(H)},Y=(L)=>{if(!G||L.pointerId!==G.pointerId)return;let Z=l0(_.viewport).zoom||1,C=(L.clientX-G.startClientX)/Z,H=(L.clientY-G.startClientY)/Z,X=k6({x:G.startNodeX+C,y:G.startNodeY+H},G.nodeId,l0(_.nodeLookup));M(G.nodeId,X.x,X.y,!0)},w=(L)=>{if(!G||L.pointerId!==G.pointerId)return;G.captureEl.releasePointerCapture?.(L.pointerId);let C=G.nodeId;G=null;let X=l0(_.nodeLookup).get(C);if(X)M(C,X.position.x,X.position.y,!1);else _.setDragging(!1)};if(f.addEventListener("pointerdown",j),f.addEventListener("pointermove",Y),f.addEventListener("pointerup",w),f.addEventListener("pointercancel",w),Pf(()=>{f.removeEventListener("pointerdown",j),f.removeEventListener("pointermove",Y),f.removeEventListener("pointerup",w),f.removeEventListener("pointercancel",w)}),M$(()=>{_.positionEpoch();let L=_.edges(),Z=_.nodeLookup(),C=f.querySelector(".bf-flow__edges");if(!C)return;for(let H of L){let X=Z.get(H.source),S=Z.get(H.target);if(!X||!S)continue;let y=J9(H,X,S);if(!y)continue;let D=$9(H,y);if(!D)continue;let R=D[0],I=C.querySelectorAll(`path[data-id="${H.id}"], path[data-hit-id="${H.id}"]`);for(let N of I)if(N.getAttribute("d")!==R)N.setAttribute("d",R)}}),typeof Q.onInit==="function")Q.onInit(_)}function V$(){if(typeof document>"u")return;if(document.getElementById("bf-flow-styles"))return;let f=document.createElement("style");f.id="bf-flow-styles",f.textContent=Y$,document.head.appendChild(f)}var Y$=`
2
2
  .bf-flow__node {
3
3
  padding: 10px 24px;
4
4
  border: 2px solid var(--foreground, #1a192b);
@@ -91,5 +91,5 @@ path.bf-flow__edge.bf-flow__edge--reconnect-hover { stroke: var(--text-primary,
91
91
  }
92
92
  `;import{untrack as r0}from"@barefootjs/client";function K9(f,_,Q,J,$){let q=f,F=_,K=J??null,A=$??null;if(Q==="target"){q=_,F=f;let U=K;K=A,A=U}return{source:q,target:F,sourceHandle:K,targetHandle:A}}function hf(f,_){if(!f.isValidConnection)return!0;return f.isValidConnection(_)}function X$(f,_,Q,J,$,q){f.addEventListener("mousedown",(F)=>{if(F.button!==0)return;if(!r0(q.nodesDraggable))return;F.stopPropagation(),F.preventDefault();let K=f.getBoundingClientRect(),A=J.getBoundingClientRect(),[,,U]=q.getTransform(),W=r0(q.viewport),G=(K.left+K.width/2-A.left-W.x)/U,j=(K.top+K.height/2-A.top-W.y)/U,M=document.createElementNS(xf,"svg");M.style.position="absolute",M.style.top="0",M.style.left="0",M.style.width="100%",M.style.height="100%",M.style.overflow="visible",M.style.pointerEvents="none",M.style.zIndex="10",J.appendChild(M);let Y=document.createElementNS(xf,"g");M.appendChild(Y);let w=document.createElementNS(xf,"path");w.setAttribute("fill","none");let L=q.connectionLineStyle;w.setAttribute("stroke",L?.stroke??"#b1b1b7"),w.setAttribute("stroke-width",L?.strokeWidth??"1"),Y.appendChild(w);let Z=null,C=null,H=30;function X(D,R){let I=J.querySelectorAll(".bf-flow__handle"),N=null,T=H;for(let b of I){if(b===f)continue;if(!b.dataset.nodeId||b.dataset.nodeId===_)continue;if((b.classList.contains("bf-flow__handle--target")?"target":"source")===Q)continue;let B=b.getBoundingClientRect(),O=B.left+B.width/2,V=B.top+B.height/2,z=Math.hypot(D-O,R-V);if(z<T)T=z,N=b}return N}let S=(D)=>{let R=J.getBoundingClientRect(),[,,I]=q.getTransform(),N=r0(q.viewport),T=X(D.clientX,D.clientY),b,k;if(T){let V=T.getBoundingClientRect();b=(V.left+V.width/2-R.left-N.x)/I,k=(V.top+V.height/2-R.top-N.y)/I}else b=(D.clientX-R.left-N.x)/I,k=(D.clientY-R.top-N.y)/I;let[B]=Kf({sourceX:G,sourceY:j,sourcePosition:Q==="source"?v.Bottom:v.Top,targetX:b,targetY:k,targetPosition:Q==="source"?v.Top:v.Bottom});w.setAttribute("d",B);let O=r0(q.viewport);if(Y.setAttribute("transform",`translate(${O.x}, ${O.y}) scale(${O.zoom})`),Z&&Z!==T)Z.classList.remove("valid","invalid");if(C=null,T){let V=T.classList.contains("bf-flow__handle--target")?"target":"source",z=Q!==V,u=f.getAttribute("data-handleid")??null,E=T.getAttribute("data-handleid")??null,x=K9(_,T.dataset.nodeId,Q,u,E),h=z&&hf(q,x);if(T.classList.remove("valid","invalid"),T.classList.add(h?"valid":"invalid"),Z=T,h)C=T}else{M.style.display="none";let V=document.elementFromPoint(D.clientX,D.clientY);M.style.display="";let z=V?.closest?.(".bf-flow__handle");if(z&&z!==f&&z.dataset.nodeId&&z.dataset.nodeId!==_){let u=z.classList.contains("bf-flow__handle--target")?"target":"source",E=Q!==u,x=f.getAttribute("data-handleid")??null,h=z.getAttribute("data-handleid")??null,P=K9(_,z.dataset.nodeId,Q,x,h),l=E&&hf(q,P);if(z.classList.remove("valid","invalid"),!l)z.classList.add("invalid");Z=z}else Z=null}},y=(D)=>{if(document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",y),Z)Z.classList.remove("valid","invalid");let R=C;if(!R){M.style.display="none";let I=document.elementFromPoint(D.clientX,D.clientY);M.style.display="",R=I?.closest?.(".bf-flow__handle")}if(R&&R.dataset.nodeId&&R.dataset.nodeId!==_){let I=R.dataset.nodeId,N=R.classList.contains("bf-flow__handle--target")?"target":"source",T=Q!==N,b=f.getAttribute("data-handleid")??null,k=R.getAttribute("data-handleid")??null,B=K9(_,I,Q,b,k);if(T&&hf(q,B))if(q.onConnect)q.onConnect(B);else{let z={id:`e-${B.source}-${B.target}-${Date.now()}`,source:B.source,target:B.target,sourceHandle:B.sourceHandle??void 0,targetHandle:B.targetHandle??void 0};q.addEdge(z)}}M.remove()};document.addEventListener("mousemove",S),document.addEventListener("mouseup",y)})}function L$(f,_,Q,J,$,q){f.addEventListener("mousedown",(F)=>{if(F.button!==0)return;F.stopPropagation(),F.preventDefault();let K=Q==="source"?_.target:_.source,U=r0(q.nodeLookup).get(K);if(!U)return;let W=U.measured.width??150,G=U.measured.height??40,j=U.internals.positionAbsolute,M=j.x+W/2,Y=Q==="source"?j.y:j.y+G,w=$.querySelector(`.bf-flow__edge[data-id="${_.id}"]`),L=$.querySelector(`path[data-hit-id="${_.id}"]`);if(w)w.style.opacity="0.2";if(L)L.style.display="none";let Z=document.createElementNS(xf,"path");Z.setAttribute("fill","none");let C=q.connectionLineStyle;Z.setAttribute("stroke",C?.stroke??"#b1b1b7"),Z.setAttribute("stroke-width",C?.strokeWidth??"1"),Z.setAttribute("pointer-events","none"),$.appendChild(Z);let H=null,X=(y)=>{let D=J.getBoundingClientRect(),[,,R]=q.getTransform(),I=r0(q.viewport),N=(y.clientX-D.left-I.x)/R,T=(y.clientY-D.top-I.y)/R,b=Q==="source"?v.Top:v.Bottom,k=Q==="source"?v.Bottom:v.Top,[B]=Kf({sourceX:M,sourceY:Y,sourcePosition:b,targetX:N,targetY:T,targetPosition:k});Z.setAttribute("d",B);let V=document.elementFromPoint(y.clientX,y.clientY)?.closest?.(".bf-flow__handle");if(H&&H!==V)H.classList.remove("invalid");if(V&&V.dataset.nodeId&&V.dataset.nodeId!==K){let z=V.dataset.nodeId,E=(V.classList.contains("bf-flow__handle--target")?"target":"source")==="target"?{source:K,target:z,sourceHandle:null,targetHandle:null}:{source:z,target:K,sourceHandle:null,targetHandle:null},x=hf(q,E);if(V.classList.remove("invalid"),!x)V.classList.add("invalid");H=V}else H=null},S=(y)=>{if(document.removeEventListener("mousemove",X),document.removeEventListener("mouseup",S),H)H.classList.remove("invalid");if(w)w.style.opacity="";if(L)L.style.display="";let R=document.elementFromPoint(y.clientX,y.clientY)?.closest?.(".bf-flow__handle");if(R&&R.dataset.nodeId&&R.dataset.nodeId!==K){let I=R.dataset.nodeId,T=(R.classList.contains("bf-flow__handle--target")?"target":"source")==="target"?{source:K,target:I,sourceHandle:null,targetHandle:null}:{source:I,target:K,sourceHandle:null,targetHandle:null};if(hf(q,T)){if(q.onReconnect)q.onReconnect(_,T);let k=r0(q.edges),B=V_(_,T,k);q.setEdges(B)}}Z.remove()};document.addEventListener("mousemove",X),document.addEventListener("mouseup",S)})}function w$(f,_,Q){let J=_.call(f,Q);if(J instanceof Node)f.appendChild(J)}import{onCleanup as T$,untrack as vf}from"@barefootjs/client";function O$(f,_,Q,J={}){let{minWidth:$=10,minHeight:q=10,maxWidth:F=Number.MAX_SAFE_INTEGER,maxHeight:K=Number.MAX_SAFE_INTEGER,keepAspectRatio:A=!1,variant:U=Y0.Handle,onResizeStart:W,onResize:G,onResizeEnd:j,shouldResize:M,isVisible:Y=!0,color:w}=J;if(!Y)return()=>{};let L=typeof U==="string"?U==="line"?Y0.Line:Y0.Handle:U,Z=L===Y0.Line?y6:E6;f.classList.add("bf-flow__node--resizable");let C=document.createElement("div");C.className="bf-flow__node-resizer",f.appendChild(C);let H=[];for(let S of Z){let y=document.createElement("div");if(y.className=`bf-flow__resize-handle bf-flow__resize-handle--${S}`,L===Y0.Line)y.classList.add("bf-flow__resize-handle--line");else y.classList.add("bf-flow__resize-handle--corner");if(y.dataset.position=S,w)y.style.setProperty("--bf-resize-color",w);C.appendChild(y);let D=u6({domNode:y,nodeId:_,getStoreItems:()=>{let N=vf(Q.nodeLookup),T=Q.getTransform();return{nodeLookup:N,transform:T,snapGrid:Q.snapToGrid?Q.snapGrid:void 0,snapToGrid:Q.snapToGrid,nodeOrigin:Q.nodeOrigin,paneDomNode:vf(Q.domNode)}},onChange:(N,T)=>{let b=vf(Q.nodeLookup),k=b.get(_);if(!k)return;if(N.width!=null)k.measured.width=N.width,f.style.width=`${N.width}px`;if(N.height!=null)k.measured.height=N.height,f.style.height=`${N.height}px`;if(N.x!=null||N.y!=null){let V=N.x??k.internals.positionAbsolute.x,z=N.y??k.internals.positionAbsolute.y;k.internals.positionAbsolute={x:V,y:z},k.internals.userNode.position={x:V,y:z},f.style.transform=`translate(${V}px, ${z}px)`}for(let V of T){let z=b.get(V.id);if(z)z.internals.positionAbsolute=V.position,z.internals.userNode.position=V.position}let B=new Map;B.set(_,{id:_,nodeElement:f,force:!0});let O=vf(Q.parentLookup);z6(B,b,O,vf(Q.domNode),Q.nodeOrigin,Q.nodeExtent),Q.triggerPositionUpdate()},onEnd:(N)=>{Q.setNodes((T)=>T.map((b)=>b.id===_?{...b,position:{x:N.x,y:N.y},measured:{width:N.width,height:N.height},style:{...b.style,width:N.width,height:N.height}}:b))}}),R=L===Y0.Line,I;if(R){if(S==="left"||S==="right")I="horizontal";else if(S==="top"||S==="bottom")I="vertical"}D.update({controlPosition:S,boundaries:{minWidth:$,minHeight:q,maxWidth:F,maxHeight:K},keepAspectRatio:A,resizeDirection:I,onResizeStart:W,onResize:G,onResizeEnd:j,shouldResize:M}),H.push(D)}let X=()=>{for(let S of H)S.destroy();C.remove(),f.classList.remove("bf-flow__node--resizable")};return T$(X),X}var R$="bf-flow",z$="bf-flow__viewport",H$="bf-flow__edges",D$="bf-flow__nodes",C$="bf-flow__node",I$="bf-flow__node--group",S$="bf-flow__node--child",E$="bf-flow__node--selected",y$="bf-flow__node--custom",N$="bf-flow__edge",u$="bf-flow__edge--selected",b$="bf-flow__edge--animated",x$="bf-flow__handle",k$="bf-flow__handle--target",P$="bf-flow__handle--source",h$="bf-flow__controls",v$="bf-flow__controls-button",m$="bf-flow__minimap",g$="bf-flow__minimap-mask",p$="xyflow__viewport";import{untrack as U0}from"@barefootjs/client";function c$(f){let _=j0();_.setNodes(f);function Q(J){_.setNodes(($)=>a$($,J))}return[_.nodes,_.setNodes,Q]}function l$(f){let _=j0();_.setEdges(f);function Q(J){_.setEdges(($)=>d$($,J))}return[_.edges,_.setEdges,Q]}function r$(){let f=j0();return{getNodes:()=>U0(f.nodes),getEdges:()=>U0(f.edges),getNode:(_)=>U0(f.nodes).find((Q)=>Q.id===_),getZoom:()=>U0(f.viewport).zoom,getViewport:()=>U0(f.viewport),setNodes:f.setNodes,setEdges:f.setEdges,setViewport:(_)=>{let Q=U0(f.panZoom);if(Q)Q.setViewport(_)},setCenter:(_,Q,J)=>{let $=U0(f.panZoom);if(!$)return;let q=U0(f.width),F=U0(f.height),K=J?.zoom??U0(f.viewport).zoom;$.setViewport({x:q/2-_*K,y:F/2-Q*K,zoom:K},{duration:J?.duration})},fitView:f.fitView,zoomIn:(_)=>{U0(f.panZoom)?.scaleBy(1.2,_)},zoomOut:(_)=>{U0(f.panZoom)?.scaleBy(0.8333333333333334,_)},zoomTo:(_,Q)=>{U0(f.panZoom)?.scaleTo(_,Q)},updateNode:(_,Q)=>{f.setNodes((J)=>J.map(($)=>{if($.id!==_)return $;let q=typeof Q==="function"?Q($):Q;return{...$,...q}}))},updateNodeData:(_,Q)=>{f.setNodes((J)=>J.map(($)=>{if($.id!==_)return $;let q=typeof Q==="function"?Q($.data):Q;return{...$,data:{...$.data,...q}}}))},addEdges:(_)=>{f.setEdges((Q)=>[...Q,..._])},deleteElements:f.deleteElements,screenToFlowPosition:(_)=>{let Q=U0(f.domNode);if(!Q)return _;let J=Q.getBoundingClientRect(),$=f.getTransform();return Ff({x:_.x-J.left,y:_.y-J.top},$)}}}function i$(f,_){return X6(f,_)}function s$(f,_,Q){return V_(f,_,Q)}function a$(f,_){let Q=[...f];for(let J of _)switch(J.type){case"position":Q=Q.map(($)=>$.id===J.id?{...$,...J.position?{position:J.position}:{},dragging:J.dragging??$.dragging}:$);break;case"dimensions":Q=Q.map(($)=>$.id===J.id&&J.dimensions?{...$,width:J.dimensions.width,height:J.dimensions.height}:$);break;case"select":Q=Q.map(($)=>$.id===J.id?{...$,selected:J.selected}:$);break;case"remove":Q=Q.filter(($)=>$.id!==J.id);break;case"add":Q.push(J.item);break}return Q}function d$(f,_){let Q=[...f];for(let J of _)switch(J.type){case"select":Q=Q.map(($)=>$.id===J.id?{...$,selected:J.selected}:$);break;case"remove":Q=Q.filter(($)=>$.id!==J.id);break;case"add":Q.push(J.item);break}return Q}export{b6 as useViewport,A$ as useStore,r$ as useReactFlow,c$ as useNodesState,U$ as useNodesInitialized,F$ as useNodes,j0 as useFlow,l$ as useEdgesState,K$ as useEdges,F9 as setupSelectionRectangle,G$ as setupNodeSelection,q9 as setupKeyboardHandlers,W$ as screenToFlowPosition,s$ as reconnectEdge,O$ as initNodeResizer,nQ as getStraightPath,Kf as getSmoothStepPath,B7 as getOutgoers,V7 as getNodesInside,M7 as getNodesBounds,j7 as getIncomers,u7 as getEdgeToolbarTransform,$9 as getEdgePath,Y7 as getConnectedEdges,tQ as getBezierPath,w$ as dispatchNodeType,_$ as createFlowStore,J9 as computeEdgePosition,k6 as clampDragPositionToParent,L$ as attachReconnectionHandler,Z$ as attachFlowSubsystems,X$ as attachConnectionHandler,i$ as addEdge,p$ as XYFLOW_VIEWPORT,Y0 as ResizeControlVariant,v as Position,cQ as MarkerType,Q9 as FlowContext,p0 as ConnectionModeEnum,z$ as BF_FLOW_VIEWPORT,E$ as BF_FLOW_NODE_SELECTED,I$ as BF_FLOW_NODE_GROUP,y$ as BF_FLOW_NODE_CUSTOM,S$ as BF_FLOW_NODE_CHILD,D$ as BF_FLOW_NODES,C$ as BF_FLOW_NODE,g$ as BF_FLOW_MINIMAP_MASK,m$ as BF_FLOW_MINIMAP,k$ as BF_FLOW_HANDLE_TARGET,P$ as BF_FLOW_HANDLE_SOURCE,x$ as BF_FLOW_HANDLE,u$ as BF_FLOW_EDGE_SELECTED,b$ as BF_FLOW_EDGE_ANIMATED,H$ as BF_FLOW_EDGES,N$ as BF_FLOW_EDGE,v$ as BF_FLOW_CONTROLS_BUTTON,h$ as BF_FLOW_CONTROLS,R$ as BF_FLOW};
93
93
 
94
- //# debugId=6CACF743F8DD910B64756E2164756E21
94
+ //# debugId=CF69EBA152B4A66B64756E2164756E21
95
95
  //# sourceMappingURL=xyflow.browser.min.js.map