@alepha/devtools 0.13.7 → 0.13.8

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 (42) hide show
  1. package/assets/devtools/asset.BZV40eAE.css +1 -0
  2. package/assets/devtools/asset.Bhpm0ujk.css +1 -0
  3. package/assets/devtools/chunk.17gtbQUO.js +1 -0
  4. package/assets/devtools/chunk.1mem8WHh.js +1 -0
  5. package/assets/devtools/chunk.B0aYes_4.js +1 -0
  6. package/assets/devtools/chunk.BULoWCgJ.js +7 -0
  7. package/assets/devtools/chunk.BYrPfJRg.js +1 -0
  8. package/assets/devtools/chunk.BjFrJKj1.js +1 -0
  9. package/assets/devtools/chunk.BlqFPyLh.js +1 -0
  10. package/assets/devtools/chunk.BmJ7-uBd.js +1 -0
  11. package/assets/devtools/chunk.BzE7YYkj.js +6 -0
  12. package/assets/devtools/chunk.C49FcqzR.js +1 -0
  13. package/assets/devtools/chunk.CBGZOsrp.js +9 -0
  14. package/assets/devtools/chunk.CHRbA_gU.js +1 -0
  15. package/assets/devtools/chunk.Ct58VlQl.js +1 -0
  16. package/assets/devtools/chunk.Cw2RCl4F.js +1 -0
  17. package/assets/devtools/chunk.CyQeq1kA.js +1 -0
  18. package/assets/devtools/chunk.CzbujtK7.js +1 -0
  19. package/assets/devtools/chunk.DA9XnVAa.js +1 -0
  20. package/assets/devtools/chunk.DEUHUxKv.js +1 -0
  21. package/assets/devtools/chunk.DGW-W4Kc.js +1 -0
  22. package/assets/devtools/chunk.DHWcJNNS.js +1 -0
  23. package/assets/devtools/chunk.DIfRZc20.js +1 -0
  24. package/assets/devtools/chunk.DJJIo7HU.js +1 -0
  25. package/assets/devtools/chunk.DJOi4_So.js +1 -0
  26. package/assets/devtools/chunk.DR0SHXXd.js +1 -0
  27. package/assets/devtools/chunk.DinJSUfH.js +1 -0
  28. package/assets/devtools/chunk.DooL4OcT.js +1 -0
  29. package/assets/devtools/chunk.Dry2LXOT.js +1 -0
  30. package/assets/devtools/chunk.IVvrfXp1.js +1 -0
  31. package/assets/devtools/chunk.OlMI8g2F.js +1 -0
  32. package/assets/devtools/chunk.Pj_uCbSv.js +1 -0
  33. package/assets/devtools/chunk.RTodzvo0.js +2 -0
  34. package/assets/devtools/chunk.YXYL4YAO.js +2 -0
  35. package/assets/devtools/chunk.fpKvkQeU.js +1 -0
  36. package/assets/devtools/chunk.qDx9cjbN.js +1 -0
  37. package/assets/devtools/chunk.rJToME5k.js +1 -0
  38. package/assets/devtools/chunk.rohGhT-A.js +1 -0
  39. package/assets/devtools/chunk.uyVen0u2.js +1 -0
  40. package/assets/devtools/entry.BY4L2Uc6.js +75 -0
  41. package/assets/devtools/index.html +11 -0
  42. package/package.json +15 -15
