showai-reader 0.11.0-reader.q7rotyau → 0.11.0-reader.wtfl5sb2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +1 -1
  2. package/chunks/{CardGrid-Y2H5CDOF.js → CardGrid-T3FSWHXC.js} +1 -1
  3. package/chunks/{CommandReference-DGADWXIZ.js → CommandReference-SF75ICXM.js} +1 -1
  4. package/chunks/{ComparisonMatrix-VAWMZLZR.js → ComparisonMatrix-NNKC7YC3.js} +1 -1
  5. package/chunks/{EventTimeline-5DPPQUM3.js → EventTimeline-BRCUCKMQ.js} +1 -1
  6. package/chunks/{ExperimentTracker-YXEM4O5T.js → ExperimentTracker-BRSJOLLO.js} +1 -1
  7. package/chunks/{ExternalDiagram-62UYKMOT.js → ExternalDiagram-RCMHZLER.js} +1 -1
  8. package/chunks/{Flowchart-E5AYMPF5.js → Flowchart-WJP2JRTK.js} +1 -1
  9. package/chunks/{G2Chart-OGP5A2UX.js → G2Chart-ZLNZM5JV.js} +16 -16
  10. package/chunks/{LayerDiagram-QG2AAZ2Y.js → LayerDiagram-AWY74YLK.js} +1 -1
  11. package/chunks/{Mindmap-GESX7CUV.js → Mindmap-5CEPNNER.js} +1 -1
  12. package/chunks/RichTextEditor-MSSA7XJT.js +157 -0
  13. package/chunks/{Roadmap-FH32SWTD.js → Roadmap-X5XVO5RX.js} +1 -1
  14. package/chunks/{Scene3D-FYDLISIF.js → Scene3D-MLR3IQZP.js} +2 -2
  15. package/chunks/{SequenceDiagram-5WN3RS2D.js → SequenceDiagram-JYU4DY6U.js} +1 -1
  16. package/chunks/{StatusTree-M3VI2IOA.js → StatusTree-3755EO2T.js} +1 -1
  17. package/chunks/{StepGuide-YZNBLBGI.js → StepGuide-HUZBM5MV.js} +1 -1
  18. package/chunks/{StructureBrowser-OP5AHX5E.js → StructureBrowser-QHESCWDB.js} +1 -1
  19. package/chunks/{Waterfall-X3KNTGX6.js → Waterfall-LJJTJ72K.js} +1 -1
  20. package/chunks/chunk-7ZXWWQSW.js +1 -0
  21. package/chunks/{chunk-FQTZDERM.js → chunk-HX7ODTGN.js} +1 -1
  22. package/chunks/{chunk-6WJL2K53.js → chunk-IFGCGSTS.js} +1 -1
  23. package/chunks/chunk-SRK2EFSL.js +10 -0
  24. package/chunks/{pdf-engine-XQHKQXXX.js → pdf-engine-N5IEZMV3.js} +29 -29
  25. package/index.js +1 -1
  26. package/manifest.json +4 -4
  27. package/package.json +1 -1
  28. package/{reader-Q7ROTYAU.js → reader-WTFL5SB2.js} +42 -42
  29. package/chunks/RichTextEditor-LGHYCOEE.js +0 -157
  30. package/chunks/chunk-2QFH7WHG.js +0 -1
  31. package/chunks/chunk-RE47W7O4.js +0 -9
  32. /package/chunks/{G2Chart-OGP5A2UX.js.LEGAL.txt → G2Chart-ZLNZM5JV.js.LEGAL.txt} +0 -0
  33. /package/chunks/{Scene3D-FYDLISIF.js.LEGAL.txt → Scene3D-MLR3IQZP.js.LEGAL.txt} +0 -0
  34. /package/{reader-Q7ROTYAU.js.LEGAL.txt → reader-WTFL5SB2.js.LEGAL.txt} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as st,b as $n,e as Rn,g as Qo,h as jo,i as Vt,j as Jo,k as er,l as at,o as tr,p as nr,q as Hn}from"./chunk-P5ET5XMK.js";import{a as Wo,b as qo}from"./chunk-5CTTY5BQ.js";import{d as Yo,e as Xo}from"./chunk-Y3REFBB6.js";import{b as Dl}from"./chunk-AW4RA5UH.js";import{a as Bo,b as Vo}from"./chunk-GLP5VV7P.js";import"./chunk-5AW2WUSZ.js";import{h as Ko,i as Go,j as Uo}from"./chunk-2QFH7WHG.js";import{b as Tn,f as On,i as Zo}from"./chunk-2YLUVQCJ.js";import{B as Do,C as Ao,Cb as Me,Da as $o,Ea as Ro,Ja as Ho,a as Bt,c as Dn,nb as Lo,ob as An,pb as Pl,ra as To,ua as Oo}from"./chunk-IJTLAUEC.js";import{a as Fo}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",Ln={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)),Ln.hasOwnProperty(t)?{space:Ln[t],local:e}:e}function Al(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 Tl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Yt(e){var t=Ie(e);return(t.local?Tl:Al)(t)}function Ol(){}function Ke(e){return e==null?Ol:function(){return this.querySelector(e)}}function or(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 Bn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function $l(){return[]}function kt(e){return e==null?$l:function(){return this.querySelectorAll(e)}}function Rl(e){return function(){return Bn(e.apply(this,arguments))}}function rr(e){typeof e=="function"?e=Rl(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 Hl=Array.prototype.find;function Ll(e){return function(){return Hl.call(this.children,e)}}function Bl(){return this.firstElementChild}function ir(e){return this.select(e==null?Bl:Ll(typeof e=="function"?e:Xt(e)))}var Vl=Array.prototype.filter;function Fl(){return Array.from(this.children)}function Yl(e){return function(){return Vl.call(this.children,e)}}function sr(e){return this.selectAll(e==null?Fl:Yl(typeof e=="function"?e:Xt(e)))}function ar(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 lr(){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 cr(e){return function(){return e}}function Xl(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 Zl(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 Wl(e){return e.__data__}function dr(e,t){if(!arguments.length)return Array.from(this,Wl);var n=t?Zl:Xl,o=this._parents,r=this._groups;typeof e!="function"&&(e=cr(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=ql(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 ql(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ur(){return new le(this._exit||this._groups.map(Zt),this._parents)}function fr(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 pr(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 hr(){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 gr(e){e||(e=Kl);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 Kl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function mr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function yr(){return Array.from(this)}function br(){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 xr(){let e=0;for(let t of this)++e;return e}function wr(){return!this.node()}function vr(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 Gl(e){return function(){this.removeAttribute(e)}}function Ul(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ql(e,t){return function(){this.setAttribute(e,t)}}function jl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Jl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ec(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 kr(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?Ul:Gl:typeof t=="function"?n.local?ec:Jl:n.local?jl:Ql)(n,t))}function Wt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function tc(e){return function(){this.style.removeProperty(e)}}function nc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function oc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function _r(e,t,n){return arguments.length>1?this.each((t==null?tc:typeof t=="function"?oc:nc)(e,t,n??"")):Oe(this.node(),e)}function Oe(e,t){return e.style.getPropertyValue(t)||Wt(e).getComputedStyle(e,null).getPropertyValue(t)}function rc(e){return function(){delete this[e]}}function ic(e,t){return function(){this[e]=t}}function sc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Sr(e,t){return arguments.length>1?this.each((t==null?rc:typeof t=="function"?sc:ic)(e,t)):this.node()[e]}function Er(e){return e.trim().split(/^|\s+/)}function Vn(e){return e.classList||new Nr(e)}function Nr(e){this._node=e,this._names=Er(e.getAttribute("class")||"")}Nr.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 Cr(e,t){for(var n=Vn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Mr(e,t){for(var n=Vn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function ac(e){return function(){Cr(this,e)}}function lc(e){return function(){Mr(this,e)}}function cc(e,t){return function(){(t.apply(this,arguments)?Cr:Mr)(this,e)}}function Ir(e,t){var n=Er(e+"");if(arguments.length<2){for(var o=Vn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?cc:t?ac:lc)(n,t))}function dc(){this.textContent=""}function uc(e){return function(){this.textContent=e}}function fc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function zr(e){return arguments.length?this.each(e==null?dc:(typeof e=="function"?fc:uc)(e)):this.node().textContent}function pc(){this.innerHTML=""}function hc(e){return function(){this.innerHTML=e}}function gc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Pr(e){return arguments.length?this.each(e==null?pc:(typeof e=="function"?gc:hc)(e)):this.node().innerHTML}function mc(){this.nextSibling&&this.parentNode.appendChild(this)}function Dr(){return this.each(mc)}function yc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ar(){return this.each(yc)}function Tr(e){var t=typeof e=="function"?e:Yt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function bc(){return null}function Or(e,t){var n=typeof e=="function"?e:Yt(e),o=t==null?bc:typeof t=="function"?t:Ke(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function xc(){var e=this.parentNode;e&&e.removeChild(this)}function $r(){return this.each(xc)}function wc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function vc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Rr(e){return this.select(e?vc:wc)}function Hr(e){return arguments.length?this.property("__data__",e):this.node().__data__}function kc(e){return function(t){e.call(this,t,this.__data__)}}function _c(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 Sc(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 Ec(e,t,n){return function(){var o=this.__on,r,i=kc(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 Lr(e,t,n){var o=_c(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?Ec:Sc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Br(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 Nc(e,t){return function(){return Br(this,e,t)}}function Cc(e,t){return function(){return Br(this,e,t.apply(this,arguments))}}function Vr(e,t){return this.each((typeof t=="function"?Cc:Nc)(e,t))}function*Fr(){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 Fn=[null];function le(e,t){this._groups=e,this._parents=t}function Yr(){return new le([[document.documentElement]],Fn)}function Mc(){return this}le.prototype=Yr.prototype={constructor:le,select:or,selectAll:rr,selectChild:ir,selectChildren:sr,filter:ar,data:dr,enter:lr,exit:ur,join:fr,merge:pr,selection:Mc,order:hr,sort:gr,call:mr,nodes:yr,node:br,size:xr,empty:wr,each:vr,attr:kr,style:_r,property:Sr,classed:Ir,text:zr,html:Pr,raise:Dr,lower:Ar,append:Tr,insert:Or,remove:$r,clone:Rr,datum:Hr,on:Lr,dispatch:Vr,[Symbol.iterator]:Fr};var ze=Yr;function de(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Fn)}function Xr(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=Xr(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 Zr={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 Ic(e){return!e.ctrlKey&&!e.button}function zc(){return this.parentNode}function Pc(e,t){return t??{x:e.x,y:e.y}}function Dc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kt(){var e=Ic,t=zc,n=Pc,o=Dc,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,Zr).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,C=t.call(this,x,E),T=S.length,I,V;for(I=0;I<T;++I)(V=g(this,C,x,E,S[I].identifier,S[I]))&&(qt(x),V("start",x,S[I]))}}function m(x){var E=x.changedTouches,S=E.length,C,T;for(C=0;C<S;++C)(T=r[E[C].identifier])&&($e(x),T("drag",x,E[C]))}function k(x){var E=x.changedTouches,S=E.length,C,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<S;++C)(T=r[E[C].identifier])&&(qt(x),T("end",x,E[C]))}function g(x,E,S,C,T,I){var V=i.copy(),$=pe(I||S,E),B,N,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}),C))!=null)return B=y.x-$[0]||0,N=y.y-$[1]||0,function v(_,M,D){var A=$,L;switch(_){case"start":r[T]=v,L=s++;break;case"end":delete r[T],--s;case"drag":$=pe(D||M,E),L=s;break}V.call(_,x,new Mt(_,{sourceEvent:M,subject:y,target:d,identifier:T,active:L,x:$[0]+B,y:$[1]+N,dx:$[0]-A[0],dy:$[1]-A[1],dispatch:V}),C)}}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 Ac=st("start","end","cancel","interrupt"),Tc=[],Kr=0,Wr=1,Ut=2,Gt=3,qr=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;Oc(e,n,{name:t,index:o,group:r,on:Ac,tween:Tc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Kr})}function zt(e,t){var n=ce(e,t);if(n.state>Kr)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 Oc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=nr(i,0,n.time);function i(l){n.state=Wr,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!==Wr)return c();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Gt)return Hn(s);p.state===qr?(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(Hn(function(){n.state===Gt&&(n.state=qr,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 Gr(e){return this.each(function(){Ue(this,e)})}function $c(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 Rc(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 Ur(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?$c:Rc)(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"?Qo:t instanceof $n?Rn:(n=$n(t))?(t=n,Rn):jo)(e,t)}function Hc(e){return function(){this.removeAttribute(e)}}function Lc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Bc(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 Vc(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 Fc(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 Yc(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 Qr(e,t){var n=Ie(e),o=n==="transform"?er:jt;return this.attrTween(e,typeof t=="function"?(n.local?Yc:Fc)(n,o,lt(this,"attr."+e,t)):t==null?(n.local?Lc:Hc)(n):(n.local?Vc:Bc)(n,o,t))}function Xc(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Zc(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Wc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Zc(e,i)),n}return r._value=t,r}function qc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Xc(e,i)),n}return r._value=t,r}function jr(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?Wc:qc)(o,t))}function Kc(e,t){return function(){zt(this,e).delay=+t.apply(this,arguments)}}function Gc(e,t){return t=+t,function(){zt(this,e).delay=t}}function Jr(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Kc:Gc)(t,e)):ce(this.node(),t).delay}function Uc(e,t){return function(){fe(this,e).duration=+t.apply(this,arguments)}}function Qc(e,t){return t=+t,function(){fe(this,e).duration=t}}function ei(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Uc:Qc)(t,e)):ce(this.node(),t).duration}function jc(e,t){if(typeof t!="function")throw new Error;return function(){fe(this,e).ease=t}}function ti(e){var t=this._id;return arguments.length?this.each(jc(t,e)):ce(this.node(),t).ease}function Jc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fe(this,e).ease=n}}function ni(e){if(typeof e!="function")throw new Error;return this.each(Jc(this._id,e))}function oi(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 ri(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 ed(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 td(e,t,n){var o,r,i=ed(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 ii(e,t){var n=this._id;return arguments.length<2?ce(this.node(),n).on.on(e):this.each(td(n,e,t))}function nd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function si(){return this.on("end.remove",nd(this._id))}function ai(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 li(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 od=ze.prototype.constructor;function ci(){return new od(this._groups,this._parents)}function rd(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 di(e){return function(){this.style.removeProperty(e)}}function id(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 sd(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 ad(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=di(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),c.on=o}}function ui(e,t,n){var o=(e+="")=="transform"?Jo:jt;return t==null?this.styleTween(e,rd(e,o)).on("end.style."+e,di(e)):typeof t=="function"?this.styleTween(e,sd(e,o,lt(this,"style."+e,t))).each(ad(this._id,e)):this.styleTween(e,id(e,o,t),n).on("end.style."+e,null)}function ld(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function cd(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&ld(e,s,n)),o}return i._value=t,i}function fi(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,cd(e,t,n??""))}function dd(e){return function(){this.textContent=e}}function ud(e){return function(){var t=e(this);this.textContent=t??""}}function pi(e){return this.tween("text",typeof e=="function"?ud(lt(this,"text",e)):dd(e==null?"":e+""))}function fd(e){return function(t){this.textContent=e.call(this,t)}}function pd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&fd(r)),t}return o._value=e,o}function hi(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,pd(e))}function gi(){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 mi(){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 hd=0;function he(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function yi(e){return ze().transition(e)}function Jt(){return++hd}var Pe=ze.prototype;he.prototype=yi.prototype={constructor:he,select:ai,selectAll:li,selectChild:Pe.selectChild,selectChildren:Pe.selectChildren,filter:oi,merge:ri,selection:ci,transition:gi,call:Pe.call,nodes:Pe.nodes,node:Pe.node,size:Pe.size,empty:Pe.empty,each:Pe.each,on:ii,attr:Qr,attrTween:jr,style:ui,styleTween:fi,text:pi,textTween:hi,remove:si,tween:Ur,delay:Jr,duration:ei,ease:ti,easeVarying:ni,end:mi,[Symbol.iterator]:Pe[Symbol.iterator]};function en(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var gd={time:null,delay:0,duration:250,ease:en};function md(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 bi(e){var t,n;e instanceof he?(t=e._id,e=e._name):(t=Jt(),(n=gd).time=tr(),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||md(c,t));return new he(o,this._parents,e,t)}ze.prototype.interrupt=Gr;ze.prototype.transition=bi;var Pt=e=>()=>e;function Yn(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 yd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function bd(){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 xi(){return this.__zoom||Qe}function xd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function wd(){return navigator.maxTouchPoints||"ontouchstart"in this}function vd(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=yd,t=bd,n=vd,o=xd,r=wd,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",xi).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",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,v,_,M){var D=y.selection?y.selection():y;D.property("__zoom",xi),y!==D?E(y,v,_,M):D.interrupt().each(function(){S(this,arguments).event(M).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},m.scaleBy=function(y,v,_,M){m.scaleTo(y,function(){var D=this.__zoom.k,A=typeof v=="function"?v.apply(this,arguments):v;return D*A},_,M)},m.scaleTo=function(y,v,_,M){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)},_,M)},m.translateBy=function(y,v,_,M){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,M)},m.translateTo=function(y,v,_,M,D){m.transform(y,function(){var A=t.apply(this,arguments),L=this.__zoom,H=M==null?x(A):typeof M=="function"?M.apply(this,arguments):M;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)},M,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 M=v[0]-_[0]*y.k,D=v[1]-_[1]*y.k;return M===y.x&&D===y.y?y:new we(y.k,M,D)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function E(y,v,_,M){y.on("start.zoom",function(){S(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,A=arguments,L=S(D,A).event(M),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 C(y,v)}function C(y,v){this.that=y,this.args=v,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,v),this.taps=0}C.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 Yn(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),M=this.__zoom,D=Math.max(i[0],Math.min(i[1],M.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]=M.invert(_.mouse[0]=A)),clearTimeout(_.wheel);else{if(M.k===D)return;_.mouse=[A,M.invert(A)],Ue(this),_.start()}ct(y),_.wheel=setTimeout(L,h),_.zoom("mouse",n(g(k(M,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,M=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),M.mouse=[A,this.__zoom.invert(A)],Ue(this),M.start();function F(Y){if(ct(Y),!M.moved){var G=Y.clientX-L,ee=Y.clientY-H;M.moved=G*G+ee*ee>w}M.event(Y).zoom("mouse",n(g(M.that.__zoom,M.mouse[0]=pe(Y,_),M.mouse[1]),M.extent,s))}function K(Y){D.on("mousemove.zoom mouseup.zoom",null),Nt(Y.view,M.moved),ct(Y),M.event(Y).end()}}function V(y,...v){if(e.apply(this,arguments)){var _=this.__zoom,M=pe(y.changedTouches?y.changedTouches[0]:y,this),D=_.invert(M),A=_.k*(y.shiftKey?.5:2),L=n(g(k(_,A),M,D),t.apply(this,v),s);ct(y),a>0?de(this).transition().duration(a).call(E,L,M,y):de(this).call(m.transform,L,M,y)}}function $(y,...v){if(e.apply(this,arguments)){var _=y.touches,M=_.length,D=S(this,v,y.changedTouches.length===M).event(y),A,L,H,F;for(tn(y),L=0;L<M;++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),M=y.changedTouches,D=M.length,A,L,H,F;for(ct(y),A=0;A<D;++A)L=M[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 N(y,...v){if(this.__zooming){var _=S(this,v).event(y),M=y.changedTouches,D=M.length,A,L;for(tn(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),A=0;A<D;++A)L=M[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]],Kn=["Enter"," ","Escape"],Gn={"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 Un={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 wi={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},Qn=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,Ai=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),jn=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);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}},Jn=(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):jn(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=Hi(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},Ti=(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 kd(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 Oi({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;let a=kd(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 eo({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 $i({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=Ti(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 Ri(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 vi=(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=vi(e.x,o,t.width-o)*n,i=vi(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)}),qn=({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}=jn(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}=jn(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)}},to=(e,t)=>dn(cn(qn(e),qn(t))),Hi=(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)=>Hi(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),no=e=>me(e.width)&&me(e.height)&&me(e.x)&&me(e.y),me=e=>!isNaN(e)&&isFinite(e),oo=(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 _d(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 Sd(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=_d(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=Sd(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 ro(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 io(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Li(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Bi(e){return{...Gn,...e||{}}}function so(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}),ao=e=>e?.getRootNode?.()||window?.document,Ed=["INPUT","SELECT","TEXTAREA"];function lo(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ed.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var co=e=>"clientX"in e,ye=(e,t)=>{let n=co(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)}},ki=(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 _i({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]=_i({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=_i({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 uo({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 Vi({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 Fi({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 Nd=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Cd=(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)),Yi=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ge.error006()),t;let o=n.getEdgeId||Nd,r;return Qn(e)?r={...e}:r={...e,id:o(e)},Cd(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]=uo({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}var Si={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Md=({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},Ei=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Id({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){let a=Si[t],c=Si[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=Md({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]=uo({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],M=l[y]<u[y];(a[d]===1&&(!v&&_||v&&M)||a[d]!==1&&(!v&&M||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)),N=Math.max(Math.abs(V.y-h[0].y),Math.abs($.y-h[0].y));B>=N?(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 zd(e,t,n,o){let r=Math.min(Ei(e,t)/2,Ei(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]=Id({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+=zd(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 Ni(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Xi(e){let{sourceNode:t,targetNode:n}=e;if(!Ni(t)||!Ni(n))return null;let o=t.internals.handleBounds||Ci(t.handles),r=n.internals.handleBounds||Ci(n.handles),i=Mi(o?.source??[],e.sourceHandle),s=Mi(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 Ci(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 Mi(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 Zi(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 Wi=1e3,Pd=10,fo={nodeOrigin:[0,0],nodeExtent:pt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Dd={...fo,checkEquality:!0};function po(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function qi(e,t,n){let o=po(fo,n);for(let r of e.values())if(r.parentId)go(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 Ad(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 ho(e){return e==="manual"}function yn(e,t,n,o={}){let r=po(Dd,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!ho(r.zIndexMode)?Wi: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:Ad(u,f),z:Ki(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&&go(f,t,n,o,i),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Td(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 go(e,t,n,o,r){let{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=po(fo,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}Td(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*Pd),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);let f=i&&!ho(c)?Wi:0,{x:d,y:p,z:h}=Od(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 Ki(e,t,n){let o=me(e.zIndex)?e.zIndex:0;return ho(n)?o:o+(e.selected?t:0)}function Od(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=Ri(f,c,t));let d=Ki(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=to(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 Gi(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=Ri(x,w,S))}else g&&(x=Je(x,g,w));let E={...h,measured:w,internals:{...h.internals,positionAbsolute:x,handleBounds:{source:ki("source",p.nodeElement,k,f,h.id),target:ki("target",p.nodeElement,k,f,h.id)}}};t.set(h.id,E),h.parentId&&go(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 Ui({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 Ii(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 mo(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}`;Ii("source",c,u,e,r,s),Ii("target",c,l,e,i,a),t.set(o.id,o)}}function Qi(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Qi(n,t):!1}function zi(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 $d(e,t,n,o){let r=new Map;for(let[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Qi(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 Xn({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 Rd({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 ji({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:C=0}){d=de(x);function T({x:B,y:N}){let{nodeLookup:y,nodeExtent:v,snapGrid:_,snapToGrid:M,nodeOrigin:D,onNodeDrag:A,onSelectionDrag:L,onError:H,updateNodePositions:F}=t();i={x:B,y:N};let K=!1,Y=a.size>1,G=Y&&v?qn(ht(a)):null,ee=Y&&M?Rd({dragItems:a,snapGrid:_,x:B,y:N}):null;for(let[q,R]of a){if(!y.has(q))continue;let Z={x:B-R.distance.x,y:N-R.distance.y};M&&(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}=eo({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]=Xn({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:N,autoPanSpeed:y,autoPanOnNodeDrag:v}=t();if(!v){c=!1,cancelAnimationFrame(s);return}let[_,M]=ln(l,u,y);(_!==0||M!==0)&&(i.x=(i.x??0)-_/B[2],i.y=(i.y??0)-M/B[2],await N({x:_,y:M})&&T(i)),s=requestAnimationFrame(I)}function V(B){let{nodeLookup:N,multiSelectionActive:y,nodesDraggable:v,transform:_,snapGrid:M,snapToGrid:D,selectNodesOnDrag:A,onNodeDragStart:L,onSelectionDragStart:H,unselectNodesAndEdges:F}=t();f=!0,(!A||!E)&&!y&&S&&(N.get(S)?.selected||F()),E&&A&&S&&e?.(S);let K=At(B.sourceEvent,{transform:_,snapGrid:M,snapToGrid:D,containerBounds:u});if(i=K,a=$d(N,v,K,S),a.size>0&&(n||L||!S&&H)){let[Y,G]=Xn({nodeId:S,dragItems:a,nodeLookup:N});n?.(B.sourceEvent,a,Y,G),L?.(B.sourceEvent,Y,G),S||H?.(B.sourceEvent,G)}}let $=Kt().clickDistance(C).on("start",B=>{let{domNode:N,nodeDragThreshold:y,transform:v,snapGrid:_,snapToGrid:M}=t();u=N?.getBoundingClientRect()||null,p=!1,h=!1,w=B.sourceEvent,y===0&&V(B),i=At(B.sourceEvent,{transform:v,snapGrid:_,snapToGrid:M,containerBounds:u}),l=ye(B.sourceEvent,u)}).on("drag",B=>{let{autoPanOnNodeDrag:N,transform:y,snapGrid:v,snapToGrid:_,nodeDragThreshold:M,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&&N&&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)>M&&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:N,updateNodePositions:y,onNodeDragStop:v,onSelectionDragStop:_}=t();if(h&&(y(a,!1),h=!1),r||v||!S&&_){let[M,D]=Xn({nodeId:S,dragItems:a,nodeLookup:N,dragging:!1});r?.(B.sourceEvent,a,M,D),v?.(B.sourceEvent,M,D),S||_?.(B.sourceEvent,D)}}}).filter(B=>{let N=B.target;return!B.button&&(!k||!zi(N,`.${k}`,x))&&(!g||zi(N,g,x))});d.call($)}function m(){d?.on(".drag",null)}return{update:b,destroy:m}}function Hd(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 Ld=250;function Bd(e,t,n,o){let r=[],i=1/0,s=Hd(e,n,t+Ld);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 Ji(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 es(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Vd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var ts=()=>!0;function Fd(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=ts,onReconnectEnd:k,updateConnection:g,getTransform:x,getFromHandle:E,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:T}){let I=ao(e.target),V=0,$,{x:B,y:N}=ye(e),y=es(i,T),v=a?.getBoundingClientRect(),_=!1;if(!v||!y)return;let M=Ji(r,y,o,c,t);if(!M)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={...M,nodeId:r,type:y,position:M.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:wi[Y.position],toNode:null,pointer:D};function R(){_=!0,g(q),h?.(e,{nodeId:r,handleId:o,handleType:y})}C===0&&R();function Z(Q){if(!_){let{x:ue,y:Se}=ye(Q),ve=ue-B,ke=Se-N;if(!(ve*ve+ke*ke>C*C))return;R()}if(!E()||!Y){j(Q);return}let W=x();D=ye(Q,v),$=Bd(yt(D,W,!1,[1,1]),n,c,Y),A||(K(),A=!0);let U=ns(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=Vd(!!$,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:wi[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 ns(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=ts,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=es(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 C={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};m.connection=C;let I=E&&S&&(n===Ve.Strict?f&&k==="source"||!f&&k==="target":g!==o||x!==r);m.isValid=I&&l(C),m.toHandle=Ji(g,k,x,u,n,!0)}return m}var xn={onPointerDown:Fd,isValid:ns};function os({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,C=x[2]*Math.pow(2,S*E);t.scaleTo(C)},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 C=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),T={x:x[0]-S[0]*C,y:x[1]-S[1]*C},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}),Zn=({x:e,y:t,zoom:n})=>Qe.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),rs=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Yd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Wn=(e,t=0,n=Yd,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},is=e=>{let t=e.ctrlKey&&bt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Xd({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=is(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 Zd({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 Wd({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 qd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&rs(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 Kd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&rs(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 Gd({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 ss({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(N=>{let y=N[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(is);async function m(N,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).transform(Wn(h,y?.duration,y?.ease,()=>v(!0)),N)}):!1}function k({noWheelClassName:N,noPanClassName:y,onPaneContextMenu:v,userSelectionActive:_,panOnScroll:M,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=M&&!ee&&!_;p.clickDistance(Q?1/0:!me(j)||j<0?0:j);let U=W?Xd({zoomPanValues:l,noWheelClassName:N,d3Selection:h,d3Zoom:p,panOnScrollMode:A,panOnScrollSpeed:L,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Zd({noWheelClassName:N,preventScrolling:H,d3ZoomHandler:w});h.on("wheel.zoom",U,{passive:!1});let te=Wd({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});p.on("start",te);let ne=qd({zoomPanValues:l,panOnDrag:D,onPaneContextMenu:!!v,onPanZoom:i,onTransformChange:R});p.on("zoom",ne);let re=Kd({zoomPanValues:l,panOnDrag:D,panOnScroll:M,onPaneContextMenu:v,onPanZoomEnd:a,onDraggingChange:c});p.on("end",re);let ue=Gd({panActivationKeyPressed:G,zoomActivationKeyPressed:ee,panOnDrag:D,zoomOnScroll:K,panOnScroll:M,zoomOnDoubleClick:Y,zoomOnPinch:F,userSelectionActive:_,noPanClassName:y,noWheelClassName:N,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(N,y,v){let _=Zn(N),M=p?.constrain()(_,y,v);return M&&await m(M),M}async function E(N,y){let v=Zn(N);return await m(v,y),v}function S(N){if(h){let y=Zn(N),v=h.property("__zoom");(v.k!==N.zoom||v.x!==N.x||v.y!==N.y)&&p?.transform(h,y,null,{sync:!0})}}function C(){let N=h?Dt(h.node()):{x:0,y:0,k:1};return{x:N.x,y:N.y,zoom:N.k}}async function T(N,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleTo(Wn(h,y?.duration,y?.ease,()=>v(!0)),N)}):!1}async function I(N,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleBy(Wn(h,y?.duration,y?.ease,()=>v(!0)),N)}):!1}function V(N){p?.scaleExtent(N)}function $(N){p?.translateExtent(N)}function B(N){let y=!me(N)||N<0?0:N;p?.clickDistance(y)}return{update:k,destroy:g,setViewport:E,setViewportConstrained:x,getViewport:C,scaleTo:T,scaleBy:I,setScaleExtent:V,setTranslateExtent:$,syncViewport:S,setClickDistance:B}}var Ye;(function(e){e.Line="line",e.Handle="handle"})(Ye||(Ye={}));function Ud({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 Pi(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 Di(e,t){return e?!t:t}function Qd(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:C}=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,N=-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+N,s[0][1]):!l&&I>0&&(A=Le(x+$+N,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/C,m,k)*C;if(y=Math.max(y,D),s){let A=0;!c&&!l||c&&!l&&d?A=Le(x+N+V/C,s[1][1])*C:A=He(x+N+(c?T:-T)/C,s[0][1])*C,y=Math.max(y,A)}if(a){let A=0;!c&&!l||c&&!l&&d?A=He(x+V/C,a[1][1])*C:A=Le(x+(c?T:-T)/C,a[0][1])*C,y=Math.max(y,A)}}if(f){let D=rn($*C,w,b)/C;if(v=Math.max(v,D),s){let A=0;!c&&!l||l&&!c&&d?A=Le(g+$*C+B,s[1][0])/C:A=He(g+(l?I:-I)*C+B,s[0][0])/C,v=Math.max(v,A)}if(a){let A=0;!c&&!l||l&&!c&&d?A=He(g+$*C,a[1][0])/C:A=Le(g+(l?I:-I)*C,a[0][0])/C,v=Math.max(v,A)}}}I=I+(I<0?v:-v),T=T+(T<0?y:-y),r&&(d?V>$*C?I=(Di(c,l)?-T:T)/C:T=(Di(c,l)?-I:I)*C:u?(I=T/C,l=c):(T=I*C,c=l));let _=c?g+T:g,M=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)+M}}var as={width:0,height:0,x:0,y:0},jd={...as,pointerX:0,pointerY:0,aspectRatio:1};function Jd(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 ls({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let i=de(e),s={controlDirection:Pi("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={...as},k={...jd};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Pi(l)};let g,x=null,E=[],S,C,T,I=Kt().on("start",V=>{let{nodeLookup:$,transform:B,snapGrid:N,snapToGrid:y,nodeOrigin:v,paneDomNode:_}=n();if(g=$.get(t),!g)return;x=_?.getBoundingClientRect()??null;let{xSnapped:M,ySnapped:D}=At(V.sourceEvent,{transform:B,snapGrid:N,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:M,pointerY:D,aspectRatio:m.width/m.height},S=void 0,C=tt(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=$.get(g.parentId)),S&&g.extent==="parent"&&(C=[[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=Jd(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:N,nodeOrigin:y}=n(),v=At(V.sourceEvent,{transform:$,snapGrid:B,snapToGrid:N,containerBounds:x}),_=[];if(!g)return;let{x:M,y:D,width:A,height:L}=m,H={},F=g.origin??y,{width:K,height:Y,x:G,y:ee}=Qd(k,s.controlDirection,v,s.boundaries,s.keepAspectRatio,F,C,T),q=K!==A,R=Y!==L,Z=G!==M&&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-M,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=Ud({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 fs=Te(Dn(),1),ps=Te(Dl(),1);var cs=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},ds=e=>e?cs(e):cs;var{useDebugValue:eu}=fs.default,{useSyncExternalStoreWithSelector:tu}=ps.default,nu=e=>e;function yo(e,t=nu,n){let o=tu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return eu(o),o}var us=(e,t)=>{let n=ds(e),o=(r,i=t)=>yo(n,r,i);return Object.assign(o,n),o},hs=(e,t)=>e?us(e,t):us;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 ou=Te(Pl()),Sn=(0,P.createContext)(null),ru=Sn.Provider,Vs=ge.error001("react");function J(e,t){let n=(0,P.useContext)(Sn);if(n===null)throw new Error(Vs);return yo(n,e,t)}function se(){let e=(0,P.useContext)(Sn);if(e===null)throw new Error(Vs);return(0,P.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var gs={display:"none"},iu={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Fs="react-flow__node-desc",Ys="react-flow__edge-desc",su="react-flow__aria-live",au=e=>e.ariaLiveMessage,lu=e=>e.ariaLabelConfig;function cu({rfId:e}){let t=J(au);return(0,z.jsx)("div",{id:`${su}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:iu,children:t})}function du({rfId:e,disableKeyboardA11y:t}){let n=J(lu);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{id:`${Fs}-${e}`,style:gs,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,z.jsx)("div",{id:`${Ys}-${e}`,style:gs,children:n["edge.a11yDescription.default"]}),!t&&(0,z.jsx)(cu,{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 ms="https://reactflow.dev?utm_source=attribution";function uu({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: ${ms}`,children:(0,z.jsx)("a",{href:ms,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var fu=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 pu(e,t){return ie(e.selectedNodes.map(vn),t.selectedNodes.map(vn))&&ie(e.selectedEdges.map(vn),t.selectedEdges.map(vn))}function hu({onSelectionChange:e}){let t=se(),{selectedNodes:n,selectedEdges:o}=J(fu,pu);return(0,P.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}var gu=e=>!!e.onSelectionChangeHandlers;function mu({onSelectionChange:e}){let t=J(gu);return e||t?(0,z.jsx)(hu,{onSelectionChange:e}):null}var Xs=[0,0],yu={x:0,y:0,zoom:1},bu=["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"],ys=[...bu,"rfId"],xu=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}),bs={translateExtent:pt,nodeOrigin:Xs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function wu(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(xu,ie),l=se();(0,P.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=bs,a()}),[]);let u=(0,P.useRef)(bs);return(0,P.useEffect)(()=>{for(let f of ys){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:Bi(d)}):f==="fitView"?l.setState({fitViewQueued:d}):f==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[f]:d})))}u.current=e},ys.map(f=>e[f])),null}function xs(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function vu(e){let[t,n]=(0,P.useState)(e==="system"?null:e);return(0,P.useEffect)(()=>{if(e!=="system"){n(e);return}let o=xs(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:xs()?.matches?"dark":"light"}var ws=typeof document<"u"?document:null;function Rt(e=null,t={target:ws,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 $n,e as Rn,g as Qo,h as jo,i as Vt,j as Jo,k as er,l as at,o as tr,p as nr,q as Hn}from"./chunk-P5ET5XMK.js";import{a as Wo,b as qo}from"./chunk-5CTTY5BQ.js";import{d as Yo,e as Xo}from"./chunk-Y3REFBB6.js";import{b as Dl}from"./chunk-AW4RA5UH.js";import{a as Bo,b as Vo}from"./chunk-GLP5VV7P.js";import"./chunk-5AW2WUSZ.js";import{i as Ko,j as Go,k as Uo}from"./chunk-7ZXWWQSW.js";import{b as Tn,f as On,i as Zo}from"./chunk-2YLUVQCJ.js";import{B as Do,C as Ao,Cb as Me,Da as $o,Ea as Ro,Ja as Ho,a as Bt,c as Dn,nb as Lo,ob as An,pb as Pl,ra as To,ua as Oo}from"./chunk-IJTLAUEC.js";import{a as Fo}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",Ln={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)),Ln.hasOwnProperty(t)?{space:Ln[t],local:e}:e}function Al(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 Tl(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Yt(e){var t=Ie(e);return(t.local?Tl:Al)(t)}function Ol(){}function Ke(e){return e==null?Ol:function(){return this.querySelector(e)}}function or(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 Bn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function $l(){return[]}function kt(e){return e==null?$l:function(){return this.querySelectorAll(e)}}function Rl(e){return function(){return Bn(e.apply(this,arguments))}}function rr(e){typeof e=="function"?e=Rl(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 Hl=Array.prototype.find;function Ll(e){return function(){return Hl.call(this.children,e)}}function Bl(){return this.firstElementChild}function ir(e){return this.select(e==null?Bl:Ll(typeof e=="function"?e:Xt(e)))}var Vl=Array.prototype.filter;function Fl(){return Array.from(this.children)}function Yl(e){return function(){return Vl.call(this.children,e)}}function sr(e){return this.selectAll(e==null?Fl:Yl(typeof e=="function"?e:Xt(e)))}function ar(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 lr(){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 cr(e){return function(){return e}}function Xl(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 Zl(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 Wl(e){return e.__data__}function dr(e,t){if(!arguments.length)return Array.from(this,Wl);var n=t?Zl:Xl,o=this._parents,r=this._groups;typeof e!="function"&&(e=cr(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=ql(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 ql(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ur(){return new le(this._exit||this._groups.map(Zt),this._parents)}function fr(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 pr(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 hr(){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 gr(e){e||(e=Kl);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 Kl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function mr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function yr(){return Array.from(this)}function br(){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 xr(){let e=0;for(let t of this)++e;return e}function wr(){return!this.node()}function vr(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 Gl(e){return function(){this.removeAttribute(e)}}function Ul(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ql(e,t){return function(){this.setAttribute(e,t)}}function jl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Jl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ec(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 kr(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?Ul:Gl:typeof t=="function"?n.local?ec:Jl:n.local?jl:Ql)(n,t))}function Wt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function tc(e){return function(){this.style.removeProperty(e)}}function nc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function oc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function _r(e,t,n){return arguments.length>1?this.each((t==null?tc:typeof t=="function"?oc:nc)(e,t,n??"")):Oe(this.node(),e)}function Oe(e,t){return e.style.getPropertyValue(t)||Wt(e).getComputedStyle(e,null).getPropertyValue(t)}function rc(e){return function(){delete this[e]}}function ic(e,t){return function(){this[e]=t}}function sc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Sr(e,t){return arguments.length>1?this.each((t==null?rc:typeof t=="function"?sc:ic)(e,t)):this.node()[e]}function Er(e){return e.trim().split(/^|\s+/)}function Vn(e){return e.classList||new Nr(e)}function Nr(e){this._node=e,this._names=Er(e.getAttribute("class")||"")}Nr.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 Cr(e,t){for(var n=Vn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Mr(e,t){for(var n=Vn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function ac(e){return function(){Cr(this,e)}}function lc(e){return function(){Mr(this,e)}}function cc(e,t){return function(){(t.apply(this,arguments)?Cr:Mr)(this,e)}}function Ir(e,t){var n=Er(e+"");if(arguments.length<2){for(var o=Vn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?cc:t?ac:lc)(n,t))}function dc(){this.textContent=""}function uc(e){return function(){this.textContent=e}}function fc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function zr(e){return arguments.length?this.each(e==null?dc:(typeof e=="function"?fc:uc)(e)):this.node().textContent}function pc(){this.innerHTML=""}function hc(e){return function(){this.innerHTML=e}}function gc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Pr(e){return arguments.length?this.each(e==null?pc:(typeof e=="function"?gc:hc)(e)):this.node().innerHTML}function mc(){this.nextSibling&&this.parentNode.appendChild(this)}function Dr(){return this.each(mc)}function yc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ar(){return this.each(yc)}function Tr(e){var t=typeof e=="function"?e:Yt(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function bc(){return null}function Or(e,t){var n=typeof e=="function"?e:Yt(e),o=t==null?bc:typeof t=="function"?t:Ke(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function xc(){var e=this.parentNode;e&&e.removeChild(this)}function $r(){return this.each(xc)}function wc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function vc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Rr(e){return this.select(e?vc:wc)}function Hr(e){return arguments.length?this.property("__data__",e):this.node().__data__}function kc(e){return function(t){e.call(this,t,this.__data__)}}function _c(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 Sc(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 Ec(e,t,n){return function(){var o=this.__on,r,i=kc(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 Lr(e,t,n){var o=_c(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?Ec:Sc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Br(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 Nc(e,t){return function(){return Br(this,e,t)}}function Cc(e,t){return function(){return Br(this,e,t.apply(this,arguments))}}function Vr(e,t){return this.each((typeof t=="function"?Cc:Nc)(e,t))}function*Fr(){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 Fn=[null];function le(e,t){this._groups=e,this._parents=t}function Yr(){return new le([[document.documentElement]],Fn)}function Mc(){return this}le.prototype=Yr.prototype={constructor:le,select:or,selectAll:rr,selectChild:ir,selectChildren:sr,filter:ar,data:dr,enter:lr,exit:ur,join:fr,merge:pr,selection:Mc,order:hr,sort:gr,call:mr,nodes:yr,node:br,size:xr,empty:wr,each:vr,attr:kr,style:_r,property:Sr,classed:Ir,text:zr,html:Pr,raise:Dr,lower:Ar,append:Tr,insert:Or,remove:$r,clone:Rr,datum:Hr,on:Lr,dispatch:Vr,[Symbol.iterator]:Fr};var ze=Yr;function de(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],Fn)}function Xr(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=Xr(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 Zr={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 Ic(e){return!e.ctrlKey&&!e.button}function zc(){return this.parentNode}function Pc(e,t){return t??{x:e.x,y:e.y}}function Dc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kt(){var e=Ic,t=zc,n=Pc,o=Dc,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,Zr).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,C=t.call(this,x,E),T=S.length,I,V;for(I=0;I<T;++I)(V=g(this,C,x,E,S[I].identifier,S[I]))&&(qt(x),V("start",x,S[I]))}}function m(x){var E=x.changedTouches,S=E.length,C,T;for(C=0;C<S;++C)(T=r[E[C].identifier])&&($e(x),T("drag",x,E[C]))}function k(x){var E=x.changedTouches,S=E.length,C,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<S;++C)(T=r[E[C].identifier])&&(qt(x),T("end",x,E[C]))}function g(x,E,S,C,T,I){var V=i.copy(),$=pe(I||S,E),B,N,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}),C))!=null)return B=y.x-$[0]||0,N=y.y-$[1]||0,function v(_,M,D){var A=$,L;switch(_){case"start":r[T]=v,L=s++;break;case"end":delete r[T],--s;case"drag":$=pe(D||M,E),L=s;break}V.call(_,x,new Mt(_,{sourceEvent:M,subject:y,target:d,identifier:T,active:L,x:$[0]+B,y:$[1]+N,dx:$[0]-A[0],dy:$[1]-A[1],dispatch:V}),C)}}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 Ac=st("start","end","cancel","interrupt"),Tc=[],Kr=0,Wr=1,Ut=2,Gt=3,qr=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;Oc(e,n,{name:t,index:o,group:r,on:Ac,tween:Tc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Kr})}function zt(e,t){var n=ce(e,t);if(n.state>Kr)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 Oc(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=nr(i,0,n.time);function i(l){n.state=Wr,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!==Wr)return c();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Gt)return Hn(s);p.state===qr?(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(Hn(function(){n.state===Gt&&(n.state=qr,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 Gr(e){return this.each(function(){Ue(this,e)})}function $c(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 Rc(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 Ur(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?$c:Rc)(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"?Qo:t instanceof $n?Rn:(n=$n(t))?(t=n,Rn):jo)(e,t)}function Hc(e){return function(){this.removeAttribute(e)}}function Lc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Bc(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 Vc(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 Fc(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 Yc(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 Qr(e,t){var n=Ie(e),o=n==="transform"?er:jt;return this.attrTween(e,typeof t=="function"?(n.local?Yc:Fc)(n,o,lt(this,"attr."+e,t)):t==null?(n.local?Lc:Hc)(n):(n.local?Vc:Bc)(n,o,t))}function Xc(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Zc(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Wc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Zc(e,i)),n}return r._value=t,r}function qc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Xc(e,i)),n}return r._value=t,r}function jr(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?Wc:qc)(o,t))}function Kc(e,t){return function(){zt(this,e).delay=+t.apply(this,arguments)}}function Gc(e,t){return t=+t,function(){zt(this,e).delay=t}}function Jr(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Kc:Gc)(t,e)):ce(this.node(),t).delay}function Uc(e,t){return function(){fe(this,e).duration=+t.apply(this,arguments)}}function Qc(e,t){return t=+t,function(){fe(this,e).duration=t}}function ei(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Uc:Qc)(t,e)):ce(this.node(),t).duration}function jc(e,t){if(typeof t!="function")throw new Error;return function(){fe(this,e).ease=t}}function ti(e){var t=this._id;return arguments.length?this.each(jc(t,e)):ce(this.node(),t).ease}function Jc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;fe(this,e).ease=n}}function ni(e){if(typeof e!="function")throw new Error;return this.each(Jc(this._id,e))}function oi(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 ri(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 ed(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 td(e,t,n){var o,r,i=ed(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 ii(e,t){var n=this._id;return arguments.length<2?ce(this.node(),n).on.on(e):this.each(td(n,e,t))}function nd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function si(){return this.on("end.remove",nd(this._id))}function ai(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 li(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 od=ze.prototype.constructor;function ci(){return new od(this._groups,this._parents)}function rd(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 di(e){return function(){this.style.removeProperty(e)}}function id(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 sd(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 ad(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=di(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),c.on=o}}function ui(e,t,n){var o=(e+="")=="transform"?Jo:jt;return t==null?this.styleTween(e,rd(e,o)).on("end.style."+e,di(e)):typeof t=="function"?this.styleTween(e,sd(e,o,lt(this,"style."+e,t))).each(ad(this._id,e)):this.styleTween(e,id(e,o,t),n).on("end.style."+e,null)}function ld(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function cd(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&ld(e,s,n)),o}return i._value=t,i}function fi(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,cd(e,t,n??""))}function dd(e){return function(){this.textContent=e}}function ud(e){return function(){var t=e(this);this.textContent=t??""}}function pi(e){return this.tween("text",typeof e=="function"?ud(lt(this,"text",e)):dd(e==null?"":e+""))}function fd(e){return function(t){this.textContent=e.call(this,t)}}function pd(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&fd(r)),t}return o._value=e,o}function hi(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,pd(e))}function gi(){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 mi(){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 hd=0;function he(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function yi(e){return ze().transition(e)}function Jt(){return++hd}var Pe=ze.prototype;he.prototype=yi.prototype={constructor:he,select:ai,selectAll:li,selectChild:Pe.selectChild,selectChildren:Pe.selectChildren,filter:oi,merge:ri,selection:ci,transition:gi,call:Pe.call,nodes:Pe.nodes,node:Pe.node,size:Pe.size,empty:Pe.empty,each:Pe.each,on:ii,attr:Qr,attrTween:jr,style:ui,styleTween:fi,text:pi,textTween:hi,remove:si,tween:Ur,delay:Jr,duration:ei,ease:ti,easeVarying:ni,end:mi,[Symbol.iterator]:Pe[Symbol.iterator]};function en(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var gd={time:null,delay:0,duration:250,ease:en};function md(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 bi(e){var t,n;e instanceof he?(t=e._id,e=e._name):(t=Jt(),(n=gd).time=tr(),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||md(c,t));return new he(o,this._parents,e,t)}ze.prototype.interrupt=Gr;ze.prototype.transition=bi;var Pt=e=>()=>e;function Yn(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 yd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function bd(){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 xi(){return this.__zoom||Qe}function xd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function wd(){return navigator.maxTouchPoints||"ontouchstart"in this}function vd(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=yd,t=bd,n=vd,o=xd,r=wd,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",xi).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",N).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,v,_,M){var D=y.selection?y.selection():y;D.property("__zoom",xi),y!==D?E(y,v,_,M):D.interrupt().each(function(){S(this,arguments).event(M).start().zoom(null,typeof v=="function"?v.apply(this,arguments):v).end()})},m.scaleBy=function(y,v,_,M){m.scaleTo(y,function(){var D=this.__zoom.k,A=typeof v=="function"?v.apply(this,arguments):v;return D*A},_,M)},m.scaleTo=function(y,v,_,M){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)},_,M)},m.translateBy=function(y,v,_,M){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,M)},m.translateTo=function(y,v,_,M,D){m.transform(y,function(){var A=t.apply(this,arguments),L=this.__zoom,H=M==null?x(A):typeof M=="function"?M.apply(this,arguments):M;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)},M,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 M=v[0]-_[0]*y.k,D=v[1]-_[1]*y.k;return M===y.x&&D===y.y?y:new we(y.k,M,D)}function x(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function E(y,v,_,M){y.on("start.zoom",function(){S(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,A=arguments,L=S(D,A).event(M),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 C(y,v)}function C(y,v){this.that=y,this.args=v,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,v),this.taps=0}C.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 Yn(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),M=this.__zoom,D=Math.max(i[0],Math.min(i[1],M.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]=M.invert(_.mouse[0]=A)),clearTimeout(_.wheel);else{if(M.k===D)return;_.mouse=[A,M.invert(A)],Ue(this),_.start()}ct(y),_.wheel=setTimeout(L,h),_.zoom("mouse",n(g(k(M,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,M=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),M.mouse=[A,this.__zoom.invert(A)],Ue(this),M.start();function F(Y){if(ct(Y),!M.moved){var G=Y.clientX-L,ee=Y.clientY-H;M.moved=G*G+ee*ee>w}M.event(Y).zoom("mouse",n(g(M.that.__zoom,M.mouse[0]=pe(Y,_),M.mouse[1]),M.extent,s))}function K(Y){D.on("mousemove.zoom mouseup.zoom",null),Nt(Y.view,M.moved),ct(Y),M.event(Y).end()}}function V(y,...v){if(e.apply(this,arguments)){var _=this.__zoom,M=pe(y.changedTouches?y.changedTouches[0]:y,this),D=_.invert(M),A=_.k*(y.shiftKey?.5:2),L=n(g(k(_,A),M,D),t.apply(this,v),s);ct(y),a>0?de(this).transition().duration(a).call(E,L,M,y):de(this).call(m.transform,L,M,y)}}function $(y,...v){if(e.apply(this,arguments)){var _=y.touches,M=_.length,D=S(this,v,y.changedTouches.length===M).event(y),A,L,H,F;for(tn(y),L=0;L<M;++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),M=y.changedTouches,D=M.length,A,L,H,F;for(ct(y),A=0;A<D;++A)L=M[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 N(y,...v){if(this.__zooming){var _=S(this,v).event(y),M=y.changedTouches,D=M.length,A,L;for(tn(y),d&&clearTimeout(d),d=setTimeout(function(){d=null},p),A=0;A<D;++A)L=M[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]],Kn=["Enter"," ","Escape"],Gn={"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 Un={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 wi={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top},Qn=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,Ai=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),jn=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);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}},Jn=(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):jn(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=Hi(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},Ti=(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 kd(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 Oi({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;let a=kd(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 eo({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 $i({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=Ti(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 Ri(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 vi=(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=vi(e.x,o,t.width-o)*n,i=vi(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)}),qn=({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}=jn(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}=jn(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)}},to=(e,t)=>dn(cn(qn(e),qn(t))),Hi=(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)=>Hi(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),no=e=>me(e.width)&&me(e.height)&&me(e.x)&&me(e.y),me=e=>!isNaN(e)&&isFinite(e),oo=(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 _d(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 Sd(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=_d(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=Sd(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 ro(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 io(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Li(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Bi(e){return{...Gn,...e||{}}}function so(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}),ao=e=>e?.getRootNode?.()||window?.document,Ed=["INPUT","SELECT","TEXTAREA"];function lo(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Ed.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var co=e=>"clientX"in e,ye=(e,t)=>{let n=co(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)}},ki=(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 _i({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]=_i({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=_i({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 uo({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 Vi({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 Fi({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 Nd=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,Cd=(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)),Yi=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",ge.error006()),t;let o=n.getEdgeId||Nd,r;return Qn(e)?r={...e}:r={...e,id:o(e)},Cd(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]=uo({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}var Si={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},Md=({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},Ei=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Id({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:o=X.Top,center:r,offset:i,stepPosition:s}){let a=Si[t],c=Si[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=Md({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]=uo({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],M=l[y]<u[y];(a[d]===1&&(!v&&_||v&&M)||a[d]!==1&&(!v&&M||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)),N=Math.max(Math.abs(V.y-h[0].y),Math.abs($.y-h[0].y));B>=N?(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 zd(e,t,n,o){let r=Math.min(Ei(e,t)/2,Ei(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]=Id({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+=zd(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 Ni(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Xi(e){let{sourceNode:t,targetNode:n}=e;if(!Ni(t)||!Ni(n))return null;let o=t.internals.handleBounds||Ci(t.handles),r=n.internals.handleBounds||Ci(n.handles),i=Mi(o?.source??[],e.sourceHandle),s=Mi(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 Ci(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 Mi(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 Zi(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 Wi=1e3,Pd=10,fo={nodeOrigin:[0,0],nodeExtent:pt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Dd={...fo,checkEquality:!0};function po(e,t){let n={...e};for(let o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function qi(e,t,n){let o=po(fo,n);for(let r of e.values())if(r.parentId)go(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 Ad(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 ho(e){return e==="manual"}function yn(e,t,n,o={}){let r=po(Dd,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!ho(r.zIndexMode)?Wi: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:Ad(u,f),z:Ki(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&&go(f,t,n,o,i),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function Td(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 go(e,t,n,o,r){let{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=po(fo,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}Td(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*Pd),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);let f=i&&!ho(c)?Wi:0,{x:d,y:p,z:h}=Od(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 Ki(e,t,n){let o=me(e.zIndex)?e.zIndex:0;return ho(n)?o:o+(e.selected?t:0)}function Od(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=Ri(f,c,t));let d=Ki(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=to(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 Gi(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=Ri(x,w,S))}else g&&(x=Je(x,g,w));let E={...h,measured:w,internals:{...h.internals,positionAbsolute:x,handleBounds:{source:ki("source",p.nodeElement,k,f,h.id),target:ki("target",p.nodeElement,k,f,h.id)}}};t.set(h.id,E),h.parentId&&go(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 Ui({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 Ii(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 mo(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}`;Ii("source",c,u,e,r,s),Ii("target",c,l,e,i,a),t.set(o.id,o)}}function Qi(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:Qi(n,t):!1}function zi(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 $d(e,t,n,o){let r=new Map;for(let[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Qi(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 Xn({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 Rd({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 ji({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:C=0}){d=de(x);function T({x:B,y:N}){let{nodeLookup:y,nodeExtent:v,snapGrid:_,snapToGrid:M,nodeOrigin:D,onNodeDrag:A,onSelectionDrag:L,onError:H,updateNodePositions:F}=t();i={x:B,y:N};let K=!1,Y=a.size>1,G=Y&&v?qn(ht(a)):null,ee=Y&&M?Rd({dragItems:a,snapGrid:_,x:B,y:N}):null;for(let[q,R]of a){if(!y.has(q))continue;let Z={x:B-R.distance.x,y:N-R.distance.y};M&&(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}=eo({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]=Xn({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:N,autoPanSpeed:y,autoPanOnNodeDrag:v}=t();if(!v){c=!1,cancelAnimationFrame(s);return}let[_,M]=ln(l,u,y);(_!==0||M!==0)&&(i.x=(i.x??0)-_/B[2],i.y=(i.y??0)-M/B[2],await N({x:_,y:M})&&T(i)),s=requestAnimationFrame(I)}function V(B){let{nodeLookup:N,multiSelectionActive:y,nodesDraggable:v,transform:_,snapGrid:M,snapToGrid:D,selectNodesOnDrag:A,onNodeDragStart:L,onSelectionDragStart:H,unselectNodesAndEdges:F}=t();f=!0,(!A||!E)&&!y&&S&&(N.get(S)?.selected||F()),E&&A&&S&&e?.(S);let K=At(B.sourceEvent,{transform:_,snapGrid:M,snapToGrid:D,containerBounds:u});if(i=K,a=$d(N,v,K,S),a.size>0&&(n||L||!S&&H)){let[Y,G]=Xn({nodeId:S,dragItems:a,nodeLookup:N});n?.(B.sourceEvent,a,Y,G),L?.(B.sourceEvent,Y,G),S||H?.(B.sourceEvent,G)}}let $=Kt().clickDistance(C).on("start",B=>{let{domNode:N,nodeDragThreshold:y,transform:v,snapGrid:_,snapToGrid:M}=t();u=N?.getBoundingClientRect()||null,p=!1,h=!1,w=B.sourceEvent,y===0&&V(B),i=At(B.sourceEvent,{transform:v,snapGrid:_,snapToGrid:M,containerBounds:u}),l=ye(B.sourceEvent,u)}).on("drag",B=>{let{autoPanOnNodeDrag:N,transform:y,snapGrid:v,snapToGrid:_,nodeDragThreshold:M,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&&N&&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)>M&&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:N,updateNodePositions:y,onNodeDragStop:v,onSelectionDragStop:_}=t();if(h&&(y(a,!1),h=!1),r||v||!S&&_){let[M,D]=Xn({nodeId:S,dragItems:a,nodeLookup:N,dragging:!1});r?.(B.sourceEvent,a,M,D),v?.(B.sourceEvent,M,D),S||_?.(B.sourceEvent,D)}}}).filter(B=>{let N=B.target;return!B.button&&(!k||!zi(N,`.${k}`,x))&&(!g||zi(N,g,x))});d.call($)}function m(){d?.on(".drag",null)}return{update:b,destroy:m}}function Hd(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 Ld=250;function Bd(e,t,n,o){let r=[],i=1/0,s=Hd(e,n,t+Ld);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 Ji(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 es(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Vd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var ts=()=>!0;function Fd(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=ts,onReconnectEnd:k,updateConnection:g,getTransform:x,getFromHandle:E,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:T}){let I=ao(e.target),V=0,$,{x:B,y:N}=ye(e),y=es(i,T),v=a?.getBoundingClientRect(),_=!1;if(!v||!y)return;let M=Ji(r,y,o,c,t);if(!M)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={...M,nodeId:r,type:y,position:M.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:wi[Y.position],toNode:null,pointer:D};function R(){_=!0,g(q),h?.(e,{nodeId:r,handleId:o,handleType:y})}C===0&&R();function Z(Q){if(!_){let{x:ue,y:Se}=ye(Q),ve=ue-B,ke=Se-N;if(!(ve*ve+ke*ke>C*C))return;R()}if(!E()||!Y){j(Q);return}let W=x();D=ye(Q,v),$=Bd(yt(D,W,!1,[1,1]),n,c,Y),A||(K(),A=!0);let U=ns(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=Vd(!!$,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:wi[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 ns(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=ts,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=es(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 C={source:f?g:o,sourceHandle:f?x:r,target:f?o:g,targetHandle:f?r:x};m.connection=C;let I=E&&S&&(n===Ve.Strict?f&&k==="source"||!f&&k==="target":g!==o||x!==r);m.isValid=I&&l(C),m.toHandle=Ji(g,k,x,u,n,!0)}return m}var xn={onPointerDown:Fd,isValid:ns};function os({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,C=x[2]*Math.pow(2,S*E);t.scaleTo(C)},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 C=o()*Math.max(x[2],Math.log(x[2]))*(p?-1:1),T={x:x[0]-S[0]*C,y:x[1]-S[1]*C},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}),Zn=({x:e,y:t,zoom:n})=>Qe.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),rs=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Yd=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Wn=(e,t=0,n=Yd,o=()=>{})=>{let r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},is=e=>{let t=e.ctrlKey&&bt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Xd({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=is(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 Zd({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 Wd({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 qd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&rs(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 Kd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&rs(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 Gd({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 ss({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(N=>{let y=N[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(is);async function m(N,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).transform(Wn(h,y?.duration,y?.ease,()=>v(!0)),N)}):!1}function k({noWheelClassName:N,noPanClassName:y,onPaneContextMenu:v,userSelectionActive:_,panOnScroll:M,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=M&&!ee&&!_;p.clickDistance(Q?1/0:!me(j)||j<0?0:j);let U=W?Xd({zoomPanValues:l,noWheelClassName:N,d3Selection:h,d3Zoom:p,panOnScrollMode:A,panOnScrollSpeed:L,zoomOnPinch:F,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Zd({noWheelClassName:N,preventScrolling:H,d3ZoomHandler:w});h.on("wheel.zoom",U,{passive:!1});let te=Wd({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});p.on("start",te);let ne=qd({zoomPanValues:l,panOnDrag:D,onPaneContextMenu:!!v,onPanZoom:i,onTransformChange:R});p.on("zoom",ne);let re=Kd({zoomPanValues:l,panOnDrag:D,panOnScroll:M,onPaneContextMenu:v,onPanZoomEnd:a,onDraggingChange:c});p.on("end",re);let ue=Gd({panActivationKeyPressed:G,zoomActivationKeyPressed:ee,panOnDrag:D,zoomOnScroll:K,panOnScroll:M,zoomOnDoubleClick:Y,zoomOnPinch:F,userSelectionActive:_,noPanClassName:y,noWheelClassName:N,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(N,y,v){let _=Zn(N),M=p?.constrain()(_,y,v);return M&&await m(M),M}async function E(N,y){let v=Zn(N);return await m(v,y),v}function S(N){if(h){let y=Zn(N),v=h.property("__zoom");(v.k!==N.zoom||v.x!==N.x||v.y!==N.y)&&p?.transform(h,y,null,{sync:!0})}}function C(){let N=h?Dt(h.node()):{x:0,y:0,k:1};return{x:N.x,y:N.y,zoom:N.k}}async function T(N,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleTo(Wn(h,y?.duration,y?.ease,()=>v(!0)),N)}):!1}async function I(N,y){return h?new Promise(v=>{p?.interpolate(y?.interpolate==="linear"?Vt:at).scaleBy(Wn(h,y?.duration,y?.ease,()=>v(!0)),N)}):!1}function V(N){p?.scaleExtent(N)}function $(N){p?.translateExtent(N)}function B(N){let y=!me(N)||N<0?0:N;p?.clickDistance(y)}return{update:k,destroy:g,setViewport:E,setViewportConstrained:x,getViewport:C,scaleTo:T,scaleBy:I,setScaleExtent:V,setTranslateExtent:$,syncViewport:S,setClickDistance:B}}var Ye;(function(e){e.Line="line",e.Handle="handle"})(Ye||(Ye={}));function Ud({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 Pi(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 Di(e,t){return e?!t:t}function Qd(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:C}=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,N=-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+N,s[0][1]):!l&&I>0&&(A=Le(x+$+N,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/C,m,k)*C;if(y=Math.max(y,D),s){let A=0;!c&&!l||c&&!l&&d?A=Le(x+N+V/C,s[1][1])*C:A=He(x+N+(c?T:-T)/C,s[0][1])*C,y=Math.max(y,A)}if(a){let A=0;!c&&!l||c&&!l&&d?A=He(x+V/C,a[1][1])*C:A=Le(x+(c?T:-T)/C,a[0][1])*C,y=Math.max(y,A)}}if(f){let D=rn($*C,w,b)/C;if(v=Math.max(v,D),s){let A=0;!c&&!l||l&&!c&&d?A=Le(g+$*C+B,s[1][0])/C:A=He(g+(l?I:-I)*C+B,s[0][0])/C,v=Math.max(v,A)}if(a){let A=0;!c&&!l||l&&!c&&d?A=He(g+$*C,a[1][0])/C:A=Le(g+(l?I:-I)*C,a[0][0])/C,v=Math.max(v,A)}}}I=I+(I<0?v:-v),T=T+(T<0?y:-y),r&&(d?V>$*C?I=(Di(c,l)?-T:T)/C:T=(Di(c,l)?-I:I)*C:u?(I=T/C,l=c):(T=I*C,c=l));let _=c?g+T:g,M=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)+M}}var as={width:0,height:0,x:0,y:0},jd={...as,pointerX:0,pointerY:0,aspectRatio:1};function Jd(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 ls({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){let i=de(e),s={controlDirection:Pi("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={...as},k={...jd};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:Pi(l)};let g,x=null,E=[],S,C,T,I=Kt().on("start",V=>{let{nodeLookup:$,transform:B,snapGrid:N,snapToGrid:y,nodeOrigin:v,paneDomNode:_}=n();if(g=$.get(t),!g)return;x=_?.getBoundingClientRect()??null;let{xSnapped:M,ySnapped:D}=At(V.sourceEvent,{transform:B,snapGrid:N,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:M,pointerY:D,aspectRatio:m.width/m.height},S=void 0,C=tt(g.extent)?g.extent:void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=$.get(g.parentId)),S&&g.extent==="parent"&&(C=[[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=Jd(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:N,nodeOrigin:y}=n(),v=At(V.sourceEvent,{transform:$,snapGrid:B,snapToGrid:N,containerBounds:x}),_=[];if(!g)return;let{x:M,y:D,width:A,height:L}=m,H={},F=g.origin??y,{width:K,height:Y,x:G,y:ee}=Qd(k,s.controlDirection,v,s.boundaries,s.keepAspectRatio,F,C,T),q=K!==A,R=Y!==L,Z=G!==M&&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-M,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=Ud({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 fs=Te(Dn(),1),ps=Te(Dl(),1);var cs=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},ds=e=>e?cs(e):cs;var{useDebugValue:eu}=fs.default,{useSyncExternalStoreWithSelector:tu}=ps.default,nu=e=>e;function yo(e,t=nu,n){let o=tu(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return eu(o),o}var us=(e,t)=>{let n=ds(e),o=(r,i=t)=>yo(n,r,i);return Object.assign(o,n),o},hs=(e,t)=>e?us(e,t):us;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 ou=Te(Pl()),Sn=(0,P.createContext)(null),ru=Sn.Provider,Vs=ge.error001("react");function J(e,t){let n=(0,P.useContext)(Sn);if(n===null)throw new Error(Vs);return yo(n,e,t)}function se(){let e=(0,P.useContext)(Sn);if(e===null)throw new Error(Vs);return(0,P.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var gs={display:"none"},iu={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Fs="react-flow__node-desc",Ys="react-flow__edge-desc",su="react-flow__aria-live",au=e=>e.ariaLiveMessage,lu=e=>e.ariaLabelConfig;function cu({rfId:e}){let t=J(au);return(0,z.jsx)("div",{id:`${su}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:iu,children:t})}function du({rfId:e,disableKeyboardA11y:t}){let n=J(lu);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{id:`${Fs}-${e}`,style:gs,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,z.jsx)("div",{id:`${Ys}-${e}`,style:gs,children:n["edge.a11yDescription.default"]}),!t&&(0,z.jsx)(cu,{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 ms="https://reactflow.dev?utm_source=attribution";function uu({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: ${ms}`,children:(0,z.jsx)("a",{href:ms,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var fu=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 pu(e,t){return ie(e.selectedNodes.map(vn),t.selectedNodes.map(vn))&&ie(e.selectedEdges.map(vn),t.selectedEdges.map(vn))}function hu({onSelectionChange:e}){let t=se(),{selectedNodes:n,selectedEdges:o}=J(fu,pu);return(0,P.useEffect)(()=>{let r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}var gu=e=>!!e.onSelectionChangeHandlers;function mu({onSelectionChange:e}){let t=J(gu);return e||t?(0,z.jsx)(hu,{onSelectionChange:e}):null}var Xs=[0,0],yu={x:0,y:0,zoom:1},bu=["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"],ys=[...bu,"rfId"],xu=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}),bs={translateExtent:pt,nodeOrigin:Xs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function wu(e){let{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(xu,ie),l=se();(0,P.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=bs,a()}),[]);let u=(0,P.useRef)(bs);return(0,P.useEffect)(()=>{for(let f of ys){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:Bi(d)}):f==="fitView"?l.setState({fitViewQueued:d}):f==="fitViewOptions"?l.setState({fitViewOptions:d}):l.setState({[f]:d})))}u.current=e},ys.map(f=>e[f])),null}function xs(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function vu(e){let[t,n]=(0,P.useState)(e==="system"?null:e);return(0,P.useEffect)(()=>{if(e!=="system"){n(e);return}let o=xs(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:xs()?.matches?"dark":"light"}var ws=typeof document<"u"?document:null;function Rt(e=null,t={target:ws,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
  `,`