@markus-global/cli 0.12.1-rc.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/web-ui/assets/{AsyncState-BE4ycfHk.js → AsyncState-BHJmTFGQ.js} +1 -1
  2. package/dist/web-ui/assets/{CommentInput-DQIh2AYB.js → CommentInput-_MNbHPyZ.js} +1 -1
  3. package/dist/web-ui/assets/{ContentRenderer-C0L1YkNl.js → ContentRenderer-BZE1MgEd.js} +2 -2
  4. package/dist/web-ui/assets/{DeliverableShareModal-KlLlP9Fe.js → DeliverableShareModal-7JeMgA4i.js} +1 -1
  5. package/dist/web-ui/assets/{Deliverables-CiqT2Ipg.js → Deliverables-JAEyj1G5.js} +1 -1
  6. package/dist/web-ui/assets/{Notifications-82rU7lAf.js → Notifications-Cglxf3qB.js} +1 -1
  7. package/dist/web-ui/assets/{Search-CNNN3duL.js → Search-BEdo0mX0.js} +1 -1
  8. package/dist/web-ui/assets/{SendToChat-EsNVdiYI.js → SendToChat-BmvnXP0P.js} +1 -1
  9. package/dist/web-ui/assets/{Settings-COmJTMaX.js → Settings-KmHPAKN6.js} +1 -1
  10. package/dist/web-ui/assets/{Store-Cb-RBY68.js → Store-BBHR--46.js} +1 -1
  11. package/dist/web-ui/assets/{Switch-SqNs6-fd.js → Switch-K1e6e4hc.js} +1 -1
  12. package/dist/web-ui/assets/{Team-DA5MQ-20.js → Team-D9dH6E4e.js} +10 -10
  13. package/dist/web-ui/assets/{Work-D4noaLBo.js → Work-GEG7j9GK.js} +1 -1
  14. package/dist/web-ui/assets/{arc-BOFJ1EJN.js → arc-D4YLoqs7.js} +1 -1
  15. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-BQ0qr0Vl.js → architectureDiagram-3BPJPVTR-CICoK0lg.js} +1 -1
  16. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-kSXlCE5q.js → blockDiagram-GPEHLZMM-YqHnK4h5.js} +1 -1
  17. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-kCxqEGe5.js → c4Diagram-AAUBKEIU-Y_vGjHQO.js} +1 -1
  18. package/dist/web-ui/assets/channel-Cn05V55D.js +1 -0
  19. package/dist/web-ui/assets/{chunk-2J33WTMH-BgMluOvE.js → chunk-2J33WTMH-B7Y7BiO8.js} +1 -1
  20. package/dist/web-ui/assets/{chunk-4BX2VUAB-tu9bzY5y.js → chunk-4BX2VUAB-ptViVnI-.js} +1 -1
  21. package/dist/web-ui/assets/{chunk-55IACEB6-DK9D0I2N.js → chunk-55IACEB6-BdPUJYak.js} +1 -1
  22. package/dist/web-ui/assets/{chunk-727SXJPM-D_5Cdc0d.js → chunk-727SXJPM-AzjCfJBz.js} +1 -1
  23. package/dist/web-ui/assets/{chunk-AQP2D5EJ-BUmO_w99.js → chunk-AQP2D5EJ-CqpVUue3.js} +1 -1
  24. package/dist/web-ui/assets/{chunk-FMBD7UC4-Ck9FWl7n.js → chunk-FMBD7UC4-BLWAcGe-.js} +1 -1
  25. package/dist/web-ui/assets/{chunk-ND2GUHAM-Mvxy6fm4.js → chunk-ND2GUHAM-CFyia0QE.js} +1 -1
  26. package/dist/web-ui/assets/{chunk-QZHKN3VN-C9xMd3WM.js → chunk-QZHKN3VN-Dj_3cO-v.js} +1 -1
  27. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-iAPqeQZG.js +1 -0
  28. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-iAPqeQZG.js +1 -0
  29. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-CUTkidkC.js → cose-bilkent-S5V4N54A-zGoZob5l.js} +1 -1
  30. package/dist/web-ui/assets/{dagre-BM42HDAG-CGLda2Em.js → dagre-BM42HDAG-Bc25zx-t.js} +1 -1
  31. package/dist/web-ui/assets/{diagram-2AECGRRQ-DRl88ns2.js → diagram-2AECGRRQ-Cv3ed92q.js} +1 -1
  32. package/dist/web-ui/assets/{diagram-5GNKFQAL-rf4YhM9A.js → diagram-5GNKFQAL-BWe1Uvyp.js} +1 -1
  33. package/dist/web-ui/assets/{diagram-KO2AKTUF-BD8mjYi6.js → diagram-KO2AKTUF-DjzFiDTk.js} +1 -1
  34. package/dist/web-ui/assets/{diagram-LMA3HP47-DiZICe4t.js → diagram-LMA3HP47-BwgC-TO3.js} +1 -1
  35. package/dist/web-ui/assets/{diagram-OG6HWLK6-Dj0Mw95G.js → diagram-OG6HWLK6-lNXyX77s.js} +1 -1
  36. package/dist/web-ui/assets/{docx-preview-DQSKxlsK.js → docx-preview-DHEwVr7V.js} +1 -1
  37. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-BQq31SZZ.js → erDiagram-TEJ5UH35-nNeltlYB.js} +1 -1
  38. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-Cc82cW20.js → flowDiagram-I6XJVG4X-B9J9RkbK.js} +1 -1
  39. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-D1MzI2Uw.js → ganttDiagram-6RSMTGT7-uYRLe9ka.js} +1 -1
  40. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-D1v-40GN.js → gitGraphDiagram-PVQCEYII-U0zgRJcQ.js} +1 -1
  41. package/dist/web-ui/assets/index-BEhLix2_.css +1 -0
  42. package/dist/web-ui/assets/{index-BXWHxoXp.js → index-CJlhDWEX.js} +79 -79
  43. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-COPRgK1x.js → infoDiagram-5YYISTIA-DmOdBju_.js} +1 -1
  44. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-BmrWPE_9.js → ishikawaDiagram-YF4QCWOH-B7EjJewZ.js} +1 -1
  45. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-C7WKxQjK.js → journeyDiagram-JHISSGLW-DgGbUYlK.js} +1 -1
  46. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-yNU5HtNI.js → kanban-definition-UN3LZRKU-6V1jdjY6.js} +1 -1
  47. package/dist/web-ui/assets/{mermaid.core-B-JixiD0.js → mermaid.core-BFVdXW7F.js} +5 -5
  48. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-CIC2Ov1E.js → mindmap-definition-RKZ34NQL-iBwppEK5.js} +1 -1
  49. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-CJn4Ut9d.js → pieDiagram-4H26LBE5-CdjlLYAD.js} +1 -1
  50. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-DcRyVlzO.js → quadrantDiagram-W4KKPZXB-DcAFSRhx.js} +1 -1
  51. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-DiNbCJGt.js → requirementDiagram-4Y6WPE33-B8BXF95J.js} +1 -1
  52. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-RHicfbUP.js → sankeyDiagram-5OEKKPKP-zxjXIxe3.js} +1 -1
  53. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-P1XTa1MM.js → sequenceDiagram-3UESZ5HK-yLejO52U.js} +1 -1
  54. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-Dbu2PX-0.js → stateDiagram-AJRCARHV-Bbg9hYWC.js} +1 -1
  55. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-ofC5xEMJ.js +1 -0
  56. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-DGJ5VfHk.js → timeline-definition-PNZ67QCA-ByVOplNZ.js} +1 -1
  57. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-B9fLD2oz.js → vennDiagram-CIIHVFJN-BtpVxrtr.js} +1 -1
  58. package/dist/web-ui/assets/{wardley-L42UT6IY-CH2NYUlK.js → wardley-L42UT6IY-BIfsUruJ.js} +1 -1
  59. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-efQZMvBj.js → wardleyDiagram-YWT4CUSO-C5RXViAU.js} +1 -1
  60. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-BNcrfIXF.js → xychartDiagram-2RQKCTM6-BeggYgqu.js} +1 -1
  61. package/dist/web-ui/index.html +2 -2
  62. package/package.json +1 -1
  63. package/dist/web-ui/assets/channel-MEPTI8rz.js +0 -1
  64. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-C-iFEC5t.js +0 -1
  65. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-C-iFEC5t.js +0 -1
  66. package/dist/web-ui/assets/index-B0GCqbye.css +0 -1
  67. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-BVoD4Uz4.js +0 -1
