@lunora/studio 1.0.0-alpha.37 → 1.0.0-alpha.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/packem_chunks/auth-config-panel.js +290 -104
  3. package/dist/packem_chunks/organizations-panel.js +3002 -494
  4. package/dist/packem_chunks/users-panel.js +576 -110
  5. package/dist/packem_shared/use-async-submit-BWMDwRa4.js +91 -0
  6. package/dist/standalone/{chunk-PACH5AHG.js → chunk-2F4VYKM6.js} +1 -1
  7. package/dist/standalone/{chunk-OIZ4CHPN.js → chunk-2GFAOIC3.js} +1 -1
  8. package/dist/standalone/{chunk-OY3GVYS7.js → chunk-2SAZ5BZ5.js} +1 -1
  9. package/dist/standalone/chunk-2SE7II7A.js +1 -0
  10. package/dist/standalone/{chunk-5OH3VPZF.js → chunk-34OQUHSV.js} +1 -1
  11. package/dist/standalone/{chunk-2THHW7BC.js → chunk-3DBG4RIV.js} +1 -1
  12. package/dist/standalone/{chunk-EUIHTPKI.js → chunk-3UFZCRWL.js} +1 -1
  13. package/dist/standalone/{chunk-QLM6FYZW.js → chunk-4FL3EDN5.js} +1 -1
  14. package/dist/standalone/{chunk-ILCTSAOB.js → chunk-4JOKDSPU.js} +1 -1
  15. package/dist/standalone/{chunk-BQUQS7QN.js → chunk-7FF76BYY.js} +1 -1
  16. package/dist/standalone/chunk-7YXOPTWI.js +1 -0
  17. package/dist/standalone/chunk-AJKR6PY7.js +1 -0
  18. package/dist/standalone/{chunk-TOJ3TC35.js → chunk-FA3CCTXK.js} +1 -1
  19. package/dist/standalone/chunk-GLUNBZRI.js +1 -0
  20. package/dist/standalone/chunk-GM4NPF3W.js +1 -0
  21. package/dist/standalone/{chunk-XLQ4BHBD.js → chunk-HLZ4YLRK.js} +1 -1
  22. package/dist/standalone/{chunk-RRAFQ5G2.js → chunk-I3VXCZZL.js} +1 -1
  23. package/dist/standalone/{chunk-7VF3IAAW.js → chunk-IJPFHUJK.js} +1 -1
  24. package/dist/standalone/chunk-IQ466Q6W.js +1 -0
  25. package/dist/standalone/{chunk-LD2R263D.js → chunk-IU6GTBPD.js} +1 -1
  26. package/dist/standalone/{chunk-764T6X6X.js → chunk-IXDH4GL5.js} +1 -1
  27. package/dist/standalone/{chunk-6WRZP62V.js → chunk-JTTVXBLU.js} +1 -1
  28. package/dist/standalone/{chunk-7SLSB2TS.js → chunk-KQTCLPLO.js} +2 -2
  29. package/dist/standalone/chunk-KSKXW5PX.js +1 -0
  30. package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
  31. package/dist/standalone/{chunk-BI35RXKQ.js → chunk-LEHGGJP2.js} +1 -1
  32. package/dist/standalone/chunk-LNZIB2MD.js +1 -0
  33. package/dist/standalone/{chunk-OCHNCAXJ.js → chunk-MZ756AFF.js} +1 -1
  34. package/dist/standalone/chunk-N7G5I47W.js +1 -0
  35. package/dist/standalone/{chunk-TO4JQX7W.js → chunk-NV6RHG5L.js} +1 -1
  36. package/dist/standalone/chunk-O3I57FXK.js +1 -0
  37. package/dist/standalone/{chunk-YEVCU7TB.js → chunk-OES45DFG.js} +1 -1
  38. package/dist/standalone/{chunk-DVKPRFIJ.js → chunk-OIC7EJWI.js} +1 -1
  39. package/dist/standalone/{chunk-ZU4DZ6NK.js → chunk-OLE2AYTD.js} +1 -1
  40. package/dist/standalone/{chunk-U4OAQPBT.js → chunk-P3ZMBPCY.js} +1 -1
  41. package/dist/standalone/{chunk-VTGBPW24.js → chunk-P5JW7HKP.js} +1 -1
  42. package/dist/standalone/{chunk-MPTM7ZU3.js → chunk-Q3PTSVVU.js} +1 -1
  43. package/dist/standalone/chunk-QKQABJBE.js +1 -0
  44. package/dist/standalone/{chunk-JE2YOAB7.js → chunk-R5OQZYSW.js} +1 -1
  45. package/dist/standalone/{chunk-ATYUMPDM.js → chunk-SE2TQAHJ.js} +1 -1
  46. package/dist/standalone/{chunk-DVC6YWVP.js → chunk-TI7SE33D.js} +1 -1
  47. package/dist/standalone/{chunk-DWTBY343.js → chunk-VFJPO4UO.js} +1 -1
  48. package/dist/standalone/chunk-VON7JUPG.js +1 -0
  49. package/dist/standalone/{chunk-46K3NKPA.js → chunk-X7RPB4K4.js} +1 -1
  50. package/dist/standalone/{chunk-X5P2WRYI.js → chunk-XFSUINL3.js} +1 -1
  51. package/dist/standalone/{chunk-SLKF2L74.js → chunk-XGUOXHX4.js} +1 -1
  52. package/dist/standalone/{chunk-M55U7NHO.js → chunk-ZL4E2WVF.js} +1 -1
  53. package/dist/standalone/studio.js +1 -1
  54. package/package.json +3 -3
  55. package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
  56. package/dist/standalone/chunk-22W5VKZ6.js +0 -1
  57. package/dist/standalone/chunk-2GGMGPEP.js +0 -1
  58. package/dist/standalone/chunk-BACPICH6.js +0 -1
  59. package/dist/standalone/chunk-DORBUITF.js +0 -1
  60. package/dist/standalone/chunk-IOFMK4D7.js +0 -1
  61. package/dist/standalone/chunk-LI43EKM6.js +0 -1
  62. package/dist/standalone/chunk-MPYFGAOW.js +0 -1
  63. package/dist/standalone/chunk-NKJDGOM3.js +0 -1
  64. package/dist/standalone/chunk-PN5NCZDX.js +0 -1
  65. package/dist/standalone/chunk-RSEEHNFI.js +0 -1
  66. package/dist/standalone/chunk-X7MMBSNW.js +0 -1
  67. package/dist/standalone/chunk-XUGSA2NG.js +0 -1
