@nomoreide/cli-darwin-arm64 0.3.2 → 0.3.3

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.
@@ -1,4 +1,4 @@
1
- import{g as Na,l as Pr,i as Ca,R as Ma,r as $,j as C,u as ka,f as lt,e as Ia,T as Aa,F as vo,c as $a,b as Pa}from"./index-DLbovJIj.js";const Da=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],za=Na("pin",Da);function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ta={value:()=>{}};function en(){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 Ot(n)}function Ot(e){this._=e}function Ra(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}})}Ot.prototype=en.prototype={constructor:Ot,on:function(e,t){var n=this._,o=Ra(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]=bo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=bo(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 Ot(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 bo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Ta,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Pn="http://www.w3.org/1999/xhtml";const _o={svg:"http://www.w3.org/2000/svg",xhtml:Pn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function tn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),_o.hasOwnProperty(t)?{space:_o[t],local:e}:e}function La(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Pn&&t.documentElement.namespaceURI===Pn?t.createElement(e):t.createElementNS(n,e)}}function Oa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Dr(e){var t=tn(e);return(t.local?Oa:La)(t)}function Va(){}function Zn(e){return e==null?Va:function(){return this.querySelector(e)}}function Ba(e){typeof e!="function"&&(e=Zn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,d,c=0;c<s;++c)(l=i[c])&&(d=e.call(l,l.__data__,c,i))&&("__data__"in l&&(d.__data__=l.__data__),a[c]=d);return new ue(o,this._parents)}function ja(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Fa(){return[]}function zr(e){return e==null?Fa:function(){return this.querySelectorAll(e)}}function Xa(e){return function(){return ja(e.apply(this,arguments))}}function Ya(e){typeof e=="function"?e=Xa(e):e=zr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,d=0;d<a;++d)(l=s[d])&&(o.push(e.call(l,l.__data__,d,s)),r.push(l));return new ue(o,r)}function Tr(e){return function(){return this.matches(e)}}function Rr(e){return function(t){return t.matches(e)}}var Za=Array.prototype.find;function Wa(e){return function(){return Za.call(this.children,e)}}function qa(){return this.firstElementChild}function Ga(e){return this.select(e==null?qa:Wa(typeof e=="function"?e:Rr(e)))}var Ka=Array.prototype.filter;function Ua(){return Array.from(this.children)}function Qa(e){return function(){return Ka.call(this.children,e)}}function Ja(e){return this.selectAll(e==null?Ua:Qa(typeof e=="function"?e:Rr(e)))}function ec(e){typeof e!="function"&&(e=Tr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,d=0;d<s;++d)(l=i[d])&&e.call(l,l.__data__,d,i)&&a.push(l);return new ue(o,this._parents)}function Hr(e){return new Array(e.length)}function tc(){return new ue(this._enter||this._groups.map(Hr),this._parents)}function Xt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Xt.prototype={constructor:Xt,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 nc(e){return function(){return e}}function oc(e,t,n,o,r,i){for(var s=0,a,l=t.length,d=i.length;s<d;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Xt(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function rc(e,t,n,o,r,i,s){var a,l,d=new Map,c=t.length,u=i.length,f=new Array(c),h;for(a=0;a<c;++a)(l=t[a])&&(f[a]=h=s.call(l,l.__data__,a,t)+"",d.has(h)?r[a]=l:d.set(h,l));for(a=0;a<u;++a)h=s.call(e,i[a],a,i)+"",(l=d.get(h))?(o[a]=l,l.__data__=i[a],d.delete(h)):n[a]=new Xt(e,i[a]);for(a=0;a<c;++a)(l=t[a])&&d.get(f[a])===l&&(r[a]=l)}function ic(e){return e.__data__}function sc(e,t){if(!arguments.length)return Array.from(this,ic);var n=t?rc:oc,o=this._parents,r=this._groups;typeof e!="function"&&(e=nc(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),d=0;d<i;++d){var c=o[d],u=r[d],f=u.length,h=ac(e.call(c,c&&c.__data__,d,o)),g=h.length,w=a[d]=new Array(g),y=s[d]=new Array(g),m=l[d]=new Array(f);n(c,u,w,y,m,h,t);for(var b=0,p=0,v,N;b<g;++b)if(v=w[b]){for(b>=p&&(p=b+1);!(N=y[p])&&++p<g;);v._next=N||null}}return s=new ue(s,o),s._enter=a,s._exit=l,s}function ac(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function cc(){return new ue(this._exit||this._groups.map(Hr),this._parents)}function lc(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 uc(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var d=n[l],c=o[l],u=d.length,f=a[l]=new Array(u),h,g=0;g<u;++g)(h=d[g]||c[g])&&(f[g]=h);for(;l<r;++l)a[l]=n[l];return new ue(a,this._parents)}function dc(){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 fc(e){e||(e=hc);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),d,c=0;c<a;++c)(d=s[c])&&(l[c]=d);l.sort(t)}return new ue(r,this._parents).order()}function hc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function gc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pc(){return Array.from(this)}function mc(){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 yc(){let e=0;for(const t of this)++e;return e}function xc(){return!this.node()}function wc(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 vc(e){return function(){this.removeAttribute(e)}}function bc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _c(e,t){return function(){this.setAttribute(e,t)}}function Ec(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Sc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Nc(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 Cc(e,t){var n=tn(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?bc:vc:typeof t=="function"?n.local?Nc:Sc:n.local?Ec:_c)(n,t))}function Lr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Mc(e){return function(){this.style.removeProperty(e)}}function kc(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 Ac(e,t,n){return arguments.length>1?this.each((t==null?Mc:typeof t=="function"?Ic:kc)(e,t,n??"")):Qe(this.node(),e)}function Qe(e,t){return e.style.getPropertyValue(t)||Lr(e).getComputedStyle(e,null).getPropertyValue(t)}function $c(e){return function(){delete this[e]}}function Pc(e,t){return function(){this[e]=t}}function Dc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function zc(e,t){return arguments.length>1?this.each((t==null?$c:typeof t=="function"?Dc:Pc)(e,t)):this.node()[e]}function Or(e){return e.trim().split(/^|\s+/)}function Wn(e){return e.classList||new Vr(e)}function Vr(e){this._node=e,this._names=Or(e.getAttribute("class")||"")}Vr.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 Br(e,t){for(var n=Wn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function jr(e,t){for(var n=Wn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Tc(e){return function(){Br(this,e)}}function Rc(e){return function(){jr(this,e)}}function Hc(e,t){return function(){(t.apply(this,arguments)?Br:jr)(this,e)}}function Lc(e,t){var n=Or(e+"");if(arguments.length<2){for(var o=Wn(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?Tc:Rc)(n,t))}function Oc(){this.textContent=""}function Vc(e){return function(){this.textContent=e}}function Bc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function jc(e){return arguments.length?this.each(e==null?Oc:(typeof e=="function"?Bc:Vc)(e)):this.node().textContent}function Fc(){this.innerHTML=""}function Xc(e){return function(){this.innerHTML=e}}function Yc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Zc(e){return arguments.length?this.each(e==null?Fc:(typeof e=="function"?Yc:Xc)(e)):this.node().innerHTML}function Wc(){this.nextSibling&&this.parentNode.appendChild(this)}function qc(){return this.each(Wc)}function Gc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Kc(){return this.each(Gc)}function Uc(e){var t=typeof e=="function"?e:Dr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Qc(){return null}function Jc(e,t){var n=typeof e=="function"?e:Dr(e),o=t==null?Qc:typeof t=="function"?t:Zn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function el(){var e=this.parentNode;e&&e.removeChild(this)}function tl(){return this.each(el)}function nl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ol(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rl(e){return this.select(e?ol:nl)}function il(e){return arguments.length?this.property("__data__",e):this.node().__data__}function sl(e){return function(t){e.call(this,t,this.__data__)}}function al(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 cl(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 ll(e,t,n){return function(){var o=this.__on,r,i=sl(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 ul(e,t,n){var o=al(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,d=a.length,c;l<d;++l)for(r=0,c=a[l];r<i;++r)if((s=o[r]).type===c.type&&s.name===c.name)return c.value}return}for(a=t?ll:cl,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Fr(e,t,n){var o=Lr(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 dl(e,t){return function(){return Fr(this,e,t)}}function fl(e,t){return function(){return Fr(this,e,t.apply(this,arguments))}}function hl(e,t){return this.each((typeof t=="function"?fl:dl)(e,t))}function*gl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Xr=[null];function ue(e,t){this._groups=e,this._parents=t}function St(){return new ue([[document.documentElement]],Xr)}function pl(){return this}ue.prototype=St.prototype={constructor:ue,select:Ba,selectAll:Ya,selectChild:Ga,selectChildren:Ja,filter:ec,data:sc,enter:tc,exit:cc,join:lc,merge:uc,selection:pl,order:dc,sort:fc,call:gc,nodes:pc,node:mc,size:yc,empty:xc,each:wc,attr:Cc,style:Ac,property:zc,classed:Lc,text:jc,html:Zc,raise:qc,lower:Kc,append:Uc,insert:Jc,remove:tl,clone:rl,datum:il,on:ul,dispatch:hl,[Symbol.iterator]:gl};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Xr)}function ml(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=ml(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 yl={passive:!1},gt={capture:!0,passive:!1};function pn(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function Yr(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Ke,gt);"onselectstart"in t?n.on("selectstart.drag",Ke,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Zr(e,t){var n=e.document.documentElement,o=le(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ke,gt),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 At=e=>()=>e;function Dn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:d,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:c}})}Dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function xl(e){return!e.ctrlKey&&!e.button}function wl(){return this.parentNode}function vl(e,t){return t??{x:e.x,y:e.y}}function bl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wr(){var e=xl,t=wl,n=vl,o=bl,r={},i=en("start","drag","end"),s=0,a,l,d,c,u=0;function f(v){v.on("mousedown.drag",h).filter(o).on("touchstart.drag",y).on("touchmove.drag",m,yl).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(v,N){if(!(c||!e.call(this,v,N))){var _=p(this,t.call(this,v,N),v,N,"mouse");_&&(le(v.view).on("mousemove.drag",g,gt).on("mouseup.drag",w,gt),Yr(v.view),pn(v),d=!1,a=v.clientX,l=v.clientY,_("start",v))}}function g(v){if(Ke(v),!d){var N=v.clientX-a,_=v.clientY-l;d=N*N+_*_>u}r.mouse("drag",v)}function w(v){le(v.view).on("mousemove.drag mouseup.drag",null),Zr(v.view,d),Ke(v),r.mouse("end",v)}function y(v,N){if(e.call(this,v,N)){var _=v.changedTouches,M=t.call(this,v,N),I=_.length,A,B;for(A=0;A<I;++A)(B=p(this,M,v,N,_[A].identifier,_[A]))&&(pn(v),B("start",v,_[A]))}}function m(v){var N=v.changedTouches,_=N.length,M,I;for(M=0;M<_;++M)(I=r[N[M].identifier])&&(Ke(v),I("drag",v,N[M]))}function b(v){var N=v.changedTouches,_=N.length,M,I;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),M=0;M<_;++M)(I=r[N[M].identifier])&&(pn(v),I("end",v,N[M]))}function p(v,N,_,M,I,A){var B=i.copy(),z=fe(A||_,N),L,T,x;if((x=n.call(v,new Dn("beforestart",{sourceEvent:_,target:f,identifier:I,active:s,x:z[0],y:z[1],dx:0,dy:0,dispatch:B}),M))!=null)return L=x.x-z[0]||0,T=x.y-z[1]||0,function E(S,k,D){var P=z,V;switch(S){case"start":r[I]=E,V=s++;break;case"end":delete r[I],--s;case"drag":z=fe(D||k,N),V=s;break}B.call(S,v,new Dn(S,{sourceEvent:k,subject:x,target:f,identifier:I,active:V,x:z[0]+L,y:z[1]+T,dx:z[0]-P[0],dy:z[1]-P[1],dispatch:B}),M)}}return f.filter=function(v){return arguments.length?(e=typeof v=="function"?v:At(!!v),f):e},f.container=function(v){return arguments.length?(t=typeof v=="function"?v:At(v),f):t},f.subject=function(v){return arguments.length?(n=typeof v=="function"?v:At(v),f):n},f.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:At(!!v),f):o},f.on=function(){var v=i.on.apply(i,arguments);return v===i?f:v},f.clickDistance=function(v){return arguments.length?(u=(v=+v)*v,f):Math.sqrt(u)},f}function qn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function qr(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Nt(){}var pt=.7,Yt=1/pt,Ue="\\s*([+-]?\\d+)\\s*",mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_l=/^#([0-9a-f]{3,8})$/,El=new RegExp(`^rgb\\(${Ue},${Ue},${Ue}\\)$`),Sl=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),Nl=new RegExp(`^rgba\\(${Ue},${Ue},${Ue},${mt}\\)$`),Cl=new RegExp(`^rgba\\(${be},${be},${be},${mt}\\)$`),Ml=new RegExp(`^hsl\\(${mt},${be},${be}\\)$`),kl=new RegExp(`^hsla\\(${mt},${be},${be},${mt}\\)$`),Eo={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};qn(Nt,je,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:So,formatHex:So,formatHex8:Il,formatHsl:Al,formatRgb:No,toString:No});function So(){return this.rgb().formatHex()}function Il(){return this.rgb().formatHex8()}function Al(){return Gr(this).formatHsl()}function No(){return this.rgb().formatRgb()}function je(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_l.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Co(t):n===3?new ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$t(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$t(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=El.exec(e))?new ce(t[1],t[2],t[3],1):(t=Sl.exec(e))?new ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Nl.exec(e))?$t(t[1],t[2],t[3],t[4]):(t=Cl.exec(e))?$t(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ml.exec(e))?Io(t[1],t[2]/100,t[3]/100,1):(t=kl.exec(e))?Io(t[1],t[2]/100,t[3]/100,t[4]):Eo.hasOwnProperty(e)?Co(Eo[e]):e==="transparent"?new ce(NaN,NaN,NaN,0):null}function Co(e){return new ce(e>>16&255,e>>8&255,e&255,1)}function $t(e,t,n,o){return o<=0&&(e=t=n=NaN),new ce(e,t,n,o)}function $l(e){return e instanceof Nt||(e=je(e)),e?(e=e.rgb(),new ce(e.r,e.g,e.b,e.opacity)):new ce}function zn(e,t,n,o){return arguments.length===1?$l(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}qn(ce,zn,qr(Nt,{brighter(e){return e=e==null?Yt:Math.pow(Yt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pt:Math.pow(pt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ce(Ve(this.r),Ve(this.g),Ve(this.b),Zt(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:Mo,formatHex:Mo,formatHex8:Pl,formatRgb:ko,toString:ko}));function Mo(){return`#${Oe(this.r)}${Oe(this.g)}${Oe(this.b)}`}function Pl(){return`#${Oe(this.r)}${Oe(this.g)}${Oe(this.b)}${Oe((isNaN(this.opacity)?1:this.opacity)*255)}`}function ko(){const e=Zt(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function Zt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Oe(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function Io(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 Gr(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof Nt||(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,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new he(s,a,l,e.opacity)}function Dl(e,t,n,o){return arguments.length===1?Gr(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}qn(he,Dl,qr(Nt,{brighter(e){return e=e==null?Yt:Math.pow(Yt,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pt:Math.pow(pt,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(Ao(this.h),Pt(this.s),Pt(this.l),Zt(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=Zt(this.opacity);return`${e===1?"hsl(":"hsla("}${Ao(this.h)}, ${Pt(this.s)*100}%, ${Pt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ao(e){return e=(e||0)%360,e<0?e+360:e}function Pt(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 Gn=e=>()=>e;function zl(e,t){return function(n){return e+n*t}}function Tl(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 Rl(e){return(e=+e)==1?Kr:function(t,n){return n-t?Tl(t,n,e):Gn(isNaN(t)?n:t)}}function Kr(e,t){var n=t-e;return n?zl(e,n):Gn(isNaN(e)?t:e)}const Wt=(function e(t){var n=Rl(t);function o(r,i){var s=n((r=zn(r)).r,(i=zn(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),d=Kr(r.opacity,i.opacity);return function(c){return r.r=s(c),r.g=a(c),r.b=l(c),r.opacity=d(c),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 Ll(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ol(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]=ft(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 Vl(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function ve(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Bl(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]=ft(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var Tn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yn=new RegExp(Tn.source,"g");function jl(e){return function(){return e}}function Fl(e){return function(t){return e(t)+""}}function Ur(e,t){var n=Tn.lastIndex=yn.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Tn.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,l.push({i:s,x:ve(o,r)})),n=yn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Fl(l[0].x):jl(t):(t=l.length,function(d){for(var c=0,u;c<t;++c)a[(u=l[c]).i]=u.x(d);return a.join("")})}function ft(e,t){var n=typeof t,o;return t==null||n==="boolean"?Gn(t):(n==="number"?ve:n==="string"?(o=je(t))?(t=o,Wt):Ur:t instanceof je?Wt:t instanceof Date?Vl:Ll(t)?Hl:Array.isArray(t)?Ol:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Bl:ve)(e,t)}var $o=180/Math.PI,Rn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Qr(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*$o,skewX:Math.atan(l)*$o,scaleX:s,scaleY:a}}var Dt;function Xl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rn:Qr(t.a,t.b,t.c,t.d,t.e,t.f)}function Yl(e){return e==null||(Dt||(Dt=document.createElementNS("http://www.w3.org/2000/svg","g")),Dt.setAttribute("transform",e),!(e=Dt.transform.baseVal.consolidate()))?Rn:(e=e.matrix,Qr(e.a,e.b,e.c,e.d,e.e,e.f))}function Jr(e,t,n,o){function r(d){return d.length?d.pop()+" ":""}function i(d,c,u,f,h,g){if(d!==u||c!==f){var w=h.push("translate(",null,t,null,n);g.push({i:w-4,x:ve(d,u)},{i:w-2,x:ve(c,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function s(d,c,u,f){d!==c?(d-c>180?c+=360:c-d>180&&(d+=360),f.push({i:u.push(r(u)+"rotate(",null,o)-2,x:ve(d,c)})):c&&u.push(r(u)+"rotate("+c+o)}function a(d,c,u,f){d!==c?f.push({i:u.push(r(u)+"skewX(",null,o)-2,x:ve(d,c)}):c&&u.push(r(u)+"skewX("+c+o)}function l(d,c,u,f,h,g){if(d!==u||c!==f){var w=h.push(r(h)+"scale(",null,",",null,")");g.push({i:w-4,x:ve(d,u)},{i:w-2,x:ve(c,f)})}else(u!==1||f!==1)&&h.push(r(h)+"scale("+u+","+f+")")}return function(d,c){var u=[],f=[];return d=e(d),c=e(c),i(d.translateX,d.translateY,c.translateX,c.translateY,u,f),s(d.rotate,c.rotate,u,f),a(d.skewX,c.skewX,u,f),l(d.scaleX,d.scaleY,c.scaleX,c.scaleY,u,f),d=c=null,function(h){for(var g=-1,w=f.length,y;++g<w;)u[(y=f[g]).i]=y.x(h);return u.join("")}}}var Zl=Jr(Xl,"px, ","px)","deg)"),Wl=Jr(Yl,", ",")",")"),ql=1e-12;function Po(e){return((e=Math.exp(e))+1/e)/2}function Gl(e){return((e=Math.exp(e))-1/e)/2}function Kl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Vt=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],d=i[2],c=s[0],u=s[1],f=s[2],h=c-a,g=u-l,w=h*h+g*g,y,m;if(w<ql)m=Math.log(f/d)/t,y=function(M){return[a+M*h,l+M*g,d*Math.exp(t*M*m)]};else{var b=Math.sqrt(w),p=(f*f-d*d+o*w)/(2*d*n*b),v=(f*f-d*d-o*w)/(2*f*n*b),N=Math.log(Math.sqrt(p*p+1)-p),_=Math.log(Math.sqrt(v*v+1)-v);m=(_-N)/t,y=function(M){var I=M*m,A=Po(N),B=d/(n*b)*(A*Kl(t*I+N)-Gl(N));return[a+B*h,l+B*g,d*A/Po(t*I+N)]}}return y.duration=m*1e3*t/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Je=0,ut=0,at=0,ei=1e3,qt,dt,Gt=0,Fe=0,nn=0,yt=typeof performance=="object"&&performance.now?performance:Date,ti=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kn(){return Fe||(ti(Ul),Fe=yt.now()+nn)}function Ul(){Fe=0}function Kt(){this._call=this._time=this._next=null}Kt.prototype=ni.prototype={constructor:Kt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Kn():+n)+(t==null?0:+t),!this._next&&dt!==this&&(dt?dt._next=this:qt=this,dt=this),this._call=e,this._time=n,Hn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Hn())}};function ni(e,t,n){var o=new Kt;return o.restart(e,t,n),o}function Ql(){Kn(),++Je;for(var e=qt,t;e;)(t=Fe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Je}function Do(){Fe=(Gt=yt.now())+nn,Je=ut=0;try{Ql()}finally{Je=0,eu(),Fe=0}}function Jl(){var e=yt.now(),t=e-Gt;t>ei&&(nn-=t,Gt=e)}function eu(){for(var e,t=qt,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:qt=n);dt=e,Hn(o)}function Hn(e){if(!Je){ut&&(ut=clearTimeout(ut));var t=e-Fe;t>24?(e<1/0&&(ut=setTimeout(Do,e-yt.now()-nn)),at&&(at=clearInterval(at))):(at||(Gt=yt.now(),at=setInterval(Jl,ei)),Je=1,ti(Do))}}function zo(e,t,n){var o=new Kt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var tu=en("start","end","cancel","interrupt"),nu=[],oi=0,To=1,Ln=2,Bt=3,Ro=4,On=5,jt=6;function on(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;ou(e,n,{name:t,index:o,group:r,on:tu,tween:nu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:oi})}function Un(e,t){var n=ye(e,t);if(n.state>oi)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=ye(e,t);if(n.state>Bt)throw new Error("too late; already running");return n}function ye(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ou(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=ni(i,0,n.time);function i(d){n.state=To,n.timer.restart(s,n.delay,n.time),n.delay<=d&&s(d-n.delay)}function s(d){var c,u,f,h;if(n.state!==To)return l();for(c in o)if(h=o[c],h.name===n.name){if(h.state===Bt)return zo(s);h.state===Ro?(h.state=jt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[c]):+c<t&&(h.state=jt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[c])}if(zo(function(){n.state===Bt&&(n.state=Ro,n.timer.restart(a,n.delay,n.time),a(d))}),n.state=Ln,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ln){for(n.state=Bt,r=new Array(f=n.tween.length),c=0,u=-1;c<f;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=h);r.length=u+1}}function a(d){for(var c=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(l),n.state=On,1),u=-1,f=r.length;++u<f;)r[u].call(e,c);n.state===On&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=jt,n.timer.stop(),delete o[t];for(var d in o)return;delete e.__transition}}function Ft(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>Ln&&o.state<On,o.state=jt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function ru(e){return this.each(function(){Ft(this,e)})}function iu(e,t){var n,o;return function(){var r=_e(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 su(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=_e(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,d=r.length;l<d;++l)if(r[l].name===t){r[l]=a;break}l===d&&r.push(a)}i.tween=r}}function au(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ye(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?iu:su)(n,e,t))}function Qn(e,t,n){var o=e._id;return e.each(function(){var r=_e(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ye(r,o).value[t]}}function ri(e,t){var n;return(typeof t=="number"?ve:t instanceof je?Wt:(n=je(t))?(t=n,Wt):Ur)(e,t)}function cu(e){return function(){this.removeAttribute(e)}}function lu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uu(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 du(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 fu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function hu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function gu(e,t){var n=tn(e),o=n==="transform"?Wl:ri;return this.attrTween(e,typeof t=="function"?(n.local?hu:fu)(n,o,Qn(this,"attr."+e,t)):t==null?(n.local?lu:cu)(n):(n.local?du:uu)(n,o,t))}function pu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function mu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function yu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&mu(e,i)),n}return r._value=t,r}function xu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&pu(e,i)),n}return r._value=t,r}function wu(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=tn(e);return this.tween(n,(o.local?yu:xu)(o,t))}function vu(e,t){return function(){Un(this,e).delay=+t.apply(this,arguments)}}function bu(e,t){return t=+t,function(){Un(this,e).delay=t}}function _u(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vu:bu)(t,e)):ye(this.node(),t).delay}function Eu(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function Su(e,t){return t=+t,function(){_e(this,e).duration=t}}function Nu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Eu:Su)(t,e)):ye(this.node(),t).duration}function Cu(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function Mu(e){var t=this._id;return arguments.length?this.each(Cu(t,e)):ye(this.node(),t).ease}function ku(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function Iu(e){if(typeof e!="function")throw new Error;return this.each(ku(this._id,e))}function Au(e){typeof e!="function"&&(e=Tr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,d=0;d<s;++d)(l=i[d])&&e.call(l,l.__data__,d,i)&&a.push(l);return new $e(o,this._parents,this._name,this._id)}function $u(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],d=n[a],c=l.length,u=s[a]=new Array(c),f,h=0;h<c;++h)(f=l[h]||d[h])&&(u[h]=f);for(;a<o;++a)s[a]=t[a];return new $e(s,this._parents,this._name,this._id)}function Pu(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 Du(e,t,n){var o,r,i=Pu(t)?Un:_e;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function zu(e,t){var n=this._id;return arguments.length<2?ye(this.node(),n).on.on(e):this.each(Du(n,e,t))}function Tu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ru(){return this.on("end.remove",Tu(this._id))}function Hu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Zn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,d=i[s]=new Array(l),c,u,f=0;f<l;++f)(c=a[f])&&(u=e.call(c,c.__data__,f,a))&&("__data__"in c&&(u.__data__=c.__data__),d[f]=u,on(d[f],t,n,f,d,ye(c,n)));return new $e(i,this._parents,t,n)}function Lu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],d=l.length,c,u=0;u<d;++u)if(c=l[u]){for(var f=e.call(c,c.__data__,u,l),h,g=ye(c,n),w=0,y=f.length;w<y;++w)(h=f[w])&&on(h,t,n,w,f,g);i.push(f),s.push(c)}return new $e(i,s,t,n)}var Ou=St.prototype.constructor;function Vu(){return new Ou(this._groups,this._parents)}function Bu(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 ii(e){return function(){this.style.removeProperty(e)}}function ju(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 Fu(e,t,n){var o,r,i;return function(){var s=Qe(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Qe(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function Xu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=_e(this,e),d=l.on,c=l.value[i]==null?a||(a=ii(t)):void 0;(d!==n||r!==c)&&(o=(n=d).copy()).on(s,r=c),l.on=o}}function Yu(e,t,n){var o=(e+="")=="transform"?Zl:ri;return t==null?this.styleTween(e,Bu(e,o)).on("end.style."+e,ii(e)):typeof t=="function"?this.styleTween(e,Fu(e,o,Qn(this,"style."+e,t))).each(Xu(this._id,e)):this.styleTween(e,ju(e,o,t),n).on("end.style."+e,null)}function Zu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Wu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Zu(e,s,n)),o}return i._value=t,i}function qu(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,Wu(e,t,n??""))}function Gu(e){return function(){this.textContent=e}}function Ku(e){return function(){var t=e(this);this.textContent=t??""}}function Uu(e){return this.tween("text",typeof e=="function"?Ku(Qn(this,"text",e)):Gu(e==null?"":e+""))}function Qu(e){return function(t){this.textContent=e.call(this,t)}}function Ju(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Qu(r)),t}return o._value=e,o}function ed(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,Ju(e))}function td(){for(var e=this._name,t=this._id,n=si(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,d=0;d<a;++d)if(l=s[d]){var c=ye(l,t);on(l,e,n,d,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new $e(o,this._parents,e,n)}function nd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var d=_e(this,o),c=d.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),d.on=t}),r===0&&i()})}var od=0;function $e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function si(){return++od}var ke=St.prototype;$e.prototype={constructor:$e,select:Hu,selectAll:Lu,selectChild:ke.selectChild,selectChildren:ke.selectChildren,filter:Au,merge:$u,selection:Vu,transition:td,call:ke.call,nodes:ke.nodes,node:ke.node,size:ke.size,empty:ke.empty,each:ke.each,on:zu,attr:gu,attrTween:wu,style:Yu,styleTween:qu,text:Uu,textTween:ed,remove:Ru,tween:au,delay:_u,duration:Nu,ease:Mu,easeVarying:Iu,end:nd,[Symbol.iterator]:ke[Symbol.iterator]};function rd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var id={time:null,delay:0,duration:250,ease:rd};function sd(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 ad(e){var t,n;e instanceof $e?(t=e._id,e=e._name):(t=si(),(n=id).time=Kn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,d=0;d<a;++d)(l=s[d])&&on(l,e,t,d,s,n||sd(l,t));return new $e(o,this._parents,e,t)}St.prototype.interrupt=ru;St.prototype.transition=ad;const zt=e=>()=>e;function cd(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 Ie(e,t,n){this.k=e,this.x=t,this.y=n}Ie.prototype={constructor:Ie,scale:function(e){return e===1?this:new Ie(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ie(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 rn=new Ie(1,0,0);ai.prototype=Ie.prototype;function ai(e){for(;!e.__zoom;)if(!(e=e.parentNode))return rn;return e.__zoom}function xn(e){e.stopImmediatePropagation()}function ct(e){e.preventDefault(),e.stopImmediatePropagation()}function ld(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ud(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ho(){return this.__zoom||rn}function dd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fd(){return navigator.maxTouchPoints||"ontouchstart"in this}function hd(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 ci(){var e=ld,t=ud,n=hd,o=dd,r=fd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Vt,d=en("start","zoom","end"),c,u,f,h=500,g=150,w=0,y=10;function m(x){x.property("__zoom",Ho).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",z).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",T).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(x,E,S,k){var D=x.selection?x.selection():x;D.property("__zoom",Ho),x!==D?N(x,E,S,k):D.interrupt().each(function(){_(this,arguments).event(k).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},m.scaleBy=function(x,E,S,k){m.scaleTo(x,function(){var D=this.__zoom.k,P=typeof E=="function"?E.apply(this,arguments):E;return D*P},S,k)},m.scaleTo=function(x,E,S,k){m.transform(x,function(){var D=t.apply(this,arguments),P=this.__zoom,V=S==null?v(D):typeof S=="function"?S.apply(this,arguments):S,O=P.invert(V),H=typeof E=="function"?E.apply(this,arguments):E;return n(p(b(P,H),V,O),D,s)},S,k)},m.translateBy=function(x,E,S,k){m.transform(x,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),s)},null,k)},m.translateTo=function(x,E,S,k,D){m.transform(x,function(){var P=t.apply(this,arguments),V=this.__zoom,O=k==null?v(P):typeof k=="function"?k.apply(this,arguments):k;return n(rn.translate(O[0],O[1]).scale(V.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof S=="function"?-S.apply(this,arguments):-S),P,s)},k,D)};function b(x,E){return E=Math.max(i[0],Math.min(i[1],E)),E===x.k?x:new Ie(E,x.x,x.y)}function p(x,E,S){var k=E[0]-S[0]*x.k,D=E[1]-S[1]*x.k;return k===x.x&&D===x.y?x:new Ie(x.k,k,D)}function v(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}function N(x,E,S,k){x.on("start.zoom",function(){_(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(k).end()}).tween("zoom",function(){var D=this,P=arguments,V=_(D,P).event(k),O=t.apply(D,P),H=S==null?v(O):typeof S=="function"?S.apply(D,P):S,Y=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),F=D.__zoom,W=typeof E=="function"?E.apply(D,P):E,Q=l(F.invert(H).concat(Y/F.k),W.invert(H).concat(Y/W.k));return function(q){if(q===1)q=W;else{var R=Q(q),j=Y/R[2];q=new Ie(j,H[0]-R[0]*j,H[1]-R[1]*j)}V.zoom(null,q)}})}function _(x,E,S){return!S&&x.__zooming||new M(x,E)}function M(x,E){this.that=x,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,E),this.taps=0}M.prototype={event:function(x){return x&&(this.sourceEvent=x),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(x,E){return this.mouse&&x!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&x!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(x){var E=le(this.that).datum();d.call(x,this.that,new cd(x,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:d}),E)}};function I(x,...E){if(!e.apply(this,arguments))return;var S=_(this,E).event(x),k=this.__zoom,D=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),P=fe(x);if(S.wheel)(S.mouse[0][0]!==P[0]||S.mouse[0][1]!==P[1])&&(S.mouse[1]=k.invert(S.mouse[0]=P)),clearTimeout(S.wheel);else{if(k.k===D)return;S.mouse=[P,k.invert(P)],Ft(this),S.start()}ct(x),S.wheel=setTimeout(V,g),S.zoom("mouse",n(p(b(k,D),S.mouse[0],S.mouse[1]),S.extent,s));function V(){S.wheel=null,S.end()}}function A(x,...E){if(f||!e.apply(this,arguments))return;var S=x.currentTarget,k=_(this,E,!0).event(x),D=le(x.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",Y,!0),P=fe(x,S),V=x.clientX,O=x.clientY;Yr(x.view),xn(x),k.mouse=[P,this.__zoom.invert(P)],Ft(this),k.start();function H(F){if(ct(F),!k.moved){var W=F.clientX-V,Q=F.clientY-O;k.moved=W*W+Q*Q>w}k.event(F).zoom("mouse",n(p(k.that.__zoom,k.mouse[0]=fe(F,S),k.mouse[1]),k.extent,s))}function Y(F){D.on("mousemove.zoom mouseup.zoom",null),Zr(F.view,k.moved),ct(F),k.event(F).end()}}function B(x,...E){if(e.apply(this,arguments)){var S=this.__zoom,k=fe(x.changedTouches?x.changedTouches[0]:x,this),D=S.invert(k),P=S.k*(x.shiftKey?.5:2),V=n(p(b(S,P),k,D),t.apply(this,E),s);ct(x),a>0?le(this).transition().duration(a).call(N,V,k,x):le(this).call(m.transform,V,k,x)}}function z(x,...E){if(e.apply(this,arguments)){var S=x.touches,k=S.length,D=_(this,E,x.changedTouches.length===k).event(x),P,V,O,H;for(xn(x),V=0;V<k;++V)O=S[V],H=fe(O,this),H=[H,this.__zoom.invert(H),O.identifier],D.touch0?!D.touch1&&D.touch0[2]!==H[2]&&(D.touch1=H,D.taps=0):(D.touch0=H,P=!0,D.taps=1+!!c);c&&(c=clearTimeout(c)),P&&(D.taps<2&&(u=H[0],c=setTimeout(function(){c=null},h)),Ft(this),D.start())}}function L(x,...E){if(this.__zooming){var S=_(this,E).event(x),k=x.changedTouches,D=k.length,P,V,O,H;for(ct(x),P=0;P<D;++P)V=k[P],O=fe(V,this),S.touch0&&S.touch0[2]===V.identifier?S.touch0[0]=O:S.touch1&&S.touch1[2]===V.identifier&&(S.touch1[0]=O);if(V=S.that.__zoom,S.touch1){var Y=S.touch0[0],F=S.touch0[1],W=S.touch1[0],Q=S.touch1[1],q=(q=W[0]-Y[0])*q+(q=W[1]-Y[1])*q,R=(R=Q[0]-F[0])*R+(R=Q[1]-F[1])*R;V=b(V,Math.sqrt(q/R)),O=[(Y[0]+W[0])/2,(Y[1]+W[1])/2],H=[(F[0]+Q[0])/2,(F[1]+Q[1])/2]}else if(S.touch0)O=S.touch0[0],H=S.touch0[1];else return;S.zoom("touch",n(p(V,O,H),S.extent,s))}}function T(x,...E){if(this.__zooming){var S=_(this,E).event(x),k=x.changedTouches,D=k.length,P,V;for(xn(x),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),P=0;P<D;++P)V=k[P],S.touch0&&S.touch0[2]===V.identifier?delete S.touch0:S.touch1&&S.touch1[2]===V.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(V=fe(V,this),Math.hypot(u[0]-V[0],u[1]-V[1])<y)){var O=le(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return m.wheelDelta=function(x){return arguments.length?(o=typeof x=="function"?x:zt(+x),m):o},m.filter=function(x){return arguments.length?(e=typeof x=="function"?x:zt(!!x),m):e},m.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:zt(!!x),m):r},m.extent=function(x){return arguments.length?(t=typeof x=="function"?x:zt([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),m):t},m.scaleExtent=function(x){return arguments.length?(i[0]=+x[0],i[1]=+x[1],m):[i[0],i[1]]},m.translateExtent=function(x){return arguments.length?(s[0][0]=+x[0][0],s[1][0]=+x[1][0],s[0][1]=+x[0][1],s[1][1]=+x[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(x){return arguments.length?(n=x,m):n},m.duration=function(x){return arguments.length?(a=+x,m):a},m.interpolate=function(x){return arguments.length?(l=x,m):l},m.on=function(){var x=d.on.apply(d,arguments);return x===d?m:x},m.clickDistance=function(x){return arguments.length?(w=(x=+x)*x,m):Math.sqrt(w)},m.tapDistance=function(x){return arguments.length?(y=+x,m):y},m}const me={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.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 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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},xt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],li=["Enter"," ","Escape"],ui={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var et;(function(e){e.Strict="strict",e.Loose="loose"})(et||(et={}));var Be;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Be||(Be={}));var wt;(function(e){e.Partial="partial",e.Full="full"})(wt||(wt={}));const di={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ze;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ze||(ze={}));var vt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(vt||(vt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const Lo={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function fi(e){return e===null?null:e?"valid":"invalid"}const hi=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,gd=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Jn=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ct=(e,t=[0,0])=>{const{width:n,height:o}=Ee(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},pd=(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):Jn(r)?r:t.nodeLookup.get(r.id));const a=s?Ut(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return sn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return an(n)},Mt=(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=sn(n,Ut(r)),o=!0)}),o?an(n):{x:0,y:0,width:0,height:0}},eo=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,l=(t.y-o)/r,d=t.width/r,c=t.height/r,u=[];for(const f of e.values()){const{measured:h,selectable:g=!0,hidden:w=!1}=f;if(s&&!g||w)continue;const y=h.width??f.width??f.initialWidth??0,m=h.height??f.height??f.initialHeight??0,{x:b,y:p}=f.internals.positionAbsolute,v=yi(a,l,d,c,b,p,y,m),N=y*m,_=i&&v>0;(!f.internals.handleBounds||_||v>=N||f.dragging)&&u.push(f)}return u},md=(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 yd(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){const{width:s,height:a}=Ee(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function xd({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;const a=yd(e,s),l=Mt(a),d=no(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(d,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function gi({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:d}=a?a.internals.positionAbsolute:{x:0,y:0},c=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",me.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[l,d],[l+h,d+g]])}else a&&Ye(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+d],[s.extent[1][0]+l,s.extent[1][1]+d]]);const f=Ye(u)?Xe(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",me.error015()),{position:{x:f.x-l+(s.measured.width??0)*c[0],y:f.y-d+(s.measured.height??0)*c[1]},positionAbsolute:f}}async function wd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(w=>w.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),c=md(s,l);for(const f of l)a.has(f.id)&&!c.find(g=>g.id===f.id)&&c.push(f);if(!r)return{edges:c,nodes:s};const u=await r({nodes:s,edges:c});return typeof u=="boolean"?u?{edges:c,nodes:s}:{edges:[],nodes:[]}:u}const tt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Xe=(e={x:0,y:0},t,n)=>({x:tt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:tt(e.y,t[0][1],t[1][1]-(n?.height??0))});function pi(e,t,n){const{width:o,height:r}=Ee(n),{x:i,y:s}=n.internals.positionAbsolute;return Xe(e,[[i,s],[i+o,s+r]],t)}const Oo=(e,t,n)=>e<t?tt(Math.abs(e-t),1,t)/t:e>n?-tt(Math.abs(e-n),1,t)/t:0,to=(e,t,n=15,o=40)=>{const r=Oo(e.x,o,t.width-o)*n,i=Oo(e.y,o,t.height-o)*n;return[r,i]},sn=(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)}),Vn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),an=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),bt=(e,t=[0,0])=>{const{x:n,y:o}=Jn(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{const{x:n,y:o}=Jn(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},mi=(e,t)=>an(sn(Vn(e),Vn(t))),yi=(e,t,n,o,r,i,s,a)=>{const l=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),d=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(l*d)},Qt=(e,t)=>yi(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Vo=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),xi=(e,t)=>(n,o)=>{},kt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),It=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?kt(a,s):a},nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function We(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(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function vd(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=We(e,n),r=We(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=We(e.top??e.y??0,n),r=We(e.bottom??e.y??0,n),i=We(e.left??e.x??0,t),s=We(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 bd(e,t,n,o,r,i){const{x:s,y:a}=nt(e,[t,n,o]),{x:l,y:d}=nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),c=r-l,u=i-d;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(c),bottom:Math.floor(u)}}const no=(e,t,n,o,r,i)=>{const s=vd(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,d=Math.min(a,l),c=tt(d,o,r),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*c,g=n/2-f*c,w=bd(e,h,g,c,t,n),y={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:g-y.top+y.bottom,zoom:c}},_t=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function Ee(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function wi(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function vi(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 Bo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function _d(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Ed(e){return{...ui,...e||{}}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=pe(e),a=It({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:d}=n?kt(a,t):a;return{xSnapped:l,ySnapped:d,...a}}const oo=e=>({width:e.offsetWidth,height:e.offsetHeight}),bi=e=>e?.getRootNode?.()||window?.document,Sd=["INPUT","SELECT","TEXTAREA"];function _i(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Sd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ei=e=>"clientX"in e,pe=(e,t)=>{const n=Ei(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},jo=(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,...oo(s)}})};function Si({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,d=t*.125+i*.375+a*.375+o*.125,c=Math.abs(l-e),u=Math.abs(d-t);return[l,d,c,u]}function Tt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Fo({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 Ni({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,l]=Fo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[d,c]=Fo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,f,h,g]=Si({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:d,targetControlY:c});return[`M${e},${t} C${a},${l} ${d},${c} ${o},${r}`,u,f,h,g]}function Ci({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 Cd({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=sn(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 Qt(s,an(i))>0}const Md=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,kd=(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)),Id=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",me.error006()),t;const o=n.getEdgeId||Md;let r;return hi(e)?r={...e}:r={...e,id:o(e)},kd(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Mi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=Ci({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Xo={[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},Yo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function $d({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=Xo[t],l=Xo[o],d={x:e.x+a.x*i,y:e.y+a.y*i},c={x:n.x+l.x*i,y:n.y+l.y*i},u=Ad({source:d,sourcePosition:t,target:c}),f=u.x!==0?"x":"y",h=u[f];let g=[],w,y;const m={x:0,y:0},b={x:0,y:0},[,,p,v]=Ci({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(w=r.x??d.x+(c.x-d.x)*s,y=r.y??(d.y+c.y)/2):(w=r.x??(d.x+c.x)/2,y=r.y??d.y+(c.y-d.y)*s);const I=[{x:w,y:d.y},{x:w,y:c.y}],A=[{x:d.x,y},{x:c.x,y}];a[f]===h?g=f==="x"?I:A:g=f==="x"?A:I}else{const I=[{x:d.x,y:c.y}],A=[{x:c.x,y:d.y}];if(f==="x"?g=a.x===h?A:I:g=a.y===h?I:A,t===o){const x=Math.abs(e[f]-n[f]);if(x<=i){const E=Math.min(i-1,i-x);a[f]===h?m[f]=(d[f]>e[f]?-1:1)*E:b[f]=(c[f]>n[f]?-1:1)*E}}if(t!==o){const x=f==="x"?"y":"x",E=a[f]===l[x],S=d[x]>c[x],k=d[x]<c[x];(a[f]===1&&(!E&&S||E&&k)||a[f]!==1&&(!E&&k||E&&S))&&(g=f==="x"?I:A)}const B={x:d.x+m.x,y:d.y+m.y},z={x:c.x+b.x,y:c.y+b.y},L=Math.max(Math.abs(B.x-g[0].x),Math.abs(z.x-g[0].x)),T=Math.max(Math.abs(B.y-g[0].y),Math.abs(z.y-g[0].y));L>=T?(w=(B.x+z.x)/2,y=g[0].y):(w=g[0].x,y=(B.y+z.y)/2)}const N={x:d.x+m.x,y:d.y+m.y},_={x:c.x+b.x,y:c.y+b.y};return[[e,...N.x!==g[0].x||N.y!==g[0].y?[N]:[],...g,..._.x!==g[g.length-1].x||_.y!==g[g.length-1].y?[_]:[],n],w,y,p,v]}function Pd(e,t,n,o){const r=Math.min(Yo(e,t)/2,Yo(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 d=e.x<n.x?-1:1,c=e.y<n.y?1:-1;return`L ${i+r*d},${s}Q ${i},${s} ${i},${s+r*c}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function Bn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:l,offset:d=20,stepPosition:c=.5}){const[u,f,h,g,w]=$d({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:d,stepPosition:c});let y=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)y+=Pd(u[m-1],u[m],u[m+1],s);return y+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[y,f,h,g,w]}function Zo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Dd(e){const{sourceNode:t,targetNode:n}=e;if(!Zo(t)||!Zo(n))return null;const o=t.internals.handleBounds||Wo(t.handles),r=n.internals.handleBounds||Wo(n.handles),i=qo(o?.source??[],e.sourceHandle),s=qo(e.connectionMode===et.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",me.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||X.Bottom,l=s?.position||X.Top,d=Ze(t,i,a),c=Ze(n,s,l);return{sourceX:d.x,sourceY:d.y,targetX:c.x,targetY:c.y,sourcePosition:a,targetPosition:l}}function Wo(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 Ze(e,t,n=X.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ee(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function qo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function jn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function zd(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const d=jn(l,t);i.has(d)||(s.push({id:d,color:l.color||n,...l}),i.add(d))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const ki=1e3,Td=10,ro={nodeOrigin:[0,0],nodeExtent:xt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Rd={...ro,checkEquality:!0};function io(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Hd(e,t,n){const o=io(ro,n);for(const r of e.values())if(r.parentId)ao(r,e,t,o);else{const i=Ct(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,a=Xe(i,s,Ee(r));r.internals.positionAbsolute=a}}function Ld(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function so(e){return e==="manual"}function Fn(e,t,n,o={}){const r=io(Rd,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!so(r.zIndexMode)?ki:0;let l=e.length>0,d=!1;t.clear(),n.clear();for(const c of e){let u=s.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const f=Ct(c,r.nodeOrigin),h=Ye(c.extent)?c.extent:r.nodeExtent,g=Xe(f,h,Ee(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:Ld(c,u),z:Ii(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&ao(u,t,n,o,i),d||=c.selected??!1}return{nodesInitialized:l,hasSelectedNodes:d}}function Od(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 ao(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=io(ro,o),d=e.parentId,c=t.get(d);if(!c){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Od(e,n),r&&!c.parentId&&c.internals.rootParentIndex===void 0&&l==="auto"&&(c.internals.rootParentIndex=++r.i,c.internals.z=c.internals.z+r.i*Td),r&&c.internals.rootParentIndex!==void 0&&(r.i=c.internals.rootParentIndex);const u=i&&!so(l)?ki:0,{x:f,y:h,z:g}=Vd(e,c,s,a,u,l),{positionAbsolute:w}=e.internals,y=f!==w.x||h!==w.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:f,y:h}:w,z:g}})}function Ii(e,t,n){const o=ge(e.zIndex)?e.zIndex:0;return so(n)?o:o+(e.selected?t:0)}function Vd(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Ee(e),d=Ct(e,n),c=Ye(e.extent)?Xe(d,e.extent,l):d;let u=Xe({x:s+c.x,y:a+c.y},o,l);e.extent==="parent"&&(u=pi(u,l,t));const f=Ii(e,r,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}function co(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??bt(a),d=mi(l,s.rect);i.set(s.parentId,{expandedRect:d,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const d=a.internals.positionAbsolute,c=Ee(a),u=a.origin??o,f=s.x<d.x?Math.round(Math.abs(d.x-s.x)):0,h=s.y<d.y?Math.round(Math.abs(d.y-s.y)):0,g=Math.max(c.width,Math.round(s.width)),w=Math.max(c.height,Math.round(s.height)),y=(g-c.width)*u[0],m=(w-c.height)*u[1];(f>0||h>0||y||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+y,y:a.position.y-h+m}}),n.get(l)?.forEach(b=>{e.some(p=>p.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+f,y:b.position.y+h}})})),(c.width<s.width||c.height<s.height||f||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?u[0]*f-y:0),height:w+(h?u[1]*h-m:0)}})}),r}function Bd(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const d=[],c=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(c.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const w=oo(h.nodeElement),y=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(y||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Ye(g.extent)?g.extent:i;let{positionAbsolute:v}=g.internals;if(g.parentId&&g.extent==="parent"){const _=t.get(g.parentId);_&&(v=pi(v,w,_))}else p&&(v=Xe(v,p,w));const N={...g,measured:w,internals:{...g.internals,positionAbsolute:v,handleBounds:{source:jo("source",h.nodeElement,b,u,g.id),target:jo("target",h.nodeElement,b,u,g.id)}}};t.set(g.id,N),g.parentId&&ao(N,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,y&&(d.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:bt(N,r)}))}}if(f.length>0){const h=co(f,t,n,r);d.push(...h)}return{changes:d,updatedInternals:l}}async function jd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Go(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const d=o.get(s)||new Map;o.set(s,d.set(n,t))}}function Ai(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},d=`${r}-${s}--${i}-${a}`,c=`${i}-${a}--${r}-${s}`;Go("source",l,c,e,r,s),Go("target",l,d,e,i,a),t.set(o.id,o)}}function $i(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:$i(n,t):!1}function Ko(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Fd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!$i(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}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Xd({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=kt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Yd({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,d={x:0,y:0},c=null,u=!1,f=null,h=!1,g=!1,w=null;function y({noDragClassName:b,handleSelector:p,domNode:v,isSelectable:N,nodeId:_,nodeClickDistance:M=0}){f=le(v);function I({x:L,y:T}){const{nodeLookup:x,nodeExtent:E,snapGrid:S,snapToGrid:k,nodeOrigin:D,onNodeDrag:P,onSelectionDrag:V,onError:O,updateNodePositions:H}=t();i={x:L,y:T};let Y=!1;const F=a.size>1,W=F&&E?Vn(Mt(a)):null,Q=F&&k?Xd({dragItems:a,snapGrid:S,x:L,y:T}):null;for(const[q,R]of a){if(!x.has(q))continue;let j={x:L-R.distance.x,y:T-R.distance.y};k&&(j=Q?{x:Math.round(j.x+Q.x),y:Math.round(j.y+Q.y)}:kt(j,S));let U=null;if(F&&E&&!R.extent&&W){const{positionAbsolute:G}=R.internals,J=G.x-W.x+E[0][0],te=G.x+R.measured.width-W.x2+E[1][0],oe=G.y-W.y+E[0][1],ae=G.y+R.measured.height-W.y2+E[1][1];U=[[J,oe],[te,ae]]}const{position:K,positionAbsolute:Z}=gi({nodeId:q,nextPosition:j,nodeLookup:x,nodeExtent:U||E,nodeOrigin:D,onError:O});Y=Y||R.position.x!==K.x||R.position.y!==K.y,R.position=K,R.internals.positionAbsolute=Z}if(g=g||Y,!!Y&&(H(a,!0),w&&(o||P||!_&&V))){const[q,R]=wn({nodeId:_,dragItems:a,nodeLookup:x});o?.(w,a,q,R),P?.(w,q,R),_||V?.(w,R)}}async function A(){if(!c)return;const{transform:L,panBy:T,autoPanSpeed:x,autoPanOnNodeDrag:E}=t();if(!E){l=!1,cancelAnimationFrame(s);return}const[S,k]=to(d,c,x);(S!==0||k!==0)&&(i.x=(i.x??0)-S/L[2],i.y=(i.y??0)-k/L[2],await T({x:S,y:k})&&I(i)),s=requestAnimationFrame(A)}function B(L){const{nodeLookup:T,multiSelectionActive:x,nodesDraggable:E,transform:S,snapGrid:k,snapToGrid:D,selectNodesOnDrag:P,onNodeDragStart:V,onSelectionDragStart:O,unselectNodesAndEdges:H}=t();u=!0,(!P||!N)&&!x&&_&&(T.get(_)?.selected||H()),N&&P&&_&&e?.(_);const Y=ht(L.sourceEvent,{transform:S,snapGrid:k,snapToGrid:D,containerBounds:c});if(i=Y,a=Fd(T,E,Y,_),a.size>0&&(n||V||!_&&O)){const[F,W]=wn({nodeId:_,dragItems:a,nodeLookup:T});n?.(L.sourceEvent,a,F,W),V?.(L.sourceEvent,F,W),_||O?.(L.sourceEvent,W)}}const z=Wr().clickDistance(M).on("start",L=>{const{domNode:T,nodeDragThreshold:x,transform:E,snapGrid:S,snapToGrid:k}=t();c=T?.getBoundingClientRect()||null,h=!1,g=!1,w=L.sourceEvent,x===0&&B(L),i=ht(L.sourceEvent,{transform:E,snapGrid:S,snapToGrid:k,containerBounds:c}),d=pe(L.sourceEvent,c)}).on("drag",L=>{const{autoPanOnNodeDrag:T,transform:x,snapGrid:E,snapToGrid:S,nodeDragThreshold:k,nodeLookup:D}=t(),P=ht(L.sourceEvent,{transform:x,snapGrid:E,snapToGrid:S,containerBounds:c});if(w=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||_&&!D.has(_))&&(h=!0),!h){if(!l&&T&&u&&(l=!0,A()),!u){const V=pe(L.sourceEvent,c),O=V.x-d.x,H=V.y-d.y;Math.sqrt(O*O+H*H)>k&&B(L)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&a&&u&&(d=pe(L.sourceEvent,c),I(P))}}).on("end",L=>{if(!u||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(l=!1,u=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:T,updateNodePositions:x,onNodeDragStop:E,onSelectionDragStop:S}=t();if(g&&(x(a,!1),g=!1),r||E||!_&&S){const[k,D]=wn({nodeId:_,dragItems:a,nodeLookup:T,dragging:!1});r?.(L.sourceEvent,a,k,D),E?.(L.sourceEvent,k,D),_||S?.(L.sourceEvent,D)}}}).filter(L=>{const T=L.target;return!L.button&&(!b||!Ko(T,`.${b}`,v))&&(!p||Ko(T,p,v))});f.call(z)}function m(){f?.on(".drag",null)}return{update:y,destroy:m}}function Zd(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())Qt(r,bt(i))>0&&o.push(i);return o}const Wd=250;function qd(e,t,n,o){let r=[],i=1/0;const s=Zd(e,n,t+Wd);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const d of l){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:c,y:u}=Ze(a,d,d.position,!0),f=Math.sqrt(Math.pow(c-e.x,2)+Math.pow(u-e.y,2));f>t||(f<i?(r=[{...d,x:c,y:u}],i=f):f===i&&r.push({...d,x:c,y:u}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function Pi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(d=>d.id===n):a?.[0])??null;return l&&i?{...l,...Ze(s,l,l.position,!0)}:l}function Di(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Gd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const zi=()=>!0;function Kd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:d,autoPanOnConnect:c,flowId:u,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:w,onConnectEnd:y,isValidConnection:m=zi,onReconnectEnd:b,updateConnection:p,getTransform:v,getFromHandle:N,autoPanSpeed:_,dragThreshold:M=1,handleDomNode:I}){const A=bi(e.target);let B=0,z;const{x:L,y:T}=pe(e),x=Di(i,I),E=a?.getBoundingClientRect();let S=!1;if(!E||!x)return;const k=Pi(r,x,o,l,t);if(!k)return;let D=pe(e,E),P=!1,V=null,O=!1,H=null;function Y(){if(!c||!E)return;const[K,Z]=to(D,E,_);f({x:K,y:Z}),B=requestAnimationFrame(Y)}const F={...k,nodeId:r,type:x,position:k.position},W=l.get(r);let q={inProgress:!0,isValid:null,from:Ze(W,F,X.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:W,to:D,toHandle:null,toPosition:Lo[F.position],toNode:null,pointer:D};function R(){S=!0,p(q),g?.(e,{nodeId:r,handleId:o,handleType:x})}M===0&&R();function j(K){if(!S){const{x:ae,y:Se}=pe(K),xe=ae-L,we=Se-T;if(!(xe*xe+we*we>M*M))return;R()}if(!N()||!F){U(K);return}const Z=v();D=pe(K,E),z=qd(It(D,Z,!1,[1,1]),n,l,F),P||(Y(),P=!0);const G=Ti(K,{handle:z,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:A,lib:d,flowId:u,nodeLookup:l});H=G.handleDomNode,V=G.connection,O=Gd(!!z,G.isValid);const J=l.get(r),te=J?Ze(J,F,X.Left,!0):q.from,oe={...q,from:te,isValid:O,to:G.toHandle&&O?nt({x:G.toHandle.x,y:G.toHandle.y},Z):D,toHandle:G.toHandle,toPosition:O&&G.toHandle?G.toHandle.position:Lo[F.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:D};p(oe),q=oe}function U(K){if(!("touches"in K&&K.touches.length>0)){if(S){(z||H)&&V&&O&&w?.(V);const{inProgress:Z,...G}=q,J={...G,toPosition:q.toHandle?q.toPosition:null};y?.(K,J),i&&b?.(K,J)}h(),cancelAnimationFrame(B),P=!1,O=!1,V=null,H=null,A.removeEventListener("mousemove",j),A.removeEventListener("mouseup",U),A.removeEventListener("touchmove",j),A.removeEventListener("touchend",U)}}A.addEventListener("mousemove",j),A.addEventListener("mouseup",U),A.addEventListener("touchmove",j),A.addEventListener("touchend",U)}function Ti(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:d=zi,nodeLookup:c}){const u=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=pe(e),w=s.elementFromPoint(h,g),y=w?.classList.contains(`${a}-flow__handle`)?w:f,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const b=Di(void 0,y),p=y.getAttribute("data-nodeid"),v=y.getAttribute("data-handleid"),N=y.classList.contains("connectable"),_=y.classList.contains("connectableend");if(!p||!b)return m;const M={source:u?p:o,sourceHandle:u?v:r,target:u?o:p,targetHandle:u?r:v};m.connection=M;const A=N&&_&&(n===et.Strict?u&&b==="source"||!u&&b==="target":p!==o||v!==r);m.isValid=A&&d(M),m.toHandle=Pi(p,b,v,c,n,!0)}return m}const Xn={onPointerDown:Kd,isValid:Ti};function Ud({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:a,width:l,height:d,zoomStep:c=1,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const v=n(),N=p.sourceEvent.ctrlKey&&_t()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*c,M=v[2]*Math.pow(2,_*N);t.scaleTo(M)};let w=[0,0];const y=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(w=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const v=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[N[0]-w[0],N[1]-w[1]];w=N;const M=o()*Math.max(v[2],Math.log(v[2]))*(h?-1:1),I={x:v[0]-_[0]*M,y:v[1]-_[1]*M},A=[[0,0],[l,d]];t.setViewportConstrained({x:I.x,y:I.y,zoom:v[2]},A,a)},b=ci().on("start",y).on("zoom",u?m:null).on("zoom.wheel",f?g:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const cn=e=>({x:e.x,y:e.y,zoom:e.k}),vn=({x:e,y:t,zoom:n})=>rn.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),Ri=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Qd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,bn=(e,t=0,n=Qd,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Hi=e=>{const t=e.ctrlKey&&_t()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Jd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:d}){return c=>{if(qe(c,t))return c.ctrlKey&&c.preventDefault(),!1;c.preventDefault(),c.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(c.ctrlKey&&s){const y=fe(c),m=Hi(c),b=u*Math.pow(2,m);o.scaleTo(n,b,y,c);return}const f=c.deltaMode===1?20:1;let h=r===Be.Vertical?0:c.deltaX*f,g=r===Be.Horizontal?0:c.deltaY*f;!_t()&&c.shiftKey&&r!==Be.Vertical&&(h=c.deltaY*f,g=0),o.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const w=cn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(c,w):(e.isPanScrolling=!0,a?.(c,w)),e.panScrollTimeout=setTimeout(()=>{d?.(c,w),e.isPanScrolling=!1},150)}}function ef({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=qe(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function tf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=cn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function nf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Ri(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,cn(i.transform))}}function of({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Ri(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=cn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function rf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:d,connectionInProgress:c}){return u=>{const f=e||t,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(qe(u,`${d}-flow__node`)||qe(u,`${d}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||c&&!g||qe(u,a)&&g||qe(u,l)&&(!g||r&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!f&&!r&&!h&&g||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&w}}function sf({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},c=e.getBoundingClientRect();let u=[[0,0],[c.width,c.height]];(typeof ResizeObserver<"u"?new ResizeObserver(T=>{const x=T[0];x&&(u=[[0,0],[x.contentRect.width,x.contentRect.height]])}):null)?.observe(e);const h=ci().extent(()=>u).scaleExtent([t,n]).translateExtent(o),g=le(e).call(h);v({x:r.x,y:r.y,zoom:tt(r.zoom,t,n)},[[0,0],[c.width,c.height]],o);const w=g.on("wheel.zoom"),y=g.on("dblclick.zoom");h.wheelDelta(Hi);async function m(T,x){return g?new Promise(E=>{h?.interpolate(x?.interpolate==="linear"?ft:Vt).transform(bn(g,x?.duration,x?.ease,()=>E(!0)),T)}):!1}function b({noWheelClassName:T,noPanClassName:x,onPaneContextMenu:E,userSelectionActive:S,panOnScroll:k,panOnDrag:D,panOnScrollMode:P,panOnScrollSpeed:V,preventScrolling:O,zoomOnPinch:H,zoomOnScroll:Y,zoomOnDoubleClick:F,zoomActivationKeyPressed:W,lib:Q,onTransformChange:q,connectionInProgress:R,paneClickDistance:j,selectionOnDrag:U}){S&&!d.isZoomingOrPanning&&p();const K=k&&!W&&!S;h.clickDistance(U?1/0:!ge(j)||j<0?0:j);const Z=K?Jd({zoomPanValues:d,noWheelClassName:T,d3Selection:g,d3Zoom:h,panOnScrollMode:P,panOnScrollSpeed:V,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):ef({noWheelClassName:T,preventScrolling:O,d3ZoomHandler:w});g.on("wheel.zoom",Z,{passive:!1});const G=tf({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:s});h.on("start",G);const J=nf({zoomPanValues:d,panOnDrag:D,onPaneContextMenu:!!E,onPanZoom:i,onTransformChange:q});h.on("zoom",J);const te=of({zoomPanValues:d,panOnDrag:D,panOnScroll:k,onPaneContextMenu:E,onPanZoomEnd:a,onDraggingChange:l});h.on("end",te);const oe=rf({zoomActivationKeyPressed:W,panOnDrag:D,zoomOnScroll:Y,panOnScroll:k,zoomOnDoubleClick:F,zoomOnPinch:H,userSelectionActive:S,noPanClassName:x,noWheelClassName:T,lib:Q,connectionInProgress:R});h.filter(oe),F?g.on("dblclick.zoom",y):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function v(T,x,E){const S=vn(T),k=h?.constrain()(S,x,E);return k&&await m(k),k}async function N(T,x){const E=vn(T);return await m(E,x),E}function _(T){if(g){const x=vn(T),E=g.property("__zoom");(E.k!==T.zoom||E.x!==T.x||E.y!==T.y)&&h?.transform(g,x,null,{sync:!0})}}function M(){const T=g?ai(g.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}async function I(T,x){return g?new Promise(E=>{h?.interpolate(x?.interpolate==="linear"?ft:Vt).scaleTo(bn(g,x?.duration,x?.ease,()=>E(!0)),T)}):!1}async function A(T,x){return g?new Promise(E=>{h?.interpolate(x?.interpolate==="linear"?ft:Vt).scaleBy(bn(g,x?.duration,x?.ease,()=>E(!0)),T)}):!1}function B(T){h?.scaleExtent(T)}function z(T){h?.translateExtent(T)}function L(T){const x=!ge(T)||T<0?0:T;h?.clickDistance(x)}return{update:b,destroy:p,setViewport:N,setViewportConstrained:v,getViewport:M,scaleTo:I,scaleBy:A,setScaleExtent:B,setTranslateExtent:z,syncViewport:_,setClickDistance:L}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function af({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Uo(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 Pe(e,t){return Math.max(0,t-e)}function De(e,t){return Math.max(0,e-t)}function Rt(e,t,n){return Math.max(0,t-e,e-n)}function Qo(e,t){return e?!t:t}function cf(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:d}=t;const{isHorizontal:c,isVertical:u}=t,f=c&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:w,maxWidth:y,minHeight:m,maxHeight:b}=o,{x:p,y:v,width:N,height:_,aspectRatio:M}=e;let I=Math.floor(c?h-e.pointerX:0),A=Math.floor(u?g-e.pointerY:0);const B=N+(l?-I:I),z=_+(d?-A:A),L=-i[0]*N,T=-i[1]*_;let x=Rt(B,w,y),E=Rt(z,m,b);if(s){let D=0,P=0;l&&I<0?D=Pe(p+I+L,s[0][0]):!l&&I>0&&(D=De(p+B+L,s[1][0])),d&&A<0?P=Pe(v+A+T,s[0][1]):!d&&A>0&&(P=De(v+z+T,s[1][1])),x=Math.max(x,D),E=Math.max(E,P)}if(a){let D=0,P=0;l&&I>0?D=De(p+I,a[0][0]):!l&&I<0&&(D=Pe(p+B,a[1][0])),d&&A>0?P=De(v+A,a[0][1]):!d&&A<0&&(P=Pe(v+z,a[1][1])),x=Math.max(x,D),E=Math.max(E,P)}if(r){if(c){const D=Rt(B/M,m,b)*M;if(x=Math.max(x,D),s){let P=0;!l&&!d||l&&!d&&f?P=De(v+T+B/M,s[1][1])*M:P=Pe(v+T+(l?I:-I)/M,s[0][1])*M,x=Math.max(x,P)}if(a){let P=0;!l&&!d||l&&!d&&f?P=Pe(v+B/M,a[1][1])*M:P=De(v+(l?I:-I)/M,a[0][1])*M,x=Math.max(x,P)}}if(u){const D=Rt(z*M,w,y)/M;if(E=Math.max(E,D),s){let P=0;!l&&!d||d&&!l&&f?P=De(p+z*M+L,s[1][0])/M:P=Pe(p+(d?A:-A)*M+L,s[0][0])/M,E=Math.max(E,P)}if(a){let P=0;!l&&!d||d&&!l&&f?P=Pe(p+z*M,a[1][0])/M:P=De(p+(d?A:-A)*M,a[0][0])/M,E=Math.max(E,P)}}}A=A+(A<0?E:-E),I=I+(I<0?x:-x),r&&(f?B>z*M?A=(Qo(l,d)?-I:I)/M:I=(Qo(l,d)?-A:A)*M:c?(A=I/M,d=l):(I=A*M,l=d));const S=l?p+I:p,k=d?v+A:v;return{width:N+(l?-I:I),height:_+(d?-A:A),x:i[0]*I*(l?-1:1)+S,y:i[1]*A*(d?-1:1)+k}}const Li={width:0,height:0,x:0,y:0},lf={...Li,pointerX:0,pointerY:0,aspectRatio:1};function uf(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function df({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:Uo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:d,boundaries:c,keepAspectRatio:u,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:w,shouldResize:y}){let m={...Li},b={...lf};s={boundaries:c,resizeDirection:f,keepAspectRatio:u,controlDirection:Uo(d)};let p,v=null,N=[],_,M,I,A=!1;const B=Wr().on("start",z=>{const{nodeLookup:L,transform:T,snapGrid:x,snapToGrid:E,nodeOrigin:S,paneDomNode:k}=n();if(p=L.get(t),!p)return;v=k?.getBoundingClientRect()??null;const{xSnapped:D,ySnapped:P}=ht(z.sourceEvent,{transform:T,snapGrid:x,snapToGrid:E,containerBounds:v});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...m,pointerX:D,pointerY:P,aspectRatio:m.width/m.height},_=void 0,M=Ye(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=L.get(p.parentId)),_&&p.extent==="parent"&&(M=[[0,0],[_.measured.width,_.measured.height]]),N=[],I=void 0;for(const[V,O]of L)if(O.parentId===t&&(N.push({id:V,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const H=uf(O,p,O.origin??S);I?I=[[Math.min(H[0][0],I[0][0]),Math.min(H[0][1],I[0][1])],[Math.max(H[1][0],I[1][0]),Math.max(H[1][1],I[1][1])]]:I=H}h?.(z,{...m})}).on("drag",z=>{const{transform:L,snapGrid:T,snapToGrid:x,nodeOrigin:E}=n(),S=ht(z.sourceEvent,{transform:L,snapGrid:T,snapToGrid:x,containerBounds:v}),k=[];if(!p)return;const{x:D,y:P,width:V,height:O}=m,H={},Y=p.origin??E,{width:F,height:W,x:Q,y:q}=cf(b,s.controlDirection,S,s.boundaries,s.keepAspectRatio,Y,M,I),R=F!==V,j=W!==O,U=Q!==D&&R,K=q!==P&&j;if(!U&&!K&&!R&&!j)return;if((U||K||Y[0]===1||Y[1]===1)&&(H.x=U?Q:m.x,H.y=K?q:m.y,m.x=H.x,m.y=H.y,N.length>0)){const te=Q-D,oe=q-P;for(const ae of N)ae.position={x:ae.position.x-te+Y[0]*(F-V),y:ae.position.y-oe+Y[1]*(W-O)},k.push(ae)}if((R||j)&&(H.width=R&&(!s.resizeDirection||s.resizeDirection==="horizontal")?F:m.width,H.height=j&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=H.width,m.height=H.height),_&&p.expandParent){const te=Y[0]*(H.width??0);H.x&&H.x<te&&(m.x=te,b.x=b.x-(H.x-te));const oe=Y[1]*(H.height??0);H.y&&H.y<oe&&(m.y=oe,b.y=b.y-(H.y-oe))}const Z=af({width:m.width,prevWidth:V,height:m.height,prevHeight:O,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:Z};y?.(z,G)!==!1&&(A=!0,g?.(z,G),o(H,k))}).on("end",z=>{A&&(w?.(z,{...m}),r?.({...m}),A=!1)});i.call(B)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var _n={exports:{}},En={},Sn={exports:{}},Nn={};var Jo;function ff(){if(Jo)return Nn;Jo=1;var e=Pr();function t(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(u,f){var h=f(),g=o({inst:{value:h,getSnapshot:f}}),w=g[0].inst,y=g[1];return i(function(){w.value=h,w.getSnapshot=f,l(w)&&y({inst:w})},[u,h,f]),r(function(){return l(w)&&y({inst:w}),u(function(){l(w)&&y({inst:w})})},[u]),s(h),h}function l(u){var f=u.getSnapshot;u=u.value;try{var h=f();return!n(u,h)}catch{return!0}}function d(u,f){return f()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Nn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:c,Nn}var er;function hf(){return er||(er=1,Sn.exports=ff()),Sn.exports}var tr;function gf(){if(tr)return En;tr=1;var e=Pr(),t=hf();function n(d,c){return d===c&&(d!==0||1/d===1/c)||d!==d&&c!==c}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return En.useSyncExternalStoreWithSelector=function(d,c,u,f,h){var g=i(null);if(g.current===null){var w={hasValue:!1,value:null};g.current=w}else w=g.current;g=a(function(){function m(_){if(!b){if(b=!0,p=_,_=f(_),h!==void 0&&w.hasValue){var M=w.value;if(h(M,_))return v=M}return v=_}if(M=v,o(p,_))return M;var I=f(_);return h!==void 0&&h(M,I)?(p=_,M):(p=_,v=I)}var b=!1,p,v,N=u===void 0?null:u;return[function(){return m(c())},N===null?void 0:function(){return m(N())}]},[c,u,f,h]);var y=r(d,g[0],g[1]);return s(function(){w.hasValue=!0,w.value=y},[y]),l(y),y},En}var nr;function pf(){return nr||(nr=1,_n.exports=gf()),_n.exports}var mf=pf();const yf=Ca(mf),xf={},or=e=>{let t;const n=new Set,o=(c,u)=>{const f=typeof c=="function"?c(t):c;if(!Object.is(f,t)){const h=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>d,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(xf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(o,r,l);return l},wf=e=>e?or(e):or,{useDebugValue:vf}=Ma,{useSyncExternalStoreWithSelector:bf}=yf,_f=e=>e;function Oi(e,t=_f,n){const o=bf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return vf(o),o}const rr=(e,t)=>{const n=wf(e),o=(r,i=t)=>Oi(n,r,i);return Object.assign(o,n),o},Ef=(e,t)=>e?rr(e,t):rr;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 ln=$.createContext(null),Sf=ln.Provider,Vi=me.error001("react");function ee(e,t){const n=$.useContext(ln);if(n===null)throw new Error(Vi);return Oi(n,e,t)}function ne(){const e=$.useContext(ln);if(e===null)throw new Error(Vi);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ir={display:"none"},Nf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Bi="react-flow__node-desc",ji="react-flow__edge-desc",Cf="react-flow__aria-live",Mf=e=>e.ariaLiveMessage,kf=e=>e.ariaLabelConfig;function If({rfId:e}){const t=ee(Mf);return C.jsx("div",{id:`${Cf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Nf,children:t})}function Af({rfId:e,disableKeyboardA11y:t}){const n=ee(kf);return C.jsxs(C.Fragment,{children:[C.jsx("div",{id:`${Bi}-${e}`,style:ir,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),C.jsx("div",{id:`${ji}-${e}`,style:ir,children:n["edge.a11yDescription.default"]}),!t&&C.jsx(If,{rfId:e})]})}const rt=$.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return C.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});rt.displayName="Panel";const sr="https://reactflow.dev?utm_source=attribution";function $f({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:C.jsx(rt,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${sr}`,children:C.jsx("a",{href:sr,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Pf=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}},Ht=e=>e.id;function Df(e,t){return re(e.selectedNodes.map(Ht),t.selectedNodes.map(Ht))&&re(e.selectedEdges.map(Ht),t.selectedEdges.map(Ht))}function zf({onSelectionChange:e}){const t=ne(),{selectedNodes:n,selectedEdges:o}=ee(Pf,Df);return $.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Tf=e=>!!e.onSelectionChangeHandlers;function Rf({onSelectionChange:e}){const t=ee(Tf);return e||t?C.jsx(zf,{onSelectionChange:e}):null}const Fi=[0,0],Hf={x:0,y:0,zoom:1},Lf=["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"],ar=[...Lf,"rfId"],Of=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}),cr={translateExtent:xt,nodeOrigin:Fi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Vf(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=ee(Of,re),d=ne();$.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{c.current=cr,a()}),[]);const c=$.useRef(cr);return $.useEffect(()=>{for(const u of ar){const f=e[u],h=c.current[u];f!==h&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?o(f):u==="maxZoom"?r(f):u==="translateExtent"?i(f):u==="nodeExtent"?s(f):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:Ed(f)}):u==="fitView"?d.setState({fitViewQueued:f}):u==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[u]:f})))}c.current=e},ar.map(u=>e[u])),null}function lr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Bf(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const o=lr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:lr()?.matches?"dark":"light"}const ur=typeof document<"u"?document:null;function Et(e=null,t={target:ur,actInsideInputWithModifier:!0}){const[n,o]=$.useState(!1),r=$.useRef(!1),i=$.useRef(new Set([])),[s,a]=$.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
1
+ import{g as Na,l as Pr,i as Ca,R as Ma,r as $,j as C,u as ka,f as lt,e as Ia,T as Aa,F as vo,c as $a,b as Pa}from"./index-BqrfDMMa.js";const Da=[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]],za=Na("pin",Da);function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ta={value:()=>{}};function en(){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 Ot(n)}function Ot(e){this._=e}function Ra(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}})}Ot.prototype=en.prototype={constructor:Ot,on:function(e,t){var n=this._,o=Ra(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]=bo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=bo(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 Ot(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 bo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Ta,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Pn="http://www.w3.org/1999/xhtml";const _o={svg:"http://www.w3.org/2000/svg",xhtml:Pn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function tn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),_o.hasOwnProperty(t)?{space:_o[t],local:e}:e}function La(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Pn&&t.documentElement.namespaceURI===Pn?t.createElement(e):t.createElementNS(n,e)}}function Oa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Dr(e){var t=tn(e);return(t.local?Oa:La)(t)}function Va(){}function Zn(e){return e==null?Va:function(){return this.querySelector(e)}}function Ba(e){typeof e!="function"&&(e=Zn(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),l,d,c=0;c<s;++c)(l=i[c])&&(d=e.call(l,l.__data__,c,i))&&("__data__"in l&&(d.__data__=l.__data__),a[c]=d);return new ue(o,this._parents)}function ja(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Fa(){return[]}function zr(e){return e==null?Fa:function(){return this.querySelectorAll(e)}}function Xa(e){return function(){return ja(e.apply(this,arguments))}}function Ya(e){typeof e=="function"?e=Xa(e):e=zr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,d=0;d<a;++d)(l=s[d])&&(o.push(e.call(l,l.__data__,d,s)),r.push(l));return new ue(o,r)}function Tr(e){return function(){return this.matches(e)}}function Rr(e){return function(t){return t.matches(e)}}var Za=Array.prototype.find;function Wa(e){return function(){return Za.call(this.children,e)}}function qa(){return this.firstElementChild}function Ga(e){return this.select(e==null?qa:Wa(typeof e=="function"?e:Rr(e)))}var Ka=Array.prototype.filter;function Ua(){return Array.from(this.children)}function Qa(e){return function(){return Ka.call(this.children,e)}}function Ja(e){return this.selectAll(e==null?Ua:Qa(typeof e=="function"?e:Rr(e)))}function ec(e){typeof e!="function"&&(e=Tr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,d=0;d<s;++d)(l=i[d])&&e.call(l,l.__data__,d,i)&&a.push(l);return new ue(o,this._parents)}function Hr(e){return new Array(e.length)}function tc(){return new ue(this._enter||this._groups.map(Hr),this._parents)}function Xt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Xt.prototype={constructor:Xt,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 nc(e){return function(){return e}}function oc(e,t,n,o,r,i){for(var s=0,a,l=t.length,d=i.length;s<d;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Xt(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function rc(e,t,n,o,r,i,s){var a,l,d=new Map,c=t.length,u=i.length,f=new Array(c),h;for(a=0;a<c;++a)(l=t[a])&&(f[a]=h=s.call(l,l.__data__,a,t)+"",d.has(h)?r[a]=l:d.set(h,l));for(a=0;a<u;++a)h=s.call(e,i[a],a,i)+"",(l=d.get(h))?(o[a]=l,l.__data__=i[a],d.delete(h)):n[a]=new Xt(e,i[a]);for(a=0;a<c;++a)(l=t[a])&&d.get(f[a])===l&&(r[a]=l)}function ic(e){return e.__data__}function sc(e,t){if(!arguments.length)return Array.from(this,ic);var n=t?rc:oc,o=this._parents,r=this._groups;typeof e!="function"&&(e=nc(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),d=0;d<i;++d){var c=o[d],u=r[d],f=u.length,h=ac(e.call(c,c&&c.__data__,d,o)),g=h.length,w=a[d]=new Array(g),y=s[d]=new Array(g),m=l[d]=new Array(f);n(c,u,w,y,m,h,t);for(var b=0,p=0,v,N;b<g;++b)if(v=w[b]){for(b>=p&&(p=b+1);!(N=y[p])&&++p<g;);v._next=N||null}}return s=new ue(s,o),s._enter=a,s._exit=l,s}function ac(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function cc(){return new ue(this._exit||this._groups.map(Hr),this._parents)}function lc(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 uc(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var d=n[l],c=o[l],u=d.length,f=a[l]=new Array(u),h,g=0;g<u;++g)(h=d[g]||c[g])&&(f[g]=h);for(;l<r;++l)a[l]=n[l];return new ue(a,this._parents)}function dc(){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 fc(e){e||(e=hc);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,l=r[i]=new Array(a),d,c=0;c<a;++c)(d=s[c])&&(l[c]=d);l.sort(t)}return new ue(r,this._parents).order()}function hc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function gc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function pc(){return Array.from(this)}function mc(){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 yc(){let e=0;for(const t of this)++e;return e}function xc(){return!this.node()}function wc(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 vc(e){return function(){this.removeAttribute(e)}}function bc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _c(e,t){return function(){this.setAttribute(e,t)}}function Ec(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Sc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Nc(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 Cc(e,t){var n=tn(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?bc:vc:typeof t=="function"?n.local?Nc:Sc:n.local?Ec:_c)(n,t))}function Lr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Mc(e){return function(){this.style.removeProperty(e)}}function kc(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 Ac(e,t,n){return arguments.length>1?this.each((t==null?Mc:typeof t=="function"?Ic:kc)(e,t,n??"")):Qe(this.node(),e)}function Qe(e,t){return e.style.getPropertyValue(t)||Lr(e).getComputedStyle(e,null).getPropertyValue(t)}function $c(e){return function(){delete this[e]}}function Pc(e,t){return function(){this[e]=t}}function Dc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function zc(e,t){return arguments.length>1?this.each((t==null?$c:typeof t=="function"?Dc:Pc)(e,t)):this.node()[e]}function Or(e){return e.trim().split(/^|\s+/)}function Wn(e){return e.classList||new Vr(e)}function Vr(e){this._node=e,this._names=Or(e.getAttribute("class")||"")}Vr.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 Br(e,t){for(var n=Wn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function jr(e,t){for(var n=Wn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Tc(e){return function(){Br(this,e)}}function Rc(e){return function(){jr(this,e)}}function Hc(e,t){return function(){(t.apply(this,arguments)?Br:jr)(this,e)}}function Lc(e,t){var n=Or(e+"");if(arguments.length<2){for(var o=Wn(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?Tc:Rc)(n,t))}function Oc(){this.textContent=""}function Vc(e){return function(){this.textContent=e}}function Bc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function jc(e){return arguments.length?this.each(e==null?Oc:(typeof e=="function"?Bc:Vc)(e)):this.node().textContent}function Fc(){this.innerHTML=""}function Xc(e){return function(){this.innerHTML=e}}function Yc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Zc(e){return arguments.length?this.each(e==null?Fc:(typeof e=="function"?Yc:Xc)(e)):this.node().innerHTML}function Wc(){this.nextSibling&&this.parentNode.appendChild(this)}function qc(){return this.each(Wc)}function Gc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Kc(){return this.each(Gc)}function Uc(e){var t=typeof e=="function"?e:Dr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Qc(){return null}function Jc(e,t){var n=typeof e=="function"?e:Dr(e),o=t==null?Qc:typeof t=="function"?t:Zn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function el(){var e=this.parentNode;e&&e.removeChild(this)}function tl(){return this.each(el)}function nl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ol(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rl(e){return this.select(e?ol:nl)}function il(e){return arguments.length?this.property("__data__",e):this.node().__data__}function sl(e){return function(t){e.call(this,t,this.__data__)}}function al(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 cl(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 ll(e,t,n){return function(){var o=this.__on,r,i=sl(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 ul(e,t,n){var o=al(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,d=a.length,c;l<d;++l)for(r=0,c=a[l];r<i;++r)if((s=o[r]).type===c.type&&s.name===c.name)return c.value}return}for(a=t?ll:cl,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Fr(e,t,n){var o=Lr(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 dl(e,t){return function(){return Fr(this,e,t)}}function fl(e,t){return function(){return Fr(this,e,t.apply(this,arguments))}}function hl(e,t){return this.each((typeof t=="function"?fl:dl)(e,t))}function*gl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var Xr=[null];function ue(e,t){this._groups=e,this._parents=t}function St(){return new ue([[document.documentElement]],Xr)}function pl(){return this}ue.prototype=St.prototype={constructor:ue,select:Ba,selectAll:Ya,selectChild:Ga,selectChildren:Ja,filter:ec,data:sc,enter:tc,exit:cc,join:lc,merge:uc,selection:pl,order:dc,sort:fc,call:gc,nodes:pc,node:mc,size:yc,empty:xc,each:wc,attr:Cc,style:Ac,property:zc,classed:Lc,text:jc,html:Zc,raise:qc,lower:Kc,append:Uc,insert:Jc,remove:tl,clone:rl,datum:il,on:ul,dispatch:hl,[Symbol.iterator]:gl};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Xr)}function ml(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=ml(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 yl={passive:!1},gt={capture:!0,passive:!1};function pn(e){e.stopImmediatePropagation()}function Ke(e){e.preventDefault(),e.stopImmediatePropagation()}function Yr(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Ke,gt);"onselectstart"in t?n.on("selectstart.drag",Ke,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Zr(e,t){var n=e.document.documentElement,o=le(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ke,gt),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 At=e=>()=>e;function Dn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:d,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:c}})}Dn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function xl(e){return!e.ctrlKey&&!e.button}function wl(){return this.parentNode}function vl(e,t){return t??{x:e.x,y:e.y}}function bl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wr(){var e=xl,t=wl,n=vl,o=bl,r={},i=en("start","drag","end"),s=0,a,l,d,c,u=0;function f(v){v.on("mousedown.drag",h).filter(o).on("touchstart.drag",y).on("touchmove.drag",m,yl).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(v,N){if(!(c||!e.call(this,v,N))){var _=p(this,t.call(this,v,N),v,N,"mouse");_&&(le(v.view).on("mousemove.drag",g,gt).on("mouseup.drag",w,gt),Yr(v.view),pn(v),d=!1,a=v.clientX,l=v.clientY,_("start",v))}}function g(v){if(Ke(v),!d){var N=v.clientX-a,_=v.clientY-l;d=N*N+_*_>u}r.mouse("drag",v)}function w(v){le(v.view).on("mousemove.drag mouseup.drag",null),Zr(v.view,d),Ke(v),r.mouse("end",v)}function y(v,N){if(e.call(this,v,N)){var _=v.changedTouches,M=t.call(this,v,N),I=_.length,A,B;for(A=0;A<I;++A)(B=p(this,M,v,N,_[A].identifier,_[A]))&&(pn(v),B("start",v,_[A]))}}function m(v){var N=v.changedTouches,_=N.length,M,I;for(M=0;M<_;++M)(I=r[N[M].identifier])&&(Ke(v),I("drag",v,N[M]))}function b(v){var N=v.changedTouches,_=N.length,M,I;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),M=0;M<_;++M)(I=r[N[M].identifier])&&(pn(v),I("end",v,N[M]))}function p(v,N,_,M,I,A){var B=i.copy(),z=fe(A||_,N),L,T,x;if((x=n.call(v,new Dn("beforestart",{sourceEvent:_,target:f,identifier:I,active:s,x:z[0],y:z[1],dx:0,dy:0,dispatch:B}),M))!=null)return L=x.x-z[0]||0,T=x.y-z[1]||0,function E(S,k,D){var P=z,V;switch(S){case"start":r[I]=E,V=s++;break;case"end":delete r[I],--s;case"drag":z=fe(D||k,N),V=s;break}B.call(S,v,new Dn(S,{sourceEvent:k,subject:x,target:f,identifier:I,active:V,x:z[0]+L,y:z[1]+T,dx:z[0]-P[0],dy:z[1]-P[1],dispatch:B}),M)}}return f.filter=function(v){return arguments.length?(e=typeof v=="function"?v:At(!!v),f):e},f.container=function(v){return arguments.length?(t=typeof v=="function"?v:At(v),f):t},f.subject=function(v){return arguments.length?(n=typeof v=="function"?v:At(v),f):n},f.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:At(!!v),f):o},f.on=function(){var v=i.on.apply(i,arguments);return v===i?f:v},f.clickDistance=function(v){return arguments.length?(u=(v=+v)*v,f):Math.sqrt(u)},f}function qn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function qr(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Nt(){}var pt=.7,Yt=1/pt,Ue="\\s*([+-]?\\d+)\\s*",mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_l=/^#([0-9a-f]{3,8})$/,El=new RegExp(`^rgb\\(${Ue},${Ue},${Ue}\\)$`),Sl=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),Nl=new RegExp(`^rgba\\(${Ue},${Ue},${Ue},${mt}\\)$`),Cl=new RegExp(`^rgba\\(${be},${be},${be},${mt}\\)$`),Ml=new RegExp(`^hsl\\(${mt},${be},${be}\\)$`),kl=new RegExp(`^hsla\\(${mt},${be},${be},${mt}\\)$`),Eo={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};qn(Nt,je,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:So,formatHex:So,formatHex8:Il,formatHsl:Al,formatRgb:No,toString:No});function So(){return this.rgb().formatHex()}function Il(){return this.rgb().formatHex8()}function Al(){return Gr(this).formatHsl()}function No(){return this.rgb().formatRgb()}function je(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_l.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Co(t):n===3?new ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$t(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$t(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=El.exec(e))?new ce(t[1],t[2],t[3],1):(t=Sl.exec(e))?new ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Nl.exec(e))?$t(t[1],t[2],t[3],t[4]):(t=Cl.exec(e))?$t(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ml.exec(e))?Io(t[1],t[2]/100,t[3]/100,1):(t=kl.exec(e))?Io(t[1],t[2]/100,t[3]/100,t[4]):Eo.hasOwnProperty(e)?Co(Eo[e]):e==="transparent"?new ce(NaN,NaN,NaN,0):null}function Co(e){return new ce(e>>16&255,e>>8&255,e&255,1)}function $t(e,t,n,o){return o<=0&&(e=t=n=NaN),new ce(e,t,n,o)}function $l(e){return e instanceof Nt||(e=je(e)),e?(e=e.rgb(),new ce(e.r,e.g,e.b,e.opacity)):new ce}function zn(e,t,n,o){return arguments.length===1?$l(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}qn(ce,zn,qr(Nt,{brighter(e){return e=e==null?Yt:Math.pow(Yt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pt:Math.pow(pt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ce(Ve(this.r),Ve(this.g),Ve(this.b),Zt(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:Mo,formatHex:Mo,formatHex8:Pl,formatRgb:ko,toString:ko}));function Mo(){return`#${Oe(this.r)}${Oe(this.g)}${Oe(this.b)}`}function Pl(){return`#${Oe(this.r)}${Oe(this.g)}${Oe(this.b)}${Oe((isNaN(this.opacity)?1:this.opacity)*255)}`}function ko(){const e=Zt(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function Zt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Oe(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function Io(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 Gr(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof Nt||(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,l=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new he(s,a,l,e.opacity)}function Dl(e,t,n,o){return arguments.length===1?Gr(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}qn(he,Dl,qr(Nt,{brighter(e){return e=e==null?Yt:Math.pow(Yt,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pt:Math.pow(pt,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(Ao(this.h),Pt(this.s),Pt(this.l),Zt(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=Zt(this.opacity);return`${e===1?"hsl(":"hsla("}${Ao(this.h)}, ${Pt(this.s)*100}%, ${Pt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ao(e){return e=(e||0)%360,e<0?e+360:e}function Pt(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 Gn=e=>()=>e;function zl(e,t){return function(n){return e+n*t}}function Tl(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 Rl(e){return(e=+e)==1?Kr:function(t,n){return n-t?Tl(t,n,e):Gn(isNaN(t)?n:t)}}function Kr(e,t){var n=t-e;return n?zl(e,n):Gn(isNaN(e)?t:e)}const Wt=(function e(t){var n=Rl(t);function o(r,i){var s=n((r=zn(r)).r,(i=zn(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),d=Kr(r.opacity,i.opacity);return function(c){return r.r=s(c),r.g=a(c),r.b=l(c),r.opacity=d(c),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 Ll(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ol(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]=ft(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 Vl(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function ve(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Bl(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]=ft(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var Tn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,yn=new RegExp(Tn.source,"g");function jl(e){return function(){return e}}function Fl(e){return function(t){return e(t)+""}}function Ur(e,t){var n=Tn.lastIndex=yn.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Tn.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,l.push({i:s,x:ve(o,r)})),n=yn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Fl(l[0].x):jl(t):(t=l.length,function(d){for(var c=0,u;c<t;++c)a[(u=l[c]).i]=u.x(d);return a.join("")})}function ft(e,t){var n=typeof t,o;return t==null||n==="boolean"?Gn(t):(n==="number"?ve:n==="string"?(o=je(t))?(t=o,Wt):Ur:t instanceof je?Wt:t instanceof Date?Vl:Ll(t)?Hl:Array.isArray(t)?Ol:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Bl:ve)(e,t)}var $o=180/Math.PI,Rn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Qr(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*$o,skewX:Math.atan(l)*$o,scaleX:s,scaleY:a}}var Dt;function Xl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rn:Qr(t.a,t.b,t.c,t.d,t.e,t.f)}function Yl(e){return e==null||(Dt||(Dt=document.createElementNS("http://www.w3.org/2000/svg","g")),Dt.setAttribute("transform",e),!(e=Dt.transform.baseVal.consolidate()))?Rn:(e=e.matrix,Qr(e.a,e.b,e.c,e.d,e.e,e.f))}function Jr(e,t,n,o){function r(d){return d.length?d.pop()+" ":""}function i(d,c,u,f,h,g){if(d!==u||c!==f){var w=h.push("translate(",null,t,null,n);g.push({i:w-4,x:ve(d,u)},{i:w-2,x:ve(c,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function s(d,c,u,f){d!==c?(d-c>180?c+=360:c-d>180&&(d+=360),f.push({i:u.push(r(u)+"rotate(",null,o)-2,x:ve(d,c)})):c&&u.push(r(u)+"rotate("+c+o)}function a(d,c,u,f){d!==c?f.push({i:u.push(r(u)+"skewX(",null,o)-2,x:ve(d,c)}):c&&u.push(r(u)+"skewX("+c+o)}function l(d,c,u,f,h,g){if(d!==u||c!==f){var w=h.push(r(h)+"scale(",null,",",null,")");g.push({i:w-4,x:ve(d,u)},{i:w-2,x:ve(c,f)})}else(u!==1||f!==1)&&h.push(r(h)+"scale("+u+","+f+")")}return function(d,c){var u=[],f=[];return d=e(d),c=e(c),i(d.translateX,d.translateY,c.translateX,c.translateY,u,f),s(d.rotate,c.rotate,u,f),a(d.skewX,c.skewX,u,f),l(d.scaleX,d.scaleY,c.scaleX,c.scaleY,u,f),d=c=null,function(h){for(var g=-1,w=f.length,y;++g<w;)u[(y=f[g]).i]=y.x(h);return u.join("")}}}var Zl=Jr(Xl,"px, ","px)","deg)"),Wl=Jr(Yl,", ",")",")"),ql=1e-12;function Po(e){return((e=Math.exp(e))+1/e)/2}function Gl(e){return((e=Math.exp(e))-1/e)/2}function Kl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Vt=(function e(t,n,o){function r(i,s){var a=i[0],l=i[1],d=i[2],c=s[0],u=s[1],f=s[2],h=c-a,g=u-l,w=h*h+g*g,y,m;if(w<ql)m=Math.log(f/d)/t,y=function(M){return[a+M*h,l+M*g,d*Math.exp(t*M*m)]};else{var b=Math.sqrt(w),p=(f*f-d*d+o*w)/(2*d*n*b),v=(f*f-d*d-o*w)/(2*f*n*b),N=Math.log(Math.sqrt(p*p+1)-p),_=Math.log(Math.sqrt(v*v+1)-v);m=(_-N)/t,y=function(M){var I=M*m,A=Po(N),B=d/(n*b)*(A*Kl(t*I+N)-Gl(N));return[a+B*h,l+B*g,d*A/Po(t*I+N)]}}return y.duration=m*1e3*t/Math.SQRT2,y}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r})(Math.SQRT2,2,4);var Je=0,ut=0,at=0,ei=1e3,qt,dt,Gt=0,Fe=0,nn=0,yt=typeof performance=="object"&&performance.now?performance:Date,ti=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kn(){return Fe||(ti(Ul),Fe=yt.now()+nn)}function Ul(){Fe=0}function Kt(){this._call=this._time=this._next=null}Kt.prototype=ni.prototype={constructor:Kt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Kn():+n)+(t==null?0:+t),!this._next&&dt!==this&&(dt?dt._next=this:qt=this,dt=this),this._call=e,this._time=n,Hn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Hn())}};function ni(e,t,n){var o=new Kt;return o.restart(e,t,n),o}function Ql(){Kn(),++Je;for(var e=qt,t;e;)(t=Fe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Je}function Do(){Fe=(Gt=yt.now())+nn,Je=ut=0;try{Ql()}finally{Je=0,eu(),Fe=0}}function Jl(){var e=yt.now(),t=e-Gt;t>ei&&(nn-=t,Gt=e)}function eu(){for(var e,t=qt,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:qt=n);dt=e,Hn(o)}function Hn(e){if(!Je){ut&&(ut=clearTimeout(ut));var t=e-Fe;t>24?(e<1/0&&(ut=setTimeout(Do,e-yt.now()-nn)),at&&(at=clearInterval(at))):(at||(Gt=yt.now(),at=setInterval(Jl,ei)),Je=1,ti(Do))}}function zo(e,t,n){var o=new Kt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var tu=en("start","end","cancel","interrupt"),nu=[],oi=0,To=1,Ln=2,Bt=3,Ro=4,On=5,jt=6;function on(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;ou(e,n,{name:t,index:o,group:r,on:tu,tween:nu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:oi})}function Un(e,t){var n=ye(e,t);if(n.state>oi)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=ye(e,t);if(n.state>Bt)throw new Error("too late; already running");return n}function ye(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ou(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=ni(i,0,n.time);function i(d){n.state=To,n.timer.restart(s,n.delay,n.time),n.delay<=d&&s(d-n.delay)}function s(d){var c,u,f,h;if(n.state!==To)return l();for(c in o)if(h=o[c],h.name===n.name){if(h.state===Bt)return zo(s);h.state===Ro?(h.state=jt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[c]):+c<t&&(h.state=jt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[c])}if(zo(function(){n.state===Bt&&(n.state=Ro,n.timer.restart(a,n.delay,n.time),a(d))}),n.state=Ln,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ln){for(n.state=Bt,r=new Array(f=n.tween.length),c=0,u=-1;c<f;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(r[++u]=h);r.length=u+1}}function a(d){for(var c=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(l),n.state=On,1),u=-1,f=r.length;++u<f;)r[u].call(e,c);n.state===On&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=jt,n.timer.stop(),delete o[t];for(var d in o)return;delete e.__transition}}function Ft(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>Ln&&o.state<On,o.state=jt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function ru(e){return this.each(function(){Ft(this,e)})}function iu(e,t){var n,o;return function(){var r=_e(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 su(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=_e(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,d=r.length;l<d;++l)if(r[l].name===t){r[l]=a;break}l===d&&r.push(a)}i.tween=r}}function au(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ye(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?iu:su)(n,e,t))}function Qn(e,t,n){var o=e._id;return e.each(function(){var r=_e(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ye(r,o).value[t]}}function ri(e,t){var n;return(typeof t=="number"?ve:t instanceof je?Wt:(n=je(t))?(t=n,Wt):Ur)(e,t)}function cu(e){return function(){this.removeAttribute(e)}}function lu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function uu(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 du(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 fu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function hu(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function gu(e,t){var n=tn(e),o=n==="transform"?Wl:ri;return this.attrTween(e,typeof t=="function"?(n.local?hu:fu)(n,o,Qn(this,"attr."+e,t)):t==null?(n.local?lu:cu)(n):(n.local?du:uu)(n,o,t))}function pu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function mu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function yu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&mu(e,i)),n}return r._value=t,r}function xu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&pu(e,i)),n}return r._value=t,r}function wu(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=tn(e);return this.tween(n,(o.local?yu:xu)(o,t))}function vu(e,t){return function(){Un(this,e).delay=+t.apply(this,arguments)}}function bu(e,t){return t=+t,function(){Un(this,e).delay=t}}function _u(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?vu:bu)(t,e)):ye(this.node(),t).delay}function Eu(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function Su(e,t){return t=+t,function(){_e(this,e).duration=t}}function Nu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Eu:Su)(t,e)):ye(this.node(),t).duration}function Cu(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function Mu(e){var t=this._id;return arguments.length?this.each(Cu(t,e)):ye(this.node(),t).ease}function ku(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function Iu(e){if(typeof e!="function")throw new Error;return this.each(ku(this._id,e))}function Au(e){typeof e!="function"&&(e=Tr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],l,d=0;d<s;++d)(l=i[d])&&e.call(l,l.__data__,d,i)&&a.push(l);return new $e(o,this._parents,this._name,this._id)}function $u(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l=t[a],d=n[a],c=l.length,u=s[a]=new Array(c),f,h=0;h<c;++h)(f=l[h]||d[h])&&(u[h]=f);for(;a<o;++a)s[a]=t[a];return new $e(s,this._parents,this._name,this._id)}function Pu(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 Du(e,t,n){var o,r,i=Pu(t)?Un:_e;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function zu(e,t){var n=this._id;return arguments.length<2?ye(this.node(),n).on.on(e):this.each(Du(n,e,t))}function Tu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ru(){return this.on("end.remove",Tu(this._id))}function Hu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Zn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,d=i[s]=new Array(l),c,u,f=0;f<l;++f)(c=a[f])&&(u=e.call(c,c.__data__,f,a))&&("__data__"in c&&(u.__data__=c.__data__),d[f]=u,on(d[f],t,n,f,d,ye(c,n)));return new $e(i,this._parents,t,n)}function Lu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],d=l.length,c,u=0;u<d;++u)if(c=l[u]){for(var f=e.call(c,c.__data__,u,l),h,g=ye(c,n),w=0,y=f.length;w<y;++w)(h=f[w])&&on(h,t,n,w,f,g);i.push(f),s.push(c)}return new $e(i,s,t,n)}var Ou=St.prototype.constructor;function Vu(){return new Ou(this._groups,this._parents)}function Bu(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 ii(e){return function(){this.style.removeProperty(e)}}function ju(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 Fu(e,t,n){var o,r,i;return function(){var s=Qe(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Qe(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function Xu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=_e(this,e),d=l.on,c=l.value[i]==null?a||(a=ii(t)):void 0;(d!==n||r!==c)&&(o=(n=d).copy()).on(s,r=c),l.on=o}}function Yu(e,t,n){var o=(e+="")=="transform"?Zl:ri;return t==null?this.styleTween(e,Bu(e,o)).on("end.style."+e,ii(e)):typeof t=="function"?this.styleTween(e,Fu(e,o,Qn(this,"style."+e,t))).each(Xu(this._id,e)):this.styleTween(e,ju(e,o,t),n).on("end.style."+e,null)}function Zu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Wu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Zu(e,s,n)),o}return i._value=t,i}function qu(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,Wu(e,t,n??""))}function Gu(e){return function(){this.textContent=e}}function Ku(e){return function(){var t=e(this);this.textContent=t??""}}function Uu(e){return this.tween("text",typeof e=="function"?Ku(Qn(this,"text",e)):Gu(e==null?"":e+""))}function Qu(e){return function(t){this.textContent=e.call(this,t)}}function Ju(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Qu(r)),t}return o._value=e,o}function ed(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,Ju(e))}function td(){for(var e=this._name,t=this._id,n=si(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,d=0;d<a;++d)if(l=s[d]){var c=ye(l,t);on(l,e,n,d,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new $e(o,this._parents,e,n)}function nd(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var d=_e(this,o),c=d.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),d.on=t}),r===0&&i()})}var od=0;function $e(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function si(){return++od}var ke=St.prototype;$e.prototype={constructor:$e,select:Hu,selectAll:Lu,selectChild:ke.selectChild,selectChildren:ke.selectChildren,filter:Au,merge:$u,selection:Vu,transition:td,call:ke.call,nodes:ke.nodes,node:ke.node,size:ke.size,empty:ke.empty,each:ke.each,on:zu,attr:gu,attrTween:wu,style:Yu,styleTween:qu,text:Uu,textTween:ed,remove:Ru,tween:au,delay:_u,duration:Nu,ease:Mu,easeVarying:Iu,end:nd,[Symbol.iterator]:ke[Symbol.iterator]};function rd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var id={time:null,delay:0,duration:250,ease:rd};function sd(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 ad(e){var t,n;e instanceof $e?(t=e._id,e=e._name):(t=si(),(n=id).time=Kn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,d=0;d<a;++d)(l=s[d])&&on(l,e,t,d,s,n||sd(l,t));return new $e(o,this._parents,e,t)}St.prototype.interrupt=ru;St.prototype.transition=ad;const zt=e=>()=>e;function cd(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 Ie(e,t,n){this.k=e,this.x=t,this.y=n}Ie.prototype={constructor:Ie,scale:function(e){return e===1?this:new Ie(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ie(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 rn=new Ie(1,0,0);ai.prototype=Ie.prototype;function ai(e){for(;!e.__zoom;)if(!(e=e.parentNode))return rn;return e.__zoom}function xn(e){e.stopImmediatePropagation()}function ct(e){e.preventDefault(),e.stopImmediatePropagation()}function ld(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ud(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ho(){return this.__zoom||rn}function dd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fd(){return navigator.maxTouchPoints||"ontouchstart"in this}function hd(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 ci(){var e=ld,t=ud,n=hd,o=dd,r=fd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Vt,d=en("start","zoom","end"),c,u,f,h=500,g=150,w=0,y=10;function m(x){x.property("__zoom",Ho).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",z).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",T).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(x,E,S,k){var D=x.selection?x.selection():x;D.property("__zoom",Ho),x!==D?N(x,E,S,k):D.interrupt().each(function(){_(this,arguments).event(k).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},m.scaleBy=function(x,E,S,k){m.scaleTo(x,function(){var D=this.__zoom.k,P=typeof E=="function"?E.apply(this,arguments):E;return D*P},S,k)},m.scaleTo=function(x,E,S,k){m.transform(x,function(){var D=t.apply(this,arguments),P=this.__zoom,V=S==null?v(D):typeof S=="function"?S.apply(this,arguments):S,O=P.invert(V),H=typeof E=="function"?E.apply(this,arguments):E;return n(p(b(P,H),V,O),D,s)},S,k)},m.translateBy=function(x,E,S,k){m.transform(x,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),s)},null,k)},m.translateTo=function(x,E,S,k,D){m.transform(x,function(){var P=t.apply(this,arguments),V=this.__zoom,O=k==null?v(P):typeof k=="function"?k.apply(this,arguments):k;return n(rn.translate(O[0],O[1]).scale(V.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof S=="function"?-S.apply(this,arguments):-S),P,s)},k,D)};function b(x,E){return E=Math.max(i[0],Math.min(i[1],E)),E===x.k?x:new Ie(E,x.x,x.y)}function p(x,E,S){var k=E[0]-S[0]*x.k,D=E[1]-S[1]*x.k;return k===x.x&&D===x.y?x:new Ie(x.k,k,D)}function v(x){return[(+x[0][0]+ +x[1][0])/2,(+x[0][1]+ +x[1][1])/2]}function N(x,E,S,k){x.on("start.zoom",function(){_(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(k).end()}).tween("zoom",function(){var D=this,P=arguments,V=_(D,P).event(k),O=t.apply(D,P),H=S==null?v(O):typeof S=="function"?S.apply(D,P):S,Y=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),F=D.__zoom,W=typeof E=="function"?E.apply(D,P):E,Q=l(F.invert(H).concat(Y/F.k),W.invert(H).concat(Y/W.k));return function(q){if(q===1)q=W;else{var R=Q(q),j=Y/R[2];q=new Ie(j,H[0]-R[0]*j,H[1]-R[1]*j)}V.zoom(null,q)}})}function _(x,E,S){return!S&&x.__zooming||new M(x,E)}function M(x,E){this.that=x,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(x,E),this.taps=0}M.prototype={event:function(x){return x&&(this.sourceEvent=x),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(x,E){return this.mouse&&x!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&x!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&x!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(x){var E=le(this.that).datum();d.call(x,this.that,new cd(x,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:d}),E)}};function I(x,...E){if(!e.apply(this,arguments))return;var S=_(this,E).event(x),k=this.__zoom,D=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,o.apply(this,arguments)))),P=fe(x);if(S.wheel)(S.mouse[0][0]!==P[0]||S.mouse[0][1]!==P[1])&&(S.mouse[1]=k.invert(S.mouse[0]=P)),clearTimeout(S.wheel);else{if(k.k===D)return;S.mouse=[P,k.invert(P)],Ft(this),S.start()}ct(x),S.wheel=setTimeout(V,g),S.zoom("mouse",n(p(b(k,D),S.mouse[0],S.mouse[1]),S.extent,s));function V(){S.wheel=null,S.end()}}function A(x,...E){if(f||!e.apply(this,arguments))return;var S=x.currentTarget,k=_(this,E,!0).event(x),D=le(x.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",Y,!0),P=fe(x,S),V=x.clientX,O=x.clientY;Yr(x.view),xn(x),k.mouse=[P,this.__zoom.invert(P)],Ft(this),k.start();function H(F){if(ct(F),!k.moved){var W=F.clientX-V,Q=F.clientY-O;k.moved=W*W+Q*Q>w}k.event(F).zoom("mouse",n(p(k.that.__zoom,k.mouse[0]=fe(F,S),k.mouse[1]),k.extent,s))}function Y(F){D.on("mousemove.zoom mouseup.zoom",null),Zr(F.view,k.moved),ct(F),k.event(F).end()}}function B(x,...E){if(e.apply(this,arguments)){var S=this.__zoom,k=fe(x.changedTouches?x.changedTouches[0]:x,this),D=S.invert(k),P=S.k*(x.shiftKey?.5:2),V=n(p(b(S,P),k,D),t.apply(this,E),s);ct(x),a>0?le(this).transition().duration(a).call(N,V,k,x):le(this).call(m.transform,V,k,x)}}function z(x,...E){if(e.apply(this,arguments)){var S=x.touches,k=S.length,D=_(this,E,x.changedTouches.length===k).event(x),P,V,O,H;for(xn(x),V=0;V<k;++V)O=S[V],H=fe(O,this),H=[H,this.__zoom.invert(H),O.identifier],D.touch0?!D.touch1&&D.touch0[2]!==H[2]&&(D.touch1=H,D.taps=0):(D.touch0=H,P=!0,D.taps=1+!!c);c&&(c=clearTimeout(c)),P&&(D.taps<2&&(u=H[0],c=setTimeout(function(){c=null},h)),Ft(this),D.start())}}function L(x,...E){if(this.__zooming){var S=_(this,E).event(x),k=x.changedTouches,D=k.length,P,V,O,H;for(ct(x),P=0;P<D;++P)V=k[P],O=fe(V,this),S.touch0&&S.touch0[2]===V.identifier?S.touch0[0]=O:S.touch1&&S.touch1[2]===V.identifier&&(S.touch1[0]=O);if(V=S.that.__zoom,S.touch1){var Y=S.touch0[0],F=S.touch0[1],W=S.touch1[0],Q=S.touch1[1],q=(q=W[0]-Y[0])*q+(q=W[1]-Y[1])*q,R=(R=Q[0]-F[0])*R+(R=Q[1]-F[1])*R;V=b(V,Math.sqrt(q/R)),O=[(Y[0]+W[0])/2,(Y[1]+W[1])/2],H=[(F[0]+Q[0])/2,(F[1]+Q[1])/2]}else if(S.touch0)O=S.touch0[0],H=S.touch0[1];else return;S.zoom("touch",n(p(V,O,H),S.extent,s))}}function T(x,...E){if(this.__zooming){var S=_(this,E).event(x),k=x.changedTouches,D=k.length,P,V;for(xn(x),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),P=0;P<D;++P)V=k[P],S.touch0&&S.touch0[2]===V.identifier?delete S.touch0:S.touch1&&S.touch1[2]===V.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(V=fe(V,this),Math.hypot(u[0]-V[0],u[1]-V[1])<y)){var O=le(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return m.wheelDelta=function(x){return arguments.length?(o=typeof x=="function"?x:zt(+x),m):o},m.filter=function(x){return arguments.length?(e=typeof x=="function"?x:zt(!!x),m):e},m.touchable=function(x){return arguments.length?(r=typeof x=="function"?x:zt(!!x),m):r},m.extent=function(x){return arguments.length?(t=typeof x=="function"?x:zt([[+x[0][0],+x[0][1]],[+x[1][0],+x[1][1]]]),m):t},m.scaleExtent=function(x){return arguments.length?(i[0]=+x[0],i[1]=+x[1],m):[i[0],i[1]]},m.translateExtent=function(x){return arguments.length?(s[0][0]=+x[0][0],s[1][0]=+x[1][0],s[0][1]=+x[0][1],s[1][1]=+x[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(x){return arguments.length?(n=x,m):n},m.duration=function(x){return arguments.length?(a=+x,m):a},m.interpolate=function(x){return arguments.length?(l=x,m):l},m.on=function(){var x=d.on.apply(d,arguments);return x===d?m:x},m.clickDistance=function(x){return arguments.length?(w=(x=+x)*x,m):Math.sqrt(w)},m.tapDistance=function(x){return arguments.length?(y=+x,m):y},m}const me={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.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 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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},xt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],li=["Enter"," ","Escape"],ui={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var et;(function(e){e.Strict="strict",e.Loose="loose"})(et||(et={}));var Be;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Be||(Be={}));var wt;(function(e){e.Partial="partial",e.Full="full"})(wt||(wt={}));const di={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ze;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ze||(ze={}));var vt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(vt||(vt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const Lo={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function fi(e){return e===null?null:e?"valid":"invalid"}const hi=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,gd=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Jn=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Ct=(e,t=[0,0])=>{const{width:n,height:o}=Ee(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},pd=(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):Jn(r)?r:t.nodeLookup.get(r.id));const a=s?Ut(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return sn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return an(n)},Mt=(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=sn(n,Ut(r)),o=!0)}),o?an(n):{x:0,y:0,width:0,height:0}},eo=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,l=(t.y-o)/r,d=t.width/r,c=t.height/r,u=[];for(const f of e.values()){const{measured:h,selectable:g=!0,hidden:w=!1}=f;if(s&&!g||w)continue;const y=h.width??f.width??f.initialWidth??0,m=h.height??f.height??f.initialHeight??0,{x:b,y:p}=f.internals.positionAbsolute,v=yi(a,l,d,c,b,p,y,m),N=y*m,_=i&&v>0;(!f.internals.handleBounds||_||v>=N||f.dragging)&&u.push(f)}return u},md=(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 yd(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){const{width:s,height:a}=Ee(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function xd({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;const a=yd(e,s),l=Mt(a),d=no(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(d,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function gi({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:d}=a?a.internals.positionAbsolute:{x:0,y:0},c=s.origin??o;let u=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",me.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[l,d],[l+h,d+g]])}else a&&Ye(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+d],[s.extent[1][0]+l,s.extent[1][1]+d]]);const f=Ye(u)?Xe(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",me.error015()),{position:{x:f.x-l+(s.measured.width??0)*c[0],y:f.y-d+(s.measured.height??0)*c[1]},positionAbsolute:f}}async function wd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(w=>w.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),c=md(s,l);for(const f of l)a.has(f.id)&&!c.find(g=>g.id===f.id)&&c.push(f);if(!r)return{edges:c,nodes:s};const u=await r({nodes:s,edges:c});return typeof u=="boolean"?u?{edges:c,nodes:s}:{edges:[],nodes:[]}:u}const tt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Xe=(e={x:0,y:0},t,n)=>({x:tt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:tt(e.y,t[0][1],t[1][1]-(n?.height??0))});function pi(e,t,n){const{width:o,height:r}=Ee(n),{x:i,y:s}=n.internals.positionAbsolute;return Xe(e,[[i,s],[i+o,s+r]],t)}const Oo=(e,t,n)=>e<t?tt(Math.abs(e-t),1,t)/t:e>n?-tt(Math.abs(e-n),1,t)/t:0,to=(e,t,n=15,o=40)=>{const r=Oo(e.x,o,t.width-o)*n,i=Oo(e.y,o,t.height-o)*n;return[r,i]},sn=(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)}),Vn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),an=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),bt=(e,t=[0,0])=>{const{x:n,y:o}=Jn(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ut=(e,t=[0,0])=>{const{x:n,y:o}=Jn(e)?e.internals.positionAbsolute:Ct(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},mi=(e,t)=>an(sn(Vn(e),Vn(t))),yi=(e,t,n,o,r,i,s,a)=>{const l=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),d=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(l*d)},Qt=(e,t)=>yi(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Vo=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),xi=(e,t)=>(n,o)=>{},kt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),It=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?kt(a,s):a},nt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function We(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(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function vd(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=We(e,n),r=We(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=We(e.top??e.y??0,n),r=We(e.bottom??e.y??0,n),i=We(e.left??e.x??0,t),s=We(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 bd(e,t,n,o,r,i){const{x:s,y:a}=nt(e,[t,n,o]),{x:l,y:d}=nt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),c=r-l,u=i-d;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(c),bottom:Math.floor(u)}}const no=(e,t,n,o,r,i)=>{const s=vd(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,d=Math.min(a,l),c=tt(d,o,r),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*c,g=n/2-f*c,w=bd(e,h,g,c,t,n),y={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:g-y.top+y.bottom,zoom:c}},_t=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ye(e){return e!=null&&e!=="parent"}function Ee(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function wi(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function vi(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 Bo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function _d(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Ed(e){return{...ui,...e||{}}}function ht(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=pe(e),a=It({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:d}=n?kt(a,t):a;return{xSnapped:l,ySnapped:d,...a}}const oo=e=>({width:e.offsetWidth,height:e.offsetHeight}),bi=e=>e?.getRootNode?.()||window?.document,Sd=["INPUT","SELECT","TEXTAREA"];function _i(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Sd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ei=e=>"clientX"in e,pe=(e,t)=>{const n=Ei(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},jo=(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,...oo(s)}})};function Si({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,d=t*.125+i*.375+a*.375+o*.125,c=Math.abs(l-e),u=Math.abs(d-t);return[l,d,c,u]}function Tt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Fo({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 Ni({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){const[a,l]=Fo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[d,c]=Fo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,f,h,g]=Si({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:d,targetControlY:c});return[`M${e},${t} C${a},${l} ${d},${c} ${o},${r}`,u,f,h,g]}function Ci({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 Cd({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=sn(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 Qt(s,an(i))>0}const Md=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,kd=(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)),Id=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",me.error006()),t;const o=n.getEdgeId||Md;let r;return hi(e)?r={...e}:r={...e,id:o(e)},kd(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function Mi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=Ci({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Xo={[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},Yo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function $d({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){const a=Xo[t],l=Xo[o],d={x:e.x+a.x*i,y:e.y+a.y*i},c={x:n.x+l.x*i,y:n.y+l.y*i},u=Ad({source:d,sourcePosition:t,target:c}),f=u.x!==0?"x":"y",h=u[f];let g=[],w,y;const m={x:0,y:0},b={x:0,y:0},[,,p,v]=Ci({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){f==="x"?(w=r.x??d.x+(c.x-d.x)*s,y=r.y??(d.y+c.y)/2):(w=r.x??(d.x+c.x)/2,y=r.y??d.y+(c.y-d.y)*s);const I=[{x:w,y:d.y},{x:w,y:c.y}],A=[{x:d.x,y},{x:c.x,y}];a[f]===h?g=f==="x"?I:A:g=f==="x"?A:I}else{const I=[{x:d.x,y:c.y}],A=[{x:c.x,y:d.y}];if(f==="x"?g=a.x===h?A:I:g=a.y===h?I:A,t===o){const x=Math.abs(e[f]-n[f]);if(x<=i){const E=Math.min(i-1,i-x);a[f]===h?m[f]=(d[f]>e[f]?-1:1)*E:b[f]=(c[f]>n[f]?-1:1)*E}}if(t!==o){const x=f==="x"?"y":"x",E=a[f]===l[x],S=d[x]>c[x],k=d[x]<c[x];(a[f]===1&&(!E&&S||E&&k)||a[f]!==1&&(!E&&k||E&&S))&&(g=f==="x"?I:A)}const B={x:d.x+m.x,y:d.y+m.y},z={x:c.x+b.x,y:c.y+b.y},L=Math.max(Math.abs(B.x-g[0].x),Math.abs(z.x-g[0].x)),T=Math.max(Math.abs(B.y-g[0].y),Math.abs(z.y-g[0].y));L>=T?(w=(B.x+z.x)/2,y=g[0].y):(w=g[0].x,y=(B.y+z.y)/2)}const N={x:d.x+m.x,y:d.y+m.y},_={x:c.x+b.x,y:c.y+b.y};return[[e,...N.x!==g[0].x||N.y!==g[0].y?[N]:[],...g,..._.x!==g[g.length-1].x||_.y!==g[g.length-1].y?[_]:[],n],w,y,p,v]}function Pd(e,t,n,o){const r=Math.min(Yo(e,t)/2,Yo(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 d=e.x<n.x?-1:1,c=e.y<n.y?1:-1;return`L ${i+r*d},${s}Q ${i},${s} ${i},${s+r*c}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function Bn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:l,offset:d=20,stepPosition:c=.5}){const[u,f,h,g,w]=$d({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:d,stepPosition:c});let y=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)y+=Pd(u[m-1],u[m],u[m+1],s);return y+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[y,f,h,g,w]}function Zo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Dd(e){const{sourceNode:t,targetNode:n}=e;if(!Zo(t)||!Zo(n))return null;const o=t.internals.handleBounds||Wo(t.handles),r=n.internals.handleBounds||Wo(n.handles),i=qo(o?.source??[],e.sourceHandle),s=qo(e.connectionMode===et.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",me.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||X.Bottom,l=s?.position||X.Top,d=Ze(t,i,a),c=Ze(n,s,l);return{sourceX:d.x,sourceY:d.y,targetX:c.x,targetY:c.y,sourcePosition:a,targetPosition:l}}function Wo(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 Ze(e,t,n=X.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ee(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case X.Top:return{x:r+s/2,y:i};case X.Right:return{x:r+s,y:i+a/2};case X.Bottom:return{x:r+s/2,y:i+a};case X.Left:return{x:r,y:i+a/2}}}function qo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function jn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function zd(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const d=jn(l,t);i.has(d)||(s.push({id:d,color:l.color||n,...l}),i.add(d))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const ki=1e3,Td=10,ro={nodeOrigin:[0,0],nodeExtent:xt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Rd={...ro,checkEquality:!0};function io(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Hd(e,t,n){const o=io(ro,n);for(const r of e.values())if(r.parentId)ao(r,e,t,o);else{const i=Ct(r,o.nodeOrigin),s=Ye(r.extent)?r.extent:o.nodeExtent,a=Xe(i,s,Ee(r));r.internals.positionAbsolute=a}}function Ld(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function so(e){return e==="manual"}function Fn(e,t,n,o={}){const r=io(Rd,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!so(r.zIndexMode)?ki:0;let l=e.length>0,d=!1;t.clear(),n.clear();for(const c of e){let u=s.get(c.id);if(r.checkEquality&&c===u?.internals.userNode)t.set(c.id,u);else{const f=Ct(c,r.nodeOrigin),h=Ye(c.extent)?c.extent:r.nodeExtent,g=Xe(f,h,Ee(c));u={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:g,handleBounds:Ld(c,u),z:Ii(c,a,r.zIndexMode),userNode:c}},t.set(c.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),c.parentId&&ao(u,t,n,o,i),d||=c.selected??!1}return{nodesInitialized:l,hasSelectedNodes:d}}function Od(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 ao(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=io(ro,o),d=e.parentId,c=t.get(d);if(!c){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Od(e,n),r&&!c.parentId&&c.internals.rootParentIndex===void 0&&l==="auto"&&(c.internals.rootParentIndex=++r.i,c.internals.z=c.internals.z+r.i*Td),r&&c.internals.rootParentIndex!==void 0&&(r.i=c.internals.rootParentIndex);const u=i&&!so(l)?ki:0,{x:f,y:h,z:g}=Vd(e,c,s,a,u,l),{positionAbsolute:w}=e.internals,y=f!==w.x||h!==w.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:f,y:h}:w,z:g}})}function Ii(e,t,n){const o=ge(e.zIndex)?e.zIndex:0;return so(n)?o:o+(e.selected?t:0)}function Vd(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Ee(e),d=Ct(e,n),c=Ye(e.extent)?Xe(d,e.extent,l):d;let u=Xe({x:s+c.x,y:a+c.y},o,l);e.extent==="parent"&&(u=pi(u,l,t));const f=Ii(e,r,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}function co(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const l=i.get(s.parentId)?.expandedRect??bt(a),d=mi(l,s.rect);i.set(s.parentId,{expandedRect:d,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const d=a.internals.positionAbsolute,c=Ee(a),u=a.origin??o,f=s.x<d.x?Math.round(Math.abs(d.x-s.x)):0,h=s.y<d.y?Math.round(Math.abs(d.y-s.y)):0,g=Math.max(c.width,Math.round(s.width)),w=Math.max(c.height,Math.round(s.height)),y=(g-c.width)*u[0],m=(w-c.height)*u[1];(f>0||h>0||y||m)&&(r.push({id:l,type:"position",position:{x:a.position.x-f+y,y:a.position.y-h+m}}),n.get(l)?.forEach(b=>{e.some(p=>p.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+f,y:b.position.y+h}})})),(c.width<s.width||c.height<s.height||f||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?u[0]*f-y:0),height:w+(h?u[1]*h-m:0)}})}),r}function Bd(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const d=[],c=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(c.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const w=oo(h.nodeElement),y=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(y||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Ye(g.extent)?g.extent:i;let{positionAbsolute:v}=g.internals;if(g.parentId&&g.extent==="parent"){const _=t.get(g.parentId);_&&(v=pi(v,w,_))}else p&&(v=Xe(v,p,w));const N={...g,measured:w,internals:{...g.internals,positionAbsolute:v,handleBounds:{source:jo("source",h.nodeElement,b,u,g.id),target:jo("target",h.nodeElement,b,u,g.id)}}};t.set(g.id,N),g.parentId&&ao(N,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,y&&(d.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:bt(N,r)}))}}if(f.length>0){const h=co(f,t,n,r);d.push(...h)}return{changes:d,updatedInternals:l}}async function jd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Go(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const d=o.get(s)||new Map;o.set(s,d.set(n,t))}}function Ai(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},d=`${r}-${s}--${i}-${a}`,c=`${i}-${a}--${r}-${s}`;Go("source",l,c,e,r,s),Go("target",l,d,e,i,a),t.set(o.id,o)}}function $i(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:$i(n,t):!1}function Ko(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Fd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!$i(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}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Xd({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=kt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Yd({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,d={x:0,y:0},c=null,u=!1,f=null,h=!1,g=!1,w=null;function y({noDragClassName:b,handleSelector:p,domNode:v,isSelectable:N,nodeId:_,nodeClickDistance:M=0}){f=le(v);function I({x:L,y:T}){const{nodeLookup:x,nodeExtent:E,snapGrid:S,snapToGrid:k,nodeOrigin:D,onNodeDrag:P,onSelectionDrag:V,onError:O,updateNodePositions:H}=t();i={x:L,y:T};let Y=!1;const F=a.size>1,W=F&&E?Vn(Mt(a)):null,Q=F&&k?Xd({dragItems:a,snapGrid:S,x:L,y:T}):null;for(const[q,R]of a){if(!x.has(q))continue;let j={x:L-R.distance.x,y:T-R.distance.y};k&&(j=Q?{x:Math.round(j.x+Q.x),y:Math.round(j.y+Q.y)}:kt(j,S));let U=null;if(F&&E&&!R.extent&&W){const{positionAbsolute:G}=R.internals,J=G.x-W.x+E[0][0],te=G.x+R.measured.width-W.x2+E[1][0],oe=G.y-W.y+E[0][1],ae=G.y+R.measured.height-W.y2+E[1][1];U=[[J,oe],[te,ae]]}const{position:K,positionAbsolute:Z}=gi({nodeId:q,nextPosition:j,nodeLookup:x,nodeExtent:U||E,nodeOrigin:D,onError:O});Y=Y||R.position.x!==K.x||R.position.y!==K.y,R.position=K,R.internals.positionAbsolute=Z}if(g=g||Y,!!Y&&(H(a,!0),w&&(o||P||!_&&V))){const[q,R]=wn({nodeId:_,dragItems:a,nodeLookup:x});o?.(w,a,q,R),P?.(w,q,R),_||V?.(w,R)}}async function A(){if(!c)return;const{transform:L,panBy:T,autoPanSpeed:x,autoPanOnNodeDrag:E}=t();if(!E){l=!1,cancelAnimationFrame(s);return}const[S,k]=to(d,c,x);(S!==0||k!==0)&&(i.x=(i.x??0)-S/L[2],i.y=(i.y??0)-k/L[2],await T({x:S,y:k})&&I(i)),s=requestAnimationFrame(A)}function B(L){const{nodeLookup:T,multiSelectionActive:x,nodesDraggable:E,transform:S,snapGrid:k,snapToGrid:D,selectNodesOnDrag:P,onNodeDragStart:V,onSelectionDragStart:O,unselectNodesAndEdges:H}=t();u=!0,(!P||!N)&&!x&&_&&(T.get(_)?.selected||H()),N&&P&&_&&e?.(_);const Y=ht(L.sourceEvent,{transform:S,snapGrid:k,snapToGrid:D,containerBounds:c});if(i=Y,a=Fd(T,E,Y,_),a.size>0&&(n||V||!_&&O)){const[F,W]=wn({nodeId:_,dragItems:a,nodeLookup:T});n?.(L.sourceEvent,a,F,W),V?.(L.sourceEvent,F,W),_||O?.(L.sourceEvent,W)}}const z=Wr().clickDistance(M).on("start",L=>{const{domNode:T,nodeDragThreshold:x,transform:E,snapGrid:S,snapToGrid:k}=t();c=T?.getBoundingClientRect()||null,h=!1,g=!1,w=L.sourceEvent,x===0&&B(L),i=ht(L.sourceEvent,{transform:E,snapGrid:S,snapToGrid:k,containerBounds:c}),d=pe(L.sourceEvent,c)}).on("drag",L=>{const{autoPanOnNodeDrag:T,transform:x,snapGrid:E,snapToGrid:S,nodeDragThreshold:k,nodeLookup:D}=t(),P=ht(L.sourceEvent,{transform:x,snapGrid:E,snapToGrid:S,containerBounds:c});if(w=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||_&&!D.has(_))&&(h=!0),!h){if(!l&&T&&u&&(l=!0,A()),!u){const V=pe(L.sourceEvent,c),O=V.x-d.x,H=V.y-d.y;Math.sqrt(O*O+H*H)>k&&B(L)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&a&&u&&(d=pe(L.sourceEvent,c),I(P))}}).on("end",L=>{if(!u||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(l=!1,u=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:T,updateNodePositions:x,onNodeDragStop:E,onSelectionDragStop:S}=t();if(g&&(x(a,!1),g=!1),r||E||!_&&S){const[k,D]=wn({nodeId:_,dragItems:a,nodeLookup:T,dragging:!1});r?.(L.sourceEvent,a,k,D),E?.(L.sourceEvent,k,D),_||S?.(L.sourceEvent,D)}}}).filter(L=>{const T=L.target;return!L.button&&(!b||!Ko(T,`.${b}`,v))&&(!p||Ko(T,p,v))});f.call(z)}function m(){f?.on(".drag",null)}return{update:y,destroy:m}}function Zd(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())Qt(r,bt(i))>0&&o.push(i);return o}const Wd=250;function qd(e,t,n,o){let r=[],i=1/0;const s=Zd(e,n,t+Wd);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const d of l){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:c,y:u}=Ze(a,d,d.position,!0),f=Math.sqrt(Math.pow(c-e.x,2)+Math.pow(u-e.y,2));f>t||(f<i?(r=[{...d,x:c,y:u}],i=f):f===i&&r.push({...d,x:c,y:u}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function Pi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(d=>d.id===n):a?.[0])??null;return l&&i?{...l,...Ze(s,l,l.position,!0)}:l}function Di(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Gd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const zi=()=>!0;function Kd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:d,autoPanOnConnect:c,flowId:u,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:w,onConnectEnd:y,isValidConnection:m=zi,onReconnectEnd:b,updateConnection:p,getTransform:v,getFromHandle:N,autoPanSpeed:_,dragThreshold:M=1,handleDomNode:I}){const A=bi(e.target);let B=0,z;const{x:L,y:T}=pe(e),x=Di(i,I),E=a?.getBoundingClientRect();let S=!1;if(!E||!x)return;const k=Pi(r,x,o,l,t);if(!k)return;let D=pe(e,E),P=!1,V=null,O=!1,H=null;function Y(){if(!c||!E)return;const[K,Z]=to(D,E,_);f({x:K,y:Z}),B=requestAnimationFrame(Y)}const F={...k,nodeId:r,type:x,position:k.position},W=l.get(r);let q={inProgress:!0,isValid:null,from:Ze(W,F,X.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:W,to:D,toHandle:null,toPosition:Lo[F.position],toNode:null,pointer:D};function R(){S=!0,p(q),g?.(e,{nodeId:r,handleId:o,handleType:x})}M===0&&R();function j(K){if(!S){const{x:ae,y:Se}=pe(K),xe=ae-L,we=Se-T;if(!(xe*xe+we*we>M*M))return;R()}if(!N()||!F){U(K);return}const Z=v();D=pe(K,E),z=qd(It(D,Z,!1,[1,1]),n,l,F),P||(Y(),P=!0);const G=Ti(K,{handle:z,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:A,lib:d,flowId:u,nodeLookup:l});H=G.handleDomNode,V=G.connection,O=Gd(!!z,G.isValid);const J=l.get(r),te=J?Ze(J,F,X.Left,!0):q.from,oe={...q,from:te,isValid:O,to:G.toHandle&&O?nt({x:G.toHandle.x,y:G.toHandle.y},Z):D,toHandle:G.toHandle,toPosition:O&&G.toHandle?G.toHandle.position:Lo[F.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:D};p(oe),q=oe}function U(K){if(!("touches"in K&&K.touches.length>0)){if(S){(z||H)&&V&&O&&w?.(V);const{inProgress:Z,...G}=q,J={...G,toPosition:q.toHandle?q.toPosition:null};y?.(K,J),i&&b?.(K,J)}h(),cancelAnimationFrame(B),P=!1,O=!1,V=null,H=null,A.removeEventListener("mousemove",j),A.removeEventListener("mouseup",U),A.removeEventListener("touchmove",j),A.removeEventListener("touchend",U)}}A.addEventListener("mousemove",j),A.addEventListener("mouseup",U),A.addEventListener("touchmove",j),A.addEventListener("touchend",U)}function Ti(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:d=zi,nodeLookup:c}){const u=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=pe(e),w=s.elementFromPoint(h,g),y=w?.classList.contains(`${a}-flow__handle`)?w:f,m={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const b=Di(void 0,y),p=y.getAttribute("data-nodeid"),v=y.getAttribute("data-handleid"),N=y.classList.contains("connectable"),_=y.classList.contains("connectableend");if(!p||!b)return m;const M={source:u?p:o,sourceHandle:u?v:r,target:u?o:p,targetHandle:u?r:v};m.connection=M;const A=N&&_&&(n===et.Strict?u&&b==="source"||!u&&b==="target":p!==o||v!==r);m.isValid=A&&d(M),m.toHandle=Pi(p,b,v,c,n,!0)}return m}const Xn={onPointerDown:Kd,isValid:Ti};function Ud({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:a,width:l,height:d,zoomStep:c=1,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const v=n(),N=p.sourceEvent.ctrlKey&&_t()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*c,M=v[2]*Math.pow(2,_*N);t.scaleTo(M)};let w=[0,0];const y=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(w=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const v=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[N[0]-w[0],N[1]-w[1]];w=N;const M=o()*Math.max(v[2],Math.log(v[2]))*(h?-1:1),I={x:v[0]-_[0]*M,y:v[1]-_[1]*M},A=[[0,0],[l,d]];t.setViewportConstrained({x:I.x,y:I.y,zoom:v[2]},A,a)},b=ci().on("start",y).on("zoom",u?m:null).on("zoom.wheel",f?g:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const cn=e=>({x:e.x,y:e.y,zoom:e.k}),vn=({x:e,y:t,zoom:n})=>rn.translate(e,t).scale(n),qe=(e,t)=>e.target.closest(`.${t}`),Ri=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Qd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,bn=(e,t=0,n=Qd,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Hi=e=>{const t=e.ctrlKey&&_t()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Jd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:d}){return c=>{if(qe(c,t))return c.ctrlKey&&c.preventDefault(),!1;c.preventDefault(),c.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(c.ctrlKey&&s){const y=fe(c),m=Hi(c),b=u*Math.pow(2,m);o.scaleTo(n,b,y,c);return}const f=c.deltaMode===1?20:1;let h=r===Be.Vertical?0:c.deltaX*f,g=r===Be.Horizontal?0:c.deltaY*f;!_t()&&c.shiftKey&&r!==Be.Vertical&&(h=c.deltaY*f,g=0),o.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const w=cn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(c,w):(e.isPanScrolling=!0,a?.(c,w)),e.panScrollTimeout=setTimeout(()=>{d?.(c,w),e.isPanScrolling=!1},150)}}function ef({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=qe(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function tf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=cn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function nf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Ri(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,cn(i.transform))}}function of({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Ri(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=cn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function rf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:d,connectionInProgress:c}){return u=>{const f=e||t,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(qe(u,`${d}-flow__node`)||qe(u,`${d}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||c&&!g||qe(u,a)&&g||qe(u,l)&&(!g||r&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&u.touches?.length>1)return u.preventDefault(),!1;if(!f&&!r&&!h&&g||!o&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(o)&&!o.includes(u.button)&&u.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&w}}function sf({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},c=e.getBoundingClientRect();let u=[[0,0],[c.width,c.height]];(typeof ResizeObserver<"u"?new ResizeObserver(T=>{const x=T[0];x&&(u=[[0,0],[x.contentRect.width,x.contentRect.height]])}):null)?.observe(e);const h=ci().extent(()=>u).scaleExtent([t,n]).translateExtent(o),g=le(e).call(h);v({x:r.x,y:r.y,zoom:tt(r.zoom,t,n)},[[0,0],[c.width,c.height]],o);const w=g.on("wheel.zoom"),y=g.on("dblclick.zoom");h.wheelDelta(Hi);async function m(T,x){return g?new Promise(E=>{h?.interpolate(x?.interpolate==="linear"?ft:Vt).transform(bn(g,x?.duration,x?.ease,()=>E(!0)),T)}):!1}function b({noWheelClassName:T,noPanClassName:x,onPaneContextMenu:E,userSelectionActive:S,panOnScroll:k,panOnDrag:D,panOnScrollMode:P,panOnScrollSpeed:V,preventScrolling:O,zoomOnPinch:H,zoomOnScroll:Y,zoomOnDoubleClick:F,zoomActivationKeyPressed:W,lib:Q,onTransformChange:q,connectionInProgress:R,paneClickDistance:j,selectionOnDrag:U}){S&&!d.isZoomingOrPanning&&p();const K=k&&!W&&!S;h.clickDistance(U?1/0:!ge(j)||j<0?0:j);const Z=K?Jd({zoomPanValues:d,noWheelClassName:T,d3Selection:g,d3Zoom:h,panOnScrollMode:P,panOnScrollSpeed:V,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):ef({noWheelClassName:T,preventScrolling:O,d3ZoomHandler:w});g.on("wheel.zoom",Z,{passive:!1});const G=tf({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:s});h.on("start",G);const J=nf({zoomPanValues:d,panOnDrag:D,onPaneContextMenu:!!E,onPanZoom:i,onTransformChange:q});h.on("zoom",J);const te=of({zoomPanValues:d,panOnDrag:D,panOnScroll:k,onPaneContextMenu:E,onPanZoomEnd:a,onDraggingChange:l});h.on("end",te);const oe=rf({zoomActivationKeyPressed:W,panOnDrag:D,zoomOnScroll:Y,panOnScroll:k,zoomOnDoubleClick:F,zoomOnPinch:H,userSelectionActive:S,noPanClassName:x,noWheelClassName:T,lib:Q,connectionInProgress:R});h.filter(oe),F?g.on("dblclick.zoom",y):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function v(T,x,E){const S=vn(T),k=h?.constrain()(S,x,E);return k&&await m(k),k}async function N(T,x){const E=vn(T);return await m(E,x),E}function _(T){if(g){const x=vn(T),E=g.property("__zoom");(E.k!==T.zoom||E.x!==T.x||E.y!==T.y)&&h?.transform(g,x,null,{sync:!0})}}function M(){const T=g?ai(g.node()):{x:0,y:0,k:1};return{x:T.x,y:T.y,zoom:T.k}}async function I(T,x){return g?new Promise(E=>{h?.interpolate(x?.interpolate==="linear"?ft:Vt).scaleTo(bn(g,x?.duration,x?.ease,()=>E(!0)),T)}):!1}async function A(T,x){return g?new Promise(E=>{h?.interpolate(x?.interpolate==="linear"?ft:Vt).scaleBy(bn(g,x?.duration,x?.ease,()=>E(!0)),T)}):!1}function B(T){h?.scaleExtent(T)}function z(T){h?.translateExtent(T)}function L(T){const x=!ge(T)||T<0?0:T;h?.clickDistance(x)}return{update:b,destroy:p,setViewport:N,setViewportConstrained:v,getViewport:M,scaleTo:I,scaleBy:A,setScaleExtent:B,setTranslateExtent:z,syncViewport:_,setClickDistance:L}}var ot;(function(e){e.Line="line",e.Handle="handle"})(ot||(ot={}));function af({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Uo(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 Pe(e,t){return Math.max(0,t-e)}function De(e,t){return Math.max(0,e-t)}function Rt(e,t,n){return Math.max(0,t-e,e-n)}function Qo(e,t){return e?!t:t}function cf(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:d}=t;const{isHorizontal:c,isVertical:u}=t,f=c&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:w,maxWidth:y,minHeight:m,maxHeight:b}=o,{x:p,y:v,width:N,height:_,aspectRatio:M}=e;let I=Math.floor(c?h-e.pointerX:0),A=Math.floor(u?g-e.pointerY:0);const B=N+(l?-I:I),z=_+(d?-A:A),L=-i[0]*N,T=-i[1]*_;let x=Rt(B,w,y),E=Rt(z,m,b);if(s){let D=0,P=0;l&&I<0?D=Pe(p+I+L,s[0][0]):!l&&I>0&&(D=De(p+B+L,s[1][0])),d&&A<0?P=Pe(v+A+T,s[0][1]):!d&&A>0&&(P=De(v+z+T,s[1][1])),x=Math.max(x,D),E=Math.max(E,P)}if(a){let D=0,P=0;l&&I>0?D=De(p+I,a[0][0]):!l&&I<0&&(D=Pe(p+B,a[1][0])),d&&A>0?P=De(v+A,a[0][1]):!d&&A<0&&(P=Pe(v+z,a[1][1])),x=Math.max(x,D),E=Math.max(E,P)}if(r){if(c){const D=Rt(B/M,m,b)*M;if(x=Math.max(x,D),s){let P=0;!l&&!d||l&&!d&&f?P=De(v+T+B/M,s[1][1])*M:P=Pe(v+T+(l?I:-I)/M,s[0][1])*M,x=Math.max(x,P)}if(a){let P=0;!l&&!d||l&&!d&&f?P=Pe(v+B/M,a[1][1])*M:P=De(v+(l?I:-I)/M,a[0][1])*M,x=Math.max(x,P)}}if(u){const D=Rt(z*M,w,y)/M;if(E=Math.max(E,D),s){let P=0;!l&&!d||d&&!l&&f?P=De(p+z*M+L,s[1][0])/M:P=Pe(p+(d?A:-A)*M+L,s[0][0])/M,E=Math.max(E,P)}if(a){let P=0;!l&&!d||d&&!l&&f?P=Pe(p+z*M,a[1][0])/M:P=De(p+(d?A:-A)*M,a[0][0])/M,E=Math.max(E,P)}}}A=A+(A<0?E:-E),I=I+(I<0?x:-x),r&&(f?B>z*M?A=(Qo(l,d)?-I:I)/M:I=(Qo(l,d)?-A:A)*M:c?(A=I/M,d=l):(I=A*M,l=d));const S=l?p+I:p,k=d?v+A:v;return{width:N+(l?-I:I),height:_+(d?-A:A),x:i[0]*I*(l?-1:1)+S,y:i[1]*A*(d?-1:1)+k}}const Li={width:0,height:0,x:0,y:0},lf={...Li,pointerX:0,pointerY:0,aspectRatio:1};function uf(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function df({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:Uo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:d,boundaries:c,keepAspectRatio:u,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:w,shouldResize:y}){let m={...Li},b={...lf};s={boundaries:c,resizeDirection:f,keepAspectRatio:u,controlDirection:Uo(d)};let p,v=null,N=[],_,M,I,A=!1;const B=Wr().on("start",z=>{const{nodeLookup:L,transform:T,snapGrid:x,snapToGrid:E,nodeOrigin:S,paneDomNode:k}=n();if(p=L.get(t),!p)return;v=k?.getBoundingClientRect()??null;const{xSnapped:D,ySnapped:P}=ht(z.sourceEvent,{transform:T,snapGrid:x,snapToGrid:E,containerBounds:v});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...m,pointerX:D,pointerY:P,aspectRatio:m.width/m.height},_=void 0,M=Ye(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=L.get(p.parentId)),_&&p.extent==="parent"&&(M=[[0,0],[_.measured.width,_.measured.height]]),N=[],I=void 0;for(const[V,O]of L)if(O.parentId===t&&(N.push({id:V,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const H=uf(O,p,O.origin??S);I?I=[[Math.min(H[0][0],I[0][0]),Math.min(H[0][1],I[0][1])],[Math.max(H[1][0],I[1][0]),Math.max(H[1][1],I[1][1])]]:I=H}h?.(z,{...m})}).on("drag",z=>{const{transform:L,snapGrid:T,snapToGrid:x,nodeOrigin:E}=n(),S=ht(z.sourceEvent,{transform:L,snapGrid:T,snapToGrid:x,containerBounds:v}),k=[];if(!p)return;const{x:D,y:P,width:V,height:O}=m,H={},Y=p.origin??E,{width:F,height:W,x:Q,y:q}=cf(b,s.controlDirection,S,s.boundaries,s.keepAspectRatio,Y,M,I),R=F!==V,j=W!==O,U=Q!==D&&R,K=q!==P&&j;if(!U&&!K&&!R&&!j)return;if((U||K||Y[0]===1||Y[1]===1)&&(H.x=U?Q:m.x,H.y=K?q:m.y,m.x=H.x,m.y=H.y,N.length>0)){const te=Q-D,oe=q-P;for(const ae of N)ae.position={x:ae.position.x-te+Y[0]*(F-V),y:ae.position.y-oe+Y[1]*(W-O)},k.push(ae)}if((R||j)&&(H.width=R&&(!s.resizeDirection||s.resizeDirection==="horizontal")?F:m.width,H.height=j&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=H.width,m.height=H.height),_&&p.expandParent){const te=Y[0]*(H.width??0);H.x&&H.x<te&&(m.x=te,b.x=b.x-(H.x-te));const oe=Y[1]*(H.height??0);H.y&&H.y<oe&&(m.y=oe,b.y=b.y-(H.y-oe))}const Z=af({width:m.width,prevWidth:V,height:m.height,prevHeight:O,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:Z};y?.(z,G)!==!1&&(A=!0,g?.(z,G),o(H,k))}).on("end",z=>{A&&(w?.(z,{...m}),r?.({...m}),A=!1)});i.call(B)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var _n={exports:{}},En={},Sn={exports:{}},Nn={};var Jo;function ff(){if(Jo)return Nn;Jo=1;var e=Pr();function t(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(u,f){var h=f(),g=o({inst:{value:h,getSnapshot:f}}),w=g[0].inst,y=g[1];return i(function(){w.value=h,w.getSnapshot=f,l(w)&&y({inst:w})},[u,h,f]),r(function(){return l(w)&&y({inst:w}),u(function(){l(w)&&y({inst:w})})},[u]),s(h),h}function l(u){var f=u.getSnapshot;u=u.value;try{var h=f();return!n(u,h)}catch{return!0}}function d(u,f){return f()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:a;return Nn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:c,Nn}var er;function hf(){return er||(er=1,Sn.exports=ff()),Sn.exports}var tr;function gf(){if(tr)return En;tr=1;var e=Pr(),t=hf();function n(d,c){return d===c&&(d!==0||1/d===1/c)||d!==d&&c!==c}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return En.useSyncExternalStoreWithSelector=function(d,c,u,f,h){var g=i(null);if(g.current===null){var w={hasValue:!1,value:null};g.current=w}else w=g.current;g=a(function(){function m(_){if(!b){if(b=!0,p=_,_=f(_),h!==void 0&&w.hasValue){var M=w.value;if(h(M,_))return v=M}return v=_}if(M=v,o(p,_))return M;var I=f(_);return h!==void 0&&h(M,I)?(p=_,M):(p=_,v=I)}var b=!1,p,v,N=u===void 0?null:u;return[function(){return m(c())},N===null?void 0:function(){return m(N())}]},[c,u,f,h]);var y=r(d,g[0],g[1]);return s(function(){w.hasValue=!0,w.value=y},[y]),l(y),y},En}var nr;function pf(){return nr||(nr=1,_n.exports=gf()),_n.exports}var mf=pf();const yf=Ca(mf),xf={},or=e=>{let t;const n=new Set,o=(c,u)=>{const f=typeof c=="function"?c(t):c;if(!Object.is(f,t)){const h=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>d,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(xf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(o,r,l);return l},wf=e=>e?or(e):or,{useDebugValue:vf}=Ma,{useSyncExternalStoreWithSelector:bf}=yf,_f=e=>e;function Oi(e,t=_f,n){const o=bf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return vf(o),o}const rr=(e,t)=>{const n=wf(e),o=(r,i=t)=>Oi(n,r,i);return Object.assign(o,n),o},Ef=(e,t)=>e?rr(e,t):rr;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 ln=$.createContext(null),Sf=ln.Provider,Vi=me.error001("react");function ee(e,t){const n=$.useContext(ln);if(n===null)throw new Error(Vi);return Oi(n,e,t)}function ne(){const e=$.useContext(ln);if(e===null)throw new Error(Vi);return $.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const ir={display:"none"},Nf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Bi="react-flow__node-desc",ji="react-flow__edge-desc",Cf="react-flow__aria-live",Mf=e=>e.ariaLiveMessage,kf=e=>e.ariaLabelConfig;function If({rfId:e}){const t=ee(Mf);return C.jsx("div",{id:`${Cf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Nf,children:t})}function Af({rfId:e,disableKeyboardA11y:t}){const n=ee(kf);return C.jsxs(C.Fragment,{children:[C.jsx("div",{id:`${Bi}-${e}`,style:ir,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),C.jsx("div",{id:`${ji}-${e}`,style:ir,children:n["edge.a11yDescription.default"]}),!t&&C.jsx(If,{rfId:e})]})}const rt=$.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return C.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});rt.displayName="Panel";const sr="https://reactflow.dev?utm_source=attribution";function $f({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:C.jsx(rt,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${sr}`,children:C.jsx("a",{href:sr,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Pf=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}},Ht=e=>e.id;function Df(e,t){return re(e.selectedNodes.map(Ht),t.selectedNodes.map(Ht))&&re(e.selectedEdges.map(Ht),t.selectedEdges.map(Ht))}function zf({onSelectionChange:e}){const t=ne(),{selectedNodes:n,selectedEdges:o}=ee(Pf,Df);return $.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const Tf=e=>!!e.onSelectionChangeHandlers;function Rf({onSelectionChange:e}){const t=ee(Tf);return e||t?C.jsx(zf,{onSelectionChange:e}):null}const Fi=[0,0],Hf={x:0,y:0,zoom:1},Lf=["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"],ar=[...Lf,"rfId"],Of=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}),cr={translateExtent:xt,nodeOrigin:Fi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Vf(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l}=ee(Of,re),d=ne();$.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{c.current=cr,a()}),[]);const c=$.useRef(cr);return $.useEffect(()=>{for(const u of ar){const f=e[u],h=c.current[u];f!==h&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?o(f):u==="maxZoom"?r(f):u==="translateExtent"?i(f):u==="nodeExtent"?s(f):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:Ed(f)}):u==="fitView"?d.setState({fitViewQueued:f}):u==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[u]:f})))}c.current=e},ar.map(u=>e[u])),null}function lr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Bf(e){const[t,n]=$.useState(e==="system"?null:e);return $.useEffect(()=>{if(e!=="system"){n(e);return}const o=lr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:lr()?.matches?"dark":"light"}const ur=typeof document<"u"?document:null;function Et(e=null,t={target:ur,actInsideInputWithModifier:!0}){const[n,o]=$.useState(!1),r=$.useRef(!1),i=$.useRef(new Set([])),[s,a]=$.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`