@a-company/paradigm 5.6.2 → 5.8.1

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 (28) hide show
  1. package/dist/{chunk-SU3WDCRR.js → chunk-T3YGSZCI.js} +12 -0
  2. package/dist/conductor-CQVGTEQN.js +161 -0
  3. package/dist/{docs-J2BTKRVU.js → docs-AIY6VNF7.js} +1 -1
  4. package/dist/index.js +7 -7
  5. package/dist/mcp.js +2 -2
  6. package/dist/{platform-server-2D6S6YTK.js → platform-server-U5L2G3EU.js} +196 -15
  7. package/dist/{reindex-J5SEDVTT.js → reindex-KFUPB3ES.js} +1 -1
  8. package/dist/{serve-EFVRS4GA.js → serve-QWWJP2EW.js} +1 -1
  9. package/dist/{shift-VFG23DLA.js → shift-2NYRFVEZ.js} +6 -2
  10. package/dist/university-ui/assets/{index-BLWmLEDq.js → index-BjewBB6s.js} +2 -2
  11. package/dist/university-ui/assets/{index-BLWmLEDq.js.map → index-BjewBB6s.js.map} +1 -1
  12. package/dist/university-ui/index.html +1 -1
  13. package/package.json +1 -1
  14. package/platform-ui/dist/assets/AmbientSection-10pbwWjo.css +1 -0
  15. package/platform-ui/dist/assets/AmbientSection-WtHfNedO.js +1 -0
  16. package/platform-ui/dist/assets/CanvasSection-DwPTRdIN.js +9 -0
  17. package/platform-ui/dist/assets/CanvasSection-flMXU19z.css +1 -0
  18. package/platform-ui/dist/assets/{DocsSection-ByAgPzWV.js → DocsSection-BJc_ws4I.js} +1 -1
  19. package/platform-ui/dist/assets/{GitSection-BLovj9yT.js → GitSection-DhqBo1xc.js} +1 -1
  20. package/platform-ui/dist/assets/{GraphSection-C5PCPUFl.js → GraphSection-D9fhVnZ0.js} +1 -1
  21. package/platform-ui/dist/assets/{LoreSection-BftejTla.js → LoreSection-CwDDHrz9.js} +1 -1
  22. package/platform-ui/dist/assets/{SentinelSection-CnYcasN7.js → SentinelSection-Cl7e5oZ6.js} +1 -1
  23. package/platform-ui/dist/assets/{SymphonySection-BpmqCHeK.js → SymphonySection-BRoBaUSS.js} +1 -1
  24. package/platform-ui/dist/assets/TeamSection-CqSIMrKz.js +1 -0
  25. package/platform-ui/dist/assets/TeamSection-udxWQTcX.css +1 -0
  26. package/platform-ui/dist/assets/{index-G9JnWEs_.js → index-F0KL9xrN.js} +11 -11
  27. package/platform-ui/dist/index.html +1 -1
  28. package/dist/conductor-PGPDVIVE.js +0 -88
