@lunora/studio 1.0.0-alpha.338 → 1.0.0-alpha.339

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/standalone/{chunk-HC6E6BIJ.js → chunk-2SNK7KHX.js} +1 -1
  2. package/dist/standalone/{chunk-GABRCO5N.js → chunk-3FYMEXVB.js} +1 -1
  3. package/dist/standalone/{chunk-Q5CSRWLU.js → chunk-3N5PRV3V.js} +1 -1
  4. package/dist/standalone/{chunk-BCGCD4CO.js → chunk-43GV7LQK.js} +1 -1
  5. package/dist/standalone/{chunk-YXW7GATV.js → chunk-4NOMAGEO.js} +1 -1
  6. package/dist/standalone/{chunk-OYDOFRRB.js → chunk-5SLTDY4C.js} +1 -1
  7. package/dist/standalone/{chunk-AHQIBM3C.js → chunk-5Y5UTG4N.js} +1 -1
  8. package/dist/standalone/{chunk-VVB3GENM.js → chunk-6XKL22OG.js} +2 -2
  9. package/dist/standalone/{chunk-7VF6QXGR.js → chunk-6ZSIPBTC.js} +1 -1
  10. package/dist/standalone/{chunk-7LPVTOAF.js → chunk-7GVT36VI.js} +1 -1
  11. package/dist/standalone/{chunk-GNX7VKQY.js → chunk-APEQELK3.js} +1 -1
  12. package/dist/standalone/{chunk-DW67E5WI.js → chunk-BFQMOALO.js} +1 -1
  13. package/dist/standalone/{chunk-QZFWP5PG.js → chunk-BTG6YDYM.js} +1 -1
  14. package/dist/standalone/{chunk-DXC6YGNT.js → chunk-BTQ72TPT.js} +1 -1
  15. package/dist/standalone/{chunk-STF2OPKL.js → chunk-DBHZXRL6.js} +1 -1
  16. package/dist/standalone/{chunk-YI7WVSMX.js → chunk-DBZ4TBP5.js} +1 -1
  17. package/dist/standalone/{chunk-Z277L2BQ.js → chunk-DEFCA7GG.js} +1 -1
  18. package/dist/standalone/{chunk-NWWMHMGA.js → chunk-DHGPCQ2F.js} +1 -1
  19. package/dist/standalone/{chunk-O75FH2VA.js → chunk-E5DXYVPB.js} +1 -1
  20. package/dist/standalone/{chunk-G5DO7HSE.js → chunk-EE227HDE.js} +1 -1
  21. package/dist/standalone/{chunk-CG7AWLQB.js → chunk-ENIA26XP.js} +1 -1
  22. package/dist/standalone/{chunk-H4BEW5RF.js → chunk-FCXFQF2W.js} +1 -1
  23. package/dist/standalone/{chunk-JIWDKEGI.js → chunk-FUL4ROKH.js} +1 -1
  24. package/dist/standalone/{chunk-RZAWVHB7.js → chunk-G2F22AMT.js} +1 -1
  25. package/dist/standalone/{chunk-ROX3SLF7.js → chunk-GC4XRCRZ.js} +1 -1
  26. package/dist/standalone/{chunk-4KMJQGIN.js → chunk-GOFZ4Y74.js} +1 -1
  27. package/dist/standalone/{chunk-7WWDCRLQ.js → chunk-GWVYDOBH.js} +1 -1
  28. package/dist/standalone/{chunk-KRSOII6O.js → chunk-GYBCO7NN.js} +1 -1
  29. package/dist/standalone/{chunk-UQJRKAQX.js → chunk-HCFJBY65.js} +1 -1
  30. package/dist/standalone/{chunk-V65TMRRH.js → chunk-HGHIVU76.js} +1 -1
  31. package/dist/standalone/{chunk-5NCDYUAL.js → chunk-HH52IEFY.js} +1 -1
  32. package/dist/standalone/{chunk-W77PDXGW.js → chunk-HPYJUVCC.js} +1 -1
  33. package/dist/standalone/{chunk-YJ5SU2PD.js → chunk-ICRKYAYO.js} +1 -1
  34. package/dist/standalone/{chunk-LXQGF74P.js → chunk-IRSSZXC3.js} +1 -1
  35. package/dist/standalone/{chunk-VVRT5OAX.js → chunk-ITT6MM23.js} +1 -1
  36. package/dist/standalone/{chunk-VVGQZR53.js → chunk-JR4ROUBB.js} +1 -1
  37. package/dist/standalone/{chunk-H6MI6GGH.js → chunk-K3UAOIR7.js} +1 -1
  38. package/dist/standalone/{chunk-6LNSHLOB.js → chunk-KCFO2BVI.js} +1 -1
  39. package/dist/standalone/{chunk-G2YF7RNG.js → chunk-KF7Y5S5O.js} +1 -1
  40. package/dist/standalone/{chunk-EJ7YAEPM.js → chunk-LHG2JVIM.js} +1 -1
  41. package/dist/standalone/{chunk-BAWEGZ7T.js → chunk-M3QKMHAP.js} +1 -1
  42. package/dist/standalone/{chunk-QYLNHUWI.js → chunk-NCBLHBRW.js} +1 -1
  43. package/dist/standalone/chunk-NCCORPSU.js +7 -0
  44. package/dist/standalone/{chunk-UEHILSMN.js → chunk-O2FW4VRL.js} +1 -1
  45. package/dist/standalone/{chunk-NQZ5IJWF.js → chunk-OI5HX3ZO.js} +1 -1
  46. package/dist/standalone/{chunk-XSW4R2MI.js → chunk-OLIKYC3C.js} +1 -1
  47. package/dist/standalone/{chunk-MFUYHLXW.js → chunk-R3ADWOYR.js} +1 -1
  48. package/dist/standalone/{chunk-WYP2Z35M.js → chunk-RB3WPSY5.js} +1 -1
  49. package/dist/standalone/{chunk-3DNOCE5K.js → chunk-SC6P4M3S.js} +1 -1
  50. package/dist/standalone/{chunk-YGV4V7VT.js → chunk-SU6QNITV.js} +1 -1
  51. package/dist/standalone/{chunk-VTLEHQAN.js → chunk-T6IV7OKH.js} +1 -1
  52. package/dist/standalone/{chunk-LVNRJL4S.js → chunk-UIIKW4II.js} +1 -1
  53. package/dist/standalone/{chunk-2JD6VLW7.js → chunk-UJQNKTYE.js} +1 -1
  54. package/dist/standalone/{chunk-5B4SQYIP.js → chunk-UVL7N5IL.js} +1 -1
  55. package/dist/standalone/{chunk-GDD7FNZA.js → chunk-VENSZ6LF.js} +1 -1
  56. package/dist/standalone/{chunk-4ZISAQ2B.js → chunk-VJ7RCBJ7.js} +1 -1
  57. package/dist/standalone/{chunk-2OOWQRI5.js → chunk-VNMKNORK.js} +1 -1
  58. package/dist/standalone/{chunk-CMVOO3MU.js → chunk-VVCXVAA7.js} +1 -1
  59. package/dist/standalone/{chunk-EFT6JH6H.js → chunk-VXJJSPX3.js} +1 -1
  60. package/dist/standalone/{chunk-CHYVUB6Y.js → chunk-WUI2PUY6.js} +1 -1
  61. package/dist/standalone/{chunk-3FRBAQI7.js → chunk-WVYIBXUH.js} +1 -1
  62. package/dist/standalone/{chunk-SKTCA3PL.js → chunk-XBQ66PGW.js} +1 -1
  63. package/dist/standalone/{chunk-LQM7KUEA.js → chunk-YZ72ZAGX.js} +1 -1
  64. package/dist/standalone/{chunk-M27YVZWM.js → chunk-ZJQIGWLG.js} +1 -1
  65. package/dist/standalone/{chunk-OPXOPRI2.js → chunk-ZKV2XC5B.js} +1 -1
  66. package/dist/standalone/{chunk-TNXRQCSI.js → chunk-ZPNTFCVI.js} +1 -1
  67. package/dist/standalone/studio.js +1 -1
  68. package/package.json +5 -5
  69. package/dist/standalone/chunk-3JVXNEBO.js +0 -7
