@markus-global/cli 0.12.3-rc.3 → 0.12.3

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 (65) hide show
  1. package/dist/web-ui/assets/{AsyncState-D2omBzdj.js → AsyncState-_UC7xcxJ.js} +1 -1
  2. package/dist/web-ui/assets/{ChatComponents-lSVBiM5B.js → ChatComponents-Ca9tWI9W.js} +1 -1
  3. package/dist/web-ui/assets/{ContentRenderer-DxgRNOd1.js → ContentRenderer-C-V5k_3K.js} +2 -2
  4. package/dist/web-ui/assets/{DeliverableShareModal-DU0PupsS.js → DeliverableShareModal-BvpyowYJ.js} +1 -1
  5. package/dist/web-ui/assets/{Deliverables-BYacAH8w.js → Deliverables-CQnWqbTb.js} +1 -1
  6. package/dist/web-ui/assets/{MarkdownMessage-DwxvYN4X.js → MarkdownMessage-DedA8Zob.js} +1 -1
  7. package/dist/web-ui/assets/{Search-jBc36ZOH.js → Search-CVYQIy_D.js} +1 -1
  8. package/dist/web-ui/assets/{SendToChat-13m2h7gu.js → SendToChat-IOAvuta-.js} +1 -1
  9. package/dist/web-ui/assets/{Settings-BkKMrBt2.js → Settings-BQDqf4q5.js} +1 -1
  10. package/dist/web-ui/assets/{Store-dLubNc0P.js → Store-BEsLd_RN.js} +1 -1
  11. package/dist/web-ui/assets/{Switch-CXRQn2gn.js → Switch-C6InTNUi.js} +1 -1
  12. package/dist/web-ui/assets/{Team-zVv87kaX.js → Team-nfNyWj-s.js} +4 -4
  13. package/dist/web-ui/assets/{Work-DbPgRas-.js → Work-BQvgkynj.js} +1 -1
  14. package/dist/web-ui/assets/{arc-C6rhmRdi.js → arc-DP1Vf7Sx.js} +1 -1
  15. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-BvaRSMDl.js → architectureDiagram-3BPJPVTR-Buq8JYN8.js} +1 -1
  16. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-DP7IwNLE.js → blockDiagram-GPEHLZMM-BCa2p2_X.js} +1 -1
  17. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-CEQJBqku.js → c4Diagram-AAUBKEIU-BxsgggQY.js} +1 -1
  18. package/dist/web-ui/assets/channel-BTSrOo6c.js +1 -0
  19. package/dist/web-ui/assets/{chunk-2J33WTMH-BtGwhrHv.js → chunk-2J33WTMH-BJZZ60c9.js} +1 -1
  20. package/dist/web-ui/assets/{chunk-4BX2VUAB-DNKfs4jy.js → chunk-4BX2VUAB-C5hc4E6J.js} +1 -1
  21. package/dist/web-ui/assets/{chunk-55IACEB6-Bd4eMlUg.js → chunk-55IACEB6-CbyvZ6Mk.js} +1 -1
  22. package/dist/web-ui/assets/{chunk-727SXJPM-CHmRT5rY.js → chunk-727SXJPM-JmNt9TVA.js} +1 -1
  23. package/dist/web-ui/assets/{chunk-AQP2D5EJ-CmoWgw5d.js → chunk-AQP2D5EJ-BTk0v5ba.js} +1 -1
  24. package/dist/web-ui/assets/{chunk-FMBD7UC4-Csafnaj6.js → chunk-FMBD7UC4-BO-dhB1U.js} +1 -1
  25. package/dist/web-ui/assets/{chunk-ND2GUHAM-Cip_3Llj.js → chunk-ND2GUHAM-BdjCcLdb.js} +1 -1
  26. package/dist/web-ui/assets/{chunk-QZHKN3VN-C0WlO578.js → chunk-QZHKN3VN-BAzRC82n.js} +1 -1
  27. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-BSYlcnF9.js +1 -0
  28. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-BSYlcnF9.js +1 -0
  29. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-ByhHiryW.js → cose-bilkent-S5V4N54A-CVffmErT.js} +1 -1
  30. package/dist/web-ui/assets/{dagre-BM42HDAG-B5-K3iqP.js → dagre-BM42HDAG-Dd9pB2fX.js} +1 -1
  31. package/dist/web-ui/assets/{diagram-2AECGRRQ-Ci16wMOI.js → diagram-2AECGRRQ-BG_AUqzM.js} +1 -1
  32. package/dist/web-ui/assets/{diagram-5GNKFQAL-Dfnzu_xA.js → diagram-5GNKFQAL-D5qFMRFf.js} +1 -1
  33. package/dist/web-ui/assets/{diagram-KO2AKTUF-K9NvC1S4.js → diagram-KO2AKTUF-B3qTxSWl.js} +1 -1
  34. package/dist/web-ui/assets/{diagram-LMA3HP47-CaKq8BY-.js → diagram-LMA3HP47-BrxC1636.js} +1 -1
  35. package/dist/web-ui/assets/{diagram-OG6HWLK6-DqY8Y9OR.js → diagram-OG6HWLK6-BvXyEQ9-.js} +1 -1
  36. package/dist/web-ui/assets/{docx-preview-DS9aOywt.js → docx-preview-DBAZFeEb.js} +1 -1
  37. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-iW17lrM1.js → erDiagram-TEJ5UH35-CMap9oy_.js} +1 -1
  38. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-BBkXZBPV.js → flowDiagram-I6XJVG4X-BZerJtvk.js} +1 -1
  39. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-J2QuVqg4.js → ganttDiagram-6RSMTGT7-CagPMHMO.js} +1 -1
  40. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-EhZa3sGY.js → gitGraphDiagram-PVQCEYII-DZ5dDKRu.js} +1 -1
  41. package/dist/web-ui/assets/{index-BHu6brRf.js → index-CKPQYzzR.js} +6 -6
  42. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-BaiNGDG7.js → infoDiagram-5YYISTIA-CHLdsDUZ.js} +1 -1
  43. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-BYN0gLmP.js → ishikawaDiagram-YF4QCWOH-SdeinQaS.js} +1 -1
  44. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-CKUGXjL8.js → journeyDiagram-JHISSGLW-BtlL2fi0.js} +1 -1
  45. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-iKb5H8rf.js → kanban-definition-UN3LZRKU-BKPQYXkB.js} +1 -1
  46. package/dist/web-ui/assets/{mermaid.core-BSghRCEC.js → mermaid.core-MkJR6w4B.js} +5 -5
  47. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-JjtDu_0Z.js → mindmap-definition-RKZ34NQL-CbOmHX_u.js} +1 -1
  48. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-BDXCI_g9.js → pieDiagram-4H26LBE5-CypGjJP1.js} +1 -1
  49. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-bATU3F6v.js → quadrantDiagram-W4KKPZXB-CGtemfUz.js} +1 -1
  50. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-BNJWpDxg.js → requirementDiagram-4Y6WPE33-N7YfpCvE.js} +1 -1
  51. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-C3B8NPUe.js → sankeyDiagram-5OEKKPKP-CYnSrei-.js} +1 -1
  52. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-DhGwy4UV.js → sequenceDiagram-3UESZ5HK-CsB7dCPF.js} +1 -1
  53. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-BtfcmNhI.js → stateDiagram-AJRCARHV-DTDFUXFP.js} +1 -1
  54. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-AVnDjlzF.js +1 -0
  55. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-BpY3qMyG.js → timeline-definition-PNZ67QCA-C_bWAN9B.js} +1 -1
  56. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-S0f15t2D.js → vennDiagram-CIIHVFJN-CX_qAuUT.js} +1 -1
  57. package/dist/web-ui/assets/{wardley-L42UT6IY-BdcJNPNt.js → wardley-L42UT6IY-q53jQ293.js} +1 -1
  58. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-mR-gwtcd.js → wardleyDiagram-YWT4CUSO-D34dKCJU.js} +1 -1
  59. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-Dq0PtvdL.js → xychartDiagram-2RQKCTM6-BFAngp66.js} +1 -1
  60. package/dist/web-ui/index.html +1 -1
  61. package/package.json +1 -1
  62. package/dist/web-ui/assets/channel-pUJ_pqAp.js +0 -1
  63. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-Cs9dF-hf.js +0 -1
  64. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-Cs9dF-hf.js +0 -1
  65. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-BOaSwLIS.js +0 -1
