showai-reader 0.10.0-reader.65k4byku → 0.10.0-reader.7ttebdmo
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/chunks/CardGrid-6WXY2OUD.js +2 -0
- package/chunks/CommandReference-CKBSDW6N.js +3 -0
- package/chunks/ComparisonMatrix-LFBHHO3A.js +1 -0
- package/chunks/{EventTimeline-JOTYNIMI.js → EventTimeline-TS5HI5GA.js} +1 -1
- package/chunks/{ExperimentTracker-CWZCU2QO.js → ExperimentTracker-MSRAHV5J.js} +1 -1
- package/chunks/{ExternalDiagram-WFWITA4Q.js → ExternalDiagram-B6TDNZM4.js} +3 -3
- package/chunks/{Flowchart-DJGFXDXU.js → Flowchart-FDIMKFEA.js} +1 -1
- package/chunks/{G2Chart-YVTXVVRZ.js → G2Chart-QP5UF6HK.js} +2 -2
- package/chunks/LayerDiagram-HTH3JN4D.js +2 -0
- package/chunks/{Mindmap-SB34H5SG.js → Mindmap-6NWSYUKU.js} +1 -1
- package/chunks/RichTextEditor-AC7S457D.js +156 -0
- package/chunks/{Roadmap-BSPT5PBK.js → Roadmap-QWD7IZHX.js} +1 -1
- package/chunks/{Scene3D-VILMVRHH.js → Scene3D-Q5MGPU3X.js} +2 -2
- package/chunks/SequenceDiagram-WA7DFSY3.js +2 -0
- package/chunks/StatusTree-EHNSDOVH.js +1 -0
- package/chunks/StepGuide-UE7JVBQD.js +1 -0
- package/chunks/StructureBrowser-DG3TSDJF.js +3 -0
- package/chunks/{Waterfall-FIQDQSMD.js → Waterfall-A5MPISUU.js} +1 -1
- package/chunks/chunk-7K7GQKOA.js +1 -0
- package/chunks/{chunk-ISEW5ABW.js → chunk-7ZRIRZ4A.js} +1 -1
- package/chunks/chunk-ECJLHLTK.js +8 -0
- package/chunks/{chunk-TFZIEWR5.js → chunk-GABDVURY.js} +1 -1
- package/chunks/{chunk-VUDDBRCY.js → chunk-JAQUAFGK.js} +2 -2
- package/chunks/{chunk-5HKZMSJF.js → chunk-NLCSXEUT.js} +1 -1
- package/chunks/{chunk-DTW4F4AN.js → chunk-NWWWOZDQ.js} +1 -1
- package/chunks/{chunk-7FHZWI2R.js → chunk-PTZCSSDG.js} +1 -1
- package/chunks/{chunk-5SAGHDIJ.js → chunk-R2RMNI2B.js} +1 -1
- package/chunks/{chunk-X6OHYKIW.js → chunk-RHJ236MQ.js} +1 -1
- package/chunks/chunk-WLKJ25NO.js +1 -0
- package/chunks/chunk-WRXJZR6G.js +349 -0
- package/chunks/{chunk-6WTBCWHP.js.LEGAL.txt → chunk-WRXJZR6G.js.LEGAL.txt} +3 -0
- package/chunks/chunk-YOGTJ6FI.js +4 -0
- package/index.js +1 -1
- package/manifest.json +4 -4
- package/package.json +1 -1
- package/reader-7TTEBDMO.js +52 -0
- package/chunks/CardGrid-CXO2U3K5.js +0 -2
- package/chunks/CommandReference-E5Y6VMXC.js +0 -3
- package/chunks/ComparisonMatrix-TXTUZF55.js +0 -1
- package/chunks/LayerDiagram-KDSBIPHG.js +0 -2
- package/chunks/RichTextEditor-SMQMXUUN.js +0 -156
- package/chunks/SequenceDiagram-W2YQCHNV.js +0 -2
- package/chunks/StatusTree-57AOX2U2.js +0 -1
- package/chunks/StepGuide-VQRICGFO.js +0 -1
- package/chunks/StructureBrowser-PVPAFYTN.js +0 -3
- package/chunks/chunk-55FJSXTX.js +0 -1
- package/chunks/chunk-6WTBCWHP.js +0 -23
- package/chunks/chunk-7TNODUAV.js +0 -4
- package/chunks/chunk-GREB3PFJ.js +0 -329
- package/chunks/chunk-UWAAPX6Y.js +0 -1
- package/reader-65K4BYKU.js +0 -51
- /package/chunks/{G2Chart-YVTXVVRZ.js.LEGAL.txt → G2Chart-QP5UF6HK.js.LEGAL.txt} +0 -0
- /package/chunks/{Scene3D-VILMVRHH.js.LEGAL.txt → Scene3D-Q5MGPU3X.js.LEGAL.txt} +0 -0
- /package/chunks/{chunk-VUDDBRCY.js.LEGAL.txt → chunk-JAQUAFGK.js.LEGAL.txt} +0 -0
- /package/{reader-65K4BYKU.js.LEGAL.txt → reader-7TTEBDMO.js.LEGAL.txt} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as st,b as Tn,e as On,g as Ko,h as Go,i as Vt,j as Uo,k as Qo,l as at,o as jo,p as Jo,q as $n}from"./chunk-P5ET5XMK.js";import{a as Ho,b as Lo,c as Yo,d as Xo}from"./chunk-KYWOOES7.js";import{d as Vo,e as Fo}from"./chunk-7FHZWI2R.js";import{b as Il}from"./chunk-VUDDBRCY.js";import"./chunk-5AW2WUSZ.js";import{d as Zo,e as Wo,f as qo}from"./chunk-UWAAPX6Y.js";import{A as zo,Aa as Oo,B as Po,Fa as $o,a as Bt,c as Dn,ib as Ro,jb as An,kb as Ml,mb as Me,pa as Do,ra as Ao,za as To}from"./chunk-6WTBCWHP.js";import{a as Bo}from"./chunk-J6IRWTF7.js";import{c as Te}from"./chunk-DCANE7XH.js";var oe=Te(Dn(),1);var z=Te(An()),P=Te(Dn());function ae(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=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ft="http://www.w3.org/1999/xhtml",Rn={svg:"http://www.w3.org/2000/svg",xhtml:Ft,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ie(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rn.hasOwnProperty(t)?{space:Rn[t],local:e}:e}function zl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ft&&t.documentElement.namespaceURI===Ft?t.createElement(e):t.createElementNS(n,e)}}function Pl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Yt(e){var t=Ie(e);return(t.local?Pl:zl)(t)}function Dl(){}function Ke(e){return e==null?Dl:function(){return this.querySelector(e)}}function er(e){typeof e!="function"&&(e=Ke(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,l,u=0;u<s;++u)(c=i[u])&&(l=e.call(c,c.__data__,u,i))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(o,this._parents)}function Hn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Al(){return[]}function kt(e){return e==null?Al:function(){return this.querySelectorAll(e)}}function Tl(e){return function(){return Hn(e.apply(this,arguments))}}function tr(e){typeof e=="function"?e=Tl(e):e=kt(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new le(o,r)}function _t(e){return function(){return this.matches(e)}}function Xt(e){return function(t){return t.matches(e)}}var Ol=Array.prototype.find;function $l(e){return function(){return Ol.call(this.children,e)}}function Rl(){return this.firstElementChild}function nr(e){return this.select(e==null?Rl:$l(typeof e=="function"?e:Xt(e)))}var Hl=Array.prototype.filter;function Ll(){return Array.from(this.children)}function Bl(e){return function(){return Hl.call(this.children,e)}}function or(e){return this.selectAll(e==null?Ll:Bl(typeof e=="function"?e:Xt(e)))}function rr(e){typeof e!="function"&&(e=_t(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(o,this._parents)}function Zt(e){return new Array(e.length)}function ir(){return new le(this._enter||this._groups.map(Zt),this._parents)}function St(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}St.prototype={constructor:St,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 sr(e){return function(){return e}}function Vl(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new St(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function Fl(e,t,n,o,r,i,s){var a,c,l=new Map,u=t.length,f=i.length,d=new Array(u),p;for(a=0;a<u;++a)(c=t[a])&&(d[a]=p=s.call(c,c.__data__,a,t)+"",l.has(p)?r[a]=c:l.set(p,c));for(a=0;a<f;++a)p=s.call(e,i[a],a,i)+"",(c=l.get(p))?(o[a]=c,c.__data__=i[a],l.delete(p)):n[a]=new St(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(r[a]=c)}function Yl(e){return e.__data__}function ar(e,t){if(!arguments.length)return Array.from(this,Yl);var n=t?Fl:Vl,o=this._parents,r=this._groups;typeof e!="function"&&(e=sr(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var u=o[l],f=r[l],d=f.length,p=Xl(e.call(u,u&&u.__data__,l,o)),h=p.length,w=a[l]=new Array(h),b=s[l]=new Array(h),m=c[l]=new Array(d);n(u,f,w,b,m,p,t);for(var k=0,g=0,x,E;k<h;++k)if(x=w[k]){for(k>=g&&(g=k+1);!(E=b[g])&&++g<h;);x._next=E||null}}return s=new le(s,o),s._enter=a,s._exit=c,s}function Xl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lr(){return new le(this._exit||this._groups.map(Zt),this._parents)}function cr(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 dr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],u=o[c],f=l.length,d=a[c]=new Array(f),p,h=0;h<f;++h)(p=l[h]||u[h])&&(d[h]=p);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function ur(){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 fr(e){e||(e=Zl);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new le(r,this._parents).order()}function Zl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hr(){return Array.from(this)}function gr(){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 mr(){let e=0;for(let t of this)++e;return e}function yr(){return!this.node()}function br(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 Wl(e){return function(){this.removeAttribute(e)}}function ql(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kl(e,t){return function(){this.setAttribute(e,t)}}function Gl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ul(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ql(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 xr(e,t){var n=Ie(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?ql:Wl:typeof t=="function"?n.local?Ql:Ul:n.local?Gl:Kl)(n,t))}function Wt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function jl(e){return function(){this.style.removeProperty(e)}}function Jl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ec(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function wr(e,t,n){return arguments.length>1?this.each((t==null?jl:typeof t=="function"?ec:Jl)(e,t,n??"")):Oe(this.node(),e)}function Oe(e,t){return e.style.getPropertyValue(t)||Wt(e).getComputedStyle(e,null).getPropertyValue(t)}function tc(e){return function(){delete this[e]}}function nc(e,t){return function(){this[e]=t}}function oc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function vr(e,t){return arguments.length>1?this.each((t==null?tc:typeof t=="function"?oc:nc)(e,t)):this.node()[e]}function kr(e){return e.trim().split(/^|\s+/)}function Ln(e){return e.classList||new _r(e)}function _r(e){this._node=e,this._names=kr(e.getAttribute("class")||"")}_r.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Sr(e,t){for(var n=Ln(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Er(e,t){for(var n=Ln(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function rc(e){return function(){Sr(this,e)}}function ic(e){return function(){Er(this,e)}}function sc(e,t){return function(){(t.apply(this,arguments)?Sr:Er)(this,e)}}function Nr(e,t){var n=kr(e+"");if(arguments.length<2){for(var o=Ln(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?sc:t?rc:ic)(n,t))}function ac(){this.textContent=""}function lc(e){return function(){this.textContent=e}}function cc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Cr(e){return arguments.length?this.each(e==null?ac:(typeof e=="function"?cc:lc)(e)):this.node().textContent}function dc(){this.innerHTML=""}function uc(e){return function(){this.innerHTML=e}}function fc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Mr(e){return arguments.length?this.each(e==null?dc:(typeof e=="function"?fc:uc)(e)):this.node().innerHTML}function pc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ir(){return this.each(pc)}function hc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zr(){return this.each(hc)}function Pr(e){var t=typeof e=="function"?e:Yt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function gc(){return null}function Dr(e,t){var n=typeof e=="function"?e:Yt(e),o=t==null?gc:typeof t=="function"?t:Ke(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function mc(){var e=this.parentNode;e&&e.removeChild(this)}function Ar(){return this.each(mc)}function yc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tr(e){return this.select(e?bc:yc)}function Or(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xc(e){return function(t){e.call(this,t,this.__data__)}}function wc(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 vc(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 kc(e,t,n){return function(){var o=this.__on,r,i=xc(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 $r(e,t,n){var o=wc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?kc:vc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Rr(e,t,n){var o=Wt(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 _c(e,t){return function(){return Rr(this,e,t)}}function Sc(e,t){return function(){return Rr(this,e,t.apply(this,arguments))}}function Hr(e,t){return this.each((typeof t=="function"?Sc:_c)(e,t))}function*Lr(){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 Bn=[null];function le(e,t){this._groups=e,this._parents=t}function Br(){return new le([[document.documentElement]],Bn)}function Ec(){return this}le.prototype=Br.prototype={constructor:le,select:er,selectAll:tr,selectChild:nr,selectChildren:or,filter:rr,data:ar,enter:ir,exit:lr,join:cr,merge:dr,selection:Ec,order:ur,sort:fr,call:pr,nodes:hr,node:gr,size:mr,empty:yr,each:br,attr:xr,style:wr,property:vr,classed:Nr,text:Cr,html:Mr,raise:Ir,lower:zr,append:Pr,insert:Dr,remove:Ar,clone:Tr,datum:Or,on:$r,dispatch:Hr,[Symbol.iterator]:Lr};var ze=Br;function de(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Bn)}function Vr(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=Vr(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]}var Fr={passive:!1},Ge={capture:!0,passive:!1};function qt(e){e.stopImmediatePropagation()}function $e(e){e.preventDefault(),e.stopImmediatePropagation()}function Et(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",$e,Ge);"onselectstart"in t?n.on("selectstart.drag",$e,Ge):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Nt(e,t){var n=e.document.documentElement,o=de(e).on("dragstart.drag",null);t&&(o.on("click.drag",$e,Ge),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Ct=e=>()=>e;function Mt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Mt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Nc(e){return!e.ctrlKey&&!e.button}function Cc(){return this.parentNode}function Mc(e,t){return t??{x:e.x,y:e.y}}function Ic(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kt(){var e=Nc,t=Cc,n=Mc,o=Ic,r={},i=st("start","drag","end"),s=0,a,c,l,u,f=0;function d(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",b).on("touchmove.drag",m,Fr).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,E){if(!(u||!e.call(this,x,E))){var S=g(this,t.call(this,x,E),x,E,"mouse");S&&(de(x.view).on("mousemove.drag",h,Ge).on("mouseup.drag",w,Ge),Et(x.view),qt(x),l=!1,a=x.clientX,c=x.clientY,S("start",x))}}function h(x){if($e(x),!l){var E=x.clientX-a,S=x.clientY-c;l=E*E+S*S>f}r.mouse("drag",x)}function w(x){de(x.view).on("mousemove.drag mouseup.drag",null),Nt(x.view,l),$e(x),r.mouse("end",x)}function b(x,E){if(e.call(this,x,E)){var S=x.changedTouches,N=t.call(this,x,E),T=S.length,I,V;for(I=0;I<T;++I)(V=g(this,N,x,E,S[I].identifier,S[I]))&&(qt(x),V("start",x,S[I]))}}function m(x){var E=x.changedTouches,S=E.length,N,T;for(N=0;N<S;++N)(T=r[E[N].identifier])&&($e(x),T("drag",x,E[N]))}function k(x){var E=x.changedTouches,S=E.length,N,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(T=r[E[N].identifier])&&(qt(x),T("end",x,E[N]))}function g(x,E,S,N,T,I){var V=i.copy(),$=pe(I||S,E),B,M,y;if((y=n.call(x,new Mt("beforestart",{sourceEvent:S,target:d,identifier:T,active:s,x:$[0],y:$[1],dx:0,dy:0,dispatch:V}),N))!=null)return B=y.x-$[0]||0,M=y.y-$[1]||0,function v(_,C,D){var A=$,L;switch(_){case"start":r[T]=v,L=s++;break;case"end":delete r[T],--s;case"drag":$=pe(D||C,E),L=s;break}V.call(_,x,new Mt(_,{sourceEvent:C,subject:y,target:d,identifier:T,active:L,x:$[0]+B,y:$[1]+M,dx:$[0]-A[0],dy:$[1]-A[1],dispatch:V}),N)}}return d.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Ct(!!x),d):e},d.container=function(x){return arguments.length?(t=typeof x=="function"?x:Ct(x),d):t},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:Ct(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:Ct(!!x),d):o},d.on=function(){var x=i.on.apply(i,arguments);return x===i?d:x},d.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,d):Math.sqrt(f)},d}var zc=st("start","end","cancel","interrupt"),Pc=[],Zr=0,Yr=1,Ut=2,Gt=3,Xr=4,Qt=5,It=6;function Re(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Dc(e,n,{name:t,index:o,group:r,on:zc,tween:Pc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zr})}function zt(e,t){var n=ce(e,t);if(n.state>Zr)throw new Error("too late; already scheduled");return n}function fe(e,t){var n=ce(e,t);if(n.state>Gt)throw new Error("too late; already running");return n}function ce(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Dc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Jo(i,0,n.time);function i(l){n.state=Yr,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,p;if(n.state!==Yr)return c();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Gt)return $n(s);p.state===Xr?(p.state=It,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=It,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if($n(function(){n.state===Gt&&(n.state=Xr,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Ut,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ut){for(n.state=Gt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=p);r.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Qt,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===Qt&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=It,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Ue(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>Ut&&o.state<Qt,o.state=It,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Wr(e){return this.each(function(){Ue(this,e)})}function Ac(e,t){var n,o;return function(){var r=fe(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 Tc(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=fe(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function qr(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ce(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?Ac:Tc)(n,e,t))}function lt(e,t,n){var o=e._id;return e.each(function(){var r=fe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ce(r,o).value[t]}}function jt(e,t){var n;return(typeof t=="number"?Ko:t instanceof Tn?On:(n=Tn(t))?(t=n,On):Go)(e,t)}function Oc(e){return function(){this.removeAttribute(e)}}function $c(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Rc(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 Hc(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 Lc(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Bc(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Kr(e,t){var n=Ie(e),o=n==="transform"?Qo:jt;return this.attrTween(e,typeof t=="function"?(n.local?Bc:Lc)(n,o,lt(this,"attr."+e,t)):t==null?(n.local?$c:Oc)(n):(n.local?Hc:Rc)(n,o,t))}function Vc(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Fc(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Fc(e,i)),n}return r._value=t,r}function Xc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Vc(e,i)),n}return r._value=t,r}function Gr(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=Ie(e);return this.tween(n,(o.local?Yc:Xc)(o,t))}function Zc(e,t){return function(){zt(this,e).delay=+t.apply(this,arguments)}}function Wc(e,t){return t=+t,function(){zt(this,e).delay=t}}function Ur(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Zc:Wc)(t,e)):ce(this.node(),t).delay}function qc(e,t){return function(){fe(this,e).duration=+t.apply(this,arguments)}}function Kc(e,t){return t=+t,function(){fe(this,e).duration=t}}function Qr(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?qc:Kc)(t,e)):ce(this.node(),t).duration}function Gc(e,t){if(typeof t!="function")throw new Error;return function(){fe(this,e).ease=t}}function jr(e){var t=this._id;return arguments.length?this.each(Gc(t,e)):ce(this.node(),t).ease}function Uc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fe(this,e).ease=n}}function Jr(e){if(typeof e!="function")throw new Error;return this.each(Uc(this._id,e))}function ei(e){typeof e!="function"&&(e=_t(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new he(o,this._parents,this._name,this._id)}function ti(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,p=0;p<u;++p)(d=c[p]||l[p])&&(f[p]=d);for(;a<o;++a)s[a]=t[a];return new he(s,this._parents,this._name,this._id)}function Qc(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 jc(e,t,n){var o,r,i=Qc(t)?zt:fe;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function ni(e,t){var n=this._id;return arguments.length<2?ce(this.node(),n).on.on(e):this.each(jc(n,e,t))}function Jc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function oi(){return this.on("end.remove",Jc(this._id))}function ri(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ke(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Re(l[d],t,n,d,l,ce(u,n)));return new he(i,this._parents,t,n)}function ii(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kt(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),p,h=ce(u,n),w=0,b=d.length;w<b;++w)(p=d[w])&&Re(p,t,n,w,d,h);i.push(d),s.push(u)}return new he(i,s,t,n)}var ed=ze.prototype.constructor;function si(){return new ed(this._groups,this._parents)}function td(e,t){var n,o,r;return function(){var i=Oe(this,e),s=(this.style.removeProperty(e),Oe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function ai(e){return function(){this.style.removeProperty(e)}}function nd(e,t,n){var o,r=n+"",i;return function(){var s=Oe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function od(e,t,n){var o,r,i;return function(){var s=Oe(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Oe(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function rd(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=fe(this,e),l=c.on,u=c.value[i]==null?a||(a=ai(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),c.on=o}}function li(e,t,n){var o=(e+="")=="transform"?Uo:jt;return t==null?this.styleTween(e,td(e,o)).on("end.style."+e,ai(e)):typeof t=="function"?this.styleTween(e,od(e,o,lt(this,"style."+e,t))).each(rd(this._id,e)):this.styleTween(e,nd(e,o,t),n).on("end.style."+e,null)}function id(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function sd(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&id(e,s,n)),o}return i._value=t,i}function ci(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,sd(e,t,n??""))}function ad(e){return function(){this.textContent=e}}function ld(e){return function(){var t=e(this);this.textContent=t??""}}function di(e){return this.tween("text",typeof e=="function"?ld(lt(this,"text",e)):ad(e==null?"":e+""))}function cd(e){return function(t){this.textContent=e.call(this,t)}}function dd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&cd(r)),t}return o._value=e,o}function ui(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,dd(e))}function fi(){for(var e=this._name,t=this._id,n=Jt(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=ce(c,t);Re(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new he(o,this._parents,e,n)}function pi(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=fe(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var ud=0;function he(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function hi(e){return ze().transition(e)}function Jt(){return++ud}var Pe=ze.prototype;he.prototype=hi.prototype={constructor:he,select:ri,selectAll:ii,selectChild:Pe.selectChild,selectChildren:Pe.selectChildren,filter:ei,merge:ti,selection:si,transition:fi,call:Pe.call,nodes:Pe.nodes,node:Pe.node,size:Pe.size,empty:Pe.empty,each:Pe.each,on:ni,attr:Kr,attrTween:Gr,style:li,styleTween:ci,text:di,textTween:ui,remove:oi,tween:qr,delay:Ur,duration:Qr,ease:jr,easeVarying:Jr,end:pi,[Symbol.iterator]:Pe[Symbol.iterator]};function en(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fd={time:null,delay:0,duration:250,ease:en};function pd(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 gi(e){var t,n;e instanceof he?(t=e._id,e=e._name):(t=Jt(),(n=fd).time=jo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Re(c,e,t,l,s,n||pd(c,t));return new he(o,this._parents,e,t)}ze.prototype.interrupt=Wr;ze.prototype.transition=gi;var Pt=e=>()=>e;function Vn(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 we(e,t,n){this.k=e,this.x=t,this.y=n}we.prototype={constructor:we,scale:function(e){return e===1?this:new we(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new we(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 Qe=new we(1,0,0);Dt.prototype=we.prototype;function Dt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Qe;return e.__zoom}function tn(e){e.stopImmediatePropagation()}function ct(e){e.preventDefault(),e.stopImmediatePropagation()}function hd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function gd(){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 mi(){return this.__zoom||Qe}function md(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yd(){return navigator.maxTouchPoints||"ontouchstart"in this}function bd(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 nn(){var e=hd,t=gd,n=bd,o=md,r=yd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=at,l=st("start","zoom","end"),u,f,d,p=500,h=150,w=0,b=10;function m(y){y.property("__zoom",mi).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,v,_,C){var D=y.selection?y.selection():y;D.property("__zoom",mi),y!==D?E(y,v,_,C):D.interrupt().each(function(){S(this,arguments).event(C).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},m.scaleBy=function(y,v,_,C){m.scaleTo(y,function(){var D=this.__zoom.k,A=typeof v=="function"?v.apply(this,arguments):v;return D*A},_,C)},m.scaleTo=function(y,v,_,C){m.transform(y,function(){var D=t.apply(this,arguments),A=this.__zoom,L=_==null?x(D):typeof _=="function"?_.apply(this,arguments):_,H=A.invert(L),F=typeof v=="function"?v.apply(this,arguments):v;return n(g(k(A,F),L,H),D,s)},_,C)},m.translateBy=function(y,v,_,C){m.transform(y,function(){return n(this.__zoom.translate(typeof v=="function"?v.apply(this,arguments):v,typeof _=="function"?_.apply(this,arguments):_),t.apply(this,arguments),s)},null,C)},m.translateTo=function(y,v,_,C,D){m.transform(y,function(){var A=t.apply(this,arguments),L=this.__zoom,H=C==null?x(A):typeof C=="function"?C.apply(this,arguments):C;return n(Qe.translate(H[0],H[1]).scale(L.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof _=="function"?-_.apply(this,arguments):-_),A,s)},C,D)};function k(y,v){return v=Math.max(i[0],Math.min(i[1],v)),v===y.k?y:new we(v,y.x,y.y)}function g(y,v,_){var C=v[0]-_[0]*y.k,D=v[1]-_[1]*y.k;return C===y.x&&D===y.y?y:new we(y.k,C,D)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function E(y,v,_,C){y.on("start.zoom",function(){S(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(C).end()}).tween("zoom",function(){var D=this,A=arguments,L=S(D,A).event(C),H=t.apply(D,A),F=_==null?x(H):typeof _=="function"?_.apply(D,A):_,K=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),Y=D.__zoom,G=typeof v=="function"?v.apply(D,A):v,ee=c(Y.invert(F).concat(K/Y.k),G.invert(F).concat(K/G.k));return function(q){if(q===1)q=G;else{var R=ee(q),Z=K/R[2];q=new we(Z,F[0]-R[0]*Z,F[1]-R[1]*Z)}L.zoom(null,q)}})}function S(y,v,_){return!_&&y.__zooming||new N(y,v)}function N(y,v){this.that=y,this.args=v,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,v),this.taps=0}N.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,v){return this.mouse&&y!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=v.invert(this.touch1[0])),this.that.__zoom=v,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var v=de(this.that).datum();l.call(y,this.that,new Vn(y,{sourceEvent:this.sourceEvent,target:m,type:y,transform:this.that.__zoom,dispatch:l}),v)}};function T(y,...v){if(!e.apply(this,arguments))return;var _=S(this,v).event(y),C=this.__zoom,D=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,o.apply(this,arguments)))),A=pe(y);if(_.wheel)(_.mouse[0][0]!==A[0]||_.mouse[0][1]!==A[1])&&(_.mouse[1]=C.invert(_.mouse[0]=A)),clearTimeout(_.wheel);else{if(C.k===D)return;_.mouse=[A,C.invert(A)],Ue(this),_.start()}ct(y),_.wheel=setTimeout(L,h),_.zoom("mouse",n(g(k(C,D),_.mouse[0],_.mouse[1]),_.extent,s));function L(){_.wheel=null,_.end()}}function I(y,...v){if(d||!e.apply(this,arguments))return;var _=y.currentTarget,C=S(this,v,!0).event(y),D=de(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",K,!0),A=pe(y,_),L=y.clientX,H=y.clientY;Et(y.view),tn(y),C.mouse=[A,this.__zoom.invert(A)],Ue(this),C.start();function F(Y){if(ct(Y),!C.moved){var G=Y.clientX-L,ee=Y.clientY-H;C.moved=G*G+ee*ee>w}C.event(Y).zoom("mouse",n(g(C.that.__zoom,C.mouse[0]=pe(Y,_),C.mouse[1]),C.extent,s))}function K(Y){D.on("mousemove.zoom mouseup.zoom",null),Nt(Y.view,C.moved),ct(Y),C.event(Y).end()}}function V(y,...v){if(e.apply(this,arguments)){var _=this.__zoom,C=pe(y.changedTouches?y.changedTouches[0]:y,this),D=_.invert(C),A=_.k*(y.shiftKey?.5:2),L=n(g(k(_,A),C,D),t.apply(this,v),s);ct(y),a>0?de(this).transition().duration(a).call(E,L,C,y):de(this).call(m.transform,L,C,y)}}function $(y,...v){if(e.apply(this,arguments)){var _=y.touches,C=_.length,D=S(this,v,y.changedTouches.length===C).event(y),A,L,H,F;for(tn(y),L=0;L<C;++L)H=_[L],F=pe(H,this),F=[F,this.__zoom.invert(F),H.identifier],D.touch0?!D.touch1&&D.touch0[2]!==F[2]&&(D.touch1=F,D.taps=0):(D.touch0=F,A=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),A&&(D.taps<2&&(f=F[0],u=setTimeout(function(){u=null},p)),Ue(this),D.start())}}function B(y,...v){if(this.__zooming){var _=S(this,v).event(y),C=y.changedTouches,D=C.length,A,L,H,F;for(ct(y),A=0;A<D;++A)L=C[A],H=pe(L,this),_.touch0&&_.touch0[2]===L.identifier?_.touch0[0]=H:_.touch1&&_.touch1[2]===L.identifier&&(_.touch1[0]=H);if(L=_.that.__zoom,_.touch1){var K=_.touch0[0],Y=_.touch0[1],G=_.touch1[0],ee=_.touch1[1],q=(q=G[0]-K[0])*q+(q=G[1]-K[1])*q,R=(R=ee[0]-Y[0])*R+(R=ee[1]-Y[1])*R;L=k(L,Math.sqrt(q/R)),H=[(K[0]+G[0])/2,(K[1]+G[1])/2],F=[(Y[0]+ee[0])/2,(Y[1]+ee[1])/2]}else if(_.touch0)H=_.touch0[0],F=_.touch0[1];else return;_.zoom("touch",n(g(L,H,F),_.extent,s))}}function M(y,...v){if(this.__zooming){var _=S(this,v).event(y),C=y.changedTouches,D=C.length,A,L;for(tn(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),A=0;A<D;++A)L=C[A],_.touch0&&_.touch0[2]===L.identifier?delete _.touch0:_.touch1&&_.touch1[2]===L.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(L=pe(L,this),Math.hypot(f[0]-L[0],f[1]-L[1])<b)){var H=de(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:Pt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Pt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Pt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Pt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(w=(y=+y)*y,m):Math.sqrt(w)},m.tapDistance=function(y){return arguments.length?(b=+y,m):b},m}var ge={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.`},pt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Wn=["Enter"," ","Escape"],qn={"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"},Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var De;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(De||(De={}));var je;(function(e){e.Partial="partial",e.Full="full"})(je||(je={}));var Kn={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},_e;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(_e||(_e={}));var ut;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ut||(ut={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));var yi={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},Gn=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,zi=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Un=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Tt=(e,t=[0,0])=>{let{width:n,height:o}=be(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Qn=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,o=e.reduce((r,i)=>{let s=typeof i=="string",a=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(a=s?t.nodeLookup.get(i):Un(i)?i:t.nodeLookup.get(i.id)),a?(n=!0,cn(r,sn(a,t.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?dn(o):{x:0,y:0,width:0,height:0}},ht=(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=cn(n,sn(r)),o=!0)}),o?dn(n):{x:0,y:0,width:0,height:0}},an=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{let a=(t.x-n)/r,c=(t.y-o)/r,l=t.width/r,u=t.height/r,f=[];for(let d of e.values()){let{measured:p,selectable:h=!0,hidden:w=!1}=d;if(s&&!h||w)continue;let b=p.width??d.width??d.initialWidth??0,m=p.height??d.height??d.initialHeight??0,{x:k,y:g}=d.internals.positionAbsolute,x=Oi(a,c,l,u,k,g,b,m),E=b*m,S=i&&x>0;(!d.internals.handleBounds||S||x>=E||d.dragging)&&f.push(d)}return f},Pi=(e,t)=>{let n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function xd(e,t){let n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){let{width:s,height:a}=be(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 Di({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;let a=xd(e,s),c=ht(a),l=$t(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function jn({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){let s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o,f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ge.error005());else{let{width:p,height:h}=be(a);p&&h&&(f=[[c,l],[c+p,l+h]])}else a&&tt(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);let d=tt(f)?Je(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ge.error015()),{position:{x:d.x-c+(s.measured.width??0)*u[0],y:d.y-l+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function Ai({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let i=new Set(e.map(d=>d.id)),s=[];for(let d of n){if(d.deletable===!1)continue;let p=i.has(d.id),h=!p&&d.parentId&&s.find(w=>w.id===d.parentId);(p||h)&&s.push(d)}let a=new Set(t.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),u=Pi(s,c);for(let d of c)a.has(d.id)&&!u.find(h=>h.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};let f=await r({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}var ft=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Je=(e={x:0,y:0},t,n)=>({x:ft(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ft(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ti(e,t,n){let{width:o,height:r}=be(n),{x:i,y:s}=n.internals.positionAbsolute;return Je(e,[[i,s],[i+o,s+r]],t)}var bi=(e,t,n)=>e<t?ft(Math.abs(e-t),1,t)/t:e>n?-ft(Math.abs(e-n),1,t)/t:0,ln=(e,t,n=15,o=40)=>{let r=bi(e.x,o,t.width-o)*n,i=bi(e.y,o,t.height-o)*n;return[r,i]},cn=(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)}),Zn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),dn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),gt=(e,t=[0,0])=>{let{x:n,y:o}=Un(e)?e.internals.positionAbsolute:Tt(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}},sn=(e,t=[0,0])=>{let{x:n,y:o}=Un(e)?e.internals.positionAbsolute:Tt(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)}},Jn=(e,t)=>dn(cn(Zn(e),Zn(t))),Oi=(e,t,n,o,r,i,s,a)=>{let c=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),l=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(c*l)},Ot=(e,t)=>Oi(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),eo=e=>me(e.width)&&me(e.height)&&me(e.x)&&me(e.y),me=e=>!isNaN(e)&&isFinite(e),to=(e,t)=>(n,o)=>{},mt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return i?mt(a,s):a},et=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function dt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wd(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=dt(e,n),r=dt(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=dt(e.top??e.y??0,n),r=dt(e.bottom??e.y??0,n),i=dt(e.left??e.x??0,t),s=dt(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 vd(e,t,n,o,r,i){let{x:s,y:a}=et(e,[t,n,o]),{x:c,y:l}=et({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}var $t=(e,t,n,o,r,i)=>{let s=wd(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),u=ft(l,o,r),f=e.x+e.width/2,d=e.y+e.height/2,p=t/2-f*u,h=n/2-d*u,w=vd(e,p,h,u,t,n),b={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:p-b.left+b.right,y:h-b.top+b.bottom,zoom:u}},bt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function tt(e){return e!=null&&e!=="parent"}function be(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function un(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function no(e,t={width:0,height:0},n,o,r){let i={...e},s=o.get(n);if(s){let 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 oo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function $i(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Ri(e){return{...qn,...e||{}}}function ro(e){return e===null?null:e?"valid":"invalid"}function At(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:i,y:s}=ye(e),a=yt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?mt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}var fn=e=>({width:e.offsetWidth,height:e.offsetHeight}),io=e=>e?.getRootNode?.()||window?.document,kd=["INPUT","SELECT","TEXTAREA"];function so(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:kd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var ao=e=>"clientX"in e,ye=(e,t)=>{let n=ao(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)}},xi=(e,t,n,o,r)=>{let i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{let 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,...fn(s)}})};function pn({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){let c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,u=Math.abs(c-e),f=Math.abs(l-t);return[c,l,u,f]}function on(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-on(t-o,i),n];case X.Right:return[t+on(o-t,i),n];case X.Top:return[t,n-on(n-r,i)];case X.Bottom:return[t,n+on(r-n,i)]}}function hn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){let[a,c]=wi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=wi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,d,p,h]=pn({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${o},${r}`,f,d,p,h]}function lo({sourceX:e,sourceY:t,targetX:n,targetY:o}){let 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 Hi({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;let 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 Li({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let i=cn(sn(e),sn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);let s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Ot(s,dn(i))>0}var _d=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Sd=(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)),Bi=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ge.error006()),t;let o=n.getEdgeId||_d,r;return Gn(e)?r={...e}:r={...e,id:o(e)},Sd(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gn({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,i,s,a]=lo({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}var vi={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Ed=({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},ki=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Nd({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){let a=vi[t],c=vi[o],l={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},f=Ed({source:l,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",p=f[d],h=[],w,b,m={x:0,y:0},k={x:0,y:0},[,,g,x]=lo({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(w=r.x??l.x+(u.x-l.x)*s,b=r.y??(l.y+u.y)/2):(w=r.x??(l.x+u.x)/2,b=r.y??l.y+(u.y-l.y)*s);let T=[{x:w,y:l.y},{x:w,y:u.y}],I=[{x:l.x,y:b},{x:u.x,y:b}];a[d]===p?h=d==="x"?T:I:h=d==="x"?I:T}else{let T=[{x:l.x,y:u.y}],I=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===p?I:T:h=a.y===p?T:I,t===o){let y=Math.abs(e[d]-n[d]);if(y<=i){let v=Math.min(i-1,i-y);a[d]===p?m[d]=(l[d]>e[d]?-1:1)*v:k[d]=(u[d]>n[d]?-1:1)*v}}if(t!==o){let y=d==="x"?"y":"x",v=a[d]===c[y],_=l[y]>u[y],C=l[y]<u[y];(a[d]===1&&(!v&&_||v&&C)||a[d]!==1&&(!v&&C||v&&_))&&(h=d==="x"?T:I)}let V={x:l.x+m.x,y:l.y+m.y},$={x:u.x+k.x,y:u.y+k.y},B=Math.max(Math.abs(V.x-h[0].x),Math.abs($.x-h[0].x)),M=Math.max(Math.abs(V.y-h[0].y),Math.abs($.y-h[0].y));B>=M?(w=(V.x+$.x)/2,b=h[0].y):(w=h[0].x,b=(V.y+$.y)/2)}let E={x:l.x+m.x,y:l.y+m.y},S={x:u.x+k.x,y:u.y+k.y};return[[e,...E.x!==h[0].x||E.y!==h[0].y?[E]:[],...h,...S.x!==h[h.length-1].x||S.y!==h[h.length-1].y?[S]:[],n],w,b,g,x]}function Cd(e,t,n,o){let r=Math.min(ki(e,t)/2,ki(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){let l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*u}`}let a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function nt({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){let[f,d,p,h,w]=Nd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:u}),b=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)b+=Cd(f[m-1],f[m],f[m+1],s);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,d,p,h,w]}function _i(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Vi(e){let{sourceNode:t,targetNode:n}=e;if(!_i(t)||!_i(n))return null;let o=t.internals.handleBounds||Si(t.handles),r=n.internals.handleBounds||Si(n.handles),i=Ei(o?.source??[],e.sourceHandle),s=Ei(e.connectionMode===Ve.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ge.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=i?.position||X.Bottom,c=s?.position||X.Top,l=Fe(t,i,a),u=Fe(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function Si(e){if(!e)return null;let t=[],n=[];for(let 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 Fe(e,t,n=X.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??be(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 Ei(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function mn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Fi(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){let l=mn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}var Yi=1e3,Md=10,co={nodeOrigin:[0,0],nodeExtent:pt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Id={...co,checkEquality:!0};function uo(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Xi(e,t,n){let o=uo(co,n);for(let r of e.values())if(r.parentId)po(r,e,t,o);else{let i=Tt(r,o.nodeOrigin),s=tt(r.extent)?r.extent:o.nodeExtent,a=Je(i,s,be(r));r.internals.positionAbsolute=a}}function zd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let 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 fo(e){return e==="manual"}function yn(e,t,n,o={}){let r=uo(Id,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!fo(r.zIndexMode)?Yi:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let f=s.get(u.id);if(r.checkEquality&&u===f?.internals.userNode)t.set(u.id,f);else{let d=Tt(u,r.nodeOrigin),p=tt(u.extent)?u.extent:r.nodeExtent,h=Je(d,p,be(u));f={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:h,handleBounds:zd(u,f),z:Zi(u,a,r.zIndexMode),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),u.parentId&&po(f,t,n,o,i),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Pd(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function po(e,t,n,o,r){let{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=uo(co,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Pd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Md),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);let f=i&&!fo(c)?Yi:0,{x:d,y:p,z:h}=Dd(e,u,s,a,f,c),{positionAbsolute:w}=e.internals,b=d!==w.x||p!==w.y;(b||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:d,y:p}:w,z:h}})}function Zi(e,t,n){let o=me(e.zIndex)?e.zIndex:0;return fo(n)?o:o+(e.selected?t:0)}function Dd(e,t,n,o,r,i){let{x:s,y:a}=t.internals.positionAbsolute,c=be(e),l=Tt(e,n),u=tt(e.extent)?Je(l,e.extent,c):l,f=Je({x:s+u.x,y:a+u.y},o,c);e.extent==="parent"&&(f=Ti(f,c,t));let d=Zi(e,r,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=d?p+1:d}}function bn(e,t,n,o=[0,0]){let r=[],i=new Map;for(let s of e){let a=t.get(s.parentId);if(!a)continue;let c=i.get(s.parentId)?.expandedRect??gt(a),l=Jn(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{let l=a.internals.positionAbsolute,u=be(a),f=a.origin??o,d=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,p=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,h=Math.max(u.width,Math.round(s.width)),w=Math.max(u.height,Math.round(s.height)),b=(h-u.width)*f[0],m=(w-u.height)*f[1];(d>0||p>0||b||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-d+b,y:a.position.y-p+m}}),n.get(c)?.forEach(k=>{e.some(g=>g.id===k.id)||r.push({id:k.id,type:"position",position:{x:k.position.x+d,y:k.position.y+p}})})),(u.width<s.width||u.height<s.height||d||p)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?f[0]*d-b:0),height:w+(p?f[1]*p-m:0)}})}),r}function Wi(e,t,n,o,r,i,s){let a=o?.querySelector(".xyflow__viewport"),c=!1;if(!a)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(let p of e.values()){let h=t.get(p.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),c=!0;continue}let w=fn(p.nodeElement),b=h.measured.width!==w.width||h.measured.height!==w.height;if(!!(w.width&&w.height&&(b||!h.internals.handleBounds||p.force))){let k=p.nodeElement.getBoundingClientRect(),g=tt(h.extent)?h.extent:i,{positionAbsolute:x}=h.internals;if(h.parentId&&h.extent==="parent"){let S=t.get(h.parentId);S&&(x=Ti(x,w,S))}else g&&(x=Je(x,g,w));let E={...h,measured:w,internals:{...h.internals,positionAbsolute:x,handleBounds:{source:xi("source",p.nodeElement,k,f,h.id),target:xi("target",p.nodeElement,k,f,h.id)}}};t.set(h.id,E),h.parentId&&po(E,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,b&&(l.push({id:h.id,type:"dimensions",dimensions:w}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:gt(E,r)}))}}if(d.length>0){let p=bn(d,t,n,r);l.push(...p)}return{changes:l,updatedInternals:c}}async function qi({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;let 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 Ni(e,t,n,o,r,i){let s=r,a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;let c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;let l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function ho(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Ni("source",c,u,e,r,s),Ni("target",c,l,e,i,a),t.set(o.id,o)}}function Ki(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Ki(n,t):!1}function Ci(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 Ad(e,t,n,o){let r=new Map;for(let[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ki(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){let 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 Fn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[s,a]of t){let c=n.get(s)?.internals.userNode;c&&r.push({...c,position:a.position,dragging:o})}if(!e)return[r[0],r];let i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Td({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let i={x:n-r.distance.x,y:o-r.distance.y},s=mt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Gi({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},u=null,f=!1,d=null,p=!1,h=!1,w=null;function b({noDragClassName:k,handleSelector:g,domNode:x,isSelectable:E,nodeId:S,nodeClickDistance:N=0}){d=de(x);function T({x:B,y:M}){let{nodeLookup:y,nodeExtent:v,snapGrid:_,snapToGrid:C,nodeOrigin:D,onNodeDrag:A,onSelectionDrag:L,onError:H,updateNodePositions:F}=t();i={x:B,y:M};let K=!1,Y=a.size>1,G=Y&&v?Zn(ht(a)):null,ee=Y&&C?Td({dragItems:a,snapGrid:_,x:B,y:M}):null;for(let[q,R]of a){if(!y.has(q))continue;let Z={x:B-R.distance.x,y:M-R.distance.y};C&&(Z=ee?{x:Math.round(Z.x+ee.x),y:Math.round(Z.y+ee.y)}:mt(Z,_));let j=null;if(Y&&v&&!R.extent&&G){let{positionAbsolute:U}=R.internals,te=U.x-G.x+v[0][0],ne=U.x+R.measured.width-G.x2+v[1][0],re=U.y-G.y+v[0][1],ue=U.y+R.measured.height-G.y2+v[1][1];j=[[te,re],[ne,ue]]}let{position:Q,positionAbsolute:W}=jn({nodeId:q,nextPosition:Z,nodeLookup:y,nodeExtent:j||v,nodeOrigin:D,onError:H});K=K||R.position.x!==Q.x||R.position.y!==Q.y,R.position=Q,R.internals.positionAbsolute=W}if(h=h||K,!!K&&(F(a,!0),w&&(o||A||!S&&L))){let[q,R]=Fn({nodeId:S,dragItems:a,nodeLookup:y});o?.(w,a,q,R),A?.(w,q,R),S||L?.(w,R)}}async function I(){if(!u)return;let{transform:B,panBy:M,autoPanSpeed:y,autoPanOnNodeDrag:v}=t();if(!v){c=!1,cancelAnimationFrame(s);return}let[_,C]=ln(l,u,y);(_!==0||C!==0)&&(i.x=(i.x??0)-_/B[2],i.y=(i.y??0)-C/B[2],await M({x:_,y:C})&&T(i)),s=requestAnimationFrame(I)}function V(B){let{nodeLookup:M,multiSelectionActive:y,nodesDraggable:v,transform:_,snapGrid:C,snapToGrid:D,selectNodesOnDrag:A,onNodeDragStart:L,onSelectionDragStart:H,unselectNodesAndEdges:F}=t();f=!0,(!A||!E)&&!y&&S&&(M.get(S)?.selected||F()),E&&A&&S&&e?.(S);let K=At(B.sourceEvent,{transform:_,snapGrid:C,snapToGrid:D,containerBounds:u});if(i=K,a=Ad(M,v,K,S),a.size>0&&(n||L||!S&&H)){let[Y,G]=Fn({nodeId:S,dragItems:a,nodeLookup:M});n?.(B.sourceEvent,a,Y,G),L?.(B.sourceEvent,Y,G),S||H?.(B.sourceEvent,G)}}let $=Kt().clickDistance(N).on("start",B=>{let{domNode:M,nodeDragThreshold:y,transform:v,snapGrid:_,snapToGrid:C}=t();u=M?.getBoundingClientRect()||null,p=!1,h=!1,w=B.sourceEvent,y===0&&V(B),i=At(B.sourceEvent,{transform:v,snapGrid:_,snapToGrid:C,containerBounds:u}),l=ye(B.sourceEvent,u)}).on("drag",B=>{let{autoPanOnNodeDrag:M,transform:y,snapGrid:v,snapToGrid:_,nodeDragThreshold:C,nodeLookup:D}=t(),A=At(B.sourceEvent,{transform:y,snapGrid:v,snapToGrid:_,containerBounds:u});if(w=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||S&&!D.has(S))&&(p=!0),!p){if(!c&&M&&f&&(c=!0,I()),!f){let L=ye(B.sourceEvent,u),H=L.x-l.x,F=L.y-l.y;Math.sqrt(H*H+F*F)>C&&V(B)}(i.x!==A.xSnapped||i.y!==A.ySnapped)&&a&&f&&(l=ye(B.sourceEvent,u),T(A))}}).on("end",B=>{if(!f||p){p&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){let{nodeLookup:M,updateNodePositions:y,onNodeDragStop:v,onSelectionDragStop:_}=t();if(h&&(y(a,!1),h=!1),r||v||!S&&_){let[C,D]=Fn({nodeId:S,dragItems:a,nodeLookup:M,dragging:!1});r?.(B.sourceEvent,a,C,D),v?.(B.sourceEvent,C,D),S||_?.(B.sourceEvent,D)}}}).filter(B=>{let M=B.target;return!B.button&&(!k||!Ci(M,`.${k}`,x))&&(!g||Ci(M,g,x))});d.call($)}function m(){d?.on(".drag",null)}return{update:b,destroy:m}}function Od(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let i of t.values())Ot(r,gt(i))>0&&o.push(i);return o}var $d=250;function Rd(e,t,n,o){let r=[],i=1/0,s=Od(e,n,t+$d);for(let a of s){let c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;let{x:u,y:f}=Fe(a,l,l.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<i?(r=[{...l,x:u,y:f}],i=d):d===i&&r.push({...l,x:u,y:f}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function Ui(e,t,n,o,r,i=!1){let s=o.get(e);if(!s)return null;let a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...Fe(s,c,c.position,!0)}:c}function Qi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Hd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var ji=()=>!0;function Ld(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:p,onConnectStart:h,onConnect:w,onConnectEnd:b,isValidConnection:m=ji,onReconnectEnd:k,updateConnection:g,getTransform:x,getFromHandle:E,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:T}){let I=io(e.target),V=0,$,{x:B,y:M}=ye(e),y=Qi(i,T),v=a?.getBoundingClientRect(),_=!1;if(!v||!y)return;let C=Ui(r,y,o,c,t);if(!C)return;let D=ye(e,v),A=!1,L=null,H=!1,F=null;function K(){if(!u||!v)return;let[Q,W]=ln(D,v,S);d({x:Q,y:W}),V=requestAnimationFrame(K)}let Y={...C,nodeId:r,type:y,position:C.position},G=c.get(r),q={inProgress:!0,isValid:null,from:Fe(G,Y,X.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:G,to:D,toHandle:null,toPosition:yi[Y.position],toNode:null,pointer:D};function R(){_=!0,g(q),h?.(e,{nodeId:r,handleId:o,handleType:y})}N===0&&R();function Z(Q){if(!_){let{x:ue,y:Se}=ye(Q),ve=ue-B,ke=Se-M;if(!(ve*ve+ke*ke>N*N))return;R()}if(!E()||!Y){j(Q);return}let W=x();D=ye(Q,v),$=Rd(yt(D,W,!1,[1,1]),n,c,Y),A||(K(),A=!0);let U=Ji(Q,{handle:$,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:I,lib:l,flowId:f,nodeLookup:c});F=U.handleDomNode,L=U.connection,H=Hd(!!$,U.isValid);let te=c.get(r),ne=te?Fe(te,Y,X.Left,!0):q.from,re={...q,from:ne,isValid:H,to:U.toHandle&&H?et({x:U.toHandle.x,y:U.toHandle.y},W):D,toHandle:U.toHandle,toPosition:H&&U.toHandle?U.toHandle.position:yi[Y.position],toNode:U.toHandle?c.get(U.toHandle.nodeId):null,pointer:D};g(re),q=re}function j(Q){if(!("touches"in Q&&Q.touches.length>0)){if(_){($||F)&&L&&H&&w?.(L);let{inProgress:W,...U}=q,te={...U,toPosition:q.toHandle?q.toPosition:null};b?.(Q,te),i&&k?.(Q,te)}p(),cancelAnimationFrame(V),A=!1,H=!1,L=null,F=null,I.removeEventListener("mousemove",Z),I.removeEventListener("mouseup",j),I.removeEventListener("touchmove",Z),I.removeEventListener("touchend",j)}}I.addEventListener("mousemove",Z),I.addEventListener("mouseup",j),I.addEventListener("touchmove",Z),I.addEventListener("touchend",j)}function Ji(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=ji,nodeLookup:u}){let f=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:h}=ye(e),w=s.elementFromPoint(p,h),b=w?.classList.contains(`${a}-flow__handle`)?w:d,m={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){let k=Qi(void 0,b),g=b.getAttribute("data-nodeid"),x=b.getAttribute("data-handleid"),E=b.classList.contains("connectable"),S=b.classList.contains("connectableend");if(!g||!k)return m;let N={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};m.connection=N;let I=E&&S&&(n===Ve.Strict?f&&k==="source"||!f&&k==="target":g!==o||x!==r);m.isValid=I&&l(N),m.toHandle=Ui(g,k,x,u,n,!0)}return m}var xn={onPointerDown:Ld,isValid:Ji};function es({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=de(e);function i({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:p=!1}){let h=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;let x=n(),E=g.sourceEvent.ctrlKey&&bt()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,N=x[2]*Math.pow(2,S*E);t.scaleTo(N)},w=[0,0],b=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{let x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;let E=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[E[0]-w[0],E[1]-w[1]];w=E;let N=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),T={x:x[0]-S[0]*N,y:x[1]-S[1]*N},I=[[0,0],[c,l]];t.setViewportConstrained({x:T.x,y:T.y,zoom:x[2]},I,a)},k=nn().on("start",b).on("zoom",f?m:null).on("zoom.wheel",d?h:null);r.call(k,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:pe}}var wn=e=>({x:e.x,y:e.y,zoom:e.k}),Yn=({x:e,y:t,zoom:n})=>Qe.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),ts=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Bd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xn=(e,t=0,n=Bd,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ns=e=>{let t=e.ctrlKey&&bt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Vd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Be(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let f=n.property("__zoom").k||1;if(u.ctrlKey&&s){let b=pe(u),m=ns(u),k=f*Math.pow(2,m);o.scaleTo(n,k,b,u);return}let d=u.deltaMode===1?20:1,p=r===De.Vertical?0:u.deltaX*d,h=r===De.Horizontal?0:u.deltaY*d;!bt()&&u.shiftKey&&r!==De.Vertical&&(p=u.deltaY*d,h=0),o.translateBy(n,-(p/f)*i,-(h/f)*i,{internal:!0});let w=wn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,w):(e.isPanScrolling=!0,a?.(u,w)),e.panScrollTimeout=setTimeout(()=>{l?.(u,w),e.isPanScrolling=!1},150)}}function Fd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Be(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Yd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=wn(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 Xd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&ts(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,wn(i.transform))}}function Zd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&ts(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=wn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Wd({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:f}){return d=>{let p=t||n,h=o&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Be(d,`${u}-flow__node`)||Be(d,`${u}-flow__edge`)||Be(d,`${u}-flow__selection`)||Be(d,`${u}-flow__nodesselection`)))return!0;if(!r&&!p&&!i&&!s&&!o||a||f&&!w||Be(d,c)&&w||Be(d,l)&&(!w||i&&w&&!t)||!o&&d.ctrlKey&&w)return!1;if(!o&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!p&&!i&&!h&&w||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;let b=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w||e)&&b}}function os({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=[[0,0],[u.width,u.height]];(typeof ResizeObserver<"u"?new ResizeObserver(M=>{let y=M[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);let p=nn().extent(()=>f).scaleExtent([t,n]).translateExtent(o),h=de(e).call(p);x({x:r.x,y:r.y,zoom:ft(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);let w=h.on("wheel.zoom"),b=h.on("dblclick.zoom");p.wheelDelta(ns);async function m(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).transform(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}function k({noWheelClassName:M,noPanClassName:y,onPaneContextMenu:v,userSelectionActive:_,panOnScroll:C,panOnDrag:D,panOnScrollMode:A,panOnScrollSpeed:L,preventScrolling:H,zoomOnPinch:F,zoomOnScroll:K,zoomOnDoubleClick:Y,panActivationKeyPressed:G=!1,zoomActivationKeyPressed:ee,lib:q,onTransformChange:R,connectionInProgress:Z,paneClickDistance:j,selectionOnDrag:Q}){_&&!l.isZoomingOrPanning&&g();let W=C&&!ee&&!_;p.clickDistance(Q?1/0:!me(j)||j<0?0:j);let U=W?Vd({zoomPanValues:l,noWheelClassName:M,d3Selection:h,d3Zoom:p,panOnScrollMode:A,panOnScrollSpeed:L,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Fd({noWheelClassName:M,preventScrolling:H,d3ZoomHandler:w});h.on("wheel.zoom",U,{passive:!1});let te=Yd({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});p.on("start",te);let ne=Xd({zoomPanValues:l,panOnDrag:D,onPaneContextMenu:!!v,onPanZoom:i,onTransformChange:R});p.on("zoom",ne);let re=Zd({zoomPanValues:l,panOnDrag:D,panOnScroll:C,onPaneContextMenu:v,onPanZoomEnd:a,onDraggingChange:c});p.on("end",re);let ue=Wd({panActivationKeyPressed:G,zoomActivationKeyPressed:ee,panOnDrag:D,zoomOnScroll:K,panOnScroll:C,zoomOnDoubleClick:Y,zoomOnPinch:F,userSelectionActive:_,noPanClassName:y,noWheelClassName:M,lib:q,connectionInProgress:Z});p.filter(ue),Y?h.on("dblclick.zoom",b):h.on("dblclick.zoom",null)}function g(){p.on("zoom",null)}async function x(M,y,v){let _=Yn(M),C=p?.constrain()(_,y,v);return C&&await m(C),C}async function E(M,y){let v=Yn(M);return await m(v,y),v}function S(M){if(h){let y=Yn(M),v=h.property("__zoom");(v.k!==M.zoom||v.x!==M.x||v.y!==M.y)&&p?.transform(h,y,null,{sync:!0})}}function N(){let M=h?Dt(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}async function T(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleTo(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}async function I(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleBy(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}function V(M){p?.scaleExtent(M)}function $(M){p?.translateExtent(M)}function B(M){let y=!me(M)||M<0?0:M;p?.clickDistance(y)}return{update:k,destroy:g,setViewport:E,setViewportConstrained:x,getViewport:N,scaleTo:T,scaleBy:I,setScaleExtent:V,setTranslateExtent:$,syncViewport:S,setClickDistance:B}}var Ye;(function(e){e.Line="line",e.Handle="handle"})(Ye||(Ye={}));function qd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){let s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Mi(e){let 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 He(e,t){return Math.max(0,t-e)}function Le(e,t){return Math.max(0,e-t)}function rn(e,t,n){return Math.max(0,t-e,e-n)}function Ii(e,t){return e?!t:t}function Kd(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:p,ySnapped:h}=n,{minWidth:w,maxWidth:b,minHeight:m,maxHeight:k}=o,{x:g,y:x,width:E,height:S,aspectRatio:N}=e,T=Math.floor(u?p-e.pointerX:0),I=Math.floor(f?h-e.pointerY:0),V=E+(c?-T:T),$=S+(l?-I:I),B=-i[0]*E,M=-i[1]*S,y=rn(V,w,b),v=rn($,m,k);if(s){let D=0,A=0;c&&T<0?D=He(g+T+B,s[0][0]):!c&&T>0&&(D=Le(g+V+B,s[1][0])),l&&I<0?A=He(x+I+M,s[0][1]):!l&&I>0&&(A=Le(x+$+M,s[1][1])),y=Math.max(y,D),v=Math.max(v,A)}if(a){let D=0,A=0;c&&T>0?D=Le(g+T,a[0][0]):!c&&T<0&&(D=He(g+V,a[1][0])),l&&I>0?A=Le(x+I,a[0][1]):!l&&I<0&&(A=He(x+$,a[1][1])),y=Math.max(y,D),v=Math.max(v,A)}if(r){if(u){let D=rn(V/N,m,k)*N;if(y=Math.max(y,D),s){let A=0;!c&&!l||c&&!l&&d?A=Le(x+M+V/N,s[1][1])*N:A=He(x+M+(c?T:-T)/N,s[0][1])*N,y=Math.max(y,A)}if(a){let A=0;!c&&!l||c&&!l&&d?A=He(x+V/N,a[1][1])*N:A=Le(x+(c?T:-T)/N,a[0][1])*N,y=Math.max(y,A)}}if(f){let D=rn($*N,w,b)/N;if(v=Math.max(v,D),s){let A=0;!c&&!l||l&&!c&&d?A=Le(g+$*N+B,s[1][0])/N:A=He(g+(l?I:-I)*N+B,s[0][0])/N,v=Math.max(v,A)}if(a){let A=0;!c&&!l||l&&!c&&d?A=He(g+$*N,a[1][0])/N:A=Le(g+(l?I:-I)*N,a[0][0])/N,v=Math.max(v,A)}}}I=I+(I<0?v:-v),T=T+(T<0?y:-y),r&&(d?V>$*N?I=(Ii(c,l)?-T:T)/N:T=(Ii(c,l)?-I:I)*N:u?(I=T/N,l=c):(T=I*N,c=l));let _=c?g+T:g,C=l?x+I:x;return{width:E+(c?-T:T),height:S+(l?-I:I),x:i[0]*T*(c?-1:1)+_,y:i[1]*I*(l?-1:1)+C}}var rs={width:0,height:0,x:0,y:0},Gd={...rs,pointerX:0,pointerY:0,aspectRatio:1};function Ud(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function is({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let i=de(e),s={controlDirection:Mi("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:p,onResize:h,onResizeEnd:w,shouldResize:b}){let m={...rs},k={...Gd};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Mi(l)};let g,x=null,E=[],S,N,T,I=Kt().on("start",V=>{let{nodeLookup:$,transform:B,snapGrid:M,snapToGrid:y,nodeOrigin:v,paneDomNode:_}=n();if(g=$.get(t),!g)return;x=_?.getBoundingClientRect()??null;let{xSnapped:C,ySnapped:D}=At(V.sourceEvent,{transform:B,snapGrid:M,snapToGrid:y,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},k={...m,pointerX:C,pointerY:D,aspectRatio:m.width/m.height},S=void 0,N=tt(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=$.get(g.parentId)),S&&g.extent==="parent"&&(N=[[0,0],[S.measured.width,S.measured.height]]),E=[],T=void 0;for(let[A,L]of $)if(L.parentId===t&&(E.push({id:A,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){let H=Ud(L,g,L.origin??v);T?T=[[Math.min(H[0][0],T[0][0]),Math.min(H[0][1],T[0][1])],[Math.max(H[1][0],T[1][0]),Math.max(H[1][1],T[1][1])]]:T=H}p?.(V,{...m})}).on("drag",V=>{let{transform:$,snapGrid:B,snapToGrid:M,nodeOrigin:y}=n(),v=At(V.sourceEvent,{transform:$,snapGrid:B,snapToGrid:M,containerBounds:x}),_=[];if(!g)return;let{x:C,y:D,width:A,height:L}=m,H={},F=g.origin??y,{width:K,height:Y,x:G,y:ee}=Kd(k,s.controlDirection,v,s.boundaries,s.keepAspectRatio,F,N,T),q=K!==A,R=Y!==L,Z=G!==C&&q,j=ee!==D&&R;if(!Z&&!j&&!q&&!R)return;let Q={prevValues:{...m},startX:k.x,startY:k.y,childNodes:E.map(ne=>({...ne,position:{...ne.position}}))};if((Z||j||F[0]===1||F[1]===1)&&(H.x=Z?G:m.x,H.y=j?ee:m.y,m.x=H.x,m.y=H.y,E.length>0)){let ne=G-C,re=ee-D;for(let ue of E)ue.position={x:ue.position.x-ne+F[0]*(K-A),y:ue.position.y-re+F[1]*(Y-L)},_.push(ue)}if((q||R)&&(H.width=q&&(!s.resizeDirection||s.resizeDirection==="horizontal")?K:m.width,H.height=R&&(!s.resizeDirection||s.resizeDirection==="vertical")?Y:m.height,m.width=H.width,m.height=H.height),S&&g.expandParent){let ne=F[0]*(H.width??0);H.x&&H.x<ne&&(m.x=ne,k.x=k.x-(H.x-ne));let re=F[1]*(H.height??0);H.y&&H.y<re&&(m.y=re,k.y=k.y-(H.y-re))}let W=qd({width:m.width,prevWidth:A,height:m.height,prevHeight:L,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),U={...m,direction:W};if(b?.(V,U)===!1){m=Q.prevValues,k.x=Q.startX,k.y=Q.startY,E.forEach((ne,re)=>{ne.position=Q.childNodes[re].position});return}h?.(V,U),o(H,_)}).on("end",V=>{w?.(V,{...m}),r?.({...m})});i.call(I)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var cs=Te(Dn(),1),ds=Te(Il(),1);var ss=e=>{let t,n=new Set,o=(u,f)=>{let d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){let p=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,p))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},as=e=>e?ss(e):ss;var{useDebugValue:Qd}=cs.default,{useSyncExternalStoreWithSelector:jd}=ds.default,Jd=e=>e;function go(e,t=Jd,n){let o=jd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Qd(o),o}var ls=(e,t)=>{let n=as(e),o=(r,i=t)=>go(n,r,i);return Object.assign(o,n),o},us=(e,t)=>e?ls(e,t):ls;function ie(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[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(let o of e)if(!t.has(o))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var eu=Te(Ml()),Sn=(0,P.createContext)(null),tu=Sn.Provider,Hs=ge.error001("react");function J(e,t){let n=(0,P.useContext)(Sn);if(n===null)throw new Error(Hs);return go(n,e,t)}function se(){let e=(0,P.useContext)(Sn);if(e===null)throw new Error(Hs);return(0,P.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var fs={display:"none"},nu={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ls="react-flow__node-desc",Bs="react-flow__edge-desc",ou="react-flow__aria-live",ru=e=>e.ariaLiveMessage,iu=e=>e.ariaLabelConfig;function su({rfId:e}){let t=J(ru);return(0,z.jsx)("div",{id:`${ou}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:nu,children:t})}function au({rfId:e,disableKeyboardA11y:t}){let n=J(iu);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{id:`${Ls}-${e}`,style:fs,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,z.jsx)("div",{id:`${Bs}-${e}`,style:fs,children:n["edge.a11yDescription.default"]}),!t&&(0,z.jsx)(su,{rfId:e})]})}var En=(0,P.forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{let s=`${e}`.split("-");return(0,z.jsx)("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});En.displayName="Panel";var ps="https://reactflow.dev?utm_source=attribution";function lu({proOptions:e,position:t="bottom-right"}){return(0,P.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,z.jsx)(En,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ps}`,children:(0,z.jsx)("a",{href:ps,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var cu=e=>{let t=[],n=[];for(let[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(let[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},vn=e=>e.id;function du(e,t){return ie(e.selectedNodes.map(vn),t.selectedNodes.map(vn))&&ie(e.selectedEdges.map(vn),t.selectedEdges.map(vn))}function uu({onSelectionChange:e}){let t=se(),{selectedNodes:n,selectedEdges:o}=J(cu,du);return(0,P.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}var fu=e=>!!e.onSelectionChangeHandlers;function pu({onSelectionChange:e}){let t=J(fu);return e||t?(0,z.jsx)(uu,{onSelectionChange:e}):null}var Vs=[0,0],hu={x:0,y:0,zoom:1},gu=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],hs=[...gu,"rfId"],mu=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}),gs={translateExtent:pt,nodeOrigin:Vs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yu(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(mu,ie),l=se();(0,P.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=gs,a()}),[]);let u=(0,P.useRef)(gs);return(0,P.useEffect)(()=>{for(let f of hs){let d=e[f],p=u.current[f];d!==p&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?i(d):f==="nodeExtent"?s(d):f==="ariaLabelConfig"?l.setState({ariaLabelConfig:Ri(d)}):f==="fitView"?l.setState({fitViewQueued:d}):f==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[f]:d})))}u.current=e},hs.map(f=>e[f])),null}function ms(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bu(e){let[t,n]=(0,P.useState)(e==="system"?null:e);return(0,P.useEffect)(()=>{if(e!=="system"){n(e);return}let o=ms(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:ms()?.matches?"dark":"light"}var ys=typeof document<"u"?document:null;function Rt(e=null,t={target:ys,actInsideInputWithModifier:!0}){let[n,o]=(0,P.useState)(!1),r=(0,P.useRef)(!1),i=(0,P.useRef)(new Set([])),[s,a]=(0,P.useMemo)(()=>{if(e!==null){let l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace(/\+/g,`
|
|
1
|
+
import{a as st,b as Tn,e as On,g as Ko,h as Go,i as Vt,j as Uo,k as Qo,l as at,o as jo,p as Jo,q as $n}from"./chunk-P5ET5XMK.js";import{a as Ho,b as Lo,c as Yo,d as Xo}from"./chunk-KYWOOES7.js";import{d as Vo,e as Fo}from"./chunk-PTZCSSDG.js";import{b as Il}from"./chunk-JAQUAFGK.js";import"./chunk-5AW2WUSZ.js";import{d as Zo,e as Wo,f as qo}from"./chunk-7K7GQKOA.js";import{Ab as Me,B as zo,C as Po,Ca as To,Da as Oo,Ia as $o,a as Bt,c as Dn,lb as Ro,mb as An,nb as Ml,qa as Do,ta as Ao}from"./chunk-WRXJZR6G.js";import{a as Bo}from"./chunk-J6IRWTF7.js";import{c as Te}from"./chunk-DCANE7XH.js";var oe=Te(Dn(),1);var z=Te(An()),P=Te(Dn());function ae(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=ae(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Ft="http://www.w3.org/1999/xhtml",Rn={svg:"http://www.w3.org/2000/svg",xhtml:Ft,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ie(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Rn.hasOwnProperty(t)?{space:Rn[t],local:e}:e}function zl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Ft&&t.documentElement.namespaceURI===Ft?t.createElement(e):t.createElementNS(n,e)}}function Pl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Yt(e){var t=Ie(e);return(t.local?Pl:zl)(t)}function Dl(){}function Ke(e){return e==null?Dl:function(){return this.querySelector(e)}}function er(e){typeof e!="function"&&(e=Ke(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,l,u=0;u<s;++u)(c=i[u])&&(l=e.call(c,c.__data__,u,i))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(o,this._parents)}function Hn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Al(){return[]}function kt(e){return e==null?Al:function(){return this.querySelectorAll(e)}}function Tl(e){return function(){return Hn(e.apply(this,arguments))}}function tr(e){typeof e=="function"?e=Tl(e):e=kt(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new le(o,r)}function _t(e){return function(){return this.matches(e)}}function Xt(e){return function(t){return t.matches(e)}}var Ol=Array.prototype.find;function $l(e){return function(){return Ol.call(this.children,e)}}function Rl(){return this.firstElementChild}function nr(e){return this.select(e==null?Rl:$l(typeof e=="function"?e:Xt(e)))}var Hl=Array.prototype.filter;function Ll(){return Array.from(this.children)}function Bl(e){return function(){return Hl.call(this.children,e)}}function or(e){return this.selectAll(e==null?Ll:Bl(typeof e=="function"?e:Xt(e)))}function rr(e){typeof e!="function"&&(e=_t(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(o,this._parents)}function Zt(e){return new Array(e.length)}function ir(){return new le(this._enter||this._groups.map(Zt),this._parents)}function St(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}St.prototype={constructor:St,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 sr(e){return function(){return e}}function Vl(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new St(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function Fl(e,t,n,o,r,i,s){var a,c,l=new Map,u=t.length,f=i.length,d=new Array(u),p;for(a=0;a<u;++a)(c=t[a])&&(d[a]=p=s.call(c,c.__data__,a,t)+"",l.has(p)?r[a]=c:l.set(p,c));for(a=0;a<f;++a)p=s.call(e,i[a],a,i)+"",(c=l.get(p))?(o[a]=c,c.__data__=i[a],l.delete(p)):n[a]=new St(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(r[a]=c)}function Yl(e){return e.__data__}function ar(e,t){if(!arguments.length)return Array.from(this,Yl);var n=t?Fl:Vl,o=this._parents,r=this._groups;typeof e!="function"&&(e=sr(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var u=o[l],f=r[l],d=f.length,p=Xl(e.call(u,u&&u.__data__,l,o)),h=p.length,w=a[l]=new Array(h),b=s[l]=new Array(h),m=c[l]=new Array(d);n(u,f,w,b,m,p,t);for(var k=0,g=0,x,E;k<h;++k)if(x=w[k]){for(k>=g&&(g=k+1);!(E=b[g])&&++g<h;);x._next=E||null}}return s=new le(s,o),s._enter=a,s._exit=c,s}function Xl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function lr(){return new le(this._exit||this._groups.map(Zt),this._parents)}function cr(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 dr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],u=o[c],f=l.length,d=a[c]=new Array(f),p,h=0;h<f;++h)(p=l[h]||u[h])&&(d[h]=p);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function ur(){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 fr(e){e||(e=Zl);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new le(r,this._parents).order()}function Zl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function hr(){return Array.from(this)}function gr(){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 mr(){let e=0;for(let t of this)++e;return e}function yr(){return!this.node()}function br(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 Wl(e){return function(){this.removeAttribute(e)}}function ql(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kl(e,t){return function(){this.setAttribute(e,t)}}function Gl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ul(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ql(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 xr(e,t){var n=Ie(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?ql:Wl:typeof t=="function"?n.local?Ql:Ul:n.local?Gl:Kl)(n,t))}function Wt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function jl(e){return function(){this.style.removeProperty(e)}}function Jl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ec(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function wr(e,t,n){return arguments.length>1?this.each((t==null?jl:typeof t=="function"?ec:Jl)(e,t,n??"")):Oe(this.node(),e)}function Oe(e,t){return e.style.getPropertyValue(t)||Wt(e).getComputedStyle(e,null).getPropertyValue(t)}function tc(e){return function(){delete this[e]}}function nc(e,t){return function(){this[e]=t}}function oc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function vr(e,t){return arguments.length>1?this.each((t==null?tc:typeof t=="function"?oc:nc)(e,t)):this.node()[e]}function kr(e){return e.trim().split(/^|\s+/)}function Ln(e){return e.classList||new _r(e)}function _r(e){this._node=e,this._names=kr(e.getAttribute("class")||"")}_r.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Sr(e,t){for(var n=Ln(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Er(e,t){for(var n=Ln(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function rc(e){return function(){Sr(this,e)}}function ic(e){return function(){Er(this,e)}}function sc(e,t){return function(){(t.apply(this,arguments)?Sr:Er)(this,e)}}function Nr(e,t){var n=kr(e+"");if(arguments.length<2){for(var o=Ln(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?sc:t?rc:ic)(n,t))}function ac(){this.textContent=""}function lc(e){return function(){this.textContent=e}}function cc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Cr(e){return arguments.length?this.each(e==null?ac:(typeof e=="function"?cc:lc)(e)):this.node().textContent}function dc(){this.innerHTML=""}function uc(e){return function(){this.innerHTML=e}}function fc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Mr(e){return arguments.length?this.each(e==null?dc:(typeof e=="function"?fc:uc)(e)):this.node().innerHTML}function pc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ir(){return this.each(pc)}function hc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function zr(){return this.each(hc)}function Pr(e){var t=typeof e=="function"?e:Yt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function gc(){return null}function Dr(e,t){var n=typeof e=="function"?e:Yt(e),o=t==null?gc:typeof t=="function"?t:Ke(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function mc(){var e=this.parentNode;e&&e.removeChild(this)}function Ar(){return this.each(mc)}function yc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tr(e){return this.select(e?bc:yc)}function Or(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xc(e){return function(t){e.call(this,t,this.__data__)}}function wc(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 vc(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 kc(e,t,n){return function(){var o=this.__on,r,i=xc(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 $r(e,t,n){var o=wc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?kc:vc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Rr(e,t,n){var o=Wt(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 _c(e,t){return function(){return Rr(this,e,t)}}function Sc(e,t){return function(){return Rr(this,e,t.apply(this,arguments))}}function Hr(e,t){return this.each((typeof t=="function"?Sc:_c)(e,t))}function*Lr(){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 Bn=[null];function le(e,t){this._groups=e,this._parents=t}function Br(){return new le([[document.documentElement]],Bn)}function Ec(){return this}le.prototype=Br.prototype={constructor:le,select:er,selectAll:tr,selectChild:nr,selectChildren:or,filter:rr,data:ar,enter:ir,exit:lr,join:cr,merge:dr,selection:Ec,order:ur,sort:fr,call:pr,nodes:hr,node:gr,size:mr,empty:yr,each:br,attr:xr,style:wr,property:vr,classed:Nr,text:Cr,html:Mr,raise:Ir,lower:zr,append:Pr,insert:Dr,remove:Ar,clone:Tr,datum:Or,on:$r,dispatch:Hr,[Symbol.iterator]:Lr};var ze=Br;function de(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Bn)}function Vr(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=Vr(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]}var Fr={passive:!1},Ge={capture:!0,passive:!1};function qt(e){e.stopImmediatePropagation()}function $e(e){e.preventDefault(),e.stopImmediatePropagation()}function Et(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",$e,Ge);"onselectstart"in t?n.on("selectstart.drag",$e,Ge):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Nt(e,t){var n=e.document.documentElement,o=de(e).on("dragstart.drag",null);t&&(o.on("click.drag",$e,Ge),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Ct=e=>()=>e;function Mt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Mt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Nc(e){return!e.ctrlKey&&!e.button}function Cc(){return this.parentNode}function Mc(e,t){return t??{x:e.x,y:e.y}}function Ic(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kt(){var e=Nc,t=Cc,n=Mc,o=Ic,r={},i=st("start","drag","end"),s=0,a,c,l,u,f=0;function d(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",b).on("touchmove.drag",m,Fr).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,E){if(!(u||!e.call(this,x,E))){var S=g(this,t.call(this,x,E),x,E,"mouse");S&&(de(x.view).on("mousemove.drag",h,Ge).on("mouseup.drag",w,Ge),Et(x.view),qt(x),l=!1,a=x.clientX,c=x.clientY,S("start",x))}}function h(x){if($e(x),!l){var E=x.clientX-a,S=x.clientY-c;l=E*E+S*S>f}r.mouse("drag",x)}function w(x){de(x.view).on("mousemove.drag mouseup.drag",null),Nt(x.view,l),$e(x),r.mouse("end",x)}function b(x,E){if(e.call(this,x,E)){var S=x.changedTouches,N=t.call(this,x,E),T=S.length,I,V;for(I=0;I<T;++I)(V=g(this,N,x,E,S[I].identifier,S[I]))&&(qt(x),V("start",x,S[I]))}}function m(x){var E=x.changedTouches,S=E.length,N,T;for(N=0;N<S;++N)(T=r[E[N].identifier])&&($e(x),T("drag",x,E[N]))}function k(x){var E=x.changedTouches,S=E.length,N,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<S;++N)(T=r[E[N].identifier])&&(qt(x),T("end",x,E[N]))}function g(x,E,S,N,T,I){var V=i.copy(),$=pe(I||S,E),B,M,y;if((y=n.call(x,new Mt("beforestart",{sourceEvent:S,target:d,identifier:T,active:s,x:$[0],y:$[1],dx:0,dy:0,dispatch:V}),N))!=null)return B=y.x-$[0]||0,M=y.y-$[1]||0,function v(_,C,D){var A=$,L;switch(_){case"start":r[T]=v,L=s++;break;case"end":delete r[T],--s;case"drag":$=pe(D||C,E),L=s;break}V.call(_,x,new Mt(_,{sourceEvent:C,subject:y,target:d,identifier:T,active:L,x:$[0]+B,y:$[1]+M,dx:$[0]-A[0],dy:$[1]-A[1],dispatch:V}),N)}}return d.filter=function(x){return arguments.length?(e=typeof x=="function"?x:Ct(!!x),d):e},d.container=function(x){return arguments.length?(t=typeof x=="function"?x:Ct(x),d):t},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:Ct(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:Ct(!!x),d):o},d.on=function(){var x=i.on.apply(i,arguments);return x===i?d:x},d.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,d):Math.sqrt(f)},d}var zc=st("start","end","cancel","interrupt"),Pc=[],Zr=0,Yr=1,Ut=2,Gt=3,Xr=4,Qt=5,It=6;function Re(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Dc(e,n,{name:t,index:o,group:r,on:zc,tween:Pc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zr})}function zt(e,t){var n=ce(e,t);if(n.state>Zr)throw new Error("too late; already scheduled");return n}function fe(e,t){var n=ce(e,t);if(n.state>Gt)throw new Error("too late; already running");return n}function ce(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Dc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Jo(i,0,n.time);function i(l){n.state=Yr,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,p;if(n.state!==Yr)return c();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Gt)return $n(s);p.state===Xr?(p.state=It,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=It,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if($n(function(){n.state===Gt&&(n.state=Xr,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Ut,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ut){for(n.state=Gt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=p);r.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Qt,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===Qt&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=It,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Ue(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>Ut&&o.state<Qt,o.state=It,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Wr(e){return this.each(function(){Ue(this,e)})}function Ac(e,t){var n,o;return function(){var r=fe(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 Tc(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=fe(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function qr(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ce(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?Ac:Tc)(n,e,t))}function lt(e,t,n){var o=e._id;return e.each(function(){var r=fe(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ce(r,o).value[t]}}function jt(e,t){var n;return(typeof t=="number"?Ko:t instanceof Tn?On:(n=Tn(t))?(t=n,On):Go)(e,t)}function Oc(e){return function(){this.removeAttribute(e)}}function $c(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Rc(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 Hc(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 Lc(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Bc(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Kr(e,t){var n=Ie(e),o=n==="transform"?Qo:jt;return this.attrTween(e,typeof t=="function"?(n.local?Bc:Lc)(n,o,lt(this,"attr."+e,t)):t==null?(n.local?$c:Oc)(n):(n.local?Hc:Rc)(n,o,t))}function Vc(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Fc(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Fc(e,i)),n}return r._value=t,r}function Xc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Vc(e,i)),n}return r._value=t,r}function Gr(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=Ie(e);return this.tween(n,(o.local?Yc:Xc)(o,t))}function Zc(e,t){return function(){zt(this,e).delay=+t.apply(this,arguments)}}function Wc(e,t){return t=+t,function(){zt(this,e).delay=t}}function Ur(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Zc:Wc)(t,e)):ce(this.node(),t).delay}function qc(e,t){return function(){fe(this,e).duration=+t.apply(this,arguments)}}function Kc(e,t){return t=+t,function(){fe(this,e).duration=t}}function Qr(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?qc:Kc)(t,e)):ce(this.node(),t).duration}function Gc(e,t){if(typeof t!="function")throw new Error;return function(){fe(this,e).ease=t}}function jr(e){var t=this._id;return arguments.length?this.each(Gc(t,e)):ce(this.node(),t).ease}function Uc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fe(this,e).ease=n}}function Jr(e){if(typeof e!="function")throw new Error;return this.each(Uc(this._id,e))}function ei(e){typeof e!="function"&&(e=_t(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new he(o,this._parents,this._name,this._id)}function ti(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,p=0;p<u;++p)(d=c[p]||l[p])&&(f[p]=d);for(;a<o;++a)s[a]=t[a];return new he(s,this._parents,this._name,this._id)}function Qc(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 jc(e,t,n){var o,r,i=Qc(t)?zt:fe;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function ni(e,t){var n=this._id;return arguments.length<2?ce(this.node(),n).on.on(e):this.each(jc(n,e,t))}function Jc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function oi(){return this.on("end.remove",Jc(this._id))}function ri(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ke(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Re(l[d],t,n,d,l,ce(u,n)));return new he(i,this._parents,t,n)}function ii(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kt(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),p,h=ce(u,n),w=0,b=d.length;w<b;++w)(p=d[w])&&Re(p,t,n,w,d,h);i.push(d),s.push(u)}return new he(i,s,t,n)}var ed=ze.prototype.constructor;function si(){return new ed(this._groups,this._parents)}function td(e,t){var n,o,r;return function(){var i=Oe(this,e),s=(this.style.removeProperty(e),Oe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function ai(e){return function(){this.style.removeProperty(e)}}function nd(e,t,n){var o,r=n+"",i;return function(){var s=Oe(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function od(e,t,n){var o,r,i;return function(){var s=Oe(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Oe(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function rd(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=fe(this,e),l=c.on,u=c.value[i]==null?a||(a=ai(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),c.on=o}}function li(e,t,n){var o=(e+="")=="transform"?Uo:jt;return t==null?this.styleTween(e,td(e,o)).on("end.style."+e,ai(e)):typeof t=="function"?this.styleTween(e,od(e,o,lt(this,"style."+e,t))).each(rd(this._id,e)):this.styleTween(e,nd(e,o,t),n).on("end.style."+e,null)}function id(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function sd(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&id(e,s,n)),o}return i._value=t,i}function ci(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,sd(e,t,n??""))}function ad(e){return function(){this.textContent=e}}function ld(e){return function(){var t=e(this);this.textContent=t??""}}function di(e){return this.tween("text",typeof e=="function"?ld(lt(this,"text",e)):ad(e==null?"":e+""))}function cd(e){return function(t){this.textContent=e.call(this,t)}}function dd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&cd(r)),t}return o._value=e,o}function ui(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,dd(e))}function fi(){for(var e=this._name,t=this._id,n=Jt(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=ce(c,t);Re(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new he(o,this._parents,e,n)}function pi(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=fe(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var ud=0;function he(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function hi(e){return ze().transition(e)}function Jt(){return++ud}var Pe=ze.prototype;he.prototype=hi.prototype={constructor:he,select:ri,selectAll:ii,selectChild:Pe.selectChild,selectChildren:Pe.selectChildren,filter:ei,merge:ti,selection:si,transition:fi,call:Pe.call,nodes:Pe.nodes,node:Pe.node,size:Pe.size,empty:Pe.empty,each:Pe.each,on:ni,attr:Kr,attrTween:Gr,style:li,styleTween:ci,text:di,textTween:ui,remove:oi,tween:qr,delay:Ur,duration:Qr,ease:jr,easeVarying:Jr,end:pi,[Symbol.iterator]:Pe[Symbol.iterator]};function en(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fd={time:null,delay:0,duration:250,ease:en};function pd(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 gi(e){var t,n;e instanceof he?(t=e._id,e=e._name):(t=Jt(),(n=fd).time=jo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Re(c,e,t,l,s,n||pd(c,t));return new he(o,this._parents,e,t)}ze.prototype.interrupt=Wr;ze.prototype.transition=gi;var Pt=e=>()=>e;function Vn(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 we(e,t,n){this.k=e,this.x=t,this.y=n}we.prototype={constructor:we,scale:function(e){return e===1?this:new we(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new we(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 Qe=new we(1,0,0);Dt.prototype=we.prototype;function Dt(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Qe;return e.__zoom}function tn(e){e.stopImmediatePropagation()}function ct(e){e.preventDefault(),e.stopImmediatePropagation()}function hd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function gd(){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 mi(){return this.__zoom||Qe}function md(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function yd(){return navigator.maxTouchPoints||"ontouchstart"in this}function bd(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 nn(){var e=hd,t=gd,n=bd,o=md,r=yd,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=at,l=st("start","zoom","end"),u,f,d,p=500,h=150,w=0,b=10;function m(y){y.property("__zoom",mi).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,v,_,C){var D=y.selection?y.selection():y;D.property("__zoom",mi),y!==D?E(y,v,_,C):D.interrupt().each(function(){S(this,arguments).event(C).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},m.scaleBy=function(y,v,_,C){m.scaleTo(y,function(){var D=this.__zoom.k,A=typeof v=="function"?v.apply(this,arguments):v;return D*A},_,C)},m.scaleTo=function(y,v,_,C){m.transform(y,function(){var D=t.apply(this,arguments),A=this.__zoom,L=_==null?x(D):typeof _=="function"?_.apply(this,arguments):_,H=A.invert(L),F=typeof v=="function"?v.apply(this,arguments):v;return n(g(k(A,F),L,H),D,s)},_,C)},m.translateBy=function(y,v,_,C){m.transform(y,function(){return n(this.__zoom.translate(typeof v=="function"?v.apply(this,arguments):v,typeof _=="function"?_.apply(this,arguments):_),t.apply(this,arguments),s)},null,C)},m.translateTo=function(y,v,_,C,D){m.transform(y,function(){var A=t.apply(this,arguments),L=this.__zoom,H=C==null?x(A):typeof C=="function"?C.apply(this,arguments):C;return n(Qe.translate(H[0],H[1]).scale(L.k).translate(typeof v=="function"?-v.apply(this,arguments):-v,typeof _=="function"?-_.apply(this,arguments):-_),A,s)},C,D)};function k(y,v){return v=Math.max(i[0],Math.min(i[1],v)),v===y.k?y:new we(v,y.x,y.y)}function g(y,v,_){var C=v[0]-_[0]*y.k,D=v[1]-_[1]*y.k;return C===y.x&&D===y.y?y:new we(y.k,C,D)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function E(y,v,_,C){y.on("start.zoom",function(){S(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(C).end()}).tween("zoom",function(){var D=this,A=arguments,L=S(D,A).event(C),H=t.apply(D,A),F=_==null?x(H):typeof _=="function"?_.apply(D,A):_,K=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),Y=D.__zoom,G=typeof v=="function"?v.apply(D,A):v,ee=c(Y.invert(F).concat(K/Y.k),G.invert(F).concat(K/G.k));return function(q){if(q===1)q=G;else{var R=ee(q),Z=K/R[2];q=new we(Z,F[0]-R[0]*Z,F[1]-R[1]*Z)}L.zoom(null,q)}})}function S(y,v,_){return!_&&y.__zooming||new N(y,v)}function N(y,v){this.that=y,this.args=v,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,v),this.taps=0}N.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,v){return this.mouse&&y!=="mouse"&&(this.mouse[1]=v.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=v.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=v.invert(this.touch1[0])),this.that.__zoom=v,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var v=de(this.that).datum();l.call(y,this.that,new Vn(y,{sourceEvent:this.sourceEvent,target:m,type:y,transform:this.that.__zoom,dispatch:l}),v)}};function T(y,...v){if(!e.apply(this,arguments))return;var _=S(this,v).event(y),C=this.__zoom,D=Math.max(i[0],Math.min(i[1],C.k*Math.pow(2,o.apply(this,arguments)))),A=pe(y);if(_.wheel)(_.mouse[0][0]!==A[0]||_.mouse[0][1]!==A[1])&&(_.mouse[1]=C.invert(_.mouse[0]=A)),clearTimeout(_.wheel);else{if(C.k===D)return;_.mouse=[A,C.invert(A)],Ue(this),_.start()}ct(y),_.wheel=setTimeout(L,h),_.zoom("mouse",n(g(k(C,D),_.mouse[0],_.mouse[1]),_.extent,s));function L(){_.wheel=null,_.end()}}function I(y,...v){if(d||!e.apply(this,arguments))return;var _=y.currentTarget,C=S(this,v,!0).event(y),D=de(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",K,!0),A=pe(y,_),L=y.clientX,H=y.clientY;Et(y.view),tn(y),C.mouse=[A,this.__zoom.invert(A)],Ue(this),C.start();function F(Y){if(ct(Y),!C.moved){var G=Y.clientX-L,ee=Y.clientY-H;C.moved=G*G+ee*ee>w}C.event(Y).zoom("mouse",n(g(C.that.__zoom,C.mouse[0]=pe(Y,_),C.mouse[1]),C.extent,s))}function K(Y){D.on("mousemove.zoom mouseup.zoom",null),Nt(Y.view,C.moved),ct(Y),C.event(Y).end()}}function V(y,...v){if(e.apply(this,arguments)){var _=this.__zoom,C=pe(y.changedTouches?y.changedTouches[0]:y,this),D=_.invert(C),A=_.k*(y.shiftKey?.5:2),L=n(g(k(_,A),C,D),t.apply(this,v),s);ct(y),a>0?de(this).transition().duration(a).call(E,L,C,y):de(this).call(m.transform,L,C,y)}}function $(y,...v){if(e.apply(this,arguments)){var _=y.touches,C=_.length,D=S(this,v,y.changedTouches.length===C).event(y),A,L,H,F;for(tn(y),L=0;L<C;++L)H=_[L],F=pe(H,this),F=[F,this.__zoom.invert(F),H.identifier],D.touch0?!D.touch1&&D.touch0[2]!==F[2]&&(D.touch1=F,D.taps=0):(D.touch0=F,A=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),A&&(D.taps<2&&(f=F[0],u=setTimeout(function(){u=null},p)),Ue(this),D.start())}}function B(y,...v){if(this.__zooming){var _=S(this,v).event(y),C=y.changedTouches,D=C.length,A,L,H,F;for(ct(y),A=0;A<D;++A)L=C[A],H=pe(L,this),_.touch0&&_.touch0[2]===L.identifier?_.touch0[0]=H:_.touch1&&_.touch1[2]===L.identifier&&(_.touch1[0]=H);if(L=_.that.__zoom,_.touch1){var K=_.touch0[0],Y=_.touch0[1],G=_.touch1[0],ee=_.touch1[1],q=(q=G[0]-K[0])*q+(q=G[1]-K[1])*q,R=(R=ee[0]-Y[0])*R+(R=ee[1]-Y[1])*R;L=k(L,Math.sqrt(q/R)),H=[(K[0]+G[0])/2,(K[1]+G[1])/2],F=[(Y[0]+ee[0])/2,(Y[1]+ee[1])/2]}else if(_.touch0)H=_.touch0[0],F=_.touch0[1];else return;_.zoom("touch",n(g(L,H,F),_.extent,s))}}function M(y,...v){if(this.__zooming){var _=S(this,v).event(y),C=y.changedTouches,D=C.length,A,L;for(tn(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),A=0;A<D;++A)L=C[A],_.touch0&&_.touch0[2]===L.identifier?delete _.touch0:_.touch1&&_.touch1[2]===L.identifier&&delete _.touch1;if(_.touch1&&!_.touch0&&(_.touch0=_.touch1,delete _.touch1),_.touch0)_.touch0[1]=this.__zoom.invert(_.touch0[0]);else if(_.end(),_.taps===2&&(L=pe(L,this),Math.hypot(f[0]-L[0],f[1]-L[1])<b)){var H=de(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:Pt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Pt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Pt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Pt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(w=(y=+y)*y,m):Math.sqrt(w)},m.tapDistance=function(y){return arguments.length?(b=+y,m):b},m}var ge={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.`},pt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Wn=["Enter"," ","Escape"],qn={"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"},Ve;(function(e){e.Strict="strict",e.Loose="loose"})(Ve||(Ve={}));var De;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(De||(De={}));var je;(function(e){e.Partial="partial",e.Full="full"})(je||(je={}));var Kn={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},_e;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(_e||(_e={}));var ut;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ut||(ut={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));var yi={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},Gn=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,zi=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Un=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Tt=(e,t=[0,0])=>{let{width:n,height:o}=be(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Qn=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let n=!1,o=e.reduce((r,i)=>{let s=typeof i=="string",a=!t.nodeLookup&&!s?i:void 0;return t.nodeLookup&&(a=s?t.nodeLookup.get(i):Un(i)?i:t.nodeLookup.get(i.id)),a?(n=!0,cn(r,sn(a,t.nodeOrigin))):r},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?dn(o):{x:0,y:0,width:0,height:0}},ht=(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=cn(n,sn(r)),o=!0)}),o?dn(n):{x:0,y:0,width:0,height:0}},an=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{let a=(t.x-n)/r,c=(t.y-o)/r,l=t.width/r,u=t.height/r,f=[];for(let d of e.values()){let{measured:p,selectable:h=!0,hidden:w=!1}=d;if(s&&!h||w)continue;let b=p.width??d.width??d.initialWidth??0,m=p.height??d.height??d.initialHeight??0,{x:k,y:g}=d.internals.positionAbsolute,x=Oi(a,c,l,u,k,g,b,m),E=b*m,S=i&&x>0;(!d.internals.handleBounds||S||x>=E||d.dragging)&&f.push(d)}return f},Pi=(e,t)=>{let n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function xd(e,t){let n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){let{width:s,height:a}=be(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 Di({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;let a=xd(e,s),c=ht(a),l=$t(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function jn({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){let s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o,f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",ge.error005());else{let{width:p,height:h}=be(a);p&&h&&(f=[[c,l],[c+p,l+h]])}else a&&tt(s.extent)&&(f=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);let d=tt(f)?Je(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",ge.error015()),{position:{x:d.x-c+(s.measured.width??0)*u[0],y:d.y-l+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function Ai({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){let i=new Set(e.map(d=>d.id)),s=[];for(let d of n){if(d.deletable===!1)continue;let p=i.has(d.id),h=!p&&d.parentId&&s.find(w=>w.id===d.parentId);(p||h)&&s.push(d)}let a=new Set(t.map(d=>d.id)),c=o.filter(d=>d.deletable!==!1),u=Pi(s,c);for(let d of c)a.has(d.id)&&!u.find(h=>h.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};let f=await r({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}var ft=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Je=(e={x:0,y:0},t,n)=>({x:ft(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ft(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ti(e,t,n){let{width:o,height:r}=be(n),{x:i,y:s}=n.internals.positionAbsolute;return Je(e,[[i,s],[i+o,s+r]],t)}var bi=(e,t,n)=>e<t?ft(Math.abs(e-t),1,t)/t:e>n?-ft(Math.abs(e-n),1,t)/t:0,ln=(e,t,n=15,o=40)=>{let r=bi(e.x,o,t.width-o)*n,i=bi(e.y,o,t.height-o)*n;return[r,i]},cn=(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)}),Zn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),dn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),gt=(e,t=[0,0])=>{let{x:n,y:o}=Un(e)?e.internals.positionAbsolute:Tt(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}},sn=(e,t=[0,0])=>{let{x:n,y:o}=Un(e)?e.internals.positionAbsolute:Tt(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)}},Jn=(e,t)=>dn(cn(Zn(e),Zn(t))),Oi=(e,t,n,o,r,i,s,a)=>{let c=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),l=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(c*l)},Ot=(e,t)=>Oi(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),eo=e=>me(e.width)&&me(e.height)&&me(e.x)&&me(e.y),me=e=>!isNaN(e)&&isFinite(e),to=(e,t)=>(n,o)=>{},mt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{let a={x:(e-n)/r,y:(t-o)/r};return i?mt(a,s):a},et=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function dt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function wd(e,t,n){if(typeof e=="string"||typeof e=="number"){let o=dt(e,n),r=dt(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){let o=dt(e.top??e.y??0,n),r=dt(e.bottom??e.y??0,n),i=dt(e.left??e.x??0,t),s=dt(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 vd(e,t,n,o,r,i){let{x:s,y:a}=et(e,[t,n,o]),{x:c,y:l}=et({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,f=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}var $t=(e,t,n,o,r,i)=>{let s=wd(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),u=ft(l,o,r),f=e.x+e.width/2,d=e.y+e.height/2,p=t/2-f*u,h=n/2-d*u,w=vd(e,p,h,u,t,n),b={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:p-b.left+b.right,y:h-b.top+b.bottom,zoom:u}},bt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function tt(e){return e!=null&&e!=="parent"}function be(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function un(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function no(e,t={width:0,height:0},n,o,r){let i={...e},s=o.get(n);if(s){let 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 oo(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function $i(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Ri(e){return{...qn,...e||{}}}function ro(e){return e===null?null:e?"valid":"invalid"}function At(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){let{x:i,y:s}=ye(e),a=yt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?mt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}var fn=e=>({width:e.offsetWidth,height:e.offsetHeight}),io=e=>e?.getRootNode?.()||window?.document,kd=["INPUT","SELECT","TEXTAREA"];function so(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:kd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var ao=e=>"clientX"in e,ye=(e,t)=>{let n=ao(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)}},xi=(e,t,n,o,r)=>{let i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{let 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,...fn(s)}})};function pn({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){let c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,u=Math.abs(c-e),f=Math.abs(l-t);return[c,l,u,f]}function on(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case X.Left:return[t-on(t-o,i),n];case X.Right:return[t+on(o-t,i),n];case X.Top:return[t,n-on(n-r,i)];case X.Bottom:return[t,n+on(r-n,i)]}}function hn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,curvature:s=.25}){let[a,c]=wi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=wi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,d,p,h]=pn({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${o},${r}`,f,d,p,h]}function lo({sourceX:e,sourceY:t,targetX:n,targetY:o}){let 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 Hi({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;let 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 Li({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){let i=cn(sn(e),sn(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);let s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Ot(s,dn(i))>0}var _d=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Sd=(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)),Bi=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ge.error006()),t;let o=n.getEdgeId||_d,r;return Gn(e)?r={...e}:r={...e,id:o(e)},Sd(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function gn({sourceX:e,sourceY:t,targetX:n,targetY:o}){let[r,i,s,a]=lo({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}var vi={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Ed=({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},ki=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Nd({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){let a=vi[t],c=vi[o],l={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},f=Ed({source:l,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",p=f[d],h=[],w,b,m={x:0,y:0},k={x:0,y:0},[,,g,x]=lo({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*c[d]===-1){d==="x"?(w=r.x??l.x+(u.x-l.x)*s,b=r.y??(l.y+u.y)/2):(w=r.x??(l.x+u.x)/2,b=r.y??l.y+(u.y-l.y)*s);let T=[{x:w,y:l.y},{x:w,y:u.y}],I=[{x:l.x,y:b},{x:u.x,y:b}];a[d]===p?h=d==="x"?T:I:h=d==="x"?I:T}else{let T=[{x:l.x,y:u.y}],I=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===p?I:T:h=a.y===p?T:I,t===o){let y=Math.abs(e[d]-n[d]);if(y<=i){let v=Math.min(i-1,i-y);a[d]===p?m[d]=(l[d]>e[d]?-1:1)*v:k[d]=(u[d]>n[d]?-1:1)*v}}if(t!==o){let y=d==="x"?"y":"x",v=a[d]===c[y],_=l[y]>u[y],C=l[y]<u[y];(a[d]===1&&(!v&&_||v&&C)||a[d]!==1&&(!v&&C||v&&_))&&(h=d==="x"?T:I)}let V={x:l.x+m.x,y:l.y+m.y},$={x:u.x+k.x,y:u.y+k.y},B=Math.max(Math.abs(V.x-h[0].x),Math.abs($.x-h[0].x)),M=Math.max(Math.abs(V.y-h[0].y),Math.abs($.y-h[0].y));B>=M?(w=(V.x+$.x)/2,b=h[0].y):(w=h[0].x,b=(V.y+$.y)/2)}let E={x:l.x+m.x,y:l.y+m.y},S={x:u.x+k.x,y:u.y+k.y};return[[e,...E.x!==h[0].x||E.y!==h[0].y?[E]:[],...h,...S.x!==h[h.length-1].x||S.y!==h[h.length-1].y?[S]:[],n],w,b,g,x]}function Cd(e,t,n,o){let r=Math.min(ki(e,t)/2,ki(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){let l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*u}`}let a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function nt({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:o,targetY:r,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){let[f,d,p,h,w]=Nd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:u}),b=`M${f[0].x} ${f[0].y}`;for(let m=1;m<f.length-1;m++)b+=Cd(f[m-1],f[m],f[m+1],s);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,d,p,h,w]}function _i(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Vi(e){let{sourceNode:t,targetNode:n}=e;if(!_i(t)||!_i(n))return null;let o=t.internals.handleBounds||Si(t.handles),r=n.internals.handleBounds||Si(n.handles),i=Ei(o?.source??[],e.sourceHandle),s=Ei(e.connectionMode===Ve.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",ge.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let a=i?.position||X.Bottom,c=s?.position||X.Top,l=Fe(t,i,a),u=Fe(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function Si(e){if(!e)return null;let t=[],n=[];for(let 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 Fe(e,t,n=X.Left,o=!1){let r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??be(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 Ei(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function mn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function Fi(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){let i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){let l=mn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}var Yi=1e3,Md=10,co={nodeOrigin:[0,0],nodeExtent:pt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Id={...co,checkEquality:!0};function uo(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Xi(e,t,n){let o=uo(co,n);for(let r of e.values())if(r.parentId)po(r,e,t,o);else{let i=Tt(r,o.nodeOrigin),s=tt(r.extent)?r.extent:o.nodeExtent,a=Je(i,s,be(r));r.internals.positionAbsolute=a}}function zd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],o=[];for(let r of e.handles){let 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 fo(e){return e==="manual"}function yn(e,t,n,o={}){let r=uo(Id,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!fo(r.zIndexMode)?Yi:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let f=s.get(u.id);if(r.checkEquality&&u===f?.internals.userNode)t.set(u.id,f);else{let d=Tt(u,r.nodeOrigin),p=tt(u.extent)?u.extent:r.nodeExtent,h=Je(d,p,be(u));f={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:h,handleBounds:zd(u,f),z:Zi(u,a,r.zIndexMode),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),u.parentId&&po(f,t,n,o,i),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Pd(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function po(e,t,n,o,r){let{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=uo(co,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Pd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*Md),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);let f=i&&!fo(c)?Yi:0,{x:d,y:p,z:h}=Dd(e,u,s,a,f,c),{positionAbsolute:w}=e.internals,b=d!==w.x||p!==w.y;(b||h!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:d,y:p}:w,z:h}})}function Zi(e,t,n){let o=me(e.zIndex)?e.zIndex:0;return fo(n)?o:o+(e.selected?t:0)}function Dd(e,t,n,o,r,i){let{x:s,y:a}=t.internals.positionAbsolute,c=be(e),l=Tt(e,n),u=tt(e.extent)?Je(l,e.extent,c):l,f=Je({x:s+u.x,y:a+u.y},o,c);e.extent==="parent"&&(f=Ti(f,c,t));let d=Zi(e,r,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=d?p+1:d}}function bn(e,t,n,o=[0,0]){let r=[],i=new Map;for(let s of e){let a=t.get(s.parentId);if(!a)continue;let c=i.get(s.parentId)?.expandedRect??gt(a),l=Jn(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{let l=a.internals.positionAbsolute,u=be(a),f=a.origin??o,d=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,p=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,h=Math.max(u.width,Math.round(s.width)),w=Math.max(u.height,Math.round(s.height)),b=(h-u.width)*f[0],m=(w-u.height)*f[1];(d>0||p>0||b||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-d+b,y:a.position.y-p+m}}),n.get(c)?.forEach(k=>{e.some(g=>g.id===k.id)||r.push({id:k.id,type:"position",position:{x:k.position.x+d,y:k.position.y+p}})})),(u.width<s.width||u.height<s.height||d||p)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:h+(d?f[0]*d-b:0),height:w+(p?f[1]*p-m:0)}})}),r}function Wi(e,t,n,o,r,i,s){let a=o?.querySelector(".xyflow__viewport"),c=!1;if(!a)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];for(let p of e.values()){let h=t.get(p.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),c=!0;continue}let w=fn(p.nodeElement),b=h.measured.width!==w.width||h.measured.height!==w.height;if(!!(w.width&&w.height&&(b||!h.internals.handleBounds||p.force))){let k=p.nodeElement.getBoundingClientRect(),g=tt(h.extent)?h.extent:i,{positionAbsolute:x}=h.internals;if(h.parentId&&h.extent==="parent"){let S=t.get(h.parentId);S&&(x=Ti(x,w,S))}else g&&(x=Je(x,g,w));let E={...h,measured:w,internals:{...h.internals,positionAbsolute:x,handleBounds:{source:xi("source",p.nodeElement,k,f,h.id),target:xi("target",p.nodeElement,k,f,h.id)}}};t.set(h.id,E),h.parentId&&po(E,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,b&&(l.push({id:h.id,type:"dimensions",dimensions:w}),h.expandParent&&h.parentId&&d.push({id:h.id,parentId:h.parentId,rect:gt(E,r)}))}}if(d.length>0){let p=bn(d,t,n,r);l.push(...p)}return{changes:l,updatedInternals:c}}async function qi({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;let 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 Ni(e,t,n,o,r,i){let s=r,a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;let c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;let l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function ho(e,t,n){e.clear(),t.clear();for(let o of n){let{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Ni("source",c,u,e,r,s),Ni("target",c,l,e,i,a),t.set(o.id,o)}}function Ki(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Ki(n,t):!1}function Ci(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 Ad(e,t,n,o){let r=new Map;for(let[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ki(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){let 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 Fn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){let r=[];for(let[s,a]of t){let c=n.get(s)?.internals.userNode;c&&r.push({...c,position:a.position,dragging:o})}if(!e)return[r[0],r];let i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Td({dragItems:e,snapGrid:t,x:n,y:o}){let r=e.values().next().value;if(!r)return null;let i={x:n-r.distance.x,y:o-r.distance.y},s=mt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Gi({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},u=null,f=!1,d=null,p=!1,h=!1,w=null;function b({noDragClassName:k,handleSelector:g,domNode:x,isSelectable:E,nodeId:S,nodeClickDistance:N=0}){d=de(x);function T({x:B,y:M}){let{nodeLookup:y,nodeExtent:v,snapGrid:_,snapToGrid:C,nodeOrigin:D,onNodeDrag:A,onSelectionDrag:L,onError:H,updateNodePositions:F}=t();i={x:B,y:M};let K=!1,Y=a.size>1,G=Y&&v?Zn(ht(a)):null,ee=Y&&C?Td({dragItems:a,snapGrid:_,x:B,y:M}):null;for(let[q,R]of a){if(!y.has(q))continue;let Z={x:B-R.distance.x,y:M-R.distance.y};C&&(Z=ee?{x:Math.round(Z.x+ee.x),y:Math.round(Z.y+ee.y)}:mt(Z,_));let j=null;if(Y&&v&&!R.extent&&G){let{positionAbsolute:U}=R.internals,te=U.x-G.x+v[0][0],ne=U.x+R.measured.width-G.x2+v[1][0],re=U.y-G.y+v[0][1],ue=U.y+R.measured.height-G.y2+v[1][1];j=[[te,re],[ne,ue]]}let{position:Q,positionAbsolute:W}=jn({nodeId:q,nextPosition:Z,nodeLookup:y,nodeExtent:j||v,nodeOrigin:D,onError:H});K=K||R.position.x!==Q.x||R.position.y!==Q.y,R.position=Q,R.internals.positionAbsolute=W}if(h=h||K,!!K&&(F(a,!0),w&&(o||A||!S&&L))){let[q,R]=Fn({nodeId:S,dragItems:a,nodeLookup:y});o?.(w,a,q,R),A?.(w,q,R),S||L?.(w,R)}}async function I(){if(!u)return;let{transform:B,panBy:M,autoPanSpeed:y,autoPanOnNodeDrag:v}=t();if(!v){c=!1,cancelAnimationFrame(s);return}let[_,C]=ln(l,u,y);(_!==0||C!==0)&&(i.x=(i.x??0)-_/B[2],i.y=(i.y??0)-C/B[2],await M({x:_,y:C})&&T(i)),s=requestAnimationFrame(I)}function V(B){let{nodeLookup:M,multiSelectionActive:y,nodesDraggable:v,transform:_,snapGrid:C,snapToGrid:D,selectNodesOnDrag:A,onNodeDragStart:L,onSelectionDragStart:H,unselectNodesAndEdges:F}=t();f=!0,(!A||!E)&&!y&&S&&(M.get(S)?.selected||F()),E&&A&&S&&e?.(S);let K=At(B.sourceEvent,{transform:_,snapGrid:C,snapToGrid:D,containerBounds:u});if(i=K,a=Ad(M,v,K,S),a.size>0&&(n||L||!S&&H)){let[Y,G]=Fn({nodeId:S,dragItems:a,nodeLookup:M});n?.(B.sourceEvent,a,Y,G),L?.(B.sourceEvent,Y,G),S||H?.(B.sourceEvent,G)}}let $=Kt().clickDistance(N).on("start",B=>{let{domNode:M,nodeDragThreshold:y,transform:v,snapGrid:_,snapToGrid:C}=t();u=M?.getBoundingClientRect()||null,p=!1,h=!1,w=B.sourceEvent,y===0&&V(B),i=At(B.sourceEvent,{transform:v,snapGrid:_,snapToGrid:C,containerBounds:u}),l=ye(B.sourceEvent,u)}).on("drag",B=>{let{autoPanOnNodeDrag:M,transform:y,snapGrid:v,snapToGrid:_,nodeDragThreshold:C,nodeLookup:D}=t(),A=At(B.sourceEvent,{transform:y,snapGrid:v,snapToGrid:_,containerBounds:u});if(w=B.sourceEvent,(B.sourceEvent.type==="touchmove"&&B.sourceEvent.touches.length>1||S&&!D.has(S))&&(p=!0),!p){if(!c&&M&&f&&(c=!0,I()),!f){let L=ye(B.sourceEvent,u),H=L.x-l.x,F=L.y-l.y;Math.sqrt(H*H+F*F)>C&&V(B)}(i.x!==A.xSnapped||i.y!==A.ySnapped)&&a&&f&&(l=ye(B.sourceEvent,u),T(A))}}).on("end",B=>{if(!f||p){p&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,f=!1,cancelAnimationFrame(s),a.size>0){let{nodeLookup:M,updateNodePositions:y,onNodeDragStop:v,onSelectionDragStop:_}=t();if(h&&(y(a,!1),h=!1),r||v||!S&&_){let[C,D]=Fn({nodeId:S,dragItems:a,nodeLookup:M,dragging:!1});r?.(B.sourceEvent,a,C,D),v?.(B.sourceEvent,C,D),S||_?.(B.sourceEvent,D)}}}).filter(B=>{let M=B.target;return!B.button&&(!k||!Ci(M,`.${k}`,x))&&(!g||Ci(M,g,x))});d.call($)}function m(){d?.on(".drag",null)}return{update:b,destroy:m}}function Od(e,t,n){let o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let i of t.values())Ot(r,gt(i))>0&&o.push(i);return o}var $d=250;function Rd(e,t,n,o){let r=[],i=1/0,s=Od(e,n,t+$d);for(let a of s){let c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(let l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;let{x:u,y:f}=Fe(a,l,l.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<i?(r=[{...l,x:u,y:f}],i=d):d===i&&r.push({...l,x:u,y:f}))}}if(!r.length)return null;if(r.length>1){let a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function Ui(e,t,n,o,r,i=!1){let s=o.get(e);if(!s)return null;let a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...Fe(s,c,c.position,!0)}:c}function Qi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Hd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var ji=()=>!0;function Ld(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:p,onConnectStart:h,onConnect:w,onConnectEnd:b,isValidConnection:m=ji,onReconnectEnd:k,updateConnection:g,getTransform:x,getFromHandle:E,autoPanSpeed:S,dragThreshold:N=1,handleDomNode:T}){let I=io(e.target),V=0,$,{x:B,y:M}=ye(e),y=Qi(i,T),v=a?.getBoundingClientRect(),_=!1;if(!v||!y)return;let C=Ui(r,y,o,c,t);if(!C)return;let D=ye(e,v),A=!1,L=null,H=!1,F=null;function K(){if(!u||!v)return;let[Q,W]=ln(D,v,S);d({x:Q,y:W}),V=requestAnimationFrame(K)}let Y={...C,nodeId:r,type:y,position:C.position},G=c.get(r),q={inProgress:!0,isValid:null,from:Fe(G,Y,X.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:G,to:D,toHandle:null,toPosition:yi[Y.position],toNode:null,pointer:D};function R(){_=!0,g(q),h?.(e,{nodeId:r,handleId:o,handleType:y})}N===0&&R();function Z(Q){if(!_){let{x:ue,y:Se}=ye(Q),ve=ue-B,ke=Se-M;if(!(ve*ve+ke*ke>N*N))return;R()}if(!E()||!Y){j(Q);return}let W=x();D=ye(Q,v),$=Rd(yt(D,W,!1,[1,1]),n,c,Y),A||(K(),A=!0);let U=Ji(Q,{handle:$,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:I,lib:l,flowId:f,nodeLookup:c});F=U.handleDomNode,L=U.connection,H=Hd(!!$,U.isValid);let te=c.get(r),ne=te?Fe(te,Y,X.Left,!0):q.from,re={...q,from:ne,isValid:H,to:U.toHandle&&H?et({x:U.toHandle.x,y:U.toHandle.y},W):D,toHandle:U.toHandle,toPosition:H&&U.toHandle?U.toHandle.position:yi[Y.position],toNode:U.toHandle?c.get(U.toHandle.nodeId):null,pointer:D};g(re),q=re}function j(Q){if(!("touches"in Q&&Q.touches.length>0)){if(_){($||F)&&L&&H&&w?.(L);let{inProgress:W,...U}=q,te={...U,toPosition:q.toHandle?q.toPosition:null};b?.(Q,te),i&&k?.(Q,te)}p(),cancelAnimationFrame(V),A=!1,H=!1,L=null,F=null,I.removeEventListener("mousemove",Z),I.removeEventListener("mouseup",j),I.removeEventListener("touchmove",Z),I.removeEventListener("touchend",j)}}I.addEventListener("mousemove",Z),I.addEventListener("mouseup",j),I.addEventListener("touchmove",Z),I.addEventListener("touchend",j)}function Ji(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=ji,nodeLookup:u}){let f=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:h}=ye(e),w=s.elementFromPoint(p,h),b=w?.classList.contains(`${a}-flow__handle`)?w:d,m={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){let k=Qi(void 0,b),g=b.getAttribute("data-nodeid"),x=b.getAttribute("data-handleid"),E=b.classList.contains("connectable"),S=b.classList.contains("connectableend");if(!g||!k)return m;let N={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};m.connection=N;let I=E&&S&&(n===Ve.Strict?f&&k==="source"||!f&&k==="target":g!==o||x!==r);m.isValid=I&&l(N),m.toHandle=Ui(g,k,x,u,n,!0)}return m}var xn={onPointerDown:Ld,isValid:Ji};function es({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){let r=de(e);function i({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:p=!1}){let h=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;let x=n(),E=g.sourceEvent.ctrlKey&&bt()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,N=x[2]*Math.pow(2,S*E);t.scaleTo(N)},w=[0,0],b=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(w=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},m=g=>{let x=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;let E=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[E[0]-w[0],E[1]-w[1]];w=E;let N=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),T={x:x[0]-S[0]*N,y:x[1]-S[1]*N},I=[[0,0],[c,l]];t.setViewportConstrained({x:T.x,y:T.y,zoom:x[2]},I,a)},k=nn().on("start",b).on("zoom",f?m:null).on("zoom.wheel",d?h:null);r.call(k,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:pe}}var wn=e=>({x:e.x,y:e.y,zoom:e.k}),Yn=({x:e,y:t,zoom:n})=>Qe.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),ts=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Bd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xn=(e,t=0,n=Bd,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},ns=e=>{let t=e.ctrlKey&&bt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Vd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(Be(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let f=n.property("__zoom").k||1;if(u.ctrlKey&&s){let b=pe(u),m=ns(u),k=f*Math.pow(2,m);o.scaleTo(n,k,b,u);return}let d=u.deltaMode===1?20:1,p=r===De.Vertical?0:u.deltaX*d,h=r===De.Horizontal?0:u.deltaY*d;!bt()&&u.shiftKey&&r!==De.Vertical&&(p=u.deltaY*d,h=0),o.translateBy(n,-(p/f)*i,-(h/f)*i,{internal:!0});let w=wn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,w):(e.isPanScrolling=!0,a?.(u,w)),e.panScrollTimeout=setTimeout(()=>{l?.(u,w),e.isPanScrolling=!1},150)}}function Fd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){let i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Be(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Yd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;let r=wn(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 Xd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&ts(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,wn(i.transform))}}function Zd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&ts(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){let a=wn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Wd({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:c,noPanClassName:l,lib:u,connectionInProgress:f}){return d=>{let p=t||n,h=o&&d.ctrlKey,w=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Be(d,`${u}-flow__node`)||Be(d,`${u}-flow__edge`)||Be(d,`${u}-flow__selection`)||Be(d,`${u}-flow__nodesselection`)))return!0;if(!r&&!p&&!i&&!s&&!o||a||f&&!w||Be(d,c)&&w||Be(d,l)&&(!w||i&&w&&!t)||!o&&d.ctrlKey&&w)return!1;if(!o&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!p&&!i&&!h&&w||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;let b=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||w||e)&&b}}function os({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),f=[[0,0],[u.width,u.height]];(typeof ResizeObserver<"u"?new ResizeObserver(M=>{let y=M[0];y&&(f=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);let p=nn().extent(()=>f).scaleExtent([t,n]).translateExtent(o),h=de(e).call(p);x({x:r.x,y:r.y,zoom:ft(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);let w=h.on("wheel.zoom"),b=h.on("dblclick.zoom");p.wheelDelta(ns);async function m(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).transform(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}function k({noWheelClassName:M,noPanClassName:y,onPaneContextMenu:v,userSelectionActive:_,panOnScroll:C,panOnDrag:D,panOnScrollMode:A,panOnScrollSpeed:L,preventScrolling:H,zoomOnPinch:F,zoomOnScroll:K,zoomOnDoubleClick:Y,panActivationKeyPressed:G=!1,zoomActivationKeyPressed:ee,lib:q,onTransformChange:R,connectionInProgress:Z,paneClickDistance:j,selectionOnDrag:Q}){_&&!l.isZoomingOrPanning&&g();let W=C&&!ee&&!_;p.clickDistance(Q?1/0:!me(j)||j<0?0:j);let U=W?Vd({zoomPanValues:l,noWheelClassName:M,d3Selection:h,d3Zoom:p,panOnScrollMode:A,panOnScrollSpeed:L,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Fd({noWheelClassName:M,preventScrolling:H,d3ZoomHandler:w});h.on("wheel.zoom",U,{passive:!1});let te=Yd({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});p.on("start",te);let ne=Xd({zoomPanValues:l,panOnDrag:D,onPaneContextMenu:!!v,onPanZoom:i,onTransformChange:R});p.on("zoom",ne);let re=Zd({zoomPanValues:l,panOnDrag:D,panOnScroll:C,onPaneContextMenu:v,onPanZoomEnd:a,onDraggingChange:c});p.on("end",re);let ue=Wd({panActivationKeyPressed:G,zoomActivationKeyPressed:ee,panOnDrag:D,zoomOnScroll:K,panOnScroll:C,zoomOnDoubleClick:Y,zoomOnPinch:F,userSelectionActive:_,noPanClassName:y,noWheelClassName:M,lib:q,connectionInProgress:Z});p.filter(ue),Y?h.on("dblclick.zoom",b):h.on("dblclick.zoom",null)}function g(){p.on("zoom",null)}async function x(M,y,v){let _=Yn(M),C=p?.constrain()(_,y,v);return C&&await m(C),C}async function E(M,y){let v=Yn(M);return await m(v,y),v}function S(M){if(h){let y=Yn(M),v=h.property("__zoom");(v.k!==M.zoom||v.x!==M.x||v.y!==M.y)&&p?.transform(h,y,null,{sync:!0})}}function N(){let M=h?Dt(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}async function T(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleTo(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}async function I(M,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleBy(Xn(h,y?.duration,y?.ease,()=>v(!0)),M)}):!1}function V(M){p?.scaleExtent(M)}function $(M){p?.translateExtent(M)}function B(M){let y=!me(M)||M<0?0:M;p?.clickDistance(y)}return{update:k,destroy:g,setViewport:E,setViewportConstrained:x,getViewport:N,scaleTo:T,scaleBy:I,setScaleExtent:V,setTranslateExtent:$,syncViewport:S,setClickDistance:B}}var Ye;(function(e){e.Line="line",e.Handle="handle"})(Ye||(Ye={}));function qd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){let s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Mi(e){let 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 He(e,t){return Math.max(0,t-e)}function Le(e,t){return Math.max(0,e-t)}function rn(e,t,n){return Math.max(0,t-e,e-n)}function Ii(e,t){return e?!t:t}function Kd(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:p,ySnapped:h}=n,{minWidth:w,maxWidth:b,minHeight:m,maxHeight:k}=o,{x:g,y:x,width:E,height:S,aspectRatio:N}=e,T=Math.floor(u?p-e.pointerX:0),I=Math.floor(f?h-e.pointerY:0),V=E+(c?-T:T),$=S+(l?-I:I),B=-i[0]*E,M=-i[1]*S,y=rn(V,w,b),v=rn($,m,k);if(s){let D=0,A=0;c&&T<0?D=He(g+T+B,s[0][0]):!c&&T>0&&(D=Le(g+V+B,s[1][0])),l&&I<0?A=He(x+I+M,s[0][1]):!l&&I>0&&(A=Le(x+$+M,s[1][1])),y=Math.max(y,D),v=Math.max(v,A)}if(a){let D=0,A=0;c&&T>0?D=Le(g+T,a[0][0]):!c&&T<0&&(D=He(g+V,a[1][0])),l&&I>0?A=Le(x+I,a[0][1]):!l&&I<0&&(A=He(x+$,a[1][1])),y=Math.max(y,D),v=Math.max(v,A)}if(r){if(u){let D=rn(V/N,m,k)*N;if(y=Math.max(y,D),s){let A=0;!c&&!l||c&&!l&&d?A=Le(x+M+V/N,s[1][1])*N:A=He(x+M+(c?T:-T)/N,s[0][1])*N,y=Math.max(y,A)}if(a){let A=0;!c&&!l||c&&!l&&d?A=He(x+V/N,a[1][1])*N:A=Le(x+(c?T:-T)/N,a[0][1])*N,y=Math.max(y,A)}}if(f){let D=rn($*N,w,b)/N;if(v=Math.max(v,D),s){let A=0;!c&&!l||l&&!c&&d?A=Le(g+$*N+B,s[1][0])/N:A=He(g+(l?I:-I)*N+B,s[0][0])/N,v=Math.max(v,A)}if(a){let A=0;!c&&!l||l&&!c&&d?A=He(g+$*N,a[1][0])/N:A=Le(g+(l?I:-I)*N,a[0][0])/N,v=Math.max(v,A)}}}I=I+(I<0?v:-v),T=T+(T<0?y:-y),r&&(d?V>$*N?I=(Ii(c,l)?-T:T)/N:T=(Ii(c,l)?-I:I)*N:u?(I=T/N,l=c):(T=I*N,c=l));let _=c?g+T:g,C=l?x+I:x;return{width:E+(c?-T:T),height:S+(l?-I:I),x:i[0]*T*(c?-1:1)+_,y:i[1]*I*(l?-1:1)+C}}var rs={width:0,height:0,x:0,y:0},Gd={...rs,pointerX:0,pointerY:0,aspectRatio:1};function Ud(e,t,n){let o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function is({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let i=de(e),s={controlDirection:Mi("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:p,onResize:h,onResizeEnd:w,shouldResize:b}){let m={...rs},k={...Gd};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Mi(l)};let g,x=null,E=[],S,N,T,I=Kt().on("start",V=>{let{nodeLookup:$,transform:B,snapGrid:M,snapToGrid:y,nodeOrigin:v,paneDomNode:_}=n();if(g=$.get(t),!g)return;x=_?.getBoundingClientRect()??null;let{xSnapped:C,ySnapped:D}=At(V.sourceEvent,{transform:B,snapGrid:M,snapToGrid:y,containerBounds:x});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},k={...m,pointerX:C,pointerY:D,aspectRatio:m.width/m.height},S=void 0,N=tt(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=$.get(g.parentId)),S&&g.extent==="parent"&&(N=[[0,0],[S.measured.width,S.measured.height]]),E=[],T=void 0;for(let[A,L]of $)if(L.parentId===t&&(E.push({id:A,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){let H=Ud(L,g,L.origin??v);T?T=[[Math.min(H[0][0],T[0][0]),Math.min(H[0][1],T[0][1])],[Math.max(H[1][0],T[1][0]),Math.max(H[1][1],T[1][1])]]:T=H}p?.(V,{...m})}).on("drag",V=>{let{transform:$,snapGrid:B,snapToGrid:M,nodeOrigin:y}=n(),v=At(V.sourceEvent,{transform:$,snapGrid:B,snapToGrid:M,containerBounds:x}),_=[];if(!g)return;let{x:C,y:D,width:A,height:L}=m,H={},F=g.origin??y,{width:K,height:Y,x:G,y:ee}=Kd(k,s.controlDirection,v,s.boundaries,s.keepAspectRatio,F,N,T),q=K!==A,R=Y!==L,Z=G!==C&&q,j=ee!==D&&R;if(!Z&&!j&&!q&&!R)return;let Q={prevValues:{...m},startX:k.x,startY:k.y,childNodes:E.map(ne=>({...ne,position:{...ne.position}}))};if((Z||j||F[0]===1||F[1]===1)&&(H.x=Z?G:m.x,H.y=j?ee:m.y,m.x=H.x,m.y=H.y,E.length>0)){let ne=G-C,re=ee-D;for(let ue of E)ue.position={x:ue.position.x-ne+F[0]*(K-A),y:ue.position.y-re+F[1]*(Y-L)},_.push(ue)}if((q||R)&&(H.width=q&&(!s.resizeDirection||s.resizeDirection==="horizontal")?K:m.width,H.height=R&&(!s.resizeDirection||s.resizeDirection==="vertical")?Y:m.height,m.width=H.width,m.height=H.height),S&&g.expandParent){let ne=F[0]*(H.width??0);H.x&&H.x<ne&&(m.x=ne,k.x=k.x-(H.x-ne));let re=F[1]*(H.height??0);H.y&&H.y<re&&(m.y=re,k.y=k.y-(H.y-re))}let W=qd({width:m.width,prevWidth:A,height:m.height,prevHeight:L,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),U={...m,direction:W};if(b?.(V,U)===!1){m=Q.prevValues,k.x=Q.startX,k.y=Q.startY,E.forEach((ne,re)=>{ne.position=Q.childNodes[re].position});return}h?.(V,U),o(H,_)}).on("end",V=>{w?.(V,{...m}),r?.({...m})});i.call(I)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var cs=Te(Dn(),1),ds=Te(Il(),1);var ss=e=>{let t,n=new Set,o=(u,f)=>{let d=typeof u=="function"?u(t):u;if(!Object.is(d,t)){let p=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(h=>h(t,p))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},as=e=>e?ss(e):ss;var{useDebugValue:Qd}=cs.default,{useSyncExternalStoreWithSelector:jd}=ds.default,Jd=e=>e;function go(e,t=Jd,n){let o=jd(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Qd(o),o}var ls=(e,t)=>{let n=as(e),o=(r,i=t)=>go(n,r,i);return Object.assign(o,n),o},us=(e,t)=>e?ls(e,t):ls;function ie(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[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(let o of e)if(!t.has(o))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}var eu=Te(Ml()),Sn=(0,P.createContext)(null),tu=Sn.Provider,Hs=ge.error001("react");function J(e,t){let n=(0,P.useContext)(Sn);if(n===null)throw new Error(Hs);return go(n,e,t)}function se(){let e=(0,P.useContext)(Sn);if(e===null)throw new Error(Hs);return(0,P.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var fs={display:"none"},nu={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ls="react-flow__node-desc",Bs="react-flow__edge-desc",ou="react-flow__aria-live",ru=e=>e.ariaLiveMessage,iu=e=>e.ariaLabelConfig;function su({rfId:e}){let t=J(ru);return(0,z.jsx)("div",{id:`${ou}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:nu,children:t})}function au({rfId:e,disableKeyboardA11y:t}){let n=J(iu);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{id:`${Ls}-${e}`,style:fs,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,z.jsx)("div",{id:`${Bs}-${e}`,style:fs,children:n["edge.a11yDescription.default"]}),!t&&(0,z.jsx)(su,{rfId:e})]})}var En=(0,P.forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{let s=`${e}`.split("-");return(0,z.jsx)("div",{className:ae(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});En.displayName="Panel";var ps="https://reactflow.dev?utm_source=attribution";function lu({proOptions:e,position:t="bottom-right"}){return(0,P.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,z.jsx)(En,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ps}`,children:(0,z.jsx)("a",{href:ps,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var cu=e=>{let t=[],n=[];for(let[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(let[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},vn=e=>e.id;function du(e,t){return ie(e.selectedNodes.map(vn),t.selectedNodes.map(vn))&&ie(e.selectedEdges.map(vn),t.selectedEdges.map(vn))}function uu({onSelectionChange:e}){let t=se(),{selectedNodes:n,selectedEdges:o}=J(cu,du);return(0,P.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}var fu=e=>!!e.onSelectionChangeHandlers;function pu({onSelectionChange:e}){let t=J(fu);return e||t?(0,z.jsx)(uu,{onSelectionChange:e}):null}var Vs=[0,0],hu={x:0,y:0,zoom:1},gu=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],hs=[...gu,"rfId"],mu=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}),gs={translateExtent:pt,nodeOrigin:Vs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yu(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(mu,ie),l=se();(0,P.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=gs,a()}),[]);let u=(0,P.useRef)(gs);return(0,P.useEffect)(()=>{for(let f of hs){let d=e[f],p=u.current[f];d!==p&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?o(d):f==="maxZoom"?r(d):f==="translateExtent"?i(d):f==="nodeExtent"?s(d):f==="ariaLabelConfig"?l.setState({ariaLabelConfig:Ri(d)}):f==="fitView"?l.setState({fitViewQueued:d}):f==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[f]:d})))}u.current=e},hs.map(f=>e[f])),null}function ms(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bu(e){let[t,n]=(0,P.useState)(e==="system"?null:e);return(0,P.useEffect)(()=>{if(e!=="system"){n(e);return}let o=ms(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:ms()?.matches?"dark":"light"}var ys=typeof document<"u"?document:null;function Rt(e=null,t={target:ys,actInsideInputWithModifier:!0}){let[n,o]=(0,P.useState)(!1),r=(0,P.useRef)(!1),i=(0,P.useRef)(new Set([])),[s,a]=(0,P.useMemo)(()=>{if(e!==null){let l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace(/\+/g,`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|