@markus-global/cli 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/markus.mjs +88 -10
- package/dist/web-ui/assets/{CommentInput-ZW-2JyIg.js → CommentInput-D3jx82c7.js} +1 -1
- package/dist/web-ui/assets/{ContentRenderer-Ccoj5KhH.js → ContentRenderer-CQ9uMng0.js} +2 -2
- package/dist/web-ui/assets/{Deliverables-Cfdx-Yeu.js → Deliverables-DKy2_HPY.js} +1 -1
- package/dist/web-ui/assets/{Notifications-CKTZO9fn.js → Notifications-1YKMlJ91.js} +1 -1
- package/dist/web-ui/assets/{Search-_yYhKio7.js → Search-D5P2V5tM.js} +1 -1
- package/dist/web-ui/assets/{Settings-BzI3q_dx.js → Settings-C86a_mG8.js} +6 -6
- package/dist/web-ui/assets/{Store-DweBtEGf.js → Store-Ca8mvyTT.js} +1 -1
- package/dist/web-ui/assets/Team-DHmWU23x.js +40 -0
- package/dist/web-ui/assets/{Work-CMguHPuO.js → Work-zJLJ6A3I.js} +1 -1
- package/dist/web-ui/assets/{arc-BCQf-2jC.js → arc-s5quZ9MF.js} +1 -1
- package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-CPfkQ9P6.js → architectureDiagram-3BPJPVTR-iZhZ9wDV.js} +1 -1
- package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-w0CZJHe6.js → blockDiagram-GPEHLZMM-lYMBEpQb.js} +1 -1
- package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-BTiNccgB.js → c4Diagram-AAUBKEIU-C8vbScKq.js} +1 -1
- package/dist/web-ui/assets/channel-D2RoSw08.js +1 -0
- package/dist/web-ui/assets/{chunk-2J33WTMH-BGdXq7Ci.js → chunk-2J33WTMH-DhvC5Teh.js} +1 -1
- package/dist/web-ui/assets/{chunk-4BX2VUAB-CDNqL2YA.js → chunk-4BX2VUAB-Do4f1QNX.js} +1 -1
- package/dist/web-ui/assets/{chunk-55IACEB6-B0gL5ae4.js → chunk-55IACEB6-BCDgVda5.js} +1 -1
- package/dist/web-ui/assets/{chunk-727SXJPM-C377nPB7.js → chunk-727SXJPM-n9W-gHJL.js} +1 -1
- package/dist/web-ui/assets/{chunk-AQP2D5EJ-DmrWdQ_x.js → chunk-AQP2D5EJ-joCNa2WM.js} +1 -1
- package/dist/web-ui/assets/{chunk-FMBD7UC4-CasLcPiP.js → chunk-FMBD7UC4-Cp9QtfEA.js} +1 -1
- package/dist/web-ui/assets/{chunk-ND2GUHAM-Bl_5b1IO.js → chunk-ND2GUHAM-Dt_ZkR0s.js} +1 -1
- package/dist/web-ui/assets/{chunk-QZHKN3VN-CAFFoh9g.js → chunk-QZHKN3VN-CVGCkc4k.js} +1 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-DGebyJZN.js +1 -0
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-DGebyJZN.js +1 -0
- package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-CNLxRUfr.js → cose-bilkent-S5V4N54A-B4Q2AELl.js} +1 -1
- package/dist/web-ui/assets/{dagre-BM42HDAG-CkqVIRox.js → dagre-BM42HDAG-DoazhTnM.js} +1 -1
- package/dist/web-ui/assets/{diagram-2AECGRRQ-CBxL1Jqg.js → diagram-2AECGRRQ-C7KY67Fn.js} +1 -1
- package/dist/web-ui/assets/{diagram-5GNKFQAL-CpSDzWYR.js → diagram-5GNKFQAL-dPjx6DBc.js} +1 -1
- package/dist/web-ui/assets/{diagram-KO2AKTUF-DG-3NyJR.js → diagram-KO2AKTUF-D4BEU7N2.js} +1 -1
- package/dist/web-ui/assets/{diagram-LMA3HP47-DOq08i33.js → diagram-LMA3HP47-D9PLmyge.js} +1 -1
- package/dist/web-ui/assets/{diagram-OG6HWLK6-B6_uG9hH.js → diagram-OG6HWLK6-Dg6SRSYN.js} +1 -1
- package/dist/web-ui/assets/{erDiagram-TEJ5UH35-DOyEVlMM.js → erDiagram-TEJ5UH35-D97ueERw.js} +1 -1
- package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-BiWeEgX3.js → flowDiagram-I6XJVG4X-Cm-sRIL_.js} +1 -1
- package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-D-j-5cEg.js → ganttDiagram-6RSMTGT7-CXq6jqCz.js} +1 -1
- package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-C6lcURfO.js → gitGraphDiagram-PVQCEYII-CJ50_J0p.js} +1 -1
- package/dist/web-ui/assets/{index-lNtr_En-.js → index-CHkb08MZ.js} +5 -5
- package/dist/web-ui/assets/{infoDiagram-5YYISTIA-DU_r7Q4O.js → infoDiagram-5YYISTIA-CbTpYpwF.js} +1 -1
- package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-C7M7fHbe.js → ishikawaDiagram-YF4QCWOH-CUt9Btxt.js} +1 -1
- package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-DQJbMKSV.js → journeyDiagram-JHISSGLW-F9zmJizG.js} +1 -1
- package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-D8nO46ug.js → kanban-definition-UN3LZRKU-jNs9ezLz.js} +1 -1
- package/dist/web-ui/assets/{mermaid.core-D9X_B1hr.js → mermaid.core-Cxm0p7KD.js} +5 -5
- package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-BoWfA0x3.js → mindmap-definition-RKZ34NQL-BuW2AA71.js} +1 -1
- package/dist/web-ui/assets/{pieDiagram-4H26LBE5-GeMxJnY4.js → pieDiagram-4H26LBE5-BKrViKGj.js} +1 -1
- package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-B5xQl44f.js → quadrantDiagram-W4KKPZXB-Hh0Kzhcb.js} +1 -1
- package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-DAecntg7.js → requirementDiagram-4Y6WPE33-B1ga-7j9.js} +1 -1
- package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-DOLj0rKK.js → sankeyDiagram-5OEKKPKP-2uQ075vI.js} +1 -1
- package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-BvS7cOXA.js → sequenceDiagram-3UESZ5HK-97k-cDlv.js} +1 -1
- package/dist/web-ui/assets/{stateDiagram-AJRCARHV-CqHRpjfn.js → stateDiagram-AJRCARHV-PTiMHe-8.js} +1 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-CNP7uL0K.js +1 -0
- package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-Bsk6HQIz.js → timeline-definition-PNZ67QCA-Gji5tIlk.js} +1 -1
- package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-CekJLx4L.js → vennDiagram-CIIHVFJN-B91fyhQC.js} +1 -1
- package/dist/web-ui/assets/{wardley-L42UT6IY-CBUmu8Xa.js → wardley-L42UT6IY-C9MIuW9C.js} +1 -1
- package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-BgoDq86Z.js → wardleyDiagram-YWT4CUSO-CtXjrE4d.js} +1 -1
- package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-zDxkTG1v.js → xychartDiagram-2RQKCTM6-BgVdUlxT.js} +1 -1
- package/dist/web-ui/index.html +1 -1
- package/package.json +1 -1
- package/dist/web-ui/assets/Team-CpIDXpOi.js +0 -40
- package/dist/web-ui/assets/channel-DIphKEQ6.js +0 -1
- package/dist/web-ui/assets/classDiagram-4FO5ZUOK-CIRviJO4.js +0 -1
- package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-CIRviJO4.js +0 -1
- package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-Df743oiT.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ai as dl,aj as ul,F as fl,ak as hl,r as g,j as t,u as He,f as re,G as ml,a as rr,e as gl,B as pl,C as xl,b as cs,P as Ye,w as bt,aa as kt,D as vr,al as no,M as bl,J as Sn,n as Lt,t as Xn,am as yl,A as ws,a0 as ro,an as ds,ao as so,ap as us,aq as oo,ar as ao,as as io,Y as Ca,$ as Sa,Z as vl}from"./index-lNtr_En-.js";import{ContentRenderer as wl}from"./ContentRenderer-Ccoj5KhH.js";import{s as ht,e as Ea,f as ks,T as Kr,g as Qr,t as kl}from"./transform-CpIVI4vC.js";import{i as Jr}from"./value-DIujSiJ7.js";import{C as Ma}from"./CommentInput-ZW-2JyIg.js";function jl(e){let n;for(;n=e.sourceEvent;)e=n;return e}function jt(e,n){if(e=jl(e),n===void 0&&(n=e.currentTarget),n){var s=n.ownerSVGElement||n;if(s.createSVGPoint){var r=s.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[e.clientX-i.left-n.clientLeft,e.clientY-i.top-n.clientTop]}}return[e.pageX,e.pageY]}const Nl={passive:!1},Un={capture:!0,passive:!1};function es(e){e.stopImmediatePropagation()}function Tn(e){e.preventDefault(),e.stopImmediatePropagation()}function Ia(e){var n=e.document.documentElement,s=ht(e).on("dragstart.drag",Tn,Un);"onselectstart"in n?s.on("selectstart.drag",Tn,Un):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Ta(e,n){var s=e.document.documentElement,r=ht(e).on("dragstart.drag",null);n&&(r.on("click.drag",Tn,Un),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in s?r.on("selectstart.drag",null):(s.style.MozUserSelect=s.__noselect,delete s.__noselect)}const wr=e=>()=>e;function fs(e,{sourceEvent:n,subject:s,target:r,identifier:i,active:o,x:a,y:l,dx:c,dy:d,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:s,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:h}})}fs.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Cl(e){return!e.ctrlKey&&!e.button}function Sl(){return this.parentNode}function El(e,n){return n??{x:e.x,y:e.y}}function Ml(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ra(){var e=Cl,n=Sl,s=El,r=Ml,i={},o=Ea("start","drag","end"),a=0,l,c,d,h,f=0;function m(b){b.on("mousedown.drag",u).filter(r).on("touchstart.drag",S).on("touchmove.drag",v,Nl).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function u(b,N){if(!(h||!e.call(this,b,N))){var w=p(this,n.call(this,b,N),b,N,"mouse");w&&(ht(b.view).on("mousemove.drag",x,Un).on("mouseup.drag",E,Un),Ia(b.view),es(b),d=!1,l=b.clientX,c=b.clientY,w("start",b))}}function x(b){if(Tn(b),!d){var N=b.clientX-l,w=b.clientY-c;d=N*N+w*w>f}i.mouse("drag",b)}function E(b){ht(b.view).on("mousemove.drag mouseup.drag",null),Ta(b.view,d),Tn(b),i.mouse("end",b)}function S(b,N){if(e.call(this,b,N)){var w=b.changedTouches,M=n.call(this,b,N),D=w.length,P,_;for(P=0;P<D;++P)(_=p(this,M,b,N,w[P].identifier,w[P]))&&(es(b),_("start",b,w[P]))}}function v(b){var N=b.changedTouches,w=N.length,M,D;for(M=0;M<w;++M)(D=i[N[M].identifier])&&(Tn(b),D("drag",b,N[M]))}function y(b){var N=b.changedTouches,w=N.length,M,D;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),M=0;M<w;++M)(D=i[N[M].identifier])&&(es(b),D("end",b,N[M]))}function p(b,N,w,M,D,P){var _=o.copy(),C=jt(P||w,N),$,z,j;if((j=s.call(b,new fs("beforestart",{sourceEvent:w,target:m,identifier:D,active:a,x:C[0],y:C[1],dx:0,dy:0,dispatch:_}),M))!=null)return $=j.x-C[0]||0,z=j.y-C[1]||0,function B(R,T,A){var L=C,q;switch(R){case"start":i[D]=B,q=a++;break;case"end":delete i[D],--a;case"drag":C=jt(A||T,N),q=a;break}_.call(R,b,new fs(R,{sourceEvent:T,subject:j,target:m,identifier:D,active:q,x:C[0]+$,y:C[1]+z,dx:C[0]-L[0],dy:C[1]-L[1],dispatch:_}),M)}}return m.filter=function(b){return arguments.length?(e=typeof b=="function"?b:wr(!!b),m):e},m.container=function(b){return arguments.length?(n=typeof b=="function"?b:wr(b),m):n},m.subject=function(b){return arguments.length?(s=typeof b=="function"?b:wr(b),m):s},m.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:wr(!!b),m):r},m.on=function(){var b=o.on.apply(o,arguments);return b===o?m:b},m.clickDistance=function(b){return arguments.length?(f=(b=+b)*b,m):Math.sqrt(f)},m}var Il=1e-12;function lo(e){return((e=Math.exp(e))+1/e)/2}function Tl(e){return((e=Math.exp(e))-1/e)/2}function Rl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Rr=(function e(n,s,r){function i(o,a){var l=o[0],c=o[1],d=o[2],h=a[0],f=a[1],m=a[2],u=h-l,x=f-c,E=u*u+x*x,S,v;if(E<Il)v=Math.log(m/d)/n,S=function(M){return[l+M*u,c+M*x,d*Math.exp(n*M*v)]};else{var y=Math.sqrt(E),p=(m*m-d*d+r*E)/(2*d*s*y),b=(m*m-d*d-r*E)/(2*m*s*y),N=Math.log(Math.sqrt(p*p+1)-p),w=Math.log(Math.sqrt(b*b+1)-b);v=(w-N)/n,S=function(M){var D=M*v,P=lo(N),_=d/(s*y)*(P*Rl(n*D+N)-Tl(N));return[l+_*u,c+_*x,d*P/lo(n*D+N)]}}return S.duration=v*1e3*n/Math.SQRT2,S}return i.rho=function(o){var a=Math.max(.001,+o),l=a*a,c=l*l;return e(a,l,c)},i})(Math.SQRT2,2,4),kr=e=>()=>e;function _l(e,{sourceEvent:n,target:s,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ts(e){e.stopImmediatePropagation()}function Fn(e){e.preventDefault(),e.stopImmediatePropagation()}function Al(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ll(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function co(){return this.__zoom||ks}function Dl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Pl(){return navigator.maxTouchPoints||"ontouchstart"in this}function $l(e,n,s){var r=e.invertX(n[0][0])-s[0][0],i=e.invertX(n[1][0])-s[1][0],o=e.invertY(n[0][1])-s[0][1],a=e.invertY(n[1][1])-s[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function _a(){var e=Al,n=Ll,s=$l,r=Dl,i=Pl,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Rr,d=Ea("start","zoom","end"),h,f,m,u=500,x=150,E=0,S=10;function v(j){j.property("__zoom",co).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",_).filter(i).on("touchstart.zoom",C).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(j,B,R,T){var A=j.selection?j.selection():j;A.property("__zoom",co),j!==A?N(j,B,R,T):A.interrupt().each(function(){w(this,arguments).event(T).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},v.scaleBy=function(j,B,R,T){v.scaleTo(j,function(){var A=this.__zoom.k,L=typeof B=="function"?B.apply(this,arguments):B;return A*L},R,T)},v.scaleTo=function(j,B,R,T){v.transform(j,function(){var A=n.apply(this,arguments),L=this.__zoom,q=R==null?b(A):typeof R=="function"?R.apply(this,arguments):R,F=L.invert(q),Y=typeof B=="function"?B.apply(this,arguments):B;return s(p(y(L,Y),q,F),A,a)},R,T)},v.translateBy=function(j,B,R,T){v.transform(j,function(){return s(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof R=="function"?R.apply(this,arguments):R),n.apply(this,arguments),a)},null,T)},v.translateTo=function(j,B,R,T,A){v.transform(j,function(){var L=n.apply(this,arguments),q=this.__zoom,F=T==null?b(L):typeof T=="function"?T.apply(this,arguments):T;return s(ks.translate(F[0],F[1]).scale(q.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof R=="function"?-R.apply(this,arguments):-R),L,a)},T,A)};function y(j,B){return B=Math.max(o[0],Math.min(o[1],B)),B===j.k?j:new Kr(B,j.x,j.y)}function p(j,B,R){var T=B[0]-R[0]*j.k,A=B[1]-R[1]*j.k;return T===j.x&&A===j.y?j:new Kr(j.k,T,A)}function b(j){return[(+j[0][0]+ +j[1][0])/2,(+j[0][1]+ +j[1][1])/2]}function N(j,B,R,T){j.on("start.zoom",function(){w(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(T).end()}).tween("zoom",function(){var A=this,L=arguments,q=w(A,L).event(T),F=n.apply(A,L),Y=R==null?b(F):typeof R=="function"?R.apply(A,L):R,Q=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),O=A.__zoom,I=typeof B=="function"?B.apply(A,L):B,H=c(O.invert(Y).concat(Q/O.k),I.invert(Y).concat(Q/I.k));return function(V){if(V===1)V=I;else{var W=H(V),X=Q/W[2];V=new Kr(X,Y[0]-W[0]*X,Y[1]-W[1]*X)}q.zoom(null,V)}})}function w(j,B,R){return!R&&j.__zooming||new M(j,B)}function M(j,B){this.that=j,this.args=B,this.active=0,this.sourceEvent=null,this.extent=n.apply(j,B),this.taps=0}M.prototype={event:function(j){return j&&(this.sourceEvent=j),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(j,B){return this.mouse&&j!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&j!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&j!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(j){var B=ht(this.that).datum();d.call(j,this.that,new _l(j,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:d}),B)}};function D(j,...B){if(!e.apply(this,arguments))return;var R=w(this,B).event(j),T=this.__zoom,A=Math.max(o[0],Math.min(o[1],T.k*Math.pow(2,r.apply(this,arguments)))),L=jt(j);if(R.wheel)(R.mouse[0][0]!==L[0]||R.mouse[0][1]!==L[1])&&(R.mouse[1]=T.invert(R.mouse[0]=L)),clearTimeout(R.wheel);else{if(T.k===A)return;R.mouse=[L,T.invert(L)],Qr(this),R.start()}Fn(j),R.wheel=setTimeout(q,x),R.zoom("mouse",s(p(y(T,A),R.mouse[0],R.mouse[1]),R.extent,a));function q(){R.wheel=null,R.end()}}function P(j,...B){if(m||!e.apply(this,arguments))return;var R=j.currentTarget,T=w(this,B,!0).event(j),A=ht(j.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",Q,!0),L=jt(j,R),q=j.clientX,F=j.clientY;Ia(j.view),ts(j),T.mouse=[L,this.__zoom.invert(L)],Qr(this),T.start();function Y(O){if(Fn(O),!T.moved){var I=O.clientX-q,H=O.clientY-F;T.moved=I*I+H*H>E}T.event(O).zoom("mouse",s(p(T.that.__zoom,T.mouse[0]=jt(O,R),T.mouse[1]),T.extent,a))}function Q(O){A.on("mousemove.zoom mouseup.zoom",null),Ta(O.view,T.moved),Fn(O),T.event(O).end()}}function _(j,...B){if(e.apply(this,arguments)){var R=this.__zoom,T=jt(j.changedTouches?j.changedTouches[0]:j,this),A=R.invert(T),L=R.k*(j.shiftKey?.5:2),q=s(p(y(R,L),T,A),n.apply(this,B),a);Fn(j),l>0?ht(this).transition().duration(l).call(N,q,T,j):ht(this).call(v.transform,q,T,j)}}function C(j,...B){if(e.apply(this,arguments)){var R=j.touches,T=R.length,A=w(this,B,j.changedTouches.length===T).event(j),L,q,F,Y;for(ts(j),q=0;q<T;++q)F=R[q],Y=jt(F,this),Y=[Y,this.__zoom.invert(Y),F.identifier],A.touch0?!A.touch1&&A.touch0[2]!==Y[2]&&(A.touch1=Y,A.taps=0):(A.touch0=Y,L=!0,A.taps=1+!!h);h&&(h=clearTimeout(h)),L&&(A.taps<2&&(f=Y[0],h=setTimeout(function(){h=null},u)),Qr(this),A.start())}}function $(j,...B){if(this.__zooming){var R=w(this,B).event(j),T=j.changedTouches,A=T.length,L,q,F,Y;for(Fn(j),L=0;L<A;++L)q=T[L],F=jt(q,this),R.touch0&&R.touch0[2]===q.identifier?R.touch0[0]=F:R.touch1&&R.touch1[2]===q.identifier&&(R.touch1[0]=F);if(q=R.that.__zoom,R.touch1){var Q=R.touch0[0],O=R.touch0[1],I=R.touch1[0],H=R.touch1[1],V=(V=I[0]-Q[0])*V+(V=I[1]-Q[1])*V,W=(W=H[0]-O[0])*W+(W=H[1]-O[1])*W;q=y(q,Math.sqrt(V/W)),F=[(Q[0]+I[0])/2,(Q[1]+I[1])/2],Y=[(O[0]+H[0])/2,(O[1]+H[1])/2]}else if(R.touch0)F=R.touch0[0],Y=R.touch0[1];else return;R.zoom("touch",s(p(q,F,Y),R.extent,a))}}function z(j,...B){if(this.__zooming){var R=w(this,B).event(j),T=j.changedTouches,A=T.length,L,q;for(ts(j),m&&clearTimeout(m),m=setTimeout(function(){m=null},u),L=0;L<A;++L)q=T[L],R.touch0&&R.touch0[2]===q.identifier?delete R.touch0:R.touch1&&R.touch1[2]===q.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&(q=jt(q,this),Math.hypot(f[0]-q[0],f[1]-q[1])<S)){var F=ht(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return v.wheelDelta=function(j){return arguments.length?(r=typeof j=="function"?j:kr(+j),v):r},v.filter=function(j){return arguments.length?(e=typeof j=="function"?j:kr(!!j),v):e},v.touchable=function(j){return arguments.length?(i=typeof j=="function"?j:kr(!!j),v):i},v.extent=function(j){return arguments.length?(n=typeof j=="function"?j:kr([[+j[0][0],+j[0][1]],[+j[1][0],+j[1][1]]]),v):n},v.scaleExtent=function(j){return arguments.length?(o[0]=+j[0],o[1]=+j[1],v):[o[0],o[1]]},v.translateExtent=function(j){return arguments.length?(a[0][0]=+j[0][0],a[1][0]=+j[1][0],a[0][1]=+j[0][1],a[1][1]=+j[1][1],v):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},v.constrain=function(j){return arguments.length?(s=j,v):s},v.duration=function(j){return arguments.length?(l=+j,v):l},v.interpolate=function(j){return arguments.length?(c=j,v):c},v.on=function(){var j=d.on.apply(d,arguments);return j===d?v:j},v.clickDistance=function(j){return arguments.length?(E=(j=+j)*j,v):Math.sqrt(E)},v.tapDistance=function(j){return arguments.length?(S=+j,v):S},v}function Ze(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let s=0,r;s<e.length;s++)(r=Ze(e[s]))!==""&&(n+=(n&&" ")+r);else for(let s in e)e[s]&&(n+=(n&&" ")+s);return n}const Dt={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:n,sourceHandle:s,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?s:r}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Kn=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Aa=["Enter"," ","Escape"],La={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:n,y:s})=>`Moved selected node ${e}. New position, x: ${n}, y: ${s}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Rn;(function(e){e.Strict="strict",e.Loose="loose"})(Rn||(Rn={}));var un;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(un||(un={}));var Qn;(function(e){e.Partial="partial",e.Full="full"})(Qn||(Qn={}));const Da={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Kt;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Kt||(Kt={}));var _n;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(_n||(_n={}));var ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ye||(ye={}));const uo={[ye.Left]:ye.Right,[ye.Right]:ye.Left,[ye.Top]:ye.Bottom,[ye.Bottom]:ye.Top};function Pa(e){return e===null?null:e?"valid":"invalid"}const $a=e=>"id"in e&&"source"in e&&"target"in e,Bl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),js=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),sr=(e,n=[0,0])=>{const{width:s,height:r}=Ft(e),i=e.origin??n,o=s*i[0],a=r*i[1];return{x:e.position.x-o,y:e.position.y-a}},Ol=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const s=e.reduce((r,i)=>{const o=typeof i=="string";let a=!n.nodeLookup&&!o?i:void 0;n.nodeLookup&&(a=o?n.nodeLookup.get(i):js(i)?i:n.nodeLookup.get(i.id));const l=a?Lr(a,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Br(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Or(s)},or=(e,n={})=>{let s={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(n.filter===void 0||n.filter(i))&&(s=Br(s,Lr(i)),r=!0)}),r?Or(s):{x:0,y:0,width:0,height:0}},Ns=(e,n,[s,r,i]=[0,0,1],o=!1,a=!1)=>{const l={...ir(n,[s,r,i]),width:n.width/i,height:n.height/i},c=[];for(const d of e.values()){const{measured:h,selectable:f=!0,hidden:m=!1}=d;if(a&&!f||m)continue;const u=h.width??d.width??d.initialWidth??null,x=h.height??d.height??d.initialHeight??null,E=Jn(l,Ln(d)),S=(u??0)*(x??0),v=o&&E>0;(!d.internals.handleBounds||v||E>=S||d.dragging)&&c.push(d)}return c},zl=(e,n)=>{const s=new Set;return e.forEach(r=>{s.add(r.id)}),n.filter(r=>s.has(r.source)||s.has(r.target))};function Hl(e,n){const s=new Map,r=n?.nodes?new Set(n.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&(n?.includeHiddenNodes||!i.hidden)&&(!r||r.has(i.id))&&s.set(i.id,i)}),s}async function ql({nodes:e,width:n,height:s,panZoom:r,minZoom:i,maxZoom:o},a){if(e.size===0)return Promise.resolve(!0);const l=Hl(e,a),c=or(l),d=Cs(c,n,s,a?.minZoom??i,a?.maxZoom??o,a?.padding??.1);return await r.setViewport(d,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function Ba({nodeId:e,nextPosition:n,nodeLookup:s,nodeOrigin:r=[0,0],nodeExtent:i,onError:o}){const a=s.get(e),l=a.parentId?s.get(a.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},h=a.origin??r;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)o?.("005",Dt.error005());else{const u=l.measured.width,x=l.measured.height;u&&x&&(f=[[c,d],[c+u,d+x]])}else l&&Dn(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+d],[a.extent[1][0]+c,a.extent[1][1]+d]]);const m=Dn(f)?fn(n,f,a.measured):n;return(a.measured.width===void 0||a.measured.height===void 0)&&o?.("015",Dt.error015()),{position:{x:m.x-c+(a.measured.width??0)*h[0],y:m.y-d+(a.measured.height??0)*h[1]},positionAbsolute:m}}async function Vl({nodesToRemove:e=[],edgesToRemove:n=[],nodes:s,edges:r,onBeforeDelete:i}){const o=new Set(e.map(m=>m.id)),a=[];for(const m of s){if(m.deletable===!1)continue;const u=o.has(m.id),x=!u&&m.parentId&&a.find(E=>E.id===m.parentId);(u||x)&&a.push(m)}const l=new Set(n.map(m=>m.id)),c=r.filter(m=>m.deletable!==!1),h=zl(a,c);for(const m of c)l.has(m.id)&&!h.find(x=>x.id===m.id)&&h.push(m);if(!i)return{edges:h,nodes:a};const f=await i({nodes:a,edges:h});return typeof f=="boolean"?f?{edges:h,nodes:a}:{edges:[],nodes:[]}:f}const An=(e,n=0,s=1)=>Math.min(Math.max(e,n),s),fn=(e={x:0,y:0},n,s)=>({x:An(e.x,n[0][0],n[1][0]-(s?.width??0)),y:An(e.y,n[0][1],n[1][1]-(s?.height??0))});function Oa(e,n,s){const{width:r,height:i}=Ft(s),{x:o,y:a}=s.internals.positionAbsolute;return fn(e,[[o,a],[o+r,a+i]],n)}const fo=(e,n,s)=>e<n?An(Math.abs(e-n),1,n)/n:e>s?-An(Math.abs(e-s),1,n)/n:0,za=(e,n,s=15,r=40)=>{const i=fo(e.x,r,n.width-r)*s,o=fo(e.y,r,n.height-r)*s;return[i,o]},Br=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),hs=({x:e,y:n,width:s,height:r})=>({x:e,y:n,x2:e+s,y2:n+r}),Or=({x:e,y:n,x2:s,y2:r})=>({x:e,y:n,width:s-e,height:r-n}),Ln=(e,n=[0,0])=>{const{x:s,y:r}=js(e)?e.internals.positionAbsolute:sr(e,n);return{x:s,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Lr=(e,n=[0,0])=>{const{x:s,y:r}=js(e)?e.internals.positionAbsolute:sr(e,n);return{x:s,y:r,x2:s+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Ha=(e,n)=>Or(Br(hs(e),hs(n))),Jn=(e,n)=>{const s=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(s*r)},ho=e=>Nt(e.width)&&Nt(e.height)&&Nt(e.x)&&Nt(e.y),Nt=e=>!isNaN(e)&&isFinite(e),Wl=(e,n)=>{},ar=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),ir=({x:e,y:n},[s,r,i],o=!1,a=[1,1])=>{const l={x:(e-s)/i,y:(n-r)/i};return o?ar(l,a):l},Dr=({x:e,y:n},[s,r,i])=>({x:e*i+s,y:n*i+r});function Cn(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const s=parseFloat(e);if(!Number.isNaN(s))return Math.floor(s)}if(typeof e=="string"&&e.endsWith("%")){const s=parseFloat(e);if(!Number.isNaN(s))return Math.floor(n*s*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Fl(e,n,s){if(typeof e=="string"||typeof e=="number"){const r=Cn(e,s),i=Cn(e,n);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=Cn(e.top??e.y??0,s),i=Cn(e.bottom??e.y??0,s),o=Cn(e.left??e.x??0,n),a=Cn(e.right??e.x??0,n);return{top:r,right:a,bottom:i,left:o,x:o+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Yl(e,n,s,r,i,o){const{x:a,y:l}=Dr(e,[n,s,r]),{x:c,y:d}=Dr({x:e.x+e.width,y:e.y+e.height},[n,s,r]),h=i-c,f=o-d;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(h),bottom:Math.floor(f)}}const Cs=(e,n,s,r,i,o)=>{const a=Fl(o,n,s),l=(n-a.x)/e.width,c=(s-a.y)/e.height,d=Math.min(l,c),h=An(d,r,i),f=e.x+e.width/2,m=e.y+e.height/2,u=n/2-f*h,x=s/2-m*h,E=Yl(e,u,x,h,n,s),S={left:Math.min(E.left-a.left,0),top:Math.min(E.top-a.top,0),right:Math.min(E.right-a.right,0),bottom:Math.min(E.bottom-a.bottom,0)};return{x:u-S.left+S.right,y:x-S.top+S.bottom,zoom:h}},er=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Dn(e){return e!=null&&e!=="parent"}function Ft(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function qa(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Va(e,n={width:0,height:0},s,r,i){const o={...e},a=r.get(s);if(a){const l=a.origin||i;o.x+=a.internals.positionAbsolute.x-(n.width??0)*l[0],o.y+=a.internals.positionAbsolute.y-(n.height??0)*l[1]}return o}function mo(e,n){if(e.size!==n.size)return!1;for(const s of e)if(!n.has(s))return!1;return!0}function Gl(){let e,n;return{promise:new Promise((r,i)=>{e=r,n=i}),resolve:e,reject:n}}function Zl(e){return{...La,...e||{}}}function Gn(e,{snapGrid:n=[0,0],snapToGrid:s=!1,transform:r,containerBounds:i}){const{x:o,y:a}=Ct(e),l=ir({x:o-(i?.left??0),y:a-(i?.top??0)},r),{x:c,y:d}=s?ar(l,n):l;return{xSnapped:c,ySnapped:d,...l}}const Ss=e=>({width:e.offsetWidth,height:e.offsetHeight}),Wa=e=>e?.getRootNode?.()||window?.document,Xl=["INPUT","SELECT","TEXTAREA"];function Fa(e){const n=e.composedPath?.()?.[0]||e.target;return n?.nodeType!==1?!1:Xl.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const Ya=e=>"clientX"in e,Ct=(e,n)=>{const s=Ya(e),r=s?e.clientX:e.touches?.[0].clientX,i=s?e.clientY:e.touches?.[0].clientY;return{x:r-(n?.left??0),y:i-(n?.top??0)}},go=(e,n,s,r,i)=>{const o=n.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-s.left)/r,y:(l.top-s.top)/r,...Ss(a)}})};function Ga({sourceX:e,sourceY:n,targetX:s,targetY:r,sourceControlX:i,sourceControlY:o,targetControlX:a,targetControlY:l}){const c=e*.125+i*.375+a*.375+s*.125,d=n*.125+o*.375+l*.375+r*.125,h=Math.abs(c-e),f=Math.abs(d-n);return[c,d,h,f]}function jr(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function po({pos:e,x1:n,y1:s,x2:r,y2:i,c:o}){switch(e){case ye.Left:return[n-jr(n-r,o),s];case ye.Right:return[n+jr(r-n,o),s];case ye.Top:return[n,s-jr(s-i,o)];case ye.Bottom:return[n,s+jr(i-s,o)]}}function Za({sourceX:e,sourceY:n,sourcePosition:s=ye.Bottom,targetX:r,targetY:i,targetPosition:o=ye.Top,curvature:a=.25}){const[l,c]=po({pos:s,x1:e,y1:n,x2:r,y2:i,c:a}),[d,h]=po({pos:o,x1:r,y1:i,x2:e,y2:n,c:a}),[f,m,u,x]=Ga({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${e},${n} C${l},${c} ${d},${h} ${r},${i}`,f,m,u,x]}function Xa({sourceX:e,sourceY:n,targetX:s,targetY:r}){const i=Math.abs(s-e)/2,o=s<e?s+i:s-i,a=Math.abs(r-n)/2,l=r<n?r+a:r-a;return[o,l,i,a]}function Ul({sourceNode:e,targetNode:n,selected:s=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:o="basic"}){if(o==="manual")return r;const a=i&&s?r+1e3:r,l=Math.max(e.parentId||i&&e.selected?e.internals.z:0,n.parentId||i&&n.selected?n.internals.z:0);return a+l}function Kl({sourceNode:e,targetNode:n,width:s,height:r,transform:i}){const o=Br(Lr(e),Lr(n));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const a={x:-i[0]/i[2],y:-i[1]/i[2],width:s/i[2],height:r/i[2]};return Jn(a,Or(o))>0}const Ql=({source:e,sourceHandle:n,target:s,targetHandle:r})=>`xy-edge__${e}${n||""}-${s}${r||""}`,Jl=(e,n)=>n.some(s=>s.source===e.source&&s.target===e.target&&(s.sourceHandle===e.sourceHandle||!s.sourceHandle&&!e.sourceHandle)&&(s.targetHandle===e.targetHandle||!s.targetHandle&&!e.targetHandle)),ec=(e,n,s={})=>{if(!e.source||!e.target)return n;const r=s.getEdgeId||Ql;let i;return $a(e)?i={...e}:i={...e,id:r(e)},Jl(i,n)?n:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,n.concat(i))};function Ua({sourceX:e,sourceY:n,targetX:s,targetY:r}){const[i,o,a,l]=Xa({sourceX:e,sourceY:n,targetX:s,targetY:r});return[`M ${e},${n}L ${s},${r}`,i,o,a,l]}const xo={[ye.Left]:{x:-1,y:0},[ye.Right]:{x:1,y:0},[ye.Top]:{x:0,y:-1},[ye.Bottom]:{x:0,y:1}},tc=({source:e,sourcePosition:n=ye.Bottom,target:s})=>n===ye.Left||n===ye.Right?e.x<s.x?{x:1,y:0}:{x:-1,y:0}:e.y<s.y?{x:0,y:1}:{x:0,y:-1},bo=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function nc({source:e,sourcePosition:n=ye.Bottom,target:s,targetPosition:r=ye.Top,center:i,offset:o,stepPosition:a}){const l=xo[n],c=xo[r],d={x:e.x+l.x*o,y:e.y+l.y*o},h={x:s.x+c.x*o,y:s.y+c.y*o},f=tc({source:d,sourcePosition:n,target:h}),m=f.x!==0?"x":"y",u=f[m];let x=[],E,S;const v={x:0,y:0},y={x:0,y:0},[,,p,b]=Xa({sourceX:e.x,sourceY:e.y,targetX:s.x,targetY:s.y});if(l[m]*c[m]===-1){m==="x"?(E=i.x??d.x+(h.x-d.x)*a,S=i.y??(d.y+h.y)/2):(E=i.x??(d.x+h.x)/2,S=i.y??d.y+(h.y-d.y)*a);const w=[{x:E,y:d.y},{x:E,y:h.y}],M=[{x:d.x,y:S},{x:h.x,y:S}];l[m]===u?x=m==="x"?w:M:x=m==="x"?M:w}else{const w=[{x:d.x,y:h.y}],M=[{x:h.x,y:d.y}];if(m==="x"?x=l.x===u?M:w:x=l.y===u?w:M,n===r){const $=Math.abs(e[m]-s[m]);if($<=o){const z=Math.min(o-1,o-$);l[m]===u?v[m]=(d[m]>e[m]?-1:1)*z:y[m]=(h[m]>s[m]?-1:1)*z}}if(n!==r){const $=m==="x"?"y":"x",z=l[m]===c[$],j=d[$]>h[$],B=d[$]<h[$];(l[m]===1&&(!z&&j||z&&B)||l[m]!==1&&(!z&&B||z&&j))&&(x=m==="x"?w:M)}const D={x:d.x+v.x,y:d.y+v.y},P={x:h.x+y.x,y:h.y+y.y},_=Math.max(Math.abs(D.x-x[0].x),Math.abs(P.x-x[0].x)),C=Math.max(Math.abs(D.y-x[0].y),Math.abs(P.y-x[0].y));_>=C?(E=(D.x+P.x)/2,S=x[0].y):(E=x[0].x,S=(D.y+P.y)/2)}return[[e,{x:d.x+v.x,y:d.y+v.y},...x,{x:h.x+y.x,y:h.y+y.y},s],E,S,p,b]}function rc(e,n,s,r){const i=Math.min(bo(e,n)/2,bo(n,s)/2,r),{x:o,y:a}=n;if(e.x===o&&o===s.x||e.y===a&&a===s.y)return`L${o} ${a}`;if(e.y===a){const d=e.x<s.x?-1:1,h=e.y<s.y?1:-1;return`L ${o+i*d},${a}Q ${o},${a} ${o},${a+i*h}`}const l=e.x<s.x?1:-1,c=e.y<s.y?-1:1;return`L ${o},${a+i*c}Q ${o},${a} ${o+i*l},${a}`}function ms({sourceX:e,sourceY:n,sourcePosition:s=ye.Bottom,targetX:r,targetY:i,targetPosition:o=ye.Top,borderRadius:a=5,centerX:l,centerY:c,offset:d=20,stepPosition:h=.5}){const[f,m,u,x,E]=nc({source:{x:e,y:n},sourcePosition:s,target:{x:r,y:i},targetPosition:o,center:{x:l,y:c},offset:d,stepPosition:h});return[f.reduce((v,y,p)=>{let b="";return p>0&&p<f.length-1?b=rc(f[p-1],y,f[p+1],a):b=`${p===0?"M":"L"}${y.x} ${y.y}`,v+=b,v},""),m,u,x,E]}function yo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function sc(e){const{sourceNode:n,targetNode:s}=e;if(!yo(n)||!yo(s))return null;const r=n.internals.handleBounds||vo(n.handles),i=s.internals.handleBounds||vo(s.handles),o=wo(r?.source??[],e.sourceHandle),a=wo(e.connectionMode===Rn.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!o||!a)return e.onError?.("008",Dt.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=o?.position||ye.Bottom,c=a?.position||ye.Top,d=hn(n,o,l),h=hn(s,a,c);return{sourceX:d.x,sourceY:d.y,targetX:h.x,targetY:h.y,sourcePosition:l,targetPosition:c}}function vo(e){if(!e)return null;const n=[],s=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?n.push(r):r.type==="target"&&s.push(r);return{source:n,target:s}}function hn(e,n,s=ye.Left,r=!1){const i=(n?.x??0)+e.internals.positionAbsolute.x,o=(n?.y??0)+e.internals.positionAbsolute.y,{width:a,height:l}=n??Ft(e);if(r)return{x:i+a/2,y:o+l/2};switch(n?.position??s){case ye.Top:return{x:i+a/2,y:o};case ye.Right:return{x:i+a,y:o+l/2};case ye.Bottom:return{x:i+a/2,y:o+l};case ye.Left:return{x:i,y:o+l/2}}}function wo(e,n){return e&&(n?e.find(s=>s.id===n):e[0])||null}function gs(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function oc(e,{id:n,defaultColor:s,defaultMarkerStart:r,defaultMarkerEnd:i}){const o=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const d=gs(c,n);o.has(d)||(a.push({id:d,color:c.color||s,...c}),o.add(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const Ka=1e3,ac=10,Es={nodeOrigin:[0,0],nodeExtent:Kn,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ic={...Es,checkEquality:!0};function Ms(e,n){const s={...e};for(const r in n)n[r]!==void 0&&(s[r]=n[r]);return s}function lc(e,n,s){const r=Ms(Es,s);for(const i of e.values())if(i.parentId)Ts(i,e,n,r);else{const o=sr(i,r.nodeOrigin),a=Dn(i.extent)?i.extent:r.nodeExtent,l=fn(o,a,Ft(i));i.internals.positionAbsolute=l}}function cc(e,n){if(!e.handles)return e.measured?n?.internals.handleBounds:void 0;const s=[],r=[];for(const i of e.handles){const o={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?s.push(o):i.type==="target"&&r.push(o)}return{source:s,target:r}}function Is(e){return e==="manual"}function ps(e,n,s,r={}){const i=Ms(ic,r),o={i:0},a=new Map(n),l=i?.elevateNodesOnSelect&&!Is(i.zIndexMode)?Ka:0;let c=e.length>0;n.clear(),s.clear();for(const d of e){let h=a.get(d.id);if(i.checkEquality&&d===h?.internals.userNode)n.set(d.id,h);else{const f=sr(d,i.nodeOrigin),m=Dn(d.extent)?d.extent:i.nodeExtent,u=fn(f,m,Ft(d));h={...i.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:u,handleBounds:cc(d,h),z:Qa(d,l,i.zIndexMode),userNode:d}},n.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&Ts(h,n,s,r,o)}return c}function dc(e,n){if(!e.parentId)return;const s=n.get(e.parentId);s?s.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function Ts(e,n,s,r,i){const{elevateNodesOnSelect:o,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Ms(Es,r),d=e.parentId,h=n.get(d);if(!h){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}dc(e,s),i&&!h.parentId&&h.internals.rootParentIndex===void 0&&c==="auto"&&(h.internals.rootParentIndex=++i.i,h.internals.z=h.internals.z+i.i*ac),i&&h.internals.rootParentIndex!==void 0&&(i.i=h.internals.rootParentIndex);const f=o&&!Is(c)?Ka:0,{x:m,y:u,z:x}=uc(e,h,a,l,f,c),{positionAbsolute:E}=e.internals,S=m!==E.x||u!==E.y;(S||x!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x:m,y:u}:E,z:x}})}function Qa(e,n,s){const r=Nt(e.zIndex)?e.zIndex:0;return Is(s)?r:r+(e.selected?n:0)}function uc(e,n,s,r,i,o){const{x:a,y:l}=n.internals.positionAbsolute,c=Ft(e),d=sr(e,s),h=Dn(e.extent)?fn(d,e.extent,c):d;let f=fn({x:a+h.x,y:l+h.y},r,c);e.extent==="parent"&&(f=Oa(f,c,n));const m=Qa(e,i,o),u=n.internals.z??0;return{x:f.x,y:f.y,z:u>=m?u+1:m}}function Rs(e,n,s,r=[0,0]){const i=[],o=new Map;for(const a of e){const l=n.get(a.parentId);if(!l)continue;const c=o.get(a.parentId)?.expandedRect??Ln(l),d=Ha(c,a.rect);o.set(a.parentId,{expandedRect:d,parent:l})}return o.size>0&&o.forEach(({expandedRect:a,parent:l},c)=>{const d=l.internals.positionAbsolute,h=Ft(l),f=l.origin??r,m=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,u=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,x=Math.max(h.width,Math.round(a.width)),E=Math.max(h.height,Math.round(a.height)),S=(x-h.width)*f[0],v=(E-h.height)*f[1];(m>0||u>0||S||v)&&(i.push({id:c,type:"position",position:{x:l.position.x-m+S,y:l.position.y-u+v}}),s.get(c)?.forEach(y=>{e.some(p=>p.id===y.id)||i.push({id:y.id,type:"position",position:{x:y.position.x+m,y:y.position.y+u}})})),(h.width<a.width||h.height<a.height||m||u)&&i.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:x+(m?f[0]*m-S:0),height:E+(u?f[1]*u-v:0)}})}),i}function fc(e,n,s,r,i,o,a){const l=r?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],h=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(h.transform),m=[];for(const u of e.values()){const x=n.get(u.id);if(!x)continue;if(x.hidden){n.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),c=!0;continue}const E=Ss(u.nodeElement),S=x.measured.width!==E.width||x.measured.height!==E.height;if(!!(E.width&&E.height&&(S||!x.internals.handleBounds||u.force))){const y=u.nodeElement.getBoundingClientRect(),p=Dn(x.extent)?x.extent:o;let{positionAbsolute:b}=x.internals;x.parentId&&x.extent==="parent"?b=Oa(b,E,n.get(x.parentId)):p&&(b=fn(b,p,E));const N={...x,measured:E,internals:{...x.internals,positionAbsolute:b,handleBounds:{source:go("source",u.nodeElement,y,f,x.id),target:go("target",u.nodeElement,y,f,x.id)}}};n.set(x.id,N),x.parentId&&Ts(N,n,s,{nodeOrigin:i,zIndexMode:a}),c=!0,S&&(d.push({id:x.id,type:"dimensions",dimensions:E}),x.expandParent&&x.parentId&&m.push({id:x.id,parentId:x.parentId,rect:Ln(N,i)}))}}if(m.length>0){const u=Rs(m,n,s,i);d.push(...u)}return{changes:d,updatedInternals:c}}async function hc({delta:e,panZoom:n,transform:s,translateExtent:r,width:i,height:o}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const a=await n.setViewportConstrained({x:s[0]+e.x,y:s[1]+e.y,zoom:s[2]},[[0,0],[i,o]],r),l=!!a&&(a.x!==s[0]||a.y!==s[1]||a.k!==s[2]);return Promise.resolve(l)}function ko(e,n,s,r,i,o){let a=i;const l=r.get(a)||new Map;r.set(a,l.set(s,n)),a=`${i}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(s,n)),o){a=`${i}-${e}-${o}`;const d=r.get(a)||new Map;r.set(a,d.set(s,n))}}function Ja(e,n,s){e.clear(),n.clear();for(const r of s){const{source:i,target:o,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:o,sourceHandle:a,targetHandle:l},d=`${i}-${a}--${o}-${l}`,h=`${o}-${l}--${i}-${a}`;ko("source",c,h,e,i,a),ko("target",c,d,e,o,l),n.set(r.id,r)}}function ei(e,n){if(!e.parentId)return!1;const s=n.get(e.parentId);return s?s.selected?!0:ei(s,n):!1}function jo(e,n,s){let r=e;do{if(r?.matches?.(n))return!0;if(r===s)return!1;r=r?.parentElement}while(r);return!1}function mc(e,n,s,r){const i=new Map;for(const[o,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!ei(a,e))&&(a.draggable||n&&typeof a.draggable>"u")){const l=e.get(o);l&&i.set(o,{id:o,position:l.position||{x:0,y:0},distance:{x:s.x-l.internals.positionAbsolute.x,y:s.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function ns({nodeId:e,dragItems:n,nodeLookup:s,dragging:r=!0}){const i=[];for(const[a,l]of n){const c=s.get(a)?.internals.userNode;c&&i.push({...c,position:l.position,dragging:r})}if(!e)return[i[0],i];const o=s.get(e)?.internals.userNode;return[o?{...o,position:n.get(e)?.position||o.position,dragging:r}:i[0],i]}function gc({dragItems:e,snapGrid:n,x:s,y:r}){const i=e.values().next().value;if(!i)return null;const o={x:s-i.distance.x,y:r-i.distance.y},a=ar(o,n);return{x:a.x-o.x,y:a.y-o.y}}function pc({onNodeMouseDown:e,getStoreItems:n,onDragStart:s,onDrag:r,onDragStop:i}){let o={x:null,y:null},a=0,l=new Map,c=!1,d={x:0,y:0},h=null,f=!1,m=null,u=!1,x=!1,E=null;function S({noDragClassName:y,handleSelector:p,domNode:b,isSelectable:N,nodeId:w,nodeClickDistance:M=0}){m=ht(b);function D({x:$,y:z}){const{nodeLookup:j,nodeExtent:B,snapGrid:R,snapToGrid:T,nodeOrigin:A,onNodeDrag:L,onSelectionDrag:q,onError:F,updateNodePositions:Y}=n();o={x:$,y:z};let Q=!1;const O=l.size>1,I=O&&B?hs(or(l)):null,H=O&&T?gc({dragItems:l,snapGrid:R,x:$,y:z}):null;for(const[V,W]of l){if(!j.has(V))continue;let X={x:$-W.distance.x,y:z-W.distance.y};T&&(X=H?{x:Math.round(X.x+H.x),y:Math.round(X.y+H.y)}:ar(X,R));let ee=null;if(O&&B&&!W.extent&&I){const{positionAbsolute:U}=W.internals,oe=U.x-I.x+B[0][0],le=U.x+W.measured.width-I.x2+B[1][0],ie=U.y-I.y+B[0][1],he=U.y+W.measured.height-I.y2+B[1][1];ee=[[oe,ie],[le,he]]}const{position:se,positionAbsolute:J}=Ba({nodeId:V,nextPosition:X,nodeLookup:j,nodeExtent:ee||B,nodeOrigin:A,onError:F});Q=Q||W.position.x!==se.x||W.position.y!==se.y,W.position=se,W.internals.positionAbsolute=J}if(x=x||Q,!!Q&&(Y(l,!0),E&&(r||L||!w&&q))){const[V,W]=ns({nodeId:w,dragItems:l,nodeLookup:j});r?.(E,l,V,W),L?.(E,V,W),w||q?.(E,W)}}async function P(){if(!h)return;const{transform:$,panBy:z,autoPanSpeed:j,autoPanOnNodeDrag:B}=n();if(!B){c=!1,cancelAnimationFrame(a);return}const[R,T]=za(d,h,j);(R!==0||T!==0)&&(o.x=(o.x??0)-R/$[2],o.y=(o.y??0)-T/$[2],await z({x:R,y:T})&&D(o)),a=requestAnimationFrame(P)}function _($){const{nodeLookup:z,multiSelectionActive:j,nodesDraggable:B,transform:R,snapGrid:T,snapToGrid:A,selectNodesOnDrag:L,onNodeDragStart:q,onSelectionDragStart:F,unselectNodesAndEdges:Y}=n();f=!0,(!L||!N)&&!j&&w&&(z.get(w)?.selected||Y()),N&&L&&w&&e?.(w);const Q=Gn($.sourceEvent,{transform:R,snapGrid:T,snapToGrid:A,containerBounds:h});if(o=Q,l=mc(z,B,Q,w),l.size>0&&(s||q||!w&&F)){const[O,I]=ns({nodeId:w,dragItems:l,nodeLookup:z});s?.($.sourceEvent,l,O,I),q?.($.sourceEvent,O,I),w||F?.($.sourceEvent,I)}}const C=Ra().clickDistance(M).on("start",$=>{const{domNode:z,nodeDragThreshold:j,transform:B,snapGrid:R,snapToGrid:T}=n();h=z?.getBoundingClientRect()||null,u=!1,x=!1,E=$.sourceEvent,j===0&&_($),o=Gn($.sourceEvent,{transform:B,snapGrid:R,snapToGrid:T,containerBounds:h}),d=Ct($.sourceEvent,h)}).on("drag",$=>{const{autoPanOnNodeDrag:z,transform:j,snapGrid:B,snapToGrid:R,nodeDragThreshold:T,nodeLookup:A}=n(),L=Gn($.sourceEvent,{transform:j,snapGrid:B,snapToGrid:R,containerBounds:h});if(E=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||w&&!A.has(w))&&(u=!0),!u){if(!c&&z&&f&&(c=!0,P()),!f){const q=Ct($.sourceEvent,h),F=q.x-d.x,Y=q.y-d.y;Math.sqrt(F*F+Y*Y)>T&&_($)}(o.x!==L.xSnapped||o.y!==L.ySnapped)&&l&&f&&(d=Ct($.sourceEvent,h),D(L))}}).on("end",$=>{if(!(!f||u)&&(c=!1,f=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:z,updateNodePositions:j,onNodeDragStop:B,onSelectionDragStop:R}=n();if(x&&(j(l,!1),x=!1),i||B||!w&&R){const[T,A]=ns({nodeId:w,dragItems:l,nodeLookup:z,dragging:!1});i?.($.sourceEvent,l,T,A),B?.($.sourceEvent,T,A),w||R?.($.sourceEvent,A)}}}).filter($=>{const z=$.target;return!$.button&&(!y||!jo(z,`.${y}`,b))&&(!p||jo(z,p,b))});m.call(C)}function v(){m?.on(".drag",null)}return{update:S,destroy:v}}function xc(e,n,s){const r=[],i={x:e.x-s,y:e.y-s,width:s*2,height:s*2};for(const o of n.values())Jn(i,Ln(o))>0&&r.push(o);return r}const bc=250;function yc(e,n,s,r){let i=[],o=1/0;const a=xc(e,s,n+bc);for(const l of a){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const d of c){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:h,y:f}=hn(l,d,d.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(f-e.y,2));m>n||(m<o?(i=[{...d,x:h,y:f}],o=m):m===o&&i.push({...d,x:h,y:f}))}}if(!i.length)return null;if(i.length>1){const l=r.type==="source"?"target":"source";return i.find(c=>c.type===l)??i[0]}return i[0]}function ti(e,n,s,r,i,o=!1){const a=r.get(e);if(!a)return null;const l=i==="strict"?a.internals.handleBounds?.[n]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],c=(s?l?.find(d=>d.id===s):l?.[0])??null;return c&&o?{...c,...hn(a,c,c.position,!0)}:c}function ni(e,n){return e||(n?.classList.contains("target")?"target":n?.classList.contains("source")?"source":null)}function vc(e,n){let s=null;return n?s=!0:e&&!n&&(s=!1),s}const ri=()=>!0;function wc(e,{connectionMode:n,connectionRadius:s,handleId:r,nodeId:i,edgeUpdaterType:o,isTarget:a,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:h,flowId:f,panBy:m,cancelConnection:u,onConnectStart:x,onConnect:E,onConnectEnd:S,isValidConnection:v=ri,onReconnectEnd:y,updateConnection:p,getTransform:b,getFromHandle:N,autoPanSpeed:w,dragThreshold:M=1,handleDomNode:D}){const P=Wa(e.target);let _=0,C;const{x:$,y:z}=Ct(e),j=ni(o,D),B=l?.getBoundingClientRect();let R=!1;if(!B||!j)return;const T=ti(i,j,r,c,n);if(!T)return;let A=Ct(e,B),L=!1,q=null,F=!1,Y=null;function Q(){if(!h||!B)return;const[se,J]=za(A,B,w);m({x:se,y:J}),_=requestAnimationFrame(Q)}const O={...T,nodeId:i,type:j,position:T.position},I=c.get(i);let V={inProgress:!0,isValid:null,from:hn(I,O,ye.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:I,to:A,toHandle:null,toPosition:uo[O.position],toNode:null,pointer:A};function W(){R=!0,p(V),x?.(e,{nodeId:i,handleId:r,handleType:j})}M===0&&W();function X(se){if(!R){const{x:he,y:de}=Ct(se),Z=he-$,ae=de-z;if(!(Z*Z+ae*ae>M*M))return;W()}if(!N()||!O){ee(se);return}const J=b();A=Ct(se,B),C=yc(ir(A,J,!1,[1,1]),s,c,O),L||(Q(),L=!0);const U=si(se,{handle:C,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:v,doc:P,lib:d,flowId:f,nodeLookup:c});Y=U.handleDomNode,q=U.connection,F=vc(!!C,U.isValid);const oe=c.get(i),le=oe?hn(oe,O,ye.Left,!0):V.from,ie={...V,from:le,isValid:F,to:U.toHandle&&F?Dr({x:U.toHandle.x,y:U.toHandle.y},J):A,toHandle:U.toHandle,toPosition:F&&U.toHandle?U.toHandle.position:uo[O.position],toNode:U.toHandle?c.get(U.toHandle.nodeId):null,pointer:A};p(ie),V=ie}function ee(se){if(!("touches"in se&&se.touches.length>0)){if(R){(C||Y)&&q&&F&&E?.(q);const{inProgress:J,...U}=V,oe={...U,toPosition:V.toHandle?V.toPosition:null};S?.(se,oe),o&&y?.(se,oe)}u(),cancelAnimationFrame(_),L=!1,F=!1,q=null,Y=null,P.removeEventListener("mousemove",X),P.removeEventListener("mouseup",ee),P.removeEventListener("touchmove",X),P.removeEventListener("touchend",ee)}}P.addEventListener("mousemove",X),P.addEventListener("mouseup",ee),P.addEventListener("touchmove",X),P.addEventListener("touchend",ee)}function si(e,{handle:n,connectionMode:s,fromNodeId:r,fromHandleId:i,fromType:o,doc:a,lib:l,flowId:c,isValidConnection:d=ri,nodeLookup:h}){const f=o==="target",m=n?a.querySelector(`.${l}-flow__handle[data-id="${c}-${n?.nodeId}-${n?.id}-${n?.type}"]`):null,{x:u,y:x}=Ct(e),E=a.elementFromPoint(u,x),S=E?.classList.contains(`${l}-flow__handle`)?E:m,v={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const y=ni(void 0,S),p=S.getAttribute("data-nodeid"),b=S.getAttribute("data-handleid"),N=S.classList.contains("connectable"),w=S.classList.contains("connectableend");if(!p||!y)return v;const M={source:f?p:r,sourceHandle:f?b:i,target:f?r:p,targetHandle:f?i:b};v.connection=M;const P=N&&w&&(s===Rn.Strict?f&&y==="source"||!f&&y==="target":p!==r||b!==i);v.isValid=P&&d(M),v.toHandle=ti(p,y,b,h,s,!0)}return v}const xs={onPointerDown:wc,isValid:si};function kc({domNode:e,panZoom:n,getTransform:s,getViewScale:r}){const i=ht(e);function o({translateExtent:l,width:c,height:d,zoomStep:h=1,pannable:f=!0,zoomable:m=!0,inversePan:u=!1}){const x=p=>{if(p.sourceEvent.type!=="wheel"||!n)return;const b=s(),N=p.sourceEvent.ctrlKey&&er()?10:1,w=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*h,M=b[2]*Math.pow(2,w*N);n.scaleTo(M)};let E=[0,0];const S=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(E=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},v=p=>{const b=s();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!n)return;const N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],w=[N[0]-E[0],N[1]-E[1]];E=N;const M=r()*Math.max(b[2],Math.log(b[2]))*(u?-1:1),D={x:b[0]-w[0]*M,y:b[1]-w[1]*M},P=[[0,0],[c,d]];n.setViewportConstrained({x:D.x,y:D.y,zoom:b[2]},P,l)},y=_a().on("start",S).on("zoom",f?v:null).on("zoom.wheel",m?x:null);i.call(y,{})}function a(){i.on("zoom",null)}return{update:o,destroy:a,pointer:jt}}const zr=e=>({x:e.x,y:e.y,zoom:e.k}),rs=({x:e,y:n,zoom:s})=>ks.translate(e,n).scale(s),En=(e,n)=>e.target.closest(`.${n}`),oi=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),jc=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ss=(e,n=0,s=jc,r=()=>{})=>{const i=typeof n=="number"&&n>0;return i||r(),i?e.transition().duration(n).ease(s).on("end",r):e},ai=e=>{const n=e.ctrlKey&&er()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function Nc({zoomPanValues:e,noWheelClassName:n,d3Selection:s,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:o,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return h=>{if(En(h,n))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const f=s.property("__zoom").k||1;if(h.ctrlKey&&a){const S=jt(h),v=ai(h),y=f*Math.pow(2,v);r.scaleTo(s,y,S,h);return}const m=h.deltaMode===1?20:1;let u=i===un.Vertical?0:h.deltaX*m,x=i===un.Horizontal?0:h.deltaY*m;!er()&&h.shiftKey&&i!==un.Vertical&&(u=h.deltaY*m,x=0),r.translateBy(s,-(u/f)*o,-(x/f)*o,{internal:!0});const E=zr(s.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(h,E),e.panScrollTimeout=setTimeout(()=>{d?.(h,E),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(h,E))}}function Cc({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:s}){return function(r,i){const o=r.type==="wheel",a=!n&&o&&!r.ctrlKey,l=En(r,e);if(r.ctrlKey&&o&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),s.call(this,r,i)}}function Sc({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:s}){return r=>{if(r.sourceEvent?.internal)return;const i=zr(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&n(!0),s&&s?.(r.sourceEvent,i)}}function Ec({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:s,onTransformChange:r,onPanZoom:i}){return o=>{e.usedRightMouseButton=!!(s&&oi(n,e.mouseButton??0)),o.sourceEvent?.sync||r([o.transform.x,o.transform.y,o.transform.k]),i&&!o.sourceEvent?.internal&&i?.(o.sourceEvent,zr(o.transform))}}function Mc({zoomPanValues:e,panOnDrag:n,panOnScroll:s,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:o}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,o&&oi(n,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&o(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const l=zr(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,l)},s?150:0)}}}function Ic({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:s,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:o,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:h}){return f=>{const m=e||n,u=s&&f.ctrlKey,x=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(En(f,`${d}-flow__node`)||En(f,`${d}-flow__edge`)))return!0;if(!r&&!m&&!i&&!o&&!s||a||h&&!x||En(f,l)&&x||En(f,c)&&(!x||i&&x&&!e)||!s&&f.ctrlKey&&x)return!1;if(!s&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!m&&!i&&!u&&x||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const E=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||x)&&E}}function Tc({domNode:e,minZoom:n,maxZoom:s,translateExtent:r,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),f=_a().scaleExtent([n,s]).translateExtent(r),m=ht(e).call(f);y({x:i.x,y:i.y,zoom:An(i.zoom,n,s)},[[0,0],[h.width,h.height]],r);const u=m.on("wheel.zoom"),x=m.on("dblclick.zoom");f.wheelDelta(ai);function E(C,$){return m?new Promise(z=>{f?.interpolate($?.interpolate==="linear"?Jr:Rr).transform(ss(m,$?.duration,$?.ease,()=>z(!0)),C)}):Promise.resolve(!1)}function S({noWheelClassName:C,noPanClassName:$,onPaneContextMenu:z,userSelectionActive:j,panOnScroll:B,panOnDrag:R,panOnScrollMode:T,panOnScrollSpeed:A,preventScrolling:L,zoomOnPinch:q,zoomOnScroll:F,zoomOnDoubleClick:Y,zoomActivationKeyPressed:Q,lib:O,onTransformChange:I,connectionInProgress:H,paneClickDistance:V,selectionOnDrag:W}){j&&!d.isZoomingOrPanning&&v();const X=B&&!Q&&!j;f.clickDistance(W?1/0:!Nt(V)||V<0?0:V);const ee=X?Nc({zoomPanValues:d,noWheelClassName:C,d3Selection:m,d3Zoom:f,panOnScrollMode:T,panOnScrollSpeed:A,zoomOnPinch:q,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:l}):Cc({noWheelClassName:C,preventScrolling:L,d3ZoomHandler:u});if(m.on("wheel.zoom",ee,{passive:!1}),!j){const J=Sc({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:a});f.on("start",J);const U=Ec({zoomPanValues:d,panOnDrag:R,onPaneContextMenu:!!z,onPanZoom:o,onTransformChange:I});f.on("zoom",U);const oe=Mc({zoomPanValues:d,panOnDrag:R,panOnScroll:B,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:c});f.on("end",oe)}const se=Ic({zoomActivationKeyPressed:Q,panOnDrag:R,zoomOnScroll:F,panOnScroll:B,zoomOnDoubleClick:Y,zoomOnPinch:q,userSelectionActive:j,noPanClassName:$,noWheelClassName:C,lib:O,connectionInProgress:H});f.filter(se),Y?m.on("dblclick.zoom",x):m.on("dblclick.zoom",null)}function v(){f.on("zoom",null)}async function y(C,$,z){const j=rs(C),B=f?.constrain()(j,$,z);return B&&await E(B),new Promise(R=>R(B))}async function p(C,$){const z=rs(C);return await E(z,$),new Promise(j=>j(z))}function b(C){if(m){const $=rs(C),z=m.property("__zoom");(z.k!==C.zoom||z.x!==C.x||z.y!==C.y)&&f?.transform(m,$,null,{sync:!0})}}function N(){const C=m?kl(m.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function w(C,$){return m?new Promise(z=>{f?.interpolate($?.interpolate==="linear"?Jr:Rr).scaleTo(ss(m,$?.duration,$?.ease,()=>z(!0)),C)}):Promise.resolve(!1)}function M(C,$){return m?new Promise(z=>{f?.interpolate($?.interpolate==="linear"?Jr:Rr).scaleBy(ss(m,$?.duration,$?.ease,()=>z(!0)),C)}):Promise.resolve(!1)}function D(C){f?.scaleExtent(C)}function P(C){f?.translateExtent(C)}function _(C){const $=!Nt(C)||C<0?0:C;f?.clickDistance($)}return{update:S,destroy:v,setViewport:p,setViewportConstrained:y,getViewport:N,scaleTo:w,scaleBy:M,setScaleExtent:D,setTranslateExtent:P,syncViewport:b,setClickDistance:_}}var Pn;(function(e){e.Line="line",e.Handle="handle"})(Pn||(Pn={}));function Rc({width:e,prevWidth:n,height:s,prevHeight:r,affectsX:i,affectsY:o}){const a=e-n,l=s-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&o&&(c[1]=c[1]*-1),c}function No(e){const n=e.includes("right")||e.includes("left"),s=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:n,isVertical:s,affectsX:r,affectsY:i}}function Xt(e,n){return Math.max(0,n-e)}function Ut(e,n){return Math.max(0,e-n)}function Nr(e,n,s){return Math.max(0,n-e,e-s)}function Co(e,n){return e?!n:n}function _c(e,n,s,r,i,o,a,l){let{affectsX:c,affectsY:d}=n;const{isHorizontal:h,isVertical:f}=n,m=h&&f,{xSnapped:u,ySnapped:x}=s,{minWidth:E,maxWidth:S,minHeight:v,maxHeight:y}=r,{x:p,y:b,width:N,height:w,aspectRatio:M}=e;let D=Math.floor(h?u-e.pointerX:0),P=Math.floor(f?x-e.pointerY:0);const _=N+(c?-D:D),C=w+(d?-P:P),$=-o[0]*N,z=-o[1]*w;let j=Nr(_,E,S),B=Nr(C,v,y);if(a){let A=0,L=0;c&&D<0?A=Xt(p+D+$,a[0][0]):!c&&D>0&&(A=Ut(p+_+$,a[1][0])),d&&P<0?L=Xt(b+P+z,a[0][1]):!d&&P>0&&(L=Ut(b+C+z,a[1][1])),j=Math.max(j,A),B=Math.max(B,L)}if(l){let A=0,L=0;c&&D>0?A=Ut(p+D,l[0][0]):!c&&D<0&&(A=Xt(p+_,l[1][0])),d&&P>0?L=Ut(b+P,l[0][1]):!d&&P<0&&(L=Xt(b+C,l[1][1])),j=Math.max(j,A),B=Math.max(B,L)}if(i){if(h){const A=Nr(_/M,v,y)*M;if(j=Math.max(j,A),a){let L=0;!c&&!d||c&&!d&&m?L=Ut(b+z+_/M,a[1][1])*M:L=Xt(b+z+(c?D:-D)/M,a[0][1])*M,j=Math.max(j,L)}if(l){let L=0;!c&&!d||c&&!d&&m?L=Xt(b+_/M,l[1][1])*M:L=Ut(b+(c?D:-D)/M,l[0][1])*M,j=Math.max(j,L)}}if(f){const A=Nr(C*M,E,S)/M;if(B=Math.max(B,A),a){let L=0;!c&&!d||d&&!c&&m?L=Ut(p+C*M+$,a[1][0])/M:L=Xt(p+(d?P:-P)*M+$,a[0][0])/M,B=Math.max(B,L)}if(l){let L=0;!c&&!d||d&&!c&&m?L=Xt(p+C*M,l[1][0])/M:L=Ut(p+(d?P:-P)*M,l[0][0])/M,B=Math.max(B,L)}}}P=P+(P<0?B:-B),D=D+(D<0?j:-j),i&&(m?_>C*M?P=(Co(c,d)?-D:D)/M:D=(Co(c,d)?-P:P)*M:h?(P=D/M,d=c):(D=P*M,c=d));const R=c?p+D:p,T=d?b+P:b;return{width:N+(c?-D:D),height:w+(d?-P:P),x:o[0]*D*(c?-1:1)+R,y:o[1]*P*(d?-1:1)+T}}const ii={width:0,height:0,x:0,y:0},Ac={...ii,pointerX:0,pointerY:0,aspectRatio:1};function Lc(e){return[[0,0],[e.measured.width,e.measured.height]]}function Dc(e,n,s){const r=n.position.x+e.position.x,i=n.position.y+e.position.y,o=e.measured.width??0,a=e.measured.height??0,l=s[0]*o,c=s[1]*a;return[[r-l,i-c],[r+o-l,i+a-c]]}function Pc({domNode:e,nodeId:n,getStoreItems:s,onChange:r,onEnd:i}){const o=ht(e);let a={controlDirection:No("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:h,keepAspectRatio:f,resizeDirection:m,onResizeStart:u,onResize:x,onResizeEnd:E,shouldResize:S}){let v={...ii},y={...Ac};a={boundaries:h,resizeDirection:m,keepAspectRatio:f,controlDirection:No(d)};let p,b=null,N=[],w,M,D,P=!1;const _=Ra().on("start",C=>{const{nodeLookup:$,transform:z,snapGrid:j,snapToGrid:B,nodeOrigin:R,paneDomNode:T}=s();if(p=$.get(n),!p)return;b=T?.getBoundingClientRect()??null;const{xSnapped:A,ySnapped:L}=Gn(C.sourceEvent,{transform:z,snapGrid:j,snapToGrid:B,containerBounds:b});v={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},y={...v,pointerX:A,pointerY:L,aspectRatio:v.width/v.height},w=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(w=$.get(p.parentId),M=w&&p.extent==="parent"?Lc(w):void 0),N=[],D=void 0;for(const[q,F]of $)if(F.parentId===n&&(N.push({id:q,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const Y=Dc(F,p,F.origin??R);D?D=[[Math.min(Y[0][0],D[0][0]),Math.min(Y[0][1],D[0][1])],[Math.max(Y[1][0],D[1][0]),Math.max(Y[1][1],D[1][1])]]:D=Y}u?.(C,{...v})}).on("drag",C=>{const{transform:$,snapGrid:z,snapToGrid:j,nodeOrigin:B}=s(),R=Gn(C.sourceEvent,{transform:$,snapGrid:z,snapToGrid:j,containerBounds:b}),T=[];if(!p)return;const{x:A,y:L,width:q,height:F}=v,Y={},Q=p.origin??B,{width:O,height:I,x:H,y:V}=_c(y,a.controlDirection,R,a.boundaries,a.keepAspectRatio,Q,M,D),W=O!==q,X=I!==F,ee=H!==A&&W,se=V!==L&&X;if(!ee&&!se&&!W&&!X)return;if((ee||se||Q[0]===1||Q[1]===1)&&(Y.x=ee?H:v.x,Y.y=se?V:v.y,v.x=Y.x,v.y=Y.y,N.length>0)){const le=H-A,ie=V-L;for(const he of N)he.position={x:he.position.x-le+Q[0]*(O-q),y:he.position.y-ie+Q[1]*(I-F)},T.push(he)}if((W||X)&&(Y.width=W&&(!a.resizeDirection||a.resizeDirection==="horizontal")?O:v.width,Y.height=X&&(!a.resizeDirection||a.resizeDirection==="vertical")?I:v.height,v.width=Y.width,v.height=Y.height),w&&p.expandParent){const le=Q[0]*(Y.width??0);Y.x&&Y.x<le&&(v.x=le,y.x=y.x-(Y.x-le));const ie=Q[1]*(Y.height??0);Y.y&&Y.y<ie&&(v.y=ie,y.y=y.y-(Y.y-ie))}const J=Rc({width:v.width,prevWidth:q,height:v.height,prevHeight:F,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),U={...v,direction:J};S?.(C,U)!==!1&&(P=!0,x?.(C,U),r(Y,T))}).on("end",C=>{P&&(E?.(C,{...v}),i?.({...v}),P=!1)});o.call(_)}function c(){o.on(".drag",null)}return{update:l,destroy:c}}var os={exports:{}},as={};var So;function $c(){if(So)return as;So=1;var e=dl(),n=ul();function s(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:s,i=n.useSyncExternalStore,o=e.useRef,a=e.useEffect,l=e.useMemo,c=e.useDebugValue;return as.useSyncExternalStoreWithSelector=function(d,h,f,m,u){var x=o(null);if(x.current===null){var E={hasValue:!1,value:null};x.current=E}else E=x.current;x=l(function(){function v(w){if(!y){if(y=!0,p=w,w=m(w),u!==void 0&&E.hasValue){var M=E.value;if(u(M,w))return b=M}return b=w}if(M=b,r(p,w))return M;var D=m(w);return u!==void 0&&u(M,D)?(p=w,M):(p=w,b=D)}var y=!1,p,b,N=f===void 0?null:f;return[function(){return v(h())},N===null?void 0:function(){return v(N())}]},[h,f,m,u]);var S=i(d,x[0],x[1]);return a(function(){E.hasValue=!0,E.value=S},[S]),c(S),S},as}var Eo;function Bc(){return Eo||(Eo=1,os.exports=$c()),os.exports}var Oc=Bc();const zc=fl(Oc),Hc={},Mo=e=>{let n;const s=new Set,r=(h,f)=>{const m=typeof h=="function"?h(n):h;if(!Object.is(m,n)){const u=n;n=f??(typeof m!="object"||m===null)?m:Object.assign({},n,m),s.forEach(x=>x(n,u))}},i=()=>n,c={setState:r,getState:i,getInitialState:()=>d,subscribe:h=>(s.add(h),()=>s.delete(h)),destroy:()=>{(Hc?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),s.clear()}},d=n=e(r,i,c);return c},qc=e=>e?Mo(e):Mo,{useDebugValue:Vc}=hl,{useSyncExternalStoreWithSelector:Wc}=zc,Fc=e=>e;function li(e,n=Fc,s){const r=Wc(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,s);return Vc(r),r}const Io=(e,n)=>{const s=qc(e),r=(i,o=n)=>li(s,i,o);return Object.assign(r,s),r},Yc=(e,n)=>e?Io(e,n):Io;function Oe(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[r,i]of e)if(!Object.is(i,n.get(r)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}const s=Object.keys(e);if(s.length!==Object.keys(n).length)return!1;for(const r of s)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}const Hr=g.createContext(null),Gc=Hr.Provider,ci=Dt.error001();function Me(e,n){const s=g.useContext(Hr);if(s===null)throw new Error(ci);return li(s,e,n)}function Be(){const e=g.useContext(Hr);if(e===null)throw new Error(ci);return g.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const To={display:"none"},Zc={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},di="react-flow__node-desc",ui="react-flow__edge-desc",Xc="react-flow__aria-live",Uc=e=>e.ariaLiveMessage,Kc=e=>e.ariaLabelConfig;function Qc({rfId:e}){const n=Me(Uc);return t.jsx("div",{id:`${Xc}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Zc,children:n})}function Jc({rfId:e,disableKeyboardA11y:n}){const s=Me(Kc);return t.jsxs(t.Fragment,{children:[t.jsx("div",{id:`${di}-${e}`,style:To,children:n?s["node.a11yDescription.default"]:s["node.a11yDescription.keyboardDisabled"]}),t.jsx("div",{id:`${ui}-${e}`,style:To,children:s["edge.a11yDescription.default"]}),!n&&t.jsx(Qc,{rfId:e})]})}const qr=g.forwardRef(({position:e="top-left",children:n,className:s,style:r,...i},o)=>{const a=`${e}`.split("-");return t.jsx("div",{className:Ze(["react-flow__panel",s,...a]),style:r,ref:o,...i,children:n})});qr.displayName="Panel";function ed({proOptions:e,position:n="bottom-right"}){return e?.hideAttribution?null:t.jsx(qr,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:t.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const td=e=>{const n=[],s=[];for(const[,r]of e.nodeLookup)r.selected&&n.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&s.push(r);return{selectedNodes:n,selectedEdges:s}},Cr=e=>e.id;function nd(e,n){return Oe(e.selectedNodes.map(Cr),n.selectedNodes.map(Cr))&&Oe(e.selectedEdges.map(Cr),n.selectedEdges.map(Cr))}function rd({onSelectionChange:e}){const n=Be(),{selectedNodes:s,selectedEdges:r}=Me(td,nd);return g.useEffect(()=>{const i={nodes:s,edges:r};e?.(i),n.getState().onSelectionChangeHandlers.forEach(o=>o(i))},[s,r,e]),null}const sd=e=>!!e.onSelectionChangeHandlers;function od({onSelectionChange:e}){const n=Me(sd);return e||n?t.jsx(rd,{onSelectionChange:e}):null}const fi=[0,0],ad={x:0,y:0,zoom:1},id=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Ro=[...id,"rfId"],ld=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),_o={translateExtent:Kn,nodeOrigin:fi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function cd(e){const{setNodes:n,setEdges:s,setMinZoom:r,setMaxZoom:i,setTranslateExtent:o,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Me(ld,Oe),d=Be();g.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{h.current=_o,l()}),[]);const h=g.useRef(_o);return g.useEffect(()=>{for(const f of Ro){const m=e[f],u=h.current[f];m!==u&&(typeof e[f]>"u"||(f==="nodes"?n(m):f==="edges"?s(m):f==="minZoom"?r(m):f==="maxZoom"?i(m):f==="translateExtent"?o(m):f==="nodeExtent"?a(m):f==="ariaLabelConfig"?d.setState({ariaLabelConfig:Zl(m)}):f==="fitView"?d.setState({fitViewQueued:m}):f==="fitViewOptions"?d.setState({fitViewOptions:m}):d.setState({[f]:m})))}h.current=e},Ro.map(f=>e[f])),null}function Ao(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function dd(e){const[n,s]=g.useState(e==="system"?null:e);return g.useEffect(()=>{if(e!=="system"){s(e);return}const r=Ao(),i=()=>s(r?.matches?"dark":"light");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),n!==null?n:Ao()?.matches?"dark":"light"}const Lo=typeof document<"u"?document:null;function tr(e=null,n={target:Lo,actInsideInputWithModifier:!0}){const[s,r]=g.useState(!1),i=g.useRef(!1),o=g.useRef(new Set([])),[a,l]=g.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
1
|
+
import{ai as dl,aj as ul,F as fl,ak as hl,r as g,j as t,u as He,f as re,G as ml,a as rr,e as gl,B as pl,C as xl,b as cs,P as Ye,w as bt,aa as kt,D as vr,al as no,M as bl,J as Sn,n as Lt,t as Xn,am as yl,A as ws,a0 as ro,an as ds,ao as so,ap as us,aq as oo,ar as ao,as as io,Y as Ca,$ as Sa,Z as vl}from"./index-CHkb08MZ.js";import{ContentRenderer as wl}from"./ContentRenderer-CQ9uMng0.js";import{s as ht,e as Ea,f as ks,T as Kr,g as Qr,t as kl}from"./transform-CpIVI4vC.js";import{i as Jr}from"./value-DIujSiJ7.js";import{C as Ma}from"./CommentInput-D3jx82c7.js";function jl(e){let n;for(;n=e.sourceEvent;)e=n;return e}function jt(e,n){if(e=jl(e),n===void 0&&(n=e.currentTarget),n){var s=n.ownerSVGElement||n;if(s.createSVGPoint){var r=s.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[e.clientX-i.left-n.clientLeft,e.clientY-i.top-n.clientTop]}}return[e.pageX,e.pageY]}const Nl={passive:!1},Un={capture:!0,passive:!1};function es(e){e.stopImmediatePropagation()}function Tn(e){e.preventDefault(),e.stopImmediatePropagation()}function Ia(e){var n=e.document.documentElement,s=ht(e).on("dragstart.drag",Tn,Un);"onselectstart"in n?s.on("selectstart.drag",Tn,Un):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function Ta(e,n){var s=e.document.documentElement,r=ht(e).on("dragstart.drag",null);n&&(r.on("click.drag",Tn,Un),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in s?r.on("selectstart.drag",null):(s.style.MozUserSelect=s.__noselect,delete s.__noselect)}const wr=e=>()=>e;function fs(e,{sourceEvent:n,subject:s,target:r,identifier:i,active:o,x:a,y:l,dx:c,dy:d,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:s,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:h}})}fs.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Cl(e){return!e.ctrlKey&&!e.button}function Sl(){return this.parentNode}function El(e,n){return n??{x:e.x,y:e.y}}function Ml(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ra(){var e=Cl,n=Sl,s=El,r=Ml,i={},o=Ea("start","drag","end"),a=0,l,c,d,h,f=0;function m(b){b.on("mousedown.drag",u).filter(r).on("touchstart.drag",S).on("touchmove.drag",v,Nl).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function u(b,N){if(!(h||!e.call(this,b,N))){var w=p(this,n.call(this,b,N),b,N,"mouse");w&&(ht(b.view).on("mousemove.drag",x,Un).on("mouseup.drag",E,Un),Ia(b.view),es(b),d=!1,l=b.clientX,c=b.clientY,w("start",b))}}function x(b){if(Tn(b),!d){var N=b.clientX-l,w=b.clientY-c;d=N*N+w*w>f}i.mouse("drag",b)}function E(b){ht(b.view).on("mousemove.drag mouseup.drag",null),Ta(b.view,d),Tn(b),i.mouse("end",b)}function S(b,N){if(e.call(this,b,N)){var w=b.changedTouches,M=n.call(this,b,N),D=w.length,P,_;for(P=0;P<D;++P)(_=p(this,M,b,N,w[P].identifier,w[P]))&&(es(b),_("start",b,w[P]))}}function v(b){var N=b.changedTouches,w=N.length,M,D;for(M=0;M<w;++M)(D=i[N[M].identifier])&&(Tn(b),D("drag",b,N[M]))}function y(b){var N=b.changedTouches,w=N.length,M,D;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),M=0;M<w;++M)(D=i[N[M].identifier])&&(es(b),D("end",b,N[M]))}function p(b,N,w,M,D,P){var _=o.copy(),C=jt(P||w,N),$,z,j;if((j=s.call(b,new fs("beforestart",{sourceEvent:w,target:m,identifier:D,active:a,x:C[0],y:C[1],dx:0,dy:0,dispatch:_}),M))!=null)return $=j.x-C[0]||0,z=j.y-C[1]||0,function B(R,T,A){var L=C,q;switch(R){case"start":i[D]=B,q=a++;break;case"end":delete i[D],--a;case"drag":C=jt(A||T,N),q=a;break}_.call(R,b,new fs(R,{sourceEvent:T,subject:j,target:m,identifier:D,active:q,x:C[0]+$,y:C[1]+z,dx:C[0]-L[0],dy:C[1]-L[1],dispatch:_}),M)}}return m.filter=function(b){return arguments.length?(e=typeof b=="function"?b:wr(!!b),m):e},m.container=function(b){return arguments.length?(n=typeof b=="function"?b:wr(b),m):n},m.subject=function(b){return arguments.length?(s=typeof b=="function"?b:wr(b),m):s},m.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:wr(!!b),m):r},m.on=function(){var b=o.on.apply(o,arguments);return b===o?m:b},m.clickDistance=function(b){return arguments.length?(f=(b=+b)*b,m):Math.sqrt(f)},m}var Il=1e-12;function lo(e){return((e=Math.exp(e))+1/e)/2}function Tl(e){return((e=Math.exp(e))-1/e)/2}function Rl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Rr=(function e(n,s,r){function i(o,a){var l=o[0],c=o[1],d=o[2],h=a[0],f=a[1],m=a[2],u=h-l,x=f-c,E=u*u+x*x,S,v;if(E<Il)v=Math.log(m/d)/n,S=function(M){return[l+M*u,c+M*x,d*Math.exp(n*M*v)]};else{var y=Math.sqrt(E),p=(m*m-d*d+r*E)/(2*d*s*y),b=(m*m-d*d-r*E)/(2*m*s*y),N=Math.log(Math.sqrt(p*p+1)-p),w=Math.log(Math.sqrt(b*b+1)-b);v=(w-N)/n,S=function(M){var D=M*v,P=lo(N),_=d/(s*y)*(P*Rl(n*D+N)-Tl(N));return[l+_*u,c+_*x,d*P/lo(n*D+N)]}}return S.duration=v*1e3*n/Math.SQRT2,S}return i.rho=function(o){var a=Math.max(.001,+o),l=a*a,c=l*l;return e(a,l,c)},i})(Math.SQRT2,2,4),kr=e=>()=>e;function _l(e,{sourceEvent:n,target:s,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ts(e){e.stopImmediatePropagation()}function Fn(e){e.preventDefault(),e.stopImmediatePropagation()}function Al(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ll(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function co(){return this.__zoom||ks}function Dl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Pl(){return navigator.maxTouchPoints||"ontouchstart"in this}function $l(e,n,s){var r=e.invertX(n[0][0])-s[0][0],i=e.invertX(n[1][0])-s[1][0],o=e.invertY(n[0][1])-s[0][1],a=e.invertY(n[1][1])-s[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function _a(){var e=Al,n=Ll,s=$l,r=Dl,i=Pl,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Rr,d=Ea("start","zoom","end"),h,f,m,u=500,x=150,E=0,S=10;function v(j){j.property("__zoom",co).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",_).filter(i).on("touchstart.zoom",C).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(j,B,R,T){var A=j.selection?j.selection():j;A.property("__zoom",co),j!==A?N(j,B,R,T):A.interrupt().each(function(){w(this,arguments).event(T).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},v.scaleBy=function(j,B,R,T){v.scaleTo(j,function(){var A=this.__zoom.k,L=typeof B=="function"?B.apply(this,arguments):B;return A*L},R,T)},v.scaleTo=function(j,B,R,T){v.transform(j,function(){var A=n.apply(this,arguments),L=this.__zoom,q=R==null?b(A):typeof R=="function"?R.apply(this,arguments):R,F=L.invert(q),Y=typeof B=="function"?B.apply(this,arguments):B;return s(p(y(L,Y),q,F),A,a)},R,T)},v.translateBy=function(j,B,R,T){v.transform(j,function(){return s(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof R=="function"?R.apply(this,arguments):R),n.apply(this,arguments),a)},null,T)},v.translateTo=function(j,B,R,T,A){v.transform(j,function(){var L=n.apply(this,arguments),q=this.__zoom,F=T==null?b(L):typeof T=="function"?T.apply(this,arguments):T;return s(ks.translate(F[0],F[1]).scale(q.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof R=="function"?-R.apply(this,arguments):-R),L,a)},T,A)};function y(j,B){return B=Math.max(o[0],Math.min(o[1],B)),B===j.k?j:new Kr(B,j.x,j.y)}function p(j,B,R){var T=B[0]-R[0]*j.k,A=B[1]-R[1]*j.k;return T===j.x&&A===j.y?j:new Kr(j.k,T,A)}function b(j){return[(+j[0][0]+ +j[1][0])/2,(+j[0][1]+ +j[1][1])/2]}function N(j,B,R,T){j.on("start.zoom",function(){w(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(T).end()}).tween("zoom",function(){var A=this,L=arguments,q=w(A,L).event(T),F=n.apply(A,L),Y=R==null?b(F):typeof R=="function"?R.apply(A,L):R,Q=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),O=A.__zoom,I=typeof B=="function"?B.apply(A,L):B,H=c(O.invert(Y).concat(Q/O.k),I.invert(Y).concat(Q/I.k));return function(V){if(V===1)V=I;else{var W=H(V),X=Q/W[2];V=new Kr(X,Y[0]-W[0]*X,Y[1]-W[1]*X)}q.zoom(null,V)}})}function w(j,B,R){return!R&&j.__zooming||new M(j,B)}function M(j,B){this.that=j,this.args=B,this.active=0,this.sourceEvent=null,this.extent=n.apply(j,B),this.taps=0}M.prototype={event:function(j){return j&&(this.sourceEvent=j),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(j,B){return this.mouse&&j!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&j!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&j!=="touch"&&(this.touch1[1]=B.invert(this.touch1[0])),this.that.__zoom=B,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(j){var B=ht(this.that).datum();d.call(j,this.that,new _l(j,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:d}),B)}};function D(j,...B){if(!e.apply(this,arguments))return;var R=w(this,B).event(j),T=this.__zoom,A=Math.max(o[0],Math.min(o[1],T.k*Math.pow(2,r.apply(this,arguments)))),L=jt(j);if(R.wheel)(R.mouse[0][0]!==L[0]||R.mouse[0][1]!==L[1])&&(R.mouse[1]=T.invert(R.mouse[0]=L)),clearTimeout(R.wheel);else{if(T.k===A)return;R.mouse=[L,T.invert(L)],Qr(this),R.start()}Fn(j),R.wheel=setTimeout(q,x),R.zoom("mouse",s(p(y(T,A),R.mouse[0],R.mouse[1]),R.extent,a));function q(){R.wheel=null,R.end()}}function P(j,...B){if(m||!e.apply(this,arguments))return;var R=j.currentTarget,T=w(this,B,!0).event(j),A=ht(j.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",Q,!0),L=jt(j,R),q=j.clientX,F=j.clientY;Ia(j.view),ts(j),T.mouse=[L,this.__zoom.invert(L)],Qr(this),T.start();function Y(O){if(Fn(O),!T.moved){var I=O.clientX-q,H=O.clientY-F;T.moved=I*I+H*H>E}T.event(O).zoom("mouse",s(p(T.that.__zoom,T.mouse[0]=jt(O,R),T.mouse[1]),T.extent,a))}function Q(O){A.on("mousemove.zoom mouseup.zoom",null),Ta(O.view,T.moved),Fn(O),T.event(O).end()}}function _(j,...B){if(e.apply(this,arguments)){var R=this.__zoom,T=jt(j.changedTouches?j.changedTouches[0]:j,this),A=R.invert(T),L=R.k*(j.shiftKey?.5:2),q=s(p(y(R,L),T,A),n.apply(this,B),a);Fn(j),l>0?ht(this).transition().duration(l).call(N,q,T,j):ht(this).call(v.transform,q,T,j)}}function C(j,...B){if(e.apply(this,arguments)){var R=j.touches,T=R.length,A=w(this,B,j.changedTouches.length===T).event(j),L,q,F,Y;for(ts(j),q=0;q<T;++q)F=R[q],Y=jt(F,this),Y=[Y,this.__zoom.invert(Y),F.identifier],A.touch0?!A.touch1&&A.touch0[2]!==Y[2]&&(A.touch1=Y,A.taps=0):(A.touch0=Y,L=!0,A.taps=1+!!h);h&&(h=clearTimeout(h)),L&&(A.taps<2&&(f=Y[0],h=setTimeout(function(){h=null},u)),Qr(this),A.start())}}function $(j,...B){if(this.__zooming){var R=w(this,B).event(j),T=j.changedTouches,A=T.length,L,q,F,Y;for(Fn(j),L=0;L<A;++L)q=T[L],F=jt(q,this),R.touch0&&R.touch0[2]===q.identifier?R.touch0[0]=F:R.touch1&&R.touch1[2]===q.identifier&&(R.touch1[0]=F);if(q=R.that.__zoom,R.touch1){var Q=R.touch0[0],O=R.touch0[1],I=R.touch1[0],H=R.touch1[1],V=(V=I[0]-Q[0])*V+(V=I[1]-Q[1])*V,W=(W=H[0]-O[0])*W+(W=H[1]-O[1])*W;q=y(q,Math.sqrt(V/W)),F=[(Q[0]+I[0])/2,(Q[1]+I[1])/2],Y=[(O[0]+H[0])/2,(O[1]+H[1])/2]}else if(R.touch0)F=R.touch0[0],Y=R.touch0[1];else return;R.zoom("touch",s(p(q,F,Y),R.extent,a))}}function z(j,...B){if(this.__zooming){var R=w(this,B).event(j),T=j.changedTouches,A=T.length,L,q;for(ts(j),m&&clearTimeout(m),m=setTimeout(function(){m=null},u),L=0;L<A;++L)q=T[L],R.touch0&&R.touch0[2]===q.identifier?delete R.touch0:R.touch1&&R.touch1[2]===q.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&(q=jt(q,this),Math.hypot(f[0]-q[0],f[1]-q[1])<S)){var F=ht(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return v.wheelDelta=function(j){return arguments.length?(r=typeof j=="function"?j:kr(+j),v):r},v.filter=function(j){return arguments.length?(e=typeof j=="function"?j:kr(!!j),v):e},v.touchable=function(j){return arguments.length?(i=typeof j=="function"?j:kr(!!j),v):i},v.extent=function(j){return arguments.length?(n=typeof j=="function"?j:kr([[+j[0][0],+j[0][1]],[+j[1][0],+j[1][1]]]),v):n},v.scaleExtent=function(j){return arguments.length?(o[0]=+j[0],o[1]=+j[1],v):[o[0],o[1]]},v.translateExtent=function(j){return arguments.length?(a[0][0]=+j[0][0],a[1][0]=+j[1][0],a[0][1]=+j[0][1],a[1][1]=+j[1][1],v):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},v.constrain=function(j){return arguments.length?(s=j,v):s},v.duration=function(j){return arguments.length?(l=+j,v):l},v.interpolate=function(j){return arguments.length?(c=j,v):c},v.on=function(){var j=d.on.apply(d,arguments);return j===d?v:j},v.clickDistance=function(j){return arguments.length?(E=(j=+j)*j,v):Math.sqrt(E)},v.tapDistance=function(j){return arguments.length?(S=+j,v):S},v}function Ze(e){if(typeof e=="string"||typeof e=="number")return""+e;let n="";if(Array.isArray(e))for(let s=0,r;s<e.length;s++)(r=Ze(e[s]))!==""&&(n+=(n&&" ")+r);else for(let s in e)e[s]&&(n+=(n&&" ")+s);return n}const Dt={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:n,sourceHandle:s,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?s:r}", edge id: ${n}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Kn=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Aa=["Enter"," ","Escape"],La={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:n,y:s})=>`Moved selected node ${e}. New position, x: ${n}, y: ${s}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Rn;(function(e){e.Strict="strict",e.Loose="loose"})(Rn||(Rn={}));var un;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(un||(un={}));var Qn;(function(e){e.Partial="partial",e.Full="full"})(Qn||(Qn={}));const Da={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Kt;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Kt||(Kt={}));var _n;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(_n||(_n={}));var ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ye||(ye={}));const uo={[ye.Left]:ye.Right,[ye.Right]:ye.Left,[ye.Top]:ye.Bottom,[ye.Bottom]:ye.Top};function Pa(e){return e===null?null:e?"valid":"invalid"}const $a=e=>"id"in e&&"source"in e&&"target"in e,Bl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),js=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),sr=(e,n=[0,0])=>{const{width:s,height:r}=Ft(e),i=e.origin??n,o=s*i[0],a=r*i[1];return{x:e.position.x-o,y:e.position.y-a}},Ol=(e,n={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const s=e.reduce((r,i)=>{const o=typeof i=="string";let a=!n.nodeLookup&&!o?i:void 0;n.nodeLookup&&(a=o?n.nodeLookup.get(i):js(i)?i:n.nodeLookup.get(i.id));const l=a?Lr(a,n.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Br(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Or(s)},or=(e,n={})=>{let s={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(n.filter===void 0||n.filter(i))&&(s=Br(s,Lr(i)),r=!0)}),r?Or(s):{x:0,y:0,width:0,height:0}},Ns=(e,n,[s,r,i]=[0,0,1],o=!1,a=!1)=>{const l={...ir(n,[s,r,i]),width:n.width/i,height:n.height/i},c=[];for(const d of e.values()){const{measured:h,selectable:f=!0,hidden:m=!1}=d;if(a&&!f||m)continue;const u=h.width??d.width??d.initialWidth??null,x=h.height??d.height??d.initialHeight??null,E=Jn(l,Ln(d)),S=(u??0)*(x??0),v=o&&E>0;(!d.internals.handleBounds||v||E>=S||d.dragging)&&c.push(d)}return c},zl=(e,n)=>{const s=new Set;return e.forEach(r=>{s.add(r.id)}),n.filter(r=>s.has(r.source)||s.has(r.target))};function Hl(e,n){const s=new Map,r=n?.nodes?new Set(n.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&(n?.includeHiddenNodes||!i.hidden)&&(!r||r.has(i.id))&&s.set(i.id,i)}),s}async function ql({nodes:e,width:n,height:s,panZoom:r,minZoom:i,maxZoom:o},a){if(e.size===0)return Promise.resolve(!0);const l=Hl(e,a),c=or(l),d=Cs(c,n,s,a?.minZoom??i,a?.maxZoom??o,a?.padding??.1);return await r.setViewport(d,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function Ba({nodeId:e,nextPosition:n,nodeLookup:s,nodeOrigin:r=[0,0],nodeExtent:i,onError:o}){const a=s.get(e),l=a.parentId?s.get(a.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},h=a.origin??r;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)o?.("005",Dt.error005());else{const u=l.measured.width,x=l.measured.height;u&&x&&(f=[[c,d],[c+u,d+x]])}else l&&Dn(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+d],[a.extent[1][0]+c,a.extent[1][1]+d]]);const m=Dn(f)?fn(n,f,a.measured):n;return(a.measured.width===void 0||a.measured.height===void 0)&&o?.("015",Dt.error015()),{position:{x:m.x-c+(a.measured.width??0)*h[0],y:m.y-d+(a.measured.height??0)*h[1]},positionAbsolute:m}}async function Vl({nodesToRemove:e=[],edgesToRemove:n=[],nodes:s,edges:r,onBeforeDelete:i}){const o=new Set(e.map(m=>m.id)),a=[];for(const m of s){if(m.deletable===!1)continue;const u=o.has(m.id),x=!u&&m.parentId&&a.find(E=>E.id===m.parentId);(u||x)&&a.push(m)}const l=new Set(n.map(m=>m.id)),c=r.filter(m=>m.deletable!==!1),h=zl(a,c);for(const m of c)l.has(m.id)&&!h.find(x=>x.id===m.id)&&h.push(m);if(!i)return{edges:h,nodes:a};const f=await i({nodes:a,edges:h});return typeof f=="boolean"?f?{edges:h,nodes:a}:{edges:[],nodes:[]}:f}const An=(e,n=0,s=1)=>Math.min(Math.max(e,n),s),fn=(e={x:0,y:0},n,s)=>({x:An(e.x,n[0][0],n[1][0]-(s?.width??0)),y:An(e.y,n[0][1],n[1][1]-(s?.height??0))});function Oa(e,n,s){const{width:r,height:i}=Ft(s),{x:o,y:a}=s.internals.positionAbsolute;return fn(e,[[o,a],[o+r,a+i]],n)}const fo=(e,n,s)=>e<n?An(Math.abs(e-n),1,n)/n:e>s?-An(Math.abs(e-s),1,n)/n:0,za=(e,n,s=15,r=40)=>{const i=fo(e.x,r,n.width-r)*s,o=fo(e.y,r,n.height-r)*s;return[i,o]},Br=(e,n)=>({x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}),hs=({x:e,y:n,width:s,height:r})=>({x:e,y:n,x2:e+s,y2:n+r}),Or=({x:e,y:n,x2:s,y2:r})=>({x:e,y:n,width:s-e,height:r-n}),Ln=(e,n=[0,0])=>{const{x:s,y:r}=js(e)?e.internals.positionAbsolute:sr(e,n);return{x:s,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Lr=(e,n=[0,0])=>{const{x:s,y:r}=js(e)?e.internals.positionAbsolute:sr(e,n);return{x:s,y:r,x2:s+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},Ha=(e,n)=>Or(Br(hs(e),hs(n))),Jn=(e,n)=>{const s=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(s*r)},ho=e=>Nt(e.width)&&Nt(e.height)&&Nt(e.x)&&Nt(e.y),Nt=e=>!isNaN(e)&&isFinite(e),Wl=(e,n)=>{},ar=(e,n=[1,1])=>({x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}),ir=({x:e,y:n},[s,r,i],o=!1,a=[1,1])=>{const l={x:(e-s)/i,y:(n-r)/i};return o?ar(l,a):l},Dr=({x:e,y:n},[s,r,i])=>({x:e*i+s,y:n*i+r});function Cn(e,n){if(typeof e=="number")return Math.floor((n-n/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const s=parseFloat(e);if(!Number.isNaN(s))return Math.floor(s)}if(typeof e=="string"&&e.endsWith("%")){const s=parseFloat(e);if(!Number.isNaN(s))return Math.floor(n*s*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Fl(e,n,s){if(typeof e=="string"||typeof e=="number"){const r=Cn(e,s),i=Cn(e,n);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=Cn(e.top??e.y??0,s),i=Cn(e.bottom??e.y??0,s),o=Cn(e.left??e.x??0,n),a=Cn(e.right??e.x??0,n);return{top:r,right:a,bottom:i,left:o,x:o+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Yl(e,n,s,r,i,o){const{x:a,y:l}=Dr(e,[n,s,r]),{x:c,y:d}=Dr({x:e.x+e.width,y:e.y+e.height},[n,s,r]),h=i-c,f=o-d;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(h),bottom:Math.floor(f)}}const Cs=(e,n,s,r,i,o)=>{const a=Fl(o,n,s),l=(n-a.x)/e.width,c=(s-a.y)/e.height,d=Math.min(l,c),h=An(d,r,i),f=e.x+e.width/2,m=e.y+e.height/2,u=n/2-f*h,x=s/2-m*h,E=Yl(e,u,x,h,n,s),S={left:Math.min(E.left-a.left,0),top:Math.min(E.top-a.top,0),right:Math.min(E.right-a.right,0),bottom:Math.min(E.bottom-a.bottom,0)};return{x:u-S.left+S.right,y:x-S.top+S.bottom,zoom:h}},er=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Dn(e){return e!=null&&e!=="parent"}function Ft(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function qa(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Va(e,n={width:0,height:0},s,r,i){const o={...e},a=r.get(s);if(a){const l=a.origin||i;o.x+=a.internals.positionAbsolute.x-(n.width??0)*l[0],o.y+=a.internals.positionAbsolute.y-(n.height??0)*l[1]}return o}function mo(e,n){if(e.size!==n.size)return!1;for(const s of e)if(!n.has(s))return!1;return!0}function Gl(){let e,n;return{promise:new Promise((r,i)=>{e=r,n=i}),resolve:e,reject:n}}function Zl(e){return{...La,...e||{}}}function Gn(e,{snapGrid:n=[0,0],snapToGrid:s=!1,transform:r,containerBounds:i}){const{x:o,y:a}=Ct(e),l=ir({x:o-(i?.left??0),y:a-(i?.top??0)},r),{x:c,y:d}=s?ar(l,n):l;return{xSnapped:c,ySnapped:d,...l}}const Ss=e=>({width:e.offsetWidth,height:e.offsetHeight}),Wa=e=>e?.getRootNode?.()||window?.document,Xl=["INPUT","SELECT","TEXTAREA"];function Fa(e){const n=e.composedPath?.()?.[0]||e.target;return n?.nodeType!==1?!1:Xl.includes(n.nodeName)||n.hasAttribute("contenteditable")||!!n.closest(".nokey")}const Ya=e=>"clientX"in e,Ct=(e,n)=>{const s=Ya(e),r=s?e.clientX:e.touches?.[0].clientX,i=s?e.clientY:e.touches?.[0].clientY;return{x:r-(n?.left??0),y:i-(n?.top??0)}},go=(e,n,s,r,i)=>{const o=n.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-s.left)/r,y:(l.top-s.top)/r,...Ss(a)}})};function Ga({sourceX:e,sourceY:n,targetX:s,targetY:r,sourceControlX:i,sourceControlY:o,targetControlX:a,targetControlY:l}){const c=e*.125+i*.375+a*.375+s*.125,d=n*.125+o*.375+l*.375+r*.125,h=Math.abs(c-e),f=Math.abs(d-n);return[c,d,h,f]}function jr(e,n){return e>=0?.5*e:n*25*Math.sqrt(-e)}function po({pos:e,x1:n,y1:s,x2:r,y2:i,c:o}){switch(e){case ye.Left:return[n-jr(n-r,o),s];case ye.Right:return[n+jr(r-n,o),s];case ye.Top:return[n,s-jr(s-i,o)];case ye.Bottom:return[n,s+jr(i-s,o)]}}function Za({sourceX:e,sourceY:n,sourcePosition:s=ye.Bottom,targetX:r,targetY:i,targetPosition:o=ye.Top,curvature:a=.25}){const[l,c]=po({pos:s,x1:e,y1:n,x2:r,y2:i,c:a}),[d,h]=po({pos:o,x1:r,y1:i,x2:e,y2:n,c:a}),[f,m,u,x]=Ga({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${e},${n} C${l},${c} ${d},${h} ${r},${i}`,f,m,u,x]}function Xa({sourceX:e,sourceY:n,targetX:s,targetY:r}){const i=Math.abs(s-e)/2,o=s<e?s+i:s-i,a=Math.abs(r-n)/2,l=r<n?r+a:r-a;return[o,l,i,a]}function Ul({sourceNode:e,targetNode:n,selected:s=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:o="basic"}){if(o==="manual")return r;const a=i&&s?r+1e3:r,l=Math.max(e.parentId||i&&e.selected?e.internals.z:0,n.parentId||i&&n.selected?n.internals.z:0);return a+l}function Kl({sourceNode:e,targetNode:n,width:s,height:r,transform:i}){const o=Br(Lr(e),Lr(n));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const a={x:-i[0]/i[2],y:-i[1]/i[2],width:s/i[2],height:r/i[2]};return Jn(a,Or(o))>0}const Ql=({source:e,sourceHandle:n,target:s,targetHandle:r})=>`xy-edge__${e}${n||""}-${s}${r||""}`,Jl=(e,n)=>n.some(s=>s.source===e.source&&s.target===e.target&&(s.sourceHandle===e.sourceHandle||!s.sourceHandle&&!e.sourceHandle)&&(s.targetHandle===e.targetHandle||!s.targetHandle&&!e.targetHandle)),ec=(e,n,s={})=>{if(!e.source||!e.target)return n;const r=s.getEdgeId||Ql;let i;return $a(e)?i={...e}:i={...e,id:r(e)},Jl(i,n)?n:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,n.concat(i))};function Ua({sourceX:e,sourceY:n,targetX:s,targetY:r}){const[i,o,a,l]=Xa({sourceX:e,sourceY:n,targetX:s,targetY:r});return[`M ${e},${n}L ${s},${r}`,i,o,a,l]}const xo={[ye.Left]:{x:-1,y:0},[ye.Right]:{x:1,y:0},[ye.Top]:{x:0,y:-1},[ye.Bottom]:{x:0,y:1}},tc=({source:e,sourcePosition:n=ye.Bottom,target:s})=>n===ye.Left||n===ye.Right?e.x<s.x?{x:1,y:0}:{x:-1,y:0}:e.y<s.y?{x:0,y:1}:{x:0,y:-1},bo=(e,n)=>Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2));function nc({source:e,sourcePosition:n=ye.Bottom,target:s,targetPosition:r=ye.Top,center:i,offset:o,stepPosition:a}){const l=xo[n],c=xo[r],d={x:e.x+l.x*o,y:e.y+l.y*o},h={x:s.x+c.x*o,y:s.y+c.y*o},f=tc({source:d,sourcePosition:n,target:h}),m=f.x!==0?"x":"y",u=f[m];let x=[],E,S;const v={x:0,y:0},y={x:0,y:0},[,,p,b]=Xa({sourceX:e.x,sourceY:e.y,targetX:s.x,targetY:s.y});if(l[m]*c[m]===-1){m==="x"?(E=i.x??d.x+(h.x-d.x)*a,S=i.y??(d.y+h.y)/2):(E=i.x??(d.x+h.x)/2,S=i.y??d.y+(h.y-d.y)*a);const w=[{x:E,y:d.y},{x:E,y:h.y}],M=[{x:d.x,y:S},{x:h.x,y:S}];l[m]===u?x=m==="x"?w:M:x=m==="x"?M:w}else{const w=[{x:d.x,y:h.y}],M=[{x:h.x,y:d.y}];if(m==="x"?x=l.x===u?M:w:x=l.y===u?w:M,n===r){const $=Math.abs(e[m]-s[m]);if($<=o){const z=Math.min(o-1,o-$);l[m]===u?v[m]=(d[m]>e[m]?-1:1)*z:y[m]=(h[m]>s[m]?-1:1)*z}}if(n!==r){const $=m==="x"?"y":"x",z=l[m]===c[$],j=d[$]>h[$],B=d[$]<h[$];(l[m]===1&&(!z&&j||z&&B)||l[m]!==1&&(!z&&B||z&&j))&&(x=m==="x"?w:M)}const D={x:d.x+v.x,y:d.y+v.y},P={x:h.x+y.x,y:h.y+y.y},_=Math.max(Math.abs(D.x-x[0].x),Math.abs(P.x-x[0].x)),C=Math.max(Math.abs(D.y-x[0].y),Math.abs(P.y-x[0].y));_>=C?(E=(D.x+P.x)/2,S=x[0].y):(E=x[0].x,S=(D.y+P.y)/2)}return[[e,{x:d.x+v.x,y:d.y+v.y},...x,{x:h.x+y.x,y:h.y+y.y},s],E,S,p,b]}function rc(e,n,s,r){const i=Math.min(bo(e,n)/2,bo(n,s)/2,r),{x:o,y:a}=n;if(e.x===o&&o===s.x||e.y===a&&a===s.y)return`L${o} ${a}`;if(e.y===a){const d=e.x<s.x?-1:1,h=e.y<s.y?1:-1;return`L ${o+i*d},${a}Q ${o},${a} ${o},${a+i*h}`}const l=e.x<s.x?1:-1,c=e.y<s.y?-1:1;return`L ${o},${a+i*c}Q ${o},${a} ${o+i*l},${a}`}function ms({sourceX:e,sourceY:n,sourcePosition:s=ye.Bottom,targetX:r,targetY:i,targetPosition:o=ye.Top,borderRadius:a=5,centerX:l,centerY:c,offset:d=20,stepPosition:h=.5}){const[f,m,u,x,E]=nc({source:{x:e,y:n},sourcePosition:s,target:{x:r,y:i},targetPosition:o,center:{x:l,y:c},offset:d,stepPosition:h});return[f.reduce((v,y,p)=>{let b="";return p>0&&p<f.length-1?b=rc(f[p-1],y,f[p+1],a):b=`${p===0?"M":"L"}${y.x} ${y.y}`,v+=b,v},""),m,u,x,E]}function yo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function sc(e){const{sourceNode:n,targetNode:s}=e;if(!yo(n)||!yo(s))return null;const r=n.internals.handleBounds||vo(n.handles),i=s.internals.handleBounds||vo(s.handles),o=wo(r?.source??[],e.sourceHandle),a=wo(e.connectionMode===Rn.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!o||!a)return e.onError?.("008",Dt.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=o?.position||ye.Bottom,c=a?.position||ye.Top,d=hn(n,o,l),h=hn(s,a,c);return{sourceX:d.x,sourceY:d.y,targetX:h.x,targetY:h.y,sourcePosition:l,targetPosition:c}}function vo(e){if(!e)return null;const n=[],s=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?n.push(r):r.type==="target"&&s.push(r);return{source:n,target:s}}function hn(e,n,s=ye.Left,r=!1){const i=(n?.x??0)+e.internals.positionAbsolute.x,o=(n?.y??0)+e.internals.positionAbsolute.y,{width:a,height:l}=n??Ft(e);if(r)return{x:i+a/2,y:o+l/2};switch(n?.position??s){case ye.Top:return{x:i+a/2,y:o};case ye.Right:return{x:i+a,y:o+l/2};case ye.Bottom:return{x:i+a/2,y:o+l};case ye.Left:return{x:i,y:o+l/2}}}function wo(e,n){return e&&(n?e.find(s=>s.id===n):e[0])||null}function gs(e,n){return e?typeof e=="string"?e:`${n?`${n}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function oc(e,{id:n,defaultColor:s,defaultMarkerStart:r,defaultMarkerEnd:i}){const o=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const d=gs(c,n);o.has(d)||(a.push({id:d,color:c.color||s,...c}),o.add(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const Ka=1e3,ac=10,Es={nodeOrigin:[0,0],nodeExtent:Kn,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ic={...Es,checkEquality:!0};function Ms(e,n){const s={...e};for(const r in n)n[r]!==void 0&&(s[r]=n[r]);return s}function lc(e,n,s){const r=Ms(Es,s);for(const i of e.values())if(i.parentId)Ts(i,e,n,r);else{const o=sr(i,r.nodeOrigin),a=Dn(i.extent)?i.extent:r.nodeExtent,l=fn(o,a,Ft(i));i.internals.positionAbsolute=l}}function cc(e,n){if(!e.handles)return e.measured?n?.internals.handleBounds:void 0;const s=[],r=[];for(const i of e.handles){const o={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?s.push(o):i.type==="target"&&r.push(o)}return{source:s,target:r}}function Is(e){return e==="manual"}function ps(e,n,s,r={}){const i=Ms(ic,r),o={i:0},a=new Map(n),l=i?.elevateNodesOnSelect&&!Is(i.zIndexMode)?Ka:0;let c=e.length>0;n.clear(),s.clear();for(const d of e){let h=a.get(d.id);if(i.checkEquality&&d===h?.internals.userNode)n.set(d.id,h);else{const f=sr(d,i.nodeOrigin),m=Dn(d.extent)?d.extent:i.nodeExtent,u=fn(f,m,Ft(d));h={...i.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:u,handleBounds:cc(d,h),z:Qa(d,l,i.zIndexMode),userNode:d}},n.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&Ts(h,n,s,r,o)}return c}function dc(e,n){if(!e.parentId)return;const s=n.get(e.parentId);s?s.set(e.id,e):n.set(e.parentId,new Map([[e.id,e]]))}function Ts(e,n,s,r,i){const{elevateNodesOnSelect:o,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Ms(Es,r),d=e.parentId,h=n.get(d);if(!h){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}dc(e,s),i&&!h.parentId&&h.internals.rootParentIndex===void 0&&c==="auto"&&(h.internals.rootParentIndex=++i.i,h.internals.z=h.internals.z+i.i*ac),i&&h.internals.rootParentIndex!==void 0&&(i.i=h.internals.rootParentIndex);const f=o&&!Is(c)?Ka:0,{x:m,y:u,z:x}=uc(e,h,a,l,f,c),{positionAbsolute:E}=e.internals,S=m!==E.x||u!==E.y;(S||x!==e.internals.z)&&n.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x:m,y:u}:E,z:x}})}function Qa(e,n,s){const r=Nt(e.zIndex)?e.zIndex:0;return Is(s)?r:r+(e.selected?n:0)}function uc(e,n,s,r,i,o){const{x:a,y:l}=n.internals.positionAbsolute,c=Ft(e),d=sr(e,s),h=Dn(e.extent)?fn(d,e.extent,c):d;let f=fn({x:a+h.x,y:l+h.y},r,c);e.extent==="parent"&&(f=Oa(f,c,n));const m=Qa(e,i,o),u=n.internals.z??0;return{x:f.x,y:f.y,z:u>=m?u+1:m}}function Rs(e,n,s,r=[0,0]){const i=[],o=new Map;for(const a of e){const l=n.get(a.parentId);if(!l)continue;const c=o.get(a.parentId)?.expandedRect??Ln(l),d=Ha(c,a.rect);o.set(a.parentId,{expandedRect:d,parent:l})}return o.size>0&&o.forEach(({expandedRect:a,parent:l},c)=>{const d=l.internals.positionAbsolute,h=Ft(l),f=l.origin??r,m=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,u=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,x=Math.max(h.width,Math.round(a.width)),E=Math.max(h.height,Math.round(a.height)),S=(x-h.width)*f[0],v=(E-h.height)*f[1];(m>0||u>0||S||v)&&(i.push({id:c,type:"position",position:{x:l.position.x-m+S,y:l.position.y-u+v}}),s.get(c)?.forEach(y=>{e.some(p=>p.id===y.id)||i.push({id:y.id,type:"position",position:{x:y.position.x+m,y:y.position.y+u}})})),(h.width<a.width||h.height<a.height||m||u)&&i.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:x+(m?f[0]*m-S:0),height:E+(u?f[1]*u-v:0)}})}),i}function fc(e,n,s,r,i,o,a){const l=r?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],h=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(h.transform),m=[];for(const u of e.values()){const x=n.get(u.id);if(!x)continue;if(x.hidden){n.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),c=!0;continue}const E=Ss(u.nodeElement),S=x.measured.width!==E.width||x.measured.height!==E.height;if(!!(E.width&&E.height&&(S||!x.internals.handleBounds||u.force))){const y=u.nodeElement.getBoundingClientRect(),p=Dn(x.extent)?x.extent:o;let{positionAbsolute:b}=x.internals;x.parentId&&x.extent==="parent"?b=Oa(b,E,n.get(x.parentId)):p&&(b=fn(b,p,E));const N={...x,measured:E,internals:{...x.internals,positionAbsolute:b,handleBounds:{source:go("source",u.nodeElement,y,f,x.id),target:go("target",u.nodeElement,y,f,x.id)}}};n.set(x.id,N),x.parentId&&Ts(N,n,s,{nodeOrigin:i,zIndexMode:a}),c=!0,S&&(d.push({id:x.id,type:"dimensions",dimensions:E}),x.expandParent&&x.parentId&&m.push({id:x.id,parentId:x.parentId,rect:Ln(N,i)}))}}if(m.length>0){const u=Rs(m,n,s,i);d.push(...u)}return{changes:d,updatedInternals:c}}async function hc({delta:e,panZoom:n,transform:s,translateExtent:r,width:i,height:o}){if(!n||!e.x&&!e.y)return Promise.resolve(!1);const a=await n.setViewportConstrained({x:s[0]+e.x,y:s[1]+e.y,zoom:s[2]},[[0,0],[i,o]],r),l=!!a&&(a.x!==s[0]||a.y!==s[1]||a.k!==s[2]);return Promise.resolve(l)}function ko(e,n,s,r,i,o){let a=i;const l=r.get(a)||new Map;r.set(a,l.set(s,n)),a=`${i}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(s,n)),o){a=`${i}-${e}-${o}`;const d=r.get(a)||new Map;r.set(a,d.set(s,n))}}function Ja(e,n,s){e.clear(),n.clear();for(const r of s){const{source:i,target:o,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:o,sourceHandle:a,targetHandle:l},d=`${i}-${a}--${o}-${l}`,h=`${o}-${l}--${i}-${a}`;ko("source",c,h,e,i,a),ko("target",c,d,e,o,l),n.set(r.id,r)}}function ei(e,n){if(!e.parentId)return!1;const s=n.get(e.parentId);return s?s.selected?!0:ei(s,n):!1}function jo(e,n,s){let r=e;do{if(r?.matches?.(n))return!0;if(r===s)return!1;r=r?.parentElement}while(r);return!1}function mc(e,n,s,r){const i=new Map;for(const[o,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!ei(a,e))&&(a.draggable||n&&typeof a.draggable>"u")){const l=e.get(o);l&&i.set(o,{id:o,position:l.position||{x:0,y:0},distance:{x:s.x-l.internals.positionAbsolute.x,y:s.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function ns({nodeId:e,dragItems:n,nodeLookup:s,dragging:r=!0}){const i=[];for(const[a,l]of n){const c=s.get(a)?.internals.userNode;c&&i.push({...c,position:l.position,dragging:r})}if(!e)return[i[0],i];const o=s.get(e)?.internals.userNode;return[o?{...o,position:n.get(e)?.position||o.position,dragging:r}:i[0],i]}function gc({dragItems:e,snapGrid:n,x:s,y:r}){const i=e.values().next().value;if(!i)return null;const o={x:s-i.distance.x,y:r-i.distance.y},a=ar(o,n);return{x:a.x-o.x,y:a.y-o.y}}function pc({onNodeMouseDown:e,getStoreItems:n,onDragStart:s,onDrag:r,onDragStop:i}){let o={x:null,y:null},a=0,l=new Map,c=!1,d={x:0,y:0},h=null,f=!1,m=null,u=!1,x=!1,E=null;function S({noDragClassName:y,handleSelector:p,domNode:b,isSelectable:N,nodeId:w,nodeClickDistance:M=0}){m=ht(b);function D({x:$,y:z}){const{nodeLookup:j,nodeExtent:B,snapGrid:R,snapToGrid:T,nodeOrigin:A,onNodeDrag:L,onSelectionDrag:q,onError:F,updateNodePositions:Y}=n();o={x:$,y:z};let Q=!1;const O=l.size>1,I=O&&B?hs(or(l)):null,H=O&&T?gc({dragItems:l,snapGrid:R,x:$,y:z}):null;for(const[V,W]of l){if(!j.has(V))continue;let X={x:$-W.distance.x,y:z-W.distance.y};T&&(X=H?{x:Math.round(X.x+H.x),y:Math.round(X.y+H.y)}:ar(X,R));let ee=null;if(O&&B&&!W.extent&&I){const{positionAbsolute:U}=W.internals,oe=U.x-I.x+B[0][0],le=U.x+W.measured.width-I.x2+B[1][0],ie=U.y-I.y+B[0][1],he=U.y+W.measured.height-I.y2+B[1][1];ee=[[oe,ie],[le,he]]}const{position:se,positionAbsolute:J}=Ba({nodeId:V,nextPosition:X,nodeLookup:j,nodeExtent:ee||B,nodeOrigin:A,onError:F});Q=Q||W.position.x!==se.x||W.position.y!==se.y,W.position=se,W.internals.positionAbsolute=J}if(x=x||Q,!!Q&&(Y(l,!0),E&&(r||L||!w&&q))){const[V,W]=ns({nodeId:w,dragItems:l,nodeLookup:j});r?.(E,l,V,W),L?.(E,V,W),w||q?.(E,W)}}async function P(){if(!h)return;const{transform:$,panBy:z,autoPanSpeed:j,autoPanOnNodeDrag:B}=n();if(!B){c=!1,cancelAnimationFrame(a);return}const[R,T]=za(d,h,j);(R!==0||T!==0)&&(o.x=(o.x??0)-R/$[2],o.y=(o.y??0)-T/$[2],await z({x:R,y:T})&&D(o)),a=requestAnimationFrame(P)}function _($){const{nodeLookup:z,multiSelectionActive:j,nodesDraggable:B,transform:R,snapGrid:T,snapToGrid:A,selectNodesOnDrag:L,onNodeDragStart:q,onSelectionDragStart:F,unselectNodesAndEdges:Y}=n();f=!0,(!L||!N)&&!j&&w&&(z.get(w)?.selected||Y()),N&&L&&w&&e?.(w);const Q=Gn($.sourceEvent,{transform:R,snapGrid:T,snapToGrid:A,containerBounds:h});if(o=Q,l=mc(z,B,Q,w),l.size>0&&(s||q||!w&&F)){const[O,I]=ns({nodeId:w,dragItems:l,nodeLookup:z});s?.($.sourceEvent,l,O,I),q?.($.sourceEvent,O,I),w||F?.($.sourceEvent,I)}}const C=Ra().clickDistance(M).on("start",$=>{const{domNode:z,nodeDragThreshold:j,transform:B,snapGrid:R,snapToGrid:T}=n();h=z?.getBoundingClientRect()||null,u=!1,x=!1,E=$.sourceEvent,j===0&&_($),o=Gn($.sourceEvent,{transform:B,snapGrid:R,snapToGrid:T,containerBounds:h}),d=Ct($.sourceEvent,h)}).on("drag",$=>{const{autoPanOnNodeDrag:z,transform:j,snapGrid:B,snapToGrid:R,nodeDragThreshold:T,nodeLookup:A}=n(),L=Gn($.sourceEvent,{transform:j,snapGrid:B,snapToGrid:R,containerBounds:h});if(E=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||w&&!A.has(w))&&(u=!0),!u){if(!c&&z&&f&&(c=!0,P()),!f){const q=Ct($.sourceEvent,h),F=q.x-d.x,Y=q.y-d.y;Math.sqrt(F*F+Y*Y)>T&&_($)}(o.x!==L.xSnapped||o.y!==L.ySnapped)&&l&&f&&(d=Ct($.sourceEvent,h),D(L))}}).on("end",$=>{if(!(!f||u)&&(c=!1,f=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:z,updateNodePositions:j,onNodeDragStop:B,onSelectionDragStop:R}=n();if(x&&(j(l,!1),x=!1),i||B||!w&&R){const[T,A]=ns({nodeId:w,dragItems:l,nodeLookup:z,dragging:!1});i?.($.sourceEvent,l,T,A),B?.($.sourceEvent,T,A),w||R?.($.sourceEvent,A)}}}).filter($=>{const z=$.target;return!$.button&&(!y||!jo(z,`.${y}`,b))&&(!p||jo(z,p,b))});m.call(C)}function v(){m?.on(".drag",null)}return{update:S,destroy:v}}function xc(e,n,s){const r=[],i={x:e.x-s,y:e.y-s,width:s*2,height:s*2};for(const o of n.values())Jn(i,Ln(o))>0&&r.push(o);return r}const bc=250;function yc(e,n,s,r){let i=[],o=1/0;const a=xc(e,s,n+bc);for(const l of a){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const d of c){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:h,y:f}=hn(l,d,d.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(f-e.y,2));m>n||(m<o?(i=[{...d,x:h,y:f}],o=m):m===o&&i.push({...d,x:h,y:f}))}}if(!i.length)return null;if(i.length>1){const l=r.type==="source"?"target":"source";return i.find(c=>c.type===l)??i[0]}return i[0]}function ti(e,n,s,r,i,o=!1){const a=r.get(e);if(!a)return null;const l=i==="strict"?a.internals.handleBounds?.[n]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],c=(s?l?.find(d=>d.id===s):l?.[0])??null;return c&&o?{...c,...hn(a,c,c.position,!0)}:c}function ni(e,n){return e||(n?.classList.contains("target")?"target":n?.classList.contains("source")?"source":null)}function vc(e,n){let s=null;return n?s=!0:e&&!n&&(s=!1),s}const ri=()=>!0;function wc(e,{connectionMode:n,connectionRadius:s,handleId:r,nodeId:i,edgeUpdaterType:o,isTarget:a,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:h,flowId:f,panBy:m,cancelConnection:u,onConnectStart:x,onConnect:E,onConnectEnd:S,isValidConnection:v=ri,onReconnectEnd:y,updateConnection:p,getTransform:b,getFromHandle:N,autoPanSpeed:w,dragThreshold:M=1,handleDomNode:D}){const P=Wa(e.target);let _=0,C;const{x:$,y:z}=Ct(e),j=ni(o,D),B=l?.getBoundingClientRect();let R=!1;if(!B||!j)return;const T=ti(i,j,r,c,n);if(!T)return;let A=Ct(e,B),L=!1,q=null,F=!1,Y=null;function Q(){if(!h||!B)return;const[se,J]=za(A,B,w);m({x:se,y:J}),_=requestAnimationFrame(Q)}const O={...T,nodeId:i,type:j,position:T.position},I=c.get(i);let V={inProgress:!0,isValid:null,from:hn(I,O,ye.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:I,to:A,toHandle:null,toPosition:uo[O.position],toNode:null,pointer:A};function W(){R=!0,p(V),x?.(e,{nodeId:i,handleId:r,handleType:j})}M===0&&W();function X(se){if(!R){const{x:he,y:de}=Ct(se),Z=he-$,ae=de-z;if(!(Z*Z+ae*ae>M*M))return;W()}if(!N()||!O){ee(se);return}const J=b();A=Ct(se,B),C=yc(ir(A,J,!1,[1,1]),s,c,O),L||(Q(),L=!0);const U=si(se,{handle:C,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:v,doc:P,lib:d,flowId:f,nodeLookup:c});Y=U.handleDomNode,q=U.connection,F=vc(!!C,U.isValid);const oe=c.get(i),le=oe?hn(oe,O,ye.Left,!0):V.from,ie={...V,from:le,isValid:F,to:U.toHandle&&F?Dr({x:U.toHandle.x,y:U.toHandle.y},J):A,toHandle:U.toHandle,toPosition:F&&U.toHandle?U.toHandle.position:uo[O.position],toNode:U.toHandle?c.get(U.toHandle.nodeId):null,pointer:A};p(ie),V=ie}function ee(se){if(!("touches"in se&&se.touches.length>0)){if(R){(C||Y)&&q&&F&&E?.(q);const{inProgress:J,...U}=V,oe={...U,toPosition:V.toHandle?V.toPosition:null};S?.(se,oe),o&&y?.(se,oe)}u(),cancelAnimationFrame(_),L=!1,F=!1,q=null,Y=null,P.removeEventListener("mousemove",X),P.removeEventListener("mouseup",ee),P.removeEventListener("touchmove",X),P.removeEventListener("touchend",ee)}}P.addEventListener("mousemove",X),P.addEventListener("mouseup",ee),P.addEventListener("touchmove",X),P.addEventListener("touchend",ee)}function si(e,{handle:n,connectionMode:s,fromNodeId:r,fromHandleId:i,fromType:o,doc:a,lib:l,flowId:c,isValidConnection:d=ri,nodeLookup:h}){const f=o==="target",m=n?a.querySelector(`.${l}-flow__handle[data-id="${c}-${n?.nodeId}-${n?.id}-${n?.type}"]`):null,{x:u,y:x}=Ct(e),E=a.elementFromPoint(u,x),S=E?.classList.contains(`${l}-flow__handle`)?E:m,v={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const y=ni(void 0,S),p=S.getAttribute("data-nodeid"),b=S.getAttribute("data-handleid"),N=S.classList.contains("connectable"),w=S.classList.contains("connectableend");if(!p||!y)return v;const M={source:f?p:r,sourceHandle:f?b:i,target:f?r:p,targetHandle:f?i:b};v.connection=M;const P=N&&w&&(s===Rn.Strict?f&&y==="source"||!f&&y==="target":p!==r||b!==i);v.isValid=P&&d(M),v.toHandle=ti(p,y,b,h,s,!0)}return v}const xs={onPointerDown:wc,isValid:si};function kc({domNode:e,panZoom:n,getTransform:s,getViewScale:r}){const i=ht(e);function o({translateExtent:l,width:c,height:d,zoomStep:h=1,pannable:f=!0,zoomable:m=!0,inversePan:u=!1}){const x=p=>{if(p.sourceEvent.type!=="wheel"||!n)return;const b=s(),N=p.sourceEvent.ctrlKey&&er()?10:1,w=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*h,M=b[2]*Math.pow(2,w*N);n.scaleTo(M)};let E=[0,0];const S=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(E=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},v=p=>{const b=s();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!n)return;const N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],w=[N[0]-E[0],N[1]-E[1]];E=N;const M=r()*Math.max(b[2],Math.log(b[2]))*(u?-1:1),D={x:b[0]-w[0]*M,y:b[1]-w[1]*M},P=[[0,0],[c,d]];n.setViewportConstrained({x:D.x,y:D.y,zoom:b[2]},P,l)},y=_a().on("start",S).on("zoom",f?v:null).on("zoom.wheel",m?x:null);i.call(y,{})}function a(){i.on("zoom",null)}return{update:o,destroy:a,pointer:jt}}const zr=e=>({x:e.x,y:e.y,zoom:e.k}),rs=({x:e,y:n,zoom:s})=>ks.translate(e,n).scale(s),En=(e,n)=>e.target.closest(`.${n}`),oi=(e,n)=>n===2&&Array.isArray(e)&&e.includes(2),jc=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ss=(e,n=0,s=jc,r=()=>{})=>{const i=typeof n=="number"&&n>0;return i||r(),i?e.transition().duration(n).ease(s).on("end",r):e},ai=e=>{const n=e.ctrlKey&&er()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*n};function Nc({zoomPanValues:e,noWheelClassName:n,d3Selection:s,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:o,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return h=>{if(En(h,n))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const f=s.property("__zoom").k||1;if(h.ctrlKey&&a){const S=jt(h),v=ai(h),y=f*Math.pow(2,v);r.scaleTo(s,y,S,h);return}const m=h.deltaMode===1?20:1;let u=i===un.Vertical?0:h.deltaX*m,x=i===un.Horizontal?0:h.deltaY*m;!er()&&h.shiftKey&&i!==un.Vertical&&(u=h.deltaY*m,x=0),r.translateBy(s,-(u/f)*o,-(x/f)*o,{internal:!0});const E=zr(s.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(h,E),e.panScrollTimeout=setTimeout(()=>{d?.(h,E),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(h,E))}}function Cc({noWheelClassName:e,preventScrolling:n,d3ZoomHandler:s}){return function(r,i){const o=r.type==="wheel",a=!n&&o&&!r.ctrlKey,l=En(r,e);if(r.ctrlKey&&o&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),s.call(this,r,i)}}function Sc({zoomPanValues:e,onDraggingChange:n,onPanZoomStart:s}){return r=>{if(r.sourceEvent?.internal)return;const i=zr(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&n(!0),s&&s?.(r.sourceEvent,i)}}function Ec({zoomPanValues:e,panOnDrag:n,onPaneContextMenu:s,onTransformChange:r,onPanZoom:i}){return o=>{e.usedRightMouseButton=!!(s&&oi(n,e.mouseButton??0)),o.sourceEvent?.sync||r([o.transform.x,o.transform.y,o.transform.k]),i&&!o.sourceEvent?.internal&&i?.(o.sourceEvent,zr(o.transform))}}function Mc({zoomPanValues:e,panOnDrag:n,panOnScroll:s,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:o}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,o&&oi(n,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&o(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const l=zr(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,l)},s?150:0)}}}function Ic({zoomActivationKeyPressed:e,zoomOnScroll:n,zoomOnPinch:s,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:o,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:h}){return f=>{const m=e||n,u=s&&f.ctrlKey,x=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(En(f,`${d}-flow__node`)||En(f,`${d}-flow__edge`)))return!0;if(!r&&!m&&!i&&!o&&!s||a||h&&!x||En(f,l)&&x||En(f,c)&&(!x||i&&x&&!e)||!s&&f.ctrlKey&&x)return!1;if(!s&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!m&&!i&&!u&&x||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const E=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||x)&&E}}function Tc({domNode:e,minZoom:n,maxZoom:s,translateExtent:r,viewport:i,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),f=_a().scaleExtent([n,s]).translateExtent(r),m=ht(e).call(f);y({x:i.x,y:i.y,zoom:An(i.zoom,n,s)},[[0,0],[h.width,h.height]],r);const u=m.on("wheel.zoom"),x=m.on("dblclick.zoom");f.wheelDelta(ai);function E(C,$){return m?new Promise(z=>{f?.interpolate($?.interpolate==="linear"?Jr:Rr).transform(ss(m,$?.duration,$?.ease,()=>z(!0)),C)}):Promise.resolve(!1)}function S({noWheelClassName:C,noPanClassName:$,onPaneContextMenu:z,userSelectionActive:j,panOnScroll:B,panOnDrag:R,panOnScrollMode:T,panOnScrollSpeed:A,preventScrolling:L,zoomOnPinch:q,zoomOnScroll:F,zoomOnDoubleClick:Y,zoomActivationKeyPressed:Q,lib:O,onTransformChange:I,connectionInProgress:H,paneClickDistance:V,selectionOnDrag:W}){j&&!d.isZoomingOrPanning&&v();const X=B&&!Q&&!j;f.clickDistance(W?1/0:!Nt(V)||V<0?0:V);const ee=X?Nc({zoomPanValues:d,noWheelClassName:C,d3Selection:m,d3Zoom:f,panOnScrollMode:T,panOnScrollSpeed:A,zoomOnPinch:q,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:l}):Cc({noWheelClassName:C,preventScrolling:L,d3ZoomHandler:u});if(m.on("wheel.zoom",ee,{passive:!1}),!j){const J=Sc({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:a});f.on("start",J);const U=Ec({zoomPanValues:d,panOnDrag:R,onPaneContextMenu:!!z,onPanZoom:o,onTransformChange:I});f.on("zoom",U);const oe=Mc({zoomPanValues:d,panOnDrag:R,panOnScroll:B,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:c});f.on("end",oe)}const se=Ic({zoomActivationKeyPressed:Q,panOnDrag:R,zoomOnScroll:F,panOnScroll:B,zoomOnDoubleClick:Y,zoomOnPinch:q,userSelectionActive:j,noPanClassName:$,noWheelClassName:C,lib:O,connectionInProgress:H});f.filter(se),Y?m.on("dblclick.zoom",x):m.on("dblclick.zoom",null)}function v(){f.on("zoom",null)}async function y(C,$,z){const j=rs(C),B=f?.constrain()(j,$,z);return B&&await E(B),new Promise(R=>R(B))}async function p(C,$){const z=rs(C);return await E(z,$),new Promise(j=>j(z))}function b(C){if(m){const $=rs(C),z=m.property("__zoom");(z.k!==C.zoom||z.x!==C.x||z.y!==C.y)&&f?.transform(m,$,null,{sync:!0})}}function N(){const C=m?kl(m.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}function w(C,$){return m?new Promise(z=>{f?.interpolate($?.interpolate==="linear"?Jr:Rr).scaleTo(ss(m,$?.duration,$?.ease,()=>z(!0)),C)}):Promise.resolve(!1)}function M(C,$){return m?new Promise(z=>{f?.interpolate($?.interpolate==="linear"?Jr:Rr).scaleBy(ss(m,$?.duration,$?.ease,()=>z(!0)),C)}):Promise.resolve(!1)}function D(C){f?.scaleExtent(C)}function P(C){f?.translateExtent(C)}function _(C){const $=!Nt(C)||C<0?0:C;f?.clickDistance($)}return{update:S,destroy:v,setViewport:p,setViewportConstrained:y,getViewport:N,scaleTo:w,scaleBy:M,setScaleExtent:D,setTranslateExtent:P,syncViewport:b,setClickDistance:_}}var Pn;(function(e){e.Line="line",e.Handle="handle"})(Pn||(Pn={}));function Rc({width:e,prevWidth:n,height:s,prevHeight:r,affectsX:i,affectsY:o}){const a=e-n,l=s-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&o&&(c[1]=c[1]*-1),c}function No(e){const n=e.includes("right")||e.includes("left"),s=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:n,isVertical:s,affectsX:r,affectsY:i}}function Xt(e,n){return Math.max(0,n-e)}function Ut(e,n){return Math.max(0,e-n)}function Nr(e,n,s){return Math.max(0,n-e,e-s)}function Co(e,n){return e?!n:n}function _c(e,n,s,r,i,o,a,l){let{affectsX:c,affectsY:d}=n;const{isHorizontal:h,isVertical:f}=n,m=h&&f,{xSnapped:u,ySnapped:x}=s,{minWidth:E,maxWidth:S,minHeight:v,maxHeight:y}=r,{x:p,y:b,width:N,height:w,aspectRatio:M}=e;let D=Math.floor(h?u-e.pointerX:0),P=Math.floor(f?x-e.pointerY:0);const _=N+(c?-D:D),C=w+(d?-P:P),$=-o[0]*N,z=-o[1]*w;let j=Nr(_,E,S),B=Nr(C,v,y);if(a){let A=0,L=0;c&&D<0?A=Xt(p+D+$,a[0][0]):!c&&D>0&&(A=Ut(p+_+$,a[1][0])),d&&P<0?L=Xt(b+P+z,a[0][1]):!d&&P>0&&(L=Ut(b+C+z,a[1][1])),j=Math.max(j,A),B=Math.max(B,L)}if(l){let A=0,L=0;c&&D>0?A=Ut(p+D,l[0][0]):!c&&D<0&&(A=Xt(p+_,l[1][0])),d&&P>0?L=Ut(b+P,l[0][1]):!d&&P<0&&(L=Xt(b+C,l[1][1])),j=Math.max(j,A),B=Math.max(B,L)}if(i){if(h){const A=Nr(_/M,v,y)*M;if(j=Math.max(j,A),a){let L=0;!c&&!d||c&&!d&&m?L=Ut(b+z+_/M,a[1][1])*M:L=Xt(b+z+(c?D:-D)/M,a[0][1])*M,j=Math.max(j,L)}if(l){let L=0;!c&&!d||c&&!d&&m?L=Xt(b+_/M,l[1][1])*M:L=Ut(b+(c?D:-D)/M,l[0][1])*M,j=Math.max(j,L)}}if(f){const A=Nr(C*M,E,S)/M;if(B=Math.max(B,A),a){let L=0;!c&&!d||d&&!c&&m?L=Ut(p+C*M+$,a[1][0])/M:L=Xt(p+(d?P:-P)*M+$,a[0][0])/M,B=Math.max(B,L)}if(l){let L=0;!c&&!d||d&&!c&&m?L=Xt(p+C*M,l[1][0])/M:L=Ut(p+(d?P:-P)*M,l[0][0])/M,B=Math.max(B,L)}}}P=P+(P<0?B:-B),D=D+(D<0?j:-j),i&&(m?_>C*M?P=(Co(c,d)?-D:D)/M:D=(Co(c,d)?-P:P)*M:h?(P=D/M,d=c):(D=P*M,c=d));const R=c?p+D:p,T=d?b+P:b;return{width:N+(c?-D:D),height:w+(d?-P:P),x:o[0]*D*(c?-1:1)+R,y:o[1]*P*(d?-1:1)+T}}const ii={width:0,height:0,x:0,y:0},Ac={...ii,pointerX:0,pointerY:0,aspectRatio:1};function Lc(e){return[[0,0],[e.measured.width,e.measured.height]]}function Dc(e,n,s){const r=n.position.x+e.position.x,i=n.position.y+e.position.y,o=e.measured.width??0,a=e.measured.height??0,l=s[0]*o,c=s[1]*a;return[[r-l,i-c],[r+o-l,i+a-c]]}function Pc({domNode:e,nodeId:n,getStoreItems:s,onChange:r,onEnd:i}){const o=ht(e);let a={controlDirection:No("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:h,keepAspectRatio:f,resizeDirection:m,onResizeStart:u,onResize:x,onResizeEnd:E,shouldResize:S}){let v={...ii},y={...Ac};a={boundaries:h,resizeDirection:m,keepAspectRatio:f,controlDirection:No(d)};let p,b=null,N=[],w,M,D,P=!1;const _=Ra().on("start",C=>{const{nodeLookup:$,transform:z,snapGrid:j,snapToGrid:B,nodeOrigin:R,paneDomNode:T}=s();if(p=$.get(n),!p)return;b=T?.getBoundingClientRect()??null;const{xSnapped:A,ySnapped:L}=Gn(C.sourceEvent,{transform:z,snapGrid:j,snapToGrid:B,containerBounds:b});v={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},y={...v,pointerX:A,pointerY:L,aspectRatio:v.width/v.height},w=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(w=$.get(p.parentId),M=w&&p.extent==="parent"?Lc(w):void 0),N=[],D=void 0;for(const[q,F]of $)if(F.parentId===n&&(N.push({id:q,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const Y=Dc(F,p,F.origin??R);D?D=[[Math.min(Y[0][0],D[0][0]),Math.min(Y[0][1],D[0][1])],[Math.max(Y[1][0],D[1][0]),Math.max(Y[1][1],D[1][1])]]:D=Y}u?.(C,{...v})}).on("drag",C=>{const{transform:$,snapGrid:z,snapToGrid:j,nodeOrigin:B}=s(),R=Gn(C.sourceEvent,{transform:$,snapGrid:z,snapToGrid:j,containerBounds:b}),T=[];if(!p)return;const{x:A,y:L,width:q,height:F}=v,Y={},Q=p.origin??B,{width:O,height:I,x:H,y:V}=_c(y,a.controlDirection,R,a.boundaries,a.keepAspectRatio,Q,M,D),W=O!==q,X=I!==F,ee=H!==A&&W,se=V!==L&&X;if(!ee&&!se&&!W&&!X)return;if((ee||se||Q[0]===1||Q[1]===1)&&(Y.x=ee?H:v.x,Y.y=se?V:v.y,v.x=Y.x,v.y=Y.y,N.length>0)){const le=H-A,ie=V-L;for(const he of N)he.position={x:he.position.x-le+Q[0]*(O-q),y:he.position.y-ie+Q[1]*(I-F)},T.push(he)}if((W||X)&&(Y.width=W&&(!a.resizeDirection||a.resizeDirection==="horizontal")?O:v.width,Y.height=X&&(!a.resizeDirection||a.resizeDirection==="vertical")?I:v.height,v.width=Y.width,v.height=Y.height),w&&p.expandParent){const le=Q[0]*(Y.width??0);Y.x&&Y.x<le&&(v.x=le,y.x=y.x-(Y.x-le));const ie=Q[1]*(Y.height??0);Y.y&&Y.y<ie&&(v.y=ie,y.y=y.y-(Y.y-ie))}const J=Rc({width:v.width,prevWidth:q,height:v.height,prevHeight:F,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),U={...v,direction:J};S?.(C,U)!==!1&&(P=!0,x?.(C,U),r(Y,T))}).on("end",C=>{P&&(E?.(C,{...v}),i?.({...v}),P=!1)});o.call(_)}function c(){o.on(".drag",null)}return{update:l,destroy:c}}var os={exports:{}},as={};var So;function $c(){if(So)return as;So=1;var e=dl(),n=ul();function s(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var r=typeof Object.is=="function"?Object.is:s,i=n.useSyncExternalStore,o=e.useRef,a=e.useEffect,l=e.useMemo,c=e.useDebugValue;return as.useSyncExternalStoreWithSelector=function(d,h,f,m,u){var x=o(null);if(x.current===null){var E={hasValue:!1,value:null};x.current=E}else E=x.current;x=l(function(){function v(w){if(!y){if(y=!0,p=w,w=m(w),u!==void 0&&E.hasValue){var M=E.value;if(u(M,w))return b=M}return b=w}if(M=b,r(p,w))return M;var D=m(w);return u!==void 0&&u(M,D)?(p=w,M):(p=w,b=D)}var y=!1,p,b,N=f===void 0?null:f;return[function(){return v(h())},N===null?void 0:function(){return v(N())}]},[h,f,m,u]);var S=i(d,x[0],x[1]);return a(function(){E.hasValue=!0,E.value=S},[S]),c(S),S},as}var Eo;function Bc(){return Eo||(Eo=1,os.exports=$c()),os.exports}var Oc=Bc();const zc=fl(Oc),Hc={},Mo=e=>{let n;const s=new Set,r=(h,f)=>{const m=typeof h=="function"?h(n):h;if(!Object.is(m,n)){const u=n;n=f??(typeof m!="object"||m===null)?m:Object.assign({},n,m),s.forEach(x=>x(n,u))}},i=()=>n,c={setState:r,getState:i,getInitialState:()=>d,subscribe:h=>(s.add(h),()=>s.delete(h)),destroy:()=>{(Hc?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),s.clear()}},d=n=e(r,i,c);return c},qc=e=>e?Mo(e):Mo,{useDebugValue:Vc}=hl,{useSyncExternalStoreWithSelector:Wc}=zc,Fc=e=>e;function li(e,n=Fc,s){const r=Wc(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,s);return Vc(r),r}const Io=(e,n)=>{const s=qc(e),r=(i,o=n)=>li(s,i,o);return Object.assign(r,s),r},Yc=(e,n)=>e?Io(e,n):Io;function Oe(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[r,i]of e)if(!Object.is(i,n.get(r)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const r of e)if(!n.has(r))return!1;return!0}const s=Object.keys(e);if(s.length!==Object.keys(n).length)return!1;for(const r of s)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}const Hr=g.createContext(null),Gc=Hr.Provider,ci=Dt.error001();function Me(e,n){const s=g.useContext(Hr);if(s===null)throw new Error(ci);return li(s,e,n)}function Be(){const e=g.useContext(Hr);if(e===null)throw new Error(ci);return g.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const To={display:"none"},Zc={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},di="react-flow__node-desc",ui="react-flow__edge-desc",Xc="react-flow__aria-live",Uc=e=>e.ariaLiveMessage,Kc=e=>e.ariaLabelConfig;function Qc({rfId:e}){const n=Me(Uc);return t.jsx("div",{id:`${Xc}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Zc,children:n})}function Jc({rfId:e,disableKeyboardA11y:n}){const s=Me(Kc);return t.jsxs(t.Fragment,{children:[t.jsx("div",{id:`${di}-${e}`,style:To,children:n?s["node.a11yDescription.default"]:s["node.a11yDescription.keyboardDisabled"]}),t.jsx("div",{id:`${ui}-${e}`,style:To,children:s["edge.a11yDescription.default"]}),!n&&t.jsx(Qc,{rfId:e})]})}const qr=g.forwardRef(({position:e="top-left",children:n,className:s,style:r,...i},o)=>{const a=`${e}`.split("-");return t.jsx("div",{className:Ze(["react-flow__panel",s,...a]),style:r,ref:o,...i,children:n})});qr.displayName="Panel";function ed({proOptions:e,position:n="bottom-right"}){return e?.hideAttribution?null:t.jsx(qr,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:t.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const td=e=>{const n=[],s=[];for(const[,r]of e.nodeLookup)r.selected&&n.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&s.push(r);return{selectedNodes:n,selectedEdges:s}},Cr=e=>e.id;function nd(e,n){return Oe(e.selectedNodes.map(Cr),n.selectedNodes.map(Cr))&&Oe(e.selectedEdges.map(Cr),n.selectedEdges.map(Cr))}function rd({onSelectionChange:e}){const n=Be(),{selectedNodes:s,selectedEdges:r}=Me(td,nd);return g.useEffect(()=>{const i={nodes:s,edges:r};e?.(i),n.getState().onSelectionChangeHandlers.forEach(o=>o(i))},[s,r,e]),null}const sd=e=>!!e.onSelectionChangeHandlers;function od({onSelectionChange:e}){const n=Me(sd);return e||n?t.jsx(rd,{onSelectionChange:e}):null}const fi=[0,0],ad={x:0,y:0,zoom:1},id=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Ro=[...id,"rfId"],ld=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),_o={translateExtent:Kn,nodeOrigin:fi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function cd(e){const{setNodes:n,setEdges:s,setMinZoom:r,setMaxZoom:i,setTranslateExtent:o,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Me(ld,Oe),d=Be();g.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{h.current=_o,l()}),[]);const h=g.useRef(_o);return g.useEffect(()=>{for(const f of Ro){const m=e[f],u=h.current[f];m!==u&&(typeof e[f]>"u"||(f==="nodes"?n(m):f==="edges"?s(m):f==="minZoom"?r(m):f==="maxZoom"?i(m):f==="translateExtent"?o(m):f==="nodeExtent"?a(m):f==="ariaLabelConfig"?d.setState({ariaLabelConfig:Zl(m)}):f==="fitView"?d.setState({fitViewQueued:m}):f==="fitViewOptions"?d.setState({fitViewOptions:m}):d.setState({[f]:m})))}h.current=e},Ro.map(f=>e[f])),null}function Ao(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function dd(e){const[n,s]=g.useState(e==="system"?null:e);return g.useEffect(()=>{if(e!=="system"){s(e);return}const r=Ao(),i=()=>s(r?.matches?"dark":"light");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),n!==null?n:Ao()?.matches?"dark":"light"}const Lo=typeof document<"u"?document:null;function tr(e=null,n={target:Lo,actInsideInputWithModifier:!0}){const[s,r]=g.useState(!1),i=g.useRef(!1),o=g.useRef(new Set([])),[a,l]=g.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as ln,a0 as an,a1 as G,a2 as q,a3 as z,a4 as un,a5 as y,a6 as tn,a7 as K,a8 as _,a9 as rn,aa as o,ab as on,ac as sn,ad as fn}from"./mermaid.core-
|
|
1
|
+
import{$ as ln,a0 as an,a1 as G,a2 as q,a3 as z,a4 as un,a5 as y,a6 as tn,a7 as K,a8 as _,a9 as rn,aa as o,ab as on,ac as sn,ad as fn}from"./mermaid.core-Cxm0p7KD.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,B,a){var O=I-l,i=D-h,n=B-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function V(l,h,I,D,v,A,B){var a=l-I,O=h-D,i=(B?A:-A)/K(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,C=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*K(on(0,T*T*R-P*P)),$=(P*g-m*S)/R,j=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=$-C,e=j-t,r=w-C,F=p-t;return x*x+e*e>r*r+F*F&&($=w,j=p),{cx:$,cy:j,x01:-n,y01:-d,x11:$*(v/T-1),y11:j*(v/T-1)}}function hn(){var l=cn,h=yn,I=z(0),D=null,v=gn,A=dn,B=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,C=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(C>tn-y)a.moveTo(s*G(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*G(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=C,S=C,$=B.apply(this,arguments)/2,j=$>y&&(D?+D.apply(this,arguments):K(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(j>y){var F=sn(j/u*q($)),L=sn(j/s*q($));(P-=F*2)>y?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(S-=L*2)>y?(L*=t?1:-1,m+=L,g-=L):(S=0,m=g=(f+c)/2)}var H=s*G(m),J=s*q(m),M=u*G(T),N=u*q(T);if(w>y){var Q=s*G(g),U=s*q(g),W=u*G(R),X=u*q(R),E;if(C<an)if(E=pn(H,J,W,X,Q,U,M,N)){var Y=H-E[0],Z=J-E[1],b=Q-E[0],k=U-E[1],nn=1/q(fn((Y*b+Z*k)/(K(Y*Y+Z*Z)*K(b*b+k*k)))/2),en=K(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(H,J),a.arc(0,0,s,m,g,!t)):a.moveTo(H,J),!(u>y)||!(P>y)?a.lineTo(M,N):p>y?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[G(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:z(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:z(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:z(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:z(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:z(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:z(+n),i):A},i.padAngle=function(n){return arguments.length?(B=typeof n=="function"?n:z(+n),i):B},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|