@@ -1,4 +1,4 @@
1
- "use client";import{a as Ye,b as fo}from"./chunk-2NGUNNGW.js";import{a as Es,b as Cs,c as _s,f as ho}from"./chunk-PN5NCZDX.js";import"./chunk-QBAT52GB.js";import"./chunk-QAFAJBAW.js";import"./chunk-764T6X6X.js";import"./chunk-XUGSA2NG.js";import"./chunk-5OIBXYZM.js";import{a as lr,b as cr,c as gs,d as ys,e as uo,g as xs,h as ws,i as Ut}from"./chunk-BJGBHGK3.js";import{e as fs}from"./chunk-WI7GWFEG.js";import{a as Ss}from"./chunk-2K47A3P6.js";import{b as tu}from"./chunk-KEGAWN6Y.js";import{a as Ge}from"./chunk-JSEXCW5Q.js";import{e as hs,k as ps}from"./chunk-4QHKBC77.js";import{a as vs}from"./chunk-K3GNLVYK.js";import{b as bs}from"./chunk-TBMYIZIO.js";import{R as Mt}from"./chunk-3CJW6NWG.js";import{c as Ie}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as Qc}from"./chunk-HV7G6DFP.js";import{a as Nn}from"./chunk-BOXSWNXZ.js";import{a as ms}from"./chunk-TAD43CG5.js";import{a as io,b as so,c as ao,d as lo,e as co}from"./chunk-SEU5V7I6.js";import{b as Ue}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as ds}from"./chunk-X7MMBSNW.js";import"./chunk-ZHVTQ37P.js";import{a as jc}from"./chunk-3OA7PECS.js";import{d as It,e as En,f as Cn,g as _n,k as Oe}from"./chunk-PVZI3CXP.js";import{b as us}from"./chunk-GMSGZDDH.js";import{a as o,e as mt,f as ar,g as Jc,h as eu,j as Zt}from"./chunk-RRCPZMC2.js";var Be=mt(Jc(),1);var re=mt(ar(),1);var O=mt(jc()),$=mt(ar());function ge(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=ge(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}o(ge,"cc");var nu={value:o(()=>{},"value")};function Is(){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 po(n)}o(Is,"dispatch");function po(e){this._=e}o(po,"Dispatch");function ou(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(ou,"parseTypenames");po.prototype=Is.prototype={constructor:po,on:o(function(e,t){var n=this._,r=ou(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=ru(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]=Ns(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ns(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 po(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 ru(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}o(ru,"get");function Ns(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=nu,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}o(Ns,"set");var Pt=Is;var mo="http://www.w3.org/1999/xhtml",ur={svg:"http://www.w3.org/2000/svg",xhtml:mo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function We(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ur.hasOwnProperty(t)?{space:ur[t],local:e}:e}o(We,"default");function iu(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===mo&&t.documentElement.namespaceURI===mo?t.createElement(e):t.createElementNS(n,e)}}o(iu,"creatorInherit");function su(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}o(su,"creatorFixed");function In(e){var t=We(e);return(t.local?su:iu)(t)}o(In,"default");function au(){}o(au,"none");function gt(e){return e==null?au:function(){return this.querySelector(e)}}o(gt,"default");function dr(e){typeof e!="function"&&(e=gt(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,l=r[i]=new Array(a),c,u,f=0;f<a;++f)(c=s[f])&&(u=e.call(c,c.__data__,f,s))&&("__data__"in c&&(u.__data__=c.__data__),l[f]=u);return new ye(r,this._parents)}o(dr,"default");function fr(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}o(fr,"array");function lu(){return[]}o(lu,"empty");function Gt(e){return e==null?lu:function(){return this.querySelectorAll(e)}}o(Gt,"default");function cu(e){return function(){return fr(e.apply(this,arguments))}}o(cu,"arrayAll");function hr(e){typeof e=="function"?e=cu(e):e=Gt(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var a=t[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&(r.push(e.call(c,c.__data__,u,a)),i.push(c));return new ye(r,i)}o(hr,"default");function qt(e){return function(){return this.matches(e)}}o(qt,"default");function go(e){return function(t){return t.matches(e)}}o(go,"childMatcher");var uu=Array.prototype.find;function du(e){return function(){return uu.call(this.children,e)}}o(du,"childFind");function fu(){return this.firstElementChild}o(fu,"childFirst");function pr(e){return this.select(e==null?fu:du(typeof e=="function"?e:go(e)))}o(pr,"default");var hu=Array.prototype.filter;function pu(){return Array.from(this.children)}o(pu,"children");function mu(e){return function(){return hu.call(this.children,e)}}o(mu,"childrenFilter");function mr(e){return this.selectAll(e==null?pu:mu(typeof e=="function"?e:go(e)))}o(mr,"default");function gr(e){typeof e!="function"&&(e=qt(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,l=r[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new ye(r,this._parents)}o(gr,"default");function Mn(e){return new Array(e.length)}o(Mn,"default");function yr(){return new ye(this._enter||this._groups.map(Mn),this._parents)}o(yr,"default");function Pn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}o(Pn,"EnterNode");Pn.prototype={constructor:Pn,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 xr(e){return function(){return e}}o(xr,"default");function gu(e,t,n,r,i,s){for(var a=0,l,c=t.length,u=s.length;a<u;++a)(l=t[a])?(l.__data__=s[a],r[a]=l):n[a]=new Pn(e,s[a]);for(;a<c;++a)(l=t[a])&&(i[a]=l)}o(gu,"bindIndex");function yu(e,t,n,r,i,s,a){var l,c,u=new Map,f=t.length,d=s.length,h=new Array(f),p;for(l=0;l<f;++l)(c=t[l])&&(h[l]=p=a.call(c,c.__data__,l,t)+"",u.has(p)?i[l]=c:u.set(p,c));for(l=0;l<d;++l)p=a.call(e,s[l],l,s)+"",(c=u.get(p))?(r[l]=c,c.__data__=s[l],u.delete(p)):n[l]=new Pn(e,s[l]);for(l=0;l<f;++l)(c=t[l])&&u.get(h[l])===c&&(i[l]=c)}o(yu,"bindKey");function xu(e){return e.__data__}o(xu,"datum");function wr(e,t){if(!arguments.length)return Array.from(this,xu);var n=t?yu:gu,r=this._parents,i=this._groups;typeof e!="function"&&(e=xr(e));for(var s=i.length,a=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var f=r[u],d=i[u],h=d.length,p=wu(e.call(f,f&&f.__data__,u,r)),m=p.length,v=l[u]=new Array(m),x=a[u]=new Array(m),y=c[u]=new Array(h);n(f,d,v,x,y,p,t);for(var S=0,g=0,w,I;S<m;++S)if(w=v[S]){for(S>=g&&(g=S+1);!(I=x[g])&&++g<m;);w._next=I||null}}return a=new ye(a,r),a._enter=l,a._exit=c,a}o(wr,"default");function wu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}o(wu,"arraylike");function br(){return new ye(this._exit||this._groups.map(Mn),this._parents)}o(br,"default");function vr(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(vr,"default");function Sr(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),l=new Array(i),c=0;c<a;++c)for(var u=n[c],f=r[c],d=u.length,h=l[c]=new Array(d),p,m=0;m<d;++m)(p=u[m]||f[m])&&(h[m]=p);for(;c<i;++c)l[c]=n[c];return new ye(l,this._parents)}o(Sr,"default");function Er(){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(Er,"default");function Cr(e){e||(e=bu);function t(d,h){return d&&h?e(d.__data__,h.__data__):!d-!h}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],l=a.length,c=i[s]=new Array(l),u,f=0;f<l;++f)(u=a[f])&&(c[f]=u);c.sort(t)}return new ye(i,this._parents).order()}o(Cr,"default");function bu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}o(bu,"ascending");function _r(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}o(_r,"default");function Nr(){return Array.from(this)}o(Nr,"default");function Ir(){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(Ir,"default");function Mr(){let e=0;for(let t of this)++e;return e}o(Mr,"default");function Pr(){return!this.node()}o(Pr,"default");function Tr(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,a=i.length,l;s<a;++s)(l=i[s])&&e.call(l,l.__data__,s,i);return this}o(Tr,"default");function vu(e){return function(){this.removeAttribute(e)}}o(vu,"attrRemove");function Su(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(Su,"attrRemoveNS");function Eu(e,t){return function(){this.setAttribute(e,t)}}o(Eu,"attrConstant");function Cu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}o(Cu,"attrConstantNS");function _u(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}o(_u,"attrFunction");function Nu(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(Nu,"attrFunctionNS");function kr(e,t){var n=We(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?Su:vu:typeof t=="function"?n.local?Nu:_u:n.local?Cu:Eu)(n,t))}o(kr,"default");function Tn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}o(Tn,"default");function Iu(e){return function(){this.style.removeProperty(e)}}o(Iu,"styleRemove");function Mu(e,t,n){return function(){this.style.setProperty(e,t,n)}}o(Mu,"styleConstant");function Pu(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}o(Pu,"styleFunction");function Ar(e,t,n){return arguments.length>1?this.each((t==null?Iu:typeof t=="function"?Pu:Mu)(e,t,n??"")):yt(this.node(),e)}o(Ar,"default");function yt(e,t){return e.style.getPropertyValue(t)||Tn(e).getComputedStyle(e,null).getPropertyValue(t)}o(yt,"styleValue");function Tu(e){return function(){delete this[e]}}o(Tu,"propertyRemove");function ku(e,t){return function(){this[e]=t}}o(ku,"propertyConstant");function Au(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}o(Au,"propertyFunction");function Dr(e,t){return arguments.length>1?this.each((t==null?Tu:typeof t=="function"?Au:ku)(e,t)):this.node()[e]}o(Dr,"default");function Ms(e){return e.trim().split(/^|\s+/)}o(Ms,"classArray");function Or(e){return e.classList||new Ps(e)}o(Or,"classList");function Ps(e){this._node=e,this._names=Ms(e.getAttribute("class")||"")}o(Ps,"ClassList");Ps.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 Ts(e,t){for(var n=Or(e),r=-1,i=t.length;++r<i;)n.add(t[r])}o(Ts,"classedAdd");function ks(e,t){for(var n=Or(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}o(ks,"classedRemove");function Du(e){return function(){Ts(this,e)}}o(Du,"classedTrue");function Ou(e){return function(){ks(this,e)}}o(Ou,"classedFalse");function $u(e,t){return function(){(t.apply(this,arguments)?Ts:ks)(this,e)}}o($u,"classedFunction");function $r(e,t){var n=Ms(e+"");if(arguments.length<2){for(var r=Or(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?$u:t?Du:Ou)(n,t))}o($r,"default");function zu(){this.textContent=""}o(zu,"textRemove");function Ru(e){return function(){this.textContent=e}}o(Ru,"textConstant");function Lu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}o(Lu,"textFunction");function zr(e){return arguments.length?this.each(e==null?zu:(typeof e=="function"?Lu:Ru)(e)):this.node().textContent}o(zr,"default");function Hu(){this.innerHTML=""}o(Hu,"htmlRemove");function Bu(e){return function(){this.innerHTML=e}}o(Bu,"htmlConstant");function Vu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}o(Vu,"htmlFunction");function Rr(e){return arguments.length?this.each(e==null?Hu:(typeof e=="function"?Vu:Bu)(e)):this.node().innerHTML}o(Rr,"default");function Fu(){this.nextSibling&&this.parentNode.appendChild(this)}o(Fu,"raise");function Lr(){return this.each(Fu)}o(Lr,"default");function Yu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}o(Yu,"lower");function Hr(){return this.each(Yu)}o(Hr,"default");function Br(e){var t=typeof e=="function"?e:In(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}o(Br,"default");function Wu(){return null}o(Wu,"constantNull");function Vr(e,t){var n=typeof e=="function"?e:In(e),r=t==null?Wu:typeof t=="function"?t:gt(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}o(Vr,"default");function Xu(){var e=this.parentNode;e&&e.removeChild(this)}o(Xu,"remove");function Fr(){return this.each(Xu)}o(Fr,"default");function Zu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(Zu,"selection_cloneShallow");function Uu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(Uu,"selection_cloneDeep");function Yr(e){return this.select(e?Uu:Zu)}o(Yr,"default");function Wr(e){return arguments.length?this.property("__data__",e):this.node().__data__}o(Wr,"default");function Gu(e){return function(t){e.call(this,t,this.__data__)}}o(Gu,"contextListener");function qu(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(qu,"parseTypenames");function Ku(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(Ku,"onRemove");function Qu(e,t,n){return function(){var r=this.__on,i,s=Gu(t);if(r){for(var a=0,l=r.length;a<l;++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(Qu,"onAdd");function Xr(e,t,n){var r=qu(e+""),i,s=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,f;c<u;++c)for(i=0,f=l[c];i<s;++i)if((a=r[i]).type===f.type&&a.name===f.name)return f.value}return}for(l=t?Qu:Ku,i=0;i<s;++i)this.each(l(r[i],t,n));return this}o(Xr,"default");function As(e,t,n){var r=Tn(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(As,"dispatchEvent");function Ju(e,t){return function(){return As(this,e,t)}}o(Ju,"dispatchConstant");function ju(e,t){return function(){return As(this,e,t.apply(this,arguments))}}o(ju,"dispatchFunction");function Zr(e,t){return this.each((typeof t=="function"?ju:Ju)(e,t))}o(Zr,"default");function*Ur(){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(Ur,"default");var Gr=[null];function ye(e,t){this._groups=e,this._parents=t}o(ye,"Selection");function Ds(){return new ye([[document.documentElement]],Gr)}o(Ds,"selection");function ed(){return this}o(ed,"selection_selection");ye.prototype=Ds.prototype={constructor:ye,select:dr,selectAll:hr,selectChild:pr,selectChildren:mr,filter:gr,data:wr,enter:yr,exit:br,join:vr,merge:Sr,selection:ed,order:Er,sort:Cr,call:_r,nodes:Nr,node:Ir,size:Mr,empty:Pr,each:Tr,attr:kr,style:Ar,property:Dr,classed:$r,text:zr,html:Rr,raise:Lr,lower:Hr,append:Br,insert:Vr,remove:Fr,clone:Yr,datum:Wr,on:Xr,dispatch:Zr,[Symbol.iterator]:Ur};var qe=Ds;function Ee(e){return typeof e=="string"?new ye([[document.querySelector(e)]],[document.documentElement]):new ye([[e]],Gr)}o(Ee,"default");function qr(e){let t;for(;t=e.sourceEvent;)e=t;return e}o(qr,"default");function Me(e,t){if(e=qr(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(Me,"default");var Os={passive:!1},Tt={capture:!0,passive:!1};function yo(e){e.stopImmediatePropagation()}o(yo,"nopropagation");function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}o(Ke,"default");function Kt(e){var t=e.document.documentElement,n=Ee(e).on("dragstart.drag",Ke,Tt);"onselectstart"in t?n.on("selectstart.drag",Ke,Tt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}o(Kt,"default");function kn(e,t){var n=e.document.documentElement,r=Ee(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ke,Tt),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(kn,"yesdrag");var An=o(e=>()=>e,"default");function Dn(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:a,y:l,dx:c,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value: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:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}o(Dn,"DragEvent");Dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function td(e){return!e.ctrlKey&&!e.button}o(td,"defaultFilter");function nd(){return this.parentNode}o(nd,"defaultContainer");function od(e,t){return t??{x:e.x,y:e.y}}o(od,"defaultSubject");function rd(){return navigator.maxTouchPoints||"ontouchstart"in this}o(rd,"defaultTouchable");function On(){var e=td,t=nd,n=od,r=rd,i={},s=Pt("start","drag","end"),a=0,l,c,u,f,d=0;function h(w){w.on("mousedown.drag",p).filter(r).on("touchstart.drag",x).on("touchmove.drag",y,Os).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(h,"drag");function p(w,I){if(!(f||!e.call(this,w,I))){var _=g(this,t.call(this,w,I),w,I,"mouse");_&&(Ee(w.view).on("mousemove.drag",m,Tt).on("mouseup.drag",v,Tt),Kt(w.view),yo(w),u=!1,l=w.clientX,c=w.clientY,_("start",w))}}o(p,"mousedowned");function m(w){if(Ke(w),!u){var I=w.clientX-l,_=w.clientY-c;u=I*I+_*_>d}i.mouse("drag",w)}o(m,"mousemoved");function v(w){Ee(w.view).on("mousemove.drag mouseup.drag",null),kn(w.view,u),Ke(w),i.mouse("end",w)}o(v,"mouseupped");function x(w,I){if(e.call(this,w,I)){var _=w.changedTouches,T=t.call(this,w,I),k=_.length,A,Y;for(A=0;A<k;++A)(Y=g(this,T,w,I,_[A].identifier,_[A]))&&(yo(w),Y("start",w,_[A]))}}o(x,"touchstarted");function y(w){var I=w.changedTouches,_=I.length,T,k;for(T=0;T<_;++T)(k=i[I[T].identifier])&&(Ke(w),k("drag",w,I[T]))}o(y,"touchmoved");function S(w){var I=w.changedTouches,_=I.length,T,k;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),T=0;T<_;++T)(k=i[I[T].identifier])&&(yo(w),k("end",w,I[T]))}o(S,"touchended");function g(w,I,_,T,k,A){var Y=s.copy(),P=Me(A||_,I),R,V,b;if((b=n.call(w,new Dn("beforestart",{sourceEvent:_,target:h,identifier:k,active:a,x:P[0],y:P[1],dx:0,dy:0,dispatch:Y}),T))!=null)return R=b.x-P[0]||0,V=b.y-P[1]||0,o(function E(C,M,z){var D=P,H;switch(C){case"start":i[k]=E,H=a++;break;case"end":delete i[k],--a;case"drag":P=Me(z||M,I),H=a;break}Y.call(C,w,new Dn(C,{sourceEvent:M,subject:b,target:h,identifier:k,active:H,x:P[0]+R,y:P[1]+V,dx:P[0]-D[0],dy:P[1]-D[1],dispatch:Y}),T)},"gesture")}return o(g,"beforestart"),h.filter=function(w){return arguments.length?(e=typeof w=="function"?w:An(!!w),h):e},h.container=function(w){return arguments.length?(t=typeof w=="function"?w:An(w),h):t},h.subject=function(w){return arguments.length?(n=typeof w=="function"?w:An(w),h):n},h.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:An(!!w),h):r},h.on=function(){var w=s.on.apply(s,arguments);return w===s?h:w},h.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,h):Math.sqrt(d)},h}o(On,"default");var Qt=0,zn=0,$n=0,zs=1e3,xo,Rn,wo=0,kt=0,bo=0,Ln=typeof performance=="object"&&performance.now?performance:Date,Rs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bn(){return kt||(Rs(id),kt=Ln.now()+bo)}o(Bn,"now");function id(){kt=0}o(id,"clearNow");function Hn(){this._call=this._time=this._next=null}o(Hn,"Timer");Hn.prototype=vo.prototype={constructor:Hn,restart:o(function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Bn():+n)+(t==null?0:+t),!this._next&&Rn!==this&&(Rn?Rn._next=this:xo=this,Rn=this),this._call=e,this._time=n,Kr()},"restart"),stop:o(function(){this._call&&(this._call=null,this._time=1/0,Kr())},"stop")};function vo(e,t,n){var r=new Hn;return r.restart(e,t,n),r}o(vo,"timer");function Ls(){Bn(),++Qt;for(var e=xo,t;e;)(t=kt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qt}o(Ls,"timerFlush");function $s(){kt=(wo=Ln.now())+bo,Qt=zn=0;try{Ls()}finally{Qt=0,ad(),kt=0}}o($s,"wake");function sd(){var e=Ln.now(),t=e-wo;t>zs&&(bo-=t,wo=e)}o(sd,"poke");function ad(){for(var e,t=xo,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:xo=n);Rn=e,Kr(r)}o(ad,"nap");function Kr(e){if(!Qt){zn&&(zn=clearTimeout(zn));var t=e-kt;t>24?(e<1/0&&(zn=setTimeout($s,e-Ln.now()-bo)),$n&&($n=clearInterval($n))):($n||(wo=Ln.now(),$n=setInterval(sd,zs)),Qt=1,Rs($s))}}o(Kr,"sleep");function Vn(e,t,n){var r=new Hn;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}o(Vn,"default");var ld=Pt("start","end","cancel","interrupt"),cd=[],Vs=0,Hs=1,Eo=2,So=3,Bs=4,Co=5,Fn=6;function Qe(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;ud(e,n,{name:t,index:r,group:i,on:ld,tween:cd,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Vs})}o(Qe,"default");function Yn(e,t){var n=Ce(e,t);if(n.state>Vs)throw new Error("too late; already scheduled");return n}o(Yn,"init");function Ne(e,t){var n=Ce(e,t);if(n.state>So)throw new Error("too late; already running");return n}o(Ne,"set");function Ce(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}o(Ce,"get");function ud(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=vo(s,0,n.time);function s(u){n.state=Hs,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}o(s,"schedule");function a(u){var f,d,h,p;if(n.state!==Hs)return c();for(f in r)if(p=r[f],p.name===n.name){if(p.state===So)return Vn(a);p.state===Bs?(p.state=Fn,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[f]):+f<t&&(p.state=Fn,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[f])}if(Vn(function(){n.state===So&&(n.state=Bs,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Eo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Eo){for(n.state=So,i=new Array(h=n.tween.length),f=0,d=-1;f<h;++f)(p=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(i[++d]=p);i.length=d+1}}o(a,"start");function l(u){for(var f=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Co,1),d=-1,h=i.length;++d<h;)i[d].call(e,f);n.state===Co&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}o(l,"tick");function c(){n.state=Fn,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}o(c,"stop")}o(ud,"create");function xt(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>Eo&&r.state<Co,r.state=Fn,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}s&&delete e.__transition}}o(xt,"default");function Qr(e){return this.each(function(){xt(this,e)})}o(Qr,"default");function dd(e,t){var n,r;return function(){var i=Ne(this,e),s=i.tween;if(s!==n){r=n=s;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}o(dd,"tweenRemove");function fd(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=Ne(this,e),a=s.tween;if(a!==r){i=(r=a).slice();for(var l={name:t,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===t){i[c]=l;break}c===u&&i.push(l)}s.tween=i}}o(fd,"tweenFunction");function Jr(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ce(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?dd:fd)(n,e,t))}o(Jr,"default");function Jt(e,t,n){var r=e._id;return e.each(function(){var i=Ne(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Ce(i,r).value[t]}}o(Jt,"tweenValue");function Wn(e,t){var n;return(typeof t=="number"?gs:t instanceof lr?cr:(n=lr(t))?(t=n,cr):ys)(e,t)}o(Wn,"default");function hd(e){return function(){this.removeAttribute(e)}}o(hd,"attrRemove");function pd(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(pd,"attrRemoveNS");function md(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(md,"attrConstant");function gd(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(gd,"attrConstantNS");function yd(e,t,n){var r,i,s;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l)))}}o(yd,"attrFunction");function xd(e,t,n){var r,i,s;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l)))}}o(xd,"attrFunctionNS");function jr(e,t){var n=We(e),r=n==="transform"?ws:Wn;return this.attrTween(e,typeof t=="function"?(n.local?xd:yd)(n,r,Jt(this,"attr."+e,t)):t==null?(n.local?pd:hd)(n):(n.local?gd:md)(n,r,t))}o(jr,"default");function wd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}o(wd,"attrInterpolate");function bd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}o(bd,"attrInterpolateNS");function vd(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&bd(e,s)),n}return o(i,"tween"),i._value=t,i}o(vd,"attrTweenNS");function Sd(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&wd(e,s)),n}return o(i,"tween"),i._value=t,i}o(Sd,"attrTween");function ei(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=We(e);return this.tween(n,(r.local?vd:Sd)(r,t))}o(ei,"default");function Ed(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}o(Ed,"delayFunction");function Cd(e,t){return t=+t,function(){Yn(this,e).delay=t}}o(Cd,"delayConstant");function ti(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ed:Cd)(t,e)):Ce(this.node(),t).delay}o(ti,"default");function _d(e,t){return function(){Ne(this,e).duration=+t.apply(this,arguments)}}o(_d,"durationFunction");function Nd(e,t){return t=+t,function(){Ne(this,e).duration=t}}o(Nd,"durationConstant");function ni(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_d:Nd)(t,e)):Ce(this.node(),t).duration}o(ni,"default");function Id(e,t){if(typeof t!="function")throw new Error;return function(){Ne(this,e).ease=t}}o(Id,"easeConstant");function oi(e){var t=this._id;return arguments.length?this.each(Id(t,e)):Ce(this.node(),t).ease}o(oi,"default");function Md(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ne(this,e).ease=n}}o(Md,"easeVarying");function ri(e){if(typeof e!="function")throw new Error;return this.each(Md(this._id,e))}o(ri,"default");function ii(e){typeof e!="function"&&(e=qt(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,l=r[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new Ae(r,this._parents,this._name,this._id)}o(ii,"default");function si(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),l=0;l<s;++l)for(var c=t[l],u=n[l],f=c.length,d=a[l]=new Array(f),h,p=0;p<f;++p)(h=c[p]||u[p])&&(d[p]=h);for(;l<r;++l)a[l]=t[l];return new Ae(a,this._parents,this._name,this._id)}o(si,"default");function Pd(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(Pd,"start");function Td(e,t,n){var r,i,s=Pd(t)?Yn:Ne;return function(){var a=s(this,e),l=a.on;l!==r&&(i=(r=l).copy()).on(t,n),a.on=i}}o(Td,"onFunction");function ai(e,t){var n=this._id;return arguments.length<2?Ce(this.node(),n).on.on(e):this.each(Td(n,e,t))}o(ai,"default");function kd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}o(kd,"removeFunction");function li(){return this.on("end.remove",kd(this._id))}o(li,"default");function ci(e){var t=this._name,n=this._id;typeof e!="function"&&(e=gt(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a<i;++a)for(var l=r[a],c=l.length,u=s[a]=new Array(c),f,d,h=0;h<c;++h)(f=l[h])&&(d=e.call(f,f.__data__,h,l))&&("__data__"in f&&(d.__data__=f.__data__),u[h]=d,Qe(u[h],t,n,h,u,Ce(f,n)));return new Ae(s,this._parents,t,n)}o(ci,"default");function ui(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Gt(e));for(var r=this._groups,i=r.length,s=[],a=[],l=0;l<i;++l)for(var c=r[l],u=c.length,f,d=0;d<u;++d)if(f=c[d]){for(var h=e.call(f,f.__data__,d,c),p,m=Ce(f,n),v=0,x=h.length;v<x;++v)(p=h[v])&&Qe(p,t,n,v,h,m);s.push(h),a.push(f)}return new Ae(s,a,t,n)}o(ui,"default");var Ad=qe.prototype.constructor;function di(){return new Ad(this._groups,this._parents)}o(di,"default");function Dd(e,t){var n,r,i;return function(){var s=yt(this,e),a=(this.style.removeProperty(e),yt(this,e));return s===a?null:s===n&&a===r?i:i=t(n=s,r=a)}}o(Dd,"styleNull");function Fs(e){return function(){this.style.removeProperty(e)}}o(Fs,"styleRemove");function Od(e,t,n){var r,i=n+"",s;return function(){var a=yt(this,e);return a===i?null:a===r?s:s=t(r=a,n)}}o(Od,"styleConstant");function $d(e,t,n){var r,i,s;return function(){var a=yt(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),yt(this,e))),a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l))}}o($d,"styleFunction");function zd(e,t){var n,r,i,s="style."+t,a="end."+s,l;return function(){var c=Ne(this,e),u=c.on,f=c.value[s]==null?l||(l=Fs(t)):void 0;(u!==n||i!==f)&&(r=(n=u).copy()).on(a,i=f),c.on=r}}o(zd,"styleMaybeRemove");function fi(e,t,n){var r=(e+="")=="transform"?xs:Wn;return t==null?this.styleTween(e,Dd(e,r)).on("end.style."+e,Fs(e)):typeof t=="function"?this.styleTween(e,$d(e,r,Jt(this,"style."+e,t))).each(zd(this._id,e)):this.styleTween(e,Od(e,r,t),n).on("end.style."+e,null)}o(fi,"default");function Rd(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}o(Rd,"styleInterpolate");function Ld(e,t,n){var r,i;function s(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Rd(e,a,n)),r}return o(s,"tween"),s._value=t,s}o(Ld,"styleTween");function hi(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,Ld(e,t,n??""))}o(hi,"default");function Hd(e){return function(){this.textContent=e}}o(Hd,"textConstant");function Bd(e){return function(){var t=e(this);this.textContent=t??""}}o(Bd,"textFunction");function pi(e){return this.tween("text",typeof e=="function"?Bd(Jt(this,"text",e)):Hd(e==null?"":e+""))}o(pi,"default");function Vd(e){return function(t){this.textContent=e.call(this,t)}}o(Vd,"textInterpolate");function Fd(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Vd(i)),t}return o(r,"tween"),r._value=e,r}o(Fd,"textTween");function mi(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,Fd(e))}o(mi,"default");function gi(){for(var e=this._name,t=this._id,n=_o(),r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var f=Ce(c,t);Qe(c,e,n,u,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Ae(r,this._parents,e,n)}o(gi,"default");function yi(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,a){var l={value:a},c={value:o(function(){--i===0&&s()},"value")};n.each(function(){var u=Ne(this,r),f=u.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),i===0&&s()})}o(yi,"default");var Yd=0;function Ae(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}o(Ae,"Transition");function Ys(e){return qe().transition(e)}o(Ys,"transition");function _o(){return++Yd}o(_o,"newId");var Je=qe.prototype;Ae.prototype=Ys.prototype={constructor:Ae,select:ci,selectAll:ui,selectChild:Je.selectChild,selectChildren:Je.selectChildren,filter:ii,merge:si,selection:di,transition:gi,call:Je.call,nodes:Je.nodes,node:Je.node,size:Je.size,empty:Je.empty,each:Je.each,on:ai,attr:jr,attrTween:ei,style:fi,styleTween:hi,text:pi,textTween:mi,remove:li,tween:Jr,delay:ti,duration:ni,ease:oi,easeVarying:ri,end:yi,[Symbol.iterator]:Je[Symbol.iterator]};function No(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}o(No,"cubicInOut");var Wd={time:null,delay:0,duration:250,ease:No};function Xd(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(Xd,"inherit");function xi(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=_o(),(n=Wd).time=Bn(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&Qe(c,e,t,u,a,n||Xd(c,t));return new Ae(r,this._parents,e,t)}o(xi,"default");qe.prototype.interrupt=Qr;qe.prototype.transition=xi;var Xn=o(e=>()=>e,"default");function wi(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(wi,"ZoomEvent");function Ve(e,t,n){this.k=e,this.x=t,this.y=n}o(Ve,"Transform");Ve.prototype={constructor:Ve,scale:o(function(e){return e===1?this:new Ve(this.k*e,this.x,this.y)},"scale"),translate:o(function(e,t){return e===0&t===0?this:new Ve(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 At=new Ve(1,0,0);Zn.prototype=Ve.prototype;function Zn(e){for(;!e.__zoom;)if(!(e=e.parentNode))return At;return e.__zoom}o(Zn,"transform");function Io(e){e.stopImmediatePropagation()}o(Io,"nopropagation");function Dt(e){e.preventDefault(),e.stopImmediatePropagation()}o(Dt,"default");function Zd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}o(Zd,"defaultFilter");function Ud(){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(Ud,"defaultExtent");function Ws(){return this.__zoom||At}o(Ws,"defaultTransform");function Gd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}o(Gd,"defaultWheelDelta");function qd(){return navigator.maxTouchPoints||"ontouchstart"in this}o(qd,"defaultTouchable");function Kd(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(Kd,"defaultConstrain");function Un(){var e=Zd,t=Ud,n=Kd,r=Gd,i=qd,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Ut,u=Pt("start","zoom","end"),f,d,h,p=500,m=150,v=0,x=10;function y(b){b.property("__zoom",Ws).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",Y).filter(i).on("touchstart.zoom",P).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(y,"zoom"),y.transform=function(b,E,C,M){var z=b.selection?b.selection():b;z.property("__zoom",Ws),b!==z?I(b,E,C,M):z.interrupt().each(function(){_(this,arguments).event(M).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},y.scaleBy=function(b,E,C,M){y.scaleTo(b,function(){var z=this.__zoom.k,D=typeof E=="function"?E.apply(this,arguments):E;return z*D},C,M)},y.scaleTo=function(b,E,C,M){y.transform(b,function(){var z=t.apply(this,arguments),D=this.__zoom,H=C==null?w(z):typeof C=="function"?C.apply(this,arguments):C,F=D.invert(H),B=typeof E=="function"?E.apply(this,arguments):E;return n(g(S(D,B),H,F),z,a)},C,M)},y.translateBy=function(b,E,C,M){y.transform(b,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),a)},null,M)},y.translateTo=function(b,E,C,M,z){y.transform(b,function(){var D=t.apply(this,arguments),H=this.__zoom,F=M==null?w(D):typeof M=="function"?M.apply(this,arguments):M;return n(At.translate(F[0],F[1]).scale(H.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof C=="function"?-C.apply(this,arguments):-C),D,a)},M,z)};function S(b,E){return E=Math.max(s[0],Math.min(s[1],E)),E===b.k?b:new Ve(E,b.x,b.y)}o(S,"scale");function g(b,E,C){var M=E[0]-C[0]*b.k,z=E[1]-C[1]*b.k;return M===b.x&&z===b.y?b:new Ve(b.k,M,z)}o(g,"translate");function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}o(w,"centroid");function I(b,E,C,M){b.on("start.zoom",function(){_(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(M).end()}).tween("zoom",function(){var z=this,D=arguments,H=_(z,D).event(M),F=t.apply(z,D),B=C==null?w(F):typeof C=="function"?C.apply(z,D):C,U=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),X=z.__zoom,W=typeof E=="function"?E.apply(z,D):E,j=c(X.invert(B).concat(U/X.k),W.invert(B).concat(U/W.k));return function(K){if(K===1)K=W;else{var L=j(K),Z=U/L[2];K=new Ve(Z,B[0]-L[0]*Z,B[1]-L[1]*Z)}H.zoom(null,K)}})}o(I,"schedule");function _(b,E,C){return!C&&b.__zooming||new T(b,E)}o(_,"gesture");function T(b,E){this.that=b,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,E),this.taps=0}o(T,"Gesture"),T.prototype={event:o(function(b){return b&&(this.sourceEvent=b),this},"event"),start:o(function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},"start"),zoom:o(function(b,E){return this.mouse&&b!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},"zoom"),end:o(function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},"end"),emit:o(function(b){var E=Ee(this.that).datum();u.call(b,this.that,new wi(b,{sourceEvent:this.sourceEvent,target:y,type:b,transform:this.that.__zoom,dispatch:u}),E)},"emit")};function k(b,...E){if(!e.apply(this,arguments))return;var C=_(this,E).event(b),M=this.__zoom,z=Math.max(s[0],Math.min(s[1],M.k*Math.pow(2,r.apply(this,arguments)))),D=Me(b);if(C.wheel)(C.mouse[0][0]!==D[0]||C.mouse[0][1]!==D[1])&&(C.mouse[1]=M.invert(C.mouse[0]=D)),clearTimeout(C.wheel);else{if(M.k===z)return;C.mouse=[D,M.invert(D)],xt(this),C.start()}Dt(b),C.wheel=setTimeout(H,m),C.zoom("mouse",n(g(S(M,z),C.mouse[0],C.mouse[1]),C.extent,a));function H(){C.wheel=null,C.end()}o(H,"wheelidled")}o(k,"wheeled");function A(b,...E){if(h||!e.apply(this,arguments))return;var C=b.currentTarget,M=_(this,E,!0).event(b),z=Ee(b.view).on("mousemove.zoom",B,!0).on("mouseup.zoom",U,!0),D=Me(b,C),H=b.clientX,F=b.clientY;Kt(b.view),Io(b),M.mouse=[D,this.__zoom.invert(D)],xt(this),M.start();function B(X){if(Dt(X),!M.moved){var W=X.clientX-H,j=X.clientY-F;M.moved=W*W+j*j>v}M.event(X).zoom("mouse",n(g(M.that.__zoom,M.mouse[0]=Me(X,C),M.mouse[1]),M.extent,a))}o(B,"mousemoved");function U(X){z.on("mousemove.zoom mouseup.zoom",null),kn(X.view,M.moved),Dt(X),M.event(X).end()}o(U,"mouseupped")}o(A,"mousedowned");function Y(b,...E){if(e.apply(this,arguments)){var C=this.__zoom,M=Me(b.changedTouches?b.changedTouches[0]:b,this),z=C.invert(M),D=C.k*(b.shiftKey?.5:2),H=n(g(S(C,D),M,z),t.apply(this,E),a);Dt(b),l>0?Ee(this).transition().duration(l).call(I,H,M,b):Ee(this).call(y.transform,H,M,b)}}o(Y,"dblclicked");function P(b,...E){if(e.apply(this,arguments)){var C=b.touches,M=C.length,z=_(this,E,b.changedTouches.length===M).event(b),D,H,F,B;for(Io(b),H=0;H<M;++H)F=C[H],B=Me(F,this),B=[B,this.__zoom.invert(B),F.identifier],z.touch0?!z.touch1&&z.touch0[2]!==B[2]&&(z.touch1=B,z.taps=0):(z.touch0=B,D=!0,z.taps=1+!!f);f&&(f=clearTimeout(f)),D&&(z.taps<2&&(d=B[0],f=setTimeout(function(){f=null},p)),xt(this),z.start())}}o(P,"touchstarted");function R(b,...E){if(this.__zooming){var C=_(this,E).event(b),M=b.changedTouches,z=M.length,D,H,F,B;for(Dt(b),D=0;D<z;++D)H=M[D],F=Me(H,this),C.touch0&&C.touch0[2]===H.identifier?C.touch0[0]=F:C.touch1&&C.touch1[2]===H.identifier&&(C.touch1[0]=F);if(H=C.that.__zoom,C.touch1){var U=C.touch0[0],X=C.touch0[1],W=C.touch1[0],j=C.touch1[1],K=(K=W[0]-U[0])*K+(K=W[1]-U[1])*K,L=(L=j[0]-X[0])*L+(L=j[1]-X[1])*L;H=S(H,Math.sqrt(K/L)),F=[(U[0]+W[0])/2,(U[1]+W[1])/2],B=[(X[0]+j[0])/2,(X[1]+j[1])/2]}else if(C.touch0)F=C.touch0[0],B=C.touch0[1];else return;C.zoom("touch",n(g(H,F,B),C.extent,a))}}o(R,"touchmoved");function V(b,...E){if(this.__zooming){var C=_(this,E).event(b),M=b.changedTouches,z=M.length,D,H;for(Io(b),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),D=0;D<z;++D)H=M[D],C.touch0&&C.touch0[2]===H.identifier?delete C.touch0:C.touch1&&C.touch1[2]===H.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(H=Me(H,this),Math.hypot(d[0]-H[0],d[1]-H[1])<x)){var F=Ee(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return o(V,"touchended"),y.wheelDelta=function(b){return arguments.length?(r=typeof b=="function"?b:Xn(+b),y):r},y.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Xn(!!b),y):e},y.touchable=function(b){return arguments.length?(i=typeof b=="function"?b:Xn(!!b),y):i},y.extent=function(b){return arguments.length?(t=typeof b=="function"?b:Xn([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),y):t},y.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],y):[s[0],s[1]]},y.translateExtent=function(b){return arguments.length?(a[0][0]=+b[0][0],a[1][0]=+b[1][0],a[0][1]=+b[0][1],a[1][1]=+b[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(b){return arguments.length?(n=b,y):n},y.duration=function(b){return arguments.length?(l=+b,y):l},y.interpolate=function(b){return arguments.length?(c=b,y):c},y.on=function(){var b=u.on.apply(u,arguments);return b===u?y:b},y.clickDistance=function(b){return arguments.length?(v=(b=+b)*b,y):Math.sqrt(v)},y.tapDistance=function(b){return arguments.length?(x=+b,y):x},y}o(Un,"default");var De={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")},on=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ci=["Enter"," ","Escape"],_i={"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"},vt;(function(e){e.Strict="strict",e.Loose="loose"})(vt||(vt={}));var je;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(je||(je={}));var Ot;(function(e){e.Partial="partial",e.Full="full"})(Ot||(Ot={}));var Ni={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Xe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Xe||(Xe={}));var tn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(tn||(tn={}));var J;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(J||(J={}));var Xs={[J.Left]:J.Right,[J.Right]:J.Left,[J.Top]:J.Bottom,[J.Bottom]:J.Top};function Ii(e){return e===null?null:e?"valid":"invalid"}o(Ii,"getConnectionStatus");var Mi=o(e=>"id"in e&&"source"in e&&"target"in e,"isEdgeBase"),ra=o(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),"isNodeBase"),Pi=o(e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),"isInternalNodeBase");var qn=o((e,t=[0,0])=>{let{width:n,height:r}=Ze(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"),Kn=o((e,t={nodeOrigin:[0,0]})=>{if(t.nodeLookup||console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};let n=e.reduce((r,i)=>{let s=typeof i=="string",a=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(i):Pi(i)?i:t.nodeLookup.get(i.id));let l=a?To(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Do(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Oo(n)},"getNodesBounds"),rn=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=Do(n,To(i)),r=!0)}),r?Oo(n):{x:0,y:0,width:0,height:0}},"getInternalNodesBounds"),ko=o((e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{let l=(t.x-n)/i,c=(t.y-r)/i,u=t.width/i,f=t.height/i,d=[];for(let h of e.values()){let{measured:p,selectable:m=!0,hidden:v=!1}=h;if(a&&!m||v)continue;let x=p.width??h.width??h.initialWidth??0,y=p.height??h.height??h.initialHeight??0,{x:S,y:g}=h.internals.positionAbsolute,w=ca(l,c,u,f,S,g,x,y),I=x*y,_=s&&w>0;(!h.internals.handleBounds||_||w>=I||h.dragging)&&d.push(h)}return d},"getNodesInside"),ia=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 Qd(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&(t?.includeHiddenNodes||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}o(Qd,"getFitViewNodes");async function sa({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;let l=Qd(e,a),c=rn(l),u=Lt(c,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(sa,"fitViewport");function Ti({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){let a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},f=a.origin??r,d=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)s?.("005",De.error005());else{let p=l.measured.width,m=l.measured.height;p&&m&&(d=[[c,u],[c+p,u+m]])}else l&&Rt(a.extent)&&(d=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);let h=Rt(d)?$t(t,d,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&s?.("015",De.error015()),{position:{x:h.x-c+(a.measured.width??0)*f[0],y:h.y-u+(a.measured.height??0)*f[1]},positionAbsolute:h}}o(Ti,"calculateNodePosition");async function aa({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let s=new Set(e.map(h=>h.id)),a=[];for(let h of n){if(h.deletable===!1)continue;let p=s.has(h.id),m=!p&&h.parentId&&a.find(v=>v.id===h.parentId);(p||m)&&a.push(h)}let l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),f=ia(a,c);for(let h of c)l.has(h.id)&&!f.find(m=>m.id===h.id)&&f.push(h);if(!i)return{edges:f,nodes:a};let d=await i({nodes:a,edges:f});return typeof d=="boolean"?d?{edges:f,nodes:a}:{edges:[],nodes:[]}:d}o(aa,"getElementsToRemove");var nn=o((e,t=0,n=1)=>Math.min(Math.max(e,t),n),"clamp"),$t=o((e={x:0,y:0},t,n)=>({x:nn(e.x,t[0][0],t[1][0]-(n?.width??0)),y:nn(e.y,t[0][1],t[1][1]-(n?.height??0))}),"clampPosition");function la(e,t,n){let{width:r,height:i}=Ze(n),{x:s,y:a}=n.internals.positionAbsolute;return $t(e,[[s,a],[s+r,a+i]],t)}o(la,"clampPositionToParent");var Zs=o((e,t,n)=>e<t?nn(Math.abs(e-t),1,t)/t:e>n?-nn(Math.abs(e-n),1,t)/t:0,"calcAutoPanVelocity"),Ao=o((e,t,n=15,r=40)=>{let i=Zs(e.x,r,t.width-r)*n,s=Zs(e.y,r,t.height-r)*n;return[i,s]},"calcAutoPan"),Do=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"),Ei=o(({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),"rectToBox"),Oo=o(({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),"boxToRect"),sn=o((e,t=[0,0])=>{let{x:n,y:r}=Pi(e)?e.internals.positionAbsolute:qn(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"),To=o((e,t=[0,0])=>{let{x:n,y:r}=Pi(e)?e.internals.positionAbsolute:qn(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"),ki=o((e,t)=>Oo(Do(Ei(e),Ei(t))),"getBoundsOfRects"),ca=o((e,t,n,r,i,s,a,l)=>{let c=Math.max(0,Math.min(e+n,i+a)-Math.max(e,i)),u=Math.max(0,Math.min(t+r,s+l)-Math.max(t,s));return Math.ceil(c*u)},"getRectsOverlappingArea"),Qn=o((e,t)=>ca(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),"getOverlappingArea"),Ai=o(e=>Le(e.width)&&Le(e.height)&&Le(e.x)&&Le(e.y),"isRectObject"),Le=o(e=>!isNaN(e)&&isFinite(e),"isNumeric"),Di=o((e,t)=>(n,r)=>{console.warn(`[${e}]: ${r} Help: ${t}error#${n}`)},"createDevWarn"),an=o((e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),"snapPosition"),ln=o(({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{let l={x:(e-n)/i,y:(t-r)/i};return s?an(l,a):l},"pointToRendererPoint"),zt=o(({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),"rendererPointToPoint");function jt(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(jt,"parsePadding");function Jd(e,t,n){if(typeof e=="string"||typeof e=="number"){let r=jt(e,n),i=jt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){let r=jt(e.top??e.y??0,n),i=jt(e.bottom??e.y??0,n),s=jt(e.left??e.x??0,t),a=jt(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(Jd,"parsePaddings");function jd(e,t,n,r,i,s){let{x:a,y:l}=zt(e,[t,n,r]),{x:c,y:u}=zt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=i-c,d=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(d)}}o(jd,"calculateAppliedPaddings");var Lt=o((e,t,n,r,i,s)=>{let a=Jd(s,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),f=nn(u,r,i),d=e.x+e.width/2,h=e.y+e.height/2,p=t/2-d*f,m=n/2-h*f,v=jd(e,p,m,f,t,n),x={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:p-x.left+x.right,y:m-x.top+x.bottom,zoom:f}},"getViewportForBounds"),cn=o(()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,"isMacOs");function Rt(e){return e!=null&&e!=="parent"}o(Rt,"isCoordinateExtent");function Ze(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}o(Ze,"getNodeDimensions");function Oi(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}o(Oi,"nodeHasDimensions");function $i(e,t={width:0,height:0},n,r,i){let s={...e},a=r.get(n);if(a){let l=a.origin||i;s.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}o($i,"evaluateAbsolutePosition");function zi(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}o(zi,"areSetsEqual");function ua(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}o(ua,"withResolvers");function da(e){return{..._i,...e||{}}}o(da,"mergeAriaLabelConfig");function Gn(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:s,y:a}=He(e),l=ln({x:s-(i?.left??0),y:a-(i?.top??0)},r),{x:c,y:u}=n?an(l,t):l;return{xSnapped:c,ySnapped:u,...l}}o(Gn,"getPointerPosition");var $o=o(e=>({width:e.offsetWidth,height:e.offsetHeight}),"getDimensions"),Ri=o(e=>e?.getRootNode?.()||window?.document,"getHostForElement"),ef=["INPUT","SELECT","TEXTAREA"];function Li(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:ef.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}o(Li,"isInputDOMNode");var Hi=o(e=>"clientX"in e,"isMouseEvent"),He=o((e,t)=>{let n=Hi(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"),Us=o((e,t,n,r,i)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{let l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...$o(a)}})},"getHandleBounds");function zo({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){let c=e*.125+i*.375+a*.375+n*.125,u=t*.125+s*.375+l*.375+r*.125,f=Math.abs(c-e),d=Math.abs(u-t);return[c,u,f,d]}o(zo,"getBezierEdgeCenter");function Mo(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}o(Mo,"calculateControlOffset");function Gs({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case J.Left:return[t-Mo(t-r,s),n];case J.Right:return[t+Mo(r-t,s),n];case J.Top:return[t,n-Mo(n-i,s)];case J.Bottom:return[t,n+Mo(i-n,s)]}}o(Gs,"getControlWithCurvature");function Ro({sourceX:e,sourceY:t,sourcePosition:n=J.Bottom,targetX:r,targetY:i,targetPosition:s=J.Top,curvature:a=.25}){let[l,c]=Gs({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,f]=Gs({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[d,h,p,m]=zo({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:f});return[`M${e},${t} C${l},${c} ${u},${f} ${r},${i}`,d,h,p,m]}o(Ro,"getBezierPath");function Bi({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,l=r<t?r+a:r-a;return[s,l,i,a]}o(Bi,"getEdgeCenter");function fa({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,l=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return a+l}o(fa,"getElevatedEdgeZIndex");function ha({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let s=Do(To(e),To(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 Qn(a,Oo(s))>0}o(ha,"isEdgeVisible");var tf=o(({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,"getEdgeId"),nf=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"),pa=o((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",De.error006()),t;let r=n.getEdgeId||tf,i;return Mi(e)?i={...e}:i={...e,id:r(e)},nf(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))},"addEdge");function Lo({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,s,a,l]=Bi({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,l]}o(Lo,"getStraightPath");var qs={[J.Left]:{x:-1,y:0},[J.Right]:{x:1,y:0},[J.Top]:{x:0,y:-1},[J.Bottom]:{x:0,y:1}},of=o(({source:e,sourcePosition:t=J.Bottom,target:n})=>t===J.Left||t===J.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"),Ks=o((e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),"distance");function rf({source:e,sourcePosition:t=J.Bottom,target:n,targetPosition:r=J.Top,center:i,offset:s,stepPosition:a}){let l=qs[t],c=qs[r],u={x:e.x+l.x*s,y:e.y+l.y*s},f={x:n.x+c.x*s,y:n.y+c.y*s},d=of({source:u,sourcePosition:t,target:f}),h=d.x!==0?"x":"y",p=d[h],m=[],v,x,y={x:0,y:0},S={x:0,y:0},[,,g,w]=Bi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(v=i.x??u.x+(f.x-u.x)*a,x=i.y??(u.y+f.y)/2):(v=i.x??(u.x+f.x)/2,x=i.y??u.y+(f.y-u.y)*a);let k=[{x:v,y:u.y},{x:v,y:f.y}],A=[{x:u.x,y:x},{x:f.x,y:x}];l[h]===p?m=h==="x"?k:A:m=h==="x"?A:k}else{let k=[{x:u.x,y:f.y}],A=[{x:f.x,y:u.y}];if(h==="x"?m=l.x===p?A:k:m=l.y===p?k:A,t===r){let b=Math.abs(e[h]-n[h]);if(b<=s){let E=Math.min(s-1,s-b);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*E:S[h]=(f[h]>n[h]?-1:1)*E}}if(t!==r){let b=h==="x"?"y":"x",E=l[h]===c[b],C=u[b]>f[b],M=u[b]<f[b];(l[h]===1&&(!E&&C||E&&M)||l[h]!==1&&(!E&&M||E&&C))&&(m=h==="x"?k:A)}let Y={x:u.x+y.x,y:u.y+y.y},P={x:f.x+S.x,y:f.y+S.y},R=Math.max(Math.abs(Y.x-m[0].x),Math.abs(P.x-m[0].x)),V=Math.max(Math.abs(Y.y-m[0].y),Math.abs(P.y-m[0].y));R>=V?(v=(Y.x+P.x)/2,x=m[0].y):(v=m[0].x,x=(Y.y+P.y)/2)}let I={x:u.x+y.x,y:u.y+y.y},_={x:f.x+S.x,y:f.y+S.y};return[[e,...I.x!==m[0].x||I.y!==m[0].y?[I]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],v,x,g,w]}o(rf,"getPoints");function sf(e,t,n,r){let i=Math.min(Ks(e,t)/2,Ks(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,f=e.y<n.y?1:-1;return`L ${s+i*u},${a}Q ${s},${a} ${s},${a+i*f}`}let l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${a+i*c}Q ${s},${a} ${s+i*l},${a}`}o(sf,"getBend");function Jn({sourceX:e,sourceY:t,sourcePosition:n=J.Bottom,targetX:r,targetY:i,targetPosition:s=J.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:f=.5}){let[d,h,p,m,v]=rf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:f}),x=`M${d[0].x} ${d[0].y}`;for(let y=1;y<d.length-1;y++)x+=sf(d[y-1],d[y],d[y+1],a);return x+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[x,h,p,m,v]}o(Jn,"getSmoothStepPath");function Qs(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}o(Qs,"isNodeInitialized");function ma(e){let{sourceNode:t,targetNode:n}=e;if(!Qs(t)||!Qs(n))return null;let r=t.internals.handleBounds||Js(t.handles),i=n.internals.handleBounds||Js(n.handles),s=js(r?.source??[],e.sourceHandle),a=js(e.connectionMode===vt.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!s||!a)return e.onError?.("008",De.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let l=s?.position||J.Bottom,c=a?.position||J.Top,u=St(t,s,l),f=St(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}o(ma,"getEdgePosition");function Js(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(Js,"toHandleBounds");function St(e,t,n=J.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??Ze(e);if(r)return{x:i+a/2,y:s+l/2};switch(t?.position??n){case J.Top:return{x:i+a/2,y:s};case J.Right:return{x:i+a,y:s+l/2};case J.Bottom:return{x:i+a/2,y:s+l};case J.Left:return{x:i,y:s+l/2}}}o(St,"getHandlePosition");function js(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}o(js,"getHandle$1");function Ho(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}o(Ho,"getMarkerId");function ga(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let s=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){let u=Ho(c,t);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}o(ga,"createMarkerIds");var ya=1e3,af=10,Vi={nodeOrigin:[0,0],nodeExtent:on,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},lf={...Vi,checkEquality:!0};function Fi(e,t){let n={...e};for(let r in t)t[r]!==void 0&&(n[r]=t[r]);return n}o(Fi,"mergeObjects");function xa(e,t,n){let r=Fi(Vi,n);for(let i of e.values())if(i.parentId)Wi(i,e,t,r);else{let s=qn(i,r.nodeOrigin),a=Rt(i.extent)?i.extent:r.nodeExtent,l=$t(s,a,Ze(i));i.internals.positionAbsolute=l}}o(xa,"updateAbsolutePositions");function cf(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(cf,"parseHandles");function Yi(e){return e==="manual"}o(Yi,"isManualZIndexMode");function Bo(e,t,n,r={}){let i=Fi(lf,r),s={i:0},a=new Map(t),l=i?.elevateNodesOnSelect&&!Yi(i.zIndexMode)?ya:0,c=e.length>0,u=!1;t.clear(),n.clear();for(let f of e){let d=a.get(f.id);if(i.checkEquality&&f===d?.internals.userNode)t.set(f.id,d);else{let h=qn(f,i.nodeOrigin),p=Rt(f.extent)?f.extent:i.nodeExtent,m=$t(h,p,Ze(f));d={...i.defaults,...f,measured:{width:f.measured?.width,height:f.measured?.height},internals:{positionAbsolute:m,handleBounds:cf(f,d),z:wa(f,l,i.zIndexMode),userNode:f}},t.set(f.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(c=!1),f.parentId&&Wi(d,t,n,r,s),u||=f.selected??!1}return{nodesInitialized:c,hasSelectedNodes:u}}o(Bo,"adoptUserNodes");function uf(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(uf,"updateParentLookup");function Wi(e,t,n,r,i){let{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Fi(Vi,r),u=e.parentId,f=t.get(u);if(!f){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}uf(e,n),i&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++i.i,f.internals.z=f.internals.z+i.i*af),i&&f.internals.rootParentIndex!==void 0&&(i.i=f.internals.rootParentIndex);let d=s&&!Yi(c)?ya:0,{x:h,y:p,z:m}=df(e,f,a,l,d,c),{positionAbsolute:v}=e.internals,x=h!==v.x||p!==v.y;(x||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:h,y:p}:v,z:m}})}o(Wi,"updateChildNode");function wa(e,t,n){let r=Le(e.zIndex)?e.zIndex:0;return Yi(n)?r:r+(e.selected?t:0)}o(wa,"calculateZ");function df(e,t,n,r,i,s){let{x:a,y:l}=t.internals.positionAbsolute,c=Ze(e),u=qn(e,n),f=Rt(e.extent)?$t(u,e.extent,c):u,d=$t({x:a+f.x,y:l+f.y},r,c);e.extent==="parent"&&(d=la(d,c,t));let h=wa(e,i,s),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=h?p+1:h}}o(df,"calculateChildXYZ");function Vo(e,t,n,r=[0,0]){let i=[],s=new Map;for(let a of e){let l=t.get(a.parentId);if(!l)continue;let c=s.get(a.parentId)?.expandedRect??sn(l),u=ki(c,a.rect);s.set(a.parentId,{expandedRect:u,parent:l})}return s.size>0&&s.forEach(({expandedRect:a,parent:l},c)=>{let u=l.internals.positionAbsolute,f=Ze(l),d=l.origin??r,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,p=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,m=Math.max(f.width,Math.round(a.width)),v=Math.max(f.height,Math.round(a.height)),x=(m-f.width)*d[0],y=(v-f.height)*d[1];(h>0||p>0||x||y)&&(i.push({id:c,type:"position",position:{x:l.position.x-h+x,y:l.position.y-p+y}}),n.get(c)?.forEach(S=>{e.some(g=>g.id===S.id)||i.push({id:S.id,type:"position",position:{x:S.position.x+h,y:S.position.y+p}})})),(f.width<a.width||f.height<a.height||h||p)&&i.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:m+(h?d[0]*h-x:0),height:v+(p?d[1]*p-y:0)}})}),i}o(Vo,"handleExpandParent");function ba(e,t,n,r,i,s,a){let l=r?.querySelector(".xyflow__viewport"),c=!1;if(!l)return{changes:[],updatedInternals:c};let u=[],f=window.getComputedStyle(l),{m22:d}=new window.DOMMatrixReadOnly(f.transform),h=[];for(let p of e.values()){let m=t.get(p.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),c=!0;continue}let v=$o(p.nodeElement),x=m.measured.width!==v.width||m.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!m.internals.handleBounds||p.force))){let S=p.nodeElement.getBoundingClientRect(),g=Rt(m.extent)?m.extent:s,{positionAbsolute:w}=m.internals;m.parentId&&m.extent==="parent"?w=la(w,v,t.get(m.parentId)):g&&(w=$t(w,g,v));let I={...m,measured:v,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:Us("source",p.nodeElement,S,d,m.id),target:Us("target",p.nodeElement,S,d,m.id)}}};t.set(m.id,I),m.parentId&&Wi(I,t,n,{nodeOrigin:i,zIndexMode:a}),c=!0,x&&(u.push({id:m.id,type:"dimensions",dimensions:v}),m.expandParent&&m.parentId&&h.push({id:m.id,parentId:m.parentId,rect:sn(I,i)}))}}if(h.length>0){let p=Vo(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}o(ba,"updateNodeInternals");async function va({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(va,"panBy");function ea(e,t,n,r,i,s){let a=i,l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${i}-${e}`;let c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),s){a=`${i}-${e}-${s}`;let u=r.get(a)||new Map;r.set(a,u.set(n,t))}}o(ea,"addConnectionToLookup");function Xi(e,t,n){e.clear(),t.clear();for(let r of n){let{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${s}-${l}`,f=`${s}-${l}--${i}-${a}`;ea("source",c,f,e,i,a),ea("target",c,u,e,s,l),t.set(r.id,r)}}o(Xi,"updateConnectionLookup");function Sa(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Sa(n,t):!1}o(Sa,"isParentSelected");function ta(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(ta,"hasSelector");function ff(e,t,n,r){let i=new Map;for(let[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!Sa(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){let l=e.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}o(ff,"getDragItems");function bi({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[a,l]of t){let c=n.get(a)?.internals.userNode;c&&i.push({...c,position:l.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(bi,"getEventHandlerParams");function hf({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=an(s,t);return{x:a.x-s.x,y:a.y-s.y}}o(hf,"calculateSnapOffset");function Ea({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},f=null,d=!1,h=null,p=!1,m=!1,v=null;function x({noDragClassName:S,handleSelector:g,domNode:w,isSelectable:I,nodeId:_,nodeClickDistance:T=0}){h=Ee(w);function k({x:R,y:V}){let{nodeLookup:b,nodeExtent:E,snapGrid:C,snapToGrid:M,nodeOrigin:z,onNodeDrag:D,onSelectionDrag:H,onError:F,updateNodePositions:B}=t();s={x:R,y:V};let U=!1,X=l.size>1,W=X&&E?Ei(rn(l)):null,j=X&&M?hf({dragItems:l,snapGrid:C,x:R,y:V}):null;for(let[K,L]of l){if(!b.has(K))continue;let Z={x:R-L.distance.x,y:V-L.distance.y};M&&(Z=j?{x:Math.round(Z.x+j.x),y:Math.round(Z.y+j.y)}:an(Z,C));let te=null;if(X&&E&&!L.extent&&W){let{positionAbsolute:q}=L.internals,ne=q.x-W.x+E[0][0],oe=q.x+L.measured.width-W.x2+E[1][0],se=q.y-W.y+E[0][1],ue=q.y+L.measured.height-W.y2+E[1][1];te=[[ne,se],[oe,ue]]}let{position:ee,positionAbsolute:G}=Ti({nodeId:K,nextPosition:Z,nodeLookup:b,nodeExtent:te||E,nodeOrigin:z,onError:F});U=U||L.position.x!==ee.x||L.position.y!==ee.y,L.position=ee,L.internals.positionAbsolute=G}if(m=m||U,!!U&&(B(l,!0),v&&(r||D||!_&&H))){let[K,L]=bi({nodeId:_,dragItems:l,nodeLookup:b});r?.(v,l,K,L),D?.(v,K,L),_||H?.(v,L)}}o(k,"updateNodes");async function A(){if(!f)return;let{transform:R,panBy:V,autoPanSpeed:b,autoPanOnNodeDrag:E}=t();if(!E){c=!1,cancelAnimationFrame(a);return}let[C,M]=Ao(u,f,b);(C!==0||M!==0)&&(s.x=(s.x??0)-C/R[2],s.y=(s.y??0)-M/R[2],await V({x:C,y:M})&&k(s)),a=requestAnimationFrame(A)}o(A,"autoPan");function Y(R){let{nodeLookup:V,multiSelectionActive:b,nodesDraggable:E,transform:C,snapGrid:M,snapToGrid:z,selectNodesOnDrag:D,onNodeDragStart:H,onSelectionDragStart:F,unselectNodesAndEdges:B}=t();d=!0,(!D||!I)&&!b&&_&&(V.get(_)?.selected||B()),I&&D&&_&&e?.(_);let U=Gn(R.sourceEvent,{transform:C,snapGrid:M,snapToGrid:z,containerBounds:f});if(s=U,l=ff(V,E,U,_),l.size>0&&(n||H||!_&&F)){let[X,W]=bi({nodeId:_,dragItems:l,nodeLookup:V});n?.(R.sourceEvent,l,X,W),H?.(R.sourceEvent,X,W),_||F?.(R.sourceEvent,W)}}o(Y,"startDrag");let P=On().clickDistance(T).on("start",R=>{let{domNode:V,nodeDragThreshold:b,transform:E,snapGrid:C,snapToGrid:M}=t();f=V?.getBoundingClientRect()||null,p=!1,m=!1,v=R.sourceEvent,b===0&&Y(R),s=Gn(R.sourceEvent,{transform:E,snapGrid:C,snapToGrid:M,containerBounds:f}),u=He(R.sourceEvent,f)}).on("drag",R=>{let{autoPanOnNodeDrag:V,transform:b,snapGrid:E,snapToGrid:C,nodeDragThreshold:M,nodeLookup:z}=t(),D=Gn(R.sourceEvent,{transform:b,snapGrid:E,snapToGrid:C,containerBounds:f});if(v=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||_&&!z.has(_))&&(p=!0),!p){if(!c&&V&&d&&(c=!0,A()),!d){let H=He(R.sourceEvent,f),F=H.x-u.x,B=H.y-u.y;Math.sqrt(F*F+B*B)>M&&Y(R)}(s.x!==D.xSnapped||s.y!==D.ySnapped)&&l&&d&&(u=He(R.sourceEvent,f),k(D))}}).on("end",R=>{if(!d||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,d=!1,cancelAnimationFrame(a),l.size>0){let{nodeLookup:V,updateNodePositions:b,onNodeDragStop:E,onSelectionDragStop:C}=t();if(m&&(b(l,!1),m=!1),i||E||!_&&C){let[M,z]=bi({nodeId:_,dragItems:l,nodeLookup:V,dragging:!1});i?.(R.sourceEvent,l,M,z),E?.(R.sourceEvent,M,z),_||C?.(R.sourceEvent,z)}}}).filter(R=>{let V=R.target;return!R.button&&(!S||!ta(V,`.${S}`,w))&&(!g||ta(V,g,w))});h.call(P)}o(x,"update");function y(){h?.on(".drag",null)}return o(y,"destroy"),{update:x,destroy:y}}o(Ea,"XYDrag");function pf(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())Qn(i,sn(s))>0&&r.push(s);return r}o(pf,"getNodesWithinDistance");var mf=250;function gf(e,t,n,r){let i=[],s=1/0,a=pf(e,n,t+mf);for(let l of a){let c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(let u of c){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;let{x:f,y:d}=St(l,u,u.position,!0),h=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(d-e.y,2));h>t||(h<s?(i=[{...u,x:f,y:d}],s=h):h===s&&i.push({...u,x:f,y:d}))}}if(!i.length)return null;if(i.length>1){let l=r.type==="source"?"target":"source";return i.find(c=>c.type===l)??i[0]}return i[0]}o(gf,"getClosestHandle");function Ca(e,t,n,r,i,s=!1){let a=r.get(e);if(!a)return null;let l=i==="strict"?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],c=(n?l?.find(u=>u.id===n):l?.[0])??null;return c&&s?{...c,...St(a,c,c.position,!0)}:c}o(Ca,"getHandle");function _a(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}o(_a,"getHandleType");function yf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}o(yf,"isConnectionValid");var Na=o(()=>!0,"alwaysValid");function xf(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:f,flowId:d,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:v,onConnectEnd:x,isValidConnection:y=Na,onReconnectEnd:S,updateConnection:g,getTransform:w,getFromHandle:I,autoPanSpeed:_,dragThreshold:T=1,handleDomNode:k}){let A=Ri(e.target),Y=0,P,{x:R,y:V}=He(e),b=_a(s,k),E=l?.getBoundingClientRect(),C=!1;if(!E||!b)return;let M=Ca(i,b,r,c,t);if(!M)return;let z=He(e,E),D=!1,H=null,F=!1,B=null;function U(){if(!f||!E)return;let[ee,G]=Ao(z,E,_);h({x:ee,y:G}),Y=requestAnimationFrame(U)}o(U,"autoPan");let X={...M,nodeId:i,type:b,position:M.position},W=c.get(i),K={inProgress:!0,isValid:null,from:St(W,X,J.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:W,to:z,toHandle:null,toPosition:Xs[X.position],toNode:null,pointer:z};function L(){C=!0,g(K),m?.(e,{nodeId:i,handleId:r,handleType:b})}o(L,"startConnection"),T===0&&L();function Z(ee){if(!C){let{x:ue,y:ve}=He(ee),he=ue-R,pe=ve-V;if(!(he*he+pe*pe>T*T))return;L()}if(!I()||!X){te(ee);return}let G=w();z=He(ee,E),P=gf(ln(z,G,!1,[1,1]),n,c,X),D||(U(),D=!0);let q=Ia(ee,{handle:P,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:A,lib:u,flowId:d,nodeLookup:c});B=q.handleDomNode,H=q.connection,F=yf(!!P,q.isValid);let ne=c.get(i),oe=ne?St(ne,X,J.Left,!0):K.from,se={...K,from:oe,isValid:F,to:q.toHandle&&F?zt({x:q.toHandle.x,y:q.toHandle.y},G):z,toHandle:q.toHandle,toPosition:F&&q.toHandle?q.toHandle.position:Xs[X.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:z};g(se),K=se}o(Z,"onPointerMove");function te(ee){if(!("touches"in ee&&ee.touches.length>0)){if(C){(P||B)&&H&&F&&v?.(H);let{inProgress:G,...q}=K,ne={...q,toPosition:K.toHandle?K.toPosition:null};x?.(ee,ne),s&&S?.(ee,ne)}p(),cancelAnimationFrame(Y),D=!1,F=!1,H=null,B=null,A.removeEventListener("mousemove",Z),A.removeEventListener("mouseup",te),A.removeEventListener("touchmove",Z),A.removeEventListener("touchend",te)}}o(te,"onPointerUp"),A.addEventListener("mousemove",Z),A.addEventListener("mouseup",te),A.addEventListener("touchmove",Z),A.addEventListener("touchend",te)}o(xf,"onPointerDown");function Ia(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=Na,nodeLookup:f}){let d=s==="target",h=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=He(e),v=a.elementFromPoint(p,m),x=v?.classList.contains(`${l}-flow__handle`)?v:h,y={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){let S=_a(void 0,x),g=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),I=x.classList.contains("connectable"),_=x.classList.contains("connectableend");if(!g||!S)return y;let T={source:d?g:r,sourceHandle:d?w:i,target:d?r:g,targetHandle:d?i:w};y.connection=T;let A=I&&_&&(n===vt.Strict?d&&S==="source"||!d&&S==="target":g!==r||w!==i);y.isValid=A&&u(T),y.toHandle=Ca(g,S,w,f,n,!0)}return y}o(Ia,"isValidHandle");var Fo={onPointerDown:xf,isValid:Ia};function Ma({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Ee(e);function s({translateExtent:l,width:c,height:u,zoomStep:f=1,pannable:d=!0,zoomable:h=!0,inversePan:p=!1}){let m=o(g=>{if(g.sourceEvent.type!=="wheel"||!t)return;let w=n(),I=g.sourceEvent.ctrlKey&&cn()?10:1,_=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*f,T=w[2]*Math.pow(2,_*I);t.scaleTo(T)},"zoomHandler"),v=[0,0],x=o(g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(v=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},"panStartHandler"),y=o(g=>{let w=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;let I=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],_=[I[0]-v[0],I[1]-v[1]];v=I;let T=r()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),k={x:w[0]-_[0]*T,y:w[1]-_[1]*T},A=[[0,0],[c,u]];t.setViewportConstrained({x:k.x,y:k.y,zoom:w[2]},A,l)},"panHandler"),S=Un().on("start",x).on("zoom",d?y:null).on("zoom.wheel",h?m:null);i.call(S,{})}o(s,"update");function a(){i.on("zoom",null)}return o(a,"destroy"),{update:s,destroy:a,pointer:Me}}o(Ma,"XYMinimap");var Yo=o(e=>({x:e.x,y:e.y,zoom:e.k}),"transformToViewport"),vi=o(({x:e,y:t,zoom:n})=>At.translate(e,t).scale(n),"viewportToTransform"),en=o((e,t)=>e.target.closest(`.${t}`),"isWrappedWithClass"),Pa=o((e,t)=>t===2&&Array.isArray(e)&&e.includes(2),"isRightClickPan"),wf=o(e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,"defaultEase"),Si=o((e,t=0,n=wf,r=()=>{})=>{let i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},"getD3Transition"),Ta=o(e=>{let t=e.ctrlKey&&cn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},"wheelDelta");function bf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return f=>{if(en(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();let d=n.property("__zoom").k||1;if(f.ctrlKey&&a){let x=Me(f),y=Ta(f),S=d*Math.pow(2,y);r.scaleTo(n,S,x,f);return}let h=f.deltaMode===1?20:1,p=i===je.Vertical?0:f.deltaX*h,m=i===je.Horizontal?0:f.deltaY*h;!cn()&&f.shiftKey&&i!==je.Vertical&&(p=f.deltaY*h,m=0),r.translateBy(n,-(p/d)*s,-(m/d)*s,{internal:!0});let v=Yo(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(f,v),e.panScrollTimeout=setTimeout(()=>{u?.(f,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(f,v))}}o(bf,"createPanOnScrollHandler");function vf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,l=en(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,i)}}o(vf,"createZoomOnScrollHandler");function Sf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Yo(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(Sf,"createPanZoomStartHandler");function Ef({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{e.usedRightMouseButton=!!(n&&Pa(t,e.mouseButton??0)),s.sourceEvent?.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!s.sourceEvent?.internal&&i?.(s.sourceEvent,Yo(s.transform))}}o(Ef,"createPanZoomHandler");function Cf({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Pa(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let l=Yo(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,l)},n?150:0)}}}o(Cf,"createPanZoomEndHandler");function _f({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:f}){return d=>{let h=e||t,p=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(en(d,`${u}-flow__node`)||en(d,`${u}-flow__edge`)))return!0;if(!r&&!h&&!i&&!s&&!n||a||f&&!m||en(d,l)&&m||en(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!h&&!i&&!p&&m||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;let v=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&v}}o(_f,"createFilter");function ka({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){let u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),d=Un().scaleExtent([t,n]).translateExtent(r),h=Ee(e).call(d);S({x:i.x,y:i.y,zoom:nn(i.zoom,t,n)},[[0,0],[f.width,f.height]],r);let p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");d.wheelDelta(Ta);async function v(P,R){return h?new Promise(V=>{d?.interpolate(R?.interpolate==="linear"?uo:Ut).transform(Si(h,R?.duration,R?.ease,()=>V(!0)),P)}):!1}o(v,"setTransform");function x({noWheelClassName:P,noPanClassName:R,onPaneContextMenu:V,userSelectionActive:b,panOnScroll:E,panOnDrag:C,panOnScrollMode:M,panOnScrollSpeed:z,preventScrolling:D,zoomOnPinch:H,zoomOnScroll:F,zoomOnDoubleClick:B,zoomActivationKeyPressed:U,lib:X,onTransformChange:W,connectionInProgress:j,paneClickDistance:K,selectionOnDrag:L}){b&&!u.isZoomingOrPanning&&y();let Z=E&&!U&&!b;d.clickDistance(L?1/0:!Le(K)||K<0?0:K);let te=Z?bf({zoomPanValues:u,noWheelClassName:P,d3Selection:h,d3Zoom:d,panOnScrollMode:M,panOnScrollSpeed:z,zoomOnPinch:H,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):vf({noWheelClassName:P,preventScrolling:D,d3ZoomHandler:p});h.on("wheel.zoom",te,{passive:!1});let ee=Sf({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});d.on("start",ee);let G=Ef({zoomPanValues:u,panOnDrag:C,onPaneContextMenu:!!V,onPanZoom:s,onTransformChange:W});d.on("zoom",G);let q=Cf({zoomPanValues:u,panOnDrag:C,panOnScroll:E,onPaneContextMenu:V,onPanZoomEnd:l,onDraggingChange:c});d.on("end",q);let ne=_f({zoomActivationKeyPressed:U,panOnDrag:C,zoomOnScroll:F,panOnScroll:E,zoomOnDoubleClick:B,zoomOnPinch:H,userSelectionActive:b,noPanClassName:R,noWheelClassName:P,lib:X,connectionInProgress:j});d.filter(ne),B?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}o(x,"update");function y(){d.on("zoom",null)}o(y,"destroy");async function S(P,R,V){let b=vi(P),E=d?.constrain()(b,R,V);return E&&await v(E),E}o(S,"setViewportConstrained");async function g(P,R){let V=vi(P);return await v(V,R),V}o(g,"setViewport");function w(P){if(h){let R=vi(P),V=h.property("__zoom");(V.k!==P.zoom||V.x!==P.x||V.y!==P.y)&&d?.transform(h,R,null,{sync:!0})}}o(w,"syncViewport");function I(){let P=h?Zn(h.node()):{x:0,y:0,k:1};return{x:P.x,y:P.y,zoom:P.k}}o(I,"getViewport");async function _(P,R){return h?new Promise(V=>{d?.interpolate(R?.interpolate==="linear"?uo:Ut).scaleTo(Si(h,R?.duration,R?.ease,()=>V(!0)),P)}):!1}o(_,"scaleTo");async function T(P,R){return h?new Promise(V=>{d?.interpolate(R?.interpolate==="linear"?uo:Ut).scaleBy(Si(h,R?.duration,R?.ease,()=>V(!0)),P)}):!1}o(T,"scaleBy");function k(P){d?.scaleExtent(P)}o(k,"setScaleExtent");function A(P){d?.translateExtent(P)}o(A,"setTranslateExtent");function Y(P){let R=!Le(P)||P<0?0:P;d?.clickDistance(R)}return o(Y,"setClickDistance"),{update:x,destroy:y,setViewport:g,setViewportConstrained:S,getViewport:I,scaleTo:_,scaleBy:T,setScaleExtent:k,setTranslateExtent:A,syncViewport:w,setClickDistance:Y}}o(ka,"XYPanZoom");var Et;(function(e){e.Line="line",e.Handle="handle"})(Et||(Et={}));function Nf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){let a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}o(Nf,"getResizeDirection");function na(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(na,"getControlDirection");function wt(e,t){return Math.max(0,t-e)}o(wt,"getLowerExtentClamp");function bt(e,t){return Math.max(0,e-t)}o(bt,"getUpperExtentClamp");function Po(e,t,n){return Math.max(0,t-e,e-n)}o(Po,"getSizeClamp");function oa(e,t){return e?!t:t}o(oa,"xor");function If(e,t,n,r,i,s,a,l){let{affectsX:c,affectsY:u}=t,{isHorizontal:f,isVertical:d}=t,h=f&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:v,maxWidth:x,minHeight:y,maxHeight:S}=r,{x:g,y:w,width:I,height:_,aspectRatio:T}=e,k=Math.floor(f?p-e.pointerX:0),A=Math.floor(d?m-e.pointerY:0),Y=I+(c?-k:k),P=_+(u?-A:A),R=-s[0]*I,V=-s[1]*_,b=Po(Y,v,x),E=Po(P,y,S);if(a){let z=0,D=0;c&&k<0?z=wt(g+k+R,a[0][0]):!c&&k>0&&(z=bt(g+Y+R,a[1][0])),u&&A<0?D=wt(w+A+V,a[0][1]):!u&&A>0&&(D=bt(w+P+V,a[1][1])),b=Math.max(b,z),E=Math.max(E,D)}if(l){let z=0,D=0;c&&k>0?z=bt(g+k,l[0][0]):!c&&k<0&&(z=wt(g+Y,l[1][0])),u&&A>0?D=bt(w+A,l[0][1]):!u&&A<0&&(D=wt(w+P,l[1][1])),b=Math.max(b,z),E=Math.max(E,D)}if(i){if(f){let z=Po(Y/T,y,S)*T;if(b=Math.max(b,z),a){let D=0;!c&&!u||c&&!u&&h?D=bt(w+V+Y/T,a[1][1])*T:D=wt(w+V+(c?k:-k)/T,a[0][1])*T,b=Math.max(b,D)}if(l){let D=0;!c&&!u||c&&!u&&h?D=wt(w+Y/T,l[1][1])*T:D=bt(w+(c?k:-k)/T,l[0][1])*T,b=Math.max(b,D)}}if(d){let z=Po(P*T,v,x)/T;if(E=Math.max(E,z),a){let D=0;!c&&!u||u&&!c&&h?D=bt(g+P*T+R,a[1][0])/T:D=wt(g+(u?A:-A)*T+R,a[0][0])/T,E=Math.max(E,D)}if(l){let D=0;!c&&!u||u&&!c&&h?D=wt(g+P*T,l[1][0])/T:D=bt(g+(u?A:-A)*T,l[0][0])/T,E=Math.max(E,D)}}}A=A+(A<0?E:-E),k=k+(k<0?b:-b),i&&(h?Y>P*T?A=(oa(c,u)?-k:k)/T:k=(oa(c,u)?-A:A)*T:f?(A=k/T,u=c):(k=A*T,c=u));let C=c?g+k:g,M=u?w+A:w;return{width:I+(c?-k:k),height:_+(u?-A:A),x:s[0]*k*(c?-1:1)+C,y:s[1]*A*(u?-1:1)+M}}o(If,"getDimensionsAfterResize");var Aa={width:0,height:0,x:0,y:0},Mf={...Aa,pointerX:0,pointerY:0,aspectRatio:1};function Pf(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,l=n[0]*s,c=n[1]*a;return[[r-l,i-c],[r+s-l,i+a-c]]}o(Pf,"nodeToChildExtent");function Da({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let s=Ee(e),a={controlDirection:na("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:f,keepAspectRatio:d,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:v,shouldResize:x}){let y={...Aa},S={...Mf};a={boundaries:f,resizeDirection:h,keepAspectRatio:d,controlDirection:na(u)};let g,w=null,I=[],_,T,k,A=!1,Y=On().on("start",P=>{let{nodeLookup:R,transform:V,snapGrid:b,snapToGrid:E,nodeOrigin:C,paneDomNode:M}=n();if(g=R.get(t),!g)return;w=M?.getBoundingClientRect()??null;let{xSnapped:z,ySnapped:D}=Gn(P.sourceEvent,{transform:V,snapGrid:b,snapToGrid:E,containerBounds:w});y={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},S={...y,pointerX:z,pointerY:D,aspectRatio:y.width/y.height},_=void 0,T=Rt(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(_=R.get(g.parentId)),_&&g.extent==="parent"&&(T=[[0,0],[_.measured.width,_.measured.height]]),I=[],k=void 0;for(let[H,F]of R)if(F.parentId===t&&(I.push({id:H,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){let B=Pf(F,g,F.origin??C);k?k=[[Math.min(B[0][0],k[0][0]),Math.min(B[0][1],k[0][1])],[Math.max(B[1][0],k[1][0]),Math.max(B[1][1],k[1][1])]]:k=B}p?.(P,{...y})}).on("drag",P=>{let{transform:R,snapGrid:V,snapToGrid:b,nodeOrigin:E}=n(),C=Gn(P.sourceEvent,{transform:R,snapGrid:V,snapToGrid:b,containerBounds:w}),M=[];if(!g)return;let{x:z,y:D,width:H,height:F}=y,B={},U=g.origin??E,{width:X,height:W,x:j,y:K}=If(S,a.controlDirection,C,a.boundaries,a.keepAspectRatio,U,T,k),L=X!==H,Z=W!==F,te=j!==z&&L,ee=K!==D&&Z;if(!te&&!ee&&!L&&!Z)return;if((te||ee||U[0]===1||U[1]===1)&&(B.x=te?j:y.x,B.y=ee?K:y.y,y.x=B.x,y.y=B.y,I.length>0)){let oe=j-z,se=K-D;for(let ue of I)ue.position={x:ue.position.x-oe+U[0]*(X-H),y:ue.position.y-se+U[1]*(W-F)},M.push(ue)}if((L||Z)&&(B.width=L&&(!a.resizeDirection||a.resizeDirection==="horizontal")?X:y.width,B.height=Z&&(!a.resizeDirection||a.resizeDirection==="vertical")?W:y.height,y.width=B.width,y.height=B.height),_&&g.expandParent){let oe=U[0]*(B.width??0);B.x&&B.x<oe&&(y.x=oe,S.x=S.x-(B.x-oe));let se=U[1]*(B.height??0);B.y&&B.y<se&&(y.y=se,S.y=S.y-(B.y-se))}let G=Nf({width:y.width,prevWidth:H,height:y.height,prevHeight:F,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),q={...y,direction:G};x?.(P,q)!==!1&&(A=!0,m?.(P,q),r(B,M))}).on("end",P=>{A&&(v?.(P,{...y}),i?.({...y}),A=!1)});s.call(Y)}o(l,"update");function c(){s.on(".drag",null)}return o(c,"destroy"),{update:l,destroy:c}}o(Da,"XYResizer");var Ra=mt(ar(),1),La=mt(tu(),1);var Oa=o(e=>{let t,n=new Set,r=o((f,d)=>{let h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){let p=t;t=d??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},"setState"),i=o(()=>t,"getState"),c={setState:r,getState:i,getInitialState:o(()=>u,"getInitialState"),subscribe:o(f=>(n.add(f),()=>n.delete(f)),"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,c);return c},"createStoreImpl"),$a=o(e=>e?Oa(e):Oa,"createStore");var{useDebugValue:Tf}=Ra.default,{useSyncExternalStoreWithSelector:kf}=La.default,Af=o(e=>e,"identity");function Zi(e,t=Af,n){let r=kf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Tf(r),r}o(Zi,"useStoreWithEqualityFn");var za=o((e,t)=>{let n=$a(e),r=o((i,s=t)=>Zi(n,i,s),"useBoundStoreWithEqualityFn");return Object.assign(r,n),r},"createWithEqualityFnImpl"),Ha=o((e,t)=>e?za(e,t):za,"createWithEqualityFn");function ce(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(ce,"shallow$1");var Df=mt(Qc());var Uo=(0,$.createContext)(null),Of=Uo.Provider,ul=De.error001("react");function ie(e,t){let n=(0,$.useContext)(Uo);if(n===null)throw new Error(ul);return Zi(n,e,t)}o(ie,"useStore");function fe(){let e=(0,$.useContext)(Uo);if(e===null)throw new Error(ul);return(0,$.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}o(fe,"useStoreApi");var Ba={display:"none"},$f={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},dl="react-flow__node-desc",fl="react-flow__edge-desc",zf="react-flow__aria-live",Rf=o(e=>e.ariaLiveMessage,"ariaLiveSelector"),Lf=o(e=>e.ariaLabelConfig,"ariaLabelConfigSelector");function Hf({rfId:e}){let t=ie(Rf);return(0,O.jsx)("div",{id:`${zf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:$f,children:t})}o(Hf,"AriaLiveMessage");function Bf({rfId:e,disableKeyboardA11y:t}){let n=ie(Lf);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{id:`${dl}-${e}`,style:Ba,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,O.jsx)("div",{id:`${fl}-${e}`,style:Ba,children:n["edge.a11yDescription.default"]}),!t&&(0,O.jsx)(Hf,{rfId:e})]})}o(Bf,"A11yDescriptions");var _t=(0,$.forwardRef)(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{let a=`${e}`.split("-");return(0,O.jsx)("div",{className:ge(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});_t.displayName="Panel";var Va="https://reactflow.dev/attribution";function Vf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,O.jsx)(_t,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Va}`,children:(0,O.jsx)("a",{href:Va,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}o(Vf,"Attribution");var Ff=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$m"),Wo=o(e=>e.id,"selectId");function Yf(e,t){return ce(e.selectedNodes.map(Wo),t.selectedNodes.map(Wo))&&ce(e.selectedEdges.map(Wo),t.selectedEdges.map(Wo))}o(Yf,"areEqual");function Wf({onSelectionChange:e}){let t=fe(),{selectedNodes:n,selectedEdges:r}=ie(Ff,Yf);return(0,$.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}o(Wf,"SelectionListenerInner");var Xf=o(e=>!!e.onSelectionChangeHandlers,"changeSelector");function Zf({onSelectionChange:e}){let t=ie(Xf);return e||t?(0,O.jsx)(Wf,{onSelectionChange:e}):null}o(Zf,"SelectionListener");var hl=[0,0],Uf={x:0,y:0,zoom:1},Gf=["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"],Fa=[...Gf,"rfId"],qf=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$l"),Ya={translateExtent:on,nodeOrigin:hl,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Kf(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=ie(qf,ce),u=fe();(0,$.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=Ya,l()}),[]);let f=(0,$.useRef)(Ya);return(0,$.useEffect)(()=>{for(let d of Fa){let h=e[d],p=f.current[d];h!==p&&(typeof e[d]>"u"||(d==="nodes"?t(h):d==="edges"?n(h):d==="minZoom"?r(h):d==="maxZoom"?i(h):d==="translateExtent"?s(h):d==="nodeExtent"?a(h):d==="ariaLabelConfig"?u.setState({ariaLabelConfig:da(h)}):d==="fitView"?u.setState({fitViewQueued:h}):d==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[d]:h})))}f.current=e},Fa.map(d=>e[d])),null}o(Kf,"StoreUpdater");function Wa(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}o(Wa,"getMediaQuery");function Qf(e){let[t,n]=(0,$.useState)(e==="system"?null:e);return(0,$.useEffect)(()=>{if(e!=="system"){n(e);return}let r=Wa(),i=o(()=>n(r?.matches?"dark":"light"),"updateColorModeClass");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:Wa()?.matches?"dark":"light"}o(Qf,"useColorModeClass");var Xa=typeof document<"u"?document:null;function jn(e=null,t={target:Xa,actInsideInputWithModifier:!0}){let[n,r]=(0,$.useState)(!1),i=(0,$.useRef)(!1),s=(0,$.useRef)(new Set([])),[a,l]=(0,$.useMemo)(()=>{if(e!==null){let u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
1
+ "use client";import{a as Ye,b as fo}from"./chunk-2NGUNNGW.js";import{a as Es,b as Cs,c as _s,f as ho}from"./chunk-LNZIB2MD.js";import"./chunk-QBAT52GB.js";import"./chunk-QAFAJBAW.js";import"./chunk-IXDH4GL5.js";import"./chunk-KSKXW5PX.js";import"./chunk-5OIBXYZM.js";import"./chunk-L7SK4ZZD.js";import{a as lr,b as cr,c as gs,d as ys,e as uo,g as xs,h as ws,i as Ut}from"./chunk-BJGBHGK3.js";import{e as fs}from"./chunk-WI7GWFEG.js";import{a as Ss}from"./chunk-2K47A3P6.js";import{b as tu}from"./chunk-KEGAWN6Y.js";import{a as Ge}from"./chunk-JSEXCW5Q.js";import{e as hs,k as ps}from"./chunk-4QHKBC77.js";import{a as vs}from"./chunk-K3GNLVYK.js";import{b as bs}from"./chunk-TBMYIZIO.js";import{R as Mt}from"./chunk-3CJW6NWG.js";import{c as Ie}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as Qc}from"./chunk-HV7G6DFP.js";import{a as Nn}from"./chunk-BOXSWNXZ.js";import{a as ms}from"./chunk-TAD43CG5.js";import{a as io,b as so,c as ao,d as lo,e as co}from"./chunk-SEU5V7I6.js";import{b as Ue}from"./chunk-ZPP2KOR4.js";import"./chunk-CKSHCYGC.js";import{f as ds}from"./chunk-GLUNBZRI.js";import"./chunk-ZHVTQ37P.js";import{a as jc}from"./chunk-3OA7PECS.js";import{d as It,e as En,f as Cn,g as _n,k as Oe}from"./chunk-PVZI3CXP.js";import{b as us}from"./chunk-GMSGZDDH.js";import{a as o,e as mt,f as ar,g as Jc,h as eu,j as Zt}from"./chunk-RRCPZMC2.js";var Be=mt(Jc(),1);var re=mt(ar(),1);var O=mt(jc()),$=mt(ar());function ge(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=ge(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}o(ge,"cc");var nu={value:o(()=>{},"value")};function Is(){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 po(n)}o(Is,"dispatch");function po(e){this._=e}o(po,"Dispatch");function ou(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(ou,"parseTypenames");po.prototype=Is.prototype={constructor:po,on:o(function(e,t){var n=this._,r=ou(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=ru(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]=Ns(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ns(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 po(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 ru(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}o(ru,"get");function Ns(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=nu,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}o(Ns,"set");var Pt=Is;var mo="http://www.w3.org/1999/xhtml",ur={svg:"http://www.w3.org/2000/svg",xhtml:mo,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function We(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ur.hasOwnProperty(t)?{space:ur[t],local:e}:e}o(We,"default");function iu(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===mo&&t.documentElement.namespaceURI===mo?t.createElement(e):t.createElementNS(n,e)}}o(iu,"creatorInherit");function su(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}o(su,"creatorFixed");function In(e){var t=We(e);return(t.local?su:iu)(t)}o(In,"default");function au(){}o(au,"none");function gt(e){return e==null?au:function(){return this.querySelector(e)}}o(gt,"default");function dr(e){typeof e!="function"&&(e=gt(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,l=r[i]=new Array(a),c,u,f=0;f<a;++f)(c=s[f])&&(u=e.call(c,c.__data__,f,s))&&("__data__"in c&&(u.__data__=c.__data__),l[f]=u);return new ye(r,this._parents)}o(dr,"default");function fr(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}o(fr,"array");function lu(){return[]}o(lu,"empty");function Gt(e){return e==null?lu:function(){return this.querySelectorAll(e)}}o(Gt,"default");function cu(e){return function(){return fr(e.apply(this,arguments))}}o(cu,"arrayAll");function hr(e){typeof e=="function"?e=cu(e):e=Gt(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var a=t[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&(r.push(e.call(c,c.__data__,u,a)),i.push(c));return new ye(r,i)}o(hr,"default");function qt(e){return function(){return this.matches(e)}}o(qt,"default");function go(e){return function(t){return t.matches(e)}}o(go,"childMatcher");var uu=Array.prototype.find;function du(e){return function(){return uu.call(this.children,e)}}o(du,"childFind");function fu(){return this.firstElementChild}o(fu,"childFirst");function pr(e){return this.select(e==null?fu:du(typeof e=="function"?e:go(e)))}o(pr,"default");var hu=Array.prototype.filter;function pu(){return Array.from(this.children)}o(pu,"children");function mu(e){return function(){return hu.call(this.children,e)}}o(mu,"childrenFilter");function mr(e){return this.selectAll(e==null?pu:mu(typeof e=="function"?e:go(e)))}o(mr,"default");function gr(e){typeof e!="function"&&(e=qt(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,l=r[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new ye(r,this._parents)}o(gr,"default");function Mn(e){return new Array(e.length)}o(Mn,"default");function yr(){return new ye(this._enter||this._groups.map(Mn),this._parents)}o(yr,"default");function Pn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}o(Pn,"EnterNode");Pn.prototype={constructor:Pn,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 xr(e){return function(){return e}}o(xr,"default");function gu(e,t,n,r,i,s){for(var a=0,l,c=t.length,u=s.length;a<u;++a)(l=t[a])?(l.__data__=s[a],r[a]=l):n[a]=new Pn(e,s[a]);for(;a<c;++a)(l=t[a])&&(i[a]=l)}o(gu,"bindIndex");function yu(e,t,n,r,i,s,a){var l,c,u=new Map,f=t.length,d=s.length,h=new Array(f),p;for(l=0;l<f;++l)(c=t[l])&&(h[l]=p=a.call(c,c.__data__,l,t)+"",u.has(p)?i[l]=c:u.set(p,c));for(l=0;l<d;++l)p=a.call(e,s[l],l,s)+"",(c=u.get(p))?(r[l]=c,c.__data__=s[l],u.delete(p)):n[l]=new Pn(e,s[l]);for(l=0;l<f;++l)(c=t[l])&&u.get(h[l])===c&&(i[l]=c)}o(yu,"bindKey");function xu(e){return e.__data__}o(xu,"datum");function wr(e,t){if(!arguments.length)return Array.from(this,xu);var n=t?yu:gu,r=this._parents,i=this._groups;typeof e!="function"&&(e=xr(e));for(var s=i.length,a=new Array(s),l=new Array(s),c=new Array(s),u=0;u<s;++u){var f=r[u],d=i[u],h=d.length,p=wu(e.call(f,f&&f.__data__,u,r)),m=p.length,v=l[u]=new Array(m),x=a[u]=new Array(m),y=c[u]=new Array(h);n(f,d,v,x,y,p,t);for(var S=0,g=0,w,I;S<m;++S)if(w=v[S]){for(S>=g&&(g=S+1);!(I=x[g])&&++g<m;);w._next=I||null}}return a=new ye(a,r),a._enter=l,a._exit=c,a}o(wr,"default");function wu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}o(wu,"arraylike");function br(){return new ye(this._exit||this._groups.map(Mn),this._parents)}o(br,"default");function vr(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(vr,"default");function Sr(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),l=new Array(i),c=0;c<a;++c)for(var u=n[c],f=r[c],d=u.length,h=l[c]=new Array(d),p,m=0;m<d;++m)(p=u[m]||f[m])&&(h[m]=p);for(;c<i;++c)l[c]=n[c];return new ye(l,this._parents)}o(Sr,"default");function Er(){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(Er,"default");function Cr(e){e||(e=bu);function t(d,h){return d&&h?e(d.__data__,h.__data__):!d-!h}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],l=a.length,c=i[s]=new Array(l),u,f=0;f<l;++f)(u=a[f])&&(c[f]=u);c.sort(t)}return new ye(i,this._parents).order()}o(Cr,"default");function bu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}o(bu,"ascending");function _r(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}o(_r,"default");function Nr(){return Array.from(this)}o(Nr,"default");function Ir(){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(Ir,"default");function Mr(){let e=0;for(let t of this)++e;return e}o(Mr,"default");function Pr(){return!this.node()}o(Pr,"default");function Tr(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,a=i.length,l;s<a;++s)(l=i[s])&&e.call(l,l.__data__,s,i);return this}o(Tr,"default");function vu(e){return function(){this.removeAttribute(e)}}o(vu,"attrRemove");function Su(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(Su,"attrRemoveNS");function Eu(e,t){return function(){this.setAttribute(e,t)}}o(Eu,"attrConstant");function Cu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}o(Cu,"attrConstantNS");function _u(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}o(_u,"attrFunction");function Nu(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(Nu,"attrFunctionNS");function kr(e,t){var n=We(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?Su:vu:typeof t=="function"?n.local?Nu:_u:n.local?Cu:Eu)(n,t))}o(kr,"default");function Tn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}o(Tn,"default");function Iu(e){return function(){this.style.removeProperty(e)}}o(Iu,"styleRemove");function Mu(e,t,n){return function(){this.style.setProperty(e,t,n)}}o(Mu,"styleConstant");function Pu(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}o(Pu,"styleFunction");function Ar(e,t,n){return arguments.length>1?this.each((t==null?Iu:typeof t=="function"?Pu:Mu)(e,t,n??"")):yt(this.node(),e)}o(Ar,"default");function yt(e,t){return e.style.getPropertyValue(t)||Tn(e).getComputedStyle(e,null).getPropertyValue(t)}o(yt,"styleValue");function Tu(e){return function(){delete this[e]}}o(Tu,"propertyRemove");function ku(e,t){return function(){this[e]=t}}o(ku,"propertyConstant");function Au(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}o(Au,"propertyFunction");function Dr(e,t){return arguments.length>1?this.each((t==null?Tu:typeof t=="function"?Au:ku)(e,t)):this.node()[e]}o(Dr,"default");function Ms(e){return e.trim().split(/^|\s+/)}o(Ms,"classArray");function Or(e){return e.classList||new Ps(e)}o(Or,"classList");function Ps(e){this._node=e,this._names=Ms(e.getAttribute("class")||"")}o(Ps,"ClassList");Ps.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 Ts(e,t){for(var n=Or(e),r=-1,i=t.length;++r<i;)n.add(t[r])}o(Ts,"classedAdd");function ks(e,t){for(var n=Or(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}o(ks,"classedRemove");function Du(e){return function(){Ts(this,e)}}o(Du,"classedTrue");function Ou(e){return function(){ks(this,e)}}o(Ou,"classedFalse");function $u(e,t){return function(){(t.apply(this,arguments)?Ts:ks)(this,e)}}o($u,"classedFunction");function $r(e,t){var n=Ms(e+"");if(arguments.length<2){for(var r=Or(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?$u:t?Du:Ou)(n,t))}o($r,"default");function zu(){this.textContent=""}o(zu,"textRemove");function Ru(e){return function(){this.textContent=e}}o(Ru,"textConstant");function Lu(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}o(Lu,"textFunction");function zr(e){return arguments.length?this.each(e==null?zu:(typeof e=="function"?Lu:Ru)(e)):this.node().textContent}o(zr,"default");function Hu(){this.innerHTML=""}o(Hu,"htmlRemove");function Bu(e){return function(){this.innerHTML=e}}o(Bu,"htmlConstant");function Vu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}o(Vu,"htmlFunction");function Rr(e){return arguments.length?this.each(e==null?Hu:(typeof e=="function"?Vu:Bu)(e)):this.node().innerHTML}o(Rr,"default");function Fu(){this.nextSibling&&this.parentNode.appendChild(this)}o(Fu,"raise");function Lr(){return this.each(Fu)}o(Lr,"default");function Yu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}o(Yu,"lower");function Hr(){return this.each(Yu)}o(Hr,"default");function Br(e){var t=typeof e=="function"?e:In(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}o(Br,"default");function Wu(){return null}o(Wu,"constantNull");function Vr(e,t){var n=typeof e=="function"?e:In(e),r=t==null?Wu:typeof t=="function"?t:gt(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}o(Vr,"default");function Xu(){var e=this.parentNode;e&&e.removeChild(this)}o(Xu,"remove");function Fr(){return this.each(Xu)}o(Fr,"default");function Zu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(Zu,"selection_cloneShallow");function Uu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}o(Uu,"selection_cloneDeep");function Yr(e){return this.select(e?Uu:Zu)}o(Yr,"default");function Wr(e){return arguments.length?this.property("__data__",e):this.node().__data__}o(Wr,"default");function Gu(e){return function(t){e.call(this,t,this.__data__)}}o(Gu,"contextListener");function qu(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(qu,"parseTypenames");function Ku(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(Ku,"onRemove");function Qu(e,t,n){return function(){var r=this.__on,i,s=Gu(t);if(r){for(var a=0,l=r.length;a<l;++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(Qu,"onAdd");function Xr(e,t,n){var r=qu(e+""),i,s=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,f;c<u;++c)for(i=0,f=l[c];i<s;++i)if((a=r[i]).type===f.type&&a.name===f.name)return f.value}return}for(l=t?Qu:Ku,i=0;i<s;++i)this.each(l(r[i],t,n));return this}o(Xr,"default");function As(e,t,n){var r=Tn(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(As,"dispatchEvent");function Ju(e,t){return function(){return As(this,e,t)}}o(Ju,"dispatchConstant");function ju(e,t){return function(){return As(this,e,t.apply(this,arguments))}}o(ju,"dispatchFunction");function Zr(e,t){return this.each((typeof t=="function"?ju:Ju)(e,t))}o(Zr,"default");function*Ur(){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(Ur,"default");var Gr=[null];function ye(e,t){this._groups=e,this._parents=t}o(ye,"Selection");function Ds(){return new ye([[document.documentElement]],Gr)}o(Ds,"selection");function ed(){return this}o(ed,"selection_selection");ye.prototype=Ds.prototype={constructor:ye,select:dr,selectAll:hr,selectChild:pr,selectChildren:mr,filter:gr,data:wr,enter:yr,exit:br,join:vr,merge:Sr,selection:ed,order:Er,sort:Cr,call:_r,nodes:Nr,node:Ir,size:Mr,empty:Pr,each:Tr,attr:kr,style:Ar,property:Dr,classed:$r,text:zr,html:Rr,raise:Lr,lower:Hr,append:Br,insert:Vr,remove:Fr,clone:Yr,datum:Wr,on:Xr,dispatch:Zr,[Symbol.iterator]:Ur};var qe=Ds;function Ee(e){return typeof e=="string"?new ye([[document.querySelector(e)]],[document.documentElement]):new ye([[e]],Gr)}o(Ee,"default");function qr(e){let t;for(;t=e.sourceEvent;)e=t;return e}o(qr,"default");function Me(e,t){if(e=qr(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(Me,"default");var Os={passive:!1},Tt={capture:!0,passive:!1};function yo(e){e.stopImmediatePropagation()}o(yo,"nopropagation");function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}o(Ke,"default");function Kt(e){var t=e.document.documentElement,n=Ee(e).on("dragstart.drag",Ke,Tt);"onselectstart"in t?n.on("selectstart.drag",Ke,Tt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}o(Kt,"default");function kn(e,t){var n=e.document.documentElement,r=Ee(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ke,Tt),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(kn,"yesdrag");var An=o(e=>()=>e,"default");function Dn(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:a,y:l,dx:c,dy:u,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value: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:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:f}})}o(Dn,"DragEvent");Dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function td(e){return!e.ctrlKey&&!e.button}o(td,"defaultFilter");function nd(){return this.parentNode}o(nd,"defaultContainer");function od(e,t){return t??{x:e.x,y:e.y}}o(od,"defaultSubject");function rd(){return navigator.maxTouchPoints||"ontouchstart"in this}o(rd,"defaultTouchable");function On(){var e=td,t=nd,n=od,r=rd,i={},s=Pt("start","drag","end"),a=0,l,c,u,f,d=0;function h(w){w.on("mousedown.drag",p).filter(r).on("touchstart.drag",x).on("touchmove.drag",y,Os).on("touchend.drag touchcancel.drag",S).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(h,"drag");function p(w,I){if(!(f||!e.call(this,w,I))){var _=g(this,t.call(this,w,I),w,I,"mouse");_&&(Ee(w.view).on("mousemove.drag",m,Tt).on("mouseup.drag",v,Tt),Kt(w.view),yo(w),u=!1,l=w.clientX,c=w.clientY,_("start",w))}}o(p,"mousedowned");function m(w){if(Ke(w),!u){var I=w.clientX-l,_=w.clientY-c;u=I*I+_*_>d}i.mouse("drag",w)}o(m,"mousemoved");function v(w){Ee(w.view).on("mousemove.drag mouseup.drag",null),kn(w.view,u),Ke(w),i.mouse("end",w)}o(v,"mouseupped");function x(w,I){if(e.call(this,w,I)){var _=w.changedTouches,T=t.call(this,w,I),k=_.length,A,Y;for(A=0;A<k;++A)(Y=g(this,T,w,I,_[A].identifier,_[A]))&&(yo(w),Y("start",w,_[A]))}}o(x,"touchstarted");function y(w){var I=w.changedTouches,_=I.length,T,k;for(T=0;T<_;++T)(k=i[I[T].identifier])&&(Ke(w),k("drag",w,I[T]))}o(y,"touchmoved");function S(w){var I=w.changedTouches,_=I.length,T,k;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),T=0;T<_;++T)(k=i[I[T].identifier])&&(yo(w),k("end",w,I[T]))}o(S,"touchended");function g(w,I,_,T,k,A){var Y=s.copy(),P=Me(A||_,I),R,V,b;if((b=n.call(w,new Dn("beforestart",{sourceEvent:_,target:h,identifier:k,active:a,x:P[0],y:P[1],dx:0,dy:0,dispatch:Y}),T))!=null)return R=b.x-P[0]||0,V=b.y-P[1]||0,o(function E(C,M,z){var D=P,H;switch(C){case"start":i[k]=E,H=a++;break;case"end":delete i[k],--a;case"drag":P=Me(z||M,I),H=a;break}Y.call(C,w,new Dn(C,{sourceEvent:M,subject:b,target:h,identifier:k,active:H,x:P[0]+R,y:P[1]+V,dx:P[0]-D[0],dy:P[1]-D[1],dispatch:Y}),T)},"gesture")}return o(g,"beforestart"),h.filter=function(w){return arguments.length?(e=typeof w=="function"?w:An(!!w),h):e},h.container=function(w){return arguments.length?(t=typeof w=="function"?w:An(w),h):t},h.subject=function(w){return arguments.length?(n=typeof w=="function"?w:An(w),h):n},h.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:An(!!w),h):r},h.on=function(){var w=s.on.apply(s,arguments);return w===s?h:w},h.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,h):Math.sqrt(d)},h}o(On,"default");var Qt=0,zn=0,$n=0,zs=1e3,xo,Rn,wo=0,kt=0,bo=0,Ln=typeof performance=="object"&&performance.now?performance:Date,Rs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bn(){return kt||(Rs(id),kt=Ln.now()+bo)}o(Bn,"now");function id(){kt=0}o(id,"clearNow");function Hn(){this._call=this._time=this._next=null}o(Hn,"Timer");Hn.prototype=vo.prototype={constructor:Hn,restart:o(function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Bn():+n)+(t==null?0:+t),!this._next&&Rn!==this&&(Rn?Rn._next=this:xo=this,Rn=this),this._call=e,this._time=n,Kr()},"restart"),stop:o(function(){this._call&&(this._call=null,this._time=1/0,Kr())},"stop")};function vo(e,t,n){var r=new Hn;return r.restart(e,t,n),r}o(vo,"timer");function Ls(){Bn(),++Qt;for(var e=xo,t;e;)(t=kt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qt}o(Ls,"timerFlush");function $s(){kt=(wo=Ln.now())+bo,Qt=zn=0;try{Ls()}finally{Qt=0,ad(),kt=0}}o($s,"wake");function sd(){var e=Ln.now(),t=e-wo;t>zs&&(bo-=t,wo=e)}o(sd,"poke");function ad(){for(var e,t=xo,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:xo=n);Rn=e,Kr(r)}o(ad,"nap");function Kr(e){if(!Qt){zn&&(zn=clearTimeout(zn));var t=e-kt;t>24?(e<1/0&&(zn=setTimeout($s,e-Ln.now()-bo)),$n&&($n=clearInterval($n))):($n||(wo=Ln.now(),$n=setInterval(sd,zs)),Qt=1,Rs($s))}}o(Kr,"sleep");function Vn(e,t,n){var r=new Hn;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}o(Vn,"default");var ld=Pt("start","end","cancel","interrupt"),cd=[],Vs=0,Hs=1,Eo=2,So=3,Bs=4,Co=5,Fn=6;function Qe(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;ud(e,n,{name:t,index:r,group:i,on:ld,tween:cd,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Vs})}o(Qe,"default");function Yn(e,t){var n=Ce(e,t);if(n.state>Vs)throw new Error("too late; already scheduled");return n}o(Yn,"init");function Ne(e,t){var n=Ce(e,t);if(n.state>So)throw new Error("too late; already running");return n}o(Ne,"set");function Ce(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}o(Ce,"get");function ud(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=vo(s,0,n.time);function s(u){n.state=Hs,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}o(s,"schedule");function a(u){var f,d,h,p;if(n.state!==Hs)return c();for(f in r)if(p=r[f],p.name===n.name){if(p.state===So)return Vn(a);p.state===Bs?(p.state=Fn,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[f]):+f<t&&(p.state=Fn,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete r[f])}if(Vn(function(){n.state===So&&(n.state=Bs,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Eo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Eo){for(n.state=So,i=new Array(h=n.tween.length),f=0,d=-1;f<h;++f)(p=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(i[++d]=p);i.length=d+1}}o(a,"start");function l(u){for(var f=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Co,1),d=-1,h=i.length;++d<h;)i[d].call(e,f);n.state===Co&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}o(l,"tick");function c(){n.state=Fn,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}o(c,"stop")}o(ud,"create");function xt(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>Eo&&r.state<Co,r.state=Fn,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}s&&delete e.__transition}}o(xt,"default");function Qr(e){return this.each(function(){xt(this,e)})}o(Qr,"default");function dd(e,t){var n,r;return function(){var i=Ne(this,e),s=i.tween;if(s!==n){r=n=s;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}i.tween=r}}o(dd,"tweenRemove");function fd(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=Ne(this,e),a=s.tween;if(a!==r){i=(r=a).slice();for(var l={name:t,value:n},c=0,u=i.length;c<u;++c)if(i[c].name===t){i[c]=l;break}c===u&&i.push(l)}s.tween=i}}o(fd,"tweenFunction");function Jr(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ce(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?dd:fd)(n,e,t))}o(Jr,"default");function Jt(e,t,n){var r=e._id;return e.each(function(){var i=Ne(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Ce(i,r).value[t]}}o(Jt,"tweenValue");function Wn(e,t){var n;return(typeof t=="number"?gs:t instanceof lr?cr:(n=lr(t))?(t=n,cr):ys)(e,t)}o(Wn,"default");function hd(e){return function(){this.removeAttribute(e)}}o(hd,"attrRemove");function pd(e){return function(){this.removeAttributeNS(e.space,e.local)}}o(pd,"attrRemoveNS");function md(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(md,"attrConstant");function gd(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(gd,"attrConstantNS");function yd(e,t,n){var r,i,s;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l)))}}o(yd,"attrFunction");function xd(e,t,n){var r,i,s;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l)))}}o(xd,"attrFunctionNS");function jr(e,t){var n=We(e),r=n==="transform"?ws:Wn;return this.attrTween(e,typeof t=="function"?(n.local?xd:yd)(n,r,Jt(this,"attr."+e,t)):t==null?(n.local?pd:hd)(n):(n.local?gd:md)(n,r,t))}o(jr,"default");function wd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}o(wd,"attrInterpolate");function bd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}o(bd,"attrInterpolateNS");function vd(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&bd(e,s)),n}return o(i,"tween"),i._value=t,i}o(vd,"attrTweenNS");function Sd(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&wd(e,s)),n}return o(i,"tween"),i._value=t,i}o(Sd,"attrTween");function ei(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=We(e);return this.tween(n,(r.local?vd:Sd)(r,t))}o(ei,"default");function Ed(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}o(Ed,"delayFunction");function Cd(e,t){return t=+t,function(){Yn(this,e).delay=t}}o(Cd,"delayConstant");function ti(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ed:Cd)(t,e)):Ce(this.node(),t).delay}o(ti,"default");function _d(e,t){return function(){Ne(this,e).duration=+t.apply(this,arguments)}}o(_d,"durationFunction");function Nd(e,t){return t=+t,function(){Ne(this,e).duration=t}}o(Nd,"durationConstant");function ni(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_d:Nd)(t,e)):Ce(this.node(),t).duration}o(ni,"default");function Id(e,t){if(typeof t!="function")throw new Error;return function(){Ne(this,e).ease=t}}o(Id,"easeConstant");function oi(e){var t=this._id;return arguments.length?this.each(Id(t,e)):Ce(this.node(),t).ease}o(oi,"default");function Md(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ne(this,e).ease=n}}o(Md,"easeVarying");function ri(e){if(typeof e!="function")throw new Error;return this.each(Md(this._id,e))}o(ri,"default");function ii(e){typeof e!="function"&&(e=qt(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,l=r[i]=[],c,u=0;u<a;++u)(c=s[u])&&e.call(c,c.__data__,u,s)&&l.push(c);return new Ae(r,this._parents,this._name,this._id)}o(ii,"default");function si(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),l=0;l<s;++l)for(var c=t[l],u=n[l],f=c.length,d=a[l]=new Array(f),h,p=0;p<f;++p)(h=c[p]||u[p])&&(d[p]=h);for(;l<r;++l)a[l]=t[l];return new Ae(a,this._parents,this._name,this._id)}o(si,"default");function Pd(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(Pd,"start");function Td(e,t,n){var r,i,s=Pd(t)?Yn:Ne;return function(){var a=s(this,e),l=a.on;l!==r&&(i=(r=l).copy()).on(t,n),a.on=i}}o(Td,"onFunction");function ai(e,t){var n=this._id;return arguments.length<2?Ce(this.node(),n).on.on(e):this.each(Td(n,e,t))}o(ai,"default");function kd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}o(kd,"removeFunction");function li(){return this.on("end.remove",kd(this._id))}o(li,"default");function ci(e){var t=this._name,n=this._id;typeof e!="function"&&(e=gt(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a<i;++a)for(var l=r[a],c=l.length,u=s[a]=new Array(c),f,d,h=0;h<c;++h)(f=l[h])&&(d=e.call(f,f.__data__,h,l))&&("__data__"in f&&(d.__data__=f.__data__),u[h]=d,Qe(u[h],t,n,h,u,Ce(f,n)));return new Ae(s,this._parents,t,n)}o(ci,"default");function ui(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Gt(e));for(var r=this._groups,i=r.length,s=[],a=[],l=0;l<i;++l)for(var c=r[l],u=c.length,f,d=0;d<u;++d)if(f=c[d]){for(var h=e.call(f,f.__data__,d,c),p,m=Ce(f,n),v=0,x=h.length;v<x;++v)(p=h[v])&&Qe(p,t,n,v,h,m);s.push(h),a.push(f)}return new Ae(s,a,t,n)}o(ui,"default");var Ad=qe.prototype.constructor;function di(){return new Ad(this._groups,this._parents)}o(di,"default");function Dd(e,t){var n,r,i;return function(){var s=yt(this,e),a=(this.style.removeProperty(e),yt(this,e));return s===a?null:s===n&&a===r?i:i=t(n=s,r=a)}}o(Dd,"styleNull");function Fs(e){return function(){this.style.removeProperty(e)}}o(Fs,"styleRemove");function Od(e,t,n){var r,i=n+"",s;return function(){var a=yt(this,e);return a===i?null:a===r?s:s=t(r=a,n)}}o(Od,"styleConstant");function $d(e,t,n){var r,i,s;return function(){var a=yt(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),yt(this,e))),a===c?null:a===r&&c===i?s:(i=c,s=t(r=a,l))}}o($d,"styleFunction");function zd(e,t){var n,r,i,s="style."+t,a="end."+s,l;return function(){var c=Ne(this,e),u=c.on,f=c.value[s]==null?l||(l=Fs(t)):void 0;(u!==n||i!==f)&&(r=(n=u).copy()).on(a,i=f),c.on=r}}o(zd,"styleMaybeRemove");function fi(e,t,n){var r=(e+="")=="transform"?xs:Wn;return t==null?this.styleTween(e,Dd(e,r)).on("end.style."+e,Fs(e)):typeof t=="function"?this.styleTween(e,$d(e,r,Jt(this,"style."+e,t))).each(zd(this._id,e)):this.styleTween(e,Od(e,r,t),n).on("end.style."+e,null)}o(fi,"default");function Rd(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}o(Rd,"styleInterpolate");function Ld(e,t,n){var r,i;function s(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Rd(e,a,n)),r}return o(s,"tween"),s._value=t,s}o(Ld,"styleTween");function hi(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,Ld(e,t,n??""))}o(hi,"default");function Hd(e){return function(){this.textContent=e}}o(Hd,"textConstant");function Bd(e){return function(){var t=e(this);this.textContent=t??""}}o(Bd,"textFunction");function pi(e){return this.tween("text",typeof e=="function"?Bd(Jt(this,"text",e)):Hd(e==null?"":e+""))}o(pi,"default");function Vd(e){return function(t){this.textContent=e.call(this,t)}}o(Vd,"textInterpolate");function Fd(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Vd(i)),t}return o(r,"tween"),r._value=e,r}o(Fd,"textTween");function mi(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,Fd(e))}o(mi,"default");function gi(){for(var e=this._name,t=this._id,n=_o(),r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var f=Ce(c,t);Qe(c,e,n,u,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Ae(r,this._parents,e,n)}o(gi,"default");function yi(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,a){var l={value:a},c={value:o(function(){--i===0&&s()},"value")};n.each(function(){var u=Ne(this,r),f=u.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),i===0&&s()})}o(yi,"default");var Yd=0;function Ae(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}o(Ae,"Transition");function Ys(e){return qe().transition(e)}o(Ys,"transition");function _o(){return++Yd}o(_o,"newId");var Je=qe.prototype;Ae.prototype=Ys.prototype={constructor:Ae,select:ci,selectAll:ui,selectChild:Je.selectChild,selectChildren:Je.selectChildren,filter:ii,merge:si,selection:di,transition:gi,call:Je.call,nodes:Je.nodes,node:Je.node,size:Je.size,empty:Je.empty,each:Je.each,on:ai,attr:jr,attrTween:ei,style:fi,styleTween:hi,text:pi,textTween:mi,remove:li,tween:Jr,delay:ti,duration:ni,ease:oi,easeVarying:ri,end:yi,[Symbol.iterator]:Je[Symbol.iterator]};function No(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}o(No,"cubicInOut");var Wd={time:null,delay:0,duration:250,ease:No};function Xd(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(Xd,"inherit");function xi(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=_o(),(n=Wd).time=Bn(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var a=r[s],l=a.length,c,u=0;u<l;++u)(c=a[u])&&Qe(c,e,t,u,a,n||Xd(c,t));return new Ae(r,this._parents,e,t)}o(xi,"default");qe.prototype.interrupt=Qr;qe.prototype.transition=xi;var Xn=o(e=>()=>e,"default");function wi(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(wi,"ZoomEvent");function Ve(e,t,n){this.k=e,this.x=t,this.y=n}o(Ve,"Transform");Ve.prototype={constructor:Ve,scale:o(function(e){return e===1?this:new Ve(this.k*e,this.x,this.y)},"scale"),translate:o(function(e,t){return e===0&t===0?this:new Ve(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 At=new Ve(1,0,0);Zn.prototype=Ve.prototype;function Zn(e){for(;!e.__zoom;)if(!(e=e.parentNode))return At;return e.__zoom}o(Zn,"transform");function Io(e){e.stopImmediatePropagation()}o(Io,"nopropagation");function Dt(e){e.preventDefault(),e.stopImmediatePropagation()}o(Dt,"default");function Zd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}o(Zd,"defaultFilter");function Ud(){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(Ud,"defaultExtent");function Ws(){return this.__zoom||At}o(Ws,"defaultTransform");function Gd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}o(Gd,"defaultWheelDelta");function qd(){return navigator.maxTouchPoints||"ontouchstart"in this}o(qd,"defaultTouchable");function Kd(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(Kd,"defaultConstrain");function Un(){var e=Zd,t=Ud,n=Kd,r=Gd,i=qd,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Ut,u=Pt("start","zoom","end"),f,d,h,p=500,m=150,v=0,x=10;function y(b){b.property("__zoom",Ws).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",Y).filter(i).on("touchstart.zoom",P).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}o(y,"zoom"),y.transform=function(b,E,C,M){var z=b.selection?b.selection():b;z.property("__zoom",Ws),b!==z?I(b,E,C,M):z.interrupt().each(function(){_(this,arguments).event(M).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},y.scaleBy=function(b,E,C,M){y.scaleTo(b,function(){var z=this.__zoom.k,D=typeof E=="function"?E.apply(this,arguments):E;return z*D},C,M)},y.scaleTo=function(b,E,C,M){y.transform(b,function(){var z=t.apply(this,arguments),D=this.__zoom,H=C==null?w(z):typeof C=="function"?C.apply(this,arguments):C,F=D.invert(H),B=typeof E=="function"?E.apply(this,arguments):E;return n(g(S(D,B),H,F),z,a)},C,M)},y.translateBy=function(b,E,C,M){y.transform(b,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),a)},null,M)},y.translateTo=function(b,E,C,M,z){y.transform(b,function(){var D=t.apply(this,arguments),H=this.__zoom,F=M==null?w(D):typeof M=="function"?M.apply(this,arguments):M;return n(At.translate(F[0],F[1]).scale(H.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof C=="function"?-C.apply(this,arguments):-C),D,a)},M,z)};function S(b,E){return E=Math.max(s[0],Math.min(s[1],E)),E===b.k?b:new Ve(E,b.x,b.y)}o(S,"scale");function g(b,E,C){var M=E[0]-C[0]*b.k,z=E[1]-C[1]*b.k;return M===b.x&&z===b.y?b:new Ve(b.k,M,z)}o(g,"translate");function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}o(w,"centroid");function I(b,E,C,M){b.on("start.zoom",function(){_(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(M).end()}).tween("zoom",function(){var z=this,D=arguments,H=_(z,D).event(M),F=t.apply(z,D),B=C==null?w(F):typeof C=="function"?C.apply(z,D):C,U=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),X=z.__zoom,W=typeof E=="function"?E.apply(z,D):E,j=c(X.invert(B).concat(U/X.k),W.invert(B).concat(U/W.k));return function(K){if(K===1)K=W;else{var L=j(K),Z=U/L[2];K=new Ve(Z,B[0]-L[0]*Z,B[1]-L[1]*Z)}H.zoom(null,K)}})}o(I,"schedule");function _(b,E,C){return!C&&b.__zooming||new T(b,E)}o(_,"gesture");function T(b,E){this.that=b,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,E),this.taps=0}o(T,"Gesture"),T.prototype={event:o(function(b){return b&&(this.sourceEvent=b),this},"event"),start:o(function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},"start"),zoom:o(function(b,E){return this.mouse&&b!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},"zoom"),end:o(function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},"end"),emit:o(function(b){var E=Ee(this.that).datum();u.call(b,this.that,new wi(b,{sourceEvent:this.sourceEvent,target:y,type:b,transform:this.that.__zoom,dispatch:u}),E)},"emit")};function k(b,...E){if(!e.apply(this,arguments))return;var C=_(this,E).event(b),M=this.__zoom,z=Math.max(s[0],Math.min(s[1],M.k*Math.pow(2,r.apply(this,arguments)))),D=Me(b);if(C.wheel)(C.mouse[0][0]!==D[0]||C.mouse[0][1]!==D[1])&&(C.mouse[1]=M.invert(C.mouse[0]=D)),clearTimeout(C.wheel);else{if(M.k===z)return;C.mouse=[D,M.invert(D)],xt(this),C.start()}Dt(b),C.wheel=setTimeout(H,m),C.zoom("mouse",n(g(S(M,z),C.mouse[0],C.mouse[1]),C.extent,a));function H(){C.wheel=null,C.end()}o(H,"wheelidled")}o(k,"wheeled");function A(b,...E){if(h||!e.apply(this,arguments))return;var C=b.currentTarget,M=_(this,E,!0).event(b),z=Ee(b.view).on("mousemove.zoom",B,!0).on("mouseup.zoom",U,!0),D=Me(b,C),H=b.clientX,F=b.clientY;Kt(b.view),Io(b),M.mouse=[D,this.__zoom.invert(D)],xt(this),M.start();function B(X){if(Dt(X),!M.moved){var W=X.clientX-H,j=X.clientY-F;M.moved=W*W+j*j>v}M.event(X).zoom("mouse",n(g(M.that.__zoom,M.mouse[0]=Me(X,C),M.mouse[1]),M.extent,a))}o(B,"mousemoved");function U(X){z.on("mousemove.zoom mouseup.zoom",null),kn(X.view,M.moved),Dt(X),M.event(X).end()}o(U,"mouseupped")}o(A,"mousedowned");function Y(b,...E){if(e.apply(this,arguments)){var C=this.__zoom,M=Me(b.changedTouches?b.changedTouches[0]:b,this),z=C.invert(M),D=C.k*(b.shiftKey?.5:2),H=n(g(S(C,D),M,z),t.apply(this,E),a);Dt(b),l>0?Ee(this).transition().duration(l).call(I,H,M,b):Ee(this).call(y.transform,H,M,b)}}o(Y,"dblclicked");function P(b,...E){if(e.apply(this,arguments)){var C=b.touches,M=C.length,z=_(this,E,b.changedTouches.length===M).event(b),D,H,F,B;for(Io(b),H=0;H<M;++H)F=C[H],B=Me(F,this),B=[B,this.__zoom.invert(B),F.identifier],z.touch0?!z.touch1&&z.touch0[2]!==B[2]&&(z.touch1=B,z.taps=0):(z.touch0=B,D=!0,z.taps=1+!!f);f&&(f=clearTimeout(f)),D&&(z.taps<2&&(d=B[0],f=setTimeout(function(){f=null},p)),xt(this),z.start())}}o(P,"touchstarted");function R(b,...E){if(this.__zooming){var C=_(this,E).event(b),M=b.changedTouches,z=M.length,D,H,F,B;for(Dt(b),D=0;D<z;++D)H=M[D],F=Me(H,this),C.touch0&&C.touch0[2]===H.identifier?C.touch0[0]=F:C.touch1&&C.touch1[2]===H.identifier&&(C.touch1[0]=F);if(H=C.that.__zoom,C.touch1){var U=C.touch0[0],X=C.touch0[1],W=C.touch1[0],j=C.touch1[1],K=(K=W[0]-U[0])*K+(K=W[1]-U[1])*K,L=(L=j[0]-X[0])*L+(L=j[1]-X[1])*L;H=S(H,Math.sqrt(K/L)),F=[(U[0]+W[0])/2,(U[1]+W[1])/2],B=[(X[0]+j[0])/2,(X[1]+j[1])/2]}else if(C.touch0)F=C.touch0[0],B=C.touch0[1];else return;C.zoom("touch",n(g(H,F,B),C.extent,a))}}o(R,"touchmoved");function V(b,...E){if(this.__zooming){var C=_(this,E).event(b),M=b.changedTouches,z=M.length,D,H;for(Io(b),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),D=0;D<z;++D)H=M[D],C.touch0&&C.touch0[2]===H.identifier?delete C.touch0:C.touch1&&C.touch1[2]===H.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(H=Me(H,this),Math.hypot(d[0]-H[0],d[1]-H[1])<x)){var F=Ee(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return o(V,"touchended"),y.wheelDelta=function(b){return arguments.length?(r=typeof b=="function"?b:Xn(+b),y):r},y.filter=function(b){return arguments.length?(e=typeof b=="function"?b:Xn(!!b),y):e},y.touchable=function(b){return arguments.length?(i=typeof b=="function"?b:Xn(!!b),y):i},y.extent=function(b){return arguments.length?(t=typeof b=="function"?b:Xn([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),y):t},y.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],y):[s[0],s[1]]},y.translateExtent=function(b){return arguments.length?(a[0][0]=+b[0][0],a[1][0]=+b[1][0],a[0][1]=+b[0][1],a[1][1]=+b[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(b){return arguments.length?(n=b,y):n},y.duration=function(b){return arguments.length?(l=+b,y):l},y.interpolate=function(b){return arguments.length?(c=b,y):c},y.on=function(){var b=u.on.apply(u,arguments);return b===u?y:b},y.clickDistance=function(b){return arguments.length?(v=(b=+b)*b,y):Math.sqrt(v)},y.tapDistance=function(b){return arguments.length?(x=+b,y):x},y}o(Un,"default");var De={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")},on=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Ci=["Enter"," ","Escape"],_i={"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"},vt;(function(e){e.Strict="strict",e.Loose="loose"})(vt||(vt={}));var je;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(je||(je={}));var Ot;(function(e){e.Partial="partial",e.Full="full"})(Ot||(Ot={}));var Ni={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},Xe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Xe||(Xe={}));var tn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(tn||(tn={}));var J;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(J||(J={}));var Xs={[J.Left]:J.Right,[J.Right]:J.Left,[J.Top]:J.Bottom,[J.Bottom]:J.Top};function Ii(e){return e===null?null:e?"valid":"invalid"}o(Ii,"getConnectionStatus");var Mi=o(e=>"id"in e&&"source"in e&&"target"in e,"isEdgeBase"),ra=o(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),"isNodeBase"),Pi=o(e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),"isInternalNodeBase");var qn=o((e,t=[0,0])=>{let{width:n,height:r}=Ze(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"),Kn=o((e,t={nodeOrigin:[0,0]})=>{if(t.nodeLookup||console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};let n=e.reduce((r,i)=>{let s=typeof i=="string",a=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(i):Pi(i)?i:t.nodeLookup.get(i.id));let l=a?To(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Do(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Oo(n)},"getNodesBounds"),rn=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=Do(n,To(i)),r=!0)}),r?Oo(n):{x:0,y:0,width:0,height:0}},"getInternalNodesBounds"),ko=o((e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{let l=(t.x-n)/i,c=(t.y-r)/i,u=t.width/i,f=t.height/i,d=[];for(let h of e.values()){let{measured:p,selectable:m=!0,hidden:v=!1}=h;if(a&&!m||v)continue;let x=p.width??h.width??h.initialWidth??0,y=p.height??h.height??h.initialHeight??0,{x:S,y:g}=h.internals.positionAbsolute,w=ca(l,c,u,f,S,g,x,y),I=x*y,_=s&&w>0;(!h.internals.handleBounds||_||w>=I||h.dragging)&&d.push(h)}return d},"getNodesInside"),ia=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 Qd(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&(t?.includeHiddenNodes||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}o(Qd,"getFitViewNodes");async function sa({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;let l=Qd(e,a),c=rn(l),u=Lt(c,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(sa,"fitViewport");function Ti({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){let a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},f=a.origin??r,d=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)s?.("005",De.error005());else{let p=l.measured.width,m=l.measured.height;p&&m&&(d=[[c,u],[c+p,u+m]])}else l&&Rt(a.extent)&&(d=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);let h=Rt(d)?$t(t,d,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&s?.("015",De.error015()),{position:{x:h.x-c+(a.measured.width??0)*f[0],y:h.y-u+(a.measured.height??0)*f[1]},positionAbsolute:h}}o(Ti,"calculateNodePosition");async function aa({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let s=new Set(e.map(h=>h.id)),a=[];for(let h of n){if(h.deletable===!1)continue;let p=s.has(h.id),m=!p&&h.parentId&&a.find(v=>v.id===h.parentId);(p||m)&&a.push(h)}let l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),f=ia(a,c);for(let h of c)l.has(h.id)&&!f.find(m=>m.id===h.id)&&f.push(h);if(!i)return{edges:f,nodes:a};let d=await i({nodes:a,edges:f});return typeof d=="boolean"?d?{edges:f,nodes:a}:{edges:[],nodes:[]}:d}o(aa,"getElementsToRemove");var nn=o((e,t=0,n=1)=>Math.min(Math.max(e,t),n),"clamp"),$t=o((e={x:0,y:0},t,n)=>({x:nn(e.x,t[0][0],t[1][0]-(n?.width??0)),y:nn(e.y,t[0][1],t[1][1]-(n?.height??0))}),"clampPosition");function la(e,t,n){let{width:r,height:i}=Ze(n),{x:s,y:a}=n.internals.positionAbsolute;return $t(e,[[s,a],[s+r,a+i]],t)}o(la,"clampPositionToParent");var Zs=o((e,t,n)=>e<t?nn(Math.abs(e-t),1,t)/t:e>n?-nn(Math.abs(e-n),1,t)/t:0,"calcAutoPanVelocity"),Ao=o((e,t,n=15,r=40)=>{let i=Zs(e.x,r,t.width-r)*n,s=Zs(e.y,r,t.height-r)*n;return[i,s]},"calcAutoPan"),Do=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"),Ei=o(({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),"rectToBox"),Oo=o(({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),"boxToRect"),sn=o((e,t=[0,0])=>{let{x:n,y:r}=Pi(e)?e.internals.positionAbsolute:qn(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"),To=o((e,t=[0,0])=>{let{x:n,y:r}=Pi(e)?e.internals.positionAbsolute:qn(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"),ki=o((e,t)=>Oo(Do(Ei(e),Ei(t))),"getBoundsOfRects"),ca=o((e,t,n,r,i,s,a,l)=>{let c=Math.max(0,Math.min(e+n,i+a)-Math.max(e,i)),u=Math.max(0,Math.min(t+r,s+l)-Math.max(t,s));return Math.ceil(c*u)},"getRectsOverlappingArea"),Qn=o((e,t)=>ca(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),"getOverlappingArea"),Ai=o(e=>Le(e.width)&&Le(e.height)&&Le(e.x)&&Le(e.y),"isRectObject"),Le=o(e=>!isNaN(e)&&isFinite(e),"isNumeric"),Di=o((e,t)=>(n,r)=>{console.warn(`[${e}]: ${r} Help: ${t}error#${n}`)},"createDevWarn"),an=o((e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),"snapPosition"),ln=o(({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{let l={x:(e-n)/i,y:(t-r)/i};return s?an(l,a):l},"pointToRendererPoint"),zt=o(({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),"rendererPointToPoint");function jt(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(jt,"parsePadding");function Jd(e,t,n){if(typeof e=="string"||typeof e=="number"){let r=jt(e,n),i=jt(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){let r=jt(e.top??e.y??0,n),i=jt(e.bottom??e.y??0,n),s=jt(e.left??e.x??0,t),a=jt(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(Jd,"parsePaddings");function jd(e,t,n,r,i,s){let{x:a,y:l}=zt(e,[t,n,r]),{x:c,y:u}=zt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=i-c,d=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(d)}}o(jd,"calculateAppliedPaddings");var Lt=o((e,t,n,r,i,s)=>{let a=Jd(s,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),f=nn(u,r,i),d=e.x+e.width/2,h=e.y+e.height/2,p=t/2-d*f,m=n/2-h*f,v=jd(e,p,m,f,t,n),x={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:p-x.left+x.right,y:m-x.top+x.bottom,zoom:f}},"getViewportForBounds"),cn=o(()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,"isMacOs");function Rt(e){return e!=null&&e!=="parent"}o(Rt,"isCoordinateExtent");function Ze(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}o(Ze,"getNodeDimensions");function Oi(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}o(Oi,"nodeHasDimensions");function $i(e,t={width:0,height:0},n,r,i){let s={...e},a=r.get(n);if(a){let l=a.origin||i;s.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}o($i,"evaluateAbsolutePosition");function zi(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}o(zi,"areSetsEqual");function ua(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}o(ua,"withResolvers");function da(e){return{..._i,...e||{}}}o(da,"mergeAriaLabelConfig");function Gn(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:s,y:a}=He(e),l=ln({x:s-(i?.left??0),y:a-(i?.top??0)},r),{x:c,y:u}=n?an(l,t):l;return{xSnapped:c,ySnapped:u,...l}}o(Gn,"getPointerPosition");var $o=o(e=>({width:e.offsetWidth,height:e.offsetHeight}),"getDimensions"),Ri=o(e=>e?.getRootNode?.()||window?.document,"getHostForElement"),ef=["INPUT","SELECT","TEXTAREA"];function Li(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:ef.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}o(Li,"isInputDOMNode");var Hi=o(e=>"clientX"in e,"isMouseEvent"),He=o((e,t)=>{let n=Hi(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"),Us=o((e,t,n,r,i)=>{let s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{let l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...$o(a)}})},"getHandleBounds");function zo({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){let c=e*.125+i*.375+a*.375+n*.125,u=t*.125+s*.375+l*.375+r*.125,f=Math.abs(c-e),d=Math.abs(u-t);return[c,u,f,d]}o(zo,"getBezierEdgeCenter");function Mo(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}o(Mo,"calculateControlOffset");function Gs({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case J.Left:return[t-Mo(t-r,s),n];case J.Right:return[t+Mo(r-t,s),n];case J.Top:return[t,n-Mo(n-i,s)];case J.Bottom:return[t,n+Mo(i-n,s)]}}o(Gs,"getControlWithCurvature");function Ro({sourceX:e,sourceY:t,sourcePosition:n=J.Bottom,targetX:r,targetY:i,targetPosition:s=J.Top,curvature:a=.25}){let[l,c]=Gs({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,f]=Gs({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[d,h,p,m]=zo({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:f});return[`M${e},${t} C${l},${c} ${u},${f} ${r},${i}`,d,h,p,m]}o(Ro,"getBezierPath");function Bi({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,l=r<t?r+a:r-a;return[s,l,i,a]}o(Bi,"getEdgeCenter");function fa({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,l=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return a+l}o(fa,"getElevatedEdgeZIndex");function ha({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let s=Do(To(e),To(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 Qn(a,Oo(s))>0}o(ha,"isEdgeVisible");var tf=o(({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,"getEdgeId"),nf=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"),pa=o((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",De.error006()),t;let r=n.getEdgeId||tf,i;return Mi(e)?i={...e}:i={...e,id:r(e)},nf(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))},"addEdge");function Lo({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,s,a,l]=Bi({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,l]}o(Lo,"getStraightPath");var qs={[J.Left]:{x:-1,y:0},[J.Right]:{x:1,y:0},[J.Top]:{x:0,y:-1},[J.Bottom]:{x:0,y:1}},of=o(({source:e,sourcePosition:t=J.Bottom,target:n})=>t===J.Left||t===J.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"),Ks=o((e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),"distance");function rf({source:e,sourcePosition:t=J.Bottom,target:n,targetPosition:r=J.Top,center:i,offset:s,stepPosition:a}){let l=qs[t],c=qs[r],u={x:e.x+l.x*s,y:e.y+l.y*s},f={x:n.x+c.x*s,y:n.y+c.y*s},d=of({source:u,sourcePosition:t,target:f}),h=d.x!==0?"x":"y",p=d[h],m=[],v,x,y={x:0,y:0},S={x:0,y:0},[,,g,w]=Bi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(v=i.x??u.x+(f.x-u.x)*a,x=i.y??(u.y+f.y)/2):(v=i.x??(u.x+f.x)/2,x=i.y??u.y+(f.y-u.y)*a);let k=[{x:v,y:u.y},{x:v,y:f.y}],A=[{x:u.x,y:x},{x:f.x,y:x}];l[h]===p?m=h==="x"?k:A:m=h==="x"?A:k}else{let k=[{x:u.x,y:f.y}],A=[{x:f.x,y:u.y}];if(h==="x"?m=l.x===p?A:k:m=l.y===p?k:A,t===r){let b=Math.abs(e[h]-n[h]);if(b<=s){let E=Math.min(s-1,s-b);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*E:S[h]=(f[h]>n[h]?-1:1)*E}}if(t!==r){let b=h==="x"?"y":"x",E=l[h]===c[b],C=u[b]>f[b],M=u[b]<f[b];(l[h]===1&&(!E&&C||E&&M)||l[h]!==1&&(!E&&M||E&&C))&&(m=h==="x"?k:A)}let Y={x:u.x+y.x,y:u.y+y.y},P={x:f.x+S.x,y:f.y+S.y},R=Math.max(Math.abs(Y.x-m[0].x),Math.abs(P.x-m[0].x)),V=Math.max(Math.abs(Y.y-m[0].y),Math.abs(P.y-m[0].y));R>=V?(v=(Y.x+P.x)/2,x=m[0].y):(v=m[0].x,x=(Y.y+P.y)/2)}let I={x:u.x+y.x,y:u.y+y.y},_={x:f.x+S.x,y:f.y+S.y};return[[e,...I.x!==m[0].x||I.y!==m[0].y?[I]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],v,x,g,w]}o(rf,"getPoints");function sf(e,t,n,r){let i=Math.min(Ks(e,t)/2,Ks(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,f=e.y<n.y?1:-1;return`L ${s+i*u},${a}Q ${s},${a} ${s},${a+i*f}`}let l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${a+i*c}Q ${s},${a} ${s+i*l},${a}`}o(sf,"getBend");function Jn({sourceX:e,sourceY:t,sourcePosition:n=J.Bottom,targetX:r,targetY:i,targetPosition:s=J.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:f=.5}){let[d,h,p,m,v]=rf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:l,y:c},offset:u,stepPosition:f}),x=`M${d[0].x} ${d[0].y}`;for(let y=1;y<d.length-1;y++)x+=sf(d[y-1],d[y],d[y+1],a);return x+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[x,h,p,m,v]}o(Jn,"getSmoothStepPath");function Qs(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}o(Qs,"isNodeInitialized");function ma(e){let{sourceNode:t,targetNode:n}=e;if(!Qs(t)||!Qs(n))return null;let r=t.internals.handleBounds||Js(t.handles),i=n.internals.handleBounds||Js(n.handles),s=js(r?.source??[],e.sourceHandle),a=js(e.connectionMode===vt.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!s||!a)return e.onError?.("008",De.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let l=s?.position||J.Bottom,c=a?.position||J.Top,u=St(t,s,l),f=St(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}o(ma,"getEdgePosition");function Js(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(Js,"toHandleBounds");function St(e,t,n=J.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,s=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??Ze(e);if(r)return{x:i+a/2,y:s+l/2};switch(t?.position??n){case J.Top:return{x:i+a/2,y:s};case J.Right:return{x:i+a,y:s+l/2};case J.Bottom:return{x:i+a/2,y:s+l};case J.Left:return{x:i,y:s+l/2}}}o(St,"getHandlePosition");function js(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}o(js,"getHandle$1");function Ho(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}o(Ho,"getMarkerId");function ga(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let s=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){let u=Ho(c,t);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}o(ga,"createMarkerIds");var ya=1e3,af=10,Vi={nodeOrigin:[0,0],nodeExtent:on,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},lf={...Vi,checkEquality:!0};function Fi(e,t){let n={...e};for(let r in t)t[r]!==void 0&&(n[r]=t[r]);return n}o(Fi,"mergeObjects");function xa(e,t,n){let r=Fi(Vi,n);for(let i of e.values())if(i.parentId)Wi(i,e,t,r);else{let s=qn(i,r.nodeOrigin),a=Rt(i.extent)?i.extent:r.nodeExtent,l=$t(s,a,Ze(i));i.internals.positionAbsolute=l}}o(xa,"updateAbsolutePositions");function cf(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(cf,"parseHandles");function Yi(e){return e==="manual"}o(Yi,"isManualZIndexMode");function Bo(e,t,n,r={}){let i=Fi(lf,r),s={i:0},a=new Map(t),l=i?.elevateNodesOnSelect&&!Yi(i.zIndexMode)?ya:0,c=e.length>0,u=!1;t.clear(),n.clear();for(let f of e){let d=a.get(f.id);if(i.checkEquality&&f===d?.internals.userNode)t.set(f.id,d);else{let h=qn(f,i.nodeOrigin),p=Rt(f.extent)?f.extent:i.nodeExtent,m=$t(h,p,Ze(f));d={...i.defaults,...f,measured:{width:f.measured?.width,height:f.measured?.height},internals:{positionAbsolute:m,handleBounds:cf(f,d),z:wa(f,l,i.zIndexMode),userNode:f}},t.set(f.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(c=!1),f.parentId&&Wi(d,t,n,r,s),u||=f.selected??!1}return{nodesInitialized:c,hasSelectedNodes:u}}o(Bo,"adoptUserNodes");function uf(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(uf,"updateParentLookup");function Wi(e,t,n,r,i){let{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Fi(Vi,r),u=e.parentId,f=t.get(u);if(!f){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}uf(e,n),i&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++i.i,f.internals.z=f.internals.z+i.i*af),i&&f.internals.rootParentIndex!==void 0&&(i.i=f.internals.rootParentIndex);let d=s&&!Yi(c)?ya:0,{x:h,y:p,z:m}=df(e,f,a,l,d,c),{positionAbsolute:v}=e.internals,x=h!==v.x||p!==v.y;(x||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:h,y:p}:v,z:m}})}o(Wi,"updateChildNode");function wa(e,t,n){let r=Le(e.zIndex)?e.zIndex:0;return Yi(n)?r:r+(e.selected?t:0)}o(wa,"calculateZ");function df(e,t,n,r,i,s){let{x:a,y:l}=t.internals.positionAbsolute,c=Ze(e),u=qn(e,n),f=Rt(e.extent)?$t(u,e.extent,c):u,d=$t({x:a+f.x,y:l+f.y},r,c);e.extent==="parent"&&(d=la(d,c,t));let h=wa(e,i,s),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=h?p+1:h}}o(df,"calculateChildXYZ");function Vo(e,t,n,r=[0,0]){let i=[],s=new Map;for(let a of e){let l=t.get(a.parentId);if(!l)continue;let c=s.get(a.parentId)?.expandedRect??sn(l),u=ki(c,a.rect);s.set(a.parentId,{expandedRect:u,parent:l})}return s.size>0&&s.forEach(({expandedRect:a,parent:l},c)=>{let u=l.internals.positionAbsolute,f=Ze(l),d=l.origin??r,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,p=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,m=Math.max(f.width,Math.round(a.width)),v=Math.max(f.height,Math.round(a.height)),x=(m-f.width)*d[0],y=(v-f.height)*d[1];(h>0||p>0||x||y)&&(i.push({id:c,type:"position",position:{x:l.position.x-h+x,y:l.position.y-p+y}}),n.get(c)?.forEach(S=>{e.some(g=>g.id===S.id)||i.push({id:S.id,type:"position",position:{x:S.position.x+h,y:S.position.y+p}})})),(f.width<a.width||f.height<a.height||h||p)&&i.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:m+(h?d[0]*h-x:0),height:v+(p?d[1]*p-y:0)}})}),i}o(Vo,"handleExpandParent");function ba(e,t,n,r,i,s,a){let l=r?.querySelector(".xyflow__viewport"),c=!1;if(!l)return{changes:[],updatedInternals:c};let u=[],f=window.getComputedStyle(l),{m22:d}=new window.DOMMatrixReadOnly(f.transform),h=[];for(let p of e.values()){let m=t.get(p.id);if(!m)continue;if(m.hidden){t.set(m.id,{...m,internals:{...m.internals,handleBounds:void 0}}),c=!0;continue}let v=$o(p.nodeElement),x=m.measured.width!==v.width||m.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!m.internals.handleBounds||p.force))){let S=p.nodeElement.getBoundingClientRect(),g=Rt(m.extent)?m.extent:s,{positionAbsolute:w}=m.internals;m.parentId&&m.extent==="parent"?w=la(w,v,t.get(m.parentId)):g&&(w=$t(w,g,v));let I={...m,measured:v,internals:{...m.internals,positionAbsolute:w,handleBounds:{source:Us("source",p.nodeElement,S,d,m.id),target:Us("target",p.nodeElement,S,d,m.id)}}};t.set(m.id,I),m.parentId&&Wi(I,t,n,{nodeOrigin:i,zIndexMode:a}),c=!0,x&&(u.push({id:m.id,type:"dimensions",dimensions:v}),m.expandParent&&m.parentId&&h.push({id:m.id,parentId:m.parentId,rect:sn(I,i)}))}}if(h.length>0){let p=Vo(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}o(ba,"updateNodeInternals");async function va({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(va,"panBy");function ea(e,t,n,r,i,s){let a=i,l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${i}-${e}`;let c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),s){a=`${i}-${e}-${s}`;let u=r.get(a)||new Map;r.set(a,u.set(n,t))}}o(ea,"addConnectionToLookup");function Xi(e,t,n){e.clear(),t.clear();for(let r of n){let{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${s}-${l}`,f=`${s}-${l}--${i}-${a}`;ea("source",c,f,e,i,a),ea("target",c,u,e,s,l),t.set(r.id,r)}}o(Xi,"updateConnectionLookup");function Sa(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Sa(n,t):!1}o(Sa,"isParentSelected");function ta(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(ta,"hasSelector");function ff(e,t,n,r){let i=new Map;for(let[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!Sa(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){let l=e.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}o(ff,"getDragItems");function bi({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[a,l]of t){let c=n.get(a)?.internals.userNode;c&&i.push({...c,position:l.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(bi,"getEventHandlerParams");function hf({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=an(s,t);return{x:a.x-s.x,y:a.y-s.y}}o(hf,"calculateSnapOffset");function Ea({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},f=null,d=!1,h=null,p=!1,m=!1,v=null;function x({noDragClassName:S,handleSelector:g,domNode:w,isSelectable:I,nodeId:_,nodeClickDistance:T=0}){h=Ee(w);function k({x:R,y:V}){let{nodeLookup:b,nodeExtent:E,snapGrid:C,snapToGrid:M,nodeOrigin:z,onNodeDrag:D,onSelectionDrag:H,onError:F,updateNodePositions:B}=t();s={x:R,y:V};let U=!1,X=l.size>1,W=X&&E?Ei(rn(l)):null,j=X&&M?hf({dragItems:l,snapGrid:C,x:R,y:V}):null;for(let[K,L]of l){if(!b.has(K))continue;let Z={x:R-L.distance.x,y:V-L.distance.y};M&&(Z=j?{x:Math.round(Z.x+j.x),y:Math.round(Z.y+j.y)}:an(Z,C));let te=null;if(X&&E&&!L.extent&&W){let{positionAbsolute:q}=L.internals,ne=q.x-W.x+E[0][0],oe=q.x+L.measured.width-W.x2+E[1][0],se=q.y-W.y+E[0][1],ue=q.y+L.measured.height-W.y2+E[1][1];te=[[ne,se],[oe,ue]]}let{position:ee,positionAbsolute:G}=Ti({nodeId:K,nextPosition:Z,nodeLookup:b,nodeExtent:te||E,nodeOrigin:z,onError:F});U=U||L.position.x!==ee.x||L.position.y!==ee.y,L.position=ee,L.internals.positionAbsolute=G}if(m=m||U,!!U&&(B(l,!0),v&&(r||D||!_&&H))){let[K,L]=bi({nodeId:_,dragItems:l,nodeLookup:b});r?.(v,l,K,L),D?.(v,K,L),_||H?.(v,L)}}o(k,"updateNodes");async function A(){if(!f)return;let{transform:R,panBy:V,autoPanSpeed:b,autoPanOnNodeDrag:E}=t();if(!E){c=!1,cancelAnimationFrame(a);return}let[C,M]=Ao(u,f,b);(C!==0||M!==0)&&(s.x=(s.x??0)-C/R[2],s.y=(s.y??0)-M/R[2],await V({x:C,y:M})&&k(s)),a=requestAnimationFrame(A)}o(A,"autoPan");function Y(R){let{nodeLookup:V,multiSelectionActive:b,nodesDraggable:E,transform:C,snapGrid:M,snapToGrid:z,selectNodesOnDrag:D,onNodeDragStart:H,onSelectionDragStart:F,unselectNodesAndEdges:B}=t();d=!0,(!D||!I)&&!b&&_&&(V.get(_)?.selected||B()),I&&D&&_&&e?.(_);let U=Gn(R.sourceEvent,{transform:C,snapGrid:M,snapToGrid:z,containerBounds:f});if(s=U,l=ff(V,E,U,_),l.size>0&&(n||H||!_&&F)){let[X,W]=bi({nodeId:_,dragItems:l,nodeLookup:V});n?.(R.sourceEvent,l,X,W),H?.(R.sourceEvent,X,W),_||F?.(R.sourceEvent,W)}}o(Y,"startDrag");let P=On().clickDistance(T).on("start",R=>{let{domNode:V,nodeDragThreshold:b,transform:E,snapGrid:C,snapToGrid:M}=t();f=V?.getBoundingClientRect()||null,p=!1,m=!1,v=R.sourceEvent,b===0&&Y(R),s=Gn(R.sourceEvent,{transform:E,snapGrid:C,snapToGrid:M,containerBounds:f}),u=He(R.sourceEvent,f)}).on("drag",R=>{let{autoPanOnNodeDrag:V,transform:b,snapGrid:E,snapToGrid:C,nodeDragThreshold:M,nodeLookup:z}=t(),D=Gn(R.sourceEvent,{transform:b,snapGrid:E,snapToGrid:C,containerBounds:f});if(v=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||_&&!z.has(_))&&(p=!0),!p){if(!c&&V&&d&&(c=!0,A()),!d){let H=He(R.sourceEvent,f),F=H.x-u.x,B=H.y-u.y;Math.sqrt(F*F+B*B)>M&&Y(R)}(s.x!==D.xSnapped||s.y!==D.ySnapped)&&l&&d&&(u=He(R.sourceEvent,f),k(D))}}).on("end",R=>{if(!d||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,d=!1,cancelAnimationFrame(a),l.size>0){let{nodeLookup:V,updateNodePositions:b,onNodeDragStop:E,onSelectionDragStop:C}=t();if(m&&(b(l,!1),m=!1),i||E||!_&&C){let[M,z]=bi({nodeId:_,dragItems:l,nodeLookup:V,dragging:!1});i?.(R.sourceEvent,l,M,z),E?.(R.sourceEvent,M,z),_||C?.(R.sourceEvent,z)}}}).filter(R=>{let V=R.target;return!R.button&&(!S||!ta(V,`.${S}`,w))&&(!g||ta(V,g,w))});h.call(P)}o(x,"update");function y(){h?.on(".drag",null)}return o(y,"destroy"),{update:x,destroy:y}}o(Ea,"XYDrag");function pf(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())Qn(i,sn(s))>0&&r.push(s);return r}o(pf,"getNodesWithinDistance");var mf=250;function gf(e,t,n,r){let i=[],s=1/0,a=pf(e,n,t+mf);for(let l of a){let c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(let u of c){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;let{x:f,y:d}=St(l,u,u.position,!0),h=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(d-e.y,2));h>t||(h<s?(i=[{...u,x:f,y:d}],s=h):h===s&&i.push({...u,x:f,y:d}))}}if(!i.length)return null;if(i.length>1){let l=r.type==="source"?"target":"source";return i.find(c=>c.type===l)??i[0]}return i[0]}o(gf,"getClosestHandle");function Ca(e,t,n,r,i,s=!1){let a=r.get(e);if(!a)return null;let l=i==="strict"?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],c=(n?l?.find(u=>u.id===n):l?.[0])??null;return c&&s?{...c,...St(a,c,c.position,!0)}:c}o(Ca,"getHandle");function _a(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}o(_a,"getHandleType");function yf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}o(yf,"isConnectionValid");var Na=o(()=>!0,"alwaysValid");function xf(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:f,flowId:d,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:v,onConnectEnd:x,isValidConnection:y=Na,onReconnectEnd:S,updateConnection:g,getTransform:w,getFromHandle:I,autoPanSpeed:_,dragThreshold:T=1,handleDomNode:k}){let A=Ri(e.target),Y=0,P,{x:R,y:V}=He(e),b=_a(s,k),E=l?.getBoundingClientRect(),C=!1;if(!E||!b)return;let M=Ca(i,b,r,c,t);if(!M)return;let z=He(e,E),D=!1,H=null,F=!1,B=null;function U(){if(!f||!E)return;let[ee,G]=Ao(z,E,_);h({x:ee,y:G}),Y=requestAnimationFrame(U)}o(U,"autoPan");let X={...M,nodeId:i,type:b,position:M.position},W=c.get(i),K={inProgress:!0,isValid:null,from:St(W,X,J.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:W,to:z,toHandle:null,toPosition:Xs[X.position],toNode:null,pointer:z};function L(){C=!0,g(K),m?.(e,{nodeId:i,handleId:r,handleType:b})}o(L,"startConnection"),T===0&&L();function Z(ee){if(!C){let{x:ue,y:ve}=He(ee),he=ue-R,pe=ve-V;if(!(he*he+pe*pe>T*T))return;L()}if(!I()||!X){te(ee);return}let G=w();z=He(ee,E),P=gf(ln(z,G,!1,[1,1]),n,c,X),D||(U(),D=!0);let q=Ia(ee,{handle:P,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:A,lib:u,flowId:d,nodeLookup:c});B=q.handleDomNode,H=q.connection,F=yf(!!P,q.isValid);let ne=c.get(i),oe=ne?St(ne,X,J.Left,!0):K.from,se={...K,from:oe,isValid:F,to:q.toHandle&&F?zt({x:q.toHandle.x,y:q.toHandle.y},G):z,toHandle:q.toHandle,toPosition:F&&q.toHandle?q.toHandle.position:Xs[X.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:z};g(se),K=se}o(Z,"onPointerMove");function te(ee){if(!("touches"in ee&&ee.touches.length>0)){if(C){(P||B)&&H&&F&&v?.(H);let{inProgress:G,...q}=K,ne={...q,toPosition:K.toHandle?K.toPosition:null};x?.(ee,ne),s&&S?.(ee,ne)}p(),cancelAnimationFrame(Y),D=!1,F=!1,H=null,B=null,A.removeEventListener("mousemove",Z),A.removeEventListener("mouseup",te),A.removeEventListener("touchmove",Z),A.removeEventListener("touchend",te)}}o(te,"onPointerUp"),A.addEventListener("mousemove",Z),A.addEventListener("mouseup",te),A.addEventListener("touchmove",Z),A.addEventListener("touchend",te)}o(xf,"onPointerDown");function Ia(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=Na,nodeLookup:f}){let d=s==="target",h=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=He(e),v=a.elementFromPoint(p,m),x=v?.classList.contains(`${l}-flow__handle`)?v:h,y={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){let S=_a(void 0,x),g=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),I=x.classList.contains("connectable"),_=x.classList.contains("connectableend");if(!g||!S)return y;let T={source:d?g:r,sourceHandle:d?w:i,target:d?r:g,targetHandle:d?i:w};y.connection=T;let A=I&&_&&(n===vt.Strict?d&&S==="source"||!d&&S==="target":g!==r||w!==i);y.isValid=A&&u(T),y.toHandle=Ca(g,S,w,f,n,!0)}return y}o(Ia,"isValidHandle");var Fo={onPointerDown:xf,isValid:Ia};function Ma({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Ee(e);function s({translateExtent:l,width:c,height:u,zoomStep:f=1,pannable:d=!0,zoomable:h=!0,inversePan:p=!1}){let m=o(g=>{if(g.sourceEvent.type!=="wheel"||!t)return;let w=n(),I=g.sourceEvent.ctrlKey&&cn()?10:1,_=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*f,T=w[2]*Math.pow(2,_*I);t.scaleTo(T)},"zoomHandler"),v=[0,0],x=o(g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(v=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},"panStartHandler"),y=o(g=>{let w=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;let I=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],_=[I[0]-v[0],I[1]-v[1]];v=I;let T=r()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),k={x:w[0]-_[0]*T,y:w[1]-_[1]*T},A=[[0,0],[c,u]];t.setViewportConstrained({x:k.x,y:k.y,zoom:w[2]},A,l)},"panHandler"),S=Un().on("start",x).on("zoom",d?y:null).on("zoom.wheel",h?m:null);i.call(S,{})}o(s,"update");function a(){i.on("zoom",null)}return o(a,"destroy"),{update:s,destroy:a,pointer:Me}}o(Ma,"XYMinimap");var Yo=o(e=>({x:e.x,y:e.y,zoom:e.k}),"transformToViewport"),vi=o(({x:e,y:t,zoom:n})=>At.translate(e,t).scale(n),"viewportToTransform"),en=o((e,t)=>e.target.closest(`.${t}`),"isWrappedWithClass"),Pa=o((e,t)=>t===2&&Array.isArray(e)&&e.includes(2),"isRightClickPan"),wf=o(e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,"defaultEase"),Si=o((e,t=0,n=wf,r=()=>{})=>{let i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},"getD3Transition"),Ta=o(e=>{let t=e.ctrlKey&&cn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},"wheelDelta");function bf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return f=>{if(en(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();let d=n.property("__zoom").k||1;if(f.ctrlKey&&a){let x=Me(f),y=Ta(f),S=d*Math.pow(2,y);r.scaleTo(n,S,x,f);return}let h=f.deltaMode===1?20:1,p=i===je.Vertical?0:f.deltaX*h,m=i===je.Horizontal?0:f.deltaY*h;!cn()&&f.shiftKey&&i!==je.Vertical&&(p=f.deltaY*h,m=0),r.translateBy(n,-(p/d)*s,-(m/d)*s,{internal:!0});let v=Yo(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(f,v),e.panScrollTimeout=setTimeout(()=>{u?.(f,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(f,v))}}o(bf,"createPanOnScrollHandler");function vf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,l=en(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,i)}}o(vf,"createZoomOnScrollHandler");function Sf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=Yo(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(Sf,"createPanZoomStartHandler");function Ef({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{e.usedRightMouseButton=!!(n&&Pa(t,e.mouseButton??0)),s.sourceEvent?.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!s.sourceEvent?.internal&&i?.(s.sourceEvent,Yo(s.transform))}}o(Ef,"createPanZoomHandler");function Cf({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,s&&Pa(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let l=Yo(a.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(a.sourceEvent,l)},n?150:0)}}}o(Cf,"createPanZoomEndHandler");function _f({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:f}){return d=>{let h=e||t,p=n&&d.ctrlKey,m=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(en(d,`${u}-flow__node`)||en(d,`${u}-flow__edge`)))return!0;if(!r&&!h&&!i&&!s&&!n||a||f&&!m||en(d,l)&&m||en(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!h&&!i&&!p&&m||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;let v=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&v}}o(_f,"createFilter");function ka({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){let u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),d=Un().scaleExtent([t,n]).translateExtent(r),h=Ee(e).call(d);S({x:i.x,y:i.y,zoom:nn(i.zoom,t,n)},[[0,0],[f.width,f.height]],r);let p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");d.wheelDelta(Ta);async function v(P,R){return h?new Promise(V=>{d?.interpolate(R?.interpolate==="linear"?uo:Ut).transform(Si(h,R?.duration,R?.ease,()=>V(!0)),P)}):!1}o(v,"setTransform");function x({noWheelClassName:P,noPanClassName:R,onPaneContextMenu:V,userSelectionActive:b,panOnScroll:E,panOnDrag:C,panOnScrollMode:M,panOnScrollSpeed:z,preventScrolling:D,zoomOnPinch:H,zoomOnScroll:F,zoomOnDoubleClick:B,zoomActivationKeyPressed:U,lib:X,onTransformChange:W,connectionInProgress:j,paneClickDistance:K,selectionOnDrag:L}){b&&!u.isZoomingOrPanning&&y();let Z=E&&!U&&!b;d.clickDistance(L?1/0:!Le(K)||K<0?0:K);let te=Z?bf({zoomPanValues:u,noWheelClassName:P,d3Selection:h,d3Zoom:d,panOnScrollMode:M,panOnScrollSpeed:z,zoomOnPinch:H,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):vf({noWheelClassName:P,preventScrolling:D,d3ZoomHandler:p});h.on("wheel.zoom",te,{passive:!1});let ee=Sf({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});d.on("start",ee);let G=Ef({zoomPanValues:u,panOnDrag:C,onPaneContextMenu:!!V,onPanZoom:s,onTransformChange:W});d.on("zoom",G);let q=Cf({zoomPanValues:u,panOnDrag:C,panOnScroll:E,onPaneContextMenu:V,onPanZoomEnd:l,onDraggingChange:c});d.on("end",q);let ne=_f({zoomActivationKeyPressed:U,panOnDrag:C,zoomOnScroll:F,panOnScroll:E,zoomOnDoubleClick:B,zoomOnPinch:H,userSelectionActive:b,noPanClassName:R,noWheelClassName:P,lib:X,connectionInProgress:j});d.filter(ne),B?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}o(x,"update");function y(){d.on("zoom",null)}o(y,"destroy");async function S(P,R,V){let b=vi(P),E=d?.constrain()(b,R,V);return E&&await v(E),E}o(S,"setViewportConstrained");async function g(P,R){let V=vi(P);return await v(V,R),V}o(g,"setViewport");function w(P){if(h){let R=vi(P),V=h.property("__zoom");(V.k!==P.zoom||V.x!==P.x||V.y!==P.y)&&d?.transform(h,R,null,{sync:!0})}}o(w,"syncViewport");function I(){let P=h?Zn(h.node()):{x:0,y:0,k:1};return{x:P.x,y:P.y,zoom:P.k}}o(I,"getViewport");async function _(P,R){return h?new Promise(V=>{d?.interpolate(R?.interpolate==="linear"?uo:Ut).scaleTo(Si(h,R?.duration,R?.ease,()=>V(!0)),P)}):!1}o(_,"scaleTo");async function T(P,R){return h?new Promise(V=>{d?.interpolate(R?.interpolate==="linear"?uo:Ut).scaleBy(Si(h,R?.duration,R?.ease,()=>V(!0)),P)}):!1}o(T,"scaleBy");function k(P){d?.scaleExtent(P)}o(k,"setScaleExtent");function A(P){d?.translateExtent(P)}o(A,"setTranslateExtent");function Y(P){let R=!Le(P)||P<0?0:P;d?.clickDistance(R)}return o(Y,"setClickDistance"),{update:x,destroy:y,setViewport:g,setViewportConstrained:S,getViewport:I,scaleTo:_,scaleBy:T,setScaleExtent:k,setTranslateExtent:A,syncViewport:w,setClickDistance:Y}}o(ka,"XYPanZoom");var Et;(function(e){e.Line="line",e.Handle="handle"})(Et||(Et={}));function Nf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){let a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}o(Nf,"getResizeDirection");function na(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(na,"getControlDirection");function wt(e,t){return Math.max(0,t-e)}o(wt,"getLowerExtentClamp");function bt(e,t){return Math.max(0,e-t)}o(bt,"getUpperExtentClamp");function Po(e,t,n){return Math.max(0,t-e,e-n)}o(Po,"getSizeClamp");function oa(e,t){return e?!t:t}o(oa,"xor");function If(e,t,n,r,i,s,a,l){let{affectsX:c,affectsY:u}=t,{isHorizontal:f,isVertical:d}=t,h=f&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:v,maxWidth:x,minHeight:y,maxHeight:S}=r,{x:g,y:w,width:I,height:_,aspectRatio:T}=e,k=Math.floor(f?p-e.pointerX:0),A=Math.floor(d?m-e.pointerY:0),Y=I+(c?-k:k),P=_+(u?-A:A),R=-s[0]*I,V=-s[1]*_,b=Po(Y,v,x),E=Po(P,y,S);if(a){let z=0,D=0;c&&k<0?z=wt(g+k+R,a[0][0]):!c&&k>0&&(z=bt(g+Y+R,a[1][0])),u&&A<0?D=wt(w+A+V,a[0][1]):!u&&A>0&&(D=bt(w+P+V,a[1][1])),b=Math.max(b,z),E=Math.max(E,D)}if(l){let z=0,D=0;c&&k>0?z=bt(g+k,l[0][0]):!c&&k<0&&(z=wt(g+Y,l[1][0])),u&&A>0?D=bt(w+A,l[0][1]):!u&&A<0&&(D=wt(w+P,l[1][1])),b=Math.max(b,z),E=Math.max(E,D)}if(i){if(f){let z=Po(Y/T,y,S)*T;if(b=Math.max(b,z),a){let D=0;!c&&!u||c&&!u&&h?D=bt(w+V+Y/T,a[1][1])*T:D=wt(w+V+(c?k:-k)/T,a[0][1])*T,b=Math.max(b,D)}if(l){let D=0;!c&&!u||c&&!u&&h?D=wt(w+Y/T,l[1][1])*T:D=bt(w+(c?k:-k)/T,l[0][1])*T,b=Math.max(b,D)}}if(d){let z=Po(P*T,v,x)/T;if(E=Math.max(E,z),a){let D=0;!c&&!u||u&&!c&&h?D=bt(g+P*T+R,a[1][0])/T:D=wt(g+(u?A:-A)*T+R,a[0][0])/T,E=Math.max(E,D)}if(l){let D=0;!c&&!u||u&&!c&&h?D=wt(g+P*T,l[1][0])/T:D=bt(g+(u?A:-A)*T,l[0][0])/T,E=Math.max(E,D)}}}A=A+(A<0?E:-E),k=k+(k<0?b:-b),i&&(h?Y>P*T?A=(oa(c,u)?-k:k)/T:k=(oa(c,u)?-A:A)*T:f?(A=k/T,u=c):(k=A*T,c=u));let C=c?g+k:g,M=u?w+A:w;return{width:I+(c?-k:k),height:_+(u?-A:A),x:s[0]*k*(c?-1:1)+C,y:s[1]*A*(u?-1:1)+M}}o(If,"getDimensionsAfterResize");var Aa={width:0,height:0,x:0,y:0},Mf={...Aa,pointerX:0,pointerY:0,aspectRatio:1};function Pf(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,l=n[0]*s,c=n[1]*a;return[[r-l,i-c],[r+s-l,i+a-c]]}o(Pf,"nodeToChildExtent");function Da({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let s=Ee(e),a={controlDirection:na("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:f,keepAspectRatio:d,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:v,shouldResize:x}){let y={...Aa},S={...Mf};a={boundaries:f,resizeDirection:h,keepAspectRatio:d,controlDirection:na(u)};let g,w=null,I=[],_,T,k,A=!1,Y=On().on("start",P=>{let{nodeLookup:R,transform:V,snapGrid:b,snapToGrid:E,nodeOrigin:C,paneDomNode:M}=n();if(g=R.get(t),!g)return;w=M?.getBoundingClientRect()??null;let{xSnapped:z,ySnapped:D}=Gn(P.sourceEvent,{transform:V,snapGrid:b,snapToGrid:E,containerBounds:w});y={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},S={...y,pointerX:z,pointerY:D,aspectRatio:y.width/y.height},_=void 0,T=Rt(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(_=R.get(g.parentId)),_&&g.extent==="parent"&&(T=[[0,0],[_.measured.width,_.measured.height]]),I=[],k=void 0;for(let[H,F]of R)if(F.parentId===t&&(I.push({id:H,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){let B=Pf(F,g,F.origin??C);k?k=[[Math.min(B[0][0],k[0][0]),Math.min(B[0][1],k[0][1])],[Math.max(B[1][0],k[1][0]),Math.max(B[1][1],k[1][1])]]:k=B}p?.(P,{...y})}).on("drag",P=>{let{transform:R,snapGrid:V,snapToGrid:b,nodeOrigin:E}=n(),C=Gn(P.sourceEvent,{transform:R,snapGrid:V,snapToGrid:b,containerBounds:w}),M=[];if(!g)return;let{x:z,y:D,width:H,height:F}=y,B={},U=g.origin??E,{width:X,height:W,x:j,y:K}=If(S,a.controlDirection,C,a.boundaries,a.keepAspectRatio,U,T,k),L=X!==H,Z=W!==F,te=j!==z&&L,ee=K!==D&&Z;if(!te&&!ee&&!L&&!Z)return;if((te||ee||U[0]===1||U[1]===1)&&(B.x=te?j:y.x,B.y=ee?K:y.y,y.x=B.x,y.y=B.y,I.length>0)){let oe=j-z,se=K-D;for(let ue of I)ue.position={x:ue.position.x-oe+U[0]*(X-H),y:ue.position.y-se+U[1]*(W-F)},M.push(ue)}if((L||Z)&&(B.width=L&&(!a.resizeDirection||a.resizeDirection==="horizontal")?X:y.width,B.height=Z&&(!a.resizeDirection||a.resizeDirection==="vertical")?W:y.height,y.width=B.width,y.height=B.height),_&&g.expandParent){let oe=U[0]*(B.width??0);B.x&&B.x<oe&&(y.x=oe,S.x=S.x-(B.x-oe));let se=U[1]*(B.height??0);B.y&&B.y<se&&(y.y=se,S.y=S.y-(B.y-se))}let G=Nf({width:y.width,prevWidth:H,height:y.height,prevHeight:F,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),q={...y,direction:G};x?.(P,q)!==!1&&(A=!0,m?.(P,q),r(B,M))}).on("end",P=>{A&&(v?.(P,{...y}),i?.({...y}),A=!1)});s.call(Y)}o(l,"update");function c(){s.on(".drag",null)}return o(c,"destroy"),{update:l,destroy:c}}o(Da,"XYResizer");var Ra=mt(ar(),1),La=mt(tu(),1);var Oa=o(e=>{let t,n=new Set,r=o((f,d)=>{let h=typeof f=="function"?f(t):f;if(!Object.is(h,t)){let p=t;t=d??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},"setState"),i=o(()=>t,"getState"),c={setState:r,getState:i,getInitialState:o(()=>u,"getInitialState"),subscribe:o(f=>(n.add(f),()=>n.delete(f)),"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,c);return c},"createStoreImpl"),$a=o(e=>e?Oa(e):Oa,"createStore");var{useDebugValue:Tf}=Ra.default,{useSyncExternalStoreWithSelector:kf}=La.default,Af=o(e=>e,"identity");function Zi(e,t=Af,n){let r=kf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Tf(r),r}o(Zi,"useStoreWithEqualityFn");var za=o((e,t)=>{let n=$a(e),r=o((i,s=t)=>Zi(n,i,s),"useBoundStoreWithEqualityFn");return Object.assign(r,n),r},"createWithEqualityFnImpl"),Ha=o((e,t)=>e?za(e,t):za,"createWithEqualityFn");function ce(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(ce,"shallow$1");var Df=mt(Qc());var Uo=(0,$.createContext)(null),Of=Uo.Provider,ul=De.error001("react");function ie(e,t){let n=(0,$.useContext)(Uo);if(n===null)throw new Error(ul);return Zi(n,e,t)}o(ie,"useStore");function fe(){let e=(0,$.useContext)(Uo);if(e===null)throw new Error(ul);return(0,$.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}o(fe,"useStoreApi");var Ba={display:"none"},$f={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},dl="react-flow__node-desc",fl="react-flow__edge-desc",zf="react-flow__aria-live",Rf=o(e=>e.ariaLiveMessage,"ariaLiveSelector"),Lf=o(e=>e.ariaLabelConfig,"ariaLabelConfigSelector");function Hf({rfId:e}){let t=ie(Rf);return(0,O.jsx)("div",{id:`${zf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:$f,children:t})}o(Hf,"AriaLiveMessage");function Bf({rfId:e,disableKeyboardA11y:t}){let n=ie(Lf);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{id:`${dl}-${e}`,style:Ba,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,O.jsx)("div",{id:`${fl}-${e}`,style:Ba,children:n["edge.a11yDescription.default"]}),!t&&(0,O.jsx)(Hf,{rfId:e})]})}o(Bf,"A11yDescriptions");var _t=(0,$.forwardRef)(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{let a=`${e}`.split("-");return(0,O.jsx)("div",{className:ge(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});_t.displayName="Panel";var Va="https://reactflow.dev/attribution";function Vf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:(0,O.jsx)(_t,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Va}`,children:(0,O.jsx)("a",{href:Va,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}o(Vf,"Attribution");var Ff=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$m"),Wo=o(e=>e.id,"selectId");function Yf(e,t){return ce(e.selectedNodes.map(Wo),t.selectedNodes.map(Wo))&&ce(e.selectedEdges.map(Wo),t.selectedEdges.map(Wo))}o(Yf,"areEqual");function Wf({onSelectionChange:e}){let t=fe(),{selectedNodes:n,selectedEdges:r}=ie(Ff,Yf);return(0,$.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}o(Wf,"SelectionListenerInner");var Xf=o(e=>!!e.onSelectionChangeHandlers,"changeSelector");function Zf({onSelectionChange:e}){let t=ie(Xf);return e||t?(0,O.jsx)(Wf,{onSelectionChange:e}):null}o(Zf,"SelectionListener");var hl=[0,0],Uf={x:0,y:0,zoom:1},Gf=["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"],Fa=[...Gf,"rfId"],qf=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$l"),Ya={translateExtent:on,nodeOrigin:hl,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Kf(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=ie(qf,ce),u=fe();(0,$.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=Ya,l()}),[]);let f=(0,$.useRef)(Ya);return(0,$.useEffect)(()=>{for(let d of Fa){let h=e[d],p=f.current[d];h!==p&&(typeof e[d]>"u"||(d==="nodes"?t(h):d==="edges"?n(h):d==="minZoom"?r(h):d==="maxZoom"?i(h):d==="translateExtent"?s(h):d==="nodeExtent"?a(h):d==="ariaLabelConfig"?u.setState({ariaLabelConfig:da(h)}):d==="fitView"?u.setState({fitViewQueued:h}):d==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[d]:h})))}f.current=e},Fa.map(d=>e[d])),null}o(Kf,"StoreUpdater");function Wa(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}o(Wa,"getMediaQuery");function Qf(e){let[t,n]=(0,$.useState)(e==="system"?null:e);return(0,$.useEffect)(()=>{if(e!=="system"){n(e);return}let r=Wa(),i=o(()=>n(r?.matches?"dark":"light"),"updateColorModeClass");return i(),r?.addEventListener("change",i),()=>{r?.removeEventListener("change",i)}},[e]),t!==null?t:Wa()?.matches?"dark":"light"}o(Qf,"useColorModeClass");var Xa=typeof document<"u"?document:null;function jn(e=null,t={target:Xa,actInsideInputWithModifier:!0}){let[n,r]=(0,$.useState)(!1),i=(0,$.useRef)(!1),s=(0,$.useRef)(new Set([])),[a,l]=(0,$.useMemo)(()=>{if(e!==null){let u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`