@@ -1,4 +1,4 @@
1
- import{u as ze,j as r,b9 as mf,ba as pf,y as gf,bb as xf,r as p,l as ne,Y as bf,a as hr,k as yf,n as en,P as Ze,Z as jc,b as wf,c as kf,m as vf,s as Pi,bc as jf,bd as Nf,w as Ht,aN as zt,be as Pr,p as Br,M as Sf,i as Cf,C as gs,q as rr,d as Ef,bf as Nc,A as Ea,af as Bi,bg as zi,bh as qi,O as Tf,ad as Sc,bi as If,bj as Mf,bk as Cc,bl as Af,ae as Lf}from"./index-BXWHxoXp.js";import{S as Ec,a as Tc,r as Ic,s as _f}from"./SendToChat-EsNVdiYI.js";import{L as Rf,P as Df}from"./AsyncState-BE4ycfHk.js";import{ContentRenderer as Of}from"./ContentRenderer-C0L1YkNl.js";import{s as qt,g as Mc,j as Ta,T as Ho,k as Wo,t as $f}from"./transform-BqqRT-Iy.js";import{i as Vo}from"./value-wA6veExk.js";import{C as Ac}from"./CommentInput-DQIh2AYB.js";function Pf(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Zt(e,t){if(e=Pf(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Bf={passive:!1},or={capture:!0,passive:!1};function Ko(e){e.stopImmediatePropagation()}function js(e){e.preventDefault(),e.stopImmediatePropagation()}function Lc(e){var t=e.document.documentElement,n=qt(e).on("dragstart.drag",js,or);"onselectstart"in t?n.on("selectstart.drag",js,or):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function _c(e,t){var n=e.document.documentElement,s=qt(e).on("dragstart.drag",null);t&&(s.on("click.drag",js,or),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const zr=e=>()=>e;function da(e,{sourceEvent:t,subject:n,target:s,identifier:o,active:a,x:i,y:l,dx:c,dy:d,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:i,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}})}da.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function zf(e){return!e.ctrlKey&&!e.button}function qf(){return this.parentNode}function Ff(e,t){return t??{x:e.x,y:e.y}}function Hf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Rc(){var e=zf,t=qf,n=Ff,s=Hf,o={},a=Mc("start","drag","end"),i=0,l,c,d,h,u=0;function f(w){w.on("mousedown.drag",m).filter(s).on("touchstart.drag",k).on("touchmove.drag",v,Bf).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,N){if(!(h||!e.call(this,w,N))){var j=x(this,t.call(this,w,N),w,N,"mouse");j&&(qt(w.view).on("mousemove.drag",g,or).on("mouseup.drag",y,or),Lc(w.view),Ko(w),d=!1,l=w.clientX,c=w.clientY,j("start",w))}}function g(w){if(js(w),!d){var N=w.clientX-l,j=w.clientY-c;d=N*N+j*j>u}o.mouse("drag",w)}function y(w){qt(w.view).on("mousemove.drag mouseup.drag",null),_c(w.view,d),js(w),o.mouse("end",w)}function k(w,N){if(e.call(this,w,N)){var j=w.changedTouches,E=t.call(this,w,N),C=j.length,D,_;for(D=0;D<C;++D)(_=x(this,E,w,N,j[D].identifier,j[D]))&&(Ko(w),_("start",w,j[D]))}}function v(w){var N=w.changedTouches,j=N.length,E,C;for(E=0;E<j;++E)(C=o[N[E].identifier])&&(js(w),C("drag",w,N[E]))}function b(w){var N=w.changedTouches,j=N.length,E,C;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),E=0;E<j;++E)(C=o[N[E].identifier])&&(Ko(w),C("end",w,N[E]))}function x(w,N,j,E,C,D){var _=a.copy(),I=Zt(D||j,N),O,q,T;if((T=n.call(w,new da("beforestart",{sourceEvent:j,target:f,identifier:C,active:i,x:I[0],y:I[1],dx:0,dy:0,dispatch:_}),E))!=null)return O=T.x-I[0]||0,q=T.y-I[1]||0,function B(L,z,R){var A=I,$;switch(L){case"start":o[C]=B,$=i++;break;case"end":delete o[C],--i;case"drag":I=Zt(R||z,N),$=i;break}_.call(L,w,new da(L,{sourceEvent:z,subject:T,target:f,identifier:C,active:$,x:I[0]+O,y:I[1]+q,dx:I[0]-A[0],dy:I[1]-A[1],dispatch:_}),E)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:zr(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:zr(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:zr(w),f):n},f.touchable=function(w){return arguments.length?(s=typeof w=="function"?w:zr(!!w),f):s},f.on=function(){var w=a.on.apply(a,arguments);return w===a?f:w},f.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,f):Math.sqrt(u)},f}var Wf=1e-12;function Fi(e){return((e=Math.exp(e))+1/e)/2}function Vf(e){return((e=Math.exp(e))-1/e)/2}function Kf(e){return((e=Math.exp(2*e))-1)/(e+1)}const no=(function e(t,n,s){function o(a,i){var l=a[0],c=a[1],d=a[2],h=i[0],u=i[1],f=i[2],m=h-l,g=u-c,y=m*m+g*g,k,v;if(y<Wf)v=Math.log(f/d)/t,k=function(E){return[l+E*m,c+E*g,d*Math.exp(t*E*v)]};else{var b=Math.sqrt(y),x=(f*f-d*d+s*y)/(2*d*n*b),w=(f*f-d*d-s*y)/(2*f*n*b),N=Math.log(Math.sqrt(x*x+1)-x),j=Math.log(Math.sqrt(w*w+1)-w);v=(j-N)/t,k=function(E){var C=E*v,D=Fi(N),_=d/(n*b)*(D*Kf(t*C+N)-Vf(N));return[l+_*m,c+_*g,d*D/Fi(t*C+N)]}}return k.duration=v*1e3*t/Math.SQRT2,k}return o.rho=function(a){var i=Math.max(.001,+a),l=i*i,c=l*l;return e(i,l,c)},o})(Math.SQRT2,2,4),qr=e=>()=>e;function Uf(e,{sourceEvent:t,target:n,transform:s,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:o}})}function Uo(e){e.stopImmediatePropagation()}function Zs(e){e.preventDefault(),e.stopImmediatePropagation()}function Yf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Gf(){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 Hi(){return this.__zoom||Ta}function Xf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Zf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qf(e,t,n){var s=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o),i>a?(a+i)/2:Math.min(0,a)||Math.max(0,i))}function Dc(){var e=Yf,t=Gf,n=Qf,s=Xf,o=Zf,a=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,c=no,d=Mc("start","zoom","end"),h,u,f,m=500,g=150,y=0,k=10;function v(T){T.property("__zoom",Hi).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",_).filter(o).on("touchstart.zoom",I).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(T,B,L,z){var R=T.selection?T.selection():T;R.property("__zoom",Hi),T!==R?N(T,B,L,z):R.interrupt().each(function(){j(this,arguments).event(z).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},v.scaleBy=function(T,B,L,z){v.scaleTo(T,function(){var R=this.__zoom.k,A=typeof B=="function"?B.apply(this,arguments):B;return R*A},L,z)},v.scaleTo=function(T,B,L,z){v.transform(T,function(){var R=t.apply(this,arguments),A=this.__zoom,$=L==null?w(R):typeof L=="function"?L.apply(this,arguments):L,F=A.invert($),W=typeof B=="function"?B.apply(this,arguments):B;return n(x(b(A,W),$,F),R,i)},L,z)},v.translateBy=function(T,B,L,z){v.transform(T,function(){return n(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),i)},null,z)},v.translateTo=function(T,B,L,z,R){v.transform(T,function(){var A=t.apply(this,arguments),$=this.__zoom,F=z==null?w(A):typeof z=="function"?z.apply(this,arguments):z;return n(Ta.translate(F[0],F[1]).scale($.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof L=="function"?-L.apply(this,arguments):-L),A,i)},z,R)};function b(T,B){return B=Math.max(a[0],Math.min(a[1],B)),B===T.k?T:new Ho(B,T.x,T.y)}function x(T,B,L){var z=B[0]-L[0]*T.k,R=B[1]-L[1]*T.k;return z===T.x&&R===T.y?T:new Ho(T.k,z,R)}function w(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function N(T,B,L,z){T.on("start.zoom",function(){j(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(z).end()}).tween("zoom",function(){var R=this,A=arguments,$=j(R,A).event(z),F=t.apply(R,A),W=L==null?w(F):typeof L=="function"?L.apply(R,A):L,X=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),P=R.__zoom,M=typeof B=="function"?B.apply(R,A):B,K=c(P.invert(W).concat(X/P.k),M.invert(W).concat(X/M.k));return function(V){if(V===1)V=M;else{var H=K(V),Z=X/H[2];V=new Ho(Z,W[0]-H[0]*Z,W[1]-H[1]*Z)}$.zoom(null,V)}})}function j(T,B,L){return!L&&T.__zooming||new E(T,B)}function E(T,B){this.that=T,this.args=B,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,B),this.taps=0}E.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,B){return this.mouse&&T!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&T!=="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(T){var B=qt(this.that).datum();d.call(T,this.that,new Uf(T,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:d}),B)}};function C(T,...B){if(!e.apply(this,arguments))return;var L=j(this,B).event(T),z=this.__zoom,R=Math.max(a[0],Math.min(a[1],z.k*Math.pow(2,s.apply(this,arguments)))),A=Zt(T);if(L.wheel)(L.mouse[0][0]!==A[0]||L.mouse[0][1]!==A[1])&&(L.mouse[1]=z.invert(L.mouse[0]=A)),clearTimeout(L.wheel);else{if(z.k===R)return;L.mouse=[A,z.invert(A)],Wo(this),L.start()}Zs(T),L.wheel=setTimeout($,g),L.zoom("mouse",n(x(b(z,R),L.mouse[0],L.mouse[1]),L.extent,i));function $(){L.wheel=null,L.end()}}function D(T,...B){if(f||!e.apply(this,arguments))return;var L=T.currentTarget,z=j(this,B,!0).event(T),R=qt(T.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",X,!0),A=Zt(T,L),$=T.clientX,F=T.clientY;Lc(T.view),Uo(T),z.mouse=[A,this.__zoom.invert(A)],Wo(this),z.start();function W(P){if(Zs(P),!z.moved){var M=P.clientX-$,K=P.clientY-F;z.moved=M*M+K*K>y}z.event(P).zoom("mouse",n(x(z.that.__zoom,z.mouse[0]=Zt(P,L),z.mouse[1]),z.extent,i))}function X(P){R.on("mousemove.zoom mouseup.zoom",null),_c(P.view,z.moved),Zs(P),z.event(P).end()}}function _(T,...B){if(e.apply(this,arguments)){var L=this.__zoom,z=Zt(T.changedTouches?T.changedTouches[0]:T,this),R=L.invert(z),A=L.k*(T.shiftKey?.5:2),$=n(x(b(L,A),z,R),t.apply(this,B),i);Zs(T),l>0?qt(this).transition().duration(l).call(N,$,z,T):qt(this).call(v.transform,$,z,T)}}function I(T,...B){if(e.apply(this,arguments)){var L=T.touches,z=L.length,R=j(this,B,T.changedTouches.length===z).event(T),A,$,F,W;for(Uo(T),$=0;$<z;++$)F=L[$],W=Zt(F,this),W=[W,this.__zoom.invert(W),F.identifier],R.touch0?!R.touch1&&R.touch0[2]!==W[2]&&(R.touch1=W,R.taps=0):(R.touch0=W,A=!0,R.taps=1+!!h);h&&(h=clearTimeout(h)),A&&(R.taps<2&&(u=W[0],h=setTimeout(function(){h=null},m)),Wo(this),R.start())}}function O(T,...B){if(this.__zooming){var L=j(this,B).event(T),z=T.changedTouches,R=z.length,A,$,F,W;for(Zs(T),A=0;A<R;++A)$=z[A],F=Zt($,this),L.touch0&&L.touch0[2]===$.identifier?L.touch0[0]=F:L.touch1&&L.touch1[2]===$.identifier&&(L.touch1[0]=F);if($=L.that.__zoom,L.touch1){var X=L.touch0[0],P=L.touch0[1],M=L.touch1[0],K=L.touch1[1],V=(V=M[0]-X[0])*V+(V=M[1]-X[1])*V,H=(H=K[0]-P[0])*H+(H=K[1]-P[1])*H;$=b($,Math.sqrt(V/H)),F=[(X[0]+M[0])/2,(X[1]+M[1])/2],W=[(P[0]+K[0])/2,(P[1]+K[1])/2]}else if(L.touch0)F=L.touch0[0],W=L.touch0[1];else return;L.zoom("touch",n(x($,F,W),L.extent,i))}}function q(T,...B){if(this.__zooming){var L=j(this,B).event(T),z=T.changedTouches,R=z.length,A,$;for(Uo(T),f&&clearTimeout(f),f=setTimeout(function(){f=null},m),A=0;A<R;++A)$=z[A],L.touch0&&L.touch0[2]===$.identifier?delete L.touch0:L.touch1&&L.touch1[2]===$.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&($=Zt($,this),Math.hypot(u[0]-$[0],u[1]-$[1])<k)){var F=qt(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return v.wheelDelta=function(T){return arguments.length?(s=typeof T=="function"?T:qr(+T),v):s},v.filter=function(T){return arguments.length?(e=typeof T=="function"?T:qr(!!T),v):e},v.touchable=function(T){return arguments.length?(o=typeof T=="function"?T:qr(!!T),v):o},v.extent=function(T){return arguments.length?(t=typeof T=="function"?T:qr([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),v):t},v.scaleExtent=function(T){return arguments.length?(a[0]=+T[0],a[1]=+T[1],v):[a[0],a[1]]},v.translateExtent=function(T){return arguments.length?(i[0][0]=+T[0][0],i[1][0]=+T[1][0],i[0][1]=+T[0][1],i[1][1]=+T[1][1],v):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},v.constrain=function(T){return arguments.length?(n=T,v):n},v.duration=function(T){return arguments.length?(l=+T,v):l},v.interpolate=function(T){return arguments.length?(c=T,v):c},v.on=function(){var T=d.on.apply(d,arguments);return T===d?v:T},v.clickDistance=function(T){return arguments.length?(y=(T=+T)*T,v):Math.sqrt(y)},v.tapDistance=function(T){return arguments.length?(k=+T,v):k},v}const Jf=["30m","1h","2h","4h","8h","12h","1d","1w"],eh={"30m":"freq30m","1h":"freq1h","2h":"freq2h","4h":"freq4h","8h":"freq8h","12h":"freq12h","1d":"freq1d","1w":"freq1w"};function Wi(e){return eh[e]??"freq4h"}function th(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function ua(){return{mode:"calendar",every:"4h",calendar:"daily",weekdays:[1,2,3,4,5],time:"09:00",cron:"",maxRuns:"",timezone:th()}}function Oc(e){const t=/^(\d{1,2}):(\d{2})$/.exec((e??"").trim());if(!t)return[9,0];const n=Math.min(23,Math.max(0,parseInt(t[1],10))),s=Math.min(59,Math.max(0,parseInt(t[2],10)));return[n,s]}function nh(e){const[t,n]=Oc(e);return`${String(t).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function sh(e,t,n){if(e==="cron")return"";const[s,o]=Oc(n),a=e==="daily"?"*":e==="weekdays"?"1-5":t.length>0?[...t].sort((i,l)=>i-l).join(","):"*";return`${o} ${s} * * ${a}`}function rh(e){const t=/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+(\S+)$/.exec((e??"").trim());if(!t)return null;const n=parseInt(t[1],10),s=parseInt(t[2],10);if(n>59||s>23)return null;const o=t[3],a=`${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`;if(o==="*")return{calendar:"daily",weekdays:[1,2,3,4,5],time:a};if(o==="1-5")return{calendar:"weekdays",weekdays:[1,2,3,4,5],time:a};if(/^\d(,\d)*$/.test(o)){const i=o.split(",").map(l=>parseInt(l,10)).filter(l=>l>=0&&l<=6);if(i.length>0)return{calendar:"weekly",weekdays:i,time:a}}return null}function oh(e){const t=ua();if(!e)return t;if(e.timezone&&(t.timezone=e.timezone),t.maxRuns=e.maxRuns&&e.maxRuns>0?String(e.maxRuns):"",e.cron){const n=rh(e.cron);t.mode="calendar",n?(t.calendar=n.calendar,t.weekdays=n.weekdays,t.time=n.time):(t.calendar="cron",t.cron=e.cron)}else e.every&&(t.mode="interval",t.every=e.every);return t}function $c(e){const t={};e.mode==="interval"?t.every=e.every||"4h":(t.cron=e.calendar==="cron"?e.cron.trim():sh(e.calendar,e.weekdays,e.time),e.timezone&&(t.timezone=e.timezone));const n=parseInt(e.maxRuns,10);return e.maxRuns.trim()!==""&&Number.isFinite(n)&&n>0&&(t.maxRuns=n),t}const ah=[1,2,3,4,5,6,0];function ih({options:e,value:t,onChange:n,size:s="md"}){const o=s==="sm"?"px-2.5 py-1 text-xs":"px-3 py-1.5 text-sm";return r.jsx("div",{className:"inline-flex rounded-lg border border-border-default overflow-hidden",children:e.map(a=>r.jsx("button",{type:"button",onClick:()=>n(a.value),className:`${o} transition-colors ${t===a.value?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:a.label},a.value))})}function Pc({value:e,onChange:t,compact:n=!1}){const{t:s}=ze(),o=h=>t({...e,...h}),a=`px-2 py-1.5 bg-surface-elevated border border-border-default rounded-lg outline-none focus:border-brand-500 ${n?"text-xs":"text-sm"}`,i=h=>{const f=e.weekdays.includes(h)?e.weekdays.filter(m=>m!==h):[...e.weekdays,h];o({weekdays:f})};let l;if(e.mode==="interval")l=s(`work:task.${Wi(e.every)}`);else if(e.calendar==="cron")l=s("work:task.scheduleCron",{expr:e.cron.trim()||"—"});else{const h=nh(e.time);if(e.calendar==="daily")l=s("work:task.scheduleDailyAt",{time:h});else if(e.calendar==="weekdays")l=s("work:task.scheduleWeekdaysAt",{time:h});else{const u=[...e.weekdays].sort((f,m)=>f-m).map(f=>s(`work:task.weekdayShort.${f}`)).join(" ");l=e.weekdays.length?s("work:task.scheduleWeeklyAt",{days:u,time:h}):s("work:task.scheduleNoDays")}}const c=e.calendar==="daily"||e.calendar==="weekdays"||e.calendar==="weekly",d="text-fg-tertiary shrink-0 text-xs w-20";return r.jsxs("div",{className:"rounded-lg border border-border-default/70 bg-surface-elevated/40 p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleRepeatMode")}),r.jsx(ih,{size:n?"sm":"md",value:e.mode,onChange:h=>o({mode:h}),options:[{value:"interval",label:s("work:task.scheduleByInterval")},{value:"calendar",label:s("work:task.scheduleByCalendar")}]})]}),e.mode==="interval"?r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleEveryLabel")}),r.jsx("select",{value:e.every,onChange:h=>o({every:h.target.value}),className:a,children:Jf.map(h=>r.jsx("option",{value:h,children:s(`work:task.${Wi(h)}`)},h))})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleRepeatLabel")}),r.jsxs("select",{value:e.calendar,onChange:h=>o({calendar:h.target.value}),className:a,children:[r.jsx("option",{value:"daily",children:s("work:task.scheduleCalendarDaily")}),r.jsx("option",{value:"weekdays",children:s("work:task.scheduleCalendarWeekdays")}),r.jsx("option",{value:"weekly",children:s("work:task.scheduleCalendarWeekly")}),r.jsx("option",{value:"cron",children:s("work:task.scheduleCalendarCron")})]}),c&&r.jsx("input",{type:"time",value:e.time,onChange:h=>o({time:h.target.value}),className:a})]}),e.calendar==="weekly"&&r.jsx("div",{className:"flex flex-wrap gap-1 pl-[5.5rem]",children:ah.map(h=>{const u=e.weekdays.includes(h);return r.jsx("button",{type:"button",onClick:()=>i(h),className:`w-7 h-7 rounded-full text-xs transition-colors ${u?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary border border-border-default hover:text-fg-primary"}`,children:s(`work:task.weekdayShort.${h}`)},h)})}),e.calendar==="cron"&&r.jsx("input",{value:e.cron,onChange:h=>o({cron:h.target.value}),placeholder:"0 9 * * 1-5",className:`${a} w-full font-mono`})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleMaxRuns")}),r.jsx("input",{value:e.maxRuns,onChange:h=>o({maxRuns:h.target.value.replace(/\D/g,"")}),placeholder:s("work:task.scheduleMaxRunsPlaceholder"),className:`${a} w-20`})]}),r.jsxs("div",{className:"text-[11px] text-fg-secondary pt-1 border-t border-border-default/50",children:[s("work:task.schedulePreview",{desc:l}),r.jsxs("span",{className:"text-fg-tertiary",children:[" · ",s("work:task.scheduleTimezoneNote",{tz:e.timezone})]})]})]})}function yt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=yt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const ln={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ar=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Bc=["Enter"," ","Escape"],zc={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Cs;(function(e){e.Strict="strict",e.Loose="loose"})(Cs||(Cs={}));var Xn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Xn||(Xn={}));var ir;(function(e){e.Partial="partial",e.Full="full"})(ir||(ir={}));const qc={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Sn;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Sn||(Sn={}));var Es;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Es||(Es={}));var Ne;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ne||(Ne={}));const Vi={[Ne.Left]:Ne.Right,[Ne.Right]:Ne.Left,[Ne.Top]:Ne.Bottom,[Ne.Bottom]:Ne.Top};function Fc(e){return e===null?null:e?"valid":"invalid"}const Hc=e=>"id"in e&&"source"in e&&"target"in e,lh=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ia=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),mr=(e,t=[0,0])=>{const{width:n,height:s}=bn(e),o=e.origin??t,a=n*o[0],i=s*o[1];return{x:e.position.x-a,y:e.position.y-i}},ch=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,o)=>{const a=typeof o=="string";let i=!t.nodeLookup&&!a?o:void 0;t.nodeLookup&&(i=a?t.nodeLookup.get(o):Ia(o)?o:t.nodeLookup.get(o.id));const l=i?co(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return wo(s,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ko(n)},pr=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=wo(n,co(o)),s=!0)}),s?ko(n):{x:0,y:0,width:0,height:0}},Ma=(e,t,[n,s,o]=[0,0,1],a=!1,i=!1)=>{const l={...xr(t,[n,s,o]),width:t.width/o,height:t.height/o},c=[];for(const d of e.values()){const{measured:h,selectable:u=!0,hidden:f=!1}=d;if(i&&!u||f)continue;const m=h.width??d.width??d.initialWidth??null,g=h.height??d.height??d.initialHeight??null,y=lr(l,Is(d)),k=(m??0)*(g??0),v=a&&y>0;(!d.internals.handleBounds||v||y>=k||d.dragging)&&c.push(d)}return c},dh=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function uh(e,t){const n=new Map,s=t?.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&(t?.includeHiddenNodes||!o.hidden)&&(!s||s.has(o.id))&&n.set(o.id,o)}),n}async function fh({nodes:e,width:t,height:n,panZoom:s,minZoom:o,maxZoom:a},i){if(e.size===0)return Promise.resolve(!0);const l=uh(e,i),c=pr(l),d=Aa(c,t,n,i?.minZoom??o,i?.maxZoom??a,i?.padding??.1);return await s.setViewport(d,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Wc({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:o,onError:a}){const i=n.get(e),l=i.parentId?n.get(i.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},h=i.origin??s;let u=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!l)a?.("005",ln.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(u=[[c,d],[c+m,d+g]])}else l&&Ms(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+d],[i.extent[1][0]+c,i.extent[1][1]+d]]);const f=Ms(u)?Zn(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&a?.("015",ln.error015()),{position:{x:f.x-c+(i.measured.width??0)*h[0],y:f.y-d+(i.measured.height??0)*h[1]},positionAbsolute:f}}async function hh({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:o}){const a=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const m=a.has(f.id),g=!m&&f.parentId&&i.find(y=>y.id===f.parentId);(m||g)&&i.push(f)}const l=new Set(t.map(f=>f.id)),c=s.filter(f=>f.deletable!==!1),h=dh(i,c);for(const f of c)l.has(f.id)&&!h.find(g=>g.id===f.id)&&h.push(f);if(!o)return{edges:h,nodes:i};const u=await o({nodes:i,edges:h});return typeof u=="boolean"?u?{edges:h,nodes:i}:{edges:[],nodes:[]}:u}const Ts=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Zn=(e={x:0,y:0},t,n)=>({x:Ts(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Ts(e.y,t[0][1],t[1][1]-(n?.height??0))});function Vc(e,t,n){const{width:s,height:o}=bn(n),{x:a,y:i}=n.internals.positionAbsolute;return Zn(e,[[a,i],[a+s,i+o]],t)}const Ki=(e,t,n)=>e<t?Ts(Math.abs(e-t),1,t)/t:e>n?-Ts(Math.abs(e-n),1,t)/t:0,Kc=(e,t,n=15,s=40)=>{const o=Ki(e.x,s,t.width-s)*n,a=Ki(e.y,s,t.height-s)*n;return[o,a]},wo=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),fa=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),ko=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Is=(e,t=[0,0])=>{const{x:n,y:s}=Ia(e)?e.internals.positionAbsolute:mr(e,t);return{x:n,y:s,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},co=(e,t=[0,0])=>{const{x:n,y:s}=Ia(e)?e.internals.positionAbsolute:mr(e,t);return{x:n,y:s,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:s+(e.measured?.height??e.height??e.initialHeight??0)}},Uc=(e,t)=>ko(wo(fa(e),fa(t))),lr=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},Ui=e=>Qt(e.width)&&Qt(e.height)&&Qt(e.x)&&Qt(e.y),Qt=e=>!isNaN(e)&&isFinite(e),mh=(e,t)=>{},gr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),xr=({x:e,y:t},[n,s,o],a=!1,i=[1,1])=>{const l={x:(e-n)/o,y:(t-s)/o};return a?gr(l,i):l},uo=({x:e,y:t},[n,s,o])=>({x:e*o+n,y:t*o+s});function hs(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ph(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=hs(e,n),o=hs(e,t);return{top:s,right:o,bottom:s,left:o,x:o*2,y:s*2}}if(typeof e=="object"){const s=hs(e.top??e.y??0,n),o=hs(e.bottom??e.y??0,n),a=hs(e.left??e.x??0,t),i=hs(e.right??e.x??0,t);return{top:s,right:i,bottom:o,left:a,x:a+i,y:s+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function gh(e,t,n,s,o,a){const{x:i,y:l}=uo(e,[t,n,s]),{x:c,y:d}=uo({x:e.x+e.width,y:e.y+e.height},[t,n,s]),h=o-c,u=a-d;return{left:Math.floor(i),top:Math.floor(l),right:Math.floor(h),bottom:Math.floor(u)}}const Aa=(e,t,n,s,o,a)=>{const i=ph(a,t,n),l=(t-i.x)/e.width,c=(n-i.y)/e.height,d=Math.min(l,c),h=Ts(d,s,o),u=e.x+e.width/2,f=e.y+e.height/2,m=t/2-u*h,g=n/2-f*h,y=gh(e,m,g,h,t,n),k={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:m-k.left+k.right,y:g-k.top+k.bottom,zoom:h}},cr=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ms(e){return e!=null&&e!=="parent"}function bn(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Yc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Gc(e,t={width:0,height:0},n,s,o){const a={...e},i=s.get(n);if(i){const l=i.origin||o;a.x+=i.internals.positionAbsolute.x-(t.width??0)*l[0],a.y+=i.internals.positionAbsolute.y-(t.height??0)*l[1]}return a}function Yi(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function xh(){let e,t;return{promise:new Promise((s,o)=>{e=s,t=o}),resolve:e,reject:t}}function bh(e){return{...zc,...e||{}}}function tr(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:o}){const{x:a,y:i}=Jt(e),l=xr({x:a-(o?.left??0),y:i-(o?.top??0)},s),{x:c,y:d}=n?gr(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const La=e=>({width:e.offsetWidth,height:e.offsetHeight}),Xc=e=>e?.getRootNode?.()||window?.document,yh=["INPUT","SELECT","TEXTAREA"];function Zc(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:yh.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Qc=e=>"clientX"in e,Jt=(e,t)=>{const n=Qc(e),s=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:s-(t?.left??0),y:o-(t?.top??0)}},Gi=(e,t,n,s,o)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(i=>{const l=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:o,position:i.getAttribute("data-handlepos"),x:(l.left-n.left)/s,y:(l.top-n.top)/s,...La(i)}})};function Jc({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:o,sourceControlY:a,targetControlX:i,targetControlY:l}){const c=e*.125+o*.375+i*.375+n*.125,d=t*.125+a*.375+l*.375+s*.125,h=Math.abs(c-e),u=Math.abs(d-t);return[c,d,h,u]}function Fr(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Xi({pos:e,x1:t,y1:n,x2:s,y2:o,c:a}){switch(e){case Ne.Left:return[t-Fr(t-s,a),n];case Ne.Right:return[t+Fr(s-t,a),n];case Ne.Top:return[t,n-Fr(n-o,a)];case Ne.Bottom:return[t,n+Fr(o-n,a)]}}function ed({sourceX:e,sourceY:t,sourcePosition:n=Ne.Bottom,targetX:s,targetY:o,targetPosition:a=Ne.Top,curvature:i=.25}){const[l,c]=Xi({pos:n,x1:e,y1:t,x2:s,y2:o,c:i}),[d,h]=Xi({pos:a,x1:s,y1:o,x2:e,y2:t,c:i}),[u,f,m,g]=Jc({sourceX:e,sourceY:t,targetX:s,targetY:o,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${e},${t} C${l},${c} ${d},${h} ${s},${o}`,u,f,m,g]}function td({sourceX:e,sourceY:t,targetX:n,targetY:s}){const o=Math.abs(n-e)/2,a=n<e?n+o:n-o,i=Math.abs(s-t)/2,l=s<t?s+i:s-i;return[a,l,o,i]}function wh({sourceNode:e,targetNode:t,selected:n=!1,zIndex:s=0,elevateOnSelect:o=!1,zIndexMode:a="basic"}){if(a==="manual")return s;const i=o&&n?s+1e3:s,l=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return i+l}function kh({sourceNode:e,targetNode:t,width:n,height:s,transform:o}){const a=wo(co(e),co(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const i={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:s/o[2]};return lr(i,ko(a))>0}const vh=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,jh=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Nh=(e,t,n={})=>{if(!e.source||!e.target)return t;const s=n.getEdgeId||vh;let o;return Hc(e)?o={...e}:o={...e,id:s(e)},jh(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function nd({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[o,a,i,l]=td({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,o,a,i,l]}const Zi={[Ne.Left]:{x:-1,y:0},[Ne.Right]:{x:1,y:0},[Ne.Top]:{x:0,y:-1},[Ne.Bottom]:{x:0,y:1}},Sh=({source:e,sourcePosition:t=Ne.Bottom,target:n})=>t===Ne.Left||t===Ne.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Qi=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Ch({source:e,sourcePosition:t=Ne.Bottom,target:n,targetPosition:s=Ne.Top,center:o,offset:a,stepPosition:i}){const l=Zi[t],c=Zi[s],d={x:e.x+l.x*a,y:e.y+l.y*a},h={x:n.x+c.x*a,y:n.y+c.y*a},u=Sh({source:d,sourcePosition:t,target:h}),f=u.x!==0?"x":"y",m=u[f];let g=[],y,k;const v={x:0,y:0},b={x:0,y:0},[,,x,w]=td({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*c[f]===-1){f==="x"?(y=o.x??d.x+(h.x-d.x)*i,k=o.y??(d.y+h.y)/2):(y=o.x??(d.x+h.x)/2,k=o.y??d.y+(h.y-d.y)*i);const j=[{x:y,y:d.y},{x:y,y:h.y}],E=[{x:d.x,y:k},{x:h.x,y:k}];l[f]===m?g=f==="x"?j:E:g=f==="x"?E:j}else{const j=[{x:d.x,y:h.y}],E=[{x:h.x,y:d.y}];if(f==="x"?g=l.x===m?E:j:g=l.y===m?j:E,t===s){const O=Math.abs(e[f]-n[f]);if(O<=a){const q=Math.min(a-1,a-O);l[f]===m?v[f]=(d[f]>e[f]?-1:1)*q:b[f]=(h[f]>n[f]?-1:1)*q}}if(t!==s){const O=f==="x"?"y":"x",q=l[f]===c[O],T=d[O]>h[O],B=d[O]<h[O];(l[f]===1&&(!q&&T||q&&B)||l[f]!==1&&(!q&&B||q&&T))&&(g=f==="x"?j:E)}const C={x:d.x+v.x,y:d.y+v.y},D={x:h.x+b.x,y:h.y+b.y},_=Math.max(Math.abs(C.x-g[0].x),Math.abs(D.x-g[0].x)),I=Math.max(Math.abs(C.y-g[0].y),Math.abs(D.y-g[0].y));_>=I?(y=(C.x+D.x)/2,k=g[0].y):(y=g[0].x,k=(C.y+D.y)/2)}return[[e,{x:d.x+v.x,y:d.y+v.y},...g,{x:h.x+b.x,y:h.y+b.y},n],y,k,x,w]}function Eh(e,t,n,s){const o=Math.min(Qi(e,t)/2,Qi(t,n)/2,s),{x:a,y:i}=t;if(e.x===a&&a===n.x||e.y===i&&i===n.y)return`L${a} ${i}`;if(e.y===i){const d=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${a+o*d},${i}Q ${a},${i} ${a},${i+o*h}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${a},${i+o*c}Q ${a},${i} ${a+o*l},${i}`}function ha({sourceX:e,sourceY:t,sourcePosition:n=Ne.Bottom,targetX:s,targetY:o,targetPosition:a=Ne.Top,borderRadius:i=5,centerX:l,centerY:c,offset:d=20,stepPosition:h=.5}){const[u,f,m,g,y]=Ch({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:o},targetPosition:a,center:{x:l,y:c},offset:d,stepPosition:h});return[u.reduce((v,b,x)=>{let w="";return x>0&&x<u.length-1?w=Eh(u[x-1],b,u[x+1],i):w=`${x===0?"M":"L"}${b.x} ${b.y}`,v+=w,v},""),f,m,g,y]}function Ji(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Th(e){const{sourceNode:t,targetNode:n}=e;if(!Ji(t)||!Ji(n))return null;const s=t.internals.handleBounds||el(t.handles),o=n.internals.handleBounds||el(n.handles),a=tl(s?.source??[],e.sourceHandle),i=tl(e.connectionMode===Cs.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!a||!i)return e.onError?.("008",ln.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=a?.position||Ne.Bottom,c=i?.position||Ne.Top,d=Qn(t,a,l),h=Qn(n,i,c);return{sourceX:d.x,sourceY:d.y,targetX:h.x,targetY:h.y,sourcePosition:l,targetPosition:c}}function el(e){if(!e)return null;const t=[],n=[];for(const s of e)s.width=s.width??1,s.height=s.height??1,s.type==="source"?t.push(s):s.type==="target"&&n.push(s);return{source:t,target:n}}function Qn(e,t,n=Ne.Left,s=!1){const o=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:l}=t??bn(e);if(s)return{x:o+i/2,y:a+l/2};switch(t?.position??n){case Ne.Top:return{x:o+i/2,y:a};case Ne.Right:return{x:o+i,y:a+l/2};case Ne.Bottom:return{x:o+i/2,y:a+l};case Ne.Left:return{x:o,y:a+l/2}}}function tl(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function ma(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function Ih(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:o}){const a=new Set;return e.reduce((i,l)=>([l.markerStart||s,l.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const d=ma(c,t);a.has(d)||(i.push({id:d,color:c.color||n,...c}),a.add(d))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))}const sd=1e3,Mh=10,_a={nodeOrigin:[0,0],nodeExtent:ar,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ah={..._a,checkEquality:!0};function Ra(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function Lh(e,t,n){const s=Ra(_a,n);for(const o of e.values())if(o.parentId)Oa(o,e,t,s);else{const a=mr(o,s.nodeOrigin),i=Ms(o.extent)?o.extent:s.nodeExtent,l=Zn(a,i,bn(o));o.internals.positionAbsolute=l}}function _h(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],s=[];for(const o of e.handles){const a={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(a):o.type==="target"&&s.push(a)}return{source:n,target:s}}function Da(e){return e==="manual"}function pa(e,t,n,s={}){const o=Ra(Ah,s),a={i:0},i=new Map(t),l=o?.elevateNodesOnSelect&&!Da(o.zIndexMode)?sd:0;let c=e.length>0;t.clear(),n.clear();for(const d of e){let h=i.get(d.id);if(o.checkEquality&&d===h?.internals.userNode)t.set(d.id,h);else{const u=mr(d,o.nodeOrigin),f=Ms(d.extent)?d.extent:o.nodeExtent,m=Zn(u,f,bn(d));h={...o.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:m,handleBounds:_h(d,h),z:rd(d,l,o.zIndexMode),userNode:d}},t.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&Oa(h,t,n,s,a)}return c}function Rh(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Oa(e,t,n,s,o){const{elevateNodesOnSelect:a,nodeOrigin:i,nodeExtent:l,zIndexMode:c}=Ra(_a,s),d=e.parentId,h=t.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}Rh(e,n),o&&!h.parentId&&h.internals.rootParentIndex===void 0&&c==="auto"&&(h.internals.rootParentIndex=++o.i,h.internals.z=h.internals.z+o.i*Mh),o&&h.internals.rootParentIndex!==void 0&&(o.i=h.internals.rootParentIndex);const u=a&&!Da(c)?sd:0,{x:f,y:m,z:g}=Dh(e,h,i,l,u,c),{positionAbsolute:y}=e.internals,k=f!==y.x||m!==y.y;(k||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:f,y:m}:y,z:g}})}function rd(e,t,n){const s=Qt(e.zIndex)?e.zIndex:0;return Da(n)?s:s+(e.selected?t:0)}function Dh(e,t,n,s,o,a){const{x:i,y:l}=t.internals.positionAbsolute,c=bn(e),d=mr(e,n),h=Ms(e.extent)?Zn(d,e.extent,c):d;let u=Zn({x:i+h.x,y:l+h.y},s,c);e.extent==="parent"&&(u=Vc(u,c,t));const f=rd(e,o,a),m=t.internals.z??0;return{x:u.x,y:u.y,z:m>=f?m+1:f}}function $a(e,t,n,s=[0,0]){const o=[],a=new Map;for(const i of e){const l=t.get(i.parentId);if(!l)continue;const c=a.get(i.parentId)?.expandedRect??Is(l),d=Uc(c,i.rect);a.set(i.parentId,{expandedRect:d,parent:l})}return a.size>0&&a.forEach(({expandedRect:i,parent:l},c)=>{const d=l.internals.positionAbsolute,h=bn(l),u=l.origin??s,f=i.x<d.x?Math.round(Math.abs(d.x-i.x)):0,m=i.y<d.y?Math.round(Math.abs(d.y-i.y)):0,g=Math.max(h.width,Math.round(i.width)),y=Math.max(h.height,Math.round(i.height)),k=(g-h.width)*u[0],v=(y-h.height)*u[1];(f>0||m>0||k||v)&&(o.push({id:c,type:"position",position:{x:l.position.x-f+k,y:l.position.y-m+v}}),n.get(c)?.forEach(b=>{e.some(x=>x.id===b.id)||o.push({id:b.id,type:"position",position:{x:b.position.x+f,y:b.position.y+m}})})),(h.width<i.width||h.height<i.height||f||m)&&o.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?u[0]*f-k:0),height:y+(m?u[1]*m-v:0)}})}),o}function Oh(e,t,n,s,o,a,i){const l=s?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],h=window.getComputedStyle(l),{m22:u}=new window.DOMMatrixReadOnly(h.transform),f=[];for(const m of e.values()){const g=t.get(m.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const y=La(m.nodeElement),k=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(k||!g.internals.handleBounds||m.force))){const b=m.nodeElement.getBoundingClientRect(),x=Ms(g.extent)?g.extent:a;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=Vc(w,y,t.get(g.parentId)):x&&(w=Zn(w,x,y));const N={...g,measured:y,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:Gi("source",m.nodeElement,b,u,g.id),target:Gi("target",m.nodeElement,b,u,g.id)}}};t.set(g.id,N),g.parentId&&Oa(N,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,k&&(d.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Is(N,o)}))}}if(f.length>0){const m=$a(f,t,n,o);d.push(...m)}return{changes:d,updatedInternals:c}}async function $h({delta:e,panZoom:t,transform:n,translateExtent:s,width:o,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,a]],s),l=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(l)}function nl(e,t,n,s,o,a){let i=o;const l=s.get(i)||new Map;s.set(i,l.set(n,t)),i=`${o}-${e}`;const c=s.get(i)||new Map;if(s.set(i,c.set(n,t)),a){i=`${o}-${e}-${a}`;const d=s.get(i)||new Map;s.set(i,d.set(n,t))}}function od(e,t,n){e.clear(),t.clear();for(const s of n){const{source:o,target:a,sourceHandle:i=null,targetHandle:l=null}=s,c={edgeId:s.id,source:o,target:a,sourceHandle:i,targetHandle:l},d=`${o}-${i}--${a}-${l}`,h=`${a}-${l}--${o}-${i}`;nl("source",c,h,e,o,i),nl("target",c,d,e,a,l),t.set(s.id,s)}}function ad(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:ad(n,t):!1}function sl(e,t,n){let s=e;do{if(s?.matches?.(t))return!0;if(s===n)return!1;s=s?.parentElement}while(s);return!1}function Ph(e,t,n,s){const o=new Map;for(const[a,i]of e)if((i.selected||i.id===s)&&(!i.parentId||!ad(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const l=e.get(a);l&&o.set(a,{id:a,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.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 o}function Yo({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){const o=[];for(const[i,l]of t){const c=n.get(i)?.internals.userNode;c&&o.push({...c,position:l.position,dragging:s})}if(!e)return[o[0],o];const a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:s}:o[0],o]}function Bh({dragItems:e,snapGrid:t,x:n,y:s}){const o=e.values().next().value;if(!o)return null;const a={x:n-o.distance.x,y:s-o.distance.y},i=gr(a,t);return{x:i.x-a.x,y:i.y-a.y}}function zh({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:o}){let a={x:null,y:null},i=0,l=new Map,c=!1,d={x:0,y:0},h=null,u=!1,f=null,m=!1,g=!1,y=null;function k({noDragClassName:b,handleSelector:x,domNode:w,isSelectable:N,nodeId:j,nodeClickDistance:E=0}){f=qt(w);function C({x:O,y:q}){const{nodeLookup:T,nodeExtent:B,snapGrid:L,snapToGrid:z,nodeOrigin:R,onNodeDrag:A,onSelectionDrag:$,onError:F,updateNodePositions:W}=t();a={x:O,y:q};let X=!1;const P=l.size>1,M=P&&B?fa(pr(l)):null,K=P&&z?Bh({dragItems:l,snapGrid:L,x:O,y:q}):null;for(const[V,H]of l){if(!T.has(V))continue;let Z={x:O-H.distance.x,y:q-H.distance.y};z&&(Z=K?{x:Math.round(Z.x+K.x),y:Math.round(Z.y+K.y)}:gr(Z,L));let ee=null;if(P&&B&&!H.extent&&M){const{positionAbsolute:Q}=H.internals,le=Q.x-M.x+B[0][0],ue=Q.x+H.measured.width-M.x2+B[1][0],fe=Q.y-M.y+B[0][1],ge=Q.y+H.measured.height-M.y2+B[1][1];ee=[[le,fe],[ue,ge]]}const{position:oe,positionAbsolute:de}=Wc({nodeId:V,nextPosition:Z,nodeLookup:T,nodeExtent:ee||B,nodeOrigin:R,onError:F});X=X||H.position.x!==oe.x||H.position.y!==oe.y,H.position=oe,H.internals.positionAbsolute=de}if(g=g||X,!!X&&(W(l,!0),y&&(s||A||!j&&$))){const[V,H]=Yo({nodeId:j,dragItems:l,nodeLookup:T});s?.(y,l,V,H),A?.(y,V,H),j||$?.(y,H)}}async function D(){if(!h)return;const{transform:O,panBy:q,autoPanSpeed:T,autoPanOnNodeDrag:B}=t();if(!B){c=!1,cancelAnimationFrame(i);return}const[L,z]=Kc(d,h,T);(L!==0||z!==0)&&(a.x=(a.x??0)-L/O[2],a.y=(a.y??0)-z/O[2],await q({x:L,y:z})&&C(a)),i=requestAnimationFrame(D)}function _(O){const{nodeLookup:q,multiSelectionActive:T,nodesDraggable:B,transform:L,snapGrid:z,snapToGrid:R,selectNodesOnDrag:A,onNodeDragStart:$,onSelectionDragStart:F,unselectNodesAndEdges:W}=t();u=!0,(!A||!N)&&!T&&j&&(q.get(j)?.selected||W()),N&&A&&j&&e?.(j);const X=tr(O.sourceEvent,{transform:L,snapGrid:z,snapToGrid:R,containerBounds:h});if(a=X,l=Ph(q,B,X,j),l.size>0&&(n||$||!j&&F)){const[P,M]=Yo({nodeId:j,dragItems:l,nodeLookup:q});n?.(O.sourceEvent,l,P,M),$?.(O.sourceEvent,P,M),j||F?.(O.sourceEvent,M)}}const I=Rc().clickDistance(E).on("start",O=>{const{domNode:q,nodeDragThreshold:T,transform:B,snapGrid:L,snapToGrid:z}=t();h=q?.getBoundingClientRect()||null,m=!1,g=!1,y=O.sourceEvent,T===0&&_(O),a=tr(O.sourceEvent,{transform:B,snapGrid:L,snapToGrid:z,containerBounds:h}),d=Jt(O.sourceEvent,h)}).on("drag",O=>{const{autoPanOnNodeDrag:q,transform:T,snapGrid:B,snapToGrid:L,nodeDragThreshold:z,nodeLookup:R}=t(),A=tr(O.sourceEvent,{transform:T,snapGrid:B,snapToGrid:L,containerBounds:h});if(y=O.sourceEvent,(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1||j&&!R.has(j))&&(m=!0),!m){if(!c&&q&&u&&(c=!0,D()),!u){const $=Jt(O.sourceEvent,h),F=$.x-d.x,W=$.y-d.y;Math.sqrt(F*F+W*W)>z&&_(O)}(a.x!==A.xSnapped||a.y!==A.ySnapped)&&l&&u&&(d=Jt(O.sourceEvent,h),C(A))}}).on("end",O=>{if(!(!u||m)&&(c=!1,u=!1,cancelAnimationFrame(i),l.size>0)){const{nodeLookup:q,updateNodePositions:T,onNodeDragStop:B,onSelectionDragStop:L}=t();if(g&&(T(l,!1),g=!1),o||B||!j&&L){const[z,R]=Yo({nodeId:j,dragItems:l,nodeLookup:q,dragging:!1});o?.(O.sourceEvent,l,z,R),B?.(O.sourceEvent,z,R),j||L?.(O.sourceEvent,R)}}}).filter(O=>{const q=O.target;return!O.button&&(!b||!sl(q,`.${b}`,w))&&(!x||sl(q,x,w))});f.call(I)}function v(){f?.on(".drag",null)}return{update:k,destroy:v}}function qh(e,t,n){const s=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())lr(o,Is(a))>0&&s.push(a);return s}const Fh=250;function Hh(e,t,n,s){let o=[],a=1/0;const i=qh(e,n,t+Fh);for(const l of i){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const d of c){if(s.nodeId===d.nodeId&&s.type===d.type&&s.id===d.id)continue;const{x:h,y:u}=Qn(l,d,d.position,!0),f=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(u-e.y,2));f>t||(f<a?(o=[{...d,x:h,y:u}],a=f):f===a&&o.push({...d,x:h,y:u}))}}if(!o.length)return null;if(o.length>1){const l=s.type==="source"?"target":"source";return o.find(c=>c.type===l)??o[0]}return o[0]}function id(e,t,n,s,o,a=!1){const i=s.get(e);if(!i)return null;const l=o==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],c=(n?l?.find(d=>d.id===n):l?.[0])??null;return c&&a?{...c,...Qn(i,c,c.position,!0)}:c}function ld(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Wh(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const cd=()=>!0;function Vh(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:o,edgeUpdaterType:a,isTarget:i,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:h,flowId:u,panBy:f,cancelConnection:m,onConnectStart:g,onConnect:y,onConnectEnd:k,isValidConnection:v=cd,onReconnectEnd:b,updateConnection:x,getTransform:w,getFromHandle:N,autoPanSpeed:j,dragThreshold:E=1,handleDomNode:C}){const D=Xc(e.target);let _=0,I;const{x:O,y:q}=Jt(e),T=ld(a,C),B=l?.getBoundingClientRect();let L=!1;if(!B||!T)return;const z=id(o,T,s,c,t);if(!z)return;let R=Jt(e,B),A=!1,$=null,F=!1,W=null;function X(){if(!h||!B)return;const[oe,de]=Kc(R,B,j);f({x:oe,y:de}),_=requestAnimationFrame(X)}const P={...z,nodeId:o,type:T,position:z.position},M=c.get(o);let V={inProgress:!0,isValid:null,from:Qn(M,P,Ne.Left,!0),fromHandle:P,fromPosition:P.position,fromNode:M,to:R,toHandle:null,toPosition:Vi[P.position],toNode:null,pointer:R};function H(){L=!0,x(V),g?.(e,{nodeId:o,handleId:s,handleType:T})}E===0&&H();function Z(oe){if(!L){const{x:ge,y:we}=Jt(oe),me=ge-O,ve=we-q;if(!(me*me+ve*ve>E*E))return;H()}if(!N()||!P){ee(oe);return}const de=w();R=Jt(oe,B),I=Hh(xr(R,de,!1,[1,1]),n,c,P),A||(X(),A=!0);const Q=dd(oe,{handle:I,connectionMode:t,fromNodeId:o,fromHandleId:s,fromType:i?"target":"source",isValidConnection:v,doc:D,lib:d,flowId:u,nodeLookup:c});W=Q.handleDomNode,$=Q.connection,F=Wh(!!I,Q.isValid);const le=c.get(o),ue=le?Qn(le,P,Ne.Left,!0):V.from,fe={...V,from:ue,isValid:F,to:Q.toHandle&&F?uo({x:Q.toHandle.x,y:Q.toHandle.y},de):R,toHandle:Q.toHandle,toPosition:F&&Q.toHandle?Q.toHandle.position:Vi[P.position],toNode:Q.toHandle?c.get(Q.toHandle.nodeId):null,pointer:R};x(fe),V=fe}function ee(oe){if(!("touches"in oe&&oe.touches.length>0)){if(L){(I||W)&&$&&F&&y?.($);const{inProgress:de,...Q}=V,le={...Q,toPosition:V.toHandle?V.toPosition:null};k?.(oe,le),a&&b?.(oe,le)}m(),cancelAnimationFrame(_),A=!1,F=!1,$=null,W=null,D.removeEventListener("mousemove",Z),D.removeEventListener("mouseup",ee),D.removeEventListener("touchmove",Z),D.removeEventListener("touchend",ee)}}D.addEventListener("mousemove",Z),D.addEventListener("mouseup",ee),D.addEventListener("touchmove",Z),D.addEventListener("touchend",ee)}function dd(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:o,fromType:a,doc:i,lib:l,flowId:c,isValidConnection:d=cd,nodeLookup:h}){const u=a==="target",f=t?i.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:m,y:g}=Jt(e),y=i.elementFromPoint(m,g),k=y?.classList.contains(`${l}-flow__handle`)?y:f,v={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const b=ld(void 0,k),x=k.getAttribute("data-nodeid"),w=k.getAttribute("data-handleid"),N=k.classList.contains("connectable"),j=k.classList.contains("connectableend");if(!x||!b)return v;const E={source:u?x:s,sourceHandle:u?w:o,target:u?s:x,targetHandle:u?o:w};v.connection=E;const D=N&&j&&(n===Cs.Strict?u&&b==="source"||!u&&b==="target":x!==s||w!==o);v.isValid=D&&d(E),v.toHandle=id(x,b,w,h,n,!0)}return v}const ga={onPointerDown:Vh,isValid:dd};function Kh({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const o=qt(e);function a({translateExtent:l,width:c,height:d,zoomStep:h=1,pannable:u=!0,zoomable:f=!0,inversePan:m=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const w=n(),N=x.sourceEvent.ctrlKey&&cr()?10:1,j=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*h,E=w[2]*Math.pow(2,j*N);t.scaleTo(E)};let y=[0,0];const k=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(y=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},v=x=>{const w=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const N=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],j=[N[0]-y[0],N[1]-y[1]];y=N;const E=s()*Math.max(w[2],Math.log(w[2]))*(m?-1:1),C={x:w[0]-j[0]*E,y:w[1]-j[1]*E},D=[[0,0],[c,d]];t.setViewportConstrained({x:C.x,y:C.y,zoom:w[2]},D,l)},b=Dc().on("start",k).on("zoom",u?v:null).on("zoom.wheel",f?g:null);o.call(b,{})}function i(){o.on("zoom",null)}return{update:a,destroy:i,pointer:Zt}}const vo=e=>({x:e.x,y:e.y,zoom:e.k}),Go=({x:e,y:t,zoom:n})=>Ta.translate(e,t).scale(n),xs=(e,t)=>e.target.closest(`.${t}`),ud=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Uh=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xo=(e,t=0,n=Uh,s=()=>{})=>{const o=typeof t=="number"&&t>0;return o||s(),o?e.transition().duration(t).ease(n).on("end",s):e},fd=e=>{const t=e.ctrlKey&&cr()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Yh({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:o,panOnScrollSpeed:a,zoomOnPinch:i,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return h=>{if(xs(h,t))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(h.ctrlKey&&i){const k=Zt(h),v=fd(h),b=u*Math.pow(2,v);s.scaleTo(n,b,k,h);return}const f=h.deltaMode===1?20:1;let m=o===Xn.Vertical?0:h.deltaX*f,g=o===Xn.Horizontal?0:h.deltaY*f;!cr()&&h.shiftKey&&o!==Xn.Vertical&&(m=h.deltaY*f,g=0),s.translateBy(n,-(m/u)*a,-(g/u)*a,{internal:!0});const y=vo(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(h,y),e.panScrollTimeout=setTimeout(()=>{d?.(h,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(h,y))}}function Gh({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,o){const a=s.type==="wheel",i=!t&&a&&!s.ctrlKey,l=xs(s,e);if(s.ctrlKey&&a&&l&&s.preventDefault(),i||l)return null;s.preventDefault(),n.call(this,s,o)}}function Xh({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{if(s.sourceEvent?.internal)return;const o=vo(s.transform);e.mouseButton=s.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,s.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(s.sourceEvent,o)}}function Zh({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:o}){return a=>{e.usedRightMouseButton=!!(n&&ud(t,e.mouseButton??0)),a.sourceEvent?.sync||s([a.transform.x,a.transform.y,a.transform.k]),o&&!a.sourceEvent?.internal&&o?.(a.sourceEvent,vo(a.transform))}}function Qh({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:o,onPaneContextMenu:a}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&ud(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&a(i.sourceEvent),e.usedRightMouseButton=!1,s(!1),o)){const l=vo(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(i.sourceEvent,l)},n?150:0)}}}function Jh({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:o,zoomOnDoubleClick:a,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:h}){return u=>{const f=e||t,m=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(xs(u,`${d}-flow__node`)||xs(u,`${d}-flow__edge`)))return!0;if(!s&&!f&&!o&&!a&&!n||i||h&&!g||xs(u,l)&&g||xs(u,c)&&(!g||o&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!f&&!o&&!m&&g||!s&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(s)&&!s.includes(u.button)&&u.type==="mousedown")return!1;const y=Array.isArray(s)&&s.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&y}}function em({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:o,onPanZoom:a,onPanZoomStart:i,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),u=Dc().scaleExtent([t,n]).translateExtent(s),f=qt(e).call(u);b({x:o.x,y:o.y,zoom:Ts(o.zoom,t,n)},[[0,0],[h.width,h.height]],s);const m=f.on("wheel.zoom"),g=f.on("dblclick.zoom");u.wheelDelta(fd);function y(I,O){return f?new Promise(q=>{u?.interpolate(O?.interpolate==="linear"?Vo:no).transform(Xo(f,O?.duration,O?.ease,()=>q(!0)),I)}):Promise.resolve(!1)}function k({noWheelClassName:I,noPanClassName:O,onPaneContextMenu:q,userSelectionActive:T,panOnScroll:B,panOnDrag:L,panOnScrollMode:z,panOnScrollSpeed:R,preventScrolling:A,zoomOnPinch:$,zoomOnScroll:F,zoomOnDoubleClick:W,zoomActivationKeyPressed:X,lib:P,onTransformChange:M,connectionInProgress:K,paneClickDistance:V,selectionOnDrag:H}){T&&!d.isZoomingOrPanning&&v();const Z=B&&!X&&!T;u.clickDistance(H?1/0:!Qt(V)||V<0?0:V);const ee=Z?Yh({zoomPanValues:d,noWheelClassName:I,d3Selection:f,d3Zoom:u,panOnScrollMode:z,panOnScrollSpeed:R,zoomOnPinch:$,onPanZoomStart:i,onPanZoom:a,onPanZoomEnd:l}):Gh({noWheelClassName:I,preventScrolling:A,d3ZoomHandler:m});if(f.on("wheel.zoom",ee,{passive:!1}),!T){const de=Xh({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:i});u.on("start",de);const Q=Zh({zoomPanValues:d,panOnDrag:L,onPaneContextMenu:!!q,onPanZoom:a,onTransformChange:M});u.on("zoom",Q);const le=Qh({zoomPanValues:d,panOnDrag:L,panOnScroll:B,onPaneContextMenu:q,onPanZoomEnd:l,onDraggingChange:c});u.on("end",le)}const oe=Jh({zoomActivationKeyPressed:X,panOnDrag:L,zoomOnScroll:F,panOnScroll:B,zoomOnDoubleClick:W,zoomOnPinch:$,userSelectionActive:T,noPanClassName:O,noWheelClassName:I,lib:P,connectionInProgress:K});u.filter(oe),W?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function v(){u.on("zoom",null)}async function b(I,O,q){const T=Go(I),B=u?.constrain()(T,O,q);return B&&await y(B),new Promise(L=>L(B))}async function x(I,O){const q=Go(I);return await y(q,O),new Promise(T=>T(q))}function w(I){if(f){const O=Go(I),q=f.property("__zoom");(q.k!==I.zoom||q.x!==I.x||q.y!==I.y)&&u?.transform(f,O,null,{sync:!0})}}function N(){const I=f?$f(f.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function j(I,O){return f?new Promise(q=>{u?.interpolate(O?.interpolate==="linear"?Vo:no).scaleTo(Xo(f,O?.duration,O?.ease,()=>q(!0)),I)}):Promise.resolve(!1)}function E(I,O){return f?new Promise(q=>{u?.interpolate(O?.interpolate==="linear"?Vo:no).scaleBy(Xo(f,O?.duration,O?.ease,()=>q(!0)),I)}):Promise.resolve(!1)}function C(I){u?.scaleExtent(I)}function D(I){u?.translateExtent(I)}function _(I){const O=!Qt(I)||I<0?0:I;u?.clickDistance(O)}return{update:k,destroy:v,setViewport:x,setViewportConstrained:b,getViewport:N,scaleTo:j,scaleBy:E,setScaleExtent:C,setTranslateExtent:D,syncViewport:w,setClickDistance:_}}var As;(function(e){e.Line="line",e.Handle="handle"})(As||(As={}));function tm({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:o,affectsY:a}){const i=e-t,l=n-s,c=[i>0?1:i<0?-1:0,l>0?1:l<0?-1:0];return i&&o&&(c[0]=c[0]*-1),l&&a&&(c[1]=c[1]*-1),c}function rl(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:o}}function vn(e,t){return Math.max(0,t-e)}function jn(e,t){return Math.max(0,e-t)}function Hr(e,t,n){return Math.max(0,t-e,e-n)}function ol(e,t){return e?!t:t}function nm(e,t,n,s,o,a,i,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:h,isVertical:u}=t,f=h&&u,{xSnapped:m,ySnapped:g}=n,{minWidth:y,maxWidth:k,minHeight:v,maxHeight:b}=s,{x,y:w,width:N,height:j,aspectRatio:E}=e;let C=Math.floor(h?m-e.pointerX:0),D=Math.floor(u?g-e.pointerY:0);const _=N+(c?-C:C),I=j+(d?-D:D),O=-a[0]*N,q=-a[1]*j;let T=Hr(_,y,k),B=Hr(I,v,b);if(i){let R=0,A=0;c&&C<0?R=vn(x+C+O,i[0][0]):!c&&C>0&&(R=jn(x+_+O,i[1][0])),d&&D<0?A=vn(w+D+q,i[0][1]):!d&&D>0&&(A=jn(w+I+q,i[1][1])),T=Math.max(T,R),B=Math.max(B,A)}if(l){let R=0,A=0;c&&C>0?R=jn(x+C,l[0][0]):!c&&C<0&&(R=vn(x+_,l[1][0])),d&&D>0?A=jn(w+D,l[0][1]):!d&&D<0&&(A=vn(w+I,l[1][1])),T=Math.max(T,R),B=Math.max(B,A)}if(o){if(h){const R=Hr(_/E,v,b)*E;if(T=Math.max(T,R),i){let A=0;!c&&!d||c&&!d&&f?A=jn(w+q+_/E,i[1][1])*E:A=vn(w+q+(c?C:-C)/E,i[0][1])*E,T=Math.max(T,A)}if(l){let A=0;!c&&!d||c&&!d&&f?A=vn(w+_/E,l[1][1])*E:A=jn(w+(c?C:-C)/E,l[0][1])*E,T=Math.max(T,A)}}if(u){const R=Hr(I*E,y,k)/E;if(B=Math.max(B,R),i){let A=0;!c&&!d||d&&!c&&f?A=jn(x+I*E+O,i[1][0])/E:A=vn(x+(d?D:-D)*E+O,i[0][0])/E,B=Math.max(B,A)}if(l){let A=0;!c&&!d||d&&!c&&f?A=vn(x+I*E,l[1][0])/E:A=jn(x+(d?D:-D)*E,l[0][0])/E,B=Math.max(B,A)}}}D=D+(D<0?B:-B),C=C+(C<0?T:-T),o&&(f?_>I*E?D=(ol(c,d)?-C:C)/E:C=(ol(c,d)?-D:D)*E:h?(D=C/E,d=c):(C=D*E,c=d));const L=c?x+C:x,z=d?w+D:w;return{width:N+(c?-C:C),height:j+(d?-D:D),x:a[0]*C*(c?-1:1)+L,y:a[1]*D*(d?-1:1)+z}}const hd={width:0,height:0,x:0,y:0},sm={...hd,pointerX:0,pointerY:0,aspectRatio:1};function rm(e){return[[0,0],[e.measured.width,e.measured.height]]}function om(e,t,n){const s=t.position.x+e.position.x,o=t.position.y+e.position.y,a=e.measured.width??0,i=e.measured.height??0,l=n[0]*a,c=n[1]*i;return[[s-l,o-c],[s+a-l,o+i-c]]}function am({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:o}){const a=qt(e);let i={controlDirection:rl("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:u,resizeDirection:f,onResizeStart:m,onResize:g,onResizeEnd:y,shouldResize:k}){let v={...hd},b={...sm};i={boundaries:h,resizeDirection:f,keepAspectRatio:u,controlDirection:rl(d)};let x,w=null,N=[],j,E,C,D=!1;const _=Rc().on("start",I=>{const{nodeLookup:O,transform:q,snapGrid:T,snapToGrid:B,nodeOrigin:L,paneDomNode:z}=n();if(x=O.get(t),!x)return;w=z?.getBoundingClientRect()??null;const{xSnapped:R,ySnapped:A}=tr(I.sourceEvent,{transform:q,snapGrid:T,snapToGrid:B,containerBounds:w});v={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},b={...v,pointerX:R,pointerY:A,aspectRatio:v.width/v.height},j=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(j=O.get(x.parentId),E=j&&x.extent==="parent"?rm(j):void 0),N=[],C=void 0;for(const[$,F]of O)if(F.parentId===t&&(N.push({id:$,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const W=om(F,x,F.origin??L);C?C=[[Math.min(W[0][0],C[0][0]),Math.min(W[0][1],C[0][1])],[Math.max(W[1][0],C[1][0]),Math.max(W[1][1],C[1][1])]]:C=W}m?.(I,{...v})}).on("drag",I=>{const{transform:O,snapGrid:q,snapToGrid:T,nodeOrigin:B}=n(),L=tr(I.sourceEvent,{transform:O,snapGrid:q,snapToGrid:T,containerBounds:w}),z=[];if(!x)return;const{x:R,y:A,width:$,height:F}=v,W={},X=x.origin??B,{width:P,height:M,x:K,y:V}=nm(b,i.controlDirection,L,i.boundaries,i.keepAspectRatio,X,E,C),H=P!==$,Z=M!==F,ee=K!==R&&H,oe=V!==A&&Z;if(!ee&&!oe&&!H&&!Z)return;if((ee||oe||X[0]===1||X[1]===1)&&(W.x=ee?K:v.x,W.y=oe?V:v.y,v.x=W.x,v.y=W.y,N.length>0)){const ue=K-R,fe=V-A;for(const ge of N)ge.position={x:ge.position.x-ue+X[0]*(P-$),y:ge.position.y-fe+X[1]*(M-F)},z.push(ge)}if((H||Z)&&(W.width=H&&(!i.resizeDirection||i.resizeDirection==="horizontal")?P:v.width,W.height=Z&&(!i.resizeDirection||i.resizeDirection==="vertical")?M:v.height,v.width=W.width,v.height=W.height),j&&x.expandParent){const ue=X[0]*(W.width??0);W.x&&W.x<ue&&(v.x=ue,b.x=b.x-(W.x-ue));const fe=X[1]*(W.height??0);W.y&&W.y<fe&&(v.y=fe,b.y=b.y-(W.y-fe))}const de=tm({width:v.width,prevWidth:$,height:v.height,prevHeight:F,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),Q={...v,direction:de};k?.(I,Q)!==!1&&(D=!0,g?.(I,Q),s(W,z))}).on("end",I=>{D&&(y?.(I,{...v}),o?.({...v}),D=!1)});a.call(_)}function c(){a.on(".drag",null)}return{update:l,destroy:c}}var Zo={exports:{}},Qo={};var al;function im(){if(al)return Qo;al=1;var e=mf(),t=pf();function n(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var s=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,a=e.useRef,i=e.useEffect,l=e.useMemo,c=e.useDebugValue;return Qo.useSyncExternalStoreWithSelector=function(d,h,u,f,m){var g=a(null);if(g.current===null){var y={hasValue:!1,value:null};g.current=y}else y=g.current;g=l(function(){function v(j){if(!b){if(b=!0,x=j,j=f(j),m!==void 0&&y.hasValue){var E=y.value;if(m(E,j))return w=E}return w=j}if(E=w,s(x,j))return E;var C=f(j);return m!==void 0&&m(E,C)?(x=j,E):(x=j,w=C)}var b=!1,x,w,N=u===void 0?null:u;return[function(){return v(h())},N===null?void 0:function(){return v(N())}]},[h,u,f,m]);var k=o(d,g[0],g[1]);return i(function(){y.hasValue=!0,y.value=k},[k]),c(k),k},Qo}var il;function lm(){return il||(il=1,Zo.exports=im()),Zo.exports}var cm=lm();const dm=gf(cm),um={},ll=e=>{let t;const n=new Set,s=(h,u)=>{const f=typeof h=="function"?h(t):h;if(!Object.is(f,t)){const m=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,m))}},o=()=>t,c={setState:s,getState:o,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(um?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(s,o,c);return c},fm=e=>e?ll(e):ll,{useDebugValue:hm}=xf,{useSyncExternalStoreWithSelector:mm}=dm,pm=e=>e;function md(e,t=pm,n){const s=mm(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hm(s),s}const cl=(e,t)=>{const n=fm(e),s=(o,a=t)=>md(n,o,a);return Object.assign(s,n),s},gm=(e,t)=>e?cl(e,t):cl;function ot(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,o]of e)if(!Object.is(o,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const jo=p.createContext(null),xm=jo.Provider,pd=ln.error001();function Fe(e,t){const n=p.useContext(jo);if(n===null)throw new Error(pd);return md(n,e,t)}function rt(){const e=p.useContext(jo);if(e===null)throw new Error(pd);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const dl={display:"none"},bm={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},gd="react-flow__node-desc",xd="react-flow__edge-desc",ym="react-flow__aria-live",wm=e=>e.ariaLiveMessage,km=e=>e.ariaLabelConfig;function vm({rfId:e}){const t=Fe(wm);return r.jsx("div",{id:`${ym}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:bm,children:t})}function jm({rfId:e,disableKeyboardA11y:t}){const n=Fe(km);return r.jsxs(r.Fragment,{children:[r.jsx("div",{id:`${gd}-${e}`,style:dl,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),r.jsx("div",{id:`${xd}-${e}`,style:dl,children:n["edge.a11yDescription.default"]}),!t&&r.jsx(vm,{rfId:e})]})}const No=p.forwardRef(({position:e="top-left",children:t,className:n,style:s,...o},a)=>{const i=`${e}`.split("-");return r.jsx("div",{className:yt(["react-flow__panel",n,...i]),style:s,ref:a,...o,children:t})});No.displayName="Panel";function Nm({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:r.jsx(No,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:r.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Sm=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},Wr=e=>e.id;function Cm(e,t){return ot(e.selectedNodes.map(Wr),t.selectedNodes.map(Wr))&&ot(e.selectedEdges.map(Wr),t.selectedEdges.map(Wr))}function Em({onSelectionChange:e}){const t=rt(),{selectedNodes:n,selectedEdges:s}=Fe(Sm,Cm);return p.useEffect(()=>{const o={nodes:n,edges:s};e?.(o),t.getState().onSelectionChangeHandlers.forEach(a=>a(o))},[n,s,e]),null}const Tm=e=>!!e.onSelectionChangeHandlers;function Im({onSelectionChange:e}){const t=Fe(Tm);return e||t?r.jsx(Em,{onSelectionChange:e}):null}const bd=[0,0],Mm={x:0,y:0,zoom:1},Am=["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"],ul=[...Am,"rfId"],Lm=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}),fl={translateExtent:ar,nodeOrigin:bd,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function _m(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:o,setTranslateExtent:a,setNodeExtent:i,reset:l,setDefaultNodesAndEdges:c}=Fe(Lm,ot),d=rt();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{h.current=fl,l()}),[]);const h=p.useRef(fl);return p.useEffect(()=>{for(const u of ul){const f=e[u],m=h.current[u];f!==m&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?s(f):u==="maxZoom"?o(f):u==="translateExtent"?a(f):u==="nodeExtent"?i(f):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:bh(f)}):u==="fitView"?d.setState({fitViewQueued:f}):u==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[u]:f})))}h.current=e},ul.map(u=>e[u])),null}function hl(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Rm(e){const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const s=hl(),o=()=>n(s?.matches?"dark":"light");return o(),s?.addEventListener("change",o),()=>{s?.removeEventListener("change",o)}},[e]),t!==null?t:hl()?.matches?"dark":"light"}const ml=typeof document<"u"?document:null;function dr(e=null,t={target:ml,actInsideInputWithModifier:!0}){const[n,s]=p.useState(!1),o=p.useRef(!1),a=p.useRef(new Set([])),[i,l]=p.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
1
+ import{u as ze,j as r,b9 as mf,ba as pf,y as gf,bb as xf,r as p,l as ne,Y as bf,a as hr,k as yf,n as en,P as Ze,Z as jc,b as wf,c as kf,m as vf,s as Pi,bc as jf,bd as Nf,w as Ht,aN as zt,be as Pr,p as Br,M as Sf,i as Cf,C as gs,q as rr,d as Ef,bf as Nc,A as Ea,af as Bi,bg as zi,bh as qi,O as Tf,ad as Sc,bi as If,bj as Mf,bk as Cc,bl as Af,ae as Lf}from"./index-CJlhDWEX.js";import{S as Ec,a as Tc,r as Ic,s as _f}from"./SendToChat-BmvnXP0P.js";import{L as Rf,P as Df}from"./AsyncState-BHJmTFGQ.js";import{ContentRenderer as Of}from"./ContentRenderer-BZE1MgEd.js";import{s as qt,g as Mc,j as Ta,T as Ho,k as Wo,t as $f}from"./transform-BqqRT-Iy.js";import{i as Vo}from"./value-wA6veExk.js";import{C as Ac}from"./CommentInput-_MNbHPyZ.js";function Pf(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Zt(e,t){if(e=Pf(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Bf={passive:!1},or={capture:!0,passive:!1};function Ko(e){e.stopImmediatePropagation()}function js(e){e.preventDefault(),e.stopImmediatePropagation()}function Lc(e){var t=e.document.documentElement,n=qt(e).on("dragstart.drag",js,or);"onselectstart"in t?n.on("selectstart.drag",js,or):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function _c(e,t){var n=e.document.documentElement,s=qt(e).on("dragstart.drag",null);t&&(s.on("click.drag",js,or),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const zr=e=>()=>e;function da(e,{sourceEvent:t,subject:n,target:s,identifier:o,active:a,x:i,y:l,dx:c,dy:d,dispatch:h}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:i,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}})}da.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function zf(e){return!e.ctrlKey&&!e.button}function qf(){return this.parentNode}function Ff(e,t){return t??{x:e.x,y:e.y}}function Hf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Rc(){var e=zf,t=qf,n=Ff,s=Hf,o={},a=Mc("start","drag","end"),i=0,l,c,d,h,u=0;function f(w){w.on("mousedown.drag",m).filter(s).on("touchstart.drag",k).on("touchmove.drag",v,Bf).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,N){if(!(h||!e.call(this,w,N))){var j=x(this,t.call(this,w,N),w,N,"mouse");j&&(qt(w.view).on("mousemove.drag",g,or).on("mouseup.drag",y,or),Lc(w.view),Ko(w),d=!1,l=w.clientX,c=w.clientY,j("start",w))}}function g(w){if(js(w),!d){var N=w.clientX-l,j=w.clientY-c;d=N*N+j*j>u}o.mouse("drag",w)}function y(w){qt(w.view).on("mousemove.drag mouseup.drag",null),_c(w.view,d),js(w),o.mouse("end",w)}function k(w,N){if(e.call(this,w,N)){var j=w.changedTouches,E=t.call(this,w,N),C=j.length,D,_;for(D=0;D<C;++D)(_=x(this,E,w,N,j[D].identifier,j[D]))&&(Ko(w),_("start",w,j[D]))}}function v(w){var N=w.changedTouches,j=N.length,E,C;for(E=0;E<j;++E)(C=o[N[E].identifier])&&(js(w),C("drag",w,N[E]))}function b(w){var N=w.changedTouches,j=N.length,E,C;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),E=0;E<j;++E)(C=o[N[E].identifier])&&(Ko(w),C("end",w,N[E]))}function x(w,N,j,E,C,D){var _=a.copy(),I=Zt(D||j,N),O,q,T;if((T=n.call(w,new da("beforestart",{sourceEvent:j,target:f,identifier:C,active:i,x:I[0],y:I[1],dx:0,dy:0,dispatch:_}),E))!=null)return O=T.x-I[0]||0,q=T.y-I[1]||0,function B(L,z,R){var A=I,$;switch(L){case"start":o[C]=B,$=i++;break;case"end":delete o[C],--i;case"drag":I=Zt(R||z,N),$=i;break}_.call(L,w,new da(L,{sourceEvent:z,subject:T,target:f,identifier:C,active:$,x:I[0]+O,y:I[1]+q,dx:I[0]-A[0],dy:I[1]-A[1],dispatch:_}),E)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:zr(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:zr(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:zr(w),f):n},f.touchable=function(w){return arguments.length?(s=typeof w=="function"?w:zr(!!w),f):s},f.on=function(){var w=a.on.apply(a,arguments);return w===a?f:w},f.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,f):Math.sqrt(u)},f}var Wf=1e-12;function Fi(e){return((e=Math.exp(e))+1/e)/2}function Vf(e){return((e=Math.exp(e))-1/e)/2}function Kf(e){return((e=Math.exp(2*e))-1)/(e+1)}const no=(function e(t,n,s){function o(a,i){var l=a[0],c=a[1],d=a[2],h=i[0],u=i[1],f=i[2],m=h-l,g=u-c,y=m*m+g*g,k,v;if(y<Wf)v=Math.log(f/d)/t,k=function(E){return[l+E*m,c+E*g,d*Math.exp(t*E*v)]};else{var b=Math.sqrt(y),x=(f*f-d*d+s*y)/(2*d*n*b),w=(f*f-d*d-s*y)/(2*f*n*b),N=Math.log(Math.sqrt(x*x+1)-x),j=Math.log(Math.sqrt(w*w+1)-w);v=(j-N)/t,k=function(E){var C=E*v,D=Fi(N),_=d/(n*b)*(D*Kf(t*C+N)-Vf(N));return[l+_*m,c+_*g,d*D/Fi(t*C+N)]}}return k.duration=v*1e3*t/Math.SQRT2,k}return o.rho=function(a){var i=Math.max(.001,+a),l=i*i,c=l*l;return e(i,l,c)},o})(Math.SQRT2,2,4),qr=e=>()=>e;function Uf(e,{sourceEvent:t,target:n,transform:s,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:o}})}function Uo(e){e.stopImmediatePropagation()}function Zs(e){e.preventDefault(),e.stopImmediatePropagation()}function Yf(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Gf(){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 Hi(){return this.__zoom||Ta}function Xf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Zf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qf(e,t,n){var s=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o),i>a?(a+i)/2:Math.min(0,a)||Math.max(0,i))}function Dc(){var e=Yf,t=Gf,n=Qf,s=Xf,o=Zf,a=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,c=no,d=Mc("start","zoom","end"),h,u,f,m=500,g=150,y=0,k=10;function v(T){T.property("__zoom",Hi).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",_).filter(o).on("touchstart.zoom",I).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(T,B,L,z){var R=T.selection?T.selection():T;R.property("__zoom",Hi),T!==R?N(T,B,L,z):R.interrupt().each(function(){j(this,arguments).event(z).start().zoom(null,typeof B=="function"?B.apply(this,arguments):B).end()})},v.scaleBy=function(T,B,L,z){v.scaleTo(T,function(){var R=this.__zoom.k,A=typeof B=="function"?B.apply(this,arguments):B;return R*A},L,z)},v.scaleTo=function(T,B,L,z){v.transform(T,function(){var R=t.apply(this,arguments),A=this.__zoom,$=L==null?w(R):typeof L=="function"?L.apply(this,arguments):L,F=A.invert($),W=typeof B=="function"?B.apply(this,arguments):B;return n(x(b(A,W),$,F),R,i)},L,z)},v.translateBy=function(T,B,L,z){v.transform(T,function(){return n(this.__zoom.translate(typeof B=="function"?B.apply(this,arguments):B,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),i)},null,z)},v.translateTo=function(T,B,L,z,R){v.transform(T,function(){var A=t.apply(this,arguments),$=this.__zoom,F=z==null?w(A):typeof z=="function"?z.apply(this,arguments):z;return n(Ta.translate(F[0],F[1]).scale($.k).translate(typeof B=="function"?-B.apply(this,arguments):-B,typeof L=="function"?-L.apply(this,arguments):-L),A,i)},z,R)};function b(T,B){return B=Math.max(a[0],Math.min(a[1],B)),B===T.k?T:new Ho(B,T.x,T.y)}function x(T,B,L){var z=B[0]-L[0]*T.k,R=B[1]-L[1]*T.k;return z===T.x&&R===T.y?T:new Ho(T.k,z,R)}function w(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function N(T,B,L,z){T.on("start.zoom",function(){j(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(z).end()}).tween("zoom",function(){var R=this,A=arguments,$=j(R,A).event(z),F=t.apply(R,A),W=L==null?w(F):typeof L=="function"?L.apply(R,A):L,X=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),P=R.__zoom,M=typeof B=="function"?B.apply(R,A):B,K=c(P.invert(W).concat(X/P.k),M.invert(W).concat(X/M.k));return function(V){if(V===1)V=M;else{var H=K(V),Z=X/H[2];V=new Ho(Z,W[0]-H[0]*Z,W[1]-H[1]*Z)}$.zoom(null,V)}})}function j(T,B,L){return!L&&T.__zooming||new E(T,B)}function E(T,B){this.that=T,this.args=B,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,B),this.taps=0}E.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,B){return this.mouse&&T!=="mouse"&&(this.mouse[1]=B.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=B.invert(this.touch0[0])),this.touch1&&T!=="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(T){var B=qt(this.that).datum();d.call(T,this.that,new Uf(T,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:d}),B)}};function C(T,...B){if(!e.apply(this,arguments))return;var L=j(this,B).event(T),z=this.__zoom,R=Math.max(a[0],Math.min(a[1],z.k*Math.pow(2,s.apply(this,arguments)))),A=Zt(T);if(L.wheel)(L.mouse[0][0]!==A[0]||L.mouse[0][1]!==A[1])&&(L.mouse[1]=z.invert(L.mouse[0]=A)),clearTimeout(L.wheel);else{if(z.k===R)return;L.mouse=[A,z.invert(A)],Wo(this),L.start()}Zs(T),L.wheel=setTimeout($,g),L.zoom("mouse",n(x(b(z,R),L.mouse[0],L.mouse[1]),L.extent,i));function $(){L.wheel=null,L.end()}}function D(T,...B){if(f||!e.apply(this,arguments))return;var L=T.currentTarget,z=j(this,B,!0).event(T),R=qt(T.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",X,!0),A=Zt(T,L),$=T.clientX,F=T.clientY;Lc(T.view),Uo(T),z.mouse=[A,this.__zoom.invert(A)],Wo(this),z.start();function W(P){if(Zs(P),!z.moved){var M=P.clientX-$,K=P.clientY-F;z.moved=M*M+K*K>y}z.event(P).zoom("mouse",n(x(z.that.__zoom,z.mouse[0]=Zt(P,L),z.mouse[1]),z.extent,i))}function X(P){R.on("mousemove.zoom mouseup.zoom",null),_c(P.view,z.moved),Zs(P),z.event(P).end()}}function _(T,...B){if(e.apply(this,arguments)){var L=this.__zoom,z=Zt(T.changedTouches?T.changedTouches[0]:T,this),R=L.invert(z),A=L.k*(T.shiftKey?.5:2),$=n(x(b(L,A),z,R),t.apply(this,B),i);Zs(T),l>0?qt(this).transition().duration(l).call(N,$,z,T):qt(this).call(v.transform,$,z,T)}}function I(T,...B){if(e.apply(this,arguments)){var L=T.touches,z=L.length,R=j(this,B,T.changedTouches.length===z).event(T),A,$,F,W;for(Uo(T),$=0;$<z;++$)F=L[$],W=Zt(F,this),W=[W,this.__zoom.invert(W),F.identifier],R.touch0?!R.touch1&&R.touch0[2]!==W[2]&&(R.touch1=W,R.taps=0):(R.touch0=W,A=!0,R.taps=1+!!h);h&&(h=clearTimeout(h)),A&&(R.taps<2&&(u=W[0],h=setTimeout(function(){h=null},m)),Wo(this),R.start())}}function O(T,...B){if(this.__zooming){var L=j(this,B).event(T),z=T.changedTouches,R=z.length,A,$,F,W;for(Zs(T),A=0;A<R;++A)$=z[A],F=Zt($,this),L.touch0&&L.touch0[2]===$.identifier?L.touch0[0]=F:L.touch1&&L.touch1[2]===$.identifier&&(L.touch1[0]=F);if($=L.that.__zoom,L.touch1){var X=L.touch0[0],P=L.touch0[1],M=L.touch1[0],K=L.touch1[1],V=(V=M[0]-X[0])*V+(V=M[1]-X[1])*V,H=(H=K[0]-P[0])*H+(H=K[1]-P[1])*H;$=b($,Math.sqrt(V/H)),F=[(X[0]+M[0])/2,(X[1]+M[1])/2],W=[(P[0]+K[0])/2,(P[1]+K[1])/2]}else if(L.touch0)F=L.touch0[0],W=L.touch0[1];else return;L.zoom("touch",n(x($,F,W),L.extent,i))}}function q(T,...B){if(this.__zooming){var L=j(this,B).event(T),z=T.changedTouches,R=z.length,A,$;for(Uo(T),f&&clearTimeout(f),f=setTimeout(function(){f=null},m),A=0;A<R;++A)$=z[A],L.touch0&&L.touch0[2]===$.identifier?delete L.touch0:L.touch1&&L.touch1[2]===$.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&($=Zt($,this),Math.hypot(u[0]-$[0],u[1]-$[1])<k)){var F=qt(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return v.wheelDelta=function(T){return arguments.length?(s=typeof T=="function"?T:qr(+T),v):s},v.filter=function(T){return arguments.length?(e=typeof T=="function"?T:qr(!!T),v):e},v.touchable=function(T){return arguments.length?(o=typeof T=="function"?T:qr(!!T),v):o},v.extent=function(T){return arguments.length?(t=typeof T=="function"?T:qr([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),v):t},v.scaleExtent=function(T){return arguments.length?(a[0]=+T[0],a[1]=+T[1],v):[a[0],a[1]]},v.translateExtent=function(T){return arguments.length?(i[0][0]=+T[0][0],i[1][0]=+T[1][0],i[0][1]=+T[0][1],i[1][1]=+T[1][1],v):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},v.constrain=function(T){return arguments.length?(n=T,v):n},v.duration=function(T){return arguments.length?(l=+T,v):l},v.interpolate=function(T){return arguments.length?(c=T,v):c},v.on=function(){var T=d.on.apply(d,arguments);return T===d?v:T},v.clickDistance=function(T){return arguments.length?(y=(T=+T)*T,v):Math.sqrt(y)},v.tapDistance=function(T){return arguments.length?(k=+T,v):k},v}const Jf=["30m","1h","2h","4h","8h","12h","1d","1w"],eh={"30m":"freq30m","1h":"freq1h","2h":"freq2h","4h":"freq4h","8h":"freq8h","12h":"freq12h","1d":"freq1d","1w":"freq1w"};function Wi(e){return eh[e]??"freq4h"}function th(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function ua(){return{mode:"calendar",every:"4h",calendar:"daily",weekdays:[1,2,3,4,5],time:"09:00",cron:"",maxRuns:"",timezone:th()}}function Oc(e){const t=/^(\d{1,2}):(\d{2})$/.exec((e??"").trim());if(!t)return[9,0];const n=Math.min(23,Math.max(0,parseInt(t[1],10))),s=Math.min(59,Math.max(0,parseInt(t[2],10)));return[n,s]}function nh(e){const[t,n]=Oc(e);return`${String(t).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function sh(e,t,n){if(e==="cron")return"";const[s,o]=Oc(n),a=e==="daily"?"*":e==="weekdays"?"1-5":t.length>0?[...t].sort((i,l)=>i-l).join(","):"*";return`${o} ${s} * * ${a}`}function rh(e){const t=/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+(\S+)$/.exec((e??"").trim());if(!t)return null;const n=parseInt(t[1],10),s=parseInt(t[2],10);if(n>59||s>23)return null;const o=t[3],a=`${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`;if(o==="*")return{calendar:"daily",weekdays:[1,2,3,4,5],time:a};if(o==="1-5")return{calendar:"weekdays",weekdays:[1,2,3,4,5],time:a};if(/^\d(,\d)*$/.test(o)){const i=o.split(",").map(l=>parseInt(l,10)).filter(l=>l>=0&&l<=6);if(i.length>0)return{calendar:"weekly",weekdays:i,time:a}}return null}function oh(e){const t=ua();if(!e)return t;if(e.timezone&&(t.timezone=e.timezone),t.maxRuns=e.maxRuns&&e.maxRuns>0?String(e.maxRuns):"",e.cron){const n=rh(e.cron);t.mode="calendar",n?(t.calendar=n.calendar,t.weekdays=n.weekdays,t.time=n.time):(t.calendar="cron",t.cron=e.cron)}else e.every&&(t.mode="interval",t.every=e.every);return t}function $c(e){const t={};e.mode==="interval"?t.every=e.every||"4h":(t.cron=e.calendar==="cron"?e.cron.trim():sh(e.calendar,e.weekdays,e.time),e.timezone&&(t.timezone=e.timezone));const n=parseInt(e.maxRuns,10);return e.maxRuns.trim()!==""&&Number.isFinite(n)&&n>0&&(t.maxRuns=n),t}const ah=[1,2,3,4,5,6,0];function ih({options:e,value:t,onChange:n,size:s="md"}){const o=s==="sm"?"px-2.5 py-1 text-xs":"px-3 py-1.5 text-sm";return r.jsx("div",{className:"inline-flex rounded-lg border border-border-default overflow-hidden",children:e.map(a=>r.jsx("button",{type:"button",onClick:()=>n(a.value),className:`${o} transition-colors ${t===a.value?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:a.label},a.value))})}function Pc({value:e,onChange:t,compact:n=!1}){const{t:s}=ze(),o=h=>t({...e,...h}),a=`px-2 py-1.5 bg-surface-elevated border border-border-default rounded-lg outline-none focus:border-brand-500 ${n?"text-xs":"text-sm"}`,i=h=>{const f=e.weekdays.includes(h)?e.weekdays.filter(m=>m!==h):[...e.weekdays,h];o({weekdays:f})};let l;if(e.mode==="interval")l=s(`work:task.${Wi(e.every)}`);else if(e.calendar==="cron")l=s("work:task.scheduleCron",{expr:e.cron.trim()||"—"});else{const h=nh(e.time);if(e.calendar==="daily")l=s("work:task.scheduleDailyAt",{time:h});else if(e.calendar==="weekdays")l=s("work:task.scheduleWeekdaysAt",{time:h});else{const u=[...e.weekdays].sort((f,m)=>f-m).map(f=>s(`work:task.weekdayShort.${f}`)).join(" ");l=e.weekdays.length?s("work:task.scheduleWeeklyAt",{days:u,time:h}):s("work:task.scheduleNoDays")}}const c=e.calendar==="daily"||e.calendar==="weekdays"||e.calendar==="weekly",d="text-fg-tertiary shrink-0 text-xs w-20";return r.jsxs("div",{className:"rounded-lg border border-border-default/70 bg-surface-elevated/40 p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleRepeatMode")}),r.jsx(ih,{size:n?"sm":"md",value:e.mode,onChange:h=>o({mode:h}),options:[{value:"interval",label:s("work:task.scheduleByInterval")},{value:"calendar",label:s("work:task.scheduleByCalendar")}]})]}),e.mode==="interval"?r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleEveryLabel")}),r.jsx("select",{value:e.every,onChange:h=>o({every:h.target.value}),className:a,children:Jf.map(h=>r.jsx("option",{value:h,children:s(`work:task.${Wi(h)}`)},h))})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleRepeatLabel")}),r.jsxs("select",{value:e.calendar,onChange:h=>o({calendar:h.target.value}),className:a,children:[r.jsx("option",{value:"daily",children:s("work:task.scheduleCalendarDaily")}),r.jsx("option",{value:"weekdays",children:s("work:task.scheduleCalendarWeekdays")}),r.jsx("option",{value:"weekly",children:s("work:task.scheduleCalendarWeekly")}),r.jsx("option",{value:"cron",children:s("work:task.scheduleCalendarCron")})]}),c&&r.jsx("input",{type:"time",value:e.time,onChange:h=>o({time:h.target.value}),className:a})]}),e.calendar==="weekly"&&r.jsx("div",{className:"flex flex-wrap gap-1 pl-[5.5rem]",children:ah.map(h=>{const u=e.weekdays.includes(h);return r.jsx("button",{type:"button",onClick:()=>i(h),className:`w-7 h-7 rounded-full text-xs transition-colors ${u?"bg-brand-600 text-white":"bg-surface-elevated text-fg-secondary border border-border-default hover:text-fg-primary"}`,children:s(`work:task.weekdayShort.${h}`)},h)})}),e.calendar==="cron"&&r.jsx("input",{value:e.cron,onChange:h=>o({cron:h.target.value}),placeholder:"0 9 * * 1-5",className:`${a} w-full font-mono`})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:d,children:s("work:task.scheduleMaxRuns")}),r.jsx("input",{value:e.maxRuns,onChange:h=>o({maxRuns:h.target.value.replace(/\D/g,"")}),placeholder:s("work:task.scheduleMaxRunsPlaceholder"),className:`${a} w-20`})]}),r.jsxs("div",{className:"text-[11px] text-fg-secondary pt-1 border-t border-border-default/50",children:[s("work:task.schedulePreview",{desc:l}),r.jsxs("span",{className:"text-fg-tertiary",children:[" · ",s("work:task.scheduleTimezoneNote",{tz:e.timezone})]})]})]})}function yt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=yt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const ln={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:s})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:s}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ar=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Bc=["Enter"," ","Escape"],zc={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Cs;(function(e){e.Strict="strict",e.Loose="loose"})(Cs||(Cs={}));var Xn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Xn||(Xn={}));var ir;(function(e){e.Partial="partial",e.Full="full"})(ir||(ir={}));const qc={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Sn;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Sn||(Sn={}));var Es;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Es||(Es={}));var Ne;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ne||(Ne={}));const Vi={[Ne.Left]:Ne.Right,[Ne.Right]:Ne.Left,[Ne.Top]:Ne.Bottom,[Ne.Bottom]:Ne.Top};function Fc(e){return e===null?null:e?"valid":"invalid"}const Hc=e=>"id"in e&&"source"in e&&"target"in e,lh=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Ia=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),mr=(e,t=[0,0])=>{const{width:n,height:s}=bn(e),o=e.origin??t,a=n*o[0],i=s*o[1];return{x:e.position.x-a,y:e.position.y-i}},ch=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,o)=>{const a=typeof o=="string";let i=!t.nodeLookup&&!a?o:void 0;t.nodeLookup&&(i=a?t.nodeLookup.get(o):Ia(o)?o:t.nodeLookup.get(o.id));const l=i?co(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return wo(s,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ko(n)},pr=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},s=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=wo(n,co(o)),s=!0)}),s?ko(n):{x:0,y:0,width:0,height:0}},Ma=(e,t,[n,s,o]=[0,0,1],a=!1,i=!1)=>{const l={...xr(t,[n,s,o]),width:t.width/o,height:t.height/o},c=[];for(const d of e.values()){const{measured:h,selectable:u=!0,hidden:f=!1}=d;if(i&&!u||f)continue;const m=h.width??d.width??d.initialWidth??null,g=h.height??d.height??d.initialHeight??null,y=lr(l,Is(d)),k=(m??0)*(g??0),v=a&&y>0;(!d.internals.handleBounds||v||y>=k||d.dragging)&&c.push(d)}return c},dh=(e,t)=>{const n=new Set;return e.forEach(s=>{n.add(s.id)}),t.filter(s=>n.has(s.source)||n.has(s.target))};function uh(e,t){const n=new Map,s=t?.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&(t?.includeHiddenNodes||!o.hidden)&&(!s||s.has(o.id))&&n.set(o.id,o)}),n}async function fh({nodes:e,width:t,height:n,panZoom:s,minZoom:o,maxZoom:a},i){if(e.size===0)return Promise.resolve(!0);const l=uh(e,i),c=pr(l),d=Aa(c,t,n,i?.minZoom??o,i?.maxZoom??a,i?.padding??.1);return await s.setViewport(d,{duration:i?.duration,ease:i?.ease,interpolate:i?.interpolate}),Promise.resolve(!0)}function Wc({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:s=[0,0],nodeExtent:o,onError:a}){const i=n.get(e),l=i.parentId?n.get(i.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},h=i.origin??s;let u=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!l)a?.("005",ln.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(u=[[c,d],[c+m,d+g]])}else l&&Ms(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+d],[i.extent[1][0]+c,i.extent[1][1]+d]]);const f=Ms(u)?Zn(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&a?.("015",ln.error015()),{position:{x:f.x-c+(i.measured.width??0)*h[0],y:f.y-d+(i.measured.height??0)*h[1]},positionAbsolute:f}}async function hh({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:o}){const a=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const m=a.has(f.id),g=!m&&f.parentId&&i.find(y=>y.id===f.parentId);(m||g)&&i.push(f)}const l=new Set(t.map(f=>f.id)),c=s.filter(f=>f.deletable!==!1),h=dh(i,c);for(const f of c)l.has(f.id)&&!h.find(g=>g.id===f.id)&&h.push(f);if(!o)return{edges:h,nodes:i};const u=await o({nodes:i,edges:h});return typeof u=="boolean"?u?{edges:h,nodes:i}:{edges:[],nodes:[]}:u}const Ts=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Zn=(e={x:0,y:0},t,n)=>({x:Ts(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Ts(e.y,t[0][1],t[1][1]-(n?.height??0))});function Vc(e,t,n){const{width:s,height:o}=bn(n),{x:a,y:i}=n.internals.positionAbsolute;return Zn(e,[[a,i],[a+s,i+o]],t)}const Ki=(e,t,n)=>e<t?Ts(Math.abs(e-t),1,t)/t:e>n?-Ts(Math.abs(e-n),1,t)/t:0,Kc=(e,t,n=15,s=40)=>{const o=Ki(e.x,s,t.width-s)*n,a=Ki(e.y,s,t.height-s)*n;return[o,a]},wo=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),fa=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),ko=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),Is=(e,t=[0,0])=>{const{x:n,y:s}=Ia(e)?e.internals.positionAbsolute:mr(e,t);return{x:n,y:s,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},co=(e,t=[0,0])=>{const{x:n,y:s}=Ia(e)?e.internals.positionAbsolute:mr(e,t);return{x:n,y:s,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:s+(e.measured?.height??e.height??e.initialHeight??0)}},Uc=(e,t)=>ko(wo(fa(e),fa(t))),lr=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},Ui=e=>Qt(e.width)&&Qt(e.height)&&Qt(e.x)&&Qt(e.y),Qt=e=>!isNaN(e)&&isFinite(e),mh=(e,t)=>{},gr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),xr=({x:e,y:t},[n,s,o],a=!1,i=[1,1])=>{const l={x:(e-n)/o,y:(t-s)/o};return a?gr(l,i):l},uo=({x:e,y:t},[n,s,o])=>({x:e*o+n,y:t*o+s});function hs(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ph(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=hs(e,n),o=hs(e,t);return{top:s,right:o,bottom:s,left:o,x:o*2,y:s*2}}if(typeof e=="object"){const s=hs(e.top??e.y??0,n),o=hs(e.bottom??e.y??0,n),a=hs(e.left??e.x??0,t),i=hs(e.right??e.x??0,t);return{top:s,right:i,bottom:o,left:a,x:a+i,y:s+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function gh(e,t,n,s,o,a){const{x:i,y:l}=uo(e,[t,n,s]),{x:c,y:d}=uo({x:e.x+e.width,y:e.y+e.height},[t,n,s]),h=o-c,u=a-d;return{left:Math.floor(i),top:Math.floor(l),right:Math.floor(h),bottom:Math.floor(u)}}const Aa=(e,t,n,s,o,a)=>{const i=ph(a,t,n),l=(t-i.x)/e.width,c=(n-i.y)/e.height,d=Math.min(l,c),h=Ts(d,s,o),u=e.x+e.width/2,f=e.y+e.height/2,m=t/2-u*h,g=n/2-f*h,y=gh(e,m,g,h,t,n),k={left:Math.min(y.left-i.left,0),top:Math.min(y.top-i.top,0),right:Math.min(y.right-i.right,0),bottom:Math.min(y.bottom-i.bottom,0)};return{x:m-k.left+k.right,y:g-k.top+k.bottom,zoom:h}},cr=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ms(e){return e!=null&&e!=="parent"}function bn(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Yc(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Gc(e,t={width:0,height:0},n,s,o){const a={...e},i=s.get(n);if(i){const l=i.origin||o;a.x+=i.internals.positionAbsolute.x-(t.width??0)*l[0],a.y+=i.internals.positionAbsolute.y-(t.height??0)*l[1]}return a}function Yi(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function xh(){let e,t;return{promise:new Promise((s,o)=>{e=s,t=o}),resolve:e,reject:t}}function bh(e){return{...zc,...e||{}}}function tr(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:o}){const{x:a,y:i}=Jt(e),l=xr({x:a-(o?.left??0),y:i-(o?.top??0)},s),{x:c,y:d}=n?gr(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const La=e=>({width:e.offsetWidth,height:e.offsetHeight}),Xc=e=>e?.getRootNode?.()||window?.document,yh=["INPUT","SELECT","TEXTAREA"];function Zc(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:yh.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Qc=e=>"clientX"in e,Jt=(e,t)=>{const n=Qc(e),s=n?e.clientX:e.touches?.[0].clientX,o=n?e.clientY:e.touches?.[0].clientY;return{x:s-(t?.left??0),y:o-(t?.top??0)}},Gi=(e,t,n,s,o)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(i=>{const l=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:o,position:i.getAttribute("data-handlepos"),x:(l.left-n.left)/s,y:(l.top-n.top)/s,...La(i)}})};function Jc({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:o,sourceControlY:a,targetControlX:i,targetControlY:l}){const c=e*.125+o*.375+i*.375+n*.125,d=t*.125+a*.375+l*.375+s*.125,h=Math.abs(c-e),u=Math.abs(d-t);return[c,d,h,u]}function Fr(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Xi({pos:e,x1:t,y1:n,x2:s,y2:o,c:a}){switch(e){case Ne.Left:return[t-Fr(t-s,a),n];case Ne.Right:return[t+Fr(s-t,a),n];case Ne.Top:return[t,n-Fr(n-o,a)];case Ne.Bottom:return[t,n+Fr(o-n,a)]}}function ed({sourceX:e,sourceY:t,sourcePosition:n=Ne.Bottom,targetX:s,targetY:o,targetPosition:a=Ne.Top,curvature:i=.25}){const[l,c]=Xi({pos:n,x1:e,y1:t,x2:s,y2:o,c:i}),[d,h]=Xi({pos:a,x1:s,y1:o,x2:e,y2:t,c:i}),[u,f,m,g]=Jc({sourceX:e,sourceY:t,targetX:s,targetY:o,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${e},${t} C${l},${c} ${d},${h} ${s},${o}`,u,f,m,g]}function td({sourceX:e,sourceY:t,targetX:n,targetY:s}){const o=Math.abs(n-e)/2,a=n<e?n+o:n-o,i=Math.abs(s-t)/2,l=s<t?s+i:s-i;return[a,l,o,i]}function wh({sourceNode:e,targetNode:t,selected:n=!1,zIndex:s=0,elevateOnSelect:o=!1,zIndexMode:a="basic"}){if(a==="manual")return s;const i=o&&n?s+1e3:s,l=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return i+l}function kh({sourceNode:e,targetNode:t,width:n,height:s,transform:o}){const a=wo(co(e),co(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const i={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:s/o[2]};return lr(i,ko(a))>0}const vh=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,jh=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Nh=(e,t,n={})=>{if(!e.source||!e.target)return t;const s=n.getEdgeId||vh;let o;return Hc(e)?o={...e}:o={...e,id:s(e)},jh(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function nd({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[o,a,i,l]=td({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,o,a,i,l]}const Zi={[Ne.Left]:{x:-1,y:0},[Ne.Right]:{x:1,y:0},[Ne.Top]:{x:0,y:-1},[Ne.Bottom]:{x:0,y:1}},Sh=({source:e,sourcePosition:t=Ne.Bottom,target:n})=>t===Ne.Left||t===Ne.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Qi=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Ch({source:e,sourcePosition:t=Ne.Bottom,target:n,targetPosition:s=Ne.Top,center:o,offset:a,stepPosition:i}){const l=Zi[t],c=Zi[s],d={x:e.x+l.x*a,y:e.y+l.y*a},h={x:n.x+c.x*a,y:n.y+c.y*a},u=Sh({source:d,sourcePosition:t,target:h}),f=u.x!==0?"x":"y",m=u[f];let g=[],y,k;const v={x:0,y:0},b={x:0,y:0},[,,x,w]=td({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*c[f]===-1){f==="x"?(y=o.x??d.x+(h.x-d.x)*i,k=o.y??(d.y+h.y)/2):(y=o.x??(d.x+h.x)/2,k=o.y??d.y+(h.y-d.y)*i);const j=[{x:y,y:d.y},{x:y,y:h.y}],E=[{x:d.x,y:k},{x:h.x,y:k}];l[f]===m?g=f==="x"?j:E:g=f==="x"?E:j}else{const j=[{x:d.x,y:h.y}],E=[{x:h.x,y:d.y}];if(f==="x"?g=l.x===m?E:j:g=l.y===m?j:E,t===s){const O=Math.abs(e[f]-n[f]);if(O<=a){const q=Math.min(a-1,a-O);l[f]===m?v[f]=(d[f]>e[f]?-1:1)*q:b[f]=(h[f]>n[f]?-1:1)*q}}if(t!==s){const O=f==="x"?"y":"x",q=l[f]===c[O],T=d[O]>h[O],B=d[O]<h[O];(l[f]===1&&(!q&&T||q&&B)||l[f]!==1&&(!q&&B||q&&T))&&(g=f==="x"?j:E)}const C={x:d.x+v.x,y:d.y+v.y},D={x:h.x+b.x,y:h.y+b.y},_=Math.max(Math.abs(C.x-g[0].x),Math.abs(D.x-g[0].x)),I=Math.max(Math.abs(C.y-g[0].y),Math.abs(D.y-g[0].y));_>=I?(y=(C.x+D.x)/2,k=g[0].y):(y=g[0].x,k=(C.y+D.y)/2)}return[[e,{x:d.x+v.x,y:d.y+v.y},...g,{x:h.x+b.x,y:h.y+b.y},n],y,k,x,w]}function Eh(e,t,n,s){const o=Math.min(Qi(e,t)/2,Qi(t,n)/2,s),{x:a,y:i}=t;if(e.x===a&&a===n.x||e.y===i&&i===n.y)return`L${a} ${i}`;if(e.y===i){const d=e.x<n.x?-1:1,h=e.y<n.y?1:-1;return`L ${a+o*d},${i}Q ${a},${i} ${a},${i+o*h}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${a},${i+o*c}Q ${a},${i} ${a+o*l},${i}`}function ha({sourceX:e,sourceY:t,sourcePosition:n=Ne.Bottom,targetX:s,targetY:o,targetPosition:a=Ne.Top,borderRadius:i=5,centerX:l,centerY:c,offset:d=20,stepPosition:h=.5}){const[u,f,m,g,y]=Ch({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:o},targetPosition:a,center:{x:l,y:c},offset:d,stepPosition:h});return[u.reduce((v,b,x)=>{let w="";return x>0&&x<u.length-1?w=Eh(u[x-1],b,u[x+1],i):w=`${x===0?"M":"L"}${b.x} ${b.y}`,v+=w,v},""),f,m,g,y]}function Ji(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Th(e){const{sourceNode:t,targetNode:n}=e;if(!Ji(t)||!Ji(n))return null;const s=t.internals.handleBounds||el(t.handles),o=n.internals.handleBounds||el(n.handles),a=tl(s?.source??[],e.sourceHandle),i=tl(e.connectionMode===Cs.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!a||!i)return e.onError?.("008",ln.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=a?.position||Ne.Bottom,c=i?.position||Ne.Top,d=Qn(t,a,l),h=Qn(n,i,c);return{sourceX:d.x,sourceY:d.y,targetX:h.x,targetY:h.y,sourcePosition:l,targetPosition:c}}function el(e){if(!e)return null;const t=[],n=[];for(const s of e)s.width=s.width??1,s.height=s.height??1,s.type==="source"?t.push(s):s.type==="target"&&n.push(s);return{source:t,target:n}}function Qn(e,t,n=Ne.Left,s=!1){const o=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:i,height:l}=t??bn(e);if(s)return{x:o+i/2,y:a+l/2};switch(t?.position??n){case Ne.Top:return{x:o+i/2,y:a};case Ne.Right:return{x:o+i,y:a+l/2};case Ne.Bottom:return{x:o+i/2,y:a+l};case Ne.Left:return{x:o,y:a+l/2}}}function tl(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function ma(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function Ih(e,{id:t,defaultColor:n,defaultMarkerStart:s,defaultMarkerEnd:o}){const a=new Set;return e.reduce((i,l)=>([l.markerStart||s,l.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const d=ma(c,t);a.has(d)||(i.push({id:d,color:c.color||n,...c}),a.add(d))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))}const sd=1e3,Mh=10,_a={nodeOrigin:[0,0],nodeExtent:ar,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ah={..._a,checkEquality:!0};function Ra(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function Lh(e,t,n){const s=Ra(_a,n);for(const o of e.values())if(o.parentId)Oa(o,e,t,s);else{const a=mr(o,s.nodeOrigin),i=Ms(o.extent)?o.extent:s.nodeExtent,l=Zn(a,i,bn(o));o.internals.positionAbsolute=l}}function _h(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],s=[];for(const o of e.handles){const a={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(a):o.type==="target"&&s.push(a)}return{source:n,target:s}}function Da(e){return e==="manual"}function pa(e,t,n,s={}){const o=Ra(Ah,s),a={i:0},i=new Map(t),l=o?.elevateNodesOnSelect&&!Da(o.zIndexMode)?sd:0;let c=e.length>0;t.clear(),n.clear();for(const d of e){let h=i.get(d.id);if(o.checkEquality&&d===h?.internals.userNode)t.set(d.id,h);else{const u=mr(d,o.nodeOrigin),f=Ms(d.extent)?d.extent:o.nodeExtent,m=Zn(u,f,bn(d));h={...o.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:m,handleBounds:_h(d,h),z:rd(d,l,o.zIndexMode),userNode:d}},t.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&Oa(h,t,n,s,a)}return c}function Rh(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Oa(e,t,n,s,o){const{elevateNodesOnSelect:a,nodeOrigin:i,nodeExtent:l,zIndexMode:c}=Ra(_a,s),d=e.parentId,h=t.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}Rh(e,n),o&&!h.parentId&&h.internals.rootParentIndex===void 0&&c==="auto"&&(h.internals.rootParentIndex=++o.i,h.internals.z=h.internals.z+o.i*Mh),o&&h.internals.rootParentIndex!==void 0&&(o.i=h.internals.rootParentIndex);const u=a&&!Da(c)?sd:0,{x:f,y:m,z:g}=Dh(e,h,i,l,u,c),{positionAbsolute:y}=e.internals,k=f!==y.x||m!==y.y;(k||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:f,y:m}:y,z:g}})}function rd(e,t,n){const s=Qt(e.zIndex)?e.zIndex:0;return Da(n)?s:s+(e.selected?t:0)}function Dh(e,t,n,s,o,a){const{x:i,y:l}=t.internals.positionAbsolute,c=bn(e),d=mr(e,n),h=Ms(e.extent)?Zn(d,e.extent,c):d;let u=Zn({x:i+h.x,y:l+h.y},s,c);e.extent==="parent"&&(u=Vc(u,c,t));const f=rd(e,o,a),m=t.internals.z??0;return{x:u.x,y:u.y,z:m>=f?m+1:f}}function $a(e,t,n,s=[0,0]){const o=[],a=new Map;for(const i of e){const l=t.get(i.parentId);if(!l)continue;const c=a.get(i.parentId)?.expandedRect??Is(l),d=Uc(c,i.rect);a.set(i.parentId,{expandedRect:d,parent:l})}return a.size>0&&a.forEach(({expandedRect:i,parent:l},c)=>{const d=l.internals.positionAbsolute,h=bn(l),u=l.origin??s,f=i.x<d.x?Math.round(Math.abs(d.x-i.x)):0,m=i.y<d.y?Math.round(Math.abs(d.y-i.y)):0,g=Math.max(h.width,Math.round(i.width)),y=Math.max(h.height,Math.round(i.height)),k=(g-h.width)*u[0],v=(y-h.height)*u[1];(f>0||m>0||k||v)&&(o.push({id:c,type:"position",position:{x:l.position.x-f+k,y:l.position.y-m+v}}),n.get(c)?.forEach(b=>{e.some(x=>x.id===b.id)||o.push({id:b.id,type:"position",position:{x:b.position.x+f,y:b.position.y+m}})})),(h.width<i.width||h.height<i.height||f||m)&&o.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?u[0]*f-k:0),height:y+(m?u[1]*m-v:0)}})}),o}function Oh(e,t,n,s,o,a,i){const l=s?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],h=window.getComputedStyle(l),{m22:u}=new window.DOMMatrixReadOnly(h.transform),f=[];for(const m of e.values()){const g=t.get(m.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const y=La(m.nodeElement),k=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(k||!g.internals.handleBounds||m.force))){const b=m.nodeElement.getBoundingClientRect(),x=Ms(g.extent)?g.extent:a;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=Vc(w,y,t.get(g.parentId)):x&&(w=Zn(w,x,y));const N={...g,measured:y,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:Gi("source",m.nodeElement,b,u,g.id),target:Gi("target",m.nodeElement,b,u,g.id)}}};t.set(g.id,N),g.parentId&&Oa(N,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,k&&(d.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Is(N,o)}))}}if(f.length>0){const m=$a(f,t,n,o);d.push(...m)}return{changes:d,updatedInternals:c}}async function $h({delta:e,panZoom:t,transform:n,translateExtent:s,width:o,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,a]],s),l=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(l)}function nl(e,t,n,s,o,a){let i=o;const l=s.get(i)||new Map;s.set(i,l.set(n,t)),i=`${o}-${e}`;const c=s.get(i)||new Map;if(s.set(i,c.set(n,t)),a){i=`${o}-${e}-${a}`;const d=s.get(i)||new Map;s.set(i,d.set(n,t))}}function od(e,t,n){e.clear(),t.clear();for(const s of n){const{source:o,target:a,sourceHandle:i=null,targetHandle:l=null}=s,c={edgeId:s.id,source:o,target:a,sourceHandle:i,targetHandle:l},d=`${o}-${i}--${a}-${l}`,h=`${a}-${l}--${o}-${i}`;nl("source",c,h,e,o,i),nl("target",c,d,e,a,l),t.set(s.id,s)}}function ad(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:ad(n,t):!1}function sl(e,t,n){let s=e;do{if(s?.matches?.(t))return!0;if(s===n)return!1;s=s?.parentElement}while(s);return!1}function Ph(e,t,n,s){const o=new Map;for(const[a,i]of e)if((i.selected||i.id===s)&&(!i.parentId||!ad(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const l=e.get(a);l&&o.set(a,{id:a,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.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 o}function Yo({nodeId:e,dragItems:t,nodeLookup:n,dragging:s=!0}){const o=[];for(const[i,l]of t){const c=n.get(i)?.internals.userNode;c&&o.push({...c,position:l.position,dragging:s})}if(!e)return[o[0],o];const a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:s}:o[0],o]}function Bh({dragItems:e,snapGrid:t,x:n,y:s}){const o=e.values().next().value;if(!o)return null;const a={x:n-o.distance.x,y:s-o.distance.y},i=gr(a,t);return{x:i.x-a.x,y:i.y-a.y}}function zh({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:s,onDragStop:o}){let a={x:null,y:null},i=0,l=new Map,c=!1,d={x:0,y:0},h=null,u=!1,f=null,m=!1,g=!1,y=null;function k({noDragClassName:b,handleSelector:x,domNode:w,isSelectable:N,nodeId:j,nodeClickDistance:E=0}){f=qt(w);function C({x:O,y:q}){const{nodeLookup:T,nodeExtent:B,snapGrid:L,snapToGrid:z,nodeOrigin:R,onNodeDrag:A,onSelectionDrag:$,onError:F,updateNodePositions:W}=t();a={x:O,y:q};let X=!1;const P=l.size>1,M=P&&B?fa(pr(l)):null,K=P&&z?Bh({dragItems:l,snapGrid:L,x:O,y:q}):null;for(const[V,H]of l){if(!T.has(V))continue;let Z={x:O-H.distance.x,y:q-H.distance.y};z&&(Z=K?{x:Math.round(Z.x+K.x),y:Math.round(Z.y+K.y)}:gr(Z,L));let ee=null;if(P&&B&&!H.extent&&M){const{positionAbsolute:Q}=H.internals,le=Q.x-M.x+B[0][0],ue=Q.x+H.measured.width-M.x2+B[1][0],fe=Q.y-M.y+B[0][1],ge=Q.y+H.measured.height-M.y2+B[1][1];ee=[[le,fe],[ue,ge]]}const{position:oe,positionAbsolute:de}=Wc({nodeId:V,nextPosition:Z,nodeLookup:T,nodeExtent:ee||B,nodeOrigin:R,onError:F});X=X||H.position.x!==oe.x||H.position.y!==oe.y,H.position=oe,H.internals.positionAbsolute=de}if(g=g||X,!!X&&(W(l,!0),y&&(s||A||!j&&$))){const[V,H]=Yo({nodeId:j,dragItems:l,nodeLookup:T});s?.(y,l,V,H),A?.(y,V,H),j||$?.(y,H)}}async function D(){if(!h)return;const{transform:O,panBy:q,autoPanSpeed:T,autoPanOnNodeDrag:B}=t();if(!B){c=!1,cancelAnimationFrame(i);return}const[L,z]=Kc(d,h,T);(L!==0||z!==0)&&(a.x=(a.x??0)-L/O[2],a.y=(a.y??0)-z/O[2],await q({x:L,y:z})&&C(a)),i=requestAnimationFrame(D)}function _(O){const{nodeLookup:q,multiSelectionActive:T,nodesDraggable:B,transform:L,snapGrid:z,snapToGrid:R,selectNodesOnDrag:A,onNodeDragStart:$,onSelectionDragStart:F,unselectNodesAndEdges:W}=t();u=!0,(!A||!N)&&!T&&j&&(q.get(j)?.selected||W()),N&&A&&j&&e?.(j);const X=tr(O.sourceEvent,{transform:L,snapGrid:z,snapToGrid:R,containerBounds:h});if(a=X,l=Ph(q,B,X,j),l.size>0&&(n||$||!j&&F)){const[P,M]=Yo({nodeId:j,dragItems:l,nodeLookup:q});n?.(O.sourceEvent,l,P,M),$?.(O.sourceEvent,P,M),j||F?.(O.sourceEvent,M)}}const I=Rc().clickDistance(E).on("start",O=>{const{domNode:q,nodeDragThreshold:T,transform:B,snapGrid:L,snapToGrid:z}=t();h=q?.getBoundingClientRect()||null,m=!1,g=!1,y=O.sourceEvent,T===0&&_(O),a=tr(O.sourceEvent,{transform:B,snapGrid:L,snapToGrid:z,containerBounds:h}),d=Jt(O.sourceEvent,h)}).on("drag",O=>{const{autoPanOnNodeDrag:q,transform:T,snapGrid:B,snapToGrid:L,nodeDragThreshold:z,nodeLookup:R}=t(),A=tr(O.sourceEvent,{transform:T,snapGrid:B,snapToGrid:L,containerBounds:h});if(y=O.sourceEvent,(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1||j&&!R.has(j))&&(m=!0),!m){if(!c&&q&&u&&(c=!0,D()),!u){const $=Jt(O.sourceEvent,h),F=$.x-d.x,W=$.y-d.y;Math.sqrt(F*F+W*W)>z&&_(O)}(a.x!==A.xSnapped||a.y!==A.ySnapped)&&l&&u&&(d=Jt(O.sourceEvent,h),C(A))}}).on("end",O=>{if(!(!u||m)&&(c=!1,u=!1,cancelAnimationFrame(i),l.size>0)){const{nodeLookup:q,updateNodePositions:T,onNodeDragStop:B,onSelectionDragStop:L}=t();if(g&&(T(l,!1),g=!1),o||B||!j&&L){const[z,R]=Yo({nodeId:j,dragItems:l,nodeLookup:q,dragging:!1});o?.(O.sourceEvent,l,z,R),B?.(O.sourceEvent,z,R),j||L?.(O.sourceEvent,R)}}}).filter(O=>{const q=O.target;return!O.button&&(!b||!sl(q,`.${b}`,w))&&(!x||sl(q,x,w))});f.call(I)}function v(){f?.on(".drag",null)}return{update:k,destroy:v}}function qh(e,t,n){const s=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())lr(o,Is(a))>0&&s.push(a);return s}const Fh=250;function Hh(e,t,n,s){let o=[],a=1/0;const i=qh(e,n,t+Fh);for(const l of i){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const d of c){if(s.nodeId===d.nodeId&&s.type===d.type&&s.id===d.id)continue;const{x:h,y:u}=Qn(l,d,d.position,!0),f=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(u-e.y,2));f>t||(f<a?(o=[{...d,x:h,y:u}],a=f):f===a&&o.push({...d,x:h,y:u}))}}if(!o.length)return null;if(o.length>1){const l=s.type==="source"?"target":"source";return o.find(c=>c.type===l)??o[0]}return o[0]}function id(e,t,n,s,o,a=!1){const i=s.get(e);if(!i)return null;const l=o==="strict"?i.internals.handleBounds?.[t]:[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]],c=(n?l?.find(d=>d.id===n):l?.[0])??null;return c&&a?{...c,...Qn(i,c,c.position,!0)}:c}function ld(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Wh(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const cd=()=>!0;function Vh(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:o,edgeUpdaterType:a,isTarget:i,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:h,flowId:u,panBy:f,cancelConnection:m,onConnectStart:g,onConnect:y,onConnectEnd:k,isValidConnection:v=cd,onReconnectEnd:b,updateConnection:x,getTransform:w,getFromHandle:N,autoPanSpeed:j,dragThreshold:E=1,handleDomNode:C}){const D=Xc(e.target);let _=0,I;const{x:O,y:q}=Jt(e),T=ld(a,C),B=l?.getBoundingClientRect();let L=!1;if(!B||!T)return;const z=id(o,T,s,c,t);if(!z)return;let R=Jt(e,B),A=!1,$=null,F=!1,W=null;function X(){if(!h||!B)return;const[oe,de]=Kc(R,B,j);f({x:oe,y:de}),_=requestAnimationFrame(X)}const P={...z,nodeId:o,type:T,position:z.position},M=c.get(o);let V={inProgress:!0,isValid:null,from:Qn(M,P,Ne.Left,!0),fromHandle:P,fromPosition:P.position,fromNode:M,to:R,toHandle:null,toPosition:Vi[P.position],toNode:null,pointer:R};function H(){L=!0,x(V),g?.(e,{nodeId:o,handleId:s,handleType:T})}E===0&&H();function Z(oe){if(!L){const{x:ge,y:we}=Jt(oe),me=ge-O,ve=we-q;if(!(me*me+ve*ve>E*E))return;H()}if(!N()||!P){ee(oe);return}const de=w();R=Jt(oe,B),I=Hh(xr(R,de,!1,[1,1]),n,c,P),A||(X(),A=!0);const Q=dd(oe,{handle:I,connectionMode:t,fromNodeId:o,fromHandleId:s,fromType:i?"target":"source",isValidConnection:v,doc:D,lib:d,flowId:u,nodeLookup:c});W=Q.handleDomNode,$=Q.connection,F=Wh(!!I,Q.isValid);const le=c.get(o),ue=le?Qn(le,P,Ne.Left,!0):V.from,fe={...V,from:ue,isValid:F,to:Q.toHandle&&F?uo({x:Q.toHandle.x,y:Q.toHandle.y},de):R,toHandle:Q.toHandle,toPosition:F&&Q.toHandle?Q.toHandle.position:Vi[P.position],toNode:Q.toHandle?c.get(Q.toHandle.nodeId):null,pointer:R};x(fe),V=fe}function ee(oe){if(!("touches"in oe&&oe.touches.length>0)){if(L){(I||W)&&$&&F&&y?.($);const{inProgress:de,...Q}=V,le={...Q,toPosition:V.toHandle?V.toPosition:null};k?.(oe,le),a&&b?.(oe,le)}m(),cancelAnimationFrame(_),A=!1,F=!1,$=null,W=null,D.removeEventListener("mousemove",Z),D.removeEventListener("mouseup",ee),D.removeEventListener("touchmove",Z),D.removeEventListener("touchend",ee)}}D.addEventListener("mousemove",Z),D.addEventListener("mouseup",ee),D.addEventListener("touchmove",Z),D.addEventListener("touchend",ee)}function dd(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:o,fromType:a,doc:i,lib:l,flowId:c,isValidConnection:d=cd,nodeLookup:h}){const u=a==="target",f=t?i.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:m,y:g}=Jt(e),y=i.elementFromPoint(m,g),k=y?.classList.contains(`${l}-flow__handle`)?y:f,v={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const b=ld(void 0,k),x=k.getAttribute("data-nodeid"),w=k.getAttribute("data-handleid"),N=k.classList.contains("connectable"),j=k.classList.contains("connectableend");if(!x||!b)return v;const E={source:u?x:s,sourceHandle:u?w:o,target:u?s:x,targetHandle:u?o:w};v.connection=E;const D=N&&j&&(n===Cs.Strict?u&&b==="source"||!u&&b==="target":x!==s||w!==o);v.isValid=D&&d(E),v.toHandle=id(x,b,w,h,n,!0)}return v}const ga={onPointerDown:Vh,isValid:dd};function Kh({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const o=qt(e);function a({translateExtent:l,width:c,height:d,zoomStep:h=1,pannable:u=!0,zoomable:f=!0,inversePan:m=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const w=n(),N=x.sourceEvent.ctrlKey&&cr()?10:1,j=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*h,E=w[2]*Math.pow(2,j*N);t.scaleTo(E)};let y=[0,0];const k=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(y=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},v=x=>{const w=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const N=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],j=[N[0]-y[0],N[1]-y[1]];y=N;const E=s()*Math.max(w[2],Math.log(w[2]))*(m?-1:1),C={x:w[0]-j[0]*E,y:w[1]-j[1]*E},D=[[0,0],[c,d]];t.setViewportConstrained({x:C.x,y:C.y,zoom:w[2]},D,l)},b=Dc().on("start",k).on("zoom",u?v:null).on("zoom.wheel",f?g:null);o.call(b,{})}function i(){o.on("zoom",null)}return{update:a,destroy:i,pointer:Zt}}const vo=e=>({x:e.x,y:e.y,zoom:e.k}),Go=({x:e,y:t,zoom:n})=>Ta.translate(e,t).scale(n),xs=(e,t)=>e.target.closest(`.${t}`),ud=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Uh=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xo=(e,t=0,n=Uh,s=()=>{})=>{const o=typeof t=="number"&&t>0;return o||s(),o?e.transition().duration(t).ease(n).on("end",s):e},fd=e=>{const t=e.ctrlKey&&cr()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Yh({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:o,panOnScrollSpeed:a,zoomOnPinch:i,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return h=>{if(xs(h,t))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(h.ctrlKey&&i){const k=Zt(h),v=fd(h),b=u*Math.pow(2,v);s.scaleTo(n,b,k,h);return}const f=h.deltaMode===1?20:1;let m=o===Xn.Vertical?0:h.deltaX*f,g=o===Xn.Horizontal?0:h.deltaY*f;!cr()&&h.shiftKey&&o!==Xn.Vertical&&(m=h.deltaY*f,g=0),s.translateBy(n,-(m/u)*a,-(g/u)*a,{internal:!0});const y=vo(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(h,y),e.panScrollTimeout=setTimeout(()=>{d?.(h,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(h,y))}}function Gh({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,o){const a=s.type==="wheel",i=!t&&a&&!s.ctrlKey,l=xs(s,e);if(s.ctrlKey&&a&&l&&s.preventDefault(),i||l)return null;s.preventDefault(),n.call(this,s,o)}}function Xh({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{if(s.sourceEvent?.internal)return;const o=vo(s.transform);e.mouseButton=s.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,s.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(s.sourceEvent,o)}}function Zh({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:o}){return a=>{e.usedRightMouseButton=!!(n&&ud(t,e.mouseButton??0)),a.sourceEvent?.sync||s([a.transform.x,a.transform.y,a.transform.k]),o&&!a.sourceEvent?.internal&&o?.(a.sourceEvent,vo(a.transform))}}function Qh({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:o,onPaneContextMenu:a}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&ud(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&a(i.sourceEvent),e.usedRightMouseButton=!1,s(!1),o)){const l=vo(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(i.sourceEvent,l)},n?150:0)}}}function Jh({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:o,zoomOnDoubleClick:a,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:h}){return u=>{const f=e||t,m=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(xs(u,`${d}-flow__node`)||xs(u,`${d}-flow__edge`)))return!0;if(!s&&!f&&!o&&!a&&!n||i||h&&!g||xs(u,l)&&g||xs(u,c)&&(!g||o&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!f&&!o&&!m&&g||!s&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(s)&&!s.includes(u.button)&&u.type==="mousedown")return!1;const y=Array.isArray(s)&&s.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&y}}function em({domNode:e,minZoom:t,maxZoom:n,translateExtent:s,viewport:o,onPanZoom:a,onPanZoomStart:i,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),u=Dc().scaleExtent([t,n]).translateExtent(s),f=qt(e).call(u);b({x:o.x,y:o.y,zoom:Ts(o.zoom,t,n)},[[0,0],[h.width,h.height]],s);const m=f.on("wheel.zoom"),g=f.on("dblclick.zoom");u.wheelDelta(fd);function y(I,O){return f?new Promise(q=>{u?.interpolate(O?.interpolate==="linear"?Vo:no).transform(Xo(f,O?.duration,O?.ease,()=>q(!0)),I)}):Promise.resolve(!1)}function k({noWheelClassName:I,noPanClassName:O,onPaneContextMenu:q,userSelectionActive:T,panOnScroll:B,panOnDrag:L,panOnScrollMode:z,panOnScrollSpeed:R,preventScrolling:A,zoomOnPinch:$,zoomOnScroll:F,zoomOnDoubleClick:W,zoomActivationKeyPressed:X,lib:P,onTransformChange:M,connectionInProgress:K,paneClickDistance:V,selectionOnDrag:H}){T&&!d.isZoomingOrPanning&&v();const Z=B&&!X&&!T;u.clickDistance(H?1/0:!Qt(V)||V<0?0:V);const ee=Z?Yh({zoomPanValues:d,noWheelClassName:I,d3Selection:f,d3Zoom:u,panOnScrollMode:z,panOnScrollSpeed:R,zoomOnPinch:$,onPanZoomStart:i,onPanZoom:a,onPanZoomEnd:l}):Gh({noWheelClassName:I,preventScrolling:A,d3ZoomHandler:m});if(f.on("wheel.zoom",ee,{passive:!1}),!T){const de=Xh({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:i});u.on("start",de);const Q=Zh({zoomPanValues:d,panOnDrag:L,onPaneContextMenu:!!q,onPanZoom:a,onTransformChange:M});u.on("zoom",Q);const le=Qh({zoomPanValues:d,panOnDrag:L,panOnScroll:B,onPaneContextMenu:q,onPanZoomEnd:l,onDraggingChange:c});u.on("end",le)}const oe=Jh({zoomActivationKeyPressed:X,panOnDrag:L,zoomOnScroll:F,panOnScroll:B,zoomOnDoubleClick:W,zoomOnPinch:$,userSelectionActive:T,noPanClassName:O,noWheelClassName:I,lib:P,connectionInProgress:K});u.filter(oe),W?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function v(){u.on("zoom",null)}async function b(I,O,q){const T=Go(I),B=u?.constrain()(T,O,q);return B&&await y(B),new Promise(L=>L(B))}async function x(I,O){const q=Go(I);return await y(q,O),new Promise(T=>T(q))}function w(I){if(f){const O=Go(I),q=f.property("__zoom");(q.k!==I.zoom||q.x!==I.x||q.y!==I.y)&&u?.transform(f,O,null,{sync:!0})}}function N(){const I=f?$f(f.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function j(I,O){return f?new Promise(q=>{u?.interpolate(O?.interpolate==="linear"?Vo:no).scaleTo(Xo(f,O?.duration,O?.ease,()=>q(!0)),I)}):Promise.resolve(!1)}function E(I,O){return f?new Promise(q=>{u?.interpolate(O?.interpolate==="linear"?Vo:no).scaleBy(Xo(f,O?.duration,O?.ease,()=>q(!0)),I)}):Promise.resolve(!1)}function C(I){u?.scaleExtent(I)}function D(I){u?.translateExtent(I)}function _(I){const O=!Qt(I)||I<0?0:I;u?.clickDistance(O)}return{update:k,destroy:v,setViewport:x,setViewportConstrained:b,getViewport:N,scaleTo:j,scaleBy:E,setScaleExtent:C,setTranslateExtent:D,syncViewport:w,setClickDistance:_}}var As;(function(e){e.Line="line",e.Handle="handle"})(As||(As={}));function tm({width:e,prevWidth:t,height:n,prevHeight:s,affectsX:o,affectsY:a}){const i=e-t,l=n-s,c=[i>0?1:i<0?-1:0,l>0?1:l<0?-1:0];return i&&o&&(c[0]=c[0]*-1),l&&a&&(c[1]=c[1]*-1),c}function rl(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),s=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:s,affectsY:o}}function vn(e,t){return Math.max(0,t-e)}function jn(e,t){return Math.max(0,e-t)}function Hr(e,t,n){return Math.max(0,t-e,e-n)}function ol(e,t){return e?!t:t}function nm(e,t,n,s,o,a,i,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:h,isVertical:u}=t,f=h&&u,{xSnapped:m,ySnapped:g}=n,{minWidth:y,maxWidth:k,minHeight:v,maxHeight:b}=s,{x,y:w,width:N,height:j,aspectRatio:E}=e;let C=Math.floor(h?m-e.pointerX:0),D=Math.floor(u?g-e.pointerY:0);const _=N+(c?-C:C),I=j+(d?-D:D),O=-a[0]*N,q=-a[1]*j;let T=Hr(_,y,k),B=Hr(I,v,b);if(i){let R=0,A=0;c&&C<0?R=vn(x+C+O,i[0][0]):!c&&C>0&&(R=jn(x+_+O,i[1][0])),d&&D<0?A=vn(w+D+q,i[0][1]):!d&&D>0&&(A=jn(w+I+q,i[1][1])),T=Math.max(T,R),B=Math.max(B,A)}if(l){let R=0,A=0;c&&C>0?R=jn(x+C,l[0][0]):!c&&C<0&&(R=vn(x+_,l[1][0])),d&&D>0?A=jn(w+D,l[0][1]):!d&&D<0&&(A=vn(w+I,l[1][1])),T=Math.max(T,R),B=Math.max(B,A)}if(o){if(h){const R=Hr(_/E,v,b)*E;if(T=Math.max(T,R),i){let A=0;!c&&!d||c&&!d&&f?A=jn(w+q+_/E,i[1][1])*E:A=vn(w+q+(c?C:-C)/E,i[0][1])*E,T=Math.max(T,A)}if(l){let A=0;!c&&!d||c&&!d&&f?A=vn(w+_/E,l[1][1])*E:A=jn(w+(c?C:-C)/E,l[0][1])*E,T=Math.max(T,A)}}if(u){const R=Hr(I*E,y,k)/E;if(B=Math.max(B,R),i){let A=0;!c&&!d||d&&!c&&f?A=jn(x+I*E+O,i[1][0])/E:A=vn(x+(d?D:-D)*E+O,i[0][0])/E,B=Math.max(B,A)}if(l){let A=0;!c&&!d||d&&!c&&f?A=vn(x+I*E,l[1][0])/E:A=jn(x+(d?D:-D)*E,l[0][0])/E,B=Math.max(B,A)}}}D=D+(D<0?B:-B),C=C+(C<0?T:-T),o&&(f?_>I*E?D=(ol(c,d)?-C:C)/E:C=(ol(c,d)?-D:D)*E:h?(D=C/E,d=c):(C=D*E,c=d));const L=c?x+C:x,z=d?w+D:w;return{width:N+(c?-C:C),height:j+(d?-D:D),x:a[0]*C*(c?-1:1)+L,y:a[1]*D*(d?-1:1)+z}}const hd={width:0,height:0,x:0,y:0},sm={...hd,pointerX:0,pointerY:0,aspectRatio:1};function rm(e){return[[0,0],[e.measured.width,e.measured.height]]}function om(e,t,n){const s=t.position.x+e.position.x,o=t.position.y+e.position.y,a=e.measured.width??0,i=e.measured.height??0,l=n[0]*a,c=n[1]*i;return[[s-l,o-c],[s+a-l,o+i-c]]}function am({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:o}){const a=qt(e);let i={controlDirection:rl("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:u,resizeDirection:f,onResizeStart:m,onResize:g,onResizeEnd:y,shouldResize:k}){let v={...hd},b={...sm};i={boundaries:h,resizeDirection:f,keepAspectRatio:u,controlDirection:rl(d)};let x,w=null,N=[],j,E,C,D=!1;const _=Rc().on("start",I=>{const{nodeLookup:O,transform:q,snapGrid:T,snapToGrid:B,nodeOrigin:L,paneDomNode:z}=n();if(x=O.get(t),!x)return;w=z?.getBoundingClientRect()??null;const{xSnapped:R,ySnapped:A}=tr(I.sourceEvent,{transform:q,snapGrid:T,snapToGrid:B,containerBounds:w});v={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},b={...v,pointerX:R,pointerY:A,aspectRatio:v.width/v.height},j=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(j=O.get(x.parentId),E=j&&x.extent==="parent"?rm(j):void 0),N=[],C=void 0;for(const[$,F]of O)if(F.parentId===t&&(N.push({id:$,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const W=om(F,x,F.origin??L);C?C=[[Math.min(W[0][0],C[0][0]),Math.min(W[0][1],C[0][1])],[Math.max(W[1][0],C[1][0]),Math.max(W[1][1],C[1][1])]]:C=W}m?.(I,{...v})}).on("drag",I=>{const{transform:O,snapGrid:q,snapToGrid:T,nodeOrigin:B}=n(),L=tr(I.sourceEvent,{transform:O,snapGrid:q,snapToGrid:T,containerBounds:w}),z=[];if(!x)return;const{x:R,y:A,width:$,height:F}=v,W={},X=x.origin??B,{width:P,height:M,x:K,y:V}=nm(b,i.controlDirection,L,i.boundaries,i.keepAspectRatio,X,E,C),H=P!==$,Z=M!==F,ee=K!==R&&H,oe=V!==A&&Z;if(!ee&&!oe&&!H&&!Z)return;if((ee||oe||X[0]===1||X[1]===1)&&(W.x=ee?K:v.x,W.y=oe?V:v.y,v.x=W.x,v.y=W.y,N.length>0)){const ue=K-R,fe=V-A;for(const ge of N)ge.position={x:ge.position.x-ue+X[0]*(P-$),y:ge.position.y-fe+X[1]*(M-F)},z.push(ge)}if((H||Z)&&(W.width=H&&(!i.resizeDirection||i.resizeDirection==="horizontal")?P:v.width,W.height=Z&&(!i.resizeDirection||i.resizeDirection==="vertical")?M:v.height,v.width=W.width,v.height=W.height),j&&x.expandParent){const ue=X[0]*(W.width??0);W.x&&W.x<ue&&(v.x=ue,b.x=b.x-(W.x-ue));const fe=X[1]*(W.height??0);W.y&&W.y<fe&&(v.y=fe,b.y=b.y-(W.y-fe))}const de=tm({width:v.width,prevWidth:$,height:v.height,prevHeight:F,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),Q={...v,direction:de};k?.(I,Q)!==!1&&(D=!0,g?.(I,Q),s(W,z))}).on("end",I=>{D&&(y?.(I,{...v}),o?.({...v}),D=!1)});a.call(_)}function c(){a.on(".drag",null)}return{update:l,destroy:c}}var Zo={exports:{}},Qo={};var al;function im(){if(al)return Qo;al=1;var e=mf(),t=pf();function n(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var s=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,a=e.useRef,i=e.useEffect,l=e.useMemo,c=e.useDebugValue;return Qo.useSyncExternalStoreWithSelector=function(d,h,u,f,m){var g=a(null);if(g.current===null){var y={hasValue:!1,value:null};g.current=y}else y=g.current;g=l(function(){function v(j){if(!b){if(b=!0,x=j,j=f(j),m!==void 0&&y.hasValue){var E=y.value;if(m(E,j))return w=E}return w=j}if(E=w,s(x,j))return E;var C=f(j);return m!==void 0&&m(E,C)?(x=j,E):(x=j,w=C)}var b=!1,x,w,N=u===void 0?null:u;return[function(){return v(h())},N===null?void 0:function(){return v(N())}]},[h,u,f,m]);var k=o(d,g[0],g[1]);return i(function(){y.hasValue=!0,y.value=k},[k]),c(k),k},Qo}var il;function lm(){return il||(il=1,Zo.exports=im()),Zo.exports}var cm=lm();const dm=gf(cm),um={},ll=e=>{let t;const n=new Set,s=(h,u)=>{const f=typeof h=="function"?h(t):h;if(!Object.is(f,t)){const m=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,m))}},o=()=>t,c={setState:s,getState:o,getInitialState:()=>d,subscribe:h=>(n.add(h),()=>n.delete(h)),destroy:()=>{(um?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(s,o,c);return c},fm=e=>e?ll(e):ll,{useDebugValue:hm}=xf,{useSyncExternalStoreWithSelector:mm}=dm,pm=e=>e;function md(e,t=pm,n){const s=mm(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return hm(s),s}const cl=(e,t)=>{const n=fm(e),s=(o,a=t)=>md(n,o,a);return Object.assign(s,n),s},gm=(e,t)=>e?cl(e,t):cl;function ot(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,o]of e)if(!Object.is(o,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}const jo=p.createContext(null),xm=jo.Provider,pd=ln.error001();function Fe(e,t){const n=p.useContext(jo);if(n===null)throw new Error(pd);return md(n,e,t)}function rt(){const e=p.useContext(jo);if(e===null)throw new Error(pd);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const dl={display:"none"},bm={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},gd="react-flow__node-desc",xd="react-flow__edge-desc",ym="react-flow__aria-live",wm=e=>e.ariaLiveMessage,km=e=>e.ariaLabelConfig;function vm({rfId:e}){const t=Fe(wm);return r.jsx("div",{id:`${ym}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:bm,children:t})}function jm({rfId:e,disableKeyboardA11y:t}){const n=Fe(km);return r.jsxs(r.Fragment,{children:[r.jsx("div",{id:`${gd}-${e}`,style:dl,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),r.jsx("div",{id:`${xd}-${e}`,style:dl,children:n["edge.a11yDescription.default"]}),!t&&r.jsx(vm,{rfId:e})]})}const No=p.forwardRef(({position:e="top-left",children:t,className:n,style:s,...o},a)=>{const i=`${e}`.split("-");return r.jsx("div",{className:yt(["react-flow__panel",n,...i]),style:s,ref:a,...o,children:t})});No.displayName="Panel";function Nm({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:r.jsx(No,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:r.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Sm=e=>{const t=[],n=[];for(const[,s]of e.nodeLookup)s.selected&&t.push(s.internals.userNode);for(const[,s]of e.edgeLookup)s.selected&&n.push(s);return{selectedNodes:t,selectedEdges:n}},Wr=e=>e.id;function Cm(e,t){return ot(e.selectedNodes.map(Wr),t.selectedNodes.map(Wr))&&ot(e.selectedEdges.map(Wr),t.selectedEdges.map(Wr))}function Em({onSelectionChange:e}){const t=rt(),{selectedNodes:n,selectedEdges:s}=Fe(Sm,Cm);return p.useEffect(()=>{const o={nodes:n,edges:s};e?.(o),t.getState().onSelectionChangeHandlers.forEach(a=>a(o))},[n,s,e]),null}const Tm=e=>!!e.onSelectionChangeHandlers;function Im({onSelectionChange:e}){const t=Fe(Tm);return e||t?r.jsx(Em,{onSelectionChange:e}):null}const bd=[0,0],Mm={x:0,y:0,zoom:1},Am=["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"],ul=[...Am,"rfId"],Lm=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}),fl={translateExtent:ar,nodeOrigin:bd,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function _m(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:o,setTranslateExtent:a,setNodeExtent:i,reset:l,setDefaultNodesAndEdges:c}=Fe(Lm,ot),d=rt();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{h.current=fl,l()}),[]);const h=p.useRef(fl);return p.useEffect(()=>{for(const u of ul){const f=e[u],m=h.current[u];f!==m&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?s(f):u==="maxZoom"?o(f):u==="translateExtent"?a(f):u==="nodeExtent"?i(f):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:bh(f)}):u==="fitView"?d.setState({fitViewQueued:f}):u==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[u]:f})))}h.current=e},ul.map(u=>e[u])),null}function hl(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Rm(e){const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const s=hl(),o=()=>n(s?.matches?"dark":"light");return o(),s?.addEventListener("change",o),()=>{s?.removeEventListener("change",o)}},[e]),t!==null?t:hl()?.matches?"dark":"light"}const ml=typeof document<"u"?document:null;function dr(e=null,t={target:ml,actInsideInputWithModifier:!0}){const[n,s]=p.useState(!1),o=p.useRef(!1),a=p.useRef(new Set([])),[i,l]=p.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -1 +1 @@
1
- import{W as ln,X as an,Y as B,$ as q,a0 as Y,a1 as un,a2 as y,a3 as tn,a4 as G,a5 as _,a6 as rn,a7 as o,a8 as on,a9 as sn,aa as fn}from"./mermaid.core-B-JixiD0.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,$,a){var O=I-l,i=D-h,n=$-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 N(l,h,I,D,v,A,$){var a=l-I,O=h-D,i=($?A:-A)/G(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,j=(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)*G(on(0,T*T*R-P*P)),W=(P*g-m*S)/R,X=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=W-j,e=X-t,r=w-j,z=p-t;return x*x+e*e>r*r+z*z&&(W=w,X=p),{cx:W,cy:X,x01:-n,y01:-d,x11:W*(v/T-1),y11:X*(v/T-1)}}function hn(){var l=cn,h=yn,I=Y(0),D=null,v=gn,A=dn,$=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,j=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(j>tn-y)a.moveTo(s*B(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*B(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=j,S=j,W=$.apply(this,arguments)/2,X=W>y&&(D?+D.apply(this,arguments):G(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(X>y){var z=sn(X/u*q(W)),H=sn(X/s*q(W));(P-=z*2)>y?(z*=t?1:-1,R+=z,T-=z):(P=0,R=T=(f+c)/2),(S-=H*2)>y?(H*=t?1:-1,m+=H,g-=H):(S=0,m=g=(f+c)/2)}var C=s*B(m),F=s*q(m),J=u*B(T),K=u*q(T);if(w>y){var L=s*B(g),M=s*q(g),Q=u*B(R),U=u*q(R),E;if(j<an)if(E=pn(C,F,Q,U,L,M,J,K)){var V=C-E[0],Z=F-E[1],k=L-E[0],b=M-E[1],nn=1/q(fn((V*k+Z*b)/(G(V*V+Z*Z)*G(k*k+b*b)))/2),en=G(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=N(Q,U,C,F,s,x,t),r=N(L,M,J,K,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(C,F),a.arc(0,0,s,m,g,!t)):a.moveTo(C,F),!(u>y)||!(P>y)?a.lineTo(J,K):p>y?(e=N(J,K,L,M,u,-p,t),r=N(C,F,Q,U,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[B(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:Y(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:Y(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:Y(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:Y(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:Y(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:Y(+n),i):A},i.padAngle=function(n){return arguments.length?($=typeof n=="function"?n:Y(+n),i):$},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
1
+ import{W as ln,X as an,Y as B,$ as q,a0 as Y,a1 as un,a2 as y,a3 as tn,a4 as G,a5 as _,a6 as rn,a7 as o,a8 as on,a9 as sn,aa as fn}from"./mermaid.core-BFVdXW7F.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,$,a){var O=I-l,i=D-h,n=$-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 N(l,h,I,D,v,A,$){var a=l-I,O=h-D,i=($?A:-A)/G(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,j=(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)*G(on(0,T*T*R-P*P)),W=(P*g-m*S)/R,X=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=W-j,e=X-t,r=w-j,z=p-t;return x*x+e*e>r*r+z*z&&(W=w,X=p),{cx:W,cy:X,x01:-n,y01:-d,x11:W*(v/T-1),y11:X*(v/T-1)}}function hn(){var l=cn,h=yn,I=Y(0),D=null,v=gn,A=dn,$=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,j=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(j>tn-y)a.moveTo(s*B(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*B(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=j,S=j,W=$.apply(this,arguments)/2,X=W>y&&(D?+D.apply(this,arguments):G(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(X>y){var z=sn(X/u*q(W)),H=sn(X/s*q(W));(P-=z*2)>y?(z*=t?1:-1,R+=z,T-=z):(P=0,R=T=(f+c)/2),(S-=H*2)>y?(H*=t?1:-1,m+=H,g-=H):(S=0,m=g=(f+c)/2)}var C=s*B(m),F=s*q(m),J=u*B(T),K=u*q(T);if(w>y){var L=s*B(g),M=s*q(g),Q=u*B(R),U=u*q(R),E;if(j<an)if(E=pn(C,F,Q,U,L,M,J,K)){var V=C-E[0],Z=F-E[1],k=L-E[0],b=M-E[1],nn=1/q(fn((V*k+Z*b)/(G(V*V+Z*Z)*G(k*k+b*b)))/2),en=G(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=N(Q,U,C,F,s,x,t),r=N(L,M,J,K,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(C,F),a.arc(0,0,s,m,g,!t)):a.moveTo(C,F),!(u>y)||!(P>y)?a.lineTo(J,K):p>y?(e=N(J,K,L,M,u,-p,t),r=N(C,F,Q,U,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[B(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:Y(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:Y(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:Y(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:Y(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:Y(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:Y(+n),i):A},i.padAngle=function(n){return arguments.length?($=typeof n=="function"?n:Y(+n),i):$},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};