@@ -1,4 +1,4 @@
1
- import{a as aa,u as ca,R as la,r as k,j as v,c as ua}from"./index-G9JnWEs_.js";function se(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=se(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var da={value:()=>{}};function Qt(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new zt(n)}function zt(e){this._=e}function fa(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}zt.prototype=Qt.prototype={constructor:zt,on:function(e,t){var n=this._,o=fa(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=ha(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=fo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=fo(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function ha(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function fo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=da,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Cn="http://www.w3.org/1999/xhtml";const ho={svg:"http://www.w3.org/2000/svg",xhtml:Cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Jt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ho.hasOwnProperty(t)?{space:ho[t],local:e}:e}function ga(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Cn&&t.documentElement.namespaceURI===Cn?t.createElement(e):t.createElementNS(n,e)}}function pa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pr(e){var t=Jt(e);return(t.local?pa:ga)(t)}function ma(){}function On(e){return e==null?ma:function(){return this.querySelector(e)}}function ya(e){typeof e!="function"&&(e=On(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,l,f=0;f<s;++f)(c=i[f])&&(l=e.call(c,c.__data__,f,i))&&("__data__"in c&&(l.__data__=c.__data__),a[f]=l);return new ue(o,this._parents)}function xa(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function wa(){return[]}function mr(e){return e==null?wa:function(){return this.querySelectorAll(e)}}function va(e){return function(){return xa(e.apply(this,arguments))}}function ba(e){typeof e=="function"?e=va(e):e=mr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new ue(o,r)}function yr(e){return function(){return this.matches(e)}}function xr(e){return function(t){return t.matches(e)}}var _a=Array.prototype.find;function Na(e){return function(){return _a.call(this.children,e)}}function Ea(){return this.firstElementChild}function Sa(e){return this.select(e==null?Ea:Na(typeof e=="function"?e:xr(e)))}var Ca=Array.prototype.filter;function Ma(){return Array.from(this.children)}function ka(e){return function(){return Ca.call(this.children,e)}}function Ia(e){return this.selectAll(e==null?Ma:ka(typeof e=="function"?e:xr(e)))}function $a(e){typeof e!="function"&&(e=yr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ue(o,this._parents)}function wr(e){return new Array(e.length)}function Aa(){return new ue(this._enter||this._groups.map(wr),this._parents)}function Ft(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ft.prototype={constructor:Ft,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ta(e){return function(){return e}}function La(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Ft(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function Pa(e,t,n,o,r,i,s){var a,c,l=new Map,f=t.length,u=i.length,d=new Array(f),g;for(a=0;a<f;++a)(c=t[a])&&(d[a]=g=s.call(c,c.__data__,a,t)+"",l.has(g)?r[a]=c:l.set(g,c));for(a=0;a<u;++a)g=s.call(e,i[a],a,i)+"",(c=l.get(g))?(o[a]=c,c.__data__=i[a],l.delete(g)):n[a]=new Ft(e,i[a]);for(a=0;a<f;++a)(c=t[a])&&l.get(d[a])===c&&(r[a]=c)}function Da(e){return e.__data__}function za(e,t){if(!arguments.length)return Array.from(this,Da);var n=t?Pa:La,o=this._parents,r=this._groups;typeof e!="function"&&(e=Ta(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var f=o[l],u=r[l],d=u.length,g=ja(e.call(f,f&&f.__data__,l,o)),h=g.length,x=a[l]=new Array(h),y=s[l]=new Array(h),m=c[l]=new Array(d);n(f,u,x,y,m,g,t);for(var N=0,p=0,w,M;N<h;++N)if(w=x[N]){for(N>=p&&(p=N+1);!(M=y[p])&&++p<h;);w._next=M||null}}return s=new ue(s,o),s._enter=a,s._exit=c,s}function ja(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ra(){return new ue(this._exit||this._groups.map(wr),this._parents)}function Ha(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Oa(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],f=o[c],u=l.length,d=a[c]=new Array(u),g,h=0;h<u;++h)(g=l[h]||f[h])&&(d[h]=g);for(;c<r;++c)a[c]=n[c];return new ue(a,this._parents)}function Fa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Va(e){e||(e=Ba);function t(u,d){return u&&d?e(u.__data__,d.__data__):!u-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,f=0;f<a;++f)(l=s[f])&&(c[f]=l);c.sort(t)}return new ue(r,this._parents).order()}function Ba(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Xa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ya(){return Array.from(this)}function Ga(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Wa(){let e=0;for(const t of this)++e;return e}function qa(){return!this.node()}function Ua(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Ka(e){return function(){this.removeAttribute(e)}}function Za(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qa(e,t){return function(){this.setAttribute(e,t)}}function Ja(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ec(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function tc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function nc(e,t){var n=Jt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Za:Ka:typeof t=="function"?n.local?tc:ec:n.local?Ja:Qa)(n,t))}function vr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function oc(e){return function(){this.style.removeProperty(e)}}function rc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ic(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function sc(e,t,n){return arguments.length>1?this.each((t==null?oc:typeof t=="function"?ic:rc)(e,t,n??"")):qe(this.node(),e)}function qe(e,t){return e.style.getPropertyValue(t)||vr(e).getComputedStyle(e,null).getPropertyValue(t)}function ac(e){return function(){delete this[e]}}function cc(e,t){return function(){this[e]=t}}function lc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function uc(e,t){return arguments.length>1?this.each((t==null?ac:typeof t=="function"?lc:cc)(e,t)):this.node()[e]}function br(e){return e.trim().split(/^|\s+/)}function Fn(e){return e.classList||new _r(e)}function _r(e){this._node=e,this._names=br(e.getAttribute("class")||"")}_r.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Nr(e,t){for(var n=Fn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Er(e,t){for(var n=Fn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function dc(e){return function(){Nr(this,e)}}function fc(e){return function(){Er(this,e)}}function hc(e,t){return function(){(t.apply(this,arguments)?Nr:Er)(this,e)}}function gc(e,t){var n=br(e+"");if(arguments.length<2){for(var o=Fn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?hc:t?dc:fc)(n,t))}function pc(){this.textContent=""}function mc(e){return function(){this.textContent=e}}function yc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function xc(e){return arguments.length?this.each(e==null?pc:(typeof e=="function"?yc:mc)(e)):this.node().textContent}function wc(){this.innerHTML=""}function vc(e){return function(){this.innerHTML=e}}function bc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function _c(e){return arguments.length?this.each(e==null?wc:(typeof e=="function"?bc:vc)(e)):this.node().innerHTML}function Nc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ec(){return this.each(Nc)}function Sc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Cc(){return this.each(Sc)}function Mc(e){var t=typeof e=="function"?e:pr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function kc(){return null}function Ic(e,t){var n=typeof e=="function"?e:pr(e),o=t==null?kc:typeof t=="function"?t:On(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function $c(){var e=this.parentNode;e&&e.removeChild(this)}function Ac(){return this.each($c)}function Tc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Lc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Pc(e){return this.select(e?Lc:Tc)}function Dc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function zc(e){return function(t){e.call(this,t,this.__data__)}}function jc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Rc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Hc(e,t,n){return function(){var o=this.__on,r,i=zc(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Oc(e,t,n){var o=jc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,f;c<l;++c)for(r=0,f=a[c];r<i;++r)if((s=o[r]).type===f.type&&s.name===f.name)return f.value}return}for(a=t?Hc:Rc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Sr(e,t,n){var o=vr(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Fc(e,t){return function(){return Sr(this,e,t)}}function Vc(e,t){return function(){return Sr(this,e,t.apply(this,arguments))}}function Bc(e,t){return this.each((typeof t=="function"?Vc:Fc)(e,t))}function*Xc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Cr=[null];function ue(e,t){this._groups=e,this._parents=t}function wt(){return new ue([[document.documentElement]],Cr)}function Yc(){return this}ue.prototype=wt.prototype={constructor:ue,select:ya,selectAll:ba,selectChild:Sa,selectChildren:Ia,filter:$a,data:za,enter:Aa,exit:Ra,join:Ha,merge:Oa,selection:Yc,order:Fa,sort:Va,call:Xa,nodes:Ya,node:Ga,size:Wa,empty:qa,each:Ua,attr:nc,style:sc,property:uc,classed:gc,text:xc,html:_c,raise:Ec,lower:Cc,append:Mc,insert:Ic,remove:Ac,clone:Pc,datum:Dc,on:Oc,dispatch:Bc,[Symbol.iterator]:Xc};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Cr)}function Gc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=Gc(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Wc={passive:!1},dt={capture:!0,passive:!1};function pn(e){e.stopImmediatePropagation()}function Ge(e){e.preventDefault(),e.stopImmediatePropagation()}function Mr(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Ge,dt);"onselectstart"in t?n.on("selectstart.drag",Ge,dt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function kr(e,t){var n=e.document.documentElement,o=le(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ge,dt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Mt=e=>()=>e;function Mn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,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:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}Mn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function qc(e){return!e.ctrlKey&&!e.button}function Uc(){return this.parentNode}function Kc(e,t){return t??{x:e.x,y:e.y}}function Zc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ir(){var e=qc,t=Uc,n=Kc,o=Zc,r={},i=Qt("start","drag","end"),s=0,a,c,l,f,u=0;function d(w){w.on("mousedown.drag",g).filter(o).on("touchstart.drag",y).on("touchmove.drag",m,Wc).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(w,M){if(!(f||!e.call(this,w,M))){var _=p(this,t.call(this,w,M),w,M,"mouse");_&&(le(w.view).on("mousemove.drag",h,dt).on("mouseup.drag",x,dt),Mr(w.view),pn(w),l=!1,a=w.clientX,c=w.clientY,_("start",w))}}function h(w){if(Ge(w),!l){var M=w.clientX-a,_=w.clientY-c;l=M*M+_*_>u}r.mouse("drag",w)}function x(w){le(w.view).on("mousemove.drag mouseup.drag",null),kr(w.view,l),Ge(w),r.mouse("end",w)}function y(w,M){if(e.call(this,w,M)){var _=w.changedTouches,C=t.call(this,w,M),T=_.length,D,O;for(D=0;D<T;++D)(O=p(this,C,w,M,_[D].identifier,_[D]))&&(pn(w),O("start",w,_[D]))}}function m(w){var M=w.changedTouches,_=M.length,C,T;for(C=0;C<_;++C)(T=r[M[C].identifier])&&(Ge(w),T("drag",w,M[C]))}function N(w){var M=w.changedTouches,_=M.length,C,T;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),C=0;C<_;++C)(T=r[M[C].identifier])&&(pn(w),T("end",w,M[C]))}function p(w,M,_,C,T,D){var O=i.copy(),$=fe(D||_,M),P,H,b;if((b=n.call(w,new Mn("beforestart",{sourceEvent:_,target:d,identifier:T,active:s,x:$[0],y:$[1],dx:0,dy:0,dispatch:O}),C))!=null)return P=b.x-$[0]||0,H=b.y-$[1]||0,function A(E,L,I){var S=$,z;switch(E){case"start":r[T]=A,z=s++;break;case"end":delete r[T],--s;case"drag":$=fe(I||L,M),z=s;break}O.call(E,w,new Mn(E,{sourceEvent:L,subject:b,target:d,identifier:T,active:z,x:$[0]+P,y:$[1]+H,dx:$[0]-S[0],dy:$[1]-S[1],dispatch:O}),C)}}return d.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Mt(!!w),d):e},d.container=function(w){return arguments.length?(t=typeof w=="function"?w:Mt(w),d):t},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Mt(w),d):n},d.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:Mt(!!w),d):o},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,d):Math.sqrt(u)},d}function Vn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function $r(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function vt(){}var ft=.7,Vt=1/ft,We="\\s*([+-]?\\d+)\\s*",ht="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qc=/^#([0-9a-f]{3,8})$/,Jc=new RegExp(`^rgb\\(${We},${We},${We}\\)$`),el=new RegExp(`^rgb\\(${xe},${xe},${xe}\\)$`),tl=new RegExp(`^rgba\\(${We},${We},${We},${ht}\\)$`),nl=new RegExp(`^rgba\\(${xe},${xe},${xe},${ht}\\)$`),ol=new RegExp(`^hsl\\(${ht},${xe},${xe}\\)$`),rl=new RegExp(`^hsla\\(${ht},${xe},${xe},${ht}\\)$`),go={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Vn(vt,je,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:po,formatHex:po,formatHex8:il,formatHsl:sl,formatRgb:mo,toString:mo});function po(){return this.rgb().formatHex()}function il(){return this.rgb().formatHex8()}function sl(){return Ar(this).formatHsl()}function mo(){return this.rgb().formatRgb()}function je(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Qc.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?yo(t):n===3?new ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?kt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?kt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Jc.exec(e))?new ce(t[1],t[2],t[3],1):(t=el.exec(e))?new ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=tl.exec(e))?kt(t[1],t[2],t[3],t[4]):(t=nl.exec(e))?kt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ol.exec(e))?vo(t[1],t[2]/100,t[3]/100,1):(t=rl.exec(e))?vo(t[1],t[2]/100,t[3]/100,t[4]):go.hasOwnProperty(e)?yo(go[e]):e==="transparent"?new ce(NaN,NaN,NaN,0):null}function yo(e){return new ce(e>>16&255,e>>8&255,e&255,1)}function kt(e,t,n,o){return o<=0&&(e=t=n=NaN),new ce(e,t,n,o)}function al(e){return e instanceof vt||(e=je(e)),e?(e=e.rgb(),new ce(e.r,e.g,e.b,e.opacity)):new ce}function kn(e,t,n,o){return arguments.length===1?al(e):new ce(e,t,n,o??1)}function ce(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}Vn(ce,kn,$r(vt,{brighter(e){return e=e==null?Vt:Math.pow(Vt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ft:Math.pow(ft,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ce(De(this.r),De(this.g),De(this.b),Bt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:xo,formatHex:xo,formatHex8:cl,formatRgb:wo,toString:wo}));function xo(){return`#${Pe(this.r)}${Pe(this.g)}${Pe(this.b)}`}function cl(){return`#${Pe(this.r)}${Pe(this.g)}${Pe(this.b)}${Pe((isNaN(this.opacity)?1:this.opacity)*255)}`}function wo(){const e=Bt(this.opacity);return`${e===1?"rgb(":"rgba("}${De(this.r)}, ${De(this.g)}, ${De(this.b)}${e===1?")":`, ${e})`}`}function Bt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function De(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pe(e){return e=De(e),(e<16?"0":"")+e.toString(16)}function vo(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,o)}function Ar(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof vt||(e=je(e)),!e)return new he;if(e instanceof he)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,c=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+r:2-i-r,s*=60):a=c>0&&c<1?0:s,new he(s,a,c,e.opacity)}function ll(e,t,n,o){return arguments.length===1?Ar(e):new he(e,t,n,o??1)}function he(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Vn(he,ll,$r(vt,{brighter(e){return e=e==null?Vt:Math.pow(Vt,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ft:Math.pow(ft,e),new he(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new ce(mn(e>=240?e-240:e+120,r,o),mn(e,r,o),mn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new he(bo(this.h),It(this.s),It(this.l),Bt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Bt(this.opacity);return`${e===1?"hsl(":"hsla("}${bo(this.h)}, ${It(this.s)*100}%, ${It(this.l)*100}%${e===1?")":`, ${e})`}`}}));function bo(e){return e=(e||0)%360,e<0?e+360:e}function It(e){return Math.max(0,Math.min(1,e||0))}function mn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Bn=e=>()=>e;function ul(e,t){return function(n){return e+n*t}}function dl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function fl(e){return(e=+e)==1?Tr:function(t,n){return n-t?dl(t,n,e):Bn(isNaN(t)?n:t)}}function Tr(e,t){var n=t-e;return n?ul(e,n):Bn(isNaN(e)?t:e)}const Xt=function e(t){var n=fl(t);function o(r,i){var s=n((r=kn(r)).r,(i=kn(i)).r),a=n(r.g,i.g),c=n(r.b,i.b),l=Tr(r.opacity,i.opacity);return function(f){return r.r=s(f),r.g=a(f),r.b=c(f),r.opacity=l(f),r+""}}return o.gamma=e,o}(1);function hl(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function gl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function pl(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=lt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function ml(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function ye(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function yl(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=lt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var In=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yn=new RegExp(In.source,"g");function xl(e){return function(){return e}}function wl(e){return function(t){return e(t)+""}}function Lr(e,t){var n=In.lastIndex=yn.lastIndex=0,o,r,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(o=In.exec(e))&&(r=yn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,c.push({i:s,x:ye(o,r)})),n=yn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?wl(c[0].x):xl(t):(t=c.length,function(l){for(var f=0,u;f<t;++f)a[(u=c[f]).i]=u.x(l);return a.join("")})}function lt(e,t){var n=typeof t,o;return t==null||n==="boolean"?Bn(t):(n==="number"?ye:n==="string"?(o=je(t))?(t=o,Xt):Lr:t instanceof je?Xt:t instanceof Date?ml:gl(t)?hl:Array.isArray(t)?pl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?yl:ye)(e,t)}var _o=180/Math.PI,$n={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Pr(e,t,n,o,r,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*_o,skewX:Math.atan(c)*_o,scaleX:s,scaleY:a}}var $t;function vl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?$n:Pr(t.a,t.b,t.c,t.d,t.e,t.f)}function bl(e){return e==null||($t||($t=document.createElementNS("http://www.w3.org/2000/svg","g")),$t.setAttribute("transform",e),!(e=$t.transform.baseVal.consolidate()))?$n:(e=e.matrix,Pr(e.a,e.b,e.c,e.d,e.e,e.f))}function Dr(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,f,u,d,g,h){if(l!==u||f!==d){var x=g.push("translate(",null,t,null,n);h.push({i:x-4,x:ye(l,u)},{i:x-2,x:ye(f,d)})}else(u||d)&&g.push("translate("+u+t+d+n)}function s(l,f,u,d){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),d.push({i:u.push(r(u)+"rotate(",null,o)-2,x:ye(l,f)})):f&&u.push(r(u)+"rotate("+f+o)}function a(l,f,u,d){l!==f?d.push({i:u.push(r(u)+"skewX(",null,o)-2,x:ye(l,f)}):f&&u.push(r(u)+"skewX("+f+o)}function c(l,f,u,d,g,h){if(l!==u||f!==d){var x=g.push(r(g)+"scale(",null,",",null,")");h.push({i:x-4,x:ye(l,u)},{i:x-2,x:ye(f,d)})}else(u!==1||d!==1)&&g.push(r(g)+"scale("+u+","+d+")")}return function(l,f){var u=[],d=[];return l=e(l),f=e(f),i(l.translateX,l.translateY,f.translateX,f.translateY,u,d),s(l.rotate,f.rotate,u,d),a(l.skewX,f.skewX,u,d),c(l.scaleX,l.scaleY,f.scaleX,f.scaleY,u,d),l=f=null,function(g){for(var h=-1,x=d.length,y;++h<x;)u[(y=d[h]).i]=y.x(g);return u.join("")}}}var _l=Dr(vl,"px, ","px)","deg)"),Nl=Dr(bl,", ",")",")"),El=1e-12;function No(e){return((e=Math.exp(e))+1/e)/2}function Sl(e){return((e=Math.exp(e))-1/e)/2}function Cl(e){return((e=Math.exp(2*e))-1)/(e+1)}const jt=function e(t,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],f=s[0],u=s[1],d=s[2],g=f-a,h=u-c,x=g*g+h*h,y,m;if(x<El)m=Math.log(d/l)/t,y=function(C){return[a+C*g,c+C*h,l*Math.exp(t*C*m)]};else{var N=Math.sqrt(x),p=(d*d-l*l+o*x)/(2*l*n*N),w=(d*d-l*l-o*x)/(2*d*n*N),M=Math.log(Math.sqrt(p*p+1)-p),_=Math.log(Math.sqrt(w*w+1)-w);m=(_-M)/t,y=function(C){var T=C*m,D=No(M),O=l/(n*N)*(D*Cl(t*T+M)-Sl(M));return[a+O*g,c+O*h,l*D/No(t*T+M)]}}return y.duration=m*1e3*t/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},r}(Math.SQRT2,2,4);var Ue=0,at=0,it=0,zr=1e3,Yt,ct,Gt=0,Re=0,en=0,gt=typeof performance=="object"&&performance.now?performance:Date,jr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xn(){return Re||(jr(Ml),Re=gt.now()+en)}function Ml(){Re=0}function Wt(){this._call=this._time=this._next=null}Wt.prototype=Rr.prototype={constructor:Wt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xn():+n)+(t==null?0:+t),!this._next&&ct!==this&&(ct?ct._next=this:Yt=this,ct=this),this._call=e,this._time=n,An()},stop:function(){this._call&&(this._call=null,this._time=1/0,An())}};function Rr(e,t,n){var o=new Wt;return o.restart(e,t,n),o}function kl(){Xn(),++Ue;for(var e=Yt,t;e;)(t=Re-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ue}function Eo(){Re=(Gt=gt.now())+en,Ue=at=0;try{kl()}finally{Ue=0,$l(),Re=0}}function Il(){var e=gt.now(),t=e-Gt;t>zr&&(en-=t,Gt=e)}function $l(){for(var e,t=Yt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Yt=n);ct=e,An(o)}function An(e){if(!Ue){at&&(at=clearTimeout(at));var t=e-Re;t>24?(e<1/0&&(at=setTimeout(Eo,e-gt.now()-en)),it&&(it=clearInterval(it))):(it||(Gt=gt.now(),it=setInterval(Il,zr)),Ue=1,jr(Eo))}}function So(e,t,n){var o=new Wt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Al=Qt("start","end","cancel","interrupt"),Tl=[],Hr=0,Co=1,Tn=2,Rt=3,Mo=4,Ln=5,Ht=6;function tn(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Ll(e,n,{name:t,index:o,group:r,on:Al,tween:Tl,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Hr})}function Yn(e,t){var n=me(e,t);if(n.state>Hr)throw new Error("too late; already scheduled");return n}function ve(e,t){var n=me(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ll(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Rr(i,0,n.time);function i(l){n.state=Co,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var f,u,d,g;if(n.state!==Co)return c();for(f in o)if(g=o[f],g.name===n.name){if(g.state===Rt)return So(s);g.state===Mo?(g.state=Ht,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[f]):+f<t&&(g.state=Ht,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[f])}if(So(function(){n.state===Rt&&(n.state=Mo,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Tn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Tn){for(n.state=Rt,r=new Array(d=n.tween.length),f=0,u=-1;f<d;++f)(g=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=g);r.length=u+1}}function a(l){for(var f=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Ln,1),u=-1,d=r.length;++u<d;)r[u].call(e,f);n.state===Ln&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Ht,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Ot(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Tn&&o.state<Ln,o.state=Ht,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Pl(e){return this.each(function(){Ot(this,e)})}function Dl(e,t){var n,o;return function(){var r=ve(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function zl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=ve(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function jl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Dl:zl)(n,e,t))}function Gn(e,t,n){var o=e._id;return e.each(function(){var r=ve(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function Or(e,t){var n;return(typeof t=="number"?ye:t instanceof je?Xt:(n=je(t))?(t=n,Xt):Lr)(e,t)}function Rl(e){return function(){this.removeAttribute(e)}}function Hl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ol(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Fl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Vl(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Bl(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Xl(e,t){var n=Jt(e),o=n==="transform"?Nl:Or;return this.attrTween(e,typeof t=="function"?(n.local?Bl:Vl)(n,o,Gn(this,"attr."+e,t)):t==null?(n.local?Hl:Rl)(n):(n.local?Fl:Ol)(n,o,t))}function Yl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Gl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Wl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Gl(e,i)),n}return r._value=t,r}function ql(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Yl(e,i)),n}return r._value=t,r}function Ul(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Jt(e);return this.tween(n,(o.local?Wl:ql)(o,t))}function Kl(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}function Zl(e,t){return t=+t,function(){Yn(this,e).delay=t}}function Ql(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Kl:Zl)(t,e)):me(this.node(),t).delay}function Jl(e,t){return function(){ve(this,e).duration=+t.apply(this,arguments)}}function eu(e,t){return t=+t,function(){ve(this,e).duration=t}}function tu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Jl:eu)(t,e)):me(this.node(),t).duration}function nu(e,t){if(typeof t!="function")throw new Error;return function(){ve(this,e).ease=t}}function ou(e){var t=this._id;return arguments.length?this.each(nu(t,e)):me(this.node(),t).ease}function ru(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ve(this,e).ease=n}}function iu(e){if(typeof e!="function")throw new Error;return this.each(ru(this._id,e))}function su(e){typeof e!="function"&&(e=yr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new Ee(o,this._parents,this._name,this._id)}function au(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=t[a],l=n[a],f=c.length,u=s[a]=new Array(f),d,g=0;g<f;++g)(d=c[g]||l[g])&&(u[g]=d);for(;a<o;++a)s[a]=t[a];return new Ee(s,this._parents,this._name,this._id)}function cu(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function lu(e,t,n){var o,r,i=cu(t)?Yn:ve;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function uu(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(lu(n,e,t))}function du(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function fu(){return this.on("end.remove",du(this._id))}function hu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=On(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),f,u,d=0;d<c;++d)(f=a[d])&&(u=e.call(f,f.__data__,d,a))&&("__data__"in f&&(u.__data__=f.__data__),l[d]=u,tn(l[d],t,n,d,l,me(f,n)));return new Ee(i,this._parents,t,n)}function gu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=mr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,f,u=0;u<l;++u)if(f=c[u]){for(var d=e.call(f,f.__data__,u,c),g,h=me(f,n),x=0,y=d.length;x<y;++x)(g=d[x])&&tn(g,t,n,x,d,h);i.push(d),s.push(f)}return new Ee(i,s,t,n)}var pu=wt.prototype.constructor;function mu(){return new pu(this._groups,this._parents)}function yu(e,t){var n,o,r;return function(){var i=qe(this,e),s=(this.style.removeProperty(e),qe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Fr(e){return function(){this.style.removeProperty(e)}}function xu(e,t,n){var o,r=n+"",i;return function(){var s=qe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function wu(e,t,n){var o,r,i;return function(){var s=qe(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),qe(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function vu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=ve(this,e),l=c.on,f=c.value[i]==null?a||(a=Fr(t)):void 0;(l!==n||r!==f)&&(o=(n=l).copy()).on(s,r=f),c.on=o}}function bu(e,t,n){var o=(e+="")=="transform"?_l:Or;return t==null?this.styleTween(e,yu(e,o)).on("end.style."+e,Fr(e)):typeof t=="function"?this.styleTween(e,wu(e,o,Gn(this,"style."+e,t))).each(vu(this._id,e)):this.styleTween(e,xu(e,o,t),n).on("end.style."+e,null)}function _u(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Nu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&_u(e,s,n)),o}return i._value=t,i}function Eu(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Nu(e,t,n??""))}function Su(e){return function(){this.textContent=e}}function Cu(e){return function(){var t=e(this);this.textContent=t??""}}function Mu(e){return this.tween("text",typeof e=="function"?Cu(Gn(this,"text",e)):Su(e==null?"":e+""))}function ku(e){return function(t){this.textContent=e.call(this,t)}}function Iu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ku(r)),t}return o._value=e,o}function $u(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,Iu(e))}function Au(){for(var e=this._name,t=this._id,n=Vr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var f=me(c,t);tn(c,e,n,l,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Ee(o,this._parents,e,n)}function Tu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=ve(this,o),f=l.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var Lu=0;function Ee(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vr(){return++Lu}var _e=wt.prototype;Ee.prototype={constructor:Ee,select:hu,selectAll:gu,selectChild:_e.selectChild,selectChildren:_e.selectChildren,filter:su,merge:au,selection:mu,transition:Au,call:_e.call,nodes:_e.nodes,node:_e.node,size:_e.size,empty:_e.empty,each:_e.each,on:uu,attr:Xl,attrTween:Ul,style:bu,styleTween:Eu,text:Mu,textTween:$u,remove:fu,tween:jl,delay:Ql,duration:tu,ease:ou,easeVarying:iu,end:Tu,[Symbol.iterator]:_e[Symbol.iterator]};function Pu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Du={time:null,delay:0,duration:250,ease:Pu};function zu(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function ju(e){var t,n;e instanceof Ee?(t=e._id,e=e._name):(t=Vr(),(n=Du).time=Xn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&tn(c,e,t,l,s,n||zu(c,t));return new Ee(o,this._parents,e,t)}wt.prototype.interrupt=Pl;wt.prototype.transition=ju;const At=e=>()=>e;function Ru(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ne(e,t,n){this.k=e,this.x=t,this.y=n}Ne.prototype={constructor:Ne,scale:function(e){return e===1?this:new Ne(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ne(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var nn=new Ne(1,0,0);Br.prototype=Ne.prototype;function Br(e){for(;!e.__zoom;)if(!(e=e.parentNode))return nn;return e.__zoom}function xn(e){e.stopImmediatePropagation()}function st(e){e.preventDefault(),e.stopImmediatePropagation()}function Hu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ou(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function ko(){return this.__zoom||nn}function Fu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Vu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bu(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Xr(){var e=Hu,t=Ou,n=Bu,o=Fu,r=Vu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=jt,l=Qt("start","zoom","end"),f,u,d,g=500,h=150,x=0,y=10;function m(b){b.property("__zoom",ko).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",O).filter(r).on("touchstart.zoom",$).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(b,A,E,L){var I=b.selection?b.selection():b;I.property("__zoom",ko),b!==I?M(b,A,E,L):I.interrupt().each(function(){_(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(b,A,E,L){m.scaleTo(b,function(){var I=this.__zoom.k,S=typeof A=="function"?A.apply(this,arguments):A;return I*S},E,L)},m.scaleTo=function(b,A,E,L){m.transform(b,function(){var I=t.apply(this,arguments),S=this.__zoom,z=E==null?w(I):typeof E=="function"?E.apply(this,arguments):E,R=S.invert(z),j=typeof A=="function"?A.apply(this,arguments):A;return n(p(N(S,j),z,R),I,s)},E,L)},m.translateBy=function(b,A,E,L){m.transform(b,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,L)},m.translateTo=function(b,A,E,L,I){m.transform(b,function(){var S=t.apply(this,arguments),z=this.__zoom,R=L==null?w(S):typeof L=="function"?L.apply(this,arguments):L;return n(nn.translate(R[0],R[1]).scale(z.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof E=="function"?-E.apply(this,arguments):-E),S,s)},L,I)};function N(b,A){return A=Math.max(i[0],Math.min(i[1],A)),A===b.k?b:new Ne(A,b.x,b.y)}function p(b,A,E){var L=A[0]-E[0]*b.k,I=A[1]-E[1]*b.k;return L===b.x&&I===b.y?b:new Ne(b.k,L,I)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function M(b,A,E,L){b.on("start.zoom",function(){_(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(L).end()}).tween("zoom",function(){var I=this,S=arguments,z=_(I,S).event(L),R=t.apply(I,S),j=E==null?w(R):typeof E=="function"?E.apply(I,S):E,V=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),B=I.__zoom,Y=typeof A=="function"?A.apply(I,S):A,U=c(B.invert(j).concat(V/B.k),Y.invert(j).concat(V/Y.k));return function(W){if(W===1)W=Y;else{var F=U(W),G=V/F[2];W=new Ne(G,j[0]-F[0]*G,j[1]-F[1]*G)}z.zoom(null,W)}})}function _(b,A,E){return!E&&b.__zooming||new C(b,A)}function C(b,A){this.that=b,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,A),this.taps=0}C.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,A){return this.mouse&&b!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var A=le(this.that).datum();l.call(b,this.that,new Ru(b,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),A)}};function T(b,...A){if(!e.apply(this,arguments))return;var E=_(this,A).event(b),L=this.__zoom,I=Math.max(i[0],Math.min(i[1],L.k*Math.pow(2,o.apply(this,arguments)))),S=fe(b);if(E.wheel)(E.mouse[0][0]!==S[0]||E.mouse[0][1]!==S[1])&&(E.mouse[1]=L.invert(E.mouse[0]=S)),clearTimeout(E.wheel);else{if(L.k===I)return;E.mouse=[S,L.invert(S)],Ot(this),E.start()}st(b),E.wheel=setTimeout(z,h),E.zoom("mouse",n(p(N(L,I),E.mouse[0],E.mouse[1]),E.extent,s));function z(){E.wheel=null,E.end()}}function D(b,...A){if(d||!e.apply(this,arguments))return;var E=b.currentTarget,L=_(this,A,!0).event(b),I=le(b.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",V,!0),S=fe(b,E),z=b.clientX,R=b.clientY;Mr(b.view),xn(b),L.mouse=[S,this.__zoom.invert(S)],Ot(this),L.start();function j(B){if(st(B),!L.moved){var Y=B.clientX-z,U=B.clientY-R;L.moved=Y*Y+U*U>x}L.event(B).zoom("mouse",n(p(L.that.__zoom,L.mouse[0]=fe(B,E),L.mouse[1]),L.extent,s))}function V(B){I.on("mousemove.zoom mouseup.zoom",null),kr(B.view,L.moved),st(B),L.event(B).end()}}function O(b,...A){if(e.apply(this,arguments)){var E=this.__zoom,L=fe(b.changedTouches?b.changedTouches[0]:b,this),I=E.invert(L),S=E.k*(b.shiftKey?.5:2),z=n(p(N(E,S),L,I),t.apply(this,A),s);st(b),a>0?le(this).transition().duration(a).call(M,z,L,b):le(this).call(m.transform,z,L,b)}}function $(b,...A){if(e.apply(this,arguments)){var E=b.touches,L=E.length,I=_(this,A,b.changedTouches.length===L).event(b),S,z,R,j;for(xn(b),z=0;z<L;++z)R=E[z],j=fe(R,this),j=[j,this.__zoom.invert(j),R.identifier],I.touch0?!I.touch1&&I.touch0[2]!==j[2]&&(I.touch1=j,I.taps=0):(I.touch0=j,S=!0,I.taps=1+!!f);f&&(f=clearTimeout(f)),S&&(I.taps<2&&(u=j[0],f=setTimeout(function(){f=null},g)),Ot(this),I.start())}}function P(b,...A){if(this.__zooming){var E=_(this,A).event(b),L=b.changedTouches,I=L.length,S,z,R,j;for(st(b),S=0;S<I;++S)z=L[S],R=fe(z,this),E.touch0&&E.touch0[2]===z.identifier?E.touch0[0]=R:E.touch1&&E.touch1[2]===z.identifier&&(E.touch1[0]=R);if(z=E.that.__zoom,E.touch1){var V=E.touch0[0],B=E.touch0[1],Y=E.touch1[0],U=E.touch1[1],W=(W=Y[0]-V[0])*W+(W=Y[1]-V[1])*W,F=(F=U[0]-B[0])*F+(F=U[1]-B[1])*F;z=N(z,Math.sqrt(W/F)),R=[(V[0]+Y[0])/2,(V[1]+Y[1])/2],j=[(B[0]+U[0])/2,(B[1]+U[1])/2]}else if(E.touch0)R=E.touch0[0],j=E.touch0[1];else return;E.zoom("touch",n(p(z,R,j),E.extent,s))}}function H(b,...A){if(this.__zooming){var E=_(this,A).event(b),L=b.changedTouches,I=L.length,S,z;for(xn(b),d&&clearTimeout(d),d=setTimeout(function(){d=null},g),S=0;S<I;++S)z=L[S],E.touch0&&E.touch0[2]===z.identifier?delete E.touch0:E.touch1&&E.touch1[2]===z.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(z=fe(z,this),Math.hypot(u[0]-z[0],u[1]-z[1])<y)){var R=le(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return m.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:At(+b),m):o},m.filter=function(b){return arguments.length?(e=typeof b=="function"?b:At(!!b),m):e},m.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:At(!!b),m):r},m.extent=function(b){return arguments.length?(t=typeof b=="function"?b:At([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),m):t},m.scaleExtent=function(b){return arguments.length?(i[0]=+b[0],i[1]=+b[1],m):[i[0],i[1]]},m.translateExtent=function(b){return arguments.length?(s[0][0]=+b[0][0],s[1][0]=+b[1][0],s[0][1]=+b[0][1],s[1][1]=+b[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(b){return arguments.length?(n=b,m):n},m.duration=function(b){return arguments.length?(a=+b,m):a},m.interpolate=function(b){return arguments.length?(c=b,m):c},m.on=function(){var b=l.on.apply(l,arguments);return b===l?m:b},m.clickDistance=function(b){return arguments.length?(x=(b=+b)*b,m):Math.sqrt(x)},m.tapDistance=function(b){return arguments.length?(y=+b,m):y},m}const we={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},pt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Yr=["Enter"," ","Escape"],Gr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ke;(function(e){e.Strict="strict",e.Loose="loose"})(Ke||(Ke={}));var ze;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ze||(ze={}));var Ze;(function(e){e.Partial="partial",e.Full="full"})(Ze||(Ze={}));const Wr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var qt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(qt||(qt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const Io={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function qr(e){return e===null?null:e?"valid":"invalid"}const Ur=e=>"id"in e&&"source"in e&&"target"in e,Xu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Wn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),bt=(e,t=[0,0])=>{const{width:n,height:o}=Se(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Yu=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Wn(r)?r:t.nodeLookup.get(r.id));const a=s?Ut(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return on(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return rn(n)},_t=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=on(n,Ut(r)),o=!0)}),o?rn(n):{x:0,y:0,width:0,height:0}},qn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...Et(t,[n,o,r]),width:t.width/r,height:t.height/r},c=[];for(const l of e.values()){const{measured:f,selectable:u=!0,hidden:d=!1}=l;if(s&&!u||d)continue;const g=f.width??l.width??l.initialWidth??null,h=f.height??l.height??l.initialHeight??null,x=mt(a,Je(l)),y=(g??0)*(h??0),m=i&&x>0;(!l.internals.handleBounds||m||x>=y||l.dragging)&&c.push(l)}return c},Gu=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Wu(e,t){const n=new Map,o=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function qu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Wu(e,s),c=_t(a),l=Un(c,t,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function Kr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},f=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",we.error005());else{const g=a.measured.width,h=a.measured.height;g&&h&&(u=[[c,l],[c+g,l+h]])}else a&&et(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const d=et(u)?He(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",we.error015())),{position:{x:d.x-c+(s.measured.width??0)*f[0],y:d.y-l+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function Uu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const g=i.has(d.id),h=!g&&d.parentId&&s.find(x=>x.id===d.parentId);(g||h)&&s.push(d)}const a=new Set(t.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),f=Gu(s,c);for(const d of c)a.has(d.id)&&!f.find(h=>h.id===d.id)&&f.push(d);if(!r)return{edges:f,nodes:s};const u=await r({nodes:s,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:s}:{edges:[],nodes:[]}:u}const Qe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),He=(e={x:0,y:0},t,n)=>({x:Qe(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Qe(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Zr(e,t,n){const{width:o,height:r}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return He(e,[[i,s],[i+o,s+r]],t)}const $o=(e,t,n)=>e<t?Qe(Math.abs(e-t),1,t)/t:e>n?-Qe(Math.abs(e-n),1,t)/t:0,Qr=(e,t,n=15,o=40)=>{const r=$o(e.x,o,t.width-o)*n,i=$o(e.y,o,t.height-o)*n;return[r,i]},on=(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)}),Pn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),rn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Je=(e,t=[0,0])=>{var r,i;const{x:n,y:o}=Wn(e)?e.internals.positionAbsolute:bt(e,t);return{x:n,y:o,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{var r,i;const{x:n,y:o}=Wn(e)?e.internals.positionAbsolute:bt(e,t);return{x:n,y:o,x2:n+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:o+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},Jr=(e,t)=>rn(on(Pn(e),Pn(t))),mt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Ao=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),Ku=(e,t)=>{},Nt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Et=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Nt(a,s):a},Kt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Be(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Zu(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Be(e,n),r=Be(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Be(e.top??e.y??0,n),r=Be(e.bottom??e.y??0,n),i=Be(e.left??e.x??0,t),s=Be(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Qu(e,t,n,o,r,i){const{x:s,y:a}=Kt(e,[t,n,o]),{x:c,y:l}=Kt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),f=r-c,u=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(f),bottom:Math.floor(u)}}const Un=(e,t,n,o,r,i)=>{const s=Zu(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),f=Qe(l,o,r),u=e.x+e.width/2,d=e.y+e.height/2,g=t/2-u*f,h=n/2-d*f,x=Qu(e,g,h,f,t,n),y={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:g-y.left+y.right,y:h-y.top+y.bottom,zoom:f}},yt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function et(e){return e!=null&&e!=="parent"}function Se(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function ei(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function ti(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function To(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ju(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function ed(e){return{...Gr,...e||{}}}function ut(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=pe(e),a=Et({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:c,y:l}=n?Nt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Kn=e=>({width:e.offsetWidth,height:e.offsetHeight}),ni=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},td=["INPUT","SELECT","TEXTAREA"];function oi(e){var o,r;const t=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:td.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ri=e=>"clientX"in e,pe=(e,t)=>{var i,s;const n=ri(e),o=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,r=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:o-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},Lo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Kn(s)}})};function ii({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,f=Math.abs(c-e),u=Math.abs(l-t);return[c,l,f,u]}function Tt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Po({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-Tt(t-o,i),n];case X.Right:return[t+Tt(o-t,i),n];case X.Top:return[t,n-Tt(n-r,i)];case X.Bottom:return[t,n+Tt(r-n,i)]}}function si({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,c]=Po({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,f]=Po({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,d,g,h]=ii({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:f});return[`M${e},${t} C${a},${c} ${l},${f} ${o},${r}`,u,d,g,h]}function ai({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function nd({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function od({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=on(Ut(e),Ut(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return mt(s,rn(i))>0}const rd=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,id=(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)),sd=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||rd;let r;return Ur(e)?r={...e}:r={...e,id:o(e)},id(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function ci({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=ai({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Do={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},ad=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},zo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function cd({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=Do[t],c=Do[o],l={x:e.x+a.x*i,y:e.y+a.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},u=ad({source:l,sourcePosition:t,target:f}),d=u.x!==0?"x":"y",g=u[d];let h=[],x,y;const m={x:0,y:0},N={x:0,y:0},[,,p,w]=ai({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(x=r.x??l.x+(f.x-l.x)*s,y=r.y??(l.y+f.y)/2):(x=r.x??(l.x+f.x)/2,y=r.y??l.y+(f.y-l.y)*s);const _=[{x,y:l.y},{x,y:f.y}],C=[{x:l.x,y},{x:f.x,y}];a[d]===g?h=d==="x"?_:C:h=d==="x"?C:_}else{const _=[{x:l.x,y:f.y}],C=[{x:f.x,y:l.y}];if(d==="x"?h=a.x===g?C:_:h=a.y===g?_:C,t===o){const P=Math.abs(e[d]-n[d]);if(P<=i){const H=Math.min(i-1,i-P);a[d]===g?m[d]=(l[d]>e[d]?-1:1)*H:N[d]=(f[d]>n[d]?-1:1)*H}}if(t!==o){const P=d==="x"?"y":"x",H=a[d]===c[P],b=l[P]>f[P],A=l[P]<f[P];(a[d]===1&&(!H&&b||H&&A)||a[d]!==1&&(!H&&A||H&&b))&&(h=d==="x"?_:C)}const T={x:l.x+m.x,y:l.y+m.y},D={x:f.x+N.x,y:f.y+N.y},O=Math.max(Math.abs(T.x-h[0].x),Math.abs(D.x-h[0].x)),$=Math.max(Math.abs(T.y-h[0].y),Math.abs(D.y-h[0].y));O>=$?(x=(T.x+D.x)/2,y=h[0].y):(x=h[0].x,y=(T.y+D.y)/2)}return[[e,{x:l.x+m.x,y:l.y+m.y},...h,{x:f.x+N.x,y:f.y+N.y},n],x,y,p,w]}function ld(e,t,n,o){const r=Math.min(zo(e,t)/2,zo(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*f}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function Dn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:f=.5}){const[u,d,g,h,x]=cd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:f});return[u.reduce((m,N,p)=>{let w="";return p>0&&p<u.length-1?w=ld(u[p-1],N,u[p+1],s):w=`${p===0?"M":"L"}${N.x} ${N.y}`,m+=w,m},""),d,g,h,x]}function jo(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ud(e){var u;const{sourceNode:t,targetNode:n}=e;if(!jo(t)||!jo(n))return null;const o=t.internals.handleBounds||Ro(t.handles),r=n.internals.handleBounds||Ro(n.handles),i=Ho((o==null?void 0:o.source)??[],e.sourceHandle),s=Ho(e.connectionMode===Ke.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),e.targetHandle);if(!i||!s)return(u=e.onError)==null||u.call(e,"008",we.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||X.Bottom,c=(s==null?void 0:s.position)||X.Top,l=Oe(t,i,a),f=Oe(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:c}}function Ro(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Oe(e,t,n=X.Left,o=!1){const r=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Se(e);if(o)return{x:r+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function Ho(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function zn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function dd(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=zn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const li=1e3,fd=10,Zn={nodeOrigin:[0,0],nodeExtent:pt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},hd={...Zn,checkEquality:!0};function Qn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function gd(e,t,n){const o=Qn(Zn,n);for(const r of e.values())if(r.parentId)eo(r,e,t,o);else{const i=bt(r,o.nodeOrigin),s=et(r.extent)?r.extent:o.nodeExtent,a=He(i,s,Se(r));r.internals.positionAbsolute=a}}function pd(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Jn(e){return e==="manual"}function jn(e,t,n,o={}){var l,f;const r=Qn(hd,o),i={i:0},s=new Map(t),a=r!=null&&r.elevateNodesOnSelect&&!Jn(r.zIndexMode)?li:0;let c=e.length>0;t.clear(),n.clear();for(const u of e){let d=s.get(u.id);if(r.checkEquality&&u===(d==null?void 0:d.internals.userNode))t.set(u.id,d);else{const g=bt(u,r.nodeOrigin),h=et(u.extent)?u.extent:r.nodeExtent,x=He(g,h,Se(u));d={...r.defaults,...u,measured:{width:(l=u.measured)==null?void 0:l.width,height:(f=u.measured)==null?void 0:f.height},internals:{positionAbsolute:x,handleBounds:pd(u,d),z:ui(u,a,r.zIndexMode),userNode:u}},t.set(u.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(c=!1),u.parentId&&eo(d,t,n,o,i)}return c}function md(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function eo(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Qn(Zn,o),l=e.parentId,f=t.get(l);if(!f){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}md(e,n),r&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++r.i,f.internals.z=f.internals.z+r.i*fd),r&&f.internals.rootParentIndex!==void 0&&(r.i=f.internals.rootParentIndex);const u=i&&!Jn(c)?li:0,{x:d,y:g,z:h}=yd(e,f,s,a,u,c),{positionAbsolute:x}=e.internals,y=d!==x.x||g!==x.y;(y||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:d,y:g}:x,z:h}})}function ui(e,t,n){const o=ge(e.zIndex)?e.zIndex:0;return Jn(n)?o:o+(e.selected?t:0)}function yd(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,c=Se(e),l=bt(e,n),f=et(e.extent)?He(l,e.extent,c):l;let u=He({x:s+f.x,y:a+f.y},o,c);e.extent==="parent"&&(u=Zr(u,c,t));const d=ui(e,r,i),g=t.internals.z??0;return{x:u.x,y:u.y,z:g>=d?g+1:d}}function to(e,t,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Je(c),f=Jr(l,a.rect);i.set(a.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const f=c.internals.positionAbsolute,u=Se(c),d=c.origin??o,g=a.x<f.x?Math.round(Math.abs(f.x-a.x)):0,h=a.y<f.y?Math.round(Math.abs(f.y-a.y)):0,x=Math.max(u.width,Math.round(a.width)),y=Math.max(u.height,Math.round(a.height)),m=(x-u.width)*d[0],N=(y-u.height)*d[1];(g>0||h>0||m||N)&&(r.push({id:l,type:"position",position:{x:c.position.x-g+m,y:c.position.y-h+N}}),(p=n.get(l))==null||p.forEach(w=>{e.some(M=>M.id===w.id)||r.push({id:w.id,type:"position",position:{x:w.position.x+g,y:w.position.y+h}})})),(u.width<a.width||u.height<a.height||g||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:x+(g?d[0]*g-m:0),height:y+(h?d[1]*h-N:0)}})}),r}function xd(e,t,n,o,r,i,s){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],f=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const g of e.values()){const h=t.get(g.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),c=!0;continue}const x=Kn(g.nodeElement),y=h.measured.width!==x.width||h.measured.height!==x.height;if(!!(x.width&&x.height&&(y||!h.internals.handleBounds||g.force))){const N=g.nodeElement.getBoundingClientRect(),p=et(h.extent)?h.extent:i;let{positionAbsolute:w}=h.internals;h.parentId&&h.extent==="parent"?w=Zr(w,x,t.get(h.parentId)):p&&(w=He(w,p,x));const M={...h,measured:x,internals:{...h.internals,positionAbsolute:w,handleBounds:{source:Lo("source",g.nodeElement,N,u,h.id),target:Lo("target",g.nodeElement,N,u,h.id)}}};t.set(h.id,M),h.parentId&&eo(M,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,y&&(l.push({id:h.id,type:"dimensions",dimensions:x}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:Je(M,r)}))}}if(d.length>0){const g=to(d,t,n,r);l.push(...g)}return{changes:l,updatedInternals:c}}async function wd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function Oo(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function di(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,f=`${i}-${a}--${r}-${s}`;Oo("source",c,f,e,r,s),Oo("target",c,l,e,i,a),t.set(o.id,o)}}function fi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:fi(n,t):!1}function Fo(e,t,n){var r;let o=e;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,t))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function vd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!fi(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function wn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){var s,a,c;const r=[];for(const[l,f]of t){const u=(s=n.get(l))==null?void 0:s.internals.userNode;u&&r.push({...u,position:f.position,dragging:o})}if(!e)return[r[0],r];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:o}:r[0],r]}function bd({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=Nt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function _d({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},f=null,u=!1,d=null,g=!1,h=!1,x=null;function y({noDragClassName:N,handleSelector:p,domNode:w,isSelectable:M,nodeId:_,nodeClickDistance:C=0}){d=le(w);function T({x:P,y:H}){const{nodeLookup:b,nodeExtent:A,snapGrid:E,snapToGrid:L,nodeOrigin:I,onNodeDrag:S,onSelectionDrag:z,onError:R,updateNodePositions:j}=t();i={x:P,y:H};let V=!1;const B=a.size>1,Y=B&&A?Pn(_t(a)):null,U=B&&L?bd({dragItems:a,snapGrid:E,x:P,y:H}):null;for(const[W,F]of a){if(!b.has(W))continue;let G={x:P-F.distance.x,y:H-F.distance.y};L&&(G=U?{x:Math.round(G.x+U.x),y:Math.round(G.y+U.y)}:Nt(G,E));let Q=null;if(B&&A&&!F.extent&&Y){const{positionAbsolute:q}=F.internals,te=q.x-Y.x+A[0][0],oe=q.x+F.measured.width-Y.x2+A[1][0],ee=q.y-Y.y+A[0][1],ae=q.y+F.measured.height-Y.y2+A[1][1];Q=[[te,ee],[oe,ae]]}const{position:Z,positionAbsolute:K}=Kr({nodeId:W,nextPosition:G,nodeLookup:b,nodeExtent:Q||A,nodeOrigin:I,onError:R});V=V||F.position.x!==Z.x||F.position.y!==Z.y,F.position=Z,F.internals.positionAbsolute=K}if(h=h||V,!!V&&(j(a,!0),x&&(o||S||!_&&z))){const[W,F]=wn({nodeId:_,dragItems:a,nodeLookup:b});o==null||o(x,a,W,F),S==null||S(x,W,F),_||z==null||z(x,F)}}async function D(){if(!f)return;const{transform:P,panBy:H,autoPanSpeed:b,autoPanOnNodeDrag:A}=t();if(!A){c=!1,cancelAnimationFrame(s);return}const[E,L]=Qr(l,f,b);(E!==0||L!==0)&&(i.x=(i.x??0)-E/P[2],i.y=(i.y??0)-L/P[2],await H({x:E,y:L})&&T(i)),s=requestAnimationFrame(D)}function O(P){var B;const{nodeLookup:H,multiSelectionActive:b,nodesDraggable:A,transform:E,snapGrid:L,snapToGrid:I,selectNodesOnDrag:S,onNodeDragStart:z,onSelectionDragStart:R,unselectNodesAndEdges:j}=t();u=!0,(!S||!M)&&!b&&_&&((B=H.get(_))!=null&&B.selected||j()),M&&S&&_&&(e==null||e(_));const V=ut(P.sourceEvent,{transform:E,snapGrid:L,snapToGrid:I,containerBounds:f});if(i=V,a=vd(H,A,V,_),a.size>0&&(n||z||!_&&R)){const[Y,U]=wn({nodeId:_,dragItems:a,nodeLookup:H});n==null||n(P.sourceEvent,a,Y,U),z==null||z(P.sourceEvent,Y,U),_||R==null||R(P.sourceEvent,U)}}const $=Ir().clickDistance(C).on("start",P=>{const{domNode:H,nodeDragThreshold:b,transform:A,snapGrid:E,snapToGrid:L}=t();f=(H==null?void 0:H.getBoundingClientRect())||null,g=!1,h=!1,x=P.sourceEvent,b===0&&O(P),i=ut(P.sourceEvent,{transform:A,snapGrid:E,snapToGrid:L,containerBounds:f}),l=pe(P.sourceEvent,f)}).on("drag",P=>{const{autoPanOnNodeDrag:H,transform:b,snapGrid:A,snapToGrid:E,nodeDragThreshold:L,nodeLookup:I}=t(),S=ut(P.sourceEvent,{transform:b,snapGrid:A,snapToGrid:E,containerBounds:f});if(x=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||_&&!I.has(_))&&(g=!0),!g){if(!c&&H&&u&&(c=!0,D()),!u){const z=pe(P.sourceEvent,f),R=z.x-l.x,j=z.y-l.y;Math.sqrt(R*R+j*j)>L&&O(P)}(i.x!==S.xSnapped||i.y!==S.ySnapped)&&a&&u&&(l=pe(P.sourceEvent,f),T(S))}}).on("end",P=>{if(!(!u||g)&&(c=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:b,onNodeDragStop:A,onSelectionDragStop:E}=t();if(h&&(b(a,!1),h=!1),r||A||!_&&E){const[L,I]=wn({nodeId:_,dragItems:a,nodeLookup:H,dragging:!1});r==null||r(P.sourceEvent,a,L,I),A==null||A(P.sourceEvent,L,I),_||E==null||E(P.sourceEvent,I)}}}).filter(P=>{const H=P.target;return!P.button&&(!N||!Fo(H,`.${N}`,w))&&(!p||Fo(H,p,w))});d.call($)}function m(){d==null||d.on(".drag",null)}return{update:y,destroy:m}}function Nd(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())mt(r,Je(i))>0&&o.push(i);return o}const Ed=250;function Sd(e,t,n,o){var a,c;let r=[],i=1/0;const s=Nd(e,n,t+Ed);for(const l of s){const f=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of f){if(o.nodeId===u.nodeId&&o.type===u.type&&o.id===u.id)continue;const{x:d,y:g}=Oe(l,u,u.position,!0),h=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(g-e.y,2));h>t||(h<i?(r=[{...u,x:d,y:g}],i=h):h===i&&r.push({...u,x:d,y:g}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(f=>f.type===l)??r[0]}return r[0]}function hi(e,t,n,o,r,i=!1){var l,f,u;const s=o.get(e);if(!s)return null;const a=r==="strict"?(l=s.internals.handleBounds)==null?void 0:l[t]:[...((f=s.internals.handleBounds)==null?void 0:f.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Oe(s,c,c.position,!0)}:c}function gi(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Cd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const pi=()=>!0;function Md(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:f,flowId:u,panBy:d,cancelConnection:g,onConnectStart:h,onConnect:x,onConnectEnd:y,isValidConnection:m=pi,onReconnectEnd:N,updateConnection:p,getTransform:w,getFromHandle:M,autoPanSpeed:_,dragThreshold:C=1,handleDomNode:T}){const D=ni(e.target);let O=0,$;const{x:P,y:H}=pe(e),b=gi(i,T),A=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!A||!b)return;const L=hi(r,b,o,c,t);if(!L)return;let I=pe(e,A),S=!1,z=null,R=!1,j=null;function V(){if(!f||!A)return;const[Z,K]=Qr(I,A,_);d({x:Z,y:K}),O=requestAnimationFrame(V)}const B={...L,nodeId:r,type:b,position:L.position},Y=c.get(r);let W={inProgress:!0,isValid:null,from:Oe(Y,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:Y,to:I,toHandle:null,toPosition:Io[B.position],toNode:null,pointer:I};function F(){E=!0,p(W),h==null||h(e,{nodeId:r,handleId:o,handleType:b})}C===0&&F();function G(Z){if(!E){const{x:ae,y:Ce}=pe(Z),be=ae-P,Te=Ce-H;if(!(be*be+Te*Te>C*C))return;F()}if(!M()||!B){Q(Z);return}const K=w();I=pe(Z,A),$=Sd(Et(I,K,!1,[1,1]),n,c,B),S||(V(),S=!0);const q=mi(Z,{handle:$,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:D,lib:l,flowId:u,nodeLookup:c});j=q.handleDomNode,z=q.connection,R=Cd(!!$,q.isValid);const te=c.get(r),oe=te?Oe(te,B,X.Left,!0):W.from,ee={...W,from:oe,isValid:R,to:q.toHandle&&R?Kt({x:q.toHandle.x,y:q.toHandle.y},K):I,toHandle:q.toHandle,toPosition:R&&q.toHandle?q.toHandle.position:Io[B.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:I};p(ee),W=ee}function Q(Z){if(!("touches"in Z&&Z.touches.length>0)){if(E){($||j)&&z&&R&&(x==null||x(z));const{inProgress:K,...q}=W,te={...q,toPosition:W.toHandle?W.toPosition:null};y==null||y(Z,te),i&&(N==null||N(Z,te))}g(),cancelAnimationFrame(O),S=!1,R=!1,z=null,j=null,D.removeEventListener("mousemove",G),D.removeEventListener("mouseup",Q),D.removeEventListener("touchmove",G),D.removeEventListener("touchend",Q)}}D.addEventListener("mousemove",G),D.addEventListener("mouseup",Q),D.addEventListener("touchmove",G),D.addEventListener("touchend",Q)}function mi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=pi,nodeLookup:f}){const u=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:g,y:h}=pe(e),x=s.elementFromPoint(g,h),y=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:d,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const N=gi(void 0,y),p=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),M=y.classList.contains("connectable"),_=y.classList.contains("connectableend");if(!p||!N)return m;const C={source:u?p:o,sourceHandle:u?w:r,target:u?o:p,targetHandle:u?r:w};m.connection=C;const D=M&&_&&(n===Ke.Strict?u&&N==="source"||!u&&N==="target":p!==o||w!==r);m.isValid=D&&l(C),m.toHandle=hi(p,N,w,f,n,!0)}return m}const Rn={onPointerDown:Md,isValid:mi};function kd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:a,width:c,height:l,zoomStep:f=1,pannable:u=!0,zoomable:d=!0,inversePan:g=!1}){const h=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),M=p.sourceEvent.ctrlKey&&yt()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*f,C=w[2]*Math.pow(2,_*M);t.scaleTo(C)};let x=[0,0];const y=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(x=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const M=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[M[0]-x[0],M[1]-x[1]];x=M;const C=o()*Math.max(w[2],Math.log(w[2]))*(g?-1:1),T={x:w[0]-_[0]*C,y:w[1]-_[1]*C},D=[[0,0],[c,l]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},D,a)},N=Xr().on("start",y).on("zoom",u?m:null).on("zoom.wheel",d?h:null);r.call(N,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const sn=e=>({x:e.x,y:e.y,zoom:e.k}),vn=({x:e,y:t,zoom:n})=>nn.translate(e,t).scale(n),Xe=(e,t)=>e.target.closest(`.${t}`),yi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Id=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,bn=(e,t=0,n=Id,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},xi=e=>{const t=e.ctrlKey&&yt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function $d({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return f=>{if(Xe(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&s){const y=fe(f),m=xi(f),N=u*Math.pow(2,m);o.scaleTo(n,N,y,f);return}const d=f.deltaMode===1?20:1;let g=r===ze.Vertical?0:f.deltaX*d,h=r===ze.Horizontal?0:f.deltaY*d;!yt()&&f.shiftKey&&r!==ze.Vertical&&(g=f.deltaY*d,h=0),o.translateBy(n,-(g/u)*i,-(h/u)*i,{internal:!0});const x=sn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(f,x),e.panScrollTimeout=setTimeout(()=>{l==null||l(f,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(f,x))}}function Ad({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Xe(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Td({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=sn(o.transform);e.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(o.sourceEvent,r))}}function Ld({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&yi(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,sn(i.transform)))}}function Pd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&yi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const c=sn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,c)},n?150:0)}}}function Dd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:f}){return u=>{var y;const d=e||t,g=n&&u.ctrlKey,h=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Xe(u,`${l}-flow__node`)||Xe(u,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||f&&!h||Xe(u,a)&&h||Xe(u,c)&&(!h||r&&h&&!e)||!n&&u.ctrlKey&&h)return!1;if(!n&&u.type==="touchstart"&&((y=u.touches)==null?void 0:y.length)>1)return u.preventDefault(),!1;if(!d&&!r&&!g&&h||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||h)&&x}}function zd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),u=Xr().scaleExtent([t,n]).translateExtent(o),d=le(e).call(u);N({x:r.x,y:r.y,zoom:Qe(r.zoom,t,n)},[[0,0],[f.width,f.height]],o);const g=d.on("wheel.zoom"),h=d.on("dblclick.zoom");u.wheelDelta(xi);function x($,P){return d?new Promise(H=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?lt:jt).transform(bn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>H(!0)),$)}):Promise.resolve(!1)}function y({noWheelClassName:$,noPanClassName:P,onPaneContextMenu:H,userSelectionActive:b,panOnScroll:A,panOnDrag:E,panOnScrollMode:L,panOnScrollSpeed:I,preventScrolling:S,zoomOnPinch:z,zoomOnScroll:R,zoomOnDoubleClick:j,zoomActivationKeyPressed:V,lib:B,onTransformChange:Y,connectionInProgress:U,paneClickDistance:W,selectionOnDrag:F}){b&&!l.isZoomingOrPanning&&m();const G=A&&!V&&!b;u.clickDistance(F?1/0:!ge(W)||W<0?0:W);const Q=G?$d({zoomPanValues:l,noWheelClassName:$,d3Selection:d,d3Zoom:u,panOnScrollMode:L,panOnScrollSpeed:I,zoomOnPinch:z,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Ad({noWheelClassName:$,preventScrolling:S,d3ZoomHandler:g});if(d.on("wheel.zoom",Q,{passive:!1}),!b){const K=Td({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});u.on("start",K);const q=Ld({zoomPanValues:l,panOnDrag:E,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:Y});u.on("zoom",q);const te=Pd({zoomPanValues:l,panOnDrag:E,panOnScroll:A,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:c});u.on("end",te)}const Z=Dd({zoomActivationKeyPressed:V,panOnDrag:E,zoomOnScroll:R,panOnScroll:A,zoomOnDoubleClick:j,zoomOnPinch:z,userSelectionActive:b,noPanClassName:P,noWheelClassName:$,lib:B,connectionInProgress:U});u.filter(Z),j?d.on("dblclick.zoom",h):d.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function N($,P,H){const b=vn($),A=u==null?void 0:u.constrain()(b,P,H);return A&&await x(A),new Promise(E=>E(A))}async function p($,P){const H=vn($);return await x(H,P),new Promise(b=>b(H))}function w($){if(d){const P=vn($),H=d.property("__zoom");(H.k!==$.zoom||H.x!==$.x||H.y!==$.y)&&(u==null||u.transform(d,P,null,{sync:!0}))}}function M(){const $=d?Br(d.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}function _($,P){return d?new Promise(H=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?lt:jt).scaleTo(bn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>H(!0)),$)}):Promise.resolve(!1)}function C($,P){return d?new Promise(H=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?lt:jt).scaleBy(bn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>H(!0)),$)}):Promise.resolve(!1)}function T($){u==null||u.scaleExtent($)}function D($){u==null||u.translateExtent($)}function O($){const P=!ge($)||$<0?0:$;u==null||u.clickDistance(P)}return{update:y,destroy:m,setViewport:p,setViewportConstrained:N,getViewport:M,scaleTo:_,scaleBy:C,setScaleExtent:T,setTranslateExtent:D,syncViewport:w,setClickDistance:O}}var Fe;(function(e){e.Line="line",e.Handle="handle"})(Fe||(Fe={}));const jd=["top-left","top-right","bottom-left","bottom-right"],Rd=["top","right","bottom","left"];function Hd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Vo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Me(e,t){return Math.max(0,t-e)}function ke(e,t){return Math.max(0,e-t)}function Lt(e,t,n){return Math.max(0,t-e,e-n)}function Bo(e,t){return e?!t:t}function Od(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:f,isVertical:u}=t,d=f&&u,{xSnapped:g,ySnapped:h}=n,{minWidth:x,maxWidth:y,minHeight:m,maxHeight:N}=o,{x:p,y:w,width:M,height:_,aspectRatio:C}=e;let T=Math.floor(f?g-e.pointerX:0),D=Math.floor(u?h-e.pointerY:0);const O=M+(c?-T:T),$=_+(l?-D:D),P=-i[0]*M,H=-i[1]*_;let b=Lt(O,x,y),A=Lt($,m,N);if(s){let I=0,S=0;c&&T<0?I=Me(p+T+P,s[0][0]):!c&&T>0&&(I=ke(p+O+P,s[1][0])),l&&D<0?S=Me(w+D+H,s[0][1]):!l&&D>0&&(S=ke(w+$+H,s[1][1])),b=Math.max(b,I),A=Math.max(A,S)}if(a){let I=0,S=0;c&&T>0?I=ke(p+T,a[0][0]):!c&&T<0&&(I=Me(p+O,a[1][0])),l&&D>0?S=ke(w+D,a[0][1]):!l&&D<0&&(S=Me(w+$,a[1][1])),b=Math.max(b,I),A=Math.max(A,S)}if(r){if(f){const I=Lt(O/C,m,N)*C;if(b=Math.max(b,I),s){let S=0;!c&&!l||c&&!l&&d?S=ke(w+H+O/C,s[1][1])*C:S=Me(w+H+(c?T:-T)/C,s[0][1])*C,b=Math.max(b,S)}if(a){let S=0;!c&&!l||c&&!l&&d?S=Me(w+O/C,a[1][1])*C:S=ke(w+(c?T:-T)/C,a[0][1])*C,b=Math.max(b,S)}}if(u){const I=Lt($*C,x,y)/C;if(A=Math.max(A,I),s){let S=0;!c&&!l||l&&!c&&d?S=ke(p+$*C+P,s[1][0])/C:S=Me(p+(l?D:-D)*C+P,s[0][0])/C,A=Math.max(A,S)}if(a){let S=0;!c&&!l||l&&!c&&d?S=Me(p+$*C,a[1][0])/C:S=ke(p+(l?D:-D)*C,a[0][0])/C,A=Math.max(A,S)}}}D=D+(D<0?A:-A),T=T+(T<0?b:-b),r&&(d?O>$*C?D=(Bo(c,l)?-T:T)/C:T=(Bo(c,l)?-D:D)*C:f?(D=T/C,l=c):(T=D*C,c=l));const E=c?p+T:p,L=l?w+D:w;return{width:M+(c?-T:T),height:_+(l?-D:D),x:i[0]*T*(c?-1:1)+E,y:i[1]*D*(l?-1:1)+L}}const wi={width:0,height:0,x:0,y:0},Fd={...wi,pointerX:0,pointerY:0,aspectRatio:1};function Vd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Bd(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Xd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:Vo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:f,keepAspectRatio:u,resizeDirection:d,onResizeStart:g,onResize:h,onResizeEnd:x,shouldResize:y}){let m={...wi},N={...Fd};s={boundaries:f,resizeDirection:d,keepAspectRatio:u,controlDirection:Vo(l)};let p,w=null,M=[],_,C,T,D=!1;const O=Ir().on("start",$=>{const{nodeLookup:P,transform:H,snapGrid:b,snapToGrid:A,nodeOrigin:E,paneDomNode:L}=n();if(p=P.get(t),!p)return;w=(L==null?void 0:L.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:S}=ut($.sourceEvent,{transform:H,snapGrid:b,snapToGrid:A,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},N={...m,pointerX:I,pointerY:S,aspectRatio:m.width/m.height},_=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=P.get(p.parentId),C=_&&p.extent==="parent"?Vd(_):void 0),M=[],T=void 0;for(const[z,R]of P)if(R.parentId===t&&(M.push({id:z,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const j=Bd(R,p,R.origin??E);T?T=[[Math.min(j[0][0],T[0][0]),Math.min(j[0][1],T[0][1])],[Math.max(j[1][0],T[1][0]),Math.max(j[1][1],T[1][1])]]:T=j}g==null||g($,{...m})}).on("drag",$=>{const{transform:P,snapGrid:H,snapToGrid:b,nodeOrigin:A}=n(),E=ut($.sourceEvent,{transform:P,snapGrid:H,snapToGrid:b,containerBounds:w}),L=[];if(!p)return;const{x:I,y:S,width:z,height:R}=m,j={},V=p.origin??A,{width:B,height:Y,x:U,y:W}=Od(N,s.controlDirection,E,s.boundaries,s.keepAspectRatio,V,C,T),F=B!==z,G=Y!==R,Q=U!==I&&F,Z=W!==S&&G;if(!Q&&!Z&&!F&&!G)return;if((Q||Z||V[0]===1||V[1]===1)&&(j.x=Q?U:m.x,j.y=Z?W:m.y,m.x=j.x,m.y=j.y,M.length>0)){const oe=U-I,ee=W-S;for(const ae of M)ae.position={x:ae.position.x-oe+V[0]*(B-z),y:ae.position.y-ee+V[1]*(Y-R)},L.push(ae)}if((F||G)&&(j.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:m.width,j.height=G&&(!s.resizeDirection||s.resizeDirection==="vertical")?Y:m.height,m.width=j.width,m.height=j.height),_&&p.expandParent){const oe=V[0]*(j.width??0);j.x&&j.x<oe&&(m.x=oe,N.x=N.x-(j.x-oe));const ee=V[1]*(j.height??0);j.y&&j.y<ee&&(m.y=ee,N.y=N.y-(j.y-ee))}const K=Hd({width:m.width,prevWidth:z,height:m.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...m,direction:K};(y==null?void 0:y($,q))!==!1&&(D=!0,h==null||h($,q),o(j,L))}).on("end",$=>{D&&(x==null||x($,{...m}),r==null||r({...m}),D=!1)});i.call(O)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}const{useDebugValue:Yd}=la,{useSyncExternalStoreWithSelector:Gd}=ca,Wd=e=>e;function vi(e,t=Wd,n){const o=Gd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Yd(o),o}const Xo=(e,t)=>{const n=aa(e),o=(r,i=t)=>vi(n,r,i);return Object.assign(o,n),o},qd=(e,t)=>e?Xo(e,t):Xo;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const an=k.createContext(null),Ud=an.Provider,bi=we.error001();function J(e,t){const n=k.useContext(an);if(n===null)throw new Error(bi);return vi(n,e,t)}function ie(){const e=k.useContext(an);if(e===null)throw new Error(bi);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Yo={display:"none"},Kd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_i="react-flow__node-desc",Ni="react-flow__edge-desc",Zd="react-flow__aria-live",Qd=e=>e.ariaLiveMessage,Jd=e=>e.ariaLabelConfig;function ef({rfId:e}){const t=J(Qd);return v.jsx("div",{id:`${Zd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Kd,children:t})}function tf({rfId:e,disableKeyboardA11y:t}){const n=J(Jd);return v.jsxs(v.Fragment,{children:[v.jsx("div",{id:`${_i}-${e}`,style:Yo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),v.jsx("div",{id:`${Ni}-${e}`,style:Yo,children:n["edge.a11yDescription.default"]}),!t&&v.jsx(ef,{rfId:e})]})}const cn=k.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return v.jsx("div",{className:se(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});cn.displayName="Panel";function nf({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:v.jsx(cn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:v.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const of=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Pt=e=>e.id;function rf(e,t){return re(e.selectedNodes.map(Pt),t.selectedNodes.map(Pt))&&re(e.selectedEdges.map(Pt),t.selectedEdges.map(Pt))}function sf({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=J(of,rf);return k.useEffect(()=>{const r={nodes:n,edges:o};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const af=e=>!!e.onSelectionChangeHandlers;function cf({onSelectionChange:e}){const t=J(af);return e||t?v.jsx(sf,{onSelectionChange:e}):null}const Ei=[0,0],lf={x:0,y:0,zoom:1},uf=["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"],Go=[...uf,"rfId"],df=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}),Wo={translateExtent:pt,nodeOrigin:Ei,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ff(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(df,re),l=ie();k.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=Wo,a()}),[]);const f=k.useRef(Wo);return k.useEffect(()=>{for(const u of Go){const d=e[u],g=f.current[u];d!==g&&(typeof e[u]>"u"||(u==="nodes"?t(d):u==="edges"?n(d):u==="minZoom"?o(d):u==="maxZoom"?r(d):u==="translateExtent"?i(d):u==="nodeExtent"?s(d):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:ed(d)}):u==="fitView"?l.setState({fitViewQueued:d}):u==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[u]:d})))}f.current=e},Go.map(u=>e[u])),null}function qo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function hf(e){var o;const[t,n]=k.useState(e==="system"?null:e);return k.useEffect(()=>{if(e!=="system"){n(e);return}const r=qo(),i=()=>n(r!=null&&r.matches?"dark":"light");return i(),r==null||r.addEventListener("change",i),()=>{r==null||r.removeEventListener("change",i)}},[e]),t!==null?t:(o=qo())!=null&&o.matches?"dark":"light"}const Uo=typeof document<"u"?document:null;function xt(e=null,t={target:Uo,actInsideInputWithModifier:!0}){const[n,o]=k.useState(!1),r=k.useRef(!1),i=k.useRef(new Set([])),[s,a]=k.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
1
+ import{a as aa,u as ca,R as la,r as k,j as v,c as ua}from"./index-F0KL9xrN.js";function se(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=se(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var da={value:()=>{}};function Qt(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new zt(n)}function zt(e){this._=e}function fa(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}zt.prototype=Qt.prototype={constructor:zt,on:function(e,t){var n=this._,o=fa(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=ha(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=fo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=fo(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new zt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function ha(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function fo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=da,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Cn="http://www.w3.org/1999/xhtml";const ho={svg:"http://www.w3.org/2000/svg",xhtml:Cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Jt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ho.hasOwnProperty(t)?{space:ho[t],local:e}:e}function ga(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Cn&&t.documentElement.namespaceURI===Cn?t.createElement(e):t.createElementNS(n,e)}}function pa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pr(e){var t=Jt(e);return(t.local?pa:ga)(t)}function ma(){}function On(e){return e==null?ma:function(){return this.querySelector(e)}}function ya(e){typeof e!="function"&&(e=On(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,l,f=0;f<s;++f)(c=i[f])&&(l=e.call(c,c.__data__,f,i))&&("__data__"in c&&(l.__data__=c.__data__),a[f]=l);return new ue(o,this._parents)}function xa(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function wa(){return[]}function mr(e){return e==null?wa:function(){return this.querySelectorAll(e)}}function va(e){return function(){return xa(e.apply(this,arguments))}}function ba(e){typeof e=="function"?e=va(e):e=mr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new ue(o,r)}function yr(e){return function(){return this.matches(e)}}function xr(e){return function(t){return t.matches(e)}}var _a=Array.prototype.find;function Na(e){return function(){return _a.call(this.children,e)}}function Ea(){return this.firstElementChild}function Sa(e){return this.select(e==null?Ea:Na(typeof e=="function"?e:xr(e)))}var Ca=Array.prototype.filter;function Ma(){return Array.from(this.children)}function ka(e){return function(){return Ca.call(this.children,e)}}function Ia(e){return this.selectAll(e==null?Ma:ka(typeof e=="function"?e:xr(e)))}function $a(e){typeof e!="function"&&(e=yr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ue(o,this._parents)}function wr(e){return new Array(e.length)}function Aa(){return new ue(this._enter||this._groups.map(wr),this._parents)}function Ft(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ft.prototype={constructor:Ft,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ta(e){return function(){return e}}function La(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Ft(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function Pa(e,t,n,o,r,i,s){var a,c,l=new Map,f=t.length,u=i.length,d=new Array(f),g;for(a=0;a<f;++a)(c=t[a])&&(d[a]=g=s.call(c,c.__data__,a,t)+"",l.has(g)?r[a]=c:l.set(g,c));for(a=0;a<u;++a)g=s.call(e,i[a],a,i)+"",(c=l.get(g))?(o[a]=c,c.__data__=i[a],l.delete(g)):n[a]=new Ft(e,i[a]);for(a=0;a<f;++a)(c=t[a])&&l.get(d[a])===c&&(r[a]=c)}function Da(e){return e.__data__}function za(e,t){if(!arguments.length)return Array.from(this,Da);var n=t?Pa:La,o=this._parents,r=this._groups;typeof e!="function"&&(e=Ta(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var f=o[l],u=r[l],d=u.length,g=ja(e.call(f,f&&f.__data__,l,o)),h=g.length,x=a[l]=new Array(h),y=s[l]=new Array(h),m=c[l]=new Array(d);n(f,u,x,y,m,g,t);for(var N=0,p=0,w,M;N<h;++N)if(w=x[N]){for(N>=p&&(p=N+1);!(M=y[p])&&++p<h;);w._next=M||null}}return s=new ue(s,o),s._enter=a,s._exit=c,s}function ja(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ra(){return new ue(this._exit||this._groups.map(wr),this._parents)}function Ha(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Oa(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],f=o[c],u=l.length,d=a[c]=new Array(u),g,h=0;h<u;++h)(g=l[h]||f[h])&&(d[h]=g);for(;c<r;++c)a[c]=n[c];return new ue(a,this._parents)}function Fa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Va(e){e||(e=Ba);function t(u,d){return u&&d?e(u.__data__,d.__data__):!u-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,f=0;f<a;++f)(l=s[f])&&(c[f]=l);c.sort(t)}return new ue(r,this._parents).order()}function Ba(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Xa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ya(){return Array.from(this)}function Ga(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Wa(){let e=0;for(const t of this)++e;return e}function qa(){return!this.node()}function Ua(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function Ka(e){return function(){this.removeAttribute(e)}}function Za(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qa(e,t){return function(){this.setAttribute(e,t)}}function Ja(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ec(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function tc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function nc(e,t){var n=Jt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Za:Ka:typeof t=="function"?n.local?tc:ec:n.local?Ja:Qa)(n,t))}function vr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function oc(e){return function(){this.style.removeProperty(e)}}function rc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ic(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function sc(e,t,n){return arguments.length>1?this.each((t==null?oc:typeof t=="function"?ic:rc)(e,t,n??"")):qe(this.node(),e)}function qe(e,t){return e.style.getPropertyValue(t)||vr(e).getComputedStyle(e,null).getPropertyValue(t)}function ac(e){return function(){delete this[e]}}function cc(e,t){return function(){this[e]=t}}function lc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function uc(e,t){return arguments.length>1?this.each((t==null?ac:typeof t=="function"?lc:cc)(e,t)):this.node()[e]}function br(e){return e.trim().split(/^|\s+/)}function Fn(e){return e.classList||new _r(e)}function _r(e){this._node=e,this._names=br(e.getAttribute("class")||"")}_r.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Nr(e,t){for(var n=Fn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Er(e,t){for(var n=Fn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function dc(e){return function(){Nr(this,e)}}function fc(e){return function(){Er(this,e)}}function hc(e,t){return function(){(t.apply(this,arguments)?Nr:Er)(this,e)}}function gc(e,t){var n=br(e+"");if(arguments.length<2){for(var o=Fn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?hc:t?dc:fc)(n,t))}function pc(){this.textContent=""}function mc(e){return function(){this.textContent=e}}function yc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function xc(e){return arguments.length?this.each(e==null?pc:(typeof e=="function"?yc:mc)(e)):this.node().textContent}function wc(){this.innerHTML=""}function vc(e){return function(){this.innerHTML=e}}function bc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function _c(e){return arguments.length?this.each(e==null?wc:(typeof e=="function"?bc:vc)(e)):this.node().innerHTML}function Nc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ec(){return this.each(Nc)}function Sc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Cc(){return this.each(Sc)}function Mc(e){var t=typeof e=="function"?e:pr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function kc(){return null}function Ic(e,t){var n=typeof e=="function"?e:pr(e),o=t==null?kc:typeof t=="function"?t:On(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function $c(){var e=this.parentNode;e&&e.removeChild(this)}function Ac(){return this.each($c)}function Tc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Lc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Pc(e){return this.select(e?Lc:Tc)}function Dc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function zc(e){return function(t){e.call(this,t,this.__data__)}}function jc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Rc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Hc(e,t,n){return function(){var o=this.__on,r,i=zc(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Oc(e,t,n){var o=jc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,f;c<l;++c)for(r=0,f=a[c];r<i;++r)if((s=o[r]).type===f.type&&s.name===f.name)return f.value}return}for(a=t?Hc:Rc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Sr(e,t,n){var o=vr(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Fc(e,t){return function(){return Sr(this,e,t)}}function Vc(e,t){return function(){return Sr(this,e,t.apply(this,arguments))}}function Bc(e,t){return this.each((typeof t=="function"?Vc:Fc)(e,t))}function*Xc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Cr=[null];function ue(e,t){this._groups=e,this._parents=t}function wt(){return new ue([[document.documentElement]],Cr)}function Yc(){return this}ue.prototype=wt.prototype={constructor:ue,select:ya,selectAll:ba,selectChild:Sa,selectChildren:Ia,filter:$a,data:za,enter:Aa,exit:Ra,join:Ha,merge:Oa,selection:Yc,order:Fa,sort:Va,call:Xa,nodes:Ya,node:Ga,size:Wa,empty:qa,each:Ua,attr:nc,style:sc,property:uc,classed:gc,text:xc,html:_c,raise:Ec,lower:Cc,append:Mc,insert:Ic,remove:Ac,clone:Pc,datum:Dc,on:Oc,dispatch:Bc,[Symbol.iterator]:Xc};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Cr)}function Gc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=Gc(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Wc={passive:!1},dt={capture:!0,passive:!1};function pn(e){e.stopImmediatePropagation()}function Ge(e){e.preventDefault(),e.stopImmediatePropagation()}function Mr(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Ge,dt);"onselectstart"in t?n.on("selectstart.drag",Ge,dt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function kr(e,t){var n=e.document.documentElement,o=le(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ge,dt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Mt=e=>()=>e;function Mn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,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:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}Mn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function qc(e){return!e.ctrlKey&&!e.button}function Uc(){return this.parentNode}function Kc(e,t){return t??{x:e.x,y:e.y}}function Zc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ir(){var e=qc,t=Uc,n=Kc,o=Zc,r={},i=Qt("start","drag","end"),s=0,a,c,l,f,u=0;function d(w){w.on("mousedown.drag",g).filter(o).on("touchstart.drag",y).on("touchmove.drag",m,Wc).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(w,M){if(!(f||!e.call(this,w,M))){var _=p(this,t.call(this,w,M),w,M,"mouse");_&&(le(w.view).on("mousemove.drag",h,dt).on("mouseup.drag",x,dt),Mr(w.view),pn(w),l=!1,a=w.clientX,c=w.clientY,_("start",w))}}function h(w){if(Ge(w),!l){var M=w.clientX-a,_=w.clientY-c;l=M*M+_*_>u}r.mouse("drag",w)}function x(w){le(w.view).on("mousemove.drag mouseup.drag",null),kr(w.view,l),Ge(w),r.mouse("end",w)}function y(w,M){if(e.call(this,w,M)){var _=w.changedTouches,C=t.call(this,w,M),T=_.length,D,O;for(D=0;D<T;++D)(O=p(this,C,w,M,_[D].identifier,_[D]))&&(pn(w),O("start",w,_[D]))}}function m(w){var M=w.changedTouches,_=M.length,C,T;for(C=0;C<_;++C)(T=r[M[C].identifier])&&(Ge(w),T("drag",w,M[C]))}function N(w){var M=w.changedTouches,_=M.length,C,T;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),C=0;C<_;++C)(T=r[M[C].identifier])&&(pn(w),T("end",w,M[C]))}function p(w,M,_,C,T,D){var O=i.copy(),$=fe(D||_,M),P,H,b;if((b=n.call(w,new Mn("beforestart",{sourceEvent:_,target:d,identifier:T,active:s,x:$[0],y:$[1],dx:0,dy:0,dispatch:O}),C))!=null)return P=b.x-$[0]||0,H=b.y-$[1]||0,function A(E,L,I){var S=$,z;switch(E){case"start":r[T]=A,z=s++;break;case"end":delete r[T],--s;case"drag":$=fe(I||L,M),z=s;break}O.call(E,w,new Mn(E,{sourceEvent:L,subject:b,target:d,identifier:T,active:z,x:$[0]+P,y:$[1]+H,dx:$[0]-S[0],dy:$[1]-S[1],dispatch:O}),C)}}return d.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Mt(!!w),d):e},d.container=function(w){return arguments.length?(t=typeof w=="function"?w:Mt(w),d):t},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Mt(w),d):n},d.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:Mt(!!w),d):o},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,d):Math.sqrt(u)},d}function Vn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function $r(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function vt(){}var ft=.7,Vt=1/ft,We="\\s*([+-]?\\d+)\\s*",ht="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qc=/^#([0-9a-f]{3,8})$/,Jc=new RegExp(`^rgb\\(${We},${We},${We}\\)$`),el=new RegExp(`^rgb\\(${xe},${xe},${xe}\\)$`),tl=new RegExp(`^rgba\\(${We},${We},${We},${ht}\\)$`),nl=new RegExp(`^rgba\\(${xe},${xe},${xe},${ht}\\)$`),ol=new RegExp(`^hsl\\(${ht},${xe},${xe}\\)$`),rl=new RegExp(`^hsla\\(${ht},${xe},${xe},${ht}\\)$`),go={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Vn(vt,je,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:po,formatHex:po,formatHex8:il,formatHsl:sl,formatRgb:mo,toString:mo});function po(){return this.rgb().formatHex()}function il(){return this.rgb().formatHex8()}function sl(){return Ar(this).formatHsl()}function mo(){return this.rgb().formatRgb()}function je(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Qc.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?yo(t):n===3?new ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?kt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?kt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Jc.exec(e))?new ce(t[1],t[2],t[3],1):(t=el.exec(e))?new ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=tl.exec(e))?kt(t[1],t[2],t[3],t[4]):(t=nl.exec(e))?kt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ol.exec(e))?vo(t[1],t[2]/100,t[3]/100,1):(t=rl.exec(e))?vo(t[1],t[2]/100,t[3]/100,t[4]):go.hasOwnProperty(e)?yo(go[e]):e==="transparent"?new ce(NaN,NaN,NaN,0):null}function yo(e){return new ce(e>>16&255,e>>8&255,e&255,1)}function kt(e,t,n,o){return o<=0&&(e=t=n=NaN),new ce(e,t,n,o)}function al(e){return e instanceof vt||(e=je(e)),e?(e=e.rgb(),new ce(e.r,e.g,e.b,e.opacity)):new ce}function kn(e,t,n,o){return arguments.length===1?al(e):new ce(e,t,n,o??1)}function ce(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}Vn(ce,kn,$r(vt,{brighter(e){return e=e==null?Vt:Math.pow(Vt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ft:Math.pow(ft,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ce(De(this.r),De(this.g),De(this.b),Bt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:xo,formatHex:xo,formatHex8:cl,formatRgb:wo,toString:wo}));function xo(){return`#${Pe(this.r)}${Pe(this.g)}${Pe(this.b)}`}function cl(){return`#${Pe(this.r)}${Pe(this.g)}${Pe(this.b)}${Pe((isNaN(this.opacity)?1:this.opacity)*255)}`}function wo(){const e=Bt(this.opacity);return`${e===1?"rgb(":"rgba("}${De(this.r)}, ${De(this.g)}, ${De(this.b)}${e===1?")":`, ${e})`}`}function Bt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function De(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pe(e){return e=De(e),(e<16?"0":"")+e.toString(16)}function vo(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,o)}function Ar(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof vt||(e=je(e)),!e)return new he;if(e instanceof he)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,c=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+r:2-i-r,s*=60):a=c>0&&c<1?0:s,new he(s,a,c,e.opacity)}function ll(e,t,n,o){return arguments.length===1?Ar(e):new he(e,t,n,o??1)}function he(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Vn(he,ll,$r(vt,{brighter(e){return e=e==null?Vt:Math.pow(Vt,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ft:Math.pow(ft,e),new he(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new ce(mn(e>=240?e-240:e+120,r,o),mn(e,r,o),mn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new he(bo(this.h),It(this.s),It(this.l),Bt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Bt(this.opacity);return`${e===1?"hsl(":"hsla("}${bo(this.h)}, ${It(this.s)*100}%, ${It(this.l)*100}%${e===1?")":`, ${e})`}`}}));function bo(e){return e=(e||0)%360,e<0?e+360:e}function It(e){return Math.max(0,Math.min(1,e||0))}function mn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Bn=e=>()=>e;function ul(e,t){return function(n){return e+n*t}}function dl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function fl(e){return(e=+e)==1?Tr:function(t,n){return n-t?dl(t,n,e):Bn(isNaN(t)?n:t)}}function Tr(e,t){var n=t-e;return n?ul(e,n):Bn(isNaN(e)?t:e)}const Xt=function e(t){var n=fl(t);function o(r,i){var s=n((r=kn(r)).r,(i=kn(i)).r),a=n(r.g,i.g),c=n(r.b,i.b),l=Tr(r.opacity,i.opacity);return function(f){return r.r=s(f),r.g=a(f),r.b=c(f),r.opacity=l(f),r+""}}return o.gamma=e,o}(1);function hl(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function gl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function pl(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=lt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function ml(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function ye(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function yl(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=lt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var In=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yn=new RegExp(In.source,"g");function xl(e){return function(){return e}}function wl(e){return function(t){return e(t)+""}}function Lr(e,t){var n=In.lastIndex=yn.lastIndex=0,o,r,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(o=In.exec(e))&&(r=yn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,c.push({i:s,x:ye(o,r)})),n=yn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?wl(c[0].x):xl(t):(t=c.length,function(l){for(var f=0,u;f<t;++f)a[(u=c[f]).i]=u.x(l);return a.join("")})}function lt(e,t){var n=typeof t,o;return t==null||n==="boolean"?Bn(t):(n==="number"?ye:n==="string"?(o=je(t))?(t=o,Xt):Lr:t instanceof je?Xt:t instanceof Date?ml:gl(t)?hl:Array.isArray(t)?pl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?yl:ye)(e,t)}var _o=180/Math.PI,$n={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Pr(e,t,n,o,r,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*_o,skewX:Math.atan(c)*_o,scaleX:s,scaleY:a}}var $t;function vl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?$n:Pr(t.a,t.b,t.c,t.d,t.e,t.f)}function bl(e){return e==null||($t||($t=document.createElementNS("http://www.w3.org/2000/svg","g")),$t.setAttribute("transform",e),!(e=$t.transform.baseVal.consolidate()))?$n:(e=e.matrix,Pr(e.a,e.b,e.c,e.d,e.e,e.f))}function Dr(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,f,u,d,g,h){if(l!==u||f!==d){var x=g.push("translate(",null,t,null,n);h.push({i:x-4,x:ye(l,u)},{i:x-2,x:ye(f,d)})}else(u||d)&&g.push("translate("+u+t+d+n)}function s(l,f,u,d){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),d.push({i:u.push(r(u)+"rotate(",null,o)-2,x:ye(l,f)})):f&&u.push(r(u)+"rotate("+f+o)}function a(l,f,u,d){l!==f?d.push({i:u.push(r(u)+"skewX(",null,o)-2,x:ye(l,f)}):f&&u.push(r(u)+"skewX("+f+o)}function c(l,f,u,d,g,h){if(l!==u||f!==d){var x=g.push(r(g)+"scale(",null,",",null,")");h.push({i:x-4,x:ye(l,u)},{i:x-2,x:ye(f,d)})}else(u!==1||d!==1)&&g.push(r(g)+"scale("+u+","+d+")")}return function(l,f){var u=[],d=[];return l=e(l),f=e(f),i(l.translateX,l.translateY,f.translateX,f.translateY,u,d),s(l.rotate,f.rotate,u,d),a(l.skewX,f.skewX,u,d),c(l.scaleX,l.scaleY,f.scaleX,f.scaleY,u,d),l=f=null,function(g){for(var h=-1,x=d.length,y;++h<x;)u[(y=d[h]).i]=y.x(g);return u.join("")}}}var _l=Dr(vl,"px, ","px)","deg)"),Nl=Dr(bl,", ",")",")"),El=1e-12;function No(e){return((e=Math.exp(e))+1/e)/2}function Sl(e){return((e=Math.exp(e))-1/e)/2}function Cl(e){return((e=Math.exp(2*e))-1)/(e+1)}const jt=function e(t,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],f=s[0],u=s[1],d=s[2],g=f-a,h=u-c,x=g*g+h*h,y,m;if(x<El)m=Math.log(d/l)/t,y=function(C){return[a+C*g,c+C*h,l*Math.exp(t*C*m)]};else{var N=Math.sqrt(x),p=(d*d-l*l+o*x)/(2*l*n*N),w=(d*d-l*l-o*x)/(2*d*n*N),M=Math.log(Math.sqrt(p*p+1)-p),_=Math.log(Math.sqrt(w*w+1)-w);m=(_-M)/t,y=function(C){var T=C*m,D=No(M),O=l/(n*N)*(D*Cl(t*T+M)-Sl(M));return[a+O*g,c+O*h,l*D/No(t*T+M)]}}return y.duration=m*1e3*t/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},r}(Math.SQRT2,2,4);var Ue=0,at=0,it=0,zr=1e3,Yt,ct,Gt=0,Re=0,en=0,gt=typeof performance=="object"&&performance.now?performance:Date,jr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xn(){return Re||(jr(Ml),Re=gt.now()+en)}function Ml(){Re=0}function Wt(){this._call=this._time=this._next=null}Wt.prototype=Rr.prototype={constructor:Wt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xn():+n)+(t==null?0:+t),!this._next&&ct!==this&&(ct?ct._next=this:Yt=this,ct=this),this._call=e,this._time=n,An()},stop:function(){this._call&&(this._call=null,this._time=1/0,An())}};function Rr(e,t,n){var o=new Wt;return o.restart(e,t,n),o}function kl(){Xn(),++Ue;for(var e=Yt,t;e;)(t=Re-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ue}function Eo(){Re=(Gt=gt.now())+en,Ue=at=0;try{kl()}finally{Ue=0,$l(),Re=0}}function Il(){var e=gt.now(),t=e-Gt;t>zr&&(en-=t,Gt=e)}function $l(){for(var e,t=Yt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Yt=n);ct=e,An(o)}function An(e){if(!Ue){at&&(at=clearTimeout(at));var t=e-Re;t>24?(e<1/0&&(at=setTimeout(Eo,e-gt.now()-en)),it&&(it=clearInterval(it))):(it||(Gt=gt.now(),it=setInterval(Il,zr)),Ue=1,jr(Eo))}}function So(e,t,n){var o=new Wt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Al=Qt("start","end","cancel","interrupt"),Tl=[],Hr=0,Co=1,Tn=2,Rt=3,Mo=4,Ln=5,Ht=6;function tn(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Ll(e,n,{name:t,index:o,group:r,on:Al,tween:Tl,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Hr})}function Yn(e,t){var n=me(e,t);if(n.state>Hr)throw new Error("too late; already scheduled");return n}function ve(e,t){var n=me(e,t);if(n.state>Rt)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ll(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Rr(i,0,n.time);function i(l){n.state=Co,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var f,u,d,g;if(n.state!==Co)return c();for(f in o)if(g=o[f],g.name===n.name){if(g.state===Rt)return So(s);g.state===Mo?(g.state=Ht,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[f]):+f<t&&(g.state=Ht,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[f])}if(So(function(){n.state===Rt&&(n.state=Mo,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Tn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Tn){for(n.state=Rt,r=new Array(d=n.tween.length),f=0,u=-1;f<d;++f)(g=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=g);r.length=u+1}}function a(l){for(var f=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Ln,1),u=-1,d=r.length;++u<d;)r[u].call(e,f);n.state===Ln&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Ht,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Ot(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Tn&&o.state<Ln,o.state=Ht,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Pl(e){return this.each(function(){Ot(this,e)})}function Dl(e,t){var n,o;return function(){var r=ve(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function zl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=ve(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function jl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Dl:zl)(n,e,t))}function Gn(e,t,n){var o=e._id;return e.each(function(){var r=ve(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function Or(e,t){var n;return(typeof t=="number"?ye:t instanceof je?Xt:(n=je(t))?(t=n,Xt):Lr)(e,t)}function Rl(e){return function(){this.removeAttribute(e)}}function Hl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ol(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Fl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Vl(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Bl(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Xl(e,t){var n=Jt(e),o=n==="transform"?Nl:Or;return this.attrTween(e,typeof t=="function"?(n.local?Bl:Vl)(n,o,Gn(this,"attr."+e,t)):t==null?(n.local?Hl:Rl)(n):(n.local?Fl:Ol)(n,o,t))}function Yl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Gl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Wl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Gl(e,i)),n}return r._value=t,r}function ql(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Yl(e,i)),n}return r._value=t,r}function Ul(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Jt(e);return this.tween(n,(o.local?Wl:ql)(o,t))}function Kl(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}function Zl(e,t){return t=+t,function(){Yn(this,e).delay=t}}function Ql(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Kl:Zl)(t,e)):me(this.node(),t).delay}function Jl(e,t){return function(){ve(this,e).duration=+t.apply(this,arguments)}}function eu(e,t){return t=+t,function(){ve(this,e).duration=t}}function tu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Jl:eu)(t,e)):me(this.node(),t).duration}function nu(e,t){if(typeof t!="function")throw new Error;return function(){ve(this,e).ease=t}}function ou(e){var t=this._id;return arguments.length?this.each(nu(t,e)):me(this.node(),t).ease}function ru(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ve(this,e).ease=n}}function iu(e){if(typeof e!="function")throw new Error;return this.each(ru(this._id,e))}function su(e){typeof e!="function"&&(e=yr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new Ee(o,this._parents,this._name,this._id)}function au(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=t[a],l=n[a],f=c.length,u=s[a]=new Array(f),d,g=0;g<f;++g)(d=c[g]||l[g])&&(u[g]=d);for(;a<o;++a)s[a]=t[a];return new Ee(s,this._parents,this._name,this._id)}function cu(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function lu(e,t,n){var o,r,i=cu(t)?Yn:ve;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function uu(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(lu(n,e,t))}function du(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function fu(){return this.on("end.remove",du(this._id))}function hu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=On(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),f,u,d=0;d<c;++d)(f=a[d])&&(u=e.call(f,f.__data__,d,a))&&("__data__"in f&&(u.__data__=f.__data__),l[d]=u,tn(l[d],t,n,d,l,me(f,n)));return new Ee(i,this._parents,t,n)}function gu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=mr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,f,u=0;u<l;++u)if(f=c[u]){for(var d=e.call(f,f.__data__,u,c),g,h=me(f,n),x=0,y=d.length;x<y;++x)(g=d[x])&&tn(g,t,n,x,d,h);i.push(d),s.push(f)}return new Ee(i,s,t,n)}var pu=wt.prototype.constructor;function mu(){return new pu(this._groups,this._parents)}function yu(e,t){var n,o,r;return function(){var i=qe(this,e),s=(this.style.removeProperty(e),qe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Fr(e){return function(){this.style.removeProperty(e)}}function xu(e,t,n){var o,r=n+"",i;return function(){var s=qe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function wu(e,t,n){var o,r,i;return function(){var s=qe(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),qe(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function vu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=ve(this,e),l=c.on,f=c.value[i]==null?a||(a=Fr(t)):void 0;(l!==n||r!==f)&&(o=(n=l).copy()).on(s,r=f),c.on=o}}function bu(e,t,n){var o=(e+="")=="transform"?_l:Or;return t==null?this.styleTween(e,yu(e,o)).on("end.style."+e,Fr(e)):typeof t=="function"?this.styleTween(e,wu(e,o,Gn(this,"style."+e,t))).each(vu(this._id,e)):this.styleTween(e,xu(e,o,t),n).on("end.style."+e,null)}function _u(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Nu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&_u(e,s,n)),o}return i._value=t,i}function Eu(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Nu(e,t,n??""))}function Su(e){return function(){this.textContent=e}}function Cu(e){return function(){var t=e(this);this.textContent=t??""}}function Mu(e){return this.tween("text",typeof e=="function"?Cu(Gn(this,"text",e)):Su(e==null?"":e+""))}function ku(e){return function(t){this.textContent=e.call(this,t)}}function Iu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ku(r)),t}return o._value=e,o}function $u(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,Iu(e))}function Au(){for(var e=this._name,t=this._id,n=Vr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var f=me(c,t);tn(c,e,n,l,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Ee(o,this._parents,e,n)}function Tu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=ve(this,o),f=l.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var Lu=0;function Ee(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vr(){return++Lu}var _e=wt.prototype;Ee.prototype={constructor:Ee,select:hu,selectAll:gu,selectChild:_e.selectChild,selectChildren:_e.selectChildren,filter:su,merge:au,selection:mu,transition:Au,call:_e.call,nodes:_e.nodes,node:_e.node,size:_e.size,empty:_e.empty,each:_e.each,on:uu,attr:Xl,attrTween:Ul,style:bu,styleTween:Eu,text:Mu,textTween:$u,remove:fu,tween:jl,delay:Ql,duration:tu,ease:ou,easeVarying:iu,end:Tu,[Symbol.iterator]:_e[Symbol.iterator]};function Pu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Du={time:null,delay:0,duration:250,ease:Pu};function zu(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function ju(e){var t,n;e instanceof Ee?(t=e._id,e=e._name):(t=Vr(),(n=Du).time=Xn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&tn(c,e,t,l,s,n||zu(c,t));return new Ee(o,this._parents,e,t)}wt.prototype.interrupt=Pl;wt.prototype.transition=ju;const At=e=>()=>e;function Ru(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ne(e,t,n){this.k=e,this.x=t,this.y=n}Ne.prototype={constructor:Ne,scale:function(e){return e===1?this:new Ne(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ne(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var nn=new Ne(1,0,0);Br.prototype=Ne.prototype;function Br(e){for(;!e.__zoom;)if(!(e=e.parentNode))return nn;return e.__zoom}function xn(e){e.stopImmediatePropagation()}function st(e){e.preventDefault(),e.stopImmediatePropagation()}function Hu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ou(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function ko(){return this.__zoom||nn}function Fu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Vu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bu(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Xr(){var e=Hu,t=Ou,n=Bu,o=Fu,r=Vu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=jt,l=Qt("start","zoom","end"),f,u,d,g=500,h=150,x=0,y=10;function m(b){b.property("__zoom",ko).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",O).filter(r).on("touchstart.zoom",$).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(b,A,E,L){var I=b.selection?b.selection():b;I.property("__zoom",ko),b!==I?M(b,A,E,L):I.interrupt().each(function(){_(this,arguments).event(L).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(b,A,E,L){m.scaleTo(b,function(){var I=this.__zoom.k,S=typeof A=="function"?A.apply(this,arguments):A;return I*S},E,L)},m.scaleTo=function(b,A,E,L){m.transform(b,function(){var I=t.apply(this,arguments),S=this.__zoom,z=E==null?w(I):typeof E=="function"?E.apply(this,arguments):E,R=S.invert(z),j=typeof A=="function"?A.apply(this,arguments):A;return n(p(N(S,j),z,R),I,s)},E,L)},m.translateBy=function(b,A,E,L){m.transform(b,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,L)},m.translateTo=function(b,A,E,L,I){m.transform(b,function(){var S=t.apply(this,arguments),z=this.__zoom,R=L==null?w(S):typeof L=="function"?L.apply(this,arguments):L;return n(nn.translate(R[0],R[1]).scale(z.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof E=="function"?-E.apply(this,arguments):-E),S,s)},L,I)};function N(b,A){return A=Math.max(i[0],Math.min(i[1],A)),A===b.k?b:new Ne(A,b.x,b.y)}function p(b,A,E){var L=A[0]-E[0]*b.k,I=A[1]-E[1]*b.k;return L===b.x&&I===b.y?b:new Ne(b.k,L,I)}function w(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function M(b,A,E,L){b.on("start.zoom",function(){_(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(L).end()}).tween("zoom",function(){var I=this,S=arguments,z=_(I,S).event(L),R=t.apply(I,S),j=E==null?w(R):typeof E=="function"?E.apply(I,S):E,V=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),B=I.__zoom,Y=typeof A=="function"?A.apply(I,S):A,U=c(B.invert(j).concat(V/B.k),Y.invert(j).concat(V/Y.k));return function(W){if(W===1)W=Y;else{var F=U(W),G=V/F[2];W=new Ne(G,j[0]-F[0]*G,j[1]-F[1]*G)}z.zoom(null,W)}})}function _(b,A,E){return!E&&b.__zooming||new C(b,A)}function C(b,A){this.that=b,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,A),this.taps=0}C.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,A){return this.mouse&&b!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&b!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(b){var A=le(this.that).datum();l.call(b,this.that,new Ru(b,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),A)}};function T(b,...A){if(!e.apply(this,arguments))return;var E=_(this,A).event(b),L=this.__zoom,I=Math.max(i[0],Math.min(i[1],L.k*Math.pow(2,o.apply(this,arguments)))),S=fe(b);if(E.wheel)(E.mouse[0][0]!==S[0]||E.mouse[0][1]!==S[1])&&(E.mouse[1]=L.invert(E.mouse[0]=S)),clearTimeout(E.wheel);else{if(L.k===I)return;E.mouse=[S,L.invert(S)],Ot(this),E.start()}st(b),E.wheel=setTimeout(z,h),E.zoom("mouse",n(p(N(L,I),E.mouse[0],E.mouse[1]),E.extent,s));function z(){E.wheel=null,E.end()}}function D(b,...A){if(d||!e.apply(this,arguments))return;var E=b.currentTarget,L=_(this,A,!0).event(b),I=le(b.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",V,!0),S=fe(b,E),z=b.clientX,R=b.clientY;Mr(b.view),xn(b),L.mouse=[S,this.__zoom.invert(S)],Ot(this),L.start();function j(B){if(st(B),!L.moved){var Y=B.clientX-z,U=B.clientY-R;L.moved=Y*Y+U*U>x}L.event(B).zoom("mouse",n(p(L.that.__zoom,L.mouse[0]=fe(B,E),L.mouse[1]),L.extent,s))}function V(B){I.on("mousemove.zoom mouseup.zoom",null),kr(B.view,L.moved),st(B),L.event(B).end()}}function O(b,...A){if(e.apply(this,arguments)){var E=this.__zoom,L=fe(b.changedTouches?b.changedTouches[0]:b,this),I=E.invert(L),S=E.k*(b.shiftKey?.5:2),z=n(p(N(E,S),L,I),t.apply(this,A),s);st(b),a>0?le(this).transition().duration(a).call(M,z,L,b):le(this).call(m.transform,z,L,b)}}function $(b,...A){if(e.apply(this,arguments)){var E=b.touches,L=E.length,I=_(this,A,b.changedTouches.length===L).event(b),S,z,R,j;for(xn(b),z=0;z<L;++z)R=E[z],j=fe(R,this),j=[j,this.__zoom.invert(j),R.identifier],I.touch0?!I.touch1&&I.touch0[2]!==j[2]&&(I.touch1=j,I.taps=0):(I.touch0=j,S=!0,I.taps=1+!!f);f&&(f=clearTimeout(f)),S&&(I.taps<2&&(u=j[0],f=setTimeout(function(){f=null},g)),Ot(this),I.start())}}function P(b,...A){if(this.__zooming){var E=_(this,A).event(b),L=b.changedTouches,I=L.length,S,z,R,j;for(st(b),S=0;S<I;++S)z=L[S],R=fe(z,this),E.touch0&&E.touch0[2]===z.identifier?E.touch0[0]=R:E.touch1&&E.touch1[2]===z.identifier&&(E.touch1[0]=R);if(z=E.that.__zoom,E.touch1){var V=E.touch0[0],B=E.touch0[1],Y=E.touch1[0],U=E.touch1[1],W=(W=Y[0]-V[0])*W+(W=Y[1]-V[1])*W,F=(F=U[0]-B[0])*F+(F=U[1]-B[1])*F;z=N(z,Math.sqrt(W/F)),R=[(V[0]+Y[0])/2,(V[1]+Y[1])/2],j=[(B[0]+U[0])/2,(B[1]+U[1])/2]}else if(E.touch0)R=E.touch0[0],j=E.touch0[1];else return;E.zoom("touch",n(p(z,R,j),E.extent,s))}}function H(b,...A){if(this.__zooming){var E=_(this,A).event(b),L=b.changedTouches,I=L.length,S,z;for(xn(b),d&&clearTimeout(d),d=setTimeout(function(){d=null},g),S=0;S<I;++S)z=L[S],E.touch0&&E.touch0[2]===z.identifier?delete E.touch0:E.touch1&&E.touch1[2]===z.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(z=fe(z,this),Math.hypot(u[0]-z[0],u[1]-z[1])<y)){var R=le(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return m.wheelDelta=function(b){return arguments.length?(o=typeof b=="function"?b:At(+b),m):o},m.filter=function(b){return arguments.length?(e=typeof b=="function"?b:At(!!b),m):e},m.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:At(!!b),m):r},m.extent=function(b){return arguments.length?(t=typeof b=="function"?b:At([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),m):t},m.scaleExtent=function(b){return arguments.length?(i[0]=+b[0],i[1]=+b[1],m):[i[0],i[1]]},m.translateExtent=function(b){return arguments.length?(s[0][0]=+b[0][0],s[1][0]=+b[1][0],s[0][1]=+b[0][1],s[1][1]=+b[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(b){return arguments.length?(n=b,m):n},m.duration=function(b){return arguments.length?(a=+b,m):a},m.interpolate=function(b){return arguments.length?(c=b,m):c},m.on=function(){var b=l.on.apply(l,arguments);return b===l?m:b},m.clickDistance=function(b){return arguments.length?(x=(b=+b)*b,m):Math.sqrt(x)},m.tapDistance=function(b){return arguments.length?(y=+b,m):y},m}const we={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},pt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Yr=["Enter"," ","Escape"],Gr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ke;(function(e){e.Strict="strict",e.Loose="loose"})(Ke||(Ke={}));var ze;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ze||(ze={}));var Ze;(function(e){e.Partial="partial",e.Full="full"})(Ze||(Ze={}));const Wr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var qt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(qt||(qt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const Io={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function qr(e){return e===null?null:e?"valid":"invalid"}const Ur=e=>"id"in e&&"source"in e&&"target"in e,Xu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Wn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),bt=(e,t=[0,0])=>{const{width:n,height:o}=Se(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Yu=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Wn(r)?r:t.nodeLookup.get(r.id));const a=s?Ut(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return on(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return rn(n)},_t=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=on(n,Ut(r)),o=!0)}),o?rn(n):{x:0,y:0,width:0,height:0}},qn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...Et(t,[n,o,r]),width:t.width/r,height:t.height/r},c=[];for(const l of e.values()){const{measured:f,selectable:u=!0,hidden:d=!1}=l;if(s&&!u||d)continue;const g=f.width??l.width??l.initialWidth??null,h=f.height??l.height??l.initialHeight??null,x=mt(a,Je(l)),y=(g??0)*(h??0),m=i&&x>0;(!l.internals.handleBounds||m||x>=y||l.dragging)&&c.push(l)}return c},Gu=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Wu(e,t){const n=new Map,o=t!=null&&t.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function qu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Wu(e,s),c=_t(a),l=Un(c,t,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function Kr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},f=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",we.error005());else{const g=a.measured.width,h=a.measured.height;g&&h&&(u=[[c,l],[c+g,l+h]])}else a&&et(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const d=et(u)?He(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",we.error015())),{position:{x:d.x-c+(s.measured.width??0)*f[0],y:d.y-l+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function Uu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const g=i.has(d.id),h=!g&&d.parentId&&s.find(x=>x.id===d.parentId);(g||h)&&s.push(d)}const a=new Set(t.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),f=Gu(s,c);for(const d of c)a.has(d.id)&&!f.find(h=>h.id===d.id)&&f.push(d);if(!r)return{edges:f,nodes:s};const u=await r({nodes:s,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:s}:{edges:[],nodes:[]}:u}const Qe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),He=(e={x:0,y:0},t,n)=>({x:Qe(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Qe(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Zr(e,t,n){const{width:o,height:r}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return He(e,[[i,s],[i+o,s+r]],t)}const $o=(e,t,n)=>e<t?Qe(Math.abs(e-t),1,t)/t:e>n?-Qe(Math.abs(e-n),1,t)/t:0,Qr=(e,t,n=15,o=40)=>{const r=$o(e.x,o,t.width-o)*n,i=$o(e.y,o,t.height-o)*n;return[r,i]},on=(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)}),Pn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),rn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Je=(e,t=[0,0])=>{var r,i;const{x:n,y:o}=Wn(e)?e.internals.positionAbsolute:bt(e,t);return{x:n,y:o,width:((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{var r,i;const{x:n,y:o}=Wn(e)?e.internals.positionAbsolute:bt(e,t);return{x:n,y:o,x2:n+(((r=e.measured)==null?void 0:r.width)??e.width??e.initialWidth??0),y2:o+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},Jr=(e,t)=>rn(on(Pn(e),Pn(t))),mt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Ao=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),Ku=(e,t)=>{},Nt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Et=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Nt(a,s):a},Kt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Be(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Zu(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Be(e,n),r=Be(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Be(e.top??e.y??0,n),r=Be(e.bottom??e.y??0,n),i=Be(e.left??e.x??0,t),s=Be(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Qu(e,t,n,o,r,i){const{x:s,y:a}=Kt(e,[t,n,o]),{x:c,y:l}=Kt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),f=r-c,u=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(f),bottom:Math.floor(u)}}const Un=(e,t,n,o,r,i)=>{const s=Zu(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),f=Qe(l,o,r),u=e.x+e.width/2,d=e.y+e.height/2,g=t/2-u*f,h=n/2-d*f,x=Qu(e,g,h,f,t,n),y={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:g-y.left+y.right,y:h-y.top+y.bottom,zoom:f}},yt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function et(e){return e!=null&&e!=="parent"}function Se(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function ei(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function ti(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function To(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ju(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function ed(e){return{...Gr,...e||{}}}function ut(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=pe(e),a=Et({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:c,y:l}=n?Nt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Kn=e=>({width:e.offsetWidth,height:e.offsetHeight}),ni=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},td=["INPUT","SELECT","TEXTAREA"];function oi(e){var o,r;const t=((r=(o=e.composedPath)==null?void 0:o.call(e))==null?void 0:r[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:td.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ri=e=>"clientX"in e,pe=(e,t)=>{var i,s;const n=ri(e),o=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,r=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:o-((t==null?void 0:t.left)??0),y:r-((t==null?void 0:t.top)??0)}},Lo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Kn(s)}})};function ii({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,f=Math.abs(c-e),u=Math.abs(l-t);return[c,l,f,u]}function Tt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Po({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-Tt(t-o,i),n];case X.Right:return[t+Tt(o-t,i),n];case X.Top:return[t,n-Tt(n-r,i)];case X.Bottom:return[t,n+Tt(r-n,i)]}}function si({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,c]=Po({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,f]=Po({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,d,g,h]=ii({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:f});return[`M${e},${t} C${a},${c} ${l},${f} ${o},${r}`,u,d,g,h]}function ai({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function nd({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function od({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=on(Ut(e),Ut(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return mt(s,rn(i))>0}const rd=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,id=(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)),sd=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||rd;let r;return Ur(e)?r={...e}:r={...e,id:o(e)},id(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function ci({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=ai({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Do={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},ad=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},zo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function cd({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=Do[t],c=Do[o],l={x:e.x+a.x*i,y:e.y+a.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},u=ad({source:l,sourcePosition:t,target:f}),d=u.x!==0?"x":"y",g=u[d];let h=[],x,y;const m={x:0,y:0},N={x:0,y:0},[,,p,w]=ai({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(x=r.x??l.x+(f.x-l.x)*s,y=r.y??(l.y+f.y)/2):(x=r.x??(l.x+f.x)/2,y=r.y??l.y+(f.y-l.y)*s);const _=[{x,y:l.y},{x,y:f.y}],C=[{x:l.x,y},{x:f.x,y}];a[d]===g?h=d==="x"?_:C:h=d==="x"?C:_}else{const _=[{x:l.x,y:f.y}],C=[{x:f.x,y:l.y}];if(d==="x"?h=a.x===g?C:_:h=a.y===g?_:C,t===o){const P=Math.abs(e[d]-n[d]);if(P<=i){const H=Math.min(i-1,i-P);a[d]===g?m[d]=(l[d]>e[d]?-1:1)*H:N[d]=(f[d]>n[d]?-1:1)*H}}if(t!==o){const P=d==="x"?"y":"x",H=a[d]===c[P],b=l[P]>f[P],A=l[P]<f[P];(a[d]===1&&(!H&&b||H&&A)||a[d]!==1&&(!H&&A||H&&b))&&(h=d==="x"?_:C)}const T={x:l.x+m.x,y:l.y+m.y},D={x:f.x+N.x,y:f.y+N.y},O=Math.max(Math.abs(T.x-h[0].x),Math.abs(D.x-h[0].x)),$=Math.max(Math.abs(T.y-h[0].y),Math.abs(D.y-h[0].y));O>=$?(x=(T.x+D.x)/2,y=h[0].y):(x=h[0].x,y=(T.y+D.y)/2)}return[[e,{x:l.x+m.x,y:l.y+m.y},...h,{x:f.x+N.x,y:f.y+N.y},n],x,y,p,w]}function ld(e,t,n,o){const r=Math.min(zo(e,t)/2,zo(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*f}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function Dn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:f=.5}){const[u,d,g,h,x]=cd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:f});return[u.reduce((m,N,p)=>{let w="";return p>0&&p<u.length-1?w=ld(u[p-1],N,u[p+1],s):w=`${p===0?"M":"L"}${N.x} ${N.y}`,m+=w,m},""),d,g,h,x]}function jo(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ud(e){var u;const{sourceNode:t,targetNode:n}=e;if(!jo(t)||!jo(n))return null;const o=t.internals.handleBounds||Ro(t.handles),r=n.internals.handleBounds||Ro(n.handles),i=Ho((o==null?void 0:o.source)??[],e.sourceHandle),s=Ho(e.connectionMode===Ke.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),e.targetHandle);if(!i||!s)return(u=e.onError)==null||u.call(e,"008",we.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||X.Bottom,c=(s==null?void 0:s.position)||X.Top,l=Oe(t,i,a),f=Oe(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:c}}function Ro(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Oe(e,t,n=X.Left,o=!1){const r=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Se(e);if(o)return{x:r+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function Ho(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function zn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function dd(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=zn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const li=1e3,fd=10,Zn={nodeOrigin:[0,0],nodeExtent:pt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},hd={...Zn,checkEquality:!0};function Qn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function gd(e,t,n){const o=Qn(Zn,n);for(const r of e.values())if(r.parentId)eo(r,e,t,o);else{const i=bt(r,o.nodeOrigin),s=et(r.extent)?r.extent:o.nodeExtent,a=He(i,s,Se(r));r.internals.positionAbsolute=a}}function pd(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Jn(e){return e==="manual"}function jn(e,t,n,o={}){var l,f;const r=Qn(hd,o),i={i:0},s=new Map(t),a=r!=null&&r.elevateNodesOnSelect&&!Jn(r.zIndexMode)?li:0;let c=e.length>0;t.clear(),n.clear();for(const u of e){let d=s.get(u.id);if(r.checkEquality&&u===(d==null?void 0:d.internals.userNode))t.set(u.id,d);else{const g=bt(u,r.nodeOrigin),h=et(u.extent)?u.extent:r.nodeExtent,x=He(g,h,Se(u));d={...r.defaults,...u,measured:{width:(l=u.measured)==null?void 0:l.width,height:(f=u.measured)==null?void 0:f.height},internals:{positionAbsolute:x,handleBounds:pd(u,d),z:ui(u,a,r.zIndexMode),userNode:u}},t.set(u.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(c=!1),u.parentId&&eo(d,t,n,o,i)}return c}function md(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function eo(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Qn(Zn,o),l=e.parentId,f=t.get(l);if(!f){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}md(e,n),r&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++r.i,f.internals.z=f.internals.z+r.i*fd),r&&f.internals.rootParentIndex!==void 0&&(r.i=f.internals.rootParentIndex);const u=i&&!Jn(c)?li:0,{x:d,y:g,z:h}=yd(e,f,s,a,u,c),{positionAbsolute:x}=e.internals,y=d!==x.x||g!==x.y;(y||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:d,y:g}:x,z:h}})}function ui(e,t,n){const o=ge(e.zIndex)?e.zIndex:0;return Jn(n)?o:o+(e.selected?t:0)}function yd(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,c=Se(e),l=bt(e,n),f=et(e.extent)?He(l,e.extent,c):l;let u=He({x:s+f.x,y:a+f.y},o,c);e.extent==="parent"&&(u=Zr(u,c,t));const d=ui(e,r,i),g=t.internals.z??0;return{x:u.x,y:u.y,z:g>=d?g+1:d}}function to(e,t,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Je(c),f=Jr(l,a.rect);i.set(a.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const f=c.internals.positionAbsolute,u=Se(c),d=c.origin??o,g=a.x<f.x?Math.round(Math.abs(f.x-a.x)):0,h=a.y<f.y?Math.round(Math.abs(f.y-a.y)):0,x=Math.max(u.width,Math.round(a.width)),y=Math.max(u.height,Math.round(a.height)),m=(x-u.width)*d[0],N=(y-u.height)*d[1];(g>0||h>0||m||N)&&(r.push({id:l,type:"position",position:{x:c.position.x-g+m,y:c.position.y-h+N}}),(p=n.get(l))==null||p.forEach(w=>{e.some(M=>M.id===w.id)||r.push({id:w.id,type:"position",position:{x:w.position.x+g,y:w.position.y+h}})})),(u.width<a.width||u.height<a.height||g||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:x+(g?d[0]*g-m:0),height:y+(h?d[1]*h-N:0)}})}),r}function xd(e,t,n,o,r,i,s){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],f=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const g of e.values()){const h=t.get(g.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),c=!0;continue}const x=Kn(g.nodeElement),y=h.measured.width!==x.width||h.measured.height!==x.height;if(!!(x.width&&x.height&&(y||!h.internals.handleBounds||g.force))){const N=g.nodeElement.getBoundingClientRect(),p=et(h.extent)?h.extent:i;let{positionAbsolute:w}=h.internals;h.parentId&&h.extent==="parent"?w=Zr(w,x,t.get(h.parentId)):p&&(w=He(w,p,x));const M={...h,measured:x,internals:{...h.internals,positionAbsolute:w,handleBounds:{source:Lo("source",g.nodeElement,N,u,h.id),target:Lo("target",g.nodeElement,N,u,h.id)}}};t.set(h.id,M),h.parentId&&eo(M,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,y&&(l.push({id:h.id,type:"dimensions",dimensions:x}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:Je(M,r)}))}}if(d.length>0){const g=to(d,t,n,r);l.push(...g)}return{changes:l,updatedInternals:c}}async function wd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function Oo(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function di(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,f=`${i}-${a}--${r}-${s}`;Oo("source",c,f,e,r,s),Oo("target",c,l,e,i,a),t.set(o.id,o)}}function fi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:fi(n,t):!1}function Fo(e,t,n){var r;let o=e;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,t))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function vd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!fi(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function wn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){var s,a,c;const r=[];for(const[l,f]of t){const u=(s=n.get(l))==null?void 0:s.internals.userNode;u&&r.push({...u,position:f.position,dragging:o})}if(!e)return[r[0],r];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:o}:r[0],r]}function bd({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=Nt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function _d({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},f=null,u=!1,d=null,g=!1,h=!1,x=null;function y({noDragClassName:N,handleSelector:p,domNode:w,isSelectable:M,nodeId:_,nodeClickDistance:C=0}){d=le(w);function T({x:P,y:H}){const{nodeLookup:b,nodeExtent:A,snapGrid:E,snapToGrid:L,nodeOrigin:I,onNodeDrag:S,onSelectionDrag:z,onError:R,updateNodePositions:j}=t();i={x:P,y:H};let V=!1;const B=a.size>1,Y=B&&A?Pn(_t(a)):null,U=B&&L?bd({dragItems:a,snapGrid:E,x:P,y:H}):null;for(const[W,F]of a){if(!b.has(W))continue;let G={x:P-F.distance.x,y:H-F.distance.y};L&&(G=U?{x:Math.round(G.x+U.x),y:Math.round(G.y+U.y)}:Nt(G,E));let Q=null;if(B&&A&&!F.extent&&Y){const{positionAbsolute:q}=F.internals,te=q.x-Y.x+A[0][0],oe=q.x+F.measured.width-Y.x2+A[1][0],ee=q.y-Y.y+A[0][1],ae=q.y+F.measured.height-Y.y2+A[1][1];Q=[[te,ee],[oe,ae]]}const{position:Z,positionAbsolute:K}=Kr({nodeId:W,nextPosition:G,nodeLookup:b,nodeExtent:Q||A,nodeOrigin:I,onError:R});V=V||F.position.x!==Z.x||F.position.y!==Z.y,F.position=Z,F.internals.positionAbsolute=K}if(h=h||V,!!V&&(j(a,!0),x&&(o||S||!_&&z))){const[W,F]=wn({nodeId:_,dragItems:a,nodeLookup:b});o==null||o(x,a,W,F),S==null||S(x,W,F),_||z==null||z(x,F)}}async function D(){if(!f)return;const{transform:P,panBy:H,autoPanSpeed:b,autoPanOnNodeDrag:A}=t();if(!A){c=!1,cancelAnimationFrame(s);return}const[E,L]=Qr(l,f,b);(E!==0||L!==0)&&(i.x=(i.x??0)-E/P[2],i.y=(i.y??0)-L/P[2],await H({x:E,y:L})&&T(i)),s=requestAnimationFrame(D)}function O(P){var B;const{nodeLookup:H,multiSelectionActive:b,nodesDraggable:A,transform:E,snapGrid:L,snapToGrid:I,selectNodesOnDrag:S,onNodeDragStart:z,onSelectionDragStart:R,unselectNodesAndEdges:j}=t();u=!0,(!S||!M)&&!b&&_&&((B=H.get(_))!=null&&B.selected||j()),M&&S&&_&&(e==null||e(_));const V=ut(P.sourceEvent,{transform:E,snapGrid:L,snapToGrid:I,containerBounds:f});if(i=V,a=vd(H,A,V,_),a.size>0&&(n||z||!_&&R)){const[Y,U]=wn({nodeId:_,dragItems:a,nodeLookup:H});n==null||n(P.sourceEvent,a,Y,U),z==null||z(P.sourceEvent,Y,U),_||R==null||R(P.sourceEvent,U)}}const $=Ir().clickDistance(C).on("start",P=>{const{domNode:H,nodeDragThreshold:b,transform:A,snapGrid:E,snapToGrid:L}=t();f=(H==null?void 0:H.getBoundingClientRect())||null,g=!1,h=!1,x=P.sourceEvent,b===0&&O(P),i=ut(P.sourceEvent,{transform:A,snapGrid:E,snapToGrid:L,containerBounds:f}),l=pe(P.sourceEvent,f)}).on("drag",P=>{const{autoPanOnNodeDrag:H,transform:b,snapGrid:A,snapToGrid:E,nodeDragThreshold:L,nodeLookup:I}=t(),S=ut(P.sourceEvent,{transform:b,snapGrid:A,snapToGrid:E,containerBounds:f});if(x=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||_&&!I.has(_))&&(g=!0),!g){if(!c&&H&&u&&(c=!0,D()),!u){const z=pe(P.sourceEvent,f),R=z.x-l.x,j=z.y-l.y;Math.sqrt(R*R+j*j)>L&&O(P)}(i.x!==S.xSnapped||i.y!==S.ySnapped)&&a&&u&&(l=pe(P.sourceEvent,f),T(S))}}).on("end",P=>{if(!(!u||g)&&(c=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:b,onNodeDragStop:A,onSelectionDragStop:E}=t();if(h&&(b(a,!1),h=!1),r||A||!_&&E){const[L,I]=wn({nodeId:_,dragItems:a,nodeLookup:H,dragging:!1});r==null||r(P.sourceEvent,a,L,I),A==null||A(P.sourceEvent,L,I),_||E==null||E(P.sourceEvent,I)}}}).filter(P=>{const H=P.target;return!P.button&&(!N||!Fo(H,`.${N}`,w))&&(!p||Fo(H,p,w))});d.call($)}function m(){d==null||d.on(".drag",null)}return{update:y,destroy:m}}function Nd(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())mt(r,Je(i))>0&&o.push(i);return o}const Ed=250;function Sd(e,t,n,o){var a,c;let r=[],i=1/0;const s=Nd(e,n,t+Ed);for(const l of s){const f=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of f){if(o.nodeId===u.nodeId&&o.type===u.type&&o.id===u.id)continue;const{x:d,y:g}=Oe(l,u,u.position,!0),h=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(g-e.y,2));h>t||(h<i?(r=[{...u,x:d,y:g}],i=h):h===i&&r.push({...u,x:d,y:g}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(f=>f.type===l)??r[0]}return r[0]}function hi(e,t,n,o,r,i=!1){var l,f,u;const s=o.get(e);if(!s)return null;const a=r==="strict"?(l=s.internals.handleBounds)==null?void 0:l[t]:[...((f=s.internals.handleBounds)==null?void 0:f.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Oe(s,c,c.position,!0)}:c}function gi(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Cd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const pi=()=>!0;function Md(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:f,flowId:u,panBy:d,cancelConnection:g,onConnectStart:h,onConnect:x,onConnectEnd:y,isValidConnection:m=pi,onReconnectEnd:N,updateConnection:p,getTransform:w,getFromHandle:M,autoPanSpeed:_,dragThreshold:C=1,handleDomNode:T}){const D=ni(e.target);let O=0,$;const{x:P,y:H}=pe(e),b=gi(i,T),A=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!A||!b)return;const L=hi(r,b,o,c,t);if(!L)return;let I=pe(e,A),S=!1,z=null,R=!1,j=null;function V(){if(!f||!A)return;const[Z,K]=Qr(I,A,_);d({x:Z,y:K}),O=requestAnimationFrame(V)}const B={...L,nodeId:r,type:b,position:L.position},Y=c.get(r);let W={inProgress:!0,isValid:null,from:Oe(Y,B,X.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:Y,to:I,toHandle:null,toPosition:Io[B.position],toNode:null,pointer:I};function F(){E=!0,p(W),h==null||h(e,{nodeId:r,handleId:o,handleType:b})}C===0&&F();function G(Z){if(!E){const{x:ae,y:Ce}=pe(Z),be=ae-P,Te=Ce-H;if(!(be*be+Te*Te>C*C))return;F()}if(!M()||!B){Q(Z);return}const K=w();I=pe(Z,A),$=Sd(Et(I,K,!1,[1,1]),n,c,B),S||(V(),S=!0);const q=mi(Z,{handle:$,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:D,lib:l,flowId:u,nodeLookup:c});j=q.handleDomNode,z=q.connection,R=Cd(!!$,q.isValid);const te=c.get(r),oe=te?Oe(te,B,X.Left,!0):W.from,ee={...W,from:oe,isValid:R,to:q.toHandle&&R?Kt({x:q.toHandle.x,y:q.toHandle.y},K):I,toHandle:q.toHandle,toPosition:R&&q.toHandle?q.toHandle.position:Io[B.position],toNode:q.toHandle?c.get(q.toHandle.nodeId):null,pointer:I};p(ee),W=ee}function Q(Z){if(!("touches"in Z&&Z.touches.length>0)){if(E){($||j)&&z&&R&&(x==null||x(z));const{inProgress:K,...q}=W,te={...q,toPosition:W.toHandle?W.toPosition:null};y==null||y(Z,te),i&&(N==null||N(Z,te))}g(),cancelAnimationFrame(O),S=!1,R=!1,z=null,j=null,D.removeEventListener("mousemove",G),D.removeEventListener("mouseup",Q),D.removeEventListener("touchmove",G),D.removeEventListener("touchend",Q)}}D.addEventListener("mousemove",G),D.addEventListener("mouseup",Q),D.addEventListener("touchmove",G),D.addEventListener("touchend",Q)}function mi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=pi,nodeLookup:f}){const u=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:g,y:h}=pe(e),x=s.elementFromPoint(g,h),y=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:d,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const N=gi(void 0,y),p=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),M=y.classList.contains("connectable"),_=y.classList.contains("connectableend");if(!p||!N)return m;const C={source:u?p:o,sourceHandle:u?w:r,target:u?o:p,targetHandle:u?r:w};m.connection=C;const D=M&&_&&(n===Ke.Strict?u&&N==="source"||!u&&N==="target":p!==o||w!==r);m.isValid=D&&l(C),m.toHandle=hi(p,N,w,f,n,!0)}return m}const Rn={onPointerDown:Md,isValid:mi};function kd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:a,width:c,height:l,zoomStep:f=1,pannable:u=!0,zoomable:d=!0,inversePan:g=!1}){const h=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),M=p.sourceEvent.ctrlKey&&yt()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*f,C=w[2]*Math.pow(2,_*M);t.scaleTo(C)};let x=[0,0];const y=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(x=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const M=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[M[0]-x[0],M[1]-x[1]];x=M;const C=o()*Math.max(w[2],Math.log(w[2]))*(g?-1:1),T={x:w[0]-_[0]*C,y:w[1]-_[1]*C},D=[[0,0],[c,l]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},D,a)},N=Xr().on("start",y).on("zoom",u?m:null).on("zoom.wheel",d?h:null);r.call(N,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const sn=e=>({x:e.x,y:e.y,zoom:e.k}),vn=({x:e,y:t,zoom:n})=>nn.translate(e,t).scale(n),Xe=(e,t)=>e.target.closest(`.${t}`),yi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Id=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,bn=(e,t=0,n=Id,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},xi=e=>{const t=e.ctrlKey&&yt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function $d({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return f=>{if(Xe(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&s){const y=fe(f),m=xi(f),N=u*Math.pow(2,m);o.scaleTo(n,N,y,f);return}const d=f.deltaMode===1?20:1;let g=r===ze.Vertical?0:f.deltaX*d,h=r===ze.Horizontal?0:f.deltaY*d;!yt()&&f.shiftKey&&r!==ze.Vertical&&(g=f.deltaY*d,h=0),o.translateBy(n,-(g/u)*i,-(h/u)*i,{internal:!0});const x=sn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(f,x),e.panScrollTimeout=setTimeout(()=>{l==null||l(f,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(f,x))}}function Ad({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Xe(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Td({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=sn(o.transform);e.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(o.sourceEvent,r))}}function Ld({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&yi(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,sn(i.transform)))}}function Pd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&yi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const c=sn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,c)},n?150:0)}}}function Dd({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:f}){return u=>{var y;const d=e||t,g=n&&u.ctrlKey,h=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Xe(u,`${l}-flow__node`)||Xe(u,`${l}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||f&&!h||Xe(u,a)&&h||Xe(u,c)&&(!h||r&&h&&!e)||!n&&u.ctrlKey&&h)return!1;if(!n&&u.type==="touchstart"&&((y=u.touches)==null?void 0:y.length)>1)return u.preventDefault(),!1;if(!d&&!r&&!g&&h||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||h)&&x}}function zd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),u=Xr().scaleExtent([t,n]).translateExtent(o),d=le(e).call(u);N({x:r.x,y:r.y,zoom:Qe(r.zoom,t,n)},[[0,0],[f.width,f.height]],o);const g=d.on("wheel.zoom"),h=d.on("dblclick.zoom");u.wheelDelta(xi);function x($,P){return d?new Promise(H=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?lt:jt).transform(bn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>H(!0)),$)}):Promise.resolve(!1)}function y({noWheelClassName:$,noPanClassName:P,onPaneContextMenu:H,userSelectionActive:b,panOnScroll:A,panOnDrag:E,panOnScrollMode:L,panOnScrollSpeed:I,preventScrolling:S,zoomOnPinch:z,zoomOnScroll:R,zoomOnDoubleClick:j,zoomActivationKeyPressed:V,lib:B,onTransformChange:Y,connectionInProgress:U,paneClickDistance:W,selectionOnDrag:F}){b&&!l.isZoomingOrPanning&&m();const G=A&&!V&&!b;u.clickDistance(F?1/0:!ge(W)||W<0?0:W);const Q=G?$d({zoomPanValues:l,noWheelClassName:$,d3Selection:d,d3Zoom:u,panOnScrollMode:L,panOnScrollSpeed:I,zoomOnPinch:z,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Ad({noWheelClassName:$,preventScrolling:S,d3ZoomHandler:g});if(d.on("wheel.zoom",Q,{passive:!1}),!b){const K=Td({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});u.on("start",K);const q=Ld({zoomPanValues:l,panOnDrag:E,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:Y});u.on("zoom",q);const te=Pd({zoomPanValues:l,panOnDrag:E,panOnScroll:A,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:c});u.on("end",te)}const Z=Dd({zoomActivationKeyPressed:V,panOnDrag:E,zoomOnScroll:R,panOnScroll:A,zoomOnDoubleClick:j,zoomOnPinch:z,userSelectionActive:b,noPanClassName:P,noWheelClassName:$,lib:B,connectionInProgress:U});u.filter(Z),j?d.on("dblclick.zoom",h):d.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function N($,P,H){const b=vn($),A=u==null?void 0:u.constrain()(b,P,H);return A&&await x(A),new Promise(E=>E(A))}async function p($,P){const H=vn($);return await x(H,P),new Promise(b=>b(H))}function w($){if(d){const P=vn($),H=d.property("__zoom");(H.k!==$.zoom||H.x!==$.x||H.y!==$.y)&&(u==null||u.transform(d,P,null,{sync:!0}))}}function M(){const $=d?Br(d.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}function _($,P){return d?new Promise(H=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?lt:jt).scaleTo(bn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>H(!0)),$)}):Promise.resolve(!1)}function C($,P){return d?new Promise(H=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?lt:jt).scaleBy(bn(d,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>H(!0)),$)}):Promise.resolve(!1)}function T($){u==null||u.scaleExtent($)}function D($){u==null||u.translateExtent($)}function O($){const P=!ge($)||$<0?0:$;u==null||u.clickDistance(P)}return{update:y,destroy:m,setViewport:p,setViewportConstrained:N,getViewport:M,scaleTo:_,scaleBy:C,setScaleExtent:T,setTranslateExtent:D,syncViewport:w,setClickDistance:O}}var Fe;(function(e){e.Line="line",e.Handle="handle"})(Fe||(Fe={}));const jd=["top-left","top-right","bottom-left","bottom-right"],Rd=["top","right","bottom","left"];function Hd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Vo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Me(e,t){return Math.max(0,t-e)}function ke(e,t){return Math.max(0,e-t)}function Lt(e,t,n){return Math.max(0,t-e,e-n)}function Bo(e,t){return e?!t:t}function Od(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:f,isVertical:u}=t,d=f&&u,{xSnapped:g,ySnapped:h}=n,{minWidth:x,maxWidth:y,minHeight:m,maxHeight:N}=o,{x:p,y:w,width:M,height:_,aspectRatio:C}=e;let T=Math.floor(f?g-e.pointerX:0),D=Math.floor(u?h-e.pointerY:0);const O=M+(c?-T:T),$=_+(l?-D:D),P=-i[0]*M,H=-i[1]*_;let b=Lt(O,x,y),A=Lt($,m,N);if(s){let I=0,S=0;c&&T<0?I=Me(p+T+P,s[0][0]):!c&&T>0&&(I=ke(p+O+P,s[1][0])),l&&D<0?S=Me(w+D+H,s[0][1]):!l&&D>0&&(S=ke(w+$+H,s[1][1])),b=Math.max(b,I),A=Math.max(A,S)}if(a){let I=0,S=0;c&&T>0?I=ke(p+T,a[0][0]):!c&&T<0&&(I=Me(p+O,a[1][0])),l&&D>0?S=ke(w+D,a[0][1]):!l&&D<0&&(S=Me(w+$,a[1][1])),b=Math.max(b,I),A=Math.max(A,S)}if(r){if(f){const I=Lt(O/C,m,N)*C;if(b=Math.max(b,I),s){let S=0;!c&&!l||c&&!l&&d?S=ke(w+H+O/C,s[1][1])*C:S=Me(w+H+(c?T:-T)/C,s[0][1])*C,b=Math.max(b,S)}if(a){let S=0;!c&&!l||c&&!l&&d?S=Me(w+O/C,a[1][1])*C:S=ke(w+(c?T:-T)/C,a[0][1])*C,b=Math.max(b,S)}}if(u){const I=Lt($*C,x,y)/C;if(A=Math.max(A,I),s){let S=0;!c&&!l||l&&!c&&d?S=ke(p+$*C+P,s[1][0])/C:S=Me(p+(l?D:-D)*C+P,s[0][0])/C,A=Math.max(A,S)}if(a){let S=0;!c&&!l||l&&!c&&d?S=Me(p+$*C,a[1][0])/C:S=ke(p+(l?D:-D)*C,a[0][0])/C,A=Math.max(A,S)}}}D=D+(D<0?A:-A),T=T+(T<0?b:-b),r&&(d?O>$*C?D=(Bo(c,l)?-T:T)/C:T=(Bo(c,l)?-D:D)*C:f?(D=T/C,l=c):(T=D*C,c=l));const E=c?p+T:p,L=l?w+D:w;return{width:M+(c?-T:T),height:_+(l?-D:D),x:i[0]*T*(c?-1:1)+E,y:i[1]*D*(l?-1:1)+L}}const wi={width:0,height:0,x:0,y:0},Fd={...wi,pointerX:0,pointerY:0,aspectRatio:1};function Vd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Bd(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Xd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:Vo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:f,keepAspectRatio:u,resizeDirection:d,onResizeStart:g,onResize:h,onResizeEnd:x,shouldResize:y}){let m={...wi},N={...Fd};s={boundaries:f,resizeDirection:d,keepAspectRatio:u,controlDirection:Vo(l)};let p,w=null,M=[],_,C,T,D=!1;const O=Ir().on("start",$=>{const{nodeLookup:P,transform:H,snapGrid:b,snapToGrid:A,nodeOrigin:E,paneDomNode:L}=n();if(p=P.get(t),!p)return;w=(L==null?void 0:L.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:S}=ut($.sourceEvent,{transform:H,snapGrid:b,snapToGrid:A,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},N={...m,pointerX:I,pointerY:S,aspectRatio:m.width/m.height},_=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=P.get(p.parentId),C=_&&p.extent==="parent"?Vd(_):void 0),M=[],T=void 0;for(const[z,R]of P)if(R.parentId===t&&(M.push({id:z,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const j=Bd(R,p,R.origin??E);T?T=[[Math.min(j[0][0],T[0][0]),Math.min(j[0][1],T[0][1])],[Math.max(j[1][0],T[1][0]),Math.max(j[1][1],T[1][1])]]:T=j}g==null||g($,{...m})}).on("drag",$=>{const{transform:P,snapGrid:H,snapToGrid:b,nodeOrigin:A}=n(),E=ut($.sourceEvent,{transform:P,snapGrid:H,snapToGrid:b,containerBounds:w}),L=[];if(!p)return;const{x:I,y:S,width:z,height:R}=m,j={},V=p.origin??A,{width:B,height:Y,x:U,y:W}=Od(N,s.controlDirection,E,s.boundaries,s.keepAspectRatio,V,C,T),F=B!==z,G=Y!==R,Q=U!==I&&F,Z=W!==S&&G;if(!Q&&!Z&&!F&&!G)return;if((Q||Z||V[0]===1||V[1]===1)&&(j.x=Q?U:m.x,j.y=Z?W:m.y,m.x=j.x,m.y=j.y,M.length>0)){const oe=U-I,ee=W-S;for(const ae of M)ae.position={x:ae.position.x-oe+V[0]*(B-z),y:ae.position.y-ee+V[1]*(Y-R)},L.push(ae)}if((F||G)&&(j.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?B:m.width,j.height=G&&(!s.resizeDirection||s.resizeDirection==="vertical")?Y:m.height,m.width=j.width,m.height=j.height),_&&p.expandParent){const oe=V[0]*(j.width??0);j.x&&j.x<oe&&(m.x=oe,N.x=N.x-(j.x-oe));const ee=V[1]*(j.height??0);j.y&&j.y<ee&&(m.y=ee,N.y=N.y-(j.y-ee))}const K=Hd({width:m.width,prevWidth:z,height:m.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...m,direction:K};(y==null?void 0:y($,q))!==!1&&(D=!0,h==null||h($,q),o(j,L))}).on("end",$=>{D&&(x==null||x($,{...m}),r==null||r({...m}),D=!1)});i.call(O)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}const{useDebugValue:Yd}=la,{useSyncExternalStoreWithSelector:Gd}=ca,Wd=e=>e;function vi(e,t=Wd,n){const o=Gd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Yd(o),o}const Xo=(e,t)=>{const n=aa(e),o=(r,i=t)=>vi(n,r,i);return Object.assign(o,n),o},qd=(e,t)=>e?Xo(e,t):Xo;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const an=k.createContext(null),Ud=an.Provider,bi=we.error001();function J(e,t){const n=k.useContext(an);if(n===null)throw new Error(bi);return vi(n,e,t)}function ie(){const e=k.useContext(an);if(e===null)throw new Error(bi);return k.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Yo={display:"none"},Kd={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_i="react-flow__node-desc",Ni="react-flow__edge-desc",Zd="react-flow__aria-live",Qd=e=>e.ariaLiveMessage,Jd=e=>e.ariaLabelConfig;function ef({rfId:e}){const t=J(Qd);return v.jsx("div",{id:`${Zd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Kd,children:t})}function tf({rfId:e,disableKeyboardA11y:t}){const n=J(Jd);return v.jsxs(v.Fragment,{children:[v.jsx("div",{id:`${_i}-${e}`,style:Yo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),v.jsx("div",{id:`${Ni}-${e}`,style:Yo,children:n["edge.a11yDescription.default"]}),!t&&v.jsx(ef,{rfId:e})]})}const cn=k.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return v.jsx("div",{className:se(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});cn.displayName="Panel";function nf({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:v.jsx(cn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:v.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const of=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Pt=e=>e.id;function rf(e,t){return re(e.selectedNodes.map(Pt),t.selectedNodes.map(Pt))&&re(e.selectedEdges.map(Pt),t.selectedEdges.map(Pt))}function sf({onSelectionChange:e}){const t=ie(),{selectedNodes:n,selectedEdges:o}=J(of,rf);return k.useEffect(()=>{const r={nodes:n,edges:o};e==null||e(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const af=e=>!!e.onSelectionChangeHandlers;function cf({onSelectionChange:e}){const t=J(af);return e||t?v.jsx(sf,{onSelectionChange:e}):null}const Ei=[0,0],lf={x:0,y:0,zoom:1},uf=["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"],Go=[...uf,"rfId"],df=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}),Wo={translateExtent:pt,nodeOrigin:Ei,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ff(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(df,re),l=ie();k.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=Wo,a()}),[]);const f=k.useRef(Wo);return k.useEffect(()=>{for(const u of Go){const d=e[u],g=f.current[u];d!==g&&(typeof e[u]>"u"||(u==="nodes"?t(d):u==="edges"?n(d):u==="minZoom"?o(d):u==="maxZoom"?r(d):u==="translateExtent"?i(d):u==="nodeExtent"?s(d):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:ed(d)}):u==="fitView"?l.setState({fitViewQueued:d}):u==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[u]:d})))}f.current=e},Go.map(u=>e[u])),null}function qo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function hf(e){var o;const[t,n]=k.useState(e==="system"?null:e);return k.useEffect(()=>{if(e!=="system"){n(e);return}const r=qo(),i=()=>n(r!=null&&r.matches?"dark":"light");return i(),r==null||r.addEventListener("change",i),()=>{r==null||r.removeEventListener("change",i)}},[e]),t!==null?t:(o=qo())!=null&&o.matches?"dark":"light"}const Uo=typeof document<"u"?document:null;function xt(e=null,t={target:Uo,actInsideInputWithModifier:!0}){const[n,o]=k.useState(!1),r=k.useRef(!1),i=k.useRef(new Set([])),[s,a]=k.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`