ocwatch 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -3
- package/package.json +4 -4
- package/src/client/dist/assets/GraphView-BZV40eAE.css +1 -0
- package/src/client/dist/assets/GraphView-KWCCGYb2.js +9 -0
- package/src/client/dist/assets/graph-Cw_XSlvx.js +7 -0
- package/src/client/dist/assets/index-CbgYG3pJ.js +23 -0
- package/src/client/dist/assets/index-CgDCc8Mm.css +1 -0
- package/src/client/dist/assets/motion-CGUGF2CN.js +9 -0
- package/src/client/dist/index.html +4 -2
- package/src/server/index.ts +9 -24
- package/src/server/routes/poll.ts +6 -9
- package/src/server/routes/projects.ts +9 -26
- package/src/server/routes/sessions.ts +66 -14
- package/src/server/services/pollService.ts +153 -47
- package/src/server/services/recentSessions.ts +14 -0
- package/src/server/services/sessionContext.ts +97 -0
- package/src/server/services/sessionService.ts +15 -183
- package/src/server/services/sessionTree.ts +92 -0
- package/src/server/storage/db.ts +2 -10
- package/src/server/storage/index.ts +7 -1
- package/src/server/storage/queries.ts +208 -5
- package/src/server/utils/projectResolver.ts +9 -3
- package/src/server/utils/sessionStatus.ts +1 -19
- package/src/server/validation.ts +2 -4
- package/src/server/watcher.ts +41 -3
- package/src/shared/constants.ts +7 -3
- package/src/shared/index.ts +3 -0
- package/src/shared/types/index.ts +9 -48
- package/src/shared/utils/activityUtils.ts +3 -2
- package/src/client/dist/assets/index-BIu7r5_5.css +0 -1
- package/src/client/dist/assets/index-CzAaOuyw.js +0 -50
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{r as Vn,g as ua,R as da,a as z,j as A}from"./motion-CGUGF2CN.js";var fn={exports:{}},ae={};var po;function fa(){if(po)return ae;po=1;var e=Vn();function t(l){var a="https://react.dev/errors/"+l;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+l+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var o={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},r=Symbol.for("react.portal");function i(l,a,u){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:d==null?null:""+d,children:l,containerInfo:a,implementation:u}}var s=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(l,a){if(l==="font")return"";if(typeof a=="string")return a==="use-credentials"?a:""}return ae.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,ae.createPortal=function(l,a){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)throw Error(t(299));return i(l,a,null,u)},ae.flushSync=function(l){var a=s.T,u=o.p;try{if(s.T=null,o.p=2,l)return l()}finally{s.T=a,o.p=u,o.d.f()}},ae.preconnect=function(l,a){typeof l=="string"&&(a?(a=a.crossOrigin,a=typeof a=="string"?a==="use-credentials"?a:"":void 0):a=null,o.d.C(l,a))},ae.prefetchDNS=function(l){typeof l=="string"&&o.d.D(l)},ae.preinit=function(l,a){if(typeof l=="string"&&a&&typeof a.as=="string"){var u=a.as,d=c(u,a.crossOrigin),f=typeof a.integrity=="string"?a.integrity:void 0,g=typeof a.fetchPriority=="string"?a.fetchPriority:void 0;u==="style"?o.d.S(l,typeof a.precedence=="string"?a.precedence:void 0,{crossOrigin:d,integrity:f,fetchPriority:g}):u==="script"&&o.d.X(l,{crossOrigin:d,integrity:f,fetchPriority:g,nonce:typeof a.nonce=="string"?a.nonce:void 0})}},ae.preinitModule=function(l,a){if(typeof l=="string")if(typeof a=="object"&&a!==null){if(a.as==null||a.as==="script"){var u=c(a.as,a.crossOrigin);o.d.M(l,{crossOrigin:u,integrity:typeof a.integrity=="string"?a.integrity:void 0,nonce:typeof a.nonce=="string"?a.nonce:void 0})}}else a==null&&o.d.M(l)},ae.preload=function(l,a){if(typeof l=="string"&&typeof a=="object"&&a!==null&&typeof a.as=="string"){var u=a.as,d=c(u,a.crossOrigin);o.d.L(l,u,{crossOrigin:d,integrity:typeof a.integrity=="string"?a.integrity:void 0,nonce:typeof a.nonce=="string"?a.nonce:void 0,type:typeof a.type=="string"?a.type:void 0,fetchPriority:typeof a.fetchPriority=="string"?a.fetchPriority:void 0,referrerPolicy:typeof a.referrerPolicy=="string"?a.referrerPolicy:void 0,imageSrcSet:typeof a.imageSrcSet=="string"?a.imageSrcSet:void 0,imageSizes:typeof a.imageSizes=="string"?a.imageSizes:void 0,media:typeof a.media=="string"?a.media:void 0})}},ae.preloadModule=function(l,a){if(typeof l=="string")if(a){var u=c(a.as,a.crossOrigin);o.d.m(l,{as:typeof a.as=="string"&&a.as!=="script"?a.as:void 0,crossOrigin:u,integrity:typeof a.integrity=="string"?a.integrity:void 0})}else o.d.m(l)},ae.requestFormReset=function(l){o.d.r(l)},ae.unstable_batchedUpdates=function(l,a){return l(a)},ae.useFormState=function(l,a,u){return s.H.useFormState(l,a,u)},ae.useFormStatus=function(){return s.H.useHostTransitionStatus()},ae.version="19.2.4",ae}var mo;function ha(){if(mo)return fn.exports;mo=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),fn.exports=fa(),fn.exports}function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var ga={value:()=>{}};function Ut(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Dt(n)}function Dt(e){this._=e}function pa(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Dt.prototype=Ut.prototype={constructor:Dt,on:function(e,t){var n=this._,o=pa(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=ma(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=yo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=yo(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Dt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function ma(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function yo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ga,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Cn="http://www.w3.org/1999/xhtml";const xo={svg:"http://www.w3.org/2000/svg",xhtml:Cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Kt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),xo.hasOwnProperty(t)?{space:xo[t],local:e}:e}function ya(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Cn&&t.documentElement.namespaceURI===Cn?t.createElement(e):t.createElementNS(n,e)}}function xa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Er(e){var t=Kt(e);return(t.local?xa:ya)(t)}function wa(){}function Bn(e){return e==null?wa:function(){return this.querySelector(e)}}function va(e){typeof e!="function"&&(e=Bn(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,c=o[r]=new Array(s),l,a,u=0;u<s;++u)(l=i[u])&&(a=e.call(l,l.__data__,u,i))&&("__data__"in l&&(a.__data__=l.__data__),c[u]=a);return new ue(o,this._parents)}function _a(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ba(){return[]}function Sr(e){return e==null?ba:function(){return this.querySelectorAll(e)}}function Ea(e){return function(){return _a(e.apply(this,arguments))}}function Sa(e){typeof e=="function"?e=Ea(e):e=Sr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],c=s.length,l,a=0;a<c;++a)(l=s[a])&&(o.push(e.call(l,l.__data__,a,s)),r.push(l));return new ue(o,r)}function Nr(e){return function(){return this.matches(e)}}function Cr(e){return function(t){return t.matches(e)}}var Na=Array.prototype.find;function Ca(e){return function(){return Na.call(this.children,e)}}function Ma(){return this.firstElementChild}function Ia(e){return this.select(e==null?Ma:Ca(typeof e=="function"?e:Cr(e)))}var ka=Array.prototype.filter;function Aa(){return Array.from(this.children)}function Pa(e){return function(){return ka.call(this.children,e)}}function $a(e){return this.selectAll(e==null?Aa:Pa(typeof e=="function"?e:Cr(e)))}function Da(e){typeof e!="function"&&(e=Nr(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,c=o[r]=[],l,a=0;a<s;++a)(l=i[a])&&e.call(l,l.__data__,a,i)&&c.push(l);return new ue(o,this._parents)}function Mr(e){return new Array(e.length)}function Ta(){return new ue(this._enter||this._groups.map(Mr),this._parents)}function Lt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Lt.prototype={constructor:Lt,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 za(e){return function(){return e}}function Ra(e,t,n,o,r,i){for(var s=0,c,l=t.length,a=i.length;s<a;++s)(c=t[s])?(c.__data__=i[s],o[s]=c):n[s]=new Lt(e,i[s]);for(;s<l;++s)(c=t[s])&&(r[s]=c)}function Ha(e,t,n,o,r,i,s){var c,l,a=new Map,u=t.length,d=i.length,f=new Array(u),g;for(c=0;c<u;++c)(l=t[c])&&(f[c]=g=s.call(l,l.__data__,c,t)+"",a.has(g)?r[c]=l:a.set(g,l));for(c=0;c<d;++c)g=s.call(e,i[c],c,i)+"",(l=a.get(g))?(o[c]=l,l.__data__=i[c],a.delete(g)):n[c]=new Lt(e,i[c]);for(c=0;c<u;++c)(l=t[c])&&a.get(f[c])===l&&(r[c]=l)}function La(e){return e.__data__}function Oa(e,t){if(!arguments.length)return Array.from(this,La);var n=t?Ha:Ra,o=this._parents,r=this._groups;typeof e!="function"&&(e=za(e));for(var i=r.length,s=new Array(i),c=new Array(i),l=new Array(i),a=0;a<i;++a){var u=o[a],d=r[a],f=d.length,g=Va(e.call(u,u&&u.__data__,a,o)),p=g.length,x=c[a]=new Array(p),w=s[a]=new Array(p),m=l[a]=new Array(f);n(u,d,x,w,m,g,t);for(var _=0,h=0,y,S;_<p;++_)if(y=x[_]){for(_>=h&&(h=_+1);!(S=w[h])&&++h<p;);y._next=S||null}}return s=new ue(s,o),s._enter=c,s._exit=l,s}function Va(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ba(){return new ue(this._exit||this._groups.map(Mr),this._parents)}function Fa(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 ja(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),c=new Array(r),l=0;l<s;++l)for(var a=n[l],u=o[l],d=a.length,f=c[l]=new Array(d),g,p=0;p<d;++p)(g=a[p]||u[p])&&(f[p]=g);for(;l<r;++l)c[l]=n[l];return new ue(c,this._parents)}function Xa(){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 Ya(e){e||(e=Za);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],c=s.length,l=r[i]=new Array(c),a,u=0;u<c;++u)(a=s[u])&&(l[u]=a);l.sort(t)}return new ue(r,this._parents).order()}function Za(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Wa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function qa(){return Array.from(this)}function Ga(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Ua(){let e=0;for(const t of this)++e;return e}function Ka(){return!this.node()}function Qa(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,c;i<s;++i)(c=r[i])&&e.call(c,c.__data__,i,r);return this}function Ja(e){return function(){this.removeAttribute(e)}}function ec(e){return function(){this.removeAttributeNS(e.space,e.local)}}function tc(e,t){return function(){this.setAttribute(e,t)}}function nc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function oc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function rc(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 ic(e,t){var n=Kt(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?ec:Ja:typeof t=="function"?n.local?rc:oc:n.local?nc:tc)(n,t))}function Ir(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function sc(e){return function(){this.style.removeProperty(e)}}function ac(e,t,n){return function(){this.style.setProperty(e,t,n)}}function cc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function lc(e,t,n){return arguments.length>1?this.each((t==null?sc:typeof t=="function"?cc:ac)(e,t,n??"")):Ye(this.node(),e)}function Ye(e,t){return e.style.getPropertyValue(t)||Ir(e).getComputedStyle(e,null).getPropertyValue(t)}function uc(e){return function(){delete this[e]}}function dc(e,t){return function(){this[e]=t}}function fc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function hc(e,t){return arguments.length>1?this.each((t==null?uc:typeof t=="function"?fc:dc)(e,t)):this.node()[e]}function kr(e){return e.trim().split(/^|\s+/)}function Fn(e){return e.classList||new Ar(e)}function Ar(e){this._node=e,this._names=kr(e.getAttribute("class")||"")}Ar.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 Pr(e,t){for(var n=Fn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function $r(e,t){for(var n=Fn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function gc(e){return function(){Pr(this,e)}}function pc(e){return function(){$r(this,e)}}function mc(e,t){return function(){(t.apply(this,arguments)?Pr:$r)(this,e)}}function yc(e,t){var n=kr(e+"");if(arguments.length<2){for(var o=Fn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?mc:t?gc:pc)(n,t))}function xc(){this.textContent=""}function wc(e){return function(){this.textContent=e}}function vc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function _c(e){return arguments.length?this.each(e==null?xc:(typeof e=="function"?vc:wc)(e)):this.node().textContent}function bc(){this.innerHTML=""}function Ec(e){return function(){this.innerHTML=e}}function Sc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Nc(e){return arguments.length?this.each(e==null?bc:(typeof e=="function"?Sc:Ec)(e)):this.node().innerHTML}function Cc(){this.nextSibling&&this.parentNode.appendChild(this)}function Mc(){return this.each(Cc)}function Ic(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function kc(){return this.each(Ic)}function Ac(e){var t=typeof e=="function"?e:Er(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Pc(){return null}function $c(e,t){var n=typeof e=="function"?e:Er(e),o=t==null?Pc:typeof t=="function"?t:Bn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Dc(){var e=this.parentNode;e&&e.removeChild(this)}function Tc(){return this.each(Dc)}function zc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Rc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hc(e){return this.select(e?Rc:zc)}function Lc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Oc(e){return function(t){e.call(this,t,this.__data__)}}function Vc(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 Bc(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 Fc(e,t,n){return function(){var o=this.__on,r,i=Oc(t);if(o){for(var s=0,c=o.length;s<c;++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 jc(e,t,n){var o=Vc(e+""),r,i=o.length,s;if(arguments.length<2){var c=this.node().__on;if(c){for(var l=0,a=c.length,u;l<a;++l)for(r=0,u=c[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(c=t?Fc:Bc,r=0;r<i;++r)this.each(c(o[r],t,n));return this}function Dr(e,t,n){var o=Ir(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 Xc(e,t){return function(){return Dr(this,e,t)}}function Yc(e,t){return function(){return Dr(this,e,t.apply(this,arguments))}}function Zc(e,t){return this.each((typeof t=="function"?Yc:Xc)(e,t))}function*Wc(){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 Tr=[null];function ue(e,t){this._groups=e,this._parents=t}function yt(){return new ue([[document.documentElement]],Tr)}function qc(){return this}ue.prototype=yt.prototype={constructor:ue,select:va,selectAll:Sa,selectChild:Ia,selectChildren:$a,filter:Da,data:Oa,enter:Ta,exit:Ba,join:Fa,merge:ja,selection:qc,order:Xa,sort:Ya,call:Wa,nodes:qa,node:Ga,size:Ua,empty:Ka,each:Qa,attr:ic,style:lc,property:hc,classed:yc,text:_c,html:Nc,raise:Mc,lower:kc,append:Ac,insert:$c,remove:Tc,clone:Hc,datum:Lc,on:jc,dispatch:Zc,[Symbol.iterator]:Wc};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Tr)}function Gc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Gc(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Uc={passive:!1},ct={capture:!0,passive:!1};function hn(e){e.stopImmediatePropagation()}function je(e){e.preventDefault(),e.stopImmediatePropagation()}function zr(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",je,ct);"onselectstart"in t?n.on("selectstart.drag",je,ct):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Rr(e,t){var n=e.document.documentElement,o=le(e).on("dragstart.drag",null);t&&(o.on("click.drag",je,ct),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const St=e=>()=>e;function Mn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:c,dx:l,dy:a,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:c,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:a,enumerable:!0,configurable:!0},_:{value:u}})}Mn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Kc(e){return!e.ctrlKey&&!e.button}function Qc(){return this.parentNode}function Jc(e,t){return t??{x:e.x,y:e.y}}function el(){return navigator.maxTouchPoints||"ontouchstart"in this}function Hr(){var e=Kc,t=Qc,n=Jc,o=el,r={},i=Ut("start","drag","end"),s=0,c,l,a,u,d=0;function f(y){y.on("mousedown.drag",g).filter(o).on("touchstart.drag",w).on("touchmove.drag",m,Uc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(y,S){if(!(u||!e.call(this,y,S))){var b=h(this,t.call(this,y,S),y,S,"mouse");b&&(le(y.view).on("mousemove.drag",p,ct).on("mouseup.drag",x,ct),zr(y.view),hn(y),a=!1,c=y.clientX,l=y.clientY,b("start",y))}}function p(y){if(je(y),!a){var S=y.clientX-c,b=y.clientY-l;a=S*S+b*b>d}r.mouse("drag",y)}function x(y){le(y.view).on("mousemove.drag mouseup.drag",null),Rr(y.view,a),je(y),r.mouse("end",y)}function w(y,S){if(e.call(this,y,S)){var b=y.changedTouches,N=t.call(this,y,S),$=b.length,D,V;for(D=0;D<$;++D)(V=h(this,N,y,S,b[D].identifier,b[D]))&&(hn(y),V("start",y,b[D]))}}function m(y){var S=y.changedTouches,b=S.length,N,$;for(N=0;N<b;++N)($=r[S[N].identifier])&&(je(y),$("drag",y,S[N]))}function _(y){var S=y.changedTouches,b=S.length,N,$;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),N=0;N<b;++N)($=r[S[N].identifier])&&(hn(y),$("end",y,S[N]))}function h(y,S,b,N,$,D){var V=i.copy(),k=de(D||b,S),T,H,v;if((v=n.call(y,new Mn("beforestart",{sourceEvent:b,target:f,identifier:$,active:s,x:k[0],y:k[1],dx:0,dy:0,dispatch:V}),N))!=null)return T=v.x-k[0]||0,H=v.y-k[1]||0,function C(E,I,M){var P=k,R;switch(E){case"start":r[$]=C,R=s++;break;case"end":delete r[$],--s;case"drag":k=de(M||I,S),R=s;break}V.call(E,y,new Mn(E,{sourceEvent:I,subject:v,target:f,identifier:$,active:R,x:k[0]+T,y:k[1]+H,dx:k[0]-P[0],dy:k[1]-P[1],dispatch:V}),N)}}return f.filter=function(y){return arguments.length?(e=typeof y=="function"?y:St(!!y),f):e},f.container=function(y){return arguments.length?(t=typeof y=="function"?y:St(y),f):t},f.subject=function(y){return arguments.length?(n=typeof y=="function"?y:St(y),f):n},f.touchable=function(y){return arguments.length?(o=typeof y=="function"?y:St(!!y),f):o},f.on=function(){var y=i.on.apply(i,arguments);return y===i?f:y},f.clickDistance=function(y){return arguments.length?(d=(y=+y)*y,f):Math.sqrt(d)},f}function jn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Lr(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function xt(){}var lt=.7,Ot=1/lt,Xe="\\s*([+-]?\\d+)\\s*",ut="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ye="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",tl=/^#([0-9a-f]{3,8})$/,nl=new RegExp(`^rgb\\(${Xe},${Xe},${Xe}\\)$`),ol=new RegExp(`^rgb\\(${ye},${ye},${ye}\\)$`),rl=new RegExp(`^rgba\\(${Xe},${Xe},${Xe},${ut}\\)$`),il=new RegExp(`^rgba\\(${ye},${ye},${ye},${ut}\\)$`),sl=new RegExp(`^hsl\\(${ut},${ye},${ye}\\)$`),al=new RegExp(`^hsla\\(${ut},${ye},${ye},${ut}\\)$`),wo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};jn(xt,ze,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:vo,formatHex:vo,formatHex8:cl,formatHsl:ll,formatRgb:_o,toString:_o});function vo(){return this.rgb().formatHex()}function cl(){return this.rgb().formatHex8()}function ll(){return Or(this).formatHsl()}function _o(){return this.rgb().formatRgb()}function ze(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=tl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?bo(t):n===3?new ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Nt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Nt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=nl.exec(e))?new ce(t[1],t[2],t[3],1):(t=ol.exec(e))?new ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=rl.exec(e))?Nt(t[1],t[2],t[3],t[4]):(t=il.exec(e))?Nt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=sl.exec(e))?No(t[1],t[2]/100,t[3]/100,1):(t=al.exec(e))?No(t[1],t[2]/100,t[3]/100,t[4]):wo.hasOwnProperty(e)?bo(wo[e]):e==="transparent"?new ce(NaN,NaN,NaN,0):null}function bo(e){return new ce(e>>16&255,e>>8&255,e&255,1)}function Nt(e,t,n,o){return o<=0&&(e=t=n=NaN),new ce(e,t,n,o)}function ul(e){return e instanceof xt||(e=ze(e)),e?(e=e.rgb(),new ce(e.r,e.g,e.b,e.opacity)):new ce}function In(e,t,n,o){return arguments.length===1?ul(e):new ce(e,t,n,o??1)}function ce(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}jn(ce,In,Lr(xt,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?lt:Math.pow(lt,e),new ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ce(De(this.r),De(this.g),De(this.b),Vt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Eo,formatHex:Eo,formatHex8:dl,formatRgb:So,toString:So}));function Eo(){return`#${$e(this.r)}${$e(this.g)}${$e(this.b)}`}function dl(){return`#${$e(this.r)}${$e(this.g)}${$e(this.b)}${$e((isNaN(this.opacity)?1:this.opacity)*255)}`}function So(){const e=Vt(this.opacity);return`${e===1?"rgb(":"rgba("}${De(this.r)}, ${De(this.g)}, ${De(this.b)}${e===1?")":`, ${e})`}`}function Vt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function De(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function $e(e){return e=De(e),(e<16?"0":"")+e.toString(16)}function No(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fe(e,t,n,o)}function Or(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof xt||(e=ze(e)),!e)return new fe;if(e instanceof fe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,c=i-r,l=(i+r)/2;return c?(t===i?s=(n-o)/c+(n<o)*6:n===i?s=(o-t)/c+2:s=(t-n)/c+4,c/=l<.5?i+r:2-i-r,s*=60):c=l>0&&l<1?0:s,new fe(s,c,l,e.opacity)}function fl(e,t,n,o){return arguments.length===1?Or(e):new fe(e,t,n,o??1)}function fe(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}jn(fe,fl,Lr(xt,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?lt:Math.pow(lt,e),new fe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new ce(gn(e>=240?e-240:e+120,r,o),gn(e,r,o),gn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new fe(Co(this.h),Ct(this.s),Ct(this.l),Vt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Vt(this.opacity);return`${e===1?"hsl(":"hsla("}${Co(this.h)}, ${Ct(this.s)*100}%, ${Ct(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Co(e){return e=(e||0)%360,e<0?e+360:e}function Ct(e){return Math.max(0,Math.min(1,e||0))}function gn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Xn=e=>()=>e;function hl(e,t){return function(n){return e+n*t}}function gl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function pl(e){return(e=+e)==1?Vr:function(t,n){return n-t?gl(t,n,e):Xn(isNaN(t)?n:t)}}function Vr(e,t){var n=t-e;return n?hl(e,n):Xn(isNaN(e)?t:e)}const Bt=(function e(t){var n=pl(t);function o(r,i){var s=n((r=In(r)).r,(i=In(i)).r),c=n(r.g,i.g),l=n(r.b,i.b),a=Vr(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=c(u),r.b=l(u),r.opacity=a(u),r+""}}return o.gamma=e,o})(1);function ml(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function yl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xl(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=st(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(c){for(s=0;s<o;++s)i[s]=r[s](c);return i}}function wl(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function me(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function vl(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=st(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var kn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pn=new RegExp(kn.source,"g");function _l(e){return function(){return e}}function bl(e){return function(t){return e(t)+""}}function Br(e,t){var n=kn.lastIndex=pn.lastIndex=0,o,r,i,s=-1,c=[],l=[];for(e=e+"",t=t+"";(o=kn.exec(e))&&(r=pn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),c[s]?c[s]+=i:c[++s]=i),(o=o[0])===(r=r[0])?c[s]?c[s]+=r:c[++s]=r:(c[++s]=null,l.push({i:s,x:me(o,r)})),n=pn.lastIndex;return n<t.length&&(i=t.slice(n),c[s]?c[s]+=i:c[++s]=i),c.length<2?l[0]?bl(l[0].x):_l(t):(t=l.length,function(a){for(var u=0,d;u<t;++u)c[(d=l[u]).i]=d.x(a);return c.join("")})}function st(e,t){var n=typeof t,o;return t==null||n==="boolean"?Xn(t):(n==="number"?me:n==="string"?(o=ze(t))?(t=o,Bt):Br:t instanceof ze?Bt:t instanceof Date?wl:yl(t)?ml:Array.isArray(t)?xl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?vl:me)(e,t)}var Mo=180/Math.PI,An={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fr(e,t,n,o,r,i){var s,c,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(c=Math.sqrt(n*n+o*o))&&(n/=c,o/=c,l/=c),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Mo,skewX:Math.atan(l)*Mo,scaleX:s,scaleY:c}}var Mt;function El(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?An:Fr(t.a,t.b,t.c,t.d,t.e,t.f)}function Sl(e){return e==null||(Mt||(Mt=document.createElementNS("http://www.w3.org/2000/svg","g")),Mt.setAttribute("transform",e),!(e=Mt.transform.baseVal.consolidate()))?An:(e=e.matrix,Fr(e.a,e.b,e.c,e.d,e.e,e.f))}function jr(e,t,n,o){function r(a){return a.length?a.pop()+" ":""}function i(a,u,d,f,g,p){if(a!==d||u!==f){var x=g.push("translate(",null,t,null,n);p.push({i:x-4,x:me(a,d)},{i:x-2,x:me(u,f)})}else(d||f)&&g.push("translate("+d+t+f+n)}function s(a,u,d,f){a!==u?(a-u>180?u+=360:u-a>180&&(a+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:me(a,u)})):u&&d.push(r(d)+"rotate("+u+o)}function c(a,u,d,f){a!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:me(a,u)}):u&&d.push(r(d)+"skewX("+u+o)}function l(a,u,d,f,g,p){if(a!==d||u!==f){var x=g.push(r(g)+"scale(",null,",",null,")");p.push({i:x-4,x:me(a,d)},{i:x-2,x:me(u,f)})}else(d!==1||f!==1)&&g.push(r(g)+"scale("+d+","+f+")")}return function(a,u){var d=[],f=[];return a=e(a),u=e(u),i(a.translateX,a.translateY,u.translateX,u.translateY,d,f),s(a.rotate,u.rotate,d,f),c(a.skewX,u.skewX,d,f),l(a.scaleX,a.scaleY,u.scaleX,u.scaleY,d,f),a=u=null,function(g){for(var p=-1,x=f.length,w;++p<x;)d[(w=f[p]).i]=w.x(g);return d.join("")}}}var Nl=jr(El,"px, ","px)","deg)"),Cl=jr(Sl,", ",")",")"),Ml=1e-12;function Io(e){return((e=Math.exp(e))+1/e)/2}function Il(e){return((e=Math.exp(e))-1/e)/2}function kl(e){return((e=Math.exp(2*e))-1)/(e+1)}const Tt=(function e(t,n,o){function r(i,s){var c=i[0],l=i[1],a=i[2],u=s[0],d=s[1],f=s[2],g=u-c,p=d-l,x=g*g+p*p,w,m;if(x<Ml)m=Math.log(f/a)/t,w=function(N){return[c+N*g,l+N*p,a*Math.exp(t*N*m)]};else{var _=Math.sqrt(x),h=(f*f-a*a+o*x)/(2*a*n*_),y=(f*f-a*a-o*x)/(2*f*n*_),S=Math.log(Math.sqrt(h*h+1)-h),b=Math.log(Math.sqrt(y*y+1)-y);m=(b-S)/t,w=function(N){var $=N*m,D=Io(S),V=a/(n*_)*(D*kl(t*$+S)-Il(S));return[c+V*g,l+V*p,a*D/Io(t*$+S)]}}return w.duration=m*1e3*t/Math.SQRT2,w}return r.rho=function(i){var s=Math.max(.001,+i),c=s*s,l=c*c;return e(s,c,l)},r})(Math.SQRT2,2,4);var Ze=0,rt=0,nt=0,Xr=1e3,Ft,it,jt=0,Re=0,Qt=0,dt=typeof performance=="object"&&performance.now?performance:Date,Yr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Yn(){return Re||(Yr(Al),Re=dt.now()+Qt)}function Al(){Re=0}function Xt(){this._call=this._time=this._next=null}Xt.prototype=Zr.prototype={constructor:Xt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Yn():+n)+(t==null?0:+t),!this._next&&it!==this&&(it?it._next=this:Ft=this,it=this),this._call=e,this._time=n,Pn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Pn())}};function Zr(e,t,n){var o=new Xt;return o.restart(e,t,n),o}function Pl(){Yn(),++Ze;for(var e=Ft,t;e;)(t=Re-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ze}function ko(){Re=(jt=dt.now())+Qt,Ze=rt=0;try{Pl()}finally{Ze=0,Dl(),Re=0}}function $l(){var e=dt.now(),t=e-jt;t>Xr&&(Qt-=t,jt=e)}function Dl(){for(var e,t=Ft,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ft=n);it=e,Pn(o)}function Pn(e){if(!Ze){rt&&(rt=clearTimeout(rt));var t=e-Re;t>24?(e<1/0&&(rt=setTimeout(ko,e-dt.now()-Qt)),nt&&(nt=clearInterval(nt))):(nt||(jt=dt.now(),nt=setInterval($l,Xr)),Ze=1,Yr(ko))}}function Ao(e,t,n){var o=new Xt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Tl=Ut("start","end","cancel","interrupt"),zl=[],Wr=0,Po=1,$n=2,zt=3,$o=4,Dn=5,Rt=6;function Jt(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Rl(e,n,{name:t,index:o,group:r,on:Tl,tween:zl,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Wr})}function Zn(e,t){var n=pe(e,t);if(n.state>Wr)throw new Error("too late; already scheduled");return n}function we(e,t){var n=pe(e,t);if(n.state>zt)throw new Error("too late; already running");return n}function pe(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Rl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Zr(i,0,n.time);function i(a){n.state=Po,n.timer.restart(s,n.delay,n.time),n.delay<=a&&s(a-n.delay)}function s(a){var u,d,f,g;if(n.state!==Po)return l();for(u in o)if(g=o[u],g.name===n.name){if(g.state===zt)return Ao(s);g.state===$o?(g.state=Rt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[u]):+u<t&&(g.state=Rt,g.timer.stop(),g.on.call("cancel",e,e.__data__,g.index,g.group),delete o[u])}if(Ao(function(){n.state===zt&&(n.state=$o,n.timer.restart(c,n.delay,n.time),c(a))}),n.state=$n,n.on.call("start",e,e.__data__,n.index,n.group),n.state===$n){for(n.state=zt,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(g=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=g);r.length=d+1}}function c(a){for(var u=a<n.duration?n.ease.call(null,a/n.duration):(n.timer.restart(l),n.state=Dn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Dn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Rt,n.timer.stop(),delete o[t];for(var a in o)return;delete e.__transition}}function Ht(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>$n&&o.state<Dn,o.state=Rt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Hl(e){return this.each(function(){Ht(this,e)})}function Ll(e,t){var n,o;return function(){var r=we(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,c=o.length;s<c;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Ol(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=we(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var c={name:t,value:n},l=0,a=r.length;l<a;++l)if(r[l].name===t){r[l]=c;break}l===a&&r.push(c)}i.tween=r}}function Vl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=pe(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?Ll:Ol)(n,e,t))}function Wn(e,t,n){var o=e._id;return e.each(function(){var r=we(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return pe(r,o).value[t]}}function qr(e,t){var n;return(typeof t=="number"?me:t instanceof ze?Bt:(n=ze(t))?(t=n,Bt):Br)(e,t)}function Bl(e){return function(){this.removeAttribute(e)}}function Fl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function jl(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 Xl(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 Yl(e,t,n){var o,r,i;return function(){var s,c=n(this),l;return c==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=c+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,c)))}}function Zl(e,t,n){var o,r,i;return function(){var s,c=n(this),l;return c==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=c+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,c)))}}function Wl(e,t){var n=Kt(e),o=n==="transform"?Cl:qr;return this.attrTween(e,typeof t=="function"?(n.local?Zl:Yl)(n,o,Wn(this,"attr."+e,t)):t==null?(n.local?Fl:Bl)(n):(n.local?Xl:jl)(n,o,t))}function ql(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Gl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ul(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Gl(e,i)),n}return r._value=t,r}function Kl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&ql(e,i)),n}return r._value=t,r}function Ql(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=Kt(e);return this.tween(n,(o.local?Ul:Kl)(o,t))}function Jl(e,t){return function(){Zn(this,e).delay=+t.apply(this,arguments)}}function eu(e,t){return t=+t,function(){Zn(this,e).delay=t}}function tu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Jl:eu)(t,e)):pe(this.node(),t).delay}function nu(e,t){return function(){we(this,e).duration=+t.apply(this,arguments)}}function ou(e,t){return t=+t,function(){we(this,e).duration=t}}function ru(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nu:ou)(t,e)):pe(this.node(),t).duration}function iu(e,t){if(typeof t!="function")throw new Error;return function(){we(this,e).ease=t}}function su(e){var t=this._id;return arguments.length?this.each(iu(t,e)):pe(this.node(),t).ease}function au(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;we(this,e).ease=n}}function cu(e){if(typeof e!="function")throw new Error;return this.each(au(this._id,e))}function lu(e){typeof e!="function"&&(e=Nr(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,c=o[r]=[],l,a=0;a<s;++a)(l=i[a])&&e.call(l,l.__data__,a,i)&&c.push(l);return new Ee(o,this._parents,this._name,this._id)}function uu(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),c=0;c<i;++c)for(var l=t[c],a=n[c],u=l.length,d=s[c]=new Array(u),f,g=0;g<u;++g)(f=l[g]||a[g])&&(d[g]=f);for(;c<o;++c)s[c]=t[c];return new Ee(s,this._parents,this._name,this._id)}function du(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 fu(e,t,n){var o,r,i=du(t)?Zn:we;return function(){var s=i(this,e),c=s.on;c!==o&&(r=(o=c).copy()).on(t,n),s.on=r}}function hu(e,t){var n=this._id;return arguments.length<2?pe(this.node(),n).on.on(e):this.each(fu(n,e,t))}function gu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function pu(){return this.on("end.remove",gu(this._id))}function mu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Bn(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var c=o[s],l=c.length,a=i[s]=new Array(l),u,d,f=0;f<l;++f)(u=c[f])&&(d=e.call(u,u.__data__,f,c))&&("__data__"in u&&(d.__data__=u.__data__),a[f]=d,Jt(a[f],t,n,f,a,pe(u,n)));return new Ee(i,this._parents,t,n)}function yu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Sr(e));for(var o=this._groups,r=o.length,i=[],s=[],c=0;c<r;++c)for(var l=o[c],a=l.length,u,d=0;d<a;++d)if(u=l[d]){for(var f=e.call(u,u.__data__,d,l),g,p=pe(u,n),x=0,w=f.length;x<w;++x)(g=f[x])&&Jt(g,t,n,x,f,p);i.push(f),s.push(u)}return new Ee(i,s,t,n)}var xu=yt.prototype.constructor;function wu(){return new xu(this._groups,this._parents)}function vu(e,t){var n,o,r;return function(){var i=Ye(this,e),s=(this.style.removeProperty(e),Ye(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Gr(e){return function(){this.style.removeProperty(e)}}function _u(e,t,n){var o,r=n+"",i;return function(){var s=Ye(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function bu(e,t,n){var o,r,i;return function(){var s=Ye(this,e),c=n(this),l=c+"";return c==null&&(l=c=(this.style.removeProperty(e),Ye(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,c))}}function Eu(e,t){var n,o,r,i="style."+t,s="end."+i,c;return function(){var l=we(this,e),a=l.on,u=l.value[i]==null?c||(c=Gr(t)):void 0;(a!==n||r!==u)&&(o=(n=a).copy()).on(s,r=u),l.on=o}}function Su(e,t,n){var o=(e+="")=="transform"?Nl:qr;return t==null?this.styleTween(e,vu(e,o)).on("end.style."+e,Gr(e)):typeof t=="function"?this.styleTween(e,bu(e,o,Wn(this,"style."+e,t))).each(Eu(this._id,e)):this.styleTween(e,_u(e,o,t),n).on("end.style."+e,null)}function Nu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Cu(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Nu(e,s,n)),o}return i._value=t,i}function Mu(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,Cu(e,t,n??""))}function Iu(e){return function(){this.textContent=e}}function ku(e){return function(){var t=e(this);this.textContent=t??""}}function Au(e){return this.tween("text",typeof e=="function"?ku(Wn(this,"text",e)):Iu(e==null?"":e+""))}function Pu(e){return function(t){this.textContent=e.call(this,t)}}function $u(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Pu(r)),t}return o._value=e,o}function Du(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,$u(e))}function Tu(){for(var e=this._name,t=this._id,n=Ur(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],c=s.length,l,a=0;a<c;++a)if(l=s[a]){var u=pe(l,t);Jt(l,e,n,a,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ee(o,this._parents,e,n)}function zu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var c={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var a=we(this,o),u=a.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(c),t._.interrupt.push(c),t._.end.push(l)),a.on=t}),r===0&&i()})}var Ru=0;function Ee(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ur(){return++Ru}var _e=yt.prototype;Ee.prototype={constructor:Ee,select:mu,selectAll:yu,selectChild:_e.selectChild,selectChildren:_e.selectChildren,filter:lu,merge:uu,selection:wu,transition:Tu,call:_e.call,nodes:_e.nodes,node:_e.node,size:_e.size,empty:_e.empty,each:_e.each,on:hu,attr:Wl,attrTween:Ql,style:Su,styleTween:Mu,text:Au,textTween:Du,remove:pu,tween:Vl,delay:tu,duration:ru,ease:su,easeVarying:cu,end:zu,[Symbol.iterator]:_e[Symbol.iterator]};function Hu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Lu={time:null,delay:0,duration:250,ease:Hu};function Ou(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 Vu(e){var t,n;e instanceof Ee?(t=e._id,e=e._name):(t=Ur(),(n=Lu).time=Yn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],c=s.length,l,a=0;a<c;++a)(l=s[a])&&Jt(l,e,t,a,s,n||Ou(l,t));return new Ee(o,this._parents,e,t)}yt.prototype.interrupt=Hl;yt.prototype.transition=Vu;const It=e=>()=>e;function Bu(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 be(e,t,n){this.k=e,this.x=t,this.y=n}be.prototype={constructor:be,scale:function(e){return e===1?this:new be(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new be(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 en=new be(1,0,0);Kr.prototype=be.prototype;function Kr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return en;return e.__zoom}function mn(e){e.stopImmediatePropagation()}function ot(e){e.preventDefault(),e.stopImmediatePropagation()}function Fu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ju(){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 Do(){return this.__zoom||en}function Xu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Yu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Zu(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 Qr(){var e=Fu,t=ju,n=Zu,o=Xu,r=Yu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],c=250,l=Tt,a=Ut("start","zoom","end"),u,d,f,g=500,p=150,x=0,w=10;function m(v){v.property("__zoom",Do).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",V).filter(r).on("touchstart.zoom",k).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,C,E,I){var M=v.selection?v.selection():v;M.property("__zoom",Do),v!==M?S(v,C,E,I):M.interrupt().each(function(){b(this,arguments).event(I).start().zoom(null,typeof C=="function"?C.apply(this,arguments):C).end()})},m.scaleBy=function(v,C,E,I){m.scaleTo(v,function(){var M=this.__zoom.k,P=typeof C=="function"?C.apply(this,arguments):C;return M*P},E,I)},m.scaleTo=function(v,C,E,I){m.transform(v,function(){var M=t.apply(this,arguments),P=this.__zoom,R=E==null?y(M):typeof E=="function"?E.apply(this,arguments):E,O=P.invert(R),L=typeof C=="function"?C.apply(this,arguments):C;return n(h(_(P,L),R,O),M,s)},E,I)},m.translateBy=function(v,C,E,I){m.transform(v,function(){return n(this.__zoom.translate(typeof C=="function"?C.apply(this,arguments):C,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,I)},m.translateTo=function(v,C,E,I,M){m.transform(v,function(){var P=t.apply(this,arguments),R=this.__zoom,O=I==null?y(P):typeof I=="function"?I.apply(this,arguments):I;return n(en.translate(O[0],O[1]).scale(R.k).translate(typeof C=="function"?-C.apply(this,arguments):-C,typeof E=="function"?-E.apply(this,arguments):-E),P,s)},I,M)};function _(v,C){return C=Math.max(i[0],Math.min(i[1],C)),C===v.k?v:new be(C,v.x,v.y)}function h(v,C,E){var I=C[0]-E[0]*v.k,M=C[1]-E[1]*v.k;return I===v.x&&M===v.y?v:new be(v.k,I,M)}function y(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function S(v,C,E,I){v.on("start.zoom",function(){b(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(I).end()}).tween("zoom",function(){var M=this,P=arguments,R=b(M,P).event(I),O=t.apply(M,P),L=E==null?y(O):typeof E=="function"?E.apply(M,P):E,j=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),F=M.__zoom,W=typeof C=="function"?C.apply(M,P):C,U=l(F.invert(L).concat(j/F.k),W.invert(L).concat(j/W.k));return function(Z){if(Z===1)Z=W;else{var B=U(Z),X=j/B[2];Z=new be(X,L[0]-B[0]*X,L[1]-B[1]*X)}R.zoom(null,Z)}})}function b(v,C,E){return!E&&v.__zooming||new N(v,C)}function N(v,C){this.that=v,this.args=C,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,C),this.taps=0}N.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,C){return this.mouse&&v!=="mouse"&&(this.mouse[1]=C.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=C.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=C.invert(this.touch1[0])),this.that.__zoom=C,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var C=le(this.that).datum();a.call(v,this.that,new Bu(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:a}),C)}};function $(v,...C){if(!e.apply(this,arguments))return;var E=b(this,C).event(v),I=this.__zoom,M=Math.max(i[0],Math.min(i[1],I.k*Math.pow(2,o.apply(this,arguments)))),P=de(v);if(E.wheel)(E.mouse[0][0]!==P[0]||E.mouse[0][1]!==P[1])&&(E.mouse[1]=I.invert(E.mouse[0]=P)),clearTimeout(E.wheel);else{if(I.k===M)return;E.mouse=[P,I.invert(P)],Ht(this),E.start()}ot(v),E.wheel=setTimeout(R,p),E.zoom("mouse",n(h(_(I,M),E.mouse[0],E.mouse[1]),E.extent,s));function R(){E.wheel=null,E.end()}}function D(v,...C){if(f||!e.apply(this,arguments))return;var E=v.currentTarget,I=b(this,C,!0).event(v),M=le(v.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",j,!0),P=de(v,E),R=v.clientX,O=v.clientY;zr(v.view),mn(v),I.mouse=[P,this.__zoom.invert(P)],Ht(this),I.start();function L(F){if(ot(F),!I.moved){var W=F.clientX-R,U=F.clientY-O;I.moved=W*W+U*U>x}I.event(F).zoom("mouse",n(h(I.that.__zoom,I.mouse[0]=de(F,E),I.mouse[1]),I.extent,s))}function j(F){M.on("mousemove.zoom mouseup.zoom",null),Rr(F.view,I.moved),ot(F),I.event(F).end()}}function V(v,...C){if(e.apply(this,arguments)){var E=this.__zoom,I=de(v.changedTouches?v.changedTouches[0]:v,this),M=E.invert(I),P=E.k*(v.shiftKey?.5:2),R=n(h(_(E,P),I,M),t.apply(this,C),s);ot(v),c>0?le(this).transition().duration(c).call(S,R,I,v):le(this).call(m.transform,R,I,v)}}function k(v,...C){if(e.apply(this,arguments)){var E=v.touches,I=E.length,M=b(this,C,v.changedTouches.length===I).event(v),P,R,O,L;for(mn(v),R=0;R<I;++R)O=E[R],L=de(O,this),L=[L,this.__zoom.invert(L),O.identifier],M.touch0?!M.touch1&&M.touch0[2]!==L[2]&&(M.touch1=L,M.taps=0):(M.touch0=L,P=!0,M.taps=1+!!u);u&&(u=clearTimeout(u)),P&&(M.taps<2&&(d=L[0],u=setTimeout(function(){u=null},g)),Ht(this),M.start())}}function T(v,...C){if(this.__zooming){var E=b(this,C).event(v),I=v.changedTouches,M=I.length,P,R,O,L;for(ot(v),P=0;P<M;++P)R=I[P],O=de(R,this),E.touch0&&E.touch0[2]===R.identifier?E.touch0[0]=O:E.touch1&&E.touch1[2]===R.identifier&&(E.touch1[0]=O);if(R=E.that.__zoom,E.touch1){var j=E.touch0[0],F=E.touch0[1],W=E.touch1[0],U=E.touch1[1],Z=(Z=W[0]-j[0])*Z+(Z=W[1]-j[1])*Z,B=(B=U[0]-F[0])*B+(B=U[1]-F[1])*B;R=_(R,Math.sqrt(Z/B)),O=[(j[0]+W[0])/2,(j[1]+W[1])/2],L=[(F[0]+U[0])/2,(F[1]+U[1])/2]}else if(E.touch0)O=E.touch0[0],L=E.touch0[1];else return;E.zoom("touch",n(h(R,O,L),E.extent,s))}}function H(v,...C){if(this.__zooming){var E=b(this,C).event(v),I=v.changedTouches,M=I.length,P,R;for(mn(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},g),P=0;P<M;++P)R=I[P],E.touch0&&E.touch0[2]===R.identifier?delete E.touch0:E.touch1&&E.touch1[2]===R.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(R=de(R,this),Math.hypot(d[0]-R[0],d[1]-R[1])<w)){var O=le(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:It(+v),m):o},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:It(!!v),m):e},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:It(!!v),m):r},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:It([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):t},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(c=+v,m):c},m.interpolate=function(v){return arguments.length?(l=v,m):l},m.on=function(){var v=a.on.apply(a,arguments);return v===a?m:v},m.clickDistance=function(v){return arguments.length?(x=(v=+v)*v,m):Math.sqrt(x)},m.tapDistance=function(v){return arguments.length?(w=+v,m):w},m}const xe={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ft=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Jr=["Enter"," ","Escape"],ei={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var We;(function(e){e.Strict="strict",e.Loose="loose"})(We||(We={}));var Te;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Te||(Te={}));var ht;(function(e){e.Partial="partial",e.Full="full"})(ht||(ht={}));const ti={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ie;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ie||(Ie={}));var Yt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Yt||(Yt={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const To={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function ni(e){return e===null?null:e?"valid":"invalid"}const oi=e=>"id"in e&&"source"in e&&"target"in e,Wu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),qn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),wt=(e,t=[0,0])=>{const{width:n,height:o}=Se(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},qu=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):qn(r)?r:t.nodeLookup.get(r.id));const c=s?Zt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return tn(o,c)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return nn(n)},vt=(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=tn(n,Zt(r)),o=!0)}),o?nn(n):{x:0,y:0,width:0,height:0}},Gn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const c={...bt(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const a of e.values()){const{measured:u,selectable:d=!0,hidden:f=!1}=a;if(s&&!d||f)continue;const g=u.width??a.width??a.initialWidth??null,p=u.height??a.height??a.initialHeight??null,x=gt(c,Ge(a)),w=(g??0)*(p??0),m=i&&x>0;(!a.internals.handleBounds||m||x>=w||a.dragging)&&l.push(a)}return l},Gu=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Uu(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Ku({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const c=Uu(e,s),l=vt(c),a=Un(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(a,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function ri({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),c=s.parentId?n.get(s.parentId):void 0,{x:l,y:a}=c?c.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!c)i?.("005",xe.error005());else{const g=c.measured.width,p=c.measured.height;g&&p&&(d=[[l,a],[l+g,a+p]])}else c&&Ue(s.extent)&&(d=[[s.extent[0][0]+l,s.extent[0][1]+a],[s.extent[1][0]+l,s.extent[1][1]+a]]);const f=Ue(d)?He(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",xe.error015()),{position:{x:f.x-l+(s.measured.width??0)*u[0],y:f.y-a+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function Qu({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const g=i.has(f.id),p=!g&&f.parentId&&s.find(x=>x.id===f.parentId);(g||p)&&s.push(f)}const c=new Set(t.map(f=>f.id)),l=o.filter(f=>f.deletable!==!1),u=Gu(s,l);for(const f of l)c.has(f.id)&&!u.find(p=>p.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const qe=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),He=(e={x:0,y:0},t,n)=>({x:qe(e.x,t[0][0],t[1][0]-(n?.width??0)),y:qe(e.y,t[0][1],t[1][1]-(n?.height??0))});function ii(e,t,n){const{width:o,height:r}=Se(n),{x:i,y:s}=n.internals.positionAbsolute;return He(e,[[i,s],[i+o,s+r]],t)}const zo=(e,t,n)=>e<t?qe(Math.abs(e-t),1,t)/t:e>n?-qe(Math.abs(e-n),1,t)/t:0,si=(e,t,n=15,o=40)=>{const r=zo(e.x,o,t.width-o)*n,i=zo(e.y,o,t.height-o)*n;return[r,i]},tn=(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)}),Tn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),nn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Ge=(e,t=[0,0])=>{const{x:n,y:o}=qn(e)?e.internals.positionAbsolute:wt(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}},Zt=(e,t=[0,0])=>{const{x:n,y:o}=qn(e)?e.internals.positionAbsolute:wt(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)}},ai=(e,t)=>nn(tn(Tn(e),Tn(t))),gt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},Ro=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),Ju=(e,t)=>{},_t=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),bt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const c={x:(e-n)/r,y:(t-o)/r};return i?_t(c,s):c},Wt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Ve(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function ed(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Ve(e,n),r=Ve(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Ve(e.top??e.y??0,n),r=Ve(e.bottom??e.y??0,n),i=Ve(e.left??e.x??0,t),s=Ve(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 td(e,t,n,o,r,i){const{x:s,y:c}=Wt(e,[t,n,o]),{x:l,y:a}=Wt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-a;return{left:Math.floor(s),top:Math.floor(c),right:Math.floor(u),bottom:Math.floor(d)}}const Un=(e,t,n,o,r,i)=>{const s=ed(i,t,n),c=(t-s.x)/e.width,l=(n-s.y)/e.height,a=Math.min(c,l),u=qe(a,o,r),d=e.x+e.width/2,f=e.y+e.height/2,g=t/2-d*u,p=n/2-f*u,x=td(e,g,p,u,t,n),w={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:g-w.left+w.right,y:p-w.top+w.bottom,zoom:u}},pt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ue(e){return e!=null&&e!=="parent"}function Se(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ci(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function li(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const c=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*c[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*c[1]}return i}function Ho(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function nd(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function od(e){return{...ei,...e||{}}}function at(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),c=bt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:a}=n?_t(c,t):c;return{xSnapped:l,ySnapped:a,...c}}const Kn=e=>({width:e.offsetWidth,height:e.offsetHeight}),ui=e=>e?.getRootNode?.()||window?.document,rd=["INPUT","SELECT","TEXTAREA"];function di(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:rd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const fi=e=>"clientX"in e,ge=(e,t)=>{const n=fi(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)}},Lo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const c=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(c.left-n.left)/o,y:(c.top-n.top)/o,...Kn(s)}})};function hi({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:c}){const l=e*.125+r*.375+s*.375+n*.125,a=t*.125+i*.375+c*.375+o*.125,u=Math.abs(l-e),d=Math.abs(a-t);return[l,a,u,d]}function kt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Oo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Y.Left:return[t-kt(t-o,i),n];case Y.Right:return[t+kt(o-t,i),n];case Y.Top:return[t,n-kt(n-r,i)];case Y.Bottom:return[t,n+kt(r-n,i)]}}function gi({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[c,l]=Oo({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[a,u]=Oo({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,g,p]=hi({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:c,sourceControlY:l,targetControlX:a,targetControlY:u});return[`M${e},${t} C${c},${l} ${a},${u} ${o},${r}`,d,f,g,p]}function pi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,c=o<t?o+s:o-s;return[i,c,r,s]}function id({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,c=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+c}function sd({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=tn(Zt(e),Zt(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return gt(s,nn(i))>0}const ad=({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)),ld=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||ad;let r;return oi(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 mi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,c]=pi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,c]}const Vo={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},ud=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.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},Bo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function dd({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const c=Vo[t],l=Vo[o],a={x:e.x+c.x*i,y:e.y+c.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=ud({source:a,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",g=d[f];let p=[],x,w;const m={x:0,y:0},_={x:0,y:0},[,,h,y]=pi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[f]*l[f]===-1){f==="x"?(x=r.x??a.x+(u.x-a.x)*s,w=r.y??(a.y+u.y)/2):(x=r.x??(a.x+u.x)/2,w=r.y??a.y+(u.y-a.y)*s);const b=[{x,y:a.y},{x,y:u.y}],N=[{x:a.x,y:w},{x:u.x,y:w}];c[f]===g?p=f==="x"?b:N:p=f==="x"?N:b}else{const b=[{x:a.x,y:u.y}],N=[{x:u.x,y:a.y}];if(f==="x"?p=c.x===g?N:b:p=c.y===g?b:N,t===o){const T=Math.abs(e[f]-n[f]);if(T<=i){const H=Math.min(i-1,i-T);c[f]===g?m[f]=(a[f]>e[f]?-1:1)*H:_[f]=(u[f]>n[f]?-1:1)*H}}if(t!==o){const T=f==="x"?"y":"x",H=c[f]===l[T],v=a[T]>u[T],C=a[T]<u[T];(c[f]===1&&(!H&&v||H&&C)||c[f]!==1&&(!H&&C||H&&v))&&(p=f==="x"?b:N)}const $={x:a.x+m.x,y:a.y+m.y},D={x:u.x+_.x,y:u.y+_.y},V=Math.max(Math.abs($.x-p[0].x),Math.abs(D.x-p[0].x)),k=Math.max(Math.abs($.y-p[0].y),Math.abs(D.y-p[0].y));V>=k?(x=($.x+D.x)/2,w=p[0].y):(x=p[0].x,w=($.y+D.y)/2)}return[[e,{x:a.x+m.x,y:a.y+m.y},...p,{x:u.x+_.x,y:u.y+_.y},n],x,w,h,y]}function fd(e,t,n,o){const r=Math.min(Bo(e,t)/2,Bo(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const a=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*a},${s}Q ${i},${s} ${i},${s+r*u}`}const c=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*c},${s}`}function zn({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:c,centerY:l,offset:a=20,stepPosition:u=.5}){const[d,f,g,p,x]=dd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:c,y:l},offset:a,stepPosition:u});return[d.reduce((m,_,h)=>{let y="";return h>0&&h<d.length-1?y=fd(d[h-1],_,d[h+1],s):y=`${h===0?"M":"L"}${_.x} ${_.y}`,m+=y,m},""),f,g,p,x]}function Fo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function hd(e){const{sourceNode:t,targetNode:n}=e;if(!Fo(t)||!Fo(n))return null;const o=t.internals.handleBounds||jo(t.handles),r=n.internals.handleBounds||jo(n.handles),i=Xo(o?.source??[],e.sourceHandle),s=Xo(e.connectionMode===We.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",xe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const c=i?.position||Y.Bottom,l=s?.position||Y.Top,a=Le(t,i,c),u=Le(n,s,l);return{sourceX:a.x,sourceY:a.y,targetX:u.x,targetY:u.y,sourcePosition:c,targetPosition:l}}function jo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Le(e,t,n=Y.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:c}=t??Se(e);if(o)return{x:r+s/2,y:i+c/2};switch(t?.position??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+c/2};case Y.Bottom:return{x:r+s/2,y:i+c};case Y.Left:return{x:r,y:i+c/2}}}function Xo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Rn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function gd(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,c)=>([c.markerStart||o,c.markerEnd||r].forEach(l=>{if(l&&typeof l=="object"){const a=Rn(l,t);i.has(a)||(s.push({id:a,color:l.color||n,...l}),i.add(a))}}),s),[]).sort((s,c)=>s.id.localeCompare(c.id))}const yi=1e3,pd=10,Qn={nodeOrigin:[0,0],nodeExtent:ft,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},md={...Qn,checkEquality:!0};function Jn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function yd(e,t,n){const o=Jn(Qn,n);for(const r of e.values())if(r.parentId)to(r,e,t,o);else{const i=wt(r,o.nodeOrigin),s=Ue(r.extent)?r.extent:o.nodeExtent,c=He(i,s,Se(r));r.internals.positionAbsolute=c}}function xd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function eo(e){return e==="manual"}function Hn(e,t,n,o={}){const r=Jn(md,o),i={i:0},s=new Map(t),c=r?.elevateNodesOnSelect&&!eo(r.zIndexMode)?yi:0;let l=e.length>0;t.clear(),n.clear();for(const a of e){let u=s.get(a.id);if(r.checkEquality&&a===u?.internals.userNode)t.set(a.id,u);else{const d=wt(a,r.nodeOrigin),f=Ue(a.extent)?a.extent:r.nodeExtent,g=He(d,f,Se(a));u={...r.defaults,...a,measured:{width:a.measured?.width,height:a.measured?.height},internals:{positionAbsolute:g,handleBounds:xd(a,u),z:xi(a,c,r.zIndexMode),userNode:a}},t.set(a.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),a.parentId&&to(u,t,n,o,i)}return l}function wd(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function to(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:c,zIndexMode:l}=Jn(Qn,o),a=e.parentId,u=t.get(a);if(!u){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}wd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="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);const d=i&&!eo(l)?yi:0,{x:f,y:g,z:p}=vd(e,u,s,c,d,l),{positionAbsolute:x}=e.internals,w=f!==x.x||g!==x.y;(w||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:g}:x,z:p}})}function xi(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return eo(n)?o:o+(e.selected?t:0)}function vd(e,t,n,o,r,i){const{x:s,y:c}=t.internals.positionAbsolute,l=Se(e),a=wt(e,n),u=Ue(e.extent)?He(a,e.extent,l):a;let d=He({x:s+u.x,y:c+u.y},o,l);e.extent==="parent"&&(d=ii(d,l,t));const f=xi(e,r,i),g=t.internals.z??0;return{x:d.x,y:d.y,z:g>=f?g+1:f}}function no(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const c=t.get(s.parentId);if(!c)continue;const l=i.get(s.parentId)?.expandedRect??Ge(c),a=ai(l,s.rect);i.set(s.parentId,{expandedRect:a,parent:c})}return i.size>0&&i.forEach(({expandedRect:s,parent:c},l)=>{const a=c.internals.positionAbsolute,u=Se(c),d=c.origin??o,f=s.x<a.x?Math.round(Math.abs(a.x-s.x)):0,g=s.y<a.y?Math.round(Math.abs(a.y-s.y)):0,p=Math.max(u.width,Math.round(s.width)),x=Math.max(u.height,Math.round(s.height)),w=(p-u.width)*d[0],m=(x-u.height)*d[1];(f>0||g>0||w||m)&&(r.push({id:l,type:"position",position:{x:c.position.x-f+w,y:c.position.y-g+m}}),n.get(l)?.forEach(_=>{e.some(h=>h.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+g}})})),(u.width<s.width||u.height<s.height||f||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:p+(f?d[0]*f-w:0),height:x+(g?d[1]*g-m:0)}})}),r}function _d(e,t,n,o,r,i,s){const c=o?.querySelector(".xyflow__viewport");let l=!1;if(!c)return{changes:[],updatedInternals:l};const a=[],u=window.getComputedStyle(c),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const g of e.values()){const p=t.get(g.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),l=!0;continue}const x=Kn(g.nodeElement),w=p.measured.width!==x.width||p.measured.height!==x.height;if(!!(x.width&&x.height&&(w||!p.internals.handleBounds||g.force))){const _=g.nodeElement.getBoundingClientRect(),h=Ue(p.extent)?p.extent:i;let{positionAbsolute:y}=p.internals;p.parentId&&p.extent==="parent"?y=ii(y,x,t.get(p.parentId)):h&&(y=He(y,h,x));const S={...p,measured:x,internals:{...p.internals,positionAbsolute:y,handleBounds:{source:Lo("source",g.nodeElement,_,d,p.id),target:Lo("target",g.nodeElement,_,d,p.id)}}};t.set(p.id,S),p.parentId&&to(S,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,w&&(a.push({id:p.id,type:"dimensions",dimensions:x}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:Ge(S,r)}))}}if(f.length>0){const g=no(f,t,n,r);a.push(...g)}return{changes:a,updatedInternals:l}}async function bd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),c=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(c)}function Yo(e,t,n,o,r,i){let s=r;const c=o.get(s)||new Map;o.set(s,c.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const a=o.get(s)||new Map;o.set(s,a.set(n,t))}}function wi(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:c=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:c},a=`${r}-${s}--${i}-${c}`,u=`${i}-${c}--${r}-${s}`;Yo("source",l,u,e,r,s),Yo("target",l,a,e,i,c),t.set(o.id,o)}}function vi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:vi(n,t):!1}function Zo(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 Ed(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!vi(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const c=e.get(i);c&&r.set(i,{id:i,position:c.position||{x:0,y:0},distance:{x:n.x-c.internals.positionAbsolute.x,y:n.y-c.internals.positionAbsolute.y},extent:c.extent,parentId:c.parentId,origin:c.origin,expandParent:c.expandParent,internals:{positionAbsolute:c.internals.positionAbsolute||{x:0,y:0}},measured:{width:c.measured.width??0,height:c.measured.height??0}})}return r}function yn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,c]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,position:c.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Sd({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=_t(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Nd({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,c=new Map,l=!1,a={x:0,y:0},u=null,d=!1,f=null,g=!1,p=!1,x=null;function w({noDragClassName:_,handleSelector:h,domNode:y,isSelectable:S,nodeId:b,nodeClickDistance:N=0}){f=le(y);function $({x:T,y:H}){const{nodeLookup:v,nodeExtent:C,snapGrid:E,snapToGrid:I,nodeOrigin:M,onNodeDrag:P,onSelectionDrag:R,onError:O,updateNodePositions:L}=t();i={x:T,y:H};let j=!1;const F=c.size>1,W=F&&C?Tn(vt(c)):null,U=F&&I?Sd({dragItems:c,snapGrid:E,x:T,y:H}):null;for(const[Z,B]of c){if(!v.has(Z))continue;let X={x:T-B.distance.x,y:H-B.distance.y};I&&(X=U?{x:Math.round(X.x+U.x),y:Math.round(X.y+U.y)}:_t(X,E));let Q=null;if(F&&C&&!B.extent&&W){const{positionAbsolute:G}=B.internals,ee=G.x-W.x+C[0][0],ne=G.x+B.measured.width-W.x2+C[1][0],te=G.y-W.y+C[0][1],se=G.y+B.measured.height-W.y2+C[1][1];Q=[[ee,te],[ne,se]]}const{position:K,positionAbsolute:q}=ri({nodeId:Z,nextPosition:X,nodeLookup:v,nodeExtent:Q||C,nodeOrigin:M,onError:O});j=j||B.position.x!==K.x||B.position.y!==K.y,B.position=K,B.internals.positionAbsolute=q}if(p=p||j,!!j&&(L(c,!0),x&&(o||P||!b&&R))){const[Z,B]=yn({nodeId:b,dragItems:c,nodeLookup:v});o?.(x,c,Z,B),P?.(x,Z,B),b||R?.(x,B)}}async function D(){if(!u)return;const{transform:T,panBy:H,autoPanSpeed:v,autoPanOnNodeDrag:C}=t();if(!C){l=!1,cancelAnimationFrame(s);return}const[E,I]=si(a,u,v);(E!==0||I!==0)&&(i.x=(i.x??0)-E/T[2],i.y=(i.y??0)-I/T[2],await H({x:E,y:I})&&$(i)),s=requestAnimationFrame(D)}function V(T){const{nodeLookup:H,multiSelectionActive:v,nodesDraggable:C,transform:E,snapGrid:I,snapToGrid:M,selectNodesOnDrag:P,onNodeDragStart:R,onSelectionDragStart:O,unselectNodesAndEdges:L}=t();d=!0,(!P||!S)&&!v&&b&&(H.get(b)?.selected||L()),S&&P&&b&&e?.(b);const j=at(T.sourceEvent,{transform:E,snapGrid:I,snapToGrid:M,containerBounds:u});if(i=j,c=Ed(H,C,j,b),c.size>0&&(n||R||!b&&O)){const[F,W]=yn({nodeId:b,dragItems:c,nodeLookup:H});n?.(T.sourceEvent,c,F,W),R?.(T.sourceEvent,F,W),b||O?.(T.sourceEvent,W)}}const k=Hr().clickDistance(N).on("start",T=>{const{domNode:H,nodeDragThreshold:v,transform:C,snapGrid:E,snapToGrid:I}=t();u=H?.getBoundingClientRect()||null,g=!1,p=!1,x=T.sourceEvent,v===0&&V(T),i=at(T.sourceEvent,{transform:C,snapGrid:E,snapToGrid:I,containerBounds:u}),a=ge(T.sourceEvent,u)}).on("drag",T=>{const{autoPanOnNodeDrag:H,transform:v,snapGrid:C,snapToGrid:E,nodeDragThreshold:I,nodeLookup:M}=t(),P=at(T.sourceEvent,{transform:v,snapGrid:C,snapToGrid:E,containerBounds:u});if(x=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||b&&!M.has(b))&&(g=!0),!g){if(!l&&H&&d&&(l=!0,D()),!d){const R=ge(T.sourceEvent,u),O=R.x-a.x,L=R.y-a.y;Math.sqrt(O*O+L*L)>I&&V(T)}(i.x!==P.xSnapped||i.y!==P.ySnapped)&&c&&d&&(a=ge(T.sourceEvent,u),$(P))}}).on("end",T=>{if(!(!d||g)&&(l=!1,d=!1,cancelAnimationFrame(s),c.size>0)){const{nodeLookup:H,updateNodePositions:v,onNodeDragStop:C,onSelectionDragStop:E}=t();if(p&&(v(c,!1),p=!1),r||C||!b&&E){const[I,M]=yn({nodeId:b,dragItems:c,nodeLookup:H,dragging:!1});r?.(T.sourceEvent,c,I,M),C?.(T.sourceEvent,I,M),b||E?.(T.sourceEvent,M)}}}).filter(T=>{const H=T.target;return!T.button&&(!_||!Zo(H,`.${_}`,y))&&(!h||Zo(H,h,y))});f.call(k)}function m(){f?.on(".drag",null)}return{update:w,destroy:m}}function Cd(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())gt(r,Ge(i))>0&&o.push(i);return o}const Md=250;function Id(e,t,n,o){let r=[],i=1/0;const s=Cd(e,n,t+Md);for(const c of s){const l=[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]];for(const a of l){if(o.nodeId===a.nodeId&&o.type===a.type&&o.id===a.id)continue;const{x:u,y:d}=Le(c,a,a.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...a,x:u,y:d}],i=f):f===i&&r.push({...a,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const c=o.type==="source"?"target":"source";return r.find(l=>l.type===c)??r[0]}return r[0]}function _i(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const c=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?c?.find(a=>a.id===n):c?.[0])??null;return l&&i?{...l,...Le(s,l,l.position,!0)}:l}function bi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function kd(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ei=()=>!0;function Ad(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:c,nodeLookup:l,lib:a,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:g,onConnectStart:p,onConnect:x,onConnectEnd:w,isValidConnection:m=Ei,onReconnectEnd:_,updateConnection:h,getTransform:y,getFromHandle:S,autoPanSpeed:b,dragThreshold:N=1,handleDomNode:$}){const D=ui(e.target);let V=0,k;const{x:T,y:H}=ge(e),v=bi(i,$),C=c?.getBoundingClientRect();let E=!1;if(!C||!v)return;const I=_i(r,v,o,l,t);if(!I)return;let M=ge(e,C),P=!1,R=null,O=!1,L=null;function j(){if(!u||!C)return;const[K,q]=si(M,C,b);f({x:K,y:q}),V=requestAnimationFrame(j)}const F={...I,nodeId:r,type:v,position:I.position},W=l.get(r);let Z={inProgress:!0,isValid:null,from:Le(W,F,Y.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:W,to:M,toHandle:null,toPosition:To[F.position],toNode:null,pointer:M};function B(){E=!0,h(Z),p?.(e,{nodeId:r,handleId:o,handleType:v})}N===0&&B();function X(K){if(!E){const{x:se,y:Ne}=ge(K),ve=se-T,Ae=Ne-H;if(!(ve*ve+Ae*Ae>N*N))return;B()}if(!S()||!F){Q(K);return}const q=y();M=ge(K,C),k=Id(bt(M,q,!1,[1,1]),n,l,F),P||(j(),P=!0);const G=Si(K,{handle:k,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:D,lib:a,flowId:d,nodeLookup:l});L=G.handleDomNode,R=G.connection,O=kd(!!k,G.isValid);const ee=l.get(r),ne=ee?Le(ee,F,Y.Left,!0):Z.from,te={...Z,from:ne,isValid:O,to:G.toHandle&&O?Wt({x:G.toHandle.x,y:G.toHandle.y},q):M,toHandle:G.toHandle,toPosition:O&&G.toHandle?G.toHandle.position:To[F.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:M};h(te),Z=te}function Q(K){if(!("touches"in K&&K.touches.length>0)){if(E){(k||L)&&R&&O&&x?.(R);const{inProgress:q,...G}=Z,ee={...G,toPosition:Z.toHandle?Z.toPosition:null};w?.(K,ee),i&&_?.(K,ee)}g(),cancelAnimationFrame(V),P=!1,O=!1,R=null,L=null,D.removeEventListener("mousemove",X),D.removeEventListener("mouseup",Q),D.removeEventListener("touchmove",X),D.removeEventListener("touchend",Q)}}D.addEventListener("mousemove",X),D.addEventListener("mouseup",Q),D.addEventListener("touchmove",X),D.addEventListener("touchend",Q)}function Si(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:c,flowId:l,isValidConnection:a=Ei,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${c}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:p}=ge(e),x=s.elementFromPoint(g,p),w=x?.classList.contains(`${c}-flow__handle`)?x:f,m={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const _=bi(void 0,w),h=w.getAttribute("data-nodeid"),y=w.getAttribute("data-handleid"),S=w.classList.contains("connectable"),b=w.classList.contains("connectableend");if(!h||!_)return m;const N={source:d?h:o,sourceHandle:d?y:r,target:d?o:h,targetHandle:d?r:y};m.connection=N;const D=S&&b&&(n===We.Strict?d&&_==="source"||!d&&_==="target":h!==o||y!==r);m.isValid=D&&a(N),m.toHandle=_i(h,_,y,u,n,!0)}return m}const Ln={onPointerDown:Ad,isValid:Si};function Pd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=le(e);function i({translateExtent:c,width:l,height:a,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:g=!1}){const p=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;const y=n(),S=h.sourceEvent.ctrlKey&&pt()?10:1,b=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*u,N=y[2]*Math.pow(2,b*S);t.scaleTo(N)};let x=[0,0];const w=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(x=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},m=h=>{const y=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;const S=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],b=[S[0]-x[0],S[1]-x[1]];x=S;const N=o()*Math.max(y[2],Math.log(y[2]))*(g?-1:1),$={x:y[0]-b[0]*N,y:y[1]-b[1]*N},D=[[0,0],[l,a]];t.setViewportConstrained({x:$.x,y:$.y,zoom:y[2]},D,c)},_=Qr().on("start",w).on("zoom",d?m:null).on("zoom.wheel",f?p:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const on=e=>({x:e.x,y:e.y,zoom:e.k}),xn=({x:e,y:t,zoom:n})=>en.translate(e,t).scale(n),Be=(e,t)=>e.target.closest(`.${t}`),Ni=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),$d=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,wn=(e,t=0,n=$d,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ci=e=>{const t=e.ctrlKey&&pt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Dd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:c,onPanZoom:l,onPanZoomEnd:a}){return u=>{if(Be(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const w=de(u),m=Ci(u),_=d*Math.pow(2,m);o.scaleTo(n,_,w,u);return}const f=u.deltaMode===1?20:1;let g=r===Te.Vertical?0:u.deltaX*f,p=r===Te.Horizontal?0:u.deltaY*f;!pt()&&u.shiftKey&&r!==Te.Vertical&&(g=u.deltaY*f,p=0),o.translateBy(n,-(g/d)*i,-(p/d)*i,{internal:!0});const x=on(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(l?.(u,x),e.panScrollTimeout=setTimeout(()=>{a?.(u,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,c?.(u,x))}}function Td({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,c=Be(o,e);if(o.ctrlKey&&i&&c&&o.preventDefault(),s||c)return null;o.preventDefault(),n.call(this,o,r)}}function zd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=on(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 Rd({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Ni(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,on(i.transform))}}function Hd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Ni(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const c=on(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,c)},n?150:0)}}}function Ld({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:c,noPanClassName:l,lib:a,connectionInProgress:u}){return d=>{const f=e||t,g=n&&d.ctrlKey,p=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Be(d,`${a}-flow__node`)||Be(d,`${a}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!p||Be(d,c)&&p||Be(d,l)&&(!p||r&&p&&!e)||!n&&d.ctrlKey&&p)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!g&&p||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const x=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||p)&&x}}function Od({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:l}){const a={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=Qr().scaleExtent([t,n]).translateExtent(o),f=le(e).call(d);_({x:r.x,y:r.y,zoom:qe(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const g=f.on("wheel.zoom"),p=f.on("dblclick.zoom");d.wheelDelta(Ci);function x(k,T){return f?new Promise(H=>{d?.interpolate(T?.interpolate==="linear"?st:Tt).transform(wn(f,T?.duration,T?.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function w({noWheelClassName:k,noPanClassName:T,onPaneContextMenu:H,userSelectionActive:v,panOnScroll:C,panOnDrag:E,panOnScrollMode:I,panOnScrollSpeed:M,preventScrolling:P,zoomOnPinch:R,zoomOnScroll:O,zoomOnDoubleClick:L,zoomActivationKeyPressed:j,lib:F,onTransformChange:W,connectionInProgress:U,paneClickDistance:Z,selectionOnDrag:B}){v&&!a.isZoomingOrPanning&&m();const X=C&&!j&&!v;d.clickDistance(B?1/0:!he(Z)||Z<0?0:Z);const Q=X?Dd({zoomPanValues:a,noWheelClassName:k,d3Selection:f,d3Zoom:d,panOnScrollMode:I,panOnScrollSpeed:M,zoomOnPinch:R,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:c}):Td({noWheelClassName:k,preventScrolling:P,d3ZoomHandler:g});if(f.on("wheel.zoom",Q,{passive:!1}),!v){const q=zd({zoomPanValues:a,onDraggingChange:l,onPanZoomStart:s});d.on("start",q);const G=Rd({zoomPanValues:a,panOnDrag:E,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:W});d.on("zoom",G);const ee=Hd({zoomPanValues:a,panOnDrag:E,panOnScroll:C,onPaneContextMenu:H,onPanZoomEnd:c,onDraggingChange:l});d.on("end",ee)}const K=Ld({zoomActivationKeyPressed:j,panOnDrag:E,zoomOnScroll:O,panOnScroll:C,zoomOnDoubleClick:L,zoomOnPinch:R,userSelectionActive:v,noPanClassName:T,noWheelClassName:k,lib:F,connectionInProgress:U});d.filter(K),L?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function m(){d.on("zoom",null)}async function _(k,T,H){const v=xn(k),C=d?.constrain()(v,T,H);return C&&await x(C),new Promise(E=>E(C))}async function h(k,T){const H=xn(k);return await x(H,T),new Promise(v=>v(H))}function y(k){if(f){const T=xn(k),H=f.property("__zoom");(H.k!==k.zoom||H.x!==k.x||H.y!==k.y)&&d?.transform(f,T,null,{sync:!0})}}function S(){const k=f?Kr(f.node()):{x:0,y:0,k:1};return{x:k.x,y:k.y,zoom:k.k}}function b(k,T){return f?new Promise(H=>{d?.interpolate(T?.interpolate==="linear"?st:Tt).scaleTo(wn(f,T?.duration,T?.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function N(k,T){return f?new Promise(H=>{d?.interpolate(T?.interpolate==="linear"?st:Tt).scaleBy(wn(f,T?.duration,T?.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function $(k){d?.scaleExtent(k)}function D(k){d?.translateExtent(k)}function V(k){const T=!he(k)||k<0?0:k;d?.clickDistance(T)}return{update:w,destroy:m,setViewport:h,setViewportConstrained:_,getViewport:S,scaleTo:b,scaleBy:N,setScaleExtent:$,setTranslateExtent:D,syncViewport:y,setClickDistance:V}}var Ke;(function(e){e.Line="line",e.Handle="handle"})(Ke||(Ke={}));function Vd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,c=n-o,l=[s>0?1:s<0?-1:0,c>0?1:c<0?-1:0];return s&&r&&(l[0]=l[0]*-1),c&&i&&(l[1]=l[1]*-1),l}function Wo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ce(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function At(e,t,n){return Math.max(0,t-e,e-n)}function qo(e,t){return e?!t:t}function Bd(e,t,n,o,r,i,s,c){let{affectsX:l,affectsY:a}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:g,ySnapped:p}=n,{minWidth:x,maxWidth:w,minHeight:m,maxHeight:_}=o,{x:h,y,width:S,height:b,aspectRatio:N}=e;let $=Math.floor(u?g-e.pointerX:0),D=Math.floor(d?p-e.pointerY:0);const V=S+(l?-$:$),k=b+(a?-D:D),T=-i[0]*S,H=-i[1]*b;let v=At(V,x,w),C=At(k,m,_);if(s){let M=0,P=0;l&&$<0?M=Ce(h+$+T,s[0][0]):!l&&$>0&&(M=Me(h+V+T,s[1][0])),a&&D<0?P=Ce(y+D+H,s[0][1]):!a&&D>0&&(P=Me(y+k+H,s[1][1])),v=Math.max(v,M),C=Math.max(C,P)}if(c){let M=0,P=0;l&&$>0?M=Me(h+$,c[0][0]):!l&&$<0&&(M=Ce(h+V,c[1][0])),a&&D>0?P=Me(y+D,c[0][1]):!a&&D<0&&(P=Ce(y+k,c[1][1])),v=Math.max(v,M),C=Math.max(C,P)}if(r){if(u){const M=At(V/N,m,_)*N;if(v=Math.max(v,M),s){let P=0;!l&&!a||l&&!a&&f?P=Me(y+H+V/N,s[1][1])*N:P=Ce(y+H+(l?$:-$)/N,s[0][1])*N,v=Math.max(v,P)}if(c){let P=0;!l&&!a||l&&!a&&f?P=Ce(y+V/N,c[1][1])*N:P=Me(y+(l?$:-$)/N,c[0][1])*N,v=Math.max(v,P)}}if(d){const M=At(k*N,x,w)/N;if(C=Math.max(C,M),s){let P=0;!l&&!a||a&&!l&&f?P=Me(h+k*N+T,s[1][0])/N:P=Ce(h+(a?D:-D)*N+T,s[0][0])/N,C=Math.max(C,P)}if(c){let P=0;!l&&!a||a&&!l&&f?P=Ce(h+k*N,c[1][0])/N:P=Me(h+(a?D:-D)*N,c[0][0])/N,C=Math.max(C,P)}}}D=D+(D<0?C:-C),$=$+($<0?v:-v),r&&(f?V>k*N?D=(qo(l,a)?-$:$)/N:$=(qo(l,a)?-D:D)*N:u?(D=$/N,a=l):($=D*N,l=a));const E=l?h+$:h,I=a?y+D:y;return{width:S+(l?-$:$),height:b+(a?-D:D),x:i[0]*$*(l?-1:1)+E,y:i[1]*D*(a?-1:1)+I}}const Mi={width:0,height:0,x:0,y:0},Fd={...Mi,pointerX:0,pointerY:0,aspectRatio:1};function jd(e){return[[0,0],[e.measured.width,e.measured.height]]}function Xd(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,c=n[0]*i,l=n[1]*s;return[[o-c,r-l],[o+i-c,r+s-l]]}function Yd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=le(e);let s={controlDirection:Wo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function c({controlPosition:a,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:g,onResize:p,onResizeEnd:x,shouldResize:w}){let m={...Mi},_={...Fd};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:Wo(a)};let h,y=null,S=[],b,N,$,D=!1;const V=Hr().on("start",k=>{const{nodeLookup:T,transform:H,snapGrid:v,snapToGrid:C,nodeOrigin:E,paneDomNode:I}=n();if(h=T.get(t),!h)return;y=I?.getBoundingClientRect()??null;const{xSnapped:M,ySnapped:P}=at(k.sourceEvent,{transform:H,snapGrid:v,snapToGrid:C,containerBounds:y});m={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},_={...m,pointerX:M,pointerY:P,aspectRatio:m.width/m.height},b=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(b=T.get(h.parentId),N=b&&h.extent==="parent"?jd(b):void 0),S=[],$=void 0;for(const[R,O]of T)if(O.parentId===t&&(S.push({id:R,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const L=Xd(O,h,O.origin??E);$?$=[[Math.min(L[0][0],$[0][0]),Math.min(L[0][1],$[0][1])],[Math.max(L[1][0],$[1][0]),Math.max(L[1][1],$[1][1])]]:$=L}g?.(k,{...m})}).on("drag",k=>{const{transform:T,snapGrid:H,snapToGrid:v,nodeOrigin:C}=n(),E=at(k.sourceEvent,{transform:T,snapGrid:H,snapToGrid:v,containerBounds:y}),I=[];if(!h)return;const{x:M,y:P,width:R,height:O}=m,L={},j=h.origin??C,{width:F,height:W,x:U,y:Z}=Bd(_,s.controlDirection,E,s.boundaries,s.keepAspectRatio,j,N,$),B=F!==R,X=W!==O,Q=U!==M&&B,K=Z!==P&&X;if(!Q&&!K&&!B&&!X)return;if((Q||K||j[0]===1||j[1]===1)&&(L.x=Q?U:m.x,L.y=K?Z:m.y,m.x=L.x,m.y=L.y,S.length>0)){const ne=U-M,te=Z-P;for(const se of S)se.position={x:se.position.x-ne+j[0]*(F-R),y:se.position.y-te+j[1]*(W-O)},I.push(se)}if((B||X)&&(L.width=B&&(!s.resizeDirection||s.resizeDirection==="horizontal")?F:m.width,L.height=X&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=L.width,m.height=L.height),b&&h.expandParent){const ne=j[0]*(L.width??0);L.x&&L.x<ne&&(m.x=ne,_.x=_.x-(L.x-ne));const te=j[1]*(L.height??0);L.y&&L.y<te&&(m.y=te,_.y=_.y-(L.y-te))}const q=Vd({width:m.width,prevWidth:R,height:m.height,prevHeight:O,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:q};w?.(k,G)!==!1&&(D=!0,p?.(k,G),o(L,I))}).on("end",k=>{D&&(x?.(k,{...m}),r?.({...m}),D=!1)});i.call(V)}function l(){i.on(".drag",null)}return{update:c,destroy:l}}var vn={exports:{}},_n={},bn={exports:{}},En={};var Go;function Zd(){if(Go)return En;Go=1;var e=Vn();function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function c(d,f){var g=f(),p=o({inst:{value:g,getSnapshot:f}}),x=p[0].inst,w=p[1];return i(function(){x.value=g,x.getSnapshot=f,l(x)&&w({inst:x})},[d,g,f]),r(function(){return l(x)&&w({inst:x}),d(function(){l(x)&&w({inst:x})})},[d]),s(g),g}function l(d){var f=d.getSnapshot;d=d.value;try{var g=f();return!n(d,g)}catch{return!0}}function a(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:c;return En.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,En}var Uo;function Wd(){return Uo||(Uo=1,bn.exports=Zd()),bn.exports}var Ko;function qd(){if(Ko)return _n;Ko=1;var e=Vn(),t=Wd();function n(a,u){return a===u&&(a!==0||1/a===1/u)||a!==a&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,c=e.useMemo,l=e.useDebugValue;return _n.useSyncExternalStoreWithSelector=function(a,u,d,f,g){var p=i(null);if(p.current===null){var x={hasValue:!1,value:null};p.current=x}else x=p.current;p=c(function(){function m(b){if(!_){if(_=!0,h=b,b=f(b),g!==void 0&&x.hasValue){var N=x.value;if(g(N,b))return y=N}return y=b}if(N=y,o(h,b))return N;var $=f(b);return g!==void 0&&g(N,$)?(h=b,N):(h=b,y=$)}var _=!1,h,y,S=d===void 0?null:d;return[function(){return m(u())},S===null?void 0:function(){return m(S())}]},[u,d,f,g]);var w=r(a,p[0],p[1]);return s(function(){x.hasValue=!0,x.value=w},[w]),l(w),w},_n}var Qo;function Gd(){return Qo||(Qo=1,vn.exports=qd()),vn.exports}var Ud=Gd();const Kd=ua(Ud),Qd={},Jo=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const g=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,g))}},r=()=>t,l={setState:o,getState:r,getInitialState:()=>a,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Qd?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(o,r,l);return l},Jd=e=>e?Jo(e):Jo,{useDebugValue:ef}=da,{useSyncExternalStoreWithSelector:tf}=Kd,nf=e=>e;function Ii(e,t=nf,n){const o=tf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ef(o),o}const er=(e,t)=>{const n=Jd(e),o=(r,i=t)=>Ii(n,r,i);return Object.assign(o,n),o},of=(e,t)=>e?er(e,t):er;function oe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}ha();const rn=z.createContext(null),rf=rn.Provider,ki=xe.error001();function J(e,t){const n=z.useContext(rn);if(n===null)throw new Error(ki);return Ii(n,e,t)}function re(){const e=z.useContext(rn);if(e===null)throw new Error(ki);return z.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const tr={display:"none"},sf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ai="react-flow__node-desc",Pi="react-flow__edge-desc",af="react-flow__aria-live",cf=e=>e.ariaLiveMessage,lf=e=>e.ariaLabelConfig;function uf({rfId:e}){const t=J(cf);return A.jsx("div",{id:`${af}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:sf,children:t})}function df({rfId:e,disableKeyboardA11y:t}){const n=J(lf);return A.jsxs(A.Fragment,{children:[A.jsx("div",{id:`${Ai}-${e}`,style:tr,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),A.jsx("div",{id:`${Pi}-${e}`,style:tr,children:n["edge.a11yDescription.default"]}),!t&&A.jsx(uf,{rfId:e})]})}const sn=z.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return A.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});sn.displayName="Panel";function ff({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:A.jsx(sn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:A.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const hf=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Pt=e=>e.id;function gf(e,t){return oe(e.selectedNodes.map(Pt),t.selectedNodes.map(Pt))&&oe(e.selectedEdges.map(Pt),t.selectedEdges.map(Pt))}function pf({onSelectionChange:e}){const t=re(),{selectedNodes:n,selectedEdges:o}=J(hf,gf);return z.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const mf=e=>!!e.onSelectionChangeHandlers;function yf({onSelectionChange:e}){const t=J(mf);return e||t?A.jsx(pf,{onSelectionChange:e}):null}const $i=[0,0],xf={x:0,y:0,zoom:1},wf=["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"],nr=[...wf,"rfId"],vf=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}),or={translateExtent:ft,nodeOrigin:$i,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function _f(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:c,setDefaultNodesAndEdges:l}=J(vf,oe),a=re();z.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{u.current=or,c()}),[]);const u=z.useRef(or);return z.useEffect(()=>{for(const d of nr){const f=e[d],g=u.current[d];f!==g&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?a.setState({ariaLabelConfig:od(f)}):d==="fitView"?a.setState({fitViewQueued:f}):d==="fitViewOptions"?a.setState({fitViewOptions:f}):a.setState({[d]:f})))}u.current=e},nr.map(d=>e[d])),null}function rr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bf(e){const[t,n]=z.useState(e==="system"?null:e);return z.useEffect(()=>{if(e!=="system"){n(e);return}const o=rr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:rr()?.matches?"dark":"light"}const ir=typeof document<"u"?document:null;function mt(e=null,t={target:ir,actInsideInputWithModifier:!0}){const[n,o]=z.useState(!1),r=z.useRef(!1),i=z.useRef(new Set([])),[s,c]=z.useMemo(()=>{if(e!==null){const a=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
2
|
+
`).replace(`
|
|
3
|
+
|
|
4
|
+
`,`
|
|
5
|
+
+`).split(`
|
|
6
|
+
`)),u=a.reduce((d,f)=>d.concat(...f),[]);return[a,u]}return[[],[]]},[e]);return z.useEffect(()=>{const l=t?.target??ir,a=t?.actInsideInputWithModifier??!0;if(e!==null){const u=g=>{if(r.current=g.ctrlKey||g.metaKey||g.shiftKey||g.altKey,(!r.current||r.current&&!a)&&di(g))return!1;const x=ar(g.code,c);if(i.current.add(g[x]),sr(s,i.current,!1)){const w=g.composedPath?.()?.[0]||g.target,m=w?.nodeName==="BUTTON"||w?.nodeName==="A";t.preventDefault!==!1&&(r.current||!m)&&g.preventDefault(),o(!0)}},d=g=>{const p=ar(g.code,c);sr(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(g[p]),g.key==="Meta"&&i.current.clear(),r.current=!1},f=()=>{i.current.clear(),o(!1)};return l?.addEventListener("keydown",u),l?.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{l?.removeEventListener("keydown",u),l?.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,o]),n}function sr(e,t,n){return e.filter(o=>n||o.length===t.size).some(o=>o.every(r=>t.has(r)))}function ar(e,t){return t.includes(e)?"code":"key"}const Ef=()=>{const e=re();return z.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:c}=e.getState(),l=Un(t,o,r,i,s,n?.padding??.1);return c?(await c.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:c,y:l}=s.getBoundingClientRect(),a={x:t.x-c,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return bt(a,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=Wt(t,n);return{x:s.x+r,y:s.y+i}}}),[])};function Di(e,t){const n=[],o=new Map,r=[];for(const i of e)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{const s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(const i of t){const s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const c={...i};for(const l of s)Sf(l,c);n.push(c)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Sf(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Nf(e,t){return Di(e,t)}function Cf(e,t){return Di(e,t)}function Pe(e,t){return{id:e,type:"select",selected:t}}function Fe(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const s=t.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(Pe(i.id,s)))}return o}function cr({items:e=[],lookup:t}){const n=[],o=new Map(e.map(r=>[r.id,r]));for(const[r,i]of e.entries()){const s=t.get(i.id),c=s?.internals?.userNode??s;c!==void 0&&c!==i&&n.push({id:i.id,item:i,type:"replace"}),c===void 0&&n.push({item:i,type:"add",index:r})}for(const[r]of t)o.get(r)===void 0&&n.push({id:r,type:"remove"});return n}function lr(e){return{id:e.id,type:"remove"}}const ur=e=>Wu(e),Mf=e=>oi(e);function Ti(e){return z.forwardRef(e)}const If=typeof window<"u"?z.useLayoutEffect:z.useEffect;function dr(e){const[t,n]=z.useState(BigInt(0)),[o]=z.useState(()=>kf(()=>n(r=>r+BigInt(1))));return If(()=>{const r=o.get();r.length&&(e(r),o.reset())},[t]),o}function kf(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const zi=z.createContext(null);function Af({children:e}){const t=re(),n=z.useCallback(c=>{const{nodes:l=[],setNodes:a,hasDefaultNodes:u,onNodesChange:d,nodeLookup:f,fitViewQueued:g,onNodesChangeMiddlewareMap:p}=t.getState();let x=l;for(const m of c)x=typeof m=="function"?m(x):m;let w=cr({items:x,lookup:f});for(const m of p.values())w=m(w);u&&a(x),w.length>0?d?.(w):g&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:_,setNodes:h}=t.getState();m&&h(_)})},[]),o=dr(n),r=z.useCallback(c=>{const{edges:l=[],setEdges:a,hasDefaultEdges:u,onEdgesChange:d,edgeLookup:f}=t.getState();let g=l;for(const p of c)g=typeof p=="function"?p(g):p;u?a(g):d&&d(cr({items:g,lookup:f}))},[]),i=dr(r),s=z.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return A.jsx(zi.Provider,{value:s,children:e})}function Pf(){const e=z.useContext(zi);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const $f=e=>!!e.panZoom;function oo(){const e=Ef(),t=re(),n=Pf(),o=J($f),r=z.useMemo(()=>{const i=d=>t.getState().nodeLookup.get(d),s=d=>{n.nodeQueue.push(d)},c=d=>{n.edgeQueue.push(d)},l=d=>{const{nodeLookup:f,nodeOrigin:g}=t.getState(),p=ur(d)?d:f.get(d.id),x=p.parentId?li(p.position,p.measured,p.parentId,f,g):p.position,w={...p,position:x,width:p.measured?.width??p.width,height:p.measured?.height??p.height};return Ge(w)},a=(d,f,g={replace:!1})=>{s(p=>p.map(x=>{if(x.id===d){const w=typeof f=="function"?f(x):f;return g.replace&&ur(w)?w:{...x,...w}}return x}))},u=(d,f,g={replace:!1})=>{c(p=>p.map(x=>{if(x.id===d){const w=typeof f=="function"?f(x):f;return g.replace&&Mf(w)?w:{...x,...w}}return x}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>i(d)?.internals.userNode,getInternalNode:i,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(f=>({...f}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:s,setEdges:c,addNodes:d=>{const f=Array.isArray(d)?d:[d];n.nodeQueue.push(g=>[...g,...f])},addEdges:d=>{const f=Array.isArray(d)?d:[d];n.edgeQueue.push(g=>[...g,...f])},toObject:()=>{const{nodes:d=[],edges:f=[],transform:g}=t.getState(),[p,x,w]=g;return{nodes:d.map(m=>({...m})),edges:f.map(m=>({...m})),viewport:{x:p,y:x,zoom:w}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{const{nodes:g,edges:p,onNodesDelete:x,onEdgesDelete:w,triggerNodeChanges:m,triggerEdgeChanges:_,onDelete:h,onBeforeDelete:y}=t.getState(),{nodes:S,edges:b}=await Qu({nodesToRemove:d,edgesToRemove:f,nodes:g,edges:p,onBeforeDelete:y}),N=b.length>0,$=S.length>0;if(N){const D=b.map(lr);w?.(b),_(D)}if($){const D=S.map(lr);x?.(S),m(D)}return($||N)&&h?.({nodes:S,edges:b}),{deletedNodes:S,deletedEdges:b}},getIntersectingNodes:(d,f=!0,g)=>{const p=Ro(d),x=p?d:l(d),w=g!==void 0;return x?(g||t.getState().nodes).filter(m=>{const _=t.getState().nodeLookup.get(m.id);if(_&&!p&&(m.id===d.id||!_.internals.positionAbsolute))return!1;const h=Ge(w?m:_),y=gt(h,x);return f&&y>0||y>=h.width*h.height||y>=x.width*x.height}):[]},isNodeIntersecting:(d,f,g=!0)=>{const x=Ro(d)?d:l(d);if(!x)return!1;const w=gt(x,f);return g&&w>0||w>=f.width*f.height||w>=x.width*x.height},updateNode:a,updateNodeData:(d,f,g={replace:!1})=>{a(d,p=>{const x=typeof f=="function"?f(p):f;return g.replace?{...p,data:x}:{...p,data:{...p.data,...x}}},g)},updateEdge:u,updateEdgeData:(d,f,g={replace:!1})=>{u(d,p=>{const x=typeof f=="function"?f(p):f;return g.replace?{...p,data:x}:{...p,data:{...p.data,...x}}},g)},getNodesBounds:d=>{const{nodeLookup:f,nodeOrigin:g}=t.getState();return qu(d,{nodeLookup:f,nodeOrigin:g})},getHandleConnections:({type:d,id:f,nodeId:g})=>Array.from(t.getState().connectionLookup.get(`${g}-${d}${f?`-${f}`:""}`)?.values()??[]),getNodeConnections:({type:d,handleId:f,nodeId:g})=>Array.from(t.getState().connectionLookup.get(`${g}${d?f?`-${d}-${f}`:`-${d}`:""}`)?.values()??[]),fitView:async d=>{const f=t.getState().fitViewResolver??nd();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(g=>[...g]),f.promise}}},[]);return z.useMemo(()=>({...r,...e,viewportInitialized:o}),[o])}const fr=e=>e.selected,Df=typeof window<"u"?window:void 0;function Tf({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=re(),{deleteElements:o}=oo(),r=mt(e,{actInsideInputWithModifier:!1}),i=mt(t,{target:Df});z.useEffect(()=>{if(r){const{edges:s,nodes:c}=n.getState();o({nodes:c.filter(fr),edges:s.filter(fr)}),n.setState({nodesSelectionActive:!1})}},[r]),z.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function zf(e){const t=re();z.useEffect(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const o=Kn(e.current);(o.height===0||o.width===0)&&t.getState().onError?.("004",xe.error004()),t.setState({width:o.width||500,height:o.height||500})};if(e.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(e.current),()=>{window.removeEventListener("resize",n),o&&e.current&&o.unobserve(e.current)}}},[])}const an={position:"absolute",width:"100%",height:"100%",top:0,left:0},Rf=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Hf({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=Te.Free,zoomOnDoubleClick:s=!0,panOnDrag:c=!0,defaultViewport:l,translateExtent:a,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:g=!0,children:p,noWheelClassName:x,noPanClassName:w,onViewportChange:m,isControlledViewport:_,paneClickDistance:h,selectionOnDrag:y}){const S=re(),b=z.useRef(null),{userSelectionActive:N,lib:$,connectionInProgress:D}=J(Rf,oe),V=mt(f),k=z.useRef();zf(b);const T=z.useCallback(H=>{m?.({x:H[0],y:H[1],zoom:H[2]}),_||S.setState({transform:H})},[m,_]);return z.useEffect(()=>{if(b.current){k.current=Od({domNode:b.current,minZoom:u,maxZoom:d,translateExtent:a,viewport:l,onDraggingChange:E=>S.setState({paneDragging:E}),onPanZoomStart:(E,I)=>{const{onViewportChangeStart:M,onMoveStart:P}=S.getState();P?.(E,I),M?.(I)},onPanZoom:(E,I)=>{const{onViewportChange:M,onMove:P}=S.getState();P?.(E,I),M?.(I)},onPanZoomEnd:(E,I)=>{const{onViewportChangeEnd:M,onMoveEnd:P}=S.getState();P?.(E,I),M?.(I)}});const{x:H,y:v,zoom:C}=k.current.getViewport();return S.setState({panZoom:k.current,transform:[H,v,C],domNode:b.current.closest(".react-flow")}),()=>{k.current?.destroy()}}},[]),z.useEffect(()=>{k.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:c,zoomActivationKeyPressed:V,preventScrolling:g,noPanClassName:w,userSelectionActive:N,noWheelClassName:x,lib:$,onTransformChange:T,connectionInProgress:D,selectionOnDrag:y,paneClickDistance:h})},[e,t,n,o,r,i,s,c,V,g,w,N,x,$,T,D,y,h]),A.jsx("div",{className:"react-flow__renderer",ref:b,style:an,children:p})}const Lf=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Of(){const{userSelectionActive:e,userSelectionRect:t}=J(Lf,oe);return e&&t?A.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Sn=(e,t)=>n=>{n.target===t.current&&e?.(n)},Vf=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Bf({isSelecting:e,selectionKeyPressed:t,selectionMode:n=ht.Full,panOnDrag:o,paneClickDistance:r,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:a,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:g,children:p}){const x=re(),{userSelectionActive:w,elementsSelectable:m,dragging:_,connectionInProgress:h}=J(Vf,oe),y=m&&(e||w),S=z.useRef(null),b=z.useRef(),N=z.useRef(new Set),$=z.useRef(new Set),D=z.useRef(!1),V=M=>{if(D.current||h){D.current=!1;return}l?.(M),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},k=M=>{if(Array.isArray(o)&&o?.includes(2)){M.preventDefault();return}a?.(M)},T=u?M=>u(M):void 0,H=M=>{D.current&&(M.stopPropagation(),D.current=!1)},v=M=>{const{domNode:P}=x.getState();if(b.current=P?.getBoundingClientRect(),!b.current)return;const R=M.target===S.current;if(!R&&!!M.target.closest(".nokey")||!e||!(i&&R||t)||M.button!==0||!M.isPrimary)return;M.target?.setPointerCapture?.(M.pointerId),D.current=!1;const{x:j,y:F}=ge(M.nativeEvent,b.current);x.setState({userSelectionRect:{width:0,height:0,startX:j,startY:F,x:j,y:F}}),R||(M.stopPropagation(),M.preventDefault())},C=M=>{const{userSelectionRect:P,transform:R,nodeLookup:O,edgeLookup:L,connectionLookup:j,triggerNodeChanges:F,triggerEdgeChanges:W,defaultEdgeOptions:U,resetSelectedElements:Z}=x.getState();if(!b.current||!P)return;const{x:B,y:X}=ge(M.nativeEvent,b.current),{startX:Q,startY:K}=P;if(!D.current){const te=t?0:r;if(Math.hypot(B-Q,X-K)<=te)return;Z(),s?.(M)}D.current=!0;const q={startX:Q,startY:K,x:B<Q?B:Q,y:X<K?X:K,width:Math.abs(B-Q),height:Math.abs(X-K)},G=N.current,ee=$.current;N.current=new Set(Gn(O,q,R,n===ht.Partial,!0).map(te=>te.id)),$.current=new Set;const ne=U?.selectable??!0;for(const te of N.current){const se=j.get(te);if(se)for(const{edgeId:Ne}of se.values()){const ve=L.get(Ne);ve&&(ve.selectable??ne)&&$.current.add(Ne)}}if(!Ho(G,N.current)){const te=Fe(O,N.current,!0);F(te)}if(!Ho(ee,$.current)){const te=Fe(L,$.current);W(te)}x.setState({userSelectionRect:q,userSelectionActive:!0,nodesSelectionActive:!1})},E=M=>{M.button===0&&(M.target?.releasePointerCapture?.(M.pointerId),!w&&M.target===S.current&&x.getState().userSelectionRect&&V?.(M),x.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(c?.(M),x.setState({nodesSelectionActive:N.current.size>0})))},I=o===!0||Array.isArray(o)&&o.includes(0);return A.jsxs("div",{className:ie(["react-flow__pane",{draggable:I,dragging:_,selection:e}]),onClick:y?void 0:Sn(V,S),onContextMenu:Sn(k,S),onWheel:Sn(T,S),onPointerEnter:y?void 0:d,onPointerMove:y?C:f,onPointerUp:y?E:void 0,onPointerDownCapture:y?v:void 0,onClickCapture:y?H:void 0,onPointerLeave:g,ref:S,style:an,children:[p,A.jsx(Of,{})]})}function On({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:c,onError:l}=t.getState(),a=c.get(e);if(!a){l?.("012",xe.error012(e));return}t.setState({nodesSelectionActive:!1}),a.selected?(n||a.selected&&s)&&(i({nodes:[a],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])}function Ri({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const c=re(),[l,a]=z.useState(!1),u=z.useRef();return z.useEffect(()=>{u.current=Nd({getStoreItems:()=>c.getState(),onNodeMouseDown:d=>{On({id:d,store:c,nodeRef:e})},onDragStart:()=>{a(!0)},onDragStop:()=>{a(!1)}})},[]),z.useEffect(()=>{if(t)u.current?.destroy();else if(e.current)return u.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s}),()=>{u.current?.destroy()}},[n,o,t,i,e,r]),l}const Ff=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Hi(){const e=re();return z.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:c,updateNodePositions:l,nodeLookup:a,nodeOrigin:u}=e.getState(),d=new Map,f=Ff(s),g=r?i[0]:5,p=r?i[1]:5,x=n.direction.x*g*n.factor,w=n.direction.y*p*n.factor;for(const[,m]of a){if(!f(m))continue;let _={x:m.internals.positionAbsolute.x+x,y:m.internals.positionAbsolute.y+w};r&&(_=_t(_,i));const{position:h,positionAbsolute:y}=ri({nodeId:m.id,nextPosition:_,nodeLookup:a,nodeExtent:o,nodeOrigin:u,onError:c});m.position=h,m.internals.positionAbsolute=y,d.set(m.id,m)}l(d)},[])}const ro=z.createContext(null),jf=ro.Provider;ro.Consumer;const Li=()=>z.useContext(ro),Xf=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Yf=(e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:c,toHandle:l,isValid:a}=s,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:c?.nodeId===e&&c?.id===t&&c?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===We.Strict?c?.type!==n:e!==c?.nodeId||t!==c?.id,connectionInProcess:!!c,clickConnectionInProcess:!!r,valid:u&&a}};function Zf({type:e="source",position:t=Y.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:c,children:l,className:a,onMouseDown:u,onTouchStart:d,...f},g){const p=s||null,x=e==="target",w=re(),m=Li(),{connectOnClick:_,noPanClassName:h,rfId:y}=J(Xf,oe),{connectingFrom:S,connectingTo:b,clickConnecting:N,isPossibleEndHandle:$,connectionInProcess:D,clickConnectionInProcess:V,valid:k}=J(Yf(m,p,e),oe);m||w.getState().onError?.("010",xe.error010());const T=C=>{const{defaultEdgeOptions:E,onConnect:I,hasDefaultEdges:M}=w.getState(),P={...E,...C};if(M){const{edges:R,setEdges:O}=w.getState();O(ld(P,R))}I?.(P),c?.(P)},H=C=>{if(!m)return;const E=fi(C.nativeEvent);if(r&&(E&&C.button===0||!E)){const I=w.getState();Ln.onPointerDown(C.nativeEvent,{handleDomNode:C.currentTarget,autoPanOnConnect:I.autoPanOnConnect,connectionMode:I.connectionMode,connectionRadius:I.connectionRadius,domNode:I.domNode,nodeLookup:I.nodeLookup,lib:I.lib,isTarget:x,handleId:p,nodeId:m,flowId:I.rfId,panBy:I.panBy,cancelConnection:I.cancelConnection,onConnectStart:I.onConnectStart,onConnectEnd:I.onConnectEnd,updateConnection:I.updateConnection,onConnect:T,isValidConnection:n||I.isValidConnection,getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:I.autoPanSpeed,dragThreshold:I.connectionDragThreshold})}E?u?.(C):d?.(C)},v=C=>{const{onClickConnectStart:E,onClickConnectEnd:I,connectionClickStartHandle:M,connectionMode:P,isValidConnection:R,lib:O,rfId:L,nodeLookup:j,connection:F}=w.getState();if(!m||!M&&!r)return;if(!M){E?.(C.nativeEvent,{nodeId:m,handleId:p,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:m,type:e,id:p}});return}const W=ui(C.target),U=n||R,{connection:Z,isValid:B}=Ln.isValid(C.nativeEvent,{handle:{nodeId:m,id:p,type:e},connectionMode:P,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:U,flowId:L,doc:W,lib:O,nodeLookup:j});B&&Z&&T(Z);const X=structuredClone(F);delete X.inProgress,X.toPosition=X.toHandle?X.toHandle.position:null,I?.(C,X),w.setState({connectionClickStartHandle:null})};return A.jsx("div",{"data-handleid":p,"data-nodeid":m,"data-handlepos":t,"data-id":`${y}-${m}-${p}-${e}`,className:ie(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",h,a,{source:!x,target:x,connectable:o,connectablestart:r,connectableend:i,clickconnecting:N,connectingfrom:S,connectingto:b,valid:k,connectionindicator:o&&(!D||$)&&(D||V?i:r)}]),onMouseDown:H,onTouchStart:H,onClick:_?v:void 0,ref:g,...f,children:l})}const qt=z.memo(Ti(Zf));function Wf({data:e,isConnectable:t,sourcePosition:n=Y.Bottom}){return A.jsxs(A.Fragment,{children:[e?.label,A.jsx(qt,{type:"source",position:n,isConnectable:t})]})}function qf({data:e,isConnectable:t,targetPosition:n=Y.Top,sourcePosition:o=Y.Bottom}){return A.jsxs(A.Fragment,{children:[A.jsx(qt,{type:"target",position:n,isConnectable:t}),e?.label,A.jsx(qt,{type:"source",position:o,isConnectable:t})]})}function Gf(){return null}function Uf({data:e,isConnectable:t,targetPosition:n=Y.Top}){return A.jsxs(A.Fragment,{children:[A.jsx(qt,{type:"target",position:n,isConnectable:t}),e?.label]})}const Gt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},hr={input:Wf,default:qf,output:Uf,group:Gf};function Kf(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const Qf=e=>{const{width:t,height:n,x:o,y:r}=vt(e.nodeLookup,{filter:i=>!!i.selected});return{width:he(t)?t:null,height:he(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Jf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=re(),{width:r,height:i,transformString:s,userSelectionActive:c}=J(Qf,oe),l=Hi(),a=z.useRef(null);if(z.useEffect(()=>{n||a.current?.focus({preventScroll:!0})},[n]),Ri({nodeRef:a}),c||!r||!i)return null;const u=e?f=>{const g=o.getState().nodes.filter(p=>p.selected);e(f,g)}:void 0,d=f=>{Object.prototype.hasOwnProperty.call(Gt,f.key)&&(f.preventDefault(),l({direction:Gt[f.key],factor:f.shiftKey?4:1}))};return A.jsx("div",{className:ie(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:A.jsx("div",{ref:a,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:r,height:i}})})}const gr=typeof window<"u"?window:void 0,eh=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Oi({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:c,deleteKeyCode:l,selectionKeyCode:a,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:p,panActivationKeyCode:x,zoomActivationKeyCode:w,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:h,panOnScroll:y,panOnScrollSpeed:S,panOnScrollMode:b,zoomOnDoubleClick:N,panOnDrag:$,defaultViewport:D,translateExtent:V,minZoom:k,maxZoom:T,preventScrolling:H,onSelectionContextMenu:v,noWheelClassName:C,noPanClassName:E,disableKeyboardA11y:I,onViewportChange:M,isControlledViewport:P}){const{nodesSelectionActive:R,userSelectionActive:O}=J(eh,oe),L=mt(a,{target:gr}),j=mt(x,{target:gr}),F=j||$,W=j||y,U=u&&F!==!0,Z=L||O||U;return Tf({deleteKeyCode:l,multiSelectionKeyCode:p}),A.jsx(Hf,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:h,panOnScroll:W,panOnScrollSpeed:S,panOnScrollMode:b,zoomOnDoubleClick:N,panOnDrag:!L&&F,defaultViewport:D,translateExtent:V,minZoom:k,maxZoom:T,zoomActivationKeyCode:w,preventScrolling:H,noWheelClassName:C,noPanClassName:E,onViewportChange:M,isControlledViewport:P,paneClickDistance:c,selectionOnDrag:U,children:A.jsxs(Bf,{onSelectionStart:f,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:F,isSelecting:!!Z,selectionMode:d,selectionKeyPressed:L,paneClickDistance:c,selectionOnDrag:U,children:[e,R&&A.jsx(Jf,{onSelectionContextMenu:v,noPanClassName:E,disableKeyboardA11y:I})]})})}Oi.displayName="FlowRenderer";const th=z.memo(Oi),nh=e=>t=>e?Gn(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function oh(e){return J(z.useCallback(nh(e),[e]),oe)}const rh=e=>e.updateNodeInternals;function ih(){const e=J(rh),[t]=z.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),e(o)}));return z.useEffect(()=>()=>{t?.disconnect()},[t]),t}function sh({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=re(),i=z.useRef(null),s=z.useRef(null),c=z.useRef(e.sourcePosition),l=z.useRef(e.targetPosition),a=z.useRef(t),u=n&&!!e.internals.handleBounds;return z.useEffect(()=>{i.current&&!e.hidden&&(!u||s.current!==i.current)&&(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[u,e.hidden]),z.useEffect(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),z.useEffect(()=>{if(i.current){const d=a.current!==t,f=c.current!==e.sourcePosition,g=l.current!==e.targetPosition;(d||f||g)&&(a.current=t,c.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function ah({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:c,elementsSelectable:l,nodesConnectable:a,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:g,disableKeyboardA11y:p,rfId:x,nodeTypes:w,nodeClickDistance:m,onError:_}){const{node:h,internals:y,isParent:S}=J(B=>{const X=B.nodeLookup.get(e),Q=B.parentLookup.has(e);return{node:X,internals:X.internals,isParent:Q}},oe);let b=h.type||"default",N=w?.[b]||hr[b];N===void 0&&(_?.("003",xe.error003(b)),b="default",N=w?.default||hr.default);const $=!!(h.draggable||c&&typeof h.draggable>"u"),D=!!(h.selectable||l&&typeof h.selectable>"u"),V=!!(h.connectable||a&&typeof h.connectable>"u"),k=!!(h.focusable||u&&typeof h.focusable>"u"),T=re(),H=ci(h),v=sh({node:h,nodeType:b,hasDimensions:H,resizeObserver:d}),C=Ri({nodeRef:v,disabled:h.hidden||!$,noDragClassName:f,handleSelector:h.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:m}),E=Hi();if(h.hidden)return null;const I=Se(h),M=Kf(h),P=D||$||t||n||o||r,R=n?B=>n(B,{...y.userNode}):void 0,O=o?B=>o(B,{...y.userNode}):void 0,L=r?B=>r(B,{...y.userNode}):void 0,j=i?B=>i(B,{...y.userNode}):void 0,F=s?B=>s(B,{...y.userNode}):void 0,W=B=>{const{selectNodesOnDrag:X,nodeDragThreshold:Q}=T.getState();D&&(!X||!$||Q>0)&&On({id:e,store:T,nodeRef:v}),t&&t(B,{...y.userNode})},U=B=>{if(!(di(B.nativeEvent)||p)){if(Jr.includes(B.key)&&D){const X=B.key==="Escape";On({id:e,store:T,unselect:X,nodeRef:v})}else if($&&h.selected&&Object.prototype.hasOwnProperty.call(Gt,B.key)){B.preventDefault();const{ariaLabelConfig:X}=T.getState();T.setState({ariaLiveMessage:X["node.a11yDescription.ariaLiveMessage"]({direction:B.key.replace("Arrow","").toLowerCase(),x:~~y.positionAbsolute.x,y:~~y.positionAbsolute.y})}),E({direction:Gt[B.key],factor:B.shiftKey?4:1})}}},Z=()=>{if(p||!v.current?.matches(":focus-visible"))return;const{transform:B,width:X,height:Q,autoPanOnNodeFocus:K,setCenter:q}=T.getState();if(!K)return;Gn(new Map([[e,h]]),{x:0,y:0,width:X,height:Q},B,!0).length>0||q(h.position.x+I.width/2,h.position.y+I.height/2,{zoom:B[2]})};return A.jsx("div",{className:ie(["react-flow__node",`react-flow__node-${b}`,{[g]:$},h.className,{selected:h.selected,selectable:D,parent:S,draggable:$,dragging:C}]),ref:v,style:{zIndex:y.z,transform:`translate(${y.positionAbsolute.x}px,${y.positionAbsolute.y}px)`,pointerEvents:P?"all":"none",visibility:H?"visible":"hidden",...h.style,...M},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:R,onMouseMove:O,onMouseLeave:L,onContextMenu:j,onClick:W,onDoubleClick:F,onKeyDown:k?U:void 0,tabIndex:k?0:void 0,onFocus:k?Z:void 0,role:h.ariaRole??(k?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${Ai}-${x}`,"aria-label":h.ariaLabel,...h.domAttributes,children:A.jsx(jf,{value:e,children:A.jsx(N,{id:e,data:h.data,type:b,positionAbsoluteX:y.positionAbsolute.x,positionAbsoluteY:y.positionAbsolute.y,selected:h.selected??!1,selectable:D,draggable:$,deletable:h.deletable??!0,isConnectable:V,sourcePosition:h.sourcePosition,targetPosition:h.targetPosition,dragging:C,dragHandle:h.dragHandle,zIndex:y.z,parentId:h.parentId,...I})})})}var ch=z.memo(ah);const lh=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Vi(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:i}=J(lh,oe),s=oh(e.onlyRenderVisibleElements),c=ih();return A.jsx("div",{className:"react-flow__nodes",style:an,children:s.map(l=>A.jsx(ch,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:c,nodesDraggable:t,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},l))})}Vi.displayName="NodeRenderer";const uh=z.memo(Vi);function dh(e){return J(z.useCallback(n=>{if(!e)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&sd({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[e]),oe)}const fh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return A.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},hh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return A.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},pr={[Yt.Arrow]:fh,[Yt.ArrowClosed]:hh};function gh(e){const t=re();return z.useMemo(()=>Object.prototype.hasOwnProperty.call(pr,e)?pr[e]:(t.getState().onError?.("009",xe.error009(e)),null),[e])}const ph=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:c="auto-start-reverse"})=>{const l=gh(t);return l?A.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:c,refX:"0",refY:"0",children:A.jsx(l,{color:n,strokeWidth:s})}):null},Bi=({defaultColor:e,rfId:t})=>{const n=J(i=>i.edges),o=J(i=>i.defaultEdgeOptions),r=z.useMemo(()=>gd(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,t,e]);return r.length?A.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:A.jsx("defs",{children:r.map(i=>A.jsx(ph,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};Bi.displayName="MarkerDefinitions";var mh=z.memo(Bi);function Fi({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:c=2,children:l,className:a,...u}){const[d,f]=z.useState({x:1,y:0,width:0,height:0}),g=ie(["react-flow__edge-textwrapper",a]),p=z.useRef(null);return z.useEffect(()=>{if(p.current){const x=p.current.getBBox();f({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?A.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:g,visibility:d.width?"visible":"hidden",...u,children:[r&&A.jsx("rect",{width:d.width+2*s[0],x:-s[0],y:-s[1],height:d.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:c,ry:c}),A.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:p,style:o,children:n}),l]}):null}Fi.displayName="EdgeText";const yh=z.memo(Fi);function cn({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,interactionWidth:a=20,...u}){return A.jsxs(A.Fragment,{children:[A.jsx("path",{...u,d:e,fill:"none",className:ie(["react-flow__edge-path",u.className])}),a?A.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:a,className:"react-flow__edge-interaction"}):null,o&&he(t)&&he(n)?A.jsx(yh,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l}):null]})}function mr({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===Y.Left||e===Y.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function ji({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top}){const[s,c]=mr({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,a]=mr({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,f,g]=hi({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:a});return[`M${e},${t} C${s},${c} ${l},${a} ${o},${r}`,u,d,f,g]}function Xi(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:c,label:l,labelStyle:a,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:x,markerStart:w,interactionWidth:m})=>{const[_,h,y]=ji({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:c}),S=e.isInternal?void 0:t;return A.jsx(cn,{id:S,path:_,labelX:h,labelY:y,label:l,labelStyle:a,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:x,markerStart:w,interactionWidth:m})})}const xh=Xi({isInternal:!1}),Yi=Xi({isInternal:!0});xh.displayName="SimpleBezierEdge";Yi.displayName="SimpleBezierEdgeInternal";function Zi(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:c,labelShowBg:l,labelBgStyle:a,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:g=Y.Bottom,targetPosition:p=Y.Top,markerEnd:x,markerStart:w,pathOptions:m,interactionWidth:_})=>{const[h,y,S]=zn({sourceX:n,sourceY:o,sourcePosition:g,targetX:r,targetY:i,targetPosition:p,borderRadius:m?.borderRadius,offset:m?.offset,stepPosition:m?.stepPosition}),b=e.isInternal?void 0:t;return A.jsx(cn,{id:b,path:h,labelX:y,labelY:S,label:s,labelStyle:c,labelShowBg:l,labelBgStyle:a,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:x,markerStart:w,interactionWidth:_})})}const Wi=Zi({isInternal:!1}),qi=Zi({isInternal:!0});Wi.displayName="SmoothStepEdge";qi.displayName="SmoothStepEdgeInternal";function Gi(e){return z.memo(({id:t,...n})=>{const o=e.isInternal?void 0:t;return A.jsx(Wi,{...n,id:o,pathOptions:z.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const wh=Gi({isInternal:!1}),Ui=Gi({isInternal:!0});wh.displayName="StepEdge";Ui.displayName="StepEdgeInternal";function Ki(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:c,labelShowBg:l,labelBgStyle:a,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:g,markerStart:p,interactionWidth:x})=>{const[w,m,_]=mi({sourceX:n,sourceY:o,targetX:r,targetY:i}),h=e.isInternal?void 0:t;return A.jsx(cn,{id:h,path:w,labelX:m,labelY:_,label:s,labelStyle:c,labelShowBg:l,labelBgStyle:a,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:g,markerStart:p,interactionWidth:x})})}const vh=Ki({isInternal:!1}),Qi=Ki({isInternal:!0});vh.displayName="StraightEdge";Qi.displayName="StraightEdgeInternal";function Ji(e){return z.memo(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=Y.Bottom,targetPosition:c=Y.Top,label:l,labelStyle:a,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:x,markerStart:w,pathOptions:m,interactionWidth:_})=>{const[h,y,S]=gi({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:c,curvature:m?.curvature}),b=e.isInternal?void 0:t;return A.jsx(cn,{id:b,path:h,labelX:y,labelY:S,label:l,labelStyle:a,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:g,style:p,markerEnd:x,markerStart:w,interactionWidth:_})})}const _h=Ji({isInternal:!1}),es=Ji({isInternal:!0});_h.displayName="BezierEdge";es.displayName="BezierEdgeInternal";const yr={default:es,straight:Qi,step:Ui,smoothstep:qi,simplebezier:Yi},xr={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},bh=(e,t,n)=>n===Y.Left?e-t:n===Y.Right?e+t:e,Eh=(e,t,n)=>n===Y.Top?e-t:n===Y.Bottom?e+t:e,wr="react-flow__edgeupdater";function vr({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:c}){return A.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:ie([wr,`${wr}-${c}`]),cx:bh(t,o,e),cy:Eh(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Sh({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:c,targetPosition:l,onReconnect:a,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:g}){const p=re(),x=(y,S)=>{if(y.button!==0)return;const{autoPanOnConnect:b,domNode:N,isValidConnection:$,connectionMode:D,connectionRadius:V,lib:k,onConnectStart:T,onConnectEnd:H,cancelConnection:v,nodeLookup:C,rfId:E,panBy:I,updateConnection:M}=p.getState(),P=S.type==="target",R=(j,F)=>{f(!1),d?.(j,n,S.type,F)},O=j=>a?.(n,j),L=(j,F)=>{f(!0),u?.(y,n,S.type),T?.(j,F)};Ln.onPointerDown(y.nativeEvent,{autoPanOnConnect:b,connectionMode:D,connectionRadius:V,domNode:N,handleId:S.id,nodeId:S.nodeId,nodeLookup:C,isTarget:P,edgeUpdaterType:S.type,lib:k,flowId:E,cancelConnection:v,panBy:I,isValidConnection:$,onConnect:O,onConnectStart:L,onConnectEnd:H,onReconnectEnd:R,updateConnection:M,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:y.currentTarget})},w=y=>x(y,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=y=>x(y,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),_=()=>g(!0),h=()=>g(!1);return A.jsxs(A.Fragment,{children:[(e===!0||e==="source")&&A.jsx(vr,{position:c,centerX:o,centerY:r,radius:t,onMouseDown:w,onMouseEnter:_,onMouseOut:h,type:"source"}),(e===!0||e==="target")&&A.jsx(vr,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:m,onMouseEnter:_,onMouseOut:h,type:"target"})]})}function Nh({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:c,onMouseMove:l,onMouseLeave:a,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:g,rfId:p,edgeTypes:x,noPanClassName:w,onError:m,disableKeyboardA11y:_}){let h=J(q=>q.edgeLookup.get(e));const y=J(q=>q.defaultEdgeOptions);h=y?{...y,...h}:h;let S=h.type||"default",b=x?.[S]||yr[S];b===void 0&&(m?.("011",xe.error011(S)),S="default",b=x?.default||yr.default);const N=!!(h.focusable||t&&typeof h.focusable>"u"),$=typeof d<"u"&&(h.reconnectable||n&&typeof h.reconnectable>"u"),D=!!(h.selectable||o&&typeof h.selectable>"u"),V=z.useRef(null),[k,T]=z.useState(!1),[H,v]=z.useState(!1),C=re(),{zIndex:E,sourceX:I,sourceY:M,targetX:P,targetY:R,sourcePosition:O,targetPosition:L}=J(z.useCallback(q=>{const G=q.nodeLookup.get(h.source),ee=q.nodeLookup.get(h.target);if(!G||!ee)return{zIndex:h.zIndex,...xr};const ne=hd({id:e,sourceNode:G,targetNode:ee,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:q.connectionMode,onError:m});return{zIndex:id({selected:h.selected,zIndex:h.zIndex,sourceNode:G,targetNode:ee,elevateOnSelect:q.elevateEdgesOnSelect,zIndexMode:q.zIndexMode}),...ne||xr}},[h.source,h.target,h.sourceHandle,h.targetHandle,h.selected,h.zIndex]),oe),j=z.useMemo(()=>h.markerStart?`url('#${Rn(h.markerStart,p)}')`:void 0,[h.markerStart,p]),F=z.useMemo(()=>h.markerEnd?`url('#${Rn(h.markerEnd,p)}')`:void 0,[h.markerEnd,p]);if(h.hidden||I===null||M===null||P===null||R===null)return null;const W=q=>{const{addSelectedEdges:G,unselectNodesAndEdges:ee,multiSelectionActive:ne}=C.getState();D&&(C.setState({nodesSelectionActive:!1}),h.selected&&ne?(ee({nodes:[],edges:[h]}),V.current?.blur()):G([e])),r&&r(q,h)},U=i?q=>{i(q,{...h})}:void 0,Z=s?q=>{s(q,{...h})}:void 0,B=c?q=>{c(q,{...h})}:void 0,X=l?q=>{l(q,{...h})}:void 0,Q=a?q=>{a(q,{...h})}:void 0,K=q=>{if(!_&&Jr.includes(q.key)&&D){const{unselectNodesAndEdges:G,addSelectedEdges:ee}=C.getState();q.key==="Escape"?(V.current?.blur(),G({edges:[h]})):ee([e])}};return A.jsx("svg",{style:{zIndex:E},children:A.jsxs("g",{className:ie(["react-flow__edge",`react-flow__edge-${S}`,h.className,w,{selected:h.selected,animated:h.animated,inactive:!D&&!r,updating:k,selectable:D}]),onClick:W,onDoubleClick:U,onContextMenu:Z,onMouseEnter:B,onMouseMove:X,onMouseLeave:Q,onKeyDown:N?K:void 0,tabIndex:N?0:void 0,role:h.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":h.ariaLabel===null?void 0:h.ariaLabel||`Edge from ${h.source} to ${h.target}`,"aria-describedby":N?`${Pi}-${p}`:void 0,ref:V,...h.domAttributes,children:[!H&&A.jsx(b,{id:e,source:h.source,target:h.target,type:h.type,selected:h.selected,animated:h.animated,selectable:D,deletable:h.deletable??!0,label:h.label,labelStyle:h.labelStyle,labelShowBg:h.labelShowBg,labelBgStyle:h.labelBgStyle,labelBgPadding:h.labelBgPadding,labelBgBorderRadius:h.labelBgBorderRadius,sourceX:I,sourceY:M,targetX:P,targetY:R,sourcePosition:O,targetPosition:L,data:h.data,style:h.style,sourceHandleId:h.sourceHandle,targetHandleId:h.targetHandle,markerStart:j,markerEnd:F,pathOptions:"pathOptions"in h?h.pathOptions:void 0,interactionWidth:h.interactionWidth}),$&&A.jsx(Sh,{edge:h,isReconnectable:$,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:g,sourceX:I,sourceY:M,targetX:P,targetY:R,sourcePosition:O,targetPosition:L,setUpdateHover:T,setReconnecting:v})]})})}var Ch=z.memo(Nh);const Mh=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ts({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:c,onEdgeMouseMove:l,onEdgeMouseLeave:a,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:g,onReconnectEnd:p,disableKeyboardA11y:x}){const{edgesFocusable:w,edgesReconnectable:m,elementsSelectable:_,onError:h}=J(Mh,oe),y=dh(t);return A.jsxs("div",{className:"react-flow__edges",children:[A.jsx(mh,{defaultColor:e,rfId:n}),y.map(S=>A.jsx(Ch,{id:S,edgesFocusable:w,edgesReconnectable:m,elementsSelectable:_,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:c,onMouseMove:l,onMouseLeave:a,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:g,onReconnectEnd:p,rfId:n,onError:h,edgeTypes:o,disableKeyboardA11y:x},S))]})}ts.displayName="EdgeRenderer";const Ih=z.memo(ts),kh=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ah({children:e}){const t=J(kh);return A.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Ph(e){const t=oo(),n=z.useRef(!1);z.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const $h=e=>e.panZoom?.syncViewport;function Dh(e){const t=J($h),n=re();return z.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Th(e){return e.connection.inProgress?{...e.connection,to:bt(e.connection.to,e.transform)}:{...e.connection}}function zh(e){return Th}function Rh(e){const t=zh();return J(t,oe)}const Hh=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Lh({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:c,inProgress:l}=J(Hh,oe);return!(i&&r&&l)?null:A.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:A.jsx("g",{className:ie(["react-flow__connection",ni(c)]),children:A.jsx(ns,{style:t,type:n,CustomComponent:o,isValid:c})})})}const ns=({style:e,type:t=Ie.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:c,fromPosition:l,to:a,toNode:u,toHandle:d,toPosition:f,pointer:g}=Rh();if(!r)return;if(n)return A.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:c,fromX:i.x,fromY:i.y,toX:a.x,toY:a.y,fromPosition:l,toPosition:f,connectionStatus:ni(o),toNode:u,toHandle:d,pointer:g});let p="";const x={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:a.x,targetY:a.y,targetPosition:f};switch(t){case Ie.Bezier:[p]=gi(x);break;case Ie.SimpleBezier:[p]=ji(x);break;case Ie.Step:[p]=zn({...x,borderRadius:0});break;case Ie.SmoothStep:[p]=zn(x);break;default:[p]=mi(x)}return A.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:e})};ns.displayName="ConnectionLine";const Oh={};function _r(e=Oh){z.useRef(e),re(),z.useEffect(()=>{},[e])}function Vh(){re(),z.useRef(!1),z.useEffect(()=>{},[])}function os({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:l,onNodeMouseLeave:a,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:g,connectionLineType:p,connectionLineStyle:x,connectionLineComponent:w,connectionLineContainerStyle:m,selectionKeyCode:_,selectionOnDrag:h,selectionMode:y,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:N,deleteKeyCode:$,onlyRenderVisibleElements:D,elementsSelectable:V,defaultViewport:k,translateExtent:T,minZoom:H,maxZoom:v,preventScrolling:C,defaultMarkerColor:E,zoomOnScroll:I,zoomOnPinch:M,panOnScroll:P,panOnScrollSpeed:R,panOnScrollMode:O,zoomOnDoubleClick:L,panOnDrag:j,onPaneClick:F,onPaneMouseEnter:W,onPaneMouseMove:U,onPaneMouseLeave:Z,onPaneScroll:B,onPaneContextMenu:X,paneClickDistance:Q,nodeClickDistance:K,onEdgeContextMenu:q,onEdgeMouseEnter:G,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,onReconnect:se,onReconnectStart:Ne,onReconnectEnd:ve,noDragClassName:Ae,noWheelClassName:Qe,noPanClassName:Je,disableKeyboardA11y:et,nodeExtent:ln,rfId:Et,viewport:Oe,onViewportChange:tt}){return _r(e),_r(t),Vh(),Ph(n),Dh(Oe),A.jsx(th,{onPaneClick:F,onPaneMouseEnter:W,onPaneMouseMove:U,onPaneMouseLeave:Z,onPaneContextMenu:X,onPaneScroll:B,paneClickDistance:Q,deleteKeyCode:$,selectionKeyCode:_,selectionOnDrag:h,selectionMode:y,onSelectionStart:f,onSelectionEnd:g,multiSelectionKeyCode:S,panActivationKeyCode:b,zoomActivationKeyCode:N,elementsSelectable:V,zoomOnScroll:I,zoomOnPinch:M,zoomOnDoubleClick:L,panOnScroll:P,panOnScrollSpeed:R,panOnScrollMode:O,panOnDrag:j,defaultViewport:k,translateExtent:T,minZoom:H,maxZoom:v,onSelectionContextMenu:d,preventScrolling:C,noDragClassName:Ae,noWheelClassName:Qe,noPanClassName:Je,disableKeyboardA11y:et,onViewportChange:tt,isControlledViewport:!!Oe,children:A.jsxs(Ah,{children:[A.jsx(Ih,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:se,onReconnectStart:Ne,onReconnectEnd:ve,onlyRenderVisibleElements:D,onEdgeContextMenu:q,onEdgeMouseEnter:G,onEdgeMouseMove:ee,onEdgeMouseLeave:ne,reconnectRadius:te,defaultMarkerColor:E,noPanClassName:Je,disableKeyboardA11y:et,rfId:Et}),A.jsx(Lh,{style:x,type:p,component:w,containerStyle:m}),A.jsx("div",{className:"react-flow__edgelabel-renderer"}),A.jsx(uh,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:c,onNodeMouseMove:l,onNodeMouseLeave:a,onNodeContextMenu:u,nodeClickDistance:K,onlyRenderVisibleElements:D,noPanClassName:Je,noDragClassName:Ae,disableKeyboardA11y:et,nodeExtent:ln,rfId:Et}),A.jsx("div",{className:"react-flow__viewport-portal"})]})})}os.displayName="GraphView";const Bh=z.memo(os),br=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:c,minZoom:l=.5,maxZoom:a=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f="basic"}={})=>{const g=new Map,p=new Map,x=new Map,w=new Map,m=o??t??[],_=n??e??[],h=u??[0,0],y=d??ft;wi(x,w,m);const S=Hn(_,g,p,{nodeOrigin:h,nodeExtent:y,zIndexMode:f});let b=[0,0,1];if(s&&r&&i){const N=vt(g,{filter:k=>!!((k.width||k.initialWidth)&&(k.height||k.initialHeight))}),{x:$,y:D,zoom:V}=Un(N,r,i,l,a,c?.padding??.1);b=[$,D,V]}return{rfId:"1",width:r??0,height:i??0,transform:b,nodes:_,nodesInitialized:S,nodeLookup:g,parentLookup:p,edges:m,edgeLookup:w,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:l,maxZoom:a,translateExtent:ft,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:We.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:h,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:c,fitViewResolver:null,connection:{...ti},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Ju,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:ei,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Fh=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:a,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>of((g,p)=>{async function x(){const{nodeLookup:w,panZoom:m,fitViewOptions:_,fitViewResolver:h,width:y,height:S,minZoom:b,maxZoom:N}=p();m&&(await Ku({nodes:w,width:y,height:S,panZoom:m,minZoom:b,maxZoom:N},_),h?.resolve(!0),g({fitViewResolver:null}))}return{...br({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:a,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:w=>{const{nodeLookup:m,parentLookup:_,nodeOrigin:h,elevateNodesOnSelect:y,fitViewQueued:S,zIndexMode:b}=p(),N=Hn(w,m,_,{nodeOrigin:h,nodeExtent:d,elevateNodesOnSelect:y,checkEquality:!0,zIndexMode:b});S&&N?(x(),g({nodes:w,nodesInitialized:N,fitViewQueued:!1,fitViewOptions:void 0})):g({nodes:w,nodesInitialized:N})},setEdges:w=>{const{connectionLookup:m,edgeLookup:_}=p();wi(m,_,w),g({edges:w})},setDefaultNodesAndEdges:(w,m)=>{if(w){const{setNodes:_}=p();_(w),g({hasDefaultNodes:!0})}if(m){const{setEdges:_}=p();_(m),g({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:m,nodeLookup:_,parentLookup:h,domNode:y,nodeOrigin:S,nodeExtent:b,debug:N,fitViewQueued:$,zIndexMode:D}=p(),{changes:V,updatedInternals:k}=_d(w,_,h,y,S,b,D);k&&(yd(_,h,{nodeOrigin:S,nodeExtent:b,zIndexMode:D}),$?(x(),g({fitViewQueued:!1,fitViewOptions:void 0})):g({}),V?.length>0&&(N&&console.log("React Flow: trigger node changes",V),m?.(V)))},updateNodePositions:(w,m=!1)=>{const _=[];let h=[];const{nodeLookup:y,triggerNodeChanges:S,connection:b,updateConnection:N,onNodesChangeMiddlewareMap:$}=p();for(const[D,V]of w){const k=y.get(D),T=!!(k?.expandParent&&k?.parentId&&V?.position),H={id:D,type:"position",position:T?{x:Math.max(0,V.position.x),y:Math.max(0,V.position.y)}:V.position,dragging:m};if(k&&b.inProgress&&b.fromNode.id===k.id){const v=Le(k,b.fromHandle,Y.Left,!0);N({...b,from:v})}T&&k.parentId&&_.push({id:D,parentId:k.parentId,rect:{...V.internals.positionAbsolute,width:V.measured.width??0,height:V.measured.height??0}}),h.push(H)}if(_.length>0){const{parentLookup:D,nodeOrigin:V}=p(),k=no(_,y,D,V);h.push(...k)}for(const D of $.values())h=D(h);S(h)},triggerNodeChanges:w=>{const{onNodesChange:m,setNodes:_,nodes:h,hasDefaultNodes:y,debug:S}=p();if(w?.length){if(y){const b=Nf(w,h);_(b)}S&&console.log("React Flow: trigger node changes",w),m?.(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:m,setEdges:_,edges:h,hasDefaultEdges:y,debug:S}=p();if(w?.length){if(y){const b=Cf(w,h);_(b)}S&&console.log("React Flow: trigger edge changes",w),m?.(w)}},addSelectedNodes:w=>{const{multiSelectionActive:m,edgeLookup:_,nodeLookup:h,triggerNodeChanges:y,triggerEdgeChanges:S}=p();if(m){const b=w.map(N=>Pe(N,!0));y(b);return}y(Fe(h,new Set([...w]),!0)),S(Fe(_))},addSelectedEdges:w=>{const{multiSelectionActive:m,edgeLookup:_,nodeLookup:h,triggerNodeChanges:y,triggerEdgeChanges:S}=p();if(m){const b=w.map(N=>Pe(N,!0));S(b);return}S(Fe(_,new Set([...w]))),y(Fe(h,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:m}={})=>{const{edges:_,nodes:h,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:b}=p(),N=w||h,$=m||_,D=N.map(k=>{const T=y.get(k.id);return T&&(T.selected=!1),Pe(k.id,!1)}),V=$.map(k=>Pe(k.id,!1));S(D),b(V)},setMinZoom:w=>{const{panZoom:m,maxZoom:_}=p();m?.setScaleExtent([w,_]),g({minZoom:w})},setMaxZoom:w=>{const{panZoom:m,minZoom:_}=p();m?.setScaleExtent([_,w]),g({maxZoom:w})},setTranslateExtent:w=>{p().panZoom?.setTranslateExtent(w),g({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:m,triggerNodeChanges:_,triggerEdgeChanges:h,elementsSelectable:y}=p();if(!y)return;const S=m.reduce((N,$)=>$.selected?[...N,Pe($.id,!1)]:N,[]),b=w.reduce((N,$)=>$.selected?[...N,Pe($.id,!1)]:N,[]);_(S),h(b)},setNodeExtent:w=>{const{nodes:m,nodeLookup:_,parentLookup:h,nodeOrigin:y,elevateNodesOnSelect:S,nodeExtent:b,zIndexMode:N}=p();w[0][0]===b[0][0]&&w[0][1]===b[0][1]&&w[1][0]===b[1][0]&&w[1][1]===b[1][1]||(Hn(m,_,h,{nodeOrigin:y,nodeExtent:w,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:N}),g({nodeExtent:w}))},panBy:w=>{const{transform:m,width:_,height:h,panZoom:y,translateExtent:S}=p();return bd({delta:w,panZoom:y,transform:m,translateExtent:S,width:_,height:h})},setCenter:async(w,m,_)=>{const{width:h,height:y,maxZoom:S,panZoom:b}=p();if(!b)return Promise.resolve(!1);const N=typeof _?.zoom<"u"?_.zoom:S;return await b.setViewport({x:h/2-w*N,y:y/2-m*N,zoom:N},{duration:_?.duration,ease:_?.ease,interpolate:_?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{g({connection:{...ti}})},updateConnection:w=>{g({connection:w})},reset:()=>g({...br()})}},Object.is);function jh({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:c,initialFitViewOptions:l,fitView:a,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:g}){const[p]=z.useState(()=>Fh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,minZoom:s,maxZoom:c,fitViewOptions:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return A.jsx(rf,{value:p,children:A.jsx(Af,{children:g})})}function Xh({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:c,fitViewOptions:l,minZoom:a,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:g}){return z.useContext(rn)?A.jsx(A.Fragment,{children:e}):A.jsx(jh,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:c,initialFitViewOptions:l,initialMinZoom:a,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:g,children:e})}const Yh={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Zh({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:c,onEdgeClick:l,onInit:a,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:g,onConnectStart:p,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:m,onNodeMouseEnter:_,onNodeMouseMove:h,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:b,onNodeDragStart:N,onNodeDrag:$,onNodeDragStop:D,onNodesDelete:V,onEdgesDelete:k,onDelete:T,onSelectionChange:H,onSelectionDragStart:v,onSelectionDrag:C,onSelectionDragStop:E,onSelectionContextMenu:I,onSelectionStart:M,onSelectionEnd:P,onBeforeDelete:R,connectionMode:O,connectionLineType:L=Ie.Bezier,connectionLineStyle:j,connectionLineComponent:F,connectionLineContainerStyle:W,deleteKeyCode:U="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:B=!1,selectionMode:X=ht.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:K=pt()?"Meta":"Control",zoomActivationKeyCode:q=pt()?"Meta":"Control",snapToGrid:G,snapGrid:ee,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:te,nodesDraggable:se,autoPanOnNodeFocus:Ne,nodesConnectable:ve,nodesFocusable:Ae,nodeOrigin:Qe=$i,edgesFocusable:Je,edgesReconnectable:et,elementsSelectable:ln=!0,defaultViewport:Et=xf,minZoom:Oe=.5,maxZoom:tt=2,translateExtent:io=ft,preventScrolling:as=!0,nodeExtent:un,defaultMarkerColor:cs="#b1b1b7",zoomOnScroll:ls=!0,zoomOnPinch:us=!0,panOnScroll:ds=!1,panOnScrollSpeed:fs=.5,panOnScrollMode:hs=Te.Free,zoomOnDoubleClick:gs=!0,panOnDrag:ps=!0,onPaneClick:ms,onPaneMouseEnter:ys,onPaneMouseMove:xs,onPaneMouseLeave:ws,onPaneScroll:vs,onPaneContextMenu:_s,paneClickDistance:bs=1,nodeClickDistance:Es=0,children:Ss,onReconnect:Ns,onReconnectStart:Cs,onReconnectEnd:Ms,onEdgeContextMenu:Is,onEdgeDoubleClick:ks,onEdgeMouseEnter:As,onEdgeMouseMove:Ps,onEdgeMouseLeave:$s,reconnectRadius:Ds=10,onNodesChange:Ts,onEdgesChange:zs,noDragClassName:Rs="nodrag",noWheelClassName:Hs="nowheel",noPanClassName:so="nopan",fitView:ao,fitViewOptions:co,connectOnClick:Ls,attributionPosition:Os,proOptions:Vs,defaultEdgeOptions:Bs,elevateNodesOnSelect:Fs=!0,elevateEdgesOnSelect:js=!1,disableKeyboardA11y:lo=!1,autoPanOnConnect:Xs,autoPanOnNodeDrag:Ys,autoPanSpeed:Zs,connectionRadius:Ws,isValidConnection:qs,onError:Gs,style:Us,id:uo,nodeDragThreshold:Ks,connectionDragThreshold:Qs,viewport:Js,onViewportChange:ea,width:ta,height:na,colorMode:oa="light",debug:ra,onScroll:fo,ariaLabelConfig:ia,zIndexMode:ho="basic",...sa},aa){const dn=uo||"1",ca=bf(oa),la=z.useCallback(go=>{go.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),fo?.(go)},[fo]);return A.jsx("div",{"data-testid":"rf__wrapper",...sa,onScroll:la,style:{...Us,...Yh},ref:aa,className:ie(["react-flow",r,ca]),id:uo,role:"application",children:A.jsxs(Xh,{nodes:e,edges:t,width:ta,height:na,fitView:ao,fitViewOptions:co,minZoom:Oe,maxZoom:tt,nodeOrigin:Qe,nodeExtent:un,zIndexMode:ho,children:[A.jsx(Bh,{onInit:a,onNodeClick:c,onEdgeClick:l,onNodeMouseEnter:_,onNodeMouseMove:h,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:b,nodeTypes:i,edgeTypes:s,connectionLineType:L,connectionLineStyle:j,connectionLineComponent:F,connectionLineContainerStyle:W,selectionKeyCode:Z,selectionOnDrag:B,selectionMode:X,deleteKeyCode:U,multiSelectionKeyCode:K,panActivationKeyCode:Q,zoomActivationKeyCode:q,onlyRenderVisibleElements:ne,defaultViewport:Et,translateExtent:io,minZoom:Oe,maxZoom:tt,preventScrolling:as,zoomOnScroll:ls,zoomOnPinch:us,zoomOnDoubleClick:gs,panOnScroll:ds,panOnScrollSpeed:fs,panOnScrollMode:hs,panOnDrag:ps,onPaneClick:ms,onPaneMouseEnter:ys,onPaneMouseMove:xs,onPaneMouseLeave:ws,onPaneScroll:vs,onPaneContextMenu:_s,paneClickDistance:bs,nodeClickDistance:Es,onSelectionContextMenu:I,onSelectionStart:M,onSelectionEnd:P,onReconnect:Ns,onReconnectStart:Cs,onReconnectEnd:Ms,onEdgeContextMenu:Is,onEdgeDoubleClick:ks,onEdgeMouseEnter:As,onEdgeMouseMove:Ps,onEdgeMouseLeave:$s,reconnectRadius:Ds,defaultMarkerColor:cs,noDragClassName:Rs,noWheelClassName:Hs,noPanClassName:so,rfId:dn,disableKeyboardA11y:lo,nodeExtent:un,viewport:Js,onViewportChange:ea}),A.jsx(_f,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:g,onConnectStart:p,onConnectEnd:x,onClickConnectStart:w,onClickConnectEnd:m,nodesDraggable:se,autoPanOnNodeFocus:Ne,nodesConnectable:ve,nodesFocusable:Ae,edgesFocusable:Je,edgesReconnectable:et,elementsSelectable:ln,elevateNodesOnSelect:Fs,elevateEdgesOnSelect:js,minZoom:Oe,maxZoom:tt,nodeExtent:un,onNodesChange:Ts,onEdgesChange:zs,snapToGrid:G,snapGrid:ee,connectionMode:O,translateExtent:io,connectOnClick:Ls,defaultEdgeOptions:Bs,fitView:ao,fitViewOptions:co,onNodesDelete:V,onEdgesDelete:k,onDelete:T,onNodeDragStart:N,onNodeDrag:$,onNodeDragStop:D,onSelectionDrag:C,onSelectionDragStart:v,onSelectionDragStop:E,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:so,nodeOrigin:Qe,rfId:dn,autoPanOnConnect:Xs,autoPanOnNodeDrag:Ys,autoPanSpeed:Zs,onError:Gs,connectionRadius:Ws,isValidConnection:qs,selectNodesOnDrag:te,nodeDragThreshold:Ks,connectionDragThreshold:Qs,onBeforeDelete:R,debug:ra,ariaLabelConfig:ia,zIndexMode:ho}),A.jsx(yf,{onSelectionChange:H}),Ss,A.jsx(ff,{proOptions:Vs,position:Os}),A.jsx(df,{rfId:dn,disableKeyboardA11y:lo})]})})}var wg=Ti(Zh);function Wh({dimensions:e,lineWidth:t,variant:n,className:o}){return A.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ie(["react-flow__background-pattern",n,o])})}function qh({radius:e,className:t}){return A.jsx("circle",{cx:e,cy:e,r:e,className:ie(["react-flow__background-pattern","dots",t])})}var ke;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ke||(ke={}));const Gh={[ke.Dots]:1,[ke.Lines]:1,[ke.Cross]:6},Uh=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function rs({id:e,variant:t=ke.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:c,style:l,className:a,patternClassName:u}){const d=z.useRef(null),{transform:f,patternId:g}=J(Uh,oe),p=o||Gh[t],x=t===ke.Dots,w=t===ke.Cross,m=Array.isArray(n)?n:[n,n],_=[m[0]*f[2]||1,m[1]*f[2]||1],h=p*f[2],y=Array.isArray(i)?i:[i,i],S=w?[h,h]:_,b=[y[0]*f[2]||1+S[0]/2,y[1]*f[2]||1+S[1]/2],N=`${g}${e||""}`;return A.jsxs("svg",{className:ie(["react-flow__background",a]),style:{...l,...an,"--xy-background-color-props":c,"--xy-background-pattern-color-props":s},ref:d,"data-testid":"rf__background",children:[A.jsx("pattern",{id:N,x:f[0]%_[0],y:f[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${b[0]},-${b[1]})`,children:x?A.jsx(qh,{radius:h/2,className:u}):A.jsx(Wh,{dimensions:S,lineWidth:r,variant:t,className:u})}),A.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}rs.displayName="Background";const vg=z.memo(rs);function Kh(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:A.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Qh(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:A.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Jh(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:A.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function eg(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:A.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function tg(){return A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:A.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function $t({children:e,className:t,...n}){return A.jsx("button",{type:"button",className:ie(["react-flow__controls-button",t]),...n,children:e})}const ng=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function is({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:c,onInteractiveChange:l,className:a,children:u,position:d="bottom-left",orientation:f="vertical","aria-label":g}){const p=re(),{isInteractive:x,minZoomReached:w,maxZoomReached:m,ariaLabelConfig:_}=J(ng,oe),{zoomIn:h,zoomOut:y,fitView:S}=oo(),b=()=>{h(),i?.()},N=()=>{y(),s?.()},$=()=>{S(r),c?.()},D=()=>{p.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),l?.(!x)},V=f==="horizontal"?"horizontal":"vertical";return A.jsxs(sn,{className:ie(["react-flow__controls",V,a]),position:d,style:e,"data-testid":"rf__controls","aria-label":g??_["controls.ariaLabel"],children:[t&&A.jsxs(A.Fragment,{children:[A.jsx($t,{onClick:b,className:"react-flow__controls-zoomin",title:_["controls.zoomIn.ariaLabel"],"aria-label":_["controls.zoomIn.ariaLabel"],disabled:m,children:A.jsx(Kh,{})}),A.jsx($t,{onClick:N,className:"react-flow__controls-zoomout",title:_["controls.zoomOut.ariaLabel"],"aria-label":_["controls.zoomOut.ariaLabel"],disabled:w,children:A.jsx(Qh,{})})]}),n&&A.jsx($t,{className:"react-flow__controls-fitview",onClick:$,title:_["controls.fitView.ariaLabel"],"aria-label":_["controls.fitView.ariaLabel"],children:A.jsx(Jh,{})}),o&&A.jsx($t,{className:"react-flow__controls-interactive",onClick:D,title:_["controls.interactive.ariaLabel"],"aria-label":_["controls.interactive.ariaLabel"],children:x?A.jsx(tg,{}):A.jsx(eg,{})}),u]})}is.displayName="Controls";const _g=z.memo(is);function og({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:c,strokeWidth:l,className:a,borderRadius:u,shapeRendering:d,selected:f,onClick:g}){const{background:p,backgroundColor:x}=i||{},w=s||p||x;return A.jsx("rect",{className:ie(["react-flow__minimap-node",{selected:f},a]),x:t,y:n,rx:u,ry:u,width:o,height:r,style:{fill:w,stroke:c,strokeWidth:l},shapeRendering:d,onClick:g?m=>g(m,e):void 0})}const rg=z.memo(og),ig=e=>e.nodes.map(t=>t.id),Nn=e=>e instanceof Function?e:()=>e;function sg({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=rg,onClick:s}){const c=J(ig,oe),l=Nn(t),a=Nn(e),u=Nn(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return A.jsx(A.Fragment,{children:c.map(f=>A.jsx(cg,{id:f,nodeColorFunc:l,nodeStrokeColorFunc:a,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:d},f))})}function ag({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:c,onClick:l}){const{node:a,x:u,y:d,width:f,height:g}=J(p=>{const{internals:x}=p.nodeLookup.get(e),w=x.userNode,{x:m,y:_}=x.positionAbsolute,{width:h,height:y}=Se(w);return{node:w,x:m,y:_,width:h,height:y}},oe);return!a||a.hidden||!ci(a)?null:A.jsx(c,{x:u,y:d,width:f,height:g,style:a.style,selected:!!a.selected,className:o(a),color:t(a),borderRadius:r,strokeColor:n(a),strokeWidth:i,shapeRendering:s,onClick:l,id:a.id})}const cg=z.memo(ag);var lg=z.memo(sg);const ug=200,dg=150,fg=e=>!e.hidden,hg=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?ai(vt(e.nodeLookup,{filter:fg}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},gg="react-flow__minimap-desc";function ss({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:c,bgColor:l,maskColor:a,maskStrokeColor:u,maskStrokeWidth:d,position:f="bottom-right",onClick:g,onNodeClick:p,pannable:x=!1,zoomable:w=!1,ariaLabel:m,inversePan:_,zoomStep:h=1,offsetScale:y=5}){const S=re(),b=z.useRef(null),{boundingRect:N,viewBB:$,rfId:D,panZoom:V,translateExtent:k,flowWidth:T,flowHeight:H,ariaLabelConfig:v}=J(hg,oe),C=e?.width??ug,E=e?.height??dg,I=N.width/C,M=N.height/E,P=Math.max(I,M),R=P*C,O=P*E,L=y*P,j=N.x-(R-N.width)/2-L,F=N.y-(O-N.height)/2-L,W=R+L*2,U=O+L*2,Z=`${gg}-${D}`,B=z.useRef(0),X=z.useRef();B.current=P,z.useEffect(()=>{if(b.current&&V)return X.current=Pd({domNode:b.current,panZoom:V,getTransform:()=>S.getState().transform,getViewScale:()=>B.current}),()=>{X.current?.destroy()}},[V]),z.useEffect(()=>{X.current?.update({translateExtent:k,width:T,height:H,inversePan:_,pannable:x,zoomStep:h,zoomable:w})},[x,w,_,h,k,T,H]);const Q=g?G=>{const[ee,ne]=X.current?.pointer(G)||[0,0];g(G,{x:ee,y:ne})}:void 0,K=p?z.useCallback((G,ee)=>{const ne=S.getState().nodeLookup.get(ee).internals.userNode;p(G,ne)},[]):void 0,q=m??v["minimap.ariaLabel"];return A.jsx(sn,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof a=="string"?a:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*P:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ie(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:A.jsxs("svg",{width:C,height:E,viewBox:`${j} ${F} ${W} ${U}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:b,onClick:Q,children:[q&&A.jsx("title",{id:Z,children:q}),A.jsx(lg,{onClick:K,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:c}),A.jsx("path",{className:"react-flow__minimap-mask",d:`M${j-L},${F-L}h${W+L*2}v${U+L*2}h${-W-L*2}z
|
|
7
|
+
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ss.displayName="MiniMap";const bg=z.memo(ss),pg=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,mg={[Ke.Line]:"right",[Ke.Handle]:"bottom-right"};function yg({nodeId:e,position:t,variant:n=Ke.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:c=10,minHeight:l=10,maxWidth:a=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:g=!0,shouldResize:p,onResizeStart:x,onResize:w,onResizeEnd:m}){const _=Li(),h=typeof e=="string"?e:_,y=re(),S=z.useRef(null),b=n===Ke.Handle,N=J(z.useCallback(pg(b&&g),[b,g]),oe),$=z.useRef(null),D=t??mg[n];z.useEffect(()=>{if(!(!S.current||!h))return $.current||($.current=Yd({domNode:S.current,nodeId:h,getStoreItems:()=>{const{nodeLookup:k,transform:T,snapGrid:H,snapToGrid:v,nodeOrigin:C,domNode:E}=y.getState();return{nodeLookup:k,transform:T,snapGrid:H,snapToGrid:v,nodeOrigin:C,paneDomNode:E}},onChange:(k,T)=>{const{triggerNodeChanges:H,nodeLookup:v,parentLookup:C,nodeOrigin:E}=y.getState(),I=[],M={x:k.x,y:k.y},P=v.get(h);if(P&&P.expandParent&&P.parentId){const R=P.origin??E,O=k.width??P.measured.width??0,L=k.height??P.measured.height??0,j={id:P.id,parentId:P.parentId,rect:{width:O,height:L,...li({x:k.x??P.position.x,y:k.y??P.position.y},{width:O,height:L},P.parentId,v,R)}},F=no([j],v,C,E);I.push(...F),M.x=k.x?Math.max(R[0]*O,k.x):void 0,M.y=k.y?Math.max(R[1]*L,k.y):void 0}if(M.x!==void 0&&M.y!==void 0){const R={id:h,type:"position",position:{...M}};I.push(R)}if(k.width!==void 0&&k.height!==void 0){const O={id:h,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:k.width,height:k.height}};I.push(O)}for(const R of T){const O={...R,type:"position"};I.push(O)}H(I)},onEnd:({width:k,height:T})=>{const H={id:h,type:"dimensions",resizing:!1,dimensions:{width:k,height:T}};y.getState().triggerNodeChanges([H])}})),$.current.update({controlPosition:D,boundaries:{minWidth:c,minHeight:l,maxWidth:a,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:x,onResize:w,onResizeEnd:m,shouldResize:p}),()=>{$.current?.destroy()}},[D,c,l,a,u,d,x,w,m,p]);const V=D.split("-");return A.jsx("div",{className:ie(["react-flow__resize-control","nodrag",...V,n,o]),ref:S,style:{...r,scale:N,...s&&{[b?"backgroundColor":"borderColor"]:s}},children:i})}z.memo(yg);export{vg as B,_g as C,qt as H,bg as M,Y as P,sn as a,zn as g,wg as i,ha as r};
|