@@ -1,4 +1,4 @@
1
- import{u as He,j as r,b5 as Mf,b6 as Af,a1 as Lf,b7 as _f,r as p,k as te,aq as Rf,a as pr,a3 as Df,n as en,P as tt,b as Of,c as $f,Q as Pf,R as Xi,b8 as Bf,b9 as qf,U as $t,a_ as qt,ba as zr,W as Fr,X as zf,bb as Ra,l as Gn,i as Ff,a4 as bs,d as Hf,bc as Vf,bd as Wf,aP as Kf,be as Oc,bf as Uf,A as Da,aT as Oa,aU as Zi,Z as Yf,t as Gf}from"./index-BHu6brRf.js";import{S as $c,a as Pc,r as Bc,s as Xf}from"./SendToChat-13m2h7gu.js";import{L as Zf,P as Qf}from"./AsyncState-D2omBzdj.js";import{t as qc,Z as zc,_ as Qi,$ as Ji,a0 as Jf,a1 as eh,a2 as Fc,a3 as th,P as nh}from"./ChatComponents-lSVBiM5B.js";import{MarkdownMessage as or}from"./MarkdownMessage-DwxvYN4X.js";import{ContentRenderer as sh}from"./ContentRenderer-DxgRNOd1.js";import{s as zt,g as Hc,j as $a,T as Go,k as Xo,t as rh}from"./transform-BqqRT-Iy.js";import{i as Zo}from"./value-wA6veExk.js";import"./chatChips-DVIRVTpT.js";function oh(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Zt(e,t){if(e=oh(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 ah={passive:!1},ar={capture:!0,passive:!1};function Qo(e){e.stopImmediatePropagation()}function Ss(e){e.preventDefault(),e.stopImmediatePropagation()}function Vc(e){var t=e.document.documentElement,n=zt(e).on("dragstart.drag",Ss,ar);"onselectstart"in t?n.on("selectstart.drag",Ss,ar):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Wc(e,t){var n=e.document.documentElement,s=zt(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ss,ar),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 Hr=e=>()=>e;function xa(e,{sourceEvent:t,subject:n,target:s,identifier:o,active:a,x:i,y:l,dx:c,dy:d,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value: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:f}})}xa.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ih(e){return!e.ctrlKey&&!e.button}function lh(){return this.parentNode}function ch(e,t){return t??{x:e.x,y:e.y}}function dh(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kc(){var e=ih,t=lh,n=ch,s=dh,o={},a=Hc("start","drag","end"),i=0,l,c,d,f,u=0;function h(w){w.on("mousedown.drag",m).filter(s).on("touchstart.drag",k).on("touchmove.drag",v,ah).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,C){if(!(f||!e.call(this,w,C))){var j=x(this,t.call(this,w,C),w,C,"mouse");j&&(zt(w.view).on("mousemove.drag",g,ar).on("mouseup.drag",b,ar),Vc(w.view),Qo(w),d=!1,l=w.clientX,c=w.clientY,j("start",w))}}function g(w){if(Ss(w),!d){var C=w.clientX-l,j=w.clientY-c;d=C*C+j*j>u}o.mouse("drag",w)}function b(w){zt(w.view).on("mousemove.drag mouseup.drag",null),Wc(w.view,d),Ss(w),o.mouse("end",w)}function k(w,C){if(e.call(this,w,C)){var j=w.changedTouches,E=t.call(this,w,C),S=j.length,R,$;for(R=0;R<S;++R)($=x(this,E,w,C,j[R].identifier,j[R]))&&(Qo(w),$("start",w,j[R]))}}function v(w){var C=w.changedTouches,j=C.length,E,S;for(E=0;E<j;++E)(S=o[C[E].identifier])&&(Ss(w),S("drag",w,C[E]))}function y(w){var C=w.changedTouches,j=C.length,E,S;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),E=0;E<j;++E)(S=o[C[E].identifier])&&(Qo(w),S("end",w,C[E]))}function x(w,C,j,E,S,R){var $=a.copy(),M=Zt(R||j,C),D,z,I;if((I=n.call(w,new xa("beforestart",{sourceEvent:j,target:h,identifier:S,active:i,x:M[0],y:M[1],dx:0,dy:0,dispatch:$}),E))!=null)return D=I.x-M[0]||0,z=I.y-M[1]||0,function P(L,B,_){var q=M,H;switch(L){case"start":o[S]=P,H=i++;break;case"end":delete o[S],--i;case"drag":M=Zt(_||B,C),H=i;break}$.call(L,w,new xa(L,{sourceEvent:B,subject:I,target:h,identifier:S,active:H,x:M[0]+D,y:M[1]+z,dx:M[0]-q[0],dy:M[1]-q[1],dispatch:$}),E)}}return h.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Hr(!!w),h):e},h.container=function(w){return arguments.length?(t=typeof w=="function"?w:Hr(w),h):t},h.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Hr(w),h):n},h.touchable=function(w){return arguments.length?(s=typeof w=="function"?w:Hr(!!w),h):s},h.on=function(){var w=a.on.apply(a,arguments);return w===a?h:w},h.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,h):Math.sqrt(u)},h}var uh=1e-12;function el(e){return((e=Math.exp(e))+1/e)/2}function fh(e){return((e=Math.exp(e))-1/e)/2}function hh(e){return((e=Math.exp(2*e))-1)/(e+1)}const ao=(function e(t,n,s){function o(a,i){var l=a[0],c=a[1],d=a[2],f=i[0],u=i[1],h=i[2],m=f-l,g=u-c,b=m*m+g*g,k,v;if(b<uh)v=Math.log(h/d)/t,k=function(E){return[l+E*m,c+E*g,d*Math.exp(t*E*v)]};else{var y=Math.sqrt(b),x=(h*h-d*d+s*b)/(2*d*n*y),w=(h*h-d*d-s*b)/(2*h*n*y),C=Math.log(Math.sqrt(x*x+1)-x),j=Math.log(Math.sqrt(w*w+1)-w);v=(j-C)/t,k=function(E){var S=E*v,R=el(C),$=d/(n*y)*(R*hh(t*S+C)-fh(C));return[l+$*m,c+$*g,d*R/el(t*S+C)]}}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),Vr=e=>()=>e;function mh(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 Jo(e){e.stopImmediatePropagation()}function Qs(e){e.preventDefault(),e.stopImmediatePropagation()}function ph(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function gh(){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 tl(){return this.__zoom||$a}function xh(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bh(){return navigator.maxTouchPoints||"ontouchstart"in this}function yh(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 Uc(){var e=ph,t=gh,n=yh,s=xh,o=bh,a=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,c=ao,d=Hc("start","zoom","end"),f,u,h,m=500,g=150,b=0,k=10;function v(I){I.property("__zoom",tl).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",$).filter(o).on("touchstart.zoom",M).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(I,P,L,B){var _=I.selection?I.selection():I;_.property("__zoom",tl),I!==_?C(I,P,L,B):_.interrupt().each(function(){j(this,arguments).event(B).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},v.scaleBy=function(I,P,L,B){v.scaleTo(I,function(){var _=this.__zoom.k,q=typeof P=="function"?P.apply(this,arguments):P;return _*q},L,B)},v.scaleTo=function(I,P,L,B){v.transform(I,function(){var _=t.apply(this,arguments),q=this.__zoom,H=L==null?w(_):typeof L=="function"?L.apply(this,arguments):L,K=q.invert(H),O=typeof P=="function"?P.apply(this,arguments):P;return n(x(y(q,O),H,K),_,i)},L,B)},v.translateBy=function(I,P,L,B){v.transform(I,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),i)},null,B)},v.translateTo=function(I,P,L,B,_){v.transform(I,function(){var q=t.apply(this,arguments),H=this.__zoom,K=B==null?w(q):typeof B=="function"?B.apply(this,arguments):B;return n($a.translate(K[0],K[1]).scale(H.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof L=="function"?-L.apply(this,arguments):-L),q,i)},B,_)};function y(I,P){return P=Math.max(a[0],Math.min(a[1],P)),P===I.k?I:new Go(P,I.x,I.y)}function x(I,P,L){var B=P[0]-L[0]*I.k,_=P[1]-L[1]*I.k;return B===I.x&&_===I.y?I:new Go(I.k,B,_)}function w(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function C(I,P,L,B){I.on("start.zoom",function(){j(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(B).end()}).tween("zoom",function(){var _=this,q=arguments,H=j(_,q).event(B),K=t.apply(_,q),O=L==null?w(K):typeof L=="function"?L.apply(_,q):L,U=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),A=_.__zoom,T=typeof P=="function"?P.apply(_,q):P,V=c(A.invert(O).concat(U/A.k),T.invert(O).concat(U/T.k));return function(W){if(W===1)W=T;else{var F=V(W),Z=U/F[2];W=new Go(Z,O[0]-F[0]*Z,O[1]-F[1]*Z)}H.zoom(null,W)}})}function j(I,P,L){return!L&&I.__zooming||new E(I,P)}function E(I,P){this.that=I,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,P),this.taps=0}E.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,P){return this.mouse&&I!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var P=zt(this.that).datum();d.call(I,this.that,new mh(I,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:d}),P)}};function S(I,...P){if(!e.apply(this,arguments))return;var L=j(this,P).event(I),B=this.__zoom,_=Math.max(a[0],Math.min(a[1],B.k*Math.pow(2,s.apply(this,arguments)))),q=Zt(I);if(L.wheel)(L.mouse[0][0]!==q[0]||L.mouse[0][1]!==q[1])&&(L.mouse[1]=B.invert(L.mouse[0]=q)),clearTimeout(L.wheel);else{if(B.k===_)return;L.mouse=[q,B.invert(q)],Xo(this),L.start()}Qs(I),L.wheel=setTimeout(H,g),L.zoom("mouse",n(x(y(B,_),L.mouse[0],L.mouse[1]),L.extent,i));function H(){L.wheel=null,L.end()}}function R(I,...P){if(h||!e.apply(this,arguments))return;var L=I.currentTarget,B=j(this,P,!0).event(I),_=zt(I.view).on("mousemove.zoom",O,!0).on("mouseup.zoom",U,!0),q=Zt(I,L),H=I.clientX,K=I.clientY;Vc(I.view),Jo(I),B.mouse=[q,this.__zoom.invert(q)],Xo(this),B.start();function O(A){if(Qs(A),!B.moved){var T=A.clientX-H,V=A.clientY-K;B.moved=T*T+V*V>b}B.event(A).zoom("mouse",n(x(B.that.__zoom,B.mouse[0]=Zt(A,L),B.mouse[1]),B.extent,i))}function U(A){_.on("mousemove.zoom mouseup.zoom",null),Wc(A.view,B.moved),Qs(A),B.event(A).end()}}function $(I,...P){if(e.apply(this,arguments)){var L=this.__zoom,B=Zt(I.changedTouches?I.changedTouches[0]:I,this),_=L.invert(B),q=L.k*(I.shiftKey?.5:2),H=n(x(y(L,q),B,_),t.apply(this,P),i);Qs(I),l>0?zt(this).transition().duration(l).call(C,H,B,I):zt(this).call(v.transform,H,B,I)}}function M(I,...P){if(e.apply(this,arguments)){var L=I.touches,B=L.length,_=j(this,P,I.changedTouches.length===B).event(I),q,H,K,O;for(Jo(I),H=0;H<B;++H)K=L[H],O=Zt(K,this),O=[O,this.__zoom.invert(O),K.identifier],_.touch0?!_.touch1&&_.touch0[2]!==O[2]&&(_.touch1=O,_.taps=0):(_.touch0=O,q=!0,_.taps=1+!!f);f&&(f=clearTimeout(f)),q&&(_.taps<2&&(u=O[0],f=setTimeout(function(){f=null},m)),Xo(this),_.start())}}function D(I,...P){if(this.__zooming){var L=j(this,P).event(I),B=I.changedTouches,_=B.length,q,H,K,O;for(Qs(I),q=0;q<_;++q)H=B[q],K=Zt(H,this),L.touch0&&L.touch0[2]===H.identifier?L.touch0[0]=K:L.touch1&&L.touch1[2]===H.identifier&&(L.touch1[0]=K);if(H=L.that.__zoom,L.touch1){var U=L.touch0[0],A=L.touch0[1],T=L.touch1[0],V=L.touch1[1],W=(W=T[0]-U[0])*W+(W=T[1]-U[1])*W,F=(F=V[0]-A[0])*F+(F=V[1]-A[1])*F;H=y(H,Math.sqrt(W/F)),K=[(U[0]+T[0])/2,(U[1]+T[1])/2],O=[(A[0]+V[0])/2,(A[1]+V[1])/2]}else if(L.touch0)K=L.touch0[0],O=L.touch0[1];else return;L.zoom("touch",n(x(H,K,O),L.extent,i))}}function z(I,...P){if(this.__zooming){var L=j(this,P).event(I),B=I.changedTouches,_=B.length,q,H;for(Jo(I),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),q=0;q<_;++q)H=B[q],L.touch0&&L.touch0[2]===H.identifier?delete L.touch0:L.touch1&&L.touch1[2]===H.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&&(H=Zt(H,this),Math.hypot(u[0]-H[0],u[1]-H[1])<k)){var K=zt(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return v.wheelDelta=function(I){return arguments.length?(s=typeof I=="function"?I:Vr(+I),v):s},v.filter=function(I){return arguments.length?(e=typeof I=="function"?I:Vr(!!I),v):e},v.touchable=function(I){return arguments.length?(o=typeof I=="function"?I:Vr(!!I),v):o},v.extent=function(I){return arguments.length?(t=typeof I=="function"?I:Vr([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),v):t},v.scaleExtent=function(I){return arguments.length?(a[0]=+I[0],a[1]=+I[1],v):[a[0],a[1]]},v.translateExtent=function(I){return arguments.length?(i[0][0]=+I[0][0],i[1][0]=+I[1][0],i[0][1]=+I[0][1],i[1][1]=+I[1][1],v):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},v.constrain=function(I){return arguments.length?(n=I,v):n},v.duration=function(I){return arguments.length?(l=+I,v):l},v.interpolate=function(I){return arguments.length?(c=I,v):c},v.on=function(){var I=d.on.apply(d,arguments);return I===d?v:I},v.clickDistance=function(I){return arguments.length?(b=(I=+I)*I,v):Math.sqrt(b)},v.tapDistance=function(I){return arguments.length?(k=+I,v):k},v}const Yc=new Set(["completed","failed","rejected","cancelled","archived"]);function ir(e){return!!e&&Yc.has(e)}const Gc=new Set(["completed","rejected","cancelled","archived"]);function wh(e,t={}){const n=[];for(let s=0;s<e.length;s++){const o=e[s];if(o.toStatus!=="review")continue;const a=e[s+1],i=!a,l=`review:${o.id}`,c=t.reviewerId??o.changedById??"",d=t.reviewerName??void 0??o.changedByName??void 0??(o.changedById?t.reviewerNameOf?.(o.changedById):void 0)??c??"reviewer";n.push({id:l,reviewerId:c,reviewerName:d,status:i?"reviewing":"completed",queuedAt:o.createdAt,completedAt:a?a.createdAt:null,round:n.length+1,outcome:a?kh(a.toStatus):null,decidedByName:a?a.changedByName??null:null,note:a?a.reason??null:null})}return n}function kh(e){return e==="completed"?"approved":e==="in_progress"?"revision_requested":"closed"}function nl(e){return e.find(t=>t.status==="reviewing")??null}function vh(e){return e.some(t=>t.status==="reviewing")}function Wr(e){return e?new Date(e).getTime():Number.NaN}function jh(e,t,n="all"){const s=[];if(n!=="review")for(const o of e){const a=o.firstAt??"";Number.isNaN(Wr(a))||s.push({kind:"execution",key:`exec:${o.round}`,round:o.round,startedAt:a,endedAt:o.lastAt??null,toolCount:o.toolCount??0,logCount:o.logCount??0,status:o.status??""})}if(n!=="execution")for(const o of t)Number.isNaN(Wr(o.queuedAt))||s.push({kind:"review",key:o.id,round:o.round,startedAt:o.queuedAt,endedAt:o.completedAt,session:o});return s.sort((o,a)=>{const i=Wr(o.startedAt)-Wr(a.startedAt);return i!==0?i:o.kind!==a.kind?o.kind==="execution"?-1:1:o.round-a.round})}const sl=6e4,Nh=/^(Reviewing task from\b|Task Review$)/;function Sh(e){const t=(e.label??"").trim();return t?Nh.test(t):!1}function Xc(e,t){const n=new Date(e).getTime();if(Number.isNaN(n))return!1;const s=new Date(t.queuedAt).getTime();if(Number.isNaN(s))return!1;const o=t.completedAt?new Date(t.completedAt).getTime():Number.POSITIVE_INFINITY;return Number.isNaN(o)?!1:n>=s-sl&&n<=o+sl}function Ch(e,t){const n=new Date(t.queuedAt).getTime(),s=t.completedAt?new Date(t.completedAt).getTime():Number.POSITIVE_INFINITY;return Number.isNaN(n)||Number.isNaN(s)?[]:e.filter(o=>!Sh(o)||o.taskId&&o.taskId!==t.taskId?!1:Xc(o.startedAt,t)).sort((o,a)=>new Date(o.startedAt).getTime()-new Date(a.startedAt).getTime())}const Eh=["30m","1h","2h","4h","8h","12h","1d","1w"],Ih={"30m":"freq30m","1h":"freq1h","2h":"freq2h","4h":"freq4h","8h":"freq8h","12h":"freq12h","1d":"freq1d","1w":"freq1w"};function rl(e){return Ih[e]??"freq4h"}function Th(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function ba(){return{mode:"calendar",every:"4h",calendar:"daily",weekdays:[1,2,3,4,5],time:"09:00",cron:"",maxRuns:"",timezone:Th()}}function Zc(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 Mh(e){const[t,n]=Zc(e);return`${String(t).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function Ah(e,t,n){if(e==="cron")return"";const[s,o]=Zc(n),a=e==="daily"?"*":e==="weekdays"?"1-5":t.length>0?[...t].sort((i,l)=>i-l).join(","):"*";return`${o} ${s} * * ${a}`}function Lh(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 _h(e){const t=ba();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=Lh(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 Qc(e){const t={};e.mode==="interval"?t.every=e.every||"4h":(t.cron=e.calendar==="cron"?e.cron.trim():Ah(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 Rh=[1,2,3,4,5,6,0];function Dh({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-on-brand":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:a.label},a.value))})}function Jc({value:e,onChange:t,compact:n=!1}){const{t:s}=He(),o=f=>t({...e,...f}),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=f=>{const h=e.weekdays.includes(f)?e.weekdays.filter(m=>m!==f):[...e.weekdays,f];o({weekdays:h})};let l;if(e.mode==="interval")l=s(`work:task.${rl(e.every)}`);else if(e.calendar==="cron")l=s("work:task.scheduleCron",{expr:e.cron.trim()||"—"});else{const f=Mh(e.time);if(e.calendar==="daily")l=s("work:task.scheduleDailyAt",{time:f});else if(e.calendar==="weekdays")l=s("work:task.scheduleWeekdaysAt",{time:f});else{const u=[...e.weekdays].sort((h,m)=>h-m).map(h=>s(`work:task.weekdayShort.${h}`)).join(" ");l=e.weekdays.length?s("work:task.scheduleWeeklyAt",{days:u,time:f}):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(Dh,{size:n?"sm":"md",value:e.mode,onChange:f=>o({mode:f}),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:f=>o({every:f.target.value}),className:a,children:Eh.map(f=>r.jsx("option",{value:f,children:s(`work:task.${rl(f)}`)},f))})]}):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:f=>o({calendar:f.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:f=>o({time:f.target.value}),className:a})]}),e.calendar==="weekly"&&r.jsx("div",{className:"flex flex-wrap gap-1 pl-[5.5rem]",children:Rh.map(f=>{const u=e.weekdays.includes(f);return r.jsx("button",{type:"button",onClick:()=>i(f),className:`w-7 h-7 rounded-full text-xs transition-colors ${u?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary border border-border-default hover:text-fg-primary"}`,children:s(`work:task.weekdayShort.${f}`)},f)})}),e.calendar==="cron"&&r.jsx("input",{value:e.cron,onChange:f=>o({cron:f.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:f=>o({maxRuns:f.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 Nt(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=Nt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const an={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."},lr=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ed=["Enter"," ","Escape"],td={"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 Is;(function(e){e.Strict="strict",e.Loose="loose"})(Is||(Is={}));var Jn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Jn||(Jn={}));var cr;(function(e){e.Partial="partial",e.Full="full"})(cr||(cr={}));const nd={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Tn;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Tn||(Tn={}));var Ts;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ts||(Ts={}));var we;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(we||(we={}));const ol={[we.Left]:we.Right,[we.Right]:we.Left,[we.Top]:we.Bottom,[we.Bottom]:we.Top};function sd(e){return e===null?null:e?"valid":"invalid"}const rd=e=>"id"in e&&"source"in e&&"target"in e,Oh=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Pa=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),gr=(e,t=[0,0])=>{const{width:n,height:s}=yn(e),o=e.origin??t,a=n*o[0],i=s*o[1];return{x:e.position.x-a,y:e.position.y-i}},$h=(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):Pa(o)?o:t.nodeLookup.get(o.id));const l=i?mo(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return So(s,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Co(n)},xr=(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=So(n,mo(o)),s=!0)}),s?Co(n):{x:0,y:0,width:0,height:0}},Ba=(e,t,[n,s,o]=[0,0,1],a=!1,i=!1)=>{const l={...yr(t,[n,s,o]),width:t.width/o,height:t.height/o},c=[];for(const d of e.values()){const{measured:f,selectable:u=!0,hidden:h=!1}=d;if(i&&!u||h)continue;const m=f.width??d.width??d.initialWidth??null,g=f.height??d.height??d.initialHeight??null,b=dr(l,As(d)),k=(m??0)*(g??0),v=a&&b>0;(!d.internals.handleBounds||v||b>=k||d.dragging)&&c.push(d)}return c},Ph=(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 Bh(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 qh({nodes:e,width:t,height:n,panZoom:s,minZoom:o,maxZoom:a},i){if(e.size===0)return Promise.resolve(!0);const l=Bh(e,i),c=xr(l),d=qa(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 od({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},f=i.origin??s;let u=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!l)a?.("005",an.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(u=[[c,d],[c+m,d+g]])}else l&&Ls(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+d],[i.extent[1][0]+c,i.extent[1][1]+d]]);const h=Ls(u)?es(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&a?.("015",an.error015()),{position:{x:h.x-c+(i.measured.width??0)*f[0],y:h.y-d+(i.measured.height??0)*f[1]},positionAbsolute:h}}async function zh({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:o}){const a=new Set(e.map(h=>h.id)),i=[];for(const h of n){if(h.deletable===!1)continue;const m=a.has(h.id),g=!m&&h.parentId&&i.find(b=>b.id===h.parentId);(m||g)&&i.push(h)}const l=new Set(t.map(h=>h.id)),c=s.filter(h=>h.deletable!==!1),f=Ph(i,c);for(const h of c)l.has(h.id)&&!f.find(g=>g.id===h.id)&&f.push(h);if(!o)return{edges:f,nodes:i};const u=await o({nodes:i,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:i}:{edges:[],nodes:[]}:u}const Ms=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),es=(e={x:0,y:0},t,n)=>({x:Ms(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Ms(e.y,t[0][1],t[1][1]-(n?.height??0))});function ad(e,t,n){const{width:s,height:o}=yn(n),{x:a,y:i}=n.internals.positionAbsolute;return es(e,[[a,i],[a+s,i+o]],t)}const al=(e,t,n)=>e<t?Ms(Math.abs(e-t),1,t)/t:e>n?-Ms(Math.abs(e-n),1,t)/t:0,id=(e,t,n=15,s=40)=>{const o=al(e.x,s,t.width-s)*n,a=al(e.y,s,t.height-s)*n;return[o,a]},So=(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)}),ya=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),Co=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),As=(e,t=[0,0])=>{const{x:n,y:s}=Pa(e)?e.internals.positionAbsolute:gr(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}},mo=(e,t=[0,0])=>{const{x:n,y:s}=Pa(e)?e.internals.positionAbsolute:gr(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)}},ld=(e,t)=>Co(So(ya(e),ya(t))),dr=(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)},il=e=>Qt(e.width)&&Qt(e.height)&&Qt(e.x)&&Qt(e.y),Qt=e=>!isNaN(e)&&isFinite(e),Fh=(e,t)=>{},br=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yr=({x:e,y:t},[n,s,o],a=!1,i=[1,1])=>{const l={x:(e-n)/o,y:(t-s)/o};return a?br(l,i):l},po=({x:e,y:t},[n,s,o])=>({x:e*o+n,y:t*o+s});function ps(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 Hh(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=ps(e,n),o=ps(e,t);return{top:s,right:o,bottom:s,left:o,x:o*2,y:s*2}}if(typeof e=="object"){const s=ps(e.top??e.y??0,n),o=ps(e.bottom??e.y??0,n),a=ps(e.left??e.x??0,t),i=ps(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 Vh(e,t,n,s,o,a){const{x:i,y:l}=po(e,[t,n,s]),{x:c,y:d}=po({x:e.x+e.width,y:e.y+e.height},[t,n,s]),f=o-c,u=a-d;return{left:Math.floor(i),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(u)}}const qa=(e,t,n,s,o,a)=>{const i=Hh(a,t,n),l=(t-i.x)/e.width,c=(n-i.y)/e.height,d=Math.min(l,c),f=Ms(d,s,o),u=e.x+e.width/2,h=e.y+e.height/2,m=t/2-u*f,g=n/2-h*f,b=Vh(e,m,g,f,t,n),k={left:Math.min(b.left-i.left,0),top:Math.min(b.top-i.top,0),right:Math.min(b.right-i.right,0),bottom:Math.min(b.bottom-i.bottom,0)};return{x:m-k.left+k.right,y:g-k.top+k.bottom,zoom:f}},ur=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ls(e){return e!=null&&e!=="parent"}function yn(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function cd(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function dd(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 ll(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Wh(){let e,t;return{promise:new Promise((s,o)=>{e=s,t=o}),resolve:e,reject:t}}function Kh(e){return{...td,...e||{}}}function nr(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:o}){const{x:a,y:i}=Jt(e),l=yr({x:a-(o?.left??0),y:i-(o?.top??0)},s),{x:c,y:d}=n?br(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const za=e=>({width:e.offsetWidth,height:e.offsetHeight}),ud=e=>e?.getRootNode?.()||window?.document,Uh=["INPUT","SELECT","TEXTAREA"];function fd(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Uh.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const hd=e=>"clientX"in e,Jt=(e,t)=>{const n=hd(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)}},cl=(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,...za(i)}})};function md({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,f=Math.abs(c-e),u=Math.abs(d-t);return[c,d,f,u]}function Kr(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function dl({pos:e,x1:t,y1:n,x2:s,y2:o,c:a}){switch(e){case we.Left:return[t-Kr(t-s,a),n];case we.Right:return[t+Kr(s-t,a),n];case we.Top:return[t,n-Kr(n-o,a)];case we.Bottom:return[t,n+Kr(o-n,a)]}}function pd({sourceX:e,sourceY:t,sourcePosition:n=we.Bottom,targetX:s,targetY:o,targetPosition:a=we.Top,curvature:i=.25}){const[l,c]=dl({pos:n,x1:e,y1:t,x2:s,y2:o,c:i}),[d,f]=dl({pos:a,x1:s,y1:o,x2:e,y2:t,c:i}),[u,h,m,g]=md({sourceX:e,sourceY:t,targetX:s,targetY:o,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${c} ${d},${f} ${s},${o}`,u,h,m,g]}function gd({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 Yh({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 Gh({sourceNode:e,targetNode:t,width:n,height:s,transform:o}){const a=So(mo(e),mo(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 dr(i,Co(a))>0}const Xh=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,Zh=(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)),Qh=(e,t,n={})=>{if(!e.source||!e.target)return t;const s=n.getEdgeId||Xh;let o;return rd(e)?o={...e}:o={...e,id:s(e)},Zh(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function xd({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[o,a,i,l]=gd({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,o,a,i,l]}const ul={[we.Left]:{x:-1,y:0},[we.Right]:{x:1,y:0},[we.Top]:{x:0,y:-1},[we.Bottom]:{x:0,y:1}},Jh=({source:e,sourcePosition:t=we.Bottom,target:n})=>t===we.Left||t===we.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},fl=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function em({source:e,sourcePosition:t=we.Bottom,target:n,targetPosition:s=we.Top,center:o,offset:a,stepPosition:i}){const l=ul[t],c=ul[s],d={x:e.x+l.x*a,y:e.y+l.y*a},f={x:n.x+c.x*a,y:n.y+c.y*a},u=Jh({source:d,sourcePosition:t,target:f}),h=u.x!==0?"x":"y",m=u[h];let g=[],b,k;const v={x:0,y:0},y={x:0,y:0},[,,x,w]=gd({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(b=o.x??d.x+(f.x-d.x)*i,k=o.y??(d.y+f.y)/2):(b=o.x??(d.x+f.x)/2,k=o.y??d.y+(f.y-d.y)*i);const j=[{x:b,y:d.y},{x:b,y:f.y}],E=[{x:d.x,y:k},{x:f.x,y:k}];l[h]===m?g=h==="x"?j:E:g=h==="x"?E:j}else{const j=[{x:d.x,y:f.y}],E=[{x:f.x,y:d.y}];if(h==="x"?g=l.x===m?E:j:g=l.y===m?j:E,t===s){const D=Math.abs(e[h]-n[h]);if(D<=a){const z=Math.min(a-1,a-D);l[h]===m?v[h]=(d[h]>e[h]?-1:1)*z:y[h]=(f[h]>n[h]?-1:1)*z}}if(t!==s){const D=h==="x"?"y":"x",z=l[h]===c[D],I=d[D]>f[D],P=d[D]<f[D];(l[h]===1&&(!z&&I||z&&P)||l[h]!==1&&(!z&&P||z&&I))&&(g=h==="x"?j:E)}const S={x:d.x+v.x,y:d.y+v.y},R={x:f.x+y.x,y:f.y+y.y},$=Math.max(Math.abs(S.x-g[0].x),Math.abs(R.x-g[0].x)),M=Math.max(Math.abs(S.y-g[0].y),Math.abs(R.y-g[0].y));$>=M?(b=(S.x+R.x)/2,k=g[0].y):(b=g[0].x,k=(S.y+R.y)/2)}return[[e,{x:d.x+v.x,y:d.y+v.y},...g,{x:f.x+y.x,y:f.y+y.y},n],b,k,x,w]}function tm(e,t,n,s){const o=Math.min(fl(e,t)/2,fl(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,f=e.y<n.y?1:-1;return`L ${a+o*d},${i}Q ${a},${i} ${a},${i+o*f}`}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 wa({sourceX:e,sourceY:t,sourcePosition:n=we.Bottom,targetX:s,targetY:o,targetPosition:a=we.Top,borderRadius:i=5,centerX:l,centerY:c,offset:d=20,stepPosition:f=.5}){const[u,h,m,g,b]=em({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:o},targetPosition:a,center:{x:l,y:c},offset:d,stepPosition:f});return[u.reduce((v,y,x)=>{let w="";return x>0&&x<u.length-1?w=tm(u[x-1],y,u[x+1],i):w=`${x===0?"M":"L"}${y.x} ${y.y}`,v+=w,v},""),h,m,g,b]}function hl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function nm(e){const{sourceNode:t,targetNode:n}=e;if(!hl(t)||!hl(n))return null;const s=t.internals.handleBounds||ml(t.handles),o=n.internals.handleBounds||ml(n.handles),a=pl(s?.source??[],e.sourceHandle),i=pl(e.connectionMode===Is.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!a||!i)return e.onError?.("008",an.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=a?.position||we.Bottom,c=i?.position||we.Top,d=ts(t,a,l),f=ts(n,i,c);return{sourceX:d.x,sourceY:d.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}function ml(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 ts(e,t,n=we.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??yn(e);if(s)return{x:o+i/2,y:a+l/2};switch(t?.position??n){case we.Top:return{x:o+i/2,y:a};case we.Right:return{x:o+i,y:a+l/2};case we.Bottom:return{x:o+i/2,y:a+l};case we.Left:return{x:o,y:a+l/2}}}function pl(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function ka(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function sm(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=ka(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 bd=1e3,rm=10,Fa={nodeOrigin:[0,0],nodeExtent:lr,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},om={...Fa,checkEquality:!0};function Ha(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function am(e,t,n){const s=Ha(Fa,n);for(const o of e.values())if(o.parentId)Wa(o,e,t,s);else{const a=gr(o,s.nodeOrigin),i=Ls(o.extent)?o.extent:s.nodeExtent,l=es(a,i,yn(o));o.internals.positionAbsolute=l}}function im(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 Va(e){return e==="manual"}function va(e,t,n,s={}){const o=Ha(om,s),a={i:0},i=new Map(t),l=o?.elevateNodesOnSelect&&!Va(o.zIndexMode)?bd:0;let c=e.length>0;t.clear(),n.clear();for(const d of e){let f=i.get(d.id);if(o.checkEquality&&d===f?.internals.userNode)t.set(d.id,f);else{const u=gr(d,o.nodeOrigin),h=Ls(d.extent)?d.extent:o.nodeExtent,m=es(u,h,yn(d));f={...o.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:m,handleBounds:im(d,f),z:yd(d,l,o.zIndexMode),userNode:d}},t.set(d.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),d.parentId&&Wa(f,t,n,s,a)}return c}function lm(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 Wa(e,t,n,s,o){const{elevateNodesOnSelect:a,nodeOrigin:i,nodeExtent:l,zIndexMode:c}=Ha(Fa,s),d=e.parentId,f=t.get(d);if(!f){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}lm(e,n),o&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++o.i,f.internals.z=f.internals.z+o.i*rm),o&&f.internals.rootParentIndex!==void 0&&(o.i=f.internals.rootParentIndex);const u=a&&!Va(c)?bd:0,{x:h,y:m,z:g}=cm(e,f,i,l,u,c),{positionAbsolute:b}=e.internals,k=h!==b.x||m!==b.y;(k||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:h,y:m}:b,z:g}})}function yd(e,t,n){const s=Qt(e.zIndex)?e.zIndex:0;return Va(n)?s:s+(e.selected?t:0)}function cm(e,t,n,s,o,a){const{x:i,y:l}=t.internals.positionAbsolute,c=yn(e),d=gr(e,n),f=Ls(e.extent)?es(d,e.extent,c):d;let u=es({x:i+f.x,y:l+f.y},s,c);e.extent==="parent"&&(u=ad(u,c,t));const h=yd(e,o,a),m=t.internals.z??0;return{x:u.x,y:u.y,z:m>=h?m+1:h}}function Ka(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??As(l),d=ld(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,f=yn(l),u=l.origin??s,h=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(f.width,Math.round(i.width)),b=Math.max(f.height,Math.round(i.height)),k=(g-f.width)*u[0],v=(b-f.height)*u[1];(h>0||m>0||k||v)&&(o.push({id:c,type:"position",position:{x:l.position.x-h+k,y:l.position.y-m+v}}),n.get(c)?.forEach(y=>{e.some(x=>x.id===y.id)||o.push({id:y.id,type:"position",position:{x:y.position.x+h,y:y.position.y+m}})})),(f.width<i.width||f.height<i.height||h||m)&&o.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(h?u[0]*h-k:0),height:b+(m?u[1]*m-v:0)}})}),o}function dm(e,t,n,s,o,a,i){const l=s?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],f=window.getComputedStyle(l),{m22:u}=new window.DOMMatrixReadOnly(f.transform),h=[];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 b=za(m.nodeElement),k=g.measured.width!==b.width||g.measured.height!==b.height;if(!!(b.width&&b.height&&(k||!g.internals.handleBounds||m.force))){const y=m.nodeElement.getBoundingClientRect(),x=Ls(g.extent)?g.extent:a;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=ad(w,b,t.get(g.parentId)):x&&(w=es(w,x,b));const C={...g,measured:b,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:cl("source",m.nodeElement,y,u,g.id),target:cl("target",m.nodeElement,y,u,g.id)}}};t.set(g.id,C),g.parentId&&Wa(C,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,k&&(d.push({id:g.id,type:"dimensions",dimensions:b}),g.expandParent&&g.parentId&&h.push({id:g.id,parentId:g.parentId,rect:As(C,o)}))}}if(h.length>0){const m=Ka(h,t,n,o);d.push(...m)}return{changes:d,updatedInternals:c}}async function um({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 gl(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 wd(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}`,f=`${a}-${l}--${o}-${i}`;gl("source",c,f,e,o,i),gl("target",c,d,e,a,l),t.set(s.id,s)}}function kd(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:kd(n,t):!1}function xl(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 fm(e,t,n,s){const o=new Map;for(const[a,i]of e)if((i.selected||i.id===s)&&(!i.parentId||!kd(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 ea({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 hm({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=br(a,t);return{x:i.x-a.x,y:i.y-a.y}}function mm({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},f=null,u=!1,h=null,m=!1,g=!1,b=null;function k({noDragClassName:y,handleSelector:x,domNode:w,isSelectable:C,nodeId:j,nodeClickDistance:E=0}){h=zt(w);function S({x:D,y:z}){const{nodeLookup:I,nodeExtent:P,snapGrid:L,snapToGrid:B,nodeOrigin:_,onNodeDrag:q,onSelectionDrag:H,onError:K,updateNodePositions:O}=t();a={x:D,y:z};let U=!1;const A=l.size>1,T=A&&P?ya(xr(l)):null,V=A&&B?hm({dragItems:l,snapGrid:L,x:D,y:z}):null;for(const[W,F]of l){if(!I.has(W))continue;let Z={x:D-F.distance.x,y:z-F.distance.y};B&&(Z=V?{x:Math.round(Z.x+V.x),y:Math.round(Z.y+V.y)}:br(Z,L));let se=null;if(A&&P&&!F.extent&&T){const{positionAbsolute:pe}=F.internals,je=pe.x-T.x+P[0][0],Se=pe.x+F.measured.width-T.x2+P[1][0],Ne=pe.y-T.y+P[0][1],Be=pe.y+F.measured.height-T.y2+P[1][1];se=[[je,Ne],[Se,Be]]}const{position:ue,positionAbsolute:ie}=od({nodeId:W,nextPosition:Z,nodeLookup:I,nodeExtent:se||P,nodeOrigin:_,onError:K});U=U||F.position.x!==ue.x||F.position.y!==ue.y,F.position=ue,F.internals.positionAbsolute=ie}if(g=g||U,!!U&&(O(l,!0),b&&(s||q||!j&&H))){const[W,F]=ea({nodeId:j,dragItems:l,nodeLookup:I});s?.(b,l,W,F),q?.(b,W,F),j||H?.(b,F)}}async function R(){if(!f)return;const{transform:D,panBy:z,autoPanSpeed:I,autoPanOnNodeDrag:P}=t();if(!P){c=!1,cancelAnimationFrame(i);return}const[L,B]=id(d,f,I);(L!==0||B!==0)&&(a.x=(a.x??0)-L/D[2],a.y=(a.y??0)-B/D[2],await z({x:L,y:B})&&S(a)),i=requestAnimationFrame(R)}function $(D){const{nodeLookup:z,multiSelectionActive:I,nodesDraggable:P,transform:L,snapGrid:B,snapToGrid:_,selectNodesOnDrag:q,onNodeDragStart:H,onSelectionDragStart:K,unselectNodesAndEdges:O}=t();u=!0,(!q||!C)&&!I&&j&&(z.get(j)?.selected||O()),C&&q&&j&&e?.(j);const U=nr(D.sourceEvent,{transform:L,snapGrid:B,snapToGrid:_,containerBounds:f});if(a=U,l=fm(z,P,U,j),l.size>0&&(n||H||!j&&K)){const[A,T]=ea({nodeId:j,dragItems:l,nodeLookup:z});n?.(D.sourceEvent,l,A,T),H?.(D.sourceEvent,A,T),j||K?.(D.sourceEvent,T)}}const M=Kc().clickDistance(E).on("start",D=>{const{domNode:z,nodeDragThreshold:I,transform:P,snapGrid:L,snapToGrid:B}=t();f=z?.getBoundingClientRect()||null,m=!1,g=!1,b=D.sourceEvent,I===0&&$(D),a=nr(D.sourceEvent,{transform:P,snapGrid:L,snapToGrid:B,containerBounds:f}),d=Jt(D.sourceEvent,f)}).on("drag",D=>{const{autoPanOnNodeDrag:z,transform:I,snapGrid:P,snapToGrid:L,nodeDragThreshold:B,nodeLookup:_}=t(),q=nr(D.sourceEvent,{transform:I,snapGrid:P,snapToGrid:L,containerBounds:f});if(b=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||j&&!_.has(j))&&(m=!0),!m){if(!c&&z&&u&&(c=!0,R()),!u){const H=Jt(D.sourceEvent,f),K=H.x-d.x,O=H.y-d.y;Math.sqrt(K*K+O*O)>B&&$(D)}(a.x!==q.xSnapped||a.y!==q.ySnapped)&&l&&u&&(d=Jt(D.sourceEvent,f),S(q))}}).on("end",D=>{if(!(!u||m)&&(c=!1,u=!1,cancelAnimationFrame(i),l.size>0)){const{nodeLookup:z,updateNodePositions:I,onNodeDragStop:P,onSelectionDragStop:L}=t();if(g&&(I(l,!1),g=!1),o||P||!j&&L){const[B,_]=ea({nodeId:j,dragItems:l,nodeLookup:z,dragging:!1});o?.(D.sourceEvent,l,B,_),P?.(D.sourceEvent,B,_),j||L?.(D.sourceEvent,_)}}}).filter(D=>{const z=D.target;return!D.button&&(!y||!xl(z,`.${y}`,w))&&(!x||xl(z,x,w))});h.call(M)}function v(){h?.on(".drag",null)}return{update:k,destroy:v}}function pm(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())dr(o,As(a))>0&&s.push(a);return s}const gm=250;function xm(e,t,n,s){let o=[],a=1/0;const i=pm(e,n,t+gm);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:f,y:u}=ts(l,d,d.position,!0),h=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(u-e.y,2));h>t||(h<a?(o=[{...d,x:f,y:u}],a=h):h===a&&o.push({...d,x:f,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 vd(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,...ts(i,c,c.position,!0)}:c}function jd(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function bm(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Nd=()=>!0;function ym(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:o,edgeUpdaterType:a,isTarget:i,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:f,flowId:u,panBy:h,cancelConnection:m,onConnectStart:g,onConnect:b,onConnectEnd:k,isValidConnection:v=Nd,onReconnectEnd:y,updateConnection:x,getTransform:w,getFromHandle:C,autoPanSpeed:j,dragThreshold:E=1,handleDomNode:S}){const R=ud(e.target);let $=0,M;const{x:D,y:z}=Jt(e),I=jd(a,S),P=l?.getBoundingClientRect();let L=!1;if(!P||!I)return;const B=vd(o,I,s,c,t);if(!B)return;let _=Jt(e,P),q=!1,H=null,K=!1,O=null;function U(){if(!f||!P)return;const[ue,ie]=id(_,P,j);h({x:ue,y:ie}),$=requestAnimationFrame(U)}const A={...B,nodeId:o,type:I,position:B.position},T=c.get(o);let W={inProgress:!0,isValid:null,from:ts(T,A,we.Left,!0),fromHandle:A,fromPosition:A.position,fromNode:T,to:_,toHandle:null,toPosition:ol[A.position],toNode:null,pointer:_};function F(){L=!0,x(W),g?.(e,{nodeId:o,handleId:s,handleType:I})}E===0&&F();function Z(ue){if(!L){const{x:Be,y:$e}=Jt(ue),Ie=Be-D,Ve=$e-z;if(!(Ie*Ie+Ve*Ve>E*E))return;F()}if(!C()||!A){se(ue);return}const ie=w();_=Jt(ue,P),M=xm(yr(_,ie,!1,[1,1]),n,c,A),q||(U(),q=!0);const pe=Sd(ue,{handle:M,connectionMode:t,fromNodeId:o,fromHandleId:s,fromType:i?"target":"source",isValidConnection:v,doc:R,lib:d,flowId:u,nodeLookup:c});O=pe.handleDomNode,H=pe.connection,K=bm(!!M,pe.isValid);const je=c.get(o),Se=je?ts(je,A,we.Left,!0):W.from,Ne={...W,from:Se,isValid:K,to:pe.toHandle&&K?po({x:pe.toHandle.x,y:pe.toHandle.y},ie):_,toHandle:pe.toHandle,toPosition:K&&pe.toHandle?pe.toHandle.position:ol[A.position],toNode:pe.toHandle?c.get(pe.toHandle.nodeId):null,pointer:_};x(Ne),W=Ne}function se(ue){if(!("touches"in ue&&ue.touches.length>0)){if(L){(M||O)&&H&&K&&b?.(H);const{inProgress:ie,...pe}=W,je={...pe,toPosition:W.toHandle?W.toPosition:null};k?.(ue,je),a&&y?.(ue,je)}m(),cancelAnimationFrame($),q=!1,K=!1,H=null,O=null,R.removeEventListener("mousemove",Z),R.removeEventListener("mouseup",se),R.removeEventListener("touchmove",Z),R.removeEventListener("touchend",se)}}R.addEventListener("mousemove",Z),R.addEventListener("mouseup",se),R.addEventListener("touchmove",Z),R.addEventListener("touchend",se)}function Sd(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:o,fromType:a,doc:i,lib:l,flowId:c,isValidConnection:d=Nd,nodeLookup:f}){const u=a==="target",h=t?i.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:m,y:g}=Jt(e),b=i.elementFromPoint(m,g),k=b?.classList.contains(`${l}-flow__handle`)?b:h,v={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const y=jd(void 0,k),x=k.getAttribute("data-nodeid"),w=k.getAttribute("data-handleid"),C=k.classList.contains("connectable"),j=k.classList.contains("connectableend");if(!x||!y)return v;const E={source:u?x:s,sourceHandle:u?w:o,target:u?s:x,targetHandle:u?o:w};v.connection=E;const R=C&&j&&(n===Is.Strict?u&&y==="source"||!u&&y==="target":x!==s||w!==o);v.isValid=R&&d(E),v.toHandle=vd(x,y,w,f,n,!0)}return v}const ja={onPointerDown:ym,isValid:Sd};function wm({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const o=zt(e);function a({translateExtent:l,width:c,height:d,zoomStep:f=1,pannable:u=!0,zoomable:h=!0,inversePan:m=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const w=n(),C=x.sourceEvent.ctrlKey&&ur()?10:1,j=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*f,E=w[2]*Math.pow(2,j*C);t.scaleTo(E)};let b=[0,0];const k=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(b=[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 C=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],j=[C[0]-b[0],C[1]-b[1]];b=C;const E=s()*Math.max(w[2],Math.log(w[2]))*(m?-1:1),S={x:w[0]-j[0]*E,y:w[1]-j[1]*E},R=[[0,0],[c,d]];t.setViewportConstrained({x:S.x,y:S.y,zoom:w[2]},R,l)},y=Uc().on("start",k).on("zoom",u?v:null).on("zoom.wheel",h?g:null);o.call(y,{})}function i(){o.on("zoom",null)}return{update:a,destroy:i,pointer:Zt}}const Eo=e=>({x:e.x,y:e.y,zoom:e.k}),ta=({x:e,y:t,zoom:n})=>$a.translate(e,t).scale(n),ys=(e,t)=>e.target.closest(`.${t}`),Cd=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),km=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,na=(e,t=0,n=km,s=()=>{})=>{const o=typeof t=="number"&&t>0;return o||s(),o?e.transition().duration(t).ease(n).on("end",s):e},Ed=e=>{const t=e.ctrlKey&&ur()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function vm({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:o,panOnScrollSpeed:a,zoomOnPinch:i,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return f=>{if(ys(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&i){const k=Zt(f),v=Ed(f),y=u*Math.pow(2,v);s.scaleTo(n,y,k,f);return}const h=f.deltaMode===1?20:1;let m=o===Jn.Vertical?0:f.deltaX*h,g=o===Jn.Horizontal?0:f.deltaY*h;!ur()&&f.shiftKey&&o!==Jn.Vertical&&(m=f.deltaY*h,g=0),s.translateBy(n,-(m/u)*a,-(g/u)*a,{internal:!0});const b=Eo(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(f,b),e.panScrollTimeout=setTimeout(()=>{d?.(f,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(f,b))}}function jm({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,o){const a=s.type==="wheel",i=!t&&a&&!s.ctrlKey,l=ys(s,e);if(s.ctrlKey&&a&&l&&s.preventDefault(),i||l)return null;s.preventDefault(),n.call(this,s,o)}}function Nm({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{if(s.sourceEvent?.internal)return;const o=Eo(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 Sm({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:o}){return a=>{e.usedRightMouseButton=!!(n&&Cd(t,e.mouseButton??0)),a.sourceEvent?.sync||s([a.transform.x,a.transform.y,a.transform.k]),o&&!a.sourceEvent?.internal&&o?.(a.sourceEvent,Eo(a.transform))}}function Cm({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:o,onPaneContextMenu:a}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Cd(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&a(i.sourceEvent),e.usedRightMouseButton=!1,s(!1),o)){const l=Eo(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(i.sourceEvent,l)},n?150:0)}}}function Em({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:o,zoomOnDoubleClick:a,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:f}){return u=>{const h=e||t,m=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(ys(u,`${d}-flow__node`)||ys(u,`${d}-flow__edge`)))return!0;if(!s&&!h&&!o&&!a&&!n||i||f&&!g||ys(u,l)&&g||ys(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(!h&&!o&&!m&&g||!s&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(s)&&!s.includes(u.button)&&u.type==="mousedown")return!1;const b=Array.isArray(s)&&s.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&b}}function Im({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},f=e.getBoundingClientRect(),u=Uc().scaleExtent([t,n]).translateExtent(s),h=zt(e).call(u);y({x:o.x,y:o.y,zoom:Ms(o.zoom,t,n)},[[0,0],[f.width,f.height]],s);const m=h.on("wheel.zoom"),g=h.on("dblclick.zoom");u.wheelDelta(Ed);function b(M,D){return h?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?Zo:ao).transform(na(h,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function k({noWheelClassName:M,noPanClassName:D,onPaneContextMenu:z,userSelectionActive:I,panOnScroll:P,panOnDrag:L,panOnScrollMode:B,panOnScrollSpeed:_,preventScrolling:q,zoomOnPinch:H,zoomOnScroll:K,zoomOnDoubleClick:O,zoomActivationKeyPressed:U,lib:A,onTransformChange:T,connectionInProgress:V,paneClickDistance:W,selectionOnDrag:F}){I&&!d.isZoomingOrPanning&&v();const Z=P&&!U&&!I;u.clickDistance(F?1/0:!Qt(W)||W<0?0:W);const se=Z?vm({zoomPanValues:d,noWheelClassName:M,d3Selection:h,d3Zoom:u,panOnScrollMode:B,panOnScrollSpeed:_,zoomOnPinch:H,onPanZoomStart:i,onPanZoom:a,onPanZoomEnd:l}):jm({noWheelClassName:M,preventScrolling:q,d3ZoomHandler:m});if(h.on("wheel.zoom",se,{passive:!1}),!I){const ie=Nm({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:i});u.on("start",ie);const pe=Sm({zoomPanValues:d,panOnDrag:L,onPaneContextMenu:!!z,onPanZoom:a,onTransformChange:T});u.on("zoom",pe);const je=Cm({zoomPanValues:d,panOnDrag:L,panOnScroll:P,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:c});u.on("end",je)}const ue=Em({zoomActivationKeyPressed:U,panOnDrag:L,zoomOnScroll:K,panOnScroll:P,zoomOnDoubleClick:O,zoomOnPinch:H,userSelectionActive:I,noPanClassName:D,noWheelClassName:M,lib:A,connectionInProgress:V});u.filter(ue),O?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function v(){u.on("zoom",null)}async function y(M,D,z){const I=ta(M),P=u?.constrain()(I,D,z);return P&&await b(P),new Promise(L=>L(P))}async function x(M,D){const z=ta(M);return await b(z,D),new Promise(I=>I(z))}function w(M){if(h){const D=ta(M),z=h.property("__zoom");(z.k!==M.zoom||z.x!==M.x||z.y!==M.y)&&u?.transform(h,D,null,{sync:!0})}}function C(){const M=h?rh(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function j(M,D){return h?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?Zo:ao).scaleTo(na(h,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function E(M,D){return h?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?Zo:ao).scaleBy(na(h,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function S(M){u?.scaleExtent(M)}function R(M){u?.translateExtent(M)}function $(M){const D=!Qt(M)||M<0?0:M;u?.clickDistance(D)}return{update:k,destroy:v,setViewport:x,setViewportConstrained:y,getViewport:C,scaleTo:j,scaleBy:E,setScaleExtent:S,setTranslateExtent:R,syncViewport:w,setClickDistance:$}}var _s;(function(e){e.Line="line",e.Handle="handle"})(_s||(_s={}));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 bl(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 Cn(e,t){return Math.max(0,t-e)}function En(e,t){return Math.max(0,e-t)}function Ur(e,t,n){return Math.max(0,t-e,e-n)}function yl(e,t){return e?!t:t}function Mm(e,t,n,s,o,a,i,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:f,isVertical:u}=t,h=f&&u,{xSnapped:m,ySnapped:g}=n,{minWidth:b,maxWidth:k,minHeight:v,maxHeight:y}=s,{x,y:w,width:C,height:j,aspectRatio:E}=e;let S=Math.floor(f?m-e.pointerX:0),R=Math.floor(u?g-e.pointerY:0);const $=C+(c?-S:S),M=j+(d?-R:R),D=-a[0]*C,z=-a[1]*j;let I=Ur($,b,k),P=Ur(M,v,y);if(i){let _=0,q=0;c&&S<0?_=Cn(x+S+D,i[0][0]):!c&&S>0&&(_=En(x+$+D,i[1][0])),d&&R<0?q=Cn(w+R+z,i[0][1]):!d&&R>0&&(q=En(w+M+z,i[1][1])),I=Math.max(I,_),P=Math.max(P,q)}if(l){let _=0,q=0;c&&S>0?_=En(x+S,l[0][0]):!c&&S<0&&(_=Cn(x+$,l[1][0])),d&&R>0?q=En(w+R,l[0][1]):!d&&R<0&&(q=Cn(w+M,l[1][1])),I=Math.max(I,_),P=Math.max(P,q)}if(o){if(f){const _=Ur($/E,v,y)*E;if(I=Math.max(I,_),i){let q=0;!c&&!d||c&&!d&&h?q=En(w+z+$/E,i[1][1])*E:q=Cn(w+z+(c?S:-S)/E,i[0][1])*E,I=Math.max(I,q)}if(l){let q=0;!c&&!d||c&&!d&&h?q=Cn(w+$/E,l[1][1])*E:q=En(w+(c?S:-S)/E,l[0][1])*E,I=Math.max(I,q)}}if(u){const _=Ur(M*E,b,k)/E;if(P=Math.max(P,_),i){let q=0;!c&&!d||d&&!c&&h?q=En(x+M*E+D,i[1][0])/E:q=Cn(x+(d?R:-R)*E+D,i[0][0])/E,P=Math.max(P,q)}if(l){let q=0;!c&&!d||d&&!c&&h?q=Cn(x+M*E,l[1][0])/E:q=En(x+(d?R:-R)*E,l[0][0])/E,P=Math.max(P,q)}}}R=R+(R<0?P:-P),S=S+(S<0?I:-I),o&&(h?$>M*E?R=(yl(c,d)?-S:S)/E:S=(yl(c,d)?-R:R)*E:f?(R=S/E,d=c):(S=R*E,c=d));const L=c?x+S:x,B=d?w+R:w;return{width:C+(c?-S:S),height:j+(d?-R:R),x:a[0]*S*(c?-1:1)+L,y:a[1]*R*(d?-1:1)+B}}const Id={width:0,height:0,x:0,y:0},Am={...Id,pointerX:0,pointerY:0,aspectRatio:1};function Lm(e){return[[0,0],[e.measured.width,e.measured.height]]}function _m(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 Rm({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:o}){const a=zt(e);let i={controlDirection:bl("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:f,keepAspectRatio:u,resizeDirection:h,onResizeStart:m,onResize:g,onResizeEnd:b,shouldResize:k}){let v={...Id},y={...Am};i={boundaries:f,resizeDirection:h,keepAspectRatio:u,controlDirection:bl(d)};let x,w=null,C=[],j,E,S,R=!1;const $=Kc().on("start",M=>{const{nodeLookup:D,transform:z,snapGrid:I,snapToGrid:P,nodeOrigin:L,paneDomNode:B}=n();if(x=D.get(t),!x)return;w=B?.getBoundingClientRect()??null;const{xSnapped:_,ySnapped:q}=nr(M.sourceEvent,{transform:z,snapGrid:I,snapToGrid:P,containerBounds:w});v={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},y={...v,pointerX:_,pointerY:q,aspectRatio:v.width/v.height},j=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(j=D.get(x.parentId),E=j&&x.extent==="parent"?Lm(j):void 0),C=[],S=void 0;for(const[H,K]of D)if(K.parentId===t&&(C.push({id:H,position:{...K.position},extent:K.extent}),K.extent==="parent"||K.expandParent)){const O=_m(K,x,K.origin??L);S?S=[[Math.min(O[0][0],S[0][0]),Math.min(O[0][1],S[0][1])],[Math.max(O[1][0],S[1][0]),Math.max(O[1][1],S[1][1])]]:S=O}m?.(M,{...v})}).on("drag",M=>{const{transform:D,snapGrid:z,snapToGrid:I,nodeOrigin:P}=n(),L=nr(M.sourceEvent,{transform:D,snapGrid:z,snapToGrid:I,containerBounds:w}),B=[];if(!x)return;const{x:_,y:q,width:H,height:K}=v,O={},U=x.origin??P,{width:A,height:T,x:V,y:W}=Mm(y,i.controlDirection,L,i.boundaries,i.keepAspectRatio,U,E,S),F=A!==H,Z=T!==K,se=V!==_&&F,ue=W!==q&&Z;if(!se&&!ue&&!F&&!Z)return;if((se||ue||U[0]===1||U[1]===1)&&(O.x=se?V:v.x,O.y=ue?W:v.y,v.x=O.x,v.y=O.y,C.length>0)){const Se=V-_,Ne=W-q;for(const Be of C)Be.position={x:Be.position.x-Se+U[0]*(A-H),y:Be.position.y-Ne+U[1]*(T-K)},B.push(Be)}if((F||Z)&&(O.width=F&&(!i.resizeDirection||i.resizeDirection==="horizontal")?A:v.width,O.height=Z&&(!i.resizeDirection||i.resizeDirection==="vertical")?T:v.height,v.width=O.width,v.height=O.height),j&&x.expandParent){const Se=U[0]*(O.width??0);O.x&&O.x<Se&&(v.x=Se,y.x=y.x-(O.x-Se));const Ne=U[1]*(O.height??0);O.y&&O.y<Ne&&(v.y=Ne,y.y=y.y-(O.y-Ne))}const ie=Tm({width:v.width,prevWidth:H,height:v.height,prevHeight:K,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),pe={...v,direction:ie};k?.(M,pe)!==!1&&(R=!0,g?.(M,pe),s(O,B))}).on("end",M=>{R&&(b?.(M,{...v}),o?.({...v}),R=!1)});a.call($)}function c(){a.on(".drag",null)}return{update:l,destroy:c}}var sa={exports:{}},ra={};var wl;function Dm(){if(wl)return ra;wl=1;var e=Mf(),t=Af();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}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 ra.useSyncExternalStoreWithSelector=function(d,f,u,h,m){var g=a(null);if(g.current===null){var b={hasValue:!1,value:null};g.current=b}else b=g.current;g=l(function(){function v(j){if(!y){if(y=!0,x=j,j=h(j),m!==void 0&&b.hasValue){var E=b.value;if(m(E,j))return w=E}return w=j}if(E=w,s(x,j))return E;var S=h(j);return m!==void 0&&m(E,S)?(x=j,E):(x=j,w=S)}var y=!1,x,w,C=u===void 0?null:u;return[function(){return v(f())},C===null?void 0:function(){return v(C())}]},[f,u,h,m]);var k=o(d,g[0],g[1]);return i(function(){b.hasValue=!0,b.value=k},[k]),c(k),k},ra}var kl;function Om(){return kl||(kl=1,sa.exports=Dm()),sa.exports}var $m=Om();const Pm=Lf($m),Bm={},vl=e=>{let t;const n=new Set,s=(f,u)=>{const h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){const m=t;t=u??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,m))}},o=()=>t,c={setState:s,getState:o,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Bm?"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},qm=e=>e?vl(e):vl,{useDebugValue:zm}=_f,{useSyncExternalStoreWithSelector:Fm}=Pm,Hm=e=>e;function Td(e,t=Hm,n){const s=Fm(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return zm(s),s}const jl=(e,t)=>{const n=qm(e),s=(o,a=t)=>Td(n,o,a);return Object.assign(s,n),s},Vm=(e,t)=>e?jl(e,t):jl;function ut(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 Io=p.createContext(null),Wm=Io.Provider,Md=an.error001();function Ue(e,t){const n=p.useContext(Io);if(n===null)throw new Error(Md);return Td(n,e,t)}function lt(){const e=p.useContext(Io);if(e===null)throw new Error(Md);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Nl={display:"none"},Km={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ad="react-flow__node-desc",Ld="react-flow__edge-desc",Um="react-flow__aria-live",Ym=e=>e.ariaLiveMessage,Gm=e=>e.ariaLabelConfig;function Xm({rfId:e}){const t=Ue(Ym);return r.jsx("div",{id:`${Um}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Km,children:t})}function Zm({rfId:e,disableKeyboardA11y:t}){const n=Ue(Gm);return r.jsxs(r.Fragment,{children:[r.jsx("div",{id:`${Ad}-${e}`,style:Nl,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),r.jsx("div",{id:`${Ld}-${e}`,style:Nl,children:n["edge.a11yDescription.default"]}),!t&&r.jsx(Xm,{rfId:e})]})}const To=p.forwardRef(({position:e="top-left",children:t,className:n,style:s,...o},a)=>{const i=`${e}`.split("-");return r.jsx("div",{className:Nt(["react-flow__panel",n,...i]),style:s,ref:a,...o,children:t})});To.displayName="Panel";function Qm({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:r.jsx(To,{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 Jm=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}},Yr=e=>e.id;function ep(e,t){return ut(e.selectedNodes.map(Yr),t.selectedNodes.map(Yr))&&ut(e.selectedEdges.map(Yr),t.selectedEdges.map(Yr))}function tp({onSelectionChange:e}){const t=lt(),{selectedNodes:n,selectedEdges:s}=Ue(Jm,ep);return p.useEffect(()=>{const o={nodes:n,edges:s};e?.(o),t.getState().onSelectionChangeHandlers.forEach(a=>a(o))},[n,s,e]),null}const np=e=>!!e.onSelectionChangeHandlers;function sp({onSelectionChange:e}){const t=Ue(np);return e||t?r.jsx(tp,{onSelectionChange:e}):null}const _d=[0,0],rp={x:0,y:0,zoom:1},op=["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"],Sl=[...op,"rfId"],ap=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}),Cl={translateExtent:lr,nodeOrigin:_d,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ip(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:o,setTranslateExtent:a,setNodeExtent:i,reset:l,setDefaultNodesAndEdges:c}=Ue(ap,ut),d=lt();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=Cl,l()}),[]);const f=p.useRef(Cl);return p.useEffect(()=>{for(const u of Sl){const h=e[u],m=f.current[u];h!==m&&(typeof e[u]>"u"||(u==="nodes"?t(h):u==="edges"?n(h):u==="minZoom"?s(h):u==="maxZoom"?o(h):u==="translateExtent"?a(h):u==="nodeExtent"?i(h):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:Kh(h)}):u==="fitView"?d.setState({fitViewQueued:h}):u==="fitViewOptions"?d.setState({fitViewOptions:h}):d.setState({[u]:h})))}f.current=e},Sl.map(u=>e[u])),null}function El(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function lp(e){const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const s=El(),o=()=>n(s?.matches?"dark":"light");return o(),s?.addEventListener("change",o),()=>{s?.removeEventListener("change",o)}},[e]),t!==null?t:El()?.matches?"dark":"light"}const Il=typeof document<"u"?document:null;function fr(e=null,t={target:Il,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 He,j as r,b5 as Mf,b6 as Af,a1 as Lf,b7 as _f,r as p,k as te,aq as Rf,a as pr,a3 as Df,n as en,P as tt,b as Of,c as $f,Q as Pf,R as Xi,b8 as Bf,b9 as qf,U as $t,a_ as qt,ba as zr,W as Fr,X as zf,bb as Ra,l as Gn,i as Ff,a4 as bs,d as Hf,bc as Vf,bd as Wf,aP as Kf,be as Oc,bf as Uf,A as Da,aT as Oa,aU as Zi,Z as Yf,t as Gf}from"./index-CKPQYzzR.js";import{S as $c,a as Pc,r as Bc,s as Xf}from"./SendToChat-IOAvuta-.js";import{L as Zf,P as Qf}from"./AsyncState-_UC7xcxJ.js";import{t as qc,Z as zc,_ as Qi,$ as Ji,a0 as Jf,a1 as eh,a2 as Fc,a3 as th,P as nh}from"./ChatComponents-Ca9tWI9W.js";import{MarkdownMessage as or}from"./MarkdownMessage-DedA8Zob.js";import{ContentRenderer as sh}from"./ContentRenderer-C-V5k_3K.js";import{s as zt,g as Hc,j as $a,T as Go,k as Xo,t as rh}from"./transform-BqqRT-Iy.js";import{i as Zo}from"./value-wA6veExk.js";import"./chatChips-DVIRVTpT.js";function oh(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Zt(e,t){if(e=oh(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 ah={passive:!1},ar={capture:!0,passive:!1};function Qo(e){e.stopImmediatePropagation()}function Ss(e){e.preventDefault(),e.stopImmediatePropagation()}function Vc(e){var t=e.document.documentElement,n=zt(e).on("dragstart.drag",Ss,ar);"onselectstart"in t?n.on("selectstart.drag",Ss,ar):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Wc(e,t){var n=e.document.documentElement,s=zt(e).on("dragstart.drag",null);t&&(s.on("click.drag",Ss,ar),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 Hr=e=>()=>e;function xa(e,{sourceEvent:t,subject:n,target:s,identifier:o,active:a,x:i,y:l,dx:c,dy:d,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value: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:f}})}xa.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ih(e){return!e.ctrlKey&&!e.button}function lh(){return this.parentNode}function ch(e,t){return t??{x:e.x,y:e.y}}function dh(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kc(){var e=ih,t=lh,n=ch,s=dh,o={},a=Hc("start","drag","end"),i=0,l,c,d,f,u=0;function h(w){w.on("mousedown.drag",m).filter(s).on("touchstart.drag",k).on("touchmove.drag",v,ah).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,C){if(!(f||!e.call(this,w,C))){var j=x(this,t.call(this,w,C),w,C,"mouse");j&&(zt(w.view).on("mousemove.drag",g,ar).on("mouseup.drag",b,ar),Vc(w.view),Qo(w),d=!1,l=w.clientX,c=w.clientY,j("start",w))}}function g(w){if(Ss(w),!d){var C=w.clientX-l,j=w.clientY-c;d=C*C+j*j>u}o.mouse("drag",w)}function b(w){zt(w.view).on("mousemove.drag mouseup.drag",null),Wc(w.view,d),Ss(w),o.mouse("end",w)}function k(w,C){if(e.call(this,w,C)){var j=w.changedTouches,E=t.call(this,w,C),S=j.length,R,$;for(R=0;R<S;++R)($=x(this,E,w,C,j[R].identifier,j[R]))&&(Qo(w),$("start",w,j[R]))}}function v(w){var C=w.changedTouches,j=C.length,E,S;for(E=0;E<j;++E)(S=o[C[E].identifier])&&(Ss(w),S("drag",w,C[E]))}function y(w){var C=w.changedTouches,j=C.length,E,S;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),E=0;E<j;++E)(S=o[C[E].identifier])&&(Qo(w),S("end",w,C[E]))}function x(w,C,j,E,S,R){var $=a.copy(),M=Zt(R||j,C),D,z,I;if((I=n.call(w,new xa("beforestart",{sourceEvent:j,target:h,identifier:S,active:i,x:M[0],y:M[1],dx:0,dy:0,dispatch:$}),E))!=null)return D=I.x-M[0]||0,z=I.y-M[1]||0,function P(L,B,_){var q=M,H;switch(L){case"start":o[S]=P,H=i++;break;case"end":delete o[S],--i;case"drag":M=Zt(_||B,C),H=i;break}$.call(L,w,new xa(L,{sourceEvent:B,subject:I,target:h,identifier:S,active:H,x:M[0]+D,y:M[1]+z,dx:M[0]-q[0],dy:M[1]-q[1],dispatch:$}),E)}}return h.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Hr(!!w),h):e},h.container=function(w){return arguments.length?(t=typeof w=="function"?w:Hr(w),h):t},h.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Hr(w),h):n},h.touchable=function(w){return arguments.length?(s=typeof w=="function"?w:Hr(!!w),h):s},h.on=function(){var w=a.on.apply(a,arguments);return w===a?h:w},h.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,h):Math.sqrt(u)},h}var uh=1e-12;function el(e){return((e=Math.exp(e))+1/e)/2}function fh(e){return((e=Math.exp(e))-1/e)/2}function hh(e){return((e=Math.exp(2*e))-1)/(e+1)}const ao=(function e(t,n,s){function o(a,i){var l=a[0],c=a[1],d=a[2],f=i[0],u=i[1],h=i[2],m=f-l,g=u-c,b=m*m+g*g,k,v;if(b<uh)v=Math.log(h/d)/t,k=function(E){return[l+E*m,c+E*g,d*Math.exp(t*E*v)]};else{var y=Math.sqrt(b),x=(h*h-d*d+s*b)/(2*d*n*y),w=(h*h-d*d-s*b)/(2*h*n*y),C=Math.log(Math.sqrt(x*x+1)-x),j=Math.log(Math.sqrt(w*w+1)-w);v=(j-C)/t,k=function(E){var S=E*v,R=el(C),$=d/(n*y)*(R*hh(t*S+C)-fh(C));return[l+$*m,c+$*g,d*R/el(t*S+C)]}}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),Vr=e=>()=>e;function mh(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 Jo(e){e.stopImmediatePropagation()}function Qs(e){e.preventDefault(),e.stopImmediatePropagation()}function ph(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function gh(){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 tl(){return this.__zoom||$a}function xh(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bh(){return navigator.maxTouchPoints||"ontouchstart"in this}function yh(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 Uc(){var e=ph,t=gh,n=yh,s=xh,o=bh,a=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],l=250,c=ao,d=Hc("start","zoom","end"),f,u,h,m=500,g=150,b=0,k=10;function v(I){I.property("__zoom",tl).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",$).filter(o).on("touchstart.zoom",M).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(I,P,L,B){var _=I.selection?I.selection():I;_.property("__zoom",tl),I!==_?C(I,P,L,B):_.interrupt().each(function(){j(this,arguments).event(B).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},v.scaleBy=function(I,P,L,B){v.scaleTo(I,function(){var _=this.__zoom.k,q=typeof P=="function"?P.apply(this,arguments):P;return _*q},L,B)},v.scaleTo=function(I,P,L,B){v.transform(I,function(){var _=t.apply(this,arguments),q=this.__zoom,H=L==null?w(_):typeof L=="function"?L.apply(this,arguments):L,K=q.invert(H),O=typeof P=="function"?P.apply(this,arguments):P;return n(x(y(q,O),H,K),_,i)},L,B)},v.translateBy=function(I,P,L,B){v.transform(I,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),i)},null,B)},v.translateTo=function(I,P,L,B,_){v.transform(I,function(){var q=t.apply(this,arguments),H=this.__zoom,K=B==null?w(q):typeof B=="function"?B.apply(this,arguments):B;return n($a.translate(K[0],K[1]).scale(H.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof L=="function"?-L.apply(this,arguments):-L),q,i)},B,_)};function y(I,P){return P=Math.max(a[0],Math.min(a[1],P)),P===I.k?I:new Go(P,I.x,I.y)}function x(I,P,L){var B=P[0]-L[0]*I.k,_=P[1]-L[1]*I.k;return B===I.x&&_===I.y?I:new Go(I.k,B,_)}function w(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function C(I,P,L,B){I.on("start.zoom",function(){j(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(B).end()}).tween("zoom",function(){var _=this,q=arguments,H=j(_,q).event(B),K=t.apply(_,q),O=L==null?w(K):typeof L=="function"?L.apply(_,q):L,U=Math.max(K[1][0]-K[0][0],K[1][1]-K[0][1]),A=_.__zoom,T=typeof P=="function"?P.apply(_,q):P,V=c(A.invert(O).concat(U/A.k),T.invert(O).concat(U/T.k));return function(W){if(W===1)W=T;else{var F=V(W),Z=U/F[2];W=new Go(Z,O[0]-F[0]*Z,O[1]-F[1]*Z)}H.zoom(null,W)}})}function j(I,P,L){return!L&&I.__zooming||new E(I,P)}function E(I,P){this.that=I,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,P),this.taps=0}E.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,P){return this.mouse&&I!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var P=zt(this.that).datum();d.call(I,this.that,new mh(I,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:d}),P)}};function S(I,...P){if(!e.apply(this,arguments))return;var L=j(this,P).event(I),B=this.__zoom,_=Math.max(a[0],Math.min(a[1],B.k*Math.pow(2,s.apply(this,arguments)))),q=Zt(I);if(L.wheel)(L.mouse[0][0]!==q[0]||L.mouse[0][1]!==q[1])&&(L.mouse[1]=B.invert(L.mouse[0]=q)),clearTimeout(L.wheel);else{if(B.k===_)return;L.mouse=[q,B.invert(q)],Xo(this),L.start()}Qs(I),L.wheel=setTimeout(H,g),L.zoom("mouse",n(x(y(B,_),L.mouse[0],L.mouse[1]),L.extent,i));function H(){L.wheel=null,L.end()}}function R(I,...P){if(h||!e.apply(this,arguments))return;var L=I.currentTarget,B=j(this,P,!0).event(I),_=zt(I.view).on("mousemove.zoom",O,!0).on("mouseup.zoom",U,!0),q=Zt(I,L),H=I.clientX,K=I.clientY;Vc(I.view),Jo(I),B.mouse=[q,this.__zoom.invert(q)],Xo(this),B.start();function O(A){if(Qs(A),!B.moved){var T=A.clientX-H,V=A.clientY-K;B.moved=T*T+V*V>b}B.event(A).zoom("mouse",n(x(B.that.__zoom,B.mouse[0]=Zt(A,L),B.mouse[1]),B.extent,i))}function U(A){_.on("mousemove.zoom mouseup.zoom",null),Wc(A.view,B.moved),Qs(A),B.event(A).end()}}function $(I,...P){if(e.apply(this,arguments)){var L=this.__zoom,B=Zt(I.changedTouches?I.changedTouches[0]:I,this),_=L.invert(B),q=L.k*(I.shiftKey?.5:2),H=n(x(y(L,q),B,_),t.apply(this,P),i);Qs(I),l>0?zt(this).transition().duration(l).call(C,H,B,I):zt(this).call(v.transform,H,B,I)}}function M(I,...P){if(e.apply(this,arguments)){var L=I.touches,B=L.length,_=j(this,P,I.changedTouches.length===B).event(I),q,H,K,O;for(Jo(I),H=0;H<B;++H)K=L[H],O=Zt(K,this),O=[O,this.__zoom.invert(O),K.identifier],_.touch0?!_.touch1&&_.touch0[2]!==O[2]&&(_.touch1=O,_.taps=0):(_.touch0=O,q=!0,_.taps=1+!!f);f&&(f=clearTimeout(f)),q&&(_.taps<2&&(u=O[0],f=setTimeout(function(){f=null},m)),Xo(this),_.start())}}function D(I,...P){if(this.__zooming){var L=j(this,P).event(I),B=I.changedTouches,_=B.length,q,H,K,O;for(Qs(I),q=0;q<_;++q)H=B[q],K=Zt(H,this),L.touch0&&L.touch0[2]===H.identifier?L.touch0[0]=K:L.touch1&&L.touch1[2]===H.identifier&&(L.touch1[0]=K);if(H=L.that.__zoom,L.touch1){var U=L.touch0[0],A=L.touch0[1],T=L.touch1[0],V=L.touch1[1],W=(W=T[0]-U[0])*W+(W=T[1]-U[1])*W,F=(F=V[0]-A[0])*F+(F=V[1]-A[1])*F;H=y(H,Math.sqrt(W/F)),K=[(U[0]+T[0])/2,(U[1]+T[1])/2],O=[(A[0]+V[0])/2,(A[1]+V[1])/2]}else if(L.touch0)K=L.touch0[0],O=L.touch0[1];else return;L.zoom("touch",n(x(H,K,O),L.extent,i))}}function z(I,...P){if(this.__zooming){var L=j(this,P).event(I),B=I.changedTouches,_=B.length,q,H;for(Jo(I),h&&clearTimeout(h),h=setTimeout(function(){h=null},m),q=0;q<_;++q)H=B[q],L.touch0&&L.touch0[2]===H.identifier?delete L.touch0:L.touch1&&L.touch1[2]===H.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&&(H=Zt(H,this),Math.hypot(u[0]-H[0],u[1]-H[1])<k)){var K=zt(this).on("dblclick.zoom");K&&K.apply(this,arguments)}}}return v.wheelDelta=function(I){return arguments.length?(s=typeof I=="function"?I:Vr(+I),v):s},v.filter=function(I){return arguments.length?(e=typeof I=="function"?I:Vr(!!I),v):e},v.touchable=function(I){return arguments.length?(o=typeof I=="function"?I:Vr(!!I),v):o},v.extent=function(I){return arguments.length?(t=typeof I=="function"?I:Vr([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),v):t},v.scaleExtent=function(I){return arguments.length?(a[0]=+I[0],a[1]=+I[1],v):[a[0],a[1]]},v.translateExtent=function(I){return arguments.length?(i[0][0]=+I[0][0],i[1][0]=+I[1][0],i[0][1]=+I[0][1],i[1][1]=+I[1][1],v):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},v.constrain=function(I){return arguments.length?(n=I,v):n},v.duration=function(I){return arguments.length?(l=+I,v):l},v.interpolate=function(I){return arguments.length?(c=I,v):c},v.on=function(){var I=d.on.apply(d,arguments);return I===d?v:I},v.clickDistance=function(I){return arguments.length?(b=(I=+I)*I,v):Math.sqrt(b)},v.tapDistance=function(I){return arguments.length?(k=+I,v):k},v}const Yc=new Set(["completed","failed","rejected","cancelled","archived"]);function ir(e){return!!e&&Yc.has(e)}const Gc=new Set(["completed","rejected","cancelled","archived"]);function wh(e,t={}){const n=[];for(let s=0;s<e.length;s++){const o=e[s];if(o.toStatus!=="review")continue;const a=e[s+1],i=!a,l=`review:${o.id}`,c=t.reviewerId??o.changedById??"",d=t.reviewerName??void 0??o.changedByName??void 0??(o.changedById?t.reviewerNameOf?.(o.changedById):void 0)??c??"reviewer";n.push({id:l,reviewerId:c,reviewerName:d,status:i?"reviewing":"completed",queuedAt:o.createdAt,completedAt:a?a.createdAt:null,round:n.length+1,outcome:a?kh(a.toStatus):null,decidedByName:a?a.changedByName??null:null,note:a?a.reason??null:null})}return n}function kh(e){return e==="completed"?"approved":e==="in_progress"?"revision_requested":"closed"}function nl(e){return e.find(t=>t.status==="reviewing")??null}function vh(e){return e.some(t=>t.status==="reviewing")}function Wr(e){return e?new Date(e).getTime():Number.NaN}function jh(e,t,n="all"){const s=[];if(n!=="review")for(const o of e){const a=o.firstAt??"";Number.isNaN(Wr(a))||s.push({kind:"execution",key:`exec:${o.round}`,round:o.round,startedAt:a,endedAt:o.lastAt??null,toolCount:o.toolCount??0,logCount:o.logCount??0,status:o.status??""})}if(n!=="execution")for(const o of t)Number.isNaN(Wr(o.queuedAt))||s.push({kind:"review",key:o.id,round:o.round,startedAt:o.queuedAt,endedAt:o.completedAt,session:o});return s.sort((o,a)=>{const i=Wr(o.startedAt)-Wr(a.startedAt);return i!==0?i:o.kind!==a.kind?o.kind==="execution"?-1:1:o.round-a.round})}const sl=6e4,Nh=/^(Reviewing task from\b|Task Review$)/;function Sh(e){const t=(e.label??"").trim();return t?Nh.test(t):!1}function Xc(e,t){const n=new Date(e).getTime();if(Number.isNaN(n))return!1;const s=new Date(t.queuedAt).getTime();if(Number.isNaN(s))return!1;const o=t.completedAt?new Date(t.completedAt).getTime():Number.POSITIVE_INFINITY;return Number.isNaN(o)?!1:n>=s-sl&&n<=o+sl}function Ch(e,t){const n=new Date(t.queuedAt).getTime(),s=t.completedAt?new Date(t.completedAt).getTime():Number.POSITIVE_INFINITY;return Number.isNaN(n)||Number.isNaN(s)?[]:e.filter(o=>!Sh(o)||o.taskId&&o.taskId!==t.taskId?!1:Xc(o.startedAt,t)).sort((o,a)=>new Date(o.startedAt).getTime()-new Date(a.startedAt).getTime())}const Eh=["30m","1h","2h","4h","8h","12h","1d","1w"],Ih={"30m":"freq30m","1h":"freq1h","2h":"freq2h","4h":"freq4h","8h":"freq8h","12h":"freq12h","1d":"freq1d","1w":"freq1w"};function rl(e){return Ih[e]??"freq4h"}function Th(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function ba(){return{mode:"calendar",every:"4h",calendar:"daily",weekdays:[1,2,3,4,5],time:"09:00",cron:"",maxRuns:"",timezone:Th()}}function Zc(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 Mh(e){const[t,n]=Zc(e);return`${String(t).padStart(2,"0")}:${String(n).padStart(2,"0")}`}function Ah(e,t,n){if(e==="cron")return"";const[s,o]=Zc(n),a=e==="daily"?"*":e==="weekdays"?"1-5":t.length>0?[...t].sort((i,l)=>i-l).join(","):"*";return`${o} ${s} * * ${a}`}function Lh(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 _h(e){const t=ba();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=Lh(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 Qc(e){const t={};e.mode==="interval"?t.every=e.every||"4h":(t.cron=e.calendar==="cron"?e.cron.trim():Ah(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 Rh=[1,2,3,4,5,6,0];function Dh({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-on-brand":"bg-surface-elevated text-fg-secondary hover:text-fg-primary"}`,children:a.label},a.value))})}function Jc({value:e,onChange:t,compact:n=!1}){const{t:s}=He(),o=f=>t({...e,...f}),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=f=>{const h=e.weekdays.includes(f)?e.weekdays.filter(m=>m!==f):[...e.weekdays,f];o({weekdays:h})};let l;if(e.mode==="interval")l=s(`work:task.${rl(e.every)}`);else if(e.calendar==="cron")l=s("work:task.scheduleCron",{expr:e.cron.trim()||"—"});else{const f=Mh(e.time);if(e.calendar==="daily")l=s("work:task.scheduleDailyAt",{time:f});else if(e.calendar==="weekdays")l=s("work:task.scheduleWeekdaysAt",{time:f});else{const u=[...e.weekdays].sort((h,m)=>h-m).map(h=>s(`work:task.weekdayShort.${h}`)).join(" ");l=e.weekdays.length?s("work:task.scheduleWeeklyAt",{days:u,time:f}):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(Dh,{size:n?"sm":"md",value:e.mode,onChange:f=>o({mode:f}),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:f=>o({every:f.target.value}),className:a,children:Eh.map(f=>r.jsx("option",{value:f,children:s(`work:task.${rl(f)}`)},f))})]}):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:f=>o({calendar:f.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:f=>o({time:f.target.value}),className:a})]}),e.calendar==="weekly"&&r.jsx("div",{className:"flex flex-wrap gap-1 pl-[5.5rem]",children:Rh.map(f=>{const u=e.weekdays.includes(f);return r.jsx("button",{type:"button",onClick:()=>i(f),className:`w-7 h-7 rounded-full text-xs transition-colors ${u?"bg-brand-600 text-on-brand":"bg-surface-elevated text-fg-secondary border border-border-default hover:text-fg-primary"}`,children:s(`work:task.weekdayShort.${f}`)},f)})}),e.calendar==="cron"&&r.jsx("input",{value:e.cron,onChange:f=>o({cron:f.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:f=>o({maxRuns:f.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 Nt(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=Nt(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}const an={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."},lr=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ed=["Enter"," ","Escape"],td={"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 Is;(function(e){e.Strict="strict",e.Loose="loose"})(Is||(Is={}));var Jn;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Jn||(Jn={}));var cr;(function(e){e.Partial="partial",e.Full="full"})(cr||(cr={}));const nd={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Tn;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Tn||(Tn={}));var Ts;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ts||(Ts={}));var we;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(we||(we={}));const ol={[we.Left]:we.Right,[we.Right]:we.Left,[we.Top]:we.Bottom,[we.Bottom]:we.Top};function sd(e){return e===null?null:e?"valid":"invalid"}const rd=e=>"id"in e&&"source"in e&&"target"in e,Oh=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Pa=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),gr=(e,t=[0,0])=>{const{width:n,height:s}=yn(e),o=e.origin??t,a=n*o[0],i=s*o[1];return{x:e.position.x-a,y:e.position.y-i}},$h=(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):Pa(o)?o:t.nodeLookup.get(o.id));const l=i?mo(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return So(s,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Co(n)},xr=(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=So(n,mo(o)),s=!0)}),s?Co(n):{x:0,y:0,width:0,height:0}},Ba=(e,t,[n,s,o]=[0,0,1],a=!1,i=!1)=>{const l={...yr(t,[n,s,o]),width:t.width/o,height:t.height/o},c=[];for(const d of e.values()){const{measured:f,selectable:u=!0,hidden:h=!1}=d;if(i&&!u||h)continue;const m=f.width??d.width??d.initialWidth??null,g=f.height??d.height??d.initialHeight??null,b=dr(l,As(d)),k=(m??0)*(g??0),v=a&&b>0;(!d.internals.handleBounds||v||b>=k||d.dragging)&&c.push(d)}return c},Ph=(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 Bh(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 qh({nodes:e,width:t,height:n,panZoom:s,minZoom:o,maxZoom:a},i){if(e.size===0)return Promise.resolve(!0);const l=Bh(e,i),c=xr(l),d=qa(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 od({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},f=i.origin??s;let u=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!l)a?.("005",an.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(u=[[c,d],[c+m,d+g]])}else l&&Ls(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+d],[i.extent[1][0]+c,i.extent[1][1]+d]]);const h=Ls(u)?es(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&a?.("015",an.error015()),{position:{x:h.x-c+(i.measured.width??0)*f[0],y:h.y-d+(i.measured.height??0)*f[1]},positionAbsolute:h}}async function zh({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:s,onBeforeDelete:o}){const a=new Set(e.map(h=>h.id)),i=[];for(const h of n){if(h.deletable===!1)continue;const m=a.has(h.id),g=!m&&h.parentId&&i.find(b=>b.id===h.parentId);(m||g)&&i.push(h)}const l=new Set(t.map(h=>h.id)),c=s.filter(h=>h.deletable!==!1),f=Ph(i,c);for(const h of c)l.has(h.id)&&!f.find(g=>g.id===h.id)&&f.push(h);if(!o)return{edges:f,nodes:i};const u=await o({nodes:i,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:i}:{edges:[],nodes:[]}:u}const Ms=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),es=(e={x:0,y:0},t,n)=>({x:Ms(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Ms(e.y,t[0][1],t[1][1]-(n?.height??0))});function ad(e,t,n){const{width:s,height:o}=yn(n),{x:a,y:i}=n.internals.positionAbsolute;return es(e,[[a,i],[a+s,i+o]],t)}const al=(e,t,n)=>e<t?Ms(Math.abs(e-t),1,t)/t:e>n?-Ms(Math.abs(e-n),1,t)/t:0,id=(e,t,n=15,s=40)=>{const o=al(e.x,s,t.width-s)*n,a=al(e.y,s,t.height-s)*n;return[o,a]},So=(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)}),ya=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),Co=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),As=(e,t=[0,0])=>{const{x:n,y:s}=Pa(e)?e.internals.positionAbsolute:gr(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}},mo=(e,t=[0,0])=>{const{x:n,y:s}=Pa(e)?e.internals.positionAbsolute:gr(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)}},ld=(e,t)=>Co(So(ya(e),ya(t))),dr=(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)},il=e=>Qt(e.width)&&Qt(e.height)&&Qt(e.x)&&Qt(e.y),Qt=e=>!isNaN(e)&&isFinite(e),Fh=(e,t)=>{},br=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yr=({x:e,y:t},[n,s,o],a=!1,i=[1,1])=>{const l={x:(e-n)/o,y:(t-s)/o};return a?br(l,i):l},po=({x:e,y:t},[n,s,o])=>({x:e*o+n,y:t*o+s});function ps(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 Hh(e,t,n){if(typeof e=="string"||typeof e=="number"){const s=ps(e,n),o=ps(e,t);return{top:s,right:o,bottom:s,left:o,x:o*2,y:s*2}}if(typeof e=="object"){const s=ps(e.top??e.y??0,n),o=ps(e.bottom??e.y??0,n),a=ps(e.left??e.x??0,t),i=ps(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 Vh(e,t,n,s,o,a){const{x:i,y:l}=po(e,[t,n,s]),{x:c,y:d}=po({x:e.x+e.width,y:e.y+e.height},[t,n,s]),f=o-c,u=a-d;return{left:Math.floor(i),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(u)}}const qa=(e,t,n,s,o,a)=>{const i=Hh(a,t,n),l=(t-i.x)/e.width,c=(n-i.y)/e.height,d=Math.min(l,c),f=Ms(d,s,o),u=e.x+e.width/2,h=e.y+e.height/2,m=t/2-u*f,g=n/2-h*f,b=Vh(e,m,g,f,t,n),k={left:Math.min(b.left-i.left,0),top:Math.min(b.top-i.top,0),right:Math.min(b.right-i.right,0),bottom:Math.min(b.bottom-i.bottom,0)};return{x:m-k.left+k.right,y:g-k.top+k.bottom,zoom:f}},ur=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ls(e){return e!=null&&e!=="parent"}function yn(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function cd(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function dd(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 ll(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Wh(){let e,t;return{promise:new Promise((s,o)=>{e=s,t=o}),resolve:e,reject:t}}function Kh(e){return{...td,...e||{}}}function nr(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:s,containerBounds:o}){const{x:a,y:i}=Jt(e),l=yr({x:a-(o?.left??0),y:i-(o?.top??0)},s),{x:c,y:d}=n?br(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const za=e=>({width:e.offsetWidth,height:e.offsetHeight}),ud=e=>e?.getRootNode?.()||window?.document,Uh=["INPUT","SELECT","TEXTAREA"];function fd(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Uh.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const hd=e=>"clientX"in e,Jt=(e,t)=>{const n=hd(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)}},cl=(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,...za(i)}})};function md({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,f=Math.abs(c-e),u=Math.abs(d-t);return[c,d,f,u]}function Kr(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function dl({pos:e,x1:t,y1:n,x2:s,y2:o,c:a}){switch(e){case we.Left:return[t-Kr(t-s,a),n];case we.Right:return[t+Kr(s-t,a),n];case we.Top:return[t,n-Kr(n-o,a)];case we.Bottom:return[t,n+Kr(o-n,a)]}}function pd({sourceX:e,sourceY:t,sourcePosition:n=we.Bottom,targetX:s,targetY:o,targetPosition:a=we.Top,curvature:i=.25}){const[l,c]=dl({pos:n,x1:e,y1:t,x2:s,y2:o,c:i}),[d,f]=dl({pos:a,x1:s,y1:o,x2:e,y2:t,c:i}),[u,h,m,g]=md({sourceX:e,sourceY:t,targetX:s,targetY:o,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${c} ${d},${f} ${s},${o}`,u,h,m,g]}function gd({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 Yh({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 Gh({sourceNode:e,targetNode:t,width:n,height:s,transform:o}){const a=So(mo(e),mo(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 dr(i,Co(a))>0}const Xh=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`xy-edge__${e}${t||""}-${n}${s||""}`,Zh=(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)),Qh=(e,t,n={})=>{if(!e.source||!e.target)return t;const s=n.getEdgeId||Xh;let o;return rd(e)?o={...e}:o={...e,id:s(e)},Zh(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function xd({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[o,a,i,l]=gd({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,o,a,i,l]}const ul={[we.Left]:{x:-1,y:0},[we.Right]:{x:1,y:0},[we.Top]:{x:0,y:-1},[we.Bottom]:{x:0,y:1}},Jh=({source:e,sourcePosition:t=we.Bottom,target:n})=>t===we.Left||t===we.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},fl=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function em({source:e,sourcePosition:t=we.Bottom,target:n,targetPosition:s=we.Top,center:o,offset:a,stepPosition:i}){const l=ul[t],c=ul[s],d={x:e.x+l.x*a,y:e.y+l.y*a},f={x:n.x+c.x*a,y:n.y+c.y*a},u=Jh({source:d,sourcePosition:t,target:f}),h=u.x!==0?"x":"y",m=u[h];let g=[],b,k;const v={x:0,y:0},y={x:0,y:0},[,,x,w]=gd({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(b=o.x??d.x+(f.x-d.x)*i,k=o.y??(d.y+f.y)/2):(b=o.x??(d.x+f.x)/2,k=o.y??d.y+(f.y-d.y)*i);const j=[{x:b,y:d.y},{x:b,y:f.y}],E=[{x:d.x,y:k},{x:f.x,y:k}];l[h]===m?g=h==="x"?j:E:g=h==="x"?E:j}else{const j=[{x:d.x,y:f.y}],E=[{x:f.x,y:d.y}];if(h==="x"?g=l.x===m?E:j:g=l.y===m?j:E,t===s){const D=Math.abs(e[h]-n[h]);if(D<=a){const z=Math.min(a-1,a-D);l[h]===m?v[h]=(d[h]>e[h]?-1:1)*z:y[h]=(f[h]>n[h]?-1:1)*z}}if(t!==s){const D=h==="x"?"y":"x",z=l[h]===c[D],I=d[D]>f[D],P=d[D]<f[D];(l[h]===1&&(!z&&I||z&&P)||l[h]!==1&&(!z&&P||z&&I))&&(g=h==="x"?j:E)}const S={x:d.x+v.x,y:d.y+v.y},R={x:f.x+y.x,y:f.y+y.y},$=Math.max(Math.abs(S.x-g[0].x),Math.abs(R.x-g[0].x)),M=Math.max(Math.abs(S.y-g[0].y),Math.abs(R.y-g[0].y));$>=M?(b=(S.x+R.x)/2,k=g[0].y):(b=g[0].x,k=(S.y+R.y)/2)}return[[e,{x:d.x+v.x,y:d.y+v.y},...g,{x:f.x+y.x,y:f.y+y.y},n],b,k,x,w]}function tm(e,t,n,s){const o=Math.min(fl(e,t)/2,fl(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,f=e.y<n.y?1:-1;return`L ${a+o*d},${i}Q ${a},${i} ${a},${i+o*f}`}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 wa({sourceX:e,sourceY:t,sourcePosition:n=we.Bottom,targetX:s,targetY:o,targetPosition:a=we.Top,borderRadius:i=5,centerX:l,centerY:c,offset:d=20,stepPosition:f=.5}){const[u,h,m,g,b]=em({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:o},targetPosition:a,center:{x:l,y:c},offset:d,stepPosition:f});return[u.reduce((v,y,x)=>{let w="";return x>0&&x<u.length-1?w=tm(u[x-1],y,u[x+1],i):w=`${x===0?"M":"L"}${y.x} ${y.y}`,v+=w,v},""),h,m,g,b]}function hl(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function nm(e){const{sourceNode:t,targetNode:n}=e;if(!hl(t)||!hl(n))return null;const s=t.internals.handleBounds||ml(t.handles),o=n.internals.handleBounds||ml(n.handles),a=pl(s?.source??[],e.sourceHandle),i=pl(e.connectionMode===Is.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!a||!i)return e.onError?.("008",an.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=a?.position||we.Bottom,c=i?.position||we.Top,d=ts(t,a,l),f=ts(n,i,c);return{sourceX:d.x,sourceY:d.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}function ml(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 ts(e,t,n=we.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??yn(e);if(s)return{x:o+i/2,y:a+l/2};switch(t?.position??n){case we.Top:return{x:o+i/2,y:a};case we.Right:return{x:o+i,y:a+l/2};case we.Bottom:return{x:o+i/2,y:a+l};case we.Left:return{x:o,y:a+l/2}}}function pl(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function ka(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`:""}function sm(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=ka(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 bd=1e3,rm=10,Fa={nodeOrigin:[0,0],nodeExtent:lr,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},om={...Fa,checkEquality:!0};function Ha(e,t){const n={...e};for(const s in t)t[s]!==void 0&&(n[s]=t[s]);return n}function am(e,t,n){const s=Ha(Fa,n);for(const o of e.values())if(o.parentId)Wa(o,e,t,s);else{const a=gr(o,s.nodeOrigin),i=Ls(o.extent)?o.extent:s.nodeExtent,l=es(a,i,yn(o));o.internals.positionAbsolute=l}}function im(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 Va(e){return e==="manual"}function va(e,t,n,s={}){const o=Ha(om,s),a={i:0},i=new Map(t),l=o?.elevateNodesOnSelect&&!Va(o.zIndexMode)?bd:0;let c=e.length>0;t.clear(),n.clear();for(const d of e){let f=i.get(d.id);if(o.checkEquality&&d===f?.internals.userNode)t.set(d.id,f);else{const u=gr(d,o.nodeOrigin),h=Ls(d.extent)?d.extent:o.nodeExtent,m=es(u,h,yn(d));f={...o.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:m,handleBounds:im(d,f),z:yd(d,l,o.zIndexMode),userNode:d}},t.set(d.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),d.parentId&&Wa(f,t,n,s,a)}return c}function lm(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 Wa(e,t,n,s,o){const{elevateNodesOnSelect:a,nodeOrigin:i,nodeExtent:l,zIndexMode:c}=Ha(Fa,s),d=e.parentId,f=t.get(d);if(!f){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}lm(e,n),o&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++o.i,f.internals.z=f.internals.z+o.i*rm),o&&f.internals.rootParentIndex!==void 0&&(o.i=f.internals.rootParentIndex);const u=a&&!Va(c)?bd:0,{x:h,y:m,z:g}=cm(e,f,i,l,u,c),{positionAbsolute:b}=e.internals,k=h!==b.x||m!==b.y;(k||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:k?{x:h,y:m}:b,z:g}})}function yd(e,t,n){const s=Qt(e.zIndex)?e.zIndex:0;return Va(n)?s:s+(e.selected?t:0)}function cm(e,t,n,s,o,a){const{x:i,y:l}=t.internals.positionAbsolute,c=yn(e),d=gr(e,n),f=Ls(e.extent)?es(d,e.extent,c):d;let u=es({x:i+f.x,y:l+f.y},s,c);e.extent==="parent"&&(u=ad(u,c,t));const h=yd(e,o,a),m=t.internals.z??0;return{x:u.x,y:u.y,z:m>=h?m+1:h}}function Ka(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??As(l),d=ld(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,f=yn(l),u=l.origin??s,h=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(f.width,Math.round(i.width)),b=Math.max(f.height,Math.round(i.height)),k=(g-f.width)*u[0],v=(b-f.height)*u[1];(h>0||m>0||k||v)&&(o.push({id:c,type:"position",position:{x:l.position.x-h+k,y:l.position.y-m+v}}),n.get(c)?.forEach(y=>{e.some(x=>x.id===y.id)||o.push({id:y.id,type:"position",position:{x:y.position.x+h,y:y.position.y+m}})})),(f.width<i.width||f.height<i.height||h||m)&&o.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(h?u[0]*h-k:0),height:b+(m?u[1]*m-v:0)}})}),o}function dm(e,t,n,s,o,a,i){const l=s?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],f=window.getComputedStyle(l),{m22:u}=new window.DOMMatrixReadOnly(f.transform),h=[];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 b=za(m.nodeElement),k=g.measured.width!==b.width||g.measured.height!==b.height;if(!!(b.width&&b.height&&(k||!g.internals.handleBounds||m.force))){const y=m.nodeElement.getBoundingClientRect(),x=Ls(g.extent)?g.extent:a;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=ad(w,b,t.get(g.parentId)):x&&(w=es(w,x,b));const C={...g,measured:b,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:cl("source",m.nodeElement,y,u,g.id),target:cl("target",m.nodeElement,y,u,g.id)}}};t.set(g.id,C),g.parentId&&Wa(C,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,k&&(d.push({id:g.id,type:"dimensions",dimensions:b}),g.expandParent&&g.parentId&&h.push({id:g.id,parentId:g.parentId,rect:As(C,o)}))}}if(h.length>0){const m=Ka(h,t,n,o);d.push(...m)}return{changes:d,updatedInternals:c}}async function um({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 gl(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 wd(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}`,f=`${a}-${l}--${o}-${i}`;gl("source",c,f,e,o,i),gl("target",c,d,e,a,l),t.set(s.id,s)}}function kd(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:kd(n,t):!1}function xl(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 fm(e,t,n,s){const o=new Map;for(const[a,i]of e)if((i.selected||i.id===s)&&(!i.parentId||!kd(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 ea({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 hm({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=br(a,t);return{x:i.x-a.x,y:i.y-a.y}}function mm({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},f=null,u=!1,h=null,m=!1,g=!1,b=null;function k({noDragClassName:y,handleSelector:x,domNode:w,isSelectable:C,nodeId:j,nodeClickDistance:E=0}){h=zt(w);function S({x:D,y:z}){const{nodeLookup:I,nodeExtent:P,snapGrid:L,snapToGrid:B,nodeOrigin:_,onNodeDrag:q,onSelectionDrag:H,onError:K,updateNodePositions:O}=t();a={x:D,y:z};let U=!1;const A=l.size>1,T=A&&P?ya(xr(l)):null,V=A&&B?hm({dragItems:l,snapGrid:L,x:D,y:z}):null;for(const[W,F]of l){if(!I.has(W))continue;let Z={x:D-F.distance.x,y:z-F.distance.y};B&&(Z=V?{x:Math.round(Z.x+V.x),y:Math.round(Z.y+V.y)}:br(Z,L));let se=null;if(A&&P&&!F.extent&&T){const{positionAbsolute:pe}=F.internals,je=pe.x-T.x+P[0][0],Se=pe.x+F.measured.width-T.x2+P[1][0],Ne=pe.y-T.y+P[0][1],Be=pe.y+F.measured.height-T.y2+P[1][1];se=[[je,Ne],[Se,Be]]}const{position:ue,positionAbsolute:ie}=od({nodeId:W,nextPosition:Z,nodeLookup:I,nodeExtent:se||P,nodeOrigin:_,onError:K});U=U||F.position.x!==ue.x||F.position.y!==ue.y,F.position=ue,F.internals.positionAbsolute=ie}if(g=g||U,!!U&&(O(l,!0),b&&(s||q||!j&&H))){const[W,F]=ea({nodeId:j,dragItems:l,nodeLookup:I});s?.(b,l,W,F),q?.(b,W,F),j||H?.(b,F)}}async function R(){if(!f)return;const{transform:D,panBy:z,autoPanSpeed:I,autoPanOnNodeDrag:P}=t();if(!P){c=!1,cancelAnimationFrame(i);return}const[L,B]=id(d,f,I);(L!==0||B!==0)&&(a.x=(a.x??0)-L/D[2],a.y=(a.y??0)-B/D[2],await z({x:L,y:B})&&S(a)),i=requestAnimationFrame(R)}function $(D){const{nodeLookup:z,multiSelectionActive:I,nodesDraggable:P,transform:L,snapGrid:B,snapToGrid:_,selectNodesOnDrag:q,onNodeDragStart:H,onSelectionDragStart:K,unselectNodesAndEdges:O}=t();u=!0,(!q||!C)&&!I&&j&&(z.get(j)?.selected||O()),C&&q&&j&&e?.(j);const U=nr(D.sourceEvent,{transform:L,snapGrid:B,snapToGrid:_,containerBounds:f});if(a=U,l=fm(z,P,U,j),l.size>0&&(n||H||!j&&K)){const[A,T]=ea({nodeId:j,dragItems:l,nodeLookup:z});n?.(D.sourceEvent,l,A,T),H?.(D.sourceEvent,A,T),j||K?.(D.sourceEvent,T)}}const M=Kc().clickDistance(E).on("start",D=>{const{domNode:z,nodeDragThreshold:I,transform:P,snapGrid:L,snapToGrid:B}=t();f=z?.getBoundingClientRect()||null,m=!1,g=!1,b=D.sourceEvent,I===0&&$(D),a=nr(D.sourceEvent,{transform:P,snapGrid:L,snapToGrid:B,containerBounds:f}),d=Jt(D.sourceEvent,f)}).on("drag",D=>{const{autoPanOnNodeDrag:z,transform:I,snapGrid:P,snapToGrid:L,nodeDragThreshold:B,nodeLookup:_}=t(),q=nr(D.sourceEvent,{transform:I,snapGrid:P,snapToGrid:L,containerBounds:f});if(b=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||j&&!_.has(j))&&(m=!0),!m){if(!c&&z&&u&&(c=!0,R()),!u){const H=Jt(D.sourceEvent,f),K=H.x-d.x,O=H.y-d.y;Math.sqrt(K*K+O*O)>B&&$(D)}(a.x!==q.xSnapped||a.y!==q.ySnapped)&&l&&u&&(d=Jt(D.sourceEvent,f),S(q))}}).on("end",D=>{if(!(!u||m)&&(c=!1,u=!1,cancelAnimationFrame(i),l.size>0)){const{nodeLookup:z,updateNodePositions:I,onNodeDragStop:P,onSelectionDragStop:L}=t();if(g&&(I(l,!1),g=!1),o||P||!j&&L){const[B,_]=ea({nodeId:j,dragItems:l,nodeLookup:z,dragging:!1});o?.(D.sourceEvent,l,B,_),P?.(D.sourceEvent,B,_),j||L?.(D.sourceEvent,_)}}}).filter(D=>{const z=D.target;return!D.button&&(!y||!xl(z,`.${y}`,w))&&(!x||xl(z,x,w))});h.call(M)}function v(){h?.on(".drag",null)}return{update:k,destroy:v}}function pm(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())dr(o,As(a))>0&&s.push(a);return s}const gm=250;function xm(e,t,n,s){let o=[],a=1/0;const i=pm(e,n,t+gm);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:f,y:u}=ts(l,d,d.position,!0),h=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(u-e.y,2));h>t||(h<a?(o=[{...d,x:f,y:u}],a=h):h===a&&o.push({...d,x:f,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 vd(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,...ts(i,c,c.position,!0)}:c}function jd(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function bm(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Nd=()=>!0;function ym(e,{connectionMode:t,connectionRadius:n,handleId:s,nodeId:o,edgeUpdaterType:a,isTarget:i,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:f,flowId:u,panBy:h,cancelConnection:m,onConnectStart:g,onConnect:b,onConnectEnd:k,isValidConnection:v=Nd,onReconnectEnd:y,updateConnection:x,getTransform:w,getFromHandle:C,autoPanSpeed:j,dragThreshold:E=1,handleDomNode:S}){const R=ud(e.target);let $=0,M;const{x:D,y:z}=Jt(e),I=jd(a,S),P=l?.getBoundingClientRect();let L=!1;if(!P||!I)return;const B=vd(o,I,s,c,t);if(!B)return;let _=Jt(e,P),q=!1,H=null,K=!1,O=null;function U(){if(!f||!P)return;const[ue,ie]=id(_,P,j);h({x:ue,y:ie}),$=requestAnimationFrame(U)}const A={...B,nodeId:o,type:I,position:B.position},T=c.get(o);let W={inProgress:!0,isValid:null,from:ts(T,A,we.Left,!0),fromHandle:A,fromPosition:A.position,fromNode:T,to:_,toHandle:null,toPosition:ol[A.position],toNode:null,pointer:_};function F(){L=!0,x(W),g?.(e,{nodeId:o,handleId:s,handleType:I})}E===0&&F();function Z(ue){if(!L){const{x:Be,y:$e}=Jt(ue),Ie=Be-D,Ve=$e-z;if(!(Ie*Ie+Ve*Ve>E*E))return;F()}if(!C()||!A){se(ue);return}const ie=w();_=Jt(ue,P),M=xm(yr(_,ie,!1,[1,1]),n,c,A),q||(U(),q=!0);const pe=Sd(ue,{handle:M,connectionMode:t,fromNodeId:o,fromHandleId:s,fromType:i?"target":"source",isValidConnection:v,doc:R,lib:d,flowId:u,nodeLookup:c});O=pe.handleDomNode,H=pe.connection,K=bm(!!M,pe.isValid);const je=c.get(o),Se=je?ts(je,A,we.Left,!0):W.from,Ne={...W,from:Se,isValid:K,to:pe.toHandle&&K?po({x:pe.toHandle.x,y:pe.toHandle.y},ie):_,toHandle:pe.toHandle,toPosition:K&&pe.toHandle?pe.toHandle.position:ol[A.position],toNode:pe.toHandle?c.get(pe.toHandle.nodeId):null,pointer:_};x(Ne),W=Ne}function se(ue){if(!("touches"in ue&&ue.touches.length>0)){if(L){(M||O)&&H&&K&&b?.(H);const{inProgress:ie,...pe}=W,je={...pe,toPosition:W.toHandle?W.toPosition:null};k?.(ue,je),a&&y?.(ue,je)}m(),cancelAnimationFrame($),q=!1,K=!1,H=null,O=null,R.removeEventListener("mousemove",Z),R.removeEventListener("mouseup",se),R.removeEventListener("touchmove",Z),R.removeEventListener("touchend",se)}}R.addEventListener("mousemove",Z),R.addEventListener("mouseup",se),R.addEventListener("touchmove",Z),R.addEventListener("touchend",se)}function Sd(e,{handle:t,connectionMode:n,fromNodeId:s,fromHandleId:o,fromType:a,doc:i,lib:l,flowId:c,isValidConnection:d=Nd,nodeLookup:f}){const u=a==="target",h=t?i.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:m,y:g}=Jt(e),b=i.elementFromPoint(m,g),k=b?.classList.contains(`${l}-flow__handle`)?b:h,v={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const y=jd(void 0,k),x=k.getAttribute("data-nodeid"),w=k.getAttribute("data-handleid"),C=k.classList.contains("connectable"),j=k.classList.contains("connectableend");if(!x||!y)return v;const E={source:u?x:s,sourceHandle:u?w:o,target:u?s:x,targetHandle:u?o:w};v.connection=E;const R=C&&j&&(n===Is.Strict?u&&y==="source"||!u&&y==="target":x!==s||w!==o);v.isValid=R&&d(E),v.toHandle=vd(x,y,w,f,n,!0)}return v}const ja={onPointerDown:ym,isValid:Sd};function wm({domNode:e,panZoom:t,getTransform:n,getViewScale:s}){const o=zt(e);function a({translateExtent:l,width:c,height:d,zoomStep:f=1,pannable:u=!0,zoomable:h=!0,inversePan:m=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const w=n(),C=x.sourceEvent.ctrlKey&&ur()?10:1,j=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*f,E=w[2]*Math.pow(2,j*C);t.scaleTo(E)};let b=[0,0];const k=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(b=[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 C=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],j=[C[0]-b[0],C[1]-b[1]];b=C;const E=s()*Math.max(w[2],Math.log(w[2]))*(m?-1:1),S={x:w[0]-j[0]*E,y:w[1]-j[1]*E},R=[[0,0],[c,d]];t.setViewportConstrained({x:S.x,y:S.y,zoom:w[2]},R,l)},y=Uc().on("start",k).on("zoom",u?v:null).on("zoom.wheel",h?g:null);o.call(y,{})}function i(){o.on("zoom",null)}return{update:a,destroy:i,pointer:Zt}}const Eo=e=>({x:e.x,y:e.y,zoom:e.k}),ta=({x:e,y:t,zoom:n})=>$a.translate(e,t).scale(n),ys=(e,t)=>e.target.closest(`.${t}`),Cd=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),km=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,na=(e,t=0,n=km,s=()=>{})=>{const o=typeof t=="number"&&t>0;return o||s(),o?e.transition().duration(t).ease(n).on("end",s):e},Ed=e=>{const t=e.ctrlKey&&ur()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function vm({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:s,panOnScrollMode:o,panOnScrollSpeed:a,zoomOnPinch:i,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return f=>{if(ys(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&i){const k=Zt(f),v=Ed(f),y=u*Math.pow(2,v);s.scaleTo(n,y,k,f);return}const h=f.deltaMode===1?20:1;let m=o===Jn.Vertical?0:f.deltaX*h,g=o===Jn.Horizontal?0:f.deltaY*h;!ur()&&f.shiftKey&&o!==Jn.Vertical&&(m=f.deltaY*h,g=0),s.translateBy(n,-(m/u)*a,-(g/u)*a,{internal:!0});const b=Eo(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(f,b),e.panScrollTimeout=setTimeout(()=>{d?.(f,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(f,b))}}function jm({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(s,o){const a=s.type==="wheel",i=!t&&a&&!s.ctrlKey,l=ys(s,e);if(s.ctrlKey&&a&&l&&s.preventDefault(),i||l)return null;s.preventDefault(),n.call(this,s,o)}}function Nm({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return s=>{if(s.sourceEvent?.internal)return;const o=Eo(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 Sm({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:s,onPanZoom:o}){return a=>{e.usedRightMouseButton=!!(n&&Cd(t,e.mouseButton??0)),a.sourceEvent?.sync||s([a.transform.x,a.transform.y,a.transform.k]),o&&!a.sourceEvent?.internal&&o?.(a.sourceEvent,Eo(a.transform))}}function Cm({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:s,onPanZoomEnd:o,onPaneContextMenu:a}){return i=>{if(!i.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Cd(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&a(i.sourceEvent),e.usedRightMouseButton=!1,s(!1),o)){const l=Eo(i.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(i.sourceEvent,l)},n?150:0)}}}function Em({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:s,panOnScroll:o,zoomOnDoubleClick:a,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:f}){return u=>{const h=e||t,m=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(ys(u,`${d}-flow__node`)||ys(u,`${d}-flow__edge`)))return!0;if(!s&&!h&&!o&&!a&&!n||i||f&&!g||ys(u,l)&&g||ys(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(!h&&!o&&!m&&g||!s&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(s)&&!s.includes(u.button)&&u.type==="mousedown")return!1;const b=Array.isArray(s)&&s.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&b}}function Im({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},f=e.getBoundingClientRect(),u=Uc().scaleExtent([t,n]).translateExtent(s),h=zt(e).call(u);y({x:o.x,y:o.y,zoom:Ms(o.zoom,t,n)},[[0,0],[f.width,f.height]],s);const m=h.on("wheel.zoom"),g=h.on("dblclick.zoom");u.wheelDelta(Ed);function b(M,D){return h?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?Zo:ao).transform(na(h,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function k({noWheelClassName:M,noPanClassName:D,onPaneContextMenu:z,userSelectionActive:I,panOnScroll:P,panOnDrag:L,panOnScrollMode:B,panOnScrollSpeed:_,preventScrolling:q,zoomOnPinch:H,zoomOnScroll:K,zoomOnDoubleClick:O,zoomActivationKeyPressed:U,lib:A,onTransformChange:T,connectionInProgress:V,paneClickDistance:W,selectionOnDrag:F}){I&&!d.isZoomingOrPanning&&v();const Z=P&&!U&&!I;u.clickDistance(F?1/0:!Qt(W)||W<0?0:W);const se=Z?vm({zoomPanValues:d,noWheelClassName:M,d3Selection:h,d3Zoom:u,panOnScrollMode:B,panOnScrollSpeed:_,zoomOnPinch:H,onPanZoomStart:i,onPanZoom:a,onPanZoomEnd:l}):jm({noWheelClassName:M,preventScrolling:q,d3ZoomHandler:m});if(h.on("wheel.zoom",se,{passive:!1}),!I){const ie=Nm({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:i});u.on("start",ie);const pe=Sm({zoomPanValues:d,panOnDrag:L,onPaneContextMenu:!!z,onPanZoom:a,onTransformChange:T});u.on("zoom",pe);const je=Cm({zoomPanValues:d,panOnDrag:L,panOnScroll:P,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:c});u.on("end",je)}const ue=Em({zoomActivationKeyPressed:U,panOnDrag:L,zoomOnScroll:K,panOnScroll:P,zoomOnDoubleClick:O,zoomOnPinch:H,userSelectionActive:I,noPanClassName:D,noWheelClassName:M,lib:A,connectionInProgress:V});u.filter(ue),O?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function v(){u.on("zoom",null)}async function y(M,D,z){const I=ta(M),P=u?.constrain()(I,D,z);return P&&await b(P),new Promise(L=>L(P))}async function x(M,D){const z=ta(M);return await b(z,D),new Promise(I=>I(z))}function w(M){if(h){const D=ta(M),z=h.property("__zoom");(z.k!==M.zoom||z.x!==M.x||z.y!==M.y)&&u?.transform(h,D,null,{sync:!0})}}function C(){const M=h?rh(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function j(M,D){return h?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?Zo:ao).scaleTo(na(h,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function E(M,D){return h?new Promise(z=>{u?.interpolate(D?.interpolate==="linear"?Zo:ao).scaleBy(na(h,D?.duration,D?.ease,()=>z(!0)),M)}):Promise.resolve(!1)}function S(M){u?.scaleExtent(M)}function R(M){u?.translateExtent(M)}function $(M){const D=!Qt(M)||M<0?0:M;u?.clickDistance(D)}return{update:k,destroy:v,setViewport:x,setViewportConstrained:y,getViewport:C,scaleTo:j,scaleBy:E,setScaleExtent:S,setTranslateExtent:R,syncViewport:w,setClickDistance:$}}var _s;(function(e){e.Line="line",e.Handle="handle"})(_s||(_s={}));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 bl(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 Cn(e,t){return Math.max(0,t-e)}function En(e,t){return Math.max(0,e-t)}function Ur(e,t,n){return Math.max(0,t-e,e-n)}function yl(e,t){return e?!t:t}function Mm(e,t,n,s,o,a,i,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:f,isVertical:u}=t,h=f&&u,{xSnapped:m,ySnapped:g}=n,{minWidth:b,maxWidth:k,minHeight:v,maxHeight:y}=s,{x,y:w,width:C,height:j,aspectRatio:E}=e;let S=Math.floor(f?m-e.pointerX:0),R=Math.floor(u?g-e.pointerY:0);const $=C+(c?-S:S),M=j+(d?-R:R),D=-a[0]*C,z=-a[1]*j;let I=Ur($,b,k),P=Ur(M,v,y);if(i){let _=0,q=0;c&&S<0?_=Cn(x+S+D,i[0][0]):!c&&S>0&&(_=En(x+$+D,i[1][0])),d&&R<0?q=Cn(w+R+z,i[0][1]):!d&&R>0&&(q=En(w+M+z,i[1][1])),I=Math.max(I,_),P=Math.max(P,q)}if(l){let _=0,q=0;c&&S>0?_=En(x+S,l[0][0]):!c&&S<0&&(_=Cn(x+$,l[1][0])),d&&R>0?q=En(w+R,l[0][1]):!d&&R<0&&(q=Cn(w+M,l[1][1])),I=Math.max(I,_),P=Math.max(P,q)}if(o){if(f){const _=Ur($/E,v,y)*E;if(I=Math.max(I,_),i){let q=0;!c&&!d||c&&!d&&h?q=En(w+z+$/E,i[1][1])*E:q=Cn(w+z+(c?S:-S)/E,i[0][1])*E,I=Math.max(I,q)}if(l){let q=0;!c&&!d||c&&!d&&h?q=Cn(w+$/E,l[1][1])*E:q=En(w+(c?S:-S)/E,l[0][1])*E,I=Math.max(I,q)}}if(u){const _=Ur(M*E,b,k)/E;if(P=Math.max(P,_),i){let q=0;!c&&!d||d&&!c&&h?q=En(x+M*E+D,i[1][0])/E:q=Cn(x+(d?R:-R)*E+D,i[0][0])/E,P=Math.max(P,q)}if(l){let q=0;!c&&!d||d&&!c&&h?q=Cn(x+M*E,l[1][0])/E:q=En(x+(d?R:-R)*E,l[0][0])/E,P=Math.max(P,q)}}}R=R+(R<0?P:-P),S=S+(S<0?I:-I),o&&(h?$>M*E?R=(yl(c,d)?-S:S)/E:S=(yl(c,d)?-R:R)*E:f?(R=S/E,d=c):(S=R*E,c=d));const L=c?x+S:x,B=d?w+R:w;return{width:C+(c?-S:S),height:j+(d?-R:R),x:a[0]*S*(c?-1:1)+L,y:a[1]*R*(d?-1:1)+B}}const Id={width:0,height:0,x:0,y:0},Am={...Id,pointerX:0,pointerY:0,aspectRatio:1};function Lm(e){return[[0,0],[e.measured.width,e.measured.height]]}function _m(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 Rm({domNode:e,nodeId:t,getStoreItems:n,onChange:s,onEnd:o}){const a=zt(e);let i={controlDirection:bl("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:f,keepAspectRatio:u,resizeDirection:h,onResizeStart:m,onResize:g,onResizeEnd:b,shouldResize:k}){let v={...Id},y={...Am};i={boundaries:f,resizeDirection:h,keepAspectRatio:u,controlDirection:bl(d)};let x,w=null,C=[],j,E,S,R=!1;const $=Kc().on("start",M=>{const{nodeLookup:D,transform:z,snapGrid:I,snapToGrid:P,nodeOrigin:L,paneDomNode:B}=n();if(x=D.get(t),!x)return;w=B?.getBoundingClientRect()??null;const{xSnapped:_,ySnapped:q}=nr(M.sourceEvent,{transform:z,snapGrid:I,snapToGrid:P,containerBounds:w});v={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},y={...v,pointerX:_,pointerY:q,aspectRatio:v.width/v.height},j=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(j=D.get(x.parentId),E=j&&x.extent==="parent"?Lm(j):void 0),C=[],S=void 0;for(const[H,K]of D)if(K.parentId===t&&(C.push({id:H,position:{...K.position},extent:K.extent}),K.extent==="parent"||K.expandParent)){const O=_m(K,x,K.origin??L);S?S=[[Math.min(O[0][0],S[0][0]),Math.min(O[0][1],S[0][1])],[Math.max(O[1][0],S[1][0]),Math.max(O[1][1],S[1][1])]]:S=O}m?.(M,{...v})}).on("drag",M=>{const{transform:D,snapGrid:z,snapToGrid:I,nodeOrigin:P}=n(),L=nr(M.sourceEvent,{transform:D,snapGrid:z,snapToGrid:I,containerBounds:w}),B=[];if(!x)return;const{x:_,y:q,width:H,height:K}=v,O={},U=x.origin??P,{width:A,height:T,x:V,y:W}=Mm(y,i.controlDirection,L,i.boundaries,i.keepAspectRatio,U,E,S),F=A!==H,Z=T!==K,se=V!==_&&F,ue=W!==q&&Z;if(!se&&!ue&&!F&&!Z)return;if((se||ue||U[0]===1||U[1]===1)&&(O.x=se?V:v.x,O.y=ue?W:v.y,v.x=O.x,v.y=O.y,C.length>0)){const Se=V-_,Ne=W-q;for(const Be of C)Be.position={x:Be.position.x-Se+U[0]*(A-H),y:Be.position.y-Ne+U[1]*(T-K)},B.push(Be)}if((F||Z)&&(O.width=F&&(!i.resizeDirection||i.resizeDirection==="horizontal")?A:v.width,O.height=Z&&(!i.resizeDirection||i.resizeDirection==="vertical")?T:v.height,v.width=O.width,v.height=O.height),j&&x.expandParent){const Se=U[0]*(O.width??0);O.x&&O.x<Se&&(v.x=Se,y.x=y.x-(O.x-Se));const Ne=U[1]*(O.height??0);O.y&&O.y<Ne&&(v.y=Ne,y.y=y.y-(O.y-Ne))}const ie=Tm({width:v.width,prevWidth:H,height:v.height,prevHeight:K,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),pe={...v,direction:ie};k?.(M,pe)!==!1&&(R=!0,g?.(M,pe),s(O,B))}).on("end",M=>{R&&(b?.(M,{...v}),o?.({...v}),R=!1)});a.call($)}function c(){a.on(".drag",null)}return{update:l,destroy:c}}var sa={exports:{}},ra={};var wl;function Dm(){if(wl)return ra;wl=1;var e=Mf(),t=Af();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}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 ra.useSyncExternalStoreWithSelector=function(d,f,u,h,m){var g=a(null);if(g.current===null){var b={hasValue:!1,value:null};g.current=b}else b=g.current;g=l(function(){function v(j){if(!y){if(y=!0,x=j,j=h(j),m!==void 0&&b.hasValue){var E=b.value;if(m(E,j))return w=E}return w=j}if(E=w,s(x,j))return E;var S=h(j);return m!==void 0&&m(E,S)?(x=j,E):(x=j,w=S)}var y=!1,x,w,C=u===void 0?null:u;return[function(){return v(f())},C===null?void 0:function(){return v(C())}]},[f,u,h,m]);var k=o(d,g[0],g[1]);return i(function(){b.hasValue=!0,b.value=k},[k]),c(k),k},ra}var kl;function Om(){return kl||(kl=1,sa.exports=Dm()),sa.exports}var $m=Om();const Pm=Lf($m),Bm={},vl=e=>{let t;const n=new Set,s=(f,u)=>{const h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){const m=t;t=u??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,m))}},o=()=>t,c={setState:s,getState:o,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Bm?"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},qm=e=>e?vl(e):vl,{useDebugValue:zm}=_f,{useSyncExternalStoreWithSelector:Fm}=Pm,Hm=e=>e;function Td(e,t=Hm,n){const s=Fm(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return zm(s),s}const jl=(e,t)=>{const n=qm(e),s=(o,a=t)=>Td(n,o,a);return Object.assign(s,n),s},Vm=(e,t)=>e?jl(e,t):jl;function ut(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 Io=p.createContext(null),Wm=Io.Provider,Md=an.error001();function Ue(e,t){const n=p.useContext(Io);if(n===null)throw new Error(Md);return Td(n,e,t)}function lt(){const e=p.useContext(Io);if(e===null)throw new Error(Md);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Nl={display:"none"},Km={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ad="react-flow__node-desc",Ld="react-flow__edge-desc",Um="react-flow__aria-live",Ym=e=>e.ariaLiveMessage,Gm=e=>e.ariaLabelConfig;function Xm({rfId:e}){const t=Ue(Ym);return r.jsx("div",{id:`${Um}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Km,children:t})}function Zm({rfId:e,disableKeyboardA11y:t}){const n=Ue(Gm);return r.jsxs(r.Fragment,{children:[r.jsx("div",{id:`${Ad}-${e}`,style:Nl,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),r.jsx("div",{id:`${Ld}-${e}`,style:Nl,children:n["edge.a11yDescription.default"]}),!t&&r.jsx(Xm,{rfId:e})]})}const To=p.forwardRef(({position:e="top-left",children:t,className:n,style:s,...o},a)=>{const i=`${e}`.split("-");return r.jsx("div",{className:Nt(["react-flow__panel",n,...i]),style:s,ref:a,...o,children:t})});To.displayName="Panel";function Qm({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:r.jsx(To,{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 Jm=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}},Yr=e=>e.id;function ep(e,t){return ut(e.selectedNodes.map(Yr),t.selectedNodes.map(Yr))&&ut(e.selectedEdges.map(Yr),t.selectedEdges.map(Yr))}function tp({onSelectionChange:e}){const t=lt(),{selectedNodes:n,selectedEdges:s}=Ue(Jm,ep);return p.useEffect(()=>{const o={nodes:n,edges:s};e?.(o),t.getState().onSelectionChangeHandlers.forEach(a=>a(o))},[n,s,e]),null}const np=e=>!!e.onSelectionChangeHandlers;function sp({onSelectionChange:e}){const t=Ue(np);return e||t?r.jsx(tp,{onSelectionChange:e}):null}const _d=[0,0],rp={x:0,y:0,zoom:1},op=["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"],Sl=[...op,"rfId"],ap=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}),Cl={translateExtent:lr,nodeOrigin:_d,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ip(e){const{setNodes:t,setEdges:n,setMinZoom:s,setMaxZoom:o,setTranslateExtent:a,setNodeExtent:i,reset:l,setDefaultNodesAndEdges:c}=Ue(ap,ut),d=lt();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=Cl,l()}),[]);const f=p.useRef(Cl);return p.useEffect(()=>{for(const u of Sl){const h=e[u],m=f.current[u];h!==m&&(typeof e[u]>"u"||(u==="nodes"?t(h):u==="edges"?n(h):u==="minZoom"?s(h):u==="maxZoom"?o(h):u==="translateExtent"?a(h):u==="nodeExtent"?i(h):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:Kh(h)}):u==="fitView"?d.setState({fitViewQueued:h}):u==="fitViewOptions"?d.setState({fitViewOptions:h}):d.setState({[u]:h})))}f.current=e},Sl.map(u=>e[u])),null}function El(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function lp(e){const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const s=El(),o=()=>n(s?.matches?"dark":"light");return o(),s?.addEventListener("change",o),()=>{s?.removeEventListener("change",o)}},[e]),t!==null?t:El()?.matches?"dark":"light"}const Il=typeof document<"u"?document:null;function fr(e=null,t={target:Il,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-BSghRCEC.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-MkJR6w4B.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};