blokctl 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/create/project.js +67 -1
- package/dist/commands/create/utils/Examples.d.ts +3 -3
- package/dist/commands/create/utils/Examples.js +109 -13
- package/dist/commands/dev/index.js +50 -13
- package/dist/commands/generate/validators/WorkflowValidator.js +1 -1
- package/dist/commands/migrate/index.js +11 -0
- package/dist/commands/migrate/workflows.d.ts +3 -0
- package/dist/commands/migrate/workflows.js +333 -0
- package/dist/commands/trace/index.js +6 -2
- package/dist/commands/trace/startStudio.d.ts +2 -0
- package/dist/commands/trace/startStudio.js +76 -11
- package/dist/index.js +1 -0
- package/dist/services/health-probe.d.ts +5 -0
- package/dist/services/health-probe.js +35 -0
- package/dist/services/runtime-detector.d.ts +3 -0
- package/dist/services/runtime-detector.js +21 -2
- package/dist/services/runtime-setup.d.ts +3 -0
- package/dist/services/runtime-setup.js +11 -2
- package/dist/studio-dist/assets/charts-Dh48HebV.js +68 -0
- package/dist/studio-dist/assets/graph-DWteCadQ.js +7 -0
- package/dist/studio-dist/assets/{icons-zP8LLgPh.js → icons-N5J4OhGx.js} +66 -51
- package/dist/studio-dist/assets/index-D6JA5F-X.js +42 -0
- package/dist/studio-dist/assets/index-mdQkg9ul.css +1 -0
- package/dist/studio-dist/assets/react-vendor-l0sNRNKZ.js +1 -0
- package/dist/studio-dist/assets/tanstack-query-Day3Mt-4.js +17 -0
- package/dist/studio-dist/assets/tanstack-router-BB95iErN.js +25 -0
- package/dist/studio-dist/assets/{tanstack-table-DhwRvuH2.js → tanstack-table-Biem1hxK.js} +1 -1
- package/dist/studio-dist/favicon.svg +7 -4
- package/dist/studio-dist/index.html +19 -10
- package/package.json +16 -21
- package/dist/studio-dist/assets/charts-Dso0hPUR.js +0 -68
- package/dist/studio-dist/assets/graph-CsV2nWGn.js +0 -23
- package/dist/studio-dist/assets/index-CLyEkXMx.css +0 -1
- package/dist/studio-dist/assets/index-CNXFX_ar.js +0 -27
- package/dist/studio-dist/assets/react-vendor--Eh9ivFN.js +0 -17
- package/dist/studio-dist/assets/tanstack-query-CiM1U6F5.js +0 -1
- package/dist/studio-dist/assets/tanstack-router-Btjy0MKq.js +0 -25
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import{R as e_,r as j,j as $}from"./tanstack-router-Btjy0MKq.js";import{c as ar,r as mv,g as t_}from"./react-vendor--Eh9ivFN.js";var ln,Gc;function ue(){if(Gc)return ln;Gc=1;var e=Array.isArray;return ln=e,ln}var dn,Uc;function _v(){if(Uc)return dn;Uc=1;var e=typeof ar=="object"&&ar&&ar.Object===Object&&ar;return dn=e,dn}var hn,Yc;function Se(){if(Yc)return hn;Yc=1;var e=_v(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return hn=r,hn}var pn,Wc;function Et(){if(Wc)return pn;Wc=1;var e=Se(),t=e.Symbol;return pn=t,pn}var gn,Xc;function r_(){if(Xc)return gn;Xc=1;var e=Et(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=r.call(o,i),u=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(s?o[i]=u:delete o[i]),f}return gn=a,gn}var vn,Kc;function n_(){if(Kc)return vn;Kc=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return vn=r,vn}var yn,Zc;function at(){if(Zc)return yn;Zc=1;var e=Et(),t=r_(),r=n_(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?t(s):r(s)}return yn=o,yn}var mn,Qc;function Me(){if(Qc)return mn;Qc=1;function e(t){return t!=null&&typeof t=="object"}return mn=e,mn}var _n,Jc;function St(){if(Jc)return _n;Jc=1;var e=at(),t=Me(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return _n=n,_n}var bn,ef;function rc(){if(ef)return bn;ef=1;var e=ue(),t=St(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return bn=i,bn}var wn,tf;function ye(){if(tf)return wn;tf=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return wn=e,wn}var xn,rf;function Gt(){if(rf)return xn;rf=1;var e=at(),t=ye(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var u=e(s);return u==n||u==i||u==r||u==a}return xn=o,xn}var En,nf;function i_(){if(nf)return En;nf=1;var e=Se(),t=e["__core-js_shared__"];return En=t,En}var Sn,af;function a_(){if(af)return Sn;af=1;var e=i_(),t=function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function r(n){return!!t&&t in n}return Sn=r,Sn}var qn,of;function bv(){if(of)return qn;of=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return qn=r,qn}var Cn,sf;function o_(){if(sf)return Cn;sf=1;var e=Gt(),t=a_(),r=ye(),n=bv(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,c=s.hasOwnProperty,f=RegExp("^"+u.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(d){if(!r(d)||t(d))return!1;var h=e(d)?f:a;return h.test(n(d))}return Cn=l,Cn}var In,uf;function s_(){if(uf)return In;uf=1;function e(t,r){return t==null?void 0:t[r]}return In=e,In}var Rn,cf;function ot(){if(cf)return Rn;cf=1;var e=o_(),t=s_();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return Rn=r,Rn}var An,ff;function Pr(){if(ff)return An;ff=1;var e=ot(),t=e(Object,"create");return An=t,An}var Nn,lf;function u_(){if(lf)return Nn;lf=1;var e=Pr();function t(){this.__data__=e?e(null):{},this.size=0}return Nn=t,Nn}var Mn,df;function c_(){if(df)return Mn;df=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return Mn=e,Mn}var Tn,hf;function f_(){if(hf)return Tn;hf=1;var e=Pr(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var s=o[a];return s===t?void 0:s}return n.call(o,a)?o[a]:void 0}return Tn=i,Tn}var Pn,pf;function l_(){if(pf)return Pn;pf=1;var e=Pr(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return Pn=n,Pn}var kn,gf;function d_(){if(gf)return kn;gf=1;var e=Pr(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return kn=r,kn}var On,vf;function h_(){if(vf)return On;vf=1;var e=u_(),t=c_(),r=f_(),n=l_(),i=d_();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,On=a,On}var Ln,yf;function p_(){if(yf)return Ln;yf=1;function e(){this.__data__=[],this.size=0}return Ln=e,Ln}var Dn,mf;function qt(){if(mf)return Dn;mf=1;function e(t,r){return t===r||t!==t&&r!==r}return Dn=e,Dn}var Fn,_f;function kr(){if(_f)return Fn;_f=1;var e=qt();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return Fn=t,Fn}var $n,bf;function g_(){if(bf)return $n;bf=1;var e=kr(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return $n=n,$n}var jn,wf;function v_(){if(wf)return jn;wf=1;var e=kr();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return jn=t,jn}var zn,xf;function y_(){if(xf)return zn;xf=1;var e=kr();function t(r){return e(this.__data__,r)>-1}return zn=t,zn}var Bn,Ef;function m_(){if(Ef)return Bn;Ef=1;var e=kr();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Bn=t,Bn}var Hn,Sf;function Or(){if(Sf)return Hn;Sf=1;var e=p_(),t=g_(),r=v_(),n=y_(),i=m_();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Hn=a,Hn}var Vn,qf;function nc(){if(qf)return Vn;qf=1;var e=ot(),t=Se(),r=e(t,"Map");return Vn=r,Vn}var Gn,Cf;function __(){if(Cf)return Gn;Cf=1;var e=h_(),t=Or(),r=nc();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Gn=n,Gn}var Un,If;function b_(){if(If)return Un;If=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Un=e,Un}var Yn,Rf;function Lr(){if(Rf)return Yn;Rf=1;var e=b_();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Yn=t,Yn}var Wn,Af;function w_(){if(Af)return Wn;Af=1;var e=Lr();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Wn=t,Wn}var Xn,Nf;function x_(){if(Nf)return Xn;Nf=1;var e=Lr();function t(r){return e(this,r).get(r)}return Xn=t,Xn}var Kn,Mf;function E_(){if(Mf)return Kn;Mf=1;var e=Lr();function t(r){return e(this,r).has(r)}return Kn=t,Kn}var Zn,Tf;function S_(){if(Tf)return Zn;Tf=1;var e=Lr();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Zn=t,Zn}var Qn,Pf;function ic(){if(Pf)return Qn;Pf=1;var e=__(),t=w_(),r=x_(),n=E_(),i=S_();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Qn=a,Qn}var Jn,kf;function q_(){if(kf)return Jn;kf=1;var e=ic(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],u=a.cache;if(u.has(s))return u.get(s);var c=n.apply(this,o);return a.cache=u.set(s,c)||u,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,Jn=r,Jn}var ei,Of;function C_(){if(Of)return ei;Of=1;var e=q_(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return ei=r,ei}var ti,Lf;function I_(){if(Lf)return ti;Lf=1;var e=C_(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,s,u,c){a.push(u?c.replace(r,"$1"):s||o)}),a});return ti=n,ti}var ri,Df;function Dr(){if(Df)return ri;Df=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return ri=e,ri}var ni,Ff;function R_(){if(Ff)return ni;Ff=1;var e=Et(),t=Dr(),r=ue(),n=St(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return t(s,o)+"";if(n(s))return a?a.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return ni=o,ni}var ii,$f;function wv(){if($f)return ii;$f=1;var e=R_();function t(r){return r==null?"":e(r)}return ii=t,ii}var ai,jf;function Fr(){if(jf)return ai;jf=1;var e=ue(),t=rc(),r=I_(),n=wv();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return ai=i,ai}var oi,zf;function Ut(){if(zf)return oi;zf=1;var e=St();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return oi=t,oi}var si,Bf;function $r(){if(Bf)return si;Bf=1;var e=Fr(),t=Ut();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return si=r,si}var ui,Hf;function A_(){if(Hf)return ui;Hf=1;var e=$r();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return ui=t,ui}var ci,Vf;function N_(){if(Vf)return ci;Vf=1;var e=at(),t=ue(),r=Me(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return ci=i,ci}var fi,Gf;function M_(){if(Gf)return fi;Gf=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",s=RegExp("["+o+e+i+a+"]");function u(c){return s.test(c)}return fi=u,fi}var li,Uf;function T_(){if(Uf)return li;Uf=1;var e=Or();function t(){this.__data__=new e,this.size=0}return li=t,li}var di,Yf;function P_(){if(Yf)return di;Yf=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return di=e,di}var hi,Wf;function k_(){if(Wf)return hi;Wf=1;function e(t){return this.__data__.get(t)}return hi=e,hi}var pi,Xf;function O_(){if(Xf)return pi;Xf=1;function e(t){return this.__data__.has(t)}return pi=e,pi}var gi,Kf;function L_(){if(Kf)return gi;Kf=1;var e=Or(),t=nc(),r=ic(),n=200;function i(a,o){var s=this.__data__;if(s instanceof e){var u=s.__data__;if(!t||u.length<n-1)return u.push([a,o]),this.size=++s.size,this;s=this.__data__=new r(u)}return s.set(a,o),this.size=s.size,this}return gi=i,gi}var vi,Zf;function jr(){if(Zf)return vi;Zf=1;var e=Or(),t=T_(),r=P_(),n=k_(),i=O_(),a=L_();function o(s){var u=this.__data__=new e(s);this.size=u.size}return o.prototype.clear=t,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=i,o.prototype.set=a,vi=o,vi}var yi,Qf;function D_(){if(Qf)return yi;Qf=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return yi=t,yi}var mi,Jf;function F_(){if(Jf)return mi;Jf=1;function e(t){return this.__data__.has(t)}return mi=e,mi}var _i,el;function xv(){if(el)return _i;el=1;var e=ic(),t=D_(),r=F_();function n(i){var a=-1,o=i==null?0:i.length;for(this.__data__=new e;++a<o;)this.add(i[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,_i=n,_i}var bi,tl;function $_(){if(tl)return bi;tl=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(t[n],n,t))return!0;return!1}return bi=e,bi}var wi,rl;function Ev(){if(rl)return wi;rl=1;function e(t,r){return t.has(r)}return wi=e,wi}var xi,nl;function Sv(){if(nl)return xi;nl=1;var e=xv(),t=$_(),r=Ev(),n=1,i=2;function a(o,s,u,c,f,l){var d=u&n,h=o.length,g=s.length;if(h!=g&&!(d&&g>h))return!1;var m=l.get(o),v=l.get(s);if(m&&v)return m==s&&v==o;var y=-1,b=!0,p=u&i?new e:void 0;for(l.set(o,s),l.set(s,o);++y<h;){var _=o[y],w=s[y];if(c)var x=d?c(w,_,y,s,o,l):c(_,w,y,o,s,l);if(x!==void 0){if(x)continue;b=!1;break}if(p){if(!t(s,function(E,I){if(!r(p,I)&&(_===E||f(_,E,u,c,l)))return p.push(I)})){b=!1;break}}else if(!(_===w||f(_,w,u,c,l))){b=!1;break}}return l.delete(o),l.delete(s),b}return xi=a,xi}var Ei,il;function qv(){if(il)return Ei;il=1;var e=Se(),t=e.Uint8Array;return Ei=t,Ei}var Si,al;function j_(){if(al)return Si;al=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(i,a){n[++r]=[a,i]}),n}return Si=e,Si}var qi,ol;function ac(){if(ol)return qi;ol=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(i){n[++r]=i}),n}return qi=e,qi}var Ci,sl;function z_(){if(sl)return Ci;sl=1;var e=Et(),t=qv(),r=qt(),n=Sv(),i=j_(),a=ac(),o=1,s=2,u="[object Boolean]",c="[object Date]",f="[object Error]",l="[object Map]",d="[object Number]",h="[object RegExp]",g="[object Set]",m="[object String]",v="[object Symbol]",y="[object ArrayBuffer]",b="[object DataView]",p=e?e.prototype:void 0,_=p?p.valueOf:void 0;function w(x,E,I,C,M,q,R){switch(I){case b:if(x.byteLength!=E.byteLength||x.byteOffset!=E.byteOffset)return!1;x=x.buffer,E=E.buffer;case y:return!(x.byteLength!=E.byteLength||!q(new t(x),new t(E)));case u:case c:case d:return r(+x,+E);case f:return x.name==E.name&&x.message==E.message;case h:case m:return x==E+"";case l:var O=i;case g:var S=C&o;if(O||(O=a),x.size!=E.size&&!S)return!1;var T=R.get(x);if(T)return T==E;C|=s,R.set(x,E);var N=n(O(x),O(E),C,M,q,R);return R.delete(x),N;case v:if(_)return _.call(x)==_.call(E)}return!1}return Ci=w,Ci}var Ii,ul;function oc(){if(ul)return Ii;ul=1;function e(t,r){for(var n=-1,i=r.length,a=t.length;++n<i;)t[a+n]=r[n];return t}return Ii=e,Ii}var Ri,cl;function Cv(){if(cl)return Ri;cl=1;var e=oc(),t=ue();function r(n,i,a){var o=i(n);return t(n)?o:e(o,a(n))}return Ri=r,Ri}var Ai,fl;function Iv(){if(fl)return Ai;fl=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=0,o=[];++n<i;){var s=t[n];r(s,n,t)&&(o[a++]=s)}return o}return Ai=e,Ai}var Ni,ll;function Rv(){if(ll)return Ni;ll=1;function e(){return[]}return Ni=e,Ni}var Mi,dl;function sc(){if(dl)return Mi;dl=1;var e=Iv(),t=Rv(),r=Object.prototype,n=r.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(o){return o==null?[]:(o=Object(o),e(i(o),function(s){return n.call(o,s)}))}:t;return Mi=a,Mi}var Ti,hl;function B_(){if(hl)return Ti;hl=1;function e(t,r){for(var n=-1,i=Array(t);++n<t;)i[n]=r(n);return i}return Ti=e,Ti}var Pi,pl;function H_(){if(pl)return Pi;pl=1;var e=at(),t=Me(),r="[object Arguments]";function n(i){return t(i)&&e(i)==r}return Pi=n,Pi}var ki,gl;function Yt(){if(gl)return ki;gl=1;var e=H_(),t=Me(),r=Object.prototype,n=r.hasOwnProperty,i=r.propertyIsEnumerable,a=e(function(){return arguments}())?e:function(o){return t(o)&&n.call(o,"callee")&&!i.call(o,"callee")};return ki=a,ki}var Nt={exports:{}},Oi,vl;function V_(){if(vl)return Oi;vl=1;function e(){return!1}return Oi=e,Oi}Nt.exports;var yl;function Ct(){return yl||(yl=1,function(e,t){var r=Se(),n=V_(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===i,s=o?r.Buffer:void 0,u=s?s.isBuffer:void 0,c=u||n;e.exports=c}(Nt,Nt.exports)),Nt.exports}var Li,ml;function zr(){if(ml)return Li;ml=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,i){var a=typeof n;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return Li=r,Li}var Di,_l;function uc(){if(_l)return Di;_l=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return Di=t,Di}var Fi,bl;function G_(){if(bl)return Fi;bl=1;var e=at(),t=uc(),r=Me(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",s="[object Error]",u="[object Function]",c="[object Map]",f="[object Number]",l="[object Object]",d="[object RegExp]",h="[object Set]",g="[object String]",m="[object WeakMap]",v="[object ArrayBuffer]",y="[object DataView]",b="[object Float32Array]",p="[object Float64Array]",_="[object Int8Array]",w="[object Int16Array]",x="[object Int32Array]",E="[object Uint8Array]",I="[object Uint8ClampedArray]",C="[object Uint16Array]",M="[object Uint32Array]",q={};q[b]=q[p]=q[_]=q[w]=q[x]=q[E]=q[I]=q[C]=q[M]=!0,q[n]=q[i]=q[v]=q[a]=q[y]=q[o]=q[s]=q[u]=q[c]=q[f]=q[l]=q[d]=q[h]=q[g]=q[m]=!1;function R(O){return r(O)&&t(O.length)&&!!q[e(O)]}return Fi=R,Fi}var $i,wl;function Br(){if(wl)return $i;wl=1;function e(t){return function(r){return t(r)}}return $i=e,$i}var Mt={exports:{}};Mt.exports;var xl;function cc(){return xl||(xl=1,function(e,t){var r=_v(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,s=function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}}();e.exports=s}(Mt,Mt.exports)),Mt.exports}var ji,El;function Wt(){if(El)return ji;El=1;var e=G_(),t=Br(),r=cc(),n=r&&r.isTypedArray,i=n?t(n):e;return ji=i,ji}var zi,Sl;function Av(){if(Sl)return zi;Sl=1;var e=B_(),t=Yt(),r=ue(),n=Ct(),i=zr(),a=Wt(),o=Object.prototype,s=o.hasOwnProperty;function u(c,f){var l=r(c),d=!l&&t(c),h=!l&&!d&&n(c),g=!l&&!d&&!h&&a(c),m=l||d||h||g,v=m?e(c.length,String):[],y=v.length;for(var b in c)(f||s.call(c,b))&&!(m&&(b=="length"||h&&(b=="offset"||b=="parent")||g&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||i(b,y)))&&v.push(b);return v}return zi=u,zi}var Bi,ql;function Hr(){if(ql)return Bi;ql=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return Bi=t,Bi}var Hi,Cl;function Nv(){if(Cl)return Hi;Cl=1;function e(t,r){return function(n){return t(r(n))}}return Hi=e,Hi}var Vi,Il;function U_(){if(Il)return Vi;Il=1;var e=Nv(),t=e(Object.keys,Object);return Vi=t,Vi}var Gi,Rl;function fc(){if(Rl)return Gi;Rl=1;var e=Hr(),t=U_(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var s in Object(a))n.call(a,s)&&s!="constructor"&&o.push(s);return o}return Gi=i,Gi}var Ui,Al;function je(){if(Al)return Ui;Al=1;var e=Gt(),t=uc();function r(n){return n!=null&&t(n.length)&&!e(n)}return Ui=r,Ui}var Yi,Nl;function Ke(){if(Nl)return Yi;Nl=1;var e=Av(),t=fc(),r=je();function n(i){return r(i)?e(i):t(i)}return Yi=n,Yi}var Wi,Ml;function Mv(){if(Ml)return Wi;Ml=1;var e=Cv(),t=sc(),r=Ke();function n(i){return e(i,r,t)}return Wi=n,Wi}var Xi,Tl;function Y_(){if(Tl)return Xi;Tl=1;var e=Mv(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,s,u,c,f){var l=s&t,d=e(a),h=d.length,g=e(o),m=g.length;if(h!=m&&!l)return!1;for(var v=h;v--;){var y=d[v];if(!(l?y in o:n.call(o,y)))return!1}var b=f.get(a),p=f.get(o);if(b&&p)return b==o&&p==a;var _=!0;f.set(a,o),f.set(o,a);for(var w=l;++v<h;){y=d[v];var x=a[y],E=o[y];if(u)var I=l?u(E,x,y,o,a,f):u(x,E,y,a,o,f);if(!(I===void 0?x===E||c(x,E,s,u,f):I)){_=!1;break}w||(w=y=="constructor")}if(_&&!w){var C=a.constructor,M=o.constructor;C!=M&&"constructor"in a&&"constructor"in o&&!(typeof C=="function"&&C instanceof C&&typeof M=="function"&&M instanceof M)&&(_=!1)}return f.delete(a),f.delete(o),_}return Xi=i,Xi}var Ki,Pl;function W_(){if(Pl)return Ki;Pl=1;var e=ot(),t=Se(),r=e(t,"DataView");return Ki=r,Ki}var Zi,kl;function X_(){if(kl)return Zi;kl=1;var e=ot(),t=Se(),r=e(t,"Promise");return Zi=r,Zi}var Qi,Ol;function Tv(){if(Ol)return Qi;Ol=1;var e=ot(),t=Se(),r=e(t,"Set");return Qi=r,Qi}var Ji,Ll;function K_(){if(Ll)return Ji;Ll=1;var e=ot(),t=Se(),r=e(t,"WeakMap");return Ji=r,Ji}var ea,Dl;function It(){if(Dl)return ea;Dl=1;var e=W_(),t=nc(),r=X_(),n=Tv(),i=K_(),a=at(),o=bv(),s="[object Map]",u="[object Object]",c="[object Promise]",f="[object Set]",l="[object WeakMap]",d="[object DataView]",h=o(e),g=o(t),m=o(r),v=o(n),y=o(i),b=a;return(e&&b(new e(new ArrayBuffer(1)))!=d||t&&b(new t)!=s||r&&b(r.resolve())!=c||n&&b(new n)!=f||i&&b(new i)!=l)&&(b=function(p){var _=a(p),w=_==u?p.constructor:void 0,x=w?o(w):"";if(x)switch(x){case h:return d;case g:return s;case m:return c;case v:return f;case y:return l}return _}),ea=b,ea}var ta,Fl;function Z_(){if(Fl)return ta;Fl=1;var e=jr(),t=Sv(),r=z_(),n=Y_(),i=It(),a=ue(),o=Ct(),s=Wt(),u=1,c="[object Arguments]",f="[object Array]",l="[object Object]",d=Object.prototype,h=d.hasOwnProperty;function g(m,v,y,b,p,_){var w=a(m),x=a(v),E=w?f:i(m),I=x?f:i(v);E=E==c?l:E,I=I==c?l:I;var C=E==l,M=I==l,q=E==I;if(q&&o(m)){if(!o(v))return!1;w=!0,C=!1}if(q&&!C)return _||(_=new e),w||s(m)?t(m,v,y,b,p,_):r(m,v,E,y,b,p,_);if(!(y&u)){var R=C&&h.call(m,"__wrapped__"),O=M&&h.call(v,"__wrapped__");if(R||O){var S=R?m.value():m,T=O?v.value():v;return _||(_=new e),p(S,T,y,b,_)}}return q?(_||(_=new e),n(m,v,y,b,p,_)):!1}return ta=g,ta}var ra,$l;function Pv(){if($l)return ra;$l=1;var e=Z_(),t=Me();function r(n,i,a,o,s){return n===i?!0:n==null||i==null||!t(n)&&!t(i)?n!==n&&i!==i:e(n,i,a,o,r,s)}return ra=r,ra}var na,jl;function Q_(){if(jl)return na;jl=1;var e=jr(),t=Pv(),r=1,n=2;function i(a,o,s,u){var c=s.length,f=c,l=!u;if(a==null)return!f;for(a=Object(a);c--;){var d=s[c];if(l&&d[2]?d[1]!==a[d[0]]:!(d[0]in a))return!1}for(;++c<f;){d=s[c];var h=d[0],g=a[h],m=d[1];if(l&&d[2]){if(g===void 0&&!(h in a))return!1}else{var v=new e;if(u)var y=u(g,m,h,a,o,v);if(!(y===void 0?t(m,g,r|n,u,v):y))return!1}}return!0}return na=i,na}var ia,zl;function kv(){if(zl)return ia;zl=1;var e=ye();function t(r){return r===r&&!e(r)}return ia=t,ia}var aa,Bl;function J_(){if(Bl)return aa;Bl=1;var e=kv(),t=Ke();function r(n){for(var i=t(n),a=i.length;a--;){var o=i[a],s=n[o];i[a]=[o,s,e(s)]}return i}return aa=r,aa}var oa,Hl;function Ov(){if(Hl)return oa;Hl=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return oa=e,oa}var sa,Vl;function eb(){if(Vl)return sa;Vl=1;var e=Q_(),t=J_(),r=Ov();function n(i){var a=t(i);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(o){return o===i||e(o,i,a)}}return sa=n,sa}var ua,Gl;function tb(){if(Gl)return ua;Gl=1;function e(t,r){return t!=null&&r in Object(t)}return ua=e,ua}var ca,Ul;function Lv(){if(Ul)return ca;Ul=1;var e=Fr(),t=Yt(),r=ue(),n=zr(),i=uc(),a=Ut();function o(s,u,c){u=e(u,s);for(var f=-1,l=u.length,d=!1;++f<l;){var h=a(u[f]);if(!(d=s!=null&&c(s,h)))break;s=s[h]}return d||++f!=l?d:(l=s==null?0:s.length,!!l&&i(l)&&n(h,l)&&(r(s)||t(s)))}return ca=o,ca}var fa,Yl;function Dv(){if(Yl)return fa;Yl=1;var e=tb(),t=Lv();function r(n,i){return n!=null&&t(n,i,e)}return fa=r,fa}var la,Wl;function rb(){if(Wl)return la;Wl=1;var e=Pv(),t=A_(),r=Dv(),n=rc(),i=kv(),a=Ov(),o=Ut(),s=1,u=2;function c(f,l){return n(f)&&i(l)?a(o(f),l):function(d){var h=t(d,f);return h===void 0&&h===l?r(d,f):e(l,h,s|u)}}return la=c,la}var da,Xl;function st(){if(Xl)return da;Xl=1;function e(t){return t}return da=e,da}var ha,Kl;function Fv(){if(Kl)return ha;Kl=1;function e(t){return function(r){return r==null?void 0:r[t]}}return ha=e,ha}var pa,Zl;function nb(){if(Zl)return pa;Zl=1;var e=$r();function t(r){return function(n){return e(n,r)}}return pa=t,pa}var ga,Ql;function ib(){if(Ql)return ga;Ql=1;var e=Fv(),t=nb(),r=rc(),n=Ut();function i(a){return r(a)?e(n(a)):t(a)}return ga=i,ga}var va,Jl;function ze(){if(Jl)return va;Jl=1;var e=eb(),t=rb(),r=st(),n=ue(),i=ib();function a(o){return typeof o=="function"?o:o==null?r:typeof o=="object"?n(o)?t(o[0],o[1]):e(o):i(o)}return va=a,va}var ya,ed;function $v(){if(ed)return ya;ed=1;function e(t,r,n,i){for(var a=t.length,o=n+(i?1:-1);i?o--:++o<a;)if(r(t[o],o,t))return o;return-1}return ya=e,ya}var ma,td;function ab(){if(td)return ma;td=1;function e(t){return t!==t}return ma=e,ma}var _a,rd;function ob(){if(rd)return _a;rd=1;function e(t,r,n){for(var i=n-1,a=t.length;++i<a;)if(t[i]===r)return i;return-1}return _a=e,_a}var ba,nd;function sb(){if(nd)return ba;nd=1;var e=$v(),t=ab(),r=ob();function n(i,a,o){return a===a?r(i,a,o):e(i,t,o)}return ba=n,ba}var wa,id;function ub(){if(id)return wa;id=1;var e=sb();function t(r,n){var i=r==null?0:r.length;return!!i&&e(r,n,0)>-1}return wa=t,wa}var xa,ad;function cb(){if(ad)return xa;ad=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i<a;)if(n(r,t[i]))return!0;return!1}return xa=e,xa}var Ea,od;function fb(){if(od)return Ea;od=1;function e(){}return Ea=e,Ea}var Sa,sd;function lb(){if(sd)return Sa;sd=1;var e=Tv(),t=fb(),r=ac(),n=1/0,i=e&&1/r(new e([,-0]))[1]==n?function(a){return new e(a)}:t;return Sa=i,Sa}var qa,ud;function db(){if(ud)return qa;ud=1;var e=xv(),t=ub(),r=cb(),n=Ev(),i=lb(),a=ac(),o=200;function s(u,c,f){var l=-1,d=t,h=u.length,g=!0,m=[],v=m;if(f)g=!1,d=r;else if(h>=o){var y=c?null:i(u);if(y)return a(y);g=!1,d=n,v=new e}else v=c?[]:m;e:for(;++l<h;){var b=u[l],p=c?c(b):b;if(b=f||b!==0?b:0,g&&p===p){for(var _=v.length;_--;)if(v[_]===p)continue e;c&&v.push(p),m.push(b)}else d(v,p,f)||(v!==m&&v.push(p),m.push(b))}return m}return qa=s,qa}var Ca,cd;function hb(){if(cd)return Ca;cd=1;var e=Et(),t=Yt(),r=ue(),n=e?e.isConcatSpreadable:void 0;function i(a){return r(a)||t(a)||!!(n&&a&&a[n])}return Ca=i,Ca}var Ia,fd;function lc(){if(fd)return Ia;fd=1;var e=oc(),t=hb();function r(n,i,a,o,s){var u=-1,c=n.length;for(a||(a=t),s||(s=[]);++u<c;){var f=n[u];i>0&&a(f)?i>1?r(f,i-1,a,o,s):e(s,f):o||(s[s.length]=f)}return s}return Ia=r,Ia}var Ra,ld;function pb(){if(ld)return Ra;ld=1;function e(t){return function(r,n,i){for(var a=-1,o=Object(r),s=i(r),u=s.length;u--;){var c=s[t?u:++a];if(n(o[c],c,o)===!1)break}return r}}return Ra=e,Ra}var Aa,dd;function dc(){if(dd)return Aa;dd=1;var e=pb(),t=e();return Aa=t,Aa}var Na,hd;function hc(){if(hd)return Na;hd=1;var e=dc(),t=Ke();function r(n,i){return n&&e(n,i,t)}return Na=r,Na}var Ma,pd;function gb(){if(pd)return Ma;pd=1;var e=je();function t(r,n){return function(i,a){if(i==null)return i;if(!e(i))return r(i,a);for(var o=i.length,s=n?o:-1,u=Object(i);(n?s--:++s<o)&&a(u[s],s,u)!==!1;);return i}}return Ma=t,Ma}var Ta,gd;function Vr(){if(gd)return Ta;gd=1;var e=hc(),t=gb(),r=t(e);return Ta=r,Ta}var Pa,vd;function jv(){if(vd)return Pa;vd=1;var e=Vr(),t=je();function r(n,i){var a=-1,o=t(n)?Array(n.length):[];return e(n,function(s,u,c){o[++a]=i(s,u,c)}),o}return Pa=r,Pa}var ka,yd;function vb(){if(yd)return ka;yd=1;function e(t,r){var n=t.length;for(t.sort(r);n--;)t[n]=t[n].value;return t}return ka=e,ka}var Oa,md;function yb(){if(md)return Oa;md=1;var e=St();function t(r,n){if(r!==n){var i=r!==void 0,a=r===null,o=r===r,s=e(r),u=n!==void 0,c=n===null,f=n===n,l=e(n);if(!c&&!l&&!s&&r>n||s&&u&&f&&!c&&!l||a&&u&&f||!i&&f||!o)return 1;if(!a&&!s&&!l&&r<n||l&&i&&o&&!a&&!s||c&&i&&o||!u&&o||!f)return-1}return 0}return Oa=t,Oa}var La,_d;function mb(){if(_d)return La;_d=1;var e=yb();function t(r,n,i){for(var a=-1,o=r.criteria,s=n.criteria,u=o.length,c=i.length;++a<u;){var f=e(o[a],s[a]);if(f){if(a>=c)return f;var l=i[a];return f*(l=="desc"?-1:1)}}return r.index-n.index}return La=t,La}var Da,bd;function _b(){if(bd)return Da;bd=1;var e=Dr(),t=$r(),r=ze(),n=jv(),i=vb(),a=Br(),o=mb(),s=st(),u=ue();function c(f,l,d){l.length?l=e(l,function(m){return u(m)?function(v){return t(v,m.length===1?m[0]:m)}:m}):l=[s];var h=-1;l=e(l,a(r));var g=n(f,function(m,v,y){var b=e(l,function(p){return p(m)});return{criteria:b,index:++h,value:m}});return i(g,function(m,v){return o(m,v,d)})}return Da=c,Da}var Fa,wd;function bb(){if(wd)return Fa;wd=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return Fa=e,Fa}var $a,xd;function zv(){if(xd)return $a;xd=1;var e=bb(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,s=-1,u=t(o.length-i,0),c=Array(u);++s<u;)c[s]=o[i+s];s=-1;for(var f=Array(i+1);++s<i;)f[s]=o[s];return f[i]=a(c),e(n,this,f)}}return $a=r,$a}var ja,Ed;function pc(){if(Ed)return ja;Ed=1;function e(t){return function(){return t}}return ja=e,ja}var za,Sd;function Bv(){if(Sd)return za;Sd=1;var e=ot(),t=function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}}();return za=t,za}var Ba,qd;function wb(){if(qd)return Ba;qd=1;var e=pc(),t=Bv(),r=st(),n=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return Ba=n,Ba}var Ha,Cd;function xb(){if(Cd)return Ha;Cd=1;var e=800,t=16,r=Date.now;function n(i){var a=0,o=0;return function(){var s=r(),u=t-(s-o);if(o=s,u>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return Ha=n,Ha}var Va,Id;function Hv(){if(Id)return Va;Id=1;var e=wb(),t=xb(),r=t(e);return Va=r,Va}var Ga,Rd;function Gr(){if(Rd)return Ga;Rd=1;var e=st(),t=zv(),r=Hv();function n(i,a){return r(t(i,a,e),i+"")}return Ga=n,Ga}var Ua,Ad;function Ur(){if(Ad)return Ua;Ad=1;var e=qt(),t=je(),r=zr(),n=ye();function i(a,o,s){if(!n(s))return!1;var u=typeof o;return(u=="number"?t(s)&&r(o,s.length):u=="string"&&o in s)?e(s[o],a):!1}return Ua=i,Ua}var Ya,Nd;function Eb(){if(Nd)return Ya;Nd=1;var e=lc(),t=_b(),r=Gr(),n=Ur(),i=r(function(a,o){if(a==null)return[];var s=o.length;return s>1&&n(a,o[0],o[1])?o=[]:s>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return Ya=i,Ya}var Wa,Md;function Sb(){if(Md)return Wa;Md=1;var e=Se(),t=function(){return e.Date.now()};return Wa=t,Wa}var Xa,Td;function qb(){if(Td)return Xa;Td=1;var e=/\s/;function t(r){for(var n=r.length;n--&&e.test(r.charAt(n)););return n}return Xa=t,Xa}var Ka,Pd;function Cb(){if(Pd)return Ka;Pd=1;var e=qb(),t=/^\s+/;function r(n){return n&&n.slice(0,e(n)+1).replace(t,"")}return Ka=r,Ka}var Za,kd;function Ib(){if(kd)return Za;kd=1;var e=Cb(),t=ye(),r=St(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function u(c){if(typeof c=="number")return c;if(r(c))return n;if(t(c)){var f=typeof c.valueOf=="function"?c.valueOf():c;c=t(f)?f+"":f}if(typeof c!="string")return c===0?c:+c;c=e(c);var l=a.test(c);return l||o.test(c)?s(c.slice(2),l?2:8):i.test(c)?n:+c}return Za=u,Za}function gc(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Vv(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Xt(){}var Lt=.7,br=1/Lt,ht="\\s*([+-]?\\d+)\\s*",Dt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ae="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Rb=/^#([0-9a-f]{3,8})$/,Ab=new RegExp(`^rgb\\(${ht},${ht},${ht}\\)$`),Nb=new RegExp(`^rgb\\(${Ae},${Ae},${Ae}\\)$`),Mb=new RegExp(`^rgba\\(${ht},${ht},${ht},${Dt}\\)$`),Tb=new RegExp(`^rgba\\(${Ae},${Ae},${Ae},${Dt}\\)$`),Pb=new RegExp(`^hsl\\(${Dt},${Ae},${Ae}\\)$`),kb=new RegExp(`^hsla\\(${Dt},${Ae},${Ae},${Dt}\\)$`),Od={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};gc(Xt,tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ld,formatHex:Ld,formatHex8:Ob,formatHsl:Lb,formatRgb:Dd,toString:Dd});function Ld(){return this.rgb().formatHex()}function Ob(){return this.rgb().formatHex8()}function Lb(){return Gv(this).formatHsl()}function Dd(){return this.rgb().formatRgb()}function tt(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Rb.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?Fd(t):r===3?new he(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?or(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?or(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=Ab.exec(e))?new he(t[1],t[2],t[3],1):(t=Nb.exec(e))?new he(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Mb.exec(e))?or(t[1],t[2],t[3],t[4]):(t=Tb.exec(e))?or(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Pb.exec(e))?zd(t[1],t[2]/100,t[3]/100,1):(t=kb.exec(e))?zd(t[1],t[2]/100,t[3]/100,t[4]):Od.hasOwnProperty(e)?Fd(Od[e]):e==="transparent"?new he(NaN,NaN,NaN,0):null}function Fd(e){return new he(e>>16&255,e>>8&255,e&255,1)}function or(e,t,r,n){return n<=0&&(e=t=r=NaN),new he(e,t,r,n)}function Db(e){return e instanceof Xt||(e=tt(e)),e?(e=e.rgb(),new he(e.r,e.g,e.b,e.opacity)):new he}function Bu(e,t,r,n){return arguments.length===1?Db(e):new he(e,t,r,n??1)}function he(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}gc(he,Bu,Vv(Xt,{brighter(e){return e=e==null?br:Math.pow(br,e),new he(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Lt:Math.pow(Lt,e),new he(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new he(Je(this.r),Je(this.g),Je(this.b),wr(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:$d,formatHex:$d,formatHex8:Fb,formatRgb:jd,toString:jd}));function $d(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}`}function Fb(){return`#${Qe(this.r)}${Qe(this.g)}${Qe(this.b)}${Qe((isNaN(this.opacity)?1:this.opacity)*255)}`}function jd(){const e=wr(this.opacity);return`${e===1?"rgb(":"rgba("}${Je(this.r)}, ${Je(this.g)}, ${Je(this.b)}${e===1?")":`, ${e})`}`}function wr(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 Qe(e){return e=Je(e),(e<16?"0":"")+e.toString(16)}function zd(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new be(e,t,r,n)}function Gv(e){if(e instanceof be)return new be(e.h,e.s,e.l,e.opacity);if(e instanceof Xt||(e=tt(e)),!e)return new be;if(e instanceof be)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),a=Math.max(t,r,n),o=NaN,s=a-i,u=(a+i)/2;return s?(t===a?o=(r-n)/s+(r<n)*6:r===a?o=(n-t)/s+2:o=(t-r)/s+4,s/=u<.5?a+i:2-a-i,o*=60):s=u>0&&u<1?0:o,new be(o,s,u,e.opacity)}function $b(e,t,r,n){return arguments.length===1?Gv(e):new be(e,t,r,n??1)}function be(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}gc(be,$b,Vv(Xt,{brighter(e){return e=e==null?br:Math.pow(br,e),new be(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Lt:Math.pow(Lt,e),new be(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,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new he(Qa(e>=240?e-240:e+120,i,n),Qa(e,i,n),Qa(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new be(Bd(this.h),sr(this.s),sr(this.l),wr(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=wr(this.opacity);return`${e===1?"hsl(":"hsla("}${Bd(this.h)}, ${sr(this.s)*100}%, ${sr(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Bd(e){return e=(e||0)%360,e<0?e+360:e}function sr(e){return Math.max(0,Math.min(1,e||0))}function Qa(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const vc=e=>()=>e;function jb(e,t){return function(r){return e+r*t}}function zb(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Bb(e){return(e=+e)==1?Uv:function(t,r){return r-t?zb(t,r,e):vc(isNaN(t)?r:t)}}function Uv(e,t){var r=t-e;return r?jb(e,r):vc(isNaN(e)?t:e)}const xr=function e(t){var r=Bb(t);function n(i,a){var o=r((i=Bu(i)).r,(a=Bu(a)).r),s=r(i.g,a.g),u=r(i.b,a.b),c=Uv(i.opacity,a.opacity);return function(f){return i.r=o(f),i.g=s(f),i.b=u(f),i.opacity=c(f),i+""}}return n.gamma=e,n}(1);function Hb(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(a){for(i=0;i<r;++i)n[i]=e[i]*(1-a)+t[i]*a;return n}}function Vb(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Gb(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),a=new Array(r),o;for(o=0;o<n;++o)i[o]=pt(e[o],t[o]);for(;o<r;++o)a[o]=t[o];return function(s){for(o=0;o<n;++o)a[o]=i[o](s);return a}}function Ub(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Re(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function Yb(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=pt(e[i],t[i]):n[i]=t[i];return function(a){for(i in r)n[i]=r[i](a);return n}}var Hu=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ja=new RegExp(Hu.source,"g");function Wb(e){return function(){return e}}function Xb(e){return function(t){return e(t)+""}}function Yv(e,t){var r=Hu.lastIndex=Ja.lastIndex=0,n,i,a,o=-1,s=[],u=[];for(e=e+"",t=t+"";(n=Hu.exec(e))&&(i=Ja.exec(t));)(a=i.index)>r&&(a=t.slice(r,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,u.push({i:o,x:Re(n,i)})),r=Ja.lastIndex;return r<t.length&&(a=t.slice(r),s[o]?s[o]+=a:s[++o]=a),s.length<2?u[0]?Xb(u[0].x):Wb(t):(t=u.length,function(c){for(var f=0,l;f<t;++f)s[(l=u[f]).i]=l.x(c);return s.join("")})}function pt(e,t){var r=typeof t,n;return t==null||r==="boolean"?vc(t):(r==="number"?Re:r==="string"?(n=tt(t))?(t=n,xr):Yv:t instanceof tt?xr:t instanceof Date?Ub:Vb(t)?Hb:Array.isArray(t)?Gb:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Yb:Re)(e,t)}function wR(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var Hd=180/Math.PI,Vu={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Wv(e,t,r,n,i,a){var o,s,u;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(u=e*r+t*n)&&(r-=e*u,n-=t*u),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,u/=s),e*n<t*r&&(e=-e,t=-t,u=-u,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Hd,skewX:Math.atan(u)*Hd,scaleX:o,scaleY:s}}var ur;function Kb(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Vu:Wv(t.a,t.b,t.c,t.d,t.e,t.f)}function Zb(e){return e==null||(ur||(ur=document.createElementNS("http://www.w3.org/2000/svg","g")),ur.setAttribute("transform",e),!(e=ur.transform.baseVal.consolidate()))?Vu:(e=e.matrix,Wv(e.a,e.b,e.c,e.d,e.e,e.f))}function Xv(e,t,r,n){function i(c){return c.length?c.pop()+" ":""}function a(c,f,l,d,h,g){if(c!==l||f!==d){var m=h.push("translate(",null,t,null,r);g.push({i:m-4,x:Re(c,l)},{i:m-2,x:Re(f,d)})}else(l||d)&&h.push("translate("+l+t+d+r)}function o(c,f,l,d){c!==f?(c-f>180?f+=360:f-c>180&&(c+=360),d.push({i:l.push(i(l)+"rotate(",null,n)-2,x:Re(c,f)})):f&&l.push(i(l)+"rotate("+f+n)}function s(c,f,l,d){c!==f?d.push({i:l.push(i(l)+"skewX(",null,n)-2,x:Re(c,f)}):f&&l.push(i(l)+"skewX("+f+n)}function u(c,f,l,d,h,g){if(c!==l||f!==d){var m=h.push(i(h)+"scale(",null,",",null,")");g.push({i:m-4,x:Re(c,l)},{i:m-2,x:Re(f,d)})}else(l!==1||d!==1)&&h.push(i(h)+"scale("+l+","+d+")")}return function(c,f){var l=[],d=[];return c=e(c),f=e(f),a(c.translateX,c.translateY,f.translateX,f.translateY,l,d),o(c.rotate,f.rotate,l,d),s(c.skewX,f.skewX,l,d),u(c.scaleX,c.scaleY,f.scaleX,f.scaleY,l,d),c=f=null,function(h){for(var g=-1,m=d.length,v;++g<m;)l[(v=d[g]).i]=v.x(h);return l.join("")}}}var Qb=Xv(Kb,"px, ","px)","deg)"),Jb=Xv(Zb,", ",")",")"),ew=1e-12;function Vd(e){return((e=Math.exp(e))+1/e)/2}function tw(e){return((e=Math.exp(e))-1/e)/2}function rw(e){return((e=Math.exp(2*e))-1)/(e+1)}const gr=function e(t,r,n){function i(a,o){var s=a[0],u=a[1],c=a[2],f=o[0],l=o[1],d=o[2],h=f-s,g=l-u,m=h*h+g*g,v,y;if(m<ew)y=Math.log(d/c)/t,v=function(E){return[s+E*h,u+E*g,c*Math.exp(t*E*y)]};else{var b=Math.sqrt(m),p=(d*d-c*c+n*m)/(2*c*r*b),_=(d*d-c*c-n*m)/(2*d*r*b),w=Math.log(Math.sqrt(p*p+1)-p),x=Math.log(Math.sqrt(_*_+1)-_);y=(x-w)/t,v=function(E){var I=E*y,C=Vd(w),M=c/(r*b)*(C*rw(t*I+w)-tw(w));return[s+M*h,u+M*g,c*C/Vd(t*I+w)]}}return v.duration=y*1e3*t/Math.SQRT2,v}return i.rho=function(a){var o=Math.max(.001,+a),s=o*o,u=s*s;return e(o,s,u)},i}(Math.SQRT2,2,4);function xR(e,t){t===void 0&&(t=e,e=pt);for(var r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r<n;)a[r]=e(i,i=t[++r]);return function(o){var s=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return a[s](o-s)}}var eo,Gd;function yc(){if(Gd)return eo;Gd=1;var e=St();function t(r,n,i){for(var a=-1,o=r.length;++a<o;){var s=r[a],u=n(s);if(u!=null&&(c===void 0?u===u&&!e(u):i(u,c)))var c=u,f=s}return f}return eo=t,eo}var to,Ud;function nw(){if(Ud)return to;Ud=1;function e(t,r){return t>r}return to=e,to}var ro,Yd;function iw(){if(Yd)return ro;Yd=1;var e=yc(),t=nw(),r=st();function n(i){return i&&i.length?e(i,r,t):void 0}return ro=n,ro}var no,Wd;function Kv(){if(Wd)return no;Wd=1;function e(t,r){return t<r}return no=e,no}var io,Xd;function aw(){if(Xd)return io;Xd=1;var e=yc(),t=Kv(),r=st();function n(i){return i&&i.length?e(i,r,t):void 0}return io=n,io}var ao,Kd;function Zv(){if(Kd)return ao;Kd=1;var e=Dr(),t=ze(),r=jv(),n=ue();function i(a,o){var s=n(a)?e:r;return s(a,t(o,3))}return ao=i,ao}var oo,Zd;function ow(){if(Zd)return oo;Zd=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return oo=e,oo}var so,Qd;function sw(){if(Qd)return so;Qd=1;var e=yc(),t=ze(),r=Kv();function n(i,a){return i&&i.length?e(i,t(a,2),r):void 0}return so=n,so}var uo,Jd;function Yr(){if(Jd)return uo;Jd=1;var e=Nv(),t=e(Object.getPrototypeOf,Object);return uo=t,uo}var co,eh;function uw(){if(eh)return co;eh=1;var e=at(),t=Yr(),r=Me(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,u=o.call(Object);function c(f){if(!r(f)||e(f)!=n)return!1;var l=t(f);if(l===null)return!0;var d=s.call(l,"constructor")&&l.constructor;return typeof d=="function"&&d instanceof d&&o.call(d)==u}return co=c,co}var fo,th;function cw(){if(th)return fo;th=1;var e=Math.ceil,t=Math.max;function r(n,i,a,o){for(var s=-1,u=t(e((i-n)/(a||1)),0),c=Array(u);u--;)c[o?u:++s]=n,n+=a;return c}return fo=r,fo}var lo,rh;function Qv(){if(rh)return lo;rh=1;var e=Ib(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-1/0){var a=i<0?-1:1;return a*r}return i===i?i:0}return lo=n,lo}var ho,nh;function fw(){if(nh)return ho;nh=1;var e=cw(),t=Ur(),r=Qv();function n(i){return function(a,o,s){return s&&typeof s!="number"&&t(a,o,s)&&(o=s=void 0),a=r(a),o===void 0?(o=a,a=0):o=r(o),s=s===void 0?a<o?1:-1:r(s),e(a,o,s,i)}}return ho=n,ho}var po,ih;function lw(){if(ih)return po;ih=1;var e=fw(),t=e();return po=t,po}var go,ah;function Wr(){if(ah)return go;ah=1;var e=Bv();function t(r,n,i){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return go=t,go}var vo,oh;function dw(){if(oh)return vo;oh=1;var e=Wr(),t=hc(),r=ze();function n(i,a){var o={};return a=r(a,3),t(i,function(s,u,c){e(o,u,a(s,u,c))}),o}return vo=n,vo}var yo,sh;function hw(){if(sh)return yo;sh=1;var e=ze(),t=je(),r=Ke();function n(i){return function(a,o,s){var u=Object(a);if(!t(a)){var c=e(o,3);a=r(a),o=function(l){return c(u[l],l,u)}}var f=i(a,o,s);return f>-1?u[c?a[f]:f]:void 0}}return yo=n,yo}var mo,uh;function pw(){if(uh)return mo;uh=1;var e=Qv();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return mo=t,mo}var _o,ch;function gw(){if(ch)return _o;ch=1;var e=$v(),t=ze(),r=pw(),n=Math.max;function i(a,o,s){var u=a==null?0:a.length;if(!u)return-1;var c=s==null?0:r(s);return c<0&&(c=n(u+c,0)),e(a,t(o,3),c)}return _o=i,_o}var bo,fh;function vw(){if(fh)return bo;fh=1;var e=hw(),t=gw(),r=e(t);return bo=r,bo}var wo,lh;function mc(){if(lh)return wo;lh=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n<i&&r(t[n],n,t)!==!1;);return t}return wo=e,wo}var xo,dh;function Xr(){if(dh)return xo;dh=1;var e=Wr(),t=qt(),r=Object.prototype,n=r.hasOwnProperty;function i(a,o,s){var u=a[o];(!(n.call(a,o)&&t(u,s))||s===void 0&&!(o in a))&&e(a,o,s)}return xo=i,xo}var Eo,hh;function Kt(){if(hh)return Eo;hh=1;var e=Xr(),t=Wr();function r(n,i,a,o){var s=!a;a||(a={});for(var u=-1,c=i.length;++u<c;){var f=i[u],l=o?o(a[f],n[f],f,a,n):void 0;l===void 0&&(l=n[f]),s?t(a,f,l):e(a,f,l)}return a}return Eo=r,Eo}var So,ph;function yw(){if(ph)return So;ph=1;var e=Kt(),t=Ke();function r(n,i){return n&&e(i,t(i),n)}return So=r,So}var qo,gh;function mw(){if(gh)return qo;gh=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return qo=e,qo}var Co,vh;function _w(){if(vh)return Co;vh=1;var e=ye(),t=Hr(),r=mw(),n=Object.prototype,i=n.hasOwnProperty;function a(o){if(!e(o))return r(o);var s=t(o),u=[];for(var c in o)c=="constructor"&&(s||!i.call(o,c))||u.push(c);return u}return Co=a,Co}var Io,yh;function ut(){if(yh)return Io;yh=1;var e=Av(),t=_w(),r=je();function n(i){return r(i)?e(i,!0):t(i)}return Io=n,Io}var Ro,mh;function bw(){if(mh)return Ro;mh=1;var e=Kt(),t=ut();function r(n,i){return n&&e(i,t(i),n)}return Ro=r,Ro}var Tt={exports:{}};Tt.exports;var _h;function Jv(){return _h||(_h=1,function(e,t){var r=Se(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a?r.Buffer:void 0,s=o?o.allocUnsafe:void 0;function u(c,f){if(f)return c.slice();var l=c.length,d=s?s(l):new c.constructor(l);return c.copy(d),d}e.exports=u}(Tt,Tt.exports)),Tt.exports}var Ao,bh;function ey(){if(bh)return Ao;bh=1;function e(t,r){var n=-1,i=t.length;for(r||(r=Array(i));++n<i;)r[n]=t[n];return r}return Ao=e,Ao}var No,wh;function ww(){if(wh)return No;wh=1;var e=Kt(),t=sc();function r(n,i){return e(n,t(n),i)}return No=r,No}var Mo,xh;function ty(){if(xh)return Mo;xh=1;var e=oc(),t=Yr(),r=sc(),n=Rv(),i=Object.getOwnPropertySymbols,a=i?function(o){for(var s=[];o;)e(s,r(o)),o=t(o);return s}:n;return Mo=a,Mo}var To,Eh;function xw(){if(Eh)return To;Eh=1;var e=Kt(),t=ty();function r(n,i){return e(n,t(n),i)}return To=r,To}var Po,Sh;function Ew(){if(Sh)return Po;Sh=1;var e=Cv(),t=ty(),r=ut();function n(i){return e(i,r,t)}return Po=n,Po}var ko,qh;function Sw(){if(qh)return ko;qh=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n){var i=n.length,a=new n.constructor(i);return i&&typeof n[0]=="string"&&t.call(n,"index")&&(a.index=n.index,a.input=n.input),a}return ko=r,ko}var Oo,Ch;function _c(){if(Ch)return Oo;Ch=1;var e=qv();function t(r){var n=new r.constructor(r.byteLength);return new e(n).set(new e(r)),n}return Oo=t,Oo}var Lo,Ih;function qw(){if(Ih)return Lo;Ih=1;var e=_c();function t(r,n){var i=n?e(r.buffer):r.buffer;return new r.constructor(i,r.byteOffset,r.byteLength)}return Lo=t,Lo}var Do,Rh;function Cw(){if(Rh)return Do;Rh=1;var e=/\w*$/;function t(r){var n=new r.constructor(r.source,e.exec(r));return n.lastIndex=r.lastIndex,n}return Do=t,Do}var Fo,Ah;function Iw(){if(Ah)return Fo;Ah=1;var e=Et(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function n(i){return r?Object(r.call(i)):{}}return Fo=n,Fo}var $o,Nh;function ry(){if(Nh)return $o;Nh=1;var e=_c();function t(r,n){var i=n?e(r.buffer):r.buffer;return new r.constructor(i,r.byteOffset,r.length)}return $o=t,$o}var jo,Mh;function Rw(){if(Mh)return jo;Mh=1;var e=_c(),t=qw(),r=Cw(),n=Iw(),i=ry(),a="[object Boolean]",o="[object Date]",s="[object Map]",u="[object Number]",c="[object RegExp]",f="[object Set]",l="[object String]",d="[object Symbol]",h="[object ArrayBuffer]",g="[object DataView]",m="[object Float32Array]",v="[object Float64Array]",y="[object Int8Array]",b="[object Int16Array]",p="[object Int32Array]",_="[object Uint8Array]",w="[object Uint8ClampedArray]",x="[object Uint16Array]",E="[object Uint32Array]";function I(C,M,q){var R=C.constructor;switch(M){case h:return e(C);case a:case o:return new R(+C);case g:return t(C,q);case m:case v:case y:case b:case p:case _:case w:case x:case E:return i(C,q);case s:return new R;case u:case l:return new R(C);case c:return r(C);case f:return new R;case d:return n(C)}}return jo=I,jo}var zo,Th;function ny(){if(Th)return zo;Th=1;var e=ye(),t=Object.create,r=function(){function n(){}return function(i){if(!e(i))return{};if(t)return t(i);n.prototype=i;var a=new n;return n.prototype=void 0,a}}();return zo=r,zo}var Bo,Ph;function iy(){if(Ph)return Bo;Ph=1;var e=ny(),t=Yr(),r=Hr();function n(i){return typeof i.constructor=="function"&&!r(i)?e(t(i)):{}}return Bo=n,Bo}var Ho,kh;function Aw(){if(kh)return Ho;kh=1;var e=It(),t=Me(),r="[object Map]";function n(i){return t(i)&&e(i)==r}return Ho=n,Ho}var Vo,Oh;function Nw(){if(Oh)return Vo;Oh=1;var e=Aw(),t=Br(),r=cc(),n=r&&r.isMap,i=n?t(n):e;return Vo=i,Vo}var Go,Lh;function Mw(){if(Lh)return Go;Lh=1;var e=It(),t=Me(),r="[object Set]";function n(i){return t(i)&&e(i)==r}return Go=n,Go}var Uo,Dh;function Tw(){if(Dh)return Uo;Dh=1;var e=Mw(),t=Br(),r=cc(),n=r&&r.isSet,i=n?t(n):e;return Uo=i,Uo}var Yo,Fh;function ay(){if(Fh)return Yo;Fh=1;var e=jr(),t=mc(),r=Xr(),n=yw(),i=bw(),a=Jv(),o=ey(),s=ww(),u=xw(),c=Mv(),f=Ew(),l=It(),d=Sw(),h=Rw(),g=iy(),m=ue(),v=Ct(),y=Nw(),b=ye(),p=Tw(),_=Ke(),w=ut(),x=1,E=2,I=4,C="[object Arguments]",M="[object Array]",q="[object Boolean]",R="[object Date]",O="[object Error]",S="[object Function]",T="[object GeneratorFunction]",N="[object Map]",D="[object Number]",k="[object Object]",P="[object RegExp]",H="[object Set]",G="[object String]",V="[object Symbol]",Y="[object WeakMap]",A="[object ArrayBuffer]",L="[object DataView]",F="[object Float32Array]",z="[object Float64Array]",B="[object Int8Array]",U="[object Int16Array]",X="[object Int32Array]",K="[object Uint8Array]",J="[object Uint8ClampedArray]",W="[object Uint16Array]",te="[object Uint32Array]",Z={};Z[C]=Z[M]=Z[A]=Z[L]=Z[q]=Z[R]=Z[F]=Z[z]=Z[B]=Z[U]=Z[X]=Z[N]=Z[D]=Z[k]=Z[P]=Z[H]=Z[G]=Z[V]=Z[K]=Z[J]=Z[W]=Z[te]=!0,Z[O]=Z[S]=Z[Y]=!1;function re(ee,le,fe,Pe,Ce,de){var se,He=le&x,ke=le&E,Ve=le&I;if(fe&&(se=Ce?fe(ee,Pe,Ce,de):fe(ee)),se!==void 0)return se;if(!b(ee))return ee;var Ge=m(ee);if(Ge){if(se=d(ee),!He)return o(ee,se)}else{var Oe=l(ee),rr=Oe==S||Oe==T;if(v(ee))return a(ee,He);if(Oe==k||Oe==C||rr&&!Ce){if(se=ke||rr?{}:g(ee),!He)return ke?u(ee,i(se,ee)):s(ee,n(se,ee))}else{if(!Z[Oe])return Ce?ee:{};se=h(ee,Oe,He)}}de||(de=new e);var ct=de.get(ee);if(ct)return ct;de.set(ee,se),p(ee)?ee.forEach(function(Ie){se.add(re(Ie,le,fe,Ie,ee,de))}):y(ee)&&ee.forEach(function(Ie,Le){se.set(Le,re(Ie,le,fe,Le,ee,de))});var cn=Ve?ke?f:c:ke?w:_,nr=Ge?void 0:cn(ee);return t(nr||ee,function(Ie,Le){nr&&(Le=Ie,Ie=ee[Le]),r(se,Le,re(Ie,le,fe,Le,ee,de))}),se}return Yo=re,Yo}var Wo,$h;function oy(){if($h)return Wo;$h=1;var e=lc();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return Wo=t,Wo}var Xo,jh;function Pw(){if(jh)return Xo;jh=1;var e=oy(),t=zv(),r=Hv();function n(i){return r(t(i,void 0,e),i+"")}return Xo=n,Xo}function ce(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,n;r<e.length;r++)(n=ce(e[r]))!==""&&(t+=(t&&" ")+n);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var kw={value:()=>{}};function Kr(){for(var e=0,t=arguments.length,r={},n;e<t;++e){if(!(n=arguments[e]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new vr(r)}function vr(e){this._=e}function Ow(e,t){return e.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}vr.prototype=Kr.prototype={constructor:vr,on:function(e,t){var r=this._,n=Ow(e+"",r),i,a=-1,o=n.length;if(arguments.length<2){for(;++a<o;)if((i=(e=n[a]).type)&&(i=Lw(r[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<o;)if(i=(e=n[a]).type)r[i]=zh(r[i],e.name,t);else if(t==null)for(i in r)r[i]=zh(r[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new vr(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,a;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],n=0,i=a.length;n<i;++n)a[n].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};function Lw(e,t){for(var r=0,n=e.length,i;r<n;++r)if((i=e[r]).name===t)return i.value}function zh(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=kw,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var Gu="http://www.w3.org/1999/xhtml";const Bh={svg:"http://www.w3.org/2000/svg",xhtml:Gu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Zr(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Bh.hasOwnProperty(t)?{space:Bh[t],local:e}:e}function Dw(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Gu&&t.documentElement.namespaceURI===Gu?t.createElement(e):t.createElementNS(r,e)}}function Fw(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function sy(e){var t=Zr(e);return(t.local?Fw:Dw)(t)}function $w(){}function bc(e){return e==null?$w:function(){return this.querySelector(e)}}function jw(e){typeof e!="function"&&(e=bc(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var a=t[i],o=a.length,s=n[i]=new Array(o),u,c,f=0;f<o;++f)(u=a[f])&&(c=e.call(u,u.__data__,f,a))&&("__data__"in u&&(c.__data__=u.__data__),s[f]=c);return new ve(n,this._parents)}function zw(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Bw(){return[]}function uy(e){return e==null?Bw:function(){return this.querySelectorAll(e)}}function Hw(e){return function(){return zw(e.apply(this,arguments))}}function Vw(e){typeof e=="function"?e=Hw(e):e=uy(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o=t[a],s=o.length,u,c=0;c<s;++c)(u=o[c])&&(n.push(e.call(u,u.__data__,c,o)),i.push(u));return new ve(n,i)}function cy(e){return function(){return this.matches(e)}}function fy(e){return function(t){return t.matches(e)}}var Gw=Array.prototype.find;function Uw(e){return function(){return Gw.call(this.children,e)}}function Yw(){return this.firstElementChild}function Ww(e){return this.select(e==null?Yw:Uw(typeof e=="function"?e:fy(e)))}var Xw=Array.prototype.filter;function Kw(){return Array.from(this.children)}function Zw(e){return function(){return Xw.call(this.children,e)}}function Qw(e){return this.selectAll(e==null?Kw:Zw(typeof e=="function"?e:fy(e)))}function Jw(e){typeof e!="function"&&(e=cy(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var a=t[i],o=a.length,s=n[i]=[],u,c=0;c<o;++c)(u=a[c])&&e.call(u,u.__data__,c,a)&&s.push(u);return new ve(n,this._parents)}function ly(e){return new Array(e.length)}function ex(){return new ve(this._enter||this._groups.map(ly),this._parents)}function Er(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Er.prototype={constructor:Er,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 tx(e){return function(){return e}}function rx(e,t,r,n,i,a){for(var o=0,s,u=t.length,c=a.length;o<c;++o)(s=t[o])?(s.__data__=a[o],n[o]=s):r[o]=new Er(e,a[o]);for(;o<u;++o)(s=t[o])&&(i[o]=s)}function nx(e,t,r,n,i,a,o){var s,u,c=new Map,f=t.length,l=a.length,d=new Array(f),h;for(s=0;s<f;++s)(u=t[s])&&(d[s]=h=o.call(u,u.__data__,s,t)+"",c.has(h)?i[s]=u:c.set(h,u));for(s=0;s<l;++s)h=o.call(e,a[s],s,a)+"",(u=c.get(h))?(n[s]=u,u.__data__=a[s],c.delete(h)):r[s]=new Er(e,a[s]);for(s=0;s<f;++s)(u=t[s])&&c.get(d[s])===u&&(i[s]=u)}function ix(e){return e.__data__}function ax(e,t){if(!arguments.length)return Array.from(this,ix);var r=t?nx:rx,n=this._parents,i=this._groups;typeof e!="function"&&(e=tx(e));for(var a=i.length,o=new Array(a),s=new Array(a),u=new Array(a),c=0;c<a;++c){var f=n[c],l=i[c],d=l.length,h=ox(e.call(f,f&&f.__data__,c,n)),g=h.length,m=s[c]=new Array(g),v=o[c]=new Array(g),y=u[c]=new Array(d);r(f,l,m,v,y,h,t);for(var b=0,p=0,_,w;b<g;++b)if(_=m[b]){for(b>=p&&(p=b+1);!(w=v[p])&&++p<g;);_._next=w||null}}return o=new ve(o,n),o._enter=s,o._exit=u,o}function ox(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function sx(){return new ve(this._exit||this._groups.map(ly),this._parents)}function ux(e,t,r){var n=this.enter(),i=this,a=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?a.remove():r(a),n&&i?n.merge(i).order():i}function cx(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=new Array(i),u=0;u<o;++u)for(var c=r[u],f=n[u],l=c.length,d=s[u]=new Array(l),h,g=0;g<l;++g)(h=c[g]||f[g])&&(d[g]=h);for(;u<i;++u)s[u]=r[u];return new ve(s,this._parents)}function fx(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n=e[t],i=n.length-1,a=n[i],o;--i>=0;)(o=n[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function lx(e){e||(e=dx);function t(l,d){return l&&d?e(l.__data__,d.__data__):!l-!d}for(var r=this._groups,n=r.length,i=new Array(n),a=0;a<n;++a){for(var o=r[a],s=o.length,u=i[a]=new Array(s),c,f=0;f<s;++f)(c=o[f])&&(u[f]=c);u.sort(t)}return new ve(i,this._parents).order()}function dx(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function hx(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function px(){return Array.from(this)}function gx(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null}function vx(){let e=0;for(const t of this)++e;return e}function yx(){return!this.node()}function mx(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i=t[r],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function _x(e){return function(){this.removeAttribute(e)}}function bx(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wx(e,t){return function(){this.setAttribute(e,t)}}function xx(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ex(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function Sx(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function qx(e,t){var r=Zr(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?bx:_x:typeof t=="function"?r.local?Sx:Ex:r.local?xx:wx)(r,t))}function dy(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Cx(e){return function(){this.style.removeProperty(e)}}function Ix(e,t,r){return function(){this.style.setProperty(e,t,r)}}function Rx(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function Ax(e,t,r){return arguments.length>1?this.each((t==null?Cx:typeof t=="function"?Rx:Ix)(e,t,r??"")):vt(this.node(),e)}function vt(e,t){return e.style.getPropertyValue(t)||dy(e).getComputedStyle(e,null).getPropertyValue(t)}function Nx(e){return function(){delete this[e]}}function Mx(e,t){return function(){this[e]=t}}function Tx(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function Px(e,t){return arguments.length>1?this.each((t==null?Nx:typeof t=="function"?Tx:Mx)(e,t)):this.node()[e]}function hy(e){return e.trim().split(/^|\s+/)}function wc(e){return e.classList||new py(e)}function py(e){this._node=e,this._names=hy(e.getAttribute("class")||"")}py.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 gy(e,t){for(var r=wc(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function vy(e,t){for(var r=wc(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function kx(e){return function(){gy(this,e)}}function Ox(e){return function(){vy(this,e)}}function Lx(e,t){return function(){(t.apply(this,arguments)?gy:vy)(this,e)}}function Dx(e,t){var r=hy(e+"");if(arguments.length<2){for(var n=wc(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?Lx:t?kx:Ox)(r,t))}function Fx(){this.textContent=""}function $x(e){return function(){this.textContent=e}}function jx(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function zx(e){return arguments.length?this.each(e==null?Fx:(typeof e=="function"?jx:$x)(e)):this.node().textContent}function Bx(){this.innerHTML=""}function Hx(e){return function(){this.innerHTML=e}}function Vx(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Gx(e){return arguments.length?this.each(e==null?Bx:(typeof e=="function"?Vx:Hx)(e)):this.node().innerHTML}function Ux(){this.nextSibling&&this.parentNode.appendChild(this)}function Yx(){return this.each(Ux)}function Wx(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Xx(){return this.each(Wx)}function Kx(e){var t=typeof e=="function"?e:sy(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Zx(){return null}function Qx(e,t){var r=typeof e=="function"?e:sy(e),n=t==null?Zx:typeof t=="function"?t:bc(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function Jx(){var e=this.parentNode;e&&e.removeChild(this)}function e1(){return this.each(Jx)}function t1(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function r1(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function n1(e){return this.select(e?r1:t1)}function i1(e){return arguments.length?this.property("__data__",e):this.node().__data__}function a1(e){return function(t){e.call(this,t,this.__data__)}}function o1(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function s1(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,a;r<i;++r)a=t[r],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++n]=a;++n?t.length=n:delete this.__on}}}function u1(e,t,r){return function(){var n=this.__on,i,a=a1(t);if(n){for(var o=0,s=n.length;o<s;++o)if((i=n[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=r),i.value=t;return}}this.addEventListener(e.type,a,r),i={type:e.type,name:e.name,value:t,listener:a,options:r},n?n.push(i):this.__on=[i]}}function c1(e,t,r){var n=o1(e+""),i,a=n.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,c=s.length,f;u<c;++u)for(i=0,f=s[u];i<a;++i)if((o=n[i]).type===f.type&&o.name===f.name)return f.value}return}for(s=t?u1:s1,i=0;i<a;++i)this.each(s(n[i],t,r));return this}function yy(e,t,r){var n=dy(e),i=n.CustomEvent;typeof i=="function"?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function f1(e,t){return function(){return yy(this,e,t)}}function l1(e,t){return function(){return yy(this,e,t.apply(this,arguments))}}function d1(e,t){return this.each((typeof t=="function"?l1:f1)(e,t))}function*h1(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length,o;i<a;++i)(o=n[i])&&(yield o)}var my=[null];function ve(e,t){this._groups=e,this._parents=t}function Zt(){return new ve([[document.documentElement]],my)}function p1(){return this}ve.prototype=Zt.prototype={constructor:ve,select:jw,selectAll:Vw,selectChild:Ww,selectChildren:Qw,filter:Jw,data:ax,enter:ex,exit:sx,join:ux,merge:cx,selection:p1,order:fx,sort:lx,call:hx,nodes:px,node:gx,size:vx,empty:yx,each:mx,attr:qx,style:Ax,property:Px,classed:Dx,text:zx,html:Gx,raise:Yx,lower:Xx,append:Kx,insert:Qx,remove:e1,clone:n1,datum:i1,on:c1,dispatch:d1,[Symbol.iterator]:h1};function ge(e){return typeof e=="string"?new ve([[document.querySelector(e)]],[document.documentElement]):new ve([[e]],my)}function g1(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=g1(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,n=n.matrixTransform(t.getScreenCTM().inverse()),[n.x,n.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const v1={passive:!1},Ft={capture:!0,passive:!1};function Ko(e){e.stopImmediatePropagation()}function gt(e){e.preventDefault(),e.stopImmediatePropagation()}function _y(e){var t=e.document.documentElement,r=ge(e).on("dragstart.drag",gt,Ft);"onselectstart"in t?r.on("selectstart.drag",gt,Ft):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function by(e,t){var r=e.document.documentElement,n=ge(e).on("dragstart.drag",null);t&&(n.on("click.drag",gt,Ft),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const cr=e=>()=>e;function Uu(e,{sourceEvent:t,subject:r,target:n,identifier:i,active:a,x:o,y:s,dx:u,dy:c,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:f}})}Uu.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function y1(e){return!e.ctrlKey&&!e.button}function m1(){return this.parentNode}function _1(e,t){return t??{x:e.x,y:e.y}}function b1(){return navigator.maxTouchPoints||"ontouchstart"in this}function wy(){var e=y1,t=m1,r=_1,n=b1,i={},a=Kr("start","drag","end"),o=0,s,u,c,f,l=0;function d(_){_.on("mousedown.drag",h).filter(n).on("touchstart.drag",v).on("touchmove.drag",y,v1).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(_,w){if(!(f||!e.call(this,_,w))){var x=p(this,t.call(this,_,w),_,w,"mouse");x&&(ge(_.view).on("mousemove.drag",g,Ft).on("mouseup.drag",m,Ft),_y(_.view),Ko(_),c=!1,s=_.clientX,u=_.clientY,x("start",_))}}function g(_){if(gt(_),!c){var w=_.clientX-s,x=_.clientY-u;c=w*w+x*x>l}i.mouse("drag",_)}function m(_){ge(_.view).on("mousemove.drag mouseup.drag",null),by(_.view,c),gt(_),i.mouse("end",_)}function v(_,w){if(e.call(this,_,w)){var x=_.changedTouches,E=t.call(this,_,w),I=x.length,C,M;for(C=0;C<I;++C)(M=p(this,E,_,w,x[C].identifier,x[C]))&&(Ko(_),M("start",_,x[C]))}}function y(_){var w=_.changedTouches,x=w.length,E,I;for(E=0;E<x;++E)(I=i[w[E].identifier])&&(gt(_),I("drag",_,w[E]))}function b(_){var w=_.changedTouches,x=w.length,E,I;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),E=0;E<x;++E)(I=i[w[E].identifier])&&(Ko(_),I("end",_,w[E]))}function p(_,w,x,E,I,C){var M=a.copy(),q=_e(C||x,w),R,O,S;if((S=r.call(_,new Uu("beforestart",{sourceEvent:x,target:d,identifier:I,active:o,x:q[0],y:q[1],dx:0,dy:0,dispatch:M}),E))!=null)return R=S.x-q[0]||0,O=S.y-q[1]||0,function T(N,D,k){var P=q,H;switch(N){case"start":i[I]=T,H=o++;break;case"end":delete i[I],--o;case"drag":q=_e(k||D,w),H=o;break}M.call(N,_,new Uu(N,{sourceEvent:D,subject:S,target:d,identifier:I,active:H,x:q[0]+R,y:q[1]+O,dx:q[0]-P[0],dy:q[1]-P[1],dispatch:M}),E)}}return d.filter=function(_){return arguments.length?(e=typeof _=="function"?_:cr(!!_),d):e},d.container=function(_){return arguments.length?(t=typeof _=="function"?_:cr(_),d):t},d.subject=function(_){return arguments.length?(r=typeof _=="function"?_:cr(_),d):r},d.touchable=function(_){return arguments.length?(n=typeof _=="function"?_:cr(!!_),d):n},d.on=function(){var _=a.on.apply(a,arguments);return _===a?d:_},d.clickDistance=function(_){return arguments.length?(l=(_=+_)*_,d):Math.sqrt(l)},d}var yt=0,Pt=0,Rt=0,xy=1e3,Sr,kt,qr=0,rt=0,Qr=0,$t=typeof performance=="object"&&performance.now?performance:Date,Ey=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function xc(){return rt||(Ey(w1),rt=$t.now()+Qr)}function w1(){rt=0}function Cr(){this._call=this._time=this._next=null}Cr.prototype=Sy.prototype={constructor:Cr,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?xc():+r)+(t==null?0:+t),!this._next&&kt!==this&&(kt?kt._next=this:Sr=this,kt=this),this._call=e,this._time=r,Yu()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yu())}};function Sy(e,t,r){var n=new Cr;return n.restart(e,t,r),n}function x1(){xc(),++yt;for(var e=Sr,t;e;)(t=rt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--yt}function Hh(){rt=(qr=$t.now())+Qr,yt=Pt=0;try{x1()}finally{yt=0,S1(),rt=0}}function E1(){var e=$t.now(),t=e-qr;t>xy&&(Qr-=t,qr=e)}function S1(){for(var e,t=Sr,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Sr=r);kt=e,Yu(n)}function Yu(e){if(!yt){Pt&&(Pt=clearTimeout(Pt));var t=e-rt;t>24?(e<1/0&&(Pt=setTimeout(Hh,e-$t.now()-Qr)),Rt&&(Rt=clearInterval(Rt))):(Rt||(qr=$t.now(),Rt=setInterval(E1,xy)),yt=1,Ey(Hh))}}function Vh(e,t,r){var n=new Cr;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var q1=Kr("start","end","cancel","interrupt"),C1=[],qy=0,Gh=1,Wu=2,yr=3,Uh=4,Xu=5,mr=6;function Jr(e,t,r,n,i,a){var o=e.__transition;if(!o)e.__transition={};else if(r in o)return;I1(e,r,{name:t,index:n,group:i,on:q1,tween:C1,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:qy})}function Ec(e,t){var r=qe(e,t);if(r.state>qy)throw new Error("too late; already scheduled");return r}function Te(e,t){var r=qe(e,t);if(r.state>yr)throw new Error("too late; already running");return r}function qe(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function I1(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=Sy(a,0,r.time);function a(c){r.state=Gh,r.timer.restart(o,r.delay,r.time),r.delay<=c&&o(c-r.delay)}function o(c){var f,l,d,h;if(r.state!==Gh)return u();for(f in n)if(h=n[f],h.name===r.name){if(h.state===yr)return Vh(o);h.state===Uh?(h.state=mr,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[f]):+f<t&&(h.state=mr,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete n[f])}if(Vh(function(){r.state===yr&&(r.state=Uh,r.timer.restart(s,r.delay,r.time),s(c))}),r.state=Wu,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Wu){for(r.state=yr,i=new Array(d=r.tween.length),f=0,l=-1;f<d;++f)(h=r.tween[f].value.call(e,e.__data__,r.index,r.group))&&(i[++l]=h);i.length=l+1}}function s(c){for(var f=c<r.duration?r.ease.call(null,c/r.duration):(r.timer.restart(u),r.state=Xu,1),l=-1,d=i.length;++l<d;)i[l].call(e,f);r.state===Xu&&(r.on.call("end",e,e.__data__,r.index,r.group),u())}function u(){r.state=mr,r.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function _r(e,t){var r=e.__transition,n,i,a=!0,o;if(r){t=t==null?null:t+"";for(o in r){if((n=r[o]).name!==t){a=!1;continue}i=n.state>Wu&&n.state<Xu,n.state=mr,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[o]}a&&delete e.__transition}}function R1(e){return this.each(function(){_r(this,e)})}function A1(e,t){var r,n;return function(){var i=Te(this,e),a=i.tween;if(a!==r){n=r=a;for(var o=0,s=n.length;o<s;++o)if(n[o].name===t){n=n.slice(),n.splice(o,1);break}}i.tween=n}}function N1(e,t,r){var n,i;if(typeof r!="function")throw new Error;return function(){var a=Te(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}a.tween=i}}function M1(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n=qe(this.node(),r).tween,i=0,a=n.length,o;i<a;++i)if((o=n[i]).name===e)return o.value;return null}return this.each((t==null?A1:N1)(r,e,t))}function Sc(e,t,r){var n=e._id;return e.each(function(){var i=Te(this,n);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return qe(i,n).value[t]}}function Cy(e,t){var r;return(typeof t=="number"?Re:t instanceof tt?xr:(r=tt(t))?(t=r,xr):Yv)(e,t)}function T1(e){return function(){this.removeAttribute(e)}}function P1(e){return function(){this.removeAttributeNS(e.space,e.local)}}function k1(e,t,r){var n,i=r+"",a;return function(){var o=this.getAttribute(e);return o===i?null:o===n?a:a=t(n=o,r)}}function O1(e,t,r){var n,i=r+"",a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===n?a:a=t(n=o,r)}}function L1(e,t,r){var n,i,a;return function(){var o,s=r(this),u;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),u=s+"",o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s)))}}function D1(e,t,r){var n,i,a;return function(){var o,s=r(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),u=s+"",o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s)))}}function F1(e,t){var r=Zr(e),n=r==="transform"?Jb:Cy;return this.attrTween(e,typeof t=="function"?(r.local?D1:L1)(r,n,Sc(this,"attr."+e,t)):t==null?(r.local?P1:T1)(r):(r.local?O1:k1)(r,n,t))}function $1(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function j1(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function z1(e,t){var r,n;function i(){var a=t.apply(this,arguments);return a!==n&&(r=(n=a)&&j1(e,a)),r}return i._value=t,i}function B1(e,t){var r,n;function i(){var a=t.apply(this,arguments);return a!==n&&(r=(n=a)&&$1(e,a)),r}return i._value=t,i}function H1(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var n=Zr(e);return this.tween(r,(n.local?z1:B1)(n,t))}function V1(e,t){return function(){Ec(this,e).delay=+t.apply(this,arguments)}}function G1(e,t){return t=+t,function(){Ec(this,e).delay=t}}function U1(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?V1:G1)(t,e)):qe(this.node(),t).delay}function Y1(e,t){return function(){Te(this,e).duration=+t.apply(this,arguments)}}function W1(e,t){return t=+t,function(){Te(this,e).duration=t}}function X1(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Y1:W1)(t,e)):qe(this.node(),t).duration}function K1(e,t){if(typeof t!="function")throw new Error;return function(){Te(this,e).ease=t}}function Z1(e){var t=this._id;return arguments.length?this.each(K1(t,e)):qe(this.node(),t).ease}function Q1(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Te(this,e).ease=r}}function J1(e){if(typeof e!="function")throw new Error;return this.each(Q1(this._id,e))}function eE(e){typeof e!="function"&&(e=cy(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var a=t[i],o=a.length,s=n[i]=[],u,c=0;c<o;++c)(u=a[c])&&e.call(u,u.__data__,c,a)&&s.push(u);return new $e(n,this._parents,this._name,this._id)}function tE(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=new Array(n),s=0;s<a;++s)for(var u=t[s],c=r[s],f=u.length,l=o[s]=new Array(f),d,h=0;h<f;++h)(d=u[h]||c[h])&&(l[h]=d);for(;s<n;++s)o[s]=t[s];return new $e(o,this._parents,this._name,this._id)}function rE(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function nE(e,t,r){var n,i,a=rE(t)?Ec:Te;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}function iE(e,t){var r=this._id;return arguments.length<2?qe(this.node(),r).on.on(e):this.each(nE(r,e,t))}function aE(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function oE(){return this.on("end.remove",aE(this._id))}function sE(e){var t=this._name,r=this._id;typeof e!="function"&&(e=bc(e));for(var n=this._groups,i=n.length,a=new Array(i),o=0;o<i;++o)for(var s=n[o],u=s.length,c=a[o]=new Array(u),f,l,d=0;d<u;++d)(f=s[d])&&(l=e.call(f,f.__data__,d,s))&&("__data__"in f&&(l.__data__=f.__data__),c[d]=l,Jr(c[d],t,r,d,c,qe(f,r)));return new $e(a,this._parents,t,r)}function uE(e){var t=this._name,r=this._id;typeof e!="function"&&(e=uy(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u=n[s],c=u.length,f,l=0;l<c;++l)if(f=u[l]){for(var d=e.call(f,f.__data__,l,u),h,g=qe(f,r),m=0,v=d.length;m<v;++m)(h=d[m])&&Jr(h,t,r,m,d,g);a.push(d),o.push(f)}return new $e(a,o,t,r)}var cE=Zt.prototype.constructor;function fE(){return new cE(this._groups,this._parents)}function lE(e,t){var r,n,i;return function(){var a=vt(this,e),o=(this.style.removeProperty(e),vt(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}function Iy(e){return function(){this.style.removeProperty(e)}}function dE(e,t,r){var n,i=r+"",a;return function(){var o=vt(this,e);return o===i?null:o===n?a:a=t(n=o,r)}}function hE(e,t,r){var n,i,a;return function(){var o=vt(this,e),s=r(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),vt(this,e))),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}function pE(e,t){var r,n,i,a="style."+t,o="end."+a,s;return function(){var u=Te(this,e),c=u.on,f=u.value[a]==null?s||(s=Iy(t)):void 0;(c!==r||i!==f)&&(n=(r=c).copy()).on(o,i=f),u.on=n}}function gE(e,t,r){var n=(e+="")=="transform"?Qb:Cy;return t==null?this.styleTween(e,lE(e,n)).on("end.style."+e,Iy(e)):typeof t=="function"?this.styleTween(e,hE(e,n,Sc(this,"style."+e,t))).each(pE(this._id,e)):this.styleTween(e,dE(e,n,t),r).on("end.style."+e,null)}function vE(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function yE(e,t,r){var n,i;function a(){var o=t.apply(this,arguments);return o!==i&&(n=(i=o)&&vE(e,o,r)),n}return a._value=t,a}function mE(e,t,r){var n="style."+(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;return this.tween(n,yE(e,t,r??""))}function _E(e){return function(){this.textContent=e}}function bE(e){return function(){var t=e(this);this.textContent=t??""}}function wE(e){return this.tween("text",typeof e=="function"?bE(Sc(this,"text",e)):_E(e==null?"":e+""))}function xE(e){return function(t){this.textContent=e.call(this,t)}}function EE(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&xE(i)),t}return n._value=e,n}function SE(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,EE(e))}function qE(){for(var e=this._name,t=this._id,r=Ry(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o=n[a],s=o.length,u,c=0;c<s;++c)if(u=o[c]){var f=qe(u,t);Jr(u,e,r,c,o,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new $e(n,this._parents,e,r)}function CE(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){--i===0&&a()}};r.each(function(){var c=Te(this,n),f=c.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),c.on=t}),i===0&&a()})}var IE=0;function $e(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function Ry(){return++IE}var De=Zt.prototype;$e.prototype={constructor:$e,select:sE,selectAll:uE,selectChild:De.selectChild,selectChildren:De.selectChildren,filter:eE,merge:tE,selection:fE,transition:qE,call:De.call,nodes:De.nodes,node:De.node,size:De.size,empty:De.empty,each:De.each,on:iE,attr:F1,attrTween:H1,style:gE,styleTween:mE,text:wE,textTween:SE,remove:oE,tween:M1,delay:U1,duration:X1,ease:Z1,easeVarying:J1,end:CE,[Symbol.iterator]:De[Symbol.iterator]};function RE(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var AE={time:null,delay:0,duration:250,ease:RE};function NE(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function ME(e){var t,r;e instanceof $e?(t=e._id,e=e._name):(t=Ry(),(r=AE).time=xc(),e=e==null?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o=n[a],s=o.length,u,c=0;c<s;++c)(u=o[c])&&Jr(u,e,t,c,o,r||NE(u,t));return new $e(n,this._parents,e,t)}Zt.prototype.interrupt=R1;Zt.prototype.transition=ME;const fr=e=>()=>e;function TE(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function Fe(e,t,r){this.k=e,this.x=t,this.y=r}Fe.prototype={constructor:Fe,scale:function(e){return e===1?this:new Fe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Fe(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 en=new Fe(1,0,0);Ay.prototype=Fe.prototype;function Ay(e){for(;!e.__zoom;)if(!(e=e.parentNode))return en;return e.__zoom}function Zo(e){e.stopImmediatePropagation()}function At(e){e.preventDefault(),e.stopImmediatePropagation()}function PE(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function kE(){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 Yh(){return this.__zoom||en}function OE(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function LE(){return navigator.maxTouchPoints||"ontouchstart"in this}function DE(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],o=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Ny(){var e=PE,t=kE,r=DE,n=OE,i=LE,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,u=gr,c=Kr("start","zoom","end"),f,l,d,h=500,g=150,m=0,v=10;function y(S){S.property("__zoom",Yh).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",M).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,T,N,D){var k=S.selection?S.selection():S;k.property("__zoom",Yh),S!==k?w(S,T,N,D):k.interrupt().each(function(){x(this,arguments).event(D).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},y.scaleBy=function(S,T,N,D){y.scaleTo(S,function(){var k=this.__zoom.k,P=typeof T=="function"?T.apply(this,arguments):T;return k*P},N,D)},y.scaleTo=function(S,T,N,D){y.transform(S,function(){var k=t.apply(this,arguments),P=this.__zoom,H=N==null?_(k):typeof N=="function"?N.apply(this,arguments):N,G=P.invert(H),V=typeof T=="function"?T.apply(this,arguments):T;return r(p(b(P,V),H,G),k,o)},N,D)},y.translateBy=function(S,T,N,D){y.transform(S,function(){return r(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),o)},null,D)},y.translateTo=function(S,T,N,D,k){y.transform(S,function(){var P=t.apply(this,arguments),H=this.__zoom,G=D==null?_(P):typeof D=="function"?D.apply(this,arguments):D;return r(en.translate(G[0],G[1]).scale(H.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof N=="function"?-N.apply(this,arguments):-N),P,o)},D,k)};function b(S,T){return T=Math.max(a[0],Math.min(a[1],T)),T===S.k?S:new Fe(T,S.x,S.y)}function p(S,T,N){var D=T[0]-N[0]*S.k,k=T[1]-N[1]*S.k;return D===S.x&&k===S.y?S:new Fe(S.k,D,k)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function w(S,T,N,D){S.on("start.zoom",function(){x(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(D).end()}).tween("zoom",function(){var k=this,P=arguments,H=x(k,P).event(D),G=t.apply(k,P),V=N==null?_(G):typeof N=="function"?N.apply(k,P):N,Y=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),A=k.__zoom,L=typeof T=="function"?T.apply(k,P):T,F=u(A.invert(V).concat(Y/A.k),L.invert(V).concat(Y/L.k));return function(z){if(z===1)z=L;else{var B=F(z),U=Y/B[2];z=new Fe(U,V[0]-B[0]*U,V[1]-B[1]*U)}H.zoom(null,z)}})}function x(S,T,N){return!N&&S.__zooming||new E(S,T)}function E(S,T){this.that=S,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,T),this.taps=0}E.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,T){return this.mouse&&S!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var T=ge(this.that).datum();c.call(S,this.that,new TE(S,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:c}),T)}};function I(S,...T){if(!e.apply(this,arguments))return;var N=x(this,T).event(S),D=this.__zoom,k=Math.max(a[0],Math.min(a[1],D.k*Math.pow(2,n.apply(this,arguments)))),P=_e(S);if(N.wheel)(N.mouse[0][0]!==P[0]||N.mouse[0][1]!==P[1])&&(N.mouse[1]=D.invert(N.mouse[0]=P)),clearTimeout(N.wheel);else{if(D.k===k)return;N.mouse=[P,D.invert(P)],_r(this),N.start()}At(S),N.wheel=setTimeout(H,g),N.zoom("mouse",r(p(b(D,k),N.mouse[0],N.mouse[1]),N.extent,o));function H(){N.wheel=null,N.end()}}function C(S,...T){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,D=x(this,T,!0).event(S),k=ge(S.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Y,!0),P=_e(S,N),H=S.clientX,G=S.clientY;_y(S.view),Zo(S),D.mouse=[P,this.__zoom.invert(P)],_r(this),D.start();function V(A){if(At(A),!D.moved){var L=A.clientX-H,F=A.clientY-G;D.moved=L*L+F*F>m}D.event(A).zoom("mouse",r(p(D.that.__zoom,D.mouse[0]=_e(A,N),D.mouse[1]),D.extent,o))}function Y(A){k.on("mousemove.zoom mouseup.zoom",null),by(A.view,D.moved),At(A),D.event(A).end()}}function M(S,...T){if(e.apply(this,arguments)){var N=this.__zoom,D=_e(S.changedTouches?S.changedTouches[0]:S,this),k=N.invert(D),P=N.k*(S.shiftKey?.5:2),H=r(p(b(N,P),D,k),t.apply(this,T),o);At(S),s>0?ge(this).transition().duration(s).call(w,H,D,S):ge(this).call(y.transform,H,D,S)}}function q(S,...T){if(e.apply(this,arguments)){var N=S.touches,D=N.length,k=x(this,T,S.changedTouches.length===D).event(S),P,H,G,V;for(Zo(S),H=0;H<D;++H)G=N[H],V=_e(G,this),V=[V,this.__zoom.invert(V),G.identifier],k.touch0?!k.touch1&&k.touch0[2]!==V[2]&&(k.touch1=V,k.taps=0):(k.touch0=V,P=!0,k.taps=1+!!f);f&&(f=clearTimeout(f)),P&&(k.taps<2&&(l=V[0],f=setTimeout(function(){f=null},h)),_r(this),k.start())}}function R(S,...T){if(this.__zooming){var N=x(this,T).event(S),D=S.changedTouches,k=D.length,P,H,G,V;for(At(S),P=0;P<k;++P)H=D[P],G=_e(H,this),N.touch0&&N.touch0[2]===H.identifier?N.touch0[0]=G:N.touch1&&N.touch1[2]===H.identifier&&(N.touch1[0]=G);if(H=N.that.__zoom,N.touch1){var Y=N.touch0[0],A=N.touch0[1],L=N.touch1[0],F=N.touch1[1],z=(z=L[0]-Y[0])*z+(z=L[1]-Y[1])*z,B=(B=F[0]-A[0])*B+(B=F[1]-A[1])*B;H=b(H,Math.sqrt(z/B)),G=[(Y[0]+L[0])/2,(Y[1]+L[1])/2],V=[(A[0]+F[0])/2,(A[1]+F[1])/2]}else if(N.touch0)G=N.touch0[0],V=N.touch0[1];else return;N.zoom("touch",r(p(H,G,V),N.extent,o))}}function O(S,...T){if(this.__zooming){var N=x(this,T).event(S),D=S.changedTouches,k=D.length,P,H;for(Zo(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),P=0;P<k;++P)H=D[P],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=_e(H,this),Math.hypot(l[0]-H[0],l[1]-H[1])<v)){var G=ge(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(n=typeof S=="function"?S:fr(+S),y):n},y.filter=function(S){return arguments.length?(e=typeof S=="function"?S:fr(!!S),y):e},y.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:fr(!!S),y):i},y.extent=function(S){return arguments.length?(t=typeof S=="function"?S:fr([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):t},y.scaleExtent=function(S){return arguments.length?(a[0]=+S[0],a[1]=+S[1],y):[a[0],a[1]]},y.translateExtent=function(S){return arguments.length?(o[0][0]=+S[0][0],o[1][0]=+S[1][0],o[0][1]=+S[0][1],o[1][1]=+S[1][1],y):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},y.constrain=function(S){return arguments.length?(r=S,y):r},y.duration=function(S){return arguments.length?(s=+S,y):s},y.interpolate=function(S){return arguments.length?(u=S,y):u},y.on=function(){var S=c.on.apply(c,arguments);return S===c?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(v=+S,y):v},y}const Ne={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:r,targetHandle:n})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:n}", 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."},jt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],My=["Enter"," ","Escape"],Ty={"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:r})=>`Moved selected node ${e}. New position, x: ${t}, y: ${r}`,"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 mt;(function(e){e.Strict="strict",e.Loose="loose"})(mt||(mt={}));var et;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(et||(et={}));var zt;(function(e){e.Partial="partial",e.Full="full"})(zt||(zt={}));const Py={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var We;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(We||(We={}));var Ir;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ir||(Ir={}));var Q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Q||(Q={}));const Wh={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function ky(e){return e===null?null:e?"valid":"invalid"}const Oy=e=>"id"in e&&"source"in e&&"target"in e,FE=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),qc=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Qt=(e,t=[0,0])=>{const{width:r,height:n}=Be(e),i=e.origin??t,a=r*i[0],o=n*i[1];return{x:e.position.x-a,y:e.position.y-o}},$E=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((n,i)=>{const a=typeof i=="string";let o=!t.nodeLookup&&!a?i:void 0;t.nodeLookup&&(o=a?t.nodeLookup.get(i):qc(i)?i:t.nodeLookup.get(i.id));const s=o?Rr(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return tn(n,s)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return rn(r)},Jt=(e,t={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},n=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(r=tn(r,Rr(i)),n=!0)}),n?rn(r):{x:0,y:0,width:0,height:0}},Cc=(e,t,[r,n,i]=[0,0,1],a=!1,o=!1)=>{const s={...tr(t,[r,n,i]),width:t.width/i,height:t.height/i},u=[];for(const c of e.values()){const{measured:f,selectable:l=!0,hidden:d=!1}=c;if(o&&!l||d)continue;const h=f.width??c.width??c.initialWidth??null,g=f.height??c.height??c.initialHeight??null,m=Bt(s,bt(c)),v=(h??0)*(g??0),y=a&&m>0;(!c.internals.handleBounds||y||m>=v||c.dragging)&&u.push(c)}return u},jE=(e,t)=>{const r=new Set;return e.forEach(n=>{r.add(n.id)}),t.filter(n=>r.has(n.source)||r.has(n.target))};function zE(e,t){const r=new Map,n=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!n||n.has(i.id))&&r.set(i.id,i)}),r}async function BE({nodes:e,width:t,height:r,panZoom:n,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);const s=zE(e,o),u=Jt(s),c=Ic(u,t,r,(o==null?void 0:o.minZoom)??i,(o==null?void 0:o.maxZoom)??a,(o==null?void 0:o.padding)??.1);return await n.setViewport(c,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),Promise.resolve(!0)}function Ly({nodeId:e,nextPosition:t,nodeLookup:r,nodeOrigin:n=[0,0],nodeExtent:i,onError:a}){const o=r.get(e),s=o.parentId?r.get(o.parentId):void 0,{x:u,y:c}=s?s.internals.positionAbsolute:{x:0,y:0},f=o.origin??n;let l=o.extent||i;if(o.extent==="parent"&&!o.expandParent)if(!s)a==null||a("005",Ne.error005());else{const h=s.measured.width,g=s.measured.height;h&&g&&(l=[[u,c],[u+h,c+g]])}else s&&wt(o.extent)&&(l=[[o.extent[0][0]+u,o.extent[0][1]+c],[o.extent[1][0]+u,o.extent[1][1]+c]]);const d=wt(l)?nt(t,l,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(a==null||a("015",Ne.error015())),{position:{x:d.x-u+(o.measured.width??0)*f[0],y:d.y-c+(o.measured.height??0)*f[1]},positionAbsolute:d}}async function HE({nodesToRemove:e=[],edgesToRemove:t=[],nodes:r,edges:n,onBeforeDelete:i}){const a=new Set(e.map(d=>d.id)),o=[];for(const d of r){if(d.deletable===!1)continue;const h=a.has(d.id),g=!h&&d.parentId&&o.find(m=>m.id===d.parentId);(h||g)&&o.push(d)}const s=new Set(t.map(d=>d.id)),u=n.filter(d=>d.deletable!==!1),f=jE(o,u);for(const d of u)s.has(d.id)&&!f.find(g=>g.id===d.id)&&f.push(d);if(!i)return{edges:f,nodes:o};const l=await i({nodes:o,edges:f});return typeof l=="boolean"?l?{edges:f,nodes:o}:{edges:[],nodes:[]}:l}const _t=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),nt=(e={x:0,y:0},t,r)=>({x:_t(e.x,t[0][0],t[1][0]-((r==null?void 0:r.width)??0)),y:_t(e.y,t[0][1],t[1][1]-((r==null?void 0:r.height)??0))});function Dy(e,t,r){const{width:n,height:i}=Be(r),{x:a,y:o}=r.internals.positionAbsolute;return nt(e,[[a,o],[a+n,o+i]],t)}const Xh=(e,t,r)=>e<t?_t(Math.abs(e-t),1,t)/t:e>r?-_t(Math.abs(e-r),1,t)/t:0,Fy=(e,t,r=15,n=40)=>{const i=Xh(e.x,n,t.width-n)*r,a=Xh(e.y,n,t.height-n)*r;return[i,a]},tn=(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)}),Ku=({x:e,y:t,width:r,height:n})=>({x:e,y:t,x2:e+r,y2:t+n}),rn=({x:e,y:t,x2:r,y2:n})=>({x:e,y:t,width:r-e,height:n-t}),bt=(e,t=[0,0])=>{var i,a;const{x:r,y:n}=qc(e)?e.internals.positionAbsolute:Qt(e,t);return{x:r,y:n,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0}},Rr=(e,t=[0,0])=>{var i,a;const{x:r,y:n}=qc(e)?e.internals.positionAbsolute:Qt(e,t);return{x:r,y:n,x2:r+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:n+(((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0)}},$y=(e,t)=>rn(tn(Ku(e),Ku(t))),Bt=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*n)},Kh=e=>we(e.width)&&we(e.height)&&we(e.x)&&we(e.y),we=e=>!isNaN(e)&&isFinite(e),VE=(e,t)=>{},er=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),tr=({x:e,y:t},[r,n,i],a=!1,o=[1,1])=>{const s={x:(e-r)/i,y:(t-n)/i};return a?er(s,o):s},Ar=({x:e,y:t},[r,n,i])=>({x:e*i+r,y:t*i+n});function ft(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(t*r*.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 GE(e,t,r){if(typeof e=="string"||typeof e=="number"){const n=ft(e,r),i=ft(e,t);return{top:n,right:i,bottom:n,left:i,x:i*2,y:n*2}}if(typeof e=="object"){const n=ft(e.top??e.y??0,r),i=ft(e.bottom??e.y??0,r),a=ft(e.left??e.x??0,t),o=ft(e.right??e.x??0,t);return{top:n,right:o,bottom:i,left:a,x:a+o,y:n+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function UE(e,t,r,n,i,a){const{x:o,y:s}=Ar(e,[t,r,n]),{x:u,y:c}=Ar({x:e.x+e.width,y:e.y+e.height},[t,r,n]),f=i-u,l=a-c;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(f),bottom:Math.floor(l)}}const Ic=(e,t,r,n,i,a)=>{const o=GE(a,t,r),s=(t-o.x)/e.width,u=(r-o.y)/e.height,c=Math.min(s,u),f=_t(c,n,i),l=e.x+e.width/2,d=e.y+e.height/2,h=t/2-l*f,g=r/2-d*f,m=UE(e,h,g,f,t,r),v={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:h-v.left+v.right,y:g-v.top+v.bottom,zoom:f}},Ht=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function wt(e){return e!=null&&e!=="parent"}function Be(e){var t,r;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight??0}}function jy(e){var t,r;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((r=e.measured)==null?void 0:r.height)??e.height??e.initialHeight)!==void 0}function zy(e,t={width:0,height:0},r,n,i){const a={...e},o=n.get(r);if(o){const s=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*s[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*s[1]}return a}function Zh(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}function YE(){let e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}function WE(e){return{...Ty,...e||{}}}function Ot(e,{snapGrid:t=[0,0],snapToGrid:r=!1,transform:n,containerBounds:i}){const{x:a,y:o}=xe(e),s=tr({x:a-((i==null?void 0:i.left)??0),y:o-((i==null?void 0:i.top)??0)},n),{x:u,y:c}=r?er(s,t):s;return{xSnapped:u,ySnapped:c,...s}}const Rc=e=>({width:e.offsetWidth,height:e.offsetHeight}),By=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},XE=["INPUT","SELECT","TEXTAREA"];function Hy(e){var n,i;const t=((i=(n=e.composedPath)==null?void 0:n.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:XE.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Vy=e=>"clientX"in e,xe=(e,t)=>{var a,o;const r=Vy(e),n=r?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,i=r?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:n-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},Qh=(e,t,r,n,i)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(o=>{const s=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:i,position:o.getAttribute("data-handlepos"),x:(s.left-r.left)/n,y:(s.top-r.top)/n,...Rc(o)}})};function Gy({sourceX:e,sourceY:t,targetX:r,targetY:n,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){const u=e*.125+i*.375+o*.375+r*.125,c=t*.125+a*.375+s*.375+n*.125,f=Math.abs(u-e),l=Math.abs(c-t);return[u,c,f,l]}function lr(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Jh({pos:e,x1:t,y1:r,x2:n,y2:i,c:a}){switch(e){case Q.Left:return[t-lr(t-n,a),r];case Q.Right:return[t+lr(n-t,a),r];case Q.Top:return[t,r-lr(r-i,a)];case Q.Bottom:return[t,r+lr(i-r,a)]}}function Uy({sourceX:e,sourceY:t,sourcePosition:r=Q.Bottom,targetX:n,targetY:i,targetPosition:a=Q.Top,curvature:o=.25}){const[s,u]=Jh({pos:r,x1:e,y1:t,x2:n,y2:i,c:o}),[c,f]=Jh({pos:a,x1:n,y1:i,x2:e,y2:t,c:o}),[l,d,h,g]=Gy({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:s,sourceControlY:u,targetControlX:c,targetControlY:f});return[`M${e},${t} C${s},${u} ${c},${f} ${n},${i}`,l,d,h,g]}function Yy({sourceX:e,sourceY:t,targetX:r,targetY:n}){const i=Math.abs(r-e)/2,a=r<e?r+i:r-i,o=Math.abs(n-t)/2,s=n<t?n+o:n-o;return[a,s,i,o]}function KE({sourceNode:e,targetNode:t,selected:r=!1,zIndex:n=0,elevateOnSelect:i=!1,zIndexMode:a="basic"}){if(a==="manual")return n;const o=i&&r?n+1e3:n,s=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return o+s}function ZE({sourceNode:e,targetNode:t,width:r,height:n,transform:i}){const a=tn(Rr(e),Rr(t));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const o={x:-i[0]/i[2],y:-i[1]/i[2],width:r/i[2],height:n/i[2]};return Bt(o,rn(a))>0}const QE=({source:e,sourceHandle:t,target:r,targetHandle:n})=>`xy-edge__${e}${t||""}-${r}${n||""}`,JE=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),eS=(e,t,r={})=>{if(!e.source||!e.target)return t;const n=r.getEdgeId||QE;let i;return Oy(e)?i={...e}:i={...e,id:n(e)},JE(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Wy({sourceX:e,sourceY:t,targetX:r,targetY:n}){const[i,a,o,s]=Yy({sourceX:e,sourceY:t,targetX:r,targetY:n});return[`M ${e},${t}L ${r},${n}`,i,a,o,s]}const ep={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},tS=({source:e,sourcePosition:t=Q.Bottom,target:r})=>t===Q.Left||t===Q.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},tp=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function rS({source:e,sourcePosition:t=Q.Bottom,target:r,targetPosition:n=Q.Top,center:i,offset:a,stepPosition:o}){const s=ep[t],u=ep[n],c={x:e.x+s.x*a,y:e.y+s.y*a},f={x:r.x+u.x*a,y:r.y+u.y*a},l=tS({source:c,sourcePosition:t,target:f}),d=l.x!==0?"x":"y",h=l[d];let g=[],m,v;const y={x:0,y:0},b={x:0,y:0},[,,p,_]=Yy({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(s[d]*u[d]===-1){d==="x"?(m=i.x??c.x+(f.x-c.x)*o,v=i.y??(c.y+f.y)/2):(m=i.x??(c.x+f.x)/2,v=i.y??c.y+(f.y-c.y)*o);const x=[{x:m,y:c.y},{x:m,y:f.y}],E=[{x:c.x,y:v},{x:f.x,y:v}];s[d]===h?g=d==="x"?x:E:g=d==="x"?E:x}else{const x=[{x:c.x,y:f.y}],E=[{x:f.x,y:c.y}];if(d==="x"?g=s.x===h?E:x:g=s.y===h?x:E,t===n){const R=Math.abs(e[d]-r[d]);if(R<=a){const O=Math.min(a-1,a-R);s[d]===h?y[d]=(c[d]>e[d]?-1:1)*O:b[d]=(f[d]>r[d]?-1:1)*O}}if(t!==n){const R=d==="x"?"y":"x",O=s[d]===u[R],S=c[R]>f[R],T=c[R]<f[R];(s[d]===1&&(!O&&S||O&&T)||s[d]!==1&&(!O&&T||O&&S))&&(g=d==="x"?x:E)}const I={x:c.x+y.x,y:c.y+y.y},C={x:f.x+b.x,y:f.y+b.y},M=Math.max(Math.abs(I.x-g[0].x),Math.abs(C.x-g[0].x)),q=Math.max(Math.abs(I.y-g[0].y),Math.abs(C.y-g[0].y));M>=q?(m=(I.x+C.x)/2,v=g[0].y):(m=g[0].x,v=(I.y+C.y)/2)}return[[e,{x:c.x+y.x,y:c.y+y.y},...g,{x:f.x+b.x,y:f.y+b.y},r],m,v,p,_]}function nS(e,t,r,n){const i=Math.min(tp(e,t)/2,tp(t,r)/2,n),{x:a,y:o}=t;if(e.x===a&&a===r.x||e.y===o&&o===r.y)return`L${a} ${o}`;if(e.y===o){const c=e.x<r.x?-1:1,f=e.y<r.y?1:-1;return`L ${a+i*c},${o}Q ${a},${o} ${a},${o+i*f}`}const s=e.x<r.x?1:-1,u=e.y<r.y?-1:1;return`L ${a},${o+i*u}Q ${a},${o} ${a+i*s},${o}`}function Zu({sourceX:e,sourceY:t,sourcePosition:r=Q.Bottom,targetX:n,targetY:i,targetPosition:a=Q.Top,borderRadius:o=5,centerX:s,centerY:u,offset:c=20,stepPosition:f=.5}){const[l,d,h,g,m]=rS({source:{x:e,y:t},sourcePosition:r,target:{x:n,y:i},targetPosition:a,center:{x:s,y:u},offset:c,stepPosition:f});return[l.reduce((y,b,p)=>{let _="";return p>0&&p<l.length-1?_=nS(l[p-1],b,l[p+1],o):_=`${p===0?"M":"L"}${b.x} ${b.y}`,y+=_,y},""),d,h,g,m]}function rp(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function iS(e){var l;const{sourceNode:t,targetNode:r}=e;if(!rp(t)||!rp(r))return null;const n=t.internals.handleBounds||np(t.handles),i=r.internals.handleBounds||np(r.handles),a=ip((n==null?void 0:n.source)??[],e.sourceHandle),o=ip(e.connectionMode===mt.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),e.targetHandle);if(!a||!o)return(l=e.onError)==null||l.call(e,"008",Ne.error008(a?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=(a==null?void 0:a.position)||Q.Bottom,u=(o==null?void 0:o.position)||Q.Top,c=it(t,a,s),f=it(r,o,u);return{sourceX:c.x,sourceY:c.y,targetX:f.x,targetY:f.y,sourcePosition:s,targetPosition:u}}function np(e){if(!e)return null;const t=[],r=[];for(const n of e)n.width=n.width??1,n.height=n.height??1,n.type==="source"?t.push(n):n.type==="target"&&r.push(n);return{source:t,target:r}}function it(e,t,r=Q.Left,n=!1){const i=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,a=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??Be(e);if(n)return{x:i+o/2,y:a+s/2};switch((t==null?void 0:t.position)??r){case Q.Top:return{x:i+o/2,y:a};case Q.Right:return{x:i+o,y:a+s/2};case Q.Bottom:return{x:i+o/2,y:a+s};case Q.Left:return{x:i,y:a+s/2}}}function ip(e,t){return e&&(t?e.find(r=>r.id===t):e[0])||null}function Qu(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(n=>`${n}=${e[n]}`).join("&")}`:""}function aS(e,{id:t,defaultColor:r,defaultMarkerStart:n,defaultMarkerEnd:i}){const a=new Set;return e.reduce((o,s)=>([s.markerStart||n,s.markerEnd||i].forEach(u=>{if(u&&typeof u=="object"){const c=Qu(u,t);a.has(c)||(o.push({id:c,color:u.color||r,...u}),a.add(c))}}),o),[]).sort((o,s)=>o.id.localeCompare(s.id))}const Xy=1e3,oS=10,Ac={nodeOrigin:[0,0],nodeExtent:jt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},sS={...Ac,checkEquality:!0};function Nc(e,t){const r={...e};for(const n in t)t[n]!==void 0&&(r[n]=t[n]);return r}function uS(e,t,r){const n=Nc(Ac,r);for(const i of e.values())if(i.parentId)Tc(i,e,t,n);else{const a=Qt(i,n.nodeOrigin),o=wt(i.extent)?i.extent:n.nodeExtent,s=nt(a,o,Be(i));i.internals.positionAbsolute=s}}function cS(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const r=[],n=[];for(const i of e.handles){const a={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?r.push(a):i.type==="target"&&n.push(a)}return{source:r,target:n}}function Mc(e){return e==="manual"}function Ju(e,t,r,n={}){var c,f;const i=Nc(sS,n),a={i:0},o=new Map(t),s=i!=null&&i.elevateNodesOnSelect&&!Mc(i.zIndexMode)?Xy:0;let u=e.length>0;t.clear(),r.clear();for(const l of e){let d=o.get(l.id);if(i.checkEquality&&l===(d==null?void 0:d.internals.userNode))t.set(l.id,d);else{const h=Qt(l,i.nodeOrigin),g=wt(l.extent)?l.extent:i.nodeExtent,m=nt(h,g,Be(l));d={...i.defaults,...l,measured:{width:(c=l.measured)==null?void 0:c.width,height:(f=l.measured)==null?void 0:f.height},internals:{positionAbsolute:m,handleBounds:cS(l,d),z:Ky(l,s,i.zIndexMode),userNode:l}},t.set(l.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(u=!1),l.parentId&&Tc(d,t,r,n,a)}return u}function fS(e,t){if(!e.parentId)return;const r=t.get(e.parentId);r?r.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Tc(e,t,r,n,i){const{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:u}=Nc(Ac,n),c=e.parentId,f=t.get(c);if(!f){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}fS(e,r),i&&!f.parentId&&f.internals.rootParentIndex===void 0&&u==="auto"&&(f.internals.rootParentIndex=++i.i,f.internals.z=f.internals.z+i.i*oS),i&&f.internals.rootParentIndex!==void 0&&(i.i=f.internals.rootParentIndex);const l=a&&!Mc(u)?Xy:0,{x:d,y:h,z:g}=lS(e,f,o,s,l,u),{positionAbsolute:m}=e.internals,v=d!==m.x||h!==m.y;(v||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:d,y:h}:m,z:g}})}function Ky(e,t,r){const n=we(e.zIndex)?e.zIndex:0;return Mc(r)?n:n+(e.selected?t:0)}function lS(e,t,r,n,i,a){const{x:o,y:s}=t.internals.positionAbsolute,u=Be(e),c=Qt(e,r),f=wt(e.extent)?nt(c,e.extent,u):c;let l=nt({x:o+f.x,y:s+f.y},n,u);e.extent==="parent"&&(l=Dy(l,u,t));const d=Ky(e,i,a),h=t.internals.z??0;return{x:l.x,y:l.y,z:h>=d?h+1:d}}function Pc(e,t,r,n=[0,0]){var o;const i=[],a=new Map;for(const s of e){const u=t.get(s.parentId);if(!u)continue;const c=((o=a.get(s.parentId))==null?void 0:o.expandedRect)??bt(u),f=$y(c,s.rect);a.set(s.parentId,{expandedRect:f,parent:u})}return a.size>0&&a.forEach(({expandedRect:s,parent:u},c)=>{var p;const f=u.internals.positionAbsolute,l=Be(u),d=u.origin??n,h=s.x<f.x?Math.round(Math.abs(f.x-s.x)):0,g=s.y<f.y?Math.round(Math.abs(f.y-s.y)):0,m=Math.max(l.width,Math.round(s.width)),v=Math.max(l.height,Math.round(s.height)),y=(m-l.width)*d[0],b=(v-l.height)*d[1];(h>0||g>0||y||b)&&(i.push({id:c,type:"position",position:{x:u.position.x-h+y,y:u.position.y-g+b}}),(p=r.get(c))==null||p.forEach(_=>{e.some(w=>w.id===_.id)||i.push({id:_.id,type:"position",position:{x:_.position.x+h,y:_.position.y+g}})})),(l.width<s.width||l.height<s.height||h||g)&&i.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:m+(h?d[0]*h-y:0),height:v+(g?d[1]*g-b:0)}})}),i}function dS(e,t,r,n,i,a,o){const s=n==null?void 0:n.querySelector(".xyflow__viewport");let u=!1;if(!s)return{changes:[],updatedInternals:u};const c=[],f=window.getComputedStyle(s),{m22:l}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),u=!0;continue}const m=Rc(h.nodeElement),v=g.measured.width!==m.width||g.measured.height!==m.height;if(!!(m.width&&m.height&&(v||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=wt(g.extent)?g.extent:a;let{positionAbsolute:_}=g.internals;g.parentId&&g.extent==="parent"?_=Dy(_,m,t.get(g.parentId)):p&&(_=nt(_,p,m));const w={...g,measured:m,internals:{...g.internals,positionAbsolute:_,handleBounds:{source:Qh("source",h.nodeElement,b,l,g.id),target:Qh("target",h.nodeElement,b,l,g.id)}}};t.set(g.id,w),g.parentId&&Tc(w,t,r,{nodeOrigin:i,zIndexMode:o}),u=!0,v&&(c.push({id:g.id,type:"dimensions",dimensions:m}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:bt(w,i)}))}}if(d.length>0){const h=Pc(d,t,r,i);c.push(...h)}return{changes:c,updatedInternals:u}}async function hS({delta:e,panZoom:t,transform:r,translateExtent:n,width:i,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const o=await t.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[i,a]],n),s=!!o&&(o.x!==r[0]||o.y!==r[1]||o.k!==r[2]);return Promise.resolve(s)}function ap(e,t,r,n,i,a){let o=i;const s=n.get(o)||new Map;n.set(o,s.set(r,t)),o=`${i}-${e}`;const u=n.get(o)||new Map;if(n.set(o,u.set(r,t)),a){o=`${i}-${e}-${a}`;const c=n.get(o)||new Map;n.set(o,c.set(r,t))}}function Zy(e,t,r){e.clear(),t.clear();for(const n of r){const{source:i,target:a,sourceHandle:o=null,targetHandle:s=null}=n,u={edgeId:n.id,source:i,target:a,sourceHandle:o,targetHandle:s},c=`${i}-${o}--${a}-${s}`,f=`${a}-${s}--${i}-${o}`;ap("source",u,f,e,i,o),ap("target",u,c,e,a,s),t.set(n.id,n)}}function Qy(e,t){if(!e.parentId)return!1;const r=t.get(e.parentId);return r?r.selected?!0:Qy(r,t):!1}function op(e,t,r){var i;let n=e;do{if((i=n==null?void 0:n.matches)!=null&&i.call(n,t))return!0;if(n===r)return!1;n=n==null?void 0:n.parentElement}while(n);return!1}function pS(e,t,r,n){const i=new Map;for(const[a,o]of e)if((o.selected||o.id===n)&&(!o.parentId||!Qy(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const s=e.get(a);s&&i.set(a,{id:a,position:s.position||{x:0,y:0},distance:{x:r.x-s.internals.positionAbsolute.x,y:r.y-s.internals.positionAbsolute.y},extent:s.extent,parentId:s.parentId,origin:s.origin,expandParent:s.expandParent,internals:{positionAbsolute:s.internals.positionAbsolute||{x:0,y:0}},measured:{width:s.measured.width??0,height:s.measured.height??0}})}return i}function Qo({nodeId:e,dragItems:t,nodeLookup:r,dragging:n=!0}){var o,s,u;const i=[];for(const[c,f]of t){const l=(o=r.get(c))==null?void 0:o.internals.userNode;l&&i.push({...l,position:f.position,dragging:n})}if(!e)return[i[0],i];const a=(s=r.get(e))==null?void 0:s.internals.userNode;return[a?{...a,position:((u=t.get(e))==null?void 0:u.position)||a.position,dragging:n}:i[0],i]}function gS({dragItems:e,snapGrid:t,x:r,y:n}){const i=e.values().next().value;if(!i)return null;const a={x:r-i.distance.x,y:n-i.distance.y},o=er(a,t);return{x:o.x-a.x,y:o.y-a.y}}function vS({onNodeMouseDown:e,getStoreItems:t,onDragStart:r,onDrag:n,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,u=!1,c={x:0,y:0},f=null,l=!1,d=null,h=!1,g=!1,m=null;function v({noDragClassName:b,handleSelector:p,domNode:_,isSelectable:w,nodeId:x,nodeClickDistance:E=0}){d=ge(_);function I({x:R,y:O}){const{nodeLookup:S,nodeExtent:T,snapGrid:N,snapToGrid:D,nodeOrigin:k,onNodeDrag:P,onSelectionDrag:H,onError:G,updateNodePositions:V}=t();a={x:R,y:O};let Y=!1;const A=s.size>1,L=A&&T?Ku(Jt(s)):null,F=A&&D?gS({dragItems:s,snapGrid:N,x:R,y:O}):null;for(const[z,B]of s){if(!S.has(z))continue;let U={x:R-B.distance.x,y:O-B.distance.y};D&&(U=F?{x:Math.round(U.x+F.x),y:Math.round(U.y+F.y)}:er(U,N));let X=null;if(A&&T&&!B.extent&&L){const{positionAbsolute:W}=B.internals,te=W.x-L.x+T[0][0],Z=W.x+B.measured.width-L.x2+T[1][0],re=W.y-L.y+T[0][1],ee=W.y+B.measured.height-L.y2+T[1][1];X=[[te,re],[Z,ee]]}const{position:K,positionAbsolute:J}=Ly({nodeId:z,nextPosition:U,nodeLookup:S,nodeExtent:X||T,nodeOrigin:k,onError:G});Y=Y||B.position.x!==K.x||B.position.y!==K.y,B.position=K,B.internals.positionAbsolute=J}if(g=g||Y,!!Y&&(V(s,!0),m&&(n||P||!x&&H))){const[z,B]=Qo({nodeId:x,dragItems:s,nodeLookup:S});n==null||n(m,s,z,B),P==null||P(m,z,B),x||H==null||H(m,B)}}async function C(){if(!f)return;const{transform:R,panBy:O,autoPanSpeed:S,autoPanOnNodeDrag:T}=t();if(!T){u=!1,cancelAnimationFrame(o);return}const[N,D]=Fy(c,f,S);(N!==0||D!==0)&&(a.x=(a.x??0)-N/R[2],a.y=(a.y??0)-D/R[2],await O({x:N,y:D})&&I(a)),o=requestAnimationFrame(C)}function M(R){var A;const{nodeLookup:O,multiSelectionActive:S,nodesDraggable:T,transform:N,snapGrid:D,snapToGrid:k,selectNodesOnDrag:P,onNodeDragStart:H,onSelectionDragStart:G,unselectNodesAndEdges:V}=t();l=!0,(!P||!w)&&!S&&x&&((A=O.get(x))!=null&&A.selected||V()),w&&P&&x&&(e==null||e(x));const Y=Ot(R.sourceEvent,{transform:N,snapGrid:D,snapToGrid:k,containerBounds:f});if(a=Y,s=pS(O,T,Y,x),s.size>0&&(r||H||!x&&G)){const[L,F]=Qo({nodeId:x,dragItems:s,nodeLookup:O});r==null||r(R.sourceEvent,s,L,F),H==null||H(R.sourceEvent,L,F),x||G==null||G(R.sourceEvent,F)}}const q=wy().clickDistance(E).on("start",R=>{const{domNode:O,nodeDragThreshold:S,transform:T,snapGrid:N,snapToGrid:D}=t();f=(O==null?void 0:O.getBoundingClientRect())||null,h=!1,g=!1,m=R.sourceEvent,S===0&&M(R),a=Ot(R.sourceEvent,{transform:T,snapGrid:N,snapToGrid:D,containerBounds:f}),c=xe(R.sourceEvent,f)}).on("drag",R=>{const{autoPanOnNodeDrag:O,transform:S,snapGrid:T,snapToGrid:N,nodeDragThreshold:D,nodeLookup:k}=t(),P=Ot(R.sourceEvent,{transform:S,snapGrid:T,snapToGrid:N,containerBounds:f});if(m=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||x&&!k.has(x))&&(h=!0),!h){if(!u&&O&&l&&(u=!0,C()),!l){const H=xe(R.sourceEvent,f),G=H.x-c.x,V=H.y-c.y;Math.sqrt(G*G+V*V)>D&&M(R)}(a.x!==P.xSnapped||a.y!==P.ySnapped)&&s&&l&&(c=xe(R.sourceEvent,f),I(P))}}).on("end",R=>{if(!(!l||h)&&(u=!1,l=!1,cancelAnimationFrame(o),s.size>0)){const{nodeLookup:O,updateNodePositions:S,onNodeDragStop:T,onSelectionDragStop:N}=t();if(g&&(S(s,!1),g=!1),i||T||!x&&N){const[D,k]=Qo({nodeId:x,dragItems:s,nodeLookup:O,dragging:!1});i==null||i(R.sourceEvent,s,D,k),T==null||T(R.sourceEvent,D,k),x||N==null||N(R.sourceEvent,k)}}}).filter(R=>{const O=R.target;return!R.button&&(!b||!op(O,`.${b}`,_))&&(!p||op(O,p,_))});d.call(q)}function y(){d==null||d.on(".drag",null)}return{update:v,destroy:y}}function yS(e,t,r){const n=[],i={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const a of t.values())Bt(i,bt(a))>0&&n.push(a);return n}const mS=250;function _S(e,t,r,n){var s,u;let i=[],a=1/0;const o=yS(e,r,t+mS);for(const c of o){const f=[...((s=c.internals.handleBounds)==null?void 0:s.source)??[],...((u=c.internals.handleBounds)==null?void 0:u.target)??[]];for(const l of f){if(n.nodeId===l.nodeId&&n.type===l.type&&n.id===l.id)continue;const{x:d,y:h}=it(c,l,l.position,!0),g=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));g>t||(g<a?(i=[{...l,x:d,y:h}],a=g):g===a&&i.push({...l,x:d,y:h}))}}if(!i.length)return null;if(i.length>1){const c=n.type==="source"?"target":"source";return i.find(f=>f.type===c)??i[0]}return i[0]}function Jy(e,t,r,n,i,a=!1){var c,f,l;const o=n.get(e);if(!o)return null;const s=i==="strict"?(c=o.internals.handleBounds)==null?void 0:c[t]:[...((f=o.internals.handleBounds)==null?void 0:f.source)??[],...((l=o.internals.handleBounds)==null?void 0:l.target)??[]],u=(r?s==null?void 0:s.find(d=>d.id===r):s==null?void 0:s[0])??null;return u&&a?{...u,...it(o,u,u.position,!0)}:u}function em(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function bS(e,t){let r=null;return t?r=!0:e&&!t&&(r=!1),r}const tm=()=>!0;function wS(e,{connectionMode:t,connectionRadius:r,handleId:n,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:u,lib:c,autoPanOnConnect:f,flowId:l,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:m,onConnectEnd:v,isValidConnection:y=tm,onReconnectEnd:b,updateConnection:p,getTransform:_,getFromHandle:w,autoPanSpeed:x,dragThreshold:E=1,handleDomNode:I}){const C=By(e.target);let M=0,q;const{x:R,y:O}=xe(e),S=em(a,I),T=s==null?void 0:s.getBoundingClientRect();let N=!1;if(!T||!S)return;const D=Jy(i,S,n,u,t);if(!D)return;let k=xe(e,T),P=!1,H=null,G=!1,V=null;function Y(){if(!f||!T)return;const[K,J]=Fy(k,T,x);d({x:K,y:J}),M=requestAnimationFrame(Y)}const A={...D,nodeId:i,type:S,position:D.position},L=u.get(i);let z={inProgress:!0,isValid:null,from:it(L,A,Q.Left,!0),fromHandle:A,fromPosition:A.position,fromNode:L,to:k,toHandle:null,toPosition:Wh[A.position],toNode:null,pointer:k};function B(){N=!0,p(z),g==null||g(e,{nodeId:i,handleId:n,handleType:S})}E===0&&B();function U(K){if(!N){const{x:ee,y:le}=xe(K),fe=ee-R,Pe=le-O;if(!(fe*fe+Pe*Pe>E*E))return;B()}if(!w()||!A){X(K);return}const J=_();k=xe(K,T),q=_S(tr(k,J,!1,[1,1]),r,u,A),P||(Y(),P=!0);const W=rm(K,{handle:q,connectionMode:t,fromNodeId:i,fromHandleId:n,fromType:o?"target":"source",isValidConnection:y,doc:C,lib:c,flowId:l,nodeLookup:u});V=W.handleDomNode,H=W.connection,G=bS(!!q,W.isValid);const te=u.get(i),Z=te?it(te,A,Q.Left,!0):z.from,re={...z,from:Z,isValid:G,to:W.toHandle&&G?Ar({x:W.toHandle.x,y:W.toHandle.y},J):k,toHandle:W.toHandle,toPosition:G&&W.toHandle?W.toHandle.position:Wh[A.position],toNode:W.toHandle?u.get(W.toHandle.nodeId):null,pointer:k};p(re),z=re}function X(K){if(!("touches"in K&&K.touches.length>0)){if(N){(q||V)&&H&&G&&(m==null||m(H));const{inProgress:J,...W}=z,te={...W,toPosition:z.toHandle?z.toPosition:null};v==null||v(K,te),a&&(b==null||b(K,te))}h(),cancelAnimationFrame(M),P=!1,G=!1,H=null,V=null,C.removeEventListener("mousemove",U),C.removeEventListener("mouseup",X),C.removeEventListener("touchmove",U),C.removeEventListener("touchend",X)}}C.addEventListener("mousemove",U),C.addEventListener("mouseup",X),C.addEventListener("touchmove",U),C.addEventListener("touchend",X)}function rm(e,{handle:t,connectionMode:r,fromNodeId:n,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:u,isValidConnection:c=tm,nodeLookup:f}){const l=a==="target",d=t?o.querySelector(`.${s}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=xe(e),m=o.elementFromPoint(h,g),v=m!=null&&m.classList.contains(`${s}-flow__handle`)?m:d,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const b=em(void 0,v),p=v.getAttribute("data-nodeid"),_=v.getAttribute("data-handleid"),w=v.classList.contains("connectable"),x=v.classList.contains("connectableend");if(!p||!b)return y;const E={source:l?p:n,sourceHandle:l?_:i,target:l?n:p,targetHandle:l?i:_};y.connection=E;const C=w&&x&&(r===mt.Strict?l&&b==="source"||!l&&b==="target":p!==n||_!==i);y.isValid=C&&c(E),y.toHandle=Jy(p,b,_,f,r,!0)}return y}const ec={onPointerDown:wS,isValid:rm};function xS({domNode:e,panZoom:t,getTransform:r,getViewScale:n}){const i=ge(e);function a({translateExtent:s,width:u,height:c,zoomStep:f=1,pannable:l=!0,zoomable:d=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const _=r(),w=p.sourceEvent.ctrlKey&&Ht()?10:1,x=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*f,E=_[2]*Math.pow(2,x*w);t.scaleTo(E)};let m=[0,0];const v=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(m=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},y=p=>{const _=r();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const w=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],x=[w[0]-m[0],w[1]-m[1]];m=w;const E=n()*Math.max(_[2],Math.log(_[2]))*(h?-1:1),I={x:_[0]-x[0]*E,y:_[1]-x[1]*E},C=[[0,0],[u,c]];t.setViewportConstrained({x:I.x,y:I.y,zoom:_[2]},C,s)},b=Ny().on("start",v).on("zoom",l?y:null).on("zoom.wheel",d?g:null);i.call(b,{})}function o(){i.on("zoom",null)}return{update:a,destroy:o,pointer:_e}}const nn=e=>({x:e.x,y:e.y,zoom:e.k}),Jo=({x:e,y:t,zoom:r})=>en.translate(e,t).scale(r),lt=(e,t)=>e.target.closest(`.${t}`),nm=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),ES=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,es=(e,t=0,r=ES,n=()=>{})=>{const i=typeof t=="number"&&t>0;return i||n(),i?e.transition().duration(t).ease(r).on("end",n):e},im=e=>{const t=e.ctrlKey&&Ht()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function SS({zoomPanValues:e,noWheelClassName:t,d3Selection:r,d3Zoom:n,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:u,onPanZoomEnd:c}){return f=>{if(lt(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const l=r.property("__zoom").k||1;if(f.ctrlKey&&o){const v=_e(f),y=im(f),b=l*Math.pow(2,y);n.scaleTo(r,b,v,f);return}const d=f.deltaMode===1?20:1;let h=i===et.Vertical?0:f.deltaX*d,g=i===et.Horizontal?0:f.deltaY*d;!Ht()&&f.shiftKey&&i!==et.Vertical&&(h=f.deltaY*d,g=0),n.translateBy(r,-(h/l)*a,-(g/l)*a,{internal:!0});const m=nn(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(f,m),e.panScrollTimeout=setTimeout(()=>{c==null||c(f,m),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,s==null||s(f,m))}}function qS({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:r}){return function(n,i){const a=n.type==="wheel",o=!t&&a&&!n.ctrlKey,s=lt(n,e);if(n.ctrlKey&&a&&s&&n.preventDefault(),o||s)return null;n.preventDefault(),r.call(this,n,i)}}function CS({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:r}){return n=>{var a,o,s;if((a=n.sourceEvent)!=null&&a.internal)return;const i=nn(n.transform);e.mouseButton=((o=n.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((s=n.sourceEvent)==null?void 0:s.type)==="mousedown"&&t(!0),r&&(r==null||r(n.sourceEvent,i))}}function IS({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:r,onTransformChange:n,onPanZoom:i}){return a=>{var o,s;e.usedRightMouseButton=!!(r&&nm(t,e.mouseButton??0)),(o=a.sourceEvent)!=null&&o.sync||n([a.transform.x,a.transform.y,a.transform.k]),i&&!((s=a.sourceEvent)!=null&&s.internal)&&(i==null||i(a.sourceEvent,nn(a.transform)))}}function RS({zoomPanValues:e,panOnDrag:t,panOnScroll:r,onDraggingChange:n,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{var s;if(!((s=o.sourceEvent)!=null&&s.internal)&&(e.isZoomingOrPanning=!1,a&&nm(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,n(!1),i)){const u=nn(o.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(o.sourceEvent,u)},r?150:0)}}}function AS({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:r,panOnDrag:n,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:u,lib:c,connectionInProgress:f}){return l=>{var v;const d=e||t,h=r&&l.ctrlKey,g=l.type==="wheel";if(l.button===1&&l.type==="mousedown"&&(lt(l,`${c}-flow__node`)||lt(l,`${c}-flow__edge`)))return!0;if(!n&&!d&&!i&&!a&&!r||o||f&&!g||lt(l,s)&&g||lt(l,u)&&(!g||i&&g&&!e)||!r&&l.ctrlKey&&g)return!1;if(!r&&l.type==="touchstart"&&((v=l.touches)==null?void 0:v.length)>1)return l.preventDefault(),!1;if(!d&&!i&&!h&&g||!n&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(n)&&!n.includes(l.button)&&l.type==="mousedown")return!1;const m=Array.isArray(n)&&n.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||g)&&m}}function NS({domNode:e,minZoom:t,maxZoom:r,translateExtent:n,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:u}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),l=Ny().scaleExtent([t,r]).translateExtent(n),d=ge(e).call(l);b({x:i.x,y:i.y,zoom:_t(i.zoom,t,r)},[[0,0],[f.width,f.height]],n);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");l.wheelDelta(im);function m(q,R){return d?new Promise(O=>{l==null||l.interpolate((R==null?void 0:R.interpolate)==="linear"?pt:gr).transform(es(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>O(!0)),q)}):Promise.resolve(!1)}function v({noWheelClassName:q,noPanClassName:R,onPaneContextMenu:O,userSelectionActive:S,panOnScroll:T,panOnDrag:N,panOnScrollMode:D,panOnScrollSpeed:k,preventScrolling:P,zoomOnPinch:H,zoomOnScroll:G,zoomOnDoubleClick:V,zoomActivationKeyPressed:Y,lib:A,onTransformChange:L,connectionInProgress:F,paneClickDistance:z,selectionOnDrag:B}){S&&!c.isZoomingOrPanning&&y();const U=T&&!Y&&!S;l.clickDistance(B?1/0:!we(z)||z<0?0:z);const X=U?SS({zoomPanValues:c,noWheelClassName:q,d3Selection:d,d3Zoom:l,panOnScrollMode:D,panOnScrollSpeed:k,zoomOnPinch:H,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):qS({noWheelClassName:q,preventScrolling:P,d3ZoomHandler:h});if(d.on("wheel.zoom",X,{passive:!1}),!S){const J=CS({zoomPanValues:c,onDraggingChange:u,onPanZoomStart:o});l.on("start",J);const W=IS({zoomPanValues:c,panOnDrag:N,onPaneContextMenu:!!O,onPanZoom:a,onTransformChange:L});l.on("zoom",W);const te=RS({zoomPanValues:c,panOnDrag:N,panOnScroll:T,onPaneContextMenu:O,onPanZoomEnd:s,onDraggingChange:u});l.on("end",te)}const K=AS({zoomActivationKeyPressed:Y,panOnDrag:N,zoomOnScroll:G,panOnScroll:T,zoomOnDoubleClick:V,zoomOnPinch:H,userSelectionActive:S,noPanClassName:R,noWheelClassName:q,lib:A,connectionInProgress:F});l.filter(K),V?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function y(){l.on("zoom",null)}async function b(q,R,O){const S=Jo(q),T=l==null?void 0:l.constrain()(S,R,O);return T&&await m(T),new Promise(N=>N(T))}async function p(q,R){const O=Jo(q);return await m(O,R),new Promise(S=>S(O))}function _(q){if(d){const R=Jo(q),O=d.property("__zoom");(O.k!==q.zoom||O.x!==q.x||O.y!==q.y)&&(l==null||l.transform(d,R,null,{sync:!0}))}}function w(){const q=d?Ay(d.node()):{x:0,y:0,k:1};return{x:q.x,y:q.y,zoom:q.k}}function x(q,R){return d?new Promise(O=>{l==null||l.interpolate((R==null?void 0:R.interpolate)==="linear"?pt:gr).scaleTo(es(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>O(!0)),q)}):Promise.resolve(!1)}function E(q,R){return d?new Promise(O=>{l==null||l.interpolate((R==null?void 0:R.interpolate)==="linear"?pt:gr).scaleBy(es(d,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>O(!0)),q)}):Promise.resolve(!1)}function I(q){l==null||l.scaleExtent(q)}function C(q){l==null||l.translateExtent(q)}function M(q){const R=!we(q)||q<0?0:q;l==null||l.clickDistance(R)}return{update:v,destroy:y,setViewport:p,setViewportConstrained:b,getViewport:w,scaleTo:x,scaleBy:E,setScaleExtent:I,setTranslateExtent:C,syncViewport:_,setClickDistance:M}}var xt;(function(e){e.Line="line",e.Handle="handle"})(xt||(xt={}));function MS({width:e,prevWidth:t,height:r,prevHeight:n,affectsX:i,affectsY:a}){const o=e-t,s=r-n,u=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(u[0]=u[0]*-1),s&&a&&(u[1]=u[1]*-1),u}function sp(e){const t=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),n=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:r,affectsX:n,affectsY:i}}function Ue(e,t){return Math.max(0,t-e)}function Ye(e,t){return Math.max(0,e-t)}function dr(e,t,r){return Math.max(0,t-e,e-r)}function up(e,t){return e?!t:t}function TS(e,t,r,n,i,a,o,s){let{affectsX:u,affectsY:c}=t;const{isHorizontal:f,isVertical:l}=t,d=f&&l,{xSnapped:h,ySnapped:g}=r,{minWidth:m,maxWidth:v,minHeight:y,maxHeight:b}=n,{x:p,y:_,width:w,height:x,aspectRatio:E}=e;let I=Math.floor(f?h-e.pointerX:0),C=Math.floor(l?g-e.pointerY:0);const M=w+(u?-I:I),q=x+(c?-C:C),R=-a[0]*w,O=-a[1]*x;let S=dr(M,m,v),T=dr(q,y,b);if(o){let k=0,P=0;u&&I<0?k=Ue(p+I+R,o[0][0]):!u&&I>0&&(k=Ye(p+M+R,o[1][0])),c&&C<0?P=Ue(_+C+O,o[0][1]):!c&&C>0&&(P=Ye(_+q+O,o[1][1])),S=Math.max(S,k),T=Math.max(T,P)}if(s){let k=0,P=0;u&&I>0?k=Ye(p+I,s[0][0]):!u&&I<0&&(k=Ue(p+M,s[1][0])),c&&C>0?P=Ye(_+C,s[0][1]):!c&&C<0&&(P=Ue(_+q,s[1][1])),S=Math.max(S,k),T=Math.max(T,P)}if(i){if(f){const k=dr(M/E,y,b)*E;if(S=Math.max(S,k),o){let P=0;!u&&!c||u&&!c&&d?P=Ye(_+O+M/E,o[1][1])*E:P=Ue(_+O+(u?I:-I)/E,o[0][1])*E,S=Math.max(S,P)}if(s){let P=0;!u&&!c||u&&!c&&d?P=Ue(_+M/E,s[1][1])*E:P=Ye(_+(u?I:-I)/E,s[0][1])*E,S=Math.max(S,P)}}if(l){const k=dr(q*E,m,v)/E;if(T=Math.max(T,k),o){let P=0;!u&&!c||c&&!u&&d?P=Ye(p+q*E+R,o[1][0])/E:P=Ue(p+(c?C:-C)*E+R,o[0][0])/E,T=Math.max(T,P)}if(s){let P=0;!u&&!c||c&&!u&&d?P=Ue(p+q*E,s[1][0])/E:P=Ye(p+(c?C:-C)*E,s[0][0])/E,T=Math.max(T,P)}}}C=C+(C<0?T:-T),I=I+(I<0?S:-S),i&&(d?M>q*E?C=(up(u,c)?-I:I)/E:I=(up(u,c)?-C:C)*E:f?(C=I/E,c=u):(I=C*E,u=c));const N=u?p+I:p,D=c?_+C:_;return{width:w+(u?-I:I),height:x+(c?-C:C),x:a[0]*I*(u?-1:1)+N,y:a[1]*C*(c?-1:1)+D}}const am={width:0,height:0,x:0,y:0},PS={...am,pointerX:0,pointerY:0,aspectRatio:1};function kS(e){return[[0,0],[e.measured.width,e.measured.height]]}function OS(e,t,r){const n=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=r[0]*a,u=r[1]*o;return[[n-s,i-u],[n+a-s,i+o-u]]}function LS({domNode:e,nodeId:t,getStoreItems:r,onChange:n,onEnd:i}){const a=ge(e);let o={controlDirection:sp("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:c,boundaries:f,keepAspectRatio:l,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:m,shouldResize:v}){let y={...am},b={...PS};o={boundaries:f,resizeDirection:d,keepAspectRatio:l,controlDirection:sp(c)};let p,_=null,w=[],x,E,I,C=!1;const M=wy().on("start",q=>{const{nodeLookup:R,transform:O,snapGrid:S,snapToGrid:T,nodeOrigin:N,paneDomNode:D}=r();if(p=R.get(t),!p)return;_=(D==null?void 0:D.getBoundingClientRect())??null;const{xSnapped:k,ySnapped:P}=Ot(q.sourceEvent,{transform:O,snapGrid:S,snapToGrid:T,containerBounds:_});y={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...y,pointerX:k,pointerY:P,aspectRatio:y.width/y.height},x=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(x=R.get(p.parentId),E=x&&p.extent==="parent"?kS(x):void 0),w=[],I=void 0;for(const[H,G]of R)if(G.parentId===t&&(w.push({id:H,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const V=OS(G,p,G.origin??N);I?I=[[Math.min(V[0][0],I[0][0]),Math.min(V[0][1],I[0][1])],[Math.max(V[1][0],I[1][0]),Math.max(V[1][1],I[1][1])]]:I=V}h==null||h(q,{...y})}).on("drag",q=>{const{transform:R,snapGrid:O,snapToGrid:S,nodeOrigin:T}=r(),N=Ot(q.sourceEvent,{transform:R,snapGrid:O,snapToGrid:S,containerBounds:_}),D=[];if(!p)return;const{x:k,y:P,width:H,height:G}=y,V={},Y=p.origin??T,{width:A,height:L,x:F,y:z}=TS(b,o.controlDirection,N,o.boundaries,o.keepAspectRatio,Y,E,I),B=A!==H,U=L!==G,X=F!==k&&B,K=z!==P&&U;if(!X&&!K&&!B&&!U)return;if((X||K||Y[0]===1||Y[1]===1)&&(V.x=X?F:y.x,V.y=K?z:y.y,y.x=V.x,y.y=V.y,w.length>0)){const Z=F-k,re=z-P;for(const ee of w)ee.position={x:ee.position.x-Z+Y[0]*(A-H),y:ee.position.y-re+Y[1]*(L-G)},D.push(ee)}if((B||U)&&(V.width=B&&(!o.resizeDirection||o.resizeDirection==="horizontal")?A:y.width,V.height=U&&(!o.resizeDirection||o.resizeDirection==="vertical")?L:y.height,y.width=V.width,y.height=V.height),x&&p.expandParent){const Z=Y[0]*(V.width??0);V.x&&V.x<Z&&(y.x=Z,b.x=b.x-(V.x-Z));const re=Y[1]*(V.height??0);V.y&&V.y<re&&(y.y=re,b.y=b.y-(V.y-re))}const J=MS({width:y.width,prevWidth:H,height:y.height,prevHeight:G,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),W={...y,direction:J};(v==null?void 0:v(q,W))!==!1&&(C=!0,g==null||g(q,W),n(V,D))}).on("end",q=>{C&&(m==null||m(q,{...y}),i==null||i({...y}),C=!1)});a.call(M)}function u(){a.on(".drag",null)}return{update:s,destroy:u}}var ts={exports:{}},rs={},ns={exports:{}},is={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* use-sync-external-store-shim.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var cp;function DS(){if(cp)return is;cp=1;var e=mv();function t(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,i=e.useEffect,a=e.useLayoutEffect,o=e.useDebugValue;function s(l,d){var h=d(),g=n({inst:{value:h,getSnapshot:d}}),m=g[0].inst,v=g[1];return a(function(){m.value=h,m.getSnapshot=d,u(m)&&v({inst:m})},[l,h,d]),i(function(){return u(m)&&v({inst:m}),l(function(){u(m)&&v({inst:m})})},[l]),o(h),h}function u(l){var d=l.getSnapshot;l=l.value;try{var h=d();return!r(l,h)}catch{return!0}}function c(l,d){return d()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:s;return is.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,is}var fp;function FS(){return fp||(fp=1,ns.exports=DS()),ns.exports}/**
|
|
10
|
-
* @license React
|
|
11
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var lp;function $S(){if(lp)return rs;lp=1;var e=mv(),t=FS();function r(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}var n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,a=e.useRef,o=e.useEffect,s=e.useMemo,u=e.useDebugValue;return rs.useSyncExternalStoreWithSelector=function(c,f,l,d,h){var g=a(null);if(g.current===null){var m={hasValue:!1,value:null};g.current=m}else m=g.current;g=s(function(){function y(x){if(!b){if(b=!0,p=x,x=d(x),h!==void 0&&m.hasValue){var E=m.value;if(h(E,x))return _=E}return _=x}if(E=_,n(p,x))return E;var I=d(x);return h!==void 0&&h(E,I)?(p=x,E):(p=x,_=I)}var b=!1,p,_,w=l===void 0?null:l;return[function(){return y(f())},w===null?void 0:function(){return y(w())}]},[f,l,d,h]);var v=i(c,g[0],g[1]);return o(function(){m.hasValue=!0,m.value=v},[v]),u(v),v},rs}var dp;function jS(){return dp||(dp=1,ts.exports=$S()),ts.exports}var zS=jS();const BS=t_(zS),HS={},hp=e=>{let t;const r=new Set,n=(f,l)=>{const d=typeof f=="function"?f(t):f;if(!Object.is(d,t)){const h=t;t=l??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(g=>g(t,h))}},i=()=>t,u={setState:n,getState:i,getInitialState:()=>c,subscribe:f=>(r.add(f),()=>r.delete(f)),destroy:()=>{(HS?"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."),r.clear()}},c=t=e(n,i,u);return u},VS=e=>e?hp(e):hp,{useDebugValue:GS}=e_,{useSyncExternalStoreWithSelector:US}=BS,YS=e=>e;function om(e,t=YS,r){const n=US(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return GS(n),n}const pp=(e,t)=>{const r=VS(e),n=(i,a=t)=>om(r,i,a);return Object.assign(n,r),n},WS=(e,t)=>e?pp(e,t):pp;function ie(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[n,i]of e)if(!Object.is(i,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||!Object.is(e[n],t[n]))return!1;return!0}const an=j.createContext(null),XS=an.Provider,sm=Ne.error001();function ne(e,t){const r=j.useContext(an);if(r===null)throw new Error(sm);return om(r,e,t)}function ae(){const e=j.useContext(an);if(e===null)throw new Error(sm);return j.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const gp={display:"none"},KS={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},um="react-flow__node-desc",cm="react-flow__edge-desc",ZS="react-flow__aria-live",QS=e=>e.ariaLiveMessage,JS=e=>e.ariaLabelConfig;function eq({rfId:e}){const t=ne(QS);return $.jsx("div",{id:`${ZS}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:KS,children:t})}function tq({rfId:e,disableKeyboardA11y:t}){const r=ne(JS);return $.jsxs($.Fragment,{children:[$.jsx("div",{id:`${um}-${e}`,style:gp,children:t?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),$.jsx("div",{id:`${cm}-${e}`,style:gp,children:r["edge.a11yDescription.default"]}),!t&&$.jsx(eq,{rfId:e})]})}const on=j.forwardRef(({position:e="top-left",children:t,className:r,style:n,...i},a)=>{const o=`${e}`.split("-");return $.jsx("div",{className:ce(["react-flow__panel",r,...o]),style:n,ref:a,...i,children:t})});on.displayName="Panel";function rq({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:$.jsx(on,{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:$.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const nq=e=>{const t=[],r=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,n]of e.edgeLookup)n.selected&&r.push(n);return{selectedNodes:t,selectedEdges:r}},hr=e=>e.id;function iq(e,t){return ie(e.selectedNodes.map(hr),t.selectedNodes.map(hr))&&ie(e.selectedEdges.map(hr),t.selectedEdges.map(hr))}function aq({onSelectionChange:e}){const t=ae(),{selectedNodes:r,selectedEdges:n}=ne(nq,iq);return j.useEffect(()=>{const i={nodes:r,edges:n};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(a=>a(i))},[r,n,e]),null}const oq=e=>!!e.onSelectionChangeHandlers;function sq({onSelectionChange:e}){const t=ne(oq);return e||t?$.jsx(aq,{onSelectionChange:e}):null}const fm=[0,0],uq={x:0,y:0,zoom:1},cq=["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"],vp=[...cq,"rfId"],fq=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}),yp={translateExtent:jt,nodeOrigin:fm,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function lq(e){const{setNodes:t,setEdges:r,setMinZoom:n,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:u}=ne(fq,ie),c=ae();j.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{f.current=yp,s()}),[]);const f=j.useRef(yp);return j.useEffect(()=>{for(const l of vp){const d=e[l],h=f.current[l];d!==h&&(typeof e[l]>"u"||(l==="nodes"?t(d):l==="edges"?r(d):l==="minZoom"?n(d):l==="maxZoom"?i(d):l==="translateExtent"?a(d):l==="nodeExtent"?o(d):l==="ariaLabelConfig"?c.setState({ariaLabelConfig:WE(d)}):l==="fitView"?c.setState({fitViewQueued:d}):l==="fitViewOptions"?c.setState({fitViewOptions:d}):c.setState({[l]:d})))}f.current=e},vp.map(l=>e[l])),null}function mp(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function dq(e){var n;const[t,r]=j.useState(e==="system"?null:e);return j.useEffect(()=>{if(e!=="system"){r(e);return}const i=mp(),a=()=>r(i!=null&&i.matches?"dark":"light");return a(),i==null||i.addEventListener("change",a),()=>{i==null||i.removeEventListener("change",a)}},[e]),t!==null?t:(n=mp())!=null&&n.matches?"dark":"light"}const _p=typeof document<"u"?document:null;function Vt(e=null,t={target:_p,actInsideInputWithModifier:!0}){const[r,n]=j.useState(!1),i=j.useRef(!1),a=j.useRef(new Set([])),[o,s]=j.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(l=>typeof l=="string").map(l=>l.replace("+",`
|
|
18
|
-
`).replace(`
|
|
19
|
-
|
|
20
|
-
`,`
|
|
21
|
-
+`).split(`
|
|
22
|
-
`)),f=c.reduce((l,d)=>l.concat(...d),[]);return[c,f]}return[[],[]]},[e]);return j.useEffect(()=>{const u=(t==null?void 0:t.target)??_p,c=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const f=h=>{var v,y;if(i.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!i.current||i.current&&!c)&&Hy(h))return!1;const m=wp(h.code,s);if(a.current.add(h[m]),bp(o,a.current,!1)){const b=((y=(v=h.composedPath)==null?void 0:v.call(h))==null?void 0:y[0])||h.target,p=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";t.preventDefault!==!1&&(i.current||!p)&&h.preventDefault(),n(!0)}},l=h=>{const g=wp(h.code,s);bp(o,a.current,!0)?(n(!1),a.current.clear()):a.current.delete(h[g]),h.key==="Meta"&&a.current.clear(),i.current=!1},d=()=>{a.current.clear(),n(!1)};return u==null||u.addEventListener("keydown",f),u==null||u.addEventListener("keyup",l),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{u==null||u.removeEventListener("keydown",f),u==null||u.removeEventListener("keyup",l),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,n]),r}function bp(e,t,r){return e.filter(n=>r||n.length===t.size).some(n=>n.every(i=>t.has(i)))}function wp(e,t){return t.includes(e)?"code":"key"}const hq=()=>{const e=ae();return j.useMemo(()=>({zoomIn:t=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,r)=>{const{panZoom:n}=e.getState();return n?n.scaleTo(t,{duration:r==null?void 0:r.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,r)=>{const{transform:[n,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??n,y:t.y??i,zoom:t.zoom??a},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,r,n]=e.getState().transform;return{x:t,y:r,zoom:n}},setCenter:async(t,r,n)=>e.getState().setCenter(t,r,n),fitBounds:async(t,r)=>{const{width:n,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),u=Ic(t,n,i,a,o,(r==null?void 0:r.padding)??.1);return s?(await s.setViewport(u,{duration:r==null?void 0:r.duration,ease:r==null?void 0:r.ease,interpolate:r==null?void 0:r.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,r={})=>{const{transform:n,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;const{x:s,y:u}=o.getBoundingClientRect(),c={x:t.x-s,y:t.y-u},f=r.snapGrid??i,l=r.snapToGrid??a;return tr(c,n,l,f)},flowToScreenPosition:t=>{const{transform:r,domNode:n}=e.getState();if(!n)return t;const{x:i,y:a}=n.getBoundingClientRect(),o=Ar(t,r);return{x:o.x+i,y:o.y+a}}}),[])};function lm(e,t){const r=[],n=new Map,i=[];for(const a of e)if(a.type==="add"){i.push(a);continue}else if(a.type==="remove"||a.type==="replace")n.set(a.id,[a]);else{const o=n.get(a.id);o?o.push(a):n.set(a.id,[a])}for(const a of t){const o=n.get(a.id);if(!o){r.push(a);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){r.push({...o[0].item});continue}const s={...a};for(const u of o)pq(u,s);r.push(s)}return i.length&&i.forEach(a=>{a.index!==void 0?r.splice(a.index,0,{...a.item}):r.push({...a.item})}),r}function pq(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 gq(e,t){return lm(e,t)}function vq(e,t){return lm(e,t)}function Ze(e,t){return{id:e,type:"select",selected:t}}function dt(e,t=new Set,r=!1){const n=[];for(const[i,a]of e){const o=t.has(i);!(a.selected===void 0&&!o)&&a.selected!==o&&(r&&(a.selected=o),n.push(Ze(a.id,o)))}return n}function xp({items:e=[],lookup:t}){var i;const r=[],n=new Map(e.map(a=>[a.id,a]));for(const[a,o]of e.entries()){const s=t.get(o.id),u=((i=s==null?void 0:s.internals)==null?void 0:i.userNode)??s;u!==void 0&&u!==o&&r.push({id:o.id,item:o,type:"replace"}),u===void 0&&r.push({item:o,type:"add",index:a})}for(const[a]of t)n.get(a)===void 0&&r.push({id:a,type:"remove"});return r}function Ep(e){return{id:e.id,type:"remove"}}const Sp=e=>FE(e),yq=e=>Oy(e);function dm(e){return j.forwardRef(e)}const mq=typeof window<"u"?j.useLayoutEffect:j.useEffect;function qp(e){const[t,r]=j.useState(BigInt(0)),[n]=j.useState(()=>_q(()=>r(i=>i+BigInt(1))));return mq(()=>{const i=n.get();i.length&&(e(i),n.reset())},[t]),n}function _q(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:r=>{t.push(r),e()}}}const hm=j.createContext(null);function bq({children:e}){const t=ae(),r=j.useCallback(s=>{const{nodes:u=[],setNodes:c,hasDefaultNodes:f,onNodesChange:l,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let m=u;for(const y of s)m=typeof y=="function"?y(m):y;let v=xp({items:m,lookup:d});for(const y of g.values())v=y(v);f&&c(m),v.length>0?l==null||l(v):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:b,setNodes:p}=t.getState();y&&p(b)})},[]),n=qp(r),i=j.useCallback(s=>{const{edges:u=[],setEdges:c,hasDefaultEdges:f,onEdgesChange:l,edgeLookup:d}=t.getState();let h=u;for(const g of s)h=typeof g=="function"?g(h):g;f?c(h):l&&l(xp({items:h,lookup:d}))},[]),a=qp(i),o=j.useMemo(()=>({nodeQueue:n,edgeQueue:a}),[]);return $.jsx(hm.Provider,{value:o,children:e})}function wq(){const e=j.useContext(hm);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const xq=e=>!!e.panZoom;function kc(){const e=hq(),t=ae(),r=wq(),n=ne(xq),i=j.useMemo(()=>{const a=l=>t.getState().nodeLookup.get(l),o=l=>{r.nodeQueue.push(l)},s=l=>{r.edgeQueue.push(l)},u=l=>{var y,b;const{nodeLookup:d,nodeOrigin:h}=t.getState(),g=Sp(l)?l:d.get(l.id),m=g.parentId?zy(g.position,g.measured,g.parentId,d,h):g.position,v={...g,position:m,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((b=g.measured)==null?void 0:b.height)??g.height};return bt(v)},c=(l,d,h={replace:!1})=>{o(g=>g.map(m=>{if(m.id===l){const v=typeof d=="function"?d(m):d;return h.replace&&Sp(v)?v:{...m,...v}}return m}))},f=(l,d,h={replace:!1})=>{s(g=>g.map(m=>{if(m.id===l){const v=typeof d=="function"?d(m):d;return h.replace&&yq(v)?v:{...m,...v}}return m}))};return{getNodes:()=>t.getState().nodes.map(l=>({...l})),getNode:l=>{var d;return(d=a(l))==null?void 0:d.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:l=[]}=t.getState();return l.map(d=>({...d}))},getEdge:l=>t.getState().edgeLookup.get(l),setNodes:o,setEdges:s,addNodes:l=>{const d=Array.isArray(l)?l:[l];r.nodeQueue.push(h=>[...h,...d])},addEdges:l=>{const d=Array.isArray(l)?l:[l];r.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:l=[],edges:d=[],transform:h}=t.getState(),[g,m,v]=h;return{nodes:l.map(y=>({...y})),edges:d.map(y=>({...y})),viewport:{x:g,y:m,zoom:v}}},deleteElements:async({nodes:l=[],edges:d=[]})=>{const{nodes:h,edges:g,onNodesDelete:m,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:b,onDelete:p,onBeforeDelete:_}=t.getState(),{nodes:w,edges:x}=await HE({nodesToRemove:l,edgesToRemove:d,nodes:h,edges:g,onBeforeDelete:_}),E=x.length>0,I=w.length>0;if(E){const C=x.map(Ep);v==null||v(x),b(C)}if(I){const C=w.map(Ep);m==null||m(w),y(C)}return(I||E)&&(p==null||p({nodes:w,edges:x})),{deletedNodes:w,deletedEdges:x}},getIntersectingNodes:(l,d=!0,h)=>{const g=Kh(l),m=g?l:u(l),v=h!==void 0;return m?(h||t.getState().nodes).filter(y=>{const b=t.getState().nodeLookup.get(y.id);if(b&&!g&&(y.id===l.id||!b.internals.positionAbsolute))return!1;const p=bt(v?y:b),_=Bt(p,m);return d&&_>0||_>=p.width*p.height||_>=m.width*m.height}):[]},isNodeIntersecting:(l,d,h=!0)=>{const m=Kh(l)?l:u(l);if(!m)return!1;const v=Bt(m,d);return h&&v>0||v>=d.width*d.height||v>=m.width*m.height},updateNode:c,updateNodeData:(l,d,h={replace:!1})=>{c(l,g=>{const m=typeof d=="function"?d(g):d;return h.replace?{...g,data:m}:{...g,data:{...g.data,...m}}},h)},updateEdge:f,updateEdgeData:(l,d,h={replace:!1})=>{f(l,g=>{const m=typeof d=="function"?d(g):d;return h.replace?{...g,data:m}:{...g,data:{...g.data,...m}}},h)},getNodesBounds:l=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return $E(l,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:l,id:d,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${l}${d?`-${d}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:l,handleId:d,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${l?d?`-${l}-${d}`:`-${l}`:""}`))==null?void 0:g.values())??[])},fitView:async l=>{const d=t.getState().fitViewResolver??YE();return t.setState({fitViewQueued:!0,fitViewOptions:l,fitViewResolver:d}),r.nodeQueue.push(h=>[...h]),d.promise}}},[]);return j.useMemo(()=>({...i,...e,viewportInitialized:n}),[n])}const Cp=e=>e.selected,Eq=typeof window<"u"?window:void 0;function Sq({deleteKeyCode:e,multiSelectionKeyCode:t}){const r=ae(),{deleteElements:n}=kc(),i=Vt(e,{actInsideInputWithModifier:!1}),a=Vt(t,{target:Eq});j.useEffect(()=>{if(i){const{edges:o,nodes:s}=r.getState();n({nodes:s.filter(Cp),edges:o.filter(Cp)}),r.setState({nodesSelectionActive:!1})}},[i]),j.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])}function qq(e){const t=ae();j.useEffect(()=>{const r=()=>{var i,a,o,s;if(!e.current||!(((a=(i=e.current).checkVisibility)==null?void 0:a.call(i))??!0))return!1;const n=Rc(e.current);(n.height===0||n.width===0)&&((s=(o=t.getState()).onError)==null||s.call(o,"004",Ne.error004())),t.setState({width:n.width||500,height:n.height||500})};if(e.current){r(),window.addEventListener("resize",r);const n=new ResizeObserver(()=>r());return n.observe(e.current),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}}},[])}const sn={position:"absolute",width:"100%",height:"100%",top:0,left:0},Cq=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Iq({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:r=!0,panOnScroll:n=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=et.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:u,translateExtent:c,minZoom:f,maxZoom:l,zoomActivationKeyCode:d,preventScrolling:h=!0,children:g,noWheelClassName:m,noPanClassName:v,onViewportChange:y,isControlledViewport:b,paneClickDistance:p,selectionOnDrag:_}){const w=ae(),x=j.useRef(null),{userSelectionActive:E,lib:I,connectionInProgress:C}=ne(Cq,ie),M=Vt(d),q=j.useRef();qq(x);const R=j.useCallback(O=>{y==null||y({x:O[0],y:O[1],zoom:O[2]}),b||w.setState({transform:O})},[y,b]);return j.useEffect(()=>{if(x.current){q.current=NS({domNode:x.current,minZoom:f,maxZoom:l,translateExtent:c,viewport:u,onDraggingChange:N=>w.setState({paneDragging:N}),onPanZoomStart:(N,D)=>{const{onViewportChangeStart:k,onMoveStart:P}=w.getState();P==null||P(N,D),k==null||k(D)},onPanZoom:(N,D)=>{const{onViewportChange:k,onMove:P}=w.getState();P==null||P(N,D),k==null||k(D)},onPanZoomEnd:(N,D)=>{const{onViewportChangeEnd:k,onMoveEnd:P}=w.getState();P==null||P(N,D),k==null||k(D)}});const{x:O,y:S,zoom:T}=q.current.getViewport();return w.setState({panZoom:q.current,transform:[O,S,T],domNode:x.current.closest(".react-flow")}),()=>{var N;(N=q.current)==null||N.destroy()}}},[]),j.useEffect(()=>{var O;(O=q.current)==null||O.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:r,panOnScroll:n,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:M,preventScrolling:h,noPanClassName:v,userSelectionActive:E,noWheelClassName:m,lib:I,onTransformChange:R,connectionInProgress:C,selectionOnDrag:_,paneClickDistance:p})},[e,t,r,n,i,a,o,s,M,h,v,E,m,I,R,C,_,p]),$.jsx("div",{className:"react-flow__renderer",ref:x,style:sn,children:g})}const Rq=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Aq(){const{userSelectionActive:e,userSelectionRect:t}=ne(Rq,ie);return e&&t?$.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 as=(e,t)=>r=>{r.target===t.current&&(e==null||e(r))},Nq=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Mq({isSelecting:e,selectionKeyPressed:t,selectionMode:r=zt.Full,panOnDrag:n,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:s,onPaneClick:u,onPaneContextMenu:c,onPaneScroll:f,onPaneMouseEnter:l,onPaneMouseMove:d,onPaneMouseLeave:h,children:g}){const m=ae(),{userSelectionActive:v,elementsSelectable:y,dragging:b,connectionInProgress:p}=ne(Nq,ie),_=y&&(e||v),w=j.useRef(null),x=j.useRef(),E=j.useRef(new Set),I=j.useRef(new Set),C=j.useRef(!1),M=k=>{if(C.current||p){C.current=!1;return}u==null||u(k),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},q=k=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){k.preventDefault();return}c==null||c(k)},R=f?k=>f(k):void 0,O=k=>{C.current&&(k.stopPropagation(),C.current=!1)},S=k=>{var L,F;const{domNode:P}=m.getState();if(x.current=P==null?void 0:P.getBoundingClientRect(),!x.current)return;const H=k.target===w.current;if(!H&&!!k.target.closest(".nokey")||!e||!(a&&H||t)||k.button!==0||!k.isPrimary)return;(F=(L=k.target)==null?void 0:L.setPointerCapture)==null||F.call(L,k.pointerId),C.current=!1;const{x:Y,y:A}=xe(k.nativeEvent,x.current);m.setState({userSelectionRect:{width:0,height:0,startX:Y,startY:A,x:Y,y:A}}),H||(k.stopPropagation(),k.preventDefault())},T=k=>{const{userSelectionRect:P,transform:H,nodeLookup:G,edgeLookup:V,connectionLookup:Y,triggerNodeChanges:A,triggerEdgeChanges:L,defaultEdgeOptions:F,resetSelectedElements:z}=m.getState();if(!x.current||!P)return;const{x:B,y:U}=xe(k.nativeEvent,x.current),{startX:X,startY:K}=P;if(!C.current){const re=t?0:i;if(Math.hypot(B-X,U-K)<=re)return;z(),o==null||o(k)}C.current=!0;const J={startX:X,startY:K,x:B<X?B:X,y:U<K?U:K,width:Math.abs(B-X),height:Math.abs(U-K)},W=E.current,te=I.current;E.current=new Set(Cc(G,J,H,r===zt.Partial,!0).map(re=>re.id)),I.current=new Set;const Z=(F==null?void 0:F.selectable)??!0;for(const re of E.current){const ee=Y.get(re);if(ee)for(const{edgeId:le}of ee.values()){const fe=V.get(le);fe&&(fe.selectable??Z)&&I.current.add(le)}}if(!Zh(W,E.current)){const re=dt(G,E.current,!0);A(re)}if(!Zh(te,I.current)){const re=dt(V,I.current);L(re)}m.setState({userSelectionRect:J,userSelectionActive:!0,nodesSelectionActive:!1})},N=k=>{var P,H;k.button===0&&((H=(P=k.target)==null?void 0:P.releasePointerCapture)==null||H.call(P,k.pointerId),!v&&k.target===w.current&&m.getState().userSelectionRect&&(M==null||M(k)),m.setState({userSelectionActive:!1,userSelectionRect:null}),C.current&&(s==null||s(k),m.setState({nodesSelectionActive:E.current.size>0})))},D=n===!0||Array.isArray(n)&&n.includes(0);return $.jsxs("div",{className:ce(["react-flow__pane",{draggable:D,dragging:b,selection:e}]),onClick:_?void 0:as(M,w),onContextMenu:as(q,w),onWheel:as(R,w),onPointerEnter:_?void 0:l,onPointerMove:_?T:d,onPointerUp:_?N:void 0,onPointerDownCapture:_?S:void 0,onClickCapture:_?O:void 0,onPointerLeave:h,ref:w,style:sn,children:[g,$.jsx(Aq,{})]})}function tc({id:e,store:t,unselect:r=!1,nodeRef:n}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:u}=t.getState(),c=s.get(e);if(!c){u==null||u("012",Ne.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(r||c.selected&&o)&&(a({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var f;return(f=n==null?void 0:n.current)==null?void 0:f.blur()})):i([e])}function pm({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:n,nodeId:i,isSelectable:a,nodeClickDistance:o}){const s=ae(),[u,c]=j.useState(!1),f=j.useRef();return j.useEffect(()=>{f.current=vS({getStoreItems:()=>s.getState(),onNodeMouseDown:l=>{tc({id:l,store:s,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),j.useEffect(()=>{var l,d;if(t)(l=f.current)==null||l.destroy();else if(e.current)return(d=f.current)==null||d.update({noDragClassName:r,handleSelector:n,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{var h;(h=f.current)==null||h.destroy()}},[r,n,t,a,e,i]),u}const Tq=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function gm(){const e=ae();return j.useCallback(r=>{const{nodeExtent:n,snapToGrid:i,snapGrid:a,nodesDraggable:o,onError:s,updateNodePositions:u,nodeLookup:c,nodeOrigin:f}=e.getState(),l=new Map,d=Tq(o),h=i?a[0]:5,g=i?a[1]:5,m=r.direction.x*h*r.factor,v=r.direction.y*g*r.factor;for(const[,y]of c){if(!d(y))continue;let b={x:y.internals.positionAbsolute.x+m,y:y.internals.positionAbsolute.y+v};i&&(b=er(b,a));const{position:p,positionAbsolute:_}=Ly({nodeId:y.id,nextPosition:b,nodeLookup:c,nodeExtent:n,nodeOrigin:f,onError:s});y.position=p,y.internals.positionAbsolute=_,l.set(y.id,y)}u(l)},[])}const Oc=j.createContext(null),Pq=Oc.Provider;Oc.Consumer;const vm=()=>j.useContext(Oc),kq=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Oq=(e,t,r)=>n=>{const{connectionClickStartHandle:i,connectionMode:a,connection:o}=n,{fromHandle:s,toHandle:u,isValid:c}=o,f=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===r;return{connectingFrom:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===r,connectingTo:f,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===r,isPossibleEndHandle:a===mt.Strict?(s==null?void 0:s.type)!==r:e!==(s==null?void 0:s.nodeId)||t!==(s==null?void 0:s.id),connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:f&&c}};function Lq({type:e="source",position:t=Q.Top,isValidConnection:r,isConnectable:n=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:u,className:c,onMouseDown:f,onTouchStart:l,...d},h){var T,N;const g=o||null,m=e==="target",v=ae(),y=vm(),{connectOnClick:b,noPanClassName:p,rfId:_}=ne(kq,ie),{connectingFrom:w,connectingTo:x,clickConnecting:E,isPossibleEndHandle:I,connectionInProcess:C,clickConnectionInProcess:M,valid:q}=ne(Oq(y,g,e),ie);y||(N=(T=v.getState()).onError)==null||N.call(T,"010",Ne.error010());const R=D=>{const{defaultEdgeOptions:k,onConnect:P,hasDefaultEdges:H}=v.getState(),G={...k,...D};if(H){const{edges:V,setEdges:Y}=v.getState();Y(eS(G,V))}P==null||P(G),s==null||s(G)},O=D=>{if(!y)return;const k=Vy(D.nativeEvent);if(i&&(k&&D.button===0||!k)){const P=v.getState();ec.onPointerDown(D.nativeEvent,{handleDomNode:D.currentTarget,autoPanOnConnect:P.autoPanOnConnect,connectionMode:P.connectionMode,connectionRadius:P.connectionRadius,domNode:P.domNode,nodeLookup:P.nodeLookup,lib:P.lib,isTarget:m,handleId:g,nodeId:y,flowId:P.rfId,panBy:P.panBy,cancelConnection:P.cancelConnection,onConnectStart:P.onConnectStart,onConnectEnd:P.onConnectEnd,updateConnection:P.updateConnection,onConnect:R,isValidConnection:r||P.isValidConnection,getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:P.autoPanSpeed,dragThreshold:P.connectionDragThreshold})}k?f==null||f(D):l==null||l(D)},S=D=>{const{onClickConnectStart:k,onClickConnectEnd:P,connectionClickStartHandle:H,connectionMode:G,isValidConnection:V,lib:Y,rfId:A,nodeLookup:L,connection:F}=v.getState();if(!y||!H&&!i)return;if(!H){k==null||k(D.nativeEvent,{nodeId:y,handleId:g,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const z=By(D.target),B=r||V,{connection:U,isValid:X}=ec.isValid(D.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:G,fromNodeId:H.nodeId,fromHandleId:H.id||null,fromType:H.type,isValidConnection:B,flowId:A,doc:z,lib:Y,nodeLookup:L});X&&U&&R(U);const K=structuredClone(F);delete K.inProgress,K.toPosition=K.toHandle?K.toHandle.position:null,P==null||P(D,K),v.setState({connectionClickStartHandle:null})};return $.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${_}-${y}-${g}-${e}`,className:ce(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,c,{source:!m,target:m,connectable:n,connectablestart:i,connectableend:a,clickconnecting:E,connectingfrom:w,connectingto:x,valid:q,connectionindicator:n&&(!C||I)&&(C||M?a:i)}]),onMouseDown:O,onTouchStart:O,onClick:b?S:void 0,ref:h,...d,children:u})}const Nr=j.memo(dm(Lq));function Dq({data:e,isConnectable:t,sourcePosition:r=Q.Bottom}){return $.jsxs($.Fragment,{children:[e==null?void 0:e.label,$.jsx(Nr,{type:"source",position:r,isConnectable:t})]})}function Fq({data:e,isConnectable:t,targetPosition:r=Q.Top,sourcePosition:n=Q.Bottom}){return $.jsxs($.Fragment,{children:[$.jsx(Nr,{type:"target",position:r,isConnectable:t}),e==null?void 0:e.label,$.jsx(Nr,{type:"source",position:n,isConnectable:t})]})}function $q(){return null}function jq({data:e,isConnectable:t,targetPosition:r=Q.Top}){return $.jsxs($.Fragment,{children:[$.jsx(Nr,{type:"target",position:r,isConnectable:t}),e==null?void 0:e.label]})}const Mr={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ip={input:Dq,default:Fq,output:jq,group:$q};function zq(e){var t,r,n,i;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((r=e.style)==null?void 0:r.height)}:{width:e.width??((n=e.style)==null?void 0:n.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const Bq=e=>{const{width:t,height:r,x:n,y:i}=Jt(e.nodeLookup,{filter:a=>!!a.selected});return{width:we(t)?t:null,height:we(r)?r:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${n}px,${i}px)`}};function Hq({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const n=ae(),{width:i,height:a,transformString:o,userSelectionActive:s}=ne(Bq,ie),u=gm(),c=j.useRef(null);if(j.useEffect(()=>{var d;r||(d=c.current)==null||d.focus({preventScroll:!0})},[r]),pm({nodeRef:c}),s||!i||!a)return null;const f=e?d=>{const h=n.getState().nodes.filter(g=>g.selected);e(d,h)}:void 0,l=d=>{Object.prototype.hasOwnProperty.call(Mr,d.key)&&(d.preventDefault(),u({direction:Mr[d.key],factor:d.shiftKey?4:1}))};return $.jsx("div",{className:ce(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:$.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:r?void 0:-1,onKeyDown:r?void 0:l,style:{width:i,height:a}})})}const Rp=typeof window<"u"?window:void 0,Vq=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function ym({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:u,selectionKeyCode:c,selectionOnDrag:f,selectionMode:l,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:m,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:_,panOnScrollSpeed:w,panOnScrollMode:x,zoomOnDoubleClick:E,panOnDrag:I,defaultViewport:C,translateExtent:M,minZoom:q,maxZoom:R,preventScrolling:O,onSelectionContextMenu:S,noWheelClassName:T,noPanClassName:N,disableKeyboardA11y:D,onViewportChange:k,isControlledViewport:P}){const{nodesSelectionActive:H,userSelectionActive:G}=ne(Vq,ie),V=Vt(c,{target:Rp}),Y=Vt(m,{target:Rp}),A=Y||I,L=Y||_,F=f&&A!==!0,z=V||G||F;return Sq({deleteKeyCode:u,multiSelectionKeyCode:g}),$.jsx(Iq,{onPaneContextMenu:a,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:L,panOnScrollSpeed:w,panOnScrollMode:x,zoomOnDoubleClick:E,panOnDrag:!V&&A,defaultViewport:C,translateExtent:M,minZoom:q,maxZoom:R,zoomActivationKeyCode:v,preventScrolling:O,noWheelClassName:T,noPanClassName:N,onViewportChange:k,isControlledViewport:P,paneClickDistance:s,selectionOnDrag:F,children:$.jsxs(Mq,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:A,isSelecting:!!z,selectionMode:l,selectionKeyPressed:V,paneClickDistance:s,selectionOnDrag:F,children:[e,H&&$.jsx(Hq,{onSelectionContextMenu:S,noPanClassName:N,disableKeyboardA11y:D})]})})}ym.displayName="FlowRenderer";const Gq=j.memo(ym),Uq=e=>t=>e?Cc(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(r=>r.id):Array.from(t.nodeLookup.keys());function Yq(e){return ne(j.useCallback(Uq(e),[e]),ie)}const Wq=e=>e.updateNodeInternals;function Xq(){const e=ne(Wq),[t]=j.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const n=new Map;r.forEach(i=>{const a=i.target.getAttribute("data-id");n.set(a,{id:a,nodeElement:i.target,force:!0})}),e(n)}));return j.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Kq({node:e,nodeType:t,hasDimensions:r,resizeObserver:n}){const i=ae(),a=j.useRef(null),o=j.useRef(null),s=j.useRef(e.sourcePosition),u=j.useRef(e.targetPosition),c=j.useRef(t),f=r&&!!e.internals.handleBounds;return j.useEffect(()=>{a.current&&!e.hidden&&(!f||o.current!==a.current)&&(o.current&&(n==null||n.unobserve(o.current)),n==null||n.observe(a.current),o.current=a.current)},[f,e.hidden]),j.useEffect(()=>()=>{o.current&&(n==null||n.unobserve(o.current),o.current=null)},[]),j.useEffect(()=>{if(a.current){const l=c.current!==t,d=s.current!==e.sourcePosition,h=u.current!==e.targetPosition;(l||d||h)&&(c.current=t,s.current=e.sourcePosition,u.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Zq({id:e,onClick:t,onMouseEnter:r,onMouseMove:n,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:u,nodesConnectable:c,nodesFocusable:f,resizeObserver:l,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:g,rfId:m,nodeTypes:v,nodeClickDistance:y,onError:b}){const{node:p,internals:_,isParent:w}=ne(B=>{const U=B.nodeLookup.get(e),X=B.parentLookup.has(e);return{node:U,internals:U.internals,isParent:X}},ie);let x=p.type||"default",E=(v==null?void 0:v[x])||Ip[x];E===void 0&&(b==null||b("003",Ne.error003(x)),x="default",E=(v==null?void 0:v.default)||Ip.default);const I=!!(p.draggable||s&&typeof p.draggable>"u"),C=!!(p.selectable||u&&typeof p.selectable>"u"),M=!!(p.connectable||c&&typeof p.connectable>"u"),q=!!(p.focusable||f&&typeof p.focusable>"u"),R=ae(),O=jy(p),S=Kq({node:p,nodeType:x,hasDimensions:O,resizeObserver:l}),T=pm({nodeRef:S,disabled:p.hidden||!I,noDragClassName:d,handleSelector:p.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:y}),N=gm();if(p.hidden)return null;const D=Be(p),k=zq(p),P=C||I||t||r||n||i,H=r?B=>r(B,{..._.userNode}):void 0,G=n?B=>n(B,{..._.userNode}):void 0,V=i?B=>i(B,{..._.userNode}):void 0,Y=a?B=>a(B,{..._.userNode}):void 0,A=o?B=>o(B,{..._.userNode}):void 0,L=B=>{const{selectNodesOnDrag:U,nodeDragThreshold:X}=R.getState();C&&(!U||!I||X>0)&&tc({id:e,store:R,nodeRef:S}),t&&t(B,{..._.userNode})},F=B=>{if(!(Hy(B.nativeEvent)||g)){if(My.includes(B.key)&&C){const U=B.key==="Escape";tc({id:e,store:R,unselect:U,nodeRef:S})}else if(I&&p.selected&&Object.prototype.hasOwnProperty.call(Mr,B.key)){B.preventDefault();const{ariaLabelConfig:U}=R.getState();R.setState({ariaLiveMessage:U["node.a11yDescription.ariaLiveMessage"]({direction:B.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),N({direction:Mr[B.key],factor:B.shiftKey?4:1})}}},z=()=>{var te;if(g||!((te=S.current)!=null&&te.matches(":focus-visible")))return;const{transform:B,width:U,height:X,autoPanOnNodeFocus:K,setCenter:J}=R.getState();if(!K)return;Cc(new Map([[e,p]]),{x:0,y:0,width:U,height:X},B,!0).length>0||J(p.position.x+D.width/2,p.position.y+D.height/2,{zoom:B[2]})};return $.jsx("div",{className:ce(["react-flow__node",`react-flow__node-${x}`,{[h]:I},p.className,{selected:p.selected,selectable:C,parent:w,draggable:I,dragging:T}]),ref:S,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:P?"all":"none",visibility:O?"visible":"hidden",...p.style,...k},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:H,onMouseMove:G,onMouseLeave:V,onContextMenu:Y,onClick:L,onDoubleClick:A,onKeyDown:q?F:void 0,tabIndex:q?0:void 0,onFocus:q?z:void 0,role:p.ariaRole??(q?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${um}-${m}`,"aria-label":p.ariaLabel,...p.domAttributes,children:$.jsx(Pq,{value:e,children:$.jsx(E,{id:e,data:p.data,type:x,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:p.selected??!1,selectable:C,draggable:I,deletable:p.deletable??!0,isConnectable:M,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:T,dragHandle:p.dragHandle,zIndex:_.z,parentId:p.parentId,...D})})})}var Qq=j.memo(Zq);const Jq=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function mm(e){const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:n,elementsSelectable:i,onError:a}=ne(Jq,ie),o=Yq(e.onlyRenderVisibleElements),s=Xq();return $.jsx("div",{className:"react-flow__nodes",style:sn,children:o.map(u=>$.jsx(Qq,{id:u,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:s,nodesDraggable:t,nodesConnectable:r,nodesFocusable:n,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},u))})}mm.displayName="NodeRenderer";const eC=j.memo(mm);function tC(e){return ne(j.useCallback(r=>{if(!e)return r.edges.map(i=>i.id);const n=[];if(r.width&&r.height)for(const i of r.edges){const a=r.nodeLookup.get(i.source),o=r.nodeLookup.get(i.target);a&&o&&ZE({sourceNode:a,targetNode:o,width:r.width,height:r.height,transform:r.transform})&&n.push(i.id)}return n},[e]),ie)}const rC=({color:e="none",strokeWidth:t=1})=>{const r={strokeWidth:t,...e&&{stroke:e}};return $.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},nC=({color:e="none",strokeWidth:t=1})=>{const r={strokeWidth:t,...e&&{stroke:e,fill:e}};return $.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ap={[Ir.Arrow]:rC,[Ir.ArrowClosed]:nC};function iC(e){const t=ae();return j.useMemo(()=>{var i,a;return Object.prototype.hasOwnProperty.call(Ap,e)?Ap[e]:((a=(i=t.getState()).onError)==null||a.call(i,"009",Ne.error009(e)),null)},[e])}const aC=({id:e,type:t,color:r,width:n=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:o,orient:s="auto-start-reverse"})=>{const u=iC(t);return u?$.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${n}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:s,refX:"0",refY:"0",children:$.jsx(u,{color:r,strokeWidth:o})}):null},_m=({defaultColor:e,rfId:t})=>{const r=ne(a=>a.edges),n=ne(a=>a.defaultEdgeOptions),i=j.useMemo(()=>aS(r,{id:t,defaultColor:e,defaultMarkerStart:n==null?void 0:n.markerStart,defaultMarkerEnd:n==null?void 0:n.markerEnd}),[r,n,t,e]);return i.length?$.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:$.jsx("defs",{children:i.map(a=>$.jsx(aC,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};_m.displayName="MarkerDefinitions";var oC=j.memo(_m);function bm({x:e,y:t,label:r,labelStyle:n,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:u,className:c,...f}){const[l,d]=j.useState({x:1,y:0,width:0,height:0}),h=ce(["react-flow__edge-textwrapper",c]),g=j.useRef(null);return j.useEffect(()=>{if(g.current){const m=g.current.getBBox();d({x:m.x,y:m.y,width:m.width,height:m.height})}},[r]),r?$.jsxs("g",{transform:`translate(${e-l.width/2} ${t-l.height/2})`,className:h,visibility:l.width?"visible":"hidden",...f,children:[i&&$.jsx("rect",{width:l.width+2*o[0],x:-o[0],y:-o[1],height:l.height+2*o[1],className:"react-flow__edge-textbg",style:a,rx:s,ry:s}),$.jsx("text",{className:"react-flow__edge-text",y:l.height/2,dy:"0.3em",ref:g,style:n,children:r}),u]}):null}bm.displayName="EdgeText";const sC=j.memo(bm);function un({path:e,labelX:t,labelY:r,label:n,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:u,interactionWidth:c=20,...f}){return $.jsxs($.Fragment,{children:[$.jsx("path",{...f,d:e,fill:"none",className:ce(["react-flow__edge-path",f.className])}),c?$.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,n&&we(t)&&we(r)?$.jsx(sC,{x:t,y:r,label:n,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:u}):null]})}function Np({pos:e,x1:t,y1:r,x2:n,y2:i}){return e===Q.Left||e===Q.Right?[.5*(t+n),r]:[t,.5*(r+i)]}function wm({sourceX:e,sourceY:t,sourcePosition:r=Q.Bottom,targetX:n,targetY:i,targetPosition:a=Q.Top}){const[o,s]=Np({pos:r,x1:e,y1:t,x2:n,y2:i}),[u,c]=Np({pos:a,x1:n,y1:i,x2:e,y2:t}),[f,l,d,h]=Gy({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:u,targetControlY:c});return[`M${e},${t} C${o},${s} ${u},${c} ${n},${i}`,f,l,d,h]}function xm(e){return j.memo(({id:t,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:v,interactionWidth:y})=>{const[b,p,_]=wm({sourceX:r,sourceY:n,sourcePosition:o,targetX:i,targetY:a,targetPosition:s}),w=e.isInternal?void 0:t;return $.jsx(un,{id:w,path:b,labelX:p,labelY:_,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:v,interactionWidth:y})})}const uC=xm({isInternal:!1}),Em=xm({isInternal:!0});uC.displayName="SimpleBezierEdge";Em.displayName="SimpleBezierEdgeInternal";function Sm(e){return j.memo(({id:t,sourceX:r,sourceY:n,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:l,style:d,sourcePosition:h=Q.Bottom,targetPosition:g=Q.Top,markerEnd:m,markerStart:v,pathOptions:y,interactionWidth:b})=>{const[p,_,w]=Zu({sourceX:r,sourceY:n,sourcePosition:h,targetX:i,targetY:a,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),x=e.isInternal?void 0:t;return $.jsx(un,{id:x,path:p,labelX:_,labelY:w,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:l,style:d,markerEnd:m,markerStart:v,interactionWidth:b})})}const qm=Sm({isInternal:!1}),Cm=Sm({isInternal:!0});qm.displayName="SmoothStepEdge";Cm.displayName="SmoothStepEdgeInternal";function Im(e){return j.memo(({id:t,...r})=>{var i;const n=e.isInternal?void 0:t;return $.jsx(qm,{...r,id:n,pathOptions:j.useMemo(()=>{var a;return{borderRadius:0,offset:(a=r.pathOptions)==null?void 0:a.offset}},[(i=r.pathOptions)==null?void 0:i.offset])})})}const cC=Im({isInternal:!1}),Rm=Im({isInternal:!0});cC.displayName="StepEdge";Rm.displayName="StepEdgeInternal";function Am(e){return j.memo(({id:t,sourceX:r,sourceY:n,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:l,style:d,markerEnd:h,markerStart:g,interactionWidth:m})=>{const[v,y,b]=Wy({sourceX:r,sourceY:n,targetX:i,targetY:a}),p=e.isInternal?void 0:t;return $.jsx(un,{id:p,path:v,labelX:y,labelY:b,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:l,style:d,markerEnd:h,markerStart:g,interactionWidth:m})})}const fC=Am({isInternal:!1}),Nm=Am({isInternal:!0});fC.displayName="StraightEdge";Nm.displayName="StraightEdgeInternal";function Mm(e){return j.memo(({id:t,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:o=Q.Bottom,targetPosition:s=Q.Top,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:v,pathOptions:y,interactionWidth:b})=>{const[p,_,w]=Uy({sourceX:r,sourceY:n,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:y==null?void 0:y.curvature}),x=e.isInternal?void 0:t;return $.jsx(un,{id:x,path:p,labelX:_,labelY:w,label:u,labelStyle:c,labelShowBg:f,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:h,style:g,markerEnd:m,markerStart:v,interactionWidth:b})})}const lC=Mm({isInternal:!1}),Tm=Mm({isInternal:!0});lC.displayName="BezierEdge";Tm.displayName="BezierEdgeInternal";const Mp={default:Tm,straight:Nm,step:Rm,smoothstep:Cm,simplebezier:Em},Tp={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},dC=(e,t,r)=>r===Q.Left?e-t:r===Q.Right?e+t:e,hC=(e,t,r)=>r===Q.Top?e-t:r===Q.Bottom?e+t:e,Pp="react-flow__edgeupdater";function kp({position:e,centerX:t,centerY:r,radius:n=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return $.jsx("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:ce([Pp,`${Pp}-${s}`]),cx:dC(t,n,e),cy:hC(r,n,e),r:n,stroke:"transparent",fill:"transparent"})}function pC({isReconnectable:e,reconnectRadius:t,edge:r,sourceX:n,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:u,onReconnect:c,onReconnectStart:f,onReconnectEnd:l,setReconnecting:d,setUpdateHover:h}){const g=ae(),m=(_,w)=>{if(_.button!==0)return;const{autoPanOnConnect:x,domNode:E,isValidConnection:I,connectionMode:C,connectionRadius:M,lib:q,onConnectStart:R,onConnectEnd:O,cancelConnection:S,nodeLookup:T,rfId:N,panBy:D,updateConnection:k}=g.getState(),P=w.type==="target",H=(Y,A)=>{d(!1),l==null||l(Y,r,w.type,A)},G=Y=>c==null?void 0:c(r,Y),V=(Y,A)=>{d(!0),f==null||f(_,r,w.type),R==null||R(Y,A)};ec.onPointerDown(_.nativeEvent,{autoPanOnConnect:x,connectionMode:C,connectionRadius:M,domNode:E,handleId:w.id,nodeId:w.nodeId,nodeLookup:T,isTarget:P,edgeUpdaterType:w.type,lib:q,flowId:N,cancelConnection:S,panBy:D,isValidConnection:I,onConnect:G,onConnectStart:V,onConnectEnd:O,onReconnectEnd:H,updateConnection:k,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},v=_=>m(_,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),y=_=>m(_,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),b=()=>h(!0),p=()=>h(!1);return $.jsxs($.Fragment,{children:[(e===!0||e==="source")&&$.jsx(kp,{position:s,centerX:n,centerY:i,radius:t,onMouseDown:v,onMouseEnter:b,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&$.jsx(kp,{position:u,centerX:a,centerY:o,radius:t,onMouseDown:y,onMouseEnter:b,onMouseOut:p,type:"target"})]})}function gC({id:e,edgesFocusable:t,edgesReconnectable:r,elementsSelectable:n,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:u,onMouseLeave:c,reconnectRadius:f,onReconnect:l,onReconnectStart:d,onReconnectEnd:h,rfId:g,edgeTypes:m,noPanClassName:v,onError:y,disableKeyboardA11y:b}){let p=ne(J=>J.edgeLookup.get(e));const _=ne(J=>J.defaultEdgeOptions);p=_?{..._,...p}:p;let w=p.type||"default",x=(m==null?void 0:m[w])||Mp[w];x===void 0&&(y==null||y("011",Ne.error011(w)),w="default",x=(m==null?void 0:m.default)||Mp.default);const E=!!(p.focusable||t&&typeof p.focusable>"u"),I=typeof l<"u"&&(p.reconnectable||r&&typeof p.reconnectable>"u"),C=!!(p.selectable||n&&typeof p.selectable>"u"),M=j.useRef(null),[q,R]=j.useState(!1),[O,S]=j.useState(!1),T=ae(),{zIndex:N,sourceX:D,sourceY:k,targetX:P,targetY:H,sourcePosition:G,targetPosition:V}=ne(j.useCallback(J=>{const W=J.nodeLookup.get(p.source),te=J.nodeLookup.get(p.target);if(!W||!te)return{zIndex:p.zIndex,...Tp};const Z=iS({id:e,sourceNode:W,targetNode:te,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:J.connectionMode,onError:y});return{zIndex:KE({selected:p.selected,zIndex:p.zIndex,sourceNode:W,targetNode:te,elevateOnSelect:J.elevateEdgesOnSelect,zIndexMode:J.zIndexMode}),...Z||Tp}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),ie),Y=j.useMemo(()=>p.markerStart?`url('#${Qu(p.markerStart,g)}')`:void 0,[p.markerStart,g]),A=j.useMemo(()=>p.markerEnd?`url('#${Qu(p.markerEnd,g)}')`:void 0,[p.markerEnd,g]);if(p.hidden||D===null||k===null||P===null||H===null)return null;const L=J=>{var re;const{addSelectedEdges:W,unselectNodesAndEdges:te,multiSelectionActive:Z}=T.getState();C&&(T.setState({nodesSelectionActive:!1}),p.selected&&Z?(te({nodes:[],edges:[p]}),(re=M.current)==null||re.blur()):W([e])),i&&i(J,p)},F=a?J=>{a(J,{...p})}:void 0,z=o?J=>{o(J,{...p})}:void 0,B=s?J=>{s(J,{...p})}:void 0,U=u?J=>{u(J,{...p})}:void 0,X=c?J=>{c(J,{...p})}:void 0,K=J=>{var W;if(!b&&My.includes(J.key)&&C){const{unselectNodesAndEdges:te,addSelectedEdges:Z}=T.getState();J.key==="Escape"?((W=M.current)==null||W.blur(),te({edges:[p]})):Z([e])}};return $.jsx("svg",{style:{zIndex:N},children:$.jsxs("g",{className:ce(["react-flow__edge",`react-flow__edge-${w}`,p.className,v,{selected:p.selected,animated:p.animated,inactive:!C&&!i,updating:q,selectable:C}]),onClick:L,onDoubleClick:F,onContextMenu:z,onMouseEnter:B,onMouseMove:U,onMouseLeave:X,onKeyDown:E?K:void 0,tabIndex:E?0:void 0,role:p.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":E?`${cm}-${g}`:void 0,ref:M,...p.domAttributes,children:[!O&&$.jsx(x,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:C,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:D,sourceY:k,targetX:P,targetY:H,sourcePosition:G,targetPosition:V,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:Y,markerEnd:A,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),I&&$.jsx(pC,{edge:p,isReconnectable:I,reconnectRadius:f,onReconnect:l,onReconnectStart:d,onReconnectEnd:h,sourceX:D,sourceY:k,targetX:P,targetY:H,sourcePosition:G,targetPosition:V,setUpdateHover:R,setReconnecting:S})]})})}var vC=j.memo(gC);const yC=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Pm({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:r,edgeTypes:n,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:f,reconnectRadius:l,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:m}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:b,onError:p}=ne(yC,ie),_=tC(t);return $.jsxs("div",{className:"react-flow__edges",children:[$.jsx(oC,{defaultColor:e,rfId:r}),_.map(w=>$.jsx(vC,{id:w,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:b,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:u,onMouseLeave:c,onClick:f,reconnectRadius:l,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:g,rfId:r,onError:p,edgeTypes:n,disableKeyboardA11y:m},w))]})}Pm.displayName="EdgeRenderer";const mC=j.memo(Pm),_C=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function bC({children:e}){const t=ne(_C);return $.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function wC(e){const t=kc(),r=j.useRef(!1);j.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const xC=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function EC(e){const t=ne(xC),r=ae();return j.useEffect(()=>{e&&(t==null||t(e),r.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function SC(e){return e.connection.inProgress?{...e.connection,to:tr(e.connection.to,e.transform)}:{...e.connection}}function qC(e){return SC}function CC(e){const t=qC();return ne(t,ie)}const IC=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function RC({containerStyle:e,style:t,type:r,component:n}){const{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:u}=ne(IC,ie);return!(a&&i&&u)?null:$.jsx("svg",{style:e,width:a,height:o,className:"react-flow__connectionline react-flow__container",children:$.jsx("g",{className:ce(["react-flow__connection",ky(s)]),children:$.jsx(km,{style:t,type:r,CustomComponent:n,isValid:s})})})}const km=({style:e,type:t=We.Bezier,CustomComponent:r,isValid:n})=>{const{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:u,to:c,toNode:f,toHandle:l,toPosition:d,pointer:h}=CC();if(!i)return;if(r)return $.jsx(r,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:c.x,toY:c.y,fromPosition:u,toPosition:d,connectionStatus:ky(n),toNode:f,toHandle:l,pointer:h});let g="";const m={sourceX:a.x,sourceY:a.y,sourcePosition:u,targetX:c.x,targetY:c.y,targetPosition:d};switch(t){case We.Bezier:[g]=Uy(m);break;case We.SimpleBezier:[g]=wm(m);break;case We.Step:[g]=Zu({...m,borderRadius:0});break;case We.SmoothStep:[g]=Zu(m);break;default:[g]=Wy(m)}return $.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};km.displayName="ConnectionLine";const AC={};function Op(e=AC){j.useRef(e),ae(),j.useEffect(()=>{},[e])}function NC(){ae(),j.useRef(!1),j.useEffect(()=>{},[])}function Om({nodeTypes:e,edgeTypes:t,onInit:r,onNodeClick:n,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:u,onNodeMouseLeave:c,onNodeContextMenu:f,onSelectionContextMenu:l,onSelectionStart:d,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:m,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:b,selectionOnDrag:p,selectionMode:_,multiSelectionKeyCode:w,panActivationKeyCode:x,zoomActivationKeyCode:E,deleteKeyCode:I,onlyRenderVisibleElements:C,elementsSelectable:M,defaultViewport:q,translateExtent:R,minZoom:O,maxZoom:S,preventScrolling:T,defaultMarkerColor:N,zoomOnScroll:D,zoomOnPinch:k,panOnScroll:P,panOnScrollSpeed:H,panOnScrollMode:G,zoomOnDoubleClick:V,panOnDrag:Y,onPaneClick:A,onPaneMouseEnter:L,onPaneMouseMove:F,onPaneMouseLeave:z,onPaneScroll:B,onPaneContextMenu:U,paneClickDistance:X,nodeClickDistance:K,onEdgeContextMenu:J,onEdgeMouseEnter:W,onEdgeMouseMove:te,onEdgeMouseLeave:Z,reconnectRadius:re,onReconnect:ee,onReconnectStart:le,onReconnectEnd:fe,noDragClassName:Pe,noWheelClassName:Ce,noPanClassName:de,disableKeyboardA11y:se,nodeExtent:He,rfId:ke,viewport:Ve,onViewportChange:Ge}){return Op(e),Op(t),NC(),wC(r),EC(Ve),$.jsx(Gq,{onPaneClick:A,onPaneMouseEnter:L,onPaneMouseMove:F,onPaneMouseLeave:z,onPaneContextMenu:U,onPaneScroll:B,paneClickDistance:X,deleteKeyCode:I,selectionKeyCode:b,selectionOnDrag:p,selectionMode:_,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:w,panActivationKeyCode:x,zoomActivationKeyCode:E,elementsSelectable:M,zoomOnScroll:D,zoomOnPinch:k,zoomOnDoubleClick:V,panOnScroll:P,panOnScrollSpeed:H,panOnScrollMode:G,panOnDrag:Y,defaultViewport:q,translateExtent:R,minZoom:O,maxZoom:S,onSelectionContextMenu:l,preventScrolling:T,noDragClassName:Pe,noWheelClassName:Ce,noPanClassName:de,disableKeyboardA11y:se,onViewportChange:Ge,isControlledViewport:!!Ve,children:$.jsxs(bC,{children:[$.jsx(mC,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:ee,onReconnectStart:le,onReconnectEnd:fe,onlyRenderVisibleElements:C,onEdgeContextMenu:J,onEdgeMouseEnter:W,onEdgeMouseMove:te,onEdgeMouseLeave:Z,reconnectRadius:re,defaultMarkerColor:N,noPanClassName:de,disableKeyboardA11y:se,rfId:ke}),$.jsx(RC,{style:m,type:g,component:v,containerStyle:y}),$.jsx("div",{className:"react-flow__edgelabel-renderer"}),$.jsx(eC,{nodeTypes:e,onNodeClick:n,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:u,onNodeMouseLeave:c,onNodeContextMenu:f,nodeClickDistance:K,onlyRenderVisibleElements:C,noPanClassName:de,noDragClassName:Pe,disableKeyboardA11y:se,nodeExtent:He,rfId:ke}),$.jsx("div",{className:"react-flow__viewport-portal"})]})})}Om.displayName="GraphView";const MC=j.memo(Om),Lp=({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:u=.5,maxZoom:c=2,nodeOrigin:f,nodeExtent:l,zIndexMode:d="basic"}={})=>{const h=new Map,g=new Map,m=new Map,v=new Map,y=n??t??[],b=r??e??[],p=f??[0,0],_=l??jt;Zy(m,v,y);const w=Ju(b,h,g,{nodeOrigin:p,nodeExtent:_,zIndexMode:d});let x=[0,0,1];if(o&&i&&a){const E=Jt(h,{filter:q=>!!((q.width||q.initialWidth)&&(q.height||q.initialHeight))}),{x:I,y:C,zoom:M}=Ic(E,i,a,u,c,(s==null?void 0:s.padding)??.1);x=[I,C,M]}return{rfId:"1",width:i??0,height:a??0,transform:x,nodes:b,nodesInitialized:w,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:v,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:n!==void 0,panZoom:null,minZoom:u,maxZoom:c,translateExtent:jt,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:mt.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,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:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...Py},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:VE,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Ty,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},TC=({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:u,maxZoom:c,nodeOrigin:f,nodeExtent:l,zIndexMode:d})=>WS((h,g)=>{async function m(){const{nodeLookup:v,panZoom:y,fitViewOptions:b,fitViewResolver:p,width:_,height:w,minZoom:x,maxZoom:E}=g();y&&(await BE({nodes:v,width:_,height:w,panZoom:y,minZoom:x,maxZoom:E},b),p==null||p.resolve(!0),h({fitViewResolver:null}))}return{...Lp({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:u,maxZoom:c,nodeOrigin:f,nodeExtent:l,defaultNodes:r,defaultEdges:n,zIndexMode:d}),setNodes:v=>{const{nodeLookup:y,parentLookup:b,nodeOrigin:p,elevateNodesOnSelect:_,fitViewQueued:w,zIndexMode:x}=g(),E=Ju(v,y,b,{nodeOrigin:p,nodeExtent:l,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:x});w&&E?(m(),h({nodes:v,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:v,nodesInitialized:E})},setEdges:v=>{const{connectionLookup:y,edgeLookup:b}=g();Zy(y,b,v),h({edges:v})},setDefaultNodesAndEdges:(v,y)=>{if(v){const{setNodes:b}=g();b(v),h({hasDefaultNodes:!0})}if(y){const{setEdges:b}=g();b(y),h({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:y,nodeLookup:b,parentLookup:p,domNode:_,nodeOrigin:w,nodeExtent:x,debug:E,fitViewQueued:I,zIndexMode:C}=g(),{changes:M,updatedInternals:q}=dS(v,b,p,_,w,x,C);q&&(uS(b,p,{nodeOrigin:w,nodeExtent:x,zIndexMode:C}),I?(m(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(M==null?void 0:M.length)>0&&(E&&console.log("React Flow: trigger node changes",M),y==null||y(M)))},updateNodePositions:(v,y=!1)=>{const b=[];let p=[];const{nodeLookup:_,triggerNodeChanges:w,connection:x,updateConnection:E,onNodesChangeMiddlewareMap:I}=g();for(const[C,M]of v){const q=_.get(C),R=!!(q!=null&&q.expandParent&&(q!=null&&q.parentId)&&(M!=null&&M.position)),O={id:C,type:"position",position:R?{x:Math.max(0,M.position.x),y:Math.max(0,M.position.y)}:M.position,dragging:y};if(q&&x.inProgress&&x.fromNode.id===q.id){const S=it(q,x.fromHandle,Q.Left,!0);E({...x,from:S})}R&&q.parentId&&b.push({id:C,parentId:q.parentId,rect:{...M.internals.positionAbsolute,width:M.measured.width??0,height:M.measured.height??0}}),p.push(O)}if(b.length>0){const{parentLookup:C,nodeOrigin:M}=g(),q=Pc(b,_,C,M);p.push(...q)}for(const C of I.values())p=C(p);w(p)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:b,nodes:p,hasDefaultNodes:_,debug:w}=g();if(v!=null&&v.length){if(_){const x=gq(v,p);b(x)}w&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:b,edges:p,hasDefaultEdges:_,debug:w}=g();if(v!=null&&v.length){if(_){const x=vq(v,p);b(x)}w&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:b,nodeLookup:p,triggerNodeChanges:_,triggerEdgeChanges:w}=g();if(y){const x=v.map(E=>Ze(E,!0));_(x);return}_(dt(p,new Set([...v]),!0)),w(dt(b))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:b,nodeLookup:p,triggerNodeChanges:_,triggerEdgeChanges:w}=g();if(y){const x=v.map(E=>Ze(E,!0));w(x);return}w(dt(b,new Set([...v]))),_(dt(p,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:b,nodes:p,nodeLookup:_,triggerNodeChanges:w,triggerEdgeChanges:x}=g(),E=v||p,I=y||b,C=E.map(q=>{const R=_.get(q.id);return R&&(R.selected=!1),Ze(q.id,!1)}),M=I.map(q=>Ze(q.id,!1));w(C),x(M)},setMinZoom:v=>{const{panZoom:y,maxZoom:b}=g();y==null||y.setScaleExtent([v,b]),h({minZoom:v})},setMaxZoom:v=>{const{panZoom:y,minZoom:b}=g();y==null||y.setScaleExtent([b,v]),h({maxZoom:v})},setTranslateExtent:v=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(v),h({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:y,triggerNodeChanges:b,triggerEdgeChanges:p,elementsSelectable:_}=g();if(!_)return;const w=y.reduce((E,I)=>I.selected?[...E,Ze(I.id,!1)]:E,[]),x=v.reduce((E,I)=>I.selected?[...E,Ze(I.id,!1)]:E,[]);b(w),p(x)},setNodeExtent:v=>{const{nodes:y,nodeLookup:b,parentLookup:p,nodeOrigin:_,elevateNodesOnSelect:w,nodeExtent:x,zIndexMode:E}=g();v[0][0]===x[0][0]&&v[0][1]===x[0][1]&&v[1][0]===x[1][0]&&v[1][1]===x[1][1]||(Ju(y,b,p,{nodeOrigin:_,nodeExtent:v,elevateNodesOnSelect:w,checkEquality:!1,zIndexMode:E}),h({nodeExtent:v}))},panBy:v=>{const{transform:y,width:b,height:p,panZoom:_,translateExtent:w}=g();return hS({delta:v,panZoom:_,transform:y,translateExtent:w,width:b,height:p})},setCenter:async(v,y,b)=>{const{width:p,height:_,maxZoom:w,panZoom:x}=g();if(!x)return Promise.resolve(!1);const E=typeof(b==null?void 0:b.zoom)<"u"?b.zoom:w;return await x.setViewport({x:p/2-v*E,y:_/2-y*E,zoom:E},{duration:b==null?void 0:b.duration,ease:b==null?void 0:b.ease,interpolate:b==null?void 0:b.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...Py}})},updateConnection:v=>{h({connection:v})},reset:()=>h({...Lp()})}},Object.is);function PC({initialNodes:e,initialEdges:t,defaultNodes:r,defaultEdges:n,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:u,fitView:c,nodeOrigin:f,nodeExtent:l,zIndexMode:d,children:h}){const[g]=j.useState(()=>TC({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,width:i,height:a,fitView:c,minZoom:o,maxZoom:s,fitViewOptions:u,nodeOrigin:f,nodeExtent:l,zIndexMode:d}));return $.jsx(XS,{value:g,children:$.jsx(bq,{children:h})})}function kC({children:e,nodes:t,edges:r,defaultNodes:n,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:u,minZoom:c,maxZoom:f,nodeOrigin:l,nodeExtent:d,zIndexMode:h}){return j.useContext(an)?$.jsx($.Fragment,{children:e}):$.jsx(PC,{initialNodes:t,initialEdges:r,defaultNodes:n,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:u,initialMinZoom:c,initialMaxZoom:f,nodeOrigin:l,nodeExtent:d,zIndexMode:h,children:e})}const OC={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function LC({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:u,onInit:c,onMove:f,onMoveStart:l,onMoveEnd:d,onConnect:h,onConnectStart:g,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:_,onNodeContextMenu:w,onNodeDoubleClick:x,onNodeDragStart:E,onNodeDrag:I,onNodeDragStop:C,onNodesDelete:M,onEdgesDelete:q,onDelete:R,onSelectionChange:O,onSelectionDragStart:S,onSelectionDrag:T,onSelectionDragStop:N,onSelectionContextMenu:D,onSelectionStart:k,onSelectionEnd:P,onBeforeDelete:H,connectionMode:G,connectionLineType:V=We.Bezier,connectionLineStyle:Y,connectionLineComponent:A,connectionLineContainerStyle:L,deleteKeyCode:F="Backspace",selectionKeyCode:z="Shift",selectionOnDrag:B=!1,selectionMode:U=zt.Full,panActivationKeyCode:X="Space",multiSelectionKeyCode:K=Ht()?"Meta":"Control",zoomActivationKeyCode:J=Ht()?"Meta":"Control",snapToGrid:W,snapGrid:te,onlyRenderVisibleElements:Z=!1,selectNodesOnDrag:re,nodesDraggable:ee,autoPanOnNodeFocus:le,nodesConnectable:fe,nodesFocusable:Pe,nodeOrigin:Ce=fm,edgesFocusable:de,edgesReconnectable:se,elementsSelectable:He=!0,defaultViewport:ke=uq,minZoom:Ve=.5,maxZoom:Ge=2,translateExtent:Oe=jt,preventScrolling:rr=!0,nodeExtent:ct,defaultMarkerColor:cn="#b1b1b7",zoomOnScroll:nr=!0,zoomOnPinch:Ie=!0,panOnScroll:Le=!1,panOnScrollSpeed:r0=.5,panOnScrollMode:n0=et.Free,zoomOnDoubleClick:i0=!0,panOnDrag:a0=!0,onPaneClick:o0,onPaneMouseEnter:s0,onPaneMouseMove:u0,onPaneMouseLeave:c0,onPaneScroll:f0,onPaneContextMenu:l0,paneClickDistance:d0=1,nodeClickDistance:h0=0,children:p0,onReconnect:g0,onReconnectStart:v0,onReconnectEnd:y0,onEdgeContextMenu:m0,onEdgeDoubleClick:_0,onEdgeMouseEnter:b0,onEdgeMouseMove:w0,onEdgeMouseLeave:x0,reconnectRadius:E0=10,onNodesChange:S0,onEdgesChange:q0,noDragClassName:C0="nodrag",noWheelClassName:I0="nowheel",noPanClassName:Fc="nopan",fitView:$c,fitViewOptions:jc,connectOnClick:R0,attributionPosition:A0,proOptions:N0,defaultEdgeOptions:M0,elevateNodesOnSelect:T0=!0,elevateEdgesOnSelect:P0=!1,disableKeyboardA11y:zc=!1,autoPanOnConnect:k0,autoPanOnNodeDrag:O0,autoPanSpeed:L0,connectionRadius:D0,isValidConnection:F0,onError:$0,style:j0,id:Bc,nodeDragThreshold:z0,connectionDragThreshold:B0,viewport:H0,onViewportChange:V0,width:G0,height:U0,colorMode:Y0="light",debug:W0,onScroll:ir,ariaLabelConfig:X0,zIndexMode:Hc="basic",...K0},Z0){const fn=Bc||"1",Q0=dq(Y0),J0=j.useCallback(Vc=>{Vc.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),ir==null||ir(Vc)},[ir]);return $.jsx("div",{"data-testid":"rf__wrapper",...K0,onScroll:J0,style:{...j0,...OC},ref:Z0,className:ce(["react-flow",i,Q0]),id:Bc,role:"application",children:$.jsxs(kC,{nodes:e,edges:t,width:G0,height:U0,fitView:$c,fitViewOptions:jc,minZoom:Ve,maxZoom:Ge,nodeOrigin:Ce,nodeExtent:ct,zIndexMode:Hc,children:[$.jsx(MC,{onInit:c,onNodeClick:s,onEdgeClick:u,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:_,onNodeContextMenu:w,onNodeDoubleClick:x,nodeTypes:a,edgeTypes:o,connectionLineType:V,connectionLineStyle:Y,connectionLineComponent:A,connectionLineContainerStyle:L,selectionKeyCode:z,selectionOnDrag:B,selectionMode:U,deleteKeyCode:F,multiSelectionKeyCode:K,panActivationKeyCode:X,zoomActivationKeyCode:J,onlyRenderVisibleElements:Z,defaultViewport:ke,translateExtent:Oe,minZoom:Ve,maxZoom:Ge,preventScrolling:rr,zoomOnScroll:nr,zoomOnPinch:Ie,zoomOnDoubleClick:i0,panOnScroll:Le,panOnScrollSpeed:r0,panOnScrollMode:n0,panOnDrag:a0,onPaneClick:o0,onPaneMouseEnter:s0,onPaneMouseMove:u0,onPaneMouseLeave:c0,onPaneScroll:f0,onPaneContextMenu:l0,paneClickDistance:d0,nodeClickDistance:h0,onSelectionContextMenu:D,onSelectionStart:k,onSelectionEnd:P,onReconnect:g0,onReconnectStart:v0,onReconnectEnd:y0,onEdgeContextMenu:m0,onEdgeDoubleClick:_0,onEdgeMouseEnter:b0,onEdgeMouseMove:w0,onEdgeMouseLeave:x0,reconnectRadius:E0,defaultMarkerColor:cn,noDragClassName:C0,noWheelClassName:I0,noPanClassName:Fc,rfId:fn,disableKeyboardA11y:zc,nodeExtent:ct,viewport:H0,onViewportChange:V0}),$.jsx(lq,{nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:h,onConnectStart:g,onConnectEnd:m,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:ee,autoPanOnNodeFocus:le,nodesConnectable:fe,nodesFocusable:Pe,edgesFocusable:de,edgesReconnectable:se,elementsSelectable:He,elevateNodesOnSelect:T0,elevateEdgesOnSelect:P0,minZoom:Ve,maxZoom:Ge,nodeExtent:ct,onNodesChange:S0,onEdgesChange:q0,snapToGrid:W,snapGrid:te,connectionMode:G,translateExtent:Oe,connectOnClick:R0,defaultEdgeOptions:M0,fitView:$c,fitViewOptions:jc,onNodesDelete:M,onEdgesDelete:q,onDelete:R,onNodeDragStart:E,onNodeDrag:I,onNodeDragStop:C,onSelectionDrag:T,onSelectionDragStart:S,onSelectionDragStop:N,onMove:f,onMoveStart:l,onMoveEnd:d,noPanClassName:Fc,nodeOrigin:Ce,rfId:fn,autoPanOnConnect:k0,autoPanOnNodeDrag:O0,autoPanSpeed:L0,onError:$0,connectionRadius:D0,isValidConnection:F0,selectNodesOnDrag:re,nodeDragThreshold:z0,connectionDragThreshold:B0,onBeforeDelete:H,debug:W0,ariaLabelConfig:X0,zIndexMode:Hc}),$.jsx(sq,{onSelectionChange:O}),p0,$.jsx(rq,{proOptions:N0,position:A0}),$.jsx(tq,{rfId:fn,disableKeyboardA11y:zc})]})})}var ER=dm(LC);function DC({dimensions:e,lineWidth:t,variant:r,className:n}){return $.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ce(["react-flow__background-pattern",r,n])})}function FC({radius:e,className:t}){return $.jsx("circle",{cx:e,cy:e,r:e,className:ce(["react-flow__background-pattern","dots",t])})}var Xe;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Xe||(Xe={}));const $C={[Xe.Dots]:1,[Xe.Lines]:1,[Xe.Cross]:6},jC=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Lm({id:e,variant:t=Xe.Dots,gap:r=20,size:n,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:u,className:c,patternClassName:f}){const l=j.useRef(null),{transform:d,patternId:h}=ne(jC,ie),g=n||$C[t],m=t===Xe.Dots,v=t===Xe.Cross,y=Array.isArray(r)?r:[r,r],b=[y[0]*d[2]||1,y[1]*d[2]||1],p=g*d[2],_=Array.isArray(a)?a:[a,a],w=v?[p,p]:b,x=[_[0]*d[2]||1+w[0]/2,_[1]*d[2]||1+w[1]/2],E=`${h}${e||""}`;return $.jsxs("svg",{className:ce(["react-flow__background",c]),style:{...u,...sn,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:l,"data-testid":"rf__background",children:[$.jsx("pattern",{id:E,x:d[0]%b[0],y:d[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${x[0]},-${x[1]})`,children:m?$.jsx(FC,{radius:p/2,className:f}):$.jsx(DC,{dimensions:w,lineWidth:i,variant:t,className:f})}),$.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}Lm.displayName="Background";const SR=j.memo(Lm);function zC(){return $.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:$.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function BC(){return $.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:$.jsx("path",{d:"M0 0h32v4.2H0z"})})}function HC(){return $.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:$.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 VC(){return $.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:$.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 GC(){return $.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:$.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 pr({children:e,className:t,...r}){return $.jsx("button",{type:"button",className:ce(["react-flow__controls-button",t]),...r,children:e})}const UC=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Dm({style:e,showZoom:t=!0,showFitView:r=!0,showInteractive:n=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:u,className:c,children:f,position:l="bottom-left",orientation:d="vertical","aria-label":h}){const g=ae(),{isInteractive:m,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:b}=ne(UC,ie),{zoomIn:p,zoomOut:_,fitView:w}=kc(),x=()=>{p(),a==null||a()},E=()=>{_(),o==null||o()},I=()=>{w(i),s==null||s()},C=()=>{g.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),u==null||u(!m)},M=d==="horizontal"?"horizontal":"vertical";return $.jsxs(on,{className:ce(["react-flow__controls",M,c]),position:l,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&$.jsxs($.Fragment,{children:[$.jsx(pr,{onClick:x,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:y,children:$.jsx(zC,{})}),$.jsx(pr,{onClick:E,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:v,children:$.jsx(BC,{})})]}),r&&$.jsx(pr,{className:"react-flow__controls-fitview",onClick:I,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:$.jsx(HC,{})}),n&&$.jsx(pr,{className:"react-flow__controls-interactive",onClick:C,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:m?$.jsx(GC,{}):$.jsx(VC,{})}),f]})}Dm.displayName="Controls";const qR=j.memo(Dm);function YC({id:e,x:t,y:r,width:n,height:i,style:a,color:o,strokeColor:s,strokeWidth:u,className:c,borderRadius:f,shapeRendering:l,selected:d,onClick:h}){const{background:g,backgroundColor:m}=a||{},v=o||g||m;return $.jsx("rect",{className:ce(["react-flow__minimap-node",{selected:d},c]),x:t,y:r,rx:f,ry:f,width:n,height:i,style:{fill:v,stroke:s,strokeWidth:u},shapeRendering:l,onClick:h?y=>h(y,e):void 0})}const WC=j.memo(YC),XC=e=>e.nodes.map(t=>t.id),os=e=>e instanceof Function?e:()=>e;function KC({nodeStrokeColor:e,nodeColor:t,nodeClassName:r="",nodeBorderRadius:n=5,nodeStrokeWidth:i,nodeComponent:a=WC,onClick:o}){const s=ne(XC,ie),u=os(t),c=os(e),f=os(r),l=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return $.jsx($.Fragment,{children:s.map(d=>$.jsx(QC,{id:d,nodeColorFunc:u,nodeStrokeColorFunc:c,nodeClassNameFunc:f,nodeBorderRadius:n,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:l},d))})}function ZC({id:e,nodeColorFunc:t,nodeStrokeColorFunc:r,nodeClassNameFunc:n,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:u}){const{node:c,x:f,y:l,width:d,height:h}=ne(g=>{const{internals:m}=g.nodeLookup.get(e),v=m.userNode,{x:y,y:b}=m.positionAbsolute,{width:p,height:_}=Be(v);return{node:v,x:y,y:b,width:p,height:_}},ie);return!c||c.hidden||!jy(c)?null:$.jsx(s,{x:f,y:l,width:d,height:h,style:c.style,selected:!!c.selected,className:n(c),color:t(c),borderRadius:i,strokeColor:r(c),strokeWidth:a,shapeRendering:o,onClick:u,id:c.id})}const QC=j.memo(ZC);var JC=j.memo(KC);const eI=200,tI=150,rI=e=>!e.hidden,nI=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?$y(Jt(e.nodeLookup,{filter:rI}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},iI="react-flow__minimap-desc";function Fm({style:e,className:t,nodeStrokeColor:r,nodeColor:n,nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:u,maskColor:c,maskStrokeColor:f,maskStrokeWidth:l,position:d="bottom-right",onClick:h,onNodeClick:g,pannable:m=!1,zoomable:v=!1,ariaLabel:y,inversePan:b,zoomStep:p=1,offsetScale:_=5}){const w=ae(),x=j.useRef(null),{boundingRect:E,viewBB:I,rfId:C,panZoom:M,translateExtent:q,flowWidth:R,flowHeight:O,ariaLabelConfig:S}=ne(nI,ie),T=(e==null?void 0:e.width)??eI,N=(e==null?void 0:e.height)??tI,D=E.width/T,k=E.height/N,P=Math.max(D,k),H=P*T,G=P*N,V=_*P,Y=E.x-(H-E.width)/2-V,A=E.y-(G-E.height)/2-V,L=H+V*2,F=G+V*2,z=`${iI}-${C}`,B=j.useRef(0),U=j.useRef();B.current=P,j.useEffect(()=>{if(x.current&&M)return U.current=xS({domNode:x.current,panZoom:M,getTransform:()=>w.getState().transform,getViewScale:()=>B.current}),()=>{var W;(W=U.current)==null||W.destroy()}},[M]),j.useEffect(()=>{var W;(W=U.current)==null||W.update({translateExtent:q,width:R,height:O,inversePan:b,pannable:m,zoomStep:p,zoomable:v})},[m,v,b,p,q,R,O]);const X=h?W=>{var re;const[te,Z]=((re=U.current)==null?void 0:re.pointer(W))||[0,0];h(W,{x:te,y:Z})}:void 0,K=g?j.useCallback((W,te)=>{const Z=w.getState().nodeLookup.get(te).internals.userNode;g(W,Z)},[]):void 0,J=y??S["minimap.ariaLabel"];return $.jsx(on,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof l=="number"?l*P:void 0,"--xy-minimap-node-background-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:ce(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:$.jsxs("svg",{width:T,height:N,viewBox:`${Y} ${A} ${L} ${F}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":z,ref:x,onClick:X,children:[J&&$.jsx("title",{id:z,children:J}),$.jsx(JC,{onClick:K,nodeColor:n,nodeStrokeColor:r,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),$.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-V},${A-V}h${L+V*2}v${F+V*2}h${-L-V*2}z
|
|
23
|
-
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Fm.displayName="MiniMap";const CR=j.memo(Fm),aI=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,oI={[xt.Line]:"right",[xt.Handle]:"bottom-right"};function sI({nodeId:e,position:t,variant:r=xt.Handle,className:n,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:u=10,maxWidth:c=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:l=!1,resizeDirection:d,autoScale:h=!0,shouldResize:g,onResizeStart:m,onResize:v,onResizeEnd:y}){const b=vm(),p=typeof e=="string"?e:b,_=ae(),w=j.useRef(null),x=r===xt.Handle,E=ne(j.useCallback(aI(x&&h),[x,h]),ie),I=j.useRef(null),C=t??oI[r];j.useEffect(()=>{if(!(!w.current||!p))return I.current||(I.current=LS({domNode:w.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:q,transform:R,snapGrid:O,snapToGrid:S,nodeOrigin:T,domNode:N}=_.getState();return{nodeLookup:q,transform:R,snapGrid:O,snapToGrid:S,nodeOrigin:T,paneDomNode:N}},onChange:(q,R)=>{const{triggerNodeChanges:O,nodeLookup:S,parentLookup:T,nodeOrigin:N}=_.getState(),D=[],k={x:q.x,y:q.y},P=S.get(p);if(P&&P.expandParent&&P.parentId){const H=P.origin??N,G=q.width??P.measured.width??0,V=q.height??P.measured.height??0,Y={id:P.id,parentId:P.parentId,rect:{width:G,height:V,...zy({x:q.x??P.position.x,y:q.y??P.position.y},{width:G,height:V},P.parentId,S,H)}},A=Pc([Y],S,T,N);D.push(...A),k.x=q.x?Math.max(H[0]*G,q.x):void 0,k.y=q.y?Math.max(H[1]*V,q.y):void 0}if(k.x!==void 0&&k.y!==void 0){const H={id:p,type:"position",position:{...k}};D.push(H)}if(q.width!==void 0&&q.height!==void 0){const G={id:p,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:q.width,height:q.height}};D.push(G)}for(const H of R){const G={...H,type:"position"};D.push(G)}O(D)},onEnd:({width:q,height:R})=>{const O={id:p,type:"dimensions",resizing:!1,dimensions:{width:q,height:R}};_.getState().triggerNodeChanges([O])}})),I.current.update({controlPosition:C,boundaries:{minWidth:s,minHeight:u,maxWidth:c,maxHeight:f},keepAspectRatio:l,resizeDirection:d,onResizeStart:m,onResize:v,onResizeEnd:y,shouldResize:g}),()=>{var q;(q=I.current)==null||q.destroy()}},[C,s,u,c,f,l,m,v,y,g]);const M=C.split("-");return $.jsx("div",{className:ce(["react-flow__resize-control","nodrag",...M,r,n]),ref:w,style:{...i,scale:E,...o&&{[x?"backgroundColor":"borderColor"]:o}},children:a})}j.memo(sI);function Lc(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ss,Dp;function uI(){if(Dp)return ss;Dp=1;var e=ay(),t=4;function r(n){return e(n,t)}return ss=r,ss}var us,Fp;function $m(){if(Fp)return us;Fp=1;var e=st();function t(r){return typeof r=="function"?r:e}return us=t,us}var cs,$p;function jm(){if($p)return cs;$p=1;var e=mc(),t=Vr(),r=$m(),n=ue();function i(a,o){var s=n(a)?e:t;return s(a,r(o))}return cs=i,cs}var fs,jp;function zm(){return jp||(jp=1,fs=jm()),fs}var ls,zp;function cI(){if(zp)return ls;zp=1;var e=Vr();function t(r,n){var i=[];return e(r,function(a,o,s){n(a,o,s)&&i.push(a)}),i}return ls=t,ls}var ds,Bp;function Bm(){if(Bp)return ds;Bp=1;var e=Iv(),t=cI(),r=ze(),n=ue();function i(a,o){var s=n(a)?e:t;return s(a,r(o,3))}return ds=i,ds}var hs,Hp;function fI(){if(Hp)return hs;Hp=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n,i){return n!=null&&t.call(n,i)}return hs=r,hs}var ps,Vp;function Hm(){if(Vp)return ps;Vp=1;var e=fI(),t=Lv();function r(n,i){return n!=null&&t(n,i,e)}return ps=r,ps}var gs,Gp;function lI(){if(Gp)return gs;Gp=1;var e=fc(),t=It(),r=Yt(),n=ue(),i=je(),a=Ct(),o=Hr(),s=Wt(),u="[object Map]",c="[object Set]",f=Object.prototype,l=f.hasOwnProperty;function d(h){if(h==null)return!0;if(i(h)&&(n(h)||typeof h=="string"||typeof h.splice=="function"||a(h)||s(h)||r(h)))return!h.length;var g=t(h);if(g==u||g==c)return!h.size;if(o(h))return!e(h).length;for(var m in h)if(l.call(h,m))return!1;return!0}return gs=d,gs}var vs,Up;function Vm(){if(Up)return vs;Up=1;function e(t){return t===void 0}return vs=e,vs}var ys,Yp;function dI(){if(Yp)return ys;Yp=1;function e(t,r,n,i){var a=-1,o=t==null?0:t.length;for(i&&o&&(n=t[++a]);++a<o;)n=r(n,t[a],a,t);return n}return ys=e,ys}var ms,Wp;function hI(){if(Wp)return ms;Wp=1;function e(t,r,n,i,a){return a(t,function(o,s,u){n=i?(i=!1,o):r(n,o,s,u)}),n}return ms=e,ms}var _s,Xp;function Gm(){if(Xp)return _s;Xp=1;var e=dI(),t=Vr(),r=ze(),n=hI(),i=ue();function a(o,s,u){var c=i(o)?e:n,f=arguments.length<3;return c(o,r(s,4),u,f,t)}return _s=a,_s}var bs,Kp;function pI(){if(Kp)return bs;Kp=1;var e=Fv(),t=e("length");return bs=t,bs}var ws,Zp;function gI(){if(Zp)return ws;Zp=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",s="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",c="(?:"+s+"|"+u+")",f="[^"+e+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",h="\\u200d",g=c+"?",m="["+a+"]?",v="(?:"+h+"(?:"+[f,l,d].join("|")+")"+m+g+")*",y=m+g+v,b="(?:"+[f+s+"?",s,l,d,o].join("|")+")",p=RegExp(u+"(?="+u+")|"+b+y,"g");function _(w){for(var x=p.lastIndex=0;p.test(w);)++x;return x}return ws=_,ws}var xs,Qp;function vI(){if(Qp)return xs;Qp=1;var e=pI(),t=M_(),r=gI();function n(i){return t(i)?r(i):e(i)}return xs=n,xs}var Es,Jp;function yI(){if(Jp)return Es;Jp=1;var e=fc(),t=It(),r=je(),n=N_(),i=vI(),a="[object Map]",o="[object Set]";function s(u){if(u==null)return 0;if(r(u))return n(u)?i(u):u.length;var c=t(u);return c==a||c==o?u.size:e(u).length}return Es=s,Es}var Ss,eg;function mI(){if(eg)return Ss;eg=1;var e=mc(),t=ny(),r=hc(),n=ze(),i=Yr(),a=ue(),o=Ct(),s=Gt(),u=ye(),c=Wt();function f(l,d,h){var g=a(l),m=g||o(l)||c(l);if(d=n(d,4),h==null){var v=l&&l.constructor;m?h=g?new v:[]:u(l)?h=s(v)?t(i(l)):{}:h={}}return(m?e:r)(l,function(y,b,p){return d(h,y,b,p)}),h}return Ss=f,Ss}var qs,tg;function Um(){if(tg)return qs;tg=1;var e=je(),t=Me();function r(n){return t(n)&&e(n)}return qs=r,qs}var Cs,rg;function _I(){if(rg)return Cs;rg=1;var e=lc(),t=Gr(),r=db(),n=Um(),i=t(function(a){return r(e(a,1,n,!0))});return Cs=i,Cs}var Is,ng;function bI(){if(ng)return Is;ng=1;var e=Dr();function t(r,n){return e(n,function(i){return r[i]})}return Is=t,Is}var Rs,ig;function Ym(){if(ig)return Rs;ig=1;var e=bI(),t=Ke();function r(n){return n==null?[]:e(n,t(n))}return Rs=r,Rs}var As,ag;function me(){if(ag)return As;ag=1;var e;if(typeof Lc=="function")try{e={clone:uI(),constant:pc(),each:zm(),filter:Bm(),has:Hm(),isArray:ue(),isEmpty:lI(),isFunction:Gt(),isUndefined:Vm(),keys:Ke(),map:Zv(),reduce:Gm(),size:yI(),transform:mI(),union:_I(),values:Ym()}}catch{}return e||(e=window._),As=e,As}var Ns,og;function Dc(){if(og)return Ns;og=1;var e=me();Ns=i;var t="\0",r="\0",n="";function i(f){this._isDirected=e.has(f,"directed")?f.directed:!0,this._isMultigraph=e.has(f,"multigraph")?f.multigraph:!1,this._isCompound=e.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(f){return this._label=f,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultNodeLabelFn=f,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var f=this;return e.filter(this.nodes(),function(l){return e.isEmpty(f._in[l])})},i.prototype.sinks=function(){var f=this;return e.filter(this.nodes(),function(l){return e.isEmpty(f._out[l])})},i.prototype.setNodes=function(f,l){var d=arguments,h=this;return e.each(f,function(g){d.length>1?h.setNode(g,l):h.setNode(g)}),this},i.prototype.setNode=function(f,l){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=l),this):(this._nodes[f]=arguments.length>1?l:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=r,this._children[f]={},this._children[r][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},i.prototype.node=function(f){return this._nodes[f]},i.prototype.hasNode=function(f){return e.has(this._nodes,f)},i.prototype.removeNode=function(f){var l=this;if(e.has(this._nodes,f)){var d=function(h){l.removeEdge(l._edgeObjs[h])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(h){l.setParent(h)}),delete this._children[f]),e.each(e.keys(this._in[f]),d),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),d),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},i.prototype.setParent=function(f,l){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(l))l=r;else{l+="";for(var d=l;!e.isUndefined(d);d=this.parent(d))if(d===f)throw new Error("Setting "+l+" as parent of "+f+" would create a cycle");this.setNode(l)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=l,this._children[l][f]=!0,this},i.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},i.prototype.parent=function(f){if(this._isCompound){var l=this._parent[f];if(l!==r)return l}},i.prototype.children=function(f){if(e.isUndefined(f)&&(f=r),this._isCompound){var l=this._children[f];if(l)return e.keys(l)}else{if(f===r)return this.nodes();if(this.hasNode(f))return[]}},i.prototype.predecessors=function(f){var l=this._preds[f];if(l)return e.keys(l)},i.prototype.successors=function(f){var l=this._sucs[f];if(l)return e.keys(l)},i.prototype.neighbors=function(f){var l=this.predecessors(f);if(l)return e.union(l,this.successors(f))},i.prototype.isLeaf=function(f){var l;return this.isDirected()?l=this.successors(f):l=this.neighbors(f),l.length===0},i.prototype.filterNodes=function(f){var l=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});l.setGraph(this.graph());var d=this;e.each(this._nodes,function(m,v){f(v)&&l.setNode(v,m)}),e.each(this._edgeObjs,function(m){l.hasNode(m.v)&&l.hasNode(m.w)&&l.setEdge(m,d.edge(m))});var h={};function g(m){var v=d.parent(m);return v===void 0||l.hasNode(v)?(h[m]=v,v):v in h?h[v]:g(v)}return this._isCompound&&e.each(l.nodes(),function(m){l.setParent(m,g(m))}),l},i.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(f,l){var d=this,h=arguments;return e.reduce(f,function(g,m){return h.length>1?d.setEdge(g,m,l):d.setEdge(g,m),m}),this},i.prototype.setEdge=function(){var f,l,d,h,g=!1,m=arguments[0];typeof m=="object"&&m!==null&&"v"in m?(f=m.v,l=m.w,d=m.name,arguments.length===2&&(h=arguments[1],g=!0)):(f=m,l=arguments[1],d=arguments[3],arguments.length>2&&(h=arguments[2],g=!0)),f=""+f,l=""+l,e.isUndefined(d)||(d=""+d);var v=s(this._isDirected,f,l,d);if(e.has(this._edgeLabels,v))return g&&(this._edgeLabels[v]=h),this;if(!e.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(l),this._edgeLabels[v]=g?h:this._defaultEdgeLabelFn(f,l,d);var y=u(this._isDirected,f,l,d);return f=y.v,l=y.w,Object.freeze(y),this._edgeObjs[v]=y,a(this._preds[l],f),a(this._sucs[f],l),this._in[l][v]=y,this._out[f][v]=y,this._edgeCount++,this},i.prototype.edge=function(f,l,d){var h=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,f,l,d);return this._edgeLabels[h]},i.prototype.hasEdge=function(f,l,d){var h=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,f,l,d);return e.has(this._edgeLabels,h)},i.prototype.removeEdge=function(f,l,d){var h=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,f,l,d),g=this._edgeObjs[h];return g&&(f=g.v,l=g.w,delete this._edgeLabels[h],delete this._edgeObjs[h],o(this._preds[l],f),o(this._sucs[f],l),delete this._in[l][h],delete this._out[f][h],this._edgeCount--),this},i.prototype.inEdges=function(f,l){var d=this._in[f];if(d){var h=e.values(d);return l?e.filter(h,function(g){return g.v===l}):h}},i.prototype.outEdges=function(f,l){var d=this._out[f];if(d){var h=e.values(d);return l?e.filter(h,function(g){return g.w===l}):h}},i.prototype.nodeEdges=function(f,l){var d=this.inEdges(f,l);if(d)return d.concat(this.outEdges(f,l))};function a(f,l){f[l]?f[l]++:f[l]=1}function o(f,l){--f[l]||delete f[l]}function s(f,l,d,h){var g=""+l,m=""+d;if(!f&&g>m){var v=g;g=m,m=v}return g+n+m+n+(e.isUndefined(h)?t:h)}function u(f,l,d,h){var g=""+l,m=""+d;if(!f&&g>m){var v=g;g=m,m=v}var y={v:g,w:m};return h&&(y.name=h),y}function c(f,l){return s(f,l.v,l.w,l.name)}return Ns}var Ms,sg;function wI(){return sg||(sg=1,Ms="2.1.8"),Ms}var Ts,ug;function xI(){return ug||(ug=1,Ts={Graph:Dc(),version:wI()}),Ts}var Ps,cg;function EI(){if(cg)return Ps;cg=1;var e=me(),t=Dc();Ps={write:r,read:a};function r(o){var s={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:n(o),edges:i(o)};return e.isUndefined(o.graph())||(s.value=e.clone(o.graph())),s}function n(o){return e.map(o.nodes(),function(s){var u=o.node(s),c=o.parent(s),f={v:s};return e.isUndefined(u)||(f.value=u),e.isUndefined(c)||(f.parent=c),f})}function i(o){return e.map(o.edges(),function(s){var u=o.edge(s),c={v:s.v,w:s.w};return e.isUndefined(s.name)||(c.name=s.name),e.isUndefined(u)||(c.value=u),c})}function a(o){var s=new t(o.options).setGraph(o.value);return e.each(o.nodes,function(u){s.setNode(u.v,u.value),u.parent&&s.setParent(u.v,u.parent)}),e.each(o.edges,function(u){s.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),s}return Ps}var ks,fg;function SI(){if(fg)return ks;fg=1;var e=me();ks=t;function t(r){var n={},i=[],a;function o(s){e.has(n,s)||(n[s]=!0,a.push(s),e.each(r.successors(s),o),e.each(r.predecessors(s),o))}return e.each(r.nodes(),function(s){a=[],o(s),a.length&&i.push(a)}),i}return ks}var Os,lg;function Wm(){if(lg)return Os;lg=1;var e=me();Os=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var n=this._keyIndices[r];if(n!==void 0)return this._arr[n].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,n){var i=this._keyIndices;if(r=String(r),!e.has(i,r)){var a=this._arr,o=a.length;return i[r]=o,a.push({key:r,priority:n}),this._decrease(o),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,n){var i=this._keyIndices[r];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},t.prototype._heapify=function(r){var n=this._arr,i=2*r,a=i+1,o=r;i<n.length&&(o=n[i].priority<n[o].priority?i:o,a<n.length&&(o=n[a].priority<n[o].priority?a:o),o!==r&&(this._swap(r,o),this._heapify(o)))},t.prototype._decrease=function(r){for(var n=this._arr,i=n[r].priority,a;r!==0&&(a=r>>1,!(n[a].priority<i));)this._swap(r,a),r=a},t.prototype._swap=function(r,n){var i=this._arr,a=this._keyIndices,o=i[r],s=i[n];i[r]=s,i[n]=o,a[s.key]=r,a[o.key]=n},Os}var Ls,dg;function Xm(){if(dg)return Ls;dg=1;var e=me(),t=Wm();Ls=n;var r=e.constant(1);function n(a,o,s,u){return i(a,String(o),s||r,u||function(c){return a.outEdges(c)})}function i(a,o,s,u){var c={},f=new t,l,d,h=function(g){var m=g.v!==l?g.v:g.w,v=c[m],y=s(g),b=d.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+y);b<v.distance&&(v.distance=b,v.predecessor=l,f.decrease(m,b))};for(a.nodes().forEach(function(g){var m=g===o?0:Number.POSITIVE_INFINITY;c[g]={distance:m},f.add(g,m)});f.size()>0&&(l=f.removeMin(),d=c[l],d.distance!==Number.POSITIVE_INFINITY);)u(l).forEach(h);return c}return Ls}var Ds,hg;function qI(){if(hg)return Ds;hg=1;var e=Xm(),t=me();Ds=r;function r(n,i,a){return t.transform(n.nodes(),function(o,s){o[s]=e(n,s,i,a)},{})}return Ds}var Fs,pg;function Km(){if(pg)return Fs;pg=1;var e=me();Fs=t;function t(r){var n=0,i=[],a={},o=[];function s(u){var c=a[u]={onStack:!0,lowlink:n,index:n++};if(i.push(u),r.successors(u).forEach(function(d){e.has(a,d)?a[d].onStack&&(c.lowlink=Math.min(c.lowlink,a[d].index)):(s(d),c.lowlink=Math.min(c.lowlink,a[d].lowlink))}),c.lowlink===c.index){var f=[],l;do l=i.pop(),a[l].onStack=!1,f.push(l);while(u!==l);o.push(f)}}return r.nodes().forEach(function(u){e.has(a,u)||s(u)}),o}return Fs}var $s,gg;function CI(){if(gg)return $s;gg=1;var e=me(),t=Km();$s=r;function r(n){return e.filter(t(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return $s}var js,vg;function II(){if(vg)return js;vg=1;var e=me();js=r;var t=e.constant(1);function r(i,a,o){return n(i,a||t,o||function(s){return i.outEdges(s)})}function n(i,a,o){var s={},u=i.nodes();return u.forEach(function(c){s[c]={},s[c][c]={distance:0},u.forEach(function(f){c!==f&&(s[c][f]={distance:Number.POSITIVE_INFINITY})}),o(c).forEach(function(f){var l=f.v===c?f.w:f.v,d=a(f);s[c][l]={distance:d,predecessor:c}})}),u.forEach(function(c){var f=s[c];u.forEach(function(l){var d=s[l];u.forEach(function(h){var g=d[c],m=f[h],v=d[h],y=g.distance+m.distance;y<v.distance&&(v.distance=y,v.predecessor=m.predecessor)})})}),s}return js}var zs,yg;function Zm(){if(yg)return zs;yg=1;var e=me();zs=t,t.CycleException=r;function t(n){var i={},a={},o=[];function s(u){if(e.has(a,u))throw new r;e.has(i,u)||(a[u]=!0,i[u]=!0,e.each(n.predecessors(u),s),delete a[u],o.push(u))}if(e.each(n.sinks(),s),e.size(i)!==n.nodeCount())throw new r;return o}function r(){}return r.prototype=new Error,zs}var Bs,mg;function RI(){if(mg)return Bs;mg=1;var e=Zm();Bs=t;function t(r){try{e(r)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}return Bs}var Hs,_g;function Qm(){if(_g)return Hs;_g=1;var e=me();Hs=t;function t(n,i,a){e.isArray(i)||(i=[i]);var o=(n.isDirected()?n.successors:n.neighbors).bind(n),s=[],u={};return e.each(i,function(c){if(!n.hasNode(c))throw new Error("Graph does not have node: "+c);r(n,c,a==="post",u,o,s)}),s}function r(n,i,a,o,s,u){e.has(o,i)||(o[i]=!0,a||u.push(i),e.each(s(i),function(c){r(n,c,a,o,s,u)}),a&&u.push(i))}return Hs}var Vs,bg;function AI(){if(bg)return Vs;bg=1;var e=Qm();Vs=t;function t(r,n){return e(r,n,"post")}return Vs}var Gs,wg;function NI(){if(wg)return Gs;wg=1;var e=Qm();Gs=t;function t(r,n){return e(r,n,"pre")}return Gs}var Us,xg;function MI(){if(xg)return Us;xg=1;var e=me(),t=Dc(),r=Wm();Us=n;function n(i,a){var o=new t,s={},u=new r,c;function f(d){var h=d.v===c?d.w:d.v,g=u.priority(h);if(g!==void 0){var m=a(d);m<g&&(s[h]=c,u.decrease(h,m))}}if(i.nodeCount()===0)return o;e.each(i.nodes(),function(d){u.add(d,Number.POSITIVE_INFINITY),o.setNode(d)}),u.decrease(i.nodes()[0],0);for(var l=!1;u.size()>0;){if(c=u.removeMin(),e.has(s,c))o.setEdge(c,s[c]);else{if(l)throw new Error("Input graph is not connected: "+i);l=!0}i.nodeEdges(c).forEach(f)}return o}return Us}var Ys,Eg;function TI(){return Eg||(Eg=1,Ys={components:SI(),dijkstra:Xm(),dijkstraAll:qI(),findCycles:CI(),floydWarshall:II(),isAcyclic:RI(),postorder:AI(),preorder:NI(),prim:MI(),tarjan:Km(),topsort:Zm()}),Ys}var Ws,Sg;function PI(){if(Sg)return Ws;Sg=1;var e=xI();return Ws={Graph:e.Graph,json:EI(),alg:TI(),version:e.version},Ws}var Xs,qg;function Ee(){if(qg)return Xs;qg=1;var e;if(typeof Lc=="function")try{e=PI()}catch{}return e||(e=window.graphlib),Xs=e,Xs}var Ks,Cg;function kI(){if(Cg)return Ks;Cg=1;var e=ay(),t=1,r=4;function n(i){return e(i,t|r)}return Ks=n,Ks}var Zs,Ig;function OI(){if(Ig)return Zs;Ig=1;var e=Gr(),t=qt(),r=Ur(),n=ut(),i=Object.prototype,a=i.hasOwnProperty,o=e(function(s,u){s=Object(s);var c=-1,f=u.length,l=f>2?u[2]:void 0;for(l&&r(u[0],u[1],l)&&(f=1);++c<f;)for(var d=u[c],h=n(d),g=-1,m=h.length;++g<m;){var v=h[g],y=s[v];(y===void 0||t(y,i[v])&&!a.call(s,v))&&(s[v]=d[v])}return s});return Zs=o,Zs}var Qs,Rg;function LI(){if(Rg)return Qs;Rg=1;var e=dc(),t=$m(),r=ut();function n(i,a){return i==null?i:e(i,t(a),r)}return Qs=n,Qs}var Js,Ag;function Jm(){if(Ag)return Js;Ag=1;var e=Wr(),t=qt();function r(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&e(n,i,a)}return Js=r,Js}var eu,Ng;function e0(){if(Ng)return eu;Ng=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return eu=e,eu}var tu,Mg;function DI(){if(Mg)return tu;Mg=1;var e=Kt(),t=ut();function r(n){return e(n,t(n))}return tu=r,tu}var ru,Tg;function FI(){if(Tg)return ru;Tg=1;var e=Jm(),t=Jv(),r=ry(),n=ey(),i=iy(),a=Yt(),o=ue(),s=Um(),u=Ct(),c=Gt(),f=ye(),l=uw(),d=Wt(),h=e0(),g=DI();function m(v,y,b,p,_,w,x){var E=h(v,b),I=h(y,b),C=x.get(I);if(C){e(v,b,C);return}var M=w?w(E,I,b+"",v,y,x):void 0,q=M===void 0;if(q){var R=o(I),O=!R&&u(I),S=!R&&!O&&d(I);M=I,R||O||S?o(E)?M=E:s(E)?M=n(E):O?(q=!1,M=t(I,!0)):S?(q=!1,M=r(I,!0)):M=[]:l(I)||a(I)?(M=E,a(E)?M=g(E):(!f(E)||c(E))&&(M=i(I))):q=!1}q&&(x.set(I,M),_(M,I,p,w,x),x.delete(I)),e(v,b,M)}return ru=m,ru}var nu,Pg;function $I(){if(Pg)return nu;Pg=1;var e=jr(),t=Jm(),r=dc(),n=FI(),i=ye(),a=ut(),o=e0();function s(u,c,f,l,d){u!==c&&r(c,function(h,g){if(d||(d=new e),i(h))n(u,c,g,f,s,l,d);else{var m=l?l(o(u,g),h,g+"",u,c,d):void 0;m===void 0&&(m=h),t(u,g,m)}},a)}return nu=s,nu}var iu,kg;function jI(){if(kg)return iu;kg=1;var e=Gr(),t=Ur();function r(n){return e(function(i,a){var o=-1,s=a.length,u=s>1?a[s-1]:void 0,c=s>2?a[2]:void 0;for(u=n.length>3&&typeof u=="function"?(s--,u):void 0,c&&t(a[0],a[1],c)&&(u=s<3?void 0:u,s=1),i=Object(i);++o<s;){var f=a[o];f&&n(i,f,o,u)}return i})}return iu=r,iu}var au,Og;function zI(){if(Og)return au;Og=1;var e=$I(),t=jI(),r=t(function(n,i,a){e(n,i,a)});return au=r,au}var ou,Lg;function BI(){if(Lg)return ou;Lg=1;var e=Xr(),t=Fr(),r=zr(),n=ye(),i=Ut();function a(o,s,u,c){if(!n(o))return o;s=t(s,o);for(var f=-1,l=s.length,d=l-1,h=o;h!=null&&++f<l;){var g=i(s[f]),m=u;if(g==="__proto__"||g==="constructor"||g==="prototype")return o;if(f!=d){var v=h[g];m=c?c(v,g,h):void 0,m===void 0&&(m=n(v)?v:r(s[f+1])?[]:{})}e(h,g,m),h=h[g]}return o}return ou=a,ou}var su,Dg;function HI(){if(Dg)return su;Dg=1;var e=$r(),t=BI(),r=Fr();function n(i,a,o){for(var s=-1,u=a.length,c={};++s<u;){var f=a[s],l=e(i,f);o(l,f)&&t(c,r(f,i),l)}return c}return su=n,su}var uu,Fg;function VI(){if(Fg)return uu;Fg=1;var e=HI(),t=Dv();function r(n,i){return e(n,i,function(a,o){return t(n,o)})}return uu=r,uu}var cu,$g;function GI(){if($g)return cu;$g=1;var e=VI(),t=Pw(),r=t(function(n,i){return n==null?{}:e(n,i)});return cu=r,cu}var fu,jg;function UI(){if(jg)return fu;jg=1;var e=wv(),t=0;function r(n){var i=++t;return e(n)+i}return fu=r,fu}var lu,zg;function YI(){if(zg)return lu;zg=1;function e(t,r,n){for(var i=-1,a=t.length,o=r.length,s={};++i<a;){var u=i<o?r[i]:void 0;n(s,t[i],u)}return s}return lu=e,lu}var du,Bg;function WI(){if(Bg)return du;Bg=1;var e=Xr(),t=YI();function r(n,i){return t(n||[],i||[],e)}return du=r,du}var hu,Hg;function oe(){if(Hg)return hu;Hg=1;var e;if(typeof Lc=="function")try{e={cloneDeep:kI(),constant:pc(),defaults:OI(),each:zm(),filter:Bm(),find:vw(),flatten:oy(),forEach:jm(),forIn:LI(),has:Hm(),isUndefined:Vm(),last:ow(),map:Zv(),mapValues:dw(),max:iw(),merge:zI(),min:aw(),minBy:sw(),now:Sb(),pick:GI(),range:lw(),reduce:Gm(),sortBy:Eb(),uniqueId:UI(),values:Ym(),zipObject:WI()}}catch{}return e||(e=window._),hu=e,hu}var pu,Vg;function XI(){if(Vg)return pu;Vg=1,pu=e;function e(){var n={};n._next=n._prev=n,this._sentinel=n}e.prototype.dequeue=function(){var n=this._sentinel,i=n._prev;if(i!==n)return t(i),i},e.prototype.enqueue=function(n){var i=this._sentinel;n._prev&&n._next&&t(n),n._next=i._next,i._next._prev=n,i._next=n,n._prev=i},e.prototype.toString=function(){for(var n=[],i=this._sentinel,a=i._prev;a!==i;)n.push(JSON.stringify(a,r)),a=a._prev;return"["+n.join(", ")+"]"};function t(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function r(n,i){if(n!=="_next"&&n!=="_prev")return i}return pu}var gu,Gg;function KI(){if(Gg)return gu;Gg=1;var e=oe(),t=Ee().Graph,r=XI();gu=i;var n=e.constant(1);function i(c,f){if(c.nodeCount()<=1)return[];var l=s(c,f||n),d=a(l.graph,l.buckets,l.zeroIdx);return e.flatten(e.map(d,function(h){return c.outEdges(h.v,h.w)}),!0)}function a(c,f,l){for(var d=[],h=f[f.length-1],g=f[0],m;c.nodeCount();){for(;m=g.dequeue();)o(c,f,l,m);for(;m=h.dequeue();)o(c,f,l,m);if(c.nodeCount()){for(var v=f.length-2;v>0;--v)if(m=f[v].dequeue(),m){d=d.concat(o(c,f,l,m,!0));break}}}return d}function o(c,f,l,d,h){var g=h?[]:void 0;return e.forEach(c.inEdges(d.v),function(m){var v=c.edge(m),y=c.node(m.v);h&&g.push({v:m.v,w:m.w}),y.out-=v,u(f,l,y)}),e.forEach(c.outEdges(d.v),function(m){var v=c.edge(m),y=m.w,b=c.node(y);b.in-=v,u(f,l,b)}),c.removeNode(d.v),g}function s(c,f){var l=new t,d=0,h=0;e.forEach(c.nodes(),function(v){l.setNode(v,{v,in:0,out:0})}),e.forEach(c.edges(),function(v){var y=l.edge(v.v,v.w)||0,b=f(v),p=y+b;l.setEdge(v.v,v.w,p),h=Math.max(h,l.node(v.v).out+=b),d=Math.max(d,l.node(v.w).in+=b)});var g=e.range(h+d+3).map(function(){return new r}),m=d+1;return e.forEach(l.nodes(),function(v){u(g,m,l.node(v))}),{graph:l,buckets:g,zeroIdx:m}}function u(c,f,l){l.out?l.in?c[l.out-l.in+f].enqueue(l):c[c.length-1].enqueue(l):c[0].enqueue(l)}return gu}var vu,Ug;function ZI(){if(Ug)return vu;Ug=1;var e=oe(),t=KI();vu={run:r,undo:i};function r(a){var o=a.graph().acyclicer==="greedy"?t(a,s(a)):n(a);e.forEach(o,function(u){var c=a.edge(u);a.removeEdge(u),c.forwardName=u.name,c.reversed=!0,a.setEdge(u.w,u.v,c,e.uniqueId("rev"))});function s(u){return function(c){return u.edge(c).weight}}}function n(a){var o=[],s={},u={};function c(f){e.has(u,f)||(u[f]=!0,s[f]=!0,e.forEach(a.outEdges(f),function(l){e.has(s,l.w)?o.push(l):c(l.w)}),delete s[f])}return e.forEach(a.nodes(),c),o}function i(a){e.forEach(a.edges(),function(o){var s=a.edge(o);if(s.reversed){a.removeEdge(o);var u=s.forwardName;delete s.reversed,delete s.forwardName,a.setEdge(o.w,o.v,s,u)}})}return vu}var yu,Yg;function pe(){if(Yg)return yu;Yg=1;var e=oe(),t=Ee().Graph;yu={addDummyNode:r,simplify:n,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:o,intersectRect:s,buildLayerMatrix:u,normalizeRanks:c,removeEmptyRanks:f,addBorderNode:l,maxRank:d,partition:h,time:g,notime:m};function r(v,y,b,p){var _;do _=e.uniqueId(p);while(v.hasNode(_));return b.dummy=y,v.setNode(_,b),_}function n(v){var y=new t().setGraph(v.graph());return e.forEach(v.nodes(),function(b){y.setNode(b,v.node(b))}),e.forEach(v.edges(),function(b){var p=y.edge(b.v,b.w)||{weight:0,minlen:1},_=v.edge(b);y.setEdge(b.v,b.w,{weight:p.weight+_.weight,minlen:Math.max(p.minlen,_.minlen)})}),y}function i(v){var y=new t({multigraph:v.isMultigraph()}).setGraph(v.graph());return e.forEach(v.nodes(),function(b){v.children(b).length||y.setNode(b,v.node(b))}),e.forEach(v.edges(),function(b){y.setEdge(b,v.edge(b))}),y}function a(v){var y=e.map(v.nodes(),function(b){var p={};return e.forEach(v.outEdges(b),function(_){p[_.w]=(p[_.w]||0)+v.edge(_).weight}),p});return e.zipObject(v.nodes(),y)}function o(v){var y=e.map(v.nodes(),function(b){var p={};return e.forEach(v.inEdges(b),function(_){p[_.v]=(p[_.v]||0)+v.edge(_).weight}),p});return e.zipObject(v.nodes(),y)}function s(v,y){var b=v.x,p=v.y,_=y.x-b,w=y.y-p,x=v.width/2,E=v.height/2;if(!_&&!w)throw new Error("Not possible to find intersection inside of the rectangle");var I,C;return Math.abs(w)*x>Math.abs(_)*E?(w<0&&(E=-E),I=E*_/w,C=E):(_<0&&(x=-x),I=x,C=x*w/_),{x:b+I,y:p+C}}function u(v){var y=e.map(e.range(d(v)+1),function(){return[]});return e.forEach(v.nodes(),function(b){var p=v.node(b),_=p.rank;e.isUndefined(_)||(y[_][p.order]=b)}),y}function c(v){var y=e.min(e.map(v.nodes(),function(b){return v.node(b).rank}));e.forEach(v.nodes(),function(b){var p=v.node(b);e.has(p,"rank")&&(p.rank-=y)})}function f(v){var y=e.min(e.map(v.nodes(),function(w){return v.node(w).rank})),b=[];e.forEach(v.nodes(),function(w){var x=v.node(w).rank-y;b[x]||(b[x]=[]),b[x].push(w)});var p=0,_=v.graph().nodeRankFactor;e.forEach(b,function(w,x){e.isUndefined(w)&&x%_!==0?--p:p&&e.forEach(w,function(E){v.node(E).rank+=p})})}function l(v,y,b,p){var _={width:0,height:0};return arguments.length>=4&&(_.rank=b,_.order=p),r(v,"border",_,y)}function d(v){return e.max(e.map(v.nodes(),function(y){var b=v.node(y).rank;if(!e.isUndefined(b))return b}))}function h(v,y){var b={lhs:[],rhs:[]};return e.forEach(v,function(p){y(p)?b.lhs.push(p):b.rhs.push(p)}),b}function g(v,y){var b=e.now();try{return y()}finally{console.log(v+" time: "+(e.now()-b)+"ms")}}function m(v,y){return y()}return yu}var mu,Wg;function QI(){if(Wg)return mu;Wg=1;var e=oe(),t=pe();mu={run:r,undo:i};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(o){n(a,o)})}function n(a,o){var s=o.v,u=a.node(s).rank,c=o.w,f=a.node(c).rank,l=o.name,d=a.edge(o),h=d.labelRank;if(f!==u+1){a.removeEdge(o);var g,m,v;for(v=0,++u;u<f;++v,++u)d.points=[],m={width:0,height:0,edgeLabel:d,edgeObj:o,rank:u},g=t.addDummyNode(a,"edge",m,"_d"),u===h&&(m.width=d.width,m.height=d.height,m.dummy="edge-label",m.labelpos=d.labelpos),a.setEdge(s,g,{weight:d.weight},l),v===0&&a.graph().dummyChains.push(g),s=g;a.setEdge(s,c,{weight:d.weight},l)}}function i(a){e.forEach(a.graph().dummyChains,function(o){var s=a.node(o),u=s.edgeLabel,c;for(a.setEdge(s.edgeObj,u);s.dummy;)c=a.successors(o)[0],a.removeNode(o),u.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(u.x=s.x,u.y=s.y,u.width=s.width,u.height=s.height),o=c,s=a.node(o)})}return mu}var _u,Xg;function Tr(){if(Xg)return _u;Xg=1;var e=oe();_u={longestPath:t,slack:r};function t(n){var i={};function a(o){var s=n.node(o);if(e.has(i,o))return s.rank;i[o]=!0;var u=e.min(e.map(n.outEdges(o),function(c){return a(c.w)-n.edge(c).minlen}));return(u===Number.POSITIVE_INFINITY||u===void 0||u===null)&&(u=0),s.rank=u}e.forEach(n.sources(),a)}function r(n,i){return n.node(i.w).rank-n.node(i.v).rank-n.edge(i).minlen}return _u}var bu,Kg;function t0(){if(Kg)return bu;Kg=1;var e=oe(),t=Ee().Graph,r=Tr().slack;bu=n;function n(s){var u=new t({directed:!1}),c=s.nodes()[0],f=s.nodeCount();u.setNode(c,{});for(var l,d;i(u,s)<f;)l=a(u,s),d=u.hasNode(l.v)?r(s,l):-r(s,l),o(u,s,d);return u}function i(s,u){function c(f){e.forEach(u.nodeEdges(f),function(l){var d=l.v,h=f===d?l.w:d;!s.hasNode(h)&&!r(u,l)&&(s.setNode(h,{}),s.setEdge(f,h,{}),c(h))})}return e.forEach(s.nodes(),c),s.nodeCount()}function a(s,u){return e.minBy(u.edges(),function(c){if(s.hasNode(c.v)!==s.hasNode(c.w))return r(u,c)})}function o(s,u,c){e.forEach(s.nodes(),function(f){u.node(f).rank+=c})}return bu}var wu,Zg;function JI(){if(Zg)return wu;Zg=1;var e=oe(),t=t0(),r=Tr().slack,n=Tr().longestPath,i=Ee().alg.preorder,a=Ee().alg.postorder,o=pe().simplify;wu=s,s.initLowLimValues=l,s.initCutValues=u,s.calcCutValue=f,s.leaveEdge=h,s.enterEdge=g,s.exchangeEdges=m;function s(p){p=o(p),n(p);var _=t(p);l(_),u(_,p);for(var w,x;w=h(_);)x=g(_,p,w),m(_,p,w,x)}function u(p,_){var w=a(p,p.nodes());w=w.slice(0,w.length-1),e.forEach(w,function(x){c(p,_,x)})}function c(p,_,w){var x=p.node(w),E=x.parent;p.edge(w,E).cutvalue=f(p,_,w)}function f(p,_,w){var x=p.node(w),E=x.parent,I=!0,C=_.edge(w,E),M=0;return C||(I=!1,C=_.edge(E,w)),M=C.weight,e.forEach(_.nodeEdges(w),function(q){var R=q.v===w,O=R?q.w:q.v;if(O!==E){var S=R===I,T=_.edge(q).weight;if(M+=S?T:-T,y(p,w,O)){var N=p.edge(w,O).cutvalue;M+=S?-N:N}}}),M}function l(p,_){arguments.length<2&&(_=p.nodes()[0]),d(p,{},1,_)}function d(p,_,w,x,E){var I=w,C=p.node(x);return _[x]=!0,e.forEach(p.neighbors(x),function(M){e.has(_,M)||(w=d(p,_,w,M,x))}),C.low=I,C.lim=w++,E?C.parent=E:delete C.parent,w}function h(p){return e.find(p.edges(),function(_){return p.edge(_).cutvalue<0})}function g(p,_,w){var x=w.v,E=w.w;_.hasEdge(x,E)||(x=w.w,E=w.v);var I=p.node(x),C=p.node(E),M=I,q=!1;I.lim>C.lim&&(M=C,q=!0);var R=e.filter(_.edges(),function(O){return q===b(p,p.node(O.v),M)&&q!==b(p,p.node(O.w),M)});return e.minBy(R,function(O){return r(_,O)})}function m(p,_,w,x){var E=w.v,I=w.w;p.removeEdge(E,I),p.setEdge(x.v,x.w,{}),l(p),u(p,_),v(p,_)}function v(p,_){var w=e.find(p.nodes(),function(E){return!_.node(E).parent}),x=i(p,w);x=x.slice(1),e.forEach(x,function(E){var I=p.node(E).parent,C=_.edge(E,I),M=!1;C||(C=_.edge(I,E),M=!0),_.node(E).rank=_.node(I).rank+(M?C.minlen:-C.minlen)})}function y(p,_,w){return p.hasEdge(_,w)}function b(p,_,w){return w.low<=_.lim&&_.lim<=w.lim}return wu}var xu,Qg;function eR(){if(Qg)return xu;Qg=1;var e=Tr(),t=e.longestPath,r=t0(),n=JI();xu=i;function i(u){switch(u.graph().ranker){case"network-simplex":s(u);break;case"tight-tree":o(u);break;case"longest-path":a(u);break;default:s(u)}}var a=t;function o(u){t(u),r(u)}function s(u){n(u)}return xu}var Eu,Jg;function tR(){if(Jg)return Eu;Jg=1;var e=oe();Eu=t;function t(i){var a=n(i);e.forEach(i.graph().dummyChains,function(o){for(var s=i.node(o),u=s.edgeObj,c=r(i,a,u.v,u.w),f=c.path,l=c.lca,d=0,h=f[d],g=!0;o!==u.w;){if(s=i.node(o),g){for(;(h=f[d])!==l&&i.node(h).maxRank<s.rank;)d++;h===l&&(g=!1)}if(!g){for(;d<f.length-1&&i.node(h=f[d+1]).minRank<=s.rank;)d++;h=f[d]}i.setParent(o,h),o=i.successors(o)[0]}})}function r(i,a,o,s){var u=[],c=[],f=Math.min(a[o].low,a[s].low),l=Math.max(a[o].lim,a[s].lim),d,h;d=o;do d=i.parent(d),u.push(d);while(d&&(a[d].low>f||l>a[d].lim));for(h=d,d=s;(d=i.parent(d))!==h;)c.push(d);return{path:u.concat(c.reverse()),lca:h}}function n(i){var a={},o=0;function s(u){var c=o;e.forEach(i.children(u),s),a[u]={low:c,lim:o++}}return e.forEach(i.children(),s),a}return Eu}var Su,ev;function rR(){if(ev)return Su;ev=1;var e=oe(),t=pe();Su={run:r,cleanup:o};function r(s){var u=t.addDummyNode(s,"root",{},"_root"),c=i(s),f=e.max(e.values(c))-1,l=2*f+1;s.graph().nestingRoot=u,e.forEach(s.edges(),function(h){s.edge(h).minlen*=l});var d=a(s)+1;e.forEach(s.children(),function(h){n(s,u,l,d,f,c,h)}),s.graph().nodeRankFactor=l}function n(s,u,c,f,l,d,h){var g=s.children(h);if(!g.length){h!==u&&s.setEdge(u,h,{weight:0,minlen:c});return}var m=t.addBorderNode(s,"_bt"),v=t.addBorderNode(s,"_bb"),y=s.node(h);s.setParent(m,h),y.borderTop=m,s.setParent(v,h),y.borderBottom=v,e.forEach(g,function(b){n(s,u,c,f,l,d,b);var p=s.node(b),_=p.borderTop?p.borderTop:b,w=p.borderBottom?p.borderBottom:b,x=p.borderTop?f:2*f,E=_!==w?1:l-d[h]+1;s.setEdge(m,_,{weight:x,minlen:E,nestingEdge:!0}),s.setEdge(w,v,{weight:x,minlen:E,nestingEdge:!0})}),s.parent(h)||s.setEdge(u,m,{weight:0,minlen:l+d[h]})}function i(s){var u={};function c(f,l){var d=s.children(f);d&&d.length&&e.forEach(d,function(h){c(h,l+1)}),u[f]=l}return e.forEach(s.children(),function(f){c(f,1)}),u}function a(s){return e.reduce(s.edges(),function(u,c){return u+s.edge(c).weight},0)}function o(s){var u=s.graph();s.removeNode(u.nestingRoot),delete u.nestingRoot,e.forEach(s.edges(),function(c){var f=s.edge(c);f.nestingEdge&&s.removeEdge(c)})}return Su}var qu,tv;function nR(){if(tv)return qu;tv=1;var e=oe(),t=pe();qu=r;function r(i){function a(o){var s=i.children(o),u=i.node(o);if(s.length&&e.forEach(s,a),e.has(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(var c=u.minRank,f=u.maxRank+1;c<f;++c)n(i,"borderLeft","_bl",o,u,c),n(i,"borderRight","_br",o,u,c)}}e.forEach(i.children(),a)}function n(i,a,o,s,u,c){var f={width:0,height:0,rank:c,borderType:a},l=u[a][c-1],d=t.addDummyNode(i,"border",f,o);u[a][c]=d,i.setParent(d,s),l&&i.setEdge(l,d,{weight:1})}return qu}var Cu,rv;function iR(){if(rv)return Cu;rv=1;var e=oe();Cu={adjust:t,undo:r};function t(c){var f=c.graph().rankdir.toLowerCase();(f==="lr"||f==="rl")&&n(c)}function r(c){var f=c.graph().rankdir.toLowerCase();(f==="bt"||f==="rl")&&a(c),(f==="lr"||f==="rl")&&(s(c),n(c))}function n(c){e.forEach(c.nodes(),function(f){i(c.node(f))}),e.forEach(c.edges(),function(f){i(c.edge(f))})}function i(c){var f=c.width;c.width=c.height,c.height=f}function a(c){e.forEach(c.nodes(),function(f){o(c.node(f))}),e.forEach(c.edges(),function(f){var l=c.edge(f);e.forEach(l.points,o),e.has(l,"y")&&o(l)})}function o(c){c.y=-c.y}function s(c){e.forEach(c.nodes(),function(f){u(c.node(f))}),e.forEach(c.edges(),function(f){var l=c.edge(f);e.forEach(l.points,u),e.has(l,"x")&&u(l)})}function u(c){var f=c.x;c.x=c.y,c.y=f}return Cu}var Iu,nv;function aR(){if(nv)return Iu;nv=1;var e=oe();Iu=t;function t(r){var n={},i=e.filter(r.nodes(),function(c){return!r.children(c).length}),a=e.max(e.map(i,function(c){return r.node(c).rank})),o=e.map(e.range(a+1),function(){return[]});function s(c){if(!e.has(n,c)){n[c]=!0;var f=r.node(c);o[f.rank].push(c),e.forEach(r.successors(c),s)}}var u=e.sortBy(i,function(c){return r.node(c).rank});return e.forEach(u,s),o}return Iu}var Ru,iv;function oR(){if(iv)return Ru;iv=1;var e=oe();Ru=t;function t(n,i){for(var a=0,o=1;o<i.length;++o)a+=r(n,i[o-1],i[o]);return a}function r(n,i,a){for(var o=e.zipObject(a,e.map(a,function(d,h){return h})),s=e.flatten(e.map(i,function(d){return e.sortBy(e.map(n.outEdges(d),function(h){return{pos:o[h.w],weight:n.edge(h).weight}}),"pos")}),!0),u=1;u<a.length;)u<<=1;var c=2*u-1;u-=1;var f=e.map(new Array(c),function(){return 0}),l=0;return e.forEach(s.forEach(function(d){var h=d.pos+u;f[h]+=d.weight;for(var g=0;h>0;)h%2&&(g+=f[h+1]),h=h-1>>1,f[h]+=d.weight;l+=d.weight*g})),l}return Ru}var Au,av;function sR(){if(av)return Au;av=1;var e=oe();Au=t;function t(r,n){return e.map(n,function(i){var a=r.inEdges(i);if(a.length){var o=e.reduce(a,function(s,u){var c=r.edge(u),f=r.node(u.v);return{sum:s.sum+c.weight*f.order,weight:s.weight+c.weight}},{sum:0,weight:0});return{v:i,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:i}})}return Au}var Nu,ov;function uR(){if(ov)return Nu;ov=1;var e=oe();Nu=t;function t(i,a){var o={};e.forEach(i,function(u,c){var f=o[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:c};e.isUndefined(u.barycenter)||(f.barycenter=u.barycenter,f.weight=u.weight)}),e.forEach(a.edges(),function(u){var c=o[u.v],f=o[u.w];!e.isUndefined(c)&&!e.isUndefined(f)&&(f.indegree++,c.out.push(o[u.w]))});var s=e.filter(o,function(u){return!u.indegree});return r(s)}function r(i){var a=[];function o(c){return function(f){f.merged||(e.isUndefined(f.barycenter)||e.isUndefined(c.barycenter)||f.barycenter>=c.barycenter)&&n(c,f)}}function s(c){return function(f){f.in.push(c),--f.indegree===0&&i.push(f)}}for(;i.length;){var u=i.pop();a.push(u),e.forEach(u.in.reverse(),o(u)),e.forEach(u.out,s(u))}return e.map(e.filter(a,function(c){return!c.merged}),function(c){return e.pick(c,["vs","i","barycenter","weight"])})}function n(i,a){var o=0,s=0;i.weight&&(o+=i.barycenter*i.weight,s+=i.weight),a.weight&&(o+=a.barycenter*a.weight,s+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=o/s,i.weight=s,i.i=Math.min(a.i,i.i),a.merged=!0}return Nu}var Mu,sv;function cR(){if(sv)return Mu;sv=1;var e=oe(),t=pe();Mu=r;function r(a,o){var s=t.partition(a,function(m){return e.has(m,"barycenter")}),u=s.lhs,c=e.sortBy(s.rhs,function(m){return-m.i}),f=[],l=0,d=0,h=0;u.sort(i(!!o)),h=n(f,c,h),e.forEach(u,function(m){h+=m.vs.length,f.push(m.vs),l+=m.barycenter*m.weight,d+=m.weight,h=n(f,c,h)});var g={vs:e.flatten(f,!0)};return d&&(g.barycenter=l/d,g.weight=d),g}function n(a,o,s){for(var u;o.length&&(u=e.last(o)).i<=s;)o.pop(),a.push(u.vs),s++;return s}function i(a){return function(o,s){return o.barycenter<s.barycenter?-1:o.barycenter>s.barycenter?1:a?s.i-o.i:o.i-s.i}}return Mu}var Tu,uv;function fR(){if(uv)return Tu;uv=1;var e=oe(),t=sR(),r=uR(),n=cR();Tu=i;function i(s,u,c,f){var l=s.children(u),d=s.node(u),h=d?d.borderLeft:void 0,g=d?d.borderRight:void 0,m={};h&&(l=e.filter(l,function(w){return w!==h&&w!==g}));var v=t(s,l);e.forEach(v,function(w){if(s.children(w.v).length){var x=i(s,w.v,c,f);m[w.v]=x,e.has(x,"barycenter")&&o(w,x)}});var y=r(v,c);a(y,m);var b=n(y,f);if(h&&(b.vs=e.flatten([h,b.vs,g],!0),s.predecessors(h).length)){var p=s.node(s.predecessors(h)[0]),_=s.node(s.predecessors(g)[0]);e.has(b,"barycenter")||(b.barycenter=0,b.weight=0),b.barycenter=(b.barycenter*b.weight+p.order+_.order)/(b.weight+2),b.weight+=2}return b}function a(s,u){e.forEach(s,function(c){c.vs=e.flatten(c.vs.map(function(f){return u[f]?u[f].vs:f}),!0)})}function o(s,u){e.isUndefined(s.barycenter)?(s.barycenter=u.barycenter,s.weight=u.weight):(s.barycenter=(s.barycenter*s.weight+u.barycenter*u.weight)/(s.weight+u.weight),s.weight+=u.weight)}return Tu}var Pu,cv;function lR(){if(cv)return Pu;cv=1;var e=oe(),t=Ee().Graph;Pu=r;function r(i,a,o){var s=n(i),u=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(function(c){return i.node(c)});return e.forEach(i.nodes(),function(c){var f=i.node(c),l=i.parent(c);(f.rank===a||f.minRank<=a&&a<=f.maxRank)&&(u.setNode(c),u.setParent(c,l||s),e.forEach(i[o](c),function(d){var h=d.v===c?d.w:d.v,g=u.edge(h,c),m=e.isUndefined(g)?0:g.weight;u.setEdge(h,c,{weight:i.edge(d).weight+m})}),e.has(f,"minRank")&&u.setNode(c,{borderLeft:f.borderLeft[a],borderRight:f.borderRight[a]}))}),u}function n(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return Pu}var ku,fv;function dR(){if(fv)return ku;fv=1;var e=oe();ku=t;function t(r,n,i){var a={},o;e.forEach(i,function(s){for(var u=r.parent(s),c,f;u;){if(c=r.parent(u),c?(f=a[c],a[c]=u):(f=o,o=u),f&&f!==u){n.setEdge(f,u);return}u=c}})}return ku}var Ou,lv;function hR(){if(lv)return Ou;lv=1;var e=oe(),t=aR(),r=oR(),n=fR(),i=lR(),a=dR(),o=Ee().Graph,s=pe();Ou=u;function u(d){var h=s.maxRank(d),g=c(d,e.range(1,h+1),"inEdges"),m=c(d,e.range(h-1,-1,-1),"outEdges"),v=t(d);l(d,v);for(var y=Number.POSITIVE_INFINITY,b,p=0,_=0;_<4;++p,++_){f(p%2?g:m,p%4>=2),v=s.buildLayerMatrix(d);var w=r(d,v);w<y&&(_=0,b=e.cloneDeep(v),y=w)}l(d,b)}function c(d,h,g){return e.map(h,function(m){return i(d,m,g)})}function f(d,h){var g=new o;e.forEach(d,function(m){var v=m.graph().root,y=n(m,v,g,h);e.forEach(y.vs,function(b,p){m.node(b).order=p}),a(m,g,y.vs)})}function l(d,h){e.forEach(h,function(g){e.forEach(g,function(m,v){d.node(m).order=v})})}return Ou}var Lu,dv;function pR(){if(dv)return Lu;dv=1;var e=oe(),t=Ee().Graph,r=pe();Lu={positionX:g,findType1Conflicts:n,findType2Conflicts:i,addConflict:o,hasConflict:s,verticalAlignment:u,horizontalCompaction:c,alignCoordinates:d,findSmallestWidthAlignment:l,balance:h};function n(y,b){var p={};function _(w,x){var E=0,I=0,C=w.length,M=e.last(x);return e.forEach(x,function(q,R){var O=a(y,q),S=O?y.node(O).order:C;(O||q===M)&&(e.forEach(x.slice(I,R+1),function(T){e.forEach(y.predecessors(T),function(N){var D=y.node(N),k=D.order;(k<E||S<k)&&!(D.dummy&&y.node(T).dummy)&&o(p,N,T)})}),I=R+1,E=S)}),x}return e.reduce(b,_),p}function i(y,b){var p={};function _(x,E,I,C,M){var q;e.forEach(e.range(E,I),function(R){q=x[R],y.node(q).dummy&&e.forEach(y.predecessors(q),function(O){var S=y.node(O);S.dummy&&(S.order<C||S.order>M)&&o(p,O,q)})})}function w(x,E){var I=-1,C,M=0;return e.forEach(E,function(q,R){if(y.node(q).dummy==="border"){var O=y.predecessors(q);O.length&&(C=y.node(O[0]).order,_(E,M,R,I,C),M=R,I=C)}_(E,M,E.length,C,x.length)}),E}return e.reduce(b,w),p}function a(y,b){if(y.node(b).dummy)return e.find(y.predecessors(b),function(p){return y.node(p).dummy})}function o(y,b,p){if(b>p){var _=b;b=p,p=_}var w=y[b];w||(y[b]=w={}),w[p]=!0}function s(y,b,p){if(b>p){var _=b;b=p,p=_}return e.has(y[b],p)}function u(y,b,p,_){var w={},x={},E={};return e.forEach(b,function(I){e.forEach(I,function(C,M){w[C]=C,x[C]=C,E[C]=M})}),e.forEach(b,function(I){var C=-1;e.forEach(I,function(M){var q=_(M);if(q.length){q=e.sortBy(q,function(N){return E[N]});for(var R=(q.length-1)/2,O=Math.floor(R),S=Math.ceil(R);O<=S;++O){var T=q[O];x[M]===M&&C<E[T]&&!s(p,M,T)&&(x[T]=M,x[M]=w[M]=w[T],C=E[T])}}})}),{root:w,align:x}}function c(y,b,p,_,w){var x={},E=f(y,b,p,w),I=w?"borderLeft":"borderRight";function C(R,O){for(var S=E.nodes(),T=S.pop(),N={};T;)N[T]?R(T):(N[T]=!0,S.push(T),S=S.concat(O(T))),T=S.pop()}function M(R){x[R]=E.inEdges(R).reduce(function(O,S){return Math.max(O,x[S.v]+E.edge(S))},0)}function q(R){var O=E.outEdges(R).reduce(function(T,N){return Math.min(T,x[N.w]-E.edge(N))},Number.POSITIVE_INFINITY),S=y.node(R);O!==Number.POSITIVE_INFINITY&&S.borderType!==I&&(x[R]=Math.max(x[R],O))}return C(M,E.predecessors.bind(E)),C(q,E.successors.bind(E)),e.forEach(_,function(R){x[R]=x[p[R]]}),x}function f(y,b,p,_){var w=new t,x=y.graph(),E=m(x.nodesep,x.edgesep,_);return e.forEach(b,function(I){var C;e.forEach(I,function(M){var q=p[M];if(w.setNode(q),C){var R=p[C],O=w.edge(R,q);w.setEdge(R,q,Math.max(E(y,M,C),O||0))}C=M})}),w}function l(y,b){return e.minBy(e.values(b),function(p){var _=Number.NEGATIVE_INFINITY,w=Number.POSITIVE_INFINITY;return e.forIn(p,function(x,E){var I=v(y,E)/2;_=Math.max(x+I,_),w=Math.min(x-I,w)}),_-w})}function d(y,b){var p=e.values(b),_=e.min(p),w=e.max(p);e.forEach(["u","d"],function(x){e.forEach(["l","r"],function(E){var I=x+E,C=y[I],M;if(C!==b){var q=e.values(C);M=E==="l"?_-e.min(q):w-e.max(q),M&&(y[I]=e.mapValues(C,function(R){return R+M}))}})})}function h(y,b){return e.mapValues(y.ul,function(p,_){if(b)return y[b.toLowerCase()][_];var w=e.sortBy(e.map(y,_));return(w[1]+w[2])/2})}function g(y){var b=r.buildLayerMatrix(y),p=e.merge(n(y,b),i(y,b)),_={},w;e.forEach(["u","d"],function(E){w=E==="u"?b:e.values(b).reverse(),e.forEach(["l","r"],function(I){I==="r"&&(w=e.map(w,function(R){return e.values(R).reverse()}));var C=(E==="u"?y.predecessors:y.successors).bind(y),M=u(y,w,p,C),q=c(y,w,M.root,M.align,I==="r");I==="r"&&(q=e.mapValues(q,function(R){return-R})),_[E+I]=q})});var x=l(y,_);return d(_,x),h(_,y.graph().align)}function m(y,b,p){return function(_,w,x){var E=_.node(w),I=_.node(x),C=0,M;if(C+=E.width/2,e.has(E,"labelpos"))switch(E.labelpos.toLowerCase()){case"l":M=-E.width/2;break;case"r":M=E.width/2;break}if(M&&(C+=p?M:-M),M=0,C+=(E.dummy?b:y)/2,C+=(I.dummy?b:y)/2,C+=I.width/2,e.has(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":M=I.width/2;break;case"r":M=-I.width/2;break}return M&&(C+=p?M:-M),M=0,C}}function v(y,b){return y.node(b).width}return Lu}var Du,hv;function gR(){if(hv)return Du;hv=1;var e=oe(),t=pe(),r=pR().positionX;Du=n;function n(a){a=t.asNonCompoundGraph(a),i(a),e.forEach(r(a),function(o,s){a.node(s).x=o})}function i(a){var o=t.buildLayerMatrix(a),s=a.graph().ranksep,u=0;e.forEach(o,function(c){var f=e.max(e.map(c,function(l){return a.node(l).height}));e.forEach(c,function(l){a.node(l).y=u+f/2}),u+=f+s})}return Du}var Fu,pv;function vR(){if(pv)return Fu;pv=1;var e=oe(),t=ZI(),r=QI(),n=eR(),i=pe().normalizeRanks,a=tR(),o=pe().removeEmptyRanks,s=rR(),u=nR(),c=iR(),f=hR(),l=gR(),d=pe(),h=Ee().Graph;Fu=g;function g(A,L){var F=L&&L.debugTiming?d.time:d.notime;F("layout",function(){var z=F(" buildLayoutGraph",function(){return C(A)});F(" runLayout",function(){m(z,F)}),F(" updateInputGraph",function(){v(A,z)})})}function m(A,L){L(" makeSpaceForEdgeLabels",function(){M(A)}),L(" removeSelfEdges",function(){P(A)}),L(" acyclic",function(){t.run(A)}),L(" nestingGraph.run",function(){s.run(A)}),L(" rank",function(){n(d.asNonCompoundGraph(A))}),L(" injectEdgeLabelProxies",function(){q(A)}),L(" removeEmptyRanks",function(){o(A)}),L(" nestingGraph.cleanup",function(){s.cleanup(A)}),L(" normalizeRanks",function(){i(A)}),L(" assignRankMinMax",function(){R(A)}),L(" removeEdgeLabelProxies",function(){O(A)}),L(" normalize.run",function(){r.run(A)}),L(" parentDummyChains",function(){a(A)}),L(" addBorderSegments",function(){u(A)}),L(" order",function(){f(A)}),L(" insertSelfEdges",function(){H(A)}),L(" adjustCoordinateSystem",function(){c.adjust(A)}),L(" position",function(){l(A)}),L(" positionSelfEdges",function(){G(A)}),L(" removeBorderNodes",function(){k(A)}),L(" normalize.undo",function(){r.undo(A)}),L(" fixupEdgeLabelCoords",function(){N(A)}),L(" undoCoordinateSystem",function(){c.undo(A)}),L(" translateGraph",function(){S(A)}),L(" assignNodeIntersects",function(){T(A)}),L(" reversePoints",function(){D(A)}),L(" acyclic.undo",function(){t.undo(A)})}function v(A,L){e.forEach(A.nodes(),function(F){var z=A.node(F),B=L.node(F);z&&(z.x=B.x,z.y=B.y,L.children(F).length&&(z.width=B.width,z.height=B.height))}),e.forEach(A.edges(),function(F){var z=A.edge(F),B=L.edge(F);z.points=B.points,e.has(B,"x")&&(z.x=B.x,z.y=B.y)}),A.graph().width=L.graph().width,A.graph().height=L.graph().height}var y=["nodesep","edgesep","ranksep","marginx","marginy"],b={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},p=["acyclicer","ranker","rankdir","align"],_=["width","height"],w={width:0,height:0},x=["minlen","weight","width","height","labeloffset"],E={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},I=["labelpos"];function C(A){var L=new h({multigraph:!0,compound:!0}),F=Y(A.graph());return L.setGraph(e.merge({},b,V(F,y),e.pick(F,p))),e.forEach(A.nodes(),function(z){var B=Y(A.node(z));L.setNode(z,e.defaults(V(B,_),w)),L.setParent(z,A.parent(z))}),e.forEach(A.edges(),function(z){var B=Y(A.edge(z));L.setEdge(z,e.merge({},E,V(B,x),e.pick(B,I)))}),L}function M(A){var L=A.graph();L.ranksep/=2,e.forEach(A.edges(),function(F){var z=A.edge(F);z.minlen*=2,z.labelpos.toLowerCase()!=="c"&&(L.rankdir==="TB"||L.rankdir==="BT"?z.width+=z.labeloffset:z.height+=z.labeloffset)})}function q(A){e.forEach(A.edges(),function(L){var F=A.edge(L);if(F.width&&F.height){var z=A.node(L.v),B=A.node(L.w),U={rank:(B.rank-z.rank)/2+z.rank,e:L};d.addDummyNode(A,"edge-proxy",U,"_ep")}})}function R(A){var L=0;e.forEach(A.nodes(),function(F){var z=A.node(F);z.borderTop&&(z.minRank=A.node(z.borderTop).rank,z.maxRank=A.node(z.borderBottom).rank,L=e.max(L,z.maxRank))}),A.graph().maxRank=L}function O(A){e.forEach(A.nodes(),function(L){var F=A.node(L);F.dummy==="edge-proxy"&&(A.edge(F.e).labelRank=F.rank,A.removeNode(L))})}function S(A){var L=Number.POSITIVE_INFINITY,F=0,z=Number.POSITIVE_INFINITY,B=0,U=A.graph(),X=U.marginx||0,K=U.marginy||0;function J(W){var te=W.x,Z=W.y,re=W.width,ee=W.height;L=Math.min(L,te-re/2),F=Math.max(F,te+re/2),z=Math.min(z,Z-ee/2),B=Math.max(B,Z+ee/2)}e.forEach(A.nodes(),function(W){J(A.node(W))}),e.forEach(A.edges(),function(W){var te=A.edge(W);e.has(te,"x")&&J(te)}),L-=X,z-=K,e.forEach(A.nodes(),function(W){var te=A.node(W);te.x-=L,te.y-=z}),e.forEach(A.edges(),function(W){var te=A.edge(W);e.forEach(te.points,function(Z){Z.x-=L,Z.y-=z}),e.has(te,"x")&&(te.x-=L),e.has(te,"y")&&(te.y-=z)}),U.width=F-L+X,U.height=B-z+K}function T(A){e.forEach(A.edges(),function(L){var F=A.edge(L),z=A.node(L.v),B=A.node(L.w),U,X;F.points?(U=F.points[0],X=F.points[F.points.length-1]):(F.points=[],U=B,X=z),F.points.unshift(d.intersectRect(z,U)),F.points.push(d.intersectRect(B,X))})}function N(A){e.forEach(A.edges(),function(L){var F=A.edge(L);if(e.has(F,"x"))switch((F.labelpos==="l"||F.labelpos==="r")&&(F.width-=F.labeloffset),F.labelpos){case"l":F.x-=F.width/2+F.labeloffset;break;case"r":F.x+=F.width/2+F.labeloffset;break}})}function D(A){e.forEach(A.edges(),function(L){var F=A.edge(L);F.reversed&&F.points.reverse()})}function k(A){e.forEach(A.nodes(),function(L){if(A.children(L).length){var F=A.node(L),z=A.node(F.borderTop),B=A.node(F.borderBottom),U=A.node(e.last(F.borderLeft)),X=A.node(e.last(F.borderRight));F.width=Math.abs(X.x-U.x),F.height=Math.abs(B.y-z.y),F.x=U.x+F.width/2,F.y=z.y+F.height/2}}),e.forEach(A.nodes(),function(L){A.node(L).dummy==="border"&&A.removeNode(L)})}function P(A){e.forEach(A.edges(),function(L){if(L.v===L.w){var F=A.node(L.v);F.selfEdges||(F.selfEdges=[]),F.selfEdges.push({e:L,label:A.edge(L)}),A.removeEdge(L)}})}function H(A){var L=d.buildLayerMatrix(A);e.forEach(L,function(F){var z=0;e.forEach(F,function(B,U){var X=A.node(B);X.order=U+z,e.forEach(X.selfEdges,function(K){d.addDummyNode(A,"selfedge",{width:K.label.width,height:K.label.height,rank:X.rank,order:U+ ++z,e:K.e,label:K.label},"_se")}),delete X.selfEdges})})}function G(A){e.forEach(A.nodes(),function(L){var F=A.node(L);if(F.dummy==="selfedge"){var z=A.node(F.e.v),B=z.x+z.width/2,U=z.y,X=F.x-B,K=z.height/2;A.setEdge(F.e,F.label),A.removeNode(L),F.label.points=[{x:B+2*X/3,y:U-K},{x:B+5*X/6,y:U-K},{x:B+X,y:U},{x:B+5*X/6,y:U+K},{x:B+2*X/3,y:U+K}],F.label.x=F.x,F.label.y=F.y}})}function V(A,L){return e.mapValues(e.pick(A,L),Number)}function Y(A){var L={};return e.forEach(A,function(F,z){L[z.toLowerCase()]=F}),L}return Fu}var $u,gv;function yR(){if(gv)return $u;gv=1;var e=oe(),t=pe(),r=Ee().Graph;$u={debugOrdering:n};function n(i){var a=t.buildLayerMatrix(i),o=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(s){o.setNode(s,{label:s}),o.setParent(s,"layer"+i.node(s).rank)}),e.forEach(i.edges(),function(s){o.setEdge(s.v,s.w,{},s.name)}),e.forEach(a,function(s,u){var c="layer"+u;o.setNode(c,{rank:"same"}),e.reduce(s,function(f,l){return o.setEdge(f,l,{style:"invis"}),l})}),o}return $u}var ju,vv;function mR(){return vv||(vv=1,ju="0.8.5"),ju}var zu,yv;function IR(){return yv||(yv=1,zu={graphlib:Ee(),layout:vR(),debug:yR(),util:{time:pe().time,notime:pe().notime},version:mR()}),zu}export{$_ as A,ue as B,Ur as C,dw as D,vw as E,q_ as F,IR as G,ER as H,SR as I,qR as J,Nr as K,CR as M,Q as P,N_ as a,Gt as b,ye as c,at as d,Me as e,M_ as f,wv as g,ze as h,db as i,Eb as j,Sb as k,Ib as l,Re as m,pt as n,wR as o,xR as p,iw as q,A_ as r,aw as s,lc as t,Zv as u,Pv as v,ow as w,uw as x,lw as y,Vr as z};
|