@@ -1,4 +1,4 @@
1
- import{a as bi,b as Si,c as Ei,f as un}from"./chunk-NQZALRU3.js";import{e as hi,k as pi}from"./chunk-GHQ2VDI2.js";import{a as ro,b as io,c as mi,d as yi,e as ln,g as wi,h as xi,i as ct}from"./chunk-AUGKHAMQ.js";import{b as xl}from"./chunk-SJQERRSZ.js";import{a as wl}from"./chunk-7Y3SY37W.js";import{d as ui}from"./chunk-BAWEGZ7T.js";import{d as fi,h as gi,q as oo}from"./chunk-74IYYDDI.js";import{a as o,d as Ke,e as no,g as di}from"./chunk-I26MS5PJ.js";var bl={value:o(()=>{},"value")};function Ci(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new dn(n)}o(Ci,"dispatch");function dn(e){this._=e}o(dn,"Dispatch");function Sl(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}o(Sl,"parseTypenames");dn.prototype=Ci.prototype={constructor:dn,on:o(function(e,t){var n=this._,r=Sl(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=El(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(i=(e=r[s]).type)n[i]=vi(n[i],e.name,t);else if(t==null)for(i in n)n[i]=vi(n[i],e.name,null);return this},"on"),copy:o(function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new dn(e)},"copy"),call:o(function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},"call"),apply:o(function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)},"apply")};function El(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}o(El,"get");function vi(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=bl,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}o(vi,"set");var Qe=Ci;var fn="http://www.w3.org/1999/xhtml",so={svg:"http://www.w3.org/2000/svg",xhtml:fn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ne(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),so.hasOwnProperty(t)?{space:so[t],local:e}:e}o(Ne,"default");function vl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===fn&&t.documentElement.namespaceURI===fn?t.createElement(e):t.createElementNS(n,e)}}o(vl,"creatorInherit");function Cl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}o(Cl,"creatorFixed");function Dt(e){var t=Ne(e);return(t.local?Cl:vl)(t)}o(Dt,"default");function _l(){}o(_l,"none");function $e(e){return e==null?_l:function(){return this.querySelector(e)}}o($e,"default");function ao(e){typeof e!="function"&&(e=$e(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,c=r[i]=new Array(a),l,u,d=0;d<a;++d)(l=s[d])&&(u=e.call(l,l.__data__,d,s))&&("__data__"in l&&(u.__data__=l.__data__),c[d]=u);return new se(r,this._parents)}o(ao,"default");function co(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}o(co,"array");function Nl(){return[]}o(Nl,"empty");function lt(e){return e==null?Nl:function(){return this.querySelectorAll(e)}}o(lt,"default");function Ml(e){return function(){return co(e.apply(this,arguments))}}o(Ml,"arrayAll");function lo(e){typeof e=="function"?e=Ml(e):e=lt(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var a=t[s],c=a.length,l,u=0;u<c;++u)(l=a[u])&&(r.push(e.call(l,l.__data__,u,a)),i.push(l));return new se(r,i)}o(lo,"default");function ut(e){return function(){return this.matches(e)}}o(ut,"default");function hn(e){return function(t){return t.matches(e)}}o(hn,"childMatcher");var Il=Array.prototype.find;function Pl(e){return function(){return Il.call(this.children,e)}}o(Pl,"childFind");function kl(){return this.firstElementChild}o(kl,"childFirst");function uo(e){return this.select(e==null?kl:Pl(typeof e=="function"?e:hn(e)))}o(uo,"default");var Al=Array.prototype.filter;function Dl(){return Array.from(this.children)}o(Dl,"children");function Tl(e){return function(){return Al.call(this.children,e)}}o(Tl,"childrenFilter");function fo(e){return this.selectAll(e==null?Dl:Tl(typeof e=="function"?e:hn(e)))}o(fo,"default");function ho(e){typeof e!="function"&&(e=ut(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,c=r[i]=[],l,u=0;u<a;++u)(l=s[u])&&e.call(l,l.__data__,u,s)&&c.push(l);return new se(r,this._parents)}o(ho,"default");function Tt(e){return new Array(e.length)}o(Tt,"default");function po(){return new se(this._enter||this._groups.map(Tt),this._parents)}o(po,"default");function Rt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}o(Rt,"EnterNode");Rt.prototype={constructor:Rt,appendChild:o(function(e){return this._parent.insertBefore(e,this._next)},"appendChild"),insertBefore:o(function(e,t){return this._parent.insertBefore(e,t)},"insertBefore"),querySelector:o(function(e){return this._parent.querySelector(e)},"querySelector"),querySelectorAll:o(function(e){return this._parent.querySelectorAll(e)},"querySelectorAll")};function go(e){return function(){return e}}o(go,"default");function Rl(e,t,n,r,i,s){for(var a=0,c,l=t.length,u=s.length;a<u;++a)(c=t[a])?(c.__data__=s[a],r[a]=c):n[a]=new Rt(e,s[a]);for(;a<l;++a)(c=t[a])&&(i[a]=c)}o(Rl,"bindIndex");function Ol(e,t,n,r,i,s,a){var c,l,u=new Map,d=t.length,h=s.length,f=new Array(d),g;for(c=0;c<d;++c)(l=t[c])&&(f[c]=g=a.call(l,l.__data__,c,t)+"",u.has(g)?i[c]=l:u.set(g,l));for(c=0;c<h;++c)g=a.call(e,s[c],c,s)+"",(l=u.get(g))?(r[c]=l,l.__data__=s[c],u.delete(g)):n[c]=new Rt(e,s[c]);for(c=0;c<d;++c)(l=t[c])&&u.get(f[c])===l&&(i[c]=l)}o(Ol,"bindKey");function zl(e){return e.__data__}o(zl,"datum");function mo(e,t){if(!arguments.length)return Array.from(this,zl);var n=t?Ol:Rl,r=this._parents,i=this._groups;typeof e!="function"&&(e=go(e));for(var s=i.length,a=new Array(s),c=new Array(s),l=new Array(s),u=0;u<s;++u){var d=r[u],h=i[u],f=h.length,g=$l(e.call(d,d&&d.__data__,u,r)),m=g.length,S=c[u]=new Array(m),x=a[u]=new Array(m),w=l[u]=new Array(f);n(d,h,S,x,w,g,t);for(var E=0,p=0,b,N;E<m;++E)if(b=S[E]){for(E>=p&&(p=E+1);!(N=x[p])&&++p<m;);b._next=N||null}}return a=new se(a,r),a._enter=c,a._exit=l,a}o(mo,"default");function $l(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}o($l,"arraylike");function yo(){return new se(this._exit||this._groups.map(Tt),this._parents)}o(yo,"default");function wo(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}o(wo,"default");function xo(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,a=Math.min(i,s),c=new Array(i),l=0;l<a;++l)for(var u=n[l],d=r[l],h=u.length,f=c[l]=new Array(h),g,m=0;m<h;++m)(g=u[m]||d[m])&&(f[m]=g);for(;l<i;++l)c[l]=n[l];return new se(c,this._parents)}o(xo,"default");function bo(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],a;--i>=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}o(bo,"default");function So(e){e||(e=Ll);function t(h,f){return h&&f?e(h.__data__,f.__data__):!h-!f}o(t,"compareNode");for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var a=n[s],c=a.length,l=i[s]=new Array(c),u,d=0;d<c;++d)(u=a[d])&&(l[d]=u);l.sort(t)}return new se(i,this._parents).order()}o(So,"default");function Ll(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}o(Ll,"ascending");function Eo(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}o(Eo,"default");function vo(){return Array.from(this)}o(vo,"default");function Co(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var a=r[i];if(a)return a}return null}o(Co,"default");function _o(){let e=0;for(let t of this)++e;return e}o(_o,"default");function No(){return!this.node()}o(No,"default");function Mo(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,a=i.length,c;s<a;++s)(c=i[s])&&e.call(c,c.__data__,s,i);return this}o(Mo,"default");function Hl(e){return function(){this.removeAttribute(e)}}o(Hl,"attrRemove");function Bl(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(Bl,"attrRemoveNS");function Vl(e,t){return function(){this.setAttribute(e,t)}}o(Vl,"attrConstant");function Fl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}o(Fl,"attrConstantNS");function Wl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}o(Wl,"attrFunction");function Yl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}o(Yl,"attrFunctionNS");function Io(e,t){var n=Ne(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Bl:Hl:typeof t=="function"?n.local?Yl:Wl:n.local?Fl:Vl)(n,t))}o(Io,"default");function Ot(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}o(Ot,"default");function Xl(e){return function(){this.style.removeProperty(e)}}o(Xl,"styleRemove");function Zl(e,t,n){return function(){this.style.setProperty(e,t,n)}}o(Zl,"styleConstant");function Ul(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}o(Ul,"styleFunction");function Po(e,t,n){return arguments.length>1?this.each((t==null?Xl:typeof t=="function"?Ul:Zl)(e,t,n??"")):Le(this.node(),e)}o(Po,"default");function Le(e,t){return e.style.getPropertyValue(t)||Ot(e).getComputedStyle(e,null).getPropertyValue(t)}o(Le,"styleValue");function ql(e){return function(){delete this[e]}}o(ql,"propertyRemove");function Gl(e,t){return function(){this[e]=t}}o(Gl,"propertyConstant");function Kl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}o(Kl,"propertyFunction");function ko(e,t){return arguments.length>1?this.each((t==null?ql:typeof t=="function"?Kl:Gl)(e,t)):this.node()[e]}o(ko,"default");function _i(e){return e.trim().split(/^|\s+/)}o(_i,"classArray");function Ao(e){return e.classList||new Ni(e)}o(Ao,"classList");function Ni(e){this._node=e,this._names=_i(e.getAttribute("class")||"")}o(Ni,"ClassList");Ni.prototype={add:o(function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},"add"),remove:o(function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},"remove"),contains:o(function(e){return this._names.indexOf(e)>=0},"contains")};function Mi(e,t){for(var n=Ao(e),r=-1,i=t.length;++r<i;)n.add(t[r])}o(Mi,"classedAdd");function Ii(e,t){for(var n=Ao(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}o(Ii,"classedRemove");function Ql(e){return function(){Mi(this,e)}}o(Ql,"classedTrue");function Jl(e){return function(){Ii(this,e)}}o(Jl,"classedFalse");function jl(e,t){return function(){(t.apply(this,arguments)?Mi:Ii)(this,e)}}o(jl,"classedFunction");function Do(e,t){var n=_i(e+"");if(arguments.length<2){for(var r=Ao(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?jl:t?Ql:Jl)(n,t))}o(Do,"default");function eu(){this.textContent=""}o(eu,"textRemove");function tu(e){return function(){this.textContent=e}}o(tu,"textConstant");function nu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}o(nu,"textFunction");function To(e){return arguments.length?this.each(e==null?eu:(typeof e=="function"?nu:tu)(e)):this.node().textContent}o(To,"default");function ou(){this.innerHTML=""}o(ou,"htmlRemove");function ru(e){return function(){this.innerHTML=e}}o(ru,"htmlConstant");function iu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}o(iu,"htmlFunction");function Ro(e){return arguments.length?this.each(e==null?ou:(typeof e=="function"?iu:ru)(e)):this.node().innerHTML}o(Ro,"default");function su(){this.nextSibling&&this.parentNode.appendChild(this)}o(su,"raise");function Oo(){return this.each(su)}o(Oo,"default");function au(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}o(au,"lower");function zo(){return this.each(au)}o(zo,"default");function $o(e){var t=typeof e=="function"?e:Dt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}o($o,"default");function cu(){return null}o(cu,"constantNull");function Lo(e,t){var n=typeof e=="function"?e:Dt(e),r=t==null?cu:typeof t=="function"?t:$e(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}o(Lo,"default");function lu(){var e=this.parentNode;e&&e.removeChild(this)}o(lu,"remove");function Ho(){return this.each(lu)}o(Ho,"default");function uu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(uu,"selection_cloneShallow");function du(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(du,"selection_cloneDeep");function Bo(e){return this.select(e?du:uu)}o(Bo,"default");function Vo(e){return arguments.length?this.property("__data__",e):this.node().__data__}o(Vo,"default");function fu(e){return function(t){e.call(this,t,this.__data__)}}o(fu,"contextListener");function hu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}o(hu,"parseTypenames");function pu(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}o(pu,"onRemove");function gu(e,t,n){return function(){var r=this.__on,i,s=fu(t);if(r){for(var a=0,c=r.length;a<c;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}o(gu,"onAdd");function Fo(e,t,n){var r=hu(e+""),i,s=r.length,a;if(arguments.length<2){var c=this.node().__on;if(c){for(var l=0,u=c.length,d;l<u;++l)for(i=0,d=c[l];i<s;++i)if((a=r[i]).type===d.type&&a.name===d.name)return d.value}return}for(c=t?gu:pu,i=0;i<s;++i)this.each(c(r[i],t,n));return this}o(Fo,"default");function Pi(e,t,n){var r=Ot(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}o(Pi,"dispatchEvent");function mu(e,t){return function(){return Pi(this,e,t)}}o(mu,"dispatchConstant");function yu(e,t){return function(){return Pi(this,e,t.apply(this,arguments))}}o(yu,"dispatchFunction");function Wo(e,t){return this.each((typeof t=="function"?yu:mu)(e,t))}o(Wo,"default");function*Yo(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,a;i<s;++i)(a=r[i])&&(yield a)}o(Yo,"default");var Xo=[null];function se(e,t){this._groups=e,this._parents=t}o(se,"Selection");function ki(){return new se([[document.documentElement]],Xo)}o(ki,"selection");function wu(){return this}o(wu,"selection_selection");se.prototype=ki.prototype={constructor:se,select:ao,selectAll:lo,selectChild:uo,selectChildren:fo,filter:ho,data:mo,enter:po,exit:yo,join:wo,merge:xo,selection:wu,order:bo,sort:So,call:Eo,nodes:vo,node:Co,size:_o,empty:No,each:Mo,attr:Io,style:Po,property:ko,classed:Do,text:To,html:Ro,raise:Oo,lower:zo,append:$o,insert:Lo,remove:Ho,clone:Bo,datum:Vo,on:Fo,dispatch:Wo,[Symbol.iterator]:Yo};var De=ki;function ce(e){return typeof e=="string"?new se([[document.querySelector(e)]],[document.documentElement]):new se([[e]],Xo)}o(ce,"default");function Zo(e){let t;for(;t=e.sourceEvent;)e=t;return e}o(Zo,"default");function fe(e,t){if(e=Zo(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.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]}o(fe,"default");var Ai={passive:!1},Je={capture:!0,passive:!1};function pn(e){e.stopImmediatePropagation()}o(pn,"nopropagation");function Te(e){e.preventDefault(),e.stopImmediatePropagation()}o(Te,"default");function dt(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Te,Je);"onselectstart"in t?n.on("selectstart.drag",Te,Je):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}o(dt,"default");function zt(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",Te,Je),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}o(zt,"yesdrag");var $t=o(e=>()=>e,"default");function Lt(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:a,y:c,dx:l,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}o(Lt,"DragEvent");Lt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function xu(e){return!e.ctrlKey&&!e.button}o(xu,"defaultFilter");function bu(){return this.parentNode}o(bu,"defaultContainer");function Su(e,t){return t??{x:e.x,y:e.y}}o(Su,"defaultSubject");function Eu(){return navigator.maxTouchPoints||"ontouchstart"in this}o(Eu,"defaultTouchable");function Ht(){var e=xu,t=bu,n=Su,r=Eu,i={},s=Qe("start","drag","end"),a=0,c,l,u,d,h=0;function f(b){b.on("mousedown.drag",g).filter(r).on("touchstart.drag",x).on("touchmove.drag",w,Ai).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(f,"drag");function g(b,N){if(!(d||!e.call(this,b,N))){var C=p(this,t.call(this,b,N),b,N,"mouse");C&&(ce(b.view).on("mousemove.drag",m,Je).on("mouseup.drag",S,Je),dt(b.view),pn(b),u=!1,c=b.clientX,l=b.clientY,C("start",b))}}o(g,"mousedowned");function m(b){if(Te(b),!u){var N=b.clientX-c,C=b.clientY-l;u=N*N+C*C>h}i.mouse("drag",b)}o(m,"mousemoved");function S(b){ce(b.view).on("mousemove.drag mouseup.drag",null),zt(b.view,u),Te(b),i.mouse("end",b)}o(S,"mouseupped");function x(b,N){if(e.call(this,b,N)){var C=b.changedTouches,I=t.call(this,b,N),R=C.length,A,V;for(A=0;A<R;++A)(V=p(this,I,b,N,C[A].identifier,C[A]))&&(pn(b),V("start",b,C[A]))}}o(x,"touchstarted");function w(b){var N=b.changedTouches,C=N.length,I,R;for(I=0;I<C;++I)(R=i[N[I].identifier])&&(Te(b),R("drag",b,N[I]))}o(w,"touchmoved");function E(b){var N=b.changedTouches,C=N.length,I,R;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),I=0;I<C;++I)(R=i[N[I].identifier])&&(pn(b),R("end",b,N[I]))}o(E,"touchended");function p(b,N,C,I,R,A){var V=s.copy(),O=fe(A||C,N),B,$,y;if((y=n.call(b,new Lt("beforestart",{sourceEvent:C,target:f,identifier:R,active:a,x:O[0],y:O[1],dx:0,dy:0,dispatch:V}),I))!=null)return B=y.x-O[0]||0,$=y.y-O[1]||0,o(function v(_,M,D){var T=O,H;switch(_){case"start":i[R]=v,H=a++;break;case"end":delete i[R],--a;case"drag":O=fe(D||M,N),H=a;break}V.call(_,b,new Lt(_,{sourceEvent:M,subject:y,target:f,identifier:R,active:H,x:O[0]+B,y:O[1]+$,dx:O[0]-T[0],dy:O[1]-T[1],dispatch:V}),I)},"gesture")}return o(p,"beforestart"),f.filter=function(b){return arguments.length?(e=typeof b=="function"?b:$t(!!b),f):e},f.container=function(b){return arguments.length?(t=typeof b=="function"?b:$t(b),f):t},f.subject=function(b){return arguments.length?(n=typeof b=="function"?b:$t(b),f):n},f.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:$t(!!b),f):r},f.on=function(){var b=s.on.apply(s,arguments);return b===s?f:b},f.clickDistance=function(b){return arguments.length?(h=(b=+b)*b,f):Math.sqrt(h)},f}o(Ht,"default");var ft=0,Vt=0,Bt=0,Ti=1e3,gn,Ft,mn=0,je=0,yn=0,Wt=typeof performance=="object"&&performance.now?performance:Date,Ri=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xt(){return je||(Ri(vu),je=Wt.now()+yn)}o(Xt,"now");function vu(){je=0}o(vu,"clearNow");function Yt(){this._call=this._time=this._next=null}o(Yt,"Timer");Yt.prototype=wn.prototype={constructor:Yt,restart:o(function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xt():+n)+(t==null?0:+t),!this._next&&Ft!==this&&(Ft?Ft._next=this:gn=this,Ft=this),this._call=e,this._time=n,Uo()},"restart"),stop:o(function(){this._call&&(this._call=null,this._time=1/0,Uo())},"stop")};function wn(e,t,n){var r=new Yt;return r.restart(e,t,n),r}o(wn,"timer");function Oi(){Xt(),++ft;for(var e=gn,t;e;)(t=je-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ft}o(Oi,"timerFlush");function Di(){je=(mn=Wt.now())+yn,ft=Vt=0;try{Oi()}finally{ft=0,_u(),je=0}}o(Di,"wake");function Cu(){var e=Wt.now(),t=e-mn;t>Ti&&(yn-=t,mn=e)}o(Cu,"poke");function _u(){for(var e,t=gn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:gn=n);Ft=e,Uo(r)}o(_u,"nap");function Uo(e){if(!ft){Vt&&(Vt=clearTimeout(Vt));var t=e-je;t>24?(e<1/0&&(Vt=setTimeout(Di,e-Wt.now()-yn)),Bt&&(Bt=clearInterval(Bt))):(Bt||(mn=Wt.now(),Bt=setInterval(Cu,Ti)),ft=1,Ri(Di))}}o(Uo,"sleep");function Zt(e,t,n){var r=new Yt;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}o(Zt,"default");var Nu=Qe("start","end","cancel","interrupt"),Mu=[],Li=0,zi=1,bn=2,xn=3,$i=4,Sn=5,Ut=6;function Re(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Iu(e,n,{name:t,index:r,group:i,on:Nu,tween:Mu,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Li})}o(Re,"default");function qt(e,t){var n=le(e,t);if(n.state>Li)throw new Error("too late; already scheduled");return n}o(qt,"init");function de(e,t){var n=le(e,t);if(n.state>xn)throw new Error("too late; already running");return n}o(de,"set");function le(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}o(le,"get");function Iu(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=wn(s,0,n.time);function s(u){n.state=zi,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}o(s,"schedule");function a(u){var d,h,f,g;if(n.state!==zi)return l();for(d in r)if(g=r[d],g.name===n.name){if(g.state===xn)return Zt(a);g.state===$i?(g.state=Ut,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[d]):+d<t&&(g.state=Ut,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete r[d])}if(Zt(function(){n.state===xn&&(n.state=$i,n.timer.restart(c,n.delay,n.time),c(u))}),n.state=bn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===bn){for(n.state=xn,i=new Array(f=n.tween.length),d=0,h=-1;d<f;++d)(g=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++h]=g);i.length=h+1}}o(a,"start");function c(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(l),n.state=Sn,1),h=-1,f=i.length;++h<f;)i[h].call(e,d);n.state===Sn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}o(c,"tick");function l(){n.state=Ut,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}o(l,"stop")}o(Iu,"create");function He(e,t){var n=e.__transition,r,i,s=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){s=!1;continue}i=r.state>bn&&r.state<Sn,r.state=Ut,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}s&&delete e.__transition}}o(He,"default");function qo(e){return this.each(function(){He(this,e)})}o(qo,"default");function Pu(e,t){var n,r;return function(){var i=de(this,e),s=i.tween;if(s!==n){r=n=s;for(var a=0,c=r.length;a<c;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}o(Pu,"tweenRemove");function ku(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=de(this,e),a=s.tween;if(a!==r){i=(r=a).slice();for(var c={name:t,value:n},l=0,u=i.length;l<u;++l)if(i[l].name===t){i[l]=c;break}l===u&&i.push(c)}s.tween=i}}o(ku,"tweenFunction");function Go(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=le(this.node(),n).tween,i=0,s=r.length,a;i<s;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?Pu:ku)(n,e,t))}o(Go,"default");function ht(e,t,n){var r=e._id;return e.each(function(){var i=de(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return le(i,r).value[t]}}o(ht,"tweenValue");function Gt(e,t){var n;return(typeof t=="number"?mi:t instanceof ro?io:(n=ro(t))?(t=n,io):yi)(e,t)}o(Gt,"default");function Au(e){return function(){this.removeAttribute(e)}}o(Au,"attrRemove");function Du(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(Du,"attrRemoveNS");function Tu(e,t,n){var r,i=n+"",s;return function(){var a=this.getAttribute(e);return a===i?null:a===r?s:s=t(r=a,n)}}o(Tu,"attrConstant");function Ru(e,t,n){var r,i=n+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?s:s=t(r=a,n)}}o(Ru,"attrConstantNS");function Ou(e,t,n){var r,i,s;return function(){var a,c=n(this),l;return c==null?void this.removeAttribute(e):(a=this.getAttribute(e),l=c+"",a===l?null:a===r&&l===i?s:(i=l,s=t(r=a,c)))}}o(Ou,"attrFunction");function zu(e,t,n){var r,i,s;return function(){var a,c=n(this),l;return c==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),l=c+"",a===l?null:a===r&&l===i?s:(i=l,s=t(r=a,c)))}}o(zu,"attrFunctionNS");function Ko(e,t){var n=Ne(e),r=n==="transform"?xi:Gt;return this.attrTween(e,typeof t=="function"?(n.local?zu:Ou)(n,r,ht(this,"attr."+e,t)):t==null?(n.local?Du:Au)(n):(n.local?Ru:Tu)(n,r,t))}o(Ko,"default");function $u(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}o($u,"attrInterpolate");function Lu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}o(Lu,"attrInterpolateNS");function Hu(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Lu(e,s)),n}return o(i,"tween"),i._value=t,i}o(Hu,"attrTweenNS");function Bu(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&$u(e,s)),n}return o(i,"tween"),i._value=t,i}o(Bu,"attrTween");function Qo(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Ne(e);return this.tween(n,(r.local?Hu:Bu)(r,t))}o(Qo,"default");function Vu(e,t){return function(){qt(this,e).delay=+t.apply(this,arguments)}}o(Vu,"delayFunction");function Fu(e,t){return t=+t,function(){qt(this,e).delay=t}}o(Fu,"delayConstant");function Jo(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Vu:Fu)(t,e)):le(this.node(),t).delay}o(Jo,"default");function Wu(e,t){return function(){de(this,e).duration=+t.apply(this,arguments)}}o(Wu,"durationFunction");function Yu(e,t){return t=+t,function(){de(this,e).duration=t}}o(Yu,"durationConstant");function jo(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Wu:Yu)(t,e)):le(this.node(),t).duration}o(jo,"default");function Xu(e,t){if(typeof t!="function")throw new Error;return function(){de(this,e).ease=t}}o(Xu,"easeConstant");function er(e){var t=this._id;return arguments.length?this.each(Xu(t,e)):le(this.node(),t).ease}o(er,"default");function Zu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;de(this,e).ease=n}}o(Zu,"easeVarying");function tr(e){if(typeof e!="function")throw new Error;return this.each(Zu(this._id,e))}o(tr,"default");function nr(e){typeof e!="function"&&(e=ut(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,c=r[i]=[],l,u=0;u<a;++u)(l=s[u])&&e.call(l,l.__data__,u,s)&&c.push(l);return new pe(r,this._parents,this._name,this._id)}o(nr,"default");function or(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=t[c],u=n[c],d=l.length,h=a[c]=new Array(d),f,g=0;g<d;++g)(f=l[g]||u[g])&&(h[g]=f);for(;c<r;++c)a[c]=t[c];return new pe(a,this._parents,this._name,this._id)}o(or,"default");function Uu(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}o(Uu,"start");function qu(e,t,n){var r,i,s=Uu(t)?qt:de;return function(){var a=s(this,e),c=a.on;c!==r&&(i=(r=c).copy()).on(t,n),a.on=i}}o(qu,"onFunction");function rr(e,t){var n=this._id;return arguments.length<2?le(this.node(),n).on.on(e):this.each(qu(n,e,t))}o(rr,"default");function Gu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}o(Gu,"removeFunction");function ir(){return this.on("end.remove",Gu(this._id))}o(ir,"default");function sr(e){var t=this._name,n=this._id;typeof e!="function"&&(e=$e(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a<i;++a)for(var c=r[a],l=c.length,u=s[a]=new Array(l),d,h,f=0;f<l;++f)(d=c[f])&&(h=e.call(d,d.__data__,f,c))&&("__data__"in d&&(h.__data__=d.__data__),u[f]=h,Re(u[f],t,n,f,u,le(d,n)));return new pe(s,this._parents,t,n)}o(sr,"default");function ar(e){var t=this._name,n=this._id;typeof e!="function"&&(e=lt(e));for(var r=this._groups,i=r.length,s=[],a=[],c=0;c<i;++c)for(var l=r[c],u=l.length,d,h=0;h<u;++h)if(d=l[h]){for(var f=e.call(d,d.__data__,h,l),g,m=le(d,n),S=0,x=f.length;S<x;++S)(g=f[S])&&Re(g,t,n,S,f,m);s.push(f),a.push(d)}return new pe(s,a,t,n)}o(ar,"default");var Ku=De.prototype.constructor;function cr(){return new Ku(this._groups,this._parents)}o(cr,"default");function Qu(e,t){var n,r,i;return function(){var s=Le(this,e),a=(this.style.removeProperty(e),Le(this,e));return s===a?null:s===n&&a===r?i:i=t(n=s,r=a)}}o(Qu,"styleNull");function Hi(e){return function(){this.style.removeProperty(e)}}o(Hi,"styleRemove");function Ju(e,t,n){var r,i=n+"",s;return function(){var a=Le(this,e);return a===i?null:a===r?s:s=t(r=a,n)}}o(Ju,"styleConstant");function ju(e,t,n){var r,i,s;return function(){var a=Le(this,e),c=n(this),l=c+"";return c==null&&(l=c=(this.style.removeProperty(e),Le(this,e))),a===l?null:a===r&&l===i?s:(i=l,s=t(r=a,c))}}o(ju,"styleFunction");function ed(e,t){var n,r,i,s="style."+t,a="end."+s,c;return function(){var l=de(this,e),u=l.on,d=l.value[s]==null?c||(c=Hi(t)):void 0;(u!==n||i!==d)&&(r=(n=u).copy()).on(a,i=d),l.on=r}}o(ed,"styleMaybeRemove");function lr(e,t,n){var r=(e+="")=="transform"?wi:Gt;return t==null?this.styleTween(e,Qu(e,r)).on("end.style."+e,Hi(e)):typeof t=="function"?this.styleTween(e,ju(e,r,ht(this,"style."+e,t))).each(ed(this._id,e)):this.styleTween(e,Ju(e,r,t),n).on("end.style."+e,null)}o(lr,"default");function td(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}o(td,"styleInterpolate");function nd(e,t,n){var r,i;function s(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&td(e,a,n)),r}return o(s,"tween"),s._value=t,s}o(nd,"styleTween");function ur(e,t,n){var r="style."+(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;return this.tween(r,nd(e,t,n??""))}o(ur,"default");function od(e){return function(){this.textContent=e}}o(od,"textConstant");function rd(e){return function(){var t=e(this);this.textContent=t??""}}o(rd,"textFunction");function dr(e){return this.tween("text",typeof e=="function"?rd(ht(this,"text",e)):od(e==null?"":e+""))}o(dr,"default");function id(e){return function(t){this.textContent=e.call(this,t)}}o(id,"textInterpolate");function sd(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&id(i)),t}return o(r,"tween"),r._value=e,r}o(sd,"textTween");function fr(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,sd(e))}o(fr,"default");function hr(){for(var e=this._name,t=this._id,n=En(),r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],c=a.length,l,u=0;u<c;++u)if(l=a[u]){var d=le(l,t);Re(l,e,n,u,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new pe(r,this._parents,e,n)}o(hr,"default");function pr(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,a){var c={value:a},l={value:o(function(){--i===0&&s()},"value")};n.each(function(){var u=de(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(l)),u.on=t}),i===0&&s()})}o(pr,"default");var ad=0;function pe(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}o(pe,"Transition");function Bi(e){return De().transition(e)}o(Bi,"transition");function En(){return++ad}o(En,"newId");var Oe=De.prototype;pe.prototype=Bi.prototype={constructor:pe,select:sr,selectAll:ar,selectChild:Oe.selectChild,selectChildren:Oe.selectChildren,filter:nr,merge:or,selection:cr,transition:hr,call:Oe.call,nodes:Oe.nodes,node:Oe.node,size:Oe.size,empty:Oe.empty,each:Oe.each,on:rr,attr:Ko,attrTween:Qo,style:lr,styleTween:ur,text:dr,textTween:fr,remove:ir,tween:Go,delay:Jo,duration:jo,ease:er,easeVarying:tr,end:pr,[Symbol.iterator]:Oe[Symbol.iterator]};function vn(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}o(vn,"cubicInOut");var cd={time:null,delay:0,duration:250,ease:vn};function ld(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}o(ld,"inherit");function gr(e){var t,n;e instanceof pe?(t=e._id,e=e._name):(t=En(),(n=cd).time=Xt(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],c=a.length,l,u=0;u<c;++u)(l=a[u])&&Re(l,e,t,u,a,n||ld(l,t));return new pe(r,this._parents,e,t)}o(gr,"default");De.prototype.interrupt=qo;De.prototype.transition=gr;var Kt=o(e=>()=>e,"default");function mr(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}o(mr,"ZoomEvent");function Se(e,t,n){this.k=e,this.x=t,this.y=n}o(Se,"Transform");Se.prototype={constructor:Se,scale:o(function(e){return e===1?this:new Se(this.k*e,this.x,this.y)},"scale"),translate:o(function(e,t){return e===0&t===0?this:new Se(this.k,this.x+this.k*e,this.y+this.k*t)},"translate"),apply:o(function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},"apply"),applyX:o(function(e){return e*this.k+this.x},"applyX"),applyY:o(function(e){return e*this.k+this.y},"applyY"),invert:o(function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},"invert"),invertX:o(function(e){return(e-this.x)/this.k},"invertX"),invertY:o(function(e){return(e-this.y)/this.k},"invertY"),rescaleX:o(function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},"rescaleX"),rescaleY:o(function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},"rescaleY"),toString:o(function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"},"toString")};var et=new Se(1,0,0);Qt.prototype=Se.prototype;function Qt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return et;return e.__zoom}o(Qt,"transform");function Cn(e){e.stopImmediatePropagation()}o(Cn,"nopropagation");function tt(e){e.preventDefault(),e.stopImmediatePropagation()}o(tt,"default");function ud(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}o(ud,"defaultFilter");function dd(){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]]}o(dd,"defaultExtent");function Vi(){return this.__zoom||et}o(Vi,"defaultTransform");function fd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}o(fd,"defaultWheelDelta");function hd(){return navigator.maxTouchPoints||"ontouchstart"in this}o(hd,"defaultTouchable");function pd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}o(pd,"defaultConstrain");function Jt(){var e=ud,t=dd,n=pd,r=fd,i=hd,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],c=250,l=ct,u=Qe("start","zoom","end"),d,h,f,g=500,m=150,S=0,x=10;function w(y){y.property("__zoom",Vi).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",V).filter(i).on("touchstart.zoom",O).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(w,"zoom"),w.transform=function(y,v,_,M){var D=y.selection?y.selection():y;D.property("__zoom",Vi),y!==D?N(y,v,_,M):D.interrupt().each(function(){C(this,arguments).event(M).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},w.scaleBy=function(y,v,_,M){w.scaleTo(y,function(){var D=this.__zoom.k,T=typeof v=="function"?v.apply(this,arguments):v;return D*T},_,M)},w.scaleTo=function(y,v,_,M){w.transform(y,function(){var D=t.apply(this,arguments),T=this.__zoom,H=_==null?b(D):typeof _=="function"?_.apply(this,arguments):_,L=T.invert(H),F=typeof v=="function"?v.apply(this,arguments):v;return n(p(E(T,F),H,L),D,a)},_,M)},w.translateBy=function(y,v,_,M){w.transform(y,function(){return n(this.__zoom.translate(typeof v=="function"?v.apply(this,arguments):v,typeof _=="function"?_.apply(this,arguments):_),t.apply(this,arguments),a)},null,M)},w.translateTo=function(y,v,_,M,D){w.transform(y,function(){var T=t.apply(this,arguments),H=this.__zoom,L=M==null?b(T):typeof M=="function"?M.apply(this,arguments):M;return n(et.translate(L[0],L[1]).scale(H.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof _=="function"?-_.apply(this,arguments):-_),T,a)},M,D)};function E(y,v){return v=Math.max(s[0],Math.min(s[1],v)),v===y.k?y:new Se(v,y.x,y.y)}o(E,"scale");function p(y,v,_){var M=v[0]-_[0]*y.k,D=v[1]-_[1]*y.k;return M===y.x&&D===y.y?y:new Se(y.k,M,D)}o(p,"translate");function b(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}o(b,"centroid");function N(y,v,_,M){y.on("start.zoom",function(){C(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,T=arguments,H=C(D,T).event(M),L=t.apply(D,T),F=_==null?b(L):typeof _=="function"?_.apply(D,T):_,q=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),W=D.__zoom,G=typeof v=="function"?v.apply(D,T):v,j=l(W.invert(F).concat(q/W.k),G.invert(F).concat(q/G.k));return function(U){if(U===1)U=G;else{var z=j(U),Y=q/z[2];U=new Se(Y,F[0]-z[0]*Y,F[1]-z[1]*Y)}H.zoom(null,U)}})}o(N,"schedule");function C(y,v,_){return!_&&y.__zooming||new I(y,v)}o(C,"gesture");function I(y,v){this.that=y,this.args=v,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,v),this.taps=0}o(I,"Gesture"),I.prototype={event:o(function(y){return y&&(this.sourceEvent=y),this},"event"),start:o(function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},"start"),zoom:o(function(y,v){return this.mouse&&y!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=v.invert(this.touch1[0])),this.that.__zoom=v,this.emit("zoom"),this},"zoom"),end:o(function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},"end"),emit:o(function(y){var v=ce(this.that).datum();u.call(y,this.that,new mr(y,{sourceEvent:this.sourceEvent,target:w,type:y,transform:this.that.__zoom,dispatch:u}),v)},"emit")};function R(y,...v){if(!e.apply(this,arguments))return;var _=C(this,v).event(y),M=this.__zoom,D=Math.max(s[0],Math.min(s[1],M.k*Math.pow(2,r.apply(this,arguments)))),T=fe(y);if(_.wheel)(_.mouse[0][0]!==T[0]||_.mouse[0][1]!==T[1])&&(_.mouse[1]=M.invert(_.mouse[0]=T)),clearTimeout(_.wheel);else{if(M.k===D)return;_.mouse=[T,M.invert(T)],He(this),_.start()}tt(y),_.wheel=setTimeout(H,m),_.zoom("mouse",n(p(E(M,D),_.mouse[0],_.mouse[1]),_.extent,a));function H(){_.wheel=null,_.end()}o(H,"wheelidled")}o(R,"wheeled");function A(y,...v){if(f||!e.apply(this,arguments))return;var _=y.currentTarget,M=C(this,v,!0).event(y),D=ce(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",q,!0),T=fe(y,_),H=y.clientX,L=y.clientY;dt(y.view),Cn(y),M.mouse=[T,this.__zoom.invert(T)],He(this),M.start();function F(W){if(tt(W),!M.moved){var G=W.clientX-H,j=W.clientY-L;M.moved=G*G+j*j>S}M.event(W).zoom("mouse",n(p(M.that.__zoom,M.mouse[0]=fe(W,_),M.mouse[1]),M.extent,a))}o(F,"mousemoved");function q(W){D.on("mousemove.zoom mouseup.zoom",null),zt(W.view,M.moved),tt(W),M.event(W).end()}o(q,"mouseupped")}o(A,"mousedowned");function V(y,...v){if(e.apply(this,arguments)){var _=this.__zoom,M=fe(y.changedTouches?y.changedTouches[0]:y,this),D=_.invert(M),T=_.k*(y.shiftKey?.5:2),H=n(p(E(_,T),M,D),t.apply(this,v),a);tt(y),c>0?ce(this).transition().duration(c).call(N,H,M,y):ce(this).call(w.transform,H,M,y)}}o(V,"dblclicked");function O(y,...v){if(e.apply(this,arguments)){var _=y.touches,M=_.length,D=C(this,v,y.changedTouches.length===M).event(y),T,H,L,F;for(Cn(y),H=0;H<M;++H)L=_[H],F=fe(L,this),F=[F,this.__zoom.invert(F),L.identifier],D.touch0?!D.touch1&&D.touch0[2]!==F[2]&&(D.touch1=F,D.taps=0):(D.touch0=F,T=!0,D.taps=1+!!d);d&&(d=clearTimeout(d)),T&&(D.taps<2&&(h=F[0],d=setTimeout(function(){d=null},g)),He(this),D.start())}}o(O,"touchstarted");function B(y,...v){if(this.__zooming){var _=C(this,v).event(y),M=y.changedTouches,D=M.length,T,H,L,F;for(tt(y),T=0;T<D;++T)H=M[T],L=fe(H,this),_.touch0&&_.touch0[2]===H.identifier?_.touch0[0]=L:_.touch1&&_.touch1[2]===H.identifier&&(_.touch1[0]=L);if(H=_.that.__zoom,_.touch1){var q=_.touch0[0],W=_.touch0[1],G=_.touch1[0],j=_.touch1[1],U=(U=G[0]-q[0])*U+(U=G[1]-q[1])*U,z=(z=j[0]-W[0])*z+(z=j[1]-W[1])*z;H=E(H,Math.sqrt(U/z)),L=[(q[0]+G[0])/2,(q[1]+G[1])/2],F=[(W[0]+j[0])/2,(W[1]+j[1])/2]}else if(_.touch0)L=_.touch0[0],F=_.touch0[1];else return;_.zoom("touch",n(p(H,L,F),_.extent,a))}}o(B,"touchmoved");function $(y,...v){if(this.__zooming){var _=C(this,v).event(y),M=y.changedTouches,D=M.length,T,H;for(Cn(y),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),T=0;T<D;++T)H=M[T],_.touch0&&_.touch0[2]===H.identifier?delete _.touch0:_.touch1&&_.touch1[2]===H.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(H=fe(H,this),Math.hypot(h[0]-H[0],h[1]-H[1])<x)){var L=ce(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return o($,"touchended"),w.wheelDelta=function(y){return arguments.length?(r=typeof y=="function"?y:Kt(+y),w):r},w.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Kt(!!y),w):e},w.touchable=function(y){return arguments.length?(i=typeof y=="function"?y:Kt(!!y),w):i},w.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Kt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),w):t},w.scaleExtent=function(y){return arguments.length?(s[0]=+y[0],s[1]=+y[1],w):[s[0],s[1]]},w.translateExtent=function(y){return arguments.length?(a[0][0]=+y[0][0],a[1][0]=+y[1][0],a[0][1]=+y[0][1],a[1][1]=+y[1][1],w):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},w.constrain=function(y){return arguments.length?(n=y,w):n},w.duration=function(y){return arguments.length?(c=+y,w):c},w.interpolate=function(y){return arguments.length?(l=y,w):l},w.on=function(){var y=u.on.apply(u,arguments);return y===u?w:y},w.clickDistance=function(y){return arguments.length?(S=(y=+y)*y,w):Math.sqrt(S)},w.tapDistance=function(y){return arguments.length?(x=+y,w):x},w}o(Jt,"default");var ge={error001:o((e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,"error001"),error002:o(()=>"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.","error002"),error003:o(e=>`Node type "${e}" not found. Using fallback type "default".`,"error003"),error004:o(()=>"The parent container needs a width and a height to render the graph.","error004"),error005:o(()=>"Only child nodes can use a parent extent.","error005"),error006:o(()=>"Can't create edge. An edge needs a source and a target.","error006"),error007:o(e=>`The old edge with id=${e} does not exist.`,"error007"),error009:o(e=>`Marker type "${e}" doesn't exist.`,"error009"),error008:o((e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,"error008"),error010:o(()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.","error010"),error011:o(e=>`Edge type "${e}" not found. Using fallback type "default".`,"error011"),error012:o(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.`,"error012"),error013:o((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.`,"error013"),error014:o(()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.","error014"),error015:o(()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.","error015"),error016:o(e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`,"error016")},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Sr=["Enter"," ","Escape"],Er={"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":o(({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"node.a11yDescription.ariaLiveMessage"),"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"},We;(function(e){e.Strict="strict",e.Loose="loose"})(We||(We={}));var ze;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ze||(ze={}));var nt;(function(e){e.Partial="partial",e.Full="full"})(nt||(nt={}));var vr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Me;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Me||(Me={}));var gt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(gt||(gt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));var Fi={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},Cr=o(e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,"isEdgeBase"),ts=o(e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),"isNodeBase"),_r=o(e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),"isInternalNodeBase");var en=o((e,t=[0,0])=>{let{width:n,height:r}=xe(e),i=e.origin??t,s=n*i[0],a=r*i[1];return{x:e.position.x-s,y:e.position.y-a}},"getNodePositionWithOrigin"),tn=o((e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((i,s)=>{let a=typeof s=="string",c=!t.nodeLookup&&!a?s:void 0;return t.nodeLookup&&(c=a?t.nodeLookup.get(s):_r(s)?s:t.nodeLookup.get(s.id)),c?(n=!0,kn(i,Mn(c,t.nodeOrigin))):i},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?An(r):{x:0,y:0,width:0,height:0}},"getNodesBounds"),wt=o((e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=kn(n,Mn(i)),r=!0)}),r?An(n):{x:0,y:0,width:0,height:0}},"getInternalNodesBounds"),In=o((e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{let c=(t.x-n)/i,l=(t.y-r)/i,u=t.width/i,d=t.height/i,h=[];for(let f of e.values()){let{measured:g,selectable:m=!0,hidden:S=!1}=f;if(a&&!m||S)continue;let x=g.width??f.width??f.initialWidth??0,w=g.height??f.height??f.initialHeight??0,{x:E,y:p}=f.internals.positionAbsolute,b=ss(c,l,u,d,E,p,x,w),N=x*w,C=s&&b>0;(!f.internals.handleBounds||C||b>=N||f.dragging)&&h.push(f)}return h},"getNodesInside"),ns=o((e,t)=>{let n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))},"getConnectedEdges");function gd(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{let s;if(t?.includeHiddenNodes){let{width:a,height:c}=xe(i);s=a>0&&c>0}else s=!!(i.measured.width&&i.measured.height&&!i.hidden);s&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}o(gd,"getFitViewNodes");async function os({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;let c=gd(e,a),l=wt(c),u=st(l,t,n,a?.minZoom??i,a?.maxZoom??s,a?.padding??.1);return await r.setViewport(u,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),!0}o(os,"fitViewport");function Nr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){let a=n.get(e),c=a.parentId?n.get(a.parentId):void 0,{x:l,y:u}=c?c.internals.positionAbsolute:{x:0,y:0},d=a.origin??r,h=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!c)s?.("005",ge.error005());else{let{width:g,height:m}=xe(c);g&&m&&(h=[[l,u],[l+g,u+m]])}else c&&it(a.extent)&&(h=[[a.extent[0][0]+l,a.extent[0][1]+u],[a.extent[1][0]+l,a.extent[1][1]+u]]);let f=it(h)?ot(t,h,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&s?.("015",ge.error015()),{position:{x:f.x-l+(a.measured.width??0)*d[0],y:f.y-u+(a.measured.height??0)*d[1]},positionAbsolute:f}}o(Nr,"calculateNodePosition");async function rs({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let s=new Set(e.map(f=>f.id)),a=[];for(let f of n){if(f.deletable===!1)continue;let g=s.has(f.id),m=!g&&f.parentId&&a.find(S=>S.id===f.parentId);(g||m)&&a.push(f)}let c=new Set(t.map(f=>f.id)),l=r.filter(f=>f.deletable!==!1),d=ns(a,l);for(let f of l)c.has(f.id)&&!d.find(m=>m.id===f.id)&&d.push(f);if(!i)return{edges:d,nodes:a};let h=await i({nodes:a,edges:d});return typeof h=="boolean"?h?{edges:d,nodes:a}:{edges:[],nodes:[]}:h}o(rs,"getElementsToRemove");var mt=o((e,t=0,n=1)=>Math.min(Math.max(e,t),n),"clamp"),ot=o((e={x:0,y:0},t,n)=>({x:mt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:mt(e.y,t[0][1],t[1][1]-(n?.height??0))}),"clampPosition");function is(e,t,n){let{width:r,height:i}=xe(n),{x:s,y:a}=n.internals.positionAbsolute;return ot(e,[[s,a],[s+r,a+i]],t)}o(is,"clampPositionToParent");var Wi=o((e,t,n)=>e<t?mt(Math.abs(e-t),1,t)/t:e>n?-mt(Math.abs(e-n),1,t)/t:0,"calcAutoPanVelocity"),Pn=o((e,t,n=15,r=40)=>{let i=Wi(e.x,r,t.width-r)*n,s=Wi(e.y,r,t.height-r)*n;return[i,s]},"calcAutoPan"),kn=o((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)}),"getBoundsOfBoxes"),br=o(({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),"rectToBox"),An=o(({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),"boxToRect"),xt=o((e,t=[0,0])=>{let{x:n,y:r}=_r(e)?e.internals.positionAbsolute:en(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},"nodeToRect"),Mn=o((e,t=[0,0])=>{let{x:n,y:r}=_r(e)?e.internals.positionAbsolute:en(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},"nodeToBox"),Mr=o((e,t)=>An(kn(br(e),br(t))),"getBoundsOfRects"),ss=o((e,t,n,r,i,s,a,c)=>{let l=Math.max(0,Math.min(e+n,i+a)-Math.max(e,i)),u=Math.max(0,Math.min(t+r,s+c)-Math.max(t,s));return Math.ceil(l*u)},"getRectsOverlappingArea"),nn=o((e,t)=>ss(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),"getOverlappingArea"),Ir=o(e=>ye(e.width)&&ye(e.height)&&ye(e.x)&&ye(e.y),"isRectObject"),ye=o(e=>!isNaN(e)&&isFinite(e),"isNumeric"),Pr=o((e,t)=>(n,r)=>{},"createDevWarn"),bt=o((e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),"snapPosition"),St=o(({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{let c={x:(e-n)/i,y:(t-r)/i};return s?bt(c,a):c},"pointToRendererPoint"),rt=o(({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),"rendererPointToPoint");function pt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}o(pt,"parsePadding");function md(e,t,n){if(typeof e=="string"||typeof e=="number"){let r=pt(e,n),i=pt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){let r=pt(e.top??e.y??0,n),i=pt(e.bottom??e.y??0,n),s=pt(e.left??e.x??0,t),a=pt(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:s,x:s+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}o(md,"parsePaddings");function yd(e,t,n,r,i,s){let{x:a,y:c}=rt(e,[t,n,r]),{x:l,y:u}=rt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=i-l,h=s-u;return{left:Math.floor(a),top:Math.floor(c),right:Math.floor(d),bottom:Math.floor(h)}}o(yd,"calculateAppliedPaddings");var st=o((e,t,n,r,i,s)=>{let a=md(s,t,n),c=(t-a.x)/e.width,l=(n-a.y)/e.height,u=Math.min(c,l),d=mt(u,r,i),h=e.x+e.width/2,f=e.y+e.height/2,g=t/2-h*d,m=n/2-f*d,S=yd(e,g,m,d,t,n),x={left:Math.min(S.left-a.left,0),top:Math.min(S.top-a.top,0),right:Math.min(S.right-a.right,0),bottom:Math.min(S.bottom-a.bottom,0)};return{x:g-x.left+x.right,y:m-x.top+x.bottom,zoom:d}},"getViewportForBounds"),Et=o(()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,"isMacOs");function it(e){return e!=null&&e!=="parent"}o(it,"isCoordinateExtent");function xe(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}o(xe,"getNodeDimensions");function Dn(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}o(Dn,"nodeHasDimensions");function kr(e,t={width:0,height:0},n,r,i){let s={...e},a=r.get(n);if(a){let c=a.origin||i;s.x+=a.internals.positionAbsolute.x-(t.width??0)*c[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*c[1]}return s}o(kr,"evaluateAbsolutePosition");function Ar(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}o(Ar,"areSetsEqual");function as(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}o(as,"withResolvers");function cs(e){return{...Er,...e||{}}}o(cs,"mergeAriaLabelConfig");function Dr(e){return e===null?null:e?"valid":"invalid"}o(Dr,"getConnectionStatus");function jt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:s,y:a}=we(e),c=St({x:s-(i?.left??0),y:a-(i?.top??0)},r),{x:l,y:u}=n?bt(c,t):c;return{xSnapped:l,ySnapped:u,...c}}o(jt,"getPointerPosition");var Tn=o(e=>({width:e.offsetWidth,height:e.offsetHeight}),"getDimensions"),Tr=o(e=>e?.getRootNode?.()||window?.document,"getHostForElement"),wd=["INPUT","SELECT","TEXTAREA"];function Rr(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:wd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}o(Rr,"isInputDOMNode");var Or=o(e=>"clientX"in e,"isMouseEvent"),we=o((e,t)=>{let n=Or(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},"getEventPosition"),Yi=o((e,t,n,r,i)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{let c=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(c.left-n.left)/r,y:(c.top-n.top)/r,...Tn(a)}})},"getHandleBounds");function Rn({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:c}){let l=e*.125+i*.375+a*.375+n*.125,u=t*.125+s*.375+c*.375+r*.125,d=Math.abs(l-e),h=Math.abs(u-t);return[l,u,d,h]}o(Rn,"getBezierEdgeCenter");function _n(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}o(_n,"calculateControlOffset");function Xi({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case X.Left:return[t-_n(t-r,s),n];case X.Right:return[t+_n(r-t,s),n];case X.Top:return[t,n-_n(n-i,s)];case X.Bottom:return[t,n+_n(i-n,s)]}}o(Xi,"getControlWithCurvature");function On({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:i,targetPosition:s=X.Top,curvature:a=.25}){let[c,l]=Xi({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,d]=Xi({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[h,f,g,m]=Rn({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:c,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${t} C${c},${l} ${u},${d} ${r},${i}`,h,f,g,m]}o(On,"getBezierPath");function zr({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,s=n<e?n+i:n-i,a=Math.abs(r-t)/2,c=r<t?r+a:r-a;return[s,c,i,a]}o(zr,"getEdgeCenter");function ls({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return r;let a=i&&n?r+1e3:r,c=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return a+c}o(ls,"getElevatedEdgeZIndex");function us({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let s=kn(Mn(e),Mn(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);let a={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return nn(a,An(s))>0}o(us,"isEdgeVisible");var xd=o(({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,"getEdgeId"),bd=o((e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),"connectionExists"),ds=o((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ge.error006()),t;let r=n.getEdgeId||xd,i;return Cr(e)?i={...e}:i={...e,id:r(e)},bd(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))},"addEdge");function zn({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,s,a,c]=zr({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,c]}o(zn,"getStraightPath");var Zi={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Sd=o(({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},"getDirection"),Ui=o((e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),"distance");function Ed({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:r=X.Top,center:i,offset:s,stepPosition:a}){let c=Zi[t],l=Zi[r],u={x:e.x+c.x*s,y:e.y+c.y*s},d={x:n.x+l.x*s,y:n.y+l.y*s},h=Sd({source:u,sourcePosition:t,target:d}),f=h.x!==0?"x":"y",g=h[f],m=[],S,x,w={x:0,y:0},E={x:0,y:0},[,,p,b]=zr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[f]*l[f]===-1){f==="x"?(S=i.x??u.x+(d.x-u.x)*a,x=i.y??(u.y+d.y)/2):(S=i.x??(u.x+d.x)/2,x=i.y??u.y+(d.y-u.y)*a);let R=[{x:S,y:u.y},{x:S,y:d.y}],A=[{x:u.x,y:x},{x:d.x,y:x}];c[f]===g?m=f==="x"?R:A:m=f==="x"?A:R}else{let R=[{x:u.x,y:d.y}],A=[{x:d.x,y:u.y}];if(f==="x"?m=c.x===g?A:R:m=c.y===g?R:A,t===r){let y=Math.abs(e[f]-n[f]);if(y<=s){let v=Math.min(s-1,s-y);c[f]===g?w[f]=(u[f]>e[f]?-1:1)*v:E[f]=(d[f]>n[f]?-1:1)*v}}if(t!==r){let y=f==="x"?"y":"x",v=c[f]===l[y],_=u[y]>d[y],M=u[y]<d[y];(c[f]===1&&(!v&&_||v&&M)||c[f]!==1&&(!v&&M||v&&_))&&(m=f==="x"?R:A)}let V={x:u.x+w.x,y:u.y+w.y},O={x:d.x+E.x,y:d.y+E.y},B=Math.max(Math.abs(V.x-m[0].x),Math.abs(O.x-m[0].x)),$=Math.max(Math.abs(V.y-m[0].y),Math.abs(O.y-m[0].y));B>=$?(S=(V.x+O.x)/2,x=m[0].y):(S=m[0].x,x=(V.y+O.y)/2)}let N={x:u.x+w.x,y:u.y+w.y},C={x:d.x+E.x,y:d.y+E.y};return[[e,...N.x!==m[0].x||N.y!==m[0].y?[N]:[],...m,...C.x!==m[m.length-1].x||C.y!==m[m.length-1].y?[C]:[],n],S,x,p,b]}o(Ed,"getPoints");function vd(e,t,n,r){let i=Math.min(Ui(e,t)/2,Ui(t,n)/2,r),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){let u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${s+i*u},${a}Q ${s},${a} ${s},${a+i*d}`}let c=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${a+i*l}Q ${s},${a} ${s+i*c},${a}`}o(vd,"getBend");function on({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:i,targetPosition:s=X.Top,borderRadius:a=5,centerX:c,centerY:l,offset:u=20,stepPosition:d=.5}){let[h,f,g,m,S]=Ed({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:c,y:l},offset:u,stepPosition:d}),x=`M${h[0].x} ${h[0].y}`;for(let w=1;w<h.length-1;w++)x+=vd(h[w-1],h[w],h[w+1],a);return x+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[x,f,g,m,S]}o(on,"getSmoothStepPath");function qi(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}o(qi,"isNodeInitialized");function fs(e){let{sourceNode:t,targetNode:n}=e;if(!qi(t)||!qi(n))return null;let r=t.internals.handleBounds||Gi(t.handles),i=n.internals.handleBounds||Gi(n.handles),s=Ki(r?.source??[],e.sourceHandle),a=Ki(e.connectionMode===We.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!s||!a)return e.onError?.("008",ge.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let c=s?.position||X.Bottom,l=a?.position||X.Top,u=Ye(t,s,c),d=Ye(n,a,l);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:c,targetPosition:l}}o(fs,"getEdgePosition");function Gi(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}o(Gi,"toHandleBounds");function Ye(e,t,n=X.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:c}=t??xe(e);if(r)return{x:i+a/2,y:s+c/2};switch(t?.position??n){case X.Top:return{x:i+a/2,y:s};case X.Right:return{x:i+a,y:s+c/2};case X.Bottom:return{x:i+a/2,y:s+c};case X.Left:return{x:i,y:s+c/2}}}o(Ye,"getHandlePosition");function Ki(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}o(Ki,"getHandle$1");function $n(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}o($n,"getMarkerId");function hs(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let s=new Set;return e.reduce((a,c)=>([c.markerStart||r,c.markerEnd||i].forEach(l=>{if(l&&typeof l=="object"){let u=$n(l,t);s.has(u)||(a.push({id:u,color:l.color||n,...l}),s.add(u))}}),a),[]).sort((a,c)=>a.id.localeCompare(c.id))}o(hs,"createMarkerIds");var ps=1e3,Cd=10,$r={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},_d={...$r,checkEquality:!0};function Lr(e,t){let n={...e};for(let r in t)t[r]!==void 0&&(n[r]=t[r]);return n}o(Lr,"mergeObjects");function gs(e,t,n){let r=Lr($r,n);for(let i of e.values())if(i.parentId)Br(i,e,t,r);else{let s=en(i,r.nodeOrigin),a=it(i.extent)?i.extent:r.nodeExtent,c=ot(s,a,xe(i));i.internals.positionAbsolute=c}}o(gs,"updateAbsolutePositions");function Nd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let i of e.handles){let s={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"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}o(Nd,"parseHandles");function Hr(e){return e==="manual"}o(Hr,"isManualZIndexMode");function Ln(e,t,n,r={}){let i=Lr(_d,r),s={i:0},a=new Map(t),c=i?.elevateNodesOnSelect&&!Hr(i.zIndexMode)?ps:0,l=e.length>0,u=!1;t.clear(),n.clear();for(let d of e){let h=a.get(d.id);if(i.checkEquality&&d===h?.internals.userNode)t.set(d.id,h);else{let f=en(d,i.nodeOrigin),g=it(d.extent)?d.extent:i.nodeExtent,m=ot(f,g,xe(d));h={...i.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:m,handleBounds:Nd(d,h),z:ms(d,c,i.zIndexMode),userNode:d}},t.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(l=!1),d.parentId&&Br(h,t,n,r,s),u||=d.selected??!1}return{nodesInitialized:l,hasSelectedNodes:u}}o(Ln,"adoptUserNodes");function Md(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}o(Md,"updateParentLookup");function Br(e,t,n,r,i){let{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:c,zIndexMode:l}=Lr($r,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Md(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&l==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*Cd),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);let h=s&&!Hr(l)?ps:0,{x:f,y:g,z:m}=Id(e,d,a,c,h,l),{positionAbsolute:S}=e.internals,x=f!==S.x||g!==S.y;(x||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:g}:S,z:m}})}o(Br,"updateChildNode");function ms(e,t,n){let r=ye(e.zIndex)?e.zIndex:0;return Hr(n)?r:r+(e.selected?t:0)}o(ms,"calculateZ");function Id(e,t,n,r,i,s){let{x:a,y:c}=t.internals.positionAbsolute,l=xe(e),u=en(e,n),d=it(e.extent)?ot(u,e.extent,l):u,h=ot({x:a+d.x,y:c+d.y},r,l);e.extent==="parent"&&(h=is(h,l,t));let f=ms(e,i,s),g=t.internals.z??0;return{x:h.x,y:h.y,z:g>=f?g+1:f}}o(Id,"calculateChildXYZ");function Hn(e,t,n,r=[0,0]){let i=[],s=new Map;for(let a of e){let c=t.get(a.parentId);if(!c)continue;let l=s.get(a.parentId)?.expandedRect??xt(c),u=Mr(l,a.rect);s.set(a.parentId,{expandedRect:u,parent:c})}return s.size>0&&s.forEach(({expandedRect:a,parent:c},l)=>{let u=c.internals.positionAbsolute,d=xe(c),h=c.origin??r,f=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,g=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,m=Math.max(d.width,Math.round(a.width)),S=Math.max(d.height,Math.round(a.height)),x=(m-d.width)*h[0],w=(S-d.height)*h[1];(f>0||g>0||x||w)&&(i.push({id:l,type:"position",position:{x:c.position.x-f+x,y:c.position.y-g+w}}),n.get(l)?.forEach(E=>{e.some(p=>p.id===E.id)||i.push({id:E.id,type:"position",position:{x:E.position.x+f,y:E.position.y+g}})})),(d.width<a.width||d.height<a.height||f||g)&&i.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(f?h[0]*f-x:0),height:S+(g?h[1]*g-w:0)}})}),i}o(Hn,"handleExpandParent");function ys(e,t,n,r,i,s,a){let c=r?.querySelector(".xyflow__viewport"),l=!1;if(!c)return{changes:[],updatedInternals:l};let u=[],d=window.getComputedStyle(c),{m22:h}=new window.DOMMatrixReadOnly(d.transform),f=[];for(let g of e.values()){let m=t.get(g.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}let S=Tn(g.nodeElement),x=m.measured.width!==S.width||m.measured.height!==S.height;if(!!(S.width&&S.height&&(x||!m.internals.handleBounds||g.force))){let E=g.nodeElement.getBoundingClientRect(),p=it(m.extent)?m.extent:s,{positionAbsolute:b}=m.internals;if(m.parentId&&m.extent==="parent"){let C=t.get(m.parentId);C&&(b=is(b,S,C))}else p&&(b=ot(b,p,S));let N={...m,measured:S,internals:{...m.internals,positionAbsolute:b,handleBounds:{source:Yi("source",g.nodeElement,E,h,m.id),target:Yi("target",g.nodeElement,E,h,m.id)}}};t.set(m.id,N),m.parentId&&Br(N,t,n,{nodeOrigin:i,zIndexMode:a}),l=!0,x&&(u.push({id:m.id,type:"dimensions",dimensions:S}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:xt(N,i)}))}}if(f.length>0){let g=Hn(f,t,n,i);u.push(...g)}return{changes:u,updatedInternals:l}}o(ys,"updateNodeInternals");async function ws({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return!1;let a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}o(ws,"panBy");function Qi(e,t,n,r,i,s){let a=i,c=r.get(a)||new Map;r.set(a,c.set(n,t)),a=`${i}-${e}`;let l=r.get(a)||new Map;if(r.set(a,l.set(n,t)),s){a=`${i}-${e}-${s}`;let u=r.get(a)||new Map;r.set(a,u.set(n,t))}}o(Qi,"addConnectionToLookup");function Vr(e,t,n){e.clear(),t.clear();for(let r of n){let{source:i,target:s,sourceHandle:a=null,targetHandle:c=null}=r,l={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:c},u=`${i}-${a}--${s}-${c}`,d=`${s}-${c}--${i}-${a}`;Qi("source",l,d,e,i,a),Qi("target",l,u,e,s,c),t.set(r.id,r)}}o(Vr,"updateConnectionLookup");function xs(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:xs(n,t):!1}o(xs,"isParentSelected");function Ji(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}o(Ji,"hasSelector");function Pd(e,t,n,r){let i=new Map;for(let[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!xs(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){let c=e.get(s);c&&i.set(s,{id:s,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return i}o(Pd,"getDragItems");function yr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[a,c]of t){let l=n.get(a)?.internals.userNode;l&&i.push({...l,position:c.position,dragging:r})}if(!e)return[i[0],i];let s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:r}:i[0],i]}o(yr,"getEventHandlerParams");function kd({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let s={x:n-i.distance.x,y:r-i.distance.y},a=bt(s,t);return{x:a.x-s.x,y:a.y-s.y}}o(kd,"calculateSnapOffset");function bs({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,c=new Map,l=!1,u={x:0,y:0},d=null,h=!1,f=null,g=!1,m=!1,S=null;function x({noDragClassName:E,handleSelector:p,domNode:b,isSelectable:N,nodeId:C,nodeClickDistance:I=0}){f=ce(b);function R({x:B,y:$}){let{nodeLookup:y,nodeExtent:v,snapGrid:_,snapToGrid:M,nodeOrigin:D,onNodeDrag:T,onSelectionDrag:H,onError:L,updateNodePositions:F}=t();s={x:B,y:$};let q=!1,W=c.size>1,G=W&&v?br(wt(c)):null,j=W&&M?kd({dragItems:c,snapGrid:_,x:B,y:$}):null;for(let[U,z]of c){if(!y.has(U))continue;let Y={x:B-z.distance.x,y:$-z.distance.y};M&&(Y=j?{x:Math.round(Y.x+j.x),y:Math.round(Y.y+j.y)}:bt(Y,_));let J=null;if(W&&v&&!z.extent&&G){let{positionAbsolute:K}=z.internals,ee=K.x-G.x+v[0][0],te=K.x+z.measured.width-G.x2+v[1][0],oe=K.y-G.y+v[0][1],ue=K.y+z.measured.height-G.y2+v[1][1];J=[[ee,oe],[te,ue]]}let{position:Q,positionAbsolute:Z}=Nr({nodeId:U,nextPosition:Y,nodeLookup:y,nodeExtent:J||v,nodeOrigin:D,onError:L});q=q||z.position.x!==Q.x||z.position.y!==Q.y,z.position=Q,z.internals.positionAbsolute=Z}if(m=m||q,!!q&&(F(c,!0),S&&(r||T||!C&&H))){let[U,z]=yr({nodeId:C,dragItems:c,nodeLookup:y});r?.(S,c,U,z),T?.(S,U,z),C||H?.(S,z)}}o(R,"updateNodes");async function A(){if(!d)return;let{transform:B,panBy:$,autoPanSpeed:y,autoPanOnNodeDrag:v}=t();if(!v){l=!1,cancelAnimationFrame(a);return}let[_,M]=Pn(u,d,y);(_!==0||M!==0)&&(s.x=(s.x??0)-_/B[2],s.y=(s.y??0)-M/B[2],await $({x:_,y:M})&&R(s)),a=requestAnimationFrame(A)}o(A,"autoPan");function V(B){let{nodeLookup:$,multiSelectionActive:y,nodesDraggable:v,transform:_,snapGrid:M,snapToGrid:D,selectNodesOnDrag:T,onNodeDragStart:H,onSelectionDragStart:L,unselectNodesAndEdges:F}=t();h=!0,(!T||!N)&&!y&&C&&($.get(C)?.selected||F()),N&&T&&C&&e?.(C);let q=jt(B.sourceEvent,{transform:_,snapGrid:M,snapToGrid:D,containerBounds:d});if(s=q,c=Pd($,v,q,C),c.size>0&&(n||H||!C&&L)){let[W,G]=yr({nodeId:C,dragItems:c,nodeLookup:$});n?.(B.sourceEvent,c,W,G),H?.(B.sourceEvent,W,G),C||L?.(B.sourceEvent,G)}}o(V,"startDrag");let O=Ht().clickDistance(I).on("start",B=>{let{domNode:$,nodeDragThreshold:y,transform:v,snapGrid:_,snapToGrid:M}=t();d=$?.getBoundingClientRect()||null,g=!1,m=!1,S=B.sourceEvent,y===0&&V(B),s=jt(B.sourceEvent,{transform:v,snapGrid:_,snapToGrid:M,containerBounds:d}),u=we(B.sourceEvent,d)}).on("drag",B=>{let{autoPanOnNodeDrag:$,transform:y,snapGrid:v,snapToGrid:_,nodeDragThreshold:M,nodeLookup:D}=t(),T=jt(B.sourceEvent,{transform:y,snapGrid:v,snapToGrid:_,containerBounds:d});if(S=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||C&&!D.has(C))&&(g=!0),!g){if(!l&&$&&h&&(l=!0,A()),!h){let H=we(B.sourceEvent,d),L=H.x-u.x,F=H.y-u.y;Math.sqrt(L*L+F*F)>M&&V(B)}(s.x!==T.xSnapped||s.y!==T.ySnapped)&&c&&h&&(u=we(B.sourceEvent,d),R(T))}}).on("end",B=>{if(!h||g){g&&c.size>0&&t().updateNodePositions(c,!1);return}if(l=!1,h=!1,cancelAnimationFrame(a),c.size>0){let{nodeLookup:$,updateNodePositions:y,onNodeDragStop:v,onSelectionDragStop:_}=t();if(m&&(y(c,!1),m=!1),i||v||!C&&_){let[M,D]=yr({nodeId:C,dragItems:c,nodeLookup:$,dragging:!1});i?.(B.sourceEvent,c,M,D),v?.(B.sourceEvent,M,D),C||_?.(B.sourceEvent,D)}}}).filter(B=>{let $=B.target;return!B.button&&(!E||!Ji($,`.${E}`,b))&&(!p||Ji($,p,b))});f.call(O)}o(x,"update");function w(){f?.on(".drag",null)}return o(w,"destroy"),{update:x,destroy:w}}o(bs,"XYDrag");function Ad(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let s of t.values())nn(i,xt(s))>0&&r.push(s);return r}o(Ad,"getNodesWithinDistance");var Dd=250;function Td(e,t,n,r){let i=[],s=1/0,a=Ad(e,n,t+Dd);for(let c of a){let l=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(let u of l){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;let{x:d,y:h}=Ye(c,u,u.position,!0),f=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));f>t||(f<s?(i=[{...u,x:d,y:h}],s=f):f===s&&i.push({...u,x:d,y:h}))}}if(!i.length)return null;if(i.length>1){let c=r.type==="source"?"target":"source";return i.find(l=>l.type===c)??i[0]}return i[0]}o(Td,"getClosestHandle");function Ss(e,t,n,r,i,s=!1){let a=r.get(e);if(!a)return null;let c=i==="strict"?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],l=(n?c?.find(u=>u.id===n):c?.[0])??null;return l&&s?{...l,...Ye(a,l,l.position,!0)}:l}o(Ss,"getHandle");function Es(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}o(Es,"getHandleType");function Rd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}o(Rd,"isConnectionValid");var vs=o(()=>!0,"alwaysValid");function Od(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:c,nodeLookup:l,lib:u,autoPanOnConnect:d,flowId:h,panBy:f,cancelConnection:g,onConnectStart:m,onConnect:S,onConnectEnd:x,isValidConnection:w=vs,onReconnectEnd:E,updateConnection:p,getTransform:b,getFromHandle:N,autoPanSpeed:C,dragThreshold:I=1,handleDomNode:R}){let A=Tr(e.target),V=0,O,{x:B,y:$}=we(e),y=Es(s,R),v=c?.getBoundingClientRect(),_=!1;if(!v||!y)return;let M=Ss(i,y,r,l,t);if(!M)return;let D=we(e,v),T=!1,H=null,L=!1,F=null;function q(){if(!d||!v)return;let[Q,Z]=Pn(D,v,C);f({x:Q,y:Z}),V=requestAnimationFrame(q)}o(q,"autoPan");let W={...M,nodeId:i,type:y,position:M.position},G=l.get(i),U={inProgress:!0,isValid:null,from:Ye(G,W,X.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:G,to:D,toHandle:null,toPosition:Fi[W.position],toNode:null,pointer:D};function z(){_=!0,p(U),m?.(e,{nodeId:i,handleId:r,handleType:y})}o(z,"startConnection"),I===0&&z();function Y(Q){if(!_){let{x:ue,y:Ie}=we(Q),Ce=ue-B,_e=Ie-$;if(!(Ce*Ce+_e*_e>I*I))return;z()}if(!N()||!W){J(Q);return}let Z=b();D=we(Q,v),O=Td(St(D,Z,!1,[1,1]),n,l,W),T||(q(),T=!0);let K=Cs(Q,{handle:O,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:w,doc:A,lib:u,flowId:h,nodeLookup:l});F=K.handleDomNode,H=K.connection,L=Rd(!!O,K.isValid);let ee=l.get(i),te=ee?Ye(ee,W,X.Left,!0):U.from,oe={...U,from:te,isValid:L,to:K.toHandle&&L?rt({x:K.toHandle.x,y:K.toHandle.y},Z):D,toHandle:K.toHandle,toPosition:L&&K.toHandle?K.toHandle.position:Fi[W.position],toNode:K.toHandle?l.get(K.toHandle.nodeId):null,pointer:D};p(oe),U=oe}o(Y,"onPointerMove");function J(Q){if(!("touches"in Q&&Q.touches.length>0)){if(_){(O||F)&&H&&L&&S?.(H);let{inProgress:Z,...K}=U,ee={...K,toPosition:U.toHandle?U.toPosition:null};x?.(Q,ee),s&&E?.(Q,ee)}g(),cancelAnimationFrame(V),T=!1,L=!1,H=null,F=null,A.removeEventListener("mousemove",Y),A.removeEventListener("mouseup",J),A.removeEventListener("touchmove",Y),A.removeEventListener("touchend",J)}}o(J,"onPointerUp"),A.addEventListener("mousemove",Y),A.addEventListener("mouseup",J),A.addEventListener("touchmove",Y),A.addEventListener("touchend",J)}o(Od,"onPointerDown");function Cs(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:c,flowId:l,isValidConnection:u=vs,nodeLookup:d}){let h=s==="target",f=t?a.querySelector(`.${c}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:m}=we(e),S=a.elementFromPoint(g,m),x=S?.classList.contains(`${c}-flow__handle`)?S:f,w={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){let E=Es(void 0,x),p=x.getAttribute("data-nodeid"),b=x.getAttribute("data-handleid"),N=x.classList.contains("connectable"),C=x.classList.contains("connectableend");if(!p||!E)return w;let I={source:h?p:r,sourceHandle:h?b:i,target:h?r:p,targetHandle:h?i:b};w.connection=I;let A=N&&C&&(n===We.Strict?h&&E==="source"||!h&&E==="target":p!==r||b!==i);w.isValid=A&&u(I),w.toHandle=Ss(p,E,b,d,n,!0)}return w}o(Cs,"isValidHandle");var Bn={onPointerDown:Od,isValid:Cs};function _s({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=ce(e);function s({translateExtent:c,width:l,height:u,zoomStep:d=1,pannable:h=!0,zoomable:f=!0,inversePan:g=!1}){let m=o(p=>{if(p.sourceEvent.type!=="wheel"||!t)return;let b=n(),N=p.sourceEvent.ctrlKey&&Et()?10:1,C=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,I=b[2]*Math.pow(2,C*N);t.scaleTo(I)},"zoomHandler"),S=[0,0],x=o(p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(S=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},"panStartHandler"),w=o(p=>{let b=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;let N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],C=[N[0]-S[0],N[1]-S[1]];S=N;let I=r()*Math.max(b[2],Math.log(b[2]))*(g?-1:1),R={x:b[0]-C[0]*I,y:b[1]-C[1]*I},A=[[0,0],[l,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:b[2]},A,c)},"panHandler"),E=Jt().on("start",x).on("zoom",h?w:null).on("zoom.wheel",f?m:null);i.call(E,{})}o(s,"update");function a(){i.on("zoom",null)}return o(a,"destroy"),{update:s,destroy:a,pointer:fe}}o(_s,"XYMinimap");var Vn=o(e=>({x:e.x,y:e.y,zoom:e.k}),"transformToViewport"),wr=o(({x:e,y:t,zoom:n})=>et.translate(e,t).scale(n),"viewportToTransform"),Fe=o((e,t)=>e.target.closest(`.${t}`),"isWrappedWithClass"),Ns=o((e,t)=>t===2&&Array.isArray(e)&&e.includes(2),"isRightClickPan"),zd=o(e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,"defaultEase"),xr=o((e,t=0,n=zd,r=()=>{})=>{let i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},"getD3Transition"),Ms=o(e=>{let t=e.ctrlKey&&Et()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},"wheelDelta");function $d({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:c,onPanZoom:l,onPanZoomEnd:u}){return d=>{if(Fe(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();let h=n.property("__zoom").k||1;if(d.ctrlKey&&a){let x=fe(d),w=Ms(d),E=h*Math.pow(2,w);r.scaleTo(n,E,x,d);return}let f=d.deltaMode===1?20:1,g=i===ze.Vertical?0:d.deltaX*f,m=i===ze.Horizontal?0:d.deltaY*f;!Et()&&d.shiftKey&&i!==ze.Vertical&&(g=d.deltaY*f,m=0),r.translateBy(n,-(g/h)*s,-(m/h)*s,{internal:!0});let S=Vn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(d,S):(e.isPanScrolling=!0,c?.(d,S)),e.panScrollTimeout=setTimeout(()=>{u?.(d,S),e.isPanScrolling=!1},150)}}o($d,"createPanOnScrollHandler");function Ld({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,c=Fe(r,e);if(r.ctrlKey&&s&&c&&r.preventDefault(),a||c)return null;r.preventDefault(),n.call(this,r,i)}}o(Ld,"createZoomOnScrollHandler");function Hd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Vn(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,i)}}o(Hd,"createPanZoomStartHandler");function Bd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{e.usedRightMouseButton=!!(n&&Ns(t,e.mouseButton??0)),s.sourceEvent?.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!s.sourceEvent?.internal&&i?.(s.sourceEvent,Vn(s.transform))}}o(Bd,"createPanZoomHandler");function Vd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Ns(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let c=Vn(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,c)},n?150:0)}}}o(Vd,"createPanZoomEndHandler");function Fd({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:s,zoomOnDoubleClick:a,userSelectionActive:c,noWheelClassName:l,noPanClassName:u,lib:d,connectionInProgress:h}){return f=>{let g=t||n,m=r&&f.ctrlKey,S=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Fe(f,`${d}-flow__node`)||Fe(f,`${d}-flow__edge`)||Fe(f,`${d}-flow__selection`)||Fe(f,`${d}-flow__nodesselection`)))return!0;if(!i&&!g&&!s&&!a&&!r||c||h&&!S||Fe(f,l)&&S||Fe(f,u)&&(!S||s&&S&&!t)||!r&&f.ctrlKey&&S)return!1;if(!r&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!g&&!s&&!m&&S||!i&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(i)&&!i.includes(f.button)&&f.type==="mousedown")return!1;let x=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||S||e)&&x}}o(Fd,"createFilter");function Is({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:l}){let u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),h=[[0,0],[d.width,d.height]];(typeof ResizeObserver<"u"?new ResizeObserver($=>{let y=$[0];y&&(h=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);let g=Jt().extent(()=>h).scaleExtent([t,n]).translateExtent(r),m=ce(e).call(g);b({x:i.x,y:i.y,zoom:mt(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);let S=m.on("wheel.zoom"),x=m.on("dblclick.zoom");g.wheelDelta(Ms);async function w($,y){return m?new Promise(v=>{g?.interpolate(y?.interpolate==="linear"?ln:ct).transform(xr(m,y?.duration,y?.ease,()=>v(!0)),$)}):!1}o(w,"setTransform");function E({noWheelClassName:$,noPanClassName:y,onPaneContextMenu:v,userSelectionActive:_,panOnScroll:M,panOnDrag:D,panOnScrollMode:T,panOnScrollSpeed:H,preventScrolling:L,zoomOnPinch:F,zoomOnScroll:q,zoomOnDoubleClick:W,panActivationKeyPressed:G=!1,zoomActivationKeyPressed:j,lib:U,onTransformChange:z,connectionInProgress:Y,paneClickDistance:J,selectionOnDrag:Q}){_&&!u.isZoomingOrPanning&&p();let Z=M&&!j&&!_;g.clickDistance(Q?1/0:!ye(J)||J<0?0:J);let K=Z?$d({zoomPanValues:u,noWheelClassName:$,d3Selection:m,d3Zoom:g,panOnScrollMode:T,panOnScrollSpeed:H,zoomOnPinch:F,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:c}):Ld({noWheelClassName:$,preventScrolling:L,d3ZoomHandler:S});m.on("wheel.zoom",K,{passive:!1});let ee=Hd({zoomPanValues:u,onDraggingChange:l,onPanZoomStart:a});g.on("start",ee);let te=Bd({zoomPanValues:u,panOnDrag:D,onPaneContextMenu:!!v,onPanZoom:s,onTransformChange:z});g.on("zoom",te);let oe=Vd({zoomPanValues:u,panOnDrag:D,panOnScroll:M,onPaneContextMenu:v,onPanZoomEnd:c,onDraggingChange:l});g.on("end",oe);let ue=Fd({panActivationKeyPressed:G,zoomActivationKeyPressed:j,panOnDrag:D,zoomOnScroll:q,panOnScroll:M,zoomOnDoubleClick:W,zoomOnPinch:F,userSelectionActive:_,noPanClassName:y,noWheelClassName:$,lib:U,connectionInProgress:Y});g.filter(ue),W?m.on("dblclick.zoom",x):m.on("dblclick.zoom",null)}o(E,"update");function p(){g.on("zoom",null)}o(p,"destroy");async function b($,y,v){let _=wr($),M=g?.constrain()(_,y,v);return M&&await w(M),M}o(b,"setViewportConstrained");async function N($,y){let v=wr($);return await w(v,y),v}o(N,"setViewport");function C($){if(m){let y=wr($),v=m.property("__zoom");(v.k!==$.zoom||v.x!==$.x||v.y!==$.y)&&g?.transform(m,y,null,{sync:!0})}}o(C,"syncViewport");function I(){let $=m?Qt(m.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}o(I,"getViewport");async function R($,y){return m?new Promise(v=>{g?.interpolate(y?.interpolate==="linear"?ln:ct).scaleTo(xr(m,y?.duration,y?.ease,()=>v(!0)),$)}):!1}o(R,"scaleTo");async function A($,y){return m?new Promise(v=>{g?.interpolate(y?.interpolate==="linear"?ln:ct).scaleBy(xr(m,y?.duration,y?.ease,()=>v(!0)),$)}):!1}o(A,"scaleBy");function V($){g?.scaleExtent($)}o(V,"setScaleExtent");function O($){g?.translateExtent($)}o(O,"setTranslateExtent");function B($){let y=!ye($)||$<0?0:$;g?.clickDistance(y)}return o(B,"setClickDistance"),{update:E,destroy:p,setViewport:N,setViewportConstrained:b,getViewport:I,scaleTo:R,scaleBy:A,setScaleExtent:V,setTranslateExtent:O,syncViewport:C,setClickDistance:B}}o(Is,"XYPanZoom");var Xe;(function(e){e.Line="line",e.Handle="handle"})(Xe||(Xe={}));function Wd({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){let a=e-t,c=n-r,l=[a>0?1:a<0?-1:0,c>0?1:c<0?-1:0];return a&&i&&(l[0]=l[0]*-1),c&&s&&(l[1]=l[1]*-1),l}o(Wd,"getResizeDirection");function ji(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}o(ji,"getControlDirection");function Be(e,t){return Math.max(0,t-e)}o(Be,"getLowerExtentClamp");function Ve(e,t){return Math.max(0,e-t)}o(Ve,"getUpperExtentClamp");function Nn(e,t,n){return Math.max(0,t-e,e-n)}o(Nn,"getSizeClamp");function es(e,t){return e?!t:t}o(es,"xor");function Yd(e,t,n,r,i,s,a,c){let{affectsX:l,affectsY:u}=t,{isHorizontal:d,isVertical:h}=t,f=d&&h,{xSnapped:g,ySnapped:m}=n,{minWidth:S,maxWidth:x,minHeight:w,maxHeight:E}=r,{x:p,y:b,width:N,height:C,aspectRatio:I}=e,R=Math.floor(d?g-e.pointerX:0),A=Math.floor(h?m-e.pointerY:0),V=N+(l?-R:R),O=C+(u?-A:A),B=-s[0]*N,$=-s[1]*C,y=Nn(V,S,x),v=Nn(O,w,E);if(a){let D=0,T=0;l&&R<0?D=Be(p+R+B,a[0][0]):!l&&R>0&&(D=Ve(p+V+B,a[1][0])),u&&A<0?T=Be(b+A+$,a[0][1]):!u&&A>0&&(T=Ve(b+O+$,a[1][1])),y=Math.max(y,D),v=Math.max(v,T)}if(c){let D=0,T=0;l&&R>0?D=Ve(p+R,c[0][0]):!l&&R<0&&(D=Be(p+V,c[1][0])),u&&A>0?T=Ve(b+A,c[0][1]):!u&&A<0&&(T=Be(b+O,c[1][1])),y=Math.max(y,D),v=Math.max(v,T)}if(i){if(d){let D=Nn(V/I,w,E)*I;if(y=Math.max(y,D),a){let T=0;!l&&!u||l&&!u&&f?T=Ve(b+$+V/I,a[1][1])*I:T=Be(b+$+(l?R:-R)/I,a[0][1])*I,y=Math.max(y,T)}if(c){let T=0;!l&&!u||l&&!u&&f?T=Be(b+V/I,c[1][1])*I:T=Ve(b+(l?R:-R)/I,c[0][1])*I,y=Math.max(y,T)}}if(h){let D=Nn(O*I,S,x)/I;if(v=Math.max(v,D),a){let T=0;!l&&!u||u&&!l&&f?T=Ve(p+O*I+B,a[1][0])/I:T=Be(p+(u?A:-A)*I+B,a[0][0])/I,v=Math.max(v,T)}if(c){let T=0;!l&&!u||u&&!l&&f?T=Be(p+O*I,c[1][0])/I:T=Ve(p+(u?A:-A)*I,c[0][0])/I,v=Math.max(v,T)}}}A=A+(A<0?v:-v),R=R+(R<0?y:-y),i&&(f?V>O*I?A=(es(l,u)?-R:R)/I:R=(es(l,u)?-A:A)*I:d?(A=R/I,u=l):(R=A*I,l=u));let _=l?p+R:p,M=u?b+A:b;return{width:N+(l?-R:R),height:C+(u?-A:A),x:s[0]*R*(l?-1:1)+_,y:s[1]*A*(u?-1:1)+M}}o(Yd,"getDimensionsAfterResize");var Ps={width:0,height:0,x:0,y:0},Xd={...Ps,pointerX:0,pointerY:0,aspectRatio:1};function Zd(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,c=n[0]*s,l=n[1]*a;return[[r-c,i-l],[r+s-c,i+a-l]]}o(Zd,"nodeToChildExtent");function ks({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let s=ce(e),a={controlDirection:ji("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:u,boundaries:d,keepAspectRatio:h,resizeDirection:f,onResizeStart:g,onResize:m,onResizeEnd:S,shouldResize:x}){let w={...Ps},E={...Xd};a={boundaries:d,resizeDirection:f,keepAspectRatio:h,controlDirection:ji(u)};let p,b=null,N=[],C,I,R,A=Ht().on("start",V=>{let{nodeLookup:O,transform:B,snapGrid:$,snapToGrid:y,nodeOrigin:v,paneDomNode:_}=n();if(p=O.get(t),!p)return;b=_?.getBoundingClientRect()??null;let{xSnapped:M,ySnapped:D}=jt(V.sourceEvent,{transform:B,snapGrid:$,snapToGrid:y,containerBounds:b});w={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},E={...w,pointerX:M,pointerY:D,aspectRatio:w.width/w.height},C=void 0,I=it(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(C=O.get(p.parentId)),C&&p.extent==="parent"&&(I=[[0,0],[C.measured.width,C.measured.height]]),N=[],R=void 0;for(let[T,H]of O)if(H.parentId===t&&(N.push({id:T,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){let L=Zd(H,p,H.origin??v);R?R=[[Math.min(L[0][0],R[0][0]),Math.min(L[0][1],R[0][1])],[Math.max(L[1][0],R[1][0]),Math.max(L[1][1],R[1][1])]]:R=L}g?.(V,{...w})}).on("drag",V=>{let{transform:O,snapGrid:B,snapToGrid:$,nodeOrigin:y}=n(),v=jt(V.sourceEvent,{transform:O,snapGrid:B,snapToGrid:$,containerBounds:b}),_=[];if(!p)return;let{x:M,y:D,width:T,height:H}=w,L={},F=p.origin??y,{width:q,height:W,x:G,y:j}=Yd(E,a.controlDirection,v,a.boundaries,a.keepAspectRatio,F,I,R),U=q!==T,z=W!==H,Y=G!==M&&U,J=j!==D&&z;if(!Y&&!J&&!U&&!z)return;let Q={prevValues:{...w},startX:E.x,startY:E.y,childNodes:N.map(te=>({...te,position:{...te.position}}))};if((Y||J||F[0]===1||F[1]===1)&&(L.x=Y?G:w.x,L.y=J?j:w.y,w.x=L.x,w.y=L.y,N.length>0)){let te=G-M,oe=j-D;for(let ue of N)ue.position={x:ue.position.x-te+F[0]*(q-T),y:ue.position.y-oe+F[1]*(W-H)},_.push(ue)}if((U||z)&&(L.width=U&&(!a.resizeDirection||a.resizeDirection==="horizontal")?q:w.width,L.height=z&&(!a.resizeDirection||a.resizeDirection==="vertical")?W:w.height,w.width=L.width,w.height=L.height),C&&p.expandParent){let te=F[0]*(L.width??0);L.x&&L.x<te&&(w.x=te,E.x=E.x-(L.x-te));let oe=F[1]*(L.height??0);L.y&&L.y<oe&&(w.y=oe,E.y=E.y-(L.y-oe))}let Z=Wd({width:w.width,prevWidth:T,height:w.height,prevHeight:H,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),K={...w,direction:Z};if(x?.(V,K)===!1){w=Q.prevValues,E.x=Q.startX,E.y=Q.startY,N.forEach((te,oe)=>{te.position=Q.childNodes[oe].position});return}m?.(V,K),r(L,_)}).on("end",V=>{S?.(V,{...w}),i?.({...w})});s.call(A)}o(c,"update");function l(){s.on(".drag",null)}return o(l,"destroy"),{update:c,destroy:l}}o(ks,"XYResizer");var k=Ke(di()),P=Ke(no());function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ae(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}o(ae,"cc");var Rs=Ke(no(),1),Os=Ke(xl(),1);var As=o(e=>{let t,n=new Set,r=o((d,h)=>{let f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){let g=t;t=h??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,g))}},"setState"),i=o(()=>t,"getState"),l={setState:r,getState:i,getInitialState:o(()=>u,"getInitialState"),subscribe:o(d=>(n.add(d),()=>n.delete(d)),"subscribe"),destroy:o(()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()},"destroy")},u=t=e(r,i,l);return l},"createStoreImpl"),Ds=o(e=>e?As(e):As,"createStore");var{useDebugValue:Ud}=Rs.default,{useSyncExternalStoreWithSelector:qd}=Os.default,Gd=o(e=>e,"identity");function Fr(e,t=Gd,n){let r=qd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ud(r),r}o(Fr,"useStoreWithEqualityFn");var Ts=o((e,t)=>{let n=Ds(e),r=o((i,s=t)=>Fr(n,i,s),"useBoundStoreWithEqualityFn");return Object.assign(r,n),r},"createWithEqualityFnImpl"),zs=o((e,t)=>e?Ts(e,t):Ts,"createWithEqualityFn");function re(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(let[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}o(re,"shallow$1");var Kd=Ke(wl());var Zn=(0,P.createContext)(null),Qd=Zn.Provider,la=ge.error001("react");function ne(e,t){let n=(0,P.useContext)(Zn);if(n===null)throw new Error(la);return Fr(n,e,t)}o(ne,"useStore");function ie(){let e=(0,P.useContext)(Zn);if(e===null)throw new Error(la);return(0,P.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}o(ie,"useStoreApi");var $s={display:"none"},Jd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ua="react-flow__node-desc",da="react-flow__edge-desc",jd="react-flow__aria-live",ef=o(e=>e.ariaLiveMessage,"ariaLiveSelector"),tf=o(e=>e.ariaLabelConfig,"ariaLabelConfigSelector");function nf({rfId:e}){let t=ne(ef);return(0,k.jsx)("div",{id:`${jd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Jd,children:t})}o(nf,"AriaLiveMessage");function of({rfId:e,disableKeyboardA11y:t}){let n=ne(tf);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("div",{id:`${ua}-${e}`,style:$s,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,k.jsx)("div",{id:`${da}-${e}`,style:$s,children:n["edge.a11yDescription.default"]}),!t&&(0,k.jsx)(nf,{rfId:e})]})}o(of,"A11yDescriptions");var Ct=(0,P.forwardRef)(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{let a=`${e}`.split("-");return(0,k.jsx)("div",{className:ae(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});Ct.displayName="Panel";var Ls="https://reactflow.dev?utm_source=attribution";function rf({proOptions:e,position:t="bottom-right"}){return(0,P.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,k.jsx)(Ct,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ls}`,children:(0,k.jsx)("a",{href:Ls,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}o(rf,"Attribution");var sf=o(e=>{let t=[],n=[];for(let[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(let[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},"selector$l"),Fn=o(e=>e.id,"selectId");function af(e,t){return re(e.selectedNodes.map(Fn),t.selectedNodes.map(Fn))&&re(e.selectedEdges.map(Fn),t.selectedEdges.map(Fn))}o(af,"areEqual$1");function cf({onSelectionChange:e}){let t=ie(),{selectedNodes:n,selectedEdges:r}=ne(sf,af);return(0,P.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}o(cf,"SelectionListenerInner");var lf=o(e=>!!e.onSelectionChangeHandlers,"changeSelector");function uf({onSelectionChange:e}){let t=ne(lf);return e||t?(0,k.jsx)(cf,{onSelectionChange:e}):null}o(uf,"SelectionListener");var fa=[0,0],df={x:0,y:0,zoom:1},ff=["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"],Hs=[...ff,"rfId"],hf=o(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}),"selector$k"),Bs={translateExtent:yt,nodeOrigin:fa,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function pf(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:c,setDefaultNodesAndEdges:l}=ne(hf,re),u=ie();(0,P.useEffect)(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=Bs,c()}),[]);let d=(0,P.useRef)(Bs);return(0,P.useEffect)(()=>{for(let h of Hs){let f=e[h],g=d.current[h];f!==g&&(typeof e[h]>"u"||(h==="nodes"?t(f):h==="edges"?n(f):h==="minZoom"?r(f):h==="maxZoom"?i(f):h==="translateExtent"?s(f):h==="nodeExtent"?a(f):h==="ariaLabelConfig"?u.setState({ariaLabelConfig:cs(f)}):h==="fitView"?u.setState({fitViewQueued:f}):h==="fitViewOptions"?u.setState({fitViewOptions:f}):u.setState({[h]:f})))}d.current=e},Hs.map(h=>e[h])),null}o(pf,"StoreUpdater");function Vs(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}o(Vs,"getMediaQuery");function gf(e){let[t,n]=(0,P.useState)(e==="system"?null:e);return(0,P.useEffect)(()=>{if(e!=="system"){n(e);return}let r=Vs(),i=o(()=>n(r?.matches?"dark":"light"),"updateColorModeClass");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:Vs()?.matches?"dark":"light"}o(gf,"useColorModeClass");var Fs=typeof document<"u"?document:null;function rn(e=null,t={target:Fs,actInsideInputWithModifier:!0}){let[n,r]=(0,P.useState)(!1),i=(0,P.useRef)(!1),s=(0,P.useRef)(new Set([])),[a,c]=(0,P.useMemo)(()=>{if(e!==null){let u=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.replace(/\+/g,`
1
+ import{a as bi,b as Si,c as Ei,f as un}from"./chunk-NQZALRU3.js";import{e as hi,k as pi}from"./chunk-GHQ2VDI2.js";import{a as ro,b as io,c as mi,d as yi,e as ln,g as wi,h as xi,i as ct}from"./chunk-AUGKHAMQ.js";import{b as xl}from"./chunk-SJQERRSZ.js";import{a as wl}from"./chunk-7Y3SY37W.js";import{d as ui}from"./chunk-M3QKMHAP.js";import{d as fi,h as gi,q as oo}from"./chunk-74IYYDDI.js";import{a as o,d as Ke,e as no,g as di}from"./chunk-I26MS5PJ.js";var bl={value:o(()=>{},"value")};function Ci(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new dn(n)}o(Ci,"dispatch");function dn(e){this._=e}o(dn,"Dispatch");function Sl(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}o(Sl,"parseTypenames");dn.prototype=Ci.prototype={constructor:dn,on:o(function(e,t){var n=this._,r=Sl(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=El(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(i=(e=r[s]).type)n[i]=vi(n[i],e.name,t);else if(t==null)for(i in n)n[i]=vi(n[i],e.name,null);return this},"on"),copy:o(function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new dn(e)},"copy"),call:o(function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},"call"),apply:o(function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)},"apply")};function El(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}o(El,"get");function vi(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=bl,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}o(vi,"set");var Qe=Ci;var fn="http://www.w3.org/1999/xhtml",so={svg:"http://www.w3.org/2000/svg",xhtml:fn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ne(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),so.hasOwnProperty(t)?{space:so[t],local:e}:e}o(Ne,"default");function vl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===fn&&t.documentElement.namespaceURI===fn?t.createElement(e):t.createElementNS(n,e)}}o(vl,"creatorInherit");function Cl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}o(Cl,"creatorFixed");function Dt(e){var t=Ne(e);return(t.local?Cl:vl)(t)}o(Dt,"default");function _l(){}o(_l,"none");function $e(e){return e==null?_l:function(){return this.querySelector(e)}}o($e,"default");function ao(e){typeof e!="function"&&(e=$e(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,c=r[i]=new Array(a),l,u,d=0;d<a;++d)(l=s[d])&&(u=e.call(l,l.__data__,d,s))&&("__data__"in l&&(u.__data__=l.__data__),c[d]=u);return new se(r,this._parents)}o(ao,"default");function co(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}o(co,"array");function Nl(){return[]}o(Nl,"empty");function lt(e){return e==null?Nl:function(){return this.querySelectorAll(e)}}o(lt,"default");function Ml(e){return function(){return co(e.apply(this,arguments))}}o(Ml,"arrayAll");function lo(e){typeof e=="function"?e=Ml(e):e=lt(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var a=t[s],c=a.length,l,u=0;u<c;++u)(l=a[u])&&(r.push(e.call(l,l.__data__,u,a)),i.push(l));return new se(r,i)}o(lo,"default");function ut(e){return function(){return this.matches(e)}}o(ut,"default");function hn(e){return function(t){return t.matches(e)}}o(hn,"childMatcher");var Il=Array.prototype.find;function Pl(e){return function(){return Il.call(this.children,e)}}o(Pl,"childFind");function kl(){return this.firstElementChild}o(kl,"childFirst");function uo(e){return this.select(e==null?kl:Pl(typeof e=="function"?e:hn(e)))}o(uo,"default");var Al=Array.prototype.filter;function Dl(){return Array.from(this.children)}o(Dl,"children");function Tl(e){return function(){return Al.call(this.children,e)}}o(Tl,"childrenFilter");function fo(e){return this.selectAll(e==null?Dl:Tl(typeof e=="function"?e:hn(e)))}o(fo,"default");function ho(e){typeof e!="function"&&(e=ut(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,c=r[i]=[],l,u=0;u<a;++u)(l=s[u])&&e.call(l,l.__data__,u,s)&&c.push(l);return new se(r,this._parents)}o(ho,"default");function Tt(e){return new Array(e.length)}o(Tt,"default");function po(){return new se(this._enter||this._groups.map(Tt),this._parents)}o(po,"default");function Rt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}o(Rt,"EnterNode");Rt.prototype={constructor:Rt,appendChild:o(function(e){return this._parent.insertBefore(e,this._next)},"appendChild"),insertBefore:o(function(e,t){return this._parent.insertBefore(e,t)},"insertBefore"),querySelector:o(function(e){return this._parent.querySelector(e)},"querySelector"),querySelectorAll:o(function(e){return this._parent.querySelectorAll(e)},"querySelectorAll")};function go(e){return function(){return e}}o(go,"default");function Rl(e,t,n,r,i,s){for(var a=0,c,l=t.length,u=s.length;a<u;++a)(c=t[a])?(c.__data__=s[a],r[a]=c):n[a]=new Rt(e,s[a]);for(;a<l;++a)(c=t[a])&&(i[a]=c)}o(Rl,"bindIndex");function Ol(e,t,n,r,i,s,a){var c,l,u=new Map,d=t.length,h=s.length,f=new Array(d),g;for(c=0;c<d;++c)(l=t[c])&&(f[c]=g=a.call(l,l.__data__,c,t)+"",u.has(g)?i[c]=l:u.set(g,l));for(c=0;c<h;++c)g=a.call(e,s[c],c,s)+"",(l=u.get(g))?(r[c]=l,l.__data__=s[c],u.delete(g)):n[c]=new Rt(e,s[c]);for(c=0;c<d;++c)(l=t[c])&&u.get(f[c])===l&&(i[c]=l)}o(Ol,"bindKey");function zl(e){return e.__data__}o(zl,"datum");function mo(e,t){if(!arguments.length)return Array.from(this,zl);var n=t?Ol:Rl,r=this._parents,i=this._groups;typeof e!="function"&&(e=go(e));for(var s=i.length,a=new Array(s),c=new Array(s),l=new Array(s),u=0;u<s;++u){var d=r[u],h=i[u],f=h.length,g=$l(e.call(d,d&&d.__data__,u,r)),m=g.length,S=c[u]=new Array(m),x=a[u]=new Array(m),w=l[u]=new Array(f);n(d,h,S,x,w,g,t);for(var E=0,p=0,b,N;E<m;++E)if(b=S[E]){for(E>=p&&(p=E+1);!(N=x[p])&&++p<m;);b._next=N||null}}return a=new se(a,r),a._enter=c,a._exit=l,a}o(mo,"default");function $l(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}o($l,"arraylike");function yo(){return new se(this._exit||this._groups.map(Tt),this._parents)}o(yo,"default");function wo(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}o(wo,"default");function xo(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,a=Math.min(i,s),c=new Array(i),l=0;l<a;++l)for(var u=n[l],d=r[l],h=u.length,f=c[l]=new Array(h),g,m=0;m<h;++m)(g=u[m]||d[m])&&(f[m]=g);for(;l<i;++l)c[l]=n[l];return new se(c,this._parents)}o(xo,"default");function bo(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],a;--i>=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}o(bo,"default");function So(e){e||(e=Ll);function t(h,f){return h&&f?e(h.__data__,f.__data__):!h-!f}o(t,"compareNode");for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var a=n[s],c=a.length,l=i[s]=new Array(c),u,d=0;d<c;++d)(u=a[d])&&(l[d]=u);l.sort(t)}return new se(i,this._parents).order()}o(So,"default");function Ll(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}o(Ll,"ascending");function Eo(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}o(Eo,"default");function vo(){return Array.from(this)}o(vo,"default");function Co(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var a=r[i];if(a)return a}return null}o(Co,"default");function _o(){let e=0;for(let t of this)++e;return e}o(_o,"default");function No(){return!this.node()}o(No,"default");function Mo(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,a=i.length,c;s<a;++s)(c=i[s])&&e.call(c,c.__data__,s,i);return this}o(Mo,"default");function Hl(e){return function(){this.removeAttribute(e)}}o(Hl,"attrRemove");function Bl(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(Bl,"attrRemoveNS");function Vl(e,t){return function(){this.setAttribute(e,t)}}o(Vl,"attrConstant");function Fl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}o(Fl,"attrConstantNS");function Wl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}o(Wl,"attrFunction");function Yl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}o(Yl,"attrFunctionNS");function Io(e,t){var n=Ne(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Bl:Hl:typeof t=="function"?n.local?Yl:Wl:n.local?Fl:Vl)(n,t))}o(Io,"default");function Ot(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}o(Ot,"default");function Xl(e){return function(){this.style.removeProperty(e)}}o(Xl,"styleRemove");function Zl(e,t,n){return function(){this.style.setProperty(e,t,n)}}o(Zl,"styleConstant");function Ul(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}o(Ul,"styleFunction");function Po(e,t,n){return arguments.length>1?this.each((t==null?Xl:typeof t=="function"?Ul:Zl)(e,t,n??"")):Le(this.node(),e)}o(Po,"default");function Le(e,t){return e.style.getPropertyValue(t)||Ot(e).getComputedStyle(e,null).getPropertyValue(t)}o(Le,"styleValue");function ql(e){return function(){delete this[e]}}o(ql,"propertyRemove");function Gl(e,t){return function(){this[e]=t}}o(Gl,"propertyConstant");function Kl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}o(Kl,"propertyFunction");function ko(e,t){return arguments.length>1?this.each((t==null?ql:typeof t=="function"?Kl:Gl)(e,t)):this.node()[e]}o(ko,"default");function _i(e){return e.trim().split(/^|\s+/)}o(_i,"classArray");function Ao(e){return e.classList||new Ni(e)}o(Ao,"classList");function Ni(e){this._node=e,this._names=_i(e.getAttribute("class")||"")}o(Ni,"ClassList");Ni.prototype={add:o(function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},"add"),remove:o(function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},"remove"),contains:o(function(e){return this._names.indexOf(e)>=0},"contains")};function Mi(e,t){for(var n=Ao(e),r=-1,i=t.length;++r<i;)n.add(t[r])}o(Mi,"classedAdd");function Ii(e,t){for(var n=Ao(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}o(Ii,"classedRemove");function Ql(e){return function(){Mi(this,e)}}o(Ql,"classedTrue");function Jl(e){return function(){Ii(this,e)}}o(Jl,"classedFalse");function jl(e,t){return function(){(t.apply(this,arguments)?Mi:Ii)(this,e)}}o(jl,"classedFunction");function Do(e,t){var n=_i(e+"");if(arguments.length<2){for(var r=Ao(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?jl:t?Ql:Jl)(n,t))}o(Do,"default");function eu(){this.textContent=""}o(eu,"textRemove");function tu(e){return function(){this.textContent=e}}o(tu,"textConstant");function nu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}o(nu,"textFunction");function To(e){return arguments.length?this.each(e==null?eu:(typeof e=="function"?nu:tu)(e)):this.node().textContent}o(To,"default");function ou(){this.innerHTML=""}o(ou,"htmlRemove");function ru(e){return function(){this.innerHTML=e}}o(ru,"htmlConstant");function iu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}o(iu,"htmlFunction");function Ro(e){return arguments.length?this.each(e==null?ou:(typeof e=="function"?iu:ru)(e)):this.node().innerHTML}o(Ro,"default");function su(){this.nextSibling&&this.parentNode.appendChild(this)}o(su,"raise");function Oo(){return this.each(su)}o(Oo,"default");function au(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}o(au,"lower");function zo(){return this.each(au)}o(zo,"default");function $o(e){var t=typeof e=="function"?e:Dt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}o($o,"default");function cu(){return null}o(cu,"constantNull");function Lo(e,t){var n=typeof e=="function"?e:Dt(e),r=t==null?cu:typeof t=="function"?t:$e(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}o(Lo,"default");function lu(){var e=this.parentNode;e&&e.removeChild(this)}o(lu,"remove");function Ho(){return this.each(lu)}o(Ho,"default");function uu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(uu,"selection_cloneShallow");function du(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(du,"selection_cloneDeep");function Bo(e){return this.select(e?du:uu)}o(Bo,"default");function Vo(e){return arguments.length?this.property("__data__",e):this.node().__data__}o(Vo,"default");function fu(e){return function(t){e.call(this,t,this.__data__)}}o(fu,"contextListener");function hu(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}o(hu,"parseTypenames");function pu(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}o(pu,"onRemove");function gu(e,t,n){return function(){var r=this.__on,i,s=fu(t);if(r){for(var a=0,c=r.length;a<c;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}o(gu,"onAdd");function Fo(e,t,n){var r=hu(e+""),i,s=r.length,a;if(arguments.length<2){var c=this.node().__on;if(c){for(var l=0,u=c.length,d;l<u;++l)for(i=0,d=c[l];i<s;++i)if((a=r[i]).type===d.type&&a.name===d.name)return d.value}return}for(c=t?gu:pu,i=0;i<s;++i)this.each(c(r[i],t,n));return this}o(Fo,"default");function Pi(e,t,n){var r=Ot(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}o(Pi,"dispatchEvent");function mu(e,t){return function(){return Pi(this,e,t)}}o(mu,"dispatchConstant");function yu(e,t){return function(){return Pi(this,e,t.apply(this,arguments))}}o(yu,"dispatchFunction");function Wo(e,t){return this.each((typeof t=="function"?yu:mu)(e,t))}o(Wo,"default");function*Yo(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,a;i<s;++i)(a=r[i])&&(yield a)}o(Yo,"default");var Xo=[null];function se(e,t){this._groups=e,this._parents=t}o(se,"Selection");function ki(){return new se([[document.documentElement]],Xo)}o(ki,"selection");function wu(){return this}o(wu,"selection_selection");se.prototype=ki.prototype={constructor:se,select:ao,selectAll:lo,selectChild:uo,selectChildren:fo,filter:ho,data:mo,enter:po,exit:yo,join:wo,merge:xo,selection:wu,order:bo,sort:So,call:Eo,nodes:vo,node:Co,size:_o,empty:No,each:Mo,attr:Io,style:Po,property:ko,classed:Do,text:To,html:Ro,raise:Oo,lower:zo,append:$o,insert:Lo,remove:Ho,clone:Bo,datum:Vo,on:Fo,dispatch:Wo,[Symbol.iterator]:Yo};var De=ki;function ce(e){return typeof e=="string"?new se([[document.querySelector(e)]],[document.documentElement]):new se([[e]],Xo)}o(ce,"default");function Zo(e){let t;for(;t=e.sourceEvent;)e=t;return e}o(Zo,"default");function fe(e,t){if(e=Zo(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.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]}o(fe,"default");var Ai={passive:!1},Je={capture:!0,passive:!1};function pn(e){e.stopImmediatePropagation()}o(pn,"nopropagation");function Te(e){e.preventDefault(),e.stopImmediatePropagation()}o(Te,"default");function dt(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Te,Je);"onselectstart"in t?n.on("selectstart.drag",Te,Je):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}o(dt,"default");function zt(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",Te,Je),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}o(zt,"yesdrag");var $t=o(e=>()=>e,"default");function Lt(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:a,y:c,dx:l,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:c,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}o(Lt,"DragEvent");Lt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function xu(e){return!e.ctrlKey&&!e.button}o(xu,"defaultFilter");function bu(){return this.parentNode}o(bu,"defaultContainer");function Su(e,t){return t??{x:e.x,y:e.y}}o(Su,"defaultSubject");function Eu(){return navigator.maxTouchPoints||"ontouchstart"in this}o(Eu,"defaultTouchable");function Ht(){var e=xu,t=bu,n=Su,r=Eu,i={},s=Qe("start","drag","end"),a=0,c,l,u,d,h=0;function f(b){b.on("mousedown.drag",g).filter(r).on("touchstart.drag",x).on("touchmove.drag",w,Ai).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(f,"drag");function g(b,N){if(!(d||!e.call(this,b,N))){var C=p(this,t.call(this,b,N),b,N,"mouse");C&&(ce(b.view).on("mousemove.drag",m,Je).on("mouseup.drag",S,Je),dt(b.view),pn(b),u=!1,c=b.clientX,l=b.clientY,C("start",b))}}o(g,"mousedowned");function m(b){if(Te(b),!u){var N=b.clientX-c,C=b.clientY-l;u=N*N+C*C>h}i.mouse("drag",b)}o(m,"mousemoved");function S(b){ce(b.view).on("mousemove.drag mouseup.drag",null),zt(b.view,u),Te(b),i.mouse("end",b)}o(S,"mouseupped");function x(b,N){if(e.call(this,b,N)){var C=b.changedTouches,I=t.call(this,b,N),R=C.length,A,V;for(A=0;A<R;++A)(V=p(this,I,b,N,C[A].identifier,C[A]))&&(pn(b),V("start",b,C[A]))}}o(x,"touchstarted");function w(b){var N=b.changedTouches,C=N.length,I,R;for(I=0;I<C;++I)(R=i[N[I].identifier])&&(Te(b),R("drag",b,N[I]))}o(w,"touchmoved");function E(b){var N=b.changedTouches,C=N.length,I,R;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),I=0;I<C;++I)(R=i[N[I].identifier])&&(pn(b),R("end",b,N[I]))}o(E,"touchended");function p(b,N,C,I,R,A){var V=s.copy(),O=fe(A||C,N),B,$,y;if((y=n.call(b,new Lt("beforestart",{sourceEvent:C,target:f,identifier:R,active:a,x:O[0],y:O[1],dx:0,dy:0,dispatch:V}),I))!=null)return B=y.x-O[0]||0,$=y.y-O[1]||0,o(function v(_,M,D){var T=O,H;switch(_){case"start":i[R]=v,H=a++;break;case"end":delete i[R],--a;case"drag":O=fe(D||M,N),H=a;break}V.call(_,b,new Lt(_,{sourceEvent:M,subject:y,target:f,identifier:R,active:H,x:O[0]+B,y:O[1]+$,dx:O[0]-T[0],dy:O[1]-T[1],dispatch:V}),I)},"gesture")}return o(p,"beforestart"),f.filter=function(b){return arguments.length?(e=typeof b=="function"?b:$t(!!b),f):e},f.container=function(b){return arguments.length?(t=typeof b=="function"?b:$t(b),f):t},f.subject=function(b){return arguments.length?(n=typeof b=="function"?b:$t(b),f):n},f.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:$t(!!b),f):r},f.on=function(){var b=s.on.apply(s,arguments);return b===s?f:b},f.clickDistance=function(b){return arguments.length?(h=(b=+b)*b,f):Math.sqrt(h)},f}o(Ht,"default");var ft=0,Vt=0,Bt=0,Ti=1e3,gn,Ft,mn=0,je=0,yn=0,Wt=typeof performance=="object"&&performance.now?performance:Date,Ri=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xt(){return je||(Ri(vu),je=Wt.now()+yn)}o(Xt,"now");function vu(){je=0}o(vu,"clearNow");function Yt(){this._call=this._time=this._next=null}o(Yt,"Timer");Yt.prototype=wn.prototype={constructor:Yt,restart:o(function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xt():+n)+(t==null?0:+t),!this._next&&Ft!==this&&(Ft?Ft._next=this:gn=this,Ft=this),this._call=e,this._time=n,Uo()},"restart"),stop:o(function(){this._call&&(this._call=null,this._time=1/0,Uo())},"stop")};function wn(e,t,n){var r=new Yt;return r.restart(e,t,n),r}o(wn,"timer");function Oi(){Xt(),++ft;for(var e=gn,t;e;)(t=je-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ft}o(Oi,"timerFlush");function Di(){je=(mn=Wt.now())+yn,ft=Vt=0;try{Oi()}finally{ft=0,_u(),je=0}}o(Di,"wake");function Cu(){var e=Wt.now(),t=e-mn;t>Ti&&(yn-=t,mn=e)}o(Cu,"poke");function _u(){for(var e,t=gn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:gn=n);Ft=e,Uo(r)}o(_u,"nap");function Uo(e){if(!ft){Vt&&(Vt=clearTimeout(Vt));var t=e-je;t>24?(e<1/0&&(Vt=setTimeout(Di,e-Wt.now()-yn)),Bt&&(Bt=clearInterval(Bt))):(Bt||(mn=Wt.now(),Bt=setInterval(Cu,Ti)),ft=1,Ri(Di))}}o(Uo,"sleep");function Zt(e,t,n){var r=new Yt;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}o(Zt,"default");var Nu=Qe("start","end","cancel","interrupt"),Mu=[],Li=0,zi=1,bn=2,xn=3,$i=4,Sn=5,Ut=6;function Re(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Iu(e,n,{name:t,index:r,group:i,on:Nu,tween:Mu,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Li})}o(Re,"default");function qt(e,t){var n=le(e,t);if(n.state>Li)throw new Error("too late; already scheduled");return n}o(qt,"init");function de(e,t){var n=le(e,t);if(n.state>xn)throw new Error("too late; already running");return n}o(de,"set");function le(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}o(le,"get");function Iu(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=wn(s,0,n.time);function s(u){n.state=zi,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}o(s,"schedule");function a(u){var d,h,f,g;if(n.state!==zi)return l();for(d in r)if(g=r[d],g.name===n.name){if(g.state===xn)return Zt(a);g.state===$i?(g.state=Ut,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete r[d]):+d<t&&(g.state=Ut,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete r[d])}if(Zt(function(){n.state===xn&&(n.state=$i,n.timer.restart(c,n.delay,n.time),c(u))}),n.state=bn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===bn){for(n.state=xn,i=new Array(f=n.tween.length),d=0,h=-1;d<f;++d)(g=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++h]=g);i.length=h+1}}o(a,"start");function c(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(l),n.state=Sn,1),h=-1,f=i.length;++h<f;)i[h].call(e,d);n.state===Sn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}o(c,"tick");function l(){n.state=Ut,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}o(l,"stop")}o(Iu,"create");function He(e,t){var n=e.__transition,r,i,s=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){s=!1;continue}i=r.state>bn&&r.state<Sn,r.state=Ut,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}s&&delete e.__transition}}o(He,"default");function qo(e){return this.each(function(){He(this,e)})}o(qo,"default");function Pu(e,t){var n,r;return function(){var i=de(this,e),s=i.tween;if(s!==n){r=n=s;for(var a=0,c=r.length;a<c;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}o(Pu,"tweenRemove");function ku(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=de(this,e),a=s.tween;if(a!==r){i=(r=a).slice();for(var c={name:t,value:n},l=0,u=i.length;l<u;++l)if(i[l].name===t){i[l]=c;break}l===u&&i.push(c)}s.tween=i}}o(ku,"tweenFunction");function Go(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=le(this.node(),n).tween,i=0,s=r.length,a;i<s;++i)if((a=r[i]).name===e)return a.value;return null}return this.each((t==null?Pu:ku)(n,e,t))}o(Go,"default");function ht(e,t,n){var r=e._id;return e.each(function(){var i=de(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return le(i,r).value[t]}}o(ht,"tweenValue");function Gt(e,t){var n;return(typeof t=="number"?mi:t instanceof ro?io:(n=ro(t))?(t=n,io):yi)(e,t)}o(Gt,"default");function Au(e){return function(){this.removeAttribute(e)}}o(Au,"attrRemove");function Du(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(Du,"attrRemoveNS");function Tu(e,t,n){var r,i=n+"",s;return function(){var a=this.getAttribute(e);return a===i?null:a===r?s:s=t(r=a,n)}}o(Tu,"attrConstant");function Ru(e,t,n){var r,i=n+"",s;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?s:s=t(r=a,n)}}o(Ru,"attrConstantNS");function Ou(e,t,n){var r,i,s;return function(){var a,c=n(this),l;return c==null?void this.removeAttribute(e):(a=this.getAttribute(e),l=c+"",a===l?null:a===r&&l===i?s:(i=l,s=t(r=a,c)))}}o(Ou,"attrFunction");function zu(e,t,n){var r,i,s;return function(){var a,c=n(this),l;return c==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),l=c+"",a===l?null:a===r&&l===i?s:(i=l,s=t(r=a,c)))}}o(zu,"attrFunctionNS");function Ko(e,t){var n=Ne(e),r=n==="transform"?xi:Gt;return this.attrTween(e,typeof t=="function"?(n.local?zu:Ou)(n,r,ht(this,"attr."+e,t)):t==null?(n.local?Du:Au)(n):(n.local?Ru:Tu)(n,r,t))}o(Ko,"default");function $u(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}o($u,"attrInterpolate");function Lu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}o(Lu,"attrInterpolateNS");function Hu(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Lu(e,s)),n}return o(i,"tween"),i._value=t,i}o(Hu,"attrTweenNS");function Bu(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&$u(e,s)),n}return o(i,"tween"),i._value=t,i}o(Bu,"attrTween");function Qo(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Ne(e);return this.tween(n,(r.local?Hu:Bu)(r,t))}o(Qo,"default");function Vu(e,t){return function(){qt(this,e).delay=+t.apply(this,arguments)}}o(Vu,"delayFunction");function Fu(e,t){return t=+t,function(){qt(this,e).delay=t}}o(Fu,"delayConstant");function Jo(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Vu:Fu)(t,e)):le(this.node(),t).delay}o(Jo,"default");function Wu(e,t){return function(){de(this,e).duration=+t.apply(this,arguments)}}o(Wu,"durationFunction");function Yu(e,t){return t=+t,function(){de(this,e).duration=t}}o(Yu,"durationConstant");function jo(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Wu:Yu)(t,e)):le(this.node(),t).duration}o(jo,"default");function Xu(e,t){if(typeof t!="function")throw new Error;return function(){de(this,e).ease=t}}o(Xu,"easeConstant");function er(e){var t=this._id;return arguments.length?this.each(Xu(t,e)):le(this.node(),t).ease}o(er,"default");function Zu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;de(this,e).ease=n}}o(Zu,"easeVarying");function tr(e){if(typeof e!="function")throw new Error;return this.each(Zu(this._id,e))}o(tr,"default");function nr(e){typeof e!="function"&&(e=ut(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],a=s.length,c=r[i]=[],l,u=0;u<a;++u)(l=s[u])&&e.call(l,l.__data__,u,s)&&c.push(l);return new pe(r,this._parents,this._name,this._id)}o(nr,"default");function or(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=t[c],u=n[c],d=l.length,h=a[c]=new Array(d),f,g=0;g<d;++g)(f=l[g]||u[g])&&(h[g]=f);for(;c<r;++c)a[c]=t[c];return new pe(a,this._parents,this._name,this._id)}o(or,"default");function Uu(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}o(Uu,"start");function qu(e,t,n){var r,i,s=Uu(t)?qt:de;return function(){var a=s(this,e),c=a.on;c!==r&&(i=(r=c).copy()).on(t,n),a.on=i}}o(qu,"onFunction");function rr(e,t){var n=this._id;return arguments.length<2?le(this.node(),n).on.on(e):this.each(qu(n,e,t))}o(rr,"default");function Gu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}o(Gu,"removeFunction");function ir(){return this.on("end.remove",Gu(this._id))}o(ir,"default");function sr(e){var t=this._name,n=this._id;typeof e!="function"&&(e=$e(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a<i;++a)for(var c=r[a],l=c.length,u=s[a]=new Array(l),d,h,f=0;f<l;++f)(d=c[f])&&(h=e.call(d,d.__data__,f,c))&&("__data__"in d&&(h.__data__=d.__data__),u[f]=h,Re(u[f],t,n,f,u,le(d,n)));return new pe(s,this._parents,t,n)}o(sr,"default");function ar(e){var t=this._name,n=this._id;typeof e!="function"&&(e=lt(e));for(var r=this._groups,i=r.length,s=[],a=[],c=0;c<i;++c)for(var l=r[c],u=l.length,d,h=0;h<u;++h)if(d=l[h]){for(var f=e.call(d,d.__data__,h,l),g,m=le(d,n),S=0,x=f.length;S<x;++S)(g=f[S])&&Re(g,t,n,S,f,m);s.push(f),a.push(d)}return new pe(s,a,t,n)}o(ar,"default");var Ku=De.prototype.constructor;function cr(){return new Ku(this._groups,this._parents)}o(cr,"default");function Qu(e,t){var n,r,i;return function(){var s=Le(this,e),a=(this.style.removeProperty(e),Le(this,e));return s===a?null:s===n&&a===r?i:i=t(n=s,r=a)}}o(Qu,"styleNull");function Hi(e){return function(){this.style.removeProperty(e)}}o(Hi,"styleRemove");function Ju(e,t,n){var r,i=n+"",s;return function(){var a=Le(this,e);return a===i?null:a===r?s:s=t(r=a,n)}}o(Ju,"styleConstant");function ju(e,t,n){var r,i,s;return function(){var a=Le(this,e),c=n(this),l=c+"";return c==null&&(l=c=(this.style.removeProperty(e),Le(this,e))),a===l?null:a===r&&l===i?s:(i=l,s=t(r=a,c))}}o(ju,"styleFunction");function ed(e,t){var n,r,i,s="style."+t,a="end."+s,c;return function(){var l=de(this,e),u=l.on,d=l.value[s]==null?c||(c=Hi(t)):void 0;(u!==n||i!==d)&&(r=(n=u).copy()).on(a,i=d),l.on=r}}o(ed,"styleMaybeRemove");function lr(e,t,n){var r=(e+="")=="transform"?wi:Gt;return t==null?this.styleTween(e,Qu(e,r)).on("end.style."+e,Hi(e)):typeof t=="function"?this.styleTween(e,ju(e,r,ht(this,"style."+e,t))).each(ed(this._id,e)):this.styleTween(e,Ju(e,r,t),n).on("end.style."+e,null)}o(lr,"default");function td(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}o(td,"styleInterpolate");function nd(e,t,n){var r,i;function s(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&td(e,a,n)),r}return o(s,"tween"),s._value=t,s}o(nd,"styleTween");function ur(e,t,n){var r="style."+(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;return this.tween(r,nd(e,t,n??""))}o(ur,"default");function od(e){return function(){this.textContent=e}}o(od,"textConstant");function rd(e){return function(){var t=e(this);this.textContent=t??""}}o(rd,"textFunction");function dr(e){return this.tween("text",typeof e=="function"?rd(ht(this,"text",e)):od(e==null?"":e+""))}o(dr,"default");function id(e){return function(t){this.textContent=e.call(this,t)}}o(id,"textInterpolate");function sd(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&id(i)),t}return o(r,"tween"),r._value=e,r}o(sd,"textTween");function fr(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,sd(e))}o(fr,"default");function hr(){for(var e=this._name,t=this._id,n=En(),r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],c=a.length,l,u=0;u<c;++u)if(l=a[u]){var d=le(l,t);Re(l,e,n,u,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new pe(r,this._parents,e,n)}o(hr,"default");function pr(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,a){var c={value:a},l={value:o(function(){--i===0&&s()},"value")};n.each(function(){var u=de(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(l)),u.on=t}),i===0&&s()})}o(pr,"default");var ad=0;function pe(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}o(pe,"Transition");function Bi(e){return De().transition(e)}o(Bi,"transition");function En(){return++ad}o(En,"newId");var Oe=De.prototype;pe.prototype=Bi.prototype={constructor:pe,select:sr,selectAll:ar,selectChild:Oe.selectChild,selectChildren:Oe.selectChildren,filter:nr,merge:or,selection:cr,transition:hr,call:Oe.call,nodes:Oe.nodes,node:Oe.node,size:Oe.size,empty:Oe.empty,each:Oe.each,on:rr,attr:Ko,attrTween:Qo,style:lr,styleTween:ur,text:dr,textTween:fr,remove:ir,tween:Go,delay:Jo,duration:jo,ease:er,easeVarying:tr,end:pr,[Symbol.iterator]:Oe[Symbol.iterator]};function vn(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}o(vn,"cubicInOut");var cd={time:null,delay:0,duration:250,ease:vn};function ld(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}o(ld,"inherit");function gr(e){var t,n;e instanceof pe?(t=e._id,e=e._name):(t=En(),(n=cd).time=Xt(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],c=a.length,l,u=0;u<c;++u)(l=a[u])&&Re(l,e,t,u,a,n||ld(l,t));return new pe(r,this._parents,e,t)}o(gr,"default");De.prototype.interrupt=qo;De.prototype.transition=gr;var Kt=o(e=>()=>e,"default");function mr(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}o(mr,"ZoomEvent");function Se(e,t,n){this.k=e,this.x=t,this.y=n}o(Se,"Transform");Se.prototype={constructor:Se,scale:o(function(e){return e===1?this:new Se(this.k*e,this.x,this.y)},"scale"),translate:o(function(e,t){return e===0&t===0?this:new Se(this.k,this.x+this.k*e,this.y+this.k*t)},"translate"),apply:o(function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},"apply"),applyX:o(function(e){return e*this.k+this.x},"applyX"),applyY:o(function(e){return e*this.k+this.y},"applyY"),invert:o(function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},"invert"),invertX:o(function(e){return(e-this.x)/this.k},"invertX"),invertY:o(function(e){return(e-this.y)/this.k},"invertY"),rescaleX:o(function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},"rescaleX"),rescaleY:o(function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},"rescaleY"),toString:o(function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"},"toString")};var et=new Se(1,0,0);Qt.prototype=Se.prototype;function Qt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return et;return e.__zoom}o(Qt,"transform");function Cn(e){e.stopImmediatePropagation()}o(Cn,"nopropagation");function tt(e){e.preventDefault(),e.stopImmediatePropagation()}o(tt,"default");function ud(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}o(ud,"defaultFilter");function dd(){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]]}o(dd,"defaultExtent");function Vi(){return this.__zoom||et}o(Vi,"defaultTransform");function fd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}o(fd,"defaultWheelDelta");function hd(){return navigator.maxTouchPoints||"ontouchstart"in this}o(hd,"defaultTouchable");function pd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}o(pd,"defaultConstrain");function Jt(){var e=ud,t=dd,n=pd,r=fd,i=hd,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],c=250,l=ct,u=Qe("start","zoom","end"),d,h,f,g=500,m=150,S=0,x=10;function w(y){y.property("__zoom",Vi).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",V).filter(i).on("touchstart.zoom",O).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(w,"zoom"),w.transform=function(y,v,_,M){var D=y.selection?y.selection():y;D.property("__zoom",Vi),y!==D?N(y,v,_,M):D.interrupt().each(function(){C(this,arguments).event(M).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},w.scaleBy=function(y,v,_,M){w.scaleTo(y,function(){var D=this.__zoom.k,T=typeof v=="function"?v.apply(this,arguments):v;return D*T},_,M)},w.scaleTo=function(y,v,_,M){w.transform(y,function(){var D=t.apply(this,arguments),T=this.__zoom,H=_==null?b(D):typeof _=="function"?_.apply(this,arguments):_,L=T.invert(H),F=typeof v=="function"?v.apply(this,arguments):v;return n(p(E(T,F),H,L),D,a)},_,M)},w.translateBy=function(y,v,_,M){w.transform(y,function(){return n(this.__zoom.translate(typeof v=="function"?v.apply(this,arguments):v,typeof _=="function"?_.apply(this,arguments):_),t.apply(this,arguments),a)},null,M)},w.translateTo=function(y,v,_,M,D){w.transform(y,function(){var T=t.apply(this,arguments),H=this.__zoom,L=M==null?b(T):typeof M=="function"?M.apply(this,arguments):M;return n(et.translate(L[0],L[1]).scale(H.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof _=="function"?-_.apply(this,arguments):-_),T,a)},M,D)};function E(y,v){return v=Math.max(s[0],Math.min(s[1],v)),v===y.k?y:new Se(v,y.x,y.y)}o(E,"scale");function p(y,v,_){var M=v[0]-_[0]*y.k,D=v[1]-_[1]*y.k;return M===y.x&&D===y.y?y:new Se(y.k,M,D)}o(p,"translate");function b(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}o(b,"centroid");function N(y,v,_,M){y.on("start.zoom",function(){C(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,T=arguments,H=C(D,T).event(M),L=t.apply(D,T),F=_==null?b(L):typeof _=="function"?_.apply(D,T):_,q=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),W=D.__zoom,G=typeof v=="function"?v.apply(D,T):v,j=l(W.invert(F).concat(q/W.k),G.invert(F).concat(q/G.k));return function(U){if(U===1)U=G;else{var z=j(U),Y=q/z[2];U=new Se(Y,F[0]-z[0]*Y,F[1]-z[1]*Y)}H.zoom(null,U)}})}o(N,"schedule");function C(y,v,_){return!_&&y.__zooming||new I(y,v)}o(C,"gesture");function I(y,v){this.that=y,this.args=v,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,v),this.taps=0}o(I,"Gesture"),I.prototype={event:o(function(y){return y&&(this.sourceEvent=y),this},"event"),start:o(function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},"start"),zoom:o(function(y,v){return this.mouse&&y!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=v.invert(this.touch1[0])),this.that.__zoom=v,this.emit("zoom"),this},"zoom"),end:o(function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},"end"),emit:o(function(y){var v=ce(this.that).datum();u.call(y,this.that,new mr(y,{sourceEvent:this.sourceEvent,target:w,type:y,transform:this.that.__zoom,dispatch:u}),v)},"emit")};function R(y,...v){if(!e.apply(this,arguments))return;var _=C(this,v).event(y),M=this.__zoom,D=Math.max(s[0],Math.min(s[1],M.k*Math.pow(2,r.apply(this,arguments)))),T=fe(y);if(_.wheel)(_.mouse[0][0]!==T[0]||_.mouse[0][1]!==T[1])&&(_.mouse[1]=M.invert(_.mouse[0]=T)),clearTimeout(_.wheel);else{if(M.k===D)return;_.mouse=[T,M.invert(T)],He(this),_.start()}tt(y),_.wheel=setTimeout(H,m),_.zoom("mouse",n(p(E(M,D),_.mouse[0],_.mouse[1]),_.extent,a));function H(){_.wheel=null,_.end()}o(H,"wheelidled")}o(R,"wheeled");function A(y,...v){if(f||!e.apply(this,arguments))return;var _=y.currentTarget,M=C(this,v,!0).event(y),D=ce(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",q,!0),T=fe(y,_),H=y.clientX,L=y.clientY;dt(y.view),Cn(y),M.mouse=[T,this.__zoom.invert(T)],He(this),M.start();function F(W){if(tt(W),!M.moved){var G=W.clientX-H,j=W.clientY-L;M.moved=G*G+j*j>S}M.event(W).zoom("mouse",n(p(M.that.__zoom,M.mouse[0]=fe(W,_),M.mouse[1]),M.extent,a))}o(F,"mousemoved");function q(W){D.on("mousemove.zoom mouseup.zoom",null),zt(W.view,M.moved),tt(W),M.event(W).end()}o(q,"mouseupped")}o(A,"mousedowned");function V(y,...v){if(e.apply(this,arguments)){var _=this.__zoom,M=fe(y.changedTouches?y.changedTouches[0]:y,this),D=_.invert(M),T=_.k*(y.shiftKey?.5:2),H=n(p(E(_,T),M,D),t.apply(this,v),a);tt(y),c>0?ce(this).transition().duration(c).call(N,H,M,y):ce(this).call(w.transform,H,M,y)}}o(V,"dblclicked");function O(y,...v){if(e.apply(this,arguments)){var _=y.touches,M=_.length,D=C(this,v,y.changedTouches.length===M).event(y),T,H,L,F;for(Cn(y),H=0;H<M;++H)L=_[H],F=fe(L,this),F=[F,this.__zoom.invert(F),L.identifier],D.touch0?!D.touch1&&D.touch0[2]!==F[2]&&(D.touch1=F,D.taps=0):(D.touch0=F,T=!0,D.taps=1+!!d);d&&(d=clearTimeout(d)),T&&(D.taps<2&&(h=F[0],d=setTimeout(function(){d=null},g)),He(this),D.start())}}o(O,"touchstarted");function B(y,...v){if(this.__zooming){var _=C(this,v).event(y),M=y.changedTouches,D=M.length,T,H,L,F;for(tt(y),T=0;T<D;++T)H=M[T],L=fe(H,this),_.touch0&&_.touch0[2]===H.identifier?_.touch0[0]=L:_.touch1&&_.touch1[2]===H.identifier&&(_.touch1[0]=L);if(H=_.that.__zoom,_.touch1){var q=_.touch0[0],W=_.touch0[1],G=_.touch1[0],j=_.touch1[1],U=(U=G[0]-q[0])*U+(U=G[1]-q[1])*U,z=(z=j[0]-W[0])*z+(z=j[1]-W[1])*z;H=E(H,Math.sqrt(U/z)),L=[(q[0]+G[0])/2,(q[1]+G[1])/2],F=[(W[0]+j[0])/2,(W[1]+j[1])/2]}else if(_.touch0)L=_.touch0[0],F=_.touch0[1];else return;_.zoom("touch",n(p(H,L,F),_.extent,a))}}o(B,"touchmoved");function $(y,...v){if(this.__zooming){var _=C(this,v).event(y),M=y.changedTouches,D=M.length,T,H;for(Cn(y),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),T=0;T<D;++T)H=M[T],_.touch0&&_.touch0[2]===H.identifier?delete _.touch0:_.touch1&&_.touch1[2]===H.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(H=fe(H,this),Math.hypot(h[0]-H[0],h[1]-H[1])<x)){var L=ce(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return o($,"touchended"),w.wheelDelta=function(y){return arguments.length?(r=typeof y=="function"?y:Kt(+y),w):r},w.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Kt(!!y),w):e},w.touchable=function(y){return arguments.length?(i=typeof y=="function"?y:Kt(!!y),w):i},w.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Kt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),w):t},w.scaleExtent=function(y){return arguments.length?(s[0]=+y[0],s[1]=+y[1],w):[s[0],s[1]]},w.translateExtent=function(y){return arguments.length?(a[0][0]=+y[0][0],a[1][0]=+y[1][0],a[0][1]=+y[0][1],a[1][1]=+y[1][1],w):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},w.constrain=function(y){return arguments.length?(n=y,w):n},w.duration=function(y){return arguments.length?(c=+y,w):c},w.interpolate=function(y){return arguments.length?(l=y,w):l},w.on=function(){var y=u.on.apply(u,arguments);return y===u?w:y},w.clickDistance=function(y){return arguments.length?(S=(y=+y)*y,w):Math.sqrt(S)},w.tapDistance=function(y){return arguments.length?(x=+y,w):x},w}o(Jt,"default");var ge={error001:o((e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,"error001"),error002:o(()=>"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.","error002"),error003:o(e=>`Node type "${e}" not found. Using fallback type "default".`,"error003"),error004:o(()=>"The parent container needs a width and a height to render the graph.","error004"),error005:o(()=>"Only child nodes can use a parent extent.","error005"),error006:o(()=>"Can't create edge. An edge needs a source and a target.","error006"),error007:o(e=>`The old edge with id=${e} does not exist.`,"error007"),error009:o(e=>`Marker type "${e}" doesn't exist.`,"error009"),error008:o((e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,"error008"),error010:o(()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.","error010"),error011:o(e=>`Edge type "${e}" not found. Using fallback type "default".`,"error011"),error012:o(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.`,"error012"),error013:o((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.`,"error013"),error014:o(()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.","error014"),error015:o(()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.","error015"),error016:o(e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`,"error016")},yt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Sr=["Enter"," ","Escape"],Er={"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":o(({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"node.a11yDescription.ariaLiveMessage"),"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"},We;(function(e){e.Strict="strict",e.Loose="loose"})(We||(We={}));var ze;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ze||(ze={}));var nt;(function(e){e.Partial="partial",e.Full="full"})(nt||(nt={}));var vr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Me;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Me||(Me={}));var gt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(gt||(gt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));var Fi={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},Cr=o(e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,"isEdgeBase"),ts=o(e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),"isNodeBase"),_r=o(e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),"isInternalNodeBase");var en=o((e,t=[0,0])=>{let{width:n,height:r}=xe(e),i=e.origin??t,s=n*i[0],a=r*i[1];return{x:e.position.x-s,y:e.position.y-a}},"getNodePositionWithOrigin"),tn=o((e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,r=e.reduce((i,s)=>{let a=typeof s=="string",c=!t.nodeLookup&&!a?s:void 0;return t.nodeLookup&&(c=a?t.nodeLookup.get(s):_r(s)?s:t.nodeLookup.get(s.id)),c?(n=!0,kn(i,Mn(c,t.nodeOrigin))):i},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?An(r):{x:0,y:0,width:0,height:0}},"getNodesBounds"),wt=o((e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=kn(n,Mn(i)),r=!0)}),r?An(n):{x:0,y:0,width:0,height:0}},"getInternalNodesBounds"),In=o((e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{let c=(t.x-n)/i,l=(t.y-r)/i,u=t.width/i,d=t.height/i,h=[];for(let f of e.values()){let{measured:g,selectable:m=!0,hidden:S=!1}=f;if(a&&!m||S)continue;let x=g.width??f.width??f.initialWidth??0,w=g.height??f.height??f.initialHeight??0,{x:E,y:p}=f.internals.positionAbsolute,b=ss(c,l,u,d,E,p,x,w),N=x*w,C=s&&b>0;(!f.internals.handleBounds||C||b>=N||f.dragging)&&h.push(f)}return h},"getNodesInside"),ns=o((e,t)=>{let n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))},"getConnectedEdges");function gd(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{let s;if(t?.includeHiddenNodes){let{width:a,height:c}=xe(i);s=a>0&&c>0}else s=!!(i.measured.width&&i.measured.height&&!i.hidden);s&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}o(gd,"getFitViewNodes");async function os({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;let c=gd(e,a),l=wt(c),u=st(l,t,n,a?.minZoom??i,a?.maxZoom??s,a?.padding??.1);return await r.setViewport(u,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),!0}o(os,"fitViewport");function Nr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){let a=n.get(e),c=a.parentId?n.get(a.parentId):void 0,{x:l,y:u}=c?c.internals.positionAbsolute:{x:0,y:0},d=a.origin??r,h=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!c)s?.("005",ge.error005());else{let{width:g,height:m}=xe(c);g&&m&&(h=[[l,u],[l+g,u+m]])}else c&&it(a.extent)&&(h=[[a.extent[0][0]+l,a.extent[0][1]+u],[a.extent[1][0]+l,a.extent[1][1]+u]]);let f=it(h)?ot(t,h,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&s?.("015",ge.error015()),{position:{x:f.x-l+(a.measured.width??0)*d[0],y:f.y-u+(a.measured.height??0)*d[1]},positionAbsolute:f}}o(Nr,"calculateNodePosition");async function rs({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let s=new Set(e.map(f=>f.id)),a=[];for(let f of n){if(f.deletable===!1)continue;let g=s.has(f.id),m=!g&&f.parentId&&a.find(S=>S.id===f.parentId);(g||m)&&a.push(f)}let c=new Set(t.map(f=>f.id)),l=r.filter(f=>f.deletable!==!1),d=ns(a,l);for(let f of l)c.has(f.id)&&!d.find(m=>m.id===f.id)&&d.push(f);if(!i)return{edges:d,nodes:a};let h=await i({nodes:a,edges:d});return typeof h=="boolean"?h?{edges:d,nodes:a}:{edges:[],nodes:[]}:h}o(rs,"getElementsToRemove");var mt=o((e,t=0,n=1)=>Math.min(Math.max(e,t),n),"clamp"),ot=o((e={x:0,y:0},t,n)=>({x:mt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:mt(e.y,t[0][1],t[1][1]-(n?.height??0))}),"clampPosition");function is(e,t,n){let{width:r,height:i}=xe(n),{x:s,y:a}=n.internals.positionAbsolute;return ot(e,[[s,a],[s+r,a+i]],t)}o(is,"clampPositionToParent");var Wi=o((e,t,n)=>e<t?mt(Math.abs(e-t),1,t)/t:e>n?-mt(Math.abs(e-n),1,t)/t:0,"calcAutoPanVelocity"),Pn=o((e,t,n=15,r=40)=>{let i=Wi(e.x,r,t.width-r)*n,s=Wi(e.y,r,t.height-r)*n;return[i,s]},"calcAutoPan"),kn=o((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)}),"getBoundsOfBoxes"),br=o(({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),"rectToBox"),An=o(({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),"boxToRect"),xt=o((e,t=[0,0])=>{let{x:n,y:r}=_r(e)?e.internals.positionAbsolute:en(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},"nodeToRect"),Mn=o((e,t=[0,0])=>{let{x:n,y:r}=_r(e)?e.internals.positionAbsolute:en(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},"nodeToBox"),Mr=o((e,t)=>An(kn(br(e),br(t))),"getBoundsOfRects"),ss=o((e,t,n,r,i,s,a,c)=>{let l=Math.max(0,Math.min(e+n,i+a)-Math.max(e,i)),u=Math.max(0,Math.min(t+r,s+c)-Math.max(t,s));return Math.ceil(l*u)},"getRectsOverlappingArea"),nn=o((e,t)=>ss(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),"getOverlappingArea"),Ir=o(e=>ye(e.width)&&ye(e.height)&&ye(e.x)&&ye(e.y),"isRectObject"),ye=o(e=>!isNaN(e)&&isFinite(e),"isNumeric"),Pr=o((e,t)=>(n,r)=>{},"createDevWarn"),bt=o((e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),"snapPosition"),St=o(({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{let c={x:(e-n)/i,y:(t-r)/i};return s?bt(c,a):c},"pointToRendererPoint"),rt=o(({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),"rendererPointToPoint");function pt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}o(pt,"parsePadding");function md(e,t,n){if(typeof e=="string"||typeof e=="number"){let r=pt(e,n),i=pt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){let r=pt(e.top??e.y??0,n),i=pt(e.bottom??e.y??0,n),s=pt(e.left??e.x??0,t),a=pt(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:s,x:s+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}o(md,"parsePaddings");function yd(e,t,n,r,i,s){let{x:a,y:c}=rt(e,[t,n,r]),{x:l,y:u}=rt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=i-l,h=s-u;return{left:Math.floor(a),top:Math.floor(c),right:Math.floor(d),bottom:Math.floor(h)}}o(yd,"calculateAppliedPaddings");var st=o((e,t,n,r,i,s)=>{let a=md(s,t,n),c=(t-a.x)/e.width,l=(n-a.y)/e.height,u=Math.min(c,l),d=mt(u,r,i),h=e.x+e.width/2,f=e.y+e.height/2,g=t/2-h*d,m=n/2-f*d,S=yd(e,g,m,d,t,n),x={left:Math.min(S.left-a.left,0),top:Math.min(S.top-a.top,0),right:Math.min(S.right-a.right,0),bottom:Math.min(S.bottom-a.bottom,0)};return{x:g-x.left+x.right,y:m-x.top+x.bottom,zoom:d}},"getViewportForBounds"),Et=o(()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,"isMacOs");function it(e){return e!=null&&e!=="parent"}o(it,"isCoordinateExtent");function xe(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}o(xe,"getNodeDimensions");function Dn(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}o(Dn,"nodeHasDimensions");function kr(e,t={width:0,height:0},n,r,i){let s={...e},a=r.get(n);if(a){let c=a.origin||i;s.x+=a.internals.positionAbsolute.x-(t.width??0)*c[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*c[1]}return s}o(kr,"evaluateAbsolutePosition");function Ar(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}o(Ar,"areSetsEqual");function as(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}o(as,"withResolvers");function cs(e){return{...Er,...e||{}}}o(cs,"mergeAriaLabelConfig");function Dr(e){return e===null?null:e?"valid":"invalid"}o(Dr,"getConnectionStatus");function jt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:s,y:a}=we(e),c=St({x:s-(i?.left??0),y:a-(i?.top??0)},r),{x:l,y:u}=n?bt(c,t):c;return{xSnapped:l,ySnapped:u,...c}}o(jt,"getPointerPosition");var Tn=o(e=>({width:e.offsetWidth,height:e.offsetHeight}),"getDimensions"),Tr=o(e=>e?.getRootNode?.()||window?.document,"getHostForElement"),wd=["INPUT","SELECT","TEXTAREA"];function Rr(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:wd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}o(Rr,"isInputDOMNode");var Or=o(e=>"clientX"in e,"isMouseEvent"),we=o((e,t)=>{let n=Or(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},"getEventPosition"),Yi=o((e,t,n,r,i)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{let c=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(c.left-n.left)/r,y:(c.top-n.top)/r,...Tn(a)}})},"getHandleBounds");function Rn({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:c}){let l=e*.125+i*.375+a*.375+n*.125,u=t*.125+s*.375+c*.375+r*.125,d=Math.abs(l-e),h=Math.abs(u-t);return[l,u,d,h]}o(Rn,"getBezierEdgeCenter");function _n(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}o(_n,"calculateControlOffset");function Xi({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case X.Left:return[t-_n(t-r,s),n];case X.Right:return[t+_n(r-t,s),n];case X.Top:return[t,n-_n(n-i,s)];case X.Bottom:return[t,n+_n(i-n,s)]}}o(Xi,"getControlWithCurvature");function On({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:i,targetPosition:s=X.Top,curvature:a=.25}){let[c,l]=Xi({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,d]=Xi({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[h,f,g,m]=Rn({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:c,sourceControlY:l,targetControlX:u,targetControlY:d});return[`M${e},${t} C${c},${l} ${u},${d} ${r},${i}`,h,f,g,m]}o(On,"getBezierPath");function zr({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,s=n<e?n+i:n-i,a=Math.abs(r-t)/2,c=r<t?r+a:r-a;return[s,c,i,a]}o(zr,"getEdgeCenter");function ls({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return r;let a=i&&n?r+1e3:r,c=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return a+c}o(ls,"getElevatedEdgeZIndex");function us({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let s=kn(Mn(e),Mn(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);let a={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return nn(a,An(s))>0}o(us,"isEdgeVisible");var xd=o(({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,"getEdgeId"),bd=o((e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),"connectionExists"),ds=o((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ge.error006()),t;let r=n.getEdgeId||xd,i;return Cr(e)?i={...e}:i={...e,id:r(e)},bd(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))},"addEdge");function zn({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,s,a,c]=zr({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,c]}o(zn,"getStraightPath");var Zi={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Sd=o(({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},"getDirection"),Ui=o((e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),"distance");function Ed({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:r=X.Top,center:i,offset:s,stepPosition:a}){let c=Zi[t],l=Zi[r],u={x:e.x+c.x*s,y:e.y+c.y*s},d={x:n.x+l.x*s,y:n.y+l.y*s},h=Sd({source:u,sourcePosition:t,target:d}),f=h.x!==0?"x":"y",g=h[f],m=[],S,x,w={x:0,y:0},E={x:0,y:0},[,,p,b]=zr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[f]*l[f]===-1){f==="x"?(S=i.x??u.x+(d.x-u.x)*a,x=i.y??(u.y+d.y)/2):(S=i.x??(u.x+d.x)/2,x=i.y??u.y+(d.y-u.y)*a);let R=[{x:S,y:u.y},{x:S,y:d.y}],A=[{x:u.x,y:x},{x:d.x,y:x}];c[f]===g?m=f==="x"?R:A:m=f==="x"?A:R}else{let R=[{x:u.x,y:d.y}],A=[{x:d.x,y:u.y}];if(f==="x"?m=c.x===g?A:R:m=c.y===g?R:A,t===r){let y=Math.abs(e[f]-n[f]);if(y<=s){let v=Math.min(s-1,s-y);c[f]===g?w[f]=(u[f]>e[f]?-1:1)*v:E[f]=(d[f]>n[f]?-1:1)*v}}if(t!==r){let y=f==="x"?"y":"x",v=c[f]===l[y],_=u[y]>d[y],M=u[y]<d[y];(c[f]===1&&(!v&&_||v&&M)||c[f]!==1&&(!v&&M||v&&_))&&(m=f==="x"?R:A)}let V={x:u.x+w.x,y:u.y+w.y},O={x:d.x+E.x,y:d.y+E.y},B=Math.max(Math.abs(V.x-m[0].x),Math.abs(O.x-m[0].x)),$=Math.max(Math.abs(V.y-m[0].y),Math.abs(O.y-m[0].y));B>=$?(S=(V.x+O.x)/2,x=m[0].y):(S=m[0].x,x=(V.y+O.y)/2)}let N={x:u.x+w.x,y:u.y+w.y},C={x:d.x+E.x,y:d.y+E.y};return[[e,...N.x!==m[0].x||N.y!==m[0].y?[N]:[],...m,...C.x!==m[m.length-1].x||C.y!==m[m.length-1].y?[C]:[],n],S,x,p,b]}o(Ed,"getPoints");function vd(e,t,n,r){let i=Math.min(Ui(e,t)/2,Ui(t,n)/2,r),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){let u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${s+i*u},${a}Q ${s},${a} ${s},${a+i*d}`}let c=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${s},${a+i*l}Q ${s},${a} ${s+i*c},${a}`}o(vd,"getBend");function on({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:i,targetPosition:s=X.Top,borderRadius:a=5,centerX:c,centerY:l,offset:u=20,stepPosition:d=.5}){let[h,f,g,m,S]=Ed({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:c,y:l},offset:u,stepPosition:d}),x=`M${h[0].x} ${h[0].y}`;for(let w=1;w<h.length-1;w++)x+=vd(h[w-1],h[w],h[w+1],a);return x+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[x,f,g,m,S]}o(on,"getSmoothStepPath");function qi(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}o(qi,"isNodeInitialized");function fs(e){let{sourceNode:t,targetNode:n}=e;if(!qi(t)||!qi(n))return null;let r=t.internals.handleBounds||Gi(t.handles),i=n.internals.handleBounds||Gi(n.handles),s=Ki(r?.source??[],e.sourceHandle),a=Ki(e.connectionMode===We.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!s||!a)return e.onError?.("008",ge.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let c=s?.position||X.Bottom,l=a?.position||X.Top,u=Ye(t,s,c),d=Ye(n,a,l);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:c,targetPosition:l}}o(fs,"getEdgePosition");function Gi(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}o(Gi,"toHandleBounds");function Ye(e,t,n=X.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:c}=t??xe(e);if(r)return{x:i+a/2,y:s+c/2};switch(t?.position??n){case X.Top:return{x:i+a/2,y:s};case X.Right:return{x:i+a,y:s+c/2};case X.Bottom:return{x:i+a/2,y:s+c};case X.Left:return{x:i,y:s+c/2}}}o(Ye,"getHandlePosition");function Ki(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}o(Ki,"getHandle$1");function $n(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}o($n,"getMarkerId");function hs(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let s=new Set;return e.reduce((a,c)=>([c.markerStart||r,c.markerEnd||i].forEach(l=>{if(l&&typeof l=="object"){let u=$n(l,t);s.has(u)||(a.push({id:u,color:l.color||n,...l}),s.add(u))}}),a),[]).sort((a,c)=>a.id.localeCompare(c.id))}o(hs,"createMarkerIds");var ps=1e3,Cd=10,$r={nodeOrigin:[0,0],nodeExtent:yt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},_d={...$r,checkEquality:!0};function Lr(e,t){let n={...e};for(let r in t)t[r]!==void 0&&(n[r]=t[r]);return n}o(Lr,"mergeObjects");function gs(e,t,n){let r=Lr($r,n);for(let i of e.values())if(i.parentId)Br(i,e,t,r);else{let s=en(i,r.nodeOrigin),a=it(i.extent)?i.extent:r.nodeExtent,c=ot(s,a,xe(i));i.internals.positionAbsolute=c}}o(gs,"updateAbsolutePositions");function Nd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let i of e.handles){let s={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"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}o(Nd,"parseHandles");function Hr(e){return e==="manual"}o(Hr,"isManualZIndexMode");function Ln(e,t,n,r={}){let i=Lr(_d,r),s={i:0},a=new Map(t),c=i?.elevateNodesOnSelect&&!Hr(i.zIndexMode)?ps:0,l=e.length>0,u=!1;t.clear(),n.clear();for(let d of e){let h=a.get(d.id);if(i.checkEquality&&d===h?.internals.userNode)t.set(d.id,h);else{let f=en(d,i.nodeOrigin),g=it(d.extent)?d.extent:i.nodeExtent,m=ot(f,g,xe(d));h={...i.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:m,handleBounds:Nd(d,h),z:ms(d,c,i.zIndexMode),userNode:d}},t.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(l=!1),d.parentId&&Br(h,t,n,r,s),u||=d.selected??!1}return{nodesInitialized:l,hasSelectedNodes:u}}o(Ln,"adoptUserNodes");function Md(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}o(Md,"updateParentLookup");function Br(e,t,n,r,i){let{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:c,zIndexMode:l}=Lr($r,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Md(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&l==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*Cd),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);let h=s&&!Hr(l)?ps:0,{x:f,y:g,z:m}=Id(e,d,a,c,h,l),{positionAbsolute:S}=e.internals,x=f!==S.x||g!==S.y;(x||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:g}:S,z:m}})}o(Br,"updateChildNode");function ms(e,t,n){let r=ye(e.zIndex)?e.zIndex:0;return Hr(n)?r:r+(e.selected?t:0)}o(ms,"calculateZ");function Id(e,t,n,r,i,s){let{x:a,y:c}=t.internals.positionAbsolute,l=xe(e),u=en(e,n),d=it(e.extent)?ot(u,e.extent,l):u,h=ot({x:a+d.x,y:c+d.y},r,l);e.extent==="parent"&&(h=is(h,l,t));let f=ms(e,i,s),g=t.internals.z??0;return{x:h.x,y:h.y,z:g>=f?g+1:f}}o(Id,"calculateChildXYZ");function Hn(e,t,n,r=[0,0]){let i=[],s=new Map;for(let a of e){let c=t.get(a.parentId);if(!c)continue;let l=s.get(a.parentId)?.expandedRect??xt(c),u=Mr(l,a.rect);s.set(a.parentId,{expandedRect:u,parent:c})}return s.size>0&&s.forEach(({expandedRect:a,parent:c},l)=>{let u=c.internals.positionAbsolute,d=xe(c),h=c.origin??r,f=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,g=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,m=Math.max(d.width,Math.round(a.width)),S=Math.max(d.height,Math.round(a.height)),x=(m-d.width)*h[0],w=(S-d.height)*h[1];(f>0||g>0||x||w)&&(i.push({id:l,type:"position",position:{x:c.position.x-f+x,y:c.position.y-g+w}}),n.get(l)?.forEach(E=>{e.some(p=>p.id===E.id)||i.push({id:E.id,type:"position",position:{x:E.position.x+f,y:E.position.y+g}})})),(d.width<a.width||d.height<a.height||f||g)&&i.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:m+(f?h[0]*f-x:0),height:S+(g?h[1]*g-w:0)}})}),i}o(Hn,"handleExpandParent");function ys(e,t,n,r,i,s,a){let c=r?.querySelector(".xyflow__viewport"),l=!1;if(!c)return{changes:[],updatedInternals:l};let u=[],d=window.getComputedStyle(c),{m22:h}=new window.DOMMatrixReadOnly(d.transform),f=[];for(let g of e.values()){let m=t.get(g.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),l=!0;continue}let S=Tn(g.nodeElement),x=m.measured.width!==S.width||m.measured.height!==S.height;if(!!(S.width&&S.height&&(x||!m.internals.handleBounds||g.force))){let E=g.nodeElement.getBoundingClientRect(),p=it(m.extent)?m.extent:s,{positionAbsolute:b}=m.internals;if(m.parentId&&m.extent==="parent"){let C=t.get(m.parentId);C&&(b=is(b,S,C))}else p&&(b=ot(b,p,S));let N={...m,measured:S,internals:{...m.internals,positionAbsolute:b,handleBounds:{source:Yi("source",g.nodeElement,E,h,m.id),target:Yi("target",g.nodeElement,E,h,m.id)}}};t.set(m.id,N),m.parentId&&Br(N,t,n,{nodeOrigin:i,zIndexMode:a}),l=!0,x&&(u.push({id:m.id,type:"dimensions",dimensions:S}),m.expandParent&&m.parentId&&f.push({id:m.id,parentId:m.parentId,rect:xt(N,i)}))}}if(f.length>0){let g=Hn(f,t,n,i);u.push(...g)}return{changes:u,updatedInternals:l}}o(ys,"updateNodeInternals");async function ws({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return!1;let a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}o(ws,"panBy");function Qi(e,t,n,r,i,s){let a=i,c=r.get(a)||new Map;r.set(a,c.set(n,t)),a=`${i}-${e}`;let l=r.get(a)||new Map;if(r.set(a,l.set(n,t)),s){a=`${i}-${e}-${s}`;let u=r.get(a)||new Map;r.set(a,u.set(n,t))}}o(Qi,"addConnectionToLookup");function Vr(e,t,n){e.clear(),t.clear();for(let r of n){let{source:i,target:s,sourceHandle:a=null,targetHandle:c=null}=r,l={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:c},u=`${i}-${a}--${s}-${c}`,d=`${s}-${c}--${i}-${a}`;Qi("source",l,d,e,i,a),Qi("target",l,u,e,s,c),t.set(r.id,r)}}o(Vr,"updateConnectionLookup");function xs(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:xs(n,t):!1}o(xs,"isParentSelected");function Ji(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}o(Ji,"hasSelector");function Pd(e,t,n,r){let i=new Map;for(let[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!xs(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){let c=e.get(s);c&&i.set(s,{id:s,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return i}o(Pd,"getDragItems");function yr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[a,c]of t){let l=n.get(a)?.internals.userNode;l&&i.push({...l,position:c.position,dragging:r})}if(!e)return[i[0],i];let s=n.get(e)?.internals.userNode;return[s?{...s,position:t.get(e)?.position||s.position,dragging:r}:i[0],i]}o(yr,"getEventHandlerParams");function kd({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let s={x:n-i.distance.x,y:r-i.distance.y},a=bt(s,t);return{x:a.x-s.x,y:a.y-s.y}}o(kd,"calculateSnapOffset");function bs({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,c=new Map,l=!1,u={x:0,y:0},d=null,h=!1,f=null,g=!1,m=!1,S=null;function x({noDragClassName:E,handleSelector:p,domNode:b,isSelectable:N,nodeId:C,nodeClickDistance:I=0}){f=ce(b);function R({x:B,y:$}){let{nodeLookup:y,nodeExtent:v,snapGrid:_,snapToGrid:M,nodeOrigin:D,onNodeDrag:T,onSelectionDrag:H,onError:L,updateNodePositions:F}=t();s={x:B,y:$};let q=!1,W=c.size>1,G=W&&v?br(wt(c)):null,j=W&&M?kd({dragItems:c,snapGrid:_,x:B,y:$}):null;for(let[U,z]of c){if(!y.has(U))continue;let Y={x:B-z.distance.x,y:$-z.distance.y};M&&(Y=j?{x:Math.round(Y.x+j.x),y:Math.round(Y.y+j.y)}:bt(Y,_));let J=null;if(W&&v&&!z.extent&&G){let{positionAbsolute:K}=z.internals,ee=K.x-G.x+v[0][0],te=K.x+z.measured.width-G.x2+v[1][0],oe=K.y-G.y+v[0][1],ue=K.y+z.measured.height-G.y2+v[1][1];J=[[ee,oe],[te,ue]]}let{position:Q,positionAbsolute:Z}=Nr({nodeId:U,nextPosition:Y,nodeLookup:y,nodeExtent:J||v,nodeOrigin:D,onError:L});q=q||z.position.x!==Q.x||z.position.y!==Q.y,z.position=Q,z.internals.positionAbsolute=Z}if(m=m||q,!!q&&(F(c,!0),S&&(r||T||!C&&H))){let[U,z]=yr({nodeId:C,dragItems:c,nodeLookup:y});r?.(S,c,U,z),T?.(S,U,z),C||H?.(S,z)}}o(R,"updateNodes");async function A(){if(!d)return;let{transform:B,panBy:$,autoPanSpeed:y,autoPanOnNodeDrag:v}=t();if(!v){l=!1,cancelAnimationFrame(a);return}let[_,M]=Pn(u,d,y);(_!==0||M!==0)&&(s.x=(s.x??0)-_/B[2],s.y=(s.y??0)-M/B[2],await $({x:_,y:M})&&R(s)),a=requestAnimationFrame(A)}o(A,"autoPan");function V(B){let{nodeLookup:$,multiSelectionActive:y,nodesDraggable:v,transform:_,snapGrid:M,snapToGrid:D,selectNodesOnDrag:T,onNodeDragStart:H,onSelectionDragStart:L,unselectNodesAndEdges:F}=t();h=!0,(!T||!N)&&!y&&C&&($.get(C)?.selected||F()),N&&T&&C&&e?.(C);let q=jt(B.sourceEvent,{transform:_,snapGrid:M,snapToGrid:D,containerBounds:d});if(s=q,c=Pd($,v,q,C),c.size>0&&(n||H||!C&&L)){let[W,G]=yr({nodeId:C,dragItems:c,nodeLookup:$});n?.(B.sourceEvent,c,W,G),H?.(B.sourceEvent,W,G),C||L?.(B.sourceEvent,G)}}o(V,"startDrag");let O=Ht().clickDistance(I).on("start",B=>{let{domNode:$,nodeDragThreshold:y,transform:v,snapGrid:_,snapToGrid:M}=t();d=$?.getBoundingClientRect()||null,g=!1,m=!1,S=B.sourceEvent,y===0&&V(B),s=jt(B.sourceEvent,{transform:v,snapGrid:_,snapToGrid:M,containerBounds:d}),u=we(B.sourceEvent,d)}).on("drag",B=>{let{autoPanOnNodeDrag:$,transform:y,snapGrid:v,snapToGrid:_,nodeDragThreshold:M,nodeLookup:D}=t(),T=jt(B.sourceEvent,{transform:y,snapGrid:v,snapToGrid:_,containerBounds:d});if(S=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||C&&!D.has(C))&&(g=!0),!g){if(!l&&$&&h&&(l=!0,A()),!h){let H=we(B.sourceEvent,d),L=H.x-u.x,F=H.y-u.y;Math.sqrt(L*L+F*F)>M&&V(B)}(s.x!==T.xSnapped||s.y!==T.ySnapped)&&c&&h&&(u=we(B.sourceEvent,d),R(T))}}).on("end",B=>{if(!h||g){g&&c.size>0&&t().updateNodePositions(c,!1);return}if(l=!1,h=!1,cancelAnimationFrame(a),c.size>0){let{nodeLookup:$,updateNodePositions:y,onNodeDragStop:v,onSelectionDragStop:_}=t();if(m&&(y(c,!1),m=!1),i||v||!C&&_){let[M,D]=yr({nodeId:C,dragItems:c,nodeLookup:$,dragging:!1});i?.(B.sourceEvent,c,M,D),v?.(B.sourceEvent,M,D),C||_?.(B.sourceEvent,D)}}}).filter(B=>{let $=B.target;return!B.button&&(!E||!Ji($,`.${E}`,b))&&(!p||Ji($,p,b))});f.call(O)}o(x,"update");function w(){f?.on(".drag",null)}return o(w,"destroy"),{update:x,destroy:w}}o(bs,"XYDrag");function Ad(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let s of t.values())nn(i,xt(s))>0&&r.push(s);return r}o(Ad,"getNodesWithinDistance");var Dd=250;function Td(e,t,n,r){let i=[],s=1/0,a=Ad(e,n,t+Dd);for(let c of a){let l=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(let u of l){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;let{x:d,y:h}=Ye(c,u,u.position,!0),f=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));f>t||(f<s?(i=[{...u,x:d,y:h}],s=f):f===s&&i.push({...u,x:d,y:h}))}}if(!i.length)return null;if(i.length>1){let c=r.type==="source"?"target":"source";return i.find(l=>l.type===c)??i[0]}return i[0]}o(Td,"getClosestHandle");function Ss(e,t,n,r,i,s=!1){let a=r.get(e);if(!a)return null;let c=i==="strict"?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],l=(n?c?.find(u=>u.id===n):c?.[0])??null;return l&&s?{...l,...Ye(a,l,l.position,!0)}:l}o(Ss,"getHandle");function Es(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}o(Es,"getHandleType");function Rd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}o(Rd,"isConnectionValid");var vs=o(()=>!0,"alwaysValid");function Od(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:c,nodeLookup:l,lib:u,autoPanOnConnect:d,flowId:h,panBy:f,cancelConnection:g,onConnectStart:m,onConnect:S,onConnectEnd:x,isValidConnection:w=vs,onReconnectEnd:E,updateConnection:p,getTransform:b,getFromHandle:N,autoPanSpeed:C,dragThreshold:I=1,handleDomNode:R}){let A=Tr(e.target),V=0,O,{x:B,y:$}=we(e),y=Es(s,R),v=c?.getBoundingClientRect(),_=!1;if(!v||!y)return;let M=Ss(i,y,r,l,t);if(!M)return;let D=we(e,v),T=!1,H=null,L=!1,F=null;function q(){if(!d||!v)return;let[Q,Z]=Pn(D,v,C);f({x:Q,y:Z}),V=requestAnimationFrame(q)}o(q,"autoPan");let W={...M,nodeId:i,type:y,position:M.position},G=l.get(i),U={inProgress:!0,isValid:null,from:Ye(G,W,X.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:G,to:D,toHandle:null,toPosition:Fi[W.position],toNode:null,pointer:D};function z(){_=!0,p(U),m?.(e,{nodeId:i,handleId:r,handleType:y})}o(z,"startConnection"),I===0&&z();function Y(Q){if(!_){let{x:ue,y:Ie}=we(Q),Ce=ue-B,_e=Ie-$;if(!(Ce*Ce+_e*_e>I*I))return;z()}if(!N()||!W){J(Q);return}let Z=b();D=we(Q,v),O=Td(St(D,Z,!1,[1,1]),n,l,W),T||(q(),T=!0);let K=Cs(Q,{handle:O,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:w,doc:A,lib:u,flowId:h,nodeLookup:l});F=K.handleDomNode,H=K.connection,L=Rd(!!O,K.isValid);let ee=l.get(i),te=ee?Ye(ee,W,X.Left,!0):U.from,oe={...U,from:te,isValid:L,to:K.toHandle&&L?rt({x:K.toHandle.x,y:K.toHandle.y},Z):D,toHandle:K.toHandle,toPosition:L&&K.toHandle?K.toHandle.position:Fi[W.position],toNode:K.toHandle?l.get(K.toHandle.nodeId):null,pointer:D};p(oe),U=oe}o(Y,"onPointerMove");function J(Q){if(!("touches"in Q&&Q.touches.length>0)){if(_){(O||F)&&H&&L&&S?.(H);let{inProgress:Z,...K}=U,ee={...K,toPosition:U.toHandle?U.toPosition:null};x?.(Q,ee),s&&E?.(Q,ee)}g(),cancelAnimationFrame(V),T=!1,L=!1,H=null,F=null,A.removeEventListener("mousemove",Y),A.removeEventListener("mouseup",J),A.removeEventListener("touchmove",Y),A.removeEventListener("touchend",J)}}o(J,"onPointerUp"),A.addEventListener("mousemove",Y),A.addEventListener("mouseup",J),A.addEventListener("touchmove",Y),A.addEventListener("touchend",J)}o(Od,"onPointerDown");function Cs(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:c,flowId:l,isValidConnection:u=vs,nodeLookup:d}){let h=s==="target",f=t?a.querySelector(`.${c}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:m}=we(e),S=a.elementFromPoint(g,m),x=S?.classList.contains(`${c}-flow__handle`)?S:f,w={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){let E=Es(void 0,x),p=x.getAttribute("data-nodeid"),b=x.getAttribute("data-handleid"),N=x.classList.contains("connectable"),C=x.classList.contains("connectableend");if(!p||!E)return w;let I={source:h?p:r,sourceHandle:h?b:i,target:h?r:p,targetHandle:h?i:b};w.connection=I;let A=N&&C&&(n===We.Strict?h&&E==="source"||!h&&E==="target":p!==r||b!==i);w.isValid=A&&u(I),w.toHandle=Ss(p,E,b,d,n,!0)}return w}o(Cs,"isValidHandle");var Bn={onPointerDown:Od,isValid:Cs};function _s({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=ce(e);function s({translateExtent:c,width:l,height:u,zoomStep:d=1,pannable:h=!0,zoomable:f=!0,inversePan:g=!1}){let m=o(p=>{if(p.sourceEvent.type!=="wheel"||!t)return;let b=n(),N=p.sourceEvent.ctrlKey&&Et()?10:1,C=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,I=b[2]*Math.pow(2,C*N);t.scaleTo(I)},"zoomHandler"),S=[0,0],x=o(p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(S=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},"panStartHandler"),w=o(p=>{let b=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;let N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],C=[N[0]-S[0],N[1]-S[1]];S=N;let I=r()*Math.max(b[2],Math.log(b[2]))*(g?-1:1),R={x:b[0]-C[0]*I,y:b[1]-C[1]*I},A=[[0,0],[l,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:b[2]},A,c)},"panHandler"),E=Jt().on("start",x).on("zoom",h?w:null).on("zoom.wheel",f?m:null);i.call(E,{})}o(s,"update");function a(){i.on("zoom",null)}return o(a,"destroy"),{update:s,destroy:a,pointer:fe}}o(_s,"XYMinimap");var Vn=o(e=>({x:e.x,y:e.y,zoom:e.k}),"transformToViewport"),wr=o(({x:e,y:t,zoom:n})=>et.translate(e,t).scale(n),"viewportToTransform"),Fe=o((e,t)=>e.target.closest(`.${t}`),"isWrappedWithClass"),Ns=o((e,t)=>t===2&&Array.isArray(e)&&e.includes(2),"isRightClickPan"),zd=o(e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,"defaultEase"),xr=o((e,t=0,n=zd,r=()=>{})=>{let i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},"getD3Transition"),Ms=o(e=>{let t=e.ctrlKey&&Et()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},"wheelDelta");function $d({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:c,onPanZoom:l,onPanZoomEnd:u}){return d=>{if(Fe(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();let h=n.property("__zoom").k||1;if(d.ctrlKey&&a){let x=fe(d),w=Ms(d),E=h*Math.pow(2,w);r.scaleTo(n,E,x,d);return}let f=d.deltaMode===1?20:1,g=i===ze.Vertical?0:d.deltaX*f,m=i===ze.Horizontal?0:d.deltaY*f;!Et()&&d.shiftKey&&i!==ze.Vertical&&(g=d.deltaY*f,m=0),r.translateBy(n,-(g/h)*s,-(m/h)*s,{internal:!0});let S=Vn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(d,S):(e.isPanScrolling=!0,c?.(d,S)),e.panScrollTimeout=setTimeout(()=>{u?.(d,S),e.isPanScrolling=!1},150)}}o($d,"createPanOnScrollHandler");function Ld({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,c=Fe(r,e);if(r.ctrlKey&&s&&c&&r.preventDefault(),a||c)return null;r.preventDefault(),n.call(this,r,i)}}o(Ld,"createZoomOnScrollHandler");function Hd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Vn(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,i)}}o(Hd,"createPanZoomStartHandler");function Bd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{e.usedRightMouseButton=!!(n&&Ns(t,e.mouseButton??0)),s.sourceEvent?.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!s.sourceEvent?.internal&&i?.(s.sourceEvent,Vn(s.transform))}}o(Bd,"createPanZoomHandler");function Vd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Ns(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let c=Vn(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,c)},n?150:0)}}}o(Vd,"createPanZoomEndHandler");function Fd({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:r,panOnDrag:i,panOnScroll:s,zoomOnDoubleClick:a,userSelectionActive:c,noWheelClassName:l,noPanClassName:u,lib:d,connectionInProgress:h}){return f=>{let g=t||n,m=r&&f.ctrlKey,S=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Fe(f,`${d}-flow__node`)||Fe(f,`${d}-flow__edge`)||Fe(f,`${d}-flow__selection`)||Fe(f,`${d}-flow__nodesselection`)))return!0;if(!i&&!g&&!s&&!a&&!r||c||h&&!S||Fe(f,l)&&S||Fe(f,u)&&(!S||s&&S&&!t)||!r&&f.ctrlKey&&S)return!1;if(!r&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!g&&!s&&!m&&S||!i&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(i)&&!i.includes(f.button)&&f.type==="mousedown")return!1;let x=Array.isArray(i)&&i.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||S||e)&&x}}o(Fd,"createFilter");function Is({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:c,onDraggingChange:l}){let u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),h=[[0,0],[d.width,d.height]];(typeof ResizeObserver<"u"?new ResizeObserver($=>{let y=$[0];y&&(h=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);let g=Jt().extent(()=>h).scaleExtent([t,n]).translateExtent(r),m=ce(e).call(g);b({x:i.x,y:i.y,zoom:mt(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);let S=m.on("wheel.zoom"),x=m.on("dblclick.zoom");g.wheelDelta(Ms);async function w($,y){return m?new Promise(v=>{g?.interpolate(y?.interpolate==="linear"?ln:ct).transform(xr(m,y?.duration,y?.ease,()=>v(!0)),$)}):!1}o(w,"setTransform");function E({noWheelClassName:$,noPanClassName:y,onPaneContextMenu:v,userSelectionActive:_,panOnScroll:M,panOnDrag:D,panOnScrollMode:T,panOnScrollSpeed:H,preventScrolling:L,zoomOnPinch:F,zoomOnScroll:q,zoomOnDoubleClick:W,panActivationKeyPressed:G=!1,zoomActivationKeyPressed:j,lib:U,onTransformChange:z,connectionInProgress:Y,paneClickDistance:J,selectionOnDrag:Q}){_&&!u.isZoomingOrPanning&&p();let Z=M&&!j&&!_;g.clickDistance(Q?1/0:!ye(J)||J<0?0:J);let K=Z?$d({zoomPanValues:u,noWheelClassName:$,d3Selection:m,d3Zoom:g,panOnScrollMode:T,panOnScrollSpeed:H,zoomOnPinch:F,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:c}):Ld({noWheelClassName:$,preventScrolling:L,d3ZoomHandler:S});m.on("wheel.zoom",K,{passive:!1});let ee=Hd({zoomPanValues:u,onDraggingChange:l,onPanZoomStart:a});g.on("start",ee);let te=Bd({zoomPanValues:u,panOnDrag:D,onPaneContextMenu:!!v,onPanZoom:s,onTransformChange:z});g.on("zoom",te);let oe=Vd({zoomPanValues:u,panOnDrag:D,panOnScroll:M,onPaneContextMenu:v,onPanZoomEnd:c,onDraggingChange:l});g.on("end",oe);let ue=Fd({panActivationKeyPressed:G,zoomActivationKeyPressed:j,panOnDrag:D,zoomOnScroll:q,panOnScroll:M,zoomOnDoubleClick:W,zoomOnPinch:F,userSelectionActive:_,noPanClassName:y,noWheelClassName:$,lib:U,connectionInProgress:Y});g.filter(ue),W?m.on("dblclick.zoom",x):m.on("dblclick.zoom",null)}o(E,"update");function p(){g.on("zoom",null)}o(p,"destroy");async function b($,y,v){let _=wr($),M=g?.constrain()(_,y,v);return M&&await w(M),M}o(b,"setViewportConstrained");async function N($,y){let v=wr($);return await w(v,y),v}o(N,"setViewport");function C($){if(m){let y=wr($),v=m.property("__zoom");(v.k!==$.zoom||v.x!==$.x||v.y!==$.y)&&g?.transform(m,y,null,{sync:!0})}}o(C,"syncViewport");function I(){let $=m?Qt(m.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}o(I,"getViewport");async function R($,y){return m?new Promise(v=>{g?.interpolate(y?.interpolate==="linear"?ln:ct).scaleTo(xr(m,y?.duration,y?.ease,()=>v(!0)),$)}):!1}o(R,"scaleTo");async function A($,y){return m?new Promise(v=>{g?.interpolate(y?.interpolate==="linear"?ln:ct).scaleBy(xr(m,y?.duration,y?.ease,()=>v(!0)),$)}):!1}o(A,"scaleBy");function V($){g?.scaleExtent($)}o(V,"setScaleExtent");function O($){g?.translateExtent($)}o(O,"setTranslateExtent");function B($){let y=!ye($)||$<0?0:$;g?.clickDistance(y)}return o(B,"setClickDistance"),{update:E,destroy:p,setViewport:N,setViewportConstrained:b,getViewport:I,scaleTo:R,scaleBy:A,setScaleExtent:V,setTranslateExtent:O,syncViewport:C,setClickDistance:B}}o(Is,"XYPanZoom");var Xe;(function(e){e.Line="line",e.Handle="handle"})(Xe||(Xe={}));function Wd({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){let a=e-t,c=n-r,l=[a>0?1:a<0?-1:0,c>0?1:c<0?-1:0];return a&&i&&(l[0]=l[0]*-1),c&&s&&(l[1]=l[1]*-1),l}o(Wd,"getResizeDirection");function ji(e){let t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}o(ji,"getControlDirection");function Be(e,t){return Math.max(0,t-e)}o(Be,"getLowerExtentClamp");function Ve(e,t){return Math.max(0,e-t)}o(Ve,"getUpperExtentClamp");function Nn(e,t,n){return Math.max(0,t-e,e-n)}o(Nn,"getSizeClamp");function es(e,t){return e?!t:t}o(es,"xor");function Yd(e,t,n,r,i,s,a,c){let{affectsX:l,affectsY:u}=t,{isHorizontal:d,isVertical:h}=t,f=d&&h,{xSnapped:g,ySnapped:m}=n,{minWidth:S,maxWidth:x,minHeight:w,maxHeight:E}=r,{x:p,y:b,width:N,height:C,aspectRatio:I}=e,R=Math.floor(d?g-e.pointerX:0),A=Math.floor(h?m-e.pointerY:0),V=N+(l?-R:R),O=C+(u?-A:A),B=-s[0]*N,$=-s[1]*C,y=Nn(V,S,x),v=Nn(O,w,E);if(a){let D=0,T=0;l&&R<0?D=Be(p+R+B,a[0][0]):!l&&R>0&&(D=Ve(p+V+B,a[1][0])),u&&A<0?T=Be(b+A+$,a[0][1]):!u&&A>0&&(T=Ve(b+O+$,a[1][1])),y=Math.max(y,D),v=Math.max(v,T)}if(c){let D=0,T=0;l&&R>0?D=Ve(p+R,c[0][0]):!l&&R<0&&(D=Be(p+V,c[1][0])),u&&A>0?T=Ve(b+A,c[0][1]):!u&&A<0&&(T=Be(b+O,c[1][1])),y=Math.max(y,D),v=Math.max(v,T)}if(i){if(d){let D=Nn(V/I,w,E)*I;if(y=Math.max(y,D),a){let T=0;!l&&!u||l&&!u&&f?T=Ve(b+$+V/I,a[1][1])*I:T=Be(b+$+(l?R:-R)/I,a[0][1])*I,y=Math.max(y,T)}if(c){let T=0;!l&&!u||l&&!u&&f?T=Be(b+V/I,c[1][1])*I:T=Ve(b+(l?R:-R)/I,c[0][1])*I,y=Math.max(y,T)}}if(h){let D=Nn(O*I,S,x)/I;if(v=Math.max(v,D),a){let T=0;!l&&!u||u&&!l&&f?T=Ve(p+O*I+B,a[1][0])/I:T=Be(p+(u?A:-A)*I+B,a[0][0])/I,v=Math.max(v,T)}if(c){let T=0;!l&&!u||u&&!l&&f?T=Be(p+O*I,c[1][0])/I:T=Ve(p+(u?A:-A)*I,c[0][0])/I,v=Math.max(v,T)}}}A=A+(A<0?v:-v),R=R+(R<0?y:-y),i&&(f?V>O*I?A=(es(l,u)?-R:R)/I:R=(es(l,u)?-A:A)*I:d?(A=R/I,u=l):(R=A*I,l=u));let _=l?p+R:p,M=u?b+A:b;return{width:N+(l?-R:R),height:C+(u?-A:A),x:s[0]*R*(l?-1:1)+_,y:s[1]*A*(u?-1:1)+M}}o(Yd,"getDimensionsAfterResize");var Ps={width:0,height:0,x:0,y:0},Xd={...Ps,pointerX:0,pointerY:0,aspectRatio:1};function Zd(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,c=n[0]*s,l=n[1]*a;return[[r-c,i-l],[r+s-c,i+a-l]]}o(Zd,"nodeToChildExtent");function ks({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let s=ce(e),a={controlDirection:ji("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:u,boundaries:d,keepAspectRatio:h,resizeDirection:f,onResizeStart:g,onResize:m,onResizeEnd:S,shouldResize:x}){let w={...Ps},E={...Xd};a={boundaries:d,resizeDirection:f,keepAspectRatio:h,controlDirection:ji(u)};let p,b=null,N=[],C,I,R,A=Ht().on("start",V=>{let{nodeLookup:O,transform:B,snapGrid:$,snapToGrid:y,nodeOrigin:v,paneDomNode:_}=n();if(p=O.get(t),!p)return;b=_?.getBoundingClientRect()??null;let{xSnapped:M,ySnapped:D}=jt(V.sourceEvent,{transform:B,snapGrid:$,snapToGrid:y,containerBounds:b});w={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},E={...w,pointerX:M,pointerY:D,aspectRatio:w.width/w.height},C=void 0,I=it(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(C=O.get(p.parentId)),C&&p.extent==="parent"&&(I=[[0,0],[C.measured.width,C.measured.height]]),N=[],R=void 0;for(let[T,H]of O)if(H.parentId===t&&(N.push({id:T,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){let L=Zd(H,p,H.origin??v);R?R=[[Math.min(L[0][0],R[0][0]),Math.min(L[0][1],R[0][1])],[Math.max(L[1][0],R[1][0]),Math.max(L[1][1],R[1][1])]]:R=L}g?.(V,{...w})}).on("drag",V=>{let{transform:O,snapGrid:B,snapToGrid:$,nodeOrigin:y}=n(),v=jt(V.sourceEvent,{transform:O,snapGrid:B,snapToGrid:$,containerBounds:b}),_=[];if(!p)return;let{x:M,y:D,width:T,height:H}=w,L={},F=p.origin??y,{width:q,height:W,x:G,y:j}=Yd(E,a.controlDirection,v,a.boundaries,a.keepAspectRatio,F,I,R),U=q!==T,z=W!==H,Y=G!==M&&U,J=j!==D&&z;if(!Y&&!J&&!U&&!z)return;let Q={prevValues:{...w},startX:E.x,startY:E.y,childNodes:N.map(te=>({...te,position:{...te.position}}))};if((Y||J||F[0]===1||F[1]===1)&&(L.x=Y?G:w.x,L.y=J?j:w.y,w.x=L.x,w.y=L.y,N.length>0)){let te=G-M,oe=j-D;for(let ue of N)ue.position={x:ue.position.x-te+F[0]*(q-T),y:ue.position.y-oe+F[1]*(W-H)},_.push(ue)}if((U||z)&&(L.width=U&&(!a.resizeDirection||a.resizeDirection==="horizontal")?q:w.width,L.height=z&&(!a.resizeDirection||a.resizeDirection==="vertical")?W:w.height,w.width=L.width,w.height=L.height),C&&p.expandParent){let te=F[0]*(L.width??0);L.x&&L.x<te&&(w.x=te,E.x=E.x-(L.x-te));let oe=F[1]*(L.height??0);L.y&&L.y<oe&&(w.y=oe,E.y=E.y-(L.y-oe))}let Z=Wd({width:w.width,prevWidth:T,height:w.height,prevHeight:H,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),K={...w,direction:Z};if(x?.(V,K)===!1){w=Q.prevValues,E.x=Q.startX,E.y=Q.startY,N.forEach((te,oe)=>{te.position=Q.childNodes[oe].position});return}m?.(V,K),r(L,_)}).on("end",V=>{S?.(V,{...w}),i?.({...w})});s.call(A)}o(c,"update");function l(){s.on(".drag",null)}return o(l,"destroy"),{update:c,destroy:l}}o(ks,"XYResizer");var k=Ke(di()),P=Ke(no());function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ae(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}o(ae,"cc");var Rs=Ke(no(),1),Os=Ke(xl(),1);var As=o(e=>{let t,n=new Set,r=o((d,h)=>{let f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){let g=t;t=h??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(m=>m(t,g))}},"setState"),i=o(()=>t,"getState"),l={setState:r,getState:i,getInitialState:o(()=>u,"getInitialState"),subscribe:o(d=>(n.add(d),()=>n.delete(d)),"subscribe"),destroy:o(()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()},"destroy")},u=t=e(r,i,l);return l},"createStoreImpl"),Ds=o(e=>e?As(e):As,"createStore");var{useDebugValue:Ud}=Rs.default,{useSyncExternalStoreWithSelector:qd}=Os.default,Gd=o(e=>e,"identity");function Fr(e,t=Gd,n){let r=qd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ud(r),r}o(Fr,"useStoreWithEqualityFn");var Ts=o((e,t)=>{let n=Ds(e),r=o((i,s=t)=>Fr(n,i,s),"useBoundStoreWithEqualityFn");return Object.assign(r,n),r},"createWithEqualityFnImpl"),zs=o((e,t)=>e?Ts(e,t):Ts,"createWithEqualityFn");function re(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(let[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}o(re,"shallow$1");var Kd=Ke(wl());var Zn=(0,P.createContext)(null),Qd=Zn.Provider,la=ge.error001("react");function ne(e,t){let n=(0,P.useContext)(Zn);if(n===null)throw new Error(la);return Fr(n,e,t)}o(ne,"useStore");function ie(){let e=(0,P.useContext)(Zn);if(e===null)throw new Error(la);return(0,P.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}o(ie,"useStoreApi");var $s={display:"none"},Jd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ua="react-flow__node-desc",da="react-flow__edge-desc",jd="react-flow__aria-live",ef=o(e=>e.ariaLiveMessage,"ariaLiveSelector"),tf=o(e=>e.ariaLabelConfig,"ariaLabelConfigSelector");function nf({rfId:e}){let t=ne(ef);return(0,k.jsx)("div",{id:`${jd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Jd,children:t})}o(nf,"AriaLiveMessage");function of({rfId:e,disableKeyboardA11y:t}){let n=ne(tf);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("div",{id:`${ua}-${e}`,style:$s,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,k.jsx)("div",{id:`${da}-${e}`,style:$s,children:n["edge.a11yDescription.default"]}),!t&&(0,k.jsx)(nf,{rfId:e})]})}o(of,"A11yDescriptions");var Ct=(0,P.forwardRef)(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{let a=`${e}`.split("-");return(0,k.jsx)("div",{className:ae(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});Ct.displayName="Panel";var Ls="https://reactflow.dev?utm_source=attribution";function rf({proOptions:e,position:t="bottom-right"}){return(0,P.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,k.jsx)(Ct,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ls}`,children:(0,k.jsx)("a",{href:Ls,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}o(rf,"Attribution");var sf=o(e=>{let t=[],n=[];for(let[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(let[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},"selector$l"),Fn=o(e=>e.id,"selectId");function af(e,t){return re(e.selectedNodes.map(Fn),t.selectedNodes.map(Fn))&&re(e.selectedEdges.map(Fn),t.selectedEdges.map(Fn))}o(af,"areEqual$1");function cf({onSelectionChange:e}){let t=ie(),{selectedNodes:n,selectedEdges:r}=ne(sf,af);return(0,P.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}o(cf,"SelectionListenerInner");var lf=o(e=>!!e.onSelectionChangeHandlers,"changeSelector");function uf({onSelectionChange:e}){let t=ne(lf);return e||t?(0,k.jsx)(cf,{onSelectionChange:e}):null}o(uf,"SelectionListener");var fa=[0,0],df={x:0,y:0,zoom:1},ff=["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"],Hs=[...ff,"rfId"],hf=o(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}),"selector$k"),Bs={translateExtent:yt,nodeOrigin:fa,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function pf(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:c,setDefaultNodesAndEdges:l}=ne(hf,re),u=ie();(0,P.useEffect)(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=Bs,c()}),[]);let d=(0,P.useRef)(Bs);return(0,P.useEffect)(()=>{for(let h of Hs){let f=e[h],g=d.current[h];f!==g&&(typeof e[h]>"u"||(h==="nodes"?t(f):h==="edges"?n(f):h==="minZoom"?r(f):h==="maxZoom"?i(f):h==="translateExtent"?s(f):h==="nodeExtent"?a(f):h==="ariaLabelConfig"?u.setState({ariaLabelConfig:cs(f)}):h==="fitView"?u.setState({fitViewQueued:f}):h==="fitViewOptions"?u.setState({fitViewOptions:f}):u.setState({[h]:f})))}d.current=e},Hs.map(h=>e[h])),null}o(pf,"StoreUpdater");function Vs(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}o(Vs,"getMediaQuery");function gf(e){let[t,n]=(0,P.useState)(e==="system"?null:e);return(0,P.useEffect)(()=>{if(e!=="system"){n(e);return}let r=Vs(),i=o(()=>n(r?.matches?"dark":"light"),"updateColorModeClass");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:Vs()?.matches?"dark":"light"}o(gf,"useColorModeClass");var Fs=typeof document<"u"?document:null;function rn(e=null,t={target:Fs,actInsideInputWithModifier:!0}){let[n,r]=(0,P.useState)(!1),i=(0,P.useRef)(!1),s=(0,P.useRef)(new Set([])),[a,c]=(0,P.useMemo)(()=>{if(e!==null){let u=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.replace(/\+/g,`
2
2
  `).replace(`
3
3
 
4
4
  `,`
@@ -1 +1 @@
1
- import{a as Z}from"./chunk-R6U22RSY.js";import{a as te}from"./chunk-LXCVA5SP.js";import{a as Y}from"./chunk-7Q256NLI.js";import{b as X}from"./chunk-ZKJS6EBE.js";import{a as W}from"./chunk-FUYEZFBP.js";import"./chunk-RGMVGZV4.js";import{i as G}from"./chunk-OQ6I6OXT.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{b as ae,c as ne}from"./chunk-X4MAMXRE.js";import{a as q,b as ee}from"./chunk-H6MI6GGH.js";import{a as Q}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import"./chunk-M27YVZWM.js";import"./chunk-NCPW7WHO.js";import"./chunk-LXQGF74P.js";import"./chunk-55UGUCQ6.js";import{a as I}from"./chunk-4ZEL6BYL.js";import{c as _}from"./chunk-NWWMHMGA.js";import{l as D}from"./chunk-3JVXNEBO.js";import"./chunk-QAQDMS6R.js";import"./chunk-BAWEGZ7T.js";import"./chunk-HCTJKP5J.js";import"./chunk-2IKDEUCX.js";import{d as M,f as C,g as A,m as V,q as N}from"./chunk-74IYYDDI.js";import{a as l,d as j,e as he,f as me,g as pe}from"./chunk-I26MS5PJ.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:i}=t;if(typeof i!="string"||i.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(s=>typeof s!="string"||s.length===0)?!1:typeof n=="string"&&n.length>0},"ye"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(i=>JSON.stringify(i)).join(", ")}])`,"ge"),ye=l(t=>{let e=(0,E.c)(19),{fields:i,indexName:a,table:n,testId:s}=t,u=M(),[h,f]=(0,c.useState)(null),m;e[0]!==i||e[1]!==a?(m=l(()=>{let b=be(a,i),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=i,e[1]=a,e[2]=m):m=e[2];let x=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==s?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${s}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:n})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${s}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:n}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=n,e[7]=s,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==n?(p=u("Copy index declaration for {table}",{table:n}),e[11]=u,e[12]=n,e[13]=p):p=e[13];let w;return e[14]!==x||e[15]!==T||e[16]!==p||e[17]!==s?(w=(0,S.jsx)(te,{confirmLabel:T,onConfirm:x,testId:s,children:p}),e[14]=x,e[15]=T,e[16]=p,e[17]=s,e[18]=w):w=e[18],w},"ve"),xe=l((t,e)=>{let i=new Map;for(let a of e){let n=`${a.table} ${a.index}`;i.set(n,(i.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:i.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let i of t)for(let a of i.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([i,a])=>({scans:a,table:i}))},"Te"),ie=l((t,e)=>e.map(i=>({index:i.name,table:t})),"P"),we=l(t=>{let e=xe(t.declaredIndexes??[],t.indexHits??[]),i=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,s=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:i,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:s,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(x=>!(x.metadata.kind==="hot_scan"&&typeof x.metadata.table=="string"&&m.has(x.metadata.table)))).map(x=>q(x))},"we"),Se=C(I.listTables),Te=C(I.listTableIndexes),Ie=C(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"L"),re=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),se=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:re(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:re(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:V(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:i,table:a}=t,n=M(),s;e[0]!==i||e[1]!==a?(s=l(()=>{i(a)},"i"),e[0]=i,e[1]=a,e[2]=s):s=e[2];let u=s,h=`in-add-index-${a}`,f;e[3]!==n||e[4]!==a?(f=n("Add index on {table}",{table:a}),e[3]=n,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(Q,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let i=D(),a=G(),n=M(),{queryShardKey:s,setShardKey:u,shardKey:h}=Z(t),[f,m]=(0,c.useState)(null),[x,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=_(I.getMetrics,{},{live:!0,shardKey:s}),b=_(I.getFunctionStats,{},{live:!0,shardKey:s}),$=_(I.getAdvisories,{},{live:!0,shardKey:s}),L=w.data??null,H=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(r=>i.shardTraffic(r)),le=l(async(r,y)=>{let o=r[0];if(o===void 0||o===""){p.current===y&&T(null);return}try{let g=await oe(o);if(p.current!==y)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===y&&T(null)}},"Y"),de=l(async(r,y)=>{let o=await Promise.allSettled(r.map(async d=>[d,await i.query(Te,{table:d},A(y))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...ie(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async r=>{p.current=r;let y=[];try{let o=await i.query(Se,{},A(r));if(p.current!==r)return;X(r),y=o.map(d=>d.name);let g=[];if(y.length>0)try{let d=await i.query(Ie,{tables:y},A(r));if(p.current!==r)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...ie(v,k))}catch{if(g=await de(y,r),p.current!==r)return}m(g)}catch{p.current===r&&m(null)}await le(y,r)});(0,c.useEffect)(()=>{N(z(s))},[s]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(s))});(0,c.useEffect)(()=>{let r=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]);let U=(0,c.useCallback)(r=>{N(a({search:{table:r},to:"/schema"}))},[a]),K=(0,c.useMemo)(()=>W(L,H),[H,L]),P=(0,c.useMemo)(()=>new Set(K.filter(r=>r.kind==="missing-index").flatMap(r=>r.tables??[])),[K]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:H,indexHits:J,shardTraffic:x,suppressHotScanTables:P}),[f,H,J,P,x]),ue=(0,c.useMemo)(()=>{let r=K.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?se(n,o):`${se(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),y=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(y.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(ye,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...r]},[F,K,U,R,n]),fe=(0,S.jsx)(Y,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(ee,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
1
+ import{a as Z}from"./chunk-R6U22RSY.js";import{a as te}from"./chunk-LXCVA5SP.js";import{a as Y}from"./chunk-7Q256NLI.js";import{b as X}from"./chunk-ZKJS6EBE.js";import{a as W}from"./chunk-FUYEZFBP.js";import"./chunk-RGMVGZV4.js";import{i as G}from"./chunk-OQ6I6OXT.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{b as ae,c as ne}from"./chunk-X4MAMXRE.js";import{a as q,b as ee}from"./chunk-K3UAOIR7.js";import{a as Q}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import"./chunk-ZJQIGWLG.js";import"./chunk-NCPW7WHO.js";import"./chunk-IRSSZXC3.js";import"./chunk-55UGUCQ6.js";import{a as I}from"./chunk-4ZEL6BYL.js";import{c as _}from"./chunk-DHGPCQ2F.js";import{l as D}from"./chunk-NCCORPSU.js";import"./chunk-QAQDMS6R.js";import"./chunk-M3QKMHAP.js";import"./chunk-HCTJKP5J.js";import"./chunk-2IKDEUCX.js";import{d as M,f as C,g as A,m as V,q as N}from"./chunk-74IYYDDI.js";import{a as l,d as j,e as he,f as me,g as pe}from"./chunk-I26MS5PJ.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:i}=t;if(typeof i!="string"||i.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(s=>typeof s!="string"||s.length===0)?!1:typeof n=="string"&&n.length>0},"ye"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(i=>JSON.stringify(i)).join(", ")}])`,"ge"),ye=l(t=>{let e=(0,E.c)(19),{fields:i,indexName:a,table:n,testId:s}=t,u=M(),[h,f]=(0,c.useState)(null),m;e[0]!==i||e[1]!==a?(m=l(()=>{let b=be(a,i),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=i,e[1]=a,e[2]=m):m=e[2];let x=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==s?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${s}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:n})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${s}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:n}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=n,e[7]=s,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==n?(p=u("Copy index declaration for {table}",{table:n}),e[11]=u,e[12]=n,e[13]=p):p=e[13];let w;return e[14]!==x||e[15]!==T||e[16]!==p||e[17]!==s?(w=(0,S.jsx)(te,{confirmLabel:T,onConfirm:x,testId:s,children:p}),e[14]=x,e[15]=T,e[16]=p,e[17]=s,e[18]=w):w=e[18],w},"ve"),xe=l((t,e)=>{let i=new Map;for(let a of e){let n=`${a.table} ${a.index}`;i.set(n,(i.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:i.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let i of t)for(let a of i.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([i,a])=>({scans:a,table:i}))},"Te"),ie=l((t,e)=>e.map(i=>({index:i.name,table:t})),"P"),we=l(t=>{let e=xe(t.declaredIndexes??[],t.indexHits??[]),i=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,s=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:i,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:s,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(x=>!(x.metadata.kind==="hot_scan"&&typeof x.metadata.table=="string"&&m.has(x.metadata.table)))).map(x=>q(x))},"we"),Se=C(I.listTables),Te=C(I.listTableIndexes),Ie=C(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"L"),re=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),se=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:re(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:re(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:V(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:i,table:a}=t,n=M(),s;e[0]!==i||e[1]!==a?(s=l(()=>{i(a)},"i"),e[0]=i,e[1]=a,e[2]=s):s=e[2];let u=s,h=`in-add-index-${a}`,f;e[3]!==n||e[4]!==a?(f=n("Add index on {table}",{table:a}),e[3]=n,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(Q,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let i=D(),a=G(),n=M(),{queryShardKey:s,setShardKey:u,shardKey:h}=Z(t),[f,m]=(0,c.useState)(null),[x,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=_(I.getMetrics,{},{live:!0,shardKey:s}),b=_(I.getFunctionStats,{},{live:!0,shardKey:s}),$=_(I.getAdvisories,{},{live:!0,shardKey:s}),L=w.data??null,H=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(r=>i.shardTraffic(r)),le=l(async(r,y)=>{let o=r[0];if(o===void 0||o===""){p.current===y&&T(null);return}try{let g=await oe(o);if(p.current!==y)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===y&&T(null)}},"Y"),de=l(async(r,y)=>{let o=await Promise.allSettled(r.map(async d=>[d,await i.query(Te,{table:d},A(y))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...ie(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async r=>{p.current=r;let y=[];try{let o=await i.query(Se,{},A(r));if(p.current!==r)return;X(r),y=o.map(d=>d.name);let g=[];if(y.length>0)try{let d=await i.query(Ie,{tables:y},A(r));if(p.current!==r)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...ie(v,k))}catch{if(g=await de(y,r),p.current!==r)return}m(g)}catch{p.current===r&&m(null)}await le(y,r)});(0,c.useEffect)(()=>{N(z(s))},[s]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(s))});(0,c.useEffect)(()=>{let r=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]);let U=(0,c.useCallback)(r=>{N(a({search:{table:r},to:"/schema"}))},[a]),K=(0,c.useMemo)(()=>W(L,H),[H,L]),P=(0,c.useMemo)(()=>new Set(K.filter(r=>r.kind==="missing-index").flatMap(r=>r.tables??[])),[K]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:H,indexHits:J,shardTraffic:x,suppressHotScanTables:P}),[f,H,J,P,x]),ue=(0,c.useMemo)(()=>{let r=K.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?se(n,o):`${se(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),y=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(y.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(ye,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...r]},[F,K,U,R,n]),fe=(0,S.jsx)(Y,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(ee,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};