@@ -0,0 +1,7 @@
1
+ import{f as za,b as Aa,q as $a,s as Pa,$ as Da,j as y,B as qe,ak as Ta,a1 as Ha,w as Pe,al as Tr,am as ja,an as Ra,r as P,F as fe,ad as ye,ae as La,z as Oa,W as Hr,a4 as jn,a9 as Ye,a7 as Va,H as $e,T as se,ag as Ba,ac as No,Y as Fa,Z as Xa,a6 as Ya,ao as Wa}from"./entry.BY4L2Uc6.js";import{d as Za}from"./chunk.Cw2RCl4F.js";import{S as Mo}from"./chunk.BmJ7-uBd.js";import{S as qa,C as Ga,I as Ua,a as Ka,b as Qa}from"./chunk.CzbujtK7.js";import{B as Ke,S as ft}from"./chunk.Dry2LXOT.js";import{D as _n}from"./chunk.fpKvkQeU.js";import{I as Ja}from"./chunk.BYrPfJRg.js";import"./chunk.uyVen0u2.js";import"./chunk.qDx9cjbN.js";import"./chunk.BjFrJKj1.js";var jr={root:"m_66836ed3",wrapper:"m_a5d60502",body:"m_667c2793",title:"m_6a03f287",label:"m_698f4f23",icon:"m_667f2a6a",message:"m_7fa78076",closeButton:"m_87f54839"};const ec=Pa((e,{radius:t,color:n,variant:o,autoContrast:r})=>{const i=e.variantColorResolver({color:n||e.primaryColor,theme:e,variant:o||"light",autoContrast:r});return{root:{"--alert-radius":t===void 0?void 0:Ha(t),"--alert-bg":n||o?i.background:void 0,"--alert-color":i.color,"--alert-bd":n||o?i.border:void 0}}}),Qn=za((e,t)=>{const n=Aa("Alert",null,e),{classNames:o,className:r,style:i,styles:s,unstyled:a,vars:l,radius:c,color:u,title:d,children:f,id:g,icon:p,withCloseButton:m,onClose:v,closeButtonLabel:x,variant:_,autoContrast:h,role:w,attributes:C,...E}=n,S=$a({name:"Alert",classes:jr,props:n,className:r,style:i,classNames:o,styles:s,unstyled:a,attributes:C,vars:l,varsResolver:ec}),M=Da(g),z=d&&`${M}-title`||void 0,O=`${M}-body`;return y.jsx(qe,{id:M,...S("root",{variant:_}),variant:_,ref:t,role:w||"alert",...E,"aria-describedby":f?O:void 0,"aria-labelledby":d?z:void 0,children:y.jsxs("div",{...S("wrapper"),children:[p&&y.jsx("div",{...S("icon"),children:p}),y.jsxs("div",{...S("body"),children:[d&&y.jsx("div",{...S("title"),"data-with-close-button":m||void 0,children:y.jsx("span",{id:z,...S("label"),children:d})}),f&&y.jsx("div",{id:O,...S("message"),"data-variant":_,children:f})]}),m&&y.jsx(Ta,{...S("closeButton"),onClick:v,variant:"transparent",size:16,iconSize:16,"aria-label":x,unstyled:a})]})})});Qn.classes=jr;Qn.displayName="@mantine/core/Alert";const tc=[["path",{d:"M7 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M17 17v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-10a2 2 0 0 1 2 -2h2",key:"svg-1"}]],nc=Pe("outline","box-multiple","BoxMultiple",tc);const oc=[["path",{d:"M12 3l8 4.5l0 9l-8 4.5l-8 -4.5l0 -9l8 -4.5",key:"svg-0"}],["path",{d:"M12 12l8 -4.5",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}],["path",{d:"M12 12l-8 -4.5",key:"svg-3"}]],Rr=Pe("outline","box","Box",oc);const rc=[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 11l5 5l5 -5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]],ic=Pe("outline","download","Download",rc);const sc=[["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-1"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-3"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-4"}]],ac=Pe("outline","focus-centered","FocusCentered",sc);const cc=[["path",{d:"M4 4l16 0",key:"svg-0"}],["path",{d:"M4 20l16 0",key:"svg-1"}],["path",{d:"M6 9m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z",key:"svg-2"}]],lc=Pe("outline","layout-distribute-horizontal","LayoutDistributeHorizontal",cc);const uc=[["path",{d:"M4 4l0 16",key:"svg-0"}],["path",{d:"M20 4l0 16",key:"svg-1"}],["path",{d:"M9 6m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z",key:"svg-2"}]],dc=Pe("outline","layout-distribute-vertical","LayoutDistributeVertical",uc);const fc=[["path",{d:"M5 11m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M12 16m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-5a4 4 0 0 1 8 0",key:"svg-2"}]],hc=Pe("outline","lock-open","LockOpen",fc);const gc=[["path",{d:"M5 12l14 0",key:"svg-0"}]],pc=Pe("outline","minus","Minus",gc);function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var mc={value:()=>{}};function sn(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Bt(n)}function Bt(e){this._=e}function yc(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Bt.prototype=sn.prototype={constructor:Bt,on:function(e,t){var n=this._,o=yc(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=xc(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=ko(n[r],e.name,t);else if(t==null)for(r in n)n[r]=ko(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Bt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function xc(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function ko(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=mc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Rn="http://www.w3.org/1999/xhtml";const Io={svg:"http://www.w3.org/2000/svg",xhtml:Rn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function an(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Io.hasOwnProperty(t)?{space:Io[t],local:e}:e}function wc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Rn&&t.documentElement.namespaceURI===Rn?t.createElement(e):t.createElementNS(n,e)}}function vc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Lr(e){var t=an(e);return(t.local?vc:wc)(t)}function bc(){}function Jn(e){return e==null?bc:function(){return this.querySelector(e)}}function _c(e){typeof e!="function"&&(e=Jn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new ue(o,this._parents)}function Sc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ec(){return[]}function Or(e){return e==null?Ec:function(){return this.querySelectorAll(e)}}function Cc(e){return function(){return Sc(e.apply(this,arguments))}}function Nc(e){typeof e=="function"?e=Cc(e):e=Or(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new ue(o,r)}function Vr(e){return function(){return this.matches(e)}}function Br(e){return function(t){return t.matches(e)}}var Mc=Array.prototype.find;function kc(e){return function(){return Mc.call(this.children,e)}}function Ic(){return this.firstElementChild}function zc(e){return this.select(e==null?Ic:kc(typeof e=="function"?e:Br(e)))}var Ac=Array.prototype.filter;function $c(){return Array.from(this.children)}function Pc(e){return function(){return Ac.call(this.children,e)}}function Dc(e){return this.selectAll(e==null?$c:Pc(typeof e=="function"?e:Br(e)))}function Tc(e){typeof e!="function"&&(e=Vr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new ue(o,this._parents)}function Fr(e){return new Array(e.length)}function Hc(){return new ue(this._enter||this._groups.map(Fr),this._parents)}function Zt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Zt.prototype={constructor:Zt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function jc(e){return function(){return e}}function Rc(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Zt(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Lc(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,d=i.length,f=new Array(u),g;for(a=0;a<u;++a)(l=t[a])&&(f[a]=g=s.call(l,l.__data__,a,t)+"",c.has(g)?r[a]=l:c.set(g,l));for(a=0;a<d;++a)g=s.call(e,i[a],a,i)+"",(l=c.get(g))?(o[a]=l,l.__data__=i[a],c.delete(g)):n[a]=new Zt(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(f[a])===l&&(r[a]=l)}function Oc(e){return e.__data__}function Vc(e,t){if(!arguments.length)return Array.from(this,Oc);var n=t?Lc:Rc,o=this._parents,r=this._groups;typeof e!="function"&&(e=jc(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],d=r[c],f=d.length,g=Bc(e.call(u,u&&u.__data__,c,o)),p=g.length,m=a[c]=new Array(p),v=s[c]=new Array(p),x=l[c]=new Array(f);n(u,d,m,v,x,g,t);for(var _=0,h=0,w,C;_<p;++_)if(w=m[_]){for(_>=h&&(h=_+1);!(C=v[h])&&++h<p;);w._next=C||null}}return s=new ue(s,o),s._enter=a,s._exit=l,s}function Bc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Fc(){return new ue(this._exit||this._groups.map(Fr),this._parents)}function Xc(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Yc(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=n[l],u=o[l],d=c.length,f=a[l]=new Array(d),g,p=0;p<d;++p)(g=c[p]||u[p])&&(f[p]=g);for(;l<r;++l)a[l]=n[l];return new ue(a,this._parents)}function Wc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Zc(e){e||(e=qc);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new ue(r,this._parents).order()}function qc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Gc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Uc(){return Array.from(this)}function Kc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Qc(){let e=0;for(const t of this)++e;return e}function Jc(){return!this.node()}function el(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function tl(e){return function(){this.removeAttribute(e)}}function nl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ol(e,t){return function(){this.setAttribute(e,t)}}function rl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function il(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function sl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function al(e,t){var n=an(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?nl:tl:typeof t=="function"?n.local?sl:il:n.local?rl:ol)(n,t))}function Xr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cl(e){return function(){this.style.removeProperty(e)}}function ll(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ul(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function dl(e,t,n){return arguments.length>1?this.each((t==null?cl:typeof t=="function"?ul:ll)(e,t,n??"")):Qe(this.node(),e)}function Qe(e,t){return e.style.getPropertyValue(t)||Xr(e).getComputedStyle(e,null).getPropertyValue(t)}function fl(e){return function(){delete this[e]}}function hl(e,t){return function(){this[e]=t}}function gl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function pl(e,t){return arguments.length>1?this.each((t==null?fl:typeof t=="function"?gl:hl)(e,t)):this.node()[e]}function Yr(e){return e.trim().split(/^|\s+/)}function eo(e){return e.classList||new Wr(e)}function Wr(e){this._node=e,this._names=Yr(e.getAttribute("class")||"")}Wr.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Zr(e,t){for(var n=eo(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function qr(e,t){for(var n=eo(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function ml(e){return function(){Zr(this,e)}}function yl(e){return function(){qr(this,e)}}function xl(e,t){return function(){(t.apply(this,arguments)?Zr:qr)(this,e)}}function wl(e,t){var n=Yr(e+"");if(arguments.length<2){for(var o=eo(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?xl:t?ml:yl)(n,t))}function vl(){this.textContent=""}function bl(e){return function(){this.textContent=e}}function _l(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Sl(e){return arguments.length?this.each(e==null?vl:(typeof e=="function"?_l:bl)(e)):this.node().textContent}function El(){this.innerHTML=""}function Cl(e){return function(){this.innerHTML=e}}function Nl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ml(e){return arguments.length?this.each(e==null?El:(typeof e=="function"?Nl:Cl)(e)):this.node().innerHTML}function kl(){this.nextSibling&&this.parentNode.appendChild(this)}function Il(){return this.each(kl)}function zl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Al(){return this.each(zl)}function $l(e){var t=typeof e=="function"?e:Lr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Pl(){return null}function Dl(e,t){var n=typeof e=="function"?e:Lr(e),o=t==null?Pl:typeof t=="function"?t:Jn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Tl(){var e=this.parentNode;e&&e.removeChild(this)}function Hl(){return this.each(Tl)}function jl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Rl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ll(e){return this.select(e?Rl:jl)}function Ol(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Vl(e){return function(t){e.call(this,t,this.__data__)}}function Bl(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Fl(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Xl(e,t,n){return function(){var o=this.__on,r,i=Vl(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Yl(e,t,n){var o=Bl(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Xl:Fl,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Gr(e,t,n){var o=Xr(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Wl(e,t){return function(){return Gr(this,e,t)}}function Zl(e,t){return function(){return Gr(this,e,t.apply(this,arguments))}}function ql(e,t){return this.each((typeof t=="function"?Zl:Wl)(e,t))}function*Gl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Ur=[null];function ue(e,t){this._groups=e,this._parents=t}function Nt(){return new ue([[document.documentElement]],Ur)}function Ul(){return this}ue.prototype=Nt.prototype={constructor:ue,select:_c,selectAll:Nc,selectChild:zc,selectChildren:Dc,filter:Tc,data:Vc,enter:Hc,exit:Fc,join:Xc,merge:Yc,selection:Ul,order:Wc,sort:Zc,call:Gc,nodes:Uc,node:Kc,size:Qc,empty:Jc,each:el,attr:al,style:dl,property:pl,classed:wl,text:Sl,html:Ml,raise:Il,lower:Al,append:$l,insert:Dl,remove:Hl,clone:Ll,datum:Ol,on:Yl,dispatch:ql,[Symbol.iterator]:Gl};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Ur)}function Kl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Kl(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Ql={passive:!1},yt={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function Ge(e){e.preventDefault(),e.stopImmediatePropagation()}function Kr(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Ge,yt);"onselectstart"in t?n.on("selectstart.drag",Ge,yt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Qr(e,t){var n=e.document.documentElement,o=le(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ge,yt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Pt=e=>()=>e;function Ln(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Ln.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Jl(e){return!e.ctrlKey&&!e.button}function eu(){return this.parentNode}function tu(e,t){return t??{x:e.x,y:e.y}}function nu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Jr(){var e=Jl,t=eu,n=tu,o=nu,r={},i=sn("start","drag","end"),s=0,a,l,c,u,d=0;function f(w){w.on("mousedown.drag",g).filter(o).on("touchstart.drag",v).on("touchmove.drag",x,Ql).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(w,C){if(!(u||!e.call(this,w,C))){var E=h(this,t.call(this,w,C),w,C,"mouse");E&&(le(w.view).on("mousemove.drag",p,yt).on("mouseup.drag",m,yt),Kr(w.view),Sn(w),c=!1,a=w.clientX,l=w.clientY,E("start",w))}}function p(w){if(Ge(w),!c){var C=w.clientX-a,E=w.clientY-l;c=C*C+E*E>d}r.mouse("drag",w)}function m(w){le(w.view).on("mousemove.drag mouseup.drag",null),Qr(w.view,c),Ge(w),r.mouse("end",w)}function v(w,C){if(e.call(this,w,C)){var E=w.changedTouches,S=t.call(this,w,C),M=E.length,z,O;for(z=0;z<M;++z)(O=h(this,S,w,C,E[z].identifier,E[z]))&&(Sn(w),O("start",w,E[z]))}}function x(w){var C=w.changedTouches,E=C.length,S,M;for(S=0;S<E;++S)(M=r[C[S].identifier])&&(Ge(w),M("drag",w,C[S]))}function _(w){var C=w.changedTouches,E=C.length,S,M;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),S=0;S<E;++S)(M=r[C[S].identifier])&&(Sn(w),M("end",w,C[S]))}function h(w,C,E,S,M,z){var O=i.copy(),k=de(z||E,C),T,j,b;if((b=n.call(w,new Ln("beforestart",{sourceEvent:E,target:f,identifier:M,active:s,x:k[0],y:k[1],dx:0,dy:0,dispatch:O}),S))!=null)return T=b.x-k[0]||0,j=b.y-k[1]||0,function I(N,$,A){var D=k,H;switch(N){case"start":r[M]=I,H=s++;break;case"end":delete r[M],--s;case"drag":k=de(A||$,C),H=s;break}O.call(N,w,new Ln(N,{sourceEvent:$,subject:b,target:f,identifier:M,active:H,x:k[0]+T,y:k[1]+j,dx:k[0]-D[0],dy:k[1]-D[1],dispatch:O}),S)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Pt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:Pt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Pt(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:Pt(!!w),f):o},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}function to(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ei(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Mt(){}var xt=.7,qt=1/xt,Ue="\\s*([+-]?\\d+)\\s*",wt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ou=/^#([0-9a-f]{3,8})$/,ru=new RegExp(`^rgb\\(${Ue},${Ue},${Ue}\\)$`),iu=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),su=new RegExp(`^rgba\\(${Ue},${Ue},${Ue},${wt}\\)$`),au=new RegExp(`^rgba\\(${we},${we},${we},${wt}\\)$`),cu=new RegExp(`^hsl\\(${wt},${we},${we}\\)$`),lu=new RegExp(`^hsla\\(${wt},${we},${we},${wt}\\)$`),zo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};to(Mt,Le,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ao,formatHex:Ao,formatHex8:uu,formatHsl:du,formatRgb:$o,toString:$o});function Ao(){return this.rgb().formatHex()}function uu(){return this.rgb().formatHex8()}function du(){return ti(this).formatHsl()}function $o(){return this.rgb().formatRgb()}function Le(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ou.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Po(t):n===3?new ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Dt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Dt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=ru.exec(e))?new ce(t[1],t[2],t[3],1):(t=iu.exec(e))?new ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=su.exec(e))?Dt(t[1],t[2],t[3],t[4]):(t=au.exec(e))?Dt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cu.exec(e))?Ho(t[1],t[2]/100,t[3]/100,1):(t=lu.exec(e))?Ho(t[1],t[2]/100,t[3]/100,t[4]):zo.hasOwnProperty(e)?Po(zo[e]):e==="transparent"?new ce(NaN,NaN,NaN,0):null}function Po(e){return new ce(e>>16&255,e>>8&255,e&255,1)}function Dt(e,t,n,o){return o<=0&&(e=t=n=NaN),new ce(e,t,n,o)}function fu(e){return e instanceof Mt||(e=Le(e)),e?(e=e.rgb(),new ce(e.r,e.g,e.b,e.opacity)):new ce}function On(e,t,n,o){return arguments.length===1?fu(e):new ce(e,t,n,o??1)}function ce(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}to(ce,On,ei(Mt,{brighter(e){return e=e==null?qt:Math.pow(qt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xt:Math.pow(xt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ce(je(this.r),je(this.g),je(this.b),Gt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Do,formatHex:Do,formatHex8:hu,formatRgb:To,toString:To}));function Do(){return`#${He(this.r)}${He(this.g)}${He(this.b)}`}function hu(){return`#${He(this.r)}${He(this.g)}${He(this.b)}${He((isNaN(this.opacity)?1:this.opacity)*255)}`}function To(){const e=Gt(this.opacity);return`${e===1?"rgb(":"rgba("}${je(this.r)}, ${je(this.g)}, ${je(this.b)}${e===1?")":`, ${e})`}`}function Gt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function je(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function He(e){return e=je(e),(e<16?"0":"")+e.toString(16)}function Ho(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,o)}function ti(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof Mt||(e=Le(e)),!e)return new he;if(e instanceof he)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new he(s,a,l,e.opacity)}function gu(e,t,n,o){return arguments.length===1?ti(e):new he(e,t,n,o??1)}function he(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}to(he,gu,ei(Mt,{brighter(e){return e=e==null?qt:Math.pow(qt,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xt:Math.pow(xt,e),new he(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new ce(En(e>=240?e-240:e+120,r,o),En(e,r,o),En(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new he(jo(this.h),Tt(this.s),Tt(this.l),Gt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Gt(this.opacity);return`${e===1?"hsl(":"hsla("}${jo(this.h)}, ${Tt(this.s)*100}%, ${Tt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function jo(e){return e=(e||0)%360,e<0?e+360:e}function Tt(e){return Math.max(0,Math.min(1,e||0))}function En(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const no=e=>()=>e;function pu(e,t){return function(n){return e+n*t}}function mu(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function yu(e){return(e=+e)==1?ni:function(t,n){return n-t?mu(t,n,e):no(isNaN(t)?n:t)}}function ni(e,t){var n=t-e;return n?pu(e,n):no(isNaN(e)?t:e)}const Ut=(function e(t){var n=yu(t);function o(r,i){var s=n((r=On(r)).r,(i=On(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),c=ni(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return o.gamma=e,o})(1);function xu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function wu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vu(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=pt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function bu(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function xe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function _u(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=pt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var Vn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Cn=new RegExp(Vn.source,"g");function Su(e){return function(){return e}}function Eu(e){return function(t){return e(t)+""}}function oi(e,t){var n=Vn.lastIndex=Cn.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Vn.exec(e))&&(r=Cn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:xe(o,r)})),n=Cn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Eu(l[0].x):Su(t):(t=l.length,function(c){for(var u=0,d;u<t;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}function pt(e,t){var n=typeof t,o;return t==null||n==="boolean"?no(t):(n==="number"?xe:n==="string"?(o=Le(t))?(t=o,Ut):oi:t instanceof Le?Ut:t instanceof Date?bu:wu(t)?xu:Array.isArray(t)?vu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?_u:xe)(e,t)}var Ro=180/Math.PI,Bn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ri(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Ro,skewX:Math.atan(l)*Ro,scaleX:s,scaleY:a}}var Ht;function Cu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Bn:ri(t.a,t.b,t.c,t.d,t.e,t.f)}function Nu(e){return e==null||(Ht||(Ht=document.createElementNS("http://www.w3.org/2000/svg","g")),Ht.setAttribute("transform",e),!(e=Ht.transform.baseVal.consolidate()))?Bn:(e=e.matrix,ri(e.a,e.b,e.c,e.d,e.e,e.f))}function ii(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,d,f,g,p){if(c!==d||u!==f){var m=g.push("translate(",null,t,null,n);p.push({i:m-4,x:xe(c,d)},{i:m-2,x:xe(u,f)})}else(d||f)&&g.push("translate("+d+t+f+n)}function s(c,u,d,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:xe(c,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(c,u,d,f){c!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:xe(c,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(c,u,d,f,g,p){if(c!==d||u!==f){var m=g.push(r(g)+"scale(",null,",",null,")");p.push({i:m-4,x:xe(c,d)},{i:m-2,x:xe(u,f)})}else(d!==1||f!==1)&&g.push(r(g)+"scale("+d+","+f+")")}return function(c,u){var d=[],f=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,d,f),s(c.rotate,u.rotate,d,f),a(c.skewX,u.skewX,d,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,f),c=u=null,function(g){for(var p=-1,m=f.length,v;++p<m;)d[(v=f[p]).i]=v.x(g);return d.join("")}}}var Mu=ii(Cu,"px, ","px)","deg)"),ku=ii(Nu,", ",")",")"),Iu=1e-12;function Lo(e){return((e=Math.exp(e))+1/e)/2}function zu(e){return((e=Math.exp(e))-1/e)/2}function Au(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ft=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],d=s[1],f=s[2],g=u-a,p=d-l,m=g*g+p*p,v,x;if(m<Iu)x=Math.log(f/c)/t,v=function(S){return[a+S*g,l+S*p,c*Math.exp(t*S*x)]};else{var _=Math.sqrt(m),h=(f*f-c*c+o*m)/(2*c*n*_),w=(f*f-c*c-o*m)/(2*f*n*_),C=Math.log(Math.sqrt(h*h+1)-h),E=Math.log(Math.sqrt(w*w+1)-w);x=(E-C)/t,v=function(S){var M=S*x,z=Lo(C),O=c/(n*_)*(z*Au(t*M+C)-zu(C));return[a+O*g,l+O*p,c*z/Lo(t*M+C)]}}return v.duration=x*1e3*t/Math.SQRT2,v}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Je=0,ht=0,ut=0,si=1e3,Kt,gt,Qt=0,Oe=0,cn=0,vt=typeof performance=="object"&&performance.now?performance:Date,ai=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oo(){return Oe||(ai($u),Oe=vt.now()+cn)}function $u(){Oe=0}function Jt(){this._call=this._time=this._next=null}Jt.prototype=ci.prototype={constructor:Jt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?oo():+n)+(t==null?0:+t),!this._next&&gt!==this&&(gt?gt._next=this:Kt=this,gt=this),this._call=e,this._time=n,Fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fn())}};function ci(e,t,n){var o=new Jt;return o.restart(e,t,n),o}function Pu(){oo(),++Je;for(var e=Kt,t;e;)(t=Oe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Je}function Oo(){Oe=(Qt=vt.now())+cn,Je=ht=0;try{Pu()}finally{Je=0,Tu(),Oe=0}}function Du(){var e=vt.now(),t=e-Qt;t>si&&(cn-=t,Qt=e)}function Tu(){for(var e,t=Kt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Kt=n);gt=e,Fn(o)}function Fn(e){if(!Je){ht&&(ht=clearTimeout(ht));var t=e-Oe;t>24?(e<1/0&&(ht=setTimeout(Oo,e-vt.now()-cn)),ut&&(ut=clearInterval(ut))):(ut||(Qt=vt.now(),ut=setInterval(Du,si)),Je=1,ai(Oo))}}function Vo(e,t,n){var o=new Jt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Hu=sn("start","end","cancel","interrupt"),ju=[],li=0,Bo=1,Xn=2,Xt=3,Fo=4,Yn=5,Yt=6;function ln(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Ru(e,n,{name:t,index:o,group:r,on:Hu,tween:ju,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:li})}function ro(e,t){var n=me(e,t);if(n.state>li)throw new Error("too late; already scheduled");return n}function be(e,t){var n=me(e,t);if(n.state>Xt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ru(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=ci(i,0,n.time);function i(c){n.state=Bo,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,d,f,g;if(n.state!==Bo)return l();for(u in o)if(g=o[u],g.name===n.name){if(g.state===Xt)return Vo(s);g.state===Fo?(g.state=Yt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Yt,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(Vo(function(){n.state===Xt&&(n.state=Fo,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Xn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Xn){for(n.state=Xt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=g);r.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Yn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Yn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Yt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Wt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Xn&&o.state<Yn,o.state=Yt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Lu(e){return this.each(function(){Wt(this,e)})}function Ou(e,t){var n,o;return function(){var r=be(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Vu(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=be(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function Bu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Ou:Vu)(n,e,t))}function io(e,t,n){var o=e._id;return e.each(function(){var r=be(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function ui(e,t){var n;return(typeof t=="number"?xe:t instanceof Le?Ut:(n=Le(t))?(t=n,Ut):oi)(e,t)}function Fu(e){return function(){this.removeAttribute(e)}}function Xu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Yu(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Wu(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Zu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function qu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Gu(e,t){var n=an(e),o=n==="transform"?ku:ui;return this.attrTween(e,typeof t=="function"?(n.local?qu:Zu)(n,o,io(this,"attr."+e,t)):t==null?(n.local?Xu:Fu)(n):(n.local?Wu:Yu)(n,o,t))}function Uu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ku(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Qu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Ku(e,i)),n}return r._value=t,r}function Ju(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Uu(e,i)),n}return r._value=t,r}function ed(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=an(e);return this.tween(n,(o.local?Qu:Ju)(o,t))}function td(e,t){return function(){ro(this,e).delay=+t.apply(this,arguments)}}function nd(e,t){return t=+t,function(){ro(this,e).delay=t}}function od(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?td:nd)(t,e)):me(this.node(),t).delay}function rd(e,t){return function(){be(this,e).duration=+t.apply(this,arguments)}}function id(e,t){return t=+t,function(){be(this,e).duration=t}}function sd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?rd:id)(t,e)):me(this.node(),t).duration}function ad(e,t){if(typeof t!="function")throw new Error;return function(){be(this,e).ease=t}}function cd(e){var t=this._id;return arguments.length?this.each(ad(t,e)):me(this.node(),t).ease}function ld(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;be(this,e).ease=n}}function ud(e){if(typeof e!="function")throw new Error;return this.each(ld(this._id,e))}function dd(e){typeof e!="function"&&(e=Vr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Ne(o,this._parents,this._name,this._id)}function fd(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,d=s[a]=new Array(u),f,g=0;g<u;++g)(f=l[g]||c[g])&&(d[g]=f);for(;a<o;++a)s[a]=t[a];return new Ne(s,this._parents,this._name,this._id)}function hd(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function gd(e,t,n){var o,r,i=hd(t)?ro:be;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function pd(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(gd(n,e,t))}function md(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function yd(){return this.on("end.remove",md(this._id))}function xd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Jn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,d,f=0;f<l;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),c[f]=d,ln(c[f],t,n,f,c,me(u,n)));return new Ne(i,this._parents,t,n)}function wd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Or(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),g,p=me(u,n),m=0,v=f.length;m<v;++m)(g=f[m])&&ln(g,t,n,m,f,p);i.push(f),s.push(u)}return new Ne(i,s,t,n)}var vd=Nt.prototype.constructor;function bd(){return new vd(this._groups,this._parents)}function _d(e,t){var n,o,r;return function(){var i=Qe(this,e),s=(this.style.removeProperty(e),Qe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function di(e){return function(){this.style.removeProperty(e)}}function Sd(e,t,n){var o,r=n+"",i;return function(){var s=Qe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Ed(e,t,n){var o,r,i;return function(){var s=Qe(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Qe(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function Cd(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=be(this,e),c=l.on,u=l.value[i]==null?a||(a=di(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function Nd(e,t,n){var o=(e+="")=="transform"?Mu:ui;return t==null?this.styleTween(e,_d(e,o)).on("end.style."+e,di(e)):typeof t=="function"?this.styleTween(e,Ed(e,o,io(this,"style."+e,t))).each(Cd(this._id,e)):this.styleTween(e,Sd(e,o,t),n).on("end.style."+e,null)}function Md(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function kd(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Md(e,s,n)),o}return i._value=t,i}function Id(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,kd(e,t,n??""))}function zd(e){return function(){this.textContent=e}}function Ad(e){return function(){var t=e(this);this.textContent=t??""}}function $d(e){return this.tween("text",typeof e=="function"?Ad(io(this,"text",e)):zd(e==null?"":e+""))}function Pd(e){return function(t){this.textContent=e.call(this,t)}}function Dd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Pd(r)),t}return o._value=e,o}function Td(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Dd(e))}function Hd(){for(var e=this._name,t=this._id,n=fi(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=me(l,t);ln(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ne(o,this._parents,e,n)}function jd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=be(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var Rd=0;function Ne(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function fi(){return++Rd}var Se=Nt.prototype;Ne.prototype={constructor:Ne,select:xd,selectAll:wd,selectChild:Se.selectChild,selectChildren:Se.selectChildren,filter:dd,merge:fd,selection:bd,transition:Hd,call:Se.call,nodes:Se.nodes,node:Se.node,size:Se.size,empty:Se.empty,each:Se.each,on:pd,attr:Gu,attrTween:ed,style:Nd,styleTween:Id,text:$d,textTween:Td,remove:yd,tween:Bu,delay:od,duration:sd,ease:cd,easeVarying:ud,end:jd,[Symbol.iterator]:Se[Symbol.iterator]};function Ld(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Od={time:null,delay:0,duration:250,ease:Ld};function Vd(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Bd(e){var t,n;e instanceof Ne?(t=e._id,e=e._name):(t=fi(),(n=Od).time=oo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&ln(l,e,t,c,s,n||Vd(l,t));return new Ne(o,this._parents,e,t)}Nt.prototype.interrupt=Lu;Nt.prototype.transition=Bd;const jt=e=>()=>e;function Fd(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var un=new Ee(1,0,0);hi.prototype=Ee.prototype;function hi(e){for(;!e.__zoom;)if(!(e=e.parentNode))return un;return e.__zoom}function Nn(e){e.stopImmediatePropagation()}function dt(e){e.preventDefault(),e.stopImmediatePropagation()}function Xd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Yd(){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 Xo(){return this.__zoom||un}function Wd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Zd(){return navigator.maxTouchPoints||"ontouchstart"in this}function qd(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function gi(){var e=Xd,t=Yd,n=qd,o=Wd,r=Zd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ft,c=sn("start","zoom","end"),u,d,f,g=500,p=150,m=0,v=10;function x(b){b.property("__zoom",Xo).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",O).filter(r).on("touchstart.zoom",k).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",j).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(b,I,N,$){var A=b.selection?b.selection():b;A.property("__zoom",Xo),b!==A?C(b,I,N,$):A.interrupt().each(function(){E(this,arguments).event($).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},x.scaleBy=function(b,I,N,$){x.scaleTo(b,function(){var A=this.__zoom.k,D=typeof I=="function"?I.apply(this,arguments):I;return A*D},N,$)},x.scaleTo=function(b,I,N,$){x.transform(b,function(){var A=t.apply(this,arguments),D=this.__zoom,H=N==null?w(A):typeof N=="function"?N.apply(this,arguments):N,L=D.invert(H),R=typeof I=="function"?I.apply(this,arguments):I;return n(h(_(D,R),H,L),A,s)},N,$)},x.translateBy=function(b,I,N,$){x.transform(b,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,$)},x.translateTo=function(b,I,N,$,A){x.transform(b,function(){var D=t.apply(this,arguments),H=this.__zoom,L=$==null?w(D):typeof $=="function"?$.apply(this,arguments):$;return n(un.translate(L[0],L[1]).scale(H.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof N=="function"?-N.apply(this,arguments):-N),D,s)},$,A)};function _(b,I){return I=Math.max(i[0],Math.min(i[1],I)),I===b.k?b:new Ee(I,b.x,b.y)}function h(b,I,N){var $=I[0]-N[0]*b.k,A=I[1]-N[1]*b.k;return $===b.x&&A===b.y?b:new Ee(b.k,$,A)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function C(b,I,N,$){b.on("start.zoom",function(){E(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event($).end()}).tween("zoom",function(){var A=this,D=arguments,H=E(A,D).event($),L=t.apply(A,D),R=N==null?w(L):typeof N=="function"?N.apply(A,D):N,F=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),B=A.__zoom,Z=typeof I=="function"?I.apply(A,D):I,U=l(B.invert(R).concat(F/B.k),Z.invert(R).concat(F/Z.k));return function(W){if(W===1)W=Z;else{var V=U(W),Y=F/V[2];W=new Ee(Y,R[0]-V[0]*Y,R[1]-V[1]*Y)}H.zoom(null,W)}})}function E(b,I,N){return!N&&b.__zooming||new S(b,I)}function S(b,I){this.that=b,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,I),this.taps=0}S.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,I){return this.mouse&&b!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var I=le(this.that).datum();c.call(b,this.that,new Fd(b,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:c}),I)}};function M(b,...I){if(!e.apply(this,arguments))return;var N=E(this,I).event(b),$=this.__zoom,A=Math.max(i[0],Math.min(i[1],$.k*Math.pow(2,o.apply(this,arguments)))),D=de(b);if(N.wheel)(N.mouse[0][0]!==D[0]||N.mouse[0][1]!==D[1])&&(N.mouse[1]=$.invert(N.mouse[0]=D)),clearTimeout(N.wheel);else{if($.k===A)return;N.mouse=[D,$.invert(D)],Wt(this),N.start()}dt(b),N.wheel=setTimeout(H,p),N.zoom("mouse",n(h(_($,A),N.mouse[0],N.mouse[1]),N.extent,s));function H(){N.wheel=null,N.end()}}function z(b,...I){if(f||!e.apply(this,arguments))return;var N=b.currentTarget,$=E(this,I,!0).event(b),A=le(b.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),D=de(b,N),H=b.clientX,L=b.clientY;Kr(b.view),Nn(b),$.mouse=[D,this.__zoom.invert(D)],Wt(this),$.start();function R(B){if(dt(B),!$.moved){var Z=B.clientX-H,U=B.clientY-L;$.moved=Z*Z+U*U>m}$.event(B).zoom("mouse",n(h($.that.__zoom,$.mouse[0]=de(B,N),$.mouse[1]),$.extent,s))}function F(B){A.on("mousemove.zoom mouseup.zoom",null),Qr(B.view,$.moved),dt(B),$.event(B).end()}}function O(b,...I){if(e.apply(this,arguments)){var N=this.__zoom,$=de(b.changedTouches?b.changedTouches[0]:b,this),A=N.invert($),D=N.k*(b.shiftKey?.5:2),H=n(h(_(N,D),$,A),t.apply(this,I),s);dt(b),a>0?le(this).transition().duration(a).call(C,H,$,b):le(this).call(x.transform,H,$,b)}}function k(b,...I){if(e.apply(this,arguments)){var N=b.touches,$=N.length,A=E(this,I,b.changedTouches.length===$).event(b),D,H,L,R;for(Nn(b),H=0;H<$;++H)L=N[H],R=de(L,this),R=[R,this.__zoom.invert(R),L.identifier],A.touch0?!A.touch1&&A.touch0[2]!==R[2]&&(A.touch1=R,A.taps=0):(A.touch0=R,D=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),D&&(A.taps<2&&(d=R[0],u=setTimeout(function(){u=null},g)),Wt(this),A.start())}}function T(b,...I){if(this.__zooming){var N=E(this,I).event(b),$=b.changedTouches,A=$.length,D,H,L,R;for(dt(b),D=0;D<A;++D)H=$[D],L=de(H,this),N.touch0&&N.touch0[2]===H.identifier?N.touch0[0]=L:N.touch1&&N.touch1[2]===H.identifier&&(N.touch1[0]=L);if(H=N.that.__zoom,N.touch1){var F=N.touch0[0],B=N.touch0[1],Z=N.touch1[0],U=N.touch1[1],W=(W=Z[0]-F[0])*W+(W=Z[1]-F[1])*W,V=(V=U[0]-B[0])*V+(V=U[1]-B[1])*V;H=_(H,Math.sqrt(W/V)),L=[(F[0]+Z[0])/2,(F[1]+Z[1])/2],R=[(B[0]+U[0])/2,(B[1]+U[1])/2]}else if(N.touch0)L=N.touch0[0],R=N.touch0[1];else return;N.zoom("touch",n(h(H,L,R),N.extent,s))}}function j(b,...I){if(this.__zooming){var N=E(this,I).event(b),$=b.changedTouches,A=$.length,D,H;for(Nn(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),D=0;D<A;++D)H=$[D],N.touch0&&N.touch0[2]===H.identifier?delete N.touch0:N.touch1&&N.touch1[2]===H.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(H=de(H,this),Math.hypot(d[0]-H[0],d[1]-H[1])<v)){var L=le(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return x.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:jt(+b),x):o},x.filter=function(b){return arguments.length?(e=typeof b=="function"?b:jt(!!b),x):e},x.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:jt(!!b),x):r},x.extent=function(b){return arguments.length?(t=typeof b=="function"?b:jt([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),x):t},x.scaleExtent=function(b){return arguments.length?(i[0]=+b[0],i[1]=+b[1],x):[i[0],i[1]]},x.translateExtent=function(b){return arguments.length?(s[0][0]=+b[0][0],s[1][0]=+b[1][0],s[0][1]=+b[0][1],s[1][1]=+b[1][1],x):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},x.constrain=function(b){return arguments.length?(n=b,x):n},x.duration=function(b){return arguments.length?(a=+b,x):a},x.interpolate=function(b){return arguments.length?(l=b,x):l},x.on=function(){var b=c.on.apply(c,arguments);return b===c?x:b},x.clickDistance=function(b){return arguments.length?(m=(b=+b)*b,x):Math.sqrt(m)},x.tapDistance=function(b){return arguments.length?(v=+b,x):v},x}const ve={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:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},bt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],pi=["Enter"," ","Escape"],mi={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var et;(function(e){e.Strict="strict",e.Loose="loose"})(et||(et={}));var Re;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Re||(Re={}));var _t;(function(e){e.Partial="partial",e.Full="full"})(_t||(_t={}));const yi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ae;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ae||(Ae={}));var en;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(en||(en={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const Yo={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function xi(e){return e===null?null:e?"valid":"invalid"}const wi=e=>"id"in e&&"source"in e&&"target"in e,Gd=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),so=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),kt=(e,t=[0,0])=>{const{width:n,height:o}=Me(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Ud=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):so(r)?r:t.nodeLookup.get(r.id));const a=s?tn(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return dn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},It=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=dn(n,tn(r)),o=!0)}),o?fn(n):{x:0,y:0,width:0,height:0}},ao=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...At(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const c of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=c;if(s&&!d||f)continue;const g=u.width??c.width??c.initialWidth??null,p=u.height??c.height??c.initialHeight??null,m=St(a,nt(c)),v=(g??0)*(p??0),x=i&&m>0;(!c.internals.handleBounds||x||m>=v||c.dragging)&&l.push(c)}return l},Kd=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Qd(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Jd({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Qd(e,s),l=It(a),c=co(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function vi({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ve.error005());else{const g=a.measured.width,p=a.measured.height;g&&p&&(d=[[l,c],[l+g,c+p]])}else a&&ot(s.extent)&&(d=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const f=ot(d)?Ve(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ve.error015()),{position:{x:f.x-l+(s.measured.width??0)*u[0],y:f.y-c+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function ef({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const g=i.has(f.id),p=!g&&f.parentId&&s.find(m=>m.id===f.parentId);(g||p)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=Kd(s,l);for(const f of l)a.has(f.id)&&!u.find(p=>p.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const tt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ve=(e={x:0,y:0},t,n)=>({x:tt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:tt(e.y,t[0][1],t[1][1]-(n?.height??0))});function bi(e,t,n){const{width:o,height:r}=Me(n),{x:i,y:s}=n.internals.positionAbsolute;return Ve(e,[[i,s],[i+o,s+r]],t)}const Wo=(e,t,n)=>e<t?tt(Math.abs(e-t),1,t)/t:e>n?-tt(Math.abs(e-n),1,t)/t:0,_i=(e,t,n=15,o=40)=>{const r=Wo(e.x,o,t.width-o)*n,i=Wo(e.y,o,t.height-o)*n;return[r,i]},dn=(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)}),Wn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),fn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),nt=(e,t=[0,0])=>{const{x:n,y:o}=so(e)?e.internals.positionAbsolute:kt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},tn=(e,t=[0,0])=>{const{x:n,y:o}=so(e)?e.internals.positionAbsolute:kt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Si=(e,t)=>fn(dn(Wn(e),Wn(t))),St=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Zo=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),tf=(e,t)=>{},zt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),At=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?zt(a,s):a},nn=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xe(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 nf(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xe(e,n),r=Xe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Xe(e.top??e.y??0,n),r=Xe(e.bottom??e.y??0,n),i=Xe(e.left??e.x??0,t),s=Xe(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function of(e,t,n,o,r,i){const{x:s,y:a}=nn(e,[t,n,o]),{x:l,y:c}=nn({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const co=(e,t,n,o,r,i)=>{const s=nf(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=tt(c,o,r),d=e.x+e.width/2,f=e.y+e.height/2,g=t/2-d*u,p=n/2-f*u,m=of(e,g,p,u,t,n),v={left:Math.min(m.left-s.left,0),top:Math.min(m.top-s.top,0),right:Math.min(m.right-s.right,0),bottom:Math.min(m.bottom-s.bottom,0)};return{x:g-v.left+v.right,y:p-v.top+v.bottom,zoom:u}},Et=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function ot(e){return e!=null&&e!=="parent"}function Me(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ei(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function Ci(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function qo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rf(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function sf(e){return{...mi,...e||{}}}function mt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=pe(e),a=At({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?zt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const lo=e=>({width:e.offsetWidth,height:e.offsetHeight}),Ni=e=>e?.getRootNode?.()||window?.document,af=["INPUT","SELECT","TEXTAREA"];function Mi(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:af.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ki=e=>"clientX"in e,pe=(e,t)=>{const n=ki(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Go=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...lo(s)}})};function Ii({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function Rt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Uo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-Rt(t-o,i),n];case X.Right:return[t+Rt(o-t,i),n];case X.Top:return[t,n-Rt(n-r,i)];case X.Bottom:return[t,n+Rt(r-n,i)]}}function zi({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,l]=Uo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=Uo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,g,p]=Ii({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,d,f,g,p]}function Ai({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function cf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function lf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=dn(tn(e),tn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return St(s,fn(i))>0}const uf=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,df=(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)),ff=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||uf;let r;return wi(e)?r={...e}:r={...e,id:o(e)},df(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function $i({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=Ai({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Ko={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},hf=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Qo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function gf({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=Ko[t],l=Ko[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=hf({source:c,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",g=d[f];let p=[],m,v;const x={x:0,y:0},_={x:0,y:0},[,,h,w]=Ai({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(m=r.x??c.x+(u.x-c.x)*s,v=r.y??(c.y+u.y)/2):(m=r.x??(c.x+u.x)/2,v=r.y??c.y+(u.y-c.y)*s);const E=[{x:m,y:c.y},{x:m,y:u.y}],S=[{x:c.x,y:v},{x:u.x,y:v}];a[f]===g?p=f==="x"?E:S:p=f==="x"?S:E}else{const E=[{x:c.x,y:u.y}],S=[{x:u.x,y:c.y}];if(f==="x"?p=a.x===g?S:E:p=a.y===g?E:S,t===o){const T=Math.abs(e[f]-n[f]);if(T<=i){const j=Math.min(i-1,i-T);a[f]===g?x[f]=(c[f]>e[f]?-1:1)*j:_[f]=(u[f]>n[f]?-1:1)*j}}if(t!==o){const T=f==="x"?"y":"x",j=a[f]===l[T],b=c[T]>u[T],I=c[T]<u[T];(a[f]===1&&(!j&&b||j&&I)||a[f]!==1&&(!j&&I||j&&b))&&(p=f==="x"?E:S)}const M={x:c.x+x.x,y:c.y+x.y},z={x:u.x+_.x,y:u.y+_.y},O=Math.max(Math.abs(M.x-p[0].x),Math.abs(z.x-p[0].x)),k=Math.max(Math.abs(M.y-p[0].y),Math.abs(z.y-p[0].y));O>=k?(m=(M.x+z.x)/2,v=p[0].y):(m=p[0].x,v=(M.y+z.y)/2)}return[[e,{x:c.x+x.x,y:c.y+x.y},...p,{x:u.x+_.x,y:u.y+_.y},n],m,v,h,w]}function pf(e,t,n,o){const r=Math.min(Qo(e,t)/2,Qo(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function Zn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,g,p,m]=gf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});return[d.reduce((x,_,h)=>{let w="";return h>0&&h<d.length-1?w=pf(d[h-1],_,d[h+1],s):w=`${h===0?"M":"L"}${_.x} ${_.y}`,x+=w,x},""),f,g,p,m]}function Jo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function mf(e){const{sourceNode:t,targetNode:n}=e;if(!Jo(t)||!Jo(n))return null;const o=t.internals.handleBounds||er(t.handles),r=n.internals.handleBounds||er(n.handles),i=tr(o?.source??[],e.sourceHandle),s=tr(e.connectionMode===et.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ve.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||X.Bottom,l=s?.position||X.Top,c=Be(t,i,a),u=Be(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function er(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Be(e,t,n=X.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Me(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function tr(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function qn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function yf(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const c=qn(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Pi=1e3,xf=10,uo={nodeOrigin:[0,0],nodeExtent:bt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},wf={...uo,checkEquality:!0};function fo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function vf(e,t,n){const o=fo(uo,n);for(const r of e.values())if(r.parentId)go(r,e,t,o);else{const i=kt(r,o.nodeOrigin),s=ot(r.extent)?r.extent:o.nodeExtent,a=Ve(i,s,Me(r));r.internals.positionAbsolute=a}}function bf(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function ho(e){return e==="manual"}function Gn(e,t,n,o={}){const r=fo(wf,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!ho(r.zIndexMode)?Pi:0;let l=e.length>0;t.clear(),n.clear();for(const c of e){let u=s.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const d=kt(c,r.nodeOrigin),f=ot(c.extent)?c.extent:r.nodeExtent,g=Ve(d,f,Me(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:bf(c,u),z:Di(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&go(u,t,n,o,i)}return l}function _f(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 go(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=fo(uo,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}_f(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*xf),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!ho(l)?Pi:0,{x:f,y:g,z:p}=Sf(e,u,s,a,d,l),{positionAbsolute:m}=e.internals,v=f!==m.x||g!==m.y;(v||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:f,y:g}:m,z:p}})}function Di(e,t,n){const o=ge(e.zIndex)?e.zIndex:0;return ho(n)?o:o+(e.selected?t:0)}function Sf(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Me(e),c=kt(e,n),u=ot(e.extent)?Ve(c,e.extent,l):c;let d=Ve({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(d=bi(d,l,t));const f=Di(e,r,i),g=t.internals.z??0;return{x:d.x,y:d.y,z:g>=f?g+1:f}}function po(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??nt(a),c=Si(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Me(a),d=a.origin??o,f=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,g=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,p=Math.max(u.width,Math.round(s.width)),m=Math.max(u.height,Math.round(s.height)),v=(p-u.width)*d[0],x=(m-u.height)*d[1];(f>0||g>0||v||x)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+v,y:a.position.y-g+x}}),n.get(l)?.forEach(_=>{e.some(h=>h.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+g}})})),(u.width<s.width||u.height<s.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:p+(f?d[0]*f-v:0),height:m+(g?d[1]*g-x:0)}})}),r}function Ef(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const g of e.values()){const p=t.get(g.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),l=!0;continue}const m=lo(g.nodeElement),v=p.measured.width!==m.width||p.measured.height!==m.height;if(!!(m.width&&m.height&&(v||!p.internals.handleBounds||g.force))){const _=g.nodeElement.getBoundingClientRect(),h=ot(p.extent)?p.extent:i;let{positionAbsolute:w}=p.internals;p.parentId&&p.extent==="parent"?w=bi(w,m,t.get(p.parentId)):h&&(w=Ve(w,h,m));const C={...p,measured:m,internals:{...p.internals,positionAbsolute:w,handleBounds:{source:Go("source",g.nodeElement,_,d,p.id),target:Go("target",g.nodeElement,_,d,p.id)}}};t.set(p.id,C),p.parentId&&go(C,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,v&&(c.push({id:p.id,type:"dimensions",dimensions:m}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:nt(C,r)}))}}if(f.length>0){const g=po(f,t,n,r);c.push(...g)}return{changes:c,updatedInternals:l}}async function Cf({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function nr(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function Ti(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;nr("source",l,u,e,r,s),nr("target",l,c,e,i,a),t.set(o.id,o)}}function Hi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Hi(n,t):!1}function or(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Nf(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Hi(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Mn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Mf({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=zt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function kf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,g=!1,p=!1,m=null;function v({noDragClassName:_,handleSelector:h,domNode:w,isSelectable:C,nodeId:E,nodeClickDistance:S=0}){f=le(w);function M({x:T,y:j}){const{nodeLookup:b,nodeExtent:I,snapGrid:N,snapToGrid:$,nodeOrigin:A,onNodeDrag:D,onSelectionDrag:H,onError:L,updateNodePositions:R}=t();i={x:T,y:j};let F=!1;const B=a.size>1,Z=B&&I?Wn(It(a)):null,U=B&&$?Mf({dragItems:a,snapGrid:N,x:T,y:j}):null;for(const[W,V]of a){if(!b.has(W))continue;let Y={x:T-V.distance.x,y:j-V.distance.y};$&&(Y=U?{x:Math.round(Y.x+U.x),y:Math.round(Y.y+U.y)}:zt(Y,N));let Q=null;if(B&&I&&!V.extent&&Z){const{positionAbsolute:G}=V.internals,ee=G.x-Z.x+I[0][0],ne=G.x+V.measured.width-Z.x2+I[1][0],te=G.y-Z.y+I[0][1],ae=G.y+V.measured.height-Z.y2+I[1][1];Q=[[ee,te],[ne,ae]]}const{position:K,positionAbsolute:q}=vi({nodeId:W,nextPosition:Y,nodeLookup:b,nodeExtent:Q||I,nodeOrigin:A,onError:L});F=F||V.position.x!==K.x||V.position.y!==K.y,V.position=K,V.internals.positionAbsolute=q}if(p=p||F,!!F&&(R(a,!0),m&&(o||D||!E&&H))){const[W,V]=Mn({nodeId:E,dragItems:a,nodeLookup:b});o?.(m,a,W,V),D?.(m,W,V),E||H?.(m,V)}}async function z(){if(!u)return;const{transform:T,panBy:j,autoPanSpeed:b,autoPanOnNodeDrag:I}=t();if(!I){l=!1,cancelAnimationFrame(s);return}const[N,$]=_i(c,u,b);(N!==0||$!==0)&&(i.x=(i.x??0)-N/T[2],i.y=(i.y??0)-$/T[2],await j({x:N,y:$})&&M(i)),s=requestAnimationFrame(z)}function O(T){const{nodeLookup:j,multiSelectionActive:b,nodesDraggable:I,transform:N,snapGrid:$,snapToGrid:A,selectNodesOnDrag:D,onNodeDragStart:H,onSelectionDragStart:L,unselectNodesAndEdges:R}=t();d=!0,(!D||!C)&&!b&&E&&(j.get(E)?.selected||R()),C&&D&&E&&e?.(E);const F=mt(T.sourceEvent,{transform:N,snapGrid:$,snapToGrid:A,containerBounds:u});if(i=F,a=Nf(j,I,F,E),a.size>0&&(n||H||!E&&L)){const[B,Z]=Mn({nodeId:E,dragItems:a,nodeLookup:j});n?.(T.sourceEvent,a,B,Z),H?.(T.sourceEvent,B,Z),E||L?.(T.sourceEvent,Z)}}const k=Jr().clickDistance(S).on("start",T=>{const{domNode:j,nodeDragThreshold:b,transform:I,snapGrid:N,snapToGrid:$}=t();u=j?.getBoundingClientRect()||null,g=!1,p=!1,m=T.sourceEvent,b===0&&O(T),i=mt(T.sourceEvent,{transform:I,snapGrid:N,snapToGrid:$,containerBounds:u}),c=pe(T.sourceEvent,u)}).on("drag",T=>{const{autoPanOnNodeDrag:j,transform:b,snapGrid:I,snapToGrid:N,nodeDragThreshold:$,nodeLookup:A}=t(),D=mt(T.sourceEvent,{transform:b,snapGrid:I,snapToGrid:N,containerBounds:u});if(m=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||E&&!A.has(E))&&(g=!0),!g){if(!l&&j&&d&&(l=!0,z()),!d){const H=pe(T.sourceEvent,u),L=H.x-c.x,R=H.y-c.y;Math.sqrt(L*L+R*R)>$&&O(T)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&d&&(c=pe(T.sourceEvent,u),M(D))}}).on("end",T=>{if(!(!d||g)&&(l=!1,d=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:j,updateNodePositions:b,onNodeDragStop:I,onSelectionDragStop:N}=t();if(p&&(b(a,!1),p=!1),r||I||!E&&N){const[$,A]=Mn({nodeId:E,dragItems:a,nodeLookup:j,dragging:!1});r?.(T.sourceEvent,a,$,A),I?.(T.sourceEvent,$,A),E||N?.(T.sourceEvent,A)}}}).filter(T=>{const j=T.target;return!T.button&&(!_||!or(j,`.${_}`,w))&&(!h||or(j,h,w))});f.call(k)}function x(){f?.on(".drag",null)}return{update:v,destroy:x}}function If(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())St(r,nt(i))>0&&o.push(i);return o}const zf=250;function Af(e,t,n,o){let r=[],i=1/0;const s=If(e,n,t+zf);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:d}=Be(a,c,c.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...c,x:u,y:d}],i=f):f===i&&r.push({...c,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function ji(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...Be(s,l,l.position,!0)}:l}function Ri(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function $f(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Li=()=>!0;function Pf(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:g,onConnectStart:p,onConnect:m,onConnectEnd:v,isValidConnection:x=Li,onReconnectEnd:_,updateConnection:h,getTransform:w,getFromHandle:C,autoPanSpeed:E,dragThreshold:S=1,handleDomNode:M}){const z=Ni(e.target);let O=0,k;const{x:T,y:j}=pe(e),b=Ri(i,M),I=a?.getBoundingClientRect();let N=!1;if(!I||!b)return;const $=ji(r,b,o,l,t);if(!$)return;let A=pe(e,I),D=!1,H=null,L=!1,R=null;function F(){if(!u||!I)return;const[K,q]=_i(A,I,E);f({x:K,y:q}),O=requestAnimationFrame(F)}const B={...$,nodeId:r,type:b,position:$.position},Z=l.get(r);let W={inProgress:!0,isValid:null,from:Be(Z,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:Z,to:A,toHandle:null,toPosition:Yo[B.position],toNode:null,pointer:A};function V(){N=!0,h(W),p?.(e,{nodeId:r,handleId:o,handleType:b})}S===0&&V();function Y(K){if(!N){const{x:ae,y:ke}=pe(K),_e=ae-T,De=ke-j;if(!(_e*_e+De*De>S*S))return;V()}if(!C()||!B){Q(K);return}const q=w();A=pe(K,I),k=Af(At(A,q,!1,[1,1]),n,l,B),D||(F(),D=!0);const G=Oi(K,{handle:k,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:x,doc:z,lib:c,flowId:d,nodeLookup:l});R=G.handleDomNode,H=G.connection,L=$f(!!k,G.isValid);const ee=l.get(r),ne=ee?Be(ee,B,X.Left,!0):W.from,te={...W,from:ne,isValid:L,to:G.toHandle&&L?nn({x:G.toHandle.x,y:G.toHandle.y},q):A,toHandle:G.toHandle,toPosition:L&&G.toHandle?G.toHandle.position:Yo[B.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:A};h(te),W=te}function Q(K){if(!("touches"in K&&K.touches.length>0)){if(N){(k||R)&&H&&L&&m?.(H);const{inProgress:q,...G}=W,ee={...G,toPosition:W.toHandle?W.toPosition:null};v?.(K,ee),i&&_?.(K,ee)}g(),cancelAnimationFrame(O),D=!1,L=!1,H=null,R=null,z.removeEventListener("mousemove",Y),z.removeEventListener("mouseup",Q),z.removeEventListener("touchmove",Y),z.removeEventListener("touchend",Q)}}z.addEventListener("mousemove",Y),z.addEventListener("mouseup",Q),z.addEventListener("touchmove",Y),z.addEventListener("touchend",Q)}function Oi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Li,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:p}=pe(e),m=s.elementFromPoint(g,p),v=m?.classList.contains(`${a}-flow__handle`)?m:f,x={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const _=Ri(void 0,v),h=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),C=v.classList.contains("connectable"),E=v.classList.contains("connectableend");if(!h||!_)return x;const S={source:d?h:o,sourceHandle:d?w:r,target:d?o:h,targetHandle:d?r:w};x.connection=S;const z=C&&E&&(n===et.Strict?d&&_==="source"||!d&&_==="target":h!==o||w!==r);x.isValid=z&&c(S),x.toHandle=ji(h,_,w,u,n,!0)}return x}const Un={onPointerDown:Pf,isValid:Oi};function Df({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:g=!1}){const p=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const w=n(),C=h.sourceEvent.ctrlKey&&Et()?10:1,E=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*u,S=w[2]*Math.pow(2,E*C);t.scaleTo(S)};let m=[0,0];const v=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(m=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},x=h=>{const w=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const C=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],E=[C[0]-m[0],C[1]-m[1]];m=C;const S=o()*Math.max(w[2],Math.log(w[2]))*(g?-1:1),M={x:w[0]-E[0]*S,y:w[1]-E[1]*S},z=[[0,0],[l,c]];t.setViewportConstrained({x:M.x,y:M.y,zoom:w[2]},z,a)},_=gi().on("start",v).on("zoom",d?x:null).on("zoom.wheel",f?p:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const hn=e=>({x:e.x,y:e.y,zoom:e.k}),kn=({x:e,y:t,zoom:n})=>un.translate(e,t).scale(n),We=(e,t)=>e.target.closest(`.${t}`),Vi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Tf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,In=(e,t=0,n=Tf,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Bi=e=>{const t=e.ctrlKey&&Et()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Hf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(We(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const v=de(u),x=Bi(u),_=d*Math.pow(2,x);o.scaleTo(n,_,v,u);return}const f=u.deltaMode===1?20:1;let g=r===Re.Vertical?0:u.deltaX*f,p=r===Re.Horizontal?0:u.deltaY*f;!Et()&&u.shiftKey&&r!==Re.Vertical&&(g=u.deltaY*f,p=0),o.translateBy(n,-(g/d)*i,-(p/d)*i,{internal:!0});const m=hn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,m),e.panScrollTimeout=setTimeout(()=>{c?.(u,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a?.(u,m))}}function jf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=We(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Rf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=hn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Lf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Vi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,hn(i.transform))}}function Of({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Vi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=hn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Vf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return d=>{const f=e||t,g=n&&d.ctrlKey,p=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(We(d,`${c}-flow__node`)||We(d,`${c}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!p||We(d,a)&&p||We(d,l)&&(!p||r&&p&&!e)||!n&&d.ctrlKey&&p)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!g&&p||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const m=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||p)&&m}}function Bf({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=gi().scaleExtent([t,n]).translateExtent(o),f=le(e).call(d);_({x:r.x,y:r.y,zoom:tt(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=f.on("wheel.zoom"),p=f.on("dblclick.zoom");d.wheelDelta(Bi);function m(k,T){return f?new Promise(j=>{d?.interpolate(T?.interpolate==="linear"?pt:Ft).transform(In(f,T?.duration,T?.ease,()=>j(!0)),k)}):Promise.resolve(!1)}function v({noWheelClassName:k,noPanClassName:T,onPaneContextMenu:j,userSelectionActive:b,panOnScroll:I,panOnDrag:N,panOnScrollMode:$,panOnScrollSpeed:A,preventScrolling:D,zoomOnPinch:H,zoomOnScroll:L,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:B,onTransformChange:Z,connectionInProgress:U,paneClickDistance:W,selectionOnDrag:V}){b&&!c.isZoomingOrPanning&&x();const Y=I&&!F&&!b;d.clickDistance(V?1/0:!ge(W)||W<0?0:W);const Q=Y?Hf({zoomPanValues:c,noWheelClassName:k,d3Selection:f,d3Zoom:d,panOnScrollMode:$,panOnScrollSpeed:A,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):jf({noWheelClassName:k,preventScrolling:D,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!b){const q=Rf({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});d.on("start",q);const G=Lf({zoomPanValues:c,panOnDrag:N,onPaneContextMenu:!!j,onPanZoom:i,onTransformChange:Z});d.on("zoom",G);const ee=Of({zoomPanValues:c,panOnDrag:N,panOnScroll:I,onPaneContextMenu:j,onPanZoomEnd:a,onDraggingChange:l});d.on("end",ee)}const K=Vf({zoomActivationKeyPressed:F,panOnDrag:N,zoomOnScroll:L,panOnScroll:I,zoomOnDoubleClick:R,zoomOnPinch:H,userSelectionActive:b,noPanClassName:T,noWheelClassName:k,lib:B,connectionInProgress:U});d.filter(K),R?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function x(){d.on("zoom",null)}async function _(k,T,j){const b=kn(k),I=d?.constrain()(b,T,j);return I&&await m(I),new Promise(N=>N(I))}async function h(k,T){const j=kn(k);return await m(j,T),new Promise(b=>b(j))}function w(k){if(f){const T=kn(k),j=f.property("__zoom");(j.k!==k.zoom||j.x!==k.x||j.y!==k.y)&&d?.transform(f,T,null,{sync:!0})}}function C(){const k=f?hi(f.node()):{x:0,y:0,k:1};return{x:k.x,y:k.y,zoom:k.k}}function E(k,T){return f?new Promise(j=>{d?.interpolate(T?.interpolate==="linear"?pt:Ft).scaleTo(In(f,T?.duration,T?.ease,()=>j(!0)),k)}):Promise.resolve(!1)}function S(k,T){return f?new Promise(j=>{d?.interpolate(T?.interpolate==="linear"?pt:Ft).scaleBy(In(f,T?.duration,T?.ease,()=>j(!0)),k)}):Promise.resolve(!1)}function M(k){d?.scaleExtent(k)}function z(k){d?.translateExtent(k)}function O(k){const T=!ge(k)||k<0?0:k;d?.clickDistance(T)}return{update:v,destroy:x,setViewport:h,setViewportConstrained:_,getViewport:C,scaleTo:E,scaleBy:S,setScaleExtent:M,setTranslateExtent:z,syncViewport:w,setClickDistance:O}}var rt;(function(e){e.Line="line",e.Handle="handle"})(rt||(rt={}));function Ff({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function rr(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ie(e,t){return Math.max(0,t-e)}function ze(e,t){return Math.max(0,e-t)}function Lt(e,t,n){return Math.max(0,t-e,e-n)}function ir(e,t){return e?!t:t}function Xf(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:g,ySnapped:p}=n,{minWidth:m,maxWidth:v,minHeight:x,maxHeight:_}=o,{x:h,y:w,width:C,height:E,aspectRatio:S}=e;let M=Math.floor(u?g-e.pointerX:0),z=Math.floor(d?p-e.pointerY:0);const O=C+(l?-M:M),k=E+(c?-z:z),T=-i[0]*C,j=-i[1]*E;let b=Lt(O,m,v),I=Lt(k,x,_);if(s){let A=0,D=0;l&&M<0?A=Ie(h+M+T,s[0][0]):!l&&M>0&&(A=ze(h+O+T,s[1][0])),c&&z<0?D=Ie(w+z+j,s[0][1]):!c&&z>0&&(D=ze(w+k+j,s[1][1])),b=Math.max(b,A),I=Math.max(I,D)}if(a){let A=0,D=0;l&&M>0?A=ze(h+M,a[0][0]):!l&&M<0&&(A=Ie(h+O,a[1][0])),c&&z>0?D=ze(w+z,a[0][1]):!c&&z<0&&(D=Ie(w+k,a[1][1])),b=Math.max(b,A),I=Math.max(I,D)}if(r){if(u){const A=Lt(O/S,x,_)*S;if(b=Math.max(b,A),s){let D=0;!l&&!c||l&&!c&&f?D=ze(w+j+O/S,s[1][1])*S:D=Ie(w+j+(l?M:-M)/S,s[0][1])*S,b=Math.max(b,D)}if(a){let D=0;!l&&!c||l&&!c&&f?D=Ie(w+O/S,a[1][1])*S:D=ze(w+(l?M:-M)/S,a[0][1])*S,b=Math.max(b,D)}}if(d){const A=Lt(k*S,m,v)/S;if(I=Math.max(I,A),s){let D=0;!l&&!c||c&&!l&&f?D=ze(h+k*S+T,s[1][0])/S:D=Ie(h+(c?z:-z)*S+T,s[0][0])/S,I=Math.max(I,D)}if(a){let D=0;!l&&!c||c&&!l&&f?D=Ie(h+k*S,a[1][0])/S:D=ze(h+(c?z:-z)*S,a[0][0])/S,I=Math.max(I,D)}}}z=z+(z<0?I:-I),M=M+(M<0?b:-b),r&&(f?O>k*S?z=(ir(l,c)?-M:M)/S:M=(ir(l,c)?-z:z)*S:u?(z=M/S,c=l):(M=z*S,l=c));const N=l?h+M:h,$=c?w+z:w;return{width:C+(l?-M:M),height:E+(c?-z:z),x:i[0]*M*(l?-1:1)+N,y:i[1]*z*(c?-1:1)+$}}const Fi={width:0,height:0,x:0,y:0},Yf={...Fi,pointerX:0,pointerY:0,aspectRatio:1};function Wf(e){return[[0,0],[e.measured.width,e.measured.height]]}function Zf(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function qf({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:rr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:g,onResize:p,onResizeEnd:m,shouldResize:v}){let x={...Fi},_={...Yf};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:rr(c)};let h,w=null,C=[],E,S,M,z=!1;const O=Jr().on("start",k=>{const{nodeLookup:T,transform:j,snapGrid:b,snapToGrid:I,nodeOrigin:N,paneDomNode:$}=n();if(h=T.get(t),!h)return;w=$?.getBoundingClientRect()??null;const{xSnapped:A,ySnapped:D}=mt(k.sourceEvent,{transform:j,snapGrid:b,snapToGrid:I,containerBounds:w});x={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},_={...x,pointerX:A,pointerY:D,aspectRatio:x.width/x.height},E=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(E=T.get(h.parentId),S=E&&h.extent==="parent"?Wf(E):void 0),C=[],M=void 0;for(const[H,L]of T)if(L.parentId===t&&(C.push({id:H,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const R=Zf(L,h,L.origin??N);M?M=[[Math.min(R[0][0],M[0][0]),Math.min(R[0][1],M[0][1])],[Math.max(R[1][0],M[1][0]),Math.max(R[1][1],M[1][1])]]:M=R}g?.(k,{...x})}).on("drag",k=>{const{transform:T,snapGrid:j,snapToGrid:b,nodeOrigin:I}=n(),N=mt(k.sourceEvent,{transform:T,snapGrid:j,snapToGrid:b,containerBounds:w}),$=[];if(!h)return;const{x:A,y:D,width:H,height:L}=x,R={},F=h.origin??I,{width:B,height:Z,x:U,y:W}=Xf(_,s.controlDirection,N,s.boundaries,s.keepAspectRatio,F,S,M),V=B!==H,Y=Z!==L,Q=U!==A&&V,K=W!==D&&Y;if(!Q&&!K&&!V&&!Y)return;if((Q||K||F[0]===1||F[1]===1)&&(R.x=Q?U:x.x,R.y=K?W:x.y,x.x=R.x,x.y=R.y,C.length>0)){const ne=U-A,te=W-D;for(const ae of C)ae.position={x:ae.position.x-ne+F[0]*(B-H),y:ae.position.y-te+F[1]*(Z-L)},$.push(ae)}if((V||Y)&&(R.width=V&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:x.width,R.height=Y&&(!s.resizeDirection||s.resizeDirection==="vertical")?Z:x.height,x.width=R.width,x.height=R.height),E&&h.expandParent){const ne=F[0]*(R.width??0);R.x&&R.x<ne&&(x.x=ne,_.x=_.x-(R.x-ne));const te=F[1]*(R.height??0);R.y&&R.y<te&&(x.y=te,_.y=_.y-(R.y-te))}const q=Ff({width:x.width,prevWidth:H,height:x.height,prevHeight:L,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...x,direction:q};v?.(k,G)!==!1&&(z=!0,p?.(k,G),o(R,$))}).on("end",k=>{z&&(m?.(k,{...x}),r?.({...x}),z=!1)});i.call(O)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var zn={exports:{}},An={},$n={exports:{}},Pn={};var sr;function Gf(){if(sr)return Pn;sr=1;var e=Tr();function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(d,f){var g=f(),p=o({inst:{value:g,getSnapshot:f}}),m=p[0].inst,v=p[1];return i(function(){m.value=g,m.getSnapshot=f,l(m)&&v({inst:m})},[d,g,f]),r(function(){return l(m)&&v({inst:m}),d(function(){l(m)&&v({inst:m})})},[d]),s(g),g}function l(d){var f=d.getSnapshot;d=d.value;try{var g=f();return!n(d,g)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Pn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Pn}var ar;function Uf(){return ar||(ar=1,$n.exports=Gf()),$n.exports}var cr;function Kf(){if(cr)return An;cr=1;var e=Tr(),t=Uf();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return An.useSyncExternalStoreWithSelector=function(c,u,d,f,g){var p=i(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function x(E){if(!_){if(_=!0,h=E,E=f(E),g!==void 0&&m.hasValue){var S=m.value;if(g(S,E))return w=S}return w=E}if(S=w,o(h,E))return S;var M=f(E);return g!==void 0&&g(S,M)?(h=E,S):(h=E,w=M)}var _=!1,h,w,C=d===void 0?null:d;return[function(){return x(u())},C===null?void 0:function(){return x(C())}]},[u,d,f,g]);var v=r(c,p[0],p[1]);return s(function(){m.hasValue=!0,m.value=v},[v]),l(v),v},An}var lr;function Qf(){return lr||(lr=1,zn.exports=Kf()),zn.exports}var Jf=Qf();const eh=ja(Jf),th={},ur=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const g=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,g))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(th?"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()}},c=t=e(o,r,l);return l},nh=e=>e?ur(e):ur,{useDebugValue:oh}=Ra,{useSyncExternalStoreWithSelector:rh}=eh,ih=e=>e;function Xi(e,t=ih,n){const o=rh(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return oh(o),o}const dr=(e,t)=>{const n=nh(e),o=(r,i=t)=>Xi(n,r,i);return Object.assign(o,n),o},sh=(e,t)=>e?dr(e,t):dr;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const gn=P.createContext(null),ah=gn.Provider,Yi=ve.error001();function J(e,t){const n=P.useContext(gn);if(n===null)throw new Error(Yi);return Xi(n,e,t)}function re(){const e=P.useContext(gn);if(e===null)throw new Error(Yi);return P.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const fr={display:"none"},ch={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Wi="react-flow__node-desc",Zi="react-flow__edge-desc",lh="react-flow__aria-live",uh=e=>e.ariaLiveMessage,dh=e=>e.ariaLabelConfig;function fh({rfId:e}){const t=J(uh);return y.jsx("div",{id:`${lh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ch,children:t})}function hh({rfId:e,disableKeyboardA11y:t}){const n=J(dh);return y.jsxs(y.Fragment,{children:[y.jsx("div",{id:`${Wi}-${e}`,style:fr,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),y.jsx("div",{id:`${Zi}-${e}`,style:fr,children:n["edge.a11yDescription.default"]}),!t&&y.jsx(fh,{rfId:e})]})}const pn=P.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return y.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});pn.displayName="Panel";function gh({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:y.jsx(pn,{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:y.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const ph=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Ot=e=>e.id;function mh(e,t){return oe(e.selectedNodes.map(Ot),t.selectedNodes.map(Ot))&&oe(e.selectedEdges.map(Ot),t.selectedEdges.map(Ot))}function yh({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(ph,mh);return P.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const xh=e=>!!e.onSelectionChangeHandlers;function wh({onSelectionChange:e}){const t=J(xh);return e||t?y.jsx(yh,{onSelectionChange:e}):null}const qi=[0,0],vh={x:0,y:0,zoom:1},bh=["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"],hr=[...bh,"rfId"],_h=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}),gr={translateExtent:bt,nodeOrigin:qi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Sh(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=J(_h,oe),c=re();P.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=gr,a()}),[]);const u=P.useRef(gr);return P.useEffect(()=>{for(const d of hr){const f=e[d],g=u.current[d];f!==g&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?c.setState({ariaLabelConfig:sf(f)}):d==="fitView"?c.setState({fitViewQueued:f}):d==="fitViewOptions"?c.setState({fitViewOptions:f}):c.setState({[d]:f})))}u.current=e},hr.map(d=>e[d])),null}function pr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Eh(e){const[t,n]=P.useState(e==="system"?null:e);return P.useEffect(()=>{if(e!=="system"){n(e);return}const o=pr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:pr()?.matches?"dark":"light"}const mr=typeof document<"u"?document:null;function Ct(e=null,t={target:mr,actInsideInputWithModifier:!0}){const[n,o]=P.useState(!1),r=P.useRef(!1),i=P.useRef(new Set([])),[s,a]=P.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
2
+ `).replace(`
3
+
4
+ `,`
5
+ +`).split(`
6
+ `)),u=c.reduce((d,f)=>d.concat(...f),[]);return[c,u]}return[[],[]]},[e]);return P.useEffect(()=>{const l=t?.target??mr,c=t?.actInsideInputWithModifier??!0;if(e!==null){const u=g=>{if(r.current=g.ctrlKey||g.metaKey||g.shiftKey||g.altKey,(!r.current||r.current&&!c)&&Mi(g))return!1;const m=xr(g.code,a);if(i.current.add(g[m]),yr(s,i.current,!1)){const v=g.composedPath?.()?.[0]||g.target,x=v?.nodeName==="BUTTON"||v?.nodeName==="A";t.preventDefault!==!1&&(r.current||!x)&&g.preventDefault(),o(!0)}},d=g=>{const p=xr(g.code,a);yr(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(g[p]),g.key==="Meta"&&i.current.clear(),r.current=!1},f=()=>{i.current.clear(),o(!1)};return l?.addEventListener("keydown",u),l?.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{l?.removeEventListener("keydown",u),l?.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,o]),n}function yr(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function xr(e,t){return t.includes(e)?"code":"key"}const Ch=()=>{const e=re();return P.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=co(t,o,r,i,s,n?.padding??.1);return a?(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return At(c,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=nn(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function Gi(e,t){const n=[],o=new Map,r=[];for(const i of e)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{const s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(const i of t){const s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const l of s)Nh(l,a);n.push(a)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Nh(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Ui(e,t){return Gi(e,t)}function Ki(e,t){return Gi(e,t)}function Te(e,t){return{id:e,type:"select",selected:t}}function Ze(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(Te(i.id,s)))}return o}function wr({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,i]of e.entries()){const s=t.get(i.id),a=s?.internals?.userNode??s;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:"replace"}),a===void 0&&n.push({item:i,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function vr(e){return{id:e.id,type:"remove"}}const br=e=>Gd(e),Mh=e=>wi(e);function Qi(e){return P.forwardRef(e)}const kh=typeof window<"u"?P.useLayoutEffect:P.useEffect;function _r(e){const[t,n]=P.useState(BigInt(0)),[o]=P.useState(()=>Ih(()=>n(r=>r+BigInt(1))));return kh(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function Ih(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Ji=P.createContext(null);function zh({children:e}){const t=re(),n=P.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:u,onNodesChange:d,nodeLookup:f,fitViewQueued:g,onNodesChangeMiddlewareMap:p}=t.getState();let m=l;for(const x of a)m=typeof x=="function"?x(m):x;let v=wr({items:m,lookup:f});for(const x of p.values())v=x(v);u&&c(m),v.length>0?d?.(v):g&&window.requestAnimationFrame(()=>{const{fitViewQueued:x,nodes:_,setNodes:h}=t.getState();x&&h(_)})},[]),o=_r(n),r=P.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:u,onEdgesChange:d,edgeLookup:f}=t.getState();let g=l;for(const p of a)g=typeof p=="function"?p(g):p;u?c(g):d&&d(wr({items:g,lookup:f}))},[]),i=_r(r),s=P.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return y.jsx(Ji.Provider,{value:s,children:e})}function Ah(){const e=P.useContext(Ji);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const $h=e=>!!e.panZoom;function mn(){const e=Ch(),t=re(),n=Ah(),o=J($h),r=P.useMemo(()=>{const i=d=>t.getState().nodeLookup.get(d),s=d=>{n.nodeQueue.push(d)},a=d=>{n.edgeQueue.push(d)},l=d=>{const{nodeLookup:f,nodeOrigin:g}=t.getState(),p=br(d)?d:f.get(d.id),m=p.parentId?Ci(p.position,p.measured,p.parentId,f,g):p.position,v={...p,position:m,width:p.measured?.width??p.width,height:p.measured?.height??p.height};return nt(v)},c=(d,f,g={replace:!1})=>{s(p=>p.map(m=>{if(m.id===d){const v=typeof f=="function"?f(m):f;return g.replace&&br(v)?v:{...m,...v}}return m}))},u=(d,f,g={replace:!1})=>{a(p=>p.map(m=>{if(m.id===d){const v=typeof f=="function"?f(m):f;return g.replace&&Mh(v)?v:{...m,...v}}return m}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>i(d)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(f=>({...f}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:s,setEdges:a,addNodes:d=>{const f=Array.isArray(d)?d:[d];n.nodeQueue.push(g=>[...g,...f])},addEdges:d=>{const f=Array.isArray(d)?d:[d];n.edgeQueue.push(g=>[...g,...f])},toObject:()=>{const{nodes:d=[],edges:f=[],transform:g}=t.getState(),[p,m,v]=g;return{nodes:d.map(x=>({...x})),edges:f.map(x=>({...x})),viewport:{x:p,y:m,zoom:v}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{const{nodes:g,edges:p,onNodesDelete:m,onEdgesDelete:v,triggerNodeChanges:x,triggerEdgeChanges:_,onDelete:h,onBeforeDelete:w}=t.getState(),{nodes:C,edges:E}=await ef({nodesToRemove:d,edgesToRemove:f,nodes:g,edges:p,onBeforeDelete:w}),S=E.length>0,M=C.length>0;if(S){const z=E.map(vr);v?.(E),_(z)}if(M){const z=C.map(vr);m?.(C),x(z)}return(M||S)&&h?.({nodes:C,edges:E}),{deletedNodes:C,deletedEdges:E}},getIntersectingNodes:(d,f=!0,g)=>{const p=Zo(d),m=p?d:l(d),v=g!==void 0;return m?(g||t.getState().nodes).filter(x=>{const _=t.getState().nodeLookup.get(x.id);if(_&&!p&&(x.id===d.id||!_.internals.positionAbsolute))return!1;const h=nt(v?x:_),w=St(h,m);return f&&w>0||w>=h.width*h.height||w>=m.width*m.height}):[]},isNodeIntersecting:(d,f,g=!0)=>{const m=Zo(d)?d:l(d);if(!m)return!1;const v=St(m,f);return g&&v>0||v>=f.width*f.height||v>=m.width*m.height},updateNode:c,updateNodeData:(d,f,g={replace:!1})=>{c(d,p=>{const m=typeof f=="function"?f(p):f;return g.replace?{...p,data:m}:{...p,data:{...p.data,...m}}},g)},updateEdge:u,updateEdgeData:(d,f,g={replace:!1})=>{u(d,p=>{const m=typeof f=="function"?f(p):f;return g.replace?{...p,data:m}:{...p,data:{...p.data,...m}}},g)},getNodesBounds:d=>{const{nodeLookup:f,nodeOrigin:g}=t.getState();return Ud(d,{nodeLookup:f,nodeOrigin:g})},getHandleConnections:({type:d,id:f,nodeId:g})=>Array.from(t.getState().connectionLookup.get(`${g}-${d}${f?`-${f}`:""}`)?.values()??[]),getNodeConnections:({type:d,handleId:f,nodeId:g})=>Array.from(t.getState().connectionLookup.get(`${g}${d?f?`-${d}-${f}`:`-${d}`:""}`)?.values()??[]),fitView:async d=>{const f=t.getState().fitViewResolver??rf();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(g=>[...g]),f.promise}}},[]);return P.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const Sr=e=>e.selected,Ph=typeof window<"u"?window:void 0;function Dh({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=re(),{deleteElements:o}=mn(),r=Ct(e,{actInsideInputWithModifier:!1}),i=Ct(t,{target:Ph});P.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter(Sr),edges:s.filter(Sr)}),n.setState({nodesSelectionActive:!1})}},[r]),P.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Th(e){const t=re();P.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=lo(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",ve.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const yn={position:"absolute",width:"100%",height:"100%",top:0,left:0},Hh=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function jh({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=Re.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:g=!0,children:p,noWheelClassName:m,noPanClassName:v,onViewportChange:x,isControlledViewport:_,paneClickDistance:h,selectionOnDrag:w}){const C=re(),E=P.useRef(null),{userSelectionActive:S,lib:M,connectionInProgress:z}=J(Hh,oe),O=Ct(f),k=P.useRef();Th(E);const T=P.useCallback(j=>{x?.({x:j[0],y:j[1],zoom:j[2]}),_||C.setState({transform:j})},[x,_]);return P.useEffect(()=>{if(E.current){k.current=Bf({domNode:E.current,minZoom:u,maxZoom:d,translateExtent:c,viewport:l,onDraggingChange:N=>C.setState({paneDragging:N}),onPanZoomStart:(N,$)=>{const{onViewportChangeStart:A,onMoveStart:D}=C.getState();D?.(N,$),A?.($)},onPanZoom:(N,$)=>{const{onViewportChange:A,onMove:D}=C.getState();D?.(N,$),A?.($)},onPanZoomEnd:(N,$)=>{const{onViewportChangeEnd:A,onMoveEnd:D}=C.getState();D?.(N,$),A?.($)}});const{x:j,y:b,zoom:I}=k.current.getViewport();return C.setState({panZoom:k.current,transform:[j,b,I],domNode:E.current.closest(".react-flow")}),()=>{k.current?.destroy()}}},[]),P.useEffect(()=>{k.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:O,preventScrolling:g,noPanClassName:v,userSelectionActive:S,noWheelClassName:m,lib:M,onTransformChange:T,connectionInProgress:z,selectionOnDrag:w,paneClickDistance:h})},[e,t,n,o,r,i,s,a,O,g,v,S,m,M,T,z,w,h]),y.jsx("div",{className:"react-flow__renderer",ref:E,style:yn,children:p})}const Rh=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Lh(){const{userSelectionActive:e,userSelectionRect:t}=J(Rh,oe);return e&&t?y.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Dn=(e,t)=>n=>{n.target===t.current&&e?.(n)},Oh=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Vh({isSelecting:e,selectionKeyPressed:t,selectionMode:n=_t.Full,panOnDrag:o,paneClickDistance:r,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:g,children:p}){const m=re(),{userSelectionActive:v,elementsSelectable:x,dragging:_,connectionInProgress:h}=J(Oh,oe),w=x&&(e||v),C=P.useRef(null),E=P.useRef(),S=P.useRef(new Set),M=P.useRef(new Set),z=P.useRef(!1),O=A=>{if(z.current||h){z.current=!1;return}l?.(A),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},k=A=>{if(Array.isArray(o)&&o?.includes(2)){A.preventDefault();return}c?.(A)},T=u?A=>u(A):void 0,j=A=>{z.current&&(A.stopPropagation(),z.current=!1)},b=A=>{const{domNode:D}=m.getState();if(E.current=D?.getBoundingClientRect(),!E.current)return;const H=A.target===C.current;if(!H&&!!A.target.closest(".nokey")||!e||!(i&&H||t)||A.button!==0||!A.isPrimary)return;A.target?.setPointerCapture?.(A.pointerId),z.current=!1;const{x:F,y:B}=pe(A.nativeEvent,E.current);m.setState({userSelectionRect:{width:0,height:0,startX:F,startY:B,x:F,y:B}}),H||(A.stopPropagation(),A.preventDefault())},I=A=>{const{userSelectionRect:D,transform:H,nodeLookup:L,edgeLookup:R,connectionLookup:F,triggerNodeChanges:B,triggerEdgeChanges:Z,defaultEdgeOptions:U,resetSelectedElements:W}=m.getState();if(!E.current||!D)return;const{x:V,y:Y}=pe(A.nativeEvent,E.current),{startX:Q,startY:K}=D;if(!z.current){const te=t?0:r;if(Math.hypot(V-Q,Y-K)<=te)return;W(),s?.(A)}z.current=!0;const q={startX:Q,startY:K,x:V<Q?V:Q,y:Y<K?Y:K,width:Math.abs(V-Q),height:Math.abs(Y-K)},G=S.current,ee=M.current;S.current=new Set(ao(L,q,H,n===_t.Partial,!0).map(te=>te.id)),M.current=new Set;const ne=U?.selectable??!0;for(const te of S.current){const ae=F.get(te);if(ae)for(const{edgeId:ke}of ae.values()){const _e=R.get(ke);_e&&(_e.selectable??ne)&&M.current.add(ke)}}if(!qo(G,S.current)){const te=Ze(L,S.current,!0);B(te)}if(!qo(ee,M.current)){const te=Ze(R,M.current);Z(te)}m.setState({userSelectionRect:q,userSelectionActive:!0,nodesSelectionActive:!1})},N=A=>{A.button===0&&(A.target?.releasePointerCapture?.(A.pointerId),!v&&A.target===C.current&&m.getState().userSelectionRect&&O?.(A),m.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(a?.(A),m.setState({nodesSelectionActive:S.current.size>0})))},$=o===!0||Array.isArray(o)&&o.includes(0);return y.jsxs("div",{className:ie(["react-flow__pane",{draggable:$,dragging:_,selection:e}]),onClick:w?void 0:Dn(O,C),onContextMenu:Dn(k,C),onWheel:Dn(T,C),onPointerEnter:w?void 0:d,onPointerMove:w?I:f,onPointerUp:w?N:void 0,onPointerDownCapture:w?b:void 0,onClickCapture:w?j:void 0,onPointerLeave:g,ref:C,style:yn,children:[p,y.jsx(Lh,{})]})}function Kn({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l?.("012",ve.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function es({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=re(),[l,c]=P.useState(!1),u=P.useRef();return P.useEffect(()=>{u.current=kf({getStoreItems:()=>a.getState(),onNodeMouseDown:d=>{Kn({id:d,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),P.useEffect(()=>{if(t)u.current?.destroy();else if(e.current)return u.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s}),()=>{u.current?.destroy()}},[n,o,t,i,e,r]),l}const Bh=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function ts(){const e=re();return P.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:u}=e.getState(),d=new Map,f=Bh(s),g=r?i[0]:5,p=r?i[1]:5,m=n.direction.x*g*n.factor,v=n.direction.y*p*n.factor;for(const[,x]of c){if(!f(x))continue;let _={x:x.internals.positionAbsolute.x+m,y:x.internals.positionAbsolute.y+v};r&&(_=zt(_,i));const{position:h,positionAbsolute:w}=vi({nodeId:x.id,nextPosition:_,nodeLookup:c,nodeExtent:o,nodeOrigin:u,onError:a});x.position=h,x.internals.positionAbsolute=w,d.set(x.id,x)}l(d)},[])}const mo=P.createContext(null),Fh=mo.Provider;mo.Consumer;const ns=()=>P.useContext(mo),Xh=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Yh=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===et.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:u&&c}};function Wh({type:e="source",position:t=X.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:d,...f},g){const p=s||null,m=e==="target",v=re(),x=ns(),{connectOnClick:_,noPanClassName:h,rfId:w}=J(Xh,oe),{connectingFrom:C,connectingTo:E,clickConnecting:S,isPossibleEndHandle:M,connectionInProcess:z,clickConnectionInProcess:O,valid:k}=J(Yh(x,p,e),oe);x||v.getState().onError?.("010",ve.error010());const T=I=>{const{defaultEdgeOptions:N,onConnect:$,hasDefaultEdges:A}=v.getState(),D={...N,...I};if(A){const{edges:H,setEdges:L}=v.getState();L(ff(D,H))}$?.(D),a?.(D)},j=I=>{if(!x)return;const N=ki(I.nativeEvent);if(r&&(N&&I.button===0||!N)){const $=v.getState();Un.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:$.autoPanOnConnect,connectionMode:$.connectionMode,connectionRadius:$.connectionRadius,domNode:$.domNode,nodeLookup:$.nodeLookup,lib:$.lib,isTarget:m,handleId:p,nodeId:x,flowId:$.rfId,panBy:$.panBy,cancelConnection:$.cancelConnection,onConnectStart:$.onConnectStart,onConnectEnd:$.onConnectEnd,updateConnection:$.updateConnection,onConnect:T,isValidConnection:n||$.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:$.autoPanSpeed,dragThreshold:$.connectionDragThreshold})}N?u?.(I):d?.(I)},b=I=>{const{onClickConnectStart:N,onClickConnectEnd:$,connectionClickStartHandle:A,connectionMode:D,isValidConnection:H,lib:L,rfId:R,nodeLookup:F,connection:B}=v.getState();if(!x||!A&&!r)return;if(!A){N?.(I.nativeEvent,{nodeId:x,handleId:p,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:x,type:e,id:p}});return}const Z=Ni(I.target),U=n||H,{connection:W,isValid:V}=Un.isValid(I.nativeEvent,{handle:{nodeId:x,id:p,type:e},connectionMode:D,fromNodeId:A.nodeId,fromHandleId:A.id||null,fromType:A.type,isValidConnection:U,flowId:R,doc:Z,lib:L,nodeLookup:F});V&&W&&T(W);const Y=structuredClone(B);delete Y.inProgress,Y.toPosition=Y.toHandle?Y.toHandle.position:null,$?.(I,Y),v.setState({connectionClickStartHandle:null})};return y.jsx("div",{"data-handleid":p,"data-nodeid":x,"data-handlepos":t,"data-id":`${w}-${x}-${p}-${e}`,className:ie(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",h,c,{source:!m,target:m,connectable:o,connectablestart:r,connectableend:i,clickconnecting:S,connectingfrom:C,connectingto:E,valid:k,connectionindicator:o&&(!z||M)&&(z||O?i:r)}]),onMouseDown:j,onTouchStart:j,onClick:_?b:void 0,ref:g,...f,children:l})}const it=P.memo(Qi(Wh));function Zh({data:e,isConnectable:t,sourcePosition:n=X.Bottom}){return y.jsxs(y.Fragment,{children:[e?.label,y.jsx(it,{type:"source",position:n,isConnectable:t})]})}function qh({data:e,isConnectable:t,targetPosition:n=X.Top,sourcePosition:o=X.Bottom}){return y.jsxs(y.Fragment,{children:[y.jsx(it,{type:"target",position:n,isConnectable:t}),e?.label,y.jsx(it,{type:"source",position:o,isConnectable:t})]})}function Gh(){return null}function Uh({data:e,isConnectable:t,targetPosition:n=X.Top}){return y.jsxs(y.Fragment,{children:[y.jsx(it,{type:"target",position:n,isConnectable:t}),e?.label]})}const on={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Er={input:Zh,default:qh,output:Uh,group:Gh};function Kh(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const Qh=e=>{const{width:t,height:n,x:o,y:r}=It(e.nodeLookup,{filter:i=>!!i.selected});return{width:ge(t)?t:null,height:ge(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Jh({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=re(),{width:r,height:i,transformString:s,userSelectionActive:a}=J(Qh,oe),l=ts(),c=P.useRef(null);if(P.useEffect(()=>{n||c.current?.focus({preventScroll:!0})},[n]),es({nodeRef:c}),a||!r||!i)return null;const u=e?f=>{const g=o.getState().nodes.filter(p=>p.selected);e(f,g)}:void 0,d=f=>{Object.prototype.hasOwnProperty.call(on,f.key)&&(f.preventDefault(),l({direction:on[f.key],factor:f.shiftKey?4:1}))};return y.jsx("div",{className:ie(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:y.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:r,height:i}})})}const Cr=typeof window<"u"?window:void 0,eg=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function os({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:m,zoomActivationKeyCode:v,elementsSelectable:x,zoomOnScroll:_,zoomOnPinch:h,panOnScroll:w,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:S,panOnDrag:M,defaultViewport:z,translateExtent:O,minZoom:k,maxZoom:T,preventScrolling:j,onSelectionContextMenu:b,noWheelClassName:I,noPanClassName:N,disableKeyboardA11y:$,onViewportChange:A,isControlledViewport:D}){const{nodesSelectionActive:H,userSelectionActive:L}=J(eg,oe),R=Ct(c,{target:Cr}),F=Ct(m,{target:Cr}),B=F||M,Z=F||w,U=u&&B!==!0,W=R||L||U;return Dh({deleteKeyCode:l,multiSelectionKeyCode:p}),y.jsx(jh,{onPaneContextMenu:i,elementsSelectable:x,zoomOnScroll:_,zoomOnPinch:h,panOnScroll:Z,panOnScrollSpeed:C,panOnScrollMode:E,zoomOnDoubleClick:S,panOnDrag:!R&&B,defaultViewport:z,translateExtent:O,minZoom:k,maxZoom:T,zoomActivationKeyCode:v,preventScrolling:j,noWheelClassName:I,noPanClassName:N,onViewportChange:A,isControlledViewport:D,paneClickDistance:a,selectionOnDrag:U,children:y.jsxs(Vh,{onSelectionStart:f,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:B,isSelecting:!!W,selectionMode:d,selectionKeyPressed:R,paneClickDistance:a,selectionOnDrag:U,children:[e,H&&y.jsx(Jh,{onSelectionContextMenu:b,noPanClassName:N,disableKeyboardA11y:$})]})})}os.displayName="FlowRenderer";const tg=P.memo(os),ng=e=>t=>e?ao(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function og(e){return J(P.useCallback(ng(e),[e]),oe)}const rg=e=>e.updateNodeInternals;function ig(){const e=J(rg),[t]=P.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),e(o)}));return P.useEffect(()=>()=>{t?.disconnect()},[t]),t}function sg({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=re(),i=P.useRef(null),s=P.useRef(null),a=P.useRef(e.sourcePosition),l=P.useRef(e.targetPosition),c=P.useRef(t),u=n&&!!e.internals.handleBounds;return P.useEffect(()=>{i.current&&!e.hidden&&(!u||s.current!==i.current)&&(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[u,e.hidden]),P.useEffect(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),P.useEffect(()=>{if(i.current){const d=c.current!==t,f=a.current!==e.sourcePosition,g=l.current!==e.targetPosition;(d||f||g)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function ag({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:g,disableKeyboardA11y:p,rfId:m,nodeTypes:v,nodeClickDistance:x,onError:_}){const{node:h,internals:w,isParent:C}=J(V=>{const Y=V.nodeLookup.get(e),Q=V.parentLookup.has(e);return{node:Y,internals:Y.internals,isParent:Q}},oe);let E=h.type||"default",S=v?.[E]||Er[E];S===void 0&&(_?.("003",ve.error003(E)),E="default",S=v?.default||Er.default);const M=!!(h.draggable||a&&typeof h.draggable>"u"),z=!!(h.selectable||l&&typeof h.selectable>"u"),O=!!(h.connectable||c&&typeof h.connectable>"u"),k=!!(h.focusable||u&&typeof h.focusable>"u"),T=re(),j=Ei(h),b=sg({node:h,nodeType:E,hasDimensions:j,resizeObserver:d}),I=es({nodeRef:b,disabled:h.hidden||!M,noDragClassName:f,handleSelector:h.dragHandle,nodeId:e,isSelectable:z,nodeClickDistance:x}),N=ts();if(h.hidden)return null;const $=Me(h),A=Kh(h),D=z||M||t||n||o||r,H=n?V=>n(V,{...w.userNode}):void 0,L=o?V=>o(V,{...w.userNode}):void 0,R=r?V=>r(V,{...w.userNode}):void 0,F=i?V=>i(V,{...w.userNode}):void 0,B=s?V=>s(V,{...w.userNode}):void 0,Z=V=>{const{selectNodesOnDrag:Y,nodeDragThreshold:Q}=T.getState();z&&(!Y||!M||Q>0)&&Kn({id:e,store:T,nodeRef:b}),t&&t(V,{...w.userNode})},U=V=>{if(!(Mi(V.nativeEvent)||p)){if(pi.includes(V.key)&&z){const Y=V.key==="Escape";Kn({id:e,store:T,unselect:Y,nodeRef:b})}else if(M&&h.selected&&Object.prototype.hasOwnProperty.call(on,V.key)){V.preventDefault();const{ariaLabelConfig:Y}=T.getState();T.setState({ariaLiveMessage:Y["node.a11yDescription.ariaLiveMessage"]({direction:V.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),N({direction:on[V.key],factor:V.shiftKey?4:1})}}},W=()=>{if(p||!b.current?.matches(":focus-visible"))return;const{transform:V,width:Y,height:Q,autoPanOnNodeFocus:K,setCenter:q}=T.getState();if(!K)return;ao(new Map([[e,h]]),{x:0,y:0,width:Y,height:Q},V,!0).length>0||q(h.position.x+$.width/2,h.position.y+$.height/2,{zoom:V[2]})};return y.jsx("div",{className:ie(["react-flow__node",`react-flow__node-${E}`,{[g]:M},h.className,{selected:h.selected,selectable:z,parent:C,draggable:M,dragging:I}]),ref:b,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:D?"all":"none",visibility:j?"visible":"hidden",...h.style,...A},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:H,onMouseMove:L,onMouseLeave:R,onContextMenu:F,onClick:Z,onDoubleClick:B,onKeyDown:k?U:void 0,tabIndex:k?0:void 0,onFocus:k?W:void 0,role:h.ariaRole??(k?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${Wi}-${m}`,"aria-label":h.ariaLabel,...h.domAttributes,children:y.jsx(Fh,{value:e,children:y.jsx(S,{id:e,data:h.data,type:E,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:h.selected??!1,selectable:z,draggable:M,deletable:h.deletable??!0,isConnectable:O,sourcePosition:h.sourcePosition,targetPosition:h.targetPosition,dragging:I,dragHandle:h.dragHandle,zIndex:w.z,parentId:h.parentId,...$})})})}var cg=P.memo(ag);const lg=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function rs(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:i}=J(lg,oe),s=og(e.onlyRenderVisibleElements),a=ig();return y.jsx("div",{className:"react-flow__nodes",style:yn,children:s.map(l=>y.jsx(cg,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},l))})}rs.displayName="NodeRenderer";const ug=P.memo(rs);function dg(e){return J(P.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&lf({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),oe)}const fg=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return y.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},hg=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return y.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Nr={[en.Arrow]:fg,[en.ArrowClosed]:hg};function gg(e){const t=re();return P.useMemo(()=>Object.prototype.hasOwnProperty.call(Nr,e)?Nr[e]:(t.getState().onError?.("009",ve.error009(e)),null),[e])}const pg=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=gg(t);return l?y.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:y.jsx(l,{color:n,strokeWidth:s})}):null},is=({defaultColor:e,rfId:t})=>{const n=J(i=>i.edges),o=J(i=>i.defaultEdgeOptions),r=P.useMemo(()=>yf(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?y.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:y.jsx("defs",{children:r.map(i=>y.jsx(pg,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};is.displayName="MarkerDefinitions";var mg=P.memo(is);function ss({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u}){const[d,f]=P.useState({x:1,y:0,width:0,height:0}),g=ie(["react-flow__edge-textwrapper",c]),p=P.useRef(null);return P.useEffect(()=>{if(p.current){const m=p.current.getBBox();f({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),n?y.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:g,visibility:d.width?"visible":"hidden",...u,children:[r&&y.jsx("rect",{width:d.width+2*s[0],x:-s[0],y:-s[1],height:d.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),y.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:p,style:o,children:n}),l]}):null}ss.displayName="EdgeText";const yg=P.memo(ss);function xn({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...u}){return y.jsxs(y.Fragment,{children:[y.jsx("path",{...u,d:e,fill:"none",className:ie(["react-flow__edge-path",u.className])}),c?y.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,o&&ge(t)&&ge(n)?y.jsx(yg,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Mr({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===X.Left||e===X.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function as({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top}){const[s,a]=Mr({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=Mr({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,f,g]=Ii({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,u,d,f,g]}function cs(e){return P.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:v,interactionWidth:x})=>{const[_,h,w]=as({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),C=e.isInternal?void 0:t;return y.jsx(xn,{id:C,path:_,labelX:h,labelY:w,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:v,interactionWidth:x})})}const xg=cs({isInternal:!1}),ls=cs({isInternal:!0});xg.displayName="SimpleBezierEdge";ls.displayName="SimpleBezierEdgeInternal";function us(e){return P.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:g=X.Bottom,targetPosition:p=X.Top,markerEnd:m,markerStart:v,pathOptions:x,interactionWidth:_})=>{const[h,w,C]=Zn({sourceX:n,sourceY:o,sourcePosition:g,targetX:r,targetY:i,targetPosition:p,borderRadius:x?.borderRadius,offset:x?.offset,stepPosition:x?.stepPosition}),E=e.isInternal?void 0:t;return y.jsx(xn,{id:E,path:h,labelX:w,labelY:C,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:m,markerStart:v,interactionWidth:_})})}const ds=us({isInternal:!1}),fs=us({isInternal:!0});ds.displayName="SmoothStepEdge";fs.displayName="SmoothStepEdgeInternal";function hs(e){return P.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return y.jsx(ds,{...n,id:o,pathOptions:P.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const wg=hs({isInternal:!1}),gs=hs({isInternal:!0});wg.displayName="StepEdge";gs.displayName="StepEdgeInternal";function ps(e){return P.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:g,markerStart:p,interactionWidth:m})=>{const[v,x,_]=$i({sourceX:n,sourceY:o,targetX:r,targetY:i}),h=e.isInternal?void 0:t;return y.jsx(xn,{id:h,path:v,labelX:x,labelY:_,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:g,markerStart:p,interactionWidth:m})})}const vg=ps({isInternal:!1}),ms=ps({isInternal:!0});vg.displayName="StraightEdge";ms.displayName="StraightEdgeInternal";function ys(e){return P.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=X.Bottom,targetPosition:a=X.Top,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:v,pathOptions:x,interactionWidth:_})=>{const[h,w,C]=zi({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:x?.curvature}),E=e.isInternal?void 0:t;return y.jsx(xn,{id:E,path:h,labelX:w,labelY:C,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:m,markerStart:v,interactionWidth:_})})}const bg=ys({isInternal:!1}),xs=ys({isInternal:!0});bg.displayName="BezierEdge";xs.displayName="BezierEdgeInternal";const kr={default:xs,straight:ms,step:gs,smoothstep:fs,simplebezier:ls},Ir={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},_g=(e,t,n)=>n===X.Left?e-t:n===X.Right?e+t:e,Sg=(e,t,n)=>n===X.Top?e-t:n===X.Bottom?e+t:e,zr="react-flow__edgeupdater";function Ar({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return y.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ie([zr,`${zr}-${a}`]),cx:_g(t,o,e),cy:Sg(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Eg({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:g}){const p=re(),m=(w,C)=>{if(w.button!==0)return;const{autoPanOnConnect:E,domNode:S,isValidConnection:M,connectionMode:z,connectionRadius:O,lib:k,onConnectStart:T,onConnectEnd:j,cancelConnection:b,nodeLookup:I,rfId:N,panBy:$,updateConnection:A}=p.getState(),D=C.type==="target",H=(F,B)=>{f(!1),d?.(F,n,C.type,B)},L=F=>c?.(n,F),R=(F,B)=>{f(!0),u?.(w,n,C.type),T?.(F,B)};Un.onPointerDown(w.nativeEvent,{autoPanOnConnect:E,connectionMode:z,connectionRadius:O,domNode:S,handleId:C.id,nodeId:C.nodeId,nodeLookup:I,isTarget:D,edgeUpdaterType:C.type,lib:k,flowId:N,cancelConnection:b,panBy:$,isValidConnection:M,onConnect:L,onConnectStart:R,onConnectEnd:j,onReconnectEnd:H,updateConnection:A,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},v=w=>m(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),x=w=>m(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),_=()=>g(!0),h=()=>g(!1);return y.jsxs(y.Fragment,{children:[(e===!0||e==="source")&&y.jsx(Ar,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:v,onMouseEnter:_,onMouseOut:h,type:"source"}),(e===!0||e==="target")&&y.jsx(Ar,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:x,onMouseEnter:_,onMouseOut:h,type:"target"})]})}function Cg({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:g,rfId:p,edgeTypes:m,noPanClassName:v,onError:x,disableKeyboardA11y:_}){let h=J(q=>q.edgeLookup.get(e));const w=J(q=>q.defaultEdgeOptions);h=w?{...w,...h}:h;let C=h.type||"default",E=m?.[C]||kr[C];E===void 0&&(x?.("011",ve.error011(C)),C="default",E=m?.default||kr.default);const S=!!(h.focusable||t&&typeof h.focusable>"u"),M=typeof d<"u"&&(h.reconnectable||n&&typeof h.reconnectable>"u"),z=!!(h.selectable||o&&typeof h.selectable>"u"),O=P.useRef(null),[k,T]=P.useState(!1),[j,b]=P.useState(!1),I=re(),{zIndex:N,sourceX:$,sourceY:A,targetX:D,targetY:H,sourcePosition:L,targetPosition:R}=J(P.useCallback(q=>{const G=q.nodeLookup.get(h.source),ee=q.nodeLookup.get(h.target);if(!G||!ee)return{zIndex:h.zIndex,...Ir};const ne=mf({id:e,sourceNode:G,targetNode:ee,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:q.connectionMode,onError:x});return{zIndex:cf({selected:h.selected,zIndex:h.zIndex,sourceNode:G,targetNode:ee,elevateOnSelect:q.elevateEdgesOnSelect,zIndexMode:q.zIndexMode}),...ne||Ir}},[h.source,h.target,h.sourceHandle,h.targetHandle,h.selected,h.zIndex]),oe),F=P.useMemo(()=>h.markerStart?`url('#${qn(h.markerStart,p)}')`:void 0,[h.markerStart,p]),B=P.useMemo(()=>h.markerEnd?`url('#${qn(h.markerEnd,p)}')`:void 0,[h.markerEnd,p]);if(h.hidden||$===null||A===null||D===null||H===null)return null;const Z=q=>{const{addSelectedEdges:G,unselectNodesAndEdges:ee,multiSelectionActive:ne}=I.getState();z&&(I.setState({nodesSelectionActive:!1}),h.selected&&ne?(ee({nodes:[],edges:[h]}),O.current?.blur()):G([e])),r&&r(q,h)},U=i?q=>{i(q,{...h})}:void 0,W=s?q=>{s(q,{...h})}:void 0,V=a?q=>{a(q,{...h})}:void 0,Y=l?q=>{l(q,{...h})}:void 0,Q=c?q=>{c(q,{...h})}:void 0,K=q=>{if(!_&&pi.includes(q.key)&&z){const{unselectNodesAndEdges:G,addSelectedEdges:ee}=I.getState();q.key==="Escape"?(O.current?.blur(),G({edges:[h]})):ee([e])}};return y.jsx("svg",{style:{zIndex:N},children:y.jsxs("g",{className:ie(["react-flow__edge",`react-flow__edge-${C}`,h.className,v,{selected:h.selected,animated:h.animated,inactive:!z&&!r,updating:k,selectable:z}]),onClick:Z,onDoubleClick:U,onContextMenu:W,onMouseEnter:V,onMouseMove:Y,onMouseLeave:Q,onKeyDown:S?K:void 0,tabIndex:S?0:void 0,role:h.ariaRole??(S?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":h.ariaLabel===null?void 0:h.ariaLabel||`Edge from ${h.source} to ${h.target}`,"aria-describedby":S?`${Zi}-${p}`:void 0,ref:O,...h.domAttributes,children:[!j&&y.jsx(E,{id:e,source:h.source,target:h.target,type:h.type,selected:h.selected,animated:h.animated,selectable:z,deletable:h.deletable??!0,label:h.label,labelStyle:h.labelStyle,labelShowBg:h.labelShowBg,labelBgStyle:h.labelBgStyle,labelBgPadding:h.labelBgPadding,labelBgBorderRadius:h.labelBgBorderRadius,sourceX:$,sourceY:A,targetX:D,targetY:H,sourcePosition:L,targetPosition:R,data:h.data,style:h.style,sourceHandleId:h.sourceHandle,targetHandleId:h.targetHandle,markerStart:F,markerEnd:B,pathOptions:"pathOptions"in h?h.pathOptions:void 0,interactionWidth:h.interactionWidth}),M&&y.jsx(Eg,{edge:h,isReconnectable:M,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:g,sourceX:$,sourceY:A,targetX:D,targetY:H,sourcePosition:L,targetPosition:R,setUpdateHover:T,setReconnecting:b})]})})}var Ng=P.memo(Cg);const Mg=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ws({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:g,onReconnectEnd:p,disableKeyboardA11y:m}){const{edgesFocusable:v,edgesReconnectable:x,elementsSelectable:_,onError:h}=J(Mg,oe),w=dg(t);return y.jsxs("div",{className:"react-flow__edges",children:[y.jsx(mg,{defaultColor:e,rfId:n}),w.map(C=>y.jsx(Ng,{id:C,edgesFocusable:v,edgesReconnectable:x,elementsSelectable:_,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:g,onReconnectEnd:p,rfId:n,onError:h,edgeTypes:o,disableKeyboardA11y:m},C))]})}ws.displayName="EdgeRenderer";const kg=P.memo(ws),Ig=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function zg({children:e}){const t=J(Ig);return y.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Ag(e){const t=mn(),n=P.useRef(!1);P.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const $g=e=>e.panZoom?.syncViewport;function Pg(e){const t=J($g),n=re();return P.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Dg(e){return e.connection.inProgress?{...e.connection,to:At(e.connection.to,e.transform)}:{...e.connection}}function Tg(e){return Dg}function Hg(e){const t=Tg();return J(t,oe)}const jg=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Rg({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=J(jg,oe);return!(i&&r&&l)?null:y.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:y.jsx("g",{className:ie(["react-flow__connection",xi(a)]),children:y.jsx(vs,{style:t,type:n,CustomComponent:o,isValid:a})})})}const vs=({style:e,type:t=Ae.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:c,toNode:u,toHandle:d,toPosition:f,pointer:g}=Hg();if(!r)return;if(n)return y.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:f,connectionStatus:xi(o),toNode:u,toHandle:d,pointer:g});let p="";const m={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:f};switch(t){case Ae.Bezier:[p]=zi(m);break;case Ae.SimpleBezier:[p]=as(m);break;case Ae.Step:[p]=Zn({...m,borderRadius:0});break;case Ae.SmoothStep:[p]=Zn(m);break;default:[p]=$i(m)}return y.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:e})};vs.displayName="ConnectionLine";const Lg={};function $r(e=Lg){P.useRef(e),re(),P.useEffect(()=>{},[e])}function Og(){re(),P.useRef(!1),P.useEffect(()=>{},[])}function bs({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:g,connectionLineType:p,connectionLineStyle:m,connectionLineComponent:v,connectionLineContainerStyle:x,selectionKeyCode:_,selectionOnDrag:h,selectionMode:w,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:S,deleteKeyCode:M,onlyRenderVisibleElements:z,elementsSelectable:O,defaultViewport:k,translateExtent:T,minZoom:j,maxZoom:b,preventScrolling:I,defaultMarkerColor:N,zoomOnScroll:$,zoomOnPinch:A,panOnScroll:D,panOnScrollSpeed:H,panOnScrollMode:L,zoomOnDoubleClick:R,panOnDrag:F,onPaneClick:B,onPaneMouseEnter:Z,onPaneMouseMove:U,onPaneMouseLeave:W,onPaneScroll:V,onPaneContextMenu:Y,paneClickDistance:Q,nodeClickDistance:K,onEdgeContextMenu:q,onEdgeMouseEnter:G,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,onReconnect:ae,onReconnectStart:ke,onReconnectEnd:_e,noDragClassName:De,noWheelClassName:st,noPanClassName:at,disableKeyboardA11y:ct,nodeExtent:wn,rfId:$t,viewport:Fe,onViewportChange:lt}){return $r(e),$r(t),Og(),Ag(n),Pg(Fe),y.jsx(tg,{onPaneClick:B,onPaneMouseEnter:Z,onPaneMouseMove:U,onPaneMouseLeave:W,onPaneContextMenu:Y,onPaneScroll:V,paneClickDistance:Q,deleteKeyCode:M,selectionKeyCode:_,selectionOnDrag:h,selectionMode:w,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:C,panActivationKeyCode:E,zoomActivationKeyCode:S,elementsSelectable:O,zoomOnScroll:$,zoomOnPinch:A,zoomOnDoubleClick:R,panOnScroll:D,panOnScrollSpeed:H,panOnScrollMode:L,panOnDrag:F,defaultViewport:k,translateExtent:T,minZoom:j,maxZoom:b,onSelectionContextMenu:d,preventScrolling:I,noDragClassName:De,noWheelClassName:st,noPanClassName:at,disableKeyboardA11y:ct,onViewportChange:lt,isControlledViewport:!!Fe,children:y.jsxs(zg,{children:[y.jsx(kg,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:ae,onReconnectStart:ke,onReconnectEnd:_e,onlyRenderVisibleElements:z,onEdgeContextMenu:q,onEdgeMouseEnter:G,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,defaultMarkerColor:N,noPanClassName:at,disableKeyboardA11y:ct,rfId:$t}),y.jsx(Rg,{style:m,type:p,component:v,containerStyle:x}),y.jsx("div",{className:"react-flow__edgelabel-renderer"}),y.jsx(ug,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,nodeClickDistance:K,onlyRenderVisibleElements:z,noPanClassName:at,noDragClassName:De,disableKeyboardA11y:ct,nodeExtent:wn,rfId:$t}),y.jsx("div",{className:"react-flow__viewport-portal"})]})})}bs.displayName="GraphView";const Vg=P.memo(bs),Pr=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f="basic"}={})=>{const g=new Map,p=new Map,m=new Map,v=new Map,x=o??t??[],_=n??e??[],h=u??[0,0],w=d??bt;Ti(m,v,x);const C=Gn(_,g,p,{nodeOrigin:h,nodeExtent:w,zIndexMode:f});let E=[0,0,1];if(s&&r&&i){const S=It(g,{filter:k=>!!((k.width||k.initialWidth)&&(k.height||k.initialHeight))}),{x:M,y:z,zoom:O}=co(S,r,i,l,c,a?.padding??.1);E=[M,z,O]}return{rfId:"1",width:r??0,height:i??0,transform:E,nodes:_,nodesInitialized:C,nodeLookup:g,parentLookup:p,edges:x,edgeLookup:v,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:bt,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:et.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:h,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...yi},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:tf,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:mi,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Bg=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>sh((g,p)=>{async function m(){const{nodeLookup:v,panZoom:x,fitViewOptions:_,fitViewResolver:h,width:w,height:C,minZoom:E,maxZoom:S}=p();x&&(await Jd({nodes:v,width:w,height:C,panZoom:x,minZoom:E,maxZoom:S},_),h?.resolve(!0),g({fitViewResolver:null}))}return{...Pr({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:v=>{const{nodeLookup:x,parentLookup:_,nodeOrigin:h,elevateNodesOnSelect:w,fitViewQueued:C,zIndexMode:E}=p(),S=Gn(v,x,_,{nodeOrigin:h,nodeExtent:d,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:E});C&&S?(m(),g({nodes:v,nodesInitialized:S,fitViewQueued:!1,fitViewOptions:void 0})):g({nodes:v,nodesInitialized:S})},setEdges:v=>{const{connectionLookup:x,edgeLookup:_}=p();Ti(x,_,v),g({edges:v})},setDefaultNodesAndEdges:(v,x)=>{if(v){const{setNodes:_}=p();_(v),g({hasDefaultNodes:!0})}if(x){const{setEdges:_}=p();_(x),g({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:x,nodeLookup:_,parentLookup:h,domNode:w,nodeOrigin:C,nodeExtent:E,debug:S,fitViewQueued:M,zIndexMode:z}=p(),{changes:O,updatedInternals:k}=Ef(v,_,h,w,C,E,z);k&&(vf(_,h,{nodeOrigin:C,nodeExtent:E,zIndexMode:z}),M?(m(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),O?.length>0&&(S&&console.log("React Flow: trigger node changes",O),x?.(O)))},updateNodePositions:(v,x=!1)=>{const _=[];let h=[];const{nodeLookup:w,triggerNodeChanges:C,connection:E,updateConnection:S,onNodesChangeMiddlewareMap:M}=p();for(const[z,O]of v){const k=w.get(z),T=!!(k?.expandParent&&k?.parentId&&O?.position),j={id:z,type:"position",position:T?{x:Math.max(0,O.position.x),y:Math.max(0,O.position.y)}:O.position,dragging:x};if(k&&E.inProgress&&E.fromNode.id===k.id){const b=Be(k,E.fromHandle,X.Left,!0);S({...E,from:b})}T&&k.parentId&&_.push({id:z,parentId:k.parentId,rect:{...O.internals.positionAbsolute,width:O.measured.width??0,height:O.measured.height??0}}),h.push(j)}if(_.length>0){const{parentLookup:z,nodeOrigin:O}=p(),k=po(_,w,z,O);h.push(...k)}for(const z of M.values())h=z(h);C(h)},triggerNodeChanges:v=>{const{onNodesChange:x,setNodes:_,nodes:h,hasDefaultNodes:w,debug:C}=p();if(v?.length){if(w){const E=Ui(v,h);_(E)}C&&console.log("React Flow: trigger node changes",v),x?.(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:x,setEdges:_,edges:h,hasDefaultEdges:w,debug:C}=p();if(v?.length){if(w){const E=Ki(v,h);_(E)}C&&console.log("React Flow: trigger edge changes",v),x?.(v)}},addSelectedNodes:v=>{const{multiSelectionActive:x,edgeLookup:_,nodeLookup:h,triggerNodeChanges:w,triggerEdgeChanges:C}=p();if(x){const E=v.map(S=>Te(S,!0));w(E);return}w(Ze(h,new Set([...v]),!0)),C(Ze(_))},addSelectedEdges:v=>{const{multiSelectionActive:x,edgeLookup:_,nodeLookup:h,triggerNodeChanges:w,triggerEdgeChanges:C}=p();if(x){const E=v.map(S=>Te(S,!0));C(E);return}C(Ze(_,new Set([...v]))),w(Ze(h,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:x}={})=>{const{edges:_,nodes:h,nodeLookup:w,triggerNodeChanges:C,triggerEdgeChanges:E}=p(),S=v||h,M=x||_,z=S.map(k=>{const T=w.get(k.id);return T&&(T.selected=!1),Te(k.id,!1)}),O=M.map(k=>Te(k.id,!1));C(z),E(O)},setMinZoom:v=>{const{panZoom:x,maxZoom:_}=p();x?.setScaleExtent([v,_]),g({minZoom:v})},setMaxZoom:v=>{const{panZoom:x,minZoom:_}=p();x?.setScaleExtent([_,v]),g({maxZoom:v})},setTranslateExtent:v=>{p().panZoom?.setTranslateExtent(v),g({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:x,triggerNodeChanges:_,triggerEdgeChanges:h,elementsSelectable:w}=p();if(!w)return;const C=x.reduce((S,M)=>M.selected?[...S,Te(M.id,!1)]:S,[]),E=v.reduce((S,M)=>M.selected?[...S,Te(M.id,!1)]:S,[]);_(C),h(E)},setNodeExtent:v=>{const{nodes:x,nodeLookup:_,parentLookup:h,nodeOrigin:w,elevateNodesOnSelect:C,nodeExtent:E,zIndexMode:S}=p();v[0][0]===E[0][0]&&v[0][1]===E[0][1]&&v[1][0]===E[1][0]&&v[1][1]===E[1][1]||(Gn(x,_,h,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:S}),g({nodeExtent:v}))},panBy:v=>{const{transform:x,width:_,height:h,panZoom:w,translateExtent:C}=p();return Cf({delta:v,panZoom:w,transform:x,translateExtent:C,width:_,height:h})},setCenter:async(v,x,_)=>{const{width:h,height:w,maxZoom:C,panZoom:E}=p();if(!E)return Promise.resolve(!1);const S=typeof _?.zoom<"u"?_.zoom:C;return await E.setViewport({x:h/2-v*S,y:w/2-x*S,zoom:S},{duration:_?.duration,ease:_?.ease,interpolate:_?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{g({connection:{...yi}})},updateConnection:v=>{g({connection:v})},reset:()=>g({...Pr()})}},Object.is);function _s({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:g}){const[p]=P.useState(()=>Bg({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:c,minZoom:s,maxZoom:a,fitViewOptions:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return y.jsx(ah,{value:p,children:y.jsx(zh,{children:g})})}function Fg({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:g}){return P.useContext(gn)?y.jsx(y.Fragment,{children:e}):y.jsx(_s,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:g,children:e})}const Xg={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Yg({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:g,onConnectStart:p,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:x,onNodeMouseEnter:_,onNodeMouseMove:h,onNodeMouseLeave:w,onNodeContextMenu:C,onNodeDoubleClick:E,onNodeDragStart:S,onNodeDrag:M,onNodeDragStop:z,onNodesDelete:O,onEdgesDelete:k,onDelete:T,onSelectionChange:j,onSelectionDragStart:b,onSelectionDrag:I,onSelectionDragStop:N,onSelectionContextMenu:$,onSelectionStart:A,onSelectionEnd:D,onBeforeDelete:H,connectionMode:L,connectionLineType:R=Ae.Bezier,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:Z,deleteKeyCode:U="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:V=!1,selectionMode:Y=_t.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:K=Et()?"Meta":"Control",zoomActivationKeyCode:q=Et()?"Meta":"Control",snapToGrid:G,snapGrid:ee,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:te,nodesDraggable:ae,autoPanOnNodeFocus:ke,nodesConnectable:_e,nodesFocusable:De,nodeOrigin:st=qi,edgesFocusable:at,edgesReconnectable:ct,elementsSelectable:wn=!0,defaultViewport:$t=vh,minZoom:Fe=.5,maxZoom:lt=2,translateExtent:yo=bt,preventScrolling:Ms=!0,nodeExtent:vn,defaultMarkerColor:ks="#b1b1b7",zoomOnScroll:Is=!0,zoomOnPinch:zs=!0,panOnScroll:As=!1,panOnScrollSpeed:$s=.5,panOnScrollMode:Ps=Re.Free,zoomOnDoubleClick:Ds=!0,panOnDrag:Ts=!0,onPaneClick:Hs,onPaneMouseEnter:js,onPaneMouseMove:Rs,onPaneMouseLeave:Ls,onPaneScroll:Os,onPaneContextMenu:Vs,paneClickDistance:Bs=1,nodeClickDistance:Fs=0,children:Xs,onReconnect:Ys,onReconnectStart:Ws,onReconnectEnd:Zs,onEdgeContextMenu:qs,onEdgeDoubleClick:Gs,onEdgeMouseEnter:Us,onEdgeMouseMove:Ks,onEdgeMouseLeave:Qs,reconnectRadius:Js=10,onNodesChange:ea,onEdgesChange:ta,noDragClassName:na="nodrag",noWheelClassName:oa="nowheel",noPanClassName:xo="nopan",fitView:wo,fitViewOptions:vo,connectOnClick:ra,attributionPosition:ia,proOptions:sa,defaultEdgeOptions:aa,elevateNodesOnSelect:ca=!0,elevateEdgesOnSelect:la=!1,disableKeyboardA11y:bo=!1,autoPanOnConnect:ua,autoPanOnNodeDrag:da,autoPanSpeed:fa,connectionRadius:ha,isValidConnection:ga,onError:pa,style:ma,id:_o,nodeDragThreshold:ya,connectionDragThreshold:xa,viewport:wa,onViewportChange:va,width:ba,height:_a,colorMode:Sa="light",debug:Ea,onScroll:So,ariaLabelConfig:Ca,zIndexMode:Eo="basic",...Na},Ma){const bn=_o||"1",ka=Eh(Sa),Ia=P.useCallback(Co=>{Co.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),So?.(Co)},[So]);return y.jsx("div",{"data-testid":"rf__wrapper",...Na,onScroll:Ia,style:{...ma,...Xg},ref:Ma,className:ie(["react-flow",r,ka]),id:_o,role:"application",children:y.jsxs(Fg,{nodes:e,edges:t,width:ba,height:_a,fitView:wo,fitViewOptions:vo,minZoom:Fe,maxZoom:lt,nodeOrigin:st,nodeExtent:vn,zIndexMode:Eo,children:[y.jsx(Vg,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:_,onNodeMouseMove:h,onNodeMouseLeave:w,onNodeContextMenu:C,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:s,connectionLineType:R,connectionLineStyle:F,connectionLineComponent:B,connectionLineContainerStyle:Z,selectionKeyCode:W,selectionOnDrag:V,selectionMode:Y,deleteKeyCode:U,multiSelectionKeyCode:K,panActivationKeyCode:Q,zoomActivationKeyCode:q,onlyRenderVisibleElements:ne,defaultViewport:$t,translateExtent:yo,minZoom:Fe,maxZoom:lt,preventScrolling:Ms,zoomOnScroll:Is,zoomOnPinch:zs,zoomOnDoubleClick:Ds,panOnScroll:As,panOnScrollSpeed:$s,panOnScrollMode:Ps,panOnDrag:Ts,onPaneClick:Hs,onPaneMouseEnter:js,onPaneMouseMove:Rs,onPaneMouseLeave:Ls,onPaneScroll:Os,onPaneContextMenu:Vs,paneClickDistance:Bs,nodeClickDistance:Fs,onSelectionContextMenu:$,onSelectionStart:A,onSelectionEnd:D,onReconnect:Ys,onReconnectStart:Ws,onReconnectEnd:Zs,onEdgeContextMenu:qs,onEdgeDoubleClick:Gs,onEdgeMouseEnter:Us,onEdgeMouseMove:Ks,onEdgeMouseLeave:Qs,reconnectRadius:Js,defaultMarkerColor:ks,noDragClassName:na,noWheelClassName:oa,noPanClassName:xo,rfId:bn,disableKeyboardA11y:bo,nodeExtent:vn,viewport:wa,onViewportChange:va}),y.jsx(Sh,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:g,onConnectStart:p,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:x,nodesDraggable:ae,autoPanOnNodeFocus:ke,nodesConnectable:_e,nodesFocusable:De,edgesFocusable:at,edgesReconnectable:ct,elementsSelectable:wn,elevateNodesOnSelect:ca,elevateEdgesOnSelect:la,minZoom:Fe,maxZoom:lt,nodeExtent:vn,onNodesChange:ea,onEdgesChange:ta,snapToGrid:G,snapGrid:ee,connectionMode:L,translateExtent:yo,connectOnClick:ra,defaultEdgeOptions:aa,fitView:wo,fitViewOptions:vo,onNodesDelete:O,onEdgesDelete:k,onDelete:T,onNodeDragStart:S,onNodeDrag:M,onNodeDragStop:z,onSelectionDrag:I,onSelectionDragStart:b,onSelectionDragStop:N,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:xo,nodeOrigin:st,rfId:bn,autoPanOnConnect:ua,autoPanOnNodeDrag:da,autoPanSpeed:fa,onError:pa,connectionRadius:ha,isValidConnection:ga,selectNodesOnDrag:te,nodeDragThreshold:ya,connectionDragThreshold:xa,onBeforeDelete:H,debug:Ea,ariaLabelConfig:Ca,zIndexMode:Eo}),y.jsx(wh,{onSelectionChange:j}),Xs,y.jsx(gh,{proOptions:sa,position:ia}),y.jsx(hh,{rfId:bn,disableKeyboardA11y:bo})]})})}var Wg=Qi(Yg);function Zg(e){const[t,n]=P.useState(e),o=P.useCallback(r=>n(i=>Ui(r,i)),[]);return[t,n,o]}function qg(e){const[t,n]=P.useState(e),o=P.useCallback(r=>n(i=>Ki(r,i)),[]);return[t,n,o]}function Gg({dimensions:e,lineWidth:t,variant:n,className:o}){return y.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ie(["react-flow__background-pattern",n,o])})}function Ug({radius:e,className:t}){return y.jsx("circle",{cx:e,cy:e,r:e,className:ie(["react-flow__background-pattern","dots",t])})}var Ce;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ce||(Ce={}));const Kg={[Ce.Dots]:1,[Ce.Lines]:1,[Ce.Cross]:6},Qg=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Ss({id:e,variant:t=Ce.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:l,className:c,patternClassName:u}){const d=P.useRef(null),{transform:f,patternId:g}=J(Qg,oe),p=o||Kg[t],m=t===Ce.Dots,v=t===Ce.Cross,x=Array.isArray(n)?n:[n,n],_=[x[0]*f[2]||1,x[1]*f[2]||1],h=p*f[2],w=Array.isArray(i)?i:[i,i],C=v?[h,h]:_,E=[w[0]*f[2]||1+C[0]/2,w[1]*f[2]||1+C[1]/2],S=`${g}${e||""}`;return y.jsxs("svg",{className:ie(["react-flow__background",c]),style:{...l,...yn,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:d,"data-testid":"rf__background",children:[y.jsx("pattern",{id:S,x:f[0]%_[0],y:f[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:m?y.jsx(Ug,{radius:h/2,className:u}):y.jsx(Gg,{dimensions:C,lineWidth:r,variant:t,className:u})}),y.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${S})`})]})}Ss.displayName="Background";const Jg=P.memo(Ss);function ep(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:y.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function tp(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:y.jsx("path",{d:"M0 0h32v4.2H0z"})})}function np(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:y.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function op(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:y.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function rp(){return y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:y.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Vt({children:e,className:t,...n}){return y.jsx("button",{type:"button",className:ie(["react-flow__controls-button",t]),...n,children:e})}const ip=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Es({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:c,children:u,position:d="bottom-left",orientation:f="vertical","aria-label":g}){const p=re(),{isInteractive:m,minZoomReached:v,maxZoomReached:x,ariaLabelConfig:_}=J(ip,oe),{zoomIn:h,zoomOut:w,fitView:C}=mn(),E=()=>{h(),i?.()},S=()=>{w(),s?.()},M=()=>{C(r),a?.()},z=()=>{p.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),l?.(!m)},O=f==="horizontal"?"horizontal":"vertical";return y.jsxs(pn,{className:ie(["react-flow__controls",O,c]),position:d,style:e,"data-testid":"rf__controls","aria-label":g??_["controls.ariaLabel"],children:[t&&y.jsxs(y.Fragment,{children:[y.jsx(Vt,{onClick:E,className:"react-flow__controls-zoomin",title:_["controls.zoomIn.ariaLabel"],"aria-label":_["controls.zoomIn.ariaLabel"],disabled:x,children:y.jsx(ep,{})}),y.jsx(Vt,{onClick:S,className:"react-flow__controls-zoomout",title:_["controls.zoomOut.ariaLabel"],"aria-label":_["controls.zoomOut.ariaLabel"],disabled:v,children:y.jsx(tp,{})})]}),n&&y.jsx(Vt,{className:"react-flow__controls-fitview",onClick:M,title:_["controls.fitView.ariaLabel"],"aria-label":_["controls.fitView.ariaLabel"],children:y.jsx(np,{})}),o&&y.jsx(Vt,{className:"react-flow__controls-interactive",onClick:z,title:_["controls.interactive.ariaLabel"],"aria-label":_["controls.interactive.ariaLabel"],children:m?y.jsx(rp,{}):y.jsx(op,{})}),u]})}Es.displayName="Controls";P.memo(Es);function sp({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:c,borderRadius:u,shapeRendering:d,selected:f,onClick:g}){const{background:p,backgroundColor:m}=i||{},v=s||p||m;return y.jsx("rect",{className:ie(["react-flow__minimap-node",{selected:f},c]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:v,stroke:a,strokeWidth:l},shapeRendering:d,onClick:g?x=>g(x,e):void 0})}const ap=P.memo(sp),cp=e=>e.nodes.map(t=>t.id),Tn=e=>e instanceof Function?e:()=>e;function lp({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=ap,onClick:s}){const a=J(cp,oe),l=Tn(t),c=Tn(e),u=Tn(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return y.jsx(y.Fragment,{children:a.map(f=>y.jsx(dp,{id:f,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:d},f))})}function up({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:c,x:u,y:d,width:f,height:g}=J(p=>{const{internals:m}=p.nodeLookup.get(e),v=m.userNode,{x,y:_}=m.positionAbsolute,{width:h,height:w}=Me(v);return{node:v,x,y:_,width:h,height:w}},oe);return!c||c.hidden||!Ei(c)?null:y.jsx(a,{x:u,y:d,width:f,height:g,style:c.style,selected:!!c.selected,className:o(c),color:t(c),borderRadius:r,strokeColor:n(c),strokeWidth:i,shapeRendering:s,onClick:l,id:c.id})}const dp=P.memo(up);var fp=P.memo(lp);const hp=200,gp=150,pp=e=>!e.hidden,mp=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Si(It(e.nodeLookup,{filter:pp}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},yp="react-flow__minimap-desc";function Cs({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:u,maskStrokeWidth:d,position:f="bottom-right",onClick:g,onNodeClick:p,pannable:m=!1,zoomable:v=!1,ariaLabel:x,inversePan:_,zoomStep:h=1,offsetScale:w=5}){const C=re(),E=P.useRef(null),{boundingRect:S,viewBB:M,rfId:z,panZoom:O,translateExtent:k,flowWidth:T,flowHeight:j,ariaLabelConfig:b}=J(mp,oe),I=e?.width??hp,N=e?.height??gp,$=S.width/I,A=S.height/N,D=Math.max($,A),H=D*I,L=D*N,R=w*D,F=S.x-(H-S.width)/2-R,B=S.y-(L-S.height)/2-R,Z=H+R*2,U=L+R*2,W=`${yp}-${z}`,V=P.useRef(0),Y=P.useRef();V.current=D,P.useEffect(()=>{if(E.current&&O)return Y.current=Df({domNode:E.current,panZoom:O,getTransform:()=>C.getState().transform,getViewScale:()=>V.current}),()=>{Y.current?.destroy()}},[O]),P.useEffect(()=>{Y.current?.update({translateExtent:k,width:T,height:j,inversePan:_,pannable:m,zoomStep:h,zoomable:v})},[m,v,_,h,k,T,j]);const Q=g?G=>{const[ee,ne]=Y.current?.pointer(G)||[0,0];g(G,{x:ee,y:ne})}:void 0,K=p?P.useCallback((G,ee)=>{const ne=C.getState().nodeLookup.get(ee).internals.userNode;p(G,ne)},[]):void 0,q=x??b["minimap.ariaLabel"];return y.jsx(pn,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*D:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ie(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:y.jsxs("svg",{width:I,height:N,viewBox:`${F} ${B} ${Z} ${U}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:E,onClick:Q,children:[q&&y.jsx("title",{id:W,children:q}),y.jsx(fp,{onClick:K,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),y.jsx("path",{className:"react-flow__minimap-mask",d:`M${F-R},${B-R}h${Z+R*2}v${U+R*2}h${-Z-R*2}z
7
+ M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Cs.displayName="MiniMap";const xp=P.memo(Cs),wp=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,vp={[rt.Line]:"right",[rt.Handle]:"bottom-right"};function bp({nodeId:e,position:t,variant:n=rt.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:g=!0,shouldResize:p,onResizeStart:m,onResize:v,onResizeEnd:x}){const _=ns(),h=typeof e=="string"?e:_,w=re(),C=P.useRef(null),E=n===rt.Handle,S=J(P.useCallback(wp(E&&g),[E,g]),oe),M=P.useRef(null),z=t??vp[n];P.useEffect(()=>{if(!(!C.current||!h))return M.current||(M.current=qf({domNode:C.current,nodeId:h,getStoreItems:()=>{const{nodeLookup:k,transform:T,snapGrid:j,snapToGrid:b,nodeOrigin:I,domNode:N}=w.getState();return{nodeLookup:k,transform:T,snapGrid:j,snapToGrid:b,nodeOrigin:I,paneDomNode:N}},onChange:(k,T)=>{const{triggerNodeChanges:j,nodeLookup:b,parentLookup:I,nodeOrigin:N}=w.getState(),$=[],A={x:k.x,y:k.y},D=b.get(h);if(D&&D.expandParent&&D.parentId){const H=D.origin??N,L=k.width??D.measured.width??0,R=k.height??D.measured.height??0,F={id:D.id,parentId:D.parentId,rect:{width:L,height:R,...Ci({x:k.x??D.position.x,y:k.y??D.position.y},{width:L,height:R},D.parentId,b,H)}},B=po([F],b,I,N);$.push(...B),A.x=k.x?Math.max(H[0]*L,k.x):void 0,A.y=k.y?Math.max(H[1]*R,k.y):void 0}if(A.x!==void 0&&A.y!==void 0){const H={id:h,type:"position",position:{...A}};$.push(H)}if(k.width!==void 0&&k.height!==void 0){const L={id:h,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:k.width,height:k.height}};$.push(L)}for(const H of T){const L={...H,type:"position"};$.push(L)}j($)},onEnd:({width:k,height:T})=>{const j={id:h,type:"dimensions",resizing:!1,dimensions:{width:k,height:T}};w.getState().triggerNodeChanges([j])}})),M.current.update({controlPosition:z,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:m,onResize:v,onResizeEnd:x,shouldResize:p}),()=>{M.current?.destroy()}},[z,a,l,c,u,d,m,v,x,p]);const O=z.split("-");return y.jsx("div",{className:ie(["react-flow__resize-control","nodrag",...O,n,o]),ref:C,style:{...r,scale:S,...s&&{[E?"backgroundColor":"borderColor"]:s}},children:i})}P.memo(bp);const Hn={"alepha.core":"#868e96","alepha.server":"#228be6","alepha.security":"#fa5252","alepha.orm":"#40c057","alepha.cache":"#fab005","alepha.queue":"#fd7e14","alepha.topic":"#be4bdb","alepha.bucket":"#15aabf","alepha.scheduler":"#e64980","alepha.logger":"#74c0fc","alepha.devtools":"#845ef7"},_p="#495057",rn=e=>{if(!e)return _p;if(Hn[e])return Hn[e];for(const[o,r]of Object.entries(Hn))if(e.startsWith(o))return r;let t=0;for(let o=0;o<e.length;o++)t=e.charCodeAt(o)+((t<<5)-t);return`hsl(${Math.abs(t%360)}, 60%, 50%)`},Sp=({filters:e,onFiltersChange:t,layout:n,onLayoutChange:o,modules:r,nodeCount:i,edgeCount:s,onExport:a})=>{const l=e.viewMode==="modules";return y.jsxs(fe,{gap:"sm",wrap:"wrap",align:"center",children:[y.jsx(Mo,{size:"xs",value:e.viewMode,onChange:c=>t({...e,viewMode:c}),data:[{label:y.jsx(ye,{label:"Modules",children:y.jsx(nc,{size:14})}),value:"modules"},{label:y.jsx(ye,{label:"Services",children:y.jsx(Rr,{size:14})}),value:"providers"}]}),y.jsx(La,{placeholder:l?"Search modules...":"Search services...",leftSection:y.jsx(Oa,{size:14}),value:e.search,onChange:c=>t({...e,search:c.currentTarget.value}),size:"xs",style:{width:200}}),!l&&y.jsx(qa,{placeholder:"Filter by module",value:e.module,onChange:c=>t({...e,module:c||"all"}),data:[{label:"All modules",value:"all"},...r.map(c=>({label:c,value:c}))],size:"xs",style:{width:200},clearable:!0}),y.jsx(Ga,{label:"Hide framework",checked:e.hideFramework,onChange:c=>t({...e,hideFramework:c.currentTarget.checked}),size:"xs"}),y.jsx(Mo,{size:"xs",value:n,onChange:c=>o(c),data:[{label:y.jsx(ye,{label:"Hierarchical",children:y.jsx(dc,{size:14})}),value:"dagre"},{label:y.jsx(ye,{label:"Circular",children:y.jsx(Hr,{size:14})}),value:"circular"},{label:y.jsx(ye,{label:"Force",children:y.jsx(lc,{size:14})}),value:"force"}]}),y.jsxs(jn,{gap:4,children:[y.jsxs(Ke,{size:"xs",variant:"light",color:"gray",children:[i," ",l?"modules":"services"]}),y.jsxs(Ke,{size:"xs",variant:"light",color:"gray",children:[s," edges"]})]}),y.jsx(ye,{label:"Export as PNG",children:y.jsx(Ye,{size:"sm",variant:"subtle",onClick:a,children:y.jsx(ic,{size:14})})})]})},Ep=(e,t)=>{const n=new Map;for(const a of e)for(const l of a.dependencies){const c=n.get(l)||[];c.push(a.name),n.set(l,c)}const o=e.filter(a=>{if(t.hideFramework&&a.module?.startsWith("alepha.")||t.module&&t.module!=="all"&&a.module!==t.module)return!1;if(t.search){const l=t.search.toLowerCase();return a.name.toLowerCase().includes(l)||a.module?.toLowerCase().includes(l)}return!0}),r=new Set(o.map(a=>a.name)),i=o.map(a=>({id:a.name,type:"provider",position:{x:0,y:0},data:{label:a.name,module:a.module,dependencies:a.dependencies,dependents:n.get(a.name)||[],aliases:a.aliases,isModule:!1}})),s=[];for(const a of o)for(const l of a.dependencies)r.has(l)&&s.push({id:`${a.name}->${l}`,source:a.name,target:l,animated:!1,style:{stroke:"#495057",strokeWidth:1.5}});return{nodes:i,edges:s}},Cp=(e,t)=>{const n=new Map;for(const u of e){const d=u.module||"Other";if(t.hideFramework&&d.startsWith("alepha."))continue;if(t.search){const g=t.search.toLowerCase();if(!d.toLowerCase().includes(g))continue}const f=n.get(d)||[];f.push(u),n.set(d,f)}const o=new Map,r=new Map;for(const[u,d]of n)o.set(u,new Set),r.set(u,new Set);for(const[u,d]of n)for(const f of d)for(const g of f.dependencies){const p=e.find(m=>m.name===g);if(p){const m=p.module||"Other";m!==u&&n.has(m)&&(o.get(u)?.add(m),r.get(m)?.add(u))}}let i=Array.from(n.keys());t.module&&t.module!=="all"&&(i=i.filter(u=>u===t.module));const s=new Set(i),a=i.map(u=>{const d=n.get(u)||[];return{id:u,type:"provider",position:{x:0,y:0},data:{label:u,module:u,dependencies:Array.from(o.get(u)||[]),dependents:Array.from(r.get(u)||[]),providers:d.map(f=>f.name),providerCount:d.length,isModule:!0}}}),l=[],c=new Set;for(const u of i)for(const d of o.get(u)||[])if(s.has(d)){const f=`${u}->${d}`;c.has(f)||(c.add(f),l.push({id:f,source:u,target:d,animated:!1,style:{stroke:"#495057",strokeWidth:1.5}}))}return{nodes:a,edges:l}},Np=(e,t)=>t.viewMode==="modules"?Cp(e,t):Ep(e,t),Dr=(e,t,n="TB")=>{const a=new Map,l=new Map;for(const m of e)a.set(m.id,[]),l.set(m.id,0);for(const m of t)a.get(m.source)?.push(m.target),l.set(m.target,(l.get(m.target)||0)+1);const c=new Map,u=[];for(const[m,v]of l)v===0&&(u.push(m),c.set(m,0));for(;u.length>0;){const m=u.shift(),v=c.get(m)||0;for(const x of a.get(m)||[]){const _=(l.get(x)||0)-1;l.set(x,_),_===0&&(u.push(x),c.set(x,v+1))}}const d=Math.max(...Array.from(c.values()),0);for(const m of e)c.has(m.id)||c.set(m.id,d+1);const f=new Map;for(const[m,v]of c){const x=f.get(v)||[];x.push(m),f.set(v,x)}const g=new Map(e.map(m=>[m.id,m])),p=[];for(const[m,v]of f){const _=-(v.length*230)/2;v.forEach((h,w)=>{const C=g.get(h);C&&p.push({...C,position:{x:n==="TB"?_+w*230:m*230,y:n==="TB"?m*140:_+w*140}})})}return p},Ns=e=>{const t=Math.max(200,e.length*30),n=2*Math.PI/e.length;return e.map((o,r)=>({...o,position:{x:Math.cos(r*n)*t,y:Math.sin(r*n)*t}}))},Mp=(e,t=!0)=>{if(!t)return Ns(e);const n=new Map;for(const a of e){const l=a.data.module||"Other",c=n.get(l)||[];c.push(a),n.set(l,c)}const o=Array.from(n.keys()).sort(),r=2*Math.PI/o.length,i=Math.max(300,o.length*80),s=[];return o.forEach((a,l)=>{const c=n.get(a)||[],u=l*r,d=Math.cos(u)*i,f=Math.sin(u)*i,g=Math.max(100,c.length*25),p=2*Math.PI/c.length;c.forEach((m,v)=>{const x=v*p;s.push({...m,position:{x:d+Math.cos(x)*g,y:f+Math.sin(x)*g}})})}),s},kp=(e,t,n)=>{switch(n){case"dagre":return Dr(e,t);case"force":return Ns(e);case"circular":return Mp(e);default:return Dr(e,t)}},Ip=(e,t,n)=>{const o=new Set([e]),r=new Map(t.map(a=>[a.id,a])),i=a=>{const l=r.get(a);if(l)for(const c of l.data.dependencies)o.has(c)||(o.add(c),i(c))},s=a=>{const l=r.get(a);if(l)for(const c of l.data.dependents)o.has(c)||(o.add(c),s(c))};return i(e),s(e),o},zp=(e,t)=>{const n=[],o=new Set,r=new Set,i=new Map;for(const a of e)i.set(a.id,[]);for(const a of t)i.get(a.source)?.push(a.target);const s=(a,l)=>{o.add(a),r.add(a),l.push(a);for(const c of i.get(a)||[])if(!o.has(c))s(c,[...l]);else if(r.has(c)){const u=l.indexOf(c);n.push([...l.slice(u),c])}r.delete(a)};for(const a of e)o.has(a.id)||s(a.id,[]);return n},Ap=({node:e,onClose:t,onNodeClick:n})=>{if(!e)return null;const{data:o}=e,r=rn(o.module),i=o.isModule;return y.jsxs(Va,{p:"md",style:{position:"absolute",top:16,right:16,width:280,backgroundColor:$e.colors.elevated,border:`1px solid ${$e.colors.border}`,borderRadius:8,zIndex:10},children:[y.jsxs(fe,{justify:"space-between",align:"start",mb:"sm",children:[y.jsxs(qe,{style:{flex:1},children:[y.jsx(se,{size:"sm",fw:600,style:{wordBreak:"break-word"},children:o.label}),!i&&o.module&&y.jsx(Ke,{size:"xs",variant:"light",mt:4,style:{backgroundColor:`${r}20`,color:r},children:o.module}),i&&o.providerCount!==void 0&&y.jsxs(se,{size:"xs",c:"dimmed",mt:4,children:[o.providerCount," services"]})]}),y.jsx(Ye,{size:"sm",variant:"subtle",onClick:t,children:y.jsx(Ba,{size:14})})]}),!i&&o.aliases&&o.aliases.length>0&&y.jsxs(y.Fragment,{children:[y.jsx(_n,{my:"xs"}),y.jsx(se,{size:"xs",c:"dimmed",mb:4,children:"Aliases"}),y.jsx(fe,{gap:4,wrap:"wrap",children:o.aliases.map(s=>y.jsx(Ke,{size:"xs",variant:"outline",children:s},s))})]}),i&&o.providers&&o.providers.length>0&&y.jsxs(y.Fragment,{children:[y.jsx(_n,{my:"xs"}),y.jsxs(fe,{align:"center",gap:4,mb:4,children:[y.jsx(Rr,{size:12,opacity:.5}),y.jsxs(se,{size:"xs",c:"dimmed",children:["Services (",o.providers.length,")"]})]}),y.jsx(No,{h:100,children:y.jsx(ft,{gap:2,children:o.providers.map(s=>y.jsx(se,{size:"xs",children:s.split(".").pop()},s))})})]}),y.jsx(_n,{my:"xs"}),y.jsx(No,{h:i?120:200,children:y.jsxs(ft,{gap:"xs",children:[o.dependencies.length>0&&y.jsxs(qe,{children:[y.jsxs(fe,{align:"center",gap:4,mb:4,children:[y.jsx(Ua,{size:12,opacity:.5}),y.jsxs(se,{size:"xs",c:"dimmed",children:[i?"Depends on":"Dependencies"," (",o.dependencies.length,")"]})]}),y.jsx(ft,{gap:2,children:o.dependencies.map(s=>y.jsx(se,{size:"xs",style:{cursor:"pointer"},c:"blue",onClick:()=>n(s),children:s},s))})]}),o.dependents.length>0&&y.jsxs(qe,{children:[y.jsxs(fe,{align:"center",gap:4,mb:4,children:[y.jsx(Ka,{size:12,opacity:.5}),y.jsxs(se,{size:"xs",c:"dimmed",children:["Used by (",o.dependents.length,")"]})]}),y.jsx(ft,{gap:2,children:o.dependents.map(s=>y.jsx(se,{size:"xs",style:{cursor:"pointer"},c:"blue",onClick:()=>n(s),children:s},s))})]}),o.dependencies.length===0&&o.dependents.length===0&&y.jsx(se,{size:"xs",c:"dimmed",children:"No dependencies"})]})})]})},$p=({data:e,selected:t})=>{const n=rn(e.module),o=e.isFaded&&!e.isHighlighted,r=e.isModule;return y.jsxs(qe,{p:"xs",style:{borderRadius:r?12:8,border:`2px solid ${t||e.isSelected?n:$e.colors.border}`,backgroundColor:$e.colors.surface,minWidth:r?200:160,opacity:o?.3:1,transition:"opacity 0.2s, border-color 0.2s",boxShadow:e.isHighlighted?`0 0 10px ${n}`:void 0},children:[y.jsx(it,{type:"target",position:X.Top,style:{background:n,width:8,height:8,border:"none"}}),y.jsxs(fe,{direction:"column",gap:4,children:[r?y.jsxs(y.Fragment,{children:[y.jsx(se,{size:"xs",fw:600,style:{wordBreak:"break-word"},children:e.label}),y.jsxs(se,{size:"xs",c:"dimmed",children:[e.providerCount," services"]})]}):y.jsxs(y.Fragment,{children:[y.jsx(se,{size:"xs",fw:600,style:{wordBreak:"break-word"},children:e.label.split(".").pop()}),e.module&&y.jsx(Ke,{size:"xs",variant:"light",style:{backgroundColor:`${n}20`,color:n},children:e.module})]}),y.jsxs(fe,{gap:4,children:[e.dependencies.length>0&&y.jsxs(se,{size:"xs",c:"dimmed",children:[e.dependencies.length," deps"]}),e.dependents.length>0&&y.jsxs(se,{size:"xs",c:"dimmed",children:[e.dependents.length," refs"]})]})]}),y.jsx(it,{type:"source",position:X.Bottom,style:{background:n,width:8,height:8,border:"none"}})]})},Pp={provider:$p},Dp=()=>{const{zoomIn:e,zoomOut:t,fitView:n}=mn(),[o,r]=P.useState(!1);return y.jsxs(ft,{gap:4,style:{position:"absolute",bottom:16,left:16,zIndex:10,backgroundColor:$e.colors.elevated,border:`1px solid ${$e.colors.border}`,borderRadius:8,padding:4},children:[y.jsx(ye,{label:"Zoom in",position:"right",children:y.jsx(Ye,{size:"sm",variant:"subtle",onClick:()=>e(),children:y.jsx(Qa,{size:14})})}),y.jsx(ye,{label:"Zoom out",position:"right",children:y.jsx(Ye,{size:"sm",variant:"subtle",onClick:()=>t(),children:y.jsx(pc,{size:14})})}),y.jsx(ye,{label:"Fit view",position:"right",children:y.jsx(Ye,{size:"sm",variant:"subtle",onClick:()=>n({padding:.2}),children:y.jsx(ac,{size:14})})}),y.jsx(ye,{label:o?"Unlock":"Lock",position:"right",children:y.jsx(Ye,{size:"sm",variant:"subtle",onClick:()=>r(!o),children:o?y.jsx(Ja,{size:14}):y.jsx(hc,{size:14})})})]})},Yp=()=>{const e=Fa(Xa),[t,n]=P.useState([]),[o,r]=P.useState(!0),[i,s,a]=Zg([]),[l,c,u]=qg([]),[d,f]=P.useState(null),[g,p]=P.useState("dagre"),[m,v]=P.useState({search:"",module:"all",hideFramework:!1,viewMode:"modules"});P.useEffect(()=>{e.fetch("/devtools/api/metadata",{schema:{response:Za}}).then(S=>{n(S.data.providers),r(!1)})},[]);const x=P.useMemo(()=>{const S=new Set;for(const M of t)M.module&&S.add(M.module);return Array.from(S).sort()},[t]);P.useEffect(()=>{if(t.length===0)return;const{nodes:S,edges:M}=Np(t,m),z=kp(S,M,g);s(z),c(M)},[t,m,g,s,c]);const _=P.useMemo(()=>zp(i,l),[i,l]),h=P.useCallback((S,M)=>{f({id:M.id,data:M.data});const z=Ip(M.id,i);s(O=>O.map(k=>({...k,data:{...k.data,isHighlighted:z.has(k.id),isSelected:k.id===M.id,isFaded:!z.has(k.id)}}))),c(O=>O.map(k=>({...k,animated:z.has(k.source)&&z.has(k.target),style:{...k.style,stroke:z.has(k.source)&&z.has(k.target)?rn(i.find(T=>T.id===k.source)?.data.module):"#495057",strokeWidth:z.has(k.source)&&z.has(k.target)?2:1,opacity:z.has(k.source)&&z.has(k.target)?1:.3}})))},[i,l,s,c]),w=P.useCallback(()=>{f(null),s(S=>S.map(M=>({...M,data:{...M.data,isHighlighted:!1,isSelected:!1,isFaded:!1}}))),c(S=>S.map(M=>({...M,animated:!1,style:{...M.style,stroke:"#495057",strokeWidth:1.5,opacity:1}})))},[s,c]),C=P.useCallback(S=>{const M=i.find(z=>z.id===S);M&&h({},M)},[i,h]),E=P.useCallback(()=>{document.querySelector(".react-flow__viewport")&&alert("Export feature requires html2canvas library. Coming soon!")},[]);return o?y.jsx(fe,{align:"center",justify:"center",h:"100%",children:y.jsx(Ya,{size:"sm"})}):y.jsxs(fe,{direction:"column",gap:"md",w:"100%",h:"100%",children:[y.jsx(jn,{justify:"space-between",wrap:"nowrap",children:y.jsxs(jn,{gap:"sm",children:[y.jsx(Hr,{size:24,opacity:.7}),y.jsx(se,{size:"lg",fw:500,children:"Dependency Graph"})]})}),y.jsx(Sp,{filters:m,onFiltersChange:v,layout:g,onLayoutChange:p,modules:x,nodeCount:i.length,edgeCount:l.length,onExport:E}),_.length>0&&y.jsx(Qn,{icon:y.jsx(Wa,{size:16}),color:"orange",variant:"light",p:"xs",children:y.jsxs(fe,{align:"center",gap:"xs",children:[y.jsx(se,{size:"xs",children:"Circular dependencies detected:"}),_.slice(0,3).map((S,M)=>y.jsxs(Ke,{size:"xs",color:"orange",variant:"light",children:[S.length," nodes"]},M)),_.length>3&&y.jsxs(se,{size:"xs",c:"dimmed",children:["+",_.length-3," more"]})]})}),y.jsxs(qe,{style:{flex:1,borderRadius:8,border:`1px solid ${$e.colors.border}`,overflow:"hidden",position:"relative"},children:[y.jsx(_s,{children:y.jsxs(Wg,{nodes:i,edges:l,onNodesChange:a,onEdgesChange:u,onNodeClick:h,onPaneClick:w,nodeTypes:Pp,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,proOptions:{hideAttribution:!0},children:[y.jsx(Jg,{variant:Ce.Dots,gap:20,size:1}),y.jsx(xp,{nodeColor:S=>rn(S.data?.module),maskColor:"rgba(0, 0, 0, 0.5)",style:{backgroundColor:$e.colors.surface}}),y.jsx(Dp,{})]})}),y.jsx(Ap,{node:d,onClose:()=>w(),onNodeClick:C})]})]})};export{Yp as DevDependencyGraph,Yp as default};
@@ -0,0 +1 @@
1
+ import{w as a}from"./entry.BY4L2Uc6.js";const o=[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-4a4 4 0 1 1 8 0v4",key:"svg-2"}]],e=a("outline","lock","Lock",o);export{e as I};
@@ -0,0 +1 @@
1
+ const o=()=>{};export{o as n};
@@ -0,0 +1 @@
1
+ function u(f,o){let a=f;for(;(a=a.parentElement)&&!a.matches(o););return a}function k(f,o,a){for(let r=f-1;r>=0;r-=1)if(!o[r].disabled)return r;if(a){for(let r=o.length-1;r>-1;r-=1)if(!o[r].disabled)return r}return f}function x(f,o,a){for(let r=f+1;r<o.length;r+=1)if(!o[r].disabled)return r;if(a){for(let r=0;r<o.length;r+=1)if(!o[r].disabled)return r}return f}function h(f,o,a){return u(f,a)===u(o,a)}function w({parentSelector:f,siblingSelector:o,onKeyDown:a,loop:r=!0,activateOnFocus:l=!1,dir:d="rtl",orientation:n}){return t=>{a?.(t);const e=Array.from(u(t.currentTarget,f)?.querySelectorAll(o)||[]).filter(i=>h(t.currentTarget,i,f)),p=e.findIndex(i=>t.currentTarget===i),c=x(p,e,r),s=k(p,e,r),g=d==="rtl"?s:c,b=d==="rtl"?c:s;switch(t.key){case"ArrowRight":{n==="horizontal"&&(t.stopPropagation(),t.preventDefault(),e[g].focus(),l&&e[g].click());break}case"ArrowLeft":{n==="horizontal"&&(t.stopPropagation(),t.preventDefault(),e[b].focus(),l&&e[b].click());break}case"ArrowUp":{n==="vertical"&&(t.stopPropagation(),t.preventDefault(),e[s].focus(),l&&e[s].click());break}case"ArrowDown":{n==="vertical"&&(t.stopPropagation(),t.preventDefault(),e[c].focus(),l&&e[c].click());break}case"Home":{t.stopPropagation(),t.preventDefault(),!e[0].disabled&&e[0].focus();break}case"End":{t.stopPropagation(),t.preventDefault();const i=e.length-1;!e[i].disabled&&e[i].focus();break}}}}export{w as c,u as f};
@@ -0,0 +1 @@
1
+ import{r,bv as E,f as F,b as W,q as L,s as B,ay as M,j as I,B as $,i as oe,bw as j,a0 as ae,$ as ie,ai as ue,aI as le,t as ce,v as de,a1 as fe}from"./entry.BY4L2Uc6.js";import{g as me}from"./chunk.uyVen0u2.js";function ve(t,e){if(t===e||Number.isNaN(t)&&Number.isNaN(e))return!0;if(!(t instanceof Object)||!(e instanceof Object))return!1;const n=Object.keys(t),{length:o}=n;if(o!==Object.keys(e).length)return!1;for(let a=0;a<o;a+=1){const i=n[a];if(!(i in e)||t[i]!==e[i]&&!(Number.isNaN(t[i])&&Number.isNaN(e[i])))return!1}return!0}function he(t,e){if(!t||!e)return!1;if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n+=1)if(!ve(t[n],e[n]))return!1;return!0}function be(t){const e=r.useRef([]),n=r.useRef(0);return he(e.current,t)||(e.current=t,n.current+=1),[n.current]}function ge(t,e){r.useEffect(t,be(e))}function pe(t,e,n={autoInvoke:!1}){const o=r.useRef(null),a=r.useCallback((...m)=>{o.current||(o.current=window.setTimeout(()=>{t(m),o.current=null},e))},[e]),i=r.useCallback(()=>{o.current&&(window.clearTimeout(o.current),o.current=null)},[]);return r.useEffect(()=>(n.autoInvoke&&a(),i),[i,a]),{start:a,clear:i}}function ye(t,e,n){const o=r.useRef(null),a=r.useRef(null);return r.useEffect(()=>{const i=typeof n=="function"?n():n;return(i||a.current)&&(o.current=new MutationObserver(t),o.current.observe(i||a.current,e)),()=>{o.current?.disconnect()}},[t,e]),a}function Re(){const[t,e]=r.useState(!1);return r.useEffect(()=>e(!0),[]),t}function we(t,e){if(!e||!t)return!1;let n=e.parentNode;for(;n!=null;){if(n===t)return!0;n=n.parentNode}return!1}function Se({target:t,parent:e,ref:n,displayAfterTransitionEnd:o}){const a=r.useRef(-1),[i,m]=r.useState(!1),[w,S]=r.useState(typeof o=="boolean"?o:!1),l=()=>{if(!t||!e||!n.current)return;const u=t.getBoundingClientRect(),c=e.getBoundingClientRect(),f=window.getComputedStyle(t),h=window.getComputedStyle(e),p=E(f.borderTopWidth)+E(h.borderTopWidth),y=E(f.borderLeftWidth)+E(h.borderLeftWidth),b={top:u.top-c.top-p,left:u.left-c.left-y,width:u.width,height:u.height};n.current.style.transform=`translateY(${b.top}px) translateX(${b.left}px)`,n.current.style.width=`${b.width}px`,n.current.style.height=`${b.height}px`},d=()=>{window.clearTimeout(a.current),n.current&&(n.current.style.transitionDuration="0ms"),l(),a.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration="")},30)},g=r.useRef(null),v=r.useRef(null);return r.useEffect(()=>{if(l(),t)return g.current=new ResizeObserver(d),g.current.observe(t),e&&(v.current=new ResizeObserver(d),v.current.observe(e)),()=>{g.current?.disconnect(),v.current?.disconnect()}},[e,t]),r.useEffect(()=>{if(e){const u=c=>{we(c.target,e)&&(d(),S(!1))};return e.addEventListener("transitionend",u),()=>{e.removeEventListener("transitionend",u)}}},[e]),pe(()=>{me()!=="test"&&m(!0)},20,{autoInvoke:!0}),ye(u=>{u.forEach(c=>{c.type==="attributes"&&c.attributeName==="dir"&&d()})},{attributes:!0,attributeFilter:["dir"]},()=>document.documentElement),{initialized:i,hidden:w}}var P={root:"m_96b553a6"};const Ce=B((t,{transitionDuration:e})=>({root:{"--transition-duration":typeof e=="number"?`${e}ms`:e}})),_=F((t,e)=>{const n=W("FloatingIndicator",null,t),{classNames:o,className:a,style:i,styles:m,unstyled:w,vars:S,target:l,parent:d,transitionDuration:g,mod:v,displayAfterTransitionEnd:u,attributes:c,...f}=n,h=L({name:"FloatingIndicator",classes:P,props:n,className:a,style:i,classNames:o,styles:m,unstyled:w,attributes:c,vars:S,varsResolver:Ce}),p=r.useRef(null),{initialized:y,hidden:b}=Se({target:l,parent:d,ref:p,displayAfterTransitionEnd:u}),N=M(e,p);return!l||!d?null:I.jsx($,{ref:N,mod:[{initialized:y,hidden:b},v],...h("root"),...f})});_.displayName="@mantine/core/FloatingIndicator";_.classes=P;var A={root:"m_cf365364",indicator:"m_9e182ccd",label:"m_1738fcb2",input:"m_1714d588",control:"m_69686b9b",innerLabel:"m_78882f40"};const Ne={withItemsBorders:!0},Ee=B((t,{radius:e,color:n,transitionDuration:o,size:a,transitionTimingFunction:i})=>({root:{"--sc-radius":e===void 0?void 0:fe(e),"--sc-color":n?de(n,t):void 0,"--sc-shadow":n?void 0:"var(--mantine-shadow-xs)","--sc-transition-duration":o===void 0?void 0:`${o}ms`,"--sc-transition-timing-function":i,"--sc-padding":ce(a,"sc-padding"),"--sc-font-size":le(a)}})),q=F((t,e)=>{const n=W("SegmentedControl",Ne,t),{classNames:o,className:a,style:i,styles:m,unstyled:w,vars:S,data:l,value:d,defaultValue:g,onChange:v,size:u,name:c,disabled:f,readOnly:h,fullWidth:p,orientation:y,radius:b,color:N,transitionDuration:Ie,transitionTimingFunction:$e,variant:D,autoContrast:H,withItemsBorders:K,mod:U,attributes:X,...Y}=n,R=L({name:"SegmentedControl",props:n,classes:A,className:a,style:i,classNames:o,styles:m,unstyled:w,attributes:X,vars:S,varsResolver:Ee}),z=oe(),O=l.map(s=>typeof s=="string"?{label:s,value:s}:s),G=Re(),[J,Q]=r.useState(j()),[Z,V]=r.useState(null),[x,ee]=r.useState({}),te=(s,T)=>{x[T]=s,ee(x)},[C,ne]=ae({value:d,defaultValue:g,finalValue:Array.isArray(l)?O.find(s=>!s.disabled)?.value??l[0]?.value??null:null,onChange:v}),k=ie(c),se=O.map(s=>r.createElement($,{...R("control"),mod:{active:C===s.value,orientation:y},key:s.value},r.createElement("input",{...R("input"),disabled:f||s.disabled,type:"radio",name:k,value:s.value,id:`${k}-${s.value}`,checked:C===s.value,onChange:()=>!h&&ne(s.value),"data-focus-ring":z.focusRing,key:`${s.value}-input`}),r.createElement($,{component:"label",...R("label"),mod:{active:C===s.value&&!(f||s.disabled),disabled:f||s.disabled,"read-only":h},htmlFor:`${k}-${s.value}`,ref:T=>te(T,s.value),__vars:{"--sc-label-color":N!==void 0?ue({color:N,theme:z,autoContrast:H}):void 0},key:`${s.value}-label`},I.jsx("span",{...R("innerLabel"),children:s.label})))),re=M(e,s=>V(s));return ge(()=>{Q(j())},[l.length]),l.length===0?null:I.jsxs($,{...R("root"),variant:D,size:u,ref:re,mod:[{"full-width":p,orientation:y,initialized:G,"with-items-borders":K},U],...Y,role:"radiogroup","data-disabled":f,children:[typeof C=="string"&&I.jsx(_,{target:x[C],parent:Z,component:"span",transitionDuration:"var(--sc-transition-duration)",...R("indicator")},J),se]})});q.classes=A;q.displayName="@mantine/core/SegmentedControl";export{q as S};
@@ -0,0 +1,6 @@
1
+ import{w as l,Y as m,Z as h,r,j as e,F as a,T as o,K as p,Q as u,L as g,O as x,P as v,S as k,V as j,H as i,B as b}from"./entry.BY4L2Uc6.js";import{d as y}from"./chunk.Cw2RCl4F.js";import{I as z}from"./chunk.BYrPfJRg.js";import{I as f}from"./chunk.DA9XnVAa.js";import{I}from"./chunk.DEUHUxKv.js";import{I as M}from"./chunk.DGW-W4Kc.js";import{S}from"./chunk.DooL4OcT.js";import"./chunk.17gtbQUO.js";const C=[["path",{d:"M12 7m-8 0a8 4 0 1 0 16 0a8 4 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.333 -1 1.246 -4.345 2.737 -10.035a7.45 7.45 0 0 0 .263 -1.965",key:"svg-1"}]],E=l("outline","bucket","Bucket",C);const _=[["path",{d:"M4 5m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M16 3l0 4",key:"svg-1"}],["path",{d:"M8 3l0 4",key:"svg-2"}],["path",{d:"M4 11l16 0",key:"svg-3"}],["path",{d:"M8 15h2v2h-2z",key:"svg-4"}]],A=l("outline","calendar-event","CalendarEvent",_);const T=[["path",{d:"M7 16.5l-5 -3l5 -3l5 3v5.5l-5 3z",key:"svg-0"}],["path",{d:"M2 13.5v5.5l5 3",key:"svg-1"}],["path",{d:"M7 16.545l5 -3.03",key:"svg-2"}],["path",{d:"M17 16.5l-5 -3l5 -3l5 3v5.5l-5 3z",key:"svg-3"}],["path",{d:"M12 19l5 3",key:"svg-4"}],["path",{d:"M17 16.5l5 -3",key:"svg-5"}],["path",{d:"M12 13.5v-5.5l-5 -3l5 -3l5 3v5.5",key:"svg-6"}],["path",{d:"M7 5.03v5.455",key:"svg-7"}],["path",{d:"M12 8l5 -3",key:"svg-8"}]],w=l("outline","packages","Packages",T),B=({label:n,count:s,icon:c})=>e.jsxs(a,{direction:"column",align:"center",justify:"center",p:"xl",style:{borderRadius:12,border:`1px solid ${i.colors.border}`,cursor:"pointer",transition:"all 0.2s ease"},bg:i.colors.surface,className:"devtools-card",children:[e.jsx(b,{opacity:.5,mb:"md",children:c}),e.jsxs(o,{size:"sm",c:"dimmed",children:[e.jsx(o,{span:!0,fw:600,size:"lg",c:"var(--mantine-color-text)",children:s})," ",n]})]}),H=()=>{const n=m(h),[s,c]=r.useState(null);if(r.useEffect(()=>{n.fetch("/devtools/api/metadata",{schema:{response:y}}).then(t=>c(t.data))},[]),!s)return e.jsx(a,{align:"center",justify:"center",h:"100%",children:e.jsx(o,{c:"dimmed",children:"Loading..."})});const d=[{label:"actions",count:s.actions.length,icon:e.jsx(p,{size:48,stroke:1.2})},{label:"entities",count:s.entities.length,icon:e.jsx(u,{size:48,stroke:1.2})},{label:"queues",count:s.queues.length,icon:e.jsx(g,{size:48,stroke:1.2})},{label:"schedulers",count:s.schedulers.length,icon:e.jsx(A,{size:48,stroke:1.2})},{label:"topics",count:s.topics.length,icon:e.jsx(x,{size:48,stroke:1.2})},{label:"buckets",count:s.buckets.length,icon:e.jsx(E,{size:48,stroke:1.2})},{label:"realms",count:s.realms.length,icon:e.jsx(z,{size:48,stroke:1.2})},{label:"caches",count:s.caches.length,icon:e.jsx(v,{size:48,stroke:1.2})},{label:"commands",count:s.commands.length,icon:e.jsx(f,{size:48,stroke:1.2})},{label:"env schemas",count:s.envs.length,icon:e.jsx(k,{size:48,stroke:1.2})},{label:"atoms",count:s.atoms.length,icon:e.jsx(j,{size:48,stroke:1.2})},{label:"modules",count:s.modules.length,icon:e.jsx(w,{size:48,stroke:1.2})},{label:"services",count:s.providers.length,icon:e.jsx(I,{size:48,stroke:1.2})}].filter(t=>t.count>0);return e.jsxs(a,{direction:"column",align:"center",justify:"center",flex:1,w:"100%",gap:"xl",children:[e.jsx("style",{children:`
2
+ .devtools-card:hover {
3
+ border-color: var(--mantine-color-dimmed);
4
+ transform: translateY(-2px);
5
+ }
6
+ `}),e.jsxs(a,{direction:"column",align:"center",gap:4,mb:"md",children:[e.jsxs(a,{align:"center",gap:"sm",children:[e.jsx(M,{size:40,stroke:1.5,opacity:.8}),e.jsx(o,{size:"2rem",fw:300,style:{letterSpacing:"-0.02em"},children:"Alepha DevTools"})]}),e.jsx(o,{size:"xs",c:"dimmed",children:"Explore your Alepha application metadata"})]}),e.jsx(S,{cols:{base:2,sm:3,md:4},spacing:"md",children:d.map(t=>e.jsx(B,{...t},t.label))})]})};export{H as DevDashboard,H as default};
@@ -0,0 +1 @@
1
+ import{w as a}from"./entry.BY4L2Uc6.js";const o=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 7v5l3 3",key:"svg-1"}]],e=a("outline","clock","Clock",o);const t=[["path",{d:"M4 7l16 0",key:"svg-0"}],["path",{d:"M10 11l0 6",key:"svg-1"}],["path",{d:"M14 11l0 6",key:"svg-2"}],["path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12",key:"svg-3"}],["path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3",key:"svg-4"}]],c=a("outline","trash","Trash",t);export{c as